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
//! # pi-codes
//!
//! Typed Rust SDK for the [pi coding agent](https://github.com/earendil-works/pi)
//! (`@earendil-works/pi-coding-agent`): serde models of the
//! `pi --mode json` JSONL event stream and the `pi --mode rpc`
//! stdin/stdout command protocol, plus an async (Tokio) RPC client.
//!
//! ```no_run
//! # #[cfg(feature = "async-client")]
//! # async fn demo() -> pi_codes::Result<()> {
//! use pi_codes::{PiRpcClient, RpcCommand};
//!
//! let mut client = PiRpcClient::start().await?;
//! let state = client.request_ok(RpcCommand::GetState { id: None }).await?;
//! println!("session: {:?}", state.data);
//! client.shutdown().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Wire contract
//!
//! - RPC framing is strict JSONL: records split on `\n` only (`\r`
//! tolerated); U+2028/U+2029 are legal inside strings and must not
//! split records.
//! - Unknown event types decode to [`io::PiEvent::Unknown`] with the
//! payload preserved — ignore them rather than treating them as
//! errors, so CLI upgrades degrade soft.
//! - Unmodeled commands can be sent via [`rpc::RpcCommand::Raw`].
//!
//! The version convention matches the sibling crates: the crate version
//! names the pi release the live suite last passed against
//! ([`version::tested_cli_version`]).
pub use ;
pub use ;
pub use ;
pub use ;
pub use PiRpcClient;