@@ -105,6 +105,14 @@ export class AgentSideConnection {
105105 const result = await agent . authenticate ( validatedParams ) ;
106106 return result ?? { } ;
107107 }
108+ case schema . AGENT_METHODS . logout : {
109+ if ( ! agent . unstable_logout ) {
110+ throw RequestError . methodNotFound ( method ) ;
111+ }
112+ const validatedParams = validate . zLogoutRequest . parse ( params ) ;
113+ const result = await agent . unstable_logout ( validatedParams ) ;
114+ return result ?? { } ;
115+ }
108116 case schema . AGENT_METHODS . session_prompt : {
109117 const validatedParams = validate . zPromptRequest . parse ( params ) ;
110118 return agent . prompt ( validatedParams ) ;
@@ -786,6 +794,24 @@ export class ClientSideConnection implements Agent {
786794 ) ;
787795 }
788796
797+ /**
798+ * Terminates the current authenticated session.
799+ *
800+ * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
801+ *
802+ * @experimental
803+ */
804+ async unstable_logout (
805+ params : schema . LogoutRequest ,
806+ ) : Promise < schema . LogoutResponse > {
807+ return (
808+ ( await this . #connection. sendRequest (
809+ schema . AGENT_METHODS . logout ,
810+ params ,
811+ ) ) ?? { }
812+ ) ;
813+ }
814+
789815 /**
790816 * Processes a user prompt within a session.
791817 *
@@ -1604,6 +1630,17 @@ export interface Agent {
16041630 authenticate (
16051631 params : schema . AuthenticateRequest ,
16061632 ) : Promise < schema . AuthenticateResponse | void > ;
1633+ /**
1634+ * Terminates the current authenticated session.
1635+ *
1636+ * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
1637+ *
1638+ * @experimental
1639+ */
1640+
1641+ unstable_logout ?(
1642+ params : schema . LogoutRequest ,
1643+ ) : Promise < schema . LogoutResponse | void > ;
16071644 /**
16081645 * Processes a user prompt within a session.
16091646 *
0 commit comments