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.
35 lines • 2.26 kB
TypeScript
/**
* # print — the canonical printer (objects -> canonical text)
*
* The inverse projection of the phase-3 parser and the round-trip target (ADR-0004):
* deterministic, minimal, 2-space indented clause lines under statement headers, and
* **USING-covered qualifiers elided** against the ambient `USING` (ARCHITECTURE §2).
*
* Every switch is exhaustive via {@link assertNever}; the printer fails **closed** — a
* non-finite number, an empty time-window, or an unhandled variant throws loudly rather
* than emitting text that would not round-trip.
*/
import type { Budget, KestrelNode, PlanClause, Trigger } from "./ast.ts";
/** Compile-time exhaustiveness guard; at runtime it fails closed on an unmodeled
* variant rather than silently emitting nothing. */
export declare function assertNever(x: never, ctx: string): never;
/** Print ONE plan clause to its canonical Kestrel text (kestrel-wa0j.29): exported so a consumer that
* holds a plan's typed AST (the sim driver, capturing the ARMED document's terms for the `armed-plan`
* pane) prints each clause through the SAME canonical printer the round-trip is defined by — a typed
* value → its byte-stable text, never a hand-rolled restatement. Pure. */
export declare function planClause(c: PlanClause): string;
/** Print a plan's top-level WHEN trigger to its canonical text (kestrel-wa0j.29), at outermost
* precedence (no enclosing parens) — the ARMED plan's arming premise, captured by the sim driver for
* the `armed-plan` pane. Pure; the same canonical trigger algebra a round-trip prints. */
export declare function printTrigger(t: Trigger): string;
/** Print a plan's risk BUDGET (the size envelope, e.g. `0.5R`) to its canonical text (kestrel-wa0j.29),
* exported for the `armed-plan` pane's size-envelope term. Pure; refuses a non-positive budget (as the
* round-trip does). */
export declare function budgetStr(b: Budget): string;
/**
* Print any node to canonical Kestrel text. The round-trip target: for well-formed
* input, `print(parse(print(x))) === print(x)` byte-for-byte (ADR-0004). No trailing
* newline — file serialization appends one (`.editorconfig`).
*/
export declare function print(node: KestrelNode): string;
//# sourceMappingURL=print.d.ts.map