/**
 * Storage schema types for Content Lake documents.
 *
 * All AILF document types include `schemaVersion` for forward-compatible
 * migration. Full trace data goes to blob storage (GCP/local); only
 * sanitized summaries are stored in Content Lake.
 *
 * SECURITY: The `next` dataset is publicly accessible. Never store
 * sensitive data (API keys, full tool call arguments, raw outputs with
 * PII) in Content Lake. Use blob storage + traceDataUri references.
 *
 * @see docs/design-docs/architecture-overhaul/storage-schema.md
 */
import type { VariableEnvelope } from "./variable-envelope.js";
/** Current schema version for all AILF document types */
export declare const CURRENT_SCHEMA_VERSION = 1;
/** Schema-versioned document base */
export interface SchemaVersioned {
    /** Schema version for forward-compatible migration */
    schemaVersion: number;
}
/** An evaluation run — one execution of the pipeline */
export interface StoredRun extends SchemaVersioned {
    _type: "ailf.run";
    _id: string;
    /** ISO timestamp when the run started */
    startedAt: string;
    /** ISO timestamp when the run completed */
    completedAt?: string;
    /** Run status */
    status: "completed" | "failed" | "running";
    /** Evaluation mode used */
    mode: string;
    /** Models evaluated */
    models: {
        id: string;
        label: string;
    }[];
    /** Grader model used */
    graderModel: string;
    /** Number of tasks evaluated */
    taskCount: number;
    /** Run-level aggregate score (0-100) */
    overallScore?: number;
    /** Per-area scores */
    areaScores?: {
        areaId: string;
        score: number;
    }[];
    /** Pipeline configuration fingerprint (for cache invalidation) */
    configFingerprint?: string;
    /** Git context at run time */
    git?: {
        branch: string;
        sha: string;
        repo: string;
    };
    /** Run metadata */
    metadata?: Record<string, unknown>;
}
/** Result for one task × one model */
export interface StoredTaskResult extends SchemaVersioned {
    _type: "ailf.taskResult";
    _id: string;
    /** Reference to parent run */
    runRef: {
        _type: "reference";
        _ref: string;
    };
    /** Reference to task definition */
    taskRef: {
        _type: "reference";
        _ref: string;
    };
    /** Task ID (denormalized for querying) */
    taskId: string;
    /** Model that produced this result */
    modelId: string;
    /** Overall task score (0-100) */
    score: number;
    /** Per-dimension scores */
    dimensions: {
        dimensionId: string;
        score: number;
        weight: number;
        assertionCount: number;
        passCount: number;
    }[];
    /** Whether task passed its quality threshold */
    passesThreshold: boolean;
    /** Input variable envelope (provenance tracking) */
    inputEnvelope?: VariableEnvelope;
    /** Output variable envelope */
    outputEnvelope?: VariableEnvelope;
    /** URI to full trace payload in blob storage */
    traceDataUri?: string;
    /** Sanitized trace summary (safe for public dataset) */
    traceSummary?: {
        toolCallCount: number;
        toolCallCategories: Record<string, number>;
        totalTokens: number;
        costEstimate: number;
        durationMs: number;
    };
    /** Evaluation mode */
    mode: string;
    /** Mode-specific metadata */
    modeMetadata?: Record<string, unknown>;
}
/** Aggregated report for a run */
export interface StoredReport extends SchemaVersioned {
    _type: "ailf.report";
    _id: string;
    /** Reference to parent run */
    runRef: {
        _type: "reference";
        _ref: string;
    };
    /** ISO timestamp */
    createdAt: string;
    /** Report tag/label */
    tag?: string;
    /** Overall score */
    overallScore: number;
    /** Per-area breakdown */
    areas: {
        areaId: string;
        score: number;
        taskCount: number;
        passingCount: number;
    }[];
    /** Per-model breakdown */
    models: {
        modelId: string;
        score: number;
    }[];
    /** Human-readable markdown summary */
    summary?: string;
}
/** Baseline snapshot for comparison */
export interface StoredBaseline extends SchemaVersioned {
    _type: "ailf.baseline";
    _id: string;
    /** ISO timestamp when baseline was saved */
    savedAt: string;
    /** Label for this baseline */
    label?: string;
    /** Reference to the run this baseline was taken from */
    runRef: {
        _type: "reference";
        _ref: string;
    };
    /** Per-task scores at baseline time */
    taskScores: {
        taskId: string;
        score: number;
        dimensions: Record<string, number>;
    }[];
    /** Per-area scores at baseline time */
    areaScores: {
        areaId: string;
        score: number;
    }[];
}
/** Trace summary document in Content Lake */
export interface StoredTrace extends SchemaVersioned {
    _type: "ailf.trace";
    _id: string;
    /** Reference to parent run */
    runRef: {
        _type: "reference";
        _ref: string;
    };
    /** Reference to task result */
    taskResultRef: {
        _type: "reference";
        _ref: string;
    };
    /** URI to full trace payload in blob storage */
    traceDataUri: string;
    /** Task ID (denormalized) */
    taskId: string;
    /** Model ID */
    modelId: string;
    /** Tool call count */
    toolCallCount: number;
    /** Tool call category breakdown */
    toolCallCategories: Record<string, number>;
    /** Total tokens consumed */
    totalTokens: number;
    /** Cost estimate in USD */
    costEstimate: number;
    /** Duration in milliseconds */
    durationMs: number;
}
/** Check if a document is schema-versioned */
export declare function isSchemaVersioned(doc: unknown): doc is SchemaVersioned;
/** Migrate a document to the current schema version (no-op for v1) */
export declare function migrateDocument<T extends SchemaVersioned>(doc: T): T;
