SIGN IN SIGN UP

chat: replace chatSessionCustomizations with chatSessionCustomizationProvider API (#303017)

* feat: add chat.registerCustomizationProvider extension API

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 <[email protected]>

* fix: address code review issues

- Register chatCustomizationProvider in extensionsApiProposals.ts
- Fix duplicate 'descriptor' variable in fetchItemsForSection
- Add missing IExternalCustomizationItemProvider import

Co-authored-by: Copilot <[email protected]>

* fix: make management editor reactive to dynamic harness registration

- 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 <[email protected]>

* refactor: address API review feedback for ChatCustomizationProvider

- 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 <[email protected]>

* fix: quality improvements for ChatCustomizationProvider plumbing

- 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 <[email protected]>

* refactor: make storage optional on IAICustomizationListItem

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 <[email protected]>

* feat: include external provider data in customization debug report

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 <[email protected]>

* refactor: rename ChatCustomization → ChatSessionCustomization per API 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 <[email protected]>

* fix: resolve rebase conflicts and remove old ChatSessionCustomizations 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 <[email protected]>

* fix: remove version number from new chatSessionCustomizationProvider proposal

Co-authored-by: Copilot <[email protected]>

* fix: rename id → chatSessionType in registerChatSessionCustomizationProvider

Aligns the parameter name with the chatSessions API convention.

Co-authored-by: Copilot <[email protected]>

* feat: add AICustomizationManagementCreateMenuId for extension create 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 <[email protected]>

* fix: register chat/customizations/create as extension menu contribution 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 <[email protected]>

* feat: scope create menu to active harness, replace built-in actions

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 <[email protected]>

* fix: address code review feedback

- 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 <[email protected]>

* fix: gate customization provider registration on kill-switch setting

Registration is now blocked when chat.customizations.providerApi.enabled
is false (default), preventing providers from affecting the UI.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
J
Josh Spicer committed
d7c19c5af6e6a30a429780ef12c8146468e9cf6c
Parent: 79c4565
Committed by GitHub <[email protected]> on 3/27/2026, 2:42:19 AM