/** * [WHO]: Provides SessionCommandHandlersController + SessionCommandHandlersContext — interactive * command bodies that mutate session/UI state (/reload, /clear, /compact, !bash, extension check) * [FROM]: Depends on injected host capability closures + @catui/tui components; no InteractiveMode reference * [TO]: Consumed by modes/interactive/interactive-mode.ts (held as `this.sessionCommands`; wired into * SlashDispatcherController commands port, input-submit bash port, compaction queue checks) * [HERE]: modes/interactive/controllers/session-command-handlers.ts — P7 C-3a slice 1/4 (extracted from * InteractiveMode command-handler block; behavior-preserving move) */ import type { AgentMessage } from "@catui/agent-core"; import { type CachedContainer, type Container, type EditorComponent, type TUI } from "@catui/tui"; import type { AgentSession } from "../../../core/runtime/agent-session.js"; import type { SessionManager } from "../../../core/session/session-manager.js"; import type { SettingsManager } from "../../../core/platform/config/settings-manager.js"; import type { ExtensionRunner } from "../../../core/extensions-host/index.js"; import type { KeybindingsManager } from "../../../core/platform/keybindings.js"; import { BashExecutionComponent } from "../components/bash-execution.js"; import type { CustomEditor } from "../components/custom-editor.js"; import type { FooterComponent } from "../components/footer.js"; import type { ImagePipelineController } from "./image-pipeline-controller.js"; import type { InteractiveState } from "../state/interactive-state.js"; /** Host capabilities needed by the session-mutating command handlers. */ export interface SessionCommandHandlersContext { /** Live agent session (streaming/compacting checks, reload, bash execution). */ readonly session: AgentSession; readonly sessionManager: SessionManager; readonly settingsManager: SettingsManager; /** Consolidated render/turn UI state (loading animation, queues, streaming slots). */ readonly state: InteractiveState; readonly ui: TUI; /** Currently mounted editor component (may be swapped by the editor adapter). */ readonly editor: EditorComponent; readonly defaultEditor: CustomEditor; readonly editorContainer: Container; readonly chatContainer: CachedContainer; readonly pendingMessagesContainer: Container; readonly statusContainer: Container; readonly footer: FooterComponent; readonly keybindings: KeybindingsManager; readonly imagePipeline: ImagePipelineController; /** fd executable path, resolved lazily after construction. */ readonly fdPath: string | undefined; /** Pending bash components (host reassigns the array on flush — always read through the getter). */ readonly pendingBashComponents: BashExecutionComponent[]; /** Currently mounted bash execution component (created/consumed by !bash handling). */ bashComponent: BashExecutionComponent | undefined; showStatus(message: string): void; showError(errorMessage: string): void; showWarning(warningMessage: string): void; resetExtensionUI(): void; remountEditorShell(): void; setupAutocomplete(fdPath: string | undefined): void; setupExtensionShortcuts(extensionRunner: ExtensionRunner): void; rebuildChatFromMessages(): void; showLoadedResources(options?: { extensionPaths?: string[]; force?: boolean; showDiagnosticsWhenQuiet?: boolean; }): void; addMessageToChat(message: AgentMessage, options?: { populateHistory?: boolean; }): void; clearStatusTimers(): void; flushCompactionQueue(options?: { willRetry?: boolean; }): Promise; } export declare class SessionCommandHandlersController { private readonly ctx; constructor(ctx: SessionCommandHandlersContext); isExtensionCommand(text: string): boolean; handleReloadCommand(): Promise; handleClearCommand(): Promise; handleBashCommand(command: string, excludeFromContext?: boolean): Promise; handleCompactCommand(customInstructions?: string): Promise; private executeCompaction; }