/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ declare module 'vscode' { // #region Customization Provider Types /** * Identifies the kind of customization an item represents. * * Use the built-in static instances (e.g. {@link ChatSessionCustomizationType.Agent}) * for well-known customization types, or create a new instance with a custom * string id for extension-defined types. */ export class ChatSessionCustomizationType { /** Agent customization (`.agent.md` files). */ static readonly Agent: ChatSessionCustomizationType; /** Skill customization (`SKILL.md` files). */ static readonly Skill: ChatSessionCustomizationType; /** Instruction customization (`.instructions.md` files). */ static readonly Instructions: ChatSessionCustomizationType; /** Prompt customization (`.prompt.md` files). */ static readonly Prompt: ChatSessionCustomizationType; /** Hook customization (event-driven automation). */ static readonly Hook: ChatSessionCustomizationType; /** Plugin customization (agent runtime plugins). */ static readonly Plugins: ChatSessionCustomizationType; /** * The string identifier for this customization type. */ readonly id: string; /** * Create a new customization type. * * @param id A unique string identifier for this type (e.g. `'agent'`, `'skill'`). */ constructor(id: string); } /** * Metadata describing a customization provider and its capabilities. * This drives UI presentation (label, icon) and filtering (unsupported types, * workspace sub-paths). */ export interface ChatSessionCustomizationProviderMetadata { /** * Display label for this provider (e.g. "Copilot CLI", "Claude Code"). */ readonly label: string; /** * Optional codicon ID for this provider's icon in the UI. */ readonly iconId?: string; /** * Customization types that this provider supports. * Only the corresponding sections will be shown in the management UI * when this provider is active. When omitted, all sections are shown. */ readonly supportedTypes?: readonly ChatSessionCustomizationType[]; } export type ChatSessionCustomizationSource = 'local' | 'user' | 'extension' | 'plugin' | 'builtin'; /** * Represents a single customization item reported by a provider. */ export interface ChatSessionCustomizationItem { /** * URI to the customization file (e.g. an `.agent.md`, `SKILL.md`, or `.instructions.md` file). */ readonly uri: Uri; /** * The type of customization this item represents. */ readonly type: ChatSessionCustomizationType; /** * Display name for this customization. */ readonly name: string; /** * Optional description of this customization. */ readonly description?: string; /** * The source/origin of this customization, which drives UI grouping and filtering */ readonly source: ChatSessionCustomizationSource; /** * The extension identifier that contributed this customization. Should be set if the source is 'extension'. */ readonly extensionId?: string; /** * The URI of the plugin that contributed this customization, if any. Should be set if the source is 'plugin'. */ readonly pluginUri?: Uri; /** * Human-readable name of the plugin that contributed this customization, if any. * Used to qualify plugin-scoped slash command names when `pluginUri` points to * an implementation-specific install directory. */ readonly pluginLabel?: string; /** * Optional group key for display grouping. Items sharing the same * `groupKey` are placed under a shared collapsible header in the * management UI. * * When omitted, items are grouped automatically by their storage * source (e.g. Workspace, User) based on the item's URI. */ readonly groupKey?: string; /** * Optional inline badge text shown next to the item name * (e.g. a glob pattern like `src/vs/sessions/**`). */ readonly badge?: string; /** * Optional tooltip text shown when hovering over the badge. */ readonly badgeTooltip?: string; /** * Whether this item should be shown to users as invocable. * Applies to agents, skills, and prompts. When `false`, the item is hidden from the UI and cannot be invoked by users, */ readonly userInvocable?: boolean; } /** * A provider that reports which chat customizations are available. * * Chat customizations are configuration artifacts — agents, skills, * instructions, prompts, and hooks — that augment LLM behavior during * a chat session. Extensions that manage their own customization files * (e.g. from an SDK's config directory) register a provider so the * management UI can discover and display them. * * ### Lifecycle * * 1. Register via {@link chat.registerChatSessionCustomizationProvider}. * 2. The UI calls {@link provideChatSessionCustomizations} once and caches * the result. * 3. When the underlying files change, fire {@link onDidChange} to * trigger a fresh call to {@link provideChatSessionCustomizations}. */ export interface ChatSessionCustomizationProvider { /** * An optional event that fires when the provider's customizations change. * The UI caches the result of {@link provideChatSessionCustomizations} and will * only re-query the provider when this event fires. */ readonly onDidChange?: Event; /** * Provide the customization items this provider supports. * * The result is cached by the UI until {@link onDidChange} fires. * * @param sessionResource URI of the chat session whose customizations should be considered. * @param token A cancellation token. * @returns The list of customization items, or `undefined` if unavailable. */ provideChatSessionCustomizations(sessionResource: Uri, token: CancellationToken): ProviderResult; /** * Optionally provide the directories where new customization files * of the given {@link type} can be created for this session. The * management UI offers these locations in a picker when the user * creates a new item. * * @param sessionResource URI of the chat session whose creation * locations should be returned. * @param type The customization type the user is creating. * @param token A cancellation token. * @returns The list of source folders, or `undefined` when no * folders apply for this type. */ provideSourceFolders?(sessionResource: Uri, type: ChatSessionCustomizationType, token: CancellationToken): ProviderResult; } /** * A directory where new customization files of a given type can be created. */ export interface ChatSessionCustomizationSourceFolder { /** Directory where the new file should be written. */ readonly uri: Uri; /** Display label for the picker when multiple folders are offered. */ readonly label: string; /** Source of the customization folder. */ readonly source: ChatSessionCustomizationSource; /** * Opaque identity shared by source folders that belong to the same * customization destination. */ readonly destinationGroupId?: string; } // #endregion // #region Registration export namespace chat { /** * Register a customization provider that reports what customizations * a harness or runtime supports. The provider's metadata drives UI * presentation and filtering, while {@link ChatSessionCustomizationProvider.provideChatSessionCustomizations} * supplies the actual items. * * @param chatSessionType The session type this provider is for (e.g. `'cli'`, `'claude'`). * @param metadata Metadata describing the provider's capabilities and UI presentation. * @param provider The customization provider implementation. * @returns A disposable that unregisters the provider when disposed. */ export function registerChatSessionCustomizationProvider(chatSessionType: string, metadata: ChatSessionCustomizationProviderMetadata, provider: ChatSessionCustomizationProvider): Disposable; } // #endregion }