-
Notifications
You must be signed in to change notification settings - Fork 37.5k
Custom chat render for agent skills #286656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,12 @@ export class PromptsService extends Disposable implements IPromptsService { | |
| [PromptsType.agent]: new ResourceMap<Promise<IExtensionPromptPath>>(), | ||
| }; | ||
|
|
||
| /** | ||
| * Cached skills keyed by URI for synchronous lookup. | ||
| * Updated whenever findAgentSkills is called. | ||
| */ | ||
| private readonly cachedSkillsByUri = new ResourceMap<IAgentSkill>(); | ||
|
|
||
| constructor( | ||
| @ILogService public readonly logger: ILogService, | ||
| @ILabelService private readonly labelService: ILabelService, | ||
|
|
@@ -705,10 +711,20 @@ export class PromptsService extends Disposable implements IPromptsService { | |
| skippedParseFailed | ||
| }); | ||
|
|
||
| // Update the cached skills map for synchronous lookup | ||
| this.cachedSkillsByUri.clear(); | ||
| for (const skill of result) { | ||
| this.cachedSkillsByUri.set(skill.uri, skill); | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| public getSkillByUri(uri: URI): IAgentSkill | undefined { | ||
| return this.cachedSkillsByUri.get(uri); | ||
| } | ||
|
Comment on lines
+725
to
+727
|
||
| } | ||
|
|
||
| // helpers | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache is only populated when findAgentSkills is called, but there's no mechanism to invalidate or refresh the cache when skill files change. If a skill file is added, removed, or modified after findAgentSkills is initially called, getSkillByUri will continue returning stale data. Consider adding file watchers to invalidate the cache when skill files change, or implementing a cache refresh mechanism similar to how cachedCustomAgents.refresh() works for custom agents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: I think we should support skills as a promptType and leverage the existing watcher mechanisms there?