1#![warn(missing_docs)]
48#![warn(clippy::all)]
49#![allow(clippy::module_name_repetitions, clippy::must_use_candidate)]
50
51pub mod consciousness;
52pub mod error;
53pub mod types;
54pub mod vector3d;
55
56pub mod nano_agent;
58
59pub mod temporal_lead;
61pub mod strange_attractor;
62
63#[cfg(feature = "quantum")]
65pub mod quantum_container;
66#[cfg(feature = "consciousness")]
67pub mod temporal_consciousness;
68pub mod lipschitz_loop;
69pub mod retrocausal;
70pub mod self_modifying;
71
72pub use error::{LoopError, Result};
74pub use nano_agent::{NanoAgent, NanoScheduler, SchedulerConfig, SchedulerTopology, TickResult};
75pub use temporal_lead::TemporalLeadPredictor;
76pub use types::{Context, LoopConfig, Policy, ScalarReasoner, SimpleCritic, SafeReflector, StrangeLoop};
77pub use vector3d::Vector3D;
78
79pub const VERSION: &str = env!("CARGO_PKG_VERSION");
81
82pub const BUILD_TIME: &str = "unknown";
84
85pub const GIT_SHA: &str = "unknown";
87
88pub const BUILD_INFO: &str = concat!(
90 "Strange Loop v", env!("CARGO_PKG_VERSION"),
91 " built for framework with thousands of tiny agents"
92);
93
94#[cfg(test)]
95mod tests {
96 use super::*;
97 use std::collections::HashMap;
98
99 #[test]
100 fn test_basic_strange_loop() {
101 let mut context = HashMap::from([("x".to_string(), 10.0)]);
102 let reasoner = ScalarReasoner::new(0.0, 0.1);
103 let critic = SimpleCritic::new();
104 let reflector = SafeReflector::new();
105
106 let config = LoopConfig {
107 max_iterations: 100,
108 max_duration_ns: 1_000_000, convergence_threshold: 1e-6,
110 lipschitz_constant: 0.8,
111 enable_consciousness: false,
112 enable_quantum: false,
113 enable_simd: false,
114 };
115
116 let mut loop_engine = StrangeLoop::new(reasoner, critic, reflector, config);
117 let result = loop_engine.run(&mut context);
118
119 assert!(result.is_ok());
120 let final_x = context.get("x").unwrap();
121 assert!(*final_x < 1.0); }
123
124 #[test]
125 fn test_nano_agent_system() {
126 let config = SchedulerConfig {
127 topology: SchedulerTopology::RoundRobin,
128 run_duration_ns: 1_000_000, tick_duration_ns: 100_000, max_agents: 5,
131 bus_capacity: 100,
132 enable_tracing: false,
133 };
134
135 let scheduler = NanoScheduler::new(config);
136 assert_eq!(scheduler.agent_count(), 0);
137 }
138
139 #[test]
140 fn test_temporal_prediction() {
141 let mut predictor = TemporalLeadPredictor::new(1_000_000, 100); let prediction = predictor.predict_future(vec![1.0, 2.0, 3.0]);
145 assert_eq!(prediction.len(), 3);
146
147 for &pred in &prediction {
149 assert!(pred.is_finite());
150 }
151 }
152
153 #[test]
154 fn test_version_info() {
155 assert!(!VERSION.is_empty());
156 assert!(!BUILD_TIME.is_empty());
157 assert!(!GIT_SHA.is_empty());
158 }
159}