/**
 * Core state types for Ink CLI
 * Central type definitions for the CLI state machine
 */
import type { ApprovalRequest } from '../components/ApprovalPrompt.js';
import type { CodexRateLimitSnapshot, ToolDisplayData, ContentPart, McpConnectionStatus, McpServerType } from '@dexto/core';
import type { LLMProvider, ReasoningVariant } from '@dexto/llm';
/**
 * Update information for version check
 */
export interface UpdateInfo {
    current: string;
    latest: string;
    updateCommand: string;
}
/**
 * Startup information displayed in CLI header
 */
export interface StartupInfo {
    connectedServers: {
        count: number;
        names: string[];
    };
    failedConnections: string[];
    toolCount: number;
    logFile: string | null;
    /** Update info if a newer version is available */
    updateInfo?: UpdateInfo | undefined;
    /** True if installed agents differ from bundled and user should sync */
    needsAgentSync?: boolean | undefined;
}
/**
 * Tool call status for visual feedback
 * - pending: Tool call received, checking if approval needed (static gray dot)
 * - pending_approval: Waiting for user approval (static orange dot)
 * - running: Actually executing (animated green/teal spinner)
 * - finished: Completed (green dot success, red dot error)
 */
export type ToolStatus = 'pending' | 'pending_approval' | 'running' | 'finished';
/**
 * Styled message types for rich command output
 */
export type StyledMessageType = 'config' | 'stats' | 'help' | 'session-list' | 'session-history' | 'log-config' | 'run-summary' | 'prompts' | 'sysprompt' | 'shortcuts' | 'external-trigger';
/**
 * Structured data for styled messages
 */
export interface ConfigStyledData {
    configFilePath: string | null;
    provider: string;
    model: string;
    maxTokens: number | null;
    temperature: number | null;
    permissionsMode: string;
    maxSessions: string;
    sessionTTL: string;
    mcpServers: string[];
    promptsCount: number;
    hooksEnabled: string[];
}
export interface StatsStyledData {
    sessions: {
        total: number;
        inMemory: number;
        maxAllowed: number;
    };
    mcp: {
        connected: number;
        failed: number;
        toolCount: number;
    };
    tokenUsage?: {
        inputTokens: number;
        outputTokens: number;
        reasoningTokens: number;
        cacheReadTokens: number;
        cacheWriteTokens: number;
        totalTokens: number;
    };
    estimatedCost?: number;
}
export interface HelpStyledData {
    commands: Array<{
        name: string;
        description: string;
        category: string;
    }>;
}
export interface SessionListStyledData {
    sessions: Array<{
        id: string;
        messageCount: number;
        lastActive: string;
        isCurrent: boolean;
    }>;
    total: number;
}
export interface SessionHistoryStyledData {
    sessionId: string;
    messages: Array<{
        role: string;
        content: string;
        timestamp: string;
    }>;
    total: number;
}
export interface LogConfigStyledData {
    currentLevel: string;
    logFile: string | null;
    availableLevels: string[];
}
export interface RunSummaryStyledData {
    /** Duration in milliseconds */
    durationMs: number;
    /** Total tokens used (lastInput + cumulativeOutput) */
    totalTokens: number;
}
export interface ExternalTriggerStyledData {
    label: string;
    source: 'scheduler' | 'a2a' | 'api' | 'external';
    timestamp: Date | string;
}
export interface PromptsStyledData {
    mcpPrompts: Array<{
        name: string;
        title?: string;
        description?: string;
        args?: string[];
    }>;
    configPrompts: Array<{
        name: string;
        title?: string;
        description?: string;
    }>;
    customPrompts: Array<{
        name: string;
        title?: string;
        description?: string;
    }>;
    total: number;
}
export interface SysPromptStyledData {
    content: string;
}
export interface ShortcutsStyledData {
    categories: Array<{
        name: string;
        shortcuts: Array<{
            keys: string;
            description: string;
        }>;
    }>;
}
export type StyledData = ConfigStyledData | StatsStyledData | HelpStyledData | SessionListStyledData | SessionHistoryStyledData | LogConfigStyledData | RunSummaryStyledData | ExternalTriggerStyledData | PromptsStyledData | SysPromptStyledData | ShortcutsStyledData;
/**
 * Sub-agent progress data for spawn_agent tool calls
 */
