Skip to content
Merged
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
2 changes: 0 additions & 2 deletions agent-client-protocol-schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ workspace = true
[features]
unstable = [
"unstable_auth_methods",
"unstable_cancel_request",
"unstable_elicitation",
"unstable_llm_providers",
"unstable_mcp_over_acp",
Expand All @@ -39,7 +38,6 @@ unstable = [
# version, so it must be opted into explicitly.
unstable_protocol_v2 = []
unstable_auth_methods = []
unstable_cancel_request = []
unstable_elicitation = []
unstable_llm_providers = []
unstable_mcp_over_acp = []
Expand Down
13 changes: 0 additions & 13 deletions agent-client-protocol-schema/src/v1/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,10 @@ impl Error {
ErrorCode::InternalError.into()
}

/// **UNSTABLE**
///
/// This capability is not part of the spec yet, and may be removed or changed at any point.
///
/// Request was cancelled.
///
/// Execution of the method was aborted either due to a cancellation request from the caller
/// or because of resource constraints or shutdown.
#[cfg(feature = "unstable_cancel_request")]
#[must_use]
pub fn request_cancelled() -> Self {
ErrorCode::RequestCancelled.into()
Expand Down Expand Up @@ -183,11 +178,6 @@ pub enum ErrorCode {
#[schemars(transform = error_code_transform)]
#[strum(to_string = "Internal error")]
InternalError, // -32603
#[cfg(feature = "unstable_cancel_request")]
/// **UNSTABLE**
///
/// This capability is not part of the spec yet, and may be removed or changed at any point.
///
/// Execution of the method was aborted either due to a cancellation request from the caller or
/// because of resource constraints or shutdown.
#[schemars(transform = error_code_transform)]
Expand Down Expand Up @@ -227,7 +217,6 @@ impl From<i32> for ErrorCode {
-32601 => ErrorCode::MethodNotFound,
-32602 => ErrorCode::InvalidParams,
-32603 => ErrorCode::InternalError,
#[cfg(feature = "unstable_cancel_request")]
-32800 => ErrorCode::RequestCancelled,
-32000 => ErrorCode::AuthRequired,
-32002 => ErrorCode::ResourceNotFound,
Expand All @@ -246,7 +235,6 @@ impl From<ErrorCode> for i32 {
ErrorCode::MethodNotFound => -32601,
ErrorCode::InvalidParams => -32602,
ErrorCode::InternalError => -32603,
#[cfg(feature = "unstable_cancel_request")]
ErrorCode::RequestCancelled => -32800,
ErrorCode::AuthRequired => -32000,
ErrorCode::ResourceNotFound => -32002,
Expand Down Expand Up @@ -275,7 +263,6 @@ fn error_code_transform(schema: &mut Schema) {
"MethodNotFound" => ErrorCode::MethodNotFound,
"InvalidParams" => ErrorCode::InvalidParams,
"InternalError" => ErrorCode::InternalError,
#[cfg(feature = "unstable_cancel_request")]
"RequestCancelled" => ErrorCode::RequestCancelled,
"AuthRequired" => ErrorCode::AuthRequired,
"ResourceNotFound" => ErrorCode::ResourceNotFound,
Expand Down
2 changes: 0 additions & 2 deletions agent-client-protocol-schema/src/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod mcp;
#[cfg(feature = "unstable_nes")]
mod nes;
mod plan;
#[cfg(feature = "unstable_cancel_request")]
mod protocol_level;
mod tool_call;

Expand All @@ -30,7 +29,6 @@ pub use mcp::*;
#[cfg(feature = "unstable_nes")]
pub use nes::*;
pub use plan::*;
#[cfg(feature = "unstable_cancel_request")]
pub use protocol_level::*;
pub use serde_json::value::RawValue;
pub use tool_call::*;
Expand Down
17 changes: 1 addition & 16 deletions agent-client-protocol-schema/src/v1/protocol_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ use crate::IntoOption;

use super::{Meta, RequestId};

/// **UNSTABLE**
///
/// This capability is not part of the spec yet, and may be removed or changed at any point.
///
/// Notification to cancel an ongoing request.
///
/// See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
#[cfg(feature = "unstable_cancel_request")]
#[serde_as]
#[skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
Expand All @@ -35,7 +30,6 @@ pub struct CancelRequestNotification {
pub meta: Option<Meta>,
}

#[cfg(feature = "unstable_cancel_request")]
impl CancelRequestNotification {
/// Builds [`CancelRequestNotification`] with the required notification fields set; optional fields start unset or empty.
#[must_use]
Expand Down Expand Up @@ -67,13 +61,11 @@ impl CancelRequestNotification {
#[non_exhaustive]
pub struct GeneralMethodNames {
/// Method name for protocol-level request cancellation notifications.
#[cfg(feature = "unstable_cancel_request")]
pub cancel_request: &'static str,
}

/// Constant containing all agent method names.
pub const PROTOCOL_LEVEL_METHOD_NAMES: GeneralMethodNames = GeneralMethodNames {
#[cfg(feature = "unstable_cancel_request")]
cancel_request: CANCEL_REQUEST_METHOD_NAME,
};

Expand All @@ -96,25 +88,19 @@ pub(crate) const CANCEL_REQUEST_METHOD_NAME: &str = "$/cancel_request";
#[schemars(inline)]
#[non_exhaustive]
pub enum ProtocolLevelNotification {
/// **UNSTABLE**
///
/// This capability is not part of the spec yet, and may be removed or
/// changed at any point.
///
/// Cancels an ongoing request.
///
/// This is a notification sent by the side that sent a request to cancel that request.
///
/// Upon receiving this notification, the receiver:
///
/// 1. MUST cancel the corresponding request activity and all nested activities
/// 1. MAY cancel the corresponding request activity and all nested activities
/// 2. MAY send any pending notifications.
/// 3. MUST send one of these responses for the original request:
/// - Valid response with appropriate data (partial results or cancellation marker)
/// - Error response with code `-32800` (Cancelled)
///
/// See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
#[cfg(feature = "unstable_cancel_request")]
CancelRequestNotification(CancelRequestNotification),
}

Expand All @@ -123,7 +109,6 @@ impl ProtocolLevelNotification {
#[must_use]
pub fn method(&self) -> &str {
match self {
#[cfg(feature = "unstable_cancel_request")]
Self::CancelRequestNotification(..) => PROTOCOL_LEVEL_METHOD_NAMES.cancel_request,
}
}
Expand Down
4 changes: 0 additions & 4 deletions agent-client-protocol-schema/src/v2/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ impl IntoV2 for crate::v1::PlanEntryStatus {
}
}

#[cfg(feature = "unstable_cancel_request")]
impl IntoV1 for super::CancelRequestNotification {
type Output = crate::v1::CancelRequestNotification;

Expand All @@ -910,7 +909,6 @@ impl IntoV1 for super::CancelRequestNotification {
}
}

#[cfg(feature = "unstable_cancel_request")]
impl IntoV2 for crate::v1::CancelRequestNotification {
type Output = super::CancelRequestNotification;

Expand All @@ -923,7 +921,6 @@ impl IntoV2 for crate::v1::CancelRequestNotification {
}
}

#[cfg(feature = "unstable_cancel_request")]
impl IntoV1 for super::ProtocolLevelNotification {
type Output = crate::v1::ProtocolLevelNotification;

Expand All @@ -936,7 +933,6 @@ impl IntoV1 for super::ProtocolLevelNotification {
}
}

#[cfg(feature = "unstable_cancel_request")]
impl IntoV2 for crate::v1::ProtocolLevelNotification {
type Output = super::ProtocolLevelNotification;

Expand Down
13 changes: 0 additions & 13 deletions agent-client-protocol-schema/src/v2/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,10 @@ impl Error {
ErrorCode::InternalError.into()
}

/// **UNSTABLE**
///
/// This capability is not part of the spec yet, and may be removed or changed at any point.
///
/// Request was cancelled.
///
/// Execution of the method was aborted either due to a cancellation request from the caller
/// or because of resource constraints or shutdown.
#[cfg(feature = "unstable_cancel_request")]
#[must_use]
pub fn request_cancelled() -> Self {
ErrorCode::RequestCancelled.into()
Expand Down Expand Up @@ -183,11 +178,6 @@ pub enum ErrorCode {
#[schemars(transform = error_code_transform)]
#[strum(to_string = "Internal error")]
InternalError, // -32603
#[cfg(feature = "unstable_cancel_request")]
/// **UNSTABLE**
///
/// This capability is not part of the spec yet, and may be removed or changed at any point.
///
/// Execution of the method was aborted either due to a cancellation request from the caller or
/// because of resource constraints or shutdown.
#[schemars(transform = error_code_transform)]
Expand Down Expand Up @@ -227,7 +217,6 @@ impl From<i32> for ErrorCode {
-32601 => ErrorCode::MethodNotFound,
-32602 => ErrorCode::InvalidParams,
-32603 => ErrorCode::InternalError,
#[cfg(feature = "unstable_cancel_request")]
-32800 => ErrorCode::RequestCancelled,
-32000 => ErrorCode::AuthRequired,
-32002 => ErrorCode::ResourceNotFound,
Expand All @@ -246,7 +235,6 @@ impl From<ErrorCode> for i32 {
ErrorCode::MethodNotFound => -32601,
ErrorCode::InvalidParams => -32602,
ErrorCode::InternalError => -32603,
#[cfg(feature = "unstable_cancel_request")]
ErrorCode::RequestCancelled => -32800,
ErrorCode::AuthRequired => -32000,
ErrorCode::ResourceNotFound => -32002,
Expand Down Expand Up @@ -275,7 +263,6 @@ fn error_code_transform(schema: &mut Schema) {
"MethodNotFound" => ErrorCode::MethodNotFound,
"InvalidParams" => ErrorCode::InvalidParams,
"InternalError" => ErrorCode::InternalError,
#[cfg(feature = "unstable_cancel_request")]
"RequestCancelled" => ErrorCode::RequestCancelled,
"AuthRequired" => ErrorCode::AuthRequired,
"ResourceNotFound" => ErrorCode::ResourceNotFound,
Expand Down
2 changes: 0 additions & 2 deletions agent-client-protocol-schema/src/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ mod mcp;
#[cfg(feature = "unstable_nes")]
mod nes;
mod plan;
#[cfg(feature = "unstable_cancel_request")]
mod protocol_level;
pub(crate) mod schema_util;
mod tool_call;
Expand All @@ -42,7 +41,6 @@ pub use mcp::*;
#[cfg(feature = "unstable_nes")]
pub use nes::*;
pub use plan::*;
#[cfg(feature = "unstable_cancel_request")]
pub use protocol_level::*;
pub use serde_json::value::RawValue;
pub use tool_call::*;
Expand Down
17 changes: 1 addition & 16 deletions agent-client-protocol-schema/src/v2/protocol_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ use serde_with::{DefaultOnError, serde_as, skip_serializing_none};
use super::{Meta, RequestId};
use crate::IntoOption;

/// **UNSTABLE**
///
/// This capability is not part of the spec yet, and may be removed or changed at any point.
///
/// Notification to cancel an ongoing request.
///
/// See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
#[cfg(feature = "unstable_cancel_request")]
#[serde_as]
#[skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
Expand All @@ -34,7 +29,6 @@ pub struct CancelRequestNotification {
pub meta: Option<Meta>,
}

#[cfg(feature = "unstable_cancel_request")]
impl CancelRequestNotification {
/// Builds [`CancelRequestNotification`] with the required notification fields set; optional fields start unset or empty.
#[must_use]
Expand Down Expand Up @@ -66,13 +60,11 @@ impl CancelRequestNotification {
#[non_exhaustive]
pub struct GeneralMethodNames {
/// Method name for protocol-level request cancellation notifications.
#[cfg(feature = "unstable_cancel_request")]
pub cancel_request: &'static str,
}

/// Constant containing all agent method names.
pub const PROTOCOL_LEVEL_METHOD_NAMES: GeneralMethodNames = GeneralMethodNames {
#[cfg(feature = "unstable_cancel_request")]
cancel_request: CANCEL_REQUEST_METHOD_NAME,
};

Expand All @@ -95,25 +87,19 @@ pub(crate) const CANCEL_REQUEST_METHOD_NAME: &str = "$/cancel_request";
#[schemars(inline)]
#[non_exhaustive]
pub enum ProtocolLevelNotification {
/// **UNSTABLE**
///
/// This capability is not part of the spec yet, and may be removed or
/// changed at any point.
///
/// Cancels an ongoing request.
///
/// This is a notification sent by the side that sent a request to cancel that request.
///
/// Upon receiving this notification, the receiver:
///
/// 1. MUST cancel the corresponding request activity and all nested activities
/// 1. MAY cancel the corresponding request activity and all nested activities
/// 2. MAY send any pending notifications.
/// 3. MUST send one of these responses for the original request:
/// - Valid response with appropriate data (partial results or cancellation marker)
/// - Error response with code `-32800` (Cancelled)
///
/// See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
#[cfg(feature = "unstable_cancel_request")]
CancelRequestNotification(CancelRequestNotification),
}

Expand All @@ -122,7 +108,6 @@ impl ProtocolLevelNotification {
#[must_use]
pub fn method(&self) -> &str {
match self {
#[cfg(feature = "unstable_cancel_request")]
Self::CancelRequestNotification(..) => PROTOCOL_LEVEL_METHOD_NAMES.cancel_request,
}
}
Expand Down
7 changes: 5 additions & 2 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"protocol/v1/content",
"protocol/v1/tool-calls",
"protocol/v1/file-system",
"protocol/v1/cancellation",
"protocol/v1/terminals",
"protocol/v1/agent-plan",
"protocol/v1/session-modes",
Expand Down Expand Up @@ -126,6 +127,7 @@
"protocol/v2/prompt-lifecycle",
"protocol/v2/content",
"protocol/v2/tool-calls",
"protocol/v2/cancellation",
"protocol/v2/agent-plan",
"protocol/v2/session-config-options",
"protocol/v2/slash-commands",
Expand Down Expand Up @@ -209,7 +211,7 @@
},
{
"group": "Preview",
"pages": ["rfds/request-cancellation"]
"pages": []
},
{
"group": "Completed",
Expand All @@ -228,7 +230,8 @@
"rfds/session-usage",
"rfds/session-delete",
"rfds/model-config-category",
"rfds/rust-sdk-v1"
"rfds/rust-sdk-v1",
"rfds/request-cancellation"
]
}
]
Expand Down
Loading
Loading