/**
 * RunTrace — aggregates attempts, evidence, and run state into a single trace.
 *
 * Provides read/write view of all attempts across a run, with per-node
 * breakdown, diagnosis summaries, cost/latency rollups, and failure memory.
 *
 * Storage structure:
 *   .omk/runs/<runId>/
 *     run.json          — run metadata (started, completed, status, stats)
 *     dag.json          — DAG snapshot at run start
 *     attempts.jsonl    — per-attempt records
 *     evidence.jsonl    — per-gate evidence results
 *     context-capsules/ — context snapshots per attempt
 *     artifacts/        — output artifacts
 *     reports/          — generated reports
 */
import type { AttemptRecord, AttemptStatus, DiagnosisResult } from "./attempt-record.js";
export interface NodeTraceSummary {
    readonly nodeId: string;
    readonly attempts: readonly AttemptRecord[];
    readonly finalStatus: AttemptStatus;
    readonly totalLatencyMs: number;
    readonly totalCostUsd: number;
    readonly diagnoses: readonly DiagnosisResult[];
}
export interface RunTrace {
    readonly runId: string;
    readonly nodes: readonly NodeTraceSummary[];
    readonly totalAttempts: number;
    readonly successRate: number;
    readonly totalLatencyMs: number;
    readonly totalCostUsd: number;
}
export interface RunMeta {
    readonly runId: string;
    readonly startedAt: string;
    completedAt?: string;
    status: "running" | "completed" | "failed" | "cancelled";
    readonly dagNodeCount: number;
    totalAttempts: number;
    successCount: number;
    failureCount: number;
    totalLatencyMs: number;
    totalCostUsd: number;
    readonly options?: {
        workers?: number;
        timeoutPreset?: string;
        ensemble?: boolean;
    };
}
export interface NodeReport {
    readonly nodeId: string;
    readonly nodeName: string;
    readonly role: string;
    readonly finalStatus: AttemptStatus;
    readonly attemptCount: number;
    readonly totalLatencyMs: number;
    readonly totalCostUsd: number;
    readonly diagnoses: readonly DiagnosisResult[];
    readonly lastError?: string;
    readonly evidenceGates: readonly {
        readonly gate: string;
        readonly passed: boolean;
        readonly ref?: string;
        readonly message?: string;
    }[];
}
export interface RunReport {
    readonly runId: string;
    readonly generatedAt: string;
    readonly durationMs: number;
    readonly summary: {
        readonly totalNodes: number;
        readonly succeeded: number;
        readonly failed: number;
        readonly skipped: number;
        readonly totalAttempts: number;
        readonly successRate: number;
        readonly totalLatencyMs: number;
        readonly totalCostUsd: number;
        readonly totalInputTokens: number;
        readonly totalOutputTokens: number;
        readonly totalEvidencePassCount: number;
        readonly totalEvidenceFailCount: number;
        readonly evidencePassRatePerToken: number;
    };
    readonly nodes: readonly NodeReport[];
    readonly failureBreakdown: readonly {
        readonly kind: string;
        readonly count: number;
        readonly nodeIds: readonly string[];
    }[];
}
export interface RunTraceStore {
    load(runId: string): Promise<RunTrace>;
    loadAttempts(runId: string): Promise<AttemptRecord[]>;
    loadRunMeta(runId: string): Promise<RunMeta | null>;
    saveRunMeta(meta: RunMeta): Promise<void>;
    saveDagSnapshot(runId: string, dag: unknown): Promise<void>;
    saveReport(report: RunReport): Promise<void>;
    generateReport(runId: string): Promise<RunReport>;
}
export declare function createRunTraceStore(runsDir?: string): RunTraceStore;
