chat: route AI customization list through item sources#309666
Merged
joshspicer merged 3 commits intomainfrom Apr 14, 2026
Merged
chat: route AI customization list through item sources#309666joshspicer merged 3 commits intomainfrom
joshspicer merged 3 commits intomainfrom
Conversation
Contributor
Screenshot ChangesBase: Changed (6) |
Contributor
There was a problem hiding this comment.
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 intoIAICustomizationListItem. - 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
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>
e9cfcb6 to
0ec4eba
Compare
8f38625 to
e01a811
Compare
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>
e01a811 to
7c4bc01
Compare
Yoyokrazy
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ICustomizationItemProviderinterface and produceICustomizationItemobjects. A consolidated pipeline normalizes these intoIAICustomizationListItemfor the widget.Resolves #309627
Design
Key interfaces (common layer)
ICustomizationItem— universal shape all 3 producers emit. Includes optionalstorage?: PromptsStorageso providers that know the origin can set it directly.ICustomizationItemProvider— single methodprovideChatSessionCustomizations()that all sources implement.What changed architecturally
storageviatoProviderItems(), then the normalizer re-inferred it from URI heuristics. Nowstorageflows through end-to-end; the normalizer only infers from URI as a fallback.provideCustomizations?optional method pattern. All providers implementprovideChatSessionCustomizations— the one established API.aiCustomizationItemSource.ts(~400 lines) contains interfaces, utilities, normalizer, and item source — following the Testing framework precedent of bundling a strict dependency chain.PromptsServiceCustomizationItemProviderstays permanently — it's how core VS Code's "Local" harness feeds items from promptsService into the unified pipeline.Files
New files
aiCustomizationItemSource.tsIAICustomizationListItem,IAICustomizationItemSource, utils,AICustomizationItemNormalizer,ProviderCustomizationItemSourcepromptsServiceCustomizationItemProvider.tsIPromptsService→ICustomizationItemProvider(local/static path)Modified files
customizationHarnessService.tsIExternalCustomizationItem→ICustomizationItem,IExternalCustomizationItemProvider→ICustomizationItemProvider, addedstoragefieldaiCustomizationListWidget.tsIAICustomizationItemSourceaiCustomizationIcons.tsstorageToIcon()withPromptsStorageenum type safetymainThreadChatAgents2.tsremoteAgentHostCustomizationHarness.tsaiCustomizationDebugPanel.tscustomizationHarnessService.test.tsAI_CUSTOMIZATIONS.mdCommits
chat: extract AI customization item sources— initial pipeline extractionchat: clean up AI customization item source extraction— council-review fixes (dedup utils, cache source, O(n) hook lookup,.filter()chains)chat: consolidate item source files into single module— merge 4 files → 1, unifyICustomizationItem/ICustomizationItemProviderinterfaces, eliminate internal DTOValidation
npm run compile-check-ts-native: clean (pre-existing copilotAgent.ts errors only)