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
59
60
61
62
63
64
65
66
//! Agents that speak the Agent Client Protocol (ACP).
//!
//! [ACP](https://agentclientprotocol.com) is an open protocol between
//! editors and coding agents: JSON-RPC over the agent's standard input and
//! output. Many agents speak it, natively or through an adapter; the
//! [`registry`] lists them and how to start them. One
//! [`AcpProvider`] drives one such agent, given a command that starts it
//! (a [`Launch`]).
//!
//! Each live session is its own agent process. Stubb starts it, completes
//! `initialize` (protocol version 1), and creates the session with
//! `session/new` in the session's folder, or loads a stored one with
//! `session/resume` or `session/load`, whichever the agent offers. Turns are
//! `session/prompt` requests; their `session/update` notifications become
//! Stubb's turn events, `session/cancel` interrupts them, and the agent's
//! `session/request_permission` requests follow Stubb's
//! [request flow](crate::request).
//!
//! Stubb offers the agent its file system, restricted to the session's
//! folder (and, for reading, its additional folders), but no terminals:
//! agents run commands themselves. Images are sent only to agents that
//! accept them.
//!
//! Models and efforts come from the session's configuration options of
//! category `model` and `thought_level`; an agent without them has one
//! model, `default`. Its modes (a `mode` option, or ACP session modes) are
//! available through [`Session::modes`](crate::Session::modes) and [`Session::set_mode`](crate::Session::set_mode). Reading
//! models needs a session, so [`AcpProvider::catalog`] starts the agent and
//! creates a session in the system's temporary folder.
//!
//! Stored sessions are listed through `session/list` when the agent offers
//! it. ACP has no way to read a stored session's turns without loading it,
//! so [`Provider::list_turns`](crate::Provider::list_turns) is unsupported, as are account quotas.
//!
//! ```no_run
//! # async fn demo() -> stubb::Result<()> {
//! use stubb::providers::acp::{AcpConfig, AcpProvider, Launch};
//! use stubb::{Provider, session};
//!
//! let launch = Launch::new("npx").args(["-y", "@agentclientprotocol/claude-agent-acp"]);
//! let provider = AcpProvider::new(AcpConfig::new("claude-acp", "Claude Agent", launch));
//! let session = provider
//! .start_session(session::Spec {
//! cwd: "/path/to/project".into(),
//! settings: Default::default(),
//! })
//! .await?;
//! # Ok(())
//! # }
//! ```
pub use ;
use connection;
pub use Launch;
pub use ;