aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / crates / spark-adapters / src / lib.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | pub mod curriculum; |
| 17 | pub mod distill; |
| 18 | pub mod models; |
| 19 | pub mod providers; |
| 20 | pub mod router; |
| 21 | pub mod vault; |
| 22 | pub mod verifier; |
| 23 | |
| 24 | pub use curriculum::{CurriculumEngine, CurriculumTrack}; |
| 25 | pub use distill::DistillationEngine; |
| 26 | pub use models::*; |
| 27 | pub use router::AdapterRouter; |
| 28 | pub use vault::*; |
| 29 | pub use verifier::Verifier; |
| 30 | |
| 31 | #[cfg(test)] |
| 32 | mod tests { |
| 33 | use super::*; |
| 34 | |
| 35 | #[test] |
| 36 | fn test_catalog_discovery() { |
| 37 | let router = AdapterRouter::new(); |
| 38 | let adapters = router.discover_adapters(); |
| 39 | assert!(!adapters.is_empty()); |
| 40 | assert!(adapters.iter().any(|a| a.id == "atlas-lightning-omni")); |
| 41 | assert!(adapters.iter().any(|a| a.id == "openai/gpt-4o")); |
| 42 | assert!(adapters |
| 43 | .iter() |
| 44 | .any(|a| a.id == "anthropic/claude-3-7-sonnet")); |
| 45 | } |
| 46 | |
| 47 | #[test] |
| 48 | fn test_router_resolution() { |
| 49 | let router = AdapterRouter::new(); |
| 50 | let (prov, endpoint, model, _) = router.resolve_route("anthropic/claude-3-7-sonnet"); |
| 51 | assert_eq!(prov, ProviderType::Anthropic); |
| 52 | assert!(endpoint.contains("anthropic")); |
| 53 | assert_eq!(model, "claude-3-7-sonnet-20250219"); |
| 54 | |
| 55 | let (prov, _endpoint, model, _) = router.resolve_route("openai/o3-mini"); |
| 56 | assert_eq!(prov, ProviderType::OpenAI); |
| 57 | assert_eq!(model, "o3-mini"); |
| 58 | } |
| 59 | |
| 60 | #[test] |
| 61 | fn test_unslop_verification() { |
| 62 | let clean = "Implementation verified with zero allocations."; |
| 63 | let out = Verifier::verify(clean, VerificationStrategy::UnslopStrict); |
| 64 | assert!(out.passed); |
| 65 | assert_eq!(out.score, 1.0); |
| 66 | |
| 67 | let dirty = "We will delve into this crucial topic."; |
| 68 | let out_dirty = Verifier::verify(dirty, VerificationStrategy::UnslopStrict); |
| 69 | assert!(!out_dirty.rule_violations.is_empty()); |
| 70 | assert!(out_dirty.score < 1.0); |
| 71 | } |
| 72 | |
| 73 | #[test] |
| 74 | fn test_distill_task_serialization() { |
| 75 | let task = DistillTask { |
| 76 | id: "task-001".to_string(), |
| 77 | task_type: TaskType::CodeSynthesis, |
| 78 | prompt: "Write an Axum handler for health checks".to_string(), |
| 79 | system_prompt: Some("You are AIEN Sovereign Architect.".to_string()), |
| 80 | teacher_model: "anthropic/claude-3-7-sonnet".to_string(), |
| 81 | student_model: Some("atlas-lightning-omni".to_string()), |
| 82 | verification_strategy: VerificationStrategy::CompilerCheck, |
| 83 | commit_to_cortex: true, |
| 84 | }; |
| 85 | |
| 86 | let json_str = serde_json::to_string(&task).expect("serialize"); |
| 87 | let parsed: DistillTask = serde_json::from_str(&json_str).expect("deserialize"); |
| 88 | assert_eq!(parsed.id, "task-001"); |
| 89 | assert_eq!(parsed.teacher_model, "anthropic/claude-3-7-sonnet"); |
| 90 | } |
| 91 | } |