import { type Api, type Model } from "@gajae-code/ai/core"; export type CanonicalModelSource = "override" | "bundled" | "heuristic" | "fallback"; export interface ModelEquivalenceConfig { overrides?: Record; exclude?: string[]; } export interface CanonicalModelVariant { canonicalId: string; selector: string; model: Model; source: CanonicalModelSource; } export interface CanonicalModelRecord { id: string; name: string; variants: CanonicalModelVariant[]; } export interface CanonicalModelIndex { records: CanonicalModelRecord[]; byId: Map; bySelector: Map; /** * Final-slash-segment lookup aliases: normalized alias key -> normalized * variant selectors ("provider/id") of every variant whose model id ends in * that segment. Variant-level: an alias never widens to sibling variants in * the same canonical record that end in a different segment. Multi-target * when distinct variants collide on the same segment. Built without * rewriting the canonical or runtime identity of any variant. */ aliases: Map; } export declare function formatCanonicalVariantSelector(model: Model): string; /** * Normalize a model id into its final-slash-segment alias key (trimmed and * lowercased). A bare id without a slash yields the id itself; a multi-level * id yields its last path segment. Returns undefined for empty ids. */ export declare function getFinalSlashSegmentAliasKey(modelId: string): string | undefined; /** * Compare equivalent provider variants using the caller's ranking policy. * * The ordered criteria intentionally mirror the historical canonical resolver: * vision support, configured provider rank, canonical exactness, canonical * source, input plus cache-read cost, and original catalog order. Callers that * do not have a canonical index can omit those axes while retaining a stable, * total comparison. * * `providerRankFirst` swaps the first two axes so configured provider rank wins * over vision support; canonical/alias resolution uses this order while every * existing caller keeps the legacy vision-first order by default. */ export declare function compareEquivalentModelVariants(left: Model, right: Model, options?: { providerRankFirst?: boolean; providerRank?: ReadonlyMap; canonicalId?: string; leftSourceRank?: number; rightSourceRank?: number; modelOrder?: ReadonlyMap; includeCost?: boolean; finalize?: boolean; }): number; /** @deprecated Use compareEquivalentModelVariants for total variant ranking. */ export declare function compareModelVariantRank(left: Model, right: Model): number; export declare function buildCanonicalModelIndex(models: readonly Model[], equivalence?: ModelEquivalenceConfig): CanonicalModelIndex;