/** * ModelRegistry interface and implementation for @a5c-ai/agent-mux. * * @see 06-capabilities-and-models.md ยง4 */ import type { AgentName } from './types.js'; import type { ModelCapabilities, ModelValidationResult } from './capabilities.js'; import type { AdapterRegistry } from './adapter-registry.js'; export interface ModelCatalogEntry extends ModelCapabilities { /** Whether this entry is the adapter's default model. */ isDefault: boolean; } /** * Per-agent model introspection registry. */ export interface ModelRegistry { /** Return all known models for an agent. */ models(agent: AgentName): ModelCapabilities[]; /** Return known models plus default-selection metadata for an agent. */ catalog(agent: AgentName): ModelCatalogEntry[]; /** Return capabilities for a specific model, or null if not found. */ model(agent: AgentName, modelId: string): ModelCapabilities | null; /** Return the default model for an agent, or null. */ defaultModel(agent: AgentName): ModelCapabilities | null; /** Validate a model identifier against the agent's known model list. */ validate(agent: AgentName, modelId: string): ModelValidationResult; /** Estimate the cost (in USD) for given token usage on a specific model. */ estimateCost(agent: AgentName, modelId: string, inputTokens: number, outputTokens: number): number; /** Refresh model data for a specific agent (no-op in current implementation). */ refresh(agent: AgentName): Promise; /** Refresh model data for all registered agents. */ refreshAll(): Promise; /** Return the timestamp of the last successful model data update. */ lastUpdated(agent: AgentName): Date; } /** * Implementation of ModelRegistry backed by the AdapterRegistry. * Reads model data from adapter.models arrays. */ export declare class ModelRegistryImpl implements ModelRegistry { private readonly _adapters; private readonly _lastUpdated; private readonly _modelsCache; constructor(adapters: AdapterRegistry); models(agent: AgentName): ModelCapabilities[]; catalog(agent: AgentName): ModelCatalogEntry[]; model(agent: AgentName, modelId: string): ModelCapabilities | null; defaultModel(agent: AgentName): ModelCapabilities | null; validate(agent: AgentName, modelId: string): ModelValidationResult; estimateCost(agent: AgentName, modelId: string, inputTokens: number, outputTokens: number): number; refresh(_agent: AgentName): Promise; refreshAll(): Promise; lastUpdated(agent: AgentName): Date; /** * Simple fuzzy matching: find models whose IDs or aliases contain * parts of the query string. Returns up to 5 suggestions. */ private _fuzzyMatch; private _getModels; private _normalizeModels; }