/**
 * sinks/retry.ts
 *
 * Simple retry utility with exponential backoff for sink and notification
 * operations. Used by the sink runner and the notification service to retry
 * transient failures (network timeouts, HTTP 429/5xx) without requiring each
 * delivery path to implement retry logic internally.
 *
 * Policy: 3 retries, exponential backoff (1s → 2s → 4s).
 *
 * `withRetryResult` is the generic core: it retries any result type while a
 * caller-supplied `isFailed` predicate holds. `withRetry` is the sink-specific
 * wrapper (kept for its existing positional signature). The notification
 * service uses `withRetryResult` directly with `DeliveryOutcome`, which has the
 * same `failed` shape but reports success as `delivered` rather than `success`.
 *
 * @see docs/design-docs/report-store/sink-architecture.md
 */
import type { SinkResult } from "../pipeline/types.js";
/** Tuning + adaptation for `withRetryResult`. */
export interface RetryOptions<R> {
    /** Whether a result is a (retryable) failure. Non-failures are terminal. */
    isFailed: (result: R) => boolean;
    /** Convert a thrown exception into a failure result of the same shape. */
    onThrow: (error: unknown) => R;
    /** Maximum retries after the first attempt (default 3). */
    maxRetries?: number;
    /** Initial backoff in ms; doubles each attempt (default 1000). */
    baseDelayMs?: number;
}
/**
 * Retry an operation with exponential backoff, generic over the result shape.
 *
 * Only retries while `isFailed(result)` is true — any other status (success,
 * skipped, delivered) is terminal and returned immediately. Thrown exceptions
 * are caught and converted to a failure via `onThrow`, then subject to the same
 * retry policy. Returns the final result; never throws.
 */
export declare function withRetryResult<R>(fn: () => Promise<R>, options: RetryOptions<R>): Promise<R>;
/**
 * Retry a sink publish operation with exponential backoff.
 *
 * Only retries on "failed" results — "success" and "skipped" are returned
 * immediately. Thrown exceptions are caught and converted to "failed" results.
 *
 * @param fn - The publish function to retry
 * @param maxRetries - Maximum number of retry attempts (default: 3)
 * @param baseDelayMs - Initial delay in milliseconds (default: 1000)
 * @returns The final SinkResult after all attempts
 */
export declare function withRetry(fn: () => Promise<SinkResult>, maxRetries?: number, baseDelayMs?: number): Promise<SinkResult>;
