import type { TuiCatalogModel, TuiModelOption, TuiProviderInfo } from "@mono-agent/operator-adapter"; import { type PiBuiltinModelSnapshot } from "@mono-agent/agent-runtime"; import type { DiscoveredLocalModel, LocalProviderDefinition, ProviderDefinition, RuntimeModelReference } from "@mono-agent/runtime-adapter"; export declare const DEFAULT_PAGE_SIZE = 100; export declare const MAX_PAGE_SIZE = 200; /** * Producer-side length bounds for the CATALOG's own projections * (`listProviders`/`listModels`/`searchModels`). Provider ids, model * ids and display names are not length-bounded by config validation, and both * `/v1/info` and a `/v1/models` page have a body cap to respect: an over-cap * `/v1/models` page 500s instead of serving, and an over-cap `/v1/info` body * costs the console a whole field at `sendBoundedInfo`'s fence. Oversized * entries are skipped rather than truncated, because a truncated id would not * resolve anyway. * * These are display/paging bounds, NOT validity bounds, and that distinction is * the whole reason they are safe to keep. The runtime reference parser bounds a * reference's CONTENT (no control or formatting code points) and deliberately * not its length — what a model may be called is decided by providers, and two * attempts at a ceiling each refused a model that really exists. So an id past * `MAX_CATALOG_ID_BYTES` is something a local `/v1/models` can genuinely report * and this filter genuinely cuts. Cutting it HERE costs a page one row; cutting * it at the parser would have cost an operator a route that runs. * * `/v1/info.models` deliberately does not inherit them (see the `/v1/info` * budget note in `channel-drivers/tui.ts`) — reusing them there deleted runnable * models from schema-1 clients at a wire schema that cannot be bumped. The TUI * has no `/v1/models` call site at all, so a model this filter drops is still * selectable in the picker; `tui-channel.test.ts` pins that divergence. * * PROVIDER ids and labels are bounded by the shared wire contract instead * (`MAX_INFO_PROVIDER_ID_BYTES`/`..._LABEL_BYTES` in `@mono-agent/agent-contracts`), * because `/v1/info.providers` has a consumer that enforces its own copy of the * same numbers. A local bound here and a local bound there is how a 129-byte * provider id came to be published by this catalog and discarded by the * console. Model ids have no such second enforcer and keep the local bound. */ export declare const MAX_CATALOG_ID_BYTES = 256; export declare const MAX_CATALOG_LABEL_BYTES = 256; export declare const DEFAULT_MAX_ADVERTISED_PER_PROVIDER = 100; export declare const MAX_SEARCH_RESULTS = 100; export interface ProviderModelCatalogInput { /** Configured provider definitions (the canonical `providers.entries` map). */ readonly providers?: readonly ProviderDefinition[]; /** Local-provider projection used for precise effort/context resolution. */ readonly localProviders?: readonly LocalProviderDefinition[]; /** Configured runtime routes (primary + fallbacks). */ readonly configuredRoutes?: readonly RuntimeModelReference[]; /** Live-discovered local models (TUI path only; Slack/Telegram pass none). */ readonly discoveredModels?: readonly DiscoveredLocalModel[]; /** Test seam: replaces the Pi built-in model listing call. */ readonly listBuiltinModels?: (providerId: string) => readonly PiBuiltinModelSnapshot[]; } export interface ProviderModelCatalog { /** Whether native local metadata proves this route cannot generate chat. */ isEmbeddingOnly(ref: RuntimeModelReference): boolean; /** Eager, frozen, deterministic provider list. Never throws. */ listProviders(): readonly TuiProviderInfo[]; listModels(providerId: string, options?: { readonly cursor?: string; readonly limit?: number; }): { readonly models: readonly TuiCatalogModel[]; readonly nextCursor?: string; readonly truncated: boolean; }; searchModels(query: string, limit?: number): readonly TuiCatalogModel[]; /** Effort/context/provider metadata for the configured-route shortlist. */ describe(refs: readonly RuntimeModelReference[]): Record; } export interface ProviderAuthCheckModelSelection { readonly kind: "selected"; readonly model: RuntimeModelReference; readonly selectionBasis: "catalog_pricing" | "subscription_zero_price" | "sole_candidate_unknown_price"; } export interface ProviderAuthCheckModelUnavailable { readonly kind: "unavailable"; readonly code: "provider_unsupported" | "no_eligible_model" | "pricing_unavailable"; readonly message: string; } /** * Select one cheapest text-generation model without network discovery. Missing * prices are deliberately incomparable unless there is exactly one candidate. */ export declare function selectProviderAuthCheckModel(providerId: string, input?: Pick): ProviderAuthCheckModelSelection | ProviderAuthCheckModelUnavailable; /** * Build the provider-widened model catalog once at channel start. The catalog * is total by construction: an unknown provider yields an empty page, a * built-in listing that throws degrades to zero models, and no code path * propagates. Everything is precomputed here so `/v1/info` reads memory only * and never awaits network I/O, and the lazy `/v1/models` endpoint only slices * already-frozen pages. */ export declare function buildProviderModelCatalog(input?: ProviderModelCatalogInput): ProviderModelCatalog; //# sourceMappingURL=provider-model-catalog.d.ts.map