-
Notifications
You must be signed in to change notification settings - Fork 740
Expand file tree
/
Copy pathvscode.proposed.chatParticipantPrivate.d.ts
More file actions
431 lines (352 loc) · 12.4 KB
/
vscode.proposed.chatParticipantPrivate.d.ts
File metadata and controls
431 lines (352 loc) · 12.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// version: 15
declare module 'vscode' {
/**
* The location at which the chat is happening.
*/
export enum ChatLocation {
/**
* The chat panel
*/
Panel = 1,
/**
* Terminal inline chat
*/
Terminal = 2,
/**
* Notebook inline chat
*/
Notebook = 3,
/**
* Code editor inline chat
*/
Editor = 4,
}
export class ChatRequestEditorData {
readonly editor: TextEditor;
//TODO@API should be the editor
document: TextDocument;
selection: Selection;
/** @deprecated */
wholeRange: Range;
constructor(editor: TextEditor, document: TextDocument, selection: Selection, wholeRange: Range);
}
export class ChatRequestNotebookData {
//TODO@API should be the editor
readonly cell: TextDocument;
constructor(cell: TextDocument);
}
export interface ChatRequest {
/**
* The id of the chat request. Used to identity an interaction with any of the chat surfaces.
*/
readonly id: string;
/**
* The attempt number of the request. The first request has attempt number 0.
*/
readonly attempt: number;
/**
* The session identifier for this chat request.
*
* @deprecated Use {@link chatSessionResource} instead.
*/
readonly sessionId: string;
/**
* The resource URI for the chat session this request belongs to.
*/
readonly sessionResource: Uri;
/**
* If automatic command detection is enabled.
*/
readonly enableCommandDetection: boolean;
/**
* If the chat participant or command was automatically assigned.
*/
readonly isParticipantDetected: boolean;
/**
* The location at which the chat is happening. This will always be one of the supported values
*
* @deprecated
*/
readonly location: ChatLocation;
/**
* Information that is specific to the location at which chat is happening, e.g within a document, notebook,
* or terminal. Will be `undefined` for the chat panel.
*/
readonly location2: ChatRequestEditorData | ChatRequestNotebookData | undefined;
/**
* Events for edited files in this session collected since the last request.
*/
readonly editedFileEvents?: ChatRequestEditedFileEvent[];
/**
* Unique ID for the subagent invocation, used to group tool calls from the same subagent run together.
* Pass this to tool invocations when calling tools from within a subagent context.
*/
readonly subAgentInvocationId?: string;
/**
* Display name of the subagent that is invoking this request.
*/
readonly subAgentName?: string;
/**
* The request ID of the parent request that invoked this subagent.
*/
readonly parentRequestId?: string;
/**
* The permission level for tool auto-approval in this request.
* - `'autoApprove'`: Auto-approve all tool calls and retry on errors.
* - `'autopilot'`: Everything autoApprove does plus continues until the task is done.
*/
readonly permissionLevel?: string;
/**
* Whether any hooks are enabled for this request.
*/
readonly hasHooksEnabled: boolean;
}
export enum ChatRequestEditedFileEventKind {
Keep = 1,
Undo = 2,
UserModification = 3,
}
export interface ChatRequestEditedFileEvent {
readonly uri: Uri;
readonly eventKind: ChatRequestEditedFileEventKind;
}
/**
* ChatRequestTurn + private additions. Note- at runtime this is the SAME as ChatRequestTurn and instanceof is safe.
*/
export class ChatRequestTurn2 {
/**
* The id of the chat request. Used to identity an interaction with any of the chat surfaces.
*/
readonly id?: string;
/**
* The prompt as entered by the user.
*
* Information about references used in this request is stored in {@link ChatRequestTurn.references}.
*
* *Note* that the {@link ChatParticipant.name name} of the participant and the {@link ChatCommand.name command}
* are not part of the prompt.
*/
readonly prompt: string;
/**
* The id of the chat participant to which this request was directed.
*/
readonly participant: string;
/**
* The name of the {@link ChatCommand command} that was selected for this request.
*/
readonly command?: string;
/**
* The references that were used in this message.
*/
readonly references: ChatPromptReference[];
/**
* The list of tools were attached to this request.
*/
readonly toolReferences: readonly ChatLanguageModelToolReference[];
/**
* Events for edited files in this session collected between the previous request and this one.
*/
readonly editedFileEvents?: ChatRequestEditedFileEvent[];
/**
* The identifier of the language model that was used for this request, if known.
*/
readonly modelId?: string;
/**
* The mode instructions that were active for this request, if any.
*/
readonly modeInstructions2?: ChatRequestModeInstructions;
/**
* @hidden
*/
constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined, id: string | undefined, modelId: string | undefined, modeInstructions2: ChatRequestModeInstructions | undefined);
}
export class ChatResponseTurn2 {
/**
* The id of the chat response. Used to identity an interaction with any of the chat surfaces.
*/
readonly id?: string;
/**
* The content that was received from the chat participant. Only the stream parts that represent actual content (not metadata) are represented.
*/
readonly response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart | ExtendedChatResponsePart | ChatToolInvocationPart>;
/**
* The result that was received from the chat participant.
*/
readonly result: ChatResult;
/**
* The id of the chat participant that this response came from.
*/
readonly participant: string;
/**
* The name of the command that this response came from.
*/
readonly command?: string;
constructor(response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart | ExtendedChatResponsePart>, result: ChatResult, participant: string);
}
export interface ChatParticipant {
supportIssueReporting?: boolean;
}
export enum ChatErrorLevel {
Info = 0,
Warning = 1,
Error = 2,
}
export interface ChatErrorDetails {
/**
* If set to true, the message content is completely hidden. Only ChatErrorDetails#message will be shown.
*/
responseIsRedacted?: boolean;
isQuotaExceeded?: boolean;
isRateLimited?: boolean;
level?: ChatErrorLevel;
code?: string;
}
export namespace chat {
export function createDynamicChatParticipant(id: string, dynamicProps: DynamicChatParticipantProps, handler: ChatExtendedRequestHandler): ChatParticipant;
}
/**
* These don't get set on the ChatParticipant after creation, like other props, because they are typically defined in package.json and we want them at the time of creation.
*/
export interface DynamicChatParticipantProps {
name: string;
publisherName: string;
description?: string;
fullName?: string;
}
export namespace lm {
export function registerIgnoredFileProvider(provider: LanguageModelIgnoredFileProvider): Disposable;
}
export interface LanguageModelIgnoredFileProvider {
provideFileIgnored(uri: Uri, token: CancellationToken): ProviderResult<boolean>;
}
export type PreToolUsePermissionDecision = 'allow' | 'deny' | 'ask';
export interface LanguageModelToolInvocationOptions<T> {
chatRequestId?: string;
chatSessionResource?: Uri;
chatInteractionId?: string;
terminalCommand?: string;
/**
* Unique ID for the subagent invocation, used to group tool calls from the same subagent run together.
*/
subAgentInvocationId?: string;
/**
* Pre-tool-use hook result, if the hook was already executed by the caller.
* When provided, the tools service will skip executing its own preToolUse hook
* and use this result for permission decisions and input modifications instead.
*/
preToolUseResult?: {
permissionDecision?: PreToolUsePermissionDecision;
permissionDecisionReason?: string;
updatedInput?: object;
};
}
export interface LanguageModelToolInvocationPrepareOptions<T> {
/**
* The input that the tool is being invoked with.
*/
input: T;
chatRequestId?: string;
chatSessionResource?: Uri;
chatInteractionId?: string;
/**
* If set, tells the tool that it should include confirmation messages.
*/
forceConfirmationReason?: string;
}
export interface PreparedToolInvocation {
pastTenseMessage?: string | MarkdownString;
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
}
export class ExtendedLanguageModelToolResult extends LanguageModelToolResult {
toolResultMessage?: string | MarkdownString;
toolResultDetails?: Array<Uri | Location>;
toolMetadata?: unknown;
/** Whether there was an error calling the tool. The tool may still have partially succeeded. */
hasError?: boolean;
}
// #region Chat participant detection
export interface ChatParticipantMetadata {
participant: string;
command?: string;
disambiguation: { category: string; description: string; examples: string[] }[];
}
export interface ChatParticipantDetectionResult {
participant: string;
command?: string;
}
export interface ChatParticipantDetectionProvider {
provideParticipantDetection(chatRequest: ChatRequest, context: ChatContext, options: { participants?: ChatParticipantMetadata[]; location: ChatLocation }, token: CancellationToken): ProviderResult<ChatParticipantDetectionResult>;
}
export namespace chat {
export function registerChatParticipantDetectionProvider(participantDetectionProvider: ChatParticipantDetectionProvider): Disposable;
export const onDidDisposeChatSession: Event<string>;
}
export namespace window {
/**
* The resource URI of the currently active chat panel session,
* or `undefined` if there is no active chat panel session.
*/
export const activeChatPanelSessionResource: Uri | undefined;
/**
* An event that fires when the active chat panel session resource changes.
*/
export const onDidChangeActiveChatPanelSessionResource: Event<Uri | undefined>;
}
// #endregion
// #region ChatErrorDetailsWithConfirmation
export interface ChatErrorDetails {
confirmationButtons?: ChatErrorDetailsConfirmationButton[];
}
export interface ChatErrorDetailsConfirmationButton {
data: any;
label: string;
}
// #endregion
// #region LanguageModelProxyProvider
/**
* Duplicated so that this proposal and languageModelProxy can be independent.
*/
export interface LanguageModelProxy extends Disposable {
readonly uri: Uri;
readonly key: string;
}
export interface LanguageModelProxyProvider {
provideModelProxy(forExtensionId: string, token: CancellationToken): ProviderResult<LanguageModelProxy>;
}
export namespace lm {
export function registerLanguageModelProxyProvider(provider: LanguageModelProxyProvider): Disposable;
}
// #endregion
// #region Steering
export interface ChatContext {
/**
* Set to `true` by the editor to request the language model gracefully
* stop after its next opportunity. When set, it's likely that the editor
* will immediately follow up with a new request in the same conversation.
*/
readonly yieldRequested: boolean;
/**
* The resource URI identifying the chat session this context belongs to.
* Available when the context is provided for title generation, summarization,
* or other session-scoped operations. Extracted from the session's history entries.
*/
readonly sessionResource?: Uri;
}
// #endregion
export interface LanguageModelToolInformation {
/**
* The full reference name of this tool as used in agent definition files.
*
* For MCP tools, this is the canonical name in the format `serverShortName/toolReferenceName`
* (e.g., `github/search_issues`). This can be used to map between the tool names specified
* in agent `.md` files and the tool's internal {@link LanguageModelToolInformation.name id}.
*
* This property is only set for MCP tools. For other tool types, it is `undefined`.
*/
readonly fullReferenceName?: string;
}
}