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.
30 lines • 1.93 kB
TypeScript
/**
* # blotter/certify — the determinism certification leg (kestrel-a57.1 slice 2, ADR-0011)
*
* `certify(bus)` is **the projector proving its own core invariant**: it re-projects the bus twice and
* byte-compares the canonical serialized {@link Blotter}. The determinism leg passes iff the two
* projections are byte-identical (same bus ⇒ byte-identical Blotter). In `sim` — determinism-pass with the
* paper/live legs `na` — the verdict is `certified`; ANY divergence is fail-closed `not certified`
* (ADR-0011). The richer paper/live legs (detectors bit-for-bit, fills ⊆ live, lifecycle divergence
* explained) land with paper/live modes in a57.3; this slice certifies the determinism leg only.
*
* This function is the runtime audit of the claim {@link ./project.ts} embeds (`certification.determinism
* = pass`): in a correct system the embedded claim and this audit agree; a bug that breaks purity (Map
* iteration order, a leaked wall clock, an RNG) makes the two projections diverge and `certify` refuses.
*/
import type { BusEvent } from "../bus/index.ts";
/** The determinism-leg verdict. `not certified` is the fail-closed outcome of any re-projection divergence. */
export type CertifyVerdict = "certified" | "not certified";
/** The result of {@link certify}: the verdict, the determinism leg, and a reason when it did not certify. */
export interface CertifyResult {
readonly verdict: CertifyVerdict;
readonly determinism: "pass" | "fail";
/** A logged reason on anything other than a clean sim certification (fail-closed, never silent). */
readonly reason?: string;
}
/**
* Certify a GRADED bus on the determinism leg: re-project + byte-compare (ADR-0011). Pure — no wall
* clock, no RNG. Refuses loudly (via {@link project}) if the bus is not a graded bus.
*/
export declare function certify(bus: readonly BusEvent[]): CertifyResult;
//# sourceMappingURL=certify.d.ts.map