pub mod types;
pub mod traits;
pub use types::*;
pub use traits::*;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const NAME: &str = env!("CARGO_PKG_NAME");
pub mod error {
use thiserror::Error;
#[derive(Error, Debug)]
pub enum OmegaError {
#[error("Intelligence not found: {0}")]
IntelligenceNotFound(String),
#[error("Memory not found: {0}")]
MemoryNotFound(String),
#[error("Loop not found: {0}")]
LoopNotFound(String),
#[error("Invalid tier: {0}")]
InvalidTier(String),
#[error("Invalid loop type: {0}")]
InvalidLoopType(String),
#[error("Operation failed: {0}")]
OperationFailed(String),
#[error("Serialization error: {0}")]
SerializationError(#[from] serde_json::Error),
#[error("Unknown error: {0}")]
Unknown(String),
}
}
pub use error::OmegaError;
#[cfg(test)]
mod tests {
use super::*;
use chrono::Utc;
#[test]
fn test_create_intelligence() {
let architecture = Architecture {
id: "test-arch".to_string(),
name: "Test Architecture".to_string(),
paradigm: Paradigm::Neural,
substrate: SubstrateType::Digital,
fitness: None,
lineage: vec![],
created_at: Utc::now(),
};
let intelligence = Intelligence::new("Test AI".to_string(), architecture);
assert_eq!(intelligence.name, "Test AI");
assert_eq!(intelligence.generation, 0);
assert_eq!(intelligence.status, IntelligenceStatus::Initializing);
}
#[test]
fn test_memory_tiers() {
let tiers = MemoryTier::all_tiers();
assert_eq!(tiers.len(), 12);
assert_eq!(tiers[0], MemoryTier::Immediate);
assert_eq!(tiers[11], MemoryTier::Cosmic);
}
#[test]
fn test_create_memory() {
let memory = Memory::new(
MemoryTier::Semantic,
MemoryType::Knowledge,
MemoryContent::Text("Test memory".to_string()),
0.8,
);
assert_eq!(memory.tier, MemoryTier::Semantic);
assert!(!memory.is_expired());
assert_eq!(memory.metadata.importance, 0.8);
}
#[test]
fn test_temporal_loops() {
let loops = LoopType::all_loops();
assert_eq!(loops.len(), 7);
assert_eq!(loops[0], LoopType::Reflexive);
assert_eq!(loops[6], LoopType::Transcendent);
}
#[test]
fn test_loop_cycle() {
let mut temporal_loop = TemporalLoop::new(
LoopType::Adaptive,
"Test Loop".to_string(),
"Test Description".to_string(),
);
let input = CycleInput {
data: std::collections::HashMap::new(),
context: "test".to_string(),
objectives: vec!["learn".to_string()],
};
let cycle_id = temporal_loop.start_cycle(input);
assert!(!cycle_id.is_empty());
assert!(temporal_loop.current_cycle.is_some());
}
}