Skip to main content
@parmana/replay (packages/replay/src/index.ts) exports ReplayEngine, ReplayBuilder, ReplayVerifier, a ReplayContext type, and an engine sub-layer (ReplayPipeline, ReplayExecutor, ReplayPlan), plus ReplayError.
This package is not imported anywhere under packages/runtime or packages/api. What POST /replay actually does is a hash-integrity check via @parmana/crypto’s VerificationCrypto — see REST API → Replay for the full trace through ExecutionTrustApplication.replay(). Everything below describes real, working code that a future integration could wire in, not what runs today when you call the endpoint.

ReplayEngine

class ReplayEngine {
  replay(input: ReplayInput): ReplayResult;
}

interface ReplayInput {
  trustRecord: ExecutionTrustRecord;
  transaction: BusinessTransaction;
  policy?: Policy;
}

interface ReplayResult {
  recordedDecision: Decision;
  replayedDecision: Decision;
  matches: boolean;
  replayedAt: Date;
}
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

class ReplayBuilder {
  constructor(context: ReplayContext);
  build(): ReplayEngine;
}
Currently just constructs a plain 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.

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.