From b8f7a14691357cfd58de44dbc303916c525f12fd Mon Sep 17 00:00:00 2001 From: "Anna.Zhdan" Date: Fri, 20 Mar 2026 09:47:01 +0100 Subject: [PATCH] Added unstable_logout --- src/acp.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/acp.ts b/src/acp.ts index faa0cc3..c905041 100644 --- a/src/acp.ts +++ b/src/acp.ts @@ -105,6 +105,14 @@ export class AgentSideConnection { const result = await agent.authenticate(validatedParams); return result ?? {}; } + case schema.AGENT_METHODS.logout: { + if (!agent.unstable_logout) { + throw RequestError.methodNotFound(method); + } + const validatedParams = validate.zLogoutRequest.parse(params); + const result = await agent.unstable_logout(validatedParams); + return result ?? {}; + } case schema.AGENT_METHODS.session_prompt: { const validatedParams = validate.zPromptRequest.parse(params); return agent.prompt(validatedParams); @@ -786,6 +794,24 @@ export class ClientSideConnection implements Agent { ); } + /** + * Terminates the current authenticated session. + * + * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point. + * + * @experimental + */ + async unstable_logout( + params: schema.LogoutRequest, + ): Promise { + return ( + (await this.#connection.sendRequest( + schema.AGENT_METHODS.logout, + params, + )) ?? {} + ); + } + /** * Processes a user prompt within a session. * @@ -1604,6 +1630,17 @@ export interface Agent { authenticate( params: schema.AuthenticateRequest, ): Promise; + /** + * Terminates the current authenticated session. + * + * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point. + * + * @experimental + */ + + unstable_logout?( + params: schema.LogoutRequest, + ): Promise; /** * Processes a user prompt within a session. *