/**
 * # `@tangle-network/agent-eval/contract` — eval-run diff primitive.
 *
 * The substrate side of the v-N-versus-v-N+1 dashboard view. Given two
 * `EvalRunEvent`s (or two `EvalRunGenerationSnapshot`s from one run), this
 * returns a normalised diff: per-cell composite + per-judge/per-dimension
 * deltas, surface-hash change, aggregate cost + duration shifts.
 *
 * Consumed by:
 *   - The hosted-tier dashboard (intelligence-web) — renders v3 vs v4
 *     comparisons of cells × judges × dimensions.
 *   - CI reporting — emits a "shipped: composite +0.07, cost +$1.20" line
 *     in PR review for autonomous-improvement runs.
 *   - Any downstream consumer that needs "what actually changed" without
 *     reimplementing the matching + arithmetic.
 *
 * Cells are matched on the natural composite key `(scenarioId, rep)`.
 * Unmatched cells surface as `removed` / `added` so callers can tell
 * "this cell got worse" from "this cell wasn't run."
 */
import type { GateDecision } from '../campaign/types';
import type { EvalRunCellScore, EvalRunEvent, EvalRunGenerationSnapshot } from '../hosted/types';
/** Per-dimension delta. `before` / `after` are null when the judge did not
 *  emit a value for that side. `delta` is `after - before`; null when
 *  either side is null. */
export interface EvalDimensionDelta {
    before: number | null;
    after: number | null;
    delta: number | null;
}
/** Per-cell delta, keyed on `(scenarioId, rep)`. */
export interface EvalCellScoreDelta {
    scenarioId: string;
    rep: number;
    compositeBefore: number;
    compositeAfter: number;
    compositeDelta: number;
    /** Per-judge → per-dimension deltas. Outer key = judge name from
     *  `EvalRunCellScore.dimensions`; inner key = dimension name. */
    dimensions: Record<string, Record<string, EvalDimensionDelta>>;
}
/** Diff between two generation snapshots — the unit the dashboard renders
 *  for a single "v3 vs v4" comparison. */
export interface EvalGenerationDiff {
    beforeIndex: number;
    afterIndex: number;
    beforeSurfaceHash: string;
    afterSurfaceHash: string;
    surfaceChanged: boolean;
    /** Cells present in both snapshots, matched on `(scenarioId, rep)`. */
    matched: EvalCellScoreDelta[];
    /** Cells present in `before` but missing from `after`. */
    removed: EvalRunCellScore[];
    /** Cells present in `after` but missing from `before`. */
    added: EvalRunCellScore[];
    /** Aggregate composite mean across all cells in the snapshot. */
    compositeBefore: number;
    compositeAfter: number;
    compositeDelta: number;
    costUsdBefore: number;
    costUsdAfter: number;
    costUsdDelta: number;
    durationMsBefore: number;
    durationMsAfter: number;
    durationMsDelta: number;
}
/** Diff between two full eval-runs. Includes both baseline-vs-baseline and
 *  winner-vs-winner generation diffs when both sides expose them, plus
 *  run-level metadata. */
export interface EvalRunDiff {
    beforeRunId: string;
    afterRunId: string;
    beforeTimestamp: string;
    afterTimestamp: string;
    beforeGateDecision: GateDecision | null;
    afterGateDecision: GateDecision | null;
    beforeHoldoutLift: number | null;
    afterHoldoutLift: number | null;
    holdoutLiftDelta: number | null;
    beforeTotalCostUsd: number;
    afterTotalCostUsd: number;
    totalCostUsdDelta: number;
    beforeTotalDurationMs: number;
    afterTotalDurationMs: number;
    totalDurationMsDelta: number;
    /** Baseline-vs-baseline diff. Null when either run has no baseline. */
    baselineDiff: EvalGenerationDiff | null;
    /** Highest-index-generation comparison. Null when either run has no
     *  recorded generations (e.g. baseline-only or errored before any
     *  generation completed). */
    winnersDiff: EvalGenerationDiff | null;
}
/**
 * Diff two generation snapshots. Cells are matched on `(scenarioId, rep)`;
 * unmatched cells surface in `added` / `removed`. Aggregate fields are
 * recomputed from the snapshot's stored fields, not re-derived from cells —
 * this keeps the diff consistent with whatever aggregation the substrate
 * actually reported.
 */
export declare function diffGenerations(before: EvalRunGenerationSnapshot, after: EvalRunGenerationSnapshot): EvalGenerationDiff;
/**
 * Diff two full eval-runs. Produces baseline-vs-baseline and
 * winner-vs-winner generation diffs when both sides expose them, plus
 * run-level cost / lift / gate-decision deltas.
 */
export declare function diffRuns(before: EvalRunEvent, after: EvalRunEvent): EvalRunDiff;
/**
 * Within-run baseline → winning-generation diff. The natural "what did the
 * improvement loop produce" view for a single run. Returns null when the
 * run never reached a generation past baseline (errored early, or the gate
 * shipped the baseline as-is).
 */
export declare function diffRunBaselineToWinner(run: EvalRunEvent): EvalGenerationDiff | null;
//# sourceMappingURL=diff.d.ts.map