/**
 * CLI Executor State
 * Conversation history + execution record storage (SQLite-backed)
 */
import type { HistoryIndexEntry } from './cli-history-store.js';
import type { CliOutputUnit } from './cli-output-converter.js';
/**
 * Get or initialize SQLite store (async)
 */
export declare function getSqliteStore(baseDir: string): Promise<import("./cli-history-store.js").CliHistoryStore>;
export type ExecutionCategory = 'user' | 'internal' | 'insight';
export interface ConversationTurn {
    turn: number;
    timestamp: string;
    prompt: string;
    duration_ms: number;
    status: 'success' | 'error' | 'timeout';
    exit_code: number | null;
    output: {
        stdout: string;
        stderr: string;
        truncated: boolean;
        cached?: boolean;
        stdout_full?: string;
        stderr_full?: string;
        structured?: CliOutputUnit[];
    };
}
export interface ConversationRecord {
    id: string;
    created_at: string;
    updated_at: string;
    tool: string;
    model: string;
    mode: string;
    category: ExecutionCategory;
    total_duration_ms: number;
    turn_count: number;
    latest_status: 'success' | 'error' | 'timeout';
    turns: ConversationTurn[];
    parent_execution_id?: string;
}
export interface ExecutionRecord {
    id: string;
    timestamp: string;
    tool: string;
    model: string;
    mode: string;
    prompt: string;
    status: 'success' | 'error' | 'timeout';
    exit_code: number | null;
    duration_ms: number;
    output: {
        stdout: string;
        stderr: string;
        truncated: boolean;
    };
    parsedOutput?: string;
    finalOutput?: string;
}
interface HistoryIndex {
    version: number;
    total_executions: number;
    executions: {
        id: string;
        timestamp: string;
        updated_at?: string;
        tool: string;
        status: string;
        duration_ms: number;
        turn_count?: number;
        prompt_preview: string;
    }[];
}
export interface ExecutionOutput {
    success: boolean;
    execution: ExecutionRecord;
    conversation: ConversationRecord;
    stdout: string;
    stderr: string;
    parsedOutput?: string;
    finalOutput?: string;
}
/**
 * Ensure history directory exists (uses centralized storage)
 */
export declare function ensureHistoryDir(baseDir: string): string;
/**
 * Sync wrapper for saveConversation (uses cached SQLite module)
 * @param baseDir - Project base directory (NOT historyDir)
 */
export declare function saveConversation(baseDir: string, conversation: ConversationRecord): void;
/**
 * Sync wrapper for loadConversation (uses cached SQLite module)
 * @param baseDir - Project base directory (NOT historyDir)
 */
export declare function loadConversation(baseDir: string, conversationId: string): ConversationRecord | null;
/**
 * Convert legacy ExecutionRecord to ConversationRecord
 */
export declare function convertToConversation(record: ExecutionRecord): ConversationRecord;
/**
 * Get execution history from SQLite (centralized storage)
 */
export declare function getExecutionHistoryAsync(baseDir: string, options?: {
    limit?: number;
    tool?: string | null;
    status?: string | null;
    category?: ExecutionCategory | null;
    search?: string | null;
    recursive?: boolean;
}): Promise<{
    total: number;
    count: number;
    executions: (HistoryIndex['executions'][0] & {
        sourceDir?: string;
    })[];
}>;
/**
 * Get execution history (sync version - uses cached SQLite module)
 */
export declare function getExecutionHistory(baseDir: string, options?: {
    limit?: number;
    tool?: string | null;
    status?: string | null;
    recursive?: boolean;
}): {
    total: number;
    count: number;
    executions: (HistoryIndex['executions'][0] & {
        sourceDir?: string;
    })[];
};
/**
 * Get conversation detail by ID
 */
export declare function getConversationDetail(baseDir: string, conversationId: string): ConversationRecord | null;
/**
 * Get conversation detail with native session mapping info
 */
export declare function getConversationDetailWithNativeInfo(baseDir: string, conversationId: string): (import("./cli-history-store.js").ConversationRecord & {
    hasNativeSession: boolean;
    nativeSessionId?: string;
    nativeSessionPath?: string;
}) | null;
/**
 * Get execution detail by ID (legacy, returns ExecutionRecord for backward compatibility)
 */
export declare function getExecutionDetail(baseDir: string, executionId: string): ExecutionRecord | null;
/**
 * Delete execution by ID (async version)
 */
export declare function deleteExecutionAsync(baseDir: string, executionId: string): Promise<{
    success: boolean;
    error?: string;
}>;
/**
 * Delete execution by ID (sync version - uses cached SQLite module)
 */
export declare function deleteExecution(baseDir: string, executionId: string): {
    success: boolean;
    error?: string;
};
/**
 * Batch delete executions (async)
 */
export declare function batchDeleteExecutionsAsync(baseDir: string, ids: string[]): Promise<{
    success: boolean;
    deleted: number;
    total: number;
    errors?: string[];
}>;
/**
 * Get latest execution for a specific tool
 */
export declare function getLatestExecution(baseDir: string, tool?: string): ExecutionRecord | null;
/**
 * Get native session content by CCW ID
 * Parses the native session file and returns full conversation data
 */
export declare function getNativeSessionContent(baseDir: string, ccwId: string): Promise<import("./session-content-parser.js").ParsedSession | null>;
/**
 * Get formatted native conversation text
 */
export declare function getFormattedNativeConversation(baseDir: string, ccwId: string, options?: {
    includeThoughts?: boolean;
    includeToolCalls?: boolean;
    includeTokens?: boolean;
    maxContentLength?: number;
}): Promise<string | null>;
/**
 * Get conversation pairs from native session
 */
export declare function getNativeConversationPairs(baseDir: string, ccwId: string): Promise<{
    turn: number;
    userPrompt: string;
    assistantResponse: string;
    timestamp: string;
}[] | null>;
/**
 * Get enriched conversation (CCW + native session merged)
 */
export declare function getEnrichedConversation(baseDir: string, ccwId: string): Promise<{
    ccw: import("./cli-history-store.js").ConversationRecord | null;
    native: import("./session-content-parser.js").ParsedSession | null;
    merged: Array<{
        turn: number;
        timestamp: string;
        ccwPrompt?: string;
        ccwOutput?: string;
        nativeUserContent?: string;
        nativeAssistantContent?: string;
        nativeThoughts?: string[];
        nativeToolCalls?: Array<{
            name: string;
            arguments?: string;
            output?: string;
        }>;
    }>;
} | null>;
/**
 * Get history with native session info
 * Supports recursive querying of child projects
 */
export declare function getHistoryWithNativeInfo(baseDir: string, options?: {
    limit?: number;
    offset?: number;
    tool?: string | null;
    status?: string | null;
    category?: ExecutionCategory | null;
    search?: string | null;
    recursive?: boolean;
}): Promise<{
    total: number;
    count: number;
    executions: Array<HistoryIndexEntry & {
        hasNativeSession: boolean;
        nativeSessionId?: string;
        nativeSessionPath?: string;
    }>;
}>;
export {};
//# sourceMappingURL=cli-executor-state.d.ts.map