import { type CodeIdentity } from "./codeIdentity.js"; import type { RunDirectoryPaths, RunDirectorySnapshot } from "./runDir.js"; import type { Trace } from "./traces.js"; /** * Attaching agent code to a run directory, stored directly under `code/` (a * run directory holds one run, so one code version). The plan is pure: it * hashes the closure it is given and checks that the directory's trace * recorded that hash on its `agentStart`. A mismatch is refused, not warned — optimizing the wrong * program would be silent otherwise. */ export declare class CodeMismatchError extends Error { } export type CodeAttachmentPlan = { identity: CodeIdentity; /** Absolute base directory the closure's relative paths hang off. */ baseDir: string; status: "add" | "already-present"; }; /** The closure hashes the directory's traces recorded, deduplicated. */ export declare function recordedClosureHashes(traces: readonly Trace[]): string[]; export declare function planCodeAttachment(snapshot: RunDirectorySnapshot, entryFile: string, paths: RunDirectoryPaths): CodeAttachmentPlan; /** @internal Copies the closure into `code/`. Caller holds the lock. */ export declare function applyCodeAttachment(paths: RunDirectoryPaths, plan: CodeAttachmentPlan): void;