Skip to content

Commit b3b6068

Browse files
authored
jsdoc and todo-update (microsoft#205201)
microsoft#199908
1 parent ca86859 commit b3b6068

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

src/vscode-dts/vscode.proposed.chatAgents2.d.ts

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ declare module 'vscode' {
2121
/**
2222
* The ID of the chat agent to which this request was directed.
2323
*/
24+
// TODO@API NAME: agentId shouldbe agentName or just agent (because it is ChatAgent#name)
2425
readonly agent: { readonly extensionId: string; readonly agentId: string };
2526

2627
/**
@@ -49,6 +50,7 @@ declare module 'vscode' {
4950
*/
5051
readonly result: ChatAgentResult2;
5152

53+
// TODO@API NAME: agentId shouldbe agentName or just agent (because it is ChatAgent#name)
5254
readonly agent: { readonly extensionId: string; readonly agentId: string };
5355

5456
private constructor(response: ReadonlyArray<ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>, result: ChatAgentResult2, agentId: { extensionId: string; agentId: string });
@@ -289,9 +291,28 @@ declare module 'vscode' {
289291
dispose(): void;
290292
}
291293

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+
*/
292297
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+
*/
293305
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+
*/
294313
readonly range: [start: number, end: number];
314+
315+
// TODO@API decouple of resolve API, use `value: string | Uri | (maybe) unknown?`
295316
readonly values: ChatVariableValue[];
296317
}
297318

@@ -313,8 +334,15 @@ declare module 'vscode' {
313334
readonly command: string | undefined;
314335

315336
/**
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.
317344
*/
345+
// TODO@API Q? are there implicit variables that are not part of the prompt?
318346
readonly variables: readonly ChatAgentResolvedVariable[];
319347
}
320348

@@ -435,6 +463,7 @@ declare module 'vscode' {
435463

436464
export class ChatResponseProgressPart {
437465
value: string;
466+
// TODO@API inline
438467
constructor(value: string);
439468
}
440469

@@ -448,18 +477,21 @@ declare module 'vscode' {
448477
constructor(value: Command);
449478
}
450479

480+
/**
481+
* Represents the different chat response types.
482+
*/
451483
export type ChatResponsePart = ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart
452484
| ChatResponseProgressPart | ChatResponseReferencePart | ChatResponseCommandButtonPart;
453485

454486

455-
456487
export namespace chat {
457488

458489
/**
459490
* Create a new {@link ChatAgent2 chat agent} instance.
460491
*
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.
463495
* @returns A new chat agent
464496
*/
465497
export function createChatAgent(name: string, handler: ChatAgentRequestHandler): ChatAgent2;

0 commit comments

Comments
 (0)