import { Task, TaskDocument } from "../../models/task.cjs"; //#region src/services/reconcile/index.d.ts export declare const ERR_ORPHANED_BY_RESTART = "Delegation orphaned by harness restart"; export declare const ERR_ORPHANED_BY_SESSION = "Delegation orphaned by session restart"; export interface ReconcileResult { document: TaskDocument; orphaned: Task[]; } /** The delegations this process can still settle, used to spot its own leftovers. */ export interface ReconcileSelf { pid: number; liveRequestIds: ReadonlySet; } /** * Recover tasks that no longer have anyone able to finish them. * * A subagent run dies with the harness that spawned it, but the store file * outlives both, so a crash leaves tasks stuck in `in_progress` forever. Two * kinds of delegation qualify as dead: * * - the owning pid is gone, so nothing is left to report a result; * - the owning pid is *this* process, yet the request is absent from the live * set. Settling requires an in-memory record, so an in-process session * restart (which clears that map without writing to the store) leaves rows * nothing can ever resolve. Checking pid liveness alone misses these, because * the pid is our own and very much alive. * * Delegations owned by a different, still-running pid belong to a parallel * session and are left untouched. */ export declare function reconcileOrphanedDelegations(document: TaskDocument, now?: string, isAlive?: (pid: number) => boolean, self?: ReconcileSelf): ReconcileResult; //#endregion //# sourceMappingURL=index.d.cts.map