/** * Zod schemas mirroring JSON-schema contracts and data-model entities. * * Canonical contract sources: * - specs/001-build-smart-router/contracts/routing-request.schema.json * - specs/001-build-smart-router/contracts/routing-decision.schema.json * - specs/001-build-smart-router/data-model.md */ import { z } from 'zod'; export declare const TurnTypeSchema: z.ZodEnum<{ planning: "planning"; tool_result: "tool_result"; subagent: "subagent"; main_loop: "main_loop"; unknown: "unknown"; }>; export declare const PinReasonSchema: z.ZodEnum<{ initial: "initial"; user_forced: "user_forced"; loop_escalation: "loop_escalation"; compaction: "compaction"; cache_economics: "cache_economics"; context_overflow: "context_overflow"; complexity_upgrade: "complexity_upgrade"; complexity_downgrade: "complexity_downgrade"; }>; export declare const ComplexityScorerConfigSchema: z.ZodObject<{ output_to_input_ratio: z.ZodDefault; upgrade_score_threshold: z.ZodDefault; downgrade_score_threshold: z.ZodDefault; confidence_threshold: z.ZodDefault; min_lightweight_streak: z.ZodDefault; min_dwell_ms: z.ZodDefault; capability_override_gap: z.ZodDefault; }, z.core.$strip>; export type ComplexityScorerConfig = z.infer; export declare const DEFAULT_COMPLEXITY_SCORER_CONFIG: { output_to_input_ratio: number; upgrade_score_threshold: number; downgrade_score_threshold: number; confidence_threshold: number; min_lightweight_streak: number; min_dwell_ms: number; capability_override_gap: number; }; export declare const TierSchema: z.ZodEnum<{ "zero-tier": "zero-tier"; "economical-cloud": "economical-cloud"; "frontier-cloud": "frontier-cloud"; }>; export declare const RoutingStageSchema: z.ZodEnum<{ triage: "triage"; turn_envelope: "turn_envelope"; session_pin: "session_pin"; local_zero: "local_zero"; hydra_match: "hydra_match"; fallback: "fallback"; }>; export declare const PriceSourceSchema: z.ZodEnum<{ override: "override"; registry: "registry"; yaml_fallback: "yaml_fallback"; }>; export declare const MessageRoleSchema: z.ZodEnum<{ user: "user"; assistant: "assistant"; system: "system"; tool: "tool"; }>; export declare const MessageSchema: z.ZodObject<{ role: z.ZodEnum<{ user: "user"; assistant: "assistant"; system: "system"; tool: "tool"; }>; content: z.ZodString; tool_call_id: z.ZodOptional; tool_calls: z.ZodOptional>; is_error: z.ZodOptional; status: z.ZodOptional; }, z.core.$strip>; export declare const RoutingRequestSchema: z.ZodObject<{ request_id: z.ZodString; session_id: z.ZodString; prompt_text: z.ZodString; messages: z.ZodOptional; content: z.ZodString; tool_call_id: z.ZodOptional; tool_calls: z.ZodOptional>; is_error: z.ZodOptional; status: z.ZodOptional; }, z.core.$strip>>>; turn_type: z.ZodOptional>; compaction_flag: z.ZodOptional; force_model_id: z.ZodOptional; candidate_model_id: z.ZodOptional; estimated_input_tokens: z.ZodOptional; }, z.core.$strip>; export declare const SessionPinSchema: z.ZodObject<{ session_id: z.ZodString; pinned_model_id: z.ZodString; pin_reason: z.ZodEnum<{ initial: "initial"; user_forced: "user_forced"; loop_escalation: "loop_escalation"; compaction: "compaction"; cache_economics: "cache_economics"; context_overflow: "context_overflow"; complexity_upgrade: "complexity_upgrade"; complexity_downgrade: "complexity_downgrade"; }>; has_ever_switched: z.ZodBoolean; consecutive_upstream_errors: z.ZodNumber; consecutive_tool_failures: z.ZodNumber; last_tool_failure_signature: z.ZodNullable; created_at: z.ZodString; updated_at: z.ZodString; }, z.core.$strip>; export declare const ModelCapabilitiesSchema: z.ZodObject<{ reasoning: z.ZodNumber; code_gen: z.ZodNumber; tool_use: z.ZodNumber; }, z.core.$strip>; export declare const ModelPerformanceSchema: z.ZodObject<{ latency_p50_ms: z.ZodOptional; verbosity_factor: z.ZodOptional; cache_friendly: z.ZodOptional; }, z.core.$strip>; export declare const ModelPricingSchema: z.ZodObject<{ registry_key: z.ZodOptional; fallback_cost_per_1m: z.ZodNumber; }, z.core.$strip>; export declare const ModelLimitsSchema: z.ZodObject<{ max_input_tokens: z.ZodOptional; max_output_tokens: z.ZodOptional; }, z.core.$strip>; export declare const ModelProfileSchema: z.ZodObject<{ id: z.ZodString; tier: z.ZodEnum<{ "zero-tier": "zero-tier"; "economical-cloud": "economical-cloud"; "frontier-cloud": "frontier-cloud"; }>; provider: z.ZodString; endpoint: z.ZodOptional; capabilities: z.ZodObject<{ reasoning: z.ZodNumber; code_gen: z.ZodNumber; tool_use: z.ZodNumber; }, z.core.$strip>; performance: z.ZodOptional; verbosity_factor: z.ZodOptional; cache_friendly: z.ZodOptional; }, z.core.$strip>>; pricing: z.ZodObject<{ registry_key: z.ZodOptional; fallback_cost_per_1m: z.ZodNumber; }, z.core.$strip>; limits: z.ZodOptional; max_output_tokens: z.ZodOptional; }, z.core.$strip>>; healthy: z.ZodOptional; }, z.core.$strip>; /** Zod-validated model profile — aligned with {@link ModelProfile} in entities.ts. */ export type ValidatedModelProfile = z.infer; export declare const CandidateScoreSchema: z.ZodObject<{ model_id: z.ZodString; score: z.ZodNumber; shortfall: z.ZodNumber; rejected_reason: z.ZodNullable; }, z.core.$strip>; export declare const RoutingDecisionSchema: z.ZodObject<{ request_id: z.ZodString; selected_model_id: z.ZodString; tier: z.ZodEnum<{ "zero-tier": "zero-tier"; "economical-cloud": "economical-cloud"; "frontier-cloud": "frontier-cloud"; }>; stage: z.ZodEnum<{ triage: "triage"; turn_envelope: "turn_envelope"; session_pin: "session_pin"; local_zero: "local_zero"; hydra_match: "hydra_match"; fallback: "fallback"; }>; reason_code: z.ZodString; candidates: z.ZodOptional; }, z.core.$strip>>>; estimated_cost_usd: z.ZodOptional; routing_latency_ms: z.ZodNumber; pin_reason: z.ZodNullable>; }, z.core.$strip>; export declare const PriceCatalogSchema: z.ZodObject<{ registry_snapshot: z.ZodRecord; registry_limits_snapshot: z.ZodOptional; max_output_tokens: z.ZodOptional; }, z.core.$strip>>>; user_overrides: z.ZodRecord; last_updated: z.ZodString; source: z.ZodEnum<{ override: "override"; registry: "registry"; yaml_fallback: "yaml_fallback"; }>; }, z.core.$strip>; export declare const RoutingTelemetrySchema: z.ZodObject<{ timestamp: z.ZodString; session_id: z.ZodString; request_id: z.ZodString; turn_type: z.ZodString; stage: z.ZodString; reason_code: z.ZodString; selected_model_id: z.ZodString; estimated_cost_usd: z.ZodNumber; routing_latency_ms: z.ZodNumber; pin_reason: z.ZodNullable; }, z.core.$strip>; export declare const FrugalityConfigSchema: z.ZodObject<{ lambda_cost: z.ZodNumber; lambda_latency: z.ZodNumber; lambda_verbosity: z.ZodNumber; }, z.core.$strip>; export declare const LoopEscalationConfigSchema: z.ZodObject<{ threshold: z.ZodNumber; }, z.core.$strip>; export declare const PricingConfigSchema: z.ZodObject<{ staleness_days: z.ZodNumber; }, z.core.$strip>; export declare const LocalConfigSchema: z.ZodObject<{ min_memory_gb_full: z.ZodNumber; min_memory_gb_classification: z.ZodNumber; battery_threshold_pct: z.ZodNumber; }, z.core.$strip>; /** Rolling median local throughput gate knobs (SP-163, #84). */ export declare const ThroughputConfigSchema: z.ZodObject<{ window_size: z.ZodNumber; threshold_tps: z.ZodNumber; }, z.core.$strip>; export type ThroughputConfig = z.infer; /** Throughput defaults per routing-roadmap.md §3 / #84 (SP-163). */ export declare const DEFAULT_THROUGHPUT_CONFIG: Readonly; /** * Pre-local_zero tool-use / capability gate knobs (SP-177, #98). * Defaults keep true trivial traffic on the cheap local path. */ export declare const LocalZeroConfigSchema: z.ZodObject<{ enabled: z.ZodDefault; max_tool_use_requirement: z.ZodNumber; }, z.core.$strip>; export type LocalZeroConfig = z.infer; /** Safe defaults: gate on, ceiling above trivial (0) but below agentic tool cues. */ export declare const DEFAULT_LOCAL_ZERO_CONFIG: Readonly; /** HyDRA text encoder selection (SP-156, #80). */ export declare const EncoderSchema: z.ZodEnum<{ minilm: "minilm"; granite: "granite"; }>; export type Encoder = z.infer; export declare const DEFAULT_ENCODER: Encoder; /** HyDRA requirement head mode (SP-158, #81). */ export declare const HydraHeadsSchema: z.ZodEnum<{ learned_projection: "learned_projection"; modernbert_k4: "modernbert_k4"; }>; export type HydraHeads = z.infer; export declare const DEFAULT_HYDRA_HEADS: HydraHeads; export declare const HydraConfigSchema: z.ZodObject<{ artifact_cache_path: z.ZodString; encoder: z.ZodDefault>; hydra_heads: z.ZodDefault>; }, z.core.$strip>; export declare const LowIntensityWeightsSchema: z.ZodObject<{ prompt_shortness: z.ZodNumber; token_shortness: z.ZodNumber; cyclomatic_low: z.ZodNumber; trivial_signal: z.ZodNumber; complex_inverse: z.ZodNumber; triage_verdict: z.ZodNumber; turn_type: z.ZodNumber; no_tool_context: z.ZodNumber; message_shallow: z.ZodNumber; prose_ratio: z.ZodNumber; requirement_low: z.ZodNumber; cluster_signal: z.ZodNumber; }, z.core.$strip>; export declare const LowIntensityConfigSchema: z.ZodObject<{ weights: z.ZodObject<{ prompt_shortness: z.ZodNumber; token_shortness: z.ZodNumber; cyclomatic_low: z.ZodNumber; trivial_signal: z.ZodNumber; complex_inverse: z.ZodNumber; triage_verdict: z.ZodNumber; turn_type: z.ZodNumber; no_tool_context: z.ZodNumber; message_shallow: z.ZodNumber; prose_ratio: z.ZodNumber; requirement_low: z.ZodNumber; cluster_signal: z.ZodNumber; }, z.core.$strip>; high_threshold: z.ZodNumber; low_threshold: z.ZodNumber; p_success_alpha: z.ZodNumber; }, z.core.$strip>; export declare const RoutingClustersConfigSchema: z.ZodObject<{ config_path: z.ZodString; }, z.core.$strip>; /** SAAR operator knobs (SP-121, #72). */ export declare const SaarConfigSchema: z.ZodObject<{ planning_turn_buffer: z.ZodNumber; prefix_cache_weight: z.ZodNumber; idle_timeout_seconds: z.ZodNumber; switch_threshold: z.ZodNumber; }, z.core.$strip>; export type SaarConfig = z.infer; /** Compressed context limits for planning delegate sub-calls (SP-142, #71). */ export declare const CompressedContextSpecSchema: z.ZodObject<{ max_messages: z.ZodNumber; max_tokens: z.ZodNumber; exclude_execution_history: z.ZodBoolean; }, z.core.$strip>; export type CompressedContextSpec = z.infer; /** Planning delegate operator knobs (SP-142, #71; timeouts SP-213, #120). */ export declare const PlanningDelegateConfigSchema: z.ZodObject<{ enabled: z.ZodBoolean; compressed_context: z.ZodObject<{ max_messages: z.ZodNumber; max_tokens: z.ZodNumber; exclude_execution_history: z.ZodBoolean; }, z.core.$strip>; global_timeout_ms: z.ZodNumber; sub_call_timeout_ms: z.ZodNumber; }, z.core.$strip>; export type PlanningDelegateConfig = z.infer; /** Virtual cost v2 operator knobs (SP-148, #78). */ export declare const VirtualCostV2ConfigSchema: z.ZodObject<{ window_duration_seconds: z.ZodNumber; lambda_decay_exponent: z.ZodNumber; lambda_max_multiplier: z.ZodNumber; quota_arbitrage_weight: z.ZodNumber; exhaustion_risk_weight: z.ZodNumber; exhaustion_risk_threshold: z.ZodNumber; prefix_cache_discount: z.ZodNumber; prefix_cache_weight: z.ZodNumber; }, z.core.$strip>; export type VirtualCostV2Config = z.infer; /** Virtual cost v2 defaults per routing-roadmap.md §2 P2 (SP-148). */ export declare const DEFAULT_VIRTUAL_COST_V2_CONFIG: Readonly; export declare const QuotaWindowPositionSchema: z.ZodObject<{ remaining_window_fraction: z.ZodNumber; elapsed_window_seconds: z.ZodOptional; }, z.core.$strip>; /** * Degraded neural failover sandwich knobs (SP-212, #119). * Fail-open chain when the encoder/neural stage errors or exceeds budget: * learned map → operator pattern pack → safe default. Never crashes the host. */ export declare const DegradedRouteConfigSchema: z.ZodObject<{ enabled: z.ZodDefault; learned_min_confidence: z.ZodNumber; learned_max_entries: z.ZodNumber; pattern_tool_use_ceiling: z.ZodNumber; }, z.core.$strip>; export type DegradedRouteConfig = z.infer; /** * Workload heat map + soft fleet affinity knobs (SP-215, #115). * Colibri learning-cache analog: privacy-safe histogram of successful routes * (requirement fingerprint / cluster id → tier/model success counts) that * soft-biases first-turn expected-cost selection. The bias is SOFT — it only * discounts the heat-preferred tier's expected cost and can never override a * hard capability shortfall, the frontier–economical price-delta gate, pin * cache economics, or absolute release gates. No frugality defaults or * absolute gates are flipped by this config. */ export declare const WorkloadHeatConfigSchema: z.ZodObject<{ enabled: z.ZodDefault; bias_strength: z.ZodNumber; min_samples: z.ZodNumber; min_success_margin: z.ZodNumber; max_entries: z.ZodNumber; live_update_enabled: z.ZodDefault; hysteresis_band: z.ZodNumber; swap_cap: z.ZodNumber; }, z.core.$strip>; export type WorkloadHeatConfig = z.infer; /** Workload heat defaults per #115 (SP-215). No frugality/gate flips. */ export declare const DEFAULT_WORKLOAD_HEAT_CONFIG: Readonly; /** Degraded sandwich defaults per #119 (SP-212). */ export declare const DEFAULT_DEGRADED_ROUTE_CONFIG: Readonly; /** * Speculative prewarm knobs (SP-217, #117 — Colibri PILOT pattern). * Optional local/encoder prewarm within a strict TTFT deadline, with an * adaptive acceptance guard. Default OFF; fail open to the normal route. * Pre-generation only — the warm probe never waits on generated tokens. */ export declare const SpeculativePrewarmConfigSchema: z.ZodObject<{ enabled: z.ZodDefault; deadline_ms: z.ZodDefault; min_acceptance_rate: z.ZodDefault; min_attempts_before_guard: z.ZodDefault; }, z.core.$strip>; export type SpeculativePrewarmConfig = z.infer; /** Speculative prewarm defaults per #117 (SP-217): default off, fail open. */ export declare const DEFAULT_SPECULATIVE_PREWARM_CONFIG: Readonly; /** SAAR defaults per routing-roadmap.md §2 P0 (SP-121). */ export declare const DEFAULT_SAAR_CONFIG: Readonly; /** Planning delegate defaults per routing-roadmap.md §2 P0 / #71 (SP-142). * Timeout bounds mirror llm-use worker discipline (SP-213, #120): * 120s global stage cap (WORKER_GLOBAL_TIMEOUT), 30s per sub-call (WORKER_CALL_TIMEOUT). */ export declare const DEFAULT_PLANNING_DELEGATE_CONFIG: Readonly; /** Merge planning delegate env overrides onto defaults (invalid env values are ignored). */ export declare function resolvePlanningDelegateConfigFromEnv(base?: PlanningDelegateConfig): PlanningDelegateConfig; /** Merge SAAR env overrides onto defaults (invalid env values are ignored). */ export declare function resolveSaarConfigFromEnv(base?: SaarConfig): SaarConfig; /** Per-session SAAR runtime state (SP-121 types; logic in SP-122). */ export declare const SaarSessionStateSchema: z.ZodObject<{ turn_index: z.ZodNumber; hard_lock: z.ZodBoolean; last_activity_at: z.ZodString; }, z.core.$strip>; /** Stable snake_case cluster id — used as reason-code suffix (`cluster_${id}`). */ export declare const RoutingClusterIdSchema: z.ZodString; export declare const RoutingClusterSchema: z.ZodObject<{ id: z.ZodString; tier_bias: z.ZodEnum<{ "zero-tier": "zero-tier"; "economical-cloud": "economical-cloud"; "frontier-cloud": "frontier-cloud"; }>; reference_prompts: z.ZodArray; min_similarity: z.ZodNumber; min_margin: z.ZodNumber; }, z.core.$strip>; export declare const RoutingClustersFileSchema: z.ZodObject<{ clusters: z.ZodArray; reference_prompts: z.ZodArray; min_similarity: z.ZodNumber; min_margin: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>; export declare const OperatorConfigSchema: z.ZodObject<{ frugality: z.ZodObject<{ lambda_cost: z.ZodNumber; lambda_latency: z.ZodNumber; lambda_verbosity: z.ZodNumber; }, z.core.$strip>; loop_escalation: z.ZodObject<{ threshold: z.ZodNumber; }, z.core.$strip>; pricing: z.ZodObject<{ staleness_days: z.ZodNumber; }, z.core.$strip>; local: z.ZodObject<{ min_memory_gb_full: z.ZodNumber; min_memory_gb_classification: z.ZodNumber; battery_threshold_pct: z.ZodNumber; }, z.core.$strip>; hydra: z.ZodObject<{ artifact_cache_path: z.ZodString; encoder: z.ZodDefault>; hydra_heads: z.ZodDefault>; }, z.core.$strip>; low_intensity: z.ZodObject<{ weights: z.ZodObject<{ prompt_shortness: z.ZodNumber; token_shortness: z.ZodNumber; cyclomatic_low: z.ZodNumber; trivial_signal: z.ZodNumber; complex_inverse: z.ZodNumber; triage_verdict: z.ZodNumber; turn_type: z.ZodNumber; no_tool_context: z.ZodNumber; message_shallow: z.ZodNumber; prose_ratio: z.ZodNumber; requirement_low: z.ZodNumber; cluster_signal: z.ZodNumber; }, z.core.$strip>; high_threshold: z.ZodNumber; low_threshold: z.ZodNumber; p_success_alpha: z.ZodNumber; }, z.core.$strip>; saar: z.ZodObject<{ planning_turn_buffer: z.ZodNumber; prefix_cache_weight: z.ZodNumber; idle_timeout_seconds: z.ZodNumber; switch_threshold: z.ZodNumber; }, z.core.$strip>; planning_delegate: z.ZodObject<{ enabled: z.ZodBoolean; compressed_context: z.ZodObject<{ max_messages: z.ZodNumber; max_tokens: z.ZodNumber; exclude_execution_history: z.ZodBoolean; }, z.core.$strip>; global_timeout_ms: z.ZodNumber; sub_call_timeout_ms: z.ZodNumber; }, z.core.$strip>; throughput: z.ZodOptional>; local_zero: z.ZodOptional; max_tool_use_requirement: z.ZodNumber; }, z.core.$strip>>; routing_clusters: z.ZodOptional>; degraded_route: z.ZodOptional; learned_min_confidence: z.ZodNumber; learned_max_entries: z.ZodNumber; pattern_tool_use_ceiling: z.ZodNumber; }, z.core.$strip>>; workload_heat: z.ZodOptional; bias_strength: z.ZodNumber; min_samples: z.ZodNumber; min_success_margin: z.ZodNumber; max_entries: z.ZodNumber; live_update_enabled: z.ZodDefault; hysteresis_band: z.ZodNumber; swap_cap: z.ZodNumber; }, z.core.$strip>>; speculative_prewarm: z.ZodOptional; deadline_ms: z.ZodDefault; min_acceptance_rate: z.ZodDefault; min_attempts_before_guard: z.ZodDefault; }, z.core.$strip>>; complexity_scorer: z.ZodDefault; upgrade_score_threshold: z.ZodDefault; downgrade_score_threshold: z.ZodDefault; confidence_threshold: z.ZodDefault; min_lightweight_streak: z.ZodDefault; min_dwell_ms: z.ZodDefault; capability_override_gap: z.ZodDefault; }, z.core.$strip>>; pin_only_fallback: z.ZodDefault; }, z.core.$strip>; export type OperatorConfig = z.infer; export type HydraConfig = z.infer; export type LowIntensityConfig = z.infer; //# sourceMappingURL=schemas.d.ts.map