/** * Read a dispatch record's `status` and `outcome` off disk. Missing or * unreadable (including unparseable JSON) reads as `{ null, null }`, which is * what keeps a corrupt record a timeout rather than a thrown error. */ export declare function defaultReadOutcome(recordPath: string): { status: string | null; outcome: string | null; }; /** One slot's mutable state — the value type of `awaitBatch`'s slot map. */ export interface AwaitBatchSlot { recordPath: string; status: 'done' | 'failed' | 'cancelled' | 'timeout'; note: string | null; finishedAt: number | null; lastProgress: number; } /** The slot table plus the batch start time the watchdog and the notes read. */ export interface AwaitBatchSlotTable { readonly startedAt: number; readonly slots: Map; readonly lastProgressAt: Map; } /** One per-dispatch result — the element type of `AwaitBatchResult.results`. */ export interface AwaitBatchSlotResult { readonly dispatchIndex: number; readonly recordPath: string; readonly status: 'done' | 'failed' | 'cancelled' | 'timeout'; readonly durationMs: number; readonly note: string | null; } /** * Seed one slot per record path, all of them `timeout` until a tick proves * otherwise, plus the progress map the no-progress watchdog runs off. */ export declare function createSlotTable(recordPaths: readonly string[], startedAt: number): AwaitBatchSlotTable; /** * One observation pass over the pending slots. Returns the `allDone` the loop * branched on: `true` only when every slot reached a terminal state. */ export declare function pollSlotsOnce(table: AwaitBatchSlotTable, readOutcome: (recordPath: string) => string | null, readRecord: (recordPath: string) => { status: string | null; outcome: string | null; }, now: () => number): boolean; /** * No-progress watchdog: every slot has been without observable * progress for `noProgressBudget`, and there is at least one slot. */ export declare function hasNoProgress(table: AwaitBatchSlotTable, now: () => number, noProgressBudget: number): boolean; /** Sleep a tick on the resolved scheduler. */ export declare function sleepTick(schedule: (cb: () => void, ms: number) => void): Promise; /** * Build the per-dispatch results in dispatchIndex order. */ export declare function buildBatchResults(table: AwaitBatchSlotTable, notePrefix: string | undefined, effectiveTimeoutMs: number): readonly AwaitBatchSlotResult[];