pub mod agent;
pub mod coordination;
pub mod error;
pub mod patterns;
pub mod task;
pub mod trust;
pub use agent::{Agent, AgentId};
pub use coordination::{Coalition, CoordinationEngine};
pub use error::{CoalescentError, Result};
pub use patterns::{CoordinationPattern, PatternFactory};
pub use task::Task;
pub use trust::{TrustScore, TrustManager};
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_basic_coordination() -> Result<()> {
let agent = Agent::new("test-agent", "Test Agent")?;
let engine = CoordinationEngine::new();
engine.register_agent(agent).await?;
let task = Task::new("Test coordination task");
let _result = engine.coalesce_around_task(task).await?;
Ok(())
}
#[test]
fn test_agent_creation() -> Result<()> {
let agent = Agent::new("test-agent", "Test Agent")?;
assert_eq!(agent.name, "Test Agent");
assert!(agent.capabilities.is_empty());
Ok(())
}
#[test]
fn test_agent_with_capabilities() -> Result<()> {
let capabilities = vec!["reasoning", "analysis"];
let agent = Agent::with_capabilities("test-id", "Test Agent", capabilities)?;
assert_eq!(agent.name, "Test Agent");
assert_eq!(agent.capabilities.len(), 2);
assert!(agent.has_capability("reasoning"));
assert!(agent.has_capability("analysis"));
Ok(())
}
#[test]
fn test_task_creation() {
let task = Task::new("Test task");
assert_eq!(task.title, "Test task");
assert_eq!(task.priority, task::Priority::Medium);
}
#[test]
fn test_task_with_priority() {
let task = Task::new("High priority task").priority(task::Priority::High);
assert_eq!(task.priority, task::Priority::High);
}
}