@@ -12,30 +12,77 @@ declare module 'vscode' {
12
12
history : ChatMessage [ ] ;
13
13
}
14
14
15
+ /**
16
+ * Represents an error result from a chat request.
17
+ */
15
18
export interface ChatAgentErrorDetails {
19
+ /**
20
+ * An error message that is shown to the user.
21
+ */
16
22
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
+ */
17
31
responseIsIncomplete ?: boolean ;
32
+
33
+ /**
34
+ * If set to true, the response will be partly blurred out.
35
+ */
18
36
responseIsFiltered ?: boolean ;
19
37
}
20
38
39
+ /**
40
+ * The result of a chat request.
41
+ */
21
42
export interface ChatAgentResult2 {
43
+ /**
44
+ * If the request resulted in an error, this property defines the error details.
45
+ */
22
46
errorDetails ?: ChatAgentErrorDetails ;
23
47
}
24
48
49
+ /**
50
+ * Represents the type of user feedback received.
51
+ */
25
52
export enum ChatAgentResultFeedbackKind {
53
+ /**
54
+ * The user marked the result as helpful.
55
+ */
26
56
Unhelpful = 0 ,
57
+
58
+ /**
59
+ * The user marked the result as unhelpful.
60
+ */
27
61
Helpful = 1 ,
28
62
}
29
63
64
+ /**
65
+ * Represents user feedback for a result.
66
+ */
30
67
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
+ */
31
72
readonly result : ChatAgentResult2 ;
73
+
74
+ /**
75
+ * The kind of feedback that was received.
76
+ */
32
77
readonly kind : ChatAgentResultFeedbackKind ;
33
78
}
34
79
35
80
export interface ChatAgentSlashCommand {
36
81
/**
37
82
* A short name by which this command is referred to in the UI, e.g. `fix` or
38
83
* `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.
39
86
*/
40
87
readonly name : string ;
41
88
@@ -62,7 +109,7 @@ declare module 'vscode' {
62
109
63
110
/**
64
111
* 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}
66
113
* via the {@link ChatAgentRequest.slashCommand slashCommand} property.
67
114
*
68
115
*
@@ -73,7 +120,7 @@ declare module 'vscode' {
73
120
provideSlashCommands ( token : CancellationToken ) : ProviderResult < ChatAgentSlashCommand [ ] > ;
74
121
}
75
122
76
- // TODO@API is this just a vscode.Command?
123
+ // TODO@API This should become a progress type, and use vscode.Command
77
124
// TODO@API what's the when-property for? how about not returning it in the first place?
78
125
export interface ChatAgentCommandFollowup {
79
126
commandId : string ;
@@ -82,27 +129,49 @@ declare module 'vscode' {
82
129
when ?: string ;
83
130
}
84
131
132
+ /**
133
+ * A followup question suggested by the model.
134
+ */
85
135
export interface ChatAgentReplyFollowup {
136
+ /**
137
+ * The message to send to the chat.
138
+ */
86
139
message : string ;
140
+
141
+ /**
142
+ * A tooltip to show when hovering over the followup.
143
+ */
87
144
tooltip ?: string ;
145
+
146
+ /**
147
+ * A title to show the user, when it is different than the message.
148
+ */
88
149
title ?: string ;
89
150
}
90
151
91
152
export type ChatAgentFollowup = ChatAgentCommandFollowup | ChatAgentReplyFollowup ;
92
153
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
+ */
93
157
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
+ */
94
163
provideFollowups ( result : ChatAgentResult2 , token : CancellationToken ) : ProviderResult < ChatAgentFollowup [ ] > ;
95
164
}
96
165
97
166
export interface ChatAgent2 {
98
167
99
168
/**
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`.
101
170
*/
102
171
readonly name : string ;
103
172
104
173
/**
105
- * The full name of this agent
174
+ * The full name of this agent.
106
175
*/
107
176
fullName : string ;
108
177
@@ -125,8 +194,14 @@ declare module 'vscode' {
125
194
dark : Uri ;
126
195
} | ThemeIcon ;
127
196
197
+ /**
198
+ * This provider will be called to retrieve the agent's slash commands.
199
+ */
128
200
slashCommandProvider ?: ChatAgentSlashCommandProvider ;
129
201
202
+ /**
203
+ * This provider will be called once after each request to retrieve suggested followup questions.
204
+ */
130
205
followupProvider ?: FollowupProvider ;
131
206
132
207
/**
@@ -138,9 +213,6 @@ declare module 'vscode' {
138
213
*/
139
214
onDidReceiveFeedback : Event < ChatAgentResult2Feedback > ;
140
215
141
- // TODO@API Something like prepareSession from the interactive chat provider might be needed.Probably nobody needs it right now.
142
- // prepareSession();
143
-
144
216
/**
145
217
* TODO@API explain what happens wrt to history, in-flight requests etc...
146
218
* Dispose this agent and free resources
0 commit comments