/**
 * Interactive mode for the coding agent.
 * Handles TUI rendering and user interaction, delegating business logic to a session client.
 */
import type { StartupInfoEntry } from '../../app/startup-info.js';
import type { InteractiveSessionClient } from '../session-client.js';
import type { InteractiveModeOptions } from './interactive-mode-options.js';
export type { CreditBalance, InteractiveModeOptions } from './interactive-mode-options.js';
export declare class InteractiveMode {
    private options;
    private session;
    private ui;
    private renderTracePath;
    private shellLayout;
    private mainContentContainer;
    private scrollableMainContent;
    private chatContainer;
    private pendingMessagesContainer;
    private conversationCustomContainer;
    private conversationCustomFocusComponents;
    private statusContainer;
    private transcriptSelectionAutoScrollTimer;
    private transcriptSelectionAutoScrollDelta;
    private taskSurface;
    private customScreenContainer;
    private defaultEditor;
    private editor;
    private autocompleteProvider;
    private fdPath;
    private editorContainer;
    private footerContainer;
    private footer;
    private footerDataProvider;
    private keybindings;
    private version;
    private isInitialized;
    private onInputCallback?;
    private attachments;
    private loadingAnimation;
    private pendingWorkingMessage;
    private readonly defaultWorkingMessage;
    private readonly workbookScopeController;
    private readonly authWorkflow;
    private readonly reloadWorkflow;
    private readonly skillsWorkflow;
    private readonly proposalsWorkflow;
    private readonly portSkillsWorkflow;
    private readonly sessionWorkflow;
    private readonly agentTasksWorkflow;
    private readonly _unsubModeChange;
    private readonly _unsubTaskManager;
    private compactNextStartupInfo;
    private lastSigintTime;
    private ctrlCHintTimeout;
    private changelogMarkdown;
    private lastStatusSpacer;
    private lastStatusText;
    private streamingComponent;
    private streamingMessage;
    private streamingStartTime;
    private pendingTools;
    private renderedToolEntries;
    private toolSummaries;
    private activeToolGroups;
    private streamedGroupMembers;
    /** Clear all active tool groups (call alongside pendingTools.clear) */
    private clearActiveToolGroups;
    /** Register a tool execution component for live updates and apply any cached summary. */
    private trackToolComponent;
    /** Reset all in-flight tool tracking maps and active groups. */
    private clearToolTracking;
    /** Drop cached tool summaries (e.g. between turns). */
    private clearToolSummaries;
    /** True when the session is mid-stream and can be interrupted. */
    private isInterruptibleOperationActive;
    /** Mount the spinner Loader for streaming state, reusing it if already present. */
    private ensureStreamingLoader;
    /** Move all live tool groups from the active overlay back into chat history. */
    private archiveAllActiveToolGroups;
    /**
     * Get or create a ToolGroupComponent for the given tool name.
     * Live grouped tools render in the active overlay; historical groups render in chat.
     */
    private getOrCreateToolGroup;
    /**
     * During message_update, check for new tool calls in the streaming content
     * and incrementally add them to a ToolGroupComponent if the tool supports grouping.
     * This creates entries as the LLM streams them, showing "starting..." one by one.
     */
    private maybeStreamGroupMembers;
    private toolOutputExpanded;
    private hideThinkingBlock;
    private skillCommands;
    private unsubscribe?;
    private autoCompactionLoader;
    private autoCompactionEscapeHandler?;
    private retryLoader;
    private retryEscapeHandler?;
    private compactionQueuedMessages;
    private shutdownRequested;
    private removeWarningInterceptor?;
    private extensionSelector;
    private extensionInput;
    private extensionEditor;
    private extensionTerminalInputUnsubscribers;
    private extensionWidgetsAbove;
    private extensionWidgetsBelow;
    private widgetContainerAbove;
    private widgetContainerBelow;
    private customFooter;
    private headerContainer;
    private builtInHeader;
    private customHeader;
    private isBashMode;
    private isChatMode;
    private creditPollInterval;
    private static readonly CREDIT_POLL_INTERVAL_MS;
    private readonly creditGate;
    private _commands;
    private _resourceDisplay;
    private _collabManager;
    private _superFight;
    private readonly manualMemoryCoordinator;
    private readonly manualSkillProposalBackground;
    /** AgentController for the current session. */
    private get agent();
    /** SessionManager for the current session. */
    private get sessionManager();
    /** SettingsManager for the current session. */
    private get settingsManager();
    /** Build the InteractiveMode shell, wiring all containers, workflows, and dependencies. */
    constructor(session: InteractiveSessionClient, options?: InteractiveModeOptions);
    /** Build the autocomplete provider from slash, prompt-template, extension, and skill commands. */
    private setupAutocomplete;
    /** Initialize TUI containers, header, autocomplete, extensions, and event subscriptions. */
    init(): Promise<void>;
    /**
     * Update terminal title with session name and cwd.
     */
    private updateTerminalTitle;
    /** Refresh the footer's running-agents indicator from the TaskManager. */
    private refreshAgentFooterStatus;
    /**
     * Run the interactive mode. This is the main entry point.
     * Initializes the UI, shows warnings, processes initial messages, and starts the interactive loop.
     */
    run(): Promise<void>;
    private startInitialSkillsSyncStatusCheck;
    private formatSkillsSyncStatus;
    private formatSkillNames;
    private pluralize;
    /**
     * Get changelog entries to display on startup.
     * Only shows new entries since last seen version, skips for resumed sessions.
     */
    private getChangelogForDisplay;
    /** Build the markdown theme honoring user code-block-indent setting. */
    private getMarkdownThemeWithSettings;
    /** Render the startup listing of prompts/extensions plus any diagnostics. */
    private showLoadedResources;
    /**
     * Initialize the extension system with TUI-based UI context.
     */
    private initExtensions;
    /**
     * Get a registered tool definition by name (for custom rendering).
     */
    private getRegisteredToolDefinition;
    /**
     * Set extension status text in the footer.
     */
    private setExtensionStatus;
    /**
     * Set an extension widget (string array or custom component).
     */
    private setExtensionWidget;
    /** Dispose and remove every extension widget (above and below the editor). */
    private clearExtensionWidgets;
    /** Hide any active extension selector/input/editor and reset extension UI state. */
    private resetExtensionUI;
    private static readonly MAX_WIDGET_LINES;
    /**
     * Render all extension widgets to the widget container.
     */
    private renderWidgets;
    /** Re-render a widget container with optional spacers above/below. */
    private renderWidgetContainer;
    /**
     * Set a custom footer component, or restore the built-in footer.
     */
    private setExtensionFooter;
    /**
     * Set a custom header component, or restore the built-in header.
     */
    private setExtensionHeader;
    /** Register a TUI input listener for an extension and return an unsubscribe function. */
    private addExtensionTerminalInputListener;
    /** Drop all extension-registered terminal input listeners. */
    private clearExtensionTerminalInputListeners;
    /**
     * Create the ExtensionUIContext for extensions.
     */
    private createExtensionUIContext;
    /**
     * Show a selector for extensions.
     */
    private showExtensionSelector;
    /**
     * Hide the extension selector.
     */
    private hideExtensionSelector;
    /**
     * Show a confirmation dialog for extensions.
     */
    private showExtensionConfirm;
    /**
     * Show a text input for extensions.
     */
    private showExtensionInput;
    /**
     * Hide the extension input.
     */
    private hideExtensionInput;
    /**
     * Show a multi-line editor for extensions (with Ctrl+G support).
     */
    private showExtensionEditor;
    /**
     * Hide the extension editor.
     */
    private hideExtensionEditor;
    /**
     * Set a custom editor component from an extension.
     * Pass undefined to restore the default editor.
     */
    private setCustomEditorComponent;
    /**
     * Show a notification for extensions.
     */
    private showExtensionNotify;
    private createCustomTui;
    /** Show a custom component with keyboard focus. Overlay mode renders on top of existing content. */
    private showExtensionCustom;
    /**
     * Show an extension error in the UI.
     */
    private showExtensionError;
    /** Wire interactive shell key handlers via registerInteractiveActions. */
    private setupKeyHandlers;
    private handleTranscriptSelectionInput;
    private updateTranscriptSelectionAutoScroll;
    private stopTranscriptSelectionAutoScroll;
    private canHandleTranscriptSelectionInput;
    private getTranscriptCopyInput;
    private handleTranscriptScrollInput;
    private isTranscriptScrollContextActive;
    /** Restore the editor (with attachments display) into editorContainer. */
    private restoreEditorToContainer;
    /** Read clipboard for an image (or file path) and attach it to the editor. */
    private handleClipboardImagePaste;
    /**
     * Read clipboard text and, if it looks like a file path, attach it.
     * Returns true if a file was attached.
     */
    private tryAttachClipboardFilePath;
    /** Build a CommandContext for slash command handlers. */
    private _buildCommandContext;
    /** Lazily build the collaboration command client backed by CollabManager. */
    private getCollabCommandClient;
    /** Wire the default editor submit handler covering bash, chat, slash, and prompt dispatch. */
    private setupEditorSubmitHandler;
    /** Wire the InteractiveSessionController to all agent lifecycle events. */
    private subscribeToAgent;
    /** Run init() if the shell hasn't been initialized yet. */
    private ensureSessionControllerInitialized;
    /** Handle agent_start: stop retry UI, mount streaming loader, begin credit polling. */
    private handleAgentStartEvent;
    /** Handle message_start: render user/custom messages and prepare for assistant streaming. */
    private handleMessageStartEvent;
    /** Handle message_update for assistant messages: refresh loader text and stream tool calls. */
    private handleMessageUpdateEvent;
    /** Handle message_end: render final assistant message, settle pending tools, abort/error UI. */
    private handleMessageEndEvent;
    /** Handle tool_execution_start: build/track the appropriate tool component or group member. */
    private handleToolExecutionStartEvent;
    /** Handle tool_execution_update: forward partial results to the tracked component. */
    private handleToolExecutionUpdateEvent;
    /** Handle tool_execution_end: finalize the component and archive completed groups. */
    private handleToolExecutionEndEvent;
    /** Handle tool_summary: cache the summary and propagate it to any rendered component. */
    private handleToolSummaryEvent;
    /** Handle agent_end: tear down loader/streaming, archive groups, refresh credits. */
    private handleAgentEndEvent;
    /** Handle auto_compaction_start: install cancel handler and mount the compaction loader. */
    private handleAutoCompactionStartEvent;
    /** Handle auto_compaction_end: rebuild chat with summary, surface errors, flush queue. */
    private handleAutoCompactionEndEvent;
    /** Handle recovery_start: install cancel handler, drop last assistant, mount retry loader. */
    private handleRecoveryStartEvent;
    /** Handle recovery_end: tear down retry UI and surface failure errors. */
    private handleRecoveryEndEvent;
    /** Annotate a user message component with workbook names from prePromptContext if available. */
    private annotateWithWorkbooks;
    /** Display the workbook scope selector and resolve with the chosen selection. */
    private showWorkbookScopeSelector;
    /** Extract text content from a user message */
    private getUserMessageText;
    /**
     * Show a status message in the chat.
     *
     * If multiple status messages are emitted back-to-back (without anything else being added to the chat),
     * we update the previous status line instead of appending new ones to avoid log spam.
     */
    private showStatus;
    /** Append a session message to the chat container with role-specific rendering. */
    private addMessageToChat;
    /**
     * Render session context to chat. Used for initial load and rebuild after compaction.
     * @param sessionContext Session context to render
     * @param options.updateFooter Update footer state
     * @param options.populateHistory Add user messages to editor history
     */
    private renderSessionContext;
    /** Render session entries on initial load and surface compaction history. */
    renderInitialMessages(): void;
    /** Resolve with the next user-submitted text from the editor. */
    getUserInput(): Promise<string>;
    /** Clear chat and re-render from the current SessionManager context. */
    private rebuildChatFromMessages;
    /** Handle Ctrl+C: clear editor on first press, exit on a quick second press. */
    private handleCtrlC;
    /** Cancel the transient "press again to exit" hint timer. */
    private clearCtrlCHint;
    /** Handle Ctrl+D when the editor is empty: trigger a graceful shutdown. */
    private handleCtrlD;
    /**
     * Gracefully shutdown the agent.
     * Emits shutdown event to extensions, then exits.
     */
    private isShuttingDown;
    private isRestarting;
    /**
     * Request a graceful restart. The process will exit with code 75,
     * signaling the outer runner to re-launch with --continue.
     */
    requestRestart(): void;
    /** Run the graceful shutdown sequence: stop UI, notify extensions, exit process. */
    private shutdown;
    /**
     * Check if shutdown was requested and perform shutdown if so.
     */
    /** If a shutdown was queued during streaming, run it now. */
    private checkShutdownRequested;
    /** Handle Ctrl+Z: stop the TUI and SIGTSTP the process group, restoring on SIGCONT. */
    private handleCtrlZ;
    /** Handle Alt+Enter: queue or stream a follow-up message based on session state. */
    private handleFollowUp;
    /** Handle dequeue keybind: pull queued messages back into the editor for editing. */
    private handleDequeue;
    /** Refresh the editor border color based on bash/chat/thinking state. */
    private updateEditorBorderColor;
    /** Subscribe to CollabClient events and surface peer activity in chat. */
    private _attachCollabEvents;
    /** Launch the SuperFight collab mini-game UI for the current room. */
    private launchSuperFight;
    /** Watch editor text and toggle bash/chat-mode borders based on `!`/`:` prefixes. */
    private setupBashModeDetection;
    /** Execute a `!`-prefixed bash command, streaming output into the chat container. */
    private executeBashCommand;
    /** Advance the thinking level for the current model and announce the new value. */
    private cycleThinkingLevel;
    /** Cycle to the next agent mode, skipping installation, and update the footer. */
    private cycleMode;
    /** Toggle fast proxy streaming for subsequent turns. */
    private toggleFastMode;
    /** Handle /fast [on|off|toggle]. */
    private handleFastCommand;
    /** Flip the per-session auto-approve flag and re-render. */
    private toggleAutoApprove;
    /** Toggle the dangerous skip-runtime-permissions setting after explicit confirmation. */
    private toggleRuntimePermissionBypass;
    /** Cycle the active model forward/backward, surfacing model and thinking-level info. */
    private cycleModel;
    /** Flip the global expanded/collapsed tool-output flag. */
    private toggleToolOutputExpansion;
    /** Apply expanded/collapsed state to every expandable component in chat. */
    private setToolsExpanded;
    /** Toggle assistant-thinking-block visibility and rebuild the chat. */
    private toggleThinkingBlockVisibility;
    /** Pause the TUI, open $VISUAL/$EDITOR on the current text, and merge edits back. */
    private openExternalEditor;
    /** Clear the editor's text and re-render. */
    clearEditor(): void;
    /** Block prompts when cached credit balance is exhausted; show an error message. */
    private checkCreditsBeforePrompt;
    /** Append a red error line to the chat container. */
    showError(errorMessage: string): void;
    /** Append a yellow warning line to the chat container. */
    showWarning(warningMessage: string): void;
    /** Append a startup-info line to the chat container, optionally without leading spacer. */
    showInfo(info: StartupInfoEntry, options?: {
        compact?: boolean;
    }): void;
    /**
     * Get all queued messages (read-only).
     * Combines session queue and compaction queue.
     */
    private getAllQueuedMessages;
    /**
     * Clear all queued messages and return their contents.
     * Clears both session queue and compaction queue.
     */
    private clearAllQueues;
    /** Re-render the queued steering and follow-up message indicators above the editor. */
    private updatePendingMessagesDisplay;
    /** Move all queued messages back into the editor; optionally abort the active turn. */
    private restoreQueuedMessagesToEditor;
    /** Append a message to the compaction-pending queue and clear the editor. */
    private queueCompactionMessage;
    /** True if `text` is a `/`-prefixed command registered by an extension. */
    private isExtensionCommand;
    /** Drain the compaction-pending queue, dispatching extension commands and prompts in order. */
    private flushCompactionQueue;
    /**
     * Shows a selector component in place of the editor.
     * @param create Factory that receives a `done` callback and returns the component and focus target
     */
    private showSelector;
    /** Open the settings selector inline in the editor area. */
    private showSettingsSelector;
    /** Open the agent-tasks selector for the current session scope. */
    private showAgentsSelector;
    /** Handle `/model [term]` — switch directly on exact match or open the selector. */
    private handleModelCommand;
    /** Find a single exact model match for `provider/id` or bare id, else undefined. */
    private findExactModelMatch;
    /** Refresh and return the available model registry, returning [] on failure. */
    private getModelCandidates;
    /** Update the footer's available provider count from current model candidates */
    private updateAvailableProviderCount;
    /** Show the model selector inline, prefilled with an optional search query. */
    private showModelSelector;
    /** Show the thinking-level selector inline. */
    private showThinkingLevelSelector;
    /** Delegate to the session workflow's tree selector. */
    private showTreeSelector;
    /** Delegate to the session workflow's session-resume selector. */
    private showSessionSelector;
    /** Resume a session by path through the session workflow. */
    private handleResumeSession;
    /** Clear loaders, queues, streaming state, and tool tracking after a session change. */
    private resetTransientUiState;
    /** Reset chat state and re-render initial messages for the active session. */
    private rebuildChatAfterSessionChange;
    /** Open the OAuth provider selector for login or logout via the auth workflow. */
    private showOAuthSelector;
    /**
     * If the user has stored OAuth credentials, try to refresh them.
     * If refresh fails (expired refresh token, revoked, etc.), show login immediately.
     * If no credentials exist at all, also show login immediately.
     */
    private ensureShortcutAuth;
    /**
     * On LoginRequiredError, shows the login dialog then retries once.
     * Returns false if the prompt failed (after retry or otherwise).
     */
    private promptWithLoginRetry;
    /** Drain any session-pending refresh prompts and resubmit each. */
    private processPendingRefreshes;
    /** Show the login dialog for a specific provider via the auth workflow. */
    private showLoginDialog;
    /**
     * Refresh credit balance and update footer.
     * No-op if no fetchCreditBalance callback was injected.
     */
    /** Start the periodic credit-balance refresh interval. */
    private startCreditPolling;
    /** Stop the credit-balance refresh interval if running. */
    private stopCreditPolling;
    /** Fetch and cache the latest credit balance, updating the footer indicators. */
    private refreshCreditBalance;
    /**
     * After login, auto-switch to the newly authenticated provider's default model
     * if the current model isn't from this provider.
     */
    private autoSwitchToProvider;
    /** Handle `/reload` — reload extensions/skills via the reload workflow. */
    private handleReloadCommand;
    /** Handle `/memory <subcommand>` — currently only `scan [request]` is supported. */
    private handleMemoryCommand;
    /** Kick off a manual durable-memory scan; returns false if no model is selected. */
    private startManualMemoryScan;
    /** Kick off a manual skill-proposal scan with the shared background runner. */
    private startManualSkillProposalScan;
    /** Build an ExtensionContext suitable for background tasks (memory scan, skill proposal). */
    private buildBackgroundExtensionContext;
    /** Handle `/clear` — start a fresh session and reset all UI state. */
    private handleClearCommand;
    /** Handle `/debug` — write rendered terminal frame and session messages to a debug log. */
    private handleDebugCommand;
    /** Handle `/compact [instructions]` — manually compact the conversation history. */
    private handleCompactCommand;
    /** Run the compaction flow with cancel-on-escape, summary rendering, and queue flushing. */
    private executeCompaction;
    /** Tear down the interactive shell: loaders, listeners, polling, footer, and UI. */
    stop(): void;
}
//# sourceMappingURL=interactive-mode.d.ts.map