import { ProviderError } from "@graphorin/core"; //#region src/fallback/index.d.ts /** * Operator-supplied policy that lets the consumer toggle which * `ProviderError` kinds the agent runtime should consider eligible * for whole-step retries against the next model in the chain. * * @stable */ interface AgentFallbackPolicy { /** Default `true`. */ readonly rateLimitEligible?: boolean; /** Default `true`. */ readonly capacityEligible?: boolean; /** Default `true`. */ readonly contextLengthEligible?: boolean; /** Default `false` - `withRetry` already covers transient errors. */ readonly transientEligible?: boolean; } /** * Stable taxonomy returned by {@link isAgentFallbackEligible} on * eligible errors. * * @stable */ type AgentFallbackReason = 'rate-limit' | 'capacity' | 'context-length' | 'transient'; /** * Outcome of {@link isAgentFallbackEligible}. * * @stable */ interface AgentFallbackEligibility { readonly eligible: boolean; readonly reason?: AgentFallbackReason; } /** * Pure dispatcher that maps a {@link ProviderError} to one of four * eligible reasons or to `eligible: false` if the error is on the * bypass list - the `ProviderErrorKind` values `invalid-request`, * `unauthorized`, `content-filter`, and `unknown`. * * The function is intentionally allocation-free on the hot path so * the agent runtime can call it once per provider error per step * without budget concerns. * * @stable */ declare function isAgentFallbackEligible(error: ProviderError, policy?: AgentFallbackPolicy): AgentFallbackEligibility; //#endregion export { AgentFallbackEligibility, AgentFallbackPolicy, AgentFallbackReason, isAgentFallbackEligible }; //# sourceMappingURL=index.d.ts.map