import { DEFAULT_MODEL } from "../agent/default-model.js"; import { type ModelEngineConfig } from "../agent/model-version.js"; export { DEFAULT_MODEL }; import { type ReasoningEffort } from "../shared/reasoning-effort.js"; import { type EngineModelGroup } from "./chat-model-groups.js"; export type { EngineModelGroup } from "./chat-model-groups.js"; export interface UseChatModelsResult { availableModels: EngineModelGroup[]; configuredModels: EngineModelGroup[]; defaultModel: string; selectedModel: string; selectedEngine: string; selectedEffort: ReasoningEffort; isLoading: boolean; selectionReady: boolean; unavailableSelection: PersistedModelSelection | null; onModelChange: (model: string, engine: string) => void; onEffortChange: (effort: ReasoningEffort) => void; refreshEngines: () => void; } export interface UseChatModelsOptions { storageKey?: string | null; enabled?: boolean; /** * Keep an unavailable explicit choice visible for the host to resolve rather * than silently replacing it with a model from another provider. */ unavailableSelectionPolicy?: "fallback" | "require-explicit"; } export declare function chatModelSelectionStorageKey(namespace?: string | null): string; export declare const CHAT_MODEL_SELECTION_CHANGED_EVENT = "agent-native:chat-model-selection-changed"; export interface PersistedModelSelection { model?: string; engine?: string; effort?: ReasoningEffort; } export type ChatModelCatalogLoad = { state: "available"; groups: EngineModelGroup[]; /** Runtime normalization config for the engines represented in groups. */ modelEngines: Readonly>; /** The server-selected engine, independent of a persisted chat choice. */ currentModelEngine: ModelEngineConfig | null; /** The server's current model, or `DEFAULT_MODEL` when it names none. */ defaultModel: string; /** The server's current engine, when it names one. */ defaultEngine?: string; /** * The catalog again with Ollama's installed models in place of its * static suggestions, or null when there is nothing to swap in (Ollama * isn't the current engine, its models are checked, or it is * unreachable). A separate call so the picker's first paint never waits * on a local network round trip. */ loadLiveGroups: () => Promise; } | { state: "unavailable"; /** The engine list itself failed, not just a readiness lookup. */ enginesUnavailable: boolean; }; /** * Fetch the engine catalog and readiness, and build the model picker's groups. * The one source for every surface with a model picker (`useChatModels`, * `MultiTabAssistantChat`), so they can't disagree about what is offered. */ export declare function loadChatModelCatalog(): Promise; export declare function useChatModels({ storageKey, enabled, unavailableSelectionPolicy, }?: UseChatModelsOptions): UseChatModelsResult;