Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/acp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<schema.LogoutResponse> {
return (
(await this.#connection.sendRequest(
schema.AGENT_METHODS.logout,
params,
)) ?? {}
);
}

/**
* Processes a user prompt within a session.
*
Expand Down Expand Up @@ -1604,6 +1630,17 @@ export interface Agent {
authenticate(
params: schema.AuthenticateRequest,
): Promise<schema.AuthenticateResponse | void>;
/**
* 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<schema.LogoutResponse | void>;
/**
* Processes a user prompt within a session.
*
Expand Down
Loading