/** * Retry a delivery until it lands (or the target is gone). * * The reload continue-nudge (server.ts `continueAfterReload`) is delivered the * moment `restartSession` resolves. But a `--resume` can still be finishing its * own resume turn (the session reads BUSY), or the freshly respawned TUI is not * yet accepting a paste — and a SINGLE refused delivery left the agent idle * forever, with nothing to try again. That was the bug: an agent reloaded fine, * then nothing happened. * * So the delivery retries, backing off, until it succeeds or the session no * longer exists. Kept here — pure, with `deliver` / `alive` / `sleep` injected — * so the retry policy is unit-tested without a server or a real TUI. */ export interface DeliverResult { ok: boolean; reason?: string; } export interface RetryOptions { /** Total attempts before giving up. */ attempts?: number; /** Which refusals may be replayed. Defaults to the cron's own rule. */ retryable?: (reason: string | undefined) => boolean; /** Delay between attempts (ms). */ delayMs?: number; sleep?: (ms: number) => Promise; } export declare function deliverWithRetry(deliver: () => Promise, alive: () => boolean, { attempts, delayMs, sleep, retryable }?: RetryOptions): Promise;