SNAPKITTYWEST's picture
push from SNAPKITTYWEST/hyperkitty-constraint-dsl
224e773 verified
Raw
History Blame Contribute Delete
2.19 kB
//! # 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());
}
}