/** * Crash-recovery journal for live interactive sessions. * * Interactive sessions are never reattachable: this file exists only so a crash * cannot leave an orphaned process tree behind. It therefore stores cleanup * evidence and nothing else — no command, cwd, input, environment, or output. */ import { type ProcessIdentityComparison } from "../os/process-identity.js"; import { type TreeSignalOutcome } from "../os/process-tree.js"; export interface JournalRecord { readonly id: string; readonly ownerHash: string; readonly pid: number | undefined; readonly processGroupId: number | undefined; readonly identity: string | undefined; readonly platform: NodeJS.Platform; readonly startedAt: number; readonly artifactPath: string; readonly launchConfirmed: boolean; } export type ReconciliationOutcome = "terminated" | "gone" | "identity-mismatch" | "unverified" | "launch-failed"; export interface ReconciliationEntry { readonly id: string; readonly outcome: ReconciliationOutcome; } export declare function hashOwner(ownerId: string): string; export interface RecoveryJournalProcessDeps { readonly compareIdentity: (pid: number | undefined, identity: string | undefined) => ProcessIdentityComparison; readonly terminateTree: (pid: number, options: { signal: NodeJS.Signals; processGroupId?: number | undefined; }) => TreeSignalOutcome; } export declare class RecoveryJournal { private readonly directory; private readonly path; private readonly process; private readonly sharedDirectory; private readonly manager; private records; constructor(directory?: string, processDeps?: Partial); upsert(record: JournalRecord): void; upsertDurable(record: JournalRecord): boolean; remove(id: string): void; load(): JournalRecord[]; reconcile(): ReconciliationEntry[]; private reconciliationPaths; private readPersisted; private reconcileOne; private persist; private writePersisted; clear(): void; }