/** * [WHO]: ModelCycleResult, ModelSwitcher class * [FROM]: Depends on ai, agent-core * [TO]: Consumed by core/model/index.ts * [HERE]: core/model/switcher.ts - model selection and cycling logic */ import type { Model } from "@catui/ai/types"; import type { ThinkingLevel } from "@catui/agent-core"; export interface ModelCycleResult { model: Model; previousModel: Model | undefined; } export interface ModelSwitcherOptions { /** Get API key for a model */ getApiKey: (model: Model) => Promise; /** Get API key for a provider */ getApiKeyForProvider: (provider: string) => Promise; /** Get all available models */ getAvailableModels: () => Model[]; /** Set the model on the agent */ setModelOnAgent: (model: Model) => void; /** Get current model */ getCurrentModel: () => Model | undefined; /** Scoped models from --models flag */ scopedModels?: Array<{ model: Model; thinkingLevel: ThinkingLevel; }>; } export declare class ModelSwitcher { private options; private _scopedModels; constructor(options: ModelSwitcherOptions); /** * Get current model */ getModel(): Model | undefined; /** * Check if a model has an API key */ hasApiKey(model: Model): Promise; /** * Get models with API keys (async, validates OAuth tokens) */ getModelsWithApiKey(): Promise[]>; /** * Get scoped models with API keys */ getScopedModelsWithApiKey(): Promise; thinkingLevel: ThinkingLevel; }>>; /** * Cycle to next/previous model */ cycleModel(direction?: "forward" | "backward"): Promise; /** * Cycle through scoped models */ private cycleScopedModel; /** * Cycle through all available models * Skips models with expired OAuth tokens. */ private cycleAvailableModel; /** * Set scoped models */ setScopedModels(models: Array<{ model: Model; thinkingLevel: ThinkingLevel; }>): void; /** * Get scoped models */ getScopedModels(): Array<{ model: Model; thinkingLevel: ThinkingLevel; }>; }