import type { BotConfig } from "../config/config.js"; import type { FailoverReason } from "./pi-embedded-helpers.js"; export type ModelFallbackRunOptions = { allowRateLimitCooldownProbe?: boolean; }; type ModelFallbackRunFn = (provider: string, model: string, options?: ModelFallbackRunOptions) => Promise; type FallbackAttempt = { provider: string; model: string; error: string; reason?: FailoverReason; status?: number; code?: string; }; type ModelFallbackErrorHandler = (attempt: { provider: string; model: string; error: unknown; attempt: number; total: number; }) => void | Promise; type ModelFallbackRunResult = { result: T; provider: string; model: string; attempts: FallbackAttempt[]; }; declare function resolveProbeThrottleKey(provider: string, agentDir?: string): string; /** @internal – exposed for unit tests only */ export declare const _probeThrottleInternals: { readonly lastProbeAttempt: Map; readonly MIN_PROBE_INTERVAL_MS: 30000; readonly PROBE_MARGIN_MS: number; readonly resolveProbeThrottleKey: typeof resolveProbeThrottleKey; }; export declare function runWithModelFallback(params: { cfg: BotConfig | undefined; provider: string; model: string; agentDir?: string; /** Optional explicit fallbacks list; when provided (even empty), replaces agents.defaults.model.fallbacks. */ fallbacksOverride?: string[]; run: ModelFallbackRunFn; onError?: ModelFallbackErrorHandler; }): Promise>; export declare function runWithImageModelFallback(params: { cfg: BotConfig | undefined; modelOverride?: string; run: (provider: string, model: string) => Promise; onError?: ModelFallbackErrorHandler; }): Promise>; export {};