import type { ApiResult } from "../../zodfetch.js"; /** * A wall-clock budget for retrying `continue`, the call that resumes a run restored from a * checkpoint. A run whose `continue` fails is aborted, so temporary failures are retried for the * whole budget rather than for a fixed number of attempts. */ export type ContinueRetryBudget = { budgetMs: number; /** Backoff for temporary failures: jittered, doubling from `minDelayMs` up to `maxDelayMs`. */ minDelayMs?: number; maxDelayMs?: number; /** Backoff cap for a plain server error, which only gets the usual number of attempts. */ serverErrorMaxDelayMs?: number; /** * Don't start another attempt with less than this left. It would be cut off here, but the * request it sent would keep running on the server. */ minAttemptBudgetMs?: number; }; /** What the retry loop did, for logs and metrics. */ export type ContinueRetrySummary = { attempts: number; elapsedMs: number; outcome: "succeeded" | "non_retryable" | "server_errors" | "budget_exhausted"; }; export declare function retryContinueWithinBudget(attempt: (signal: AbortSignal) => Promise>, { budgetMs, minDelayMs, maxDelayMs, serverErrorMaxDelayMs, minAttemptBudgetMs, }: ContinueRetryBudget): Promise & { retry: ContinueRetrySummary; }>;