use serde::{Deserialize, Serialize};
use tokio::sync::mpsc;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AgentType {
Search,
Extract,
Verify,
Synthesize,
}
impl std::fmt::Display for AgentType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
AgentType::Search => write!(f, "Search"),
AgentType::Extract => write!(f, "Extract"),
AgentType::Verify => write!(f, "Verify"),
AgentType::Synthesize => write!(f, "Synthesize"),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AmrsContradiction {
pub claim: String,
pub source_a: String,
pub source_b: String,
pub source_a_says: String,
pub source_b_says: String,
pub severity: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuditEntry {
pub timestamp: chrono::DateTime<chrono::Utc>,
pub agent: AgentType,
pub action: String,
pub detail: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AmrsFinding {
pub claim: String,
pub confidence: f64,
pub source_indices: Vec<usize>,
pub evidence_type: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AmrsSource {
pub url: String,
pub title: String,
pub content: String,
pub content_hash: String,
}
#[derive(Debug)]
pub enum AgentMessage {
SearchComplete {
sub_query: String,
results: Vec<crate::types::ResultItem>,
follow_up_queries: Vec<String>,
},
ExtractComplete {
sources: Vec<AmrsSource>,
},
VerifyComplete {
findings: Vec<AmrsFinding>,
contradictions: Vec<AmrsContradiction>,
},
SynthesisComplete {
report: String,
audit_entries: Vec<AuditEntry>,
},
SpawnSearch {
query: String,
depth: usize,
},
SpawnExtract {
urls: Vec<String>,
query: String,
},
SpawnVerify {
sources: Vec<AmrsSource>,
query: String,
},
SpawnSynthesize {
findings: Vec<AmrsFinding>,
sources: Vec<AmrsSource>,
query: String,
},
Shutdown,
ProgressUpdate {
agent_type: AgentType,
message: String,
progress: f64,
},
}
pub type AgentSender = mpsc::Sender<AgentMessage>;
pub type AgentReceiver = mpsc::Receiver<AgentMessage>;