import type { LanguageModelV4 } from "@ai-sdk/provider"; import { AdmissionController } from "./admission.js"; import type { AdmissionRegistry } from "./admission-utils.js"; import type { RetryBudget } from "./budget.js"; import { CandidateHealthState } from "./candidate-health.js"; import { CooldownState } from "./cooldown.js"; import type { OrderingTokenSource } from "./ordering.js"; import { type NormalizedEntry } from "./router-entry.js"; import type { InvalidProviderModelError } from "./router-generate-validator.js"; import type { ResolvedEntry } from "./stream.js"; import type { ClassifyFailure, CreateRouterOptions, OnRouterAttempt, OnRouterError, ProviderEntry, RouterHealthStore, ShouldRetryThisError, ValidateGenerateResult } from "./types.js"; /** * A candidate entry normalized to a single internal shape, regardless of which * of the three accepted `ProviderEntry` forms the user wrote. */ export declare abstract class RouterModelConfig { protected abstract computeSupportedUrls(): Promise> | Record; readonly specificationVersion: "v4"; readonly provider = "router"; readonly modelId: string; protected readonly normalized: NormalizedEntry[]; protected readonly onError?: OnRouterError; protected readonly shouldRetry: ShouldRetryThisError; protected readonly retryAfterOutput: boolean; protected readonly cooldown?: CooldownState; protected readonly health: CandidateHealthState; protected readonly healthEnabled: boolean; protected readonly classifyFailure: ClassifyFailure; protected readonly hasCustomClassifier: boolean; protected readonly hasCustomRetry: boolean; protected readonly attemptTimeout?: number; protected readonly concurrencyWaitTimeout?: number; protected readonly backoff?: number; protected readonly firstContentTimeout?: number; protected readonly totalTimeout?: number; protected readonly maxAttempts: number; protected readonly onAttempt?: OnRouterAttempt; protected readonly validateResult?: ValidateGenerateResult; protected readonly strictStreamValidation: boolean; protected readonly retryBudget?: RetryBudget; protected readonly admission: AdmissionController; protected readonly ordering: OrderingTokenSource; protected readonly selection: "least-inflight" | "ordered" | "round-robin"; /** Cache of instantiated models, keyed by candidate index. */ protected readonly modelCache: Map; /** Permanent invalid-model results are cached; transient factory throws are not. */ protected readonly modelErrors: Map; /** Memoized conservative `supportedUrls` (computed once per instance). */ protected supportedUrlsCache: Record; protected supportedUrlsPromise?: Promise>; protected supportedUrlsComputed: boolean; protected abstract emitSkipped(candidates: ResolvedEntry[], phase: "generate" | "stream-open", reason: "concurrency" | "cooldown" | "max-attempts"): void; constructor(logicalId: string, entries: ProviderEntry[], options: CreateRouterOptions, admissionRegistry: AdmissionRegistry, healthStore: RouterHealthStore, ordering: OrderingTokenSource); /** * The set of URLs the router can pass through un-downloaded. The AI SDK reads * this ONCE during call setup to decide whether to download+inline a URL or * forward it raw — but it cannot know which candidate will actually serve the * request. So we report only the support COMMON to every candidate: a URL is * passed through only if all candidates handle it natively; otherwise the SDK * inlines it (which any candidate accepts). Computed once and memoized. */ get supportedUrls(): LanguageModelV4["supportedUrls"]; }