1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! # cap-rs — Rust reference implementation of the CAP (CLI Agent Protocol).
//!
//! See <https://cap-protocol.org> for the protocol specification.
//!
//! ## Layout
//!
//! - [`core`] — protocol types (events, frames, capabilities, manifest).
//! Always available, no IO dependencies.
//! - [`driver`] — backends that drive an actual CLI agent.
//! Each backend is gated behind a feature flag.
//!
//! ## Quick start
//!
//! ```toml
//! [dependencies]
//! cap-rs = { version = "0.1", features = ["stream-json"] }
//! ```
//!
//! ```no_run
//! # #[cfg(feature = "stream-json")]
//! # async fn run() -> anyhow::Result<()> {
//! use cap_rs::driver::stream_json::ClaudeCodeDriver;
//! use cap_rs::core::{ClientFrame, Content};
//!
//! let mut driver = ClaudeCodeDriver::spawn(std::env::current_dir()?).await?;
//! driver.send(ClientFrame::Prompt {
//! content: vec![Content::Text("What is 2 + 2?".into())],
//! }).await?;
//!
//! while let Some(event) = driver.next_event().await {
//! println!("{event:?}");
//! }
//! # Ok(())
//! # }
//! ```
/// Crate name (build-time constant).
pub const CRATE_NAME: &str = env!;
/// Crate version (build-time constant).
pub const CRATE_VERSION: &str = env!;
/// CAP protocol version targeted by this crate.
pub const PROTOCOL_VERSION: &str = "cap-protocol/v1";