Reversibility Gate

loom-sprint-scaffoldsourcetypescript
Path: loom-sprint-scaffold/loom/src/execution/reversibility-gate.tsRelative: loom/src/execution/reversibility-gate.tsSubproject: loom-sprint-scaffoldCategory: other
Lines: 136Bytes: 3,886Imports: 3Exports: 3

Content Preview

  1. /**
  2. * H3.3 — Reversibility Gate: every tool call checked against the envelope
  3. * allowlist. Each allowlist entry has reversibility ∈ read|recoverable|destructive.
  4. * Destructive requires a valid HMAC approval token (verified with WebCrypto
  5. * crypto.subtle, NOT node:crypto — workerd).
  6. *
  7. * Deny → trace event kind=token_denied; never throw past the trace.
  8. */
  9. import { canonicalJSON, newEventId } from "../lib/ids";
  10. import { createLogger } from "../lib/logger";
  11. import type {
  12. DispatchEnvelope,