Structured event system for deterministic boundary behavior.
boundary-trace is built around structured boundary events. A boundary event records a meaningful state transition in a deterministic boundary system, such as a verification failure, a repair being generated, or a retry being scheduled.
This event stream is the canonical representation of boundary behavior. Console views, JSON logs, and future TUI tools should all consume the same event stream.
Every event uses a shared envelope:
systemsource of event (for example,llm-contract)runIdlogical boundary execution IDtstimestamp in ISO formattypecanonical state transition nameattemptoptional attempt numberdatatyped payload for the transition
The core union models boundary lifecycle transitions:
run.startedattempt.startedoutput.raw_observedoutput.cleanedverification.passedverification.failedrepair.generatedretry.scheduledrun.succeededrun.failed
Use createMemoryTrace() to collect events in order for tests, debugging, and comparison.
It returns:
eventscollected event arraysinksink-compatible emitterreset()utility for reuse
Use createFanoutSink([...sinks]) to broadcast one event stream to multiple sinks.
This supports attaching memory capture, renderers, and downstream tooling without changing event producers.
npm install
npm run exampleThe repository includes a renderer for fast run comprehension:
- left panel: attempt timeline
- center panel: selected event inspector
- right panel: failure + repair details
- raw/structured event toggle
- replay mode
- copy reproduction payload
Run the inspector locally:
npm run inspector:dev