erosolar-cli
Version:
Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning
101 lines • 3.05 kB
TypeScript
/**
* Model discovery system for auto-detecting new models from providers.
*
* This module queries provider APIs to discover available models and caches
* them for use alongside the static model schema. It never modifies the
* static schema - discoveries are stored separately and merged at runtime.
*/
import type { ProviderId } from './types.js';
import type { ModelConfig } from './agentSchemaLoader.js';
/**
* Model discovery result for a single provider
*/
export interface ProviderDiscoveryResult {
provider: ProviderId;
success: boolean;
models: ModelConfig[];
error?: string;
}
/**
* Complete discovery result
*/
export interface DiscoveryResult {
success: boolean;
timestamp: string;
results: ProviderDiscoveryResult[];
totalModelsDiscovered: number;
errors: string[];
}
/**
* Get cached discovered models
*/
export declare function getCachedDiscoveredModels(): ModelConfig[];
/**
* Discover models from all configured providers
*
* PERF: Uses Promise.allSettled for parallel discovery - all providers queried
* simultaneously. No single slow/failed provider blocks the others.
*/
export declare function discoverAllModels(): Promise<DiscoveryResult>;
/**
* Clear the discovered models cache
*/
export declare function clearDiscoveredModelsCache(): void;
/**
* Provider configuration info
*/
export interface ProviderInfo {
id: ProviderId;
name: string;
envVar: string;
configured: boolean;
latestModel: string;
models?: string[];
}
/**
* Sort models by priority (best first)
*/
export declare function sortModelsByPriority(provider: ProviderId, models: string[]): string[];
/**
* Get the best/latest model for a provider
*/
export declare function getBestModel(provider: ProviderId, models: string[]): string;
/**
* Check if a provider is configured (has API key or is accessible)
*/
export declare function isProviderConfigured(providerId: ProviderId): boolean;
/**
* Get all providers with their configuration status
*/
export declare function getProvidersStatus(): ProviderInfo[];
/**
* Get list of configured providers (with valid API keys)
*/
export declare function getConfiguredProviders(): ProviderInfo[];
/**
* Get list of unconfigured providers
*/
export declare function getUnconfiguredProviders(): ProviderInfo[];
/**
* Get the first available provider (for auto-selection)
*/
export declare function getFirstAvailableProvider(): ProviderInfo | null;
/**
* Get latest model for a provider from cache or defaults
*/
export declare function getLatestModelForProvider(providerId: ProviderId): string;
/**
* Quick provider availability check result
*/
export interface QuickProviderStatus {
provider: ProviderId;
available: boolean;
latestModel: string;
error?: string;
}
/**
* Quickly check if providers are available by querying their APIs
* Returns actual latest models from each provider
*/
export declare function quickCheckProviders(): Promise<QuickProviderStatus[]>;
//# sourceMappingURL=modelDiscovery.d.ts.map