SlashCommandContext
Category: Commands
Source: slash_command_context.dart
Classes
SlashCommandContext
Single dependency surface every slash command receives.
Exposes runtime objects (live readers for things that may be null or late on App at construction time) and the small set of generic services the command system relies on. Commands take only this; no bespoke per-command callbacks.
Constructor
dart
SlashCommandContext({
// Runtime — live readers
required GlueConfig? Function() configGetter,
required LlmClientFactory? Function() llmFactoryGetter,
required AgentCore Function() agentGetter,
required String Function() cwdGetter,
required String Function() modelIdGetter,
required bool Function() isIdleGetter,
// Runtime — stable
required this.environment,
required this.session,
required this.skills,
required this.debug,
required this.dockManager,
required this.editor,
required this.mcpPool,
required this.autoApprovedTools,
required this.ensureSession,
required this.backfillTitle,
required this.switchModel,
// Services
required this.conversation,
required this.approval,
required this.lifecycle,
required this.panels,
// Self-reference for /help-style enumeration
required Iterable<SlashCommand> Function() commandsGetter,
})Properties
| Property | Type | Description |
|---|---|---|
config | GlueConfig? get | Currently-active config, if any. May be null until startup completes. |
llmFactory | LlmClientFactory? get | Live LLM client factory. May be null if no provider is configured. |
agent | AgentCore get | Live agent core (always present once the app is running). |
cwd | String get | Current working directory. |
modelId | String get | Live identifier of the active model. Mutates when /model switches. |
isIdle | bool get | True when the agent loop is idle (no streaming, tool, or bash command in flight). Commands that mutate session state should gate on this. |
commands | Iterable<SlashCommand> get | All registered slash commands. Used by /help to enumerate. |
environment | Environment | |
session | SessionManager | |
skills | SkillRuntime | |
debug | DebugController? | |
dockManager | DockManager | |
editor | TextAreaEditor | The textarea backing the input prompt. Commands that seed the prompt (e.g., /history after a fork) write to this directly. |
mcpPool | McpClientPool | Pool of connected MCP servers. Always present (empty when no servers configured). Used by /mcp … slash commands. |
autoApprovedTools | Set<String> | Live reference to the auto-approved tool name set. Contents may be mutated by approval flows; readers see the current set on each access. |
conversation | ConversationView | |
approval | ApprovalState | |
lifecycle | Lifecycle | |
panels | ModalSurface | The existing TUI panel host. Today this still carries domain-specific openers (openHelp, openModel, etc.). Long-term plan is to slim it down to generic primitives and move panel-assembly into commands. |
config | GlueConfig? get | Currently-active config, if any. May be null until startup completes. |
llmFactory | LlmClientFactory? get | Live LLM client factory. May be null if no provider is configured. |
agent | AgentCore get | Live agent core (always present once the app is running). |
cwd | String get | Current working directory. |
modelId | String get | Live identifier of the active model. Mutates when /model switches. |
isIdle | bool get | True when the agent loop is idle (no streaming, tool, or bash command in flight). Commands that mutate session state should gate on this. |
commands | Iterable<SlashCommand> get | All registered slash commands. Used by /help to enumerate. |