Budget Governor
Path:
loom-sprint-scaffold/loom/src/execution/budget-governor.tsRelative: loom/src/execution/budget-governor.tsSubproject: loom-sprint-scaffoldCategory: otherLines: 142Bytes: 3,640Imports: 3Exports: 7
Content Preview
- /**
- * H3.6 — Budget Governor: hard caps B_tokens / B_calls / B_wallclock_ms from
- * the envelope. Breach → graceful suspension: emit a state-summary MemoryRecord
- * (scope=execution, validated against memory-record contract) then stop.
- * Never kill mid-action — check BEFORE model calls and AFTER tool execution.
- */
- import { newMemoryId, newEventId } from "../lib/ids";
- import { createLogger } from "../lib/logger";
- import type {
- DispatchEnvelope,
- ExecutionTraceEvent,
- MemoryRecord,
- Sha25