import type { Context } from '../core/context.js'; import type { Compactor } from '../types/compactor.js'; import type { Config } from '../types/config.js'; import type { ErrorHandler, RecoveryDecision } from '../types/error-handler.js'; import type { ModelsRegistry } from '../types/models-registry.js'; /** * Tiered error recovery strategies. * Each strategy is attempted in order until one returns a decision. */ export interface RecoveryStrategy { /** Human-readable label for logs. */ label: string; /** Optional compactor for context_overflow recovery. */ compactor?: Compactor | undefined; /** Returns an explicit recovery decision, or null to fall through. */ attempt: (err: unknown, ctx: Context) => Promise; } /** * Builds the ordered list of recovery strategies used by DefaultErrorHandler. * Exported so callers can customise or extend the strategy chain. */ export declare function buildRecoveryStrategies(opts?: { compactor?: Compactor | undefined; modelsRegistry?: ModelsRegistry | undefined; getConfig?: (() => Config) | undefined; }): RecoveryStrategy[]; /** * Clamp a session's effective context ceiling after a provider-authoritative * overflow. The rejected request proves that `input + output reserve` is at * or beyond the route's real limit. This is intentionally session-local: it * must not overwrite user config based on one transient provider route. */ export declare function learnEffectiveContextLimitFromOverflow(ctx: Context): number | undefined; export declare const DEFAULT_RECOVERY_STRATEGIES: RecoveryStrategy[]; export declare class DefaultErrorHandler implements ErrorHandler { private readonly strategies; constructor(strategies?: RecoveryStrategy[]); classify(err: unknown): ReturnType; recover(err: unknown, ctx: Context): Promise; } //# sourceMappingURL=error-handler.d.ts.map