/** * MODULE CHARTER: Dynamic Pool Synthesis & Tier Discovery (dynamic-pools.ts) * * 1. Domain Boundary & Responsibilities: * - Synthesizes dynamic, benchmark-ranked model pools (`pool/low`, `pool/medium`, `pool/high`, `pool/xhigh`). * - Dynamically discovers candidates by evaluating active provider catalogs against known tier benchmarks. * - Materializes candidate lists combining invariant fixed targets with fitness-ranked discovery tails. * * 2. Tier Discovery & Ranking Invariants: * - Matches candidate models against curated benchmark data (`tier-data.js`) using strict normalized SKU matching. * - Weighs capability scores alongside runtime stability metrics (`runtime-telemetry.js`, `probe-cache.js`). * - Caches materialized pool signatures per configuration epoch (`DYNAMIC_POOL_RANKING_EPOCH_MS`) to bound CPU overhead. * * 3. Degradation Tail & Fallback Rules: * - Implements monotonic effort-level degradation: `xhigh` degrades to `high`, `medium`, and `low` successively. * - Higher tiers incorporate lower tier candidates in their fallback tail to survive total tier exhaustion. * - Fixed targets specified in configuration take strict precedence over dynamically discovered tail candidates. * * 4. Cost-Based Band Ordering & Guardrails: * - Prioritizes 100% free model providers and subscription pools over metered paid endpoints. * - Enforces operator cost blocks (`isCostBlockedForEverySlot()`) to guarantee zero unintended spend on offload lanes. */ import { type Config, type ResolvedTarget } from "./config-types.js"; import type { ModelCatalog } from "./catalog.js"; import type { DeploymentRankingSignals } from "./benchmarks.js"; import { type TierData } from "./tier-data.js"; import { type TelemetryData } from "./ping/runtime-telemetry.js"; import { type ProbeCacheData } from "./ping/probe-cache.js"; export declare const DYNAMIC_POOL_RANKING_EPOCH_MS = 30000; interface RankingDataSnapshot { tierData: TierData | null; telemetry: TelemetryData; probes: ProbeCacheData; now: number; } /** Operational and task-fit signals for one concrete provider deployment. */ export declare function deploymentRankingSignals(target: ResolvedTarget, catalog: ModelCatalog, snapshot?: RankingDataSnapshot): DeploymentRankingSignals; /** * Materialize every dynamic pool as: * * fixed configured prefix -> every eligible free target in deployment-fitness order * * Catalog discovery is deliberately synchronous here: startup warms catalogs in the background, * while the on-disk cache makes restarts immediately useful. Re-materializing after a refresh * replaces the tail rather than accumulating stale models. */ export declare function materializeDynamicPools(cfg: Config, catalog: ModelCatalog, opts?: { now?: number; force?: boolean; tierData?: TierData | null; }): boolean; export {};