import type { CanonicalModelId } from "./canonical-model.js"; import type { RouteSkip } from "./plan.js"; import { type RoutePlanRequest, type RoutePlanResult } from "./planner.js"; import { type ProviderPolicy } from "./policy.js"; /** * Configuration-degradation wrapper around the harness planner. * * Policy: even when a provider has priority over the default (an explicit * `only` fence or an ordered policy naming it first), **missing keys or * configuration must never make inference unavailable** — the call degrades * to the default provider and the caller logs an error. This keeps * development environments that hold only an OpenRouter key fully working * while a checked-in policy prioritizes (say) Azure, and keeps production * serving through a provider-config regression instead of hard-failing. * * Scope: PLAN-TIME emptiness only — a stage with zero attemptable candidates * (transport unconfigured/invalid, no binding for the model, capability * mismatch). Runtime failures keep the fence semantics: a configured `only` * provider that errors at request time is never retried through another * provider; the executor's cross-provider traversal applies only * within the plan the policy allowed. */ export interface DegradedStage { readonly model: CanonicalModelId; /** The policy that produced an empty stage. */ readonly fromPolicy: ProviderPolicy; /** Plan skips recorded for this model under the original policy. */ readonly skips: readonly RouteSkip[]; } export interface DegradedPlanResult extends RoutePlanResult { /** Stages rebuilt under the degraded default; empty when nothing degraded. */ readonly degraded: readonly DegradedStage[]; } export declare function buildRoutePlanWithConfigDegradation(request: RoutePlanRequest, degradedPolicy: ProviderPolicy): DegradedPlanResult;