/** * Model Registry - manages built-in and custom models from models.json * * Features: * - Loads built-in models from @earendil-works/pi-ai * - Loads custom models from ~/.xopc/models.json * - Supports provider baseUrl/headers overrides * - Supports per-model overrides (modelOverrides) * - API key resolution with shell commands, env vars, and literals * - Hot reload support */ import { type Api, type Model } from '@earendil-works/pi-ai/compat'; import { type ModelCatalogStore } from './model-catalog-store.js'; /** * Model Registry - manages all models (built-in + custom) */ export declare class ModelRegistry { private modelsJsonPath; private catalogStore; private models; private customProviderApiKeys; private loadError; private loaded; private prewarmPromise; private _availableModelsCache; private _authStatusCache; constructor(modelsJsonPath?: string, catalogStore?: ModelCatalogStore); isLoaded(): boolean; /** Synchronously materialize the catalog (idempotent). */ ensureLoaded(): void; /** Background-friendly catalog load (idempotent). */ prewarm(): Promise; /** * Reload models from disk (built-in + custom from models.json) * Clears all caches */ refresh(): void; /** * Get any error from loading models.json (undefined if no error) */ getError(): string | undefined; /** * Get all models (built-in + custom) * Results are cached until refresh() is called */ getAll(): readonly Model[]; /** * Get only models that have auth configured * Results are cached on first call until refresh() */ getAvailable(): readonly Model[]; /** * Find a model by provider and ID */ find(provider: string, modelId: string): Model | undefined; /** * Resolve a model reference (provider/modelId or just modelId) */ resolve(ref: string): Model | undefined; /** * Get API key for a provider (for custom providers from models.json) */ getApiKey(provider: string): string | undefined; /** * Check if a provider has auth configured * Results are cached until refresh() is called */ private hasAuth; /** * Load all models * Clears caches to ensure fresh data */ private loadModels; private loadRemoteModels; /** * Load built-in models and apply provider/model overrides */ private loadBuiltInModels; /** * Merge custom models into built-in list (custom wins on conflicts) */ private mergeCustomModels; /** * Load custom models from models.json */ private loadCustomModels; /** * Parse custom models from config */ private parseModels; } export declare function getModelRegistry(): ModelRegistry; export declare function resetModelRegistry(): void; /** Schedule catalog load on a background turn (gateway post-ready sidecar). */ export declare function prewarmModelRegistry(): Promise;