export interface SubAgentProgress {
    /** Short task description */
    task: string;
    /** Agent ID (e.g., 'explore-agent') */
    agentId: string;
    /** Runtime agent ID for ephemeral sub-agent (e.g., 'agent-ba01ae37') */
    runtimeAgentId?: string;
    /** Optional file path where the sub-agent logs are written */
    subAgentLogFilePath?: string;
    /** Number of tools called by the sub-agent */
    toolsCalled: number;
    /** Current tool being executed */
    currentTool: string;
    /** Current tool arguments (optional) */
    currentArgs?: Record<string, unknown> | undefined;
    /** Cumulative token usage from the sub-agent (updated on each llm:response) */
    tokenUsage?: {
        input: number;
        output: number;
        total: number;
    };
}
/**
 * Todo status for workflow tracking
 */
export type TodoStatus = 'pending' | 'in_progress' | 'completed';
/**
 * Todo item for workflow tracking
 */
export interface TodoItem {
    id: string;
    sessionId: string;
    content: string;
    activeForm: string;
    status: TodoStatus;
    position: number;
    createdAt: Date | string;
    updatedAt: Date | string;
}
/**
 * Message in the chat interface
 *
 * TODO: Consolidate with InternalMessage from @dexto/core. Currently we have two
 * message types: InternalMessage (core, ContentPart[] content) and Message (CLI,
 * string content + UI fields). Consider extending InternalMessage or extracting
 * shared role type to reduce duplication and type confusion.
 */
export interface Message {
    id: string;
    role: 'user' | 'assistant' | 'system' | 'tool';
    content: string;
    /** Optional model reasoning trace (when provider supports returning it). */
    reasoning?: string | undefined;
    timestamp: Date;
    isStreaming?: boolean;
    toolResult?: string;
    toolStatus?: ToolStatus;
    isError?: boolean;
    styledType?: StyledMessageType;
    styledData?: StyledData;
    /** True for split messages that continue a previous message (no role indicator) */
    isContinuation?: boolean;
    /** True for messages that are queued while agent is processing */
    isQueued?: boolean;
    /** Queue position (1-indexed) for queued messages */
    queuePosition?: number;
    /** Structured display data for tool-specific rendering (diffs, shell output, etc.) */
    toolDisplayData?: ToolDisplayData;
    /** Content parts for tool result rendering */
    toolContent?: ContentPart[];
    /** Sub-agent progress data (for spawn_agent tool calls) */
    subAgentProgress?: SubAgentProgress;
}
/**
 * Streaming message state
 */
export interface StreamingMessage {
    id: string;
    content: string;
}
/**
 * Pending image attachment
 */
export interface PendingImage {
    /** Unique ID for tracking/removal */
    id: string;
    /** Base64-encoded image data */
    data: string;
    /** MIME type of the image */
    mimeType: string;
    /** Placeholder text shown in input (e.g., "[Image 1]") */
    placeholder: string;
}
/**
 * Pasted content block (for collapsible paste feature)
 */
export interface PastedBlock {
    /** Unique ID for tracking */
    id: string;
    /** Sequential number for display (Paste 1, Paste 2, etc.) */
    number: number;
    /** The full original pasted text */
    fullText: string;
    /** Line count for display */
    lineCount: number;
    /** Whether this block is currently collapsed */
    isCollapsed: boolean;
    /** The placeholder text when collapsed (e.g., "[Paste 1: ~32 lines]") */
    placeholder: string;
}
/**
 * Input state management
 */
export interface InputState {
    value: string;
    history: string[];
    historyIndex: number;
    draftBeforeHistory: string;
    /** Pending images to be sent with the next message */
    images: PendingImage[];
    /** Pasted content blocks (collapsed/expandable) */
    pastedBlocks: PastedBlock[];
    /** Counter for generating sequential paste numbers */
    pasteCounter: number;
    /** True while editing a queued follow-up pulled back into the input */
    editingQueuedFollowUp: boolean;
}
export interface InsufficientCreditsState {
    balanceUsd: number | null;
}
/**
 * Available overlay types
 */
