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;
13#[cfg(feature = "unstable_proxy_chains")]
14mod proxy;
15mod rpc;
16mod tool_call;
17
18pub use crate::rpc::{JsonRpcBatch, JsonRpcMessage, Notification};
19pub use agent::*;
20pub use client::*;
21pub use content::*;
22use derive_more::{Display, From};
23pub use elicitation::*;
24pub use error::*;
25pub use ext::*;
26#[cfg(feature = "unstable_mcp_over_acp")]
27pub use mcp::*;
28pub use plan::*;
29pub use protocol_level::*;
30#[cfg(feature = "unstable_proxy_chains")]
31pub use proxy::*;
32pub use rpc::*;
33pub use serde_json::value::RawValue;
34pub use tool_call::*;
35
36use serde::{Deserialize, Serialize};
37use std::sync::Arc;
38
39/// A unique identifier for a conversation session between a client and agent.
40///
41/// Each session has its own context, conversation history, and state, so one
42/// agent can run several independent sessions.
43///
44/// See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/v1/session-setup#session-id)
45#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Display, From)]
47#[serde(transparent)]
48#[from(Arc<str>, String, &'static str)]
49#[non_exhaustive]
50pub struct SessionId(pub Arc<str>);
51
52impl SessionId {
53    /// Wraps a protocol string as a typed [`SessionId`].
54    #[must_use]
55    pub fn new(id: impl Into<Arc<str>>) -> Self {
56        Self(id.into())
57    }
58}