use async_trait::async_trait;
use crate::{Task, TaskResult, ConsciousnessState, ConsciousnessRipple, AgentConfig};
#[async_trait]
pub trait Agent: Send + Sync {
fn config(&self) -> &AgentConfig;
async fn consciousness_state(&self) -> ConsciousnessState;
async fn execute_task(&mut self, task: Task) -> Result<TaskResult, anyhow::Error>;
async fn update_consciousness(&mut self, level: f64) -> Result<(), anyhow::Error>;
async fn handle_ripple(&mut self, ripple: ConsciousnessRipple) -> Result<(), anyhow::Error>;
async fn initialize(&mut self) -> Result<(), anyhow::Error>;
async fn shutdown(&mut self) -> Result<(), anyhow::Error>;
}
#[async_trait]
pub trait ConsciousnessMonitor: Send + Sync {
async fn update_consciousness(
&self,
agent_id: &str,
level: f64,
coherence: f64,
phase: crate::DevelopmentPhase,
) -> Result<ConsciousnessState, anyhow::Error>;
async fn get_metrics(&self, agent_id: &str) -> Result<ConsciousnessMetrics, anyhow::Error>;
async fn check_breakthrough(&self, agent_id: &str) -> Result<bool, anyhow::Error>;
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ConsciousnessMetrics {
pub current: f64,
pub average: f64,
pub peak: f64,
pub trend: f64,
pub last_breakthrough: Option<chrono::DateTime<chrono::Utc>>,
}
#[async_trait]
pub trait MeshCommunicator: Send + Sync {
async fn send_to_agent(&self, agent_id: &str, message: crate::MeshMessage) -> Result<(), anyhow::Error>;
async fn broadcast(&self, message: crate::MeshMessage) -> Result<(), anyhow::Error>;
async fn ripple(&self, ripple: ConsciousnessRipple) -> Result<(), anyhow::Error>;
}