1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Hybrid attn+SSM engine stub (Jamba / LFM2 / Nemotron-H / Qwen3.5 GDN / …).
//!
//! Fail-closed at load via [`HybridEngine::reject`] (used by
//! [`crate::engine_factory`] for `nemotron_h` and other hybrid arches).
//! Qwen-style GDN math: [`crate::gdn`]. GGUF hparams + GDN weight load
//! skeleton: [`crate::hybrid_gguf_loader`] (`try_load` still
//! `UnsupportedFeature` until this engine assembles layers for serve).
use thiserror::Error;
#[derive(Debug, Error)]
#[error("hybrid engine not implemented for architecture {arch}")]
pub struct HybridUnavailable {
pub arch: String,
}
/// Placeholder hybrid serve handle.
///
/// Holds the GGUF arch string and an optional note. Construction is via
/// [`Self::stub`]; the factory still calls [`Self::reject`]. GGUF→GDN
/// weight probing lives in [`crate::hybrid_gguf_loader::try_load`].
#[derive(Debug)]
pub struct HybridEngine {
pub arch: String,
/// e.g. that GDN + loader skeleton exist but assemble/serve is incomplete.
pub note: Option<String>,
}
impl HybridEngine {
/// Fail-closed entry used by the engine factory until HybridEngine assemble lands.
pub fn reject(arch: &str) -> Result<(), HybridUnavailable> {
Err(HybridUnavailable {
arch: arch.to_string(),
})
}
/// Non-serving stub: records arch + note that GDN + hybrid_gguf_loader
/// exist but serve assemble is not wired.
pub fn stub(arch: &str) -> Self {
Self {
arch: arch.to_string(),
note: Some(
"GDN + hybrid_gguf_loader skeleton exist; HybridEngine assemble/serve not wired — factory still reject()"
.into(),
),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn reject_is_fail_closed() {
assert!(HybridEngine::reject("jamba").is_err());
assert!(HybridEngine::reject("nemotron_h").is_err());
}
#[test]
fn stub_holds_arch_and_gdn_note() {
let eng = HybridEngine::stub("qwen35");
assert_eq!(eng.arch, "qwen35");
let note = eng.note.expect("note");
assert!(note.contains("GDN"));
assert!(note.contains("hybrid_gguf_loader"));
}
}