export declare function executeBoundedRetryLoop<TResult>(params: {
    maxIterations: number;
    onRetryLimit: (params: {
        iterations: number;
        maxIterations: number;
    }) => Promise<TResult> | TResult;
    executeIteration: (params: {
        iteration: number;
    }) => Promise<{
        kind: "continue";
    } | {
        kind: "return";
        result: TResult;
    }>;
}): Promise<TResult>;
export declare function resolveScaledRetryIterations(params: {
    candidateCount: number;
    baseIterations?: number;
    perCandidateIterations?: number;
    minIterations?: number;
    maxIterations?: number;
}): number;
export declare function isForegroundSource(source: string | undefined): boolean;
/** Is this a transient capacity error (429 or 529/overloaded)? */
export declare function isTransientCapacityError(status: number | undefined): boolean;
/**
 * Compute exponential backoff delay with jitter.
 * CC parity: withRetry.ts — BASE_DELAY_MS=500, 2^n backoff, capped.
 */
export declare function computeRetryBackoff(attempt: number, baseDelayMs?: number, maxDelayMs?: number): number;
/**
 * Persistent retry mode — for unattended sessions.
 * Retries 429/529 indefinitely with higher backoff.
 * Yields heartbeat events periodically so the host doesn't mark us idle.
 *
 * CC parity: withRetry.ts CLAUDE_CODE_UNATTENDED_RETRY
 */
export interface PersistentRetryConfig {
    /** Max backoff interval (CC: 5 min). */
    maxBackoffMs: number;
    /** Total cap before giving up (CC: 6 hours). */
    resetCapMs: number;
    /** Heartbeat interval during waits (CC: 30 seconds). */
    heartbeatIntervalMs: number;
}
export declare const DEFAULT_PERSISTENT_RETRY_CONFIG: PersistentRetryConfig;
/**
 * Check if persistent retry is enabled via environment variable.
 * CC parity: CLAUDE_CODE_UNATTENDED_RETRY
 */
export declare function isPersistentRetryEnabled(): boolean;
/**
 * Error class for triggering model fallback after repeated 529s.
 * CC parity: FallbackTriggeredError
 */
export declare class FallbackTriggeredError extends Error {
    readonly originalModel: string;
    readonly fallbackModel: string;
    constructor(originalModel: string, fallbackModel: string);
}
/**
 * Error class for when retries are exhausted and cannot continue.
 * CC parity: CannotRetryError
 */
export declare class CannotRetryError extends Error {
    readonly originalError: unknown;
    readonly model: string;
    constructor(originalError: unknown, model: string);
}
