promptsServiceImpl.ts ×8

Frontier kind: Code frontier

unlabeled · c_de9a25126b07

25 tests · 67649 LOC · 326 files · introduces 0 tests · 112 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges112 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
6471 ranges67649 lines · 326 files · Browse complete extent
All tests (intent)
25 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: 112 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

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

Open complete file

913 return undefined;
914 }
916 > const discoveryInfo = await this.cachedSkills.get(token);
917 > const result = this.skillsFromDiscoveryInfo(discoveryInfo);
918 > return result;
919 }
920
923 */
924 private skillsFromDiscoveryInfo(discoveryInfo: IPromptDiscoveryInfo): IAgentSkill[] {
925 > const result: IAgentSkill[] = []; promptsServiceImpl.ts
926 > for (const file of discoveryInfo.files) {
927 if (file.status === 'loaded' && file.promptPath.name) {
928 const sanitizedDescription = this.truncateAgentSkillDescription(file.promptPath.description, file.promptPath.uri);
948 */
949 private async computeSkillDiscovery(token: CancellationToken): Promise<IPromptDiscoveryInfo> {
950 > const stopWatch = StopWatch.create(true); promptsServiceImpl.ts
951 > const files = await this.computeSkillDiscoveryInfo(token);
952 > const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.skill);
953 >
954 > // Count by source for telemetry
955 > const skillsBySource = new Map<PromptFileSource, number>();
956 > for (const file of files) {
957 if (file.status === 'loaded' && file.promptPath.name) {
958 const source = file.promptPath.source;
962 }
963 }
965 > // Count skip reasons for telemetry
966 > let skippedMissingName = 0;
967 > let skippedMissingDescription = 0;
968 > let skippedDuplicateName = 0;
969 > let skippedParseFailed = 0;
970 > let skippedNameMismatch = 0;
971 > for (const file of files) {
972 if (file.status === 'skipped') {
973 switch (file.skipReason) {
980 }
981 }
983 > // Send telemetry about skill usage
984 > type AgentSkillsFoundEvent = {
985 > totalSkillsFound: number;
986 > claudePersonal: number;
987 > claudeWorkspace: number;
988 > copilotPersonal: number;
989 > githubWorkspace: number;
990 > agentsPersonal: number;
991 > agentsWorkspace: number;
992 > configPersonal: number;
993 > configWorkspace: number;
994 > extensionContribution: number;
995 > extensionAPI: number;
996 > plugin: number;
997 > skippedDuplicateName: number;
998 > skippedMissingName: number;
999 > skippedMissingDescription: number;
1000 > skippedNameMismatch: number;
1001 > skippedParseFailed: number;
1002 > };
1003 >
1004 > type AgentSkillsFoundClassification = {
1005 > totalSkillsFound: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Total number of agent skills found.' };
1006 > claudePersonal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of Claude personal skills.' };
1007 > claudeWorkspace: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of Claude workspace skills.' };
1008 > copilotPersonal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of Copilot personal skills.' };
1009 > githubWorkspace: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of GitHub workspace skills.' };
1010 > agentsPersonal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of .agents personal skills.' };
1011 > agentsWorkspace: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of .agents workspace skills.' };
1012 > configPersonal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of custom configured personal skills.' };
1013 > configWorkspace: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of custom configured workspace skills.' };
1014 > extensionContribution: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of extension contributed skills.' };
1015 > extensionAPI: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of extension API provided skills.' };
1016 > plugin: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of plugin provided skills.' };
1017 > skippedDuplicateName: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of skills skipped due to duplicate names.' };
1018 > skippedMissingName: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of skills skipped due to missing name attribute.' };
1019 > skippedMissingDescription: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of skills skipped due to missing description attribute.' };
1020 > skippedNameMismatch: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of skills skipped due to name not matching folder name.' };
1021 > skippedParseFailed: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of skills skipped due to parse failures.' };
1022 > owner: 'pwang347';
1023 > comment: 'Tracks agent skill usage, discovery, and skipped files.';
1024 > };
1025 >
1026 > const totalSkillsFound = files.filter(f => f.status === 'loaded' && f.promptPath.name).length;
1027 > this.telemetryService.publicLog2<AgentSkillsFoundEvent, AgentSkillsFoundClassification>('agentSkillsFound', {
1028 > totalSkillsFound,
1029 > claudePersonal: skillsBySource.get(PromptFileSource.ClaudePersonal) ?? 0,
1030 > claudeWorkspace: skillsBySource.get(PromptFileSource.ClaudeWorkspace) ?? 0,
1031 > copilotPersonal: skillsBySource.get(PromptFileSource.CopilotPersonal) ?? 0,
1032 > githubWorkspace: skillsBySource.get(PromptFileSource.GitHubWorkspace) ?? 0,
1033 > agentsPersonal: skillsBySource.get(PromptFileSource.AgentsPersonal) ?? 0,
1034 > agentsWorkspace: skillsBySource.get(PromptFileSource.AgentsWorkspace) ?? 0,
1035 > configWorkspace: skillsBySource.get(PromptFileSource.ConfigWorkspace) ?? 0,
1036 > configPersonal: skillsBySource.get(PromptFileSource.ConfigPersonal) ?? 0,
1037 > extensionContribution: skillsBySource.get(PromptFileSource.ExtensionContribution) ?? 0,
1038 > extensionAPI: skillsBySource.get(PromptFileSource.ExtensionAPI) ?? 0,
1039 > plugin: skillsBySource.get(PromptFileSource.Plugin) ?? 0,
1040 > skippedDuplicateName,
1041 > skippedMissingName,
1042 > skippedMissingDescription,
1043 > skippedNameMismatch,
1044 > skippedParseFailed
1045 > });
1046 >
1047 > return { type: PromptsType.skill, files, sourceFolders, durationInMillis: stopWatch.elapsed() };
1048 > }
1049
1050 public async getHooks(token: CancellationToken): Promise<IConfiguredHooksInfo | undefined> {
1332 */
1333 private async computeSkillDiscoveryInfo(token: CancellationToken): Promise<IPromptFileDiscoveryResult[]> {
1334 > const files: IPromptFileDiscoveryResult[] = []; promptsServiceImpl.ts
1335 > const seenNames = new Set<string>();
1336 > const nameToUri = new Map<string, URI>();
1337 >
1338 > // Collect all skills with their metadata for sorting
1339 > const allSkills: Array<IPromptPath> = [];
1340 > const skills = await Promise.all([
1341 > this.fileLocator.findAgentSkills(token),
1342 > this.getExtensionPromptFiles(PromptsType.skill, token),
1343 > Promise.resolve(this._pluginPromptFilesByType.get(PromptsType.skill) ?? []),
1344 > this.getBuiltinPromptFiles(PromptsType.skill, token)
1345 > ]);
1346 > for (const skillList of skills) {
1347 > allSkills.push(...skillList);
1348 > }
1349 > // Stable sort; we should keep order consistent to the order in the user's configuration object
1350 > allSkills.sort((a, b) => this.getSkillPriority(a) - this.getSkillPriority(b));
1351 >
1352 > for (const skill of allSkills) {
1353 const uri = skill.uri;
1354 const promptPath = skill;
1394 }
1395 }
1397 > return files;
1398 > }
1399
1400 private async getInstructionsDiscoveryInfo(token: CancellationToken): Promise<IInstructionDiscoveryInfo> {