Path: blob/main/src/vscode-dts/vscode.proposed.chatSessionCustomizationProvider.d.ts
13379 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45declare module 'vscode' {67// #region Customization Provider Types89/**10* Identifies the kind of customization an item represents.11*12* Use the built-in static instances (e.g. {@link ChatSessionCustomizationType.Agent})13* for well-known customization types, or create a new instance with a custom14* string id for extension-defined types.15*/16export class ChatSessionCustomizationType {17/** Agent customization (`.agent.md` files). */18static readonly Agent: ChatSessionCustomizationType;19/** Skill customization (`SKILL.md` files). */20static readonly Skill: ChatSessionCustomizationType;21/** Instruction customization (`.instructions.md` files). */22static readonly Instructions: ChatSessionCustomizationType;23/** Prompt customization (`.prompt.md` files). */24static readonly Prompt: ChatSessionCustomizationType;25/** Hook customization (event-driven automation). */26static readonly Hook: ChatSessionCustomizationType;27/** Plugin customization (agent runtime plugins). */28static readonly Plugins: ChatSessionCustomizationType;2930/**31* The string identifier for this customization type.32*/33readonly id: string;3435/**36* Create a new customization type.37*38* @param id A unique string identifier for this type (e.g. `'agent'`, `'skill'`).39*/40constructor(id: string);41}4243/**44* Metadata describing a customization provider and its capabilities.45* This drives UI presentation (label, icon) and filtering (unsupported types,46* workspace sub-paths).47*/48export interface ChatSessionCustomizationProviderMetadata {49/**50* Display label for this provider (e.g. "Copilot CLI", "Claude Code").51*/52readonly label: string;5354/**55* Optional codicon ID for this provider's icon in the UI.56*/57readonly iconId?: string;5859/**60* Customization types that this provider supports.61* Only the corresponding sections will be shown in the management UI62* when this provider is active. When omitted, all sections are shown.63*/64readonly supportedTypes?: readonly ChatSessionCustomizationType[];65}6667/**68* Represents a single customization item reported by a provider.69*/70export interface ChatSessionCustomizationItem {71/**72* URI to the customization file (e.g. an `.agent.md`, `SKILL.md`, or `.instructions.md` file).73*/74readonly uri: Uri;7576/**77* The type of customization this item represents.78*/79readonly type: ChatSessionCustomizationType;8081/**82* Display name for this customization.83*/84readonly name: string;8586/**87* Optional description of this customization.88*/89readonly description?: string;9091/**92* The extension identifier that contributed this customization, if any.93*/94readonly extensionId?: string;9596/**97* The URI of the plugin that contributed this customization, if any.98*/99readonly pluginUri?: Uri;100101/**102* Optional group key for display grouping. Items sharing the same103* `groupKey` are placed under a shared collapsible header in the104* management UI.105*106* When omitted, items are grouped automatically by their storage107* source (e.g. Workspace, User) based on the item's URI.108*/109readonly groupKey?: string;110111/**112* Optional inline badge text shown next to the item name113* (e.g. a glob pattern like `src/vs/sessions/**`).114*/115readonly badge?: string;116117/**118* Optional tooltip text shown when hovering over the badge.119*/120readonly badgeTooltip?: string;121122/**123* Whether this item should be shown to users as invocable.124* Applies to agents, skills, and prompts. When `false`, the item is hidden from the UI and cannot be invoked by users,125*/126readonly userInvocable?: boolean;127}128129/**130* A provider that reports which chat customizations are available.131*132* Chat customizations are configuration artifacts — agents, skills,133* instructions, prompts, and hooks — that augment LLM behavior during134* a chat session. Extensions that manage their own customization files135* (e.g. from an SDK's config directory) register a provider so the136* management UI can discover and display them.137*138* ### Lifecycle139*140* 1. Register via {@link chat.registerChatSessionCustomizationProvider}.141* 2. The UI calls {@link provideChatSessionCustomizations} once and caches142* the result.143* 3. When the underlying files change, fire {@link onDidChange} to144* trigger a fresh call to {@link provideChatSessionCustomizations}.145*/146export interface ChatSessionCustomizationProvider {147/**148* An optional event that fires when the provider's customizations change.149* The UI caches the result of {@link provideChatSessionCustomizations} and will150* only re-query the provider when this event fires.151*/152readonly onDidChange?: Event<void>;153154/**155* Provide the customization items this provider supports.156*157* The result is cached by the UI until {@link onDidChange} fires.158*159* @param token A cancellation token.160* @returns The list of customization items, or `undefined` if unavailable.161*/162provideChatSessionCustomizations(token: CancellationToken): ProviderResult<ChatSessionCustomizationItem[]>;163}164165// #endregion166167// #region Registration168169export namespace chat {170/**171* Register a customization provider that reports what customizations172* a harness or runtime supports. The provider's metadata drives UI173* presentation and filtering, while {@link ChatSessionCustomizationProvider.provideChatSessionCustomizations}174* supplies the actual items.175*176* @param chatSessionType The session type this provider is for (e.g. `'cli'`, `'claude'`).177* @param metadata Metadata describing the provider's capabilities and UI presentation.178* @param provider The customization provider implementation.179* @returns A disposable that unregisters the provider when disposed.180*/181export function registerChatSessionCustomizationProvider(chatSessionType: string, metadata: ChatSessionCustomizationProviderMetadata, provider: ChatSessionCustomizationProvider): Disposable;182}183184// #endregion185}186187188