car-external-agents 0.21.0

Detection of installed agentic CLIs (Claude Code, Codex, Gemini) for the Common Agent Runtime.
Documentation
//! External agents — detect installed agentic CLIs and treat them
//! as agents available through CAR.
//!
//! This is the **third kind of agent** in CAR's taxonomy, sibling to:
//!
//! - **Lifecycle agents** (`car_registry::supervisor`) — long-lived
//!   child processes the daemon babysits.
//! - **In-process runners** (`car_multi::AgentRunner`) — caller-
//!   implemented model loops invoked per task.
//!
//! External agents are **caller-installed CLIs spawned per task** —
//! `claude`, `codex`, `gemini`, etc. The daemon discovers them at
//! boot (and on demand) but does not own their lifecycle. They run
//! only when explicitly selected.
//!
//! See `docs/proposals/external-agent-detection.md` for the
//! architectural rationale.
//!
//! ## Phase 1 scope (this crate, today)
//!
//! - **Detection.** [`detect`] scans `$PATH` for known adapter
//!   binaries, probes version + auth state, returns a stable
//!   [`ExternalAgentSpec`] list.
//!
//! - **No invocation yet.** The per-task adapter that speaks the
//!   JSON stdio protocol lands in Phase 2 alongside the
//!   `agents.invoke_external` JSON-RPC method.
//!
//! ## Example
//!
//! ```no_run
//! # async fn run() {
//! let specs = car_external_agents::detect().await;
//! for spec in &specs {
//!     println!(
//!         "{} at {} (auth: {:?})",
//!         spec.display_name,
//!         spec.binary_path.display(),
//!         spec.auth_kind
//!     );
//! }
//! # }
//! ```

mod adapters;
mod detection;
pub mod health;
pub mod multi;
pub mod protocol;
pub mod runner;
mod types;

pub use detection::{detect, detect_with_health};
pub use health::{
    check_all as health_all, check_one as health_one, ExternalAgentHealth, HealthStatus,
};
pub use multi::{
    extract_invoke_options, map_invoke_to_agent_output, run_external, ExternalAwareRunner,
    EXTERNAL_PREFIX,
};
pub use protocol::{parse_line, ResultEventData, StreamEvent, ToolUseRequest};
pub use runner::{
    invoke, invoke_claude_code, invoke_codex, invoke_gemini, invoke_with_emitter, InvokeError,
    InvokeOptions, InvokeResult, StreamEventEmitter,
};
pub use types::{AdapterId, AuthKind, Capabilities, ExternalAgentSpec};