@@ -732,6 +732,142 @@ impl ForkSessionResponse {
732732 }
733733}
734734
735+ // Resume session
736+
737+ /// **UNSTABLE**
738+ ///
739+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
740+ ///
741+ /// Request parameters for resuming an existing session.
742+ ///
743+ /// Resumes an existing session without returning previous messages (unlike `session/load`).
744+ /// This is useful for agents that can resume sessions but don't implement full session loading.
745+ ///
746+ /// Only available if the Agent supports the `session.resume` capability.
747+ #[ cfg( feature = "unstable_session_resume" ) ]
748+ #[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema , PartialEq , Eq ) ]
749+ #[ schemars( extend( "x-side" = "agent" , "x-method" = SESSION_RESUME_METHOD_NAME ) ) ]
750+ #[ serde( rename_all = "camelCase" ) ]
751+ #[ non_exhaustive]
752+ pub struct ResumeSessionRequest {
753+ /// The ID of the session to resume.
754+ pub session_id : SessionId ,
755+ /// The working directory for this session.
756+ pub cwd : PathBuf ,
757+ /// List of MCP servers to connect to for this session.
758+ pub mcp_servers : Vec < McpServer > ,
759+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
760+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
761+ /// these keys.
762+ ///
763+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
764+ #[ serde( skip_serializing_if = "Option::is_none" , rename = "_meta" ) ]
765+ pub meta : Option < Meta > ,
766+ }
767+
768+ #[ cfg( feature = "unstable_session_resume" ) ]
769+ impl ResumeSessionRequest {
770+ pub fn new ( session_id : impl Into < SessionId > , cwd : impl Into < PathBuf > ) -> Self {
771+ Self {
772+ session_id : session_id. into ( ) ,
773+ cwd : cwd. into ( ) ,
774+ mcp_servers : vec ! [ ] ,
775+ meta : None ,
776+ }
777+ }
778+
779+ /// List of MCP servers to connect to for this session.
780+ #[ must_use]
781+ pub fn mcp_servers ( mut self , mcp_servers : Vec < McpServer > ) -> Self {
782+ self . mcp_servers = mcp_servers;
783+ self
784+ }
785+
786+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
787+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
788+ /// these keys.
789+ ///
790+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
791+ #[ must_use]
792+ pub fn meta ( mut self , meta : impl IntoOption < Meta > ) -> Self {
793+ self . meta = meta. into_option ( ) ;
794+ self
795+ }
796+ }
797+
798+ /// **UNSTABLE**
799+ ///
800+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
801+ ///
802+ /// Response from resuming an existing session.
803+ #[ cfg( feature = "unstable_session_resume" ) ]
804+ #[ derive( Default , Debug , Clone , Serialize , Deserialize , JsonSchema , PartialEq , Eq ) ]
805+ #[ schemars( extend( "x-side" = "agent" , "x-method" = SESSION_RESUME_METHOD_NAME ) ) ]
806+ #[ serde( rename_all = "camelCase" ) ]
807+ #[ non_exhaustive]
808+ pub struct ResumeSessionResponse {
809+ /// Initial mode state if supported by the Agent
810+ ///
811+ /// See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
812+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
813+ pub modes : Option < SessionModeState > ,
814+ /// **UNSTABLE**
815+ ///
816+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
817+ ///
818+ /// Initial model state if supported by the Agent
819+ #[ cfg( feature = "unstable_session_model" ) ]
820+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
821+ pub models : Option < SessionModelState > ,
822+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
823+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
824+ /// these keys.
825+ ///
826+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
827+ #[ serde( skip_serializing_if = "Option::is_none" , rename = "_meta" ) ]
828+ pub meta : Option < Meta > ,
829+ }
830+
831+ #[ cfg( feature = "unstable_session_resume" ) ]
832+ impl ResumeSessionResponse {
833+ #[ must_use]
834+ pub fn new ( ) -> Self {
835+ Self :: default ( )
836+ }
837+
838+ /// Initial mode state if supported by the Agent
839+ ///
840+ /// See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
841+ #[ must_use]
842+ pub fn modes ( mut self , modes : impl IntoOption < SessionModeState > ) -> Self {
843+ self . modes = modes. into_option ( ) ;
844+ self
845+ }
846+
847+ /// **UNSTABLE**
848+ ///
849+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
850+ ///
851+ /// Initial model state if supported by the Agent
852+ #[ cfg( feature = "unstable_session_model" ) ]
853+ #[ must_use]
854+ pub fn models ( mut self , models : impl IntoOption < SessionModelState > ) -> Self {
855+ self . models = models. into_option ( ) ;
856+ self
857+ }
858+
859+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
860+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
861+ /// these keys.
862+ ///
863+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
864+ #[ must_use]
865+ pub fn meta ( mut self , meta : impl IntoOption < Meta > ) -> Self {
866+ self . meta = meta. into_option ( ) ;
867+ self
868+ }
869+ }
870+
735871// List sessions
736872
737873/// **UNSTABLE**
@@ -1778,6 +1914,14 @@ pub struct SessionCapabilities {
17781914 #[ cfg( feature = "unstable_session_fork" ) ]
17791915 #[ serde( skip_serializing_if = "Option::is_none" ) ]
17801916 pub fork : Option < SessionForkCapabilities > ,
1917+ /// **UNSTABLE**
1918+ ///
1919+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
1920+ ///
1921+ /// Whether the agent supports `session/resume`.
1922+ #[ cfg( feature = "unstable_session_resume" ) ]
1923+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1924+ pub resume : Option < SessionResumeCapabilities > ,
17811925 /// The _meta property is reserved by ACP to allow clients and agents to attach additional
17821926 /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
17831927 /// these keys.
@@ -1809,6 +1953,14 @@ impl SessionCapabilities {
18091953 self
18101954 }
18111955
1956+ #[ cfg( feature = "unstable_session_resume" ) ]
1957+ /// Whether the agent supports `session/resume`.
1958+ #[ must_use]
1959+ pub fn resume ( mut self , resume : impl IntoOption < SessionResumeCapabilities > ) -> Self {
1960+ self . resume = resume. into_option ( ) ;
1961+ self
1962+ }
1963+
18121964 /// The _meta property is reserved by ACP to allow clients and agents to attach additional
18131965 /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
18141966 /// these keys.
@@ -1896,6 +2048,45 @@ impl SessionForkCapabilities {
18962048 }
18972049}
18982050
2051+ /// **UNSTABLE**
2052+ ///
2053+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
2054+ ///
2055+ /// Capabilities for the `session/resume` method.
2056+ ///
2057+ /// By supplying `{}` it means that the agent supports resuming of sessions.
2058+ #[ cfg( feature = "unstable_session_resume" ) ]
2059+ #[ derive( Default , Debug , Clone , Serialize , Deserialize , JsonSchema , PartialEq , Eq ) ]
2060+ #[ non_exhaustive]
2061+ pub struct SessionResumeCapabilities {
2062+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
2063+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
2064+ /// these keys.
2065+ ///
2066+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
2067+ #[ serde( skip_serializing_if = "Option::is_none" , rename = "_meta" ) ]
2068+ pub meta : Option < Meta > ,
2069+ }
2070+
2071+ #[ cfg( feature = "unstable_session_resume" ) ]
2072+ impl SessionResumeCapabilities {
2073+ #[ must_use]
2074+ pub fn new ( ) -> Self {
2075+ Self :: default ( )
2076+ }
2077+
2078+ /// The _meta property is reserved by ACP to allow clients and agents to attach additional
2079+ /// metadata to their interactions. Implementations MUST NOT make assumptions about values at
2080+ /// these keys.
2081+ ///
2082+ /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
2083+ #[ must_use]
2084+ pub fn meta ( mut self , meta : impl IntoOption < Meta > ) -> Self {
2085+ self . meta = meta. into_option ( ) ;
2086+ self
2087+ }
2088+ }
2089+
18992090/// Prompt capabilities supported by the agent in `session/prompt` requests.
19002091///
19012092/// Baseline agent functionality requires support for [`ContentBlock::Text`]
@@ -2058,6 +2249,9 @@ pub struct AgentMethodNames {
20582249 /// Method for forking an existing session.
20592250 #[ cfg( feature = "unstable_session_fork" ) ]
20602251 pub session_fork : & ' static str ,
2252+ /// Method for resuming an existing session.
2253+ #[ cfg( feature = "unstable_session_resume" ) ]
2254+ pub session_resume : & ' static str ,
20612255}
20622256
20632257/// Constant containing all agent method names.
@@ -2075,6 +2269,8 @@ pub const AGENT_METHOD_NAMES: AgentMethodNames = AgentMethodNames {
20752269 session_list : SESSION_LIST_METHOD_NAME ,
20762270 #[ cfg( feature = "unstable_session_fork" ) ]
20772271 session_fork : SESSION_FORK_METHOD_NAME ,
2272+ #[ cfg( feature = "unstable_session_resume" ) ]
2273+ session_resume : SESSION_RESUME_METHOD_NAME ,
20782274} ;
20792275
20802276/// Method name for the initialize request.
@@ -2100,6 +2296,9 @@ pub(crate) const SESSION_LIST_METHOD_NAME: &str = "session/list";
21002296/// Method name for forking an existing session.
21012297#[ cfg( feature = "unstable_session_fork" ) ]
21022298pub ( crate ) const SESSION_FORK_METHOD_NAME : & str = "session/fork" ;
2299+ /// Method name for resuming an existing session.
2300+ #[ cfg( feature = "unstable_session_resume" ) ]
2301+ pub ( crate ) const SESSION_RESUME_METHOD_NAME : & str = "session/resume" ;
21032302
21042303/// All possible requests that a client can send to an agent.
21052304///
@@ -2181,6 +2380,18 @@ pub enum ClientRequest {
21812380 /// original, allowing operations like generating summaries without affecting the
21822381 /// original session's history.
21832382 ForkSessionRequest ( ForkSessionRequest ) ,
2383+ #[ cfg( feature = "unstable_session_resume" ) ]
2384+ /// **UNSTABLE**
2385+ ///
2386+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
2387+ ///
2388+ /// Resumes an existing session without returning previous messages.
2389+ ///
2390+ /// This method is only available if the agent advertises the `session.resume` capability.
2391+ ///
2392+ /// The agent should resume the session context, allowing the conversation to continue
2393+ /// without replaying the message history (unlike `session/load`).
2394+ ResumeSessionRequest ( ResumeSessionRequest ) ,
21842395 /// Sets the current mode for a session.
21852396 ///
21862397 /// Allows switching between different agent modes (e.g., "ask", "architect", "code")
@@ -2236,6 +2447,8 @@ impl ClientRequest {
22362447 Self :: ListSessionsRequest ( _) => AGENT_METHOD_NAMES . session_list ,
22372448 #[ cfg( feature = "unstable_session_fork" ) ]
22382449 Self :: ForkSessionRequest ( _) => AGENT_METHOD_NAMES . session_fork ,
2450+ #[ cfg( feature = "unstable_session_resume" ) ]
2451+ Self :: ResumeSessionRequest ( _) => AGENT_METHOD_NAMES . session_resume ,
22392452 Self :: SetSessionModeRequest ( _) => AGENT_METHOD_NAMES . session_set_mode ,
22402453 Self :: PromptRequest ( _) => AGENT_METHOD_NAMES . session_prompt ,
22412454 #[ cfg( feature = "unstable_session_model" ) ]
@@ -2264,6 +2477,8 @@ pub enum AgentResponse {
22642477 ListSessionsResponse ( ListSessionsResponse ) ,
22652478 #[ cfg( feature = "unstable_session_fork" ) ]
22662479 ForkSessionResponse ( ForkSessionResponse ) ,
2480+ #[ cfg( feature = "unstable_session_resume" ) ]
2481+ ResumeSessionResponse ( #[ serde( default ) ] ResumeSessionResponse ) ,
22672482 SetSessionModeResponse ( #[ serde( default ) ] SetSessionModeResponse ) ,
22682483 PromptResponse ( PromptResponse ) ,
22692484 #[ cfg( feature = "unstable_session_model" ) ]
0 commit comments