Expand description
§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
[dependencies]
cap-rs = { version = "0.1", features = ["stream-json"] }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:?}");
}Modules§
- core
- Core protocol types — events, frames, content blocks, usage.
- driver
- Driver backends — concrete implementations that drive a CLI agent.
Constants§
- CRATE_
NAME - Crate name (build-time constant).
- CRATE_
VERSION - Crate version (build-time constant).
- PROTOCOL_
VERSION - CAP protocol version targeted by this crate.