/**
 * Session trace analyzer — extracts patterns from conversation sessions.
 * Parses tool call sequences, error recovery, multi-step workflows.
 * Output feeds into skill synthesizer (Round 105).
 */
import type { Session } from '../history/sessions.js';
export interface ToolCall {
    /** Sequential index in the session */
    index: number;
    /** Tool name (e.g., "bash", "file_write", "grep") */
    name: string;
    /** Tool input (truncated for storage) */
    input: Record<string, unknown>;
    /** Whether the tool result was an error */
    isError: boolean;
    /** Timestamp from the containing message */
    timestamp: string;
}
export interface ErrorRecovery {
    /** The tool call that failed */
    failedCall: ToolCall;
    /** Tool calls made to recover (between error and next success of same tool) */
    recoveryCalls: ToolCall[];
    /** Whether recovery succeeded */
    recovered: boolean;
}
export interface WorkflowStep {
    /** Step number in the workflow */
    order: number;
    /** What happened (e.g., "Read file src/foo.ts", "Ran tests") */
    description: string;
    /** Tools used in this step */
    tools: string[];
}
export interface AnalyzedTrace {
    /** Session ID */
    sessionId: string;
    /** Model used */
    model: string;
    /** All tool calls in order */
    toolCalls: ToolCall[];
    /** Error → recovery patterns */
    errorRecoveries: ErrorRecovery[];
    /** High-level workflow steps (collapsed from raw tool calls) */
    workflow: WorkflowStep[];
    /** Unique tool names used */
    toolsUsed: string[];
    /** Complexity score (0-100) */
    complexity: number;
    /** Number of user/assistant turns */
    turnCount: number;
    /** Duration in seconds (first to last message) */
    durationSec: number;
    /** Keywords extracted from user messages */
    keywords: string[];
}
export declare function extractToolCalls(session: Session): ToolCall[];
export declare function extractErrorRecoveries(calls: ToolCall[]): ErrorRecovery[];
export declare function buildWorkflow(calls: ToolCall[]): WorkflowStep[];
export declare function extractKeywords(session: Session): string[];
export declare function computeComplexity(calls: ToolCall[], recoveries: ErrorRecovery[], turnCount: number): number;
export declare function analyzeSession(session: Session): AnalyzedTrace;
