//! Built-in commodity agents for Common Agent Runtime.
//!
//! These are the agents every workflow needs but nobody should have to build.
//! They compose with car-multi's coordination patterns (swarm, pipeline,
//! supervisor) and use car-inference for model calls.
//!
//! ## Built-in Agents
//!
//! - **Researcher**: Search, read, gather → structured findings
//! - **Planner**: Goal → ordered action steps
//! - **Verifier**: Output + spec → pass/fail with reasons
//! - **Summarizer**: Long context → compressed handoff
//! - **Coordinator**: Goal → which agents + which pattern

pub mod coordinator;
pub mod planner;
pub mod researcher;
pub mod summarizer;
pub mod verifier;

pub use coordinator::Coordinator;
pub use planner::PlannerAgent;
pub use researcher::Researcher;
pub use summarizer::Summarizer;
pub use verifier::Verifier;

pub use car_search::indexer;
/// Compatibility re-export: `ReferenceMiner` / `Indexer` moved to the
/// dedicated `car-search` crate. This alias keeps callers that imported
/// `car_agents::reference_miner::*` working for one release. New code
/// should import from `car_search` directly.
pub use car_search::reference_miner;
pub use car_search::{
    CodeReference, IndexReport, Indexer, MiningError, MiningFilters, MiningQuery, MiningScope,
    ReferenceMiner,
};

use car_inference::InferenceEngine;
use std::sync::Arc;

/// Shared context for built-in agents.
#[derive(Clone)]
pub struct AgentContext {
    pub inference: Arc<InferenceEngine>,
}

/// Result from any built-in agent.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct AgentResult {
    pub agent: String,
    pub output: String,
    pub confidence: f64,
    pub model_used: String,
    pub latency_ms: u64,
}
