@parmana/replay (packages/replay/src/index.ts) exports ReplayEngine, ReplayBuilder, ReplayVerifier, a ReplayContext type, and an engine sub-layer (ReplayPipeline, ReplayExecutor, ReplayPlan), plus ReplayError.
ReplayEngine
ReplayEngine.replay() (packages/replay/src/ReplayEngine.ts) takes the recorded Decision from trustRecord.executions[0].decision, re-runs PolicyEngine.evaluate() (from policy) against the transaction’s signals and the supplied policy, builds a replayedDecision, and sets matches = recordedDecision.outcome === replayedDecision.outcome. This is genuine deterministic decision replay — a materially different (and stronger) check than a hash comparison, since it independently re-derives the policy outcome rather than just confirming the record wasn’t tampered with.
This
ReplayResult (recordedDecision/replayedDecision/matches/replayedAt) is a completely different shape from the ReplayResult that POST /replay and both SDKs actually return (businessTransactionId/trustRecordHash/verified — see Concepts → Replay). Same name, two different types, in two different packages.ReplayEngine.replay() also logs recorded vs. replayed outcomes and the intermediate policy decision to the console (labeled "Temporary debug output" in the source) on every call — noisy if you do wire this in as-is.
ReplayBuilder
new ReplayEngine() regardless of the context passed in — the context isn’t yet used to configure anything.
Engine sub-layer
packages/replay/src/engine/ — ReplayPipeline, ReplayExecutor, ReplayPlan — a staged execution model parallel to runtime’s own RuntimePipeline/RuntimeComponent, intended for more elaborate multi-step replay scenarios than the single-shot ReplayEngine.replay() call above.
Related
Replay (concept)
What replay is meant to guarantee.
REST API → Replay
What actually runs when you call
POST /replay.policy
The
PolicyEngine this package re-invokes.verification
The other unused-by-the-API engine package.