import { EventStore } from "../infra/event-store.js"; import type { IStateStore } from "../infra/state-store.js"; import type { AggregateGraphViolation } from "../runtime/replay.js"; /** Detailed divergence between operational and replayed state. */ export type ReplayDivergence = { key: string; live: unknown; replayed: unknown; }; /** Hash-chain verification result. */ export type ChainCheckResult = { valid: boolean; firstBrokenIndex: number | null; firstBrokenReason: string | null; eventCount: number; }; /** Replay verification result. */ export type ReplayCheckResult = { consistent: boolean; chainValid: boolean; liveHash: string | null; replayHash: string; eventCount: number; divergences: ReplayDivergence[]; explanation: string; /** * EXP-HARDEN-004: true when the event log's aggregate graph and * post-replay navigation are free of violations. Reported separately * from `consistent`; violations are warnings unless a strict * consumer (e.g. verify-replay.js --strict-graph) enforces them. */ graphValid: boolean; graphViolations: AggregateGraphViolation[]; }; /** Verifies that operational state matches replayed state. */ export declare class ReplayVerifier { private eventStore; private stateStore; constructor(eventStore: EventStore, stateStore: IStateStore); /** * Verify the cryptographic hash-chain of the event log. * Returns detailed information about the first break, if any. */ verifyChain(): Promise; /** * Run full replay consistency check. * Returns a detailed result explaining any divergence. */ verify(): Promise; /** * Check that replayed state satisfies structural invariants. * These properties must hold regardless of event content. * * EXP-HARDEN-006: mission/expedition/objective status enums are * validated alongside workItem/plan (deferred from EXP-HARDEN-004). * The enums mirror src/types/state.ts exactly. */ private checkStructuralConsistency; /** * Compute a deep diff between two projection maps. */ private deepDiff; private buildExplanation; /** * Check First Contact artifact integrity. * If a DISCOVERY_APPROVED event exists, verify that the stored artifact * at `.synth/first-contact/discovery-artifact.json` has the same hash. */ private checkFirstContactArtifact; /** Quick check: are events replayable? */ isReplayable(): Promise; /** Get replay statistics */ getStats(): Promise<{ eventCount: number; workItemCount: number; planCount: number; milestoneCount: number; projectCount: number; stateHash: string; }>; } /** Factory function */ export declare function createReplayVerifier(eventStore: EventStore, stateStore: IStateStore): ReplayVerifier;