/** * Boot-time run crash-resume (crew#830) — the run-level twin of `campaign/boot-resume.ts`. * * A daemon that dies mid-run leaves the run persisted `executing`: its worker was in the dead * process, and the engine's in-process path claims no cross-restart durability, so on the next * boot it does NOT redrive the run. It does say so: actor bootstrap emits a `runOrphaned` frame * into the run's durable event log for every `executing` session it restored no worker for * (core#124, `report_orphaned_executing_sessions`), naming `POST /runs/:id/resume` as the remedy. * Observed live (rig, 2026-10-06): the frame was written, the run stayed `executing` with no * process behind it, and nothing moved it until an operator POSTed the resume by hand — which * re-entered the cursor unit within seconds. The engine's resume path is sound; nobody called it. * * So at boot the daemon calls it, once, for every run whose trail ENDS on `runOrphaned`. The * tail-of-trail read is what separates a zombie from a live run: a session the armed exec path * redrove keeps `executing` too, but its trail continues past any orphan frame (a fresh * `unitDispatched`), and a run the operator cancelled between the crash and the boot is no longer * `executing` at all. A refused resume is logged and reported, never thrown — boot must finish. * * Ordering: the engine's orphan scan runs on actor bootstrap, BEFORE the actor answers its first * command, so by the time `sessionsDetail()` resolves every orphan frame the engine will write for * this boot is already in the log. No wait, no race. */ import type { Actor, RecordedEvent, SessionView } from './types.js'; /** The frame the engine writes for a run it left `executing` without a worker (core#124). */ export declare const RUN_ORPHANED_EVENT = "runOrphaned"; /** The three engine calls the sweep needs (the real `CoreAdapter` has all of them). */ export interface RunResumeSurface { sessionsDetail(): Promise; /** `null` = the binding lacks the capability (the `runEvents` doctrine) — nothing is resumed. */ runEvents(runId: string): Promise; resumeRun(runId: string): Promise; } /** The trail writer the sweep records `run.resumed {via: 'boot'}` through (an `AuditLog`). */ export interface RunResumeAudit { record(action: string, actor: Actor, fields?: { runId?: string; detail?: Record; }): number; } export interface BootRunResumeResult { /** Runs the engine was asked to resume, with the unit ord the orphan frame named and the status token it answered. */ resumed: Array<{ id: string; ord: number | undefined; status: string; }>; /** Runs whose resume the engine refused, with the reason. */ failed: Array<{ id: string; error: string; }>; } /** Ask the engine to resume every run it marked `runOrphaned` and still calls `executing`. Never throws. */ export declare function resumeOrphanedRuns(adapter: RunResumeSurface, audit: RunResumeAudit, actor: Actor, log: (message: string) => void): Promise; //# sourceMappingURL=run-boot-resume.d.ts.map