Skip to content

v0.1.3 — validated record boundary

Choose a tag to compare

@bearmug bearmug released this 18 Sep 19:42
· 1 commit to main since this release
75fa788

Fixes the advertised record contract and documents the complete library workflow.

Fixed

The package root exported isRecord as a DecisionRecord type guard, but it only detected record-shaped envelopes: isRecord({ response: null }) returned true, so a consumer could treat a malformed envelope as a validated record.

  • isRecord(input): boolean — envelope detector only.
  • readRecord(input): DecisionRecord — new validated boundary; returns a checked record or throws.
  • gate, replay, and extractResponse route through it. Same validator, same errors on malformed input; only the contract is honest.

Added

examples/library/record-and-gate.mts: the full recorded workflow with public imports only — one shared SDK client, SIGINT/SIGTERM abort, elapsed-time measurement, client errors that never reach policy, a record storing hashes of state/questions plus model identity and latency (never the supplied text), then offline policy over readRecord + evaluatePolicy. Verified against the stub (says_nothing at 0.6 → deny exit 3). README library section rebuilt around it.

Publishing

Staged via the publish workflow (npm stage publish, provenance signed); a maintainer approves it with 2FA. Requires Node.js >= 22.0.0.