/** * Pure provider-alias resolution over {@link ProviderDef.aliases} (T11704). * * M3 Provider SSoT (epic T11667 · task T11704). {@link resolveProviderId} maps a name * OR an alias to its canonical provider id, reading the {@link ProviderDef} set's * `aliases` arrays as the SINGLE source — `codex`/`chatgpt` → `openai`, * `claude` → `anthropic`, `google` → `gemini`, … It is the declarative replacement * for the ad-hoc `_aliases` Map the in-process registry populates imperatively. * * ## Pure + deterministic + side-effect-free (AC2 · AC5) * * The resolver is a pure function of `(input, defs)`: no DB, no network, no module * state. {@link buildAliasIndex} folds the provider set into an immutable * `alias → id` index once; {@link resolveProviderId} is a single case-insensitive * lookup. An alias that collides with ANOTHER provider's primary id is rejected at * index-build time (a hard error) so a mis-declared alias can never silently * mis-route. Unknown input returns `null`. * * @module llm/provider-registry/provider-alias * @task T11704 * @epic T11667 * @see @cleocode/contracts — {@link ProviderDef} (the declarative contract, T11702) * @see ./provider-defs.ts — {@link builtinProviderDefs} (the default provider set) */ import type { ProviderDef } from '@cleocode/contracts'; /** * An immutable case-insensitive `alias-or-id → canonical-id` index built from a * provider set. Every provider's own id maps to itself; every alias maps to its * provider's id. * * @task T11704 */ export type ProviderAliasIndex = ReadonlyMap; /** * Build the immutable {@link ProviderAliasIndex} from a provider set. * * Every provider's lower-cased `id` maps to itself; every lower-cased alias maps to * its provider's id. Pure + deterministic. * * @param defs - The provider definitions (defaults to {@link builtinProviderDefs}). * @returns The case-insensitive alias index. * @throws {Error} When an alias collides with ANOTHER provider's primary id, or two * providers declare the SAME alias (ambiguous resolution — AC2). * @task T11704 */ export declare function buildAliasIndex(defs?: ReadonlyArray): ProviderAliasIndex; /** * Resolve a provider name or alias to its canonical provider id (case-insensitive). * * Pure + deterministic + side-effect-free. `codex`/`chatgpt` → `openai`, * `claude` → `anthropic`, an exact provider id → itself. Returns `null` for an * unknown name (callers handle the generic/fallback case). * * @param input - The provider name or alias to resolve. * @param indexOrDefs - An already-built {@link ProviderAliasIndex}, OR the provider * set to build one from (defaults to {@link builtinProviderDefs}). Pass the prebuilt * index in a hot loop to avoid rebuilding per call. * @returns The canonical provider id, or `null` when `input` matches no id/alias. * @task T11704 */ export declare function resolveProviderId(input: string, indexOrDefs?: ProviderAliasIndex | ReadonlyArray): string | null; //# sourceMappingURL=provider-alias.d.ts.map