/** * CLEO Provider Registry — public API. * * A lightweight, in-process registry mapping canonical provider names (and * their aliases) to {@link ProviderProfile} descriptors. Ported idiomatically * from the Hermes provider registry (`providers/__init__.py`). * * ## Semantics * - Last-writer-wins on `name` collision — user plugins override builtins. * - Alias conflicts with another profile's **primary** name throw at * registration time to prevent silent mis-routing. * - Discovery is lazy and idempotent: the first call to `getProviderProfile` * or `listProviders` triggers a one-shot discovery pass that: * 1. Registers all builtin profiles. * 2. Scans `${CLEO_HOME}/plugins/model-providers/` for user plugins. * Subsequent calls reuse the same discovery promise. * * @task T9262 * @epic T9261 (T-LLM-CRED-CENTRALIZATION Phase 3) * * @example * ```ts * import { getProviderProfile, listProviders } from '@cleocode/core/llm/provider-registry'; * * const profile = await getProviderProfile('anthropic'); * // → { name: 'anthropic', displayName: 'Anthropic Claude', … } * * const all = await listProviders(); * // → [{ name: 'anthropic', … }] * ``` */ import type { ProviderProfile } from '@cleocode/contracts'; /** * Register a provider profile. * * - Keys the profile by `profile.name.toLowerCase()` in the primary registry. * - Indexes each alias in {@link _aliases}. An alias that conflicts with the * primary name of a *different* already-registered profile throws a * `TypeError` to prevent silent mis-routing. * - Last-writer-wins on primary name collisions (user plugins override * builtins). * * @param profile - The provider profile to register. * @throws {TypeError} When an alias conflicts with another profile's primary name. */ export declare function registerProvider(profile: ProviderProfile): void; /** * Ensure the one-shot discovery pass has run. * * Calling this multiple times is safe — it returns the same promise every time. * The discovery pass: * 1. Registers all {@link BUILTIN_PROFILES}. * 2. Scans `${CLEO_HOME}/plugins/model-providers/` for user plugins. */ export declare function ensureDiscovered(): Promise; /** * Run plugin discovery explicitly. * * Idempotent: subsequent calls after the first discovery pass return * the cached promise immediately without rescanning the filesystem. */ export declare function discoverPlugins(): Promise; /** * Look up a provider profile by name or alias (case-insensitive). * * Triggers discovery on the first call. Returns `undefined` when no profile * matches — callers MUST handle this case (generic/fallback behaviour). * * @param name - Provider name or alias to look up. * @returns The matching {@link ProviderProfile}, or `undefined`. */ export declare function getProviderProfile(name: string): Promise; /** * Return all registered provider profiles, sorted ascending by canonical name. * * Triggers discovery on the first call. Each profile appears exactly once * (aliases do not generate duplicate entries). * * @returns Sorted array of registered {@link ProviderProfile} objects. */ export declare function listProviders(): Promise>; /** * Reset registry state for testing. * * @internal — NOT part of the public API. Exported so the test suite can * isolate each test case without restarting the process. */ export declare function _resetRegistryForTesting(): void; //# sourceMappingURL=index.d.ts.map