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