-
Notifications
You must be signed in to change notification settings - Fork 735
Expand file tree
/
Copy pathvscode.proposed.chatParticipantPrivate.d.ts
More file actions
276 lines (224 loc) · 7.56 KB
/
vscode.proposed.chatParticipantPrivate.d.ts
File metadata and controls
276 lines (224 loc) · 7.56 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// version: 10
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 {
//TODO@API should be the editor
document: TextDocument;
selection: Selection;
wholeRange: Range;
constructor(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;
/**
* 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[];
}
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 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[];
/**
* @hidden
*/
constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined);
}
export class ChatResponseTurn2 {
/**
* 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;
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 interface LanguageModelToolInvocationOptions<T> {
chatRequestId?: string;
chatSessionId?: string;
chatInteractionId?: string;
terminalCommand?: string;
}
export interface LanguageModelToolInvocationPrepareOptions<T> {
/**
* The input that the tool is being invoked with.
*/
input: T;
chatRequestId?: string;
chatSessionId?: string;
chatInteractionId?: string;
}
export interface PreparedToolInvocation {
pastTenseMessage?: string | MarkdownString;
presentation?: 'hidden' | undefined;
}
export class ExtendedLanguageModelToolResult extends LanguageModelToolResult {
toolResultMessage?: string | MarkdownString;
toolResultDetails?: Array<Uri | Location>;
}
// #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>;
}
// #endregion
// #region ChatErrorDetailsWithConfirmation
export interface ChatErrorDetails {
confirmationButtons?: ChatErrorDetailsConfirmationButton[];
}
export interface ChatErrorDetailsConfirmationButton {
data: any;
label: string;
}
// #endregion
}