#execution

34 files tagged execution.

_archivetest

Fakes

import type { AssistantBlock, BlobStore, Clock, HarnessDeps, MemorySink, ModelClient, ModelRequest, ModelTurn, ToolD…

TS157 lines6,003 bytes
_archivetest

Monitors.Test

import { describe, expect, test } from "bun:test"; import { ConfMonitor, extractConf } from "../../src/execution/conf-mo…

TS96 lines4,032 bytes
_archivetest

Harness.Test

import { describe, expect, test } from "bun:test"; import { runDispatch } from "../../src/execution/harness"; import { m…

TS165 lines8,465 bytes
_archivetest

Gates.Test

import { describe, expect, test } from "bun:test"; import { AckGate } from "../../src/execution/ack-gate"; import { Loop…

TS103 lines4,287 bytes
_archivesource

Loop Detector

/** * H3.2 — Action-hash loop detector (P5). * sha256(tool + canonicalJSON(args)) over a sliding window of W steps; *…

TS23 lines687 bytes
_archivesource

Preflight

/** * H3.7 — Self-consistency preflight (P5). * Before recoverable|destructive actions: the staged change (the tool ar…

TS47 lines1,936 bytes
_archivesource

Ports

import type { ExecutionTraceEvent, MemoryRecord, MonitorName } from "../types/contracts"; /** * Hexagonal ports for th…

TS88 lines3,268 bytes
_archivesource

Index

export * from "./ports"; export * from "./harness"; export * from "./ack-gate"; export * from "./loop-detector"; export …

TS12 lines341 bytes
_archivesource

Anthropic Client

import { withRetry } from "../lib/retry"; import { LoomError } from "../types/errors"; import type { AssistantBlock, Mod…

TS92 lines3,295 bytes
_archivesource

Budget Governor

import type { StageBudget } from "../types/contracts"; import type { Clock } from "./ports"; /** * H3.6 — Budget gover…

TS57 lines1,685 bytes
_archivesource

Conf Monitor

/** * H3.5 — Confidence EWMA monitor (P5). * Each assistant turn must carry <conf>0.NN</conf>. EWMA(alpha=0.4) below …

TS40 lines1,274 bytes
_archivesource

Reinjector

import { sha256Hex } from "../lib/ids"; import type { BlobStore, ToolOutcome } from "./ports"; /** * H3.4 — Structured…

TS57 lines2,135 bytes
_archivesource

Reversibility Gate

import { verifyApprovalToken } from "../lib/hmac"; import type { AllowedTool, Reversibility } from "../types/contracts";…

TS51 lines1,860 bytes
_archivesource

Ack Gate

/** * H3.1 — Observation acknowledgment gate (P1 feedback closure). * After tool results are re-injected, the NEXT ass…

TS55 lines2,076 bytes
_archivesource

Adapters

import { drizzle } from "drizzle-orm/d1"; import { memoryRecords, traceEvents } from "../db/schema"; import { withRetry …

TS118 lines4,160 bytes
_archivesource

Harness

import { actionHash, canonicalJSON, newEventId, newMemoryId } from "../lib/ids"; import { parseContract } from "../lib/v…

TS304 lines14,667 bytes
loom-sprint-scaffoldtest

Budget Governor.Test

/** * Tests for budget-governor (H3.6). * * Proves: * - all 3 hard cap types (calls, tokens, wallclock) are enforced…

TS190 lines6,388 bytes
loom-sprint-scaffoldtest

Reinjector.Test

/** * Tests for reinjector (H3.4). * * Proves: * - normalizeObservation truncates content exceeding obs_cap_tokens …

TS167 lines5,612 bytes
loom-sprint-scaffoldtest

Model Client.Test

/** * Tests for model-client (H3.0). * * Proves: * - createAnthropicModelCaller returns a callable ModelCaller * - …

TS349 lines10,934 bytes
loom-sprint-scaffoldtest

Reversibility Gate.Test

/** * Tests for reversibility-gate (H3.3). * * Proves: * - allowlist lookup accepts allowed tools and denies unknown…

TS203 lines6,855 bytes
loom-sprint-scaffoldtest

Conf Monitor.Test

/** * Tests for conf-monitor (H3.5). * * Proves: * - extractConf finds trailing JSON line `{"conf": 0.8}` in assista…

TS159 lines5,452 bytes
loom-sprint-scaffoldtest

Harness.Test

/** * Integration tests for harness (runStage). * * Proves every StageTermination kind is reachable: * DONE | GATE_R…

TS612 lines20,705 bytes
loom-sprint-scaffoldtest

Preflight.Test

/** * Tests for preflight (H3.7). * * Proves: * - clean files (no markers) pass * - every marker (TODO, FIXME, <<<<…

TS133 lines4,732 bytes
loom-sprint-scaffoldtest

Ack Gate.Test

/** * Tests for ack-gate (H3.1). * * Proves: * - wrapResult produces deterministic hex hash from tool result * - ch…

TS162 lines5,577 bytes
loom-sprint-scaffoldtest

Loop Detector.Test

/** * Tests for loop-detector (H3.2). * * Proves: * - the identical action halts at exactly the 3rd occurrence (not …

TS152 lines5,256 bytes
loom-sprint-scaffoldsource

Loop Detector

/** * H3.2 — Loop Detector: actionHash(tool, args) via src/lib/ids.ts; * ring buffer W=10; ≥3 identical in window → HA…

TS96 lines2,531 bytes
loom-sprint-scaffoldsource

Preflight

/** * H3.7 — Preflight: before any recoverable|destructive action, scan a provided * list of staged file contents for …

TS84 lines2,426 bytes
loom-sprint-scaffoldsource

Budget Governor

/** * H3.6 — Budget Governor: hard caps B_tokens / B_calls / B_wallclock_ms from * the envelope. Breach → graceful sus…

TS142 lines3,640 bytes
loom-sprint-scaffoldsource

Conf Monitor

/** * H3.5 — Confidence Monitor: every assistant turn must include conf ∈ [0,1] * (schema-enforced; extract from a tra…

TS108 lines3,011 bytes
loom-sprint-scaffoldsource

Reinjector

/** * H3.4 — Reinjector: normalize observations. Truncate to per-tool obs_cap_tokens * from the envelope; store full t…

TS98 lines2,802 bytes