import type { ModelDefinition } from './registry-types.js'; /** * Ceiling for a configured context window. Matches the model-picker's input * validation; anything above this is a typo, not a real model window. */ export declare const MAX_CONTEXT_WINDOW_OVERRIDE = 10000000; export declare function getContextWindowOverridesPath(configDir: string): string; /** True when the value is usable as a context window override. */ export declare function isValidContextWindowOverride(value: number): boolean; interface LoadedContextWindowState { overrides: Map; observed: Map; } /** * Load persisted state (v1 files have no observed section). Malformed files * and invalid entries are dropped with a warning, never poison downstream * window math with a bad value. */ export declare function loadContextWindowOverrides(filePath: string): LoadedContextWindowState; /** Persist state. Write failures are logged, not thrown, the in-memory values still apply this session. */ export declare function saveContextWindowOverrides(filePath: string, state: LoadedContextWindowState): void; /** * Owns the per-model window knowledge: lazy disk load, validated set/clear * with persistence, observed-limit learning, and the overlay applied to * model definitions. ProviderRegistry delegates here so window policy lives * in one place. */ export declare class ContextWindowOverrideStore { private readonly filePath; private state; constructor(filePath: string); private load; private persist; /** The user-configured window for a model, or null when automatic. */ get(registryKey: string): number | null; /** The learned provider limit for a model, or null when none observed. */ getObserved(registryKey: string): number | null; /** Validate, store, and persist a user override. Returns false (and stores nothing) for invalid caps. */ set(registryKey: string, cap: number): boolean; /** * Remove the user override AND any learned limit, returning the model to * fully automatic resolution. Returns true when anything was cleared. */ clear(registryKey: string): boolean; /** * A provider rejected a request of ~`rejectedAtTokens` as too long: record * that size as the model's practical ceiling. Only lowers (or sets) the * learned limit, a larger rejection than a known-smaller limit teaches * nothing new. */ recordRejection(registryKey: string, rejectedAtTokens: number): void; /** * A request with real billed input of `successfulInputTokens` succeeded: * if that exceeds the learned limit, the limit was too pessimistic (token * estimates overshoot), raise it to what the provider demonstrably * accepted. */ reconcileSuccess(registryKey: string, successfulInputTokens: number): void; /** * Overlay window knowledge onto a model definition. A user override wins * ('configured_cap', authoritative downstream); otherwise a learned limit * applies when it is smaller than the automatic window ('observed_limit', * equally authoritative, the provider proved the catalog wrong). */ apply(model: ModelDefinition): ModelDefinition; } export {}; //# sourceMappingURL=context-window-overrides.d.ts.map