import type { ManagedOwnerSigabrtReceipt } from "./managed-owner-supervisor"; /** Immutable identity supplied by the owner-loss monitor and coordinator admission. */ export interface UltragoalRecoveryBinding { sessionId: string; endpointIncarnation: string; ownerGeneration: string; cwd: string; } export interface UltragoalOwnerLossReceipt { schema_version: 1; session_id: string; generation: string; classification: "unexpected_owner_loss"; result: "signal" | "exit" | "unknown_terminal"; observed_at: string; } export type AuthoritativeOwnerLossReceipt = UltragoalOwnerLossReceipt | ManagedOwnerSigabrtReceipt; export interface UltragoalRecoverySnapshot { /** B0 is captured once before recovery writes. P is protected and never rewritten. */ b0: { planSha256: string; ledgerSha256: string; capturedAt: string; }; protectedPaths: string[]; /** Exact sanctioned deltas, never inferred from a worktree scan. */ sanctionedDeltas: string[]; /** Durable baseline-absent artifacts. */ absentArtifacts: string[]; /** Transient paths deliberately excluded from provenance. */ transientHistory: string[]; } export type UltragoalRecoveryDisposition = "resume" | "handoff"; export interface UltragoalRecoveryDecision { disposition: UltragoalRecoveryDisposition; reason: string; snapshot?: UltragoalRecoverySnapshot; terminal?: { yieldId: string; result: Record; }; } interface TranscriptYield { type: "yield"; id: string; parentId: string | null; result: Record; } /** * Parse the complete transcript; partial rows, alternate terminal spellings, and * duplicate/conflicting yields are intentionally invalid authority. */ export declare function parseStrictTerminalTranscript(content: string): TranscriptYield | null; /** Validate a path through a retained native root descriptor; path strings alone are never authority. */ export declare function validateRecoveryPath(root: string, candidate: string): Promise; export declare function validateOwnerLossBinding(binding: UltragoalRecoveryBinding, receipt: unknown): receipt is AuthoritativeOwnerLossReceipt; /** Admission is valid only for this immutable coordinator endpoint incarnation. */ export declare function validateRecoveryAdmission(binding: UltragoalRecoveryBinding, admission: unknown): boolean; /** Raw plan and ledger evidence must be complete before their B0 hashes are trusted. */ export declare function validateRawUltragoalEvidence(plan: Uint8Array, ledger: Uint8Array): boolean; /** Build a B0 snapshot without consulting unrelated paths or mutable sidecars. */ export declare function captureUltragoalRecoverySnapshot(input: { cwd: string; sessionId: string; protectedPaths: readonly string[]; sanctionedDeltas: readonly string[]; absentArtifacts: readonly string[]; transientHistory: readonly string[]; }): Promise; /** * Decide only from direct owner evidence plus a complete terminal transcript. * All ambiguity maps to durable handoff; callers never guess a resume. */ export declare function planUltragoalOwnerLossRecovery(input: { binding: UltragoalRecoveryBinding; receipt: unknown; admission: unknown; transcriptPath: string; protectedPaths?: readonly string[]; sanctionedDeltas?: readonly string[]; absentArtifacts?: readonly string[]; transientHistory?: readonly string[]; }): Promise; /** Persist a monotonic replay journal and fail-closed handoff through sanctioned state writers. */ export declare function persistUltragoalRecoveryDecision(input: { cwd: string; sessionId: string; binding: UltragoalRecoveryBinding; decision: UltragoalRecoveryDecision; }): Promise<{ handoffPath: string; journalPath: string; }>; export {};