import type { BackgroundJobStore, ContextFile } from '../../utils'; import type { RevivedRunTracker } from './revived-run-tracker'; import type { StopEvidenceGate } from './stop-confirmation'; export declare function createIdleReconciler(options: { backgroundJobBoard: BackgroundJobStore; reconcileInjectedTerminalJobs: (parentSessionID: string) => void; /** Called when a deferred inline error is terminalized at idle. */ onErrorTerminalize?: (sessionID: string) => void; idleReconcileDelayMs: number; stopConfirmationGraceMs?: number; /** Deadline for the tracker-probe and outcome-probe awaits on the * quiescent path: a hung read must not park the stop confirmation * indefinitely. */ evidenceReadTimeoutMs?: number; isFallbackInProgress?: (sessionID: string) => boolean; hasInputWait: (sessionID: string) => boolean; getIdleSessionToken: (sessionID: string) => symbol; isCurrentIdleSessionToken: (sessionID: string, sessionToken: symbol) => boolean; taskContextTracker: { pendingManagedTaskIds: Set; contextFilesForPrompt(taskId: string): ContextFile[]; prune(board: { taskIDs(): Set; }): void; }; revivedRunTracker?: RevivedRunTracker; /** Host-native terminal outcome probe (v2 Session.Info.outcome via * session.get). Quiescent jobs settle to the accurate terminal state * instead of lingering 'running + statusUncertain' on hosts without a * live session-status map. Return undefined when unavailable. */ readSessionOutcome?: (sessionID: string) => Promise<{ outcome?: string; resultText?: string; } | undefined>; /** Stabilization retries for a succeeded-but-textless outcome. */ outcomeStabilization?: { probes: number; intervalMs: number; }; /** Transcript-backed stop gate: consulted before publishing `stopped` * so a quiescent job whose transcript already holds the terminal * result settles completed/error instead (false-stop incident). */ stopEvidenceGate?: StopEvidenceGate; }): { scheduleIdleReconciliation: (parentSessionID: string) => void; scheduleChildIdleReconciliation: (sessionID: string, idleObservedAt: number, observedGeneration: number) => void; scheduleErrorTerminalize: (sessionID: string, idleObservedAt: number, observedGeneration: number) => void; clearIdleTimers: (sessionID: string) => void; clearAllTimers: () => string[]; /** Callback for idle-session-tokens invalidate. */ onInvalidateIdle: (sessionID: string) => void; };