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