Skip to main content

agent_client_protocol_schema/v1/
mod.rs

1//! Agent Client Protocol version 1 types.
2
3mod agent;
4mod client;
5mod content;
6mod elicitation;
7mod error;
8mod ext;
9#[cfg(feature = "unstable_mcp_over_acp")]
10mod mcp;
11#[cfg(feature = "unstable_nes")]
12mod nes;
13mod plan;
14mod protocol_level;
15mod tool_call;
16
17pub use crate::rpc::{JsonRpcBatch, JsonRpcMessage, Notification, Request, RequestId};
18pub use agent::*;
19pub use client::*;
20pub use content::*;
21use derive_more::{Display, From};
22pub use elicitation::*;
23pub use error::*;
24pub use ext::*;
25#[cfg(feature = "unstable_mcp_over_acp")]
26pub use mcp::*;
27#[cfg(feature = "unstable_nes")]
28pub use nes::*;
29pub use plan::*;
30pub use protocol_level::*;
31pub use serde_json::value::RawValue;
32pub use tool_call::*;
33
34/// JSON-RPC response envelope using this protocol version's error type.
35pub type Response<Result> = crate::rpc::Response<Result, Error>;
36
37use serde::{Deserialize, Serialize};
38use std::sync::Arc;
39
40/// A unique identifier for a conversation session between a client and agent.
41///
42/// Sessions maintain their own context, conversation history, and state,
43/// allowing multiple independent interactions with the same agent.
44///
45/// See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)
46#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
47#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Display, From)]
48#[serde(transparent)]
49#[from(Arc<str>, String, &'static str)]
50#[non_exhaustive]
51pub struct SessionId(pub Arc<str>);
52
53impl SessionId {
54    /// Wraps a protocol string as a typed [`SessionId`].
55    #[must_use]
56    pub fn new(id: impl Into<Arc<str>>) -> Self {
57        Self(id.into())
58    }
59}