agent: add preliminary plugin support#296617
Conversation
Supports Copilot-style and the almost identical Claude-style plugins. In this PR we support skills, commands, and prompts. There is also a "browse" experience, based on the same registries that Copilot CLI comes with out of the box, but there is not yet an "Install" experience. Demo: https://memes.peet.io/img/26-02-6b29afc1-c3df-4f32-8364-c5307c35d43a.mp4
There was a problem hiding this comment.
Pull request overview
This PR adds preliminary plugin support to VS Code's chat functionality, implementing Copilot-style and Claude-style plugin infrastructure. The changes enable plugins to contribute skills, commands, prompts, and MCP server definitions through a filesystem-based discovery mechanism.
Changes:
- Adds new plugin service infrastructure (
IAgentPluginService) for discovering and managing plugins from configured directories - Implements plugin marketplace browsing functionality that fetches plugin metadata from GitHub repositories
- Integrates plugins with the existing prompts system, allowing plugin commands and skills to appear as slash commands
- Updates slash command validation and completion regex patterns to support colons (
:) in command names for namespaced plugin commands - Adds MCP discovery adapter to expose plugin-defined MCP servers to the MCP registry
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| agentPluginService.ts | Interface definitions for plugin service, discovery, and plugin data structures |
| agentPluginServiceImpl.ts | Implementation of plugin discovery from configured filesystem paths with file watching |
| pluginMarketplaceService.ts | Service to fetch plugin metadata from GitHub marketplace repositories |
| pluginMcpDiscovery.ts | Adapter to register MCP servers defined in plugins to the MCP registry |
| promptsServiceImpl.ts | Integration of plugin commands/skills into the prompts system; refactored cache invalidation logic |
| promptsService.ts | Added optional name and description fields to IPromptFileResource interface |
| chatInputCompletions.ts | Updated regex patterns to support colons in slash command names |
| chat.contribution.ts | Registered new services and configuration settings |
| chatPluginActions.ts | UI actions for managing plugins (enable/disable, browse marketplace, add from folder) |
| constants.ts | Added configuration keys for plugin paths and marketplaces |
| mcp.contribution.ts | Registered plugin MCP discovery in the MCP discovery registry |
Comments suppressed due to low confidence (6)
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts:294
- There is a potential inconsistency between the validation regex and the completion regex. The validation pattern in
isValidSlashCommandNameuses\p{L}to match Unicode letters, but the completion patterns usea-zwhich only matches ASCII letters. This means users might be able to type slash commands with Unicode letters (which would pass validation) but those commands won't be properly matched by the completion regex. Consider changing the completion pattern to use(@|\\/)[\\p{L}0-9_.:-]*to match the validation pattern.
const range = computeCompletionRanges(model, position, /\/[a-z0-9_.:-]*/gi);
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts:435
- There is a potential inconsistency between the validation regex and the completion regex. The validation pattern in
isValidSlashCommandNameuses\p{L}to match Unicode letters, but the completion patterns usea-zwhich only matches ASCII letters. This means users might be able to type slash commands with Unicode letters (which would pass validation) but those commands won't be properly matched by the completion regex. Consider changing the completion pattern to use(@|\\/)[\\p{L}0-9_.:-]*to match the validation pattern.
const range = computeCompletionRanges(model, position, /(@|\/)[a-z0-9_.:-]*/gi);
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts:502
- There is a potential inconsistency between the validation regex and the completion regex. The validation pattern in
isValidSlashCommandNameuses\p{L}to match Unicode letters, but the completion patterns usea-zwhich only matches ASCII letters. This means users might be able to type slash commands with Unicode letters (which would pass validation) but those commands won't be properly matched by the completion regex. Consider changing the completion pattern to use(@|\\/)[\\p{L}0-9_.:-]*to match the validation pattern.
const range = computeCompletionRanges(model, position, /(@|\/)[a-z0-9_.:-]*/gi);
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts:86
- There is a potential inconsistency between the validation regex and the completion regex. The validation pattern in
isValidSlashCommandNameuses\p{L}to match Unicode letters, but the completion patterns usea-zwhich only matches ASCII letters. This means users might be able to type slash commands with Unicode letters (which would pass validation) but those commands won't be properly matched by the completion regex. Consider changing the completion pattern to use[\\p{L}0-9_.:-]*to match the validation pattern.
const range = computeCompletionRanges(model, position, /\/[a-z0-9_.:-]*/gi);
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts:335
- There is a potential inconsistency between the validation regex and the completion regex. The validation pattern in
isValidSlashCommandNameuses\p{L}to match Unicode letters, but the completion patterns usea-zwhich only matches ASCII letters. This means users might be able to type slash commands with Unicode letters (which would pass validation) but those commands won't be properly matched by the completion regex. Consider changing the completion pattern to use(@|\\/)[\\p{L}0-9_.:-]*to match the validation pattern.
const range = computeCompletionRanges(model, position, /(@|\/)[a-z0-9_.:-]*/gi);
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts:555
- There is a potential inconsistency between the validation regex and the completion regex. The validation pattern in
isValidSlashCommandNameuses\p{L}to match Unicode letters, but the completion patterns usea-zwhich only matches ASCII letters. This means users might be able to type slash commands with Unicode letters (which would pass validation) but those commands won't be properly matched by this check. Consider changing the pattern to use\\/[\\p{L}0-9_.:-]*to match the validation pattern.
if (!(partAfterAgent instanceof ChatRequestTextPart) || !partAfterAgent.text.trim().match(/^(\/[a-z0-9_.:-]*)?$/i)) {
Supports Copilot-style and the almost identical Claude-style plugins.
In this PR we support skills, commands, and prompts.
There is also a "browse" experience, based on the same registries that
Copilot CLI comes with out of the box, but there is not yet an "Install"
experience.
Demo: https://memes.peet.io/img/26-02-6b29afc1-c3df-4f32-8364-c5307c35d43a.mp4