Skip to content

Commit fff2eae

Browse files
authored
Do a pass on chatAgents2 docs (#197688)
#197687
1 parent 71da595 commit fff2eae

File tree

1 file changed

+79
-7
lines changed

1 file changed

+79
-7
lines changed

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

+79-7
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,77 @@ declare module 'vscode' {
1212
history: ChatMessage[];
1313
}
1414

15+
/**
16+
* Represents an error result from a chat request.
17+
*/
1518
export interface ChatAgentErrorDetails {
19+
/**
20+
* An error message that is shown to the user.
21+
*/
1622
message: string;
23+
24+
/**
25+
* If partial markdown content was sent over the `progress` callback before the response terminated, then this flag
26+
* can be set to true and it will be rendered with incomplete markdown features patched up.
27+
*
28+
* For example, if the response terminated after sending part of a triple-backtick code block, then the editor will
29+
* render it as a complete code block.
30+
*/
1731
responseIsIncomplete?: boolean;
32+
33+
/**
34+
* If set to true, the response will be partly blurred out.
35+
*/
1836
responseIsFiltered?: boolean;
1937
}
2038

39+
/**
40+
* The result of a chat request.
41+
*/
2142
export interface ChatAgentResult2 {
43+
/**
44+
* If the request resulted in an error, this property defines the error details.
45+
*/
2246
errorDetails?: ChatAgentErrorDetails;
2347
}
2448

49+
/**
50+
* Represents the type of user feedback received.
51+
*/
2552
export enum ChatAgentResultFeedbackKind {
53+
/**
54+
* The user marked the result as helpful.
55+
*/
2656
Unhelpful = 0,
57+
58+
/**
59+
* The user marked the result as unhelpful.
60+
*/
2761
Helpful = 1,
2862
}
2963

64+
/**
65+
* Represents user feedback for a result.
66+
*/
3067
export interface ChatAgentResult2Feedback {
68+
/**
69+
* This instance of ChatAgentResult2 is the same instance that was returned from the chat agent,
70+
* and it can be extended with arbitrary properties if needed.
71+
*/
3172
readonly result: ChatAgentResult2;
73+
74+
/**
75+
* The kind of feedback that was received.
76+
*/
3277
readonly kind: ChatAgentResultFeedbackKind;
3378
}
3479

3580
export interface ChatAgentSlashCommand {
3681
/**
3782
* A short name by which this command is referred to in the UI, e.g. `fix` or
3883
* `explain` for commands that fix an issue or explain code.
84+
*
85+
* **Note**: The name should be unique among the slash commands provided by this agent.
3986
*/
4087
readonly name: string;
4188

@@ -62,7 +109,7 @@ declare module 'vscode' {
62109

63110
/**
64111
* Returns a list of slash commands that its agent is capable of handling. A slash command
65-
* and be selected by the user and will then be passed to the {@link ChatAgentHandler handler}
112+
* can be selected by the user and will then be passed to the {@link ChatAgentHandler handler}
66113
* via the {@link ChatAgentRequest.slashCommand slashCommand} property.
67114
*
68115
*
@@ -73,7 +120,7 @@ declare module 'vscode' {
73120
provideSlashCommands(token: CancellationToken): ProviderResult<ChatAgentSlashCommand[]>;
74121
}
75122

76-
// TODO@API is this just a vscode.Command?
123+
// TODO@API This should become a progress type, and use vscode.Command
77124
// TODO@API what's the when-property for? how about not returning it in the first place?
78125
export interface ChatAgentCommandFollowup {
79126
commandId: string;
@@ -82,27 +129,49 @@ declare module 'vscode' {
82129
when?: string;
83130
}
84131

132+
/**
133+
* A followup question suggested by the model.
134+
*/
85135
export interface ChatAgentReplyFollowup {
136+
/**
137+
* The message to send to the chat.
138+
*/
86139
message: string;
140+
141+
/**
142+
* A tooltip to show when hovering over the followup.
143+
*/
87144
tooltip?: string;
145+
146+
/**
147+
* A title to show the user, when it is different than the message.
148+
*/
88149
title?: string;
89150
}
90151

91152
export type ChatAgentFollowup = ChatAgentCommandFollowup | ChatAgentReplyFollowup;
92153

154+
/**
155+
* Will be invoked once after each request to get suggested followup questions to show the user. The user can click the followup to send it to the chat.
156+
*/
93157
export interface FollowupProvider {
158+
/**
159+
*
160+
* @param result The same instance of the result object that was returned by the chat agent, and it can be extended with arbitrary properties if needed.
161+
* @param token A cancellation token.
162+
*/
94163
provideFollowups(result: ChatAgentResult2, token: CancellationToken): ProviderResult<ChatAgentFollowup[]>;
95164
}
96165

97166
export interface ChatAgent2 {
98167

99168
/**
100-
* The short name by which this agent is referred to in the UI, e.g `workspace`
169+
* The short name by which this agent is referred to in the UI, e.g `workspace`.
101170
*/
102171
readonly name: string;
103172

104173
/**
105-
* The full name of this agent
174+
* The full name of this agent.
106175
*/
107176
fullName: string;
108177

@@ -125,8 +194,14 @@ declare module 'vscode' {
125194
dark: Uri;
126195
} | ThemeIcon;
127196

197+
/**
198+
* This provider will be called to retrieve the agent's slash commands.
199+
*/
128200
slashCommandProvider?: ChatAgentSlashCommandProvider;
129201

202+
/**
203+
* This provider will be called once after each request to retrieve suggested followup questions.
204+
*/
130205
followupProvider?: FollowupProvider;
131206

132207
/**
@@ -138,9 +213,6 @@ declare module 'vscode' {
138213
*/
139214
onDidReceiveFeedback: Event<ChatAgentResult2Feedback>;
140215

141-
// TODO@API Something like prepareSession from the interactive chat provider might be needed.Probably nobody needs it right now.
142-
// prepareSession();
143-
144216
/**
145217
* TODO@API explain what happens wrt to history, in-flight requests etc...
146218
* Dispose this agent and free resources

0 commit comments

Comments
 (0)