/** * Context Handoff Store — A-CTX-2 persistence layer. * * Produces, writes, and reads ContextHandoffReceipt files so that * downstream processes can verify them without rerunning the upstream agent. * * Storage layout (under runsRoot//): * context-handoff.json — the receipt produced by this run for the next hop * * The producerReceiptHash is computed as SHA-256 of the receipt-integrity.json * file written by writeLoopRecord. If that file is absent, upstreamIntegrity is * set to "evidence_boundary" — the receipt is still written but will not pass * verifyContextHandoff. */ import type { ContextHandoffArtifact, ContextHandoffClaim, ContextHandoffReceipt } from "../../contracts/index.js"; /** Compute the SHA-256 hex digest of a file's raw bytes. */ export declare function computeFileHash(filePath: string): Promise; export declare function contextHandoffPath(runsRoot: string, runId: string): string; /** * Persist a ContextHandoffReceipt for this run so the next hop can load it. * Overwrites any existing file — callers must not call this more than once per run. */ export declare function writeContextHandoff(runsRoot: string, runId: string, receipt: ContextHandoffReceipt): Promise; /** * Load a ContextHandoffReceipt from a previous run. * Returns null when the file does not exist (not an error — the consumer * must treat absence as a hard gate failure). */ export declare function readContextHandoff(runsRoot: string, runId: string): Promise; export interface BuildHandoffReceiptInput { runsRoot: string; /** Run that is producing this handoff (the upstream/producer run). */ producerRunId: string; /** Stable identifier for the chain. Shared across all hops. */ chainId: string; /** Optional mission identifier shared across hops. */ missionId?: string; /** Unique ID for this specific handoff crossing. Generated if absent. */ handoffId?: string; /** Verified claims the producer is asserting. All must be state "verified". */ claims?: ContextHandoffClaim[]; /** * File paths whose SHA-256 hashes should be captured as artifacts. * Each file is hashed at call time — callers must call after writing artifacts. */ artifactFiles?: Array<{ filePath: string; label?: string; required: boolean; }>; /** Optional pre-computed artifacts (bypasses file hashing). */ artifacts?: ContextHandoffArtifact[]; /** Assumptions that are not yet resolved at handoff time. */ unresolvedAssumptions?: string[]; /** Parent handoff IDs for multi-hop lineage. */ parentHandoffIds?: string[]; /** Clock override (defaults to new Date().toISOString()). */ now?: () => string; } /** * Build a ContextHandoffReceipt from a completed run. * * - producerReceiptHash is SHA-256 of the receipt-integrity.json file * written by writeLoopRecord. If that file is absent, upstreamIntegrity * is "evidence_boundary". * - Artifact hashes are computed from real files at call time. */ export declare function buildContextHandoffReceipt(input: BuildHandoffReceiptInput): Promise;