Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vscode-dts/vscode.proposed.chatSessionCustomizationProvider.d.ts
13379 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
declare module 'vscode' {
7
8
// #region Customization Provider Types
9
10
/**
11
* Identifies the kind of customization an item represents.
12
*
13
* Use the built-in static instances (e.g. {@link ChatSessionCustomizationType.Agent})
14
* for well-known customization types, or create a new instance with a custom
15
* string id for extension-defined types.
16
*/
17
export class ChatSessionCustomizationType {
18
/** Agent customization (`.agent.md` files). */
19
static readonly Agent: ChatSessionCustomizationType;
20
/** Skill customization (`SKILL.md` files). */
21
static readonly Skill: ChatSessionCustomizationType;
22
/** Instruction customization (`.instructions.md` files). */
23
static readonly Instructions: ChatSessionCustomizationType;
24
/** Prompt customization (`.prompt.md` files). */
25
static readonly Prompt: ChatSessionCustomizationType;
26
/** Hook customization (event-driven automation). */
27
static readonly Hook: ChatSessionCustomizationType;
28
/** Plugin customization (agent runtime plugins). */
29
static readonly Plugins: ChatSessionCustomizationType;
30
31
/**
32
* The string identifier for this customization type.
33
*/
34
readonly id: string;
35
36
/**
37
* Create a new customization type.
38
*
39
* @param id A unique string identifier for this type (e.g. `'agent'`, `'skill'`).
40
*/
41
constructor(id: string);
42
}
43
44
/**
45
* Metadata describing a customization provider and its capabilities.
46
* This drives UI presentation (label, icon) and filtering (unsupported types,
47
* workspace sub-paths).
48
*/
49
export interface ChatSessionCustomizationProviderMetadata {
50
/**
51
* Display label for this provider (e.g. "Copilot CLI", "Claude Code").
52
*/
53
readonly label: string;
54
55
/**
56
* Optional codicon ID for this provider's icon in the UI.
57
*/
58
readonly iconId?: string;
59
60
/**
61
* Customization types that this provider supports.
62
* Only the corresponding sections will be shown in the management UI
63
* when this provider is active. When omitted, all sections are shown.
64
*/
65
readonly supportedTypes?: readonly ChatSessionCustomizationType[];
66
}
67
68
/**
69
* Represents a single customization item reported by a provider.
70
*/
71
export interface ChatSessionCustomizationItem {
72
/**
73
* URI to the customization file (e.g. an `.agent.md`, `SKILL.md`, or `.instructions.md` file).
74
*/
75
readonly uri: Uri;
76
77
/**
78
* The type of customization this item represents.
79
*/
80
readonly type: ChatSessionCustomizationType;
81
82
/**
83
* Display name for this customization.
84
*/
85
readonly name: string;
86
87
/**
88
* Optional description of this customization.
89
*/
90
readonly description?: string;
91
92
/**
93
* The extension identifier that contributed this customization, if any.
94
*/
95
readonly extensionId?: string;
96
97
/**
98
* The URI of the plugin that contributed this customization, if any.
99
*/
100
readonly pluginUri?: Uri;
101
102
/**
103
* Optional group key for display grouping. Items sharing the same
104
* `groupKey` are placed under a shared collapsible header in the
105
* management UI.
106
*
107
* When omitted, items are grouped automatically by their storage
108
* source (e.g. Workspace, User) based on the item's URI.
109
*/
110
readonly groupKey?: string;
111
112
/**
113
* Optional inline badge text shown next to the item name
114
* (e.g. a glob pattern like `src/vs/sessions/**`).
115
*/
116
readonly badge?: string;
117
118
/**
119
* Optional tooltip text shown when hovering over the badge.
120
*/
121
readonly badgeTooltip?: string;
122
123
/**
124
* Whether this item should be shown to users as invocable.
125
* Applies to agents, skills, and prompts. When `false`, the item is hidden from the UI and cannot be invoked by users,
126
*/
127
readonly userInvocable?: boolean;
128
}
129
130
/**
131
* A provider that reports which chat customizations are available.
132
*
133
* Chat customizations are configuration artifacts — agents, skills,
134
* instructions, prompts, and hooks — that augment LLM behavior during
135
* a chat session. Extensions that manage their own customization files
136
* (e.g. from an SDK's config directory) register a provider so the
137
* management UI can discover and display them.
138
*
139
* ### Lifecycle
140
*
141
* 1. Register via {@link chat.registerChatSessionCustomizationProvider}.
142
* 2. The UI calls {@link provideChatSessionCustomizations} once and caches
143
* the result.
144
* 3. When the underlying files change, fire {@link onDidChange} to
145
* trigger a fresh call to {@link provideChatSessionCustomizations}.
146
*/
147
export interface ChatSessionCustomizationProvider {
148
/**
149
* An optional event that fires when the provider's customizations change.
150
* The UI caches the result of {@link provideChatSessionCustomizations} and will
151
* only re-query the provider when this event fires.
152
*/
153
readonly onDidChange?: Event<void>;
154
155
/**
156
* Provide the customization items this provider supports.
157
*
158
* The result is cached by the UI until {@link onDidChange} fires.
159
*
160
* @param token A cancellation token.
161
* @returns The list of customization items, or `undefined` if unavailable.
162
*/
163
provideChatSessionCustomizations(token: CancellationToken): ProviderResult<ChatSessionCustomizationItem[]>;
164
}
165
166
// #endregion
167
168
// #region Registration
169
170
export namespace chat {
171
/**
172
* Register a customization provider that reports what customizations
173
* a harness or runtime supports. The provider's metadata drives UI
174
* presentation and filtering, while {@link ChatSessionCustomizationProvider.provideChatSessionCustomizations}
175
* supplies the actual items.
176
*
177
* @param chatSessionType The session type this provider is for (e.g. `'cli'`, `'claude'`).
178
* @param metadata Metadata describing the provider's capabilities and UI presentation.
179
* @param provider The customization provider implementation.
180
* @returns A disposable that unregisters the provider when disposed.
181
*/
182
export function registerChatSessionCustomizationProvider(chatSessionType: string, metadata: ChatSessionCustomizationProviderMetadata, provider: ChatSessionCustomizationProvider): Disposable;
183
}
184
185
// #endregion
186
}
187
188