chat: replace chatSessionCustomizations with chatSessionCustomizationProvider API#303017
chat: replace chatSessionCustomizations with chatSessionCustomizationProvider API#303017joshspicer merged 16 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new proposed extension API to let extensions register “customization providers” that supply items directly to the AI Customizations UI, wiring the provider through ExtHost ↔ MainThread and registering it as an external harness in the customization harness service.
Changes:
- Introduces proposed API
chat.registerCustomizationProviderplus related DTO/protocol plumbing. - ExtHost/MainThread implementations register providers, forward change events, and fetch provider items over RPC.
- Updates the AI Customizations list widget to refresh on dynamic harness changes and delegate item listing to the active harness’ external provider.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatCustomizationProvider.d.ts | New proposed API surface for registering customization providers and reporting items/metadata. |
| src/vs/workbench/contrib/chat/test/common/customizationHarnessService.test.ts | New unit tests for external harness registration lifecycle and workspace-subpath matching. |
| src/vs/workbench/contrib/chat/common/customizationHarnessService.ts | Adds external item/provider types and registerExternalHarness, and widens harness ids to strings. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts | Refreshes on dynamic harness changes and delegates listing to itemProvider when present. |
| src/vs/workbench/api/common/extHostTypes.ts | Adds ChatCustomizationType enum to the ExtHost API surface. |
| src/vs/workbench/api/common/extHostTypeConverters.ts | Converts ChatCustomizationType to internal PromptsType strings for RPC. |
| src/vs/workbench/api/common/extHostChatAgents2.ts | Implements provider registration, change forwarding, and $provideCustomizations. |
| src/vs/workbench/api/common/extHost.protocol.ts | Adds protocol DTOs and RPC methods for customization providers. |
| src/vs/workbench/api/common/extHost.api.impl.ts | Wires chat.registerCustomizationProvider into the extension API factory. |
| src/vs/workbench/api/browser/mainThreadChatAgents2.ts | Registers external harnesses backed by ExtHost providers and forwards change events to the UI. |
You can also share your feedback on Copilot code review. Take the survey.
chat.registerCustomizationProvider extension API4fb704c to
09a7352
Compare
Introduces a new proposed extension API (chatCustomizationProvider) that enables extensions to register as customization providers for the AI Customization UI. This replaces core-based harness filtering with extension-driven discovery. Key changes: - New proposed API: vscode.proposed.chatCustomizationProvider.d.ts - ChatCustomizationProvider, ChatCustomizationItem, ChatCustomizationType - chat.registerCustomizationProvider(id, metadata, provider) - ExtHost/MainThread RPC bridge for provider registration - ICustomizationHarnessService extended with registerExternalHarness() for dynamic harness registration from extensions - IHarnessDescriptor.itemProvider for extension-driven item discovery - AICustomizationListWidget falls through to provider when active harness has an itemProvider - Unit tests for dynamic harness registration and lifecycle The static CLI/Claude harness descriptors remain as fallback until extensions adopt the new API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Register chatCustomizationProvider in extensionsApiProposals.ts - Fix duplicate 'descriptor' variable in fetchItemsForSection - Add missing IExternalCustomizationItemProvider import Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Track availableHarnesses in autorun (not just activeHarness) - Add ensureHarnessDropdown() to lazily create/remove the dropdown when harnesses are dynamically registered/unregistered - Store sidebarContent and harnessDropdownContainer refs for dynamic dropdown management Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace ChatCustomizationType enum with TaskGroup-style class pattern (static instances with string-backed ids, extensible via constructor) - Rename provideCustomizations → provideChatCustomizations to match VS Code provider naming conventions - Add comprehensive JSDoc explaining customization lifecycle and caching semantics (cached until onDidChange fires) - Simplify type converter to use class id directly - Bump proposal version to 2 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Skip storage-based grouping for provider-backed items in the customization list widget. External providers manage their own items, so Workspace/User/Extension categories don't apply — render a flat sorted list instead. - Use AICustomizationManagementSection constants instead of hardcoded string literals in hiddenSections mapping. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
External provider items don't have a storage origin — the provider manages discovery, so Workspace/User/Extension categories don't apply. Make the storage field optional: - Provider items omit storage entirely (no fake PromptsStorage.local) - Context key overlay only sets storage key when present - Management editor falls back gracefully for provider items - Debug panel accepts optional storage - Built-in path (promptsService) is unchanged — items always have storage Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When the active harness has an external provider, the debug report now shows the provider's raw items grouped by type, with name, URI, and description for each item, plus a count of items matching the current section. The promptsService stages are skipped since they don't apply to provider-backed harnesses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… review Renames all types, methods, events, DTOs, and the proposal file to use the ChatSession prefix as requested in API review feedback. - ChatCustomizationType → ChatSessionCustomizationType - ChatCustomizationItem → ChatSessionCustomizationItem - ChatCustomizationProvider → ChatSessionCustomizationProvider - provideChatCustomizations → provideChatSessionCustomizations - onDidChangeChatCustomizations → onDidChangeChatSessionCustomizations - registerCustomizationProvider → registerChatSessionCustomizationProvider - Proposal: chatCustomizationProvider → chatSessionCustomizationProvider Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s API Remove the old group-based ChatSessionCustomizations API from the merged PR #304532, which is superseded by our new ChatSessionCustomizationProvider API. The old API used groups, storageLocation, and commands on the chatSessionsService path; the new API uses a flat item model on the customizationHarnessService path. Removed: - IChatSessionCustomizationItem/Group DTOs from extHost.protocol.ts - registerChatSessionCustomizationsProvider from extHostChatSessions.ts, mainThreadChatSessions.ts, extHost.api.impl.ts, chatSessionsProvider.d.ts - ChatSessionCustomizations converter namespace from extHostTypeConverters.ts - mapProviderItemToListItem and old group command fields from list widget Fixed: - registerContributedHarness → registerExternalHarness in fixtures and mainThreadChatSessions.ts - Missing AGENT_MD_FILENAME import in customizationHarnessService.ts - Constructor arg mismatch in browser customizationHarnessService.ts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…proposal Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rovider Aligns the parameter name with the chatSessions API convention. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…actions Extensions can now contribute create/add button actions to the customizations management editor via contributes.menus targeting 'AICustomizationManagementCreate'. Use the aiCustomizationManagementSection context key to scope commands to specific sections (agents, skills, etc.). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…on point Extensions contribute to 'chat/customizations/create' in package.json contributes.menus, gated by chatSessionCustomizationProvider proposal. Uses MenuId.for() to avoid cross-layer import. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add aiCustomizationManagementHarness context key set to the active harness ID. Extensions scope create menu contributions using 'when: aiCustomizationManagementHarness == myHarness'. When a harness has menu-contributed create actions, they fully replace the built-in create buttons for that section. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
29d4289 to
69aedcb
Compare
There was a problem hiding this comment.
Pull request overview
This PR replaces the previous group-based chatSessionCustomizations proposed API with a new flat-list chatSessionCustomizationProvider proposed API, and rewires the workbench “Chat Customizations” UI to consume extension-provided customization items via external harness descriptors.
Changes:
- Remove the old
registerChatSessionCustomizationsProviderAPI + deletedvscode.proposed.chatSessionCustomizations.d.ts; add newvscode.proposed.chatSessionCustomizationProvider.d.ts+ registration API. - Add ext host ↔ main thread plumbing for the new provider and register provider-backed harnesses via
ICustomizationHarnessService.registerExternalHarness. - Update the customizations UI to handle provider-backed items (flat list) and allow extensions to contribute “Create” actions via a new menu id + context key.
Reviewed changes
Copilot reviewed 20 out of 23 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts | Removes old customizations-provider registration from the chatSessionsProvider proposal. |
| src/vscode-dts/vscode.proposed.chatSessionCustomizations.d.ts | Deletes the old group-based customizations proposal types. |
| src/vscode-dts/vscode.proposed.chatSessionCustomizationProvider.d.ts | Adds the new flat-list customization provider proposal surface. |
| src/vs/workbench/test/browser/componentFixtures/aiCustomizationManagementEditor.fixture.ts | Updates fixture to new harness registration method name. |
| src/vs/workbench/test/browser/componentFixtures/aiCustomizationListWidget.fixture.ts | Updates fixture to new harness registration method name. |
| src/vs/workbench/services/actions/common/menusExtensionPoint.ts | Adds an API menu entry for create actions in the customizations editor. |
| src/vs/workbench/contrib/chat/test/common/customizationHarnessService.test.ts | Adds unit tests for external harness registration + workspace-subpath matching. |
| src/vs/workbench/contrib/chat/common/customizationHarnessService.ts | Extends harness descriptors with an optional external item provider + external harness registration. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.ts | Adjusts harness service wiring for core window harness list. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.ts | Adds harness context key + dynamic dropdown handling; adjusts selection telemetry/storage handling. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.ts | Adds harness context key and a new create menu id for extension create actions. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts | Supports provider-backed items (flat list), provider change events, and menu-based create actions. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.ts | Adds debug reporting for external provider item data. |
| src/vs/workbench/api/test/browser/mainThreadChatSessions.test.ts | Removes old customizations-provider stubs from tests. |
| src/vs/workbench/api/common/extHostTypes.ts | Replaces old customizations enums with ChatSessionCustomizationType class. |
| src/vs/workbench/api/common/extHostTypeConverters.ts | Adds converter for ChatSessionCustomizationType; removes old group conversion. |
| src/vs/workbench/api/common/extHostChatSessions.ts | Removes old customizations-provider registration and RPC handler. |
| src/vs/workbench/api/common/extHostChatAgents2.ts | Adds new customization provider registration and $provideChatSessionCustomizations RPC. |
| src/vs/workbench/api/common/extHost.protocol.ts | Adds new RPC DTOs/methods on the ChatAgents2 shape; removes old groups DTOs. |
| src/vs/workbench/api/common/extHost.api.impl.ts | Exposes chat.registerChatSessionCustomizationProvider under the new proposal gate. |
| src/vs/workbench/api/browser/mainThreadChatSessions.ts | Removes old main-thread customizations provider wiring and gating. |
| src/vs/workbench/api/browser/mainThreadChatAgents2.ts | Registers provider-backed harnesses on the main thread via registerExternalHarness. |
| src/vs/platform/extensions/common/extensionsApiProposals.ts | Replaces the proposal key with chatSessionCustomizationProvider. |
- Provider items without storage are now read-only (not editable/deletable) - Wrap provideChatSessionCustomizations in try/catch to handle extension errors - Use menuItem.run() instead of commandService.executeCommand for menu actions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Registration is now blocked when chat.customizations.providerApi.enabled is false (default), preventing providers from affecting the UI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8bee3e8 to
3aef205
Compare
Summary
Replaces the group-based
chatSessionCustomizationsAPI (merged in #304532) with a simpler, flat-itemchatSessionCustomizationProviderproposed API. Extensions callchat.registerChatSessionCustomizationProvider(chatSessionType, metadata, provider)to declare what customization items (agents, skills, instructions, prompts, hooks) they support, which then appear in the customizations management editor.API surface (
chatSessionCustomizationProviderproposal)Create button menu contributions
Extensions contribute create actions to the add button dropdown via
contributes.menusinpackage.json:Scoping: Use
aiCustomizationManagementHarnesscontext key to target a specific session type, andaiCustomizationManagementSectionto target a specific section (agents, skills, etc.).Replacement: When a harness has menu-contributed create actions for a section, they fully replace the built-in create buttons. Switching back to the "Local" harness restores the default buttons.
Plumbing
ExtHostChatAgentsShape2/MainThreadChatAgentsShape2IHarnessDescriptorwithitemProviderand registers viaICustomizationHarnessService.registerExternalHarness()storageis optional onIAICustomizationListItem— provider items don't have itchat.customizations.providerApi.enabled(default false)aiCustomizationManagementHarnesstracks the active harness IDWhat was removed
The old group-based
chatSessionCustomizationsAPI from #304532:IChatSessionCustomizationItem/GroupDTOs and convertersregisterChatSessionCustomizationsProviderfrom ext host sessions, main thread sessions, andchatSessionsProvider.d.tsgetCustomizations/hasCustomizationsProvideronIChatSessionsServicevscode.proposed.chatSessionCustomizations.d.ts(deleted)Files changed (23)
vscode.proposed.chatSessionCustomizationProvider.d.tsvscode.proposed.chatSessionCustomizations.d.tsvscode.proposed.chatSessionsProvider.d.tsregisterChatSessionCustomizationsProviderextensionsApiProposals.tschatSessionCustomizationProviderproposalextHostChatAgents2.tsregisterChatSessionCustomizationProvider,$provideChatSessionCustomizationsextHostChatSessions.tsextHostTypes.tsChatSessionCustomizationTypeclassextHostTypeConverters.ts.from()converterextHost.api.impl.tschat.registerChatSessionCustomizationProviderextHost.protocol.tsmainThreadChatAgents2.tsIHarnessDescriptor, registers viaregisterExternalHarnessmainThreadChatSessions.tscustomizationHarnessService.ts(common)registerExternalHarness(),IExternalCustomizationItemProvidercustomizationHarnessService.ts(browser)aiCustomizationListWidget.tsaiCustomizationManagement.tsAICustomizationManagementCreateMenuId, harness context keyaiCustomizationManagementEditor.tsaiCustomizationDebugPanel.tsappendExternalProviderData()menusExtensionPoint.tschat/customizations/createcontribution pointcustomizationHarnessService.test.tsmainThreadChatSessions.test.tsaiCustomizationListWidget.fixture.tsaiCustomizationManagementEditor.fixture.ts