import type { EffortLevel, ResolvedTarget } from "./config-types.js"; import { type TierData } from "./tier-data.js"; /** Where a strength score came from. Ranking is only as trustworthy as its basis. */ export type StrengthBasis = "snapshot" | "neutral"; export interface Strength { /** 0-100 confidence-adjusted routing score. Higher is better. */ score: number; /** Unadjusted snapshot capability composite, kept visible for diagnosis. */ rawScore: number; /** 0-1: how strongly rawScore is allowed to move routing away from neutral. */ confidence: number; basis: StrengthBasis; /** Snapshot only: direct capability signals. Task-fit publications are counted separately. */ signals?: string[]; signalCount?: number; /** Capability + behavioural publications. Pool admission requires at least three. */ publishedSignalCount?: number; /** Fixed 0-100 agentic/coding/general estimates; imputed dimensions are named separately. */ dimensions?: Partial>; directDimensions?: string[]; imputedDimensions?: string[]; /** Capability-only pool bands computed with coarse admission and persisted hysteresis. */ effortEligibility?: EffortLevel[]; /** snapshot only: `fuzzy` means the row belongs to a similarly-named, DIFFERENT model. */ match?: "exact" | "fuzzy"; /** snapshot only: the row actually used. */ matchedName?: string; } /** Deployment-local evidence used after capability eligibility has been decided. */ export interface DeploymentRankingSignals { /** Synthetic-probe stability (0-100). Null/undefined means unmeasured. */ stabilityScore?: number | null; /** 0-1 confidence in stabilityScore, normally based on probe sample count. */ stabilityConfidence?: number; /** Success/speed/recency score from at least five real relay calls. */ runtimeScore?: number | null; /** Whether the exact model SKU advertises tool calling. False is incompatible with agent pools. */ supportsTools?: boolean | null; /** Best known context window for this deployment/SKU. */ contextLength?: number | null; /** 0-1 confidence in contextLength (provider-published=1, cross-host reference<1). */ contextConfidence?: number; /** Best known output ceiling for this deployment/SKU. */ maxOutputTokens?: number | null; /** 0-1 confidence in maxOutputTokens. */ maxOutputConfidence?: number; /** Specialized design/protocol task fit kept outside general capability, 0-100. */ benchmarkTaskFitScore?: number | null; /** 0-1 confidence in benchmarkTaskFitScore, based on task-fit source coverage. */ benchmarkTaskFitConfidence?: number; } /** Transparent breakdown of the one scalar required to order a deployment pool. */ export interface DeploymentFitness { /** 0-100 weighted score: 75% capability, 20% operations, 5% task-fit metadata. */ score: number; capability: number; operational: number; metadata: number; signals: DeploymentRankingSignals; } /** * Evidence confidence used to shrink unlike measurements toward neutral before comparing them. * * Snapshot composites may contain up to five core independent signal families in ordinary use; * additional columns can exist, but five is already full confidence. A fuzzy name match describes * a different SKU and therefore gets half weight. Runtime telemetry is handled separately as an * operational deployment signal and never enters this capability-confidence calculation. */ export declare function evidenceConfidence(basis: StrengthBasis, signalCount?: number, match?: "exact" | "fuzzy"): number; /** Pull an uncertain score toward neutral instead of letting a one-source outlier win outright. */ export declare function confidenceAdjustedScore(rawScore: number, confidence: number): number; /** * Strength of one target, from the best evidence available, in this order: * * 1. the synced multi-source snapshot — real published capability, refreshed by `sync:tiers`; * 2. neutral — nothing is known, so claim nothing. * * Runtime telemetry deliberately does NOT appear here. It measures whether this deployment * answers reliably and quickly, not whether the model can reason. `deploymentFitness()` consumes * it on the operational axis after capability-floor eligibility has been decided. * * There is deliberately no hardcoded-table rung. `BENCHMARK_DB` used to sit here; every pattern it * carried is present in the snapshot, so it contributed nothing but a stale, provenance-free number * that outranked the synced data for any model it happened to substring-match. */ export declare function getStrength(spec: string, tierData?: TierData | null): Strength; /** Minimum raw multi-source capability required by each cumulative effort pool. */ export declare const EFFORT_FLOORS: Record; /** * Whether an automatically discovered target belongs in an effort pool. * * These are raw capability FLOORS, not ceilings. Automatic eligibility additionally requires an * exact model-SKU match and at least three independent published signals. Evidence confidence, * stability, and deployment metadata affect ordering after eligibility; they do not move a strong * model below a floor. Higher effort narrows upward: xhigh ⊆ high ⊆ medium ⊆ low. */ export declare function strengthAllowedForEffort(strength: Strength, effort: EffortLevel): boolean; /** * Build deployment fitness without confusing deployment health with model capability. * * Capability remains dominant and is the only input to effort eligibility. Operations can move * close models based on measured stability and real traffic; useful task-fit metadata makes only * a small final distinction. Every missing operational/metadata signal is neutral (50), never 0. */ export declare function deploymentFitness(strength: Strength, signals?: DeploymentRankingSignals): DeploymentFitness; /** One target with the strength that ranked it, and the provenance of that strength. */ export interface RankedTarget { target: ResolvedTarget; spec: string; strength: Strength; fitness: DeploymentFitness; } export declare function specOfTarget(t: ResolvedTarget): string; /** * Rank targets strongest-first, KEEPING the provenance that produced each position. * * ⚠ The comparator used to read `getStrength(spec).score` and throw the rest away, which made a * `neutral` 50 — "nobody publishes anything about this model" — indistinguishable from a `snapshot` * 50 measured across five leaderboards (`ARC-31833353`). A provenance-free number was deciding * which backend serves a request, the one thing this module exists to prevent. * * Resolution order: * 1. deployment fitness, highest first — capability dominates, then operations and metadata; * 2. on an exact fitness tie, confidence-adjusted capability; * 3. then the better-evidenced basis and larger signal count; * 4. still tied, config order (`sort` is stable), so a pool's declared order is the last word. * * Operational unknowns are neutral, so a cold deployment keeps capability order rather than * being treated as broken. Hard availability/credential faults are demoted later by the breaker. */ export declare function rankTargetsWithProvenance(targets: ResolvedTarget[], opts?: { signalsForTarget?: (target: ResolvedTarget, spec: string) => DeploymentRankingSignals; telemetryPath?: string; tierData?: TierData | null; }): RankedTarget[]; /** Ranked targets only. Use `rankTargetsWithProvenance` when the caller can report WHY. */ export declare function rankTargetsByBenchmark(targets: ResolvedTarget[]): ResolvedTarget[];