import type { SimSolver } from './SimSolver'; import { ContractedSimulation } from './SimulationContract'; import { type CAELTrace } from './CAELTrace'; type SolverFactory = (config: Record) => SimSolver; /** * Options for CAELReplayer.replay(). * * Item 5b (paper-3 §5.2 Algorithm 1 dispatch): the replayer compares * the trace's recorded adapter fingerprint (cael.init.payload. * adapterFingerprint) against the current replay environment's * fingerprint. Matching fingerprints → same-adapter → strict digest * enforcement. Differing (or either absent) → cross-adapter → skip * digest enforcement (per Appendix A Lemma 3 regime where per-step * digest identity is not expected across adapters). */ export interface ReplayOptions { /** Adapter fingerprint of the CURRENT replay environment. In * production this is vendor+architecture+device+driver+UA (matching * the format used at record time); in tests any stable string. * If omitted, replayer treats the replay as cross-adapter (safe * fallback — no strict enforcement, dispute oracle falls through * to metric comparison). */ currentAdapterFingerprint?: string; } export declare class CAELReplayer { private readonly trace; constructor(jsonlOrTrace: string | CAELTrace); getTrace(): CAELTrace; verify(): { valid: boolean; brokenAt?: number; reason?: string; }; /** * sameAdapter predicate (Item 5b): compares the trace's recorded * adapter fingerprint against the replay environment's current * fingerprint. Both must be present as non-empty strings AND equal * for sameAdapter() to return true. Any null/undefined/empty or * mismatch returns false (cross-adapter fallback). * * Exposed as a public static helper because paper-3 §5.2 * Algorithm 1's pseudocode uses sameAdapter() in the dispute * oracle's dispatch branch; external code (dispute oracle, CRDT * merge) can reuse the same predicate for consistent semantics. */ static sameAdapter(recordedFingerprint: string | null | undefined, currentFingerprint: string | null | undefined): boolean; replay(solverFactory: SolverFactory, options?: ReplayOptions): Promise; /** * Validate per-step (Route 2b) or terminal (Route 2d) state digests * captured by CAELRecorder against the digests re-computed during * replay. * * Item 5b dispatch (founder-approved 2026-04-20): * - same-adapter → strict enforcement: mismatch is a hard error, * indicating state-integrity violation (replay diverged from * recorded state on the same physical adapter, which should not * happen under a deterministic contract). * - cross-adapter → skip validation: per Appendix A Lemma 3, the * per-step straddle probability p_f is non-zero across adapters, * and digest-sequence mismatch over n steps is *expected* in the * regime n > n* (~416 for structural stress). Disputes between * cross-adapter branches fall through to end-to-end metric * comparison in the dispute oracle (paper-3 §5.2 Algorithm 1's * else branch). * * Backward compat: * - Traces recorded BEFORE Wave-2 item 5a have no `stateDigests` * field. Validation is skipped silently for absent/malformed * fields (Array.isArray guard). * - Traces recorded BEFORE Item 5b have no `adapterFingerprint` * field; isSameAdapter evaluates to false (cross-adapter * fallback), so validation is skipped. This is the safe default. * * Fail-closed on NaN: if computeStateDigest throws a state-integrity * violation (non-finite value per Wave-1.5 guard), the error * propagates up through `contracted.step()` or `contracted.solve()` * and bypasses this validator entirely — the replayer inherits the * same fail-closed semantics as the contract itself, even on * cross-adapter replays where digest comparison is skipped. */ private validateDigests; } export {}; //# sourceMappingURL=CAELReplayer.d.ts.map