import type { DispatchRecord } from '../../services/dispatch/dispatch-record-writer.js'; import type { FinalizeSelection } from './finalize-selection.js'; interface FinalizedEntry { recordPath: string; requestId: string; status: string; } interface SkippedEntry { recordPath: string; reason: string; } interface FailedEntry { recordPath: string; error: string; } /** The sweep's three counters, threaded explicitly instead of closed over. */ export interface FinalizeAccumulator { readonly finalized: FinalizedEntry[]; readonly skipped: SkippedEntry[]; readonly errors: FailedEntry[]; } export interface MappedOutcome { readonly status: 'done' | 'failed' | 'cancelled'; readonly outcome: 'success' | 'failed' | 'cancelled'; } export declare const OUTCOME_MAP: Record; export declare function makeAccumulator(): FinalizeAccumulator; /** * N2 — one unreadable record must not abort the sweep. * * Skipping `active-dispatches.json` and `batch-*.counter.json` by FILENAME * removed the two non-record files that happened to be in the directory, but a * single stale or foreign `dispatch-*.json` (an old `version`, hand-edited * JSON, a truncated write) still made `readRecord` throw from OUTSIDE any * try/catch — and the throw escaped to the action's outer handler, so * `--request-id` AND `--batch` both died with `FINALIZE_ERROR` and exit 1 * without touching a single healthy record. * * A record that cannot be read is now reported in `errors[]` and skipped; * every other record is processed as before. */ export declare function tryReadRecord(recordPath: string, readRecord: (recordPath: string) => DispatchRecord, acc: FinalizeAccumulator): DispatchRecord | null; export declare function buildFinalizeHints(acc: FinalizeAccumulator, selection: FinalizeSelection | null): string[]; export {};