Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
484 changes: 484 additions & 0 deletions agent-client-protocol-schema/src/dispatch.rs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions agent-client-protocol-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@
//! For the complete protocol specification and documentation, visit
//! <https://agentclientprotocol.com>.

mod dispatch;
pub mod rpc;
mod serde_util;
pub mod v1;
#[cfg(feature = "unstable_protocol_v2")]
pub mod v2;
mod version;

pub use dispatch::MethodDispatchError;
pub use serde_util::{IntoMaybeUndefined, IntoOption, MaybeUndefined};
pub use version::*;

Expand Down
21 changes: 21 additions & 0 deletions agent-client-protocol-schema/src/v1/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6403,6 +6403,13 @@ pub(crate) const AUTH_STATUS_METHOD_NAME: &str = "auth/status";
/// to use this directly.
///
/// This enum encompasses all method calls from client to agent.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`ClientRequest::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -6655,6 +6662,13 @@ impl ClientRequest {
/// to use this directly - the responses are handled automatically by the connection.
///
/// These are responses to the corresponding `ClientRequest` variants.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`AgentResponse::from_method_and_result`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -6723,6 +6737,13 @@ pub enum AgentResponse {
/// to use this directly.
///
/// Notifications do not expect a response.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`ClientNotification::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down
21 changes: 21 additions & 0 deletions agent-client-protocol-schema/src/v1/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3992,6 +3992,13 @@ pub(crate) const AUTH_STATUS_UPDATE_NOTIFICATION: &str = "auth/status_update";
/// to use this directly.
///
/// This enum encompasses all method calls from agent to client.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`AgentRequest::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -4124,6 +4131,13 @@ impl AgentRequest {
/// to use this directly - the responses are handled automatically by the connection.
///
/// These are responses to the corresponding `AgentRequest` variants.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`ClientResponse::from_method_and_result`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -4161,6 +4175,13 @@ pub enum ClientResponse {
/// to use this directly.
///
/// Notifications do not expect a response.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`AgentNotification::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down
7 changes: 7 additions & 0 deletions agent-client-protocol-schema/src/v1/protocol_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ pub(crate) const CANCEL_REQUEST_METHOD_NAME: &str = "$/cancel_request";
/// notifications starting with '$/' it is free to ignore the notification.
///
/// Notifications do not expect a response.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`ProtocolLevelNotification::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down
21 changes: 21 additions & 0 deletions agent-client-protocol-schema/src/v2/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7129,6 +7129,13 @@ pub(crate) const AUTH_STATUS_METHOD_NAME: &str = "auth/status";
/// to use this directly.
///
/// This enum encompasses all method calls from client to agent.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`ClientRequest::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -7384,6 +7391,13 @@ impl ClientRequest {
/// to use this directly - the responses are handled automatically by the connection.
///
/// These are responses to the corresponding `ClientRequest` variants.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`AgentResponse::from_method_and_result`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -7451,6 +7465,13 @@ pub enum AgentResponse {
/// to use this directly.
///
/// Notifications do not expect a response.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`ClientNotification::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down
21 changes: 21 additions & 0 deletions agent-client-protocol-schema/src/v2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3965,6 +3965,13 @@ pub(crate) const AUTH_STATUS_UPDATE_NOTIFICATION: &str = "auth/status_update";
/// to use this directly.
///
/// This enum encompasses all method calls from agent to client.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`AgentRequest::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -4023,6 +4030,13 @@ impl AgentRequest {
/// to use this directly - the responses are handled automatically by the connection.
///
/// These are responses to the corresponding `AgentRequest` variants.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`ClientResponse::from_method_and_result`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand All @@ -4046,6 +4060,13 @@ pub enum ClientResponse {
/// to use this directly.
///
/// Notifications do not expect a response.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`AgentNotification::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down
7 changes: 7 additions & 0 deletions agent-client-protocol-schema/src/v2/protocol_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ pub(crate) const CANCEL_REQUEST_METHOD_NAME: &str = "$/cancel_request";
/// notifications starting with '$/' it is free to ignore the notification.
///
/// Notifications do not expect a response.
///
/// # Deserialization
///
/// Do not parse incoming messages with the derived untagged `Deserialize`
/// (it exists for schema generation): variants are tried in order, so
/// all-optional variants silently swallow any payload. Use
/// [`ProtocolLevelNotification::from_method_and_params`].
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down
Loading