Skip to content

Use session types for slash commands#311912

Merged
aeschli merged 3 commits intomainfrom
aeschli/hushed-stingray-883
Apr 23, 2026
Merged

Use session types for slash commands#311912
aeschli merged 3 commits intomainfrom
aeschli/hushed-stingray-883

Conversation

@aeschli
Copy link
Copy Markdown
Contributor

@aeschli aeschli commented Apr 22, 2026

Co-authored-by: Copilot copilot@github.com

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 22, 2026 14:41
@aeschli aeschli enabled auto-merge (squash) April 22, 2026 14:41
@aeschli aeschli self-assigned this Apr 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: acb6bc5d Current: 4b6bec81

Changed (2)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates workbench chat “classic” slash commands to be scoped using chat session types (string IDs like local, copilotcli) rather than prompt targets (e.g. Target.VSCode), aligning slash-command visibility with the session/provider model used elsewhere in chat.

Changes:

  • Replaced IChatSlashData.targets with IChatSlashData.sessionTypes and updated slash-command registration and filtering accordingly.
  • Introduced SessionType constants in chatSessionsService.ts and reused them in slash-command registrations.
  • Refactored agent session provider identifiers to reference the new SessionType constants.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.ts Updates slash command metadata from targets to sessionTypes.
src/vs/workbench/contrib/chat/common/chatSessionsService.ts Adds SessionType well-known IDs and reuses it for localChatSessionType.
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts Updates completion filtering to use sessionTypes instead of prompt Target.
src/vs/workbench/contrib/chat/browser/chatSlashCommands.ts Updates built-in slash command registrations to use sessionTypes (via SessionType).
src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.ts Attempts to reuse SessionType values in AgentSessionProviders.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 1

Comment on lines 15 to 23
export enum AgentSessionProviders {
Local = 'local',
Background = 'copilotcli',
Cloud = 'copilot-cloud-agent',
Claude = 'claude-code',
Codex = 'openai-codex',
Growth = 'copilot-growth',
AgentHostCopilot = 'agent-host-copilot',
Local = SessionType.Local,
Background = SessionType.CopilotCLI,
Cloud = SessionType.CopilotCloud,
Claude = SessionType.ClaudeCode,
Codex = SessionType.Codex,
Growth = SessionType.Growth,
AgentHostCopilot = SessionType.AgentHostCopilot,
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AgentSessionProviders is a string enum, but its members are initialized with SessionType.* constants. TypeScript requires string-enum members to be string literals (computed/variable initializers are not allowed), so this will not compile. Consider either reverting these enum initializers back to string literals, or replacing AgentSessionProviders with a const object/union type (or making SessionType itself a const enum) so you can safely reuse the shared values.

See below for a potential fix:

export const AgentSessionProviders = {
	Local: SessionType.Local,
	Background: SessionType.CopilotCLI,
	Cloud: SessionType.CopilotCloud,
	Claude: SessionType.ClaudeCode,
	Codex: SessionType.Codex,
	Growth: SessionType.Growth,
	AgentHostCopilot: SessionType.AgentHostCopilot,
} as const;

export type AgentSessionProviders = typeof AgentSessionProviders[keyof typeof AgentSessionProviders];

/**
 * A session target is either a well-known {@link AgentSessionProviders} value
 * or a dynamic string for dynamically-registered providers (e.g. remote

Copilot uses AI. Check for mistakes.
alexr00
alexr00 previously approved these changes Apr 22, 2026
Co-authored-by: Copilot <copilot@github.com>
@aeschli aeschli merged commit 15cb380 into main Apr 23, 2026
26 checks passed
@aeschli aeschli deleted the aeschli/hushed-stingray-883 branch April 23, 2026 10:22
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants