Skip to content

Commit 2bc22d6

Browse files
authored
feat(chat): update session type for AgentHostCopilot to 'agent-host-copilotcli' and enhance slash command handling (#317725)
1 parent e038801 commit 2bc22d6

2 files changed

Lines changed: 39 additions & 17 deletions

File tree

src/vs/workbench/contrib/chat/browser/chatSlashCommands.ts

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import { IChatWidgetService } from './chat.js';
3131
import { agentSlashCommandToMarkdown, agentToMarkdown } from './widget/chatContentParts/chatMarkdownDecorationsRenderer.js';
3232
import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
3333
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
34+
import { AICustomizationManagementCommands, AICustomizationManagementSection } from './aiCustomization/aiCustomizationManagement.js';
35+
import { getChatSessionType } from '../common/model/chatUri.js';
3436

3537
export class ChatSlashCommandsContribution extends Disposable {
3638

@@ -66,9 +68,13 @@ export class ChatSlashCommandsContribution extends Disposable {
6668
executeImmediately: true,
6769
silent: true,
6870
locations: [ChatAgentLocation.Chat],
69-
sessionTypes: [SessionType.Local],
70-
}, async () => {
71-
await instantiationService.invokeFunction(showConfigureHooksQuickPick);
71+
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
72+
}, async (_prompt, _progress, _history, _location, sessionResource) => {
73+
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
74+
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Hooks);
75+
} else {
76+
await instantiationService.invokeFunction(showConfigureHooksQuickPick);
77+
}
7278
}));
7379
this._store.add(slashCommandService.registerSlashCommand({
7480
command: 'models',
@@ -77,7 +83,7 @@ export class ChatSlashCommandsContribution extends Disposable {
7783
executeImmediately: true,
7884
silent: true,
7985
locations: [ChatAgentLocation.Chat],
80-
}, async () => {
86+
}, async (_promp) => {
8187
await commandService.executeCommand(OpenModelPickerAction.ID);
8288
}));
8389
this._store.add(slashCommandService.registerSlashCommand({
@@ -121,9 +127,13 @@ export class ChatSlashCommandsContribution extends Disposable {
121127
executeImmediately: true,
122128
silent: true,
123129
locations: [ChatAgentLocation.Chat],
124-
sessionTypes: [SessionType.Local],
125-
}, async () => {
126-
await commandService.executeCommand(OpenModePickerAction.ID);
130+
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
131+
}, async (_prompt, _progress, _history, _location, sessionResource) => {
132+
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
133+
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Agents);
134+
} else {
135+
await commandService.executeCommand(OpenModePickerAction.ID);
136+
}
127137
}));
128138
this._store.add(slashCommandService.registerSlashCommand({
129139
command: 'skills',
@@ -132,9 +142,13 @@ export class ChatSlashCommandsContribution extends Disposable {
132142
executeImmediately: true,
133143
silent: true,
134144
locations: [ChatAgentLocation.Chat],
135-
sessionTypes: [SessionType.Local],
136-
}, async () => {
137-
await commandService.executeCommand(CONFIGURE_SKILLS_ACTION_ID);
145+
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
146+
}, async (_prompt, _progress, _history, _location, sessionResource) => {
147+
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
148+
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Skills);
149+
} else {
150+
await commandService.executeCommand(CONFIGURE_SKILLS_ACTION_ID);
151+
}
138152
}));
139153
this._store.add(slashCommandService.registerSlashCommand({
140154
command: 'instructions',
@@ -143,9 +157,13 @@ export class ChatSlashCommandsContribution extends Disposable {
143157
executeImmediately: true,
144158
silent: true,
145159
locations: [ChatAgentLocation.Chat],
146-
sessionTypes: [SessionType.Local],
147-
}, async () => {
148-
await commandService.executeCommand(CONFIGURE_INSTRUCTIONS_ACTION_ID);
160+
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
161+
}, async (_prompt, _progress, _history, _location, sessionResource) => {
162+
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
163+
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Instructions);
164+
} else {
165+
await commandService.executeCommand(CONFIGURE_INSTRUCTIONS_ACTION_ID);
166+
}
149167
}));
150168
this._store.add(slashCommandService.registerSlashCommand({
151169
command: 'prompts',
@@ -154,9 +172,13 @@ export class ChatSlashCommandsContribution extends Disposable {
154172
executeImmediately: true,
155173
silent: true,
156174
locations: [ChatAgentLocation.Chat],
157-
sessionTypes: [SessionType.Local],
158-
}, async () => {
159-
await commandService.executeCommand(CONFIGURE_PROMPTS_ACTION_ID);
175+
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
176+
}, async (_prompt, _progress, _history, _location, sessionResource) => {
177+
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
178+
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Prompts);
179+
} else {
180+
await commandService.executeCommand(CONFIGURE_PROMPTS_ACTION_ID);
181+
}
160182
}));
161183
this._store.add(slashCommandService.registerSlashCommand({
162184
command: 'fork',

src/vs/workbench/contrib/chat/common/chatSessionsService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export namespace SessionType {
204204
export const ClaudeCode = 'claude-code';
205205
export const Codex = 'openai-codex';
206206
export const Growth = 'copilot-growth';
207-
export const AgentHostCopilot = 'agent-host-copilot';
207+
export const AgentHostCopilot = 'agent-host-copilotcli';
208208
}
209209

210210
/**

0 commit comments

Comments
 (0)