Skip to content

chat: route AI customization list through item sources#309666

Merged
joshspicer merged 3 commits intomainfrom
agents/delightful-asp
Apr 14, 2026
Merged

chat: route AI customization list through item sources#309666
joshspicer merged 3 commits intomainfrom
agents/delightful-asp

Conversation

@joshspicer
Copy link
Copy Markdown
Member

@joshspicer joshspicer commented Apr 13, 2026

Summary

Route the AI Customizations list widget through a unified item-source abstraction, eliminating the two separate code paths that branched on whether the active harness had a promptsService path vs an extension-contributed provider.

All three customization item producers — core promptsService (local), extension API providers, and AHP remote servers — now implement a single ICustomizationItemProvider interface and produce ICustomizationItem objects. A consolidated pipeline normalizes these into IAICustomizationListItem for the widget.

Resolves #309627

Design

promptsService ──→ PromptsServiceCustomizationItemProvider ──→ ICustomizationItem[]
                                                                       │
Extension API ────────────────────────────────────────────→ ICustomizationItem[]
                                                                       │
AHP Remote ───────────────────────────────────────────────→ ICustomizationItem[]
                                                                       │
                                                                       ▼
                                                  ProviderCustomizationItemSource
                                                                       │
                                                                       ▼
                                                    AICustomizationItemNormalizer
                                                                       │
                                                                       ▼
                                                    IAICustomizationListItem[] → Widget

Key interfaces (common layer)

  • ICustomizationItem — universal shape all 3 producers emit. Includes optional storage?: PromptsStorage so providers that know the origin can set it directly.
  • ICustomizationItemProvider — single method provideChatSessionCustomizations() that all sources implement.

What changed architecturally

  • No more lossy round-trip: Previously an adapter stripped storage via toProviderItems(), then the normalizer re-inferred it from URI heuristics. Now storage flows through end-to-end; the normalizer only infers from URI as a fallback.
  • No duck-typed interfaces: Removed the provideCustomizations? optional method pattern. All providers implement provideChatSessionCustomizations — the one established API.
  • Consolidated pipeline file: aiCustomizationItemSource.ts (~400 lines) contains interfaces, utilities, normalizer, and item source — following the Testing framework precedent of bundling a strict dependency chain.
  • PromptsServiceCustomizationItemProvider stays permanently — it's how core VS Code's "Local" harness feeds items from promptsService into the unified pipeline.

Files

New files

File Purpose
aiCustomizationItemSource.ts Consolidated pipeline: IAICustomizationListItem, IAICustomizationItemSource, utils, AICustomizationItemNormalizer, ProviderCustomizationItemSource
promptsServiceCustomizationItemProvider.ts Adapts IPromptsServiceICustomizationItemProvider (local/static path)

Modified files

File Change
customizationHarnessService.ts Renamed IExternalCustomizationItemICustomizationItem, IExternalCustomizationItemProviderICustomizationItemProvider, added storage field
aiCustomizationListWidget.ts Removed ~800 lines of dual-path fetch/normalize/group logic, now consumes IAICustomizationItemSource
aiCustomizationIcons.ts storageToIcon() with PromptsStorage enum type safety
mainThreadChatAgents2.ts Interface renames
remoteAgentHostCustomizationHarness.ts Interface renames
aiCustomizationDebugPanel.ts Interface renames
customizationHarnessService.test.ts Interface renames
AI_CUSTOMIZATIONS.md Design doc updated to reflect new architecture

Commits

  1. chat: extract AI customization item sources — initial pipeline extraction
  2. chat: clean up AI customization item source extraction — council-review fixes (dedup utils, cache source, O(n) hook lookup, .filter() chains)
  3. chat: consolidate item source files into single module — merge 4 files → 1, unify ICustomizationItem/ICustomizationItemProvider interfaces, eliminate internal DTO

Validation

  • npm run compile-check-ts-native: clean (pre-existing copilotAgent.ts errors only)
  • Unit tests passing

