//! Core pluggable traits and shared domain types: WeightStore quantization formats, //! Speculative Drafting (local or Lyra LAN), and Prefetching. /// `(layer, expert)` identity of one MoE expert (shared by cc, tm, sp). #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct ExpertKey { pub layer: u16, pub expert: u16, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum QuantFormat { Bf16, Fp32, Q8G64T16, Q4G64T16, NvFp4, MxFp8, } #[derive(Debug, Clone)] pub struct DraftProposal { pub tokens: Vec, /// Optional scalar draft probabilities `q(x_j)` for lossless non-greedy Leviathan verification. pub draft_probs: Option>, } /// Pluggable speculative drafter: /// - Local MTP (1-layer) / Block-Diffusion preview /// - Remote LAN drafter on **Lyra** (`~128 B/step`, `~0.3 ms` RTT on 2.5 Gbps Ethernet) pub trait DraftProvider: Send { fn name(&self) -> &'static str; fn propose(&mut self, prefix_tail: &[i32], max_k: usize) -> Result; fn notify_accepted(&mut self, accepted_tokens: &[i32]) -> Result<(), String>; fn reset(&mut self); } /// Pluggable MoE prefetch advisor: /// - Local router lookahead (`h_{L-1} -> W_router[L]`) /// - Remote domain classifier on **Lyra** (`Dante/letteratura` vs `Lean 4/matematica` -> NVMe pre-warm) pub trait PrefetchAdvisor: Send { fn on_prompt_domain(&mut self, domain_tag: &str) -> Vec; fn on_layer_routed(&mut self, layer: u16, active_experts: &[u16]) -> Vec; }