Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions schema/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"nes_reject": "nes/reject",
"nes_start": "nes/start",
"nes_suggest": "nes/suggest",
"providers_disable": "providers/disable",
"providers_list": "providers/list",
"providers_set": "providers/set",
"session_cancel": "session/cancel",
"session_close": "session/close",
"session_fork": "session/fork",
Expand Down
300 changes: 290 additions & 10 deletions schema/schema.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as fs from "fs/promises";
import { dirname } from "path";
import * as prettier from "prettier";

const CURRENT_SCHEMA_RELEASE = "v0.11.6";
const CURRENT_SCHEMA_RELEASE = "v0.12.2";

await main();

Expand Down
4 changes: 2 additions & 2 deletions src/acp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ describe("Connection", () => {
receivedForkSession = params;
return { sessionId: "forked-s1" };
}
async unstable_resumeSession(
async resumeSession(
params: ResumeSessionRequest,
): Promise<ResumeSessionResponse> {
receivedResumeSession = params;
Expand Down Expand Up @@ -2060,7 +2060,7 @@ describe("Connection", () => {
"/extra/root2",
]);

const resumeResponse = await agentConnection.unstable_resumeSession({
const resumeResponse = await agentConnection.resumeSession({
sessionId: "s1",
cwd: "/test",
additionalDirectories: ["/extra/root1", "/extra/root2"],
Expand Down
43 changes: 10 additions & 33 deletions src/acp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,19 @@ export class AgentSideConnection {
return agent.unstable_forkSession(validatedParams);
}
case schema.AGENT_METHODS.session_resume: {
if (!agent.unstable_resumeSession) {
if (!agent.resumeSession) {
throw RequestError.methodNotFound(method);
}
const validatedParams = validate.zResumeSessionRequest.parse(params);
return agent.unstable_resumeSession(validatedParams);
return agent.resumeSession(validatedParams);
}
case schema.AGENT_METHODS.session_close: {
if (!agent.unstable_closeSession) {
if (!agent.closeSession) {
throw RequestError.methodNotFound(method);
}
const validatedParams = validate.zCloseSessionRequest.parse(params);
return agent.unstable_closeSession(validatedParams);
const result = await agent.closeSession(validatedParams);
return result ?? {};
}
case schema.AGENT_METHODS.session_set_mode: {
if (!agent.setSessionMode) {
Expand Down Expand Up @@ -791,10 +792,6 @@ export class ClientSideConnection implements Agent {
}

/**
* **UNSTABLE**
*
* This capability is not part of the spec yet, and may be removed or changed at any point.
*
* Resumes an existing session without returning previous messages.
*
* This method is only available if the agent advertises the `session.resume` capability.
Expand All @@ -804,10 +801,8 @@ export class ClientSideConnection implements Agent {
*
* The request may include `additionalDirectories` to set the complete list of
* additional workspace roots for the resumed session.
*
* @experimental
*/
async unstable_resumeSession(
async resumeSession(
params: schema.ResumeSessionRequest,
): Promise<schema.ResumeSessionResponse> {
return await this.connection.sendRequest(
Expand All @@ -817,20 +812,14 @@ export class ClientSideConnection implements Agent {
}

/**
* **UNSTABLE**
*
* This capability is not part of the spec yet, and may be removed or changed at any point.
*
* Closes an active session and frees up any resources associated with it.
*
* This method is only available if the agent advertises the `session.close` capability.
*
* The agent must cancel any ongoing work (as if `session/cancel` was called)
* and then free up any resources associated with the session.
*
* @experimental
*/
async unstable_closeSession(
async closeSession(
params: schema.CloseSessionRequest,
): Promise<schema.CloseSessionResponse> {
return await this.connection.sendRequest(
Expand Down Expand Up @@ -1910,10 +1899,6 @@ export interface Agent {
params: schema.ListSessionsRequest,
): Promise<schema.ListSessionsResponse>;
/**
* **UNSTABLE**
*
* This capability is not part of the spec yet, and may be removed or changed at any point.
*
* Resumes an existing session without returning previous messages.
*
* This method is only available if the agent advertises the `session.resume` capability.
Expand All @@ -1923,29 +1908,21 @@ export interface Agent {
*
* The request may include `additionalDirectories` to set the complete list of
* additional workspace roots for the resumed session.
*
* @experimental
*/
unstable_resumeSession?(
resumeSession?(
params: schema.ResumeSessionRequest,
): Promise<schema.ResumeSessionResponse>;
/**
* **UNSTABLE**
*
* This capability is not part of the spec yet, and may be removed or changed at any point.
*
* Closes an active session and frees up any resources associated with it.
*
* This method is only available if the agent advertises the `session.close` capability.
*
* The agent must cancel any ongoing work (as if `session/cancel` was called)
* and then free up any resources associated with the session.
*
* @experimental
*/
unstable_closeSession?(
closeSession?(
params: schema.CloseSessionRequest,
): Promise<schema.CloseSessionResponse>;
): Promise<schema.CloseSessionResponse | void>;
/**
* Sets the operational mode for a session.
*
Expand Down
13 changes: 13 additions & 0 deletions src/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export type {
DidOpenDocumentNotification,
DidSaveDocumentNotification,
Diff,
DisableProvidersRequest,
DisableProvidersResponse,
ElicitationAcceptAction,
ElicitationCapabilities,
ElicitationContentValue,
Expand Down Expand Up @@ -84,8 +86,11 @@ export type {
IntegerPropertySchema,
KillTerminalRequest,
KillTerminalResponse,
ListProvidersRequest,
ListProvidersResponse,
ListSessionsRequest,
ListSessionsResponse,
LlmProtocol,
LoadSessionRequest,
LoadSessionResponse,
LogoutCapabilities,
Expand Down Expand Up @@ -152,6 +157,9 @@ export type {
PromptRequest,
PromptResponse,
ProtocolVersion,
ProviderCurrentConfig,
ProviderInfo,
ProvidersCapabilities,
Range,
ReadTextFileRequest,
ReadTextFileResponse,
Expand Down Expand Up @@ -192,6 +200,8 @@ export type {
SessionNotification,
SessionResumeCapabilities,
SessionUpdate,
SetProvidersRequest,
SetProvidersResponse,
SetSessionConfigOptionRequest,
SetSessionConfigOptionResponse,
SetSessionModelRequest,
Expand Down Expand Up @@ -246,6 +256,9 @@ export const AGENT_METHODS = {
nes_reject: "nes/reject",
nes_start: "nes/start",
nes_suggest: "nes/suggest",
providers_disable: "providers/disable",
providers_list: "providers/list",
providers_set: "providers/set",
session_cancel: "session/cancel",
session_close: "session/close",
session_fork: "session/fork",
Expand Down
Loading
Loading