diff --git a/Cargo.toml b/Cargo.toml
index 2ff641af..81b25943 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,7 @@ unstable = [
"unstable_mcp_over_acp",
"unstable_nes",
"unstable_session_additional_directories",
+ "unstable_session_delete",
"unstable_session_fork",
"unstable_session_model",
"unstable_session_usage",
@@ -42,6 +43,7 @@ unstable_logout = []
unstable_mcp_over_acp = []
unstable_nes = []
unstable_session_additional_directories = []
+unstable_session_delete = []
unstable_session_fork = []
unstable_session_model = []
unstable_session_usage = []
diff --git a/docs/protocol/draft/schema-v2.mdx b/docs/protocol/draft/schema-v2.mdx
index 0450ceb6..9ab822f8 100644
--- a/docs/protocol/draft/schema-v2.mdx
+++ b/docs/protocol/draft/schema-v2.mdx
@@ -889,6 +889,64 @@ See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/exte
+
+### session/delete
+
+**UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Deletes an existing session.
+
+This method is only available if the agent advertises the `sessionCapabilities.delete` capability.
+
+#### DeleteSessionRequest
+
+**UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Request parameters for deleting a session.
+
+Only available if the Agent supports the `sessionCapabilities.delete` capability.
+
+**Type:** Object
+
+**Properties:**
+
+
+ The _meta property is reserved by ACP to allow clients and agents to attach additional
+metadata to their interactions. Implementations MUST NOT make assumptions about values at
+these keys.
+
+See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+
+
+SessionId} required>
+ The ID of the session to delete.
+
+
+#### DeleteSessionResponse
+
+**UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Response from deleting a session.
+
+**Type:** Object
+
+**Properties:**
+
+
+ The _meta property is reserved by ACP to allow clients and agents to attach additional
+metadata to their interactions. Implementations MUST NOT make assumptions about values at
+these keys.
+
+See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+
+
+
### session/fork
@@ -6225,6 +6283,14 @@ Whether the agent supports `additionalDirectories` on supported session lifecycl
SessionCloseCapabilities | null>} >
Whether the agent supports `session/close`.
+
+SessionDeleteCapabilities | null>} >
+ **UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Whether the agent supports `session/delete`.
+
SessionForkCapabilities | null>} >
**UNSTABLE**
@@ -6489,6 +6555,29 @@ Unique identifier for a session configuration option value.
**Type:** `string`
+## SessionDeleteCapabilities
+
+**UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Capabilities for the `session/delete` method.
+
+By supplying `\{\}` it means that the agent supports deletion of sessions.
+
+**Type:** Object
+
+**Properties:**
+
+
+ The _meta property is reserved by ACP to allow clients and agents to attach additional
+metadata to their interactions. Implementations MUST NOT make assumptions about values at
+these keys.
+
+See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+
+
+
## SessionForkCapabilities
**UNSTABLE**
diff --git a/docs/protocol/draft/schema.mdx b/docs/protocol/draft/schema.mdx
index 0450ceb6..9ab822f8 100644
--- a/docs/protocol/draft/schema.mdx
+++ b/docs/protocol/draft/schema.mdx
@@ -889,6 +889,64 @@ See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/exte
+
+### session/delete
+
+**UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Deletes an existing session.
+
+This method is only available if the agent advertises the `sessionCapabilities.delete` capability.
+
+#### DeleteSessionRequest
+
+**UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Request parameters for deleting a session.
+
+Only available if the Agent supports the `sessionCapabilities.delete` capability.
+
+**Type:** Object
+
+**Properties:**
+
+
+ The _meta property is reserved by ACP to allow clients and agents to attach additional
+metadata to their interactions. Implementations MUST NOT make assumptions about values at
+these keys.
+
+See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+
+
+SessionId} required>
+ The ID of the session to delete.
+
+
+#### DeleteSessionResponse
+
+**UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Response from deleting a session.
+
+**Type:** Object
+
+**Properties:**
+
+
+ The _meta property is reserved by ACP to allow clients and agents to attach additional
+metadata to their interactions. Implementations MUST NOT make assumptions about values at
+these keys.
+
+See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+
+
+
### session/fork
@@ -6225,6 +6283,14 @@ Whether the agent supports `additionalDirectories` on supported session lifecycl
SessionCloseCapabilities | null>} >
Whether the agent supports `session/close`.
+
+SessionDeleteCapabilities | null>} >
+ **UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Whether the agent supports `session/delete`.
+
SessionForkCapabilities | null>} >
**UNSTABLE**
@@ -6489,6 +6555,29 @@ Unique identifier for a session configuration option value.
**Type:** `string`
+## SessionDeleteCapabilities
+
+**UNSTABLE**
+
+This capability is not part of the spec yet, and may be removed or changed at any point.
+
+Capabilities for the `session/delete` method.
+
+By supplying `\{\}` it means that the agent supports deletion of sessions.
+
+**Type:** Object
+
+**Properties:**
+
+
+ The _meta property is reserved by ACP to allow clients and agents to attach additional
+metadata to their interactions. Implementations MUST NOT make assumptions about values at
+these keys.
+
+See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+
+
+
## SessionForkCapabilities
**UNSTABLE**
diff --git a/docs/rfds/session-delete.mdx b/docs/rfds/session-delete.mdx
index dc09e692..d203761c 100644
--- a/docs/rfds/session-delete.mdx
+++ b/docs/rfds/session-delete.mdx
@@ -138,5 +138,6 @@ The [`session/list` RFD](/rfds/session-list#what-about-session-deletion) explici
## Revision history
+- **2026-05-13**: Implemented as unstable schema feature (`unstable_session_delete`).
- **2025-02-03**: Fixed capability example to use agent capability (initialize response)
- **2025-01-24**: Initial draft
diff --git a/schema/meta.unstable.json b/schema/meta.unstable.json
index 6d1dd249..55aa8c26 100644
--- a/schema/meta.unstable.json
+++ b/schema/meta.unstable.json
@@ -18,6 +18,7 @@
"providers_set": "providers/set",
"session_cancel": "session/cancel",
"session_close": "session/close",
+ "session_delete": "session/delete",
"session_fork": "session/fork",
"session_list": "session/list",
"session_load": "session/load",
diff --git a/schema/meta.v2.unstable.json b/schema/meta.v2.unstable.json
index 462086fd..9c4b370a 100644
--- a/schema/meta.v2.unstable.json
+++ b/schema/meta.v2.unstable.json
@@ -18,6 +18,7 @@
"providers_set": "providers/set",
"session_cancel": "session/cancel",
"session_close": "session/close",
+ "session_delete": "session/delete",
"session_fork": "session/fork",
"session_list": "session/list",
"session_load": "session/load",
diff --git a/schema/schema.unstable.json b/schema/schema.unstable.json
index b419997a..357441b8 100644
--- a/schema/schema.unstable.json
+++ b/schema/schema.unstable.json
@@ -393,6 +393,14 @@
],
"title": "ForkSessionResponse"
},
+ {
+ "allOf": [
+ {
+ "$ref": "#/$defs/DeleteSessionResponse"
+ }
+ ],
+ "title": "DeleteSessionResponse"
+ },
{
"allOf": [
{
@@ -1233,6 +1241,15 @@
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForks an existing session to create a new independent session.\n\nThis method is only available if the agent advertises the `session.fork` capability.\n\nThe agent should create a new session with the same conversation context as the\noriginal, allowing operations like generating summaries without affecting the\noriginal session's history.",
"title": "ForkSessionRequest"
},
+ {
+ "allOf": [
+ {
+ "$ref": "#/$defs/DeleteSessionRequest"
+ }
+ ],
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nDeletes an existing session.\n\nThis method is only available if the agent advertises the `sessionCapabilities.delete` capability.",
+ "title": "DeleteSessionRequest"
+ },
{
"allOf": [
{
@@ -1907,6 +1924,41 @@
"required": ["currentModeId"],
"type": "object"
},
+ "DeleteSessionRequest": {
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for deleting a session.\n\nOnly available if the Agent supports the `sessionCapabilities.delete` capability.",
+ "properties": {
+ "_meta": {
+ "additionalProperties": true,
+ "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
+ "type": ["object", "null"]
+ },
+ "sessionId": {
+ "allOf": [
+ {
+ "$ref": "#/$defs/SessionId"
+ }
+ ],
+ "description": "The ID of the session to delete."
+ }
+ },
+ "required": ["sessionId"],
+ "type": "object",
+ "x-method": "session/delete",
+ "x-side": "agent"
+ },
+ "DeleteSessionResponse": {
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from deleting a session.",
+ "properties": {
+ "_meta": {
+ "additionalProperties": true,
+ "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
+ "type": ["object", "null"]
+ }
+ },
+ "type": "object",
+ "x-method": "session/delete",
+ "x-side": "agent"
+ },
"DidChangeDocumentNotification": {
"description": "Notification sent when a file is edited.",
"properties": {
@@ -5417,6 +5469,17 @@
],
"description": "Whether the agent supports `session/close`."
},
+ "delete": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/SessionDeleteCapabilities"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/delete`."
+ },
"fork": {
"anyOf": [
{
@@ -5691,6 +5754,17 @@
"description": "Unique identifier for a session configuration option value.",
"type": "string"
},
+ "SessionDeleteCapabilities": {
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/delete` method.\n\nBy supplying `{}` it means that the agent supports deletion of sessions.",
+ "properties": {
+ "_meta": {
+ "additionalProperties": true,
+ "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
+ "type": ["object", "null"]
+ }
+ },
+ "type": "object"
+ },
"SessionForkCapabilities": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/fork` method.\n\nBy supplying `{}` it means that the agent supports forking of sessions.",
"properties": {
diff --git a/schema/schema.v2.unstable.json b/schema/schema.v2.unstable.json
index b419997a..357441b8 100644
--- a/schema/schema.v2.unstable.json
+++ b/schema/schema.v2.unstable.json
@@ -393,6 +393,14 @@
],
"title": "ForkSessionResponse"
},
+ {
+ "allOf": [
+ {
+ "$ref": "#/$defs/DeleteSessionResponse"
+ }
+ ],
+ "title": "DeleteSessionResponse"
+ },
{
"allOf": [
{
@@ -1233,6 +1241,15 @@
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForks an existing session to create a new independent session.\n\nThis method is only available if the agent advertises the `session.fork` capability.\n\nThe agent should create a new session with the same conversation context as the\noriginal, allowing operations like generating summaries without affecting the\noriginal session's history.",
"title": "ForkSessionRequest"
},
+ {
+ "allOf": [
+ {
+ "$ref": "#/$defs/DeleteSessionRequest"
+ }
+ ],
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nDeletes an existing session.\n\nThis method is only available if the agent advertises the `sessionCapabilities.delete` capability.",
+ "title": "DeleteSessionRequest"
+ },
{
"allOf": [
{
@@ -1907,6 +1924,41 @@
"required": ["currentModeId"],
"type": "object"
},
+ "DeleteSessionRequest": {
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for deleting a session.\n\nOnly available if the Agent supports the `sessionCapabilities.delete` capability.",
+ "properties": {
+ "_meta": {
+ "additionalProperties": true,
+ "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
+ "type": ["object", "null"]
+ },
+ "sessionId": {
+ "allOf": [
+ {
+ "$ref": "#/$defs/SessionId"
+ }
+ ],
+ "description": "The ID of the session to delete."
+ }
+ },
+ "required": ["sessionId"],
+ "type": "object",
+ "x-method": "session/delete",
+ "x-side": "agent"
+ },
+ "DeleteSessionResponse": {
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from deleting a session.",
+ "properties": {
+ "_meta": {
+ "additionalProperties": true,
+ "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
+ "type": ["object", "null"]
+ }
+ },
+ "type": "object",
+ "x-method": "session/delete",
+ "x-side": "agent"
+ },
"DidChangeDocumentNotification": {
"description": "Notification sent when a file is edited.",
"properties": {
@@ -5417,6 +5469,17 @@
],
"description": "Whether the agent supports `session/close`."
},
+ "delete": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/SessionDeleteCapabilities"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/delete`."
+ },
"fork": {
"anyOf": [
{
@@ -5691,6 +5754,17 @@
"description": "Unique identifier for a session configuration option value.",
"type": "string"
},
+ "SessionDeleteCapabilities": {
+ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/delete` method.\n\nBy supplying `{}` it means that the agent supports deletion of sessions.",
+ "properties": {
+ "_meta": {
+ "additionalProperties": true,
+ "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
+ "type": ["object", "null"]
+ }
+ },
+ "type": "object"
+ },
"SessionForkCapabilities": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/fork` method.\n\nBy supplying `{}` it means that the agent supports forking of sessions.",
"properties": {
diff --git a/src/bin/generate.rs b/src/bin/generate.rs
index 4d96cf61..dc26ab9f 100644
--- a/src/bin/generate.rs
+++ b/src/bin/generate.rs
@@ -1128,6 +1128,7 @@ starting with '$/' it is free to ignore the notification."
"session/load" => self.agent.get("LoadSessionRequest").unwrap(),
"session/list" => self.agent.get("ListSessionsRequest").unwrap(),
"session/fork" => self.agent.get("ForkSessionRequest").unwrap(),
+ "session/delete" => self.agent.get("DeleteSessionRequest").unwrap(),
"session/resume" => self.agent.get("ResumeSessionRequest").unwrap(),
"session/set_mode" => self.agent.get("SetSessionModeRequest").unwrap(),
"session/set_config_option" => {
diff --git a/src/v1/agent.rs b/src/v1/agent.rs
index cd59e5fa..982506a4 100644
--- a/src/v1/agent.rs
+++ b/src/v1/agent.rs
@@ -1703,6 +1703,95 @@ impl CloseSessionResponse {
}
}
+// Delete session
+
+/// **UNSTABLE**
+///
+/// This capability is not part of the spec yet, and may be removed or changed at any point.
+///
+/// Request parameters for deleting a session.
+///
+/// Only available if the Agent supports the `sessionCapabilities.delete` capability.
+#[cfg(feature = "unstable_session_delete")]
+#[skip_serializing_none]
+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
+#[schemars(extend("x-side" = "agent", "x-method" = SESSION_DELETE_METHOD_NAME))]
+#[serde(rename_all = "camelCase")]
+#[non_exhaustive]
+pub struct DeleteSessionRequest {
+ /// The ID of the session to delete.
+ pub session_id: SessionId,
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[serde(rename = "_meta")]
+ pub meta: Option,
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl DeleteSessionRequest {
+ #[must_use]
+ pub fn new(session_id: impl Into) -> Self {
+ Self {
+ session_id: session_id.into(),
+ meta: None,
+ }
+ }
+
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[must_use]
+ pub fn meta(mut self, meta: impl IntoOption) -> Self {
+ self.meta = meta.into_option();
+ self
+ }
+}
+
+/// **UNSTABLE**
+///
+/// This capability is not part of the spec yet, and may be removed or changed at any point.
+///
+/// Response from deleting a session.
+#[cfg(feature = "unstable_session_delete")]
+#[skip_serializing_none]
+#[derive(Default, Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
+#[schemars(extend("x-side" = "agent", "x-method" = SESSION_DELETE_METHOD_NAME))]
+#[serde(rename_all = "camelCase")]
+#[non_exhaustive]
+pub struct DeleteSessionResponse {
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[serde(rename = "_meta")]
+ pub meta: Option,
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl DeleteSessionResponse {
+ #[must_use]
+ pub fn new() -> Self {
+ Self::default()
+ }
+
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[must_use]
+ pub fn meta(mut self, meta: impl IntoOption) -> Self {
+ self.meta = meta.into_option();
+ self
+ }
+}
+
// List sessions
/// Request parameters for listing existing sessions.
@@ -4160,6 +4249,15 @@ pub struct SessionCapabilities {
#[serde_as(deserialize_as = "DefaultOnError")]
#[serde(default)]
pub fork: Option,
+ /// **UNSTABLE**
+ ///
+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
+ ///
+ /// Whether the agent supports `session/delete`.
+ #[cfg(feature = "unstable_session_delete")]
+ #[serde_as(deserialize_as = "DefaultOnError")]
+ #[serde(default)]
+ pub delete: Option,
/// Whether the agent supports `session/resume`.
#[serde_as(deserialize_as = "DefaultOnError")]
#[serde(default)]
@@ -4213,6 +4311,18 @@ impl SessionCapabilities {
self
}
+ /// **UNSTABLE**
+ ///
+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
+ ///
+ /// Whether the agent supports `session/delete`.
+ #[cfg(feature = "unstable_session_delete")]
+ #[must_use]
+ pub fn delete(mut self, delete: impl IntoOption) -> Self {
+ self.delete = delete.into_option();
+ self
+ }
+
/// Whether the agent supports `session/resume`.
#[must_use]
pub fn resume(mut self, resume: impl IntoOption) -> Self {
@@ -4354,6 +4464,46 @@ impl SessionForkCapabilities {
}
}
+/// **UNSTABLE**
+///
+/// This capability is not part of the spec yet, and may be removed or changed at any point.
+///
+/// Capabilities for the `session/delete` method.
+///
+/// By supplying `{}` it means that the agent supports deletion of sessions.
+#[cfg(feature = "unstable_session_delete")]
+#[skip_serializing_none]
+#[derive(Default, Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
+#[non_exhaustive]
+pub struct SessionDeleteCapabilities {
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[serde(rename = "_meta")]
+ pub meta: Option,
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl SessionDeleteCapabilities {
+ #[must_use]
+ pub fn new() -> Self {
+ Self::default()
+ }
+
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[must_use]
+ pub fn meta(mut self, meta: impl IntoOption) -> Self {
+ self.meta = meta.into_option();
+ self
+ }
+}
+
/// Capabilities for the `session/resume` method.
///
/// By supplying `{}` it means that the agent supports resuming of sessions.
@@ -4616,6 +4766,9 @@ pub struct AgentMethodNames {
/// Method for forking an existing session.
#[cfg(feature = "unstable_session_fork")]
pub session_fork: &'static str,
+ /// Method for deleting an existing session.
+ #[cfg(feature = "unstable_session_delete")]
+ pub session_delete: &'static str,
/// Method for resuming an existing session.
pub session_resume: &'static str,
/// Method for closing an active session.
@@ -4676,6 +4829,8 @@ pub const AGENT_METHOD_NAMES: AgentMethodNames = AgentMethodNames {
session_list: SESSION_LIST_METHOD_NAME,
#[cfg(feature = "unstable_session_fork")]
session_fork: SESSION_FORK_METHOD_NAME,
+ #[cfg(feature = "unstable_session_delete")]
+ session_delete: SESSION_DELETE_METHOD_NAME,
session_resume: SESSION_RESUME_METHOD_NAME,
session_close: SESSION_CLOSE_METHOD_NAME,
#[cfg(feature = "unstable_logout")]
@@ -4735,6 +4890,9 @@ pub(crate) const SESSION_LIST_METHOD_NAME: &str = "session/list";
/// Method name for forking an existing session.
#[cfg(feature = "unstable_session_fork")]
pub(crate) const SESSION_FORK_METHOD_NAME: &str = "session/fork";
+/// Method name for deleting an existing session.
+#[cfg(feature = "unstable_session_delete")]
+pub(crate) const SESSION_DELETE_METHOD_NAME: &str = "session/delete";
/// Method name for resuming an existing session.
pub(crate) const SESSION_RESUME_METHOD_NAME: &str = "session/resume";
/// Method name for closing an active session.
@@ -4850,6 +5008,15 @@ pub enum ClientRequest {
/// original, allowing operations like generating summaries without affecting the
/// original session's history.
ForkSessionRequest(ForkSessionRequest),
+ #[cfg(feature = "unstable_session_delete")]
+ /// **UNSTABLE**
+ ///
+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
+ ///
+ /// Deletes an existing session.
+ ///
+ /// This method is only available if the agent advertises the `sessionCapabilities.delete` capability.
+ DeleteSessionRequest(DeleteSessionRequest),
/// Resumes an existing session without returning previous messages.
///
/// This method is only available if the agent advertises the `sessionCapabilities.resume` capability.
@@ -4952,6 +5119,8 @@ impl ClientRequest {
Self::ListSessionsRequest(_) => AGENT_METHOD_NAMES.session_list,
#[cfg(feature = "unstable_session_fork")]
Self::ForkSessionRequest(_) => AGENT_METHOD_NAMES.session_fork,
+ #[cfg(feature = "unstable_session_delete")]
+ Self::DeleteSessionRequest(_) => AGENT_METHOD_NAMES.session_delete,
Self::ResumeSessionRequest(_) => AGENT_METHOD_NAMES.session_resume,
Self::CloseSessionRequest(_) => AGENT_METHOD_NAMES.session_close,
Self::SetSessionModeRequest(_) => AGENT_METHOD_NAMES.session_set_mode,
@@ -4997,6 +5166,8 @@ pub enum AgentResponse {
ListSessionsResponse(ListSessionsResponse),
#[cfg(feature = "unstable_session_fork")]
ForkSessionResponse(ForkSessionResponse),
+ #[cfg(feature = "unstable_session_delete")]
+ DeleteSessionResponse(#[serde(default)] DeleteSessionResponse),
ResumeSessionResponse(#[serde(default)] ResumeSessionResponse),
CloseSessionResponse(#[serde(default)] CloseSessionResponse),
SetSessionModeResponse(#[serde(default)] SetSessionModeResponse),
@@ -5572,6 +5743,37 @@ mod test_serialization {
);
}
+ #[cfg(feature = "unstable_session_delete")]
+ #[test]
+ fn test_delete_session_request_serialization() {
+ let request = DeleteSessionRequest::new("sess_abc123");
+
+ let json = serde_json::to_value(&request).unwrap();
+ assert_eq!(
+ json,
+ json!({
+ "sessionId": "sess_abc123",
+ })
+ );
+
+ let deserialized: DeleteSessionRequest = serde_json::from_value(json).unwrap();
+ assert_eq!(deserialized.session_id, SessionId::from("sess_abc123"));
+ }
+
+ #[cfg(feature = "unstable_session_delete")]
+ #[test]
+ fn test_delete_session_capabilities_serialization() {
+ assert_eq!(
+ serde_json::to_value(
+ SessionCapabilities::new().delete(SessionDeleteCapabilities::new())
+ )
+ .unwrap(),
+ json!({
+ "delete": {}
+ })
+ );
+ }
+
#[cfg(feature = "unstable_auth_methods")]
#[test]
fn test_auth_method_env_var_serialization() {
diff --git a/src/v2/agent.rs b/src/v2/agent.rs
index a6e8210d..ffb8e3f4 100644
--- a/src/v2/agent.rs
+++ b/src/v2/agent.rs
@@ -1703,6 +1703,95 @@ impl CloseSessionResponse {
}
}
+// Delete session
+
+/// **UNSTABLE**
+///
+/// This capability is not part of the spec yet, and may be removed or changed at any point.
+///
+/// Request parameters for deleting a session.
+///
+/// Only available if the Agent supports the `sessionCapabilities.delete` capability.
+#[cfg(feature = "unstable_session_delete")]
+#[skip_serializing_none]
+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
+#[schemars(extend("x-side" = "agent", "x-method" = SESSION_DELETE_METHOD_NAME))]
+#[serde(rename_all = "camelCase")]
+#[non_exhaustive]
+pub struct DeleteSessionRequest {
+ /// The ID of the session to delete.
+ pub session_id: SessionId,
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[serde(rename = "_meta")]
+ pub meta: Option,
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl DeleteSessionRequest {
+ #[must_use]
+ pub fn new(session_id: impl Into) -> Self {
+ Self {
+ session_id: session_id.into(),
+ meta: None,
+ }
+ }
+
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[must_use]
+ pub fn meta(mut self, meta: impl IntoOption) -> Self {
+ self.meta = meta.into_option();
+ self
+ }
+}
+
+/// **UNSTABLE**
+///
+/// This capability is not part of the spec yet, and may be removed or changed at any point.
+///
+/// Response from deleting a session.
+#[cfg(feature = "unstable_session_delete")]
+#[skip_serializing_none]
+#[derive(Default, Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
+#[schemars(extend("x-side" = "agent", "x-method" = SESSION_DELETE_METHOD_NAME))]
+#[serde(rename_all = "camelCase")]
+#[non_exhaustive]
+pub struct DeleteSessionResponse {
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[serde(rename = "_meta")]
+ pub meta: Option,
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl DeleteSessionResponse {
+ #[must_use]
+ pub fn new() -> Self {
+ Self::default()
+ }
+
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[must_use]
+ pub fn meta(mut self, meta: impl IntoOption) -> Self {
+ self.meta = meta.into_option();
+ self
+ }
+}
+
// List sessions
/// Request parameters for listing existing sessions.
@@ -4160,6 +4249,15 @@ pub struct SessionCapabilities {
#[serde_as(deserialize_as = "DefaultOnError")]
#[serde(default)]
pub fork: Option,
+ /// **UNSTABLE**
+ ///
+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
+ ///
+ /// Whether the agent supports `session/delete`.
+ #[cfg(feature = "unstable_session_delete")]
+ #[serde_as(deserialize_as = "DefaultOnError")]
+ #[serde(default)]
+ pub delete: Option,
/// Whether the agent supports `session/resume`.
#[serde_as(deserialize_as = "DefaultOnError")]
#[serde(default)]
@@ -4213,6 +4311,18 @@ impl SessionCapabilities {
self
}
+ /// **UNSTABLE**
+ ///
+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
+ ///
+ /// Whether the agent supports `session/delete`.
+ #[cfg(feature = "unstable_session_delete")]
+ #[must_use]
+ pub fn delete(mut self, delete: impl IntoOption) -> Self {
+ self.delete = delete.into_option();
+ self
+ }
+
/// Whether the agent supports `session/resume`.
#[must_use]
pub fn resume(mut self, resume: impl IntoOption) -> Self {
@@ -4354,6 +4464,46 @@ impl SessionForkCapabilities {
}
}
+/// **UNSTABLE**
+///
+/// This capability is not part of the spec yet, and may be removed or changed at any point.
+///
+/// Capabilities for the `session/delete` method.
+///
+/// By supplying `{}` it means that the agent supports deletion of sessions.
+#[cfg(feature = "unstable_session_delete")]
+#[skip_serializing_none]
+#[derive(Default, Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
+#[non_exhaustive]
+pub struct SessionDeleteCapabilities {
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[serde(rename = "_meta")]
+ pub meta: Option,
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl SessionDeleteCapabilities {
+ #[must_use]
+ pub fn new() -> Self {
+ Self::default()
+ }
+
+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
+ /// these keys.
+ ///
+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
+ #[must_use]
+ pub fn meta(mut self, meta: impl IntoOption) -> Self {
+ self.meta = meta.into_option();
+ self
+ }
+}
+
/// Capabilities for the `session/resume` method.
///
/// By supplying `{}` it means that the agent supports resuming of sessions.
@@ -4616,6 +4766,9 @@ pub struct AgentMethodNames {
/// Method for forking an existing session.
#[cfg(feature = "unstable_session_fork")]
pub session_fork: &'static str,
+ /// Method for deleting an existing session.
+ #[cfg(feature = "unstable_session_delete")]
+ pub session_delete: &'static str,
/// Method for resuming an existing session.
pub session_resume: &'static str,
/// Method for closing an active session.
@@ -4676,6 +4829,8 @@ pub const AGENT_METHOD_NAMES: AgentMethodNames = AgentMethodNames {
session_list: SESSION_LIST_METHOD_NAME,
#[cfg(feature = "unstable_session_fork")]
session_fork: SESSION_FORK_METHOD_NAME,
+ #[cfg(feature = "unstable_session_delete")]
+ session_delete: SESSION_DELETE_METHOD_NAME,
session_resume: SESSION_RESUME_METHOD_NAME,
session_close: SESSION_CLOSE_METHOD_NAME,
#[cfg(feature = "unstable_logout")]
@@ -4735,6 +4890,9 @@ pub(crate) const SESSION_LIST_METHOD_NAME: &str = "session/list";
/// Method name for forking an existing session.
#[cfg(feature = "unstable_session_fork")]
pub(crate) const SESSION_FORK_METHOD_NAME: &str = "session/fork";
+/// Method name for deleting an existing session.
+#[cfg(feature = "unstable_session_delete")]
+pub(crate) const SESSION_DELETE_METHOD_NAME: &str = "session/delete";
/// Method name for resuming an existing session.
pub(crate) const SESSION_RESUME_METHOD_NAME: &str = "session/resume";
/// Method name for closing an active session.
@@ -4850,6 +5008,15 @@ pub enum ClientRequest {
/// original, allowing operations like generating summaries without affecting the
/// original session's history.
ForkSessionRequest(ForkSessionRequest),
+ #[cfg(feature = "unstable_session_delete")]
+ /// **UNSTABLE**
+ ///
+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
+ ///
+ /// Deletes an existing session.
+ ///
+ /// This method is only available if the agent advertises the `sessionCapabilities.delete` capability.
+ DeleteSessionRequest(DeleteSessionRequest),
/// Resumes an existing session without returning previous messages.
///
/// This method is only available if the agent advertises the `sessionCapabilities.resume` capability.
@@ -4952,6 +5119,8 @@ impl ClientRequest {
Self::ListSessionsRequest(_) => AGENT_METHOD_NAMES.session_list,
#[cfg(feature = "unstable_session_fork")]
Self::ForkSessionRequest(_) => AGENT_METHOD_NAMES.session_fork,
+ #[cfg(feature = "unstable_session_delete")]
+ Self::DeleteSessionRequest(_) => AGENT_METHOD_NAMES.session_delete,
Self::ResumeSessionRequest(_) => AGENT_METHOD_NAMES.session_resume,
Self::CloseSessionRequest(_) => AGENT_METHOD_NAMES.session_close,
Self::SetSessionModeRequest(_) => AGENT_METHOD_NAMES.session_set_mode,
@@ -4997,6 +5166,8 @@ pub enum AgentResponse {
ListSessionsResponse(ListSessionsResponse),
#[cfg(feature = "unstable_session_fork")]
ForkSessionResponse(ForkSessionResponse),
+ #[cfg(feature = "unstable_session_delete")]
+ DeleteSessionResponse(#[serde(default)] DeleteSessionResponse),
ResumeSessionResponse(#[serde(default)] ResumeSessionResponse),
CloseSessionResponse(#[serde(default)] CloseSessionResponse),
SetSessionModeResponse(#[serde(default)] SetSessionModeResponse),
diff --git a/src/v2/conversion.rs b/src/v2/conversion.rs
index 407d0d41..b9368f8c 100644
--- a/src/v2/conversion.rs
+++ b/src/v2/conversion.rs
@@ -3328,6 +3328,56 @@ impl IntoV2 for crate::v1::ResumeSessionResponse {
}
}
+#[cfg(feature = "unstable_session_delete")]
+impl IntoV1 for super::DeleteSessionRequest {
+ type Output = crate::v1::DeleteSessionRequest;
+
+ fn into_v1(self) -> Result {
+ let Self { session_id, meta } = self;
+ Ok(crate::v1::DeleteSessionRequest {
+ session_id: session_id.into_v1()?,
+ meta: meta.into_v1()?,
+ })
+ }
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl IntoV2 for crate::v1::DeleteSessionRequest {
+ type Output = super::DeleteSessionRequest;
+
+ fn into_v2(self) -> Result {
+ let Self { session_id, meta } = self;
+ Ok(super::DeleteSessionRequest {
+ session_id: session_id.into_v2()?,
+ meta: meta.into_v2()?,
+ })
+ }
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl IntoV1 for super::DeleteSessionResponse {
+ type Output = crate::v1::DeleteSessionResponse;
+
+ fn into_v1(self) -> Result {
+ let Self { meta } = self;
+ Ok(crate::v1::DeleteSessionResponse {
+ meta: meta.into_v1()?,
+ })
+ }
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl IntoV2 for crate::v1::DeleteSessionResponse {
+ type Output = super::DeleteSessionResponse;
+
+ fn into_v2(self) -> Result {
+ let Self { meta } = self;
+ Ok(super::DeleteSessionResponse {
+ meta: meta.into_v2()?,
+ })
+ }
+}
+
impl IntoV1 for super::CloseSessionRequest {
type Output = crate::v1::CloseSessionRequest;
@@ -4986,6 +5036,8 @@ impl IntoV1 for super::SessionCapabilities {
additional_directories,
#[cfg(feature = "unstable_session_fork")]
fork,
+ #[cfg(feature = "unstable_session_delete")]
+ delete,
resume,
close,
meta,
@@ -4996,6 +5048,8 @@ impl IntoV1 for super::SessionCapabilities {
additional_directories: additional_directories.into_v1()?,
#[cfg(feature = "unstable_session_fork")]
fork: fork.into_v1()?,
+ #[cfg(feature = "unstable_session_delete")]
+ delete: delete.into_v1()?,
resume: resume.into_v1()?,
close: close.into_v1()?,
meta: meta.into_v1()?,
@@ -5013,6 +5067,8 @@ impl IntoV2 for crate::v1::SessionCapabilities {
additional_directories,
#[cfg(feature = "unstable_session_fork")]
fork,
+ #[cfg(feature = "unstable_session_delete")]
+ delete,
resume,
close,
meta,
@@ -5023,6 +5079,8 @@ impl IntoV2 for crate::v1::SessionCapabilities {
additional_directories: additional_directories.into_v2()?,
#[cfg(feature = "unstable_session_fork")]
fork: fork.into_v2()?,
+ #[cfg(feature = "unstable_session_delete")]
+ delete: delete.into_v2()?,
resume: resume.into_v2()?,
close: close.into_v2()?,
meta: meta.into_v2()?,
@@ -5100,6 +5158,30 @@ impl IntoV2 for crate::v1::SessionForkCapabilities {
}
}
+#[cfg(feature = "unstable_session_delete")]
+impl IntoV1 for super::SessionDeleteCapabilities {
+ type Output = crate::v1::SessionDeleteCapabilities;
+
+ fn into_v1(self) -> Result {
+ let Self { meta } = self;
+ Ok(crate::v1::SessionDeleteCapabilities {
+ meta: meta.into_v1()?,
+ })
+ }
+}
+
+#[cfg(feature = "unstable_session_delete")]
+impl IntoV2 for crate::v1::SessionDeleteCapabilities {
+ type Output = super::SessionDeleteCapabilities;
+
+ fn into_v2(self) -> Result {
+ let Self { meta } = self;
+ Ok(super::SessionDeleteCapabilities {
+ meta: meta.into_v2()?,
+ })
+ }
+}
+
impl IntoV1 for super::SessionResumeCapabilities {
type Output = crate::v1::SessionResumeCapabilities;
@@ -5262,6 +5344,10 @@ impl IntoV1 for super::ClientRequest {
Self::ForkSessionRequest(value) => {
crate::v1::ClientRequest::ForkSessionRequest(value.into_v1()?)
}
+ #[cfg(feature = "unstable_session_delete")]
+ Self::DeleteSessionRequest(value) => {
+ crate::v1::ClientRequest::DeleteSessionRequest(value.into_v1()?)
+ }
Self::ResumeSessionRequest(value) => {
crate::v1::ClientRequest::ResumeSessionRequest(value.into_v1()?)
}
@@ -5336,6 +5422,10 @@ impl IntoV2 for crate::v1::ClientRequest {
Self::ForkSessionRequest(value) => {
super::ClientRequest::ForkSessionRequest(value.into_v2()?)
}
+ #[cfg(feature = "unstable_session_delete")]
+ Self::DeleteSessionRequest(value) => {
+ super::ClientRequest::DeleteSessionRequest(value.into_v2()?)
+ }
Self::ResumeSessionRequest(value) => {
super::ClientRequest::ResumeSessionRequest(value.into_v2()?)
}
@@ -5408,6 +5498,10 @@ impl IntoV1 for super::AgentResponse {
Self::ForkSessionResponse(value) => {
crate::v1::AgentResponse::ForkSessionResponse(value.into_v1()?)
}
+ #[cfg(feature = "unstable_session_delete")]
+ Self::DeleteSessionResponse(value) => {
+ crate::v1::AgentResponse::DeleteSessionResponse(value.into_v1()?)
+ }
Self::ResumeSessionResponse(value) => {
crate::v1::AgentResponse::ResumeSessionResponse(value.into_v1()?)
}
@@ -5484,6 +5578,10 @@ impl IntoV2 for crate::v1::AgentResponse {
Self::ForkSessionResponse(value) => {
super::AgentResponse::ForkSessionResponse(value.into_v2()?)
}
+ #[cfg(feature = "unstable_session_delete")]
+ Self::DeleteSessionResponse(value) => {
+ super::AgentResponse::DeleteSessionResponse(value.into_v2()?)
+ }
Self::ResumeSessionResponse(value) => {
super::AgentResponse::ResumeSessionResponse(value.into_v2()?)
}