Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 38 additions & 16 deletions src/vs/workbench/contrib/chat/browser/chatSlashCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { IChatWidgetService } from './chat.js';
import { agentSlashCommandToMarkdown, agentToMarkdown } from './widget/chatContentParts/chatMarkdownDecorationsRenderer.js';
import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { AICustomizationManagementCommands, AICustomizationManagementSection } from './aiCustomization/aiCustomizationManagement.js';
import { getChatSessionType } from '../common/model/chatUri.js';

export class ChatSlashCommandsContribution extends Disposable {

Expand Down Expand Up @@ -66,9 +68,13 @@ export class ChatSlashCommandsContribution extends Disposable {
executeImmediately: true,
silent: true,
locations: [ChatAgentLocation.Chat],
sessionTypes: [SessionType.Local],
}, async () => {
await instantiationService.invokeFunction(showConfigureHooksQuickPick);
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
}, async (_prompt, _progress, _history, _location, sessionResource) => {
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Hooks);
} else {
await instantiationService.invokeFunction(showConfigureHooksQuickPick);
}
}));
this._store.add(slashCommandService.registerSlashCommand({
command: 'models',
Expand All @@ -77,7 +83,7 @@ export class ChatSlashCommandsContribution extends Disposable {
executeImmediately: true,
silent: true,
locations: [ChatAgentLocation.Chat],
}, async () => {
}, async (_promp) => {
await commandService.executeCommand(OpenModelPickerAction.ID);
}));
this._store.add(slashCommandService.registerSlashCommand({
Expand Down Expand Up @@ -121,9 +127,13 @@ export class ChatSlashCommandsContribution extends Disposable {
executeImmediately: true,
silent: true,
locations: [ChatAgentLocation.Chat],
sessionTypes: [SessionType.Local],
}, async () => {
await commandService.executeCommand(OpenModePickerAction.ID);
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
}, async (_prompt, _progress, _history, _location, sessionResource) => {
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Agents);
} else {
await commandService.executeCommand(OpenModePickerAction.ID);
}
}));
this._store.add(slashCommandService.registerSlashCommand({
command: 'skills',
Expand All @@ -132,9 +142,13 @@ export class ChatSlashCommandsContribution extends Disposable {
executeImmediately: true,
silent: true,
locations: [ChatAgentLocation.Chat],
sessionTypes: [SessionType.Local],
}, async () => {
await commandService.executeCommand(CONFIGURE_SKILLS_ACTION_ID);
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
}, async (_prompt, _progress, _history, _location, sessionResource) => {
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Skills);
} else {
await commandService.executeCommand(CONFIGURE_SKILLS_ACTION_ID);
}
}));
this._store.add(slashCommandService.registerSlashCommand({
command: 'instructions',
Expand All @@ -143,9 +157,13 @@ export class ChatSlashCommandsContribution extends Disposable {
executeImmediately: true,
silent: true,
locations: [ChatAgentLocation.Chat],
sessionTypes: [SessionType.Local],
}, async () => {
await commandService.executeCommand(CONFIGURE_INSTRUCTIONS_ACTION_ID);
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
}, async (_prompt, _progress, _history, _location, sessionResource) => {
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Instructions);
} else {
await commandService.executeCommand(CONFIGURE_INSTRUCTIONS_ACTION_ID);
}
}));
this._store.add(slashCommandService.registerSlashCommand({
command: 'prompts',
Expand All @@ -154,9 +172,13 @@ export class ChatSlashCommandsContribution extends Disposable {
executeImmediately: true,
silent: true,
locations: [ChatAgentLocation.Chat],
sessionTypes: [SessionType.Local],
}, async () => {
await commandService.executeCommand(CONFIGURE_PROMPTS_ACTION_ID);
sessionTypes: [SessionType.Local, SessionType.AgentHostCopilot],
}, async (_prompt, _progress, _history, _location, sessionResource) => {
if (getChatSessionType(sessionResource) === SessionType.AgentHostCopilot) {
await commandService.executeCommand(AICustomizationManagementCommands.OpenEditor, AICustomizationManagementSection.Prompts);
} else {
await commandService.executeCommand(CONFIGURE_PROMPTS_ACTION_ID);
}
}));
this._store.add(slashCommandService.registerSlashCommand({
command: 'fork',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export namespace SessionType {
export const ClaudeCode = 'claude-code';
export const Codex = 'openai-codex';
export const Growth = 'copilot-growth';
export const AgentHostCopilot = 'agent-host-copilot';
export const AgentHostCopilot = 'agent-host-copilotcli';
}

/**
Expand Down
Loading