/** * [WHO]: Provides MessageQueueController + MessageQueueContext — steering/follow-up/ * compaction queue management (queue, flush, restore-to-editor, pending display) * [FROM]: Depends on injected host capability closures + @catui/tui; no InteractiveMode * reference; all cross-mode calls route through ctx callbacks so host-side method * patching (partial-mode tests) keeps intercepting them * [TO]: Consumed by modes/interactive/interactive-mode.ts (held lazily as `this.messageQueue` * behind thin delegators: handleFollowUp / handleDequeue / promptAfterRender / * getAllQueuedMessages / clearAllQueues / updatePendingMessagesDisplay / * restoreQueuedMessagesToEditor / queueCompactionMessage / flushCompactionQueue) * [HERE]: modes/interactive/controllers/message-queue-controller.ts — P7 C-3d (extracted from * InteractiveMode; behavior-preserving move) */ import { type Container, type EditorComponent, type TUI } from "@catui/tui"; import type { AgentSession, PromptOptions } from "../../../core/runtime/agent-session.js"; import type { AppAction } from "../../../core/platform/keybindings.js"; import type { InteractiveState } from "../state/interactive-state.js"; /** Host capabilities needed by the message-queue controller. */ export interface MessageQueueContext { readonly session: AgentSession; readonly state: InteractiveState; readonly editor: EditorComponent; readonly ui: TUI; readonly pendingMessagesContainer: Container; readonly agent: { abort(): void; }; isExtensionCommand(text: string): boolean; getAppKeyDisplay(action: AppAction): string; promptAfterRender(text: string, options?: PromptOptions): Promise; showStatus(message: string): void; showError(errorMessage: string): void; } export declare class MessageQueueController { private readonly ctx; constructor(ctx: MessageQueueContext); handleFollowUp(): Promise; handleDequeue(): void; promptAfterRender(text: string, options?: PromptOptions): Promise; /** * Get all queued messages (read-only). * Combines session queue and compaction queue. */ getAllQueuedMessages(): { steering: string[]; followUp: string[]; }; /** * Clear all queued messages and return their contents. * Clears both session queue and compaction queue. */ clearAllQueues(): { steering: string[]; followUp: string[]; }; updatePendingMessagesDisplay(): void; restoreQueuedMessagesToEditor(options?: { abort?: boolean; currentText?: string; }): number; queueCompactionMessage(text: string, mode: "steer" | "followUp"): void; flushCompactionQueue(options?: { willRetry?: boolean; }): Promise; }