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
51
52
53
54
55
56
57
58
//! # cli-agents
//!
//! Build agentic apps on top of your users' existing AI subscriptions.
//!
//! Instead of requiring API keys or managing token costs, `cli-agents` spawns
//! the AI CLI tools users already have installed — Claude Code, Codex, or
//! Gemini CLI — and provides a unified interface for streaming events,
//! tool calls, cancellation, and structured results.
//!
//! ## Quick start
//!
//! ```no_run
//! use cli_agents::{run, RunOptions, StreamEvent, CliName};
//! use std::sync::Arc;
//!
//! #[tokio::main]
//! async fn main() {
//! let opts = RunOptions {
//! cli: Some(CliName::Claude),
//! task: "What is 2+2?".into(),
//! skip_permissions: true,
//! ..Default::default()
//! };
//!
//! let handle = run(opts, Some(Arc::new(|event: StreamEvent| {
//! match &event {
//! StreamEvent::TextDelta { text } => print!("{text}"),
//! StreamEvent::Done { result } => println!("\n\nDone: {:?}", result.success),
//! _ => {}
//! }
//! })));
//!
//! let result = handle.result.await.unwrap().unwrap();
//! println!("Success: {}", result.success);
//! }
//! ```
/// Default max stdout buffer size: 10 MB.
///
/// Shared across all adapters to prevent OOM if a CLI produces unexpectedly
/// large output. Override per-run via [`RunOptions::max_output_bytes`].
pub const DEFAULT_MAX_OUTPUT_BYTES: usize = 10 * 1024 * 1024;
// Re-export primary API
pub use ;
pub use ;
pub use ;
pub use ;