import type { LanguageModel } from "ai"; import type { Modality, ProviderEntry } from "./types.js"; export interface NormalizedEntry { adaptiveConcurrency?: boolean | import("./types.js").AdaptiveConcurrencyConfig; healthKey?: string; /** Model id for the fail-fast error message (factory form only). */ label?: string; maxConcurrency?: number; /** The user's original entry — surfaced verbatim on `onError`. */ original: ProviderEntry; providerFamily?: string; /** Produce the raw model (calls the factory, or returns the captured instance). */ raw: () => LanguageModel; /** Declared modalities, or `undefined` for a universal (catch-all) candidate. */ supports?: Modality[]; } export declare function assertSynchronousEntryFields(values: readonly unknown[]): void; /** Collapse any of the three `ProviderEntry` shapes into a {@link NormalizedEntry}. */ export declare function normalizeEntry(entry: ProviderEntry): NormalizedEntry; /** * A delegating `LanguageModelV4` for one logical id. * * For every request it: * 1. Detects the input modalities from the prompt. * 2. Keeps the candidate entries whose `supports` covers them, in order. * 3. Tries each candidate; on failure it classifies the error (retry vs stop), * calls `onError`, and falls through to the next one when retryable. * 4. On `doStream`, wraps the live stream so a mid-stream failure also falls * back transparently (before any content has been emitted). * 5. Surfaces the original error for a single failure, or an `AggregateError` * of all candidate errors when several fail. * * It forwards an attempt-isolated copy of the V4 call options so one provider * cannot mutate the prompt or policy observed by later fallback candidates. */