import type { AuthVerification, CostEvidence, ProcessingCostBasis, BillingKnowledge, CredentialRoute, EffortHint, Intent, PaidFallback, QualityTierSet, RouteRankingRationale, RoutingGoal } from "@claudexor/schema"; import type { BudgetLedger } from "./ledger.js"; /** * The typed auth-route evidence a route ran (or would run) under — the doctor's * `auth_sources` verification for the credential source plus the concrete * `credential_route` receipt. This is the ONLY sanctioned source of billing * knowledge (INV-060 / schema `auth.ts`: a credential transport alone never * proves entitlement or zero cost, but a VERIFIED native/subscription route is * a subscription-entitlement fact). No per-vendor price table is inferred. */ export interface RouteAuthEvidence { route: CredentialRoute | null; verification: AuthVerification; } /** * Billing knowledge derived STRICTLY from the typed auth route (QA-034). A * verified vendor-native route proves `subscription_entitlement`; a managed * API-key route is `metered` and is NEVER presumed free; every other route * (unverified native, credential-free local, unknown) stays `unknown`. This is * the missing production producer the schema/router already knew how to consume. */ export declare function billingKnowledgeForAuthRoute(evidence: RouteAuthEvidence): BillingKnowledge; export interface RouterCandidate { costEvidence?: CostEvidence; harnessId: string; available: boolean; /** Known model id, null for an intentional vendor-native default, or omitted * only when the caller has no model context at all. */ model?: string | null; effort?: EffortHint; billingKnowledge?: BillingKnowledge; /** Typed auth-route evidence. When present it is AUTHORITATIVE for billing * knowledge (derived via billingKnowledgeForAuthRoute), so a verified native * route survives paid_fallback:never and ranks with a real economy tuple. * Falls back to the explicit billingKnowledge (else unknown) when absent. */ authRoute?: RouteAuthEvidence; incrementalCostUsd?: number | null; credentialRoute?: CredentialRoute; /** Effective credential subject for quota filtering (release wave round-16 * #2): a profile id, null for the engine default, undefined when unknown * (conservative any-subject matching). Profile A's cooldown must never * exclude profile B or the default on the same harness+route. */ credentialSubjectId?: string | null; } export interface RouteContext { goal: RoutingGoal; paidFallback: PaidFallback; intent: Intent; qualityTiers: QualityTierSet; ledger: BudgetLedger; /** * The instant EVERY clock-dependent axis is evaluated at (cooldown expiry and * quota pace slack). Optional: each entry point pins one `Date.now()` for the * whole call when it is absent. A caller that ranks a pool and then explains * the SAME pool must pass a pinned instant so both passes read one clock. */ now?: number; } export declare class RoutingPreflightError extends Error { readonly code = "routing_preflight_refused"; } /** A mode-qualified native receipt outranks authentication-only inference. */ export declare function processingBillingKnowledge(basis: ProcessingCostBasis | undefined, ordinary: BillingKnowledge): BillingKnowledge; /** Order candidates transparently; lower tuple values win. Unknown quota remains eligible. */ export declare function rankHarnesses(candidates: RouterCandidate[], context: RouteContext): RouterCandidate[]; export declare function selectHarness(candidates: RouterCandidate[], ctx: RouteContext): RouterCandidate | null; /** * Explain a ranking as a typed record (QA-034): the per-candidate billing/cost * tuple, the eligible/dropped split, and the DECISIVE reason. Kept axis-aligned * with rankHarnesses so the recorded rationale can never disagree with the * order actually taken. Prose-free; a surface projects it, never reconstructs it. * The shape is the schema-owned RouteRankingRationale (snake_case) so it can be * persisted verbatim as RunTelemetry.routing_rationale. */ export declare function explainRanking(candidates: RouterCandidate[], context: RouteContext): RouteRankingRationale; //# sourceMappingURL=router.d.ts.map