import { type NimiError } from '../types/index.js';
import type { RuntimeClient, RuntimeConnectionState, RuntimeOptions } from './types.js';
import type { RuntimeCallOptionsInternal, RuntimeStreamCallOptionsInternal } from './types-internal.js';
export declare function resolveRetryConfig(options: RuntimeOptions): {
    maxAttempts: number;
    backoffMs: number;
};
export declare function resolveReadyTimeout(options: RuntimeOptions, timeoutMs?: number): number;
export declare function waitForRuntimeReady(input: {
    stateStatus: RuntimeConnectionState['status'];
    connectPromise: Promise<void> | null;
    connect: () => Promise<void>;
    timeoutMs: number;
}): Promise<void>;
export declare function ensureRuntimeClientForCall(input: {
    options: RuntimeOptions;
    stateStatus: RuntimeConnectionState['status'];
    client: RuntimeClient | null;
    waitForReady: (timeoutMs: number) => Promise<void>;
    getClient: () => RuntimeClient | null;
}): Promise<RuntimeClient>;
export declare function invokeWithRuntimeRetry<T>(input: {
    operation: () => Promise<T>;
    options: RuntimeOptions;
    normalizeError: (error: unknown) => NimiError;
    onRecovered: (attempt: number) => void;
    onRetry: (error: NimiError, attempt: number, backoffMs: number, maxAttempts: number) => void;
    onTerminalError: (error: NimiError) => void;
}): Promise<T>;
export declare function computeRetryBackoffMs(baseBackoffMs: number, attempt: number): number;
export declare function shouldRetryRuntimeCall(error: NimiError, attempt: number, maxAttempts: number): boolean;
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, fallback: {
    reasonCode: string;
    actionHint: string;
    source: 'sdk' | 'runtime' | 'realm';
}): Promise<T>;
export declare function resolveRuntimeCallOptions(options: RuntimeOptions, input: {
    timeoutMs?: number;
    metadata?: Record<string, string>;
    idempotencyKey?: string;
    _responseMetadataObserver?: (metadata: Record<string, string>) => void;
}): RuntimeCallOptionsInternal;
export declare function resolveRuntimeStreamOptions(options: RuntimeOptions, input: {
    timeoutMs?: number;
    metadata?: Record<string, string>;
    idempotencyKey?: string;
    signal?: AbortSignal;
}): RuntimeStreamCallOptionsInternal;
//# sourceMappingURL=runtime-infra.d.ts.map