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