@@ -6,7 +6,9 @@ use agent_client_protocol_schema::{
66 LoadSessionResponse , NewSessionRequest , NewSessionResponse , PromptRequest , PromptResponse ,
77 Result , SetSessionModeRequest , SetSessionModeResponse ,
88} ;
9- #[ cfg( feature = "unstable" ) ]
9+ #[ cfg( feature = "unstable_session_list" ) ]
10+ use agent_client_protocol_schema:: { ListSessionsRequest , ListSessionsResponse } ;
11+ #[ cfg( feature = "unstable_session_model" ) ]
1012use agent_client_protocol_schema:: { SetSessionModelRequest , SetSessionModelResponse } ;
1113use serde_json:: value:: RawValue ;
1214
@@ -118,14 +120,26 @@ pub trait Agent {
118120 /// This capability is not part of the spec yet, and may be removed or changed at any point.
119121 ///
120122 /// Select a model for a given session.
121- #[ cfg( feature = "unstable " ) ]
123+ #[ cfg( feature = "unstable_session_model " ) ]
122124 async fn set_session_model (
123125 & self ,
124126 _args : SetSessionModelRequest ,
125127 ) -> Result < SetSessionModelResponse > {
126128 Err ( Error :: method_not_found ( ) )
127129 }
128130
131+ /// **UNSTABLE**
132+ ///
133+ /// This capability is not part of the spec yet, and may be removed or changed at any point.
134+ ///
135+ /// Lists existing sessions known to the agent.
136+ ///
137+ /// Only available if the Agent supports the `sessionCapabilities.list` capability.
138+ #[ cfg( feature = "unstable_session_list" ) ]
139+ async fn list_sessions ( & self , _args : ListSessionsRequest ) -> Result < ListSessionsResponse > {
140+ Err ( Error :: method_not_found ( ) )
141+ }
142+
129143 /// Handles extension method requests from the client.
130144 ///
131145 /// Extension methods provide a way to add custom functionality while maintaining
@@ -173,13 +187,17 @@ impl<T: Agent> Agent for Rc<T> {
173187 async fn cancel ( & self , args : CancelNotification ) -> Result < ( ) > {
174188 self . as_ref ( ) . cancel ( args) . await
175189 }
176- #[ cfg( feature = "unstable " ) ]
190+ #[ cfg( feature = "unstable_session_model " ) ]
177191 async fn set_session_model (
178192 & self ,
179193 args : SetSessionModelRequest ,
180194 ) -> Result < SetSessionModelResponse > {
181195 self . as_ref ( ) . set_session_model ( args) . await
182196 }
197+ #[ cfg( feature = "unstable_session_list" ) ]
198+ async fn list_sessions ( & self , args : ListSessionsRequest ) -> Result < ListSessionsResponse > {
199+ self . as_ref ( ) . list_sessions ( args) . await
200+ }
183201 async fn ext_method ( & self , args : ExtRequest ) -> Result < ExtResponse > {
184202 self . as_ref ( ) . ext_method ( args) . await
185203 }
@@ -214,13 +232,17 @@ impl<T: Agent> Agent for Arc<T> {
214232 async fn cancel ( & self , args : CancelNotification ) -> Result < ( ) > {
215233 self . as_ref ( ) . cancel ( args) . await
216234 }
217- #[ cfg( feature = "unstable " ) ]
235+ #[ cfg( feature = "unstable_session_model " ) ]
218236 async fn set_session_model (
219237 & self ,
220238 args : SetSessionModelRequest ,
221239 ) -> Result < SetSessionModelResponse > {
222240 self . as_ref ( ) . set_session_model ( args) . await
223241 }
242+ #[ cfg( feature = "unstable_session_list" ) ]
243+ async fn list_sessions ( & self , args : ListSessionsRequest ) -> Result < ListSessionsResponse > {
244+ self . as_ref ( ) . list_sessions ( args) . await
245+ }
224246 async fn ext_method ( & self , args : ExtRequest ) -> Result < ExtResponse > {
225247 self . as_ref ( ) . ext_method ( args) . await
226248 }
0 commit comments