UNPKG

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.

32 lines (31 loc) 2.45 kB
/** * # sdk/types — the ONE typed Kestrel SDK contract (kestrel-djm.5) * * The transport-neutral surface a caller writes ONCE and runs LOCAL or REMOTE. Every method returns a * djm.2 PROTOCOL object (never a face-local success/failure state): catalog discovery yields * {@link CatalogEntry}[]; validation yields the client's {@link ValidateOutcome}; a Session interaction * yields the djm.4 {@link Delivery} / {@link SessionResponse} / {@link SessionTranscript}; finalize yields a * protocol {@link Blotter} + tip + conformance root + artifact refs; grade yields the portable * {@link GradeOutcome}. The 402/Offer boundary is DATA on {@link Gated} (the client's exact shape), and an * unknown/off-contract subject is a TYPED refusal (fail-closed) — the SDK speaks the protocol, it does not * invent a vocabulary. * * ZERO-WEIGHT: this module carries NO value import of the local runtime — every djm.2/djm.4 shape is a * TYPE-ONLY import (erased at build), so `src/sdk/types.ts`, `src/sdk/facade.ts`, and the HTTP transport * (`src/sdk/remote.ts`) that consume it stay light (the djm.3 light/heavy seam, pinned by * tests/package.boundary.test.ts). {@link Gated}/{@link GradeOutcome}/{@link ValidateOutcome} are RE-EXPORTED * from the 109 client — one definition, never a fork. * * ── DESIGN FORK LOGGED (hard rules forbid .beads writes — recorded here like djm.4's 7dv.4 note) ── * (1) ONE client interface, TRANSPORT via factory. `createSdk(transport)` (facade.ts) wires a low-level * {@link Transport} seam into the {@link KestrelSdk} facade; `localTransport()` (local.ts, heavy) binds * the djm.4 controller + djm.8 catalog + engine grade in-process; `remoteTransport({ baseUrl, fetch })` * (remote.ts, light) binds the 109 client over the 5rb wire. Minimal shape consistent with djm.4's * `openSession(spec)` factory and 109's `new KestrelClient(opts)` — no third contract. * (2) PROTOCOL OBJECTS, no face-local states (this file's whole point). * (3) SdkFinalized ADDS `conformanceRoot` (= `blotter.session.bus.sha256` = the catalog's pinned root) and * `artifacts` to djm.4's `SessionFinalized`, and narrows `blotter` to the djm.2 PROTOCOL {@link Blotter} * (the generic public view) — the SESSION's rich engine Blotter stays on the local path. Minimal shape * consistent with protocol/session.ts's `FinalizeMessage` (`tipHash` + `artifacts`). */ export {};