Ack Gate

loom-sprint-scaffoldsourcetypescript
Path: loom-sprint-scaffold/loom/src/execution/ack-gate.tsRelative: loom/src/execution/ack-gate.tsSubproject: loom-sprint-scaffoldCategory: other
Lines: 94Bytes: 2,810Imports: 3Exports: 4

Content Preview

  1. /**
  2. * H3.1 — Ack Gate: wrap every tool result with obs_hash; enforce that the
  3. * NEXT assistant turn begins with `<ack obs="HASH">...</ack>`.
  4. *
  5. * Non-conforming turn → one corrective retry (system note naming the violation),
  6. * then emit trace event kind=gate_reject and count a step failure.
  7. */
  8. import { sha256Hex, newEventId } from "../lib/ids";
  9. import { createLogger } from "../lib/logger";
  10. import type {
  11. AckExpectation,
  12. ExecutionTraceEvent,
  13. Sha256Hex,
  14. ToolResultEntry,
  15. } from "../typ