Skip to content

chat: replace chatSessionCustomizations with chatSessionCustomizationProvider API#303017

Merged
joshspicer merged 16 commits intomainfrom
jospicer/provide-customizations-api
Mar 27, 2026
Merged

chat: replace chatSessionCustomizations with chatSessionCustomizationProvider API#303017
joshspicer merged 16 commits intomainfrom
jospicer/provide-customizations-api

Conversation

@joshspicer
Copy link
Copy Markdown
Member

@joshspicer joshspicer commented Mar 18, 2026

Summary

Replaces the group-based chatSessionCustomizations API (merged in #304532) with a simpler, flat-item chatSessionCustomizationProvider proposed API. Extensions call chat.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 (chatSessionCustomizationProvider proposal)

// Registration — chatSessionType scopes the provider to a harness
chat.registerChatSessionCustomizationProvider('my-ext', { label: 'My Extension' }, provider);

// Provider
interface ChatSessionCustomizationProvider {
  provideChatSessionCustomizations(token: CancellationToken): ProviderResult<ChatSessionCustomizationItem[]>;
  onDidChangeChatSessionCustomizations?: Event<void>;
}

// Items — flat list, each item declares its type
interface ChatSessionCustomizationItem {
  readonly uri: Uri;
  readonly name: string;
  readonly type: ChatSessionCustomizationType; // .Agent, .Skill, .Instructions, .Prompt, .Hook
  readonly description?: string;
}

// Type — TaskGroup-style class, extensible
class ChatSessionCustomizationType {
  static readonly Agent, Skill, Instructions, Prompt, Hook;
  constructor(id: string); // for extension-defined types
}

Create button menu contributions

Extensions contribute create actions to the add button dropdown via contributes.menus in package.json:

"contributes": {
  "menus": {
    "chat/customizations/create": [
      {
        "command": "myext.newAgent",
        "when": "aiCustomizationManagementHarness == my-ext && aiCustomizationManagementSection == agents"
      }
    ]
  }
}

Scoping: Use aiCustomizationManagementHarness context key to target a specific session type, and aiCustomizationManagementSection to 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

  • Ext host ↔ main thread bridge via ExtHostChatAgentsShape2 / MainThreadChatAgentsShape2
  • Main thread creates IHarnessDescriptor with itemProvider and registers via ICustomizationHarnessService.registerExternalHarness()
  • Provider-backed harnesses render items as a flat sorted list (no storage-based Workspace/User/Extension grouping)
  • storage is optional on IAICustomizationListItem — provider items don't have it
  • Feature gate: chat.customizations.providerApi.enabled (default false)
  • Debug panel shows provider's raw items when an extension harness is active
  • New context key aiCustomizationManagementHarness tracks the active harness ID

What was removed

The old group-based chatSessionCustomizations API from #304532:

  • IChatSessionCustomizationItem/Group DTOs and converters
  • registerChatSessionCustomizationsProvider from ext host sessions, main thread sessions, and chatSessionsProvider.d.ts
  • getCustomizations/hasCustomizationsProvider on IChatSessionsService
  • vscode.proposed.chatSessionCustomizations.d.ts (deleted)

Files changed (23)

Area File What
Proposal vscode.proposed.chatSessionCustomizationProvider.d.ts New — full type surface
vscode.proposed.chatSessionCustomizations.d.ts Deleted — old API
vscode.proposed.chatSessionsProvider.d.ts Removed old registerChatSessionCustomizationsProvider
Registry extensionsApiProposals.ts New chatSessionCustomizationProvider proposal
Ext host extHostChatAgents2.ts registerChatSessionCustomizationProvider, $provideChatSessionCustomizations
extHostChatSessions.ts Removed old provider code
extHostTypes.ts ChatSessionCustomizationType class
extHostTypeConverters.ts Simple .from() converter
extHost.api.impl.ts Wires chat.registerChatSessionCustomizationProvider
Protocol extHost.protocol.ts DTOs and RPC methods
Main thread mainThreadChatAgents2.ts Creates IHarnessDescriptor, registers via registerExternalHarness
mainThreadChatSessions.ts Removed old provider methods
Harness customizationHarnessService.ts (common) registerExternalHarness(), IExternalCustomizationItemProvider
customizationHarnessService.ts (browser) Simplified constructor
UI aiCustomizationListWidget.ts Provider flat-list path, menu-contributed create actions
aiCustomizationManagement.ts AICustomizationManagementCreateMenuId, harness context key
aiCustomizationManagementEditor.ts Harness context key binding, reactive harness tracking
aiCustomizationDebugPanel.ts appendExternalProviderData()
Menu extension point menusExtensionPoint.ts chat/customizations/create contribution point
Tests customizationHarnessService.test.ts New — harness registration lifecycle
mainThreadChatSessions.test.ts Removed old mock
Fixtures aiCustomizationListWidget.fixture.ts Updated mock
aiCustomizationManagementEditor.fixture.ts Updated mock

Copilot AI review requested due to automatic review settings March 18, 2026 23:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.registerCustomizationProvider plus 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.

Comment thread src/vs/workbench/contrib/chat/common/customizationHarnessService.ts
Comment thread src/vs/workbench/contrib/chat/common/customizationHarnessService.ts
@joshspicer joshspicer changed the title feat: add chat.registerCustomizationProvider extension API chat: add chat.registerCustomizationProvider extension API Mar 26, 2026
@joshspicer joshspicer changed the title chat: add chat.registerCustomizationProvider extension API chat: add chat.registerChatSessionCustomizationProvider extension API Mar 26, 2026
@joshspicer joshspicer force-pushed the jospicer/provide-customizations-api branch from 4fb704c to 09a7352 Compare March 26, 2026 21:19
@joshspicer joshspicer changed the title chat: add chat.registerChatSessionCustomizationProvider extension API chat: replace chatSessionCustomizations with chatSessionCustomizationProvider API Mar 26, 2026
@microsoft microsoft deleted a comment from github-actions bot Mar 26, 2026
@joshspicer joshspicer requested a review from Copilot March 27, 2026 01:10
joshspicer and others added 14 commits March 26, 2026 18:11
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 registerChatSessionCustomizationsProvider API + deleted vscode.proposed.chatSessionCustomizations.d.ts; add new vscode.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.

Comment thread src/vs/workbench/api/browser/mainThreadChatAgents2.ts
Comment thread src/vs/workbench/api/common/extHostChatAgents2.ts Outdated
joshspicer and others added 2 commits March 26, 2026 18:45
- 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>
@joshspicer joshspicer force-pushed the jospicer/provide-customizations-api branch from 8bee3e8 to 3aef205 Compare March 27, 2026 01:56
@joshspicer joshspicer marked this pull request as ready for review March 27, 2026 02:07
@joshspicer joshspicer enabled auto-merge (squash) March 27, 2026 02:08
@joshspicer joshspicer merged commit d7c19c5 into main Mar 27, 2026
19 checks passed
@joshspicer joshspicer deleted the jospicer/provide-customizations-api branch March 27, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants