/** * Pi model registry → ModelProfile mapper. * * Maps pi `Model` objects (provider + id) to router fleet entries using * pattern-based lookup for known families. When `config/benchmark-profiles.json` * contains a row for the model id (SP-134/136 ingest output), or a fleet alias * pointing at such a row (SP-174), capability vectors are grounded in benchmark * scores instead of regex defaults. Unknown models or missing benchmark rows * receive conservative pattern defaults. Mapped profiles include * `capability_source` (`benchmark` | `pattern_default`) for explain/telemetry. * * Mixed capability-source fairness (SP-312 / #193): raw ingest scores live on a * compressed scale (~0.5–0.85) while pattern defaults sit at 0.7–0.95, so a * benchmark-grounded model ranked below every ungrounded same-tier model purely * because of its capability source. Grounded vectors are therefore rescaled per * dimension against the max of their own pattern-family cohort, anchored at the * matched family default: the best-measured grounded model in a family ties the * ungrounded family default, and every other grounded model ranks below it in * proportion to its measured distance from the best — remaining differences are * explained by benchmark standing, not capability source. The transform is * strictly monotonic per dimension, so grounded relative order is preserved. * The rescale is lift-only: a grounded model is never pushed below its measured * scores, so families whose pattern default sits below the measured cohort * scale (e.g. UNKNOWN_DEFAULTS rows like gpt-5.3-codex) keep their raw scores * instead of regressing. See `withBenchmarkCapabilities`. */ import type { ModelCapabilities, ModelLimits, ModelProfile, Tier } from '../domain/types/entities.js'; /** Checked-in ingest artifact from `npm run routing:ingest-benchmarks` (SP-134). */ export declare const DEFAULT_BENCHMARK_PROFILES_PATH: string; /** Whether HyDRA capabilities came from the ingest artifact (or alias) vs regex defaults. */ export type CapabilitySource = 'benchmark' | 'pattern_default'; /** ModelProfile plus operator-visible capability provenance (SP-174). */ export interface MappedModelProfile extends ModelProfile { readonly capability_source: CapabilitySource; /** * Context limits carried from the pi model registry (`Model.contextWindow` / * `Model.maxTokens`) — SP-299 / #177. Kept separate from `limits` (YAML * overrides) so `resolveLimits` can rank them below LiteLLM catalog data * and above tier defaults. */ readonly pi_registry_limits?: ModelLimits; } /** * Test hook — override benchmark artifact path (null disables benchmark grounding). */ export declare function setBenchmarkProfilesPathForTests(filePath: string | null): void; /** Test hook — clear cached benchmark artifact between cases. */ export declare function resetBenchmarkProfilesCacheForTests(): void; /** * Resolve a scoped-fleet model id to the canonical ingest `model_id` via aliases. * Returns the input id when no alias exists. */ export declare function resolveBenchmarkModelId(modelId: string): string; /** * Per-dimension max of the pattern-family cohort the model's benchmark row * belongs to (SP-312). Exported for fairness audits and tests. */ export declare function getBenchmarkFamilyCohortMax(modelId: string): ModelCapabilities | undefined; /** * SP-312 / #193 — rescale a grounded capability vector onto the pattern-default * scale of its model family. Per dimension: * `score × max(1, familyDefault / cohortMax)`, where `cohortMax` is the max * across the pattern-family cohort the benchmark row belongs to. Properties: * - Strictly monotonic in the raw score → grounded relative order preserved. * - The cohort-best grounded model reaches the family default exactly (ties * ungrounded same-tier models) whenever the family default sits above the * measured cohort scale. * - Lift-only: never pushes a grounded model below its measured scores, so * rows whose family default is below the cohort scale (e.g. UNKNOWN_DEFAULTS * rows) are not penalized for being benchmarked. * A degenerate cohort (max ≤ 0) cannot differentiate — keep the raw score * rather than divide by zero. */ export declare function scaleBenchmarkCapabilitiesToFamily(grounded: ModelCapabilities, familyDefault: ModelCapabilities, familyCohortMax: ModelCapabilities): ModelCapabilities; /** * Whether capabilities for this model id resolve from the benchmark artifact * (direct row or fleet alias) vs pattern/family defaults. */ export declare function getCapabilitySource(modelId: string): CapabilitySource; /** Pi registry `Model.cost` shape — per-1M-token USD rates (SP-298). */ export interface PiRegistryCost { readonly input: number; readonly output: number; readonly cacheRead: number; readonly cacheWrite: number; } export interface PiModelInput { readonly provider: string; readonly id: string; readonly name?: string; readonly cost?: PiRegistryCost; /** Pi registry `Model.contextWindow` — total input token window (SP-299 / #177). */ readonly contextWindow?: number; /** Pi registry `Model.maxTokens` — max output tokens (SP-299 / #177). */ readonly maxTokens?: number; } /** Conservative context limits when YAML and LiteLLM registry have no entry (SP-092). */ export declare const DEFAULT_MODEL_LIMITS: Readonly>; export declare function getDefaultLimitsForTier(tier: Tier): ModelLimits; /** * Default virtual subscription-quota cost for Cursor frontier models (SP-096 / #70). * `fallback_cost_per_1m` stays 0 (no per-token API billing); `quota_cost_per_1m` * is used only for frugality scoring and telemetry so economical API models are * not dominated solely because subscription registry cost is zero. */ export declare const DEFAULT_CURSOR_QUOTA_COST_PER_1M = 3; /** * Map a pi model registry entry to a router ModelProfile. * Includes `capability_source` for operators (benchmark vs pattern_default). */ export declare function mapPiModelToProfile(input: PiModelInput): MappedModelProfile; /** * Map an array of pi registry models to a router fleet catalog. */ export declare function mapFleetFromRegistry(models: readonly PiModelInput[]): MappedModelProfile[]; //# sourceMappingURL=pi-model-mapper.d.ts.map