export type OverlayType = 'none' | 'slash-autocomplete' | 'resource-autocomplete' | 'model-selector' | 'reasoning' | 'custom-model-wizard' | 'session-selector' | 'mcp-server-list' | 'mcp-server-actions' | 'mcp-add-choice' | 'mcp-add-selector' | 'mcp-custom-type-selector' | 'mcp-custom-wizard' | 'log-level-selector' | 'stream-selector' | 'sounds-selector' | 'session-subcommand-selector' | 'api-key-input' | 'chatgpt-usage-cap' | 'insufficient-credits' | 'login' | 'logout' | 'connect' | 'search' | 'approval' | 'tool-browser' | 'prompt-list' | 'prompt-add-choice' | 'prompt-add-wizard' | 'prompt-delete-selector' | 'session-rename' | 'context-stats' | 'export-wizard' | 'plugin-manager' | 'plugin-list' | 'plugin-actions' | 'marketplace-browser' | 'marketplace-add' | 'command-output';
/**
 * Temporary modal output for slash commands (e.g., /help, /stats).
 */
export interface CommandOutputState {
    title: string;
    content: string;
}
/**
 * MCP server type for custom wizard (null = not yet selected)
 */
export type McpWizardServerType = McpServerType | null;
/**
 * MCP server info for actions screen
 */
export interface SelectedMcpServer {
    name: string;
    enabled: boolean;
    status: McpConnectionStatus;
    type: McpServerType;
}
/**
 * Pending model switch info (when waiting for API key input)
 */
export interface PendingModelSwitch {
    provider: LLMProvider;
    model: string;
    displayName?: string;
    baseURL?: string;
    reasoningVariant?: ReasoningVariant;
}
/**
 * Prompt add wizard state
 */
export type PromptAddScope = 'agent' | 'shared';
export interface PromptAddWizardState {
    scope: PromptAddScope;
    step: 'name' | 'title' | 'description' | 'content';
    name: string;
    title: string;
    description: string;
    content: string;
}
/**
 * History search state (Ctrl+R reverse search)
 */
export interface HistorySearchState {
    isActive: boolean;
    query: string;
    matchIndex: number;
    originalInput: string;
    lastMatch: string;
}
/**
 * UI state management
 */
export interface UIState {
    isProcessing: boolean;
    isCancelling: boolean;
    isThinking: boolean;
    isCompacting: boolean;
    activeOverlay: OverlayType;
    /** Whether assistant reasoning is shown in the chat transcript. */
    showReasoning: boolean;
    exitWarningShown: boolean;
    exitWarningTimestamp: number | null;
    mcpWizardServerType: McpWizardServerType;
    copyModeEnabled: boolean;
    pendingModelSwitch: PendingModelSwitch | null;
    selectedMcpServer: SelectedMcpServer | null;
    historySearch: HistorySearchState;
    promptAddWizard: PromptAddWizardState | null;
    autoApproveEdits: boolean;
    bypassPermissions: boolean;
    todoExpanded: boolean;
    backgroundTasksRunning: number;
    backgroundTasksExpanded: boolean;
    backgroundTasks: Array<{
        taskId: string;
        status: 'running' | 'completed' | 'failed' | 'cancelled';
        description?: string;
    }>;
    /** Best-effort ChatGPT Login usage-cap status for the current session. */
    chatgptRateLimitStatus: CodexRateLimitSnapshot | null;
    insufficientCredits: InsufficientCreditsState | null;
    planModeActive: boolean;
    planModeInitialized: boolean;
    commandOutput: CommandOutputState | null;
}
/**
 * Session state management
 */
export interface SessionState {
    id: string | null;
    hasActiveSession: boolean;
    modelName: string;
}
/**
 * Root CLI state (UI state only - messages handled separately via useState)
 */
export interface CLIState {
    input: InputState;
    ui: UIState;
    session: SessionState;
    approval: ApprovalRequest | null;
    approvalQueue: ApprovalRequest[];
}
//# sourceMappingURL=types.d.ts.map