import type { Result } from '@private.me/shared';
import type { XailTransportAdapter, TransportError, EnvelopeHandler } from './transport.js';
import type { AnyTransportEnvelope } from './envelope.js';
/**
 * Configuration options for exponential backoff retry logic.
 */
export interface RetryOptions {
    /** Maximum number of retry attempts. Default: 3. */
    maxRetries?: number;
    /** Base delay in milliseconds for exponential backoff. Default: 1000. */
    baseDelayMs?: number;
    /** Maximum jitter in milliseconds for randomization. Default: 200. */
    maxJitterMs?: number;
}
/**
 * Decorator that adds exponential backoff retry logic to any transport adapter.
 *
 * Retry delays follow exponential backoff with jitter:
 * - Formula: 2^attempt * baseDelay + jitter
 * - Jitter: Math.random() * maxJitter * 2 - maxJitter
 * - Default delays: 1s, 2s, 4s (with ±200ms jitter)
 *
 * Use case: Push notification delivery failures requiring automatic retry.
 *
 * @example
 * ```typescript
 * const transport = new RetryTransportAdapter(baseTransport, {
 *   maxRetries: 3,
 *   baseDelayMs: 1000,
 *   maxJitterMs: 200
 * });
 * ```
 */
export declare class RetryTransportAdapter implements XailTransportAdapter {
    private readonly inner;
    private readonly maxRetries;
    private readonly baseDelayMs;
    private readonly maxJitterMs;
    /**
     * Create a new RetryTransportAdapter wrapping an existing transport.
     *
     * @param inner - The transport adapter to wrap with retry logic
     * @param options - Retry configuration options
     */
    constructor(inner: XailTransportAdapter, options?: RetryOptions);
    /**
     * Send an envelope with exponential backoff retry logic.
     *
     * Retries on all error types (SEND_FAILED, NETWORK_ERROR, RECIPIENT_UNREACHABLE, TIMEOUT).
     * Throws error after all retries are exhausted.
     *
     * @param envelope - The envelope to send
     * @param recipientDid - The recipient's DID
     * @returns Result with void on success, or TransportError on failure
     * @throws Error if all retry attempts are exhausted
     */
    send(envelope: AnyTransportEnvelope, recipientDid: string): Promise<Result<void, TransportError>>;
    /**
     * Register a handler for incoming envelopes.
     * Delegates directly to the inner transport.
     *
     * @param handler - The envelope handler function
     */
    onReceive(handler: EnvelopeHandler): void;
    /**
     * Shut down the transport.
     * Delegates directly to the inner transport.
     */
    dispose(): void;
    /**
     * Sleep for a specified duration.
     *
     * @param ms - Duration in milliseconds
     */
    private sleep;
}