Copilot AI review requested due to automatic review settings April 13, 2026 23:21
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2026

Screenshot Changes

Base: d4ff4fe5 Current: 2cb9a5fa

Changed (6)

chat/aiCustomizations/aiCustomizationListWidget/InstructionsTabWithItems/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationListWidget/InstructionsTabWithItems/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/HooksTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/HooksTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Light
Before After
before after

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

Refactors the AI Customization management list to fetch items through a unified, browser-internal “item source” abstraction, converging both promptsService-backed discovery and extension-contributed providers onto the same normalized list-item model.

Changes:

  • Introduces IAICustomizationItemSource + supporting utilities/normalizer to unify discovery and normalization into IAICustomizationListItem.
  • Adds a promptsService adapter (PromptsServiceCustomizationItemProvider) so local/static harnesses keep the rich promptsService pipeline while still producing provider-shaped items.
  • Updates the list widget to select/cache an item source per active harness and remove direct branching between “core” vs “provider” paths.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/aiCustomization/providerCustomizationItemSource.ts New unified item source that merges provider items + optional local sync overlays and emits a composed onDidChange.
src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.ts Adapts IPromptsService to IExternalCustomizationItemProvider, including hook expansion and harness filtering.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts Switches the widget to consume an IAICustomizationItemSource and cache it per harness descriptor.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListItem.ts Extracts the widget list item model + item source contract into a shared browser file.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSourceUtils.ts Shared utilities for friendly naming, hook expansion, and built-in chat extension detection.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemNormalizer.ts Normalizes provider-shaped items into rich UI list items, inferring source/grouping details.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.ts Moves storageToIcon into the icons module.
src/vs/sessions/AI_CUSTOMIZATIONS.md Updates sessions documentation to describe the new management editor item pipeline.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 2

Comment thread src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.ts Outdated
joshspicer and others added 2 commits April 14, 2026 11:19
Addresses code quality issues from council review:

- Extract shared isChatExtensionItem() to aiCustomizationItemSourceUtils
- Move storageToIcon() to aiCustomizationIcons (pure function, no class dep)
- Extract shared expandHookFileItems() utility, deduplicating hook file
  parsing from PromptsServiceCustomizationItemProvider and
  ProviderCustomizationItemSource
- Replace fragile backward-index splice loops in applyLocalFilters
  with idiomatic .filter() chains
- Cache ProviderCustomizationItemSource per active harness descriptor
  to avoid redundant event composition on every call

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joshspicer joshspicer force-pushed the agents/delightful-asp branch 2 times, most recently from e9cfcb6 to 0ec4eba Compare April 14, 2026 19:01
@joshspicer joshspicer marked this pull request as ready for review April 14, 2026 19:15
@joshspicer joshspicer marked this pull request as draft April 14, 2026 19:25
@joshspicer joshspicer force-pushed the agents/delightful-asp branch 3 times, most recently from 8f38625 to e01a811 Compare April 14, 2026 19:38
Merge aiCustomizationListItem, aiCustomizationItemSourceUtils,
aiCustomizationItemNormalizer, and providerCustomizationItemSource
into a single aiCustomizationItemSource.ts (~414 lines).

These four files form a tight linear dependency chain with one
external consumer (the list widget). Consolidating matches the
codebase convention (cf. testing explorerProjections/index.ts)
and reduces the aiCustomization directory from 22 to 19 files.

The promptsServiceCustomizationItemProvider remains separate as
a distinct adapter that bridges the core promptsService into the
provider-shaped pipeline for harnesses without an external provider.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joshspicer joshspicer force-pushed the agents/delightful-asp branch from e01a811 to 7c4bc01 Compare April 14, 2026 19:42
@joshspicer joshspicer marked this pull request as ready for review April 14, 2026 19:48
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.

AI Customization: Unify item discovery through provider abstraction & cut over sessions

3 participants