kestrel.markets
Version:
A typed, token-efficient language + runtime for agentic trading: agents author bounded plans, the runtime fires them at the tick. CLI + typed library + MCP server.
33 lines (32 loc) • 2.27 kB
JavaScript
/**
* # bus — the typed, append-only event bus + deterministic synthetic sessions (RUNTIME §1)
*
* The bus is the runtime's spine: a single append-only JSONL log per session that is at once
* the **audit trail**, the **replay substrate**, and the **grading corpus** (RUNTIME §1).
* The engine writes everything it does back onto it; a `sim` Session reads a recorded or
* synthetic bus *as its clock* (`now` = the current event's `ts`, RUNTIME §0). Same bus +
* same armed documents ⇒ byte-identical emitted stream (the determinism invariant).
*
* This barrel is the import surface other `src/` modules use for bus types and I/O:
*
* - {@link ./types.ts} — the envelope + payload object model. Discriminate on `stream`
* (then, for `TICK`, on `type`). The per-instrument book reduction is {@link BookState}.
* - {@link ./write.ts} — {@link BusWriter} (single-writer, monotonic `seq`, flush-per-line)
* plus the pure {@link serializeBus} / {@link writeBusFile} serializers.
* - {@link ./read.ts} — {@link readBus} (path or content), crash-tolerant (torn final line
* dropped; interior corruption is a loud {@link BusReadError}; a v1 bus and an unknown
* {@link JournalEvent JOURNAL} `kind` are tolerated by a logged skip) and schema-validating.
* - {@link ./synthetic.ts} — {@link generateSession}, a seeded deterministic session
* generator (public-safe test substrate).
* - {@link ./anchor-ledger.ts} — {@link spotAnchorUnknownWindows}, the past-only ledger of the
* spans the SPOT/value anchor was UNKNOWN (the same windows the de-arm primitive covers). The
* ledger is honest BY CONSTRUCTION — the derivation records exactly the de-arm's UNKNOWN seqs, so
* it can never under-report (proved against the series-layer primitive in the ven.4 suite); there
* is no separate under-report validator (kestrel-voy9).
*/
export * from "./types.js";
export { BusWriter, canonicalEnvelope, serializeEvent, serializeBus, writeBusFile } from "./write.js";
export { readBus, readBusText, readBusFile, BusReadError } from "./read.js";
export { groupPlanInstances } from "./plan-instances.js";
export { generateSession, mulberry32 } from "./synthetic.js";
export { spotAnchorUnknownWindows, } from "./anchor-ledger.js";