import { type GitDelta, type ReceiptFamily, type RecoveryClassification, type ReviewVerdict } from "./types"; export interface ReceiptSubject { workspace: string; branch: string | null; head: string | null; commit: string | null; } export interface ReceiptEnvelope> { receiptId: string; schemaVersion: number; sessionId: string; family: ReceiptFamily; valid: boolean; createdAt: string; source: string; subject: ReceiptSubject; evidence: E; /** Hashes of out-of-line artifacts (diff patches, validation logs) folded into the receipt hash. */ artifactHashes: Record; sha256: string; } export declare const RECEIPT_SCHEMA_VERSION: 1; /** Deterministic stringify with sorted keys (stable hash basis). */ export declare function canonicalJson(value: unknown): string; export declare function sha256Hex(input: string): string; export interface BuildReceiptInput { receiptId: string; sessionId: string; family: ReceiptFamily; source: string; subject: ReceiptSubject; evidence: E; artifactHashes?: Record; createdAt?: string; valid?: boolean; } export declare function buildReceipt(input: BuildReceiptInput): ReceiptEnvelope; export interface ValidationOutcome { valid: boolean; reasons: string[]; } /** Recompute the hash and run structural family checks. Fail-closed. */ export declare function validateReceipt(receipt: ReceiptEnvelope): ValidationOutcome; export interface VanishEvidence { classification: RecoveryClassification; gitDelta: GitDelta; gitStatusPorcelain: string; untrackedManifest: { path: string; size: number; sha256: string; }[]; preservation: "snapshot" | "stash" | "block"; stashRef: string | null; snapshotComplete: boolean; forbiddenActions: string[]; } export interface PromptAcceptanceEvidence { promptSha256: string; preSubmitState: { isStreaming: boolean; steeringQueueDepth: number; followupQueueDepth: number; }; preSubmitCursor: number; agentStartCursor: number; acceptedAt: string; singleFlight: true; } export interface ValidationEvidence { command: string; exactCommand: string; cwd: string; exitStatus: number; pass: boolean; commitUnderTest: string | null; } export interface CompletionEvidence { finalCommit: string; branch: string; prUrl: string | null; issueArtifact: string | null; requiredValidationReceiptIds: string[]; finalLifecycle: string; finalizedAt: string; blockers: string[]; } export interface ReviewVerdictEvidence { verdict: ReviewVerdict; prTarget: string | null; finalizedAt: string; /** Bounded summary code/reference for the verdict; never raw assistant text. */ summaryRef: string | null; /** Where the verdict came from: explicit operator input or extracted from final assistant text. */ verdictSource?: "input" | "assistant"; /** sha256 of the assistant text the verdict was extracted from, when sourced from the agent. */ assistantDigest?: string | null; } export interface ReviewFailureEvidence { /** Machine-actionable reason the review produced no terminal verdict. */ reason: string; prTarget: string | null; failedAt: string; /** Routing hint for the operator/fallback path. */ fallback: string; /** sha256 of the assistant text examined for a verdict, when one was available. */ assistantDigest?: string | null; /** Bounded, whitespace-collapsed assistant summary (never an unbounded transcript dump). */ assistantSummary?: string | null; } /** Pointer back to one superseded child task receipt. */ export interface PhaseRollupChildPointer { id: string; status: "completed" | "failed" | "aborted" | "merge_failed" | "paused"; /** Artifact URI holding the child's full output, when available. */ outputUri: string | null; /** Content hash of the child's output artifact, when available. */ outputSha256: string | null; /** Hash of the child receipt itself (canonical JSON), for staleness checks. */ receiptSha256: string; /** * Per-child ROI accounting carried into the rollup so the aggregate totals * below are recomputable/verifiable from child evidence (not self-reported). * `tokens` is the child's effective token count; cost/cloned are null when * the child reported no such accounting. */ tokens: number; costTotal: number | null; clonedTokens: number | null; lowRoi: boolean; } export interface PhaseRollupEvidence { /** Harness lifecycle boundary this rollup was emitted at. */ phase: string; children: PhaseRollupChildPointer[]; aggregate: { childCount: number; completed: number; failed: number; totalTokens: number; totalCostTotal: number | null; totalClonedTokens: number | null; lowRoiChildIds: string[]; }; } export declare function validatePhaseRollup(e: PhaseRollupEvidence): string[]; /** Classifications that MUST have a valid `vanish` receipt before the action proceeds. */ export declare function requiresVanishBeforeAction(classification: RecoveryClassification): boolean;