/** * Route context-window sizing for hand-declared gateways. * * A gateway whose `GET /models` discloses no capacity leaves every model on the * route at the harness default (262,144), so a long session compacts far * earlier than the endpoint requires. `/setup` closes that gap from two * sources, in order: the listing's own `context_length`, then the installed * pi-ai catalog, which sizes 1,200-odd models under its own provider ids. * * A gateway id is rarely a catalog id verbatim — `gemini-claude-sonnet-4-6` * proxies `claude-sonnet-4-6`, `deepseek/deepseek-v4.1-flash` is namespaced, * `gemini-3.6-flash-high` names its thinking level — so the lookup normalizes * before it matches, and reports nothing rather than guessing a window it * never found. * * @module dsh-ssh-tui/context-window */ import type { CatalogPreset } from './provider-catalog.js'; /** * Catalog ids to try for one gateway model id, most specific first. * @param raw - the id the endpoint advertises. * @returns lowercased candidates, deduplicated and order-preserving. */ export declare function catalogIdCandidates(raw: string): string[]; /** * Every catalog window, keyed by lowercased model id. The first provider to * size an id wins, so a shared id keeps one stable answer. * @param presets - the read catalog presets. * @returns the lookup index. */ export declare function catalogWindowIndex(presets: readonly CatalogPreset[]): Map; /** * The catalog window for one gateway model id. * @param id - the id the endpoint advertises. * @param index - {@link catalogWindowIndex} for the loaded catalog. * @returns the window, or `undefined` when no candidate names a sized model. */ export declare function catalogContextWindow(id: string, index: ReadonlyMap): number | undefined; /** * The route-level default to persist: the smallest window discovered for the * route's selected models. A model neither the listing nor the catalog sizes * then inherits a value the route already proved it serves, never more. * @param windows - the per-model windows discovered so far. * @returns the window, or `undefined` when nothing was discovered. */ export declare function suggestedRouteContextWindow(windows: Iterable): number | undefined;