Skip to content

Commit 6334988

Browse files
authored
Avoid "slash command" name in agent API (microsoft#202729)
* Avoid "slash command" name in agent API * Fix reference * Fix
1 parent fa989a1 commit 6334988

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

extensions/vscode-api-tests/src/singlefolder-tests/chat.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ suite('chat', () => {
3535
deferred.complete(request);
3636
return null;
3737
});
38-
agent.slashCommandProvider = {
39-
provideSlashCommands: (_token) => {
38+
agent.subCommandProvider = {
39+
provideSubCommands: (_token) => {
4040
return [{ name: 'hello', description: 'Hello' }];
4141
}
4242
};

src/vs/workbench/api/common/extHostChatAgents2.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ export class ExtHostChatAgents2 implements ExtHostChatAgentsShape2 {
240240

241241
class ExtHostChatAgent<TResult extends vscode.ChatAgentResult2> {
242242

243-
private _slashCommandProvider: vscode.ChatAgentSlashCommandProvider | undefined;
244-
private _lastSlashCommands: vscode.ChatAgentSlashCommand[] | undefined;
243+
private _slashCommandProvider: vscode.ChatAgentSubCommandProvider | undefined;
244+
private _lastSlashCommands: vscode.ChatAgentSubCommand[] | undefined;
245245
private _followupProvider: vscode.FollowupProvider<TResult> | undefined;
246246
private _description: string | undefined;
247247
private _fullName: string | undefined;
@@ -297,7 +297,7 @@ class ExtHostChatAgent<TResult extends vscode.ChatAgentResult2> {
297297
if (!this._slashCommandProvider) {
298298
return [];
299299
}
300-
const result = await this._slashCommandProvider.provideSlashCommands(token);
300+
const result = await this._slashCommandProvider.provideSubCommands(token);
301301
if (!result) {
302302
return [];
303303
}
@@ -385,10 +385,10 @@ class ExtHostChatAgent<TResult extends vscode.ChatAgentResult2> {
385385
that._iconPath = v;
386386
updateMetadataSoon();
387387
},
388-
get slashCommandProvider() {
388+
get subCommandProvider() {
389389
return that._slashCommandProvider;
390390
},
391-
set slashCommandProvider(v) {
391+
set subCommandProvider(v) {
392392
that._slashCommandProvider = v;
393393
updateMetadataSoon();
394394
},

src/vs/workbench/api/common/extHostTypeConverters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2430,7 +2430,7 @@ export namespace ChatResponseProgress {
24302430
}
24312431

24322432
export namespace ChatAgentRequest {
2433-
export function to(request: IChatAgentRequest, slashCommand: vscode.ChatAgentSlashCommand | undefined): vscode.ChatAgentRequest {
2433+
export function to(request: IChatAgentRequest, slashCommand: vscode.ChatAgentSubCommand | undefined): vscode.ChatAgentRequest {
24342434
return {
24352435
prompt: request.message,
24362436
variables: ChatVariable.objectTo(request.variables),

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ declare module 'vscode' {
8383
readonly kind: ChatAgentResultFeedbackKind;
8484
}
8585

86-
export interface ChatAgentSlashCommand {
86+
export interface ChatAgentSubCommand {
8787
/**
8888
* A short name by which this command is referred to in the UI, e.g. `fix` or
8989
* `explain` for commands that fix an issue or explain code.
9090
*
91-
* **Note**: The name should be unique among the slash commands provided by this agent.
91+
* **Note**: The name should be unique among the subCommands provided by this agent.
9292
*/
9393
readonly name: string;
9494

@@ -98,39 +98,39 @@ declare module 'vscode' {
9898
readonly description: string;
9999

100100
/**
101-
* When the user clicks this slash command in `/help`, this text will be submitted to this slash command
101+
* When the user clicks this subCommand in `/help`, this text will be submitted to this subCommand
102102
*/
103103
readonly sampleRequest?: string;
104104

105105
/**
106106
* Whether executing the command puts the
107107
* chat into a persistent mode, where the
108-
* slash command is prepended to the chat input.
108+
* subCommand is prepended to the chat input.
109109
*/
110110
readonly shouldRepopulate?: boolean;
111111

112112
/**
113113
* Placeholder text to render in the chat input
114-
* when the slash command has been repopulated.
114+
* when the subCommand has been repopulated.
115115
* Has no effect if `shouldRepopulate` is `false`.
116116
*/
117117
// TODO@API merge this with shouldRepopulate? so that invalid state cannot be represented?
118118
readonly followupPlaceholder?: string;
119119
}
120120

121-
export interface ChatAgentSlashCommandProvider {
121+
export interface ChatAgentSubCommandProvider {
122122

123123
/**
124-
* Returns a list of slash commands that its agent is capable of handling. A slash command
124+
* Returns a list of subCommands that its agent is capable of handling. A subCommand
125125
* can be selected by the user and will then be passed to the {@link ChatAgentHandler handler}
126-
* via the {@link ChatAgentRequest.slashCommand slashCommand} property.
126+
* via the {@link ChatAgentRequest.subCommand subCommand} property.
127127
*
128128
*
129129
* @param token A cancellation token.
130-
* @returns A list of slash commands. The lack of a result can be signaled by returning `undefined`, `null`, or
130+
* @returns A list of subCommands. The lack of a result can be signaled by returning `undefined`, `null`, or
131131
* an empty array.
132132
*/
133-
provideSlashCommands(token: CancellationToken): ProviderResult<ChatAgentSlashCommand[]>;
133+
provideSubCommands(token: CancellationToken): ProviderResult<ChatAgentSubCommand[]>;
134134
}
135135

136136
// TODO@API This should become a progress type, and use vscode.Command
@@ -208,17 +208,17 @@ declare module 'vscode' {
208208
} | ThemeIcon;
209209

210210
/**
211-
* This provider will be called to retrieve the agent's slash commands.
211+
* This provider will be called to retrieve the agent's subCommands.
212212
*/
213-
slashCommandProvider?: ChatAgentSlashCommandProvider;
213+
subCommandProvider?: ChatAgentSubCommandProvider;
214214

215215
/**
216216
* This provider will be called once after each request to retrieve suggested followup questions.
217217
*/
218218
followupProvider?: FollowupProvider<TResult>;
219219

220220
/**
221-
* When the user clicks this agent in `/help`, this text will be submitted to this slash command
221+
* When the user clicks this agent in `/help`, this text will be submitted to this subCommand
222222
*/
223223
sampleRequest?: string;
224224

@@ -240,10 +240,10 @@ declare module 'vscode' {
240240
export interface ChatAgentRequest {
241241

242242
/**
243-
* The prompt entered by the user. The {@link ChatAgent2.name name} of the agent or the {@link ChatAgentSlashCommand.name slash command}
243+
* The prompt entered by the user. The {@link ChatAgent2.name name} of the agent or the {@link ChatAgentSubCommand.name subCommand}
244244
* are not part of the prompt.
245245
*
246-
* @see {@link ChatAgentRequest.slashCommand}
246+
* @see {@link ChatAgentRequest.subCommand}
247247
*/
248248
prompt: string;
249249

@@ -253,14 +253,14 @@ declare module 'vscode' {
253253
agentId: string;
254254

255255
/**
256-
* The {@link ChatAgentSlashCommand slash command} that was selected for this request. It is guaranteed that the passed slash
257-
* command is an instance that was previously returned from the {@link ChatAgentSlashCommandProvider.provideSlashCommands slash command provider}.
256+
* The {@link ChatAgentSubCommand subCommand} that was selected for this request. It is guaranteed that the passed subCommand
257+
* is an instance that was previously returned from the {@link ChatAgentSubCommandProvider.provideSubCommands subCommand provider}.
258258
* @deprecated this will be replaced by `subCommand`
259259
*/
260-
slashCommand?: ChatAgentSlashCommand;
260+
slashCommand?: ChatAgentSubCommand;
261261

262262
/**
263-
* The name of the {@link ChatAgentSlashCommand slash command} that was selected for this request.
263+
* The name of the {@link ChatAgentSubCommand subCommand} that was selected for this request.
264264
*/
265265
subCommand?: string;
266266

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare module 'vscode' {
2626

2727
export interface ChatAgentDetectedAgent {
2828
agentName: string;
29-
command?: ChatAgentSlashCommand;
29+
command?: ChatAgentSubCommand;
3030
}
3131

3232
export interface ChatAgentVulnerability {

0 commit comments

Comments
 (0)