@@ -21,6 +21,7 @@ declare module 'vscode' {
21
21
/**
22
22
* The ID of the chat agent to which this request was directed.
23
23
*/
24
+ // TODO@API NAME: agentId shouldbe agentName or just agent (because it is ChatAgent#name)
24
25
readonly agent : { readonly extensionId : string ; readonly agentId : string } ;
25
26
26
27
/**
@@ -49,6 +50,7 @@ declare module 'vscode' {
49
50
*/
50
51
readonly result : ChatAgentResult2 ;
51
52
53
+ // TODO@API NAME: agentId shouldbe agentName or just agent (because it is ChatAgent#name)
52
54
readonly agent : { readonly extensionId : string ; readonly agentId : string } ;
53
55
54
56
private constructor ( response : ReadonlyArray < ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart > , result : ChatAgentResult2 , agentId : { extensionId : string ; agentId : string } ) ;
@@ -289,9 +291,28 @@ declare module 'vscode' {
289
291
dispose ( ) : void ;
290
292
}
291
293
294
+ /**
295
+ * A resolved variable value is a name-value pair as well as the range in the prompt where a variable was used.
296
+ */
292
297
export interface ChatAgentResolvedVariable {
298
+
299
+ /**
300
+ * The name of the variable.
301
+ *
302
+ * *Note* that the name doesn't include the leading `#`-character,
303
+ * e.g `selection` for `#selection`.
304
+ */
293
305
readonly name : string ;
306
+
307
+ /**
308
+ * The start and end index of the variable in the {@link ChatAgentRequest.prompt prompt}.
309
+ *
310
+ * *Note* that the indices take the leading `#`-character into account which means they can
311
+ * used to modify the prompt as-is.
312
+ */
294
313
readonly range : [ start : number , end : number ] ;
314
+
315
+ // TODO@API decouple of resolve API, use `value: string | Uri | (maybe) unknown?`
295
316
readonly values : ChatVariableValue [ ] ;
296
317
}
297
318
@@ -313,8 +334,15 @@ declare module 'vscode' {
313
334
readonly command : string | undefined ;
314
335
315
336
/**
316
- * The list of variables that are referenced in the prompt.
337
+ * The list of variables and their values that are referenced in the prompt.
338
+ *
339
+ * *Note* that the prompt contains varibale references as authored and that it is up to the agent
340
+ * to further modify the prompt, for instance by inlining variable values or creating links to
341
+ * headings which contain the resolved values. vvariables are sorted in reverse by their range
342
+ * in the prompt. That means the last variable in the prompt is the first in this list. This simplifies
343
+ * string-manipulation of the prompt.
317
344
*/
345
+ // TODO@API Q? are there implicit variables that are not part of the prompt?
318
346
readonly variables : readonly ChatAgentResolvedVariable [ ] ;
319
347
}
320
348
@@ -435,6 +463,7 @@ declare module 'vscode' {
435
463
436
464
export class ChatResponseProgressPart {
437
465
value : string ;
466
+ // TODO@API inline
438
467
constructor ( value : string ) ;
439
468
}
440
469
@@ -448,18 +477,21 @@ declare module 'vscode' {
448
477
constructor ( value : Command ) ;
449
478
}
450
479
480
+ /**
481
+ * Represents the different chat response types.
482
+ */
451
483
export type ChatResponsePart = ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart
452
484
| ChatResponseProgressPart | ChatResponseReferencePart | ChatResponseCommandButtonPart ;
453
485
454
486
455
-
456
487
export namespace chat {
457
488
458
489
/**
459
490
* Create a new {@link ChatAgent2 chat agent} instance.
460
491
*
461
- * @param name Short name by which this agent is referred to in the UI
462
- * @param handler The reply-handler of the agent.
492
+ * @param name Short name by which the agent is referred to in the UI. The name must be unique for the extension
493
+ * contributing the agent but can collide with names from other extensions.
494
+ * @param handler A request handler for the agent.
463
495
* @returns A new chat agent
464
496
*/
465
497
export function createChatAgent ( name : string , handler : ChatAgentRequestHandler ) : ChatAgent2 ;
0 commit comments