File size: 2,189 Bytes
224e773 | 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 69 70 71 72 73 | //! # Hyperkitty Routing Pipeline
//!
//! A complete 11-stage routing pipeline for intelligent message dispatch across expert agents.
//!
//! ## Pipeline Stages
//!
//! 1. **RegexParser** β tokenize input, reject blocked patterns
//! 2. **ASTBuilder** β construct typed inverted AST
//! 3. **SymbolicGraph** β convert to weighted adjacency matrix
//! 4. **JordanTransformer** β spectral radius, Jordan decomposition
//! 5. **JacobianLens** β route sensitivity, dead paths
//! 6. **ConstraintEval** β evaluate validity predicates
//! 7. **SparseActivation** β expert activation set
//! 8. **RoutingNodes** β convert activations to nodes
//! 9. **NANDFilter** β remove incompatible routes
//! 10. **AgentDispatch** β execute admitted experts
//! 11. **MergeOutput** β recombine under merge policy
pub mod pipeline;
pub mod nodes;
pub mod dispatch;
pub mod qra_dispatch;
pub use pipeline::{RoutingPipeline, PipelineState};
pub use nodes::RoutingNode;
pub use dispatch::Dispatcher;
pub use qra_dispatch::{QRADispatcher, QRADispatchResult};
/// Route a message through the complete 11-stage pipeline
pub fn route_message(input: &str) -> hyperkitty_core::Result<String> {
let pipeline = RoutingPipeline::new();
pipeline.process(input)
}
/// Route a message with custom dispatcher
pub fn route_with_dispatcher(
input: &str,
_dispatcher: &mut Dispatcher,
) -> hyperkitty_core::Result<String> {
route_message(input)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_route_message_valid_input() {
let result = route_message("test input");
assert!(result.is_ok());
}
#[test]
fn test_route_message_empty_input() {
let result = route_message("");
assert!(result.is_err());
}
#[test]
fn test_route_message_contains_output() {
let result = route_message("hello world");
assert!(result.is_ok());
assert!(result.unwrap().contains("routed"));
}
#[test]
fn test_route_with_dispatcher() {
let mut dispatcher = Dispatcher::new();
let result = route_with_dispatcher("test", &mut dispatcher);
assert!(result.is_ok());
}
}
|