Skip to content

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

PropertyTypeDescription
configGlueConfig? getCurrently-active config, if any. May be null until startup completes.
llmFactoryLlmClientFactory? getLive LLM client factory. May be null if no provider is configured.
agentAgentCore getLive agent core (always present once the app is running).
cwdString getCurrent working directory.
modelIdString getLive identifier of the active model. Mutates when /model switches.
isIdlebool getTrue when the agent loop is idle (no streaming, tool, or bash command in flight). Commands that mutate session state should gate on this.
commandsIterable&lt;SlashCommand&gt; getAll registered slash commands. Used by /help to enumerate.
environmentEnvironment
sessionSessionManager
skillsSkillRuntime
debugDebugController?
dockManagerDockManager
editorTextAreaEditorThe textarea backing the input prompt. Commands that seed the prompt (e.g., /history after a fork) write to this directly.
mcpPoolMcpClientPoolPool of connected MCP servers. Always present (empty when no servers configured). Used by /mcp … slash commands.
autoApprovedToolsSet&lt;String&gt;Live reference to the auto-approved tool name set. Contents may be mutated by approval flows; readers see the current set on each access.
conversationConversationView
approvalApprovalState
lifecycleLifecycle
panelsModalSurfaceThe 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.
configGlueConfig? getCurrently-active config, if any. May be null until startup completes.
llmFactoryLlmClientFactory? getLive LLM client factory. May be null if no provider is configured.
agentAgentCore getLive agent core (always present once the app is running).
cwdString getCurrent working directory.
modelIdString getLive identifier of the active model. Mutates when /model switches.
isIdlebool getTrue when the agent loop is idle (no streaming, tool, or bash command in flight). Commands that mutate session state should gate on this.
commandsIterable&lt;SlashCommand&gt; getAll registered slash commands. Used by /help to enumerate.

Released under the MIT License.