Trace & replay

Structured events for every pipeline stage, replayable end to end.

The engine emits structured events through a Tracer. Because trace events and serialized transactions are JSON-safe, recorded artifacts can be stored, compared, and replayed without asking the DOM what happened.

Tracer

createTracer(sink: TraceSink, sessionId?: TraceSessionId): Tracer

Sinks: NoopTraceSink, MemoryTraceSink, or any custom TraceSink. Built-in event kinds are intentReceived, planCompiled, transactionApplied, normalized, history, and custom. See packages/core/src/trace.ts.

Export / import

exportTrace(events: readonly TraceEvent[], sessionId?: TraceSessionId): JsonValue
importTrace(value: JsonValue): { sessionId?: TraceSessionId; events: readonly TraceEvent[] }

Exported traces are deterministic and preserve emitted event order. Imported traces are sorted by logical timestamp with stable ordering for ties.

Replay

replayIntents(config: ReplayIntentsConfig): ReplayIntentsResult
replayTransactions(config: ReplayTransactionsConfig): ReplayArtifacts

Comparison helpers: replayArtifactsEqual, replayArtifactsSemanticallyEqual, and replayArtifactsNormalizedEqual. See packages/core/src/replay.ts.