/** * Deterministic replay — re-fold a recorded event log under alternate **decision * knobs** without calling the model (RFC §7, S3). * * **Import graph guard (structural):** this module imports only pure packages * (`exec/events`, `exec/fold`, `deterministic`, `scorers`). It must NEVER import * `runtime.ts` or `exec/driver` / `exec/step` (those drag process-spawning). * * 0.1.7 shipped types only. 0.2.0 implements {@link replayRun}. */ import type { Event } from "./exec/events.ts"; import { type FoldedRun } from "./exec/fold.ts"; import { type UsageStats } from "./usage.ts"; /** * Per-phase outcome of a replay. Distinct from `RecomputeDecision` (which * describes a *live* recompute): only `"reused"` overlaps. */ export interface ReplayDecision { readonly phaseId: string; readonly outcome: "reused" | "verdict-flipped" | "would-block" | "would-exceed-budget" | "needs-live-rerun" | "would-skip" | "threshold-changed" | "failed"; readonly reason: string; readonly priorOutcome?: string; readonly replayedOutcome?: string; readonly causedBy?: readonly string[]; } /** * Knobs a replay may override on a *copy* of the recorded definition (never the * stored run). */ export interface ReplayOverrides { budgetMaxUSD?: number; budgetMaxTokens?: number; /** `phases..score.threshold` — re-judge recorded gate-score events. */ thresholds?: Record; /** `phases..model` — cost delta only (needs rates; otherwise needs-live-rerun). */ models?: Record; /** `args.*` — text-changing args → needs-live-rerun for affected phases. */ args?: Record; } /** Result of {@link replayRun}. */ export interface ReplayReport { readonly decisions: ReplayDecision[]; /** Fold under recorded knobs (baseline). */ readonly baseline: FoldedRun; /** Fold after applying overrides (may equal baseline when no knobs change). */ readonly replayed: FoldedRun; /** True if any phase needs a live model call. */ readonly needsLiveRerun: boolean; /** Aggregate recorded usage (for budget re-check). */ readonly totalUsage: UsageStats; } /** * Re-evaluate a recorded event log under optional decision overrides. * * - **No overrides** → every completed phase is `"reused"` (consistency oracle). * - **thresholds[phaseId]** → re-compare recorded `gate-score.combined` to the * new threshold; emit `verdict-flipped` / `would-block` / `threshold-changed`. * - **budgetMax*** → re-tally recorded usage; phases that would not have run * under a tighter cap → `would-exceed-budget`. * - **models / args** → currently `needs-live-rerun` for any phase (cannot * re-judge quality offline without more instrumentation). * * Never calls a model. Never throws. */ export declare function replayRun(events: readonly Event[], overrides?: ReplayOverrides): ReplayReport; /** @deprecated kept for 0.1.7 callers that checked the sentinel string */ export declare const REPLAY_NOT_YET_IMPLEMENTED = "replayRun() is implemented in 0.2.0; this sentinel remains for back-compat string checks."; //# sourceMappingURL=replay.d.ts.map