#execution
34 files tagged execution.
Fakes
import type { AssistantBlock, BlobStore, Clock, HarnessDeps, MemorySink, ModelClient, ModelRequest, ModelTurn, ToolD…
Monitors.Test
import { describe, expect, test } from "bun:test"; import { ConfMonitor, extractConf } from "../../src/execution/conf-mo…
Harness.Test
import { describe, expect, test } from "bun:test"; import { runDispatch } from "../../src/execution/harness"; import { m…
Gates.Test
import { describe, expect, test } from "bun:test"; import { AckGate } from "../../src/execution/ack-gate"; import { Loop…
Loop Detector
/** * H3.2 — Action-hash loop detector (P5). * sha256(tool + canonicalJSON(args)) over a sliding window of W steps; *…
Preflight
/** * H3.7 — Self-consistency preflight (P5). * Before recoverable|destructive actions: the staged change (the tool ar…
Ports
import type { ExecutionTraceEvent, MemoryRecord, MonitorName } from "../types/contracts"; /** * Hexagonal ports for th…
Index
export * from "./ports"; export * from "./harness"; export * from "./ack-gate"; export * from "./loop-detector"; export …
Anthropic Client
import { withRetry } from "../lib/retry"; import { LoomError } from "../types/errors"; import type { AssistantBlock, Mod…
Budget Governor
import type { StageBudget } from "../types/contracts"; import type { Clock } from "./ports"; /** * H3.6 — Budget gover…
Conf Monitor
/** * H3.5 — Confidence EWMA monitor (P5). * Each assistant turn must carry <conf>0.NN</conf>. EWMA(alpha=0.4) below …
Reinjector
import { sha256Hex } from "../lib/ids"; import type { BlobStore, ToolOutcome } from "./ports"; /** * H3.4 — Structured…
Reversibility Gate
import { verifyApprovalToken } from "../lib/hmac"; import type { AllowedTool, Reversibility } from "../types/contracts";…
Ack Gate
/** * H3.1 — Observation acknowledgment gate (P1 feedback closure). * After tool results are re-injected, the NEXT ass…
Adapters
import { drizzle } from "drizzle-orm/d1"; import { memoryRecords, traceEvents } from "../db/schema"; import { withRetry …
Harness
import { actionHash, canonicalJSON, newEventId, newMemoryId } from "../lib/ids"; import { parseContract } from "../lib/v…
Budget Governor.Test
/** * Tests for budget-governor (H3.6). * * Proves: * - all 3 hard cap types (calls, tokens, wallclock) are enforced…
Reinjector.Test
/** * Tests for reinjector (H3.4). * * Proves: * - normalizeObservation truncates content exceeding obs_cap_tokens …
Model Client.Test
/** * Tests for model-client (H3.0). * * Proves: * - createAnthropicModelCaller returns a callable ModelCaller * - …
Reversibility Gate.Test
/** * Tests for reversibility-gate (H3.3). * * Proves: * - allowlist lookup accepts allowed tools and denies unknown…
Conf Monitor.Test
/** * Tests for conf-monitor (H3.5). * * Proves: * - extractConf finds trailing JSON line `{"conf": 0.8}` in assista…
Harness.Test
/** * Integration tests for harness (runStage). * * Proves every StageTermination kind is reachable: * DONE | GATE_R…
Preflight.Test
/** * Tests for preflight (H3.7). * * Proves: * - clean files (no markers) pass * - every marker (TODO, FIXME, <<<<…
Ack Gate.Test
/** * Tests for ack-gate (H3.1). * * Proves: * - wrapResult produces deterministic hex hash from tool result * - ch…
Loop Detector.Test
/** * Tests for loop-detector (H3.2). * * Proves: * - the identical action halts at exactly the 3rd occurrence (not …
Loop Detector
/** * H3.2 — Loop Detector: actionHash(tool, args) via src/lib/ids.ts; * ring buffer W=10; ≥3 identical in window → HA…
Preflight
/** * H3.7 — Preflight: before any recoverable|destructive action, scan a provided * list of staged file contents for …
Budget Governor
/** * H3.6 — Budget Governor: hard caps B_tokens / B_calls / B_wallclock_ms from * the envelope. Breach → graceful sus…
Conf Monitor
/** * H3.5 — Confidence Monitor: every assistant turn must include conf ∈ [0,1] * (schema-enforced; extract from a tra…
Reinjector
/** * H3.4 — Reinjector: normalize observations. Truncate to per-tool obs_cap_tokens * from the envelope; store full t…