leviath_agent_client/lib.rs
1//! # Leviath Agent Client Protocol
2//!
3//! Wire types and Leviath mappings for the [Agent **Client** Protocol][acp] - the
4//! JSON-RPC 2.0 protocol agent hosts (Zed, Gas City, …) use to drive a headless
5//! agent over **stdio**.
6//!
7//! ## Naming
8//!
9//! The bare acronym "ACP" is deliberately never used unqualified anywhere in this
10//! workspace: it is claimed by two unrelated protocols. This crate implements the
11//! Agent **Client** Protocol (JSON-RPC over stdio, the one implemented here). The
12//! Agent **Communication** Protocol (a REST + SSE API from the BeeAI project,
13//! since folded into A2A) is a different thing entirely and is not implemented
14//! anywhere in this workspace.
15//!
16//! ## Scope
17//!
18//! This crate is deliberately **pure**: wire types plus total functions over
19//! them. It has no transport, no I/O, no async runtime, and no knowledge of the
20//! Leviath daemon. The stdio server that drives it lives in `leviath-cli`
21//! (`commands::agent_client`).
22//!
23//! Framing is **newline-delimited JSON**: exactly one compact JSON message per
24//! line. See [`protocol::MAX_FRAME_BYTES`] for the size ceiling this implies.
25//!
26//! [acp]: https://agentclientprotocol.com
27
28pub mod mapping;
29pub mod protocol;
30
31pub use mapping::{
32 flatten_prompt, is_permission_request, parse_region_markers, permission_request,
33 stop_reason_for, stop_reason_for_label,
34};
35pub use protocol::{
36 AgentCapabilities, AgentInfo, ContentBlock, EmbeddedResource, InitializeParams,
37 InitializeResult, JsonRpcError, JsonRpcMessage, MAX_FRAME_BYTES, PROTOCOL_VERSION,
38 PermissionOutcome, PromptCapabilities, RequestPermissionResult, SessionCancelParams,
39 SessionNewParams, SessionNewResult, SessionPromptParams, SessionPromptResult, SessionUpdate,
40 SessionUpdateParams, StopReason, error_codes,
41};