use anyhow::Result;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SpawnConfig {
pub description: String,
pub working_directory: Option<String>,
pub max_iterations: Option<u32>,
pub enable_validation: Option<bool>,
pub build_type: Option<String>,
pub extra: Option<Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AgentInfo {
pub agent_id: String,
pub status: String,
pub task_description: String,
pub iterations: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AgentResult {
pub agent_id: String,
pub success: bool,
pub summary: String,
pub iterations: u32,
}
#[async_trait]
pub trait AgentManager: Send + Sync {
async fn spawn_agent(&self, config: SpawnConfig) -> Result<String>;
async fn list_agents(&self) -> Result<Vec<AgentInfo>>;
async fn agent_status(&self, agent_id: &str) -> Result<AgentInfo>;
async fn stop_agent(&self, agent_id: &str) -> Result<()>;
async fn await_agent(&self, agent_id: &str, timeout_secs: Option<u64>) -> Result<AgentResult>;
async fn pool_stats(&self) -> Result<Value>;
async fn file_locks(&self) -> Result<Value>;
}