promptsServiceImpl.ts ×15

Frontier kind: Code frontier

unlabeled · c_355ac77c614c

22 tests · 69247 LOC · 326 files · introduces 0 tests · 59 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges59 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
7010 ranges69247 lines · 326 files · Browse complete extent
All tests (intent)
22 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 59 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts 59 introduced LOC · 15 ranges

Open complete file

867
868 private sanitizeAgentSkillText(text: string): string {
869 > // Remove XML tags promptsServiceImpl.ts
870 > return text.replace(/<[^>]+>/g, '');
871 > }
872
873 private truncateAgentSkillName(name: string, uri: URI): string {
874 > const MAX_NAME_LENGTH = 64; promptsServiceImpl.ts
875 > const sanitized = this.sanitizeAgentSkillText(name);
876 > if (sanitized !== name) {
877 this.logger.debug(`[findAgentSkills] Agent skill name contains XML tags, removed: ${uri}`);
878 }
879 > if (sanitized.length > MAX_NAME_LENGTH) { promptsServiceImpl.ts
880 this.logger.debug(`[findAgentSkills] Agent skill name exceeds ${MAX_NAME_LENGTH} characters, truncated: ${uri}`);
881 return sanitized.substring(0, MAX_NAME_LENGTH);
882 }
883 return sanitized;
885
886 private truncateAgentSkillDescription(description: string | undefined, uri: URI): string | undefined {
887 > if (!description) { promptsServiceImpl.ts
888 return undefined;
889 }
898 }
899 return sanitized;
901
902 public get onDidChangeSkills(): Event<void> {
925 const result: IAgentSkill[] = [];
926 for (const file of discoveryInfo.files) {
927 > if (file.status === 'loaded' && file.promptPath.name) { promptsServiceImpl.ts
928 > const sanitizedDescription = this.truncateAgentSkillDescription(file.promptPath.description, file.promptPath.uri);
929 > result.push({
930 > uri: file.promptPath.uri,
931 > storage: file.promptPath.storage,
932 > name: file.promptPath.name,
933 > description: sanitizedDescription,
934 > disableModelInvocation: file.disableModelInvocation ?? false,
935 > userInvocable: file.userInvocable ?? true,
936 > pluginUri: file.promptPath.pluginUri,
937 > pluginLabel: file.promptPath.pluginLabel,
938 > extension: file.promptPath.extension,
939 > sessionTypes: file.promptPath.sessionTypes,
940 > });
941 > }
942 > }
943 return result;
944 }
955 const skillsBySource = new Map<PromptFileSource, number>();
956 for (const file of files) {
957 > if (file.status === 'loaded' && file.promptPath.name) { promptsServiceImpl.ts
958 > const source = file.promptPath.source;
959 > if (source) {
960 > skillsBySource.set(source, (skillsBySource.get(source) || 0) + 1);
961 > }
962 > }
963 > }
964
965 // Count skip reasons for telemetry
970 let skippedNameMismatch = 0;
971 for (const file of files) {
972 > if (file.status === 'skipped') { promptsServiceImpl.ts
973 switch (file.skipReason) {
974 case 'missing-name': skippedMissingName++; break;
1351
1352 for (const skill of allSkills) {
1353 > const uri = skill.uri; promptsServiceImpl.ts
1354 > const promptPath = skill;
1355 >
1356 > try {
1357 > const parsedFile = await this.parseNew(uri, token);
1358 > const folderName = getSkillFolderName(uri);
1359 >
1360 > let name = parsedFile.header?.name;
1361 > const description = parsedFile.header?.description;
1362 >
1363 > if (!name) {
1364 this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill file missing name attribute, using folder name "${folderName}": ${uri}`);
1365 name = folderName;
1366 }
1367 > let sanitizedName = this.truncateAgentSkillName(name, uri); promptsServiceImpl.ts
1368 > if (sanitizedName !== folderName) {
1369 this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill name "${sanitizedName}" does not match folder name "${folderName}", using folder name: ${uri}`);
1370 sanitizedName = folderName;
1371 }
1373 > if (seenNames.has(sanitizedName)) {
1374 this.logger.debug(`[computeSkillDiscoveryInfo] Skipping duplicate agent skill name: ${sanitizedName} at ${uri}`);
1375 files.push({ status: 'skipped', skipReason: 'duplicate-name', duplicateOf: nameToUri.get(sanitizedName), promptPath: this.withPromptPathMetadata(promptPath, sanitizedName, description) });
1376 continue;
1377 }
1379 > seenNames.add(sanitizedName);
1380 > nameToUri.set(sanitizedName, uri);
1381 > const disableModelInvocation = parsedFile.header?.disableModelInvocation === true;
1382 > const userInvocable = parsedFile.header?.userInvocable !== false;
1383 >
1384 > files.push({ status: 'loaded', promptPath: this.withPromptPathMetadata(promptPath, sanitizedName, description), disableModelInvocation, userInvocable });
1385 > } catch (e) {
1386 const msg = e instanceof Error ? e.message : String(e);
1387 this.logger.error(`[computeSkillDiscoveryInfo] Failed to validate Agent skill file: ${uri}`, msg);