@agentclientprotocol/sdk
Advanced tools
| export {}; |
+705
| import { describe, it, expect, beforeEach } from "vitest"; | ||
| import { ClientSideConnection, AgentSideConnection, PROTOCOL_VERSION, ndJsonStream, } from "./acp.js"; | ||
| describe("Connection", () => { | ||
| let clientToAgent; | ||
| let agentToClient; | ||
| beforeEach(() => { | ||
| clientToAgent = new TransformStream(); | ||
| agentToClient = new TransformStream(); | ||
| }); | ||
| it("handles errors in bidirectional communication", async () => { | ||
| // Create client that throws errors | ||
| class TestClient { | ||
| async writeTextFile(_) { | ||
| throw new Error("Write failed"); | ||
| } | ||
| async readTextFile(_) { | ||
| throw new Error("Read failed"); | ||
| } | ||
| async requestPermission(_) { | ||
| throw new Error("Permission denied"); | ||
| } | ||
| async sessionUpdate(_) { | ||
| // no-op | ||
| } | ||
| } | ||
| // Create agent that throws errors | ||
| class TestAgent { | ||
| async initialize(_) { | ||
| throw new Error("Failed to initialize"); | ||
| } | ||
| async newSession(_) { | ||
| throw new Error("Failed to create session"); | ||
| } | ||
| async loadSession(_) { | ||
| throw new Error("Failed to load session"); | ||
| } | ||
| async authenticate(_) { | ||
| throw new Error("Authentication failed"); | ||
| } | ||
| async prompt(_) { | ||
| throw new Error("Prompt failed"); | ||
| } | ||
| async cancel(_) { | ||
| // no-op | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection(() => new TestClient(), ndJsonStream(clientToAgent.writable, agentToClient.readable)); | ||
| const clientConnection = new AgentSideConnection(() => new TestAgent(), ndJsonStream(agentToClient.writable, clientToAgent.readable)); | ||
| // Test error handling in client->agent direction | ||
| await expect(clientConnection.writeTextFile({ | ||
| path: "/test.txt", | ||
| content: "test", | ||
| sessionId: "test-session", | ||
| })).rejects.toThrow(); | ||
| // Test error handling in agent->client direction | ||
| await expect(agentConnection.newSession({ | ||
| cwd: "/test", | ||
| mcpServers: [], | ||
| })).rejects.toThrow(); | ||
| }); | ||
| it("handles concurrent requests", async () => { | ||
| let requestCount = 0; | ||
| // Create client | ||
| class TestClient { | ||
| async writeTextFile(_) { | ||
| requestCount++; | ||
| const currentCount = requestCount; | ||
| await new Promise((resolve) => setTimeout(resolve, 40)); | ||
| console.log(`Write request ${currentCount} completed`); | ||
| return {}; | ||
| } | ||
| async readTextFile(params) { | ||
| return { content: `Content of ${params.path}` }; | ||
| } | ||
| async requestPermission(_) { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_) { | ||
| // no-op | ||
| } | ||
| } | ||
| // Create agent | ||
| class TestAgent { | ||
| async initialize(_) { | ||
| return { | ||
| protocolVersion: 1, | ||
| agentCapabilities: { loadSession: false }, | ||
| authMethods: [], | ||
| }; | ||
| } | ||
| async newSession(_) { | ||
| return { | ||
| sessionId: "test-session", | ||
| }; | ||
| } | ||
| async loadSession(_) { | ||
| return {}; | ||
| } | ||
| async authenticate(_) { | ||
| // no-op | ||
| } | ||
| async prompt(_) { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_) { | ||
| // no-op | ||
| } | ||
| } | ||
| // Set up connections | ||
| new ClientSideConnection(() => new TestClient(), ndJsonStream(clientToAgent.writable, agentToClient.readable)); | ||
| const clientConnection = new AgentSideConnection(() => new TestAgent(), ndJsonStream(agentToClient.writable, clientToAgent.readable)); | ||
| // Send multiple concurrent requests | ||
| const promises = [ | ||
| clientConnection.writeTextFile({ | ||
| path: "/file1.txt", | ||
| content: "content1", | ||
| sessionId: "session1", | ||
| }), | ||
| clientConnection.writeTextFile({ | ||
| path: "/file2.txt", | ||
| content: "content2", | ||
| sessionId: "session1", | ||
| }), | ||
| clientConnection.writeTextFile({ | ||
| path: "/file3.txt", | ||
| content: "content3", | ||
| sessionId: "session1", | ||
| }), | ||
| ]; | ||
| const results = await Promise.all(promises); | ||
| // Verify all requests completed successfully | ||
| expect(results).toHaveLength(3); | ||
| expect(results[0]).toEqual({}); | ||
| expect(results[1]).toEqual({}); | ||
| expect(results[2]).toEqual({}); | ||
| expect(requestCount).toBe(3); | ||
| }); | ||
| it("handles message ordering correctly", async () => { | ||
| const messageLog = []; | ||
| // Create client | ||
| class TestClient { | ||
| async writeTextFile(params) { | ||
| messageLog.push(`writeTextFile called: ${params.path}`); | ||
| return {}; | ||
| } | ||
| async readTextFile(params) { | ||
| messageLog.push(`readTextFile called: ${params.path}`); | ||
| return { content: "test content" }; | ||
| } | ||
| async requestPermission(params) { | ||
| messageLog.push(`requestPermission called: ${params.toolCall.title}`); | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_params) { | ||
| messageLog.push("sessionUpdate called"); | ||
| } | ||
| } | ||
| // Create agent | ||
| class TestAgent { | ||
| async initialize(_) { | ||
| return { | ||
| protocolVersion: 1, | ||
| agentCapabilities: { loadSession: false }, | ||
| authMethods: [], | ||
| }; | ||
| } | ||
| async newSession(request) { | ||
| messageLog.push(`newSession called: ${request.cwd}`); | ||
| return { | ||
| sessionId: "test-session", | ||
| }; | ||
| } | ||
| async loadSession(params) { | ||
| messageLog.push(`loadSession called: ${params.sessionId}`); | ||
| return {}; | ||
| } | ||
| async authenticate(params) { | ||
| messageLog.push(`authenticate called: ${params.methodId}`); | ||
| } | ||
| async prompt(params) { | ||
| messageLog.push(`prompt called: ${params.sessionId}`); | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(params) { | ||
| messageLog.push(`cancelled called: ${params.sessionId}`); | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection(() => new TestClient(), ndJsonStream(clientToAgent.writable, agentToClient.readable)); | ||
| const clientConnection = new AgentSideConnection(() => new TestAgent(), ndJsonStream(agentToClient.writable, clientToAgent.readable)); | ||
| // Send requests in specific order | ||
| await agentConnection.newSession({ | ||
| cwd: "/test", | ||
| mcpServers: [], | ||
| }); | ||
| await clientConnection.writeTextFile({ | ||
| path: "/test.txt", | ||
| content: "test", | ||
| sessionId: "test-session", | ||
| }); | ||
| await clientConnection.readTextFile({ | ||
| path: "/test.txt", | ||
| sessionId: "test-session", | ||
| }); | ||
| await clientConnection.requestPermission({ | ||
| sessionId: "test-session", | ||
| toolCall: { | ||
| title: "Execute command", | ||
| kind: "execute", | ||
| status: "pending", | ||
| toolCallId: "tool-123", | ||
| content: [ | ||
| { | ||
| type: "content", | ||
| content: { | ||
| type: "text", | ||
| text: "ls -la", | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| options: [ | ||
| { | ||
| kind: "allow_once", | ||
| name: "Allow", | ||
| optionId: "allow", | ||
| }, | ||
| { | ||
| kind: "reject_once", | ||
| name: "Reject", | ||
| optionId: "reject", | ||
| }, | ||
| ], | ||
| }); | ||
| // Verify order | ||
| expect(messageLog).toEqual([ | ||
| "newSession called: /test", | ||
| "writeTextFile called: /test.txt", | ||
| "readTextFile called: /test.txt", | ||
| "requestPermission called: Execute command", | ||
| ]); | ||
| }); | ||
| it("handles notifications correctly", async () => { | ||
| const notificationLog = []; | ||
| // Create client | ||
| class TestClient { | ||
| async writeTextFile(_) { | ||
| return {}; | ||
| } | ||
| async readTextFile(_) { | ||
| return { content: "test" }; | ||
| } | ||
| async requestPermission(_) { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(notification) { | ||
| if (notification.update && | ||
| "sessionUpdate" in notification.update && | ||
| notification.update.sessionUpdate === "agent_message_chunk") { | ||
| notificationLog.push(`agent message: ${notification.update.content.text}`); | ||
| } | ||
| } | ||
| } | ||
| // Create agent | ||
| class TestAgent { | ||
| async initialize(_) { | ||
| return { | ||
| protocolVersion: 1, | ||
| agentCapabilities: { loadSession: false }, | ||
| authMethods: [], | ||
| }; | ||
| } | ||
| async newSession(_) { | ||
| return { | ||
| sessionId: "test-session", | ||
| }; | ||
| } | ||
| async loadSession(_) { | ||
| return {}; | ||
| } | ||
| async authenticate(_) { | ||
| // no-op | ||
| } | ||
| async prompt(_) { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(params) { | ||
| notificationLog.push(`cancelled: ${params.sessionId}`); | ||
| } | ||
| } | ||
| // Create shared instances | ||
| const testClient = () => new TestClient(); | ||
| const testAgent = () => new TestAgent(); | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection(testClient, ndJsonStream(clientToAgent.writable, agentToClient.readable)); | ||
| const clientConnection = new AgentSideConnection(testAgent, ndJsonStream(agentToClient.writable, clientToAgent.readable)); | ||
| // Send notifications | ||
| await clientConnection.sessionUpdate({ | ||
| sessionId: "test-session", | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: "Hello from agent", | ||
| }, | ||
| }, | ||
| }); | ||
| await agentConnection.cancel({ | ||
| sessionId: "test-session", | ||
| }); | ||
| // Wait a bit for async handlers | ||
| await new Promise((resolve) => setTimeout(resolve, 50)); | ||
| // Verify notifications were received | ||
| expect(notificationLog).toContain("agent message: Hello from agent"); | ||
| expect(notificationLog).toContain("cancelled: test-session"); | ||
| }); | ||
| it("handles initialize method", async () => { | ||
| // Create client | ||
| class TestClient { | ||
| async writeTextFile(_) { | ||
| return {}; | ||
| } | ||
| async readTextFile(_) { | ||
| return { content: "test" }; | ||
| } | ||
| async requestPermission(_) { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_) { | ||
| // no-op | ||
| } | ||
| } | ||
| // Create agent | ||
| class TestAgent { | ||
| async initialize(params) { | ||
| return { | ||
| protocolVersion: params.protocolVersion, | ||
| agentCapabilities: { loadSession: true }, | ||
| authMethods: [ | ||
| { | ||
| id: "oauth", | ||
| name: "OAuth", | ||
| description: "Authenticate with OAuth", | ||
| }, | ||
| ], | ||
| }; | ||
| } | ||
| async newSession(_) { | ||
| return { sessionId: "test-session" }; | ||
| } | ||
| async loadSession(_) { | ||
| return {}; | ||
| } | ||
| async authenticate(_) { | ||
| // no-op | ||
| } | ||
| async prompt(_) { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_) { | ||
| // no-op | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection(() => new TestClient(), ndJsonStream(clientToAgent.writable, agentToClient.readable)); | ||
| new AgentSideConnection(() => new TestAgent(), ndJsonStream(agentToClient.writable, clientToAgent.readable)); | ||
| // Test initialize request | ||
| const response = await agentConnection.initialize({ | ||
| protocolVersion: PROTOCOL_VERSION, | ||
| clientCapabilities: { | ||
| fs: { | ||
| readTextFile: false, | ||
| writeTextFile: false, | ||
| }, | ||
| }, | ||
| }); | ||
| expect(response.protocolVersion).toBe(PROTOCOL_VERSION); | ||
| expect(response.agentCapabilities?.loadSession).toBe(true); | ||
| expect(response.authMethods).toHaveLength(1); | ||
| expect(response.authMethods?.[0].id).toBe("oauth"); | ||
| }); | ||
| it("handles extension methods and notifications", async () => { | ||
| const extensionLog = []; | ||
| // Create client with extension method support | ||
| class TestClient { | ||
| async writeTextFile(_) { | ||
| return {}; | ||
| } | ||
| async readTextFile(_) { | ||
| return { content: "test" }; | ||
| } | ||
| async requestPermission(_) { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_) { | ||
| // no-op | ||
| } | ||
| async extMethod(method, params) { | ||
| if (method === "example.com/ping") { | ||
| return { response: "pong", params }; | ||
| } | ||
| throw new Error(`Unknown method: ${method}`); | ||
| } | ||
| async extNotification(method, _params) { | ||
| extensionLog.push(`client extNotification: ${method}`); | ||
| } | ||
| } | ||
| // Create agent with extension method support | ||
| class TestAgent { | ||
| async initialize(_) { | ||
| return { | ||
| protocolVersion: PROTOCOL_VERSION, | ||
| agentCapabilities: { loadSession: false }, | ||
| }; | ||
| } | ||
| async newSession(_) { | ||
| return { sessionId: "test-session" }; | ||
| } | ||
| async authenticate(_) { | ||
| // no-op | ||
| } | ||
| async prompt(_) { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_) { | ||
| // no-op | ||
| } | ||
| async extMethod(method, params) { | ||
| if (method === "example.com/echo") { | ||
| return { echo: params }; | ||
| } | ||
| throw new Error(`Unknown method: ${method}`); | ||
| } | ||
| async extNotification(method, _params) { | ||
| extensionLog.push(`agent extNotification: ${method}`); | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection(() => new TestClient(), ndJsonStream(clientToAgent.writable, agentToClient.readable)); | ||
| const clientConnection = new AgentSideConnection(() => new TestAgent(), ndJsonStream(agentToClient.writable, clientToAgent.readable)); | ||
| // Test agent calling client extension method | ||
| const clientResponse = await clientConnection.extMethod("example.com/ping", { | ||
| data: "test", | ||
| }); | ||
| expect(clientResponse).toEqual({ | ||
| response: "pong", | ||
| params: { data: "test" }, | ||
| }); | ||
| // Test client calling agent extension method | ||
| const agentResponse = await agentConnection.extMethod("example.com/echo", { | ||
| message: "hello", | ||
| }); | ||
| expect(agentResponse).toEqual({ echo: { message: "hello" } }); | ||
| // Test extension notifications | ||
| await clientConnection.extNotification("example.com/client/notify", { | ||
| info: "client notification", | ||
| }); | ||
| await agentConnection.extNotification("example.com/agent/notify", { | ||
| info: "agent notification", | ||
| }); | ||
| // Wait a bit for async handlers | ||
| await new Promise((resolve) => setTimeout(resolve, 50)); | ||
| // Verify notifications were logged | ||
| expect(extensionLog).toContain("client extNotification: example.com/client/notify"); | ||
| expect(extensionLog).toContain("agent extNotification: example.com/agent/notify"); | ||
| }); | ||
| it("handles optional extension methods correctly", async () => { | ||
| // Create client WITHOUT extension methods | ||
| class TestClientWithoutExtensions { | ||
| async writeTextFile(_) { | ||
| return {}; | ||
| } | ||
| async readTextFile(_) { | ||
| return { content: "test" }; | ||
| } | ||
| async requestPermission(_) { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_) { | ||
| // no-op | ||
| } | ||
| } | ||
| // Create agent WITHOUT extension methods | ||
| class TestAgentWithoutExtensions { | ||
| async initialize(_) { | ||
| return { | ||
| protocolVersion: PROTOCOL_VERSION, | ||
| agentCapabilities: { loadSession: false }, | ||
| }; | ||
| } | ||
| async newSession(_) { | ||
| return { sessionId: "test-session" }; | ||
| } | ||
| async authenticate(_) { | ||
| // no-op | ||
| } | ||
| async prompt(_) { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_) { | ||
| // no-op | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection(() => new TestClientWithoutExtensions(), ndJsonStream(clientToAgent.writable, agentToClient.readable)); | ||
| const clientConnection = new AgentSideConnection(() => new TestAgentWithoutExtensions(), ndJsonStream(agentToClient.writable, clientToAgent.readable)); | ||
| // Test that calling extension methods on connections without them throws method not found | ||
| try { | ||
| await clientConnection.extMethod("example.com/ping", { data: "test" }); | ||
| expect.fail("Should have thrown method not found error"); | ||
| } | ||
| catch (error) { | ||
| expect(error.code).toBe(-32601); // Method not found | ||
| expect(error.data.method).toBe("_example.com/ping"); // Should show full method name with underscore | ||
| } | ||
| try { | ||
| await agentConnection.extMethod("example.com/echo", { message: "hello" }); | ||
| expect.fail("Should have thrown method not found error"); | ||
| } | ||
| catch (error) { | ||
| expect(error.code).toBe(-32601); // Method not found | ||
| expect(error.data.method).toBe("_example.com/echo"); // Should show full method name with underscore | ||
| } | ||
| // Notifications should be ignored when not implemented (no error thrown) | ||
| await clientConnection.extNotification("example.com/notify", { | ||
| info: "test", | ||
| }); | ||
| await agentConnection.extNotification("example.com/notify", { | ||
| info: "test", | ||
| }); | ||
| }); | ||
| it("handles methods returning response objects with _meta or void", async () => { | ||
| // Create client that returns both response objects and void | ||
| class TestClient { | ||
| async writeTextFile(_params) { | ||
| // Return response object with _meta | ||
| return { | ||
| _meta: { | ||
| timestamp: new Date().toISOString(), | ||
| version: "1.0.0", | ||
| }, | ||
| }; | ||
| } | ||
| async readTextFile(_params) { | ||
| return { | ||
| content: "test content", | ||
| _meta: { | ||
| encoding: "utf-8", | ||
| }, | ||
| }; | ||
| } | ||
| async requestPermission(_params) { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| _meta: { | ||
| userId: "test-user", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_params) { | ||
| // Returns void | ||
| } | ||
| } | ||
| // Create agent that returns both response objects and void | ||
| class TestAgent { | ||
| async initialize(params) { | ||
| return { | ||
| protocolVersion: params.protocolVersion, | ||
| agentCapabilities: { loadSession: true }, | ||
| _meta: { | ||
| agentVersion: "2.0.0", | ||
| }, | ||
| }; | ||
| } | ||
| async newSession(_params) { | ||
| return { | ||
| sessionId: "test-session", | ||
| _meta: { | ||
| sessionType: "ephemeral", | ||
| }, | ||
| }; | ||
| } | ||
| async loadSession(_params) { | ||
| // Test returning minimal response | ||
| return {}; | ||
| } | ||
| async authenticate(params) { | ||
| if (params.methodId === "none") { | ||
| // Test returning void | ||
| return; | ||
| } | ||
| // Test returning response with _meta | ||
| return { | ||
| _meta: { | ||
| authenticated: true, | ||
| method: params.methodId, | ||
| }, | ||
| }; | ||
| } | ||
| async prompt(_params) { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_params) { | ||
| // Returns void | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection(() => new TestClient(), ndJsonStream(clientToAgent.writable, agentToClient.readable)); | ||
| const clientConnection = new AgentSideConnection(() => new TestAgent(), ndJsonStream(agentToClient.writable, clientToAgent.readable)); | ||
| // Test writeTextFile returns response with _meta | ||
| const writeResponse = await clientConnection.writeTextFile({ | ||
| path: "/test.txt", | ||
| content: "test", | ||
| sessionId: "test-session", | ||
| }); | ||
| expect(writeResponse).toEqual({ | ||
| _meta: { | ||
| timestamp: expect.any(String), | ||
| version: "1.0.0", | ||
| }, | ||
| }); | ||
| // Test readTextFile returns response with content and _meta | ||
| const readResponse = await clientConnection.readTextFile({ | ||
| path: "/test.txt", | ||
| sessionId: "test-session", | ||
| }); | ||
| expect(readResponse.content).toBe("test content"); | ||
| expect(readResponse._meta).toEqual({ | ||
| encoding: "utf-8", | ||
| }); | ||
| // Test initialize with _meta | ||
| const initResponse = await agentConnection.initialize({ | ||
| protocolVersion: PROTOCOL_VERSION, | ||
| clientCapabilities: {}, | ||
| }); | ||
| expect(initResponse._meta).toEqual({ | ||
| agentVersion: "2.0.0", | ||
| }); | ||
| // Test authenticate returning void | ||
| const authResponseVoid = await agentConnection.authenticate({ | ||
| methodId: "none", | ||
| }); | ||
| expect(authResponseVoid).toEqual({}); | ||
| // Test authenticate returning response with _meta | ||
| const authResponse = await agentConnection.authenticate({ | ||
| methodId: "oauth", | ||
| }); | ||
| expect(authResponse).toEqual({ | ||
| _meta: { | ||
| authenticated: true, | ||
| method: "oauth", | ||
| }, | ||
| }); | ||
| // Test newSession with _meta | ||
| const sessionResponse = await agentConnection.newSession({ | ||
| cwd: "/test", | ||
| mcpServers: [], | ||
| }); | ||
| expect(sessionResponse._meta).toEqual({ | ||
| sessionType: "ephemeral", | ||
| }); | ||
| // Test loadSession returning minimal response | ||
| const loadResponse = await agentConnection.loadSession({ | ||
| sessionId: "test-session", | ||
| mcpServers: [], | ||
| cwd: "/test", | ||
| }); | ||
| expect(loadResponse).toEqual({}); | ||
| }); | ||
| }); | ||
| //# sourceMappingURL=acp.test.js.map |
| {"version":3,"file":"acp.test.js","sourceRoot":"","sources":["../src/acp.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAEL,oBAAoB,EAEpB,mBAAmB,EAmBnB,gBAAgB,EAChB,YAAY,GACb,MAAM,UAAU,CAAC;AAElB,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAA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AC;QACH,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC;YAC3B,KAAK,EAAE;gBACL,aAAa,EAAE,IAAI;gBACnB,MAAM,EAAE,OAAO;aAChB;SACF,CAAC,CAAC;QAEH,6BAA6B;QAC7B,MAAM,eAAe,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC;YACvD,GAAG,EAAE,OAAO;YACZ,UAAU,EAAE,EAAE;SACf,CAAC,CAAC;QACH,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YACpC,WAAW,EAAE,WAAW;SACzB,CAAC,CAAC;QAEH,8CAA8C;QAC9C,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC;YACrD,SAAS,EAAE,cAAc;YACzB,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,OAAO;SACb,CAAC,CAAC;QACH,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} |
| #!/usr/bin/env node | ||
| export {}; |
| #!/usr/bin/env node | ||
| import * as acp from "../acp.js"; | ||
| import { Readable, Writable } from "node:stream"; | ||
| class ExampleAgent { | ||
| connection; | ||
| sessions; | ||
| constructor(connection) { | ||
| this.connection = connection; | ||
| this.sessions = new Map(); | ||
| } | ||
| async initialize(_params) { | ||
| return { | ||
| protocolVersion: acp.PROTOCOL_VERSION, | ||
| agentCapabilities: { | ||
| loadSession: false, | ||
| }, | ||
| }; | ||
| } | ||
| async newSession(_params) { | ||
| const sessionId = Math.random().toString(36).substring(2); | ||
| this.sessions.set(sessionId, { | ||
| pendingPrompt: null, | ||
| }); | ||
| return { | ||
| sessionId, | ||
| }; | ||
| } | ||
| async authenticate(_params) { | ||
| // No auth needed - return empty response | ||
| return {}; | ||
| } | ||
| async setSessionMode(_params) { | ||
| // Session mode changes not implemented in this example | ||
| return {}; | ||
| } | ||
| async prompt(params) { | ||
| const session = this.sessions.get(params.sessionId); | ||
| if (!session) { | ||
| throw new Error(`Session ${params.sessionId} not found`); | ||
| } | ||
| session.pendingPrompt?.abort(); | ||
| session.pendingPrompt = new AbortController(); | ||
| try { | ||
| await this.simulateTurn(params.sessionId, session.pendingPrompt.signal); | ||
| } | ||
| catch (err) { | ||
| if (session.pendingPrompt.signal.aborted) { | ||
| return { stopReason: "cancelled" }; | ||
| } | ||
| throw err; | ||
| } | ||
| session.pendingPrompt = null; | ||
| return { | ||
| stopReason: "end_turn", | ||
| }; | ||
| } | ||
| async simulateTurn(sessionId, abortSignal) { | ||
| // Send initial text chunk | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: "I'll help you with that. Let me start by reading some files to understand the current situation.", | ||
| }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| // Send a tool call that doesn't need permission | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "tool_call", | ||
| toolCallId: "call_1", | ||
| title: "Reading project files", | ||
| kind: "read", | ||
| status: "pending", | ||
| locations: [{ path: "/project/README.md" }], | ||
| rawInput: { path: "/project/README.md" }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| // Update tool call to completed | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "tool_call_update", | ||
| toolCallId: "call_1", | ||
| status: "completed", | ||
| content: [ | ||
| { | ||
| type: "content", | ||
| content: { | ||
| type: "text", | ||
| text: "# My Project\n\nThis is a sample project...", | ||
| }, | ||
| }, | ||
| ], | ||
| rawOutput: { content: "# My Project\n\nThis is a sample project..." }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| // Send more text | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: " Now I understand the project structure. I need to make some changes to improve it.", | ||
| }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| // Send a tool call that DOES need permission | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "tool_call", | ||
| toolCallId: "call_2", | ||
| title: "Modifying critical configuration file", | ||
| kind: "edit", | ||
| status: "pending", | ||
| locations: [{ path: "/project/config.json" }], | ||
| rawInput: { | ||
| path: "/project/config.json", | ||
| content: '{"database": {"host": "new-host"}}', | ||
| }, | ||
| }, | ||
| }); | ||
| // Request permission for the sensitive operation | ||
| const permissionResponse = await this.connection.requestPermission({ | ||
| sessionId, | ||
| toolCall: { | ||
| toolCallId: "call_2", | ||
| title: "Modifying critical configuration file", | ||
| kind: "edit", | ||
| status: "pending", | ||
| locations: [{ path: "/home/user/project/config.json" }], | ||
| rawInput: { | ||
| path: "/home/user/project/config.json", | ||
| content: '{"database": {"host": "new-host"}}', | ||
| }, | ||
| }, | ||
| options: [ | ||
| { | ||
| kind: "allow_once", | ||
| name: "Allow this change", | ||
| optionId: "allow", | ||
| }, | ||
| { | ||
| kind: "reject_once", | ||
| name: "Skip this change", | ||
| optionId: "reject", | ||
| }, | ||
| ], | ||
| }); | ||
| if (permissionResponse.outcome.outcome === "cancelled") { | ||
| return; | ||
| } | ||
| switch (permissionResponse.outcome.optionId) { | ||
| case "allow": { | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "tool_call_update", | ||
| toolCallId: "call_2", | ||
| status: "completed", | ||
| rawOutput: { success: true, message: "Configuration updated" }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: " Perfect! I've successfully updated the configuration. The changes have been applied.", | ||
| }, | ||
| }, | ||
| }); | ||
| break; | ||
| } | ||
| case "reject": { | ||
| await this.simulateModelInteraction(abortSignal); | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: " I understand you prefer not to make that change. I'll skip the configuration update.", | ||
| }, | ||
| }, | ||
| }); | ||
| break; | ||
| } | ||
| default: | ||
| throw new Error(`Unexpected permission outcome ${permissionResponse.outcome}`); | ||
| } | ||
| } | ||
| simulateModelInteraction(abortSignal) { | ||
| return new Promise((resolve, reject) => setTimeout(() => { | ||
| // In a real agent, you'd pass this abort signal to the LLM client | ||
| if (abortSignal.aborted) { | ||
| reject(); | ||
| } | ||
| else { | ||
| resolve(); | ||
| } | ||
| }, 1000)); | ||
| } | ||
| async cancel(params) { | ||
| this.sessions.get(params.sessionId)?.pendingPrompt?.abort(); | ||
| } | ||
| } | ||
| const input = Writable.toWeb(process.stdout); | ||
| const output = Readable.toWeb(process.stdin); | ||
| const stream = acp.ndJsonStream(input, output); | ||
| new acp.AgentSideConnection((conn) => new ExampleAgent(conn), stream); | ||
| //# sourceMappingURL=agent.js.map |
| {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/examples/agent.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMjD,MAAM,YAAY;IACR,UAAU,CAA0B;IACpC,QAAQ,CAA4B;IAE5C,YAAY,UAAmC;QAC7C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,UAAU,CACd,OAA8B;QAE9B,OAAO;YACL,eAAe,EAAE,GAAG,CAAC,gBAAgB;YACrC,iBAAiB,EAAE;gBACjB,WAAW,EAAE,KAAK;aACnB;SACF,CAAC;IACJ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O,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CACrC,UAAU,CAAC,GAAG,EAAE;YACd,kEAAkE;YAClE,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACxB,MAAM,EAAE,CAAC;YACX,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,CACT,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAA8B;QACzC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAC9D,CAAC;CACF;AAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAA+B,CAAC;AAE3E,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/C,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC"} |
| #!/usr/bin/env node | ||
| export {}; |
| #!/usr/bin/env node | ||
| import { spawn } from "node:child_process"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { dirname, join } from "node:path"; | ||
| import { Writable, Readable } from "node:stream"; | ||
| import readline from "node:readline/promises"; | ||
| import * as acp from "../acp.js"; | ||
| class ExampleClient { | ||
| async requestPermission(params) { | ||
| console.log(`\n🔐 Permission requested: ${params.toolCall.title}`); | ||
| console.log(`\nOptions:`); | ||
| params.options.forEach((option, index) => { | ||
| console.log(` ${index + 1}. ${option.name} (${option.kind})`); | ||
| }); | ||
| while (true) { | ||
| const rl = readline.createInterface({ | ||
| input: process.stdin, | ||
| output: process.stdout, | ||
| }); | ||
| const answer = await rl.question("\nChoose an option: "); | ||
| const trimmedAnswer = answer.trim(); | ||
| const optionIndex = parseInt(trimmedAnswer) - 1; | ||
| if (optionIndex >= 0 && optionIndex < params.options.length) { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: params.options[optionIndex].optionId, | ||
| }, | ||
| }; | ||
| } | ||
| else { | ||
| console.log("Invalid option. Please try again."); | ||
| } | ||
| } | ||
| } | ||
| async sessionUpdate(params) { | ||
| const update = params.update; | ||
| switch (update.sessionUpdate) { | ||
| case "agent_message_chunk": | ||
| if (update.content.type === "text") { | ||
| console.log(update.content.text); | ||
| } | ||
| else { | ||
| console.log(`[${update.content.type}]`); | ||
| } | ||
| break; | ||
| case "tool_call": | ||
| console.log(`\n🔧 ${update.title} (${update.status})`); | ||
| break; | ||
| case "tool_call_update": | ||
| console.log(`\n🔧 Tool call \`${update.toolCallId}\` updated: ${update.status}\n`); | ||
| break; | ||
| case "plan": | ||
| case "agent_thought_chunk": | ||
| case "user_message_chunk": | ||
| console.log(`[${update.sessionUpdate}]`); | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| } | ||
| async writeTextFile(params) { | ||
| console.error("[Client] Write text file called with:", JSON.stringify(params, null, 2)); | ||
| return {}; | ||
| } | ||
| async readTextFile(params) { | ||
| console.error("[Client] Read text file called with:", JSON.stringify(params, null, 2)); | ||
| return { | ||
| content: "Mock file content", | ||
| }; | ||
| } | ||
| } | ||
| async function main() { | ||
| // Get the current file's directory to find agent.ts | ||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = dirname(__filename); | ||
| const agentPath = join(__dirname, "agent.ts"); | ||
| // Spawn the agent as a subprocess using tsx | ||
| const agentProcess = spawn("npx", ["tsx", agentPath], { | ||
| stdio: ["pipe", "pipe", "inherit"], | ||
| }); | ||
| // Create streams to communicate with the agent | ||
| const input = Writable.toWeb(agentProcess.stdin); | ||
| const output = Readable.toWeb(agentProcess.stdout); | ||
| // Create the client connection | ||
| const client = new ExampleClient(); | ||
| const stream = acp.ndJsonStream(input, output); | ||
| const connection = new acp.ClientSideConnection((_agent) => client, stream); | ||
| try { | ||
| // Initialize the connection | ||
| const initResult = await connection.initialize({ | ||
| protocolVersion: acp.PROTOCOL_VERSION, | ||
| clientCapabilities: { | ||
| fs: { | ||
| readTextFile: true, | ||
| writeTextFile: true, | ||
| }, | ||
| }, | ||
| }); | ||
| console.log(`✅ Connected to agent (protocol v${initResult.protocolVersion})`); | ||
| // Create a new session | ||
| const sessionResult = await connection.newSession({ | ||
| cwd: process.cwd(), | ||
| mcpServers: [], | ||
| }); | ||
| console.log(`📝 Created session: ${sessionResult.sessionId}`); | ||
| console.log(`💬 User: Hello, agent!\n`); | ||
| process.stdout.write(" "); | ||
| // Send a test prompt | ||
| const promptResult = await connection.prompt({ | ||
| sessionId: sessionResult.sessionId, | ||
| prompt: [ | ||
| { | ||
| type: "text", | ||
| text: "Hello, agent!", | ||
| }, | ||
| ], | ||
| }); | ||
| console.log(`\n\n✅ Agent completed with: ${promptResult.stopReason}`); | ||
| } | ||
| catch (error) { | ||
| console.error("[Client] Error:", error); | ||
| } | ||
| finally { | ||
| agentProcess.kill(); | ||
| process.exit(0); | ||
| } | ||
| } | ||
| main().catch(console.error); | ||
| //# sourceMappingURL=client.js.map |
| {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/examples/client.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAE9C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,MAAM,aAAa;IACjB,KAAK,CAAC,iBAAiB,CACrB,MAAoC;QAEpC,OA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AC,GAAG,CAAC,uBAAuB,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE1B,qBAAqB;QACrB,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC;YAC3C,SAAS,EAAE,aAAa,CAAC,SAAS;YAClC,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,eAAe;iBACtB;aACF;SACF,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,+BAA+B,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC;IACxE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"} |
+2
-2
@@ -599,3 +599,3 @@ import { z } from "zod"; | ||
| } | ||
| catch (_err) { | ||
| catch { | ||
| return RequestError.internalError({ details }).toResult(); | ||
@@ -630,3 +630,3 @@ } | ||
| } | ||
| catch (_err) { | ||
| catch { | ||
| return RequestError.internalError({ details }).toResult(); | ||
@@ -633,0 +633,0 @@ } |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"acp.js","sourceRoot":"","sources":["../typescript/acp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAa5B;;;;;;;;;GASG;AACH,M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A;;GAEG"} | ||
| {"version":3,"file":"jsonrpc.js","sourceRoot":"","sources":["../src/jsonrpc.ts"],"names":[],"mappings":"AAAA;;GAEG"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"schema.js","sourceRoot":"","sources":["../typescript/schema.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,iBAAiB,EAAE,mBAAmB;CAC9B,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,0BAA0B,EAAE,4BAA4B;IACxD,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,aAAa,EAAE,eAAe;IAC9B,eAAe,EAAE,iBAAiB;IAClC,gBAAgB,EAAE,kBAAkB;IACpC,sBAAsB,EAAE,wBAAwB;CACxC,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0pDxB,gBAAgB;AAChB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IACvC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAEH,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAA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C,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YAClD,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC"} |
+18
-21
| { | ||
| "name": "@agentclientprotocol/sdk", | ||
| "version": "0.4.6", | ||
| "version": "0.4.7", | ||
| "publishConfig": { | ||
@@ -8,9 +8,9 @@ "access": "public" | ||
| "description": "The Agent Client Protocol (ACP) is a protocol that standardizes communication between *code editors* (interactive programs for viewing and editing source code) and *coding agents* (programs that use generative AI to autonomously modify code).", | ||
| "homepage": "https://github.com/agentclientprotocol/agent-client-protocol#readme", | ||
| "homepage": "https://github.com/agentclientprotocol/typescript-sdk#readme", | ||
| "bugs": { | ||
| "url": "https://github.com/agentclientprotocol/agent-client-protocol/issues" | ||
| "url": "https://github.com/agentclientprotocol/typescript-sdk/issues" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/agentclientprotocol/agent-client-protocol.git" | ||
| "url": "git+https://github.com/agentclientprotocol/typescript-sdk.git" | ||
| }, | ||
@@ -32,23 +32,16 @@ "license": "Apache-2.0", | ||
| "scripts": { | ||
| "prepublishOnly": "cp typescript/README.md README.md", | ||
| "postpublish": "git checkout README.md", | ||
| "clean": "rm -rf dist tsconfig.tsbuildinfo && cargo clean", | ||
| "test": "cargo check --all-targets && cargo test && vitest run", | ||
| "test:ts": "vitest run", | ||
| "test:ts:watch": "vitest", | ||
| "generate:json-schema": "cd rust && cargo run --bin generate --features unstable", | ||
| "generate:ts-schema": "node typescript/generate.js", | ||
| "generate": "npm run generate:json-schema && npm run generate:ts-schema && npm run format", | ||
| "clean": "rm -rf dist tsconfig.tsbuildinfo", | ||
| "test": "vitest run", | ||
| "generate": "node scripts/generate.js && npm run format", | ||
| "build": "npm run generate && tsc", | ||
| "format": "prettier --write . && cargo fmt", | ||
| "format:check": "prettier --check . && cargo fmt -- --check", | ||
| "lint": "cargo clippy", | ||
| "lint:fix": "cargo clippy --fix", | ||
| "format": "prettier --write .", | ||
| "format:check": "prettier --check .", | ||
| "lint": "eslint", | ||
| "lint:fix": "eslint --fix", | ||
| "spellcheck": "./scripts/spellcheck.sh", | ||
| "spellcheck:fix": "./scripts/spellcheck.sh --write-changes", | ||
| "check": "npm run lint && npm run format:check && npm run spellcheck && npm run build && npm run test && npm run docs:ts:verify", | ||
| "docs": "cd docs && npx mint@4.2.93 dev", | ||
| "docs:ts:build": "cd typescript && typedoc && echo 'TypeScript documentation generated in ./typescript/docs'", | ||
| "docs:ts:dev": "concurrently \"cd typescript && typedoc --watch --preserveWatchOutput\" \"npx http-server typescript/docs -p 8081\"", | ||
| "docs:ts:verify": "cd typescript && typedoc --emit none && echo 'TypeDoc verification passed'" | ||
| "docs:ts:build": "cd src && typedoc && echo 'TypeScript documentation generated in ./src/docs'", | ||
| "docs:ts:dev": "concurrently \"cd src && typedoc --watch --preserveWatchOutput\" \"npx http-server src/docs -p 8081\"", | ||
| "docs:ts:verify": "cd src && typedoc --emit none && echo 'TypeDoc verification passed'" | ||
| }, | ||
@@ -60,3 +53,7 @@ "dependencies": { | ||
| "@types/node": "^24.1.0", | ||
| "@typescript-eslint/eslint-plugin": "8.46.0", | ||
| "@typescript-eslint/parser": "8.46.0", | ||
| "concurrently": "^9.1.0", | ||
| "eslint": "^9.37.0", | ||
| "eslint-config-prettier": "10.1.8", | ||
| "http-server": "^14.1.1", | ||
@@ -63,0 +60,0 @@ "json-schema-to-typescript": "^15.0.4", |
+12
-8
@@ -25,11 +25,11 @@ <a href="https://agentclientprotocol.com/" > | ||
| The [examples directory](https://github.com/agentclientprotocol/agent-client-protocol/tree/main/typescript/examples) contains simple implementations of both Agents and Clients in TypeScript. These examples can be run from your terminal or from an ACP Client like [Zed](https://zed.dev), making them great starting points for your own integration! | ||
| The [examples directory](https://github.com/agentclientprotocol/typescript-sdk/tree/main/src/examples) contains simple implementations of both Agents and Clients in TypeScript. These examples can be run from your terminal or from an ACP Client like [Zed](https://zed.dev), making them great starting points for your own integration! | ||
| ### Explore the API | ||
| Browse the [TypeScript library reference](https://agentclientprotocol.github.io/agent-client-protocol) for detailed API documentation. | ||
| Browse the [TypeScript library reference](https://agentclientprotocol.github.io/typescript-sdk) for detailed API documentation. | ||
| If you're building an [Agent](https://agentclientprotocol.com/protocol/overview#agent), start with [AgentSideConnection](https://agentclientprotocol.github.io/agent-client-protocol/classes/AgentSideConnection.html). | ||
| If you're building an [Agent](https://agentclientprotocol.com/protocol/overview#agent), start with [AgentSideConnection](https://agentclientprotocol.github.io/typescript-sdk/classes/AgentSideConnection.html). | ||
| If you're building a [Client](https://agentclientprotocol.com/protocol/overview#client), start with [ClientSideConnection](https://agentclientprotocol.github.io/agent-client-protocol/classes/ClientSideConnection.html). | ||
| If you're building a [Client](https://agentclientprotocol.com/protocol/overview#client), start with [ClientSideConnection](https://agentclientprotocol.github.io/typescript-sdk/classes/ClientSideConnection.html). | ||
@@ -42,6 +42,6 @@ ### Study a Production Implementation | ||
| - [Library docs](https://agentclientprotocol.github.io/agent-client-protocol) | ||
| - [Examples](https://github.com/agentclientprotocol/agent-client-protocol/tree/main/typescript/examples) | ||
| - [Library docs](https://agentclientprotocol.github.io/typescript-sdk) | ||
| - [Examples](https://github.com/agentclientprotocol/typescript-sdk/tree/main/src/examples) | ||
| - [Protocol Documentation](https://agentclientprotocol.com) | ||
| - [GitHub Repository](https://github.com/agentclientprotocol/agent-client-protocol) | ||
| - [GitHub Repository](https://github.com/agentclientprotocol/typescript-sdk) | ||
| - [NPM Package](https://www.npmjs.com/package/@agentclientprotocol/sdk) | ||
@@ -51,2 +51,6 @@ | ||
| See the main [repository](https://github.com/agentclientprotocol/agent-client-protocol) for contribution guidelines. | ||
| See the main [repository](https://github.com/agentclientprotocol/typescript-sdk) for contribution guidelines. | ||
| ### License | ||
| By contributing, you agree that your contributions will be licensed under the Apache 2.0 License. |
| import { describe, it, expect, beforeEach } from "vitest"; | ||
| import { | ||
| Agent, | ||
| ClientSideConnection, | ||
| Client, | ||
| AgentSideConnection, | ||
| InitializeRequest, | ||
| InitializeResponse, | ||
| NewSessionRequest, | ||
| NewSessionResponse, | ||
| LoadSessionRequest, | ||
| LoadSessionResponse, | ||
| AuthenticateRequest, | ||
| AuthenticateResponse, | ||
| PromptRequest, | ||
| PromptResponse, | ||
| WriteTextFileRequest, | ||
| WriteTextFileResponse, | ||
| ReadTextFileRequest, | ||
| ReadTextFileResponse, | ||
| RequestPermissionRequest, | ||
| RequestPermissionResponse, | ||
| CancelNotification, | ||
| SessionNotification, | ||
| PROTOCOL_VERSION, | ||
| ndJsonStream, | ||
| } from "./acp.js"; | ||
| describe("Connection", () => { | ||
| let clientToAgent: TransformStream<Uint8Array, Uint8Array>; | ||
| let agentToClient: TransformStream<Uint8Array, Uint8Array>; | ||
| beforeEach(() => { | ||
| clientToAgent = new TransformStream(); | ||
| agentToClient = new TransformStream(); | ||
| }); | ||
| it("handles errors in bidirectional communication", async () => { | ||
| // Create client that throws errors | ||
| class TestClient implements Client { | ||
| async writeTextFile( | ||
| _: WriteTextFileRequest, | ||
| ): Promise<WriteTextFileResponse> { | ||
| throw new Error("Write failed"); | ||
| } | ||
| async readTextFile( | ||
| _: ReadTextFileRequest, | ||
| ): Promise<ReadTextFileResponse> { | ||
| throw new Error("Read failed"); | ||
| } | ||
| async requestPermission( | ||
| _: RequestPermissionRequest, | ||
| ): Promise<RequestPermissionResponse> { | ||
| throw new Error("Permission denied"); | ||
| } | ||
| async sessionUpdate(_: SessionNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| } | ||
| // Create agent that throws errors | ||
| class TestAgent implements Agent { | ||
| async initialize(_: InitializeRequest): Promise<InitializeResponse> { | ||
| throw new Error("Failed to initialize"); | ||
| } | ||
| async newSession(_: NewSessionRequest): Promise<NewSessionResponse> { | ||
| throw new Error("Failed to create session"); | ||
| } | ||
| async loadSession(_: LoadSessionRequest): Promise<LoadSessionResponse> { | ||
| throw new Error("Failed to load session"); | ||
| } | ||
| async authenticate(_: AuthenticateRequest): Promise<void> { | ||
| throw new Error("Authentication failed"); | ||
| } | ||
| async prompt(_: PromptRequest): Promise<PromptResponse> { | ||
| throw new Error("Prompt failed"); | ||
| } | ||
| async cancel(_: CancelNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection( | ||
| () => new TestClient(), | ||
| ndJsonStream(clientToAgent.writable, agentToClient.readable), | ||
| ); | ||
| const clientConnection = new AgentSideConnection( | ||
| () => new TestAgent(), | ||
| ndJsonStream(agentToClient.writable, clientToAgent.readable), | ||
| ); | ||
| // Test error handling in client->agent direction | ||
| await expect( | ||
| clientConnection.writeTextFile({ | ||
| path: "/test.txt", | ||
| content: "test", | ||
| sessionId: "test-session", | ||
| }), | ||
| ).rejects.toThrow(); | ||
| // Test error handling in agent->client direction | ||
| await expect( | ||
| agentConnection.newSession({ | ||
| cwd: "/test", | ||
| mcpServers: [], | ||
| }), | ||
| ).rejects.toThrow(); | ||
| }); | ||
| it("handles concurrent requests", async () => { | ||
| let requestCount = 0; | ||
| // Create client | ||
| class TestClient implements Client { | ||
| async writeTextFile( | ||
| _: WriteTextFileRequest, | ||
| ): Promise<WriteTextFileResponse> { | ||
| requestCount++; | ||
| const currentCount = requestCount; | ||
| await new Promise((resolve) => setTimeout(resolve, 40)); | ||
| console.log(`Write request ${currentCount} completed`); | ||
| return {}; | ||
| } | ||
| async readTextFile( | ||
| params: ReadTextFileRequest, | ||
| ): Promise<ReadTextFileResponse> { | ||
| return { content: `Content of ${params.path}` }; | ||
| } | ||
| async requestPermission( | ||
| _: RequestPermissionRequest, | ||
| ): Promise<RequestPermissionResponse> { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_: SessionNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| } | ||
| // Create agent | ||
| class TestAgent implements Agent { | ||
| async initialize(_: InitializeRequest): Promise<InitializeResponse> { | ||
| return { | ||
| protocolVersion: 1, | ||
| agentCapabilities: { loadSession: false }, | ||
| authMethods: [], | ||
| }; | ||
| } | ||
| async newSession(_: NewSessionRequest): Promise<NewSessionResponse> { | ||
| return { | ||
| sessionId: "test-session", | ||
| }; | ||
| } | ||
| async loadSession(_: LoadSessionRequest): Promise<LoadSessionResponse> { | ||
| return {}; | ||
| } | ||
| async authenticate(_: AuthenticateRequest): Promise<void> { | ||
| // no-op | ||
| } | ||
| async prompt(_: PromptRequest): Promise<PromptResponse> { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_: CancelNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection( | ||
| () => new TestClient(), | ||
| ndJsonStream(clientToAgent.writable, agentToClient.readable), | ||
| ); | ||
| const clientConnection = new AgentSideConnection( | ||
| () => new TestAgent(), | ||
| ndJsonStream(agentToClient.writable, clientToAgent.readable), | ||
| ); | ||
| // Send multiple concurrent requests | ||
| const promises = [ | ||
| clientConnection.writeTextFile({ | ||
| path: "/file1.txt", | ||
| content: "content1", | ||
| sessionId: "session1", | ||
| }), | ||
| clientConnection.writeTextFile({ | ||
| path: "/file2.txt", | ||
| content: "content2", | ||
| sessionId: "session1", | ||
| }), | ||
| clientConnection.writeTextFile({ | ||
| path: "/file3.txt", | ||
| content: "content3", | ||
| sessionId: "session1", | ||
| }), | ||
| ]; | ||
| const results = await Promise.all(promises); | ||
| // Verify all requests completed successfully | ||
| expect(results).toHaveLength(3); | ||
| expect(results[0]).toEqual({}); | ||
| expect(results[1]).toEqual({}); | ||
| expect(results[2]).toEqual({}); | ||
| expect(requestCount).toBe(3); | ||
| }); | ||
| it("handles message ordering correctly", async () => { | ||
| const messageLog: string[] = []; | ||
| // Create client | ||
| class TestClient implements Client { | ||
| async writeTextFile( | ||
| params: WriteTextFileRequest, | ||
| ): Promise<WriteTextFileResponse> { | ||
| messageLog.push(`writeTextFile called: ${params.path}`); | ||
| return {}; | ||
| } | ||
| async readTextFile( | ||
| params: ReadTextFileRequest, | ||
| ): Promise<ReadTextFileResponse> { | ||
| messageLog.push(`readTextFile called: ${params.path}`); | ||
| return { content: "test content" }; | ||
| } | ||
| async requestPermission( | ||
| params: RequestPermissionRequest, | ||
| ): Promise<RequestPermissionResponse> { | ||
| messageLog.push(`requestPermission called: ${params.toolCall.title}`); | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(params: SessionNotification): Promise<void> { | ||
| messageLog.push("sessionUpdate called"); | ||
| } | ||
| } | ||
| // Create agent | ||
| class TestAgent implements Agent { | ||
| async initialize(_: InitializeRequest): Promise<InitializeResponse> { | ||
| return { | ||
| protocolVersion: 1, | ||
| agentCapabilities: { loadSession: false }, | ||
| authMethods: [], | ||
| }; | ||
| } | ||
| async newSession( | ||
| request: NewSessionRequest, | ||
| ): Promise<NewSessionResponse> { | ||
| messageLog.push(`newSession called: ${request.cwd}`); | ||
| return { | ||
| sessionId: "test-session", | ||
| }; | ||
| } | ||
| async loadSession( | ||
| params: LoadSessionRequest, | ||
| ): Promise<LoadSessionResponse> { | ||
| messageLog.push(`loadSession called: ${params.sessionId}`); | ||
| return {}; | ||
| } | ||
| async authenticate(params: AuthenticateRequest): Promise<void> { | ||
| messageLog.push(`authenticate called: ${params.methodId}`); | ||
| } | ||
| async prompt(params: PromptRequest): Promise<PromptResponse> { | ||
| messageLog.push(`prompt called: ${params.sessionId}`); | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(params: CancelNotification): Promise<void> { | ||
| messageLog.push(`cancelled called: ${params.sessionId}`); | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection( | ||
| () => new TestClient(), | ||
| ndJsonStream(clientToAgent.writable, agentToClient.readable), | ||
| ); | ||
| const clientConnection = new AgentSideConnection( | ||
| () => new TestAgent(), | ||
| ndJsonStream(agentToClient.writable, clientToAgent.readable), | ||
| ); | ||
| // Send requests in specific order | ||
| await agentConnection.newSession({ | ||
| cwd: "/test", | ||
| mcpServers: [], | ||
| }); | ||
| await clientConnection.writeTextFile({ | ||
| path: "/test.txt", | ||
| content: "test", | ||
| sessionId: "test-session", | ||
| }); | ||
| await clientConnection.readTextFile({ | ||
| path: "/test.txt", | ||
| sessionId: "test-session", | ||
| }); | ||
| await clientConnection.requestPermission({ | ||
| sessionId: "test-session", | ||
| toolCall: { | ||
| title: "Execute command", | ||
| kind: "execute", | ||
| status: "pending", | ||
| toolCallId: "tool-123", | ||
| content: [ | ||
| { | ||
| type: "content", | ||
| content: { | ||
| type: "text", | ||
| text: "ls -la", | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| options: [ | ||
| { | ||
| kind: "allow_once", | ||
| name: "Allow", | ||
| optionId: "allow", | ||
| }, | ||
| { | ||
| kind: "reject_once", | ||
| name: "Reject", | ||
| optionId: "reject", | ||
| }, | ||
| ], | ||
| }); | ||
| // Verify order | ||
| expect(messageLog).toEqual([ | ||
| "newSession called: /test", | ||
| "writeTextFile called: /test.txt", | ||
| "readTextFile called: /test.txt", | ||
| "requestPermission called: Execute command", | ||
| ]); | ||
| }); | ||
| it("handles notifications correctly", async () => { | ||
| const notificationLog: string[] = []; | ||
| // Create client | ||
| class TestClient implements Client { | ||
| async writeTextFile( | ||
| _: WriteTextFileRequest, | ||
| ): Promise<WriteTextFileResponse> { | ||
| return {}; | ||
| } | ||
| async readTextFile( | ||
| _: ReadTextFileRequest, | ||
| ): Promise<ReadTextFileResponse> { | ||
| return { content: "test" }; | ||
| } | ||
| async requestPermission( | ||
| _: RequestPermissionRequest, | ||
| ): Promise<RequestPermissionResponse> { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(notification: SessionNotification): Promise<void> { | ||
| if ( | ||
| notification.update && | ||
| "sessionUpdate" in notification.update && | ||
| notification.update.sessionUpdate === "agent_message_chunk" | ||
| ) { | ||
| notificationLog.push( | ||
| `agent message: ${(notification.update.content as any).text}`, | ||
| ); | ||
| } | ||
| } | ||
| } | ||
| // Create agent | ||
| class TestAgent implements Agent { | ||
| async initialize(_: InitializeRequest): Promise<InitializeResponse> { | ||
| return { | ||
| protocolVersion: 1, | ||
| agentCapabilities: { loadSession: false }, | ||
| authMethods: [], | ||
| }; | ||
| } | ||
| async newSession(_: NewSessionRequest): Promise<NewSessionResponse> { | ||
| return { | ||
| sessionId: "test-session", | ||
| }; | ||
| } | ||
| async loadSession(_: LoadSessionRequest): Promise<LoadSessionResponse> { | ||
| return {}; | ||
| } | ||
| async authenticate(_: AuthenticateRequest): Promise<void> { | ||
| // no-op | ||
| } | ||
| async prompt(_: PromptRequest): Promise<PromptResponse> { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(params: CancelNotification): Promise<void> { | ||
| notificationLog.push(`cancelled: ${params.sessionId}`); | ||
| } | ||
| } | ||
| // Create shared instances | ||
| const testClient = () => new TestClient(); | ||
| const testAgent = () => new TestAgent(); | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection( | ||
| testClient, | ||
| ndJsonStream(clientToAgent.writable, agentToClient.readable), | ||
| ); | ||
| const clientConnection = new AgentSideConnection( | ||
| testAgent, | ||
| ndJsonStream(agentToClient.writable, clientToAgent.readable), | ||
| ); | ||
| // Send notifications | ||
| await clientConnection.sessionUpdate({ | ||
| sessionId: "test-session", | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: "Hello from agent", | ||
| }, | ||
| }, | ||
| }); | ||
| await agentConnection.cancel({ | ||
| sessionId: "test-session", | ||
| }); | ||
| // Wait a bit for async handlers | ||
| await new Promise((resolve) => setTimeout(resolve, 50)); | ||
| // Verify notifications were received | ||
| expect(notificationLog).toContain("agent message: Hello from agent"); | ||
| expect(notificationLog).toContain("cancelled: test-session"); | ||
| }); | ||
| it("handles initialize method", async () => { | ||
| // Create client | ||
| class TestClient implements Client { | ||
| async writeTextFile( | ||
| _: WriteTextFileRequest, | ||
| ): Promise<WriteTextFileResponse> { | ||
| return {}; | ||
| } | ||
| async readTextFile( | ||
| _: ReadTextFileRequest, | ||
| ): Promise<ReadTextFileResponse> { | ||
| return { content: "test" }; | ||
| } | ||
| async requestPermission( | ||
| _: RequestPermissionRequest, | ||
| ): Promise<RequestPermissionResponse> { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_: SessionNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| } | ||
| // Create agent | ||
| class TestAgent implements Agent { | ||
| async initialize(params: InitializeRequest): Promise<InitializeResponse> { | ||
| return { | ||
| protocolVersion: params.protocolVersion, | ||
| agentCapabilities: { loadSession: true }, | ||
| authMethods: [ | ||
| { | ||
| id: "oauth", | ||
| name: "OAuth", | ||
| description: "Authenticate with OAuth", | ||
| }, | ||
| ], | ||
| }; | ||
| } | ||
| async newSession(_: NewSessionRequest): Promise<NewSessionResponse> { | ||
| return { sessionId: "test-session" }; | ||
| } | ||
| async loadSession(_: LoadSessionRequest): Promise<LoadSessionResponse> { | ||
| return {}; | ||
| } | ||
| async authenticate(_: AuthenticateRequest): Promise<void> { | ||
| // no-op | ||
| } | ||
| async prompt(_: PromptRequest): Promise<PromptResponse> { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_: CancelNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection( | ||
| () => new TestClient(), | ||
| ndJsonStream(clientToAgent.writable, agentToClient.readable), | ||
| ); | ||
| const clientConnection = new AgentSideConnection( | ||
| () => new TestAgent(), | ||
| ndJsonStream(agentToClient.writable, clientToAgent.readable), | ||
| ); | ||
| // Test initialize request | ||
| const response = await agentConnection.initialize({ | ||
| protocolVersion: PROTOCOL_VERSION, | ||
| clientCapabilities: { | ||
| fs: { | ||
| readTextFile: false, | ||
| writeTextFile: false, | ||
| }, | ||
| }, | ||
| }); | ||
| expect(response.protocolVersion).toBe(PROTOCOL_VERSION); | ||
| expect(response.agentCapabilities?.loadSession).toBe(true); | ||
| expect(response.authMethods).toHaveLength(1); | ||
| expect(response.authMethods?.[0].id).toBe("oauth"); | ||
| }); | ||
| it("handles extension methods and notifications", async () => { | ||
| const extensionLog: string[] = []; | ||
| // Create client with extension method support | ||
| class TestClient implements Client { | ||
| async writeTextFile( | ||
| _: WriteTextFileRequest, | ||
| ): Promise<WriteTextFileResponse> { | ||
| return {}; | ||
| } | ||
| async readTextFile( | ||
| _: ReadTextFileRequest, | ||
| ): Promise<ReadTextFileResponse> { | ||
| return { content: "test" }; | ||
| } | ||
| async requestPermission( | ||
| _: RequestPermissionRequest, | ||
| ): Promise<RequestPermissionResponse> { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_: SessionNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| async extMethod( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<Record<string, unknown>> { | ||
| if (method === "example.com/ping") { | ||
| return { response: "pong", params }; | ||
| } | ||
| throw new Error(`Unknown method: ${method}`); | ||
| } | ||
| async extNotification( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<void> { | ||
| extensionLog.push(`client extNotification: ${method}`); | ||
| } | ||
| } | ||
| // Create agent with extension method support | ||
| class TestAgent implements Agent { | ||
| async initialize(_: InitializeRequest): Promise<InitializeResponse> { | ||
| return { | ||
| protocolVersion: PROTOCOL_VERSION, | ||
| agentCapabilities: { loadSession: false }, | ||
| }; | ||
| } | ||
| async newSession(_: NewSessionRequest): Promise<NewSessionResponse> { | ||
| return { sessionId: "test-session" }; | ||
| } | ||
| async authenticate(_: AuthenticateRequest): Promise<void> { | ||
| // no-op | ||
| } | ||
| async prompt(_: PromptRequest): Promise<PromptResponse> { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_: CancelNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| async extMethod( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<Record<string, unknown>> { | ||
| if (method === "example.com/echo") { | ||
| return { echo: params }; | ||
| } | ||
| throw new Error(`Unknown method: ${method}`); | ||
| } | ||
| async extNotification( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<void> { | ||
| extensionLog.push(`agent extNotification: ${method}`); | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection( | ||
| () => new TestClient(), | ||
| ndJsonStream(clientToAgent.writable, agentToClient.readable), | ||
| ); | ||
| const clientConnection = new AgentSideConnection( | ||
| () => new TestAgent(), | ||
| ndJsonStream(agentToClient.writable, clientToAgent.readable), | ||
| ); | ||
| // Test agent calling client extension method | ||
| const clientResponse = await clientConnection.extMethod( | ||
| "example.com/ping", | ||
| { | ||
| data: "test", | ||
| }, | ||
| ); | ||
| expect(clientResponse).toEqual({ | ||
| response: "pong", | ||
| params: { data: "test" }, | ||
| }); | ||
| // Test client calling agent extension method | ||
| const agentResponse = await agentConnection.extMethod("example.com/echo", { | ||
| message: "hello", | ||
| }); | ||
| expect(agentResponse).toEqual({ echo: { message: "hello" } }); | ||
| // Test extension notifications | ||
| await clientConnection.extNotification("example.com/client/notify", { | ||
| info: "client notification", | ||
| }); | ||
| await agentConnection.extNotification("example.com/agent/notify", { | ||
| info: "agent notification", | ||
| }); | ||
| // Wait a bit for async handlers | ||
| await new Promise((resolve) => setTimeout(resolve, 50)); | ||
| // Verify notifications were logged | ||
| expect(extensionLog).toContain( | ||
| "client extNotification: example.com/client/notify", | ||
| ); | ||
| expect(extensionLog).toContain( | ||
| "agent extNotification: example.com/agent/notify", | ||
| ); | ||
| }); | ||
| it("handles optional extension methods correctly", async () => { | ||
| // Create client WITHOUT extension methods | ||
| class TestClientWithoutExtensions implements Client { | ||
| async writeTextFile( | ||
| _: WriteTextFileRequest, | ||
| ): Promise<WriteTextFileResponse> { | ||
| return {}; | ||
| } | ||
| async readTextFile( | ||
| _: ReadTextFileRequest, | ||
| ): Promise<ReadTextFileResponse> { | ||
| return { content: "test" }; | ||
| } | ||
| async requestPermission( | ||
| _: RequestPermissionRequest, | ||
| ): Promise<RequestPermissionResponse> { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(_: SessionNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| // Note: No extMethod or extNotification implemented | ||
| } | ||
| // Create agent WITHOUT extension methods | ||
| class TestAgentWithoutExtensions implements Agent { | ||
| async initialize(_: InitializeRequest): Promise<InitializeResponse> { | ||
| return { | ||
| protocolVersion: PROTOCOL_VERSION, | ||
| agentCapabilities: { loadSession: false }, | ||
| }; | ||
| } | ||
| async newSession(_: NewSessionRequest): Promise<NewSessionResponse> { | ||
| return { sessionId: "test-session" }; | ||
| } | ||
| async authenticate(_: AuthenticateRequest): Promise<void> { | ||
| // no-op | ||
| } | ||
| async prompt(_: PromptRequest): Promise<PromptResponse> { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(_: CancelNotification): Promise<void> { | ||
| // no-op | ||
| } | ||
| // Note: No extMethod or extNotification implemented | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection( | ||
| () => new TestClientWithoutExtensions(), | ||
| ndJsonStream(clientToAgent.writable, agentToClient.readable), | ||
| ); | ||
| const clientConnection = new AgentSideConnection( | ||
| () => new TestAgentWithoutExtensions(), | ||
| ndJsonStream(agentToClient.writable, clientToAgent.readable), | ||
| ); | ||
| // Test that calling extension methods on connections without them throws method not found | ||
| try { | ||
| await clientConnection.extMethod("example.com/ping", { data: "test" }); | ||
| expect.fail("Should have thrown method not found error"); | ||
| } catch (error: any) { | ||
| expect(error.code).toBe(-32601); // Method not found | ||
| expect(error.data.method).toBe("_example.com/ping"); // Should show full method name with underscore | ||
| } | ||
| try { | ||
| await agentConnection.extMethod("example.com/echo", { message: "hello" }); | ||
| expect.fail("Should have thrown method not found error"); | ||
| } catch (error: any) { | ||
| expect(error.code).toBe(-32601); // Method not found | ||
| expect(error.data.method).toBe("_example.com/echo"); // Should show full method name with underscore | ||
| } | ||
| // Notifications should be ignored when not implemented (no error thrown) | ||
| await clientConnection.extNotification("example.com/notify", { | ||
| info: "test", | ||
| }); | ||
| await agentConnection.extNotification("example.com/notify", { | ||
| info: "test", | ||
| }); | ||
| }); | ||
| it("handles methods returning response objects with _meta or void", async () => { | ||
| // Create client that returns both response objects and void | ||
| class TestClient implements Client { | ||
| async writeTextFile( | ||
| params: WriteTextFileRequest, | ||
| ): Promise<WriteTextFileResponse> { | ||
| // Return response object with _meta | ||
| return { | ||
| _meta: { | ||
| timestamp: new Date().toISOString(), | ||
| version: "1.0.0", | ||
| }, | ||
| }; | ||
| } | ||
| async readTextFile( | ||
| params: ReadTextFileRequest, | ||
| ): Promise<ReadTextFileResponse> { | ||
| return { | ||
| content: "test content", | ||
| _meta: { | ||
| encoding: "utf-8", | ||
| }, | ||
| }; | ||
| } | ||
| async requestPermission( | ||
| params: RequestPermissionRequest, | ||
| ): Promise<RequestPermissionResponse> { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: "allow", | ||
| }, | ||
| _meta: { | ||
| userId: "test-user", | ||
| }, | ||
| }; | ||
| } | ||
| async sessionUpdate(params: SessionNotification): Promise<void> { | ||
| // Returns void | ||
| } | ||
| } | ||
| // Create agent that returns both response objects and void | ||
| class TestAgent implements Agent { | ||
| async initialize(params: InitializeRequest): Promise<InitializeResponse> { | ||
| return { | ||
| protocolVersion: params.protocolVersion, | ||
| agentCapabilities: { loadSession: true }, | ||
| _meta: { | ||
| agentVersion: "2.0.0", | ||
| }, | ||
| }; | ||
| } | ||
| async newSession(params: NewSessionRequest): Promise<NewSessionResponse> { | ||
| return { | ||
| sessionId: "test-session", | ||
| _meta: { | ||
| sessionType: "ephemeral", | ||
| }, | ||
| }; | ||
| } | ||
| async loadSession( | ||
| params: LoadSessionRequest, | ||
| ): Promise<LoadSessionResponse> { | ||
| // Test returning minimal response | ||
| return {}; | ||
| } | ||
| async authenticate( | ||
| params: AuthenticateRequest, | ||
| ): Promise<AuthenticateResponse | void> { | ||
| if (params.methodId === "none") { | ||
| // Test returning void | ||
| return; | ||
| } | ||
| // Test returning response with _meta | ||
| return { | ||
| _meta: { | ||
| authenticated: true, | ||
| method: params.methodId, | ||
| }, | ||
| }; | ||
| } | ||
| async prompt(params: PromptRequest): Promise<PromptResponse> { | ||
| return { stopReason: "end_turn" }; | ||
| } | ||
| async cancel(params: CancelNotification): Promise<void> { | ||
| // Returns void | ||
| } | ||
| } | ||
| // Set up connections | ||
| const agentConnection = new ClientSideConnection( | ||
| () => new TestClient(), | ||
| ndJsonStream(clientToAgent.writable, agentToClient.readable), | ||
| ); | ||
| const clientConnection = new AgentSideConnection( | ||
| () => new TestAgent(), | ||
| ndJsonStream(agentToClient.writable, clientToAgent.readable), | ||
| ); | ||
| // Test writeTextFile returns response with _meta | ||
| const writeResponse = await clientConnection.writeTextFile({ | ||
| path: "/test.txt", | ||
| content: "test", | ||
| sessionId: "test-session", | ||
| }); | ||
| expect(writeResponse).toEqual({ | ||
| _meta: { | ||
| timestamp: expect.any(String), | ||
| version: "1.0.0", | ||
| }, | ||
| }); | ||
| // Test readTextFile returns response with content and _meta | ||
| const readResponse = await clientConnection.readTextFile({ | ||
| path: "/test.txt", | ||
| sessionId: "test-session", | ||
| }); | ||
| expect(readResponse.content).toBe("test content"); | ||
| expect(readResponse._meta).toEqual({ | ||
| encoding: "utf-8", | ||
| }); | ||
| // Test initialize with _meta | ||
| const initResponse = await agentConnection.initialize({ | ||
| protocolVersion: PROTOCOL_VERSION, | ||
| clientCapabilities: {}, | ||
| }); | ||
| expect(initResponse._meta).toEqual({ | ||
| agentVersion: "2.0.0", | ||
| }); | ||
| // Test authenticate returning void | ||
| const authResponseVoid = await agentConnection.authenticate({ | ||
| methodId: "none", | ||
| }); | ||
| expect(authResponseVoid).toEqual({}); | ||
| // Test authenticate returning response with _meta | ||
| const authResponse = await agentConnection.authenticate({ | ||
| methodId: "oauth", | ||
| }); | ||
| expect(authResponse).toEqual({ | ||
| _meta: { | ||
| authenticated: true, | ||
| method: "oauth", | ||
| }, | ||
| }); | ||
| // Test newSession with _meta | ||
| const sessionResponse = await agentConnection.newSession({ | ||
| cwd: "/test", | ||
| mcpServers: [], | ||
| }); | ||
| expect(sessionResponse._meta).toEqual({ | ||
| sessionType: "ephemeral", | ||
| }); | ||
| // Test loadSession returning minimal response | ||
| const loadResponse = await agentConnection.loadSession({ | ||
| sessionId: "test-session", | ||
| mcpServers: [], | ||
| cwd: "/test", | ||
| }); | ||
| expect(loadResponse).toEqual({}); | ||
| }); | ||
| }); |
-1295
| import { z } from "zod"; | ||
| import * as schema from "./schema.js"; | ||
| export * from "./schema.js"; | ||
| export * from "./stream.js"; | ||
| import type { Stream } from "./stream.js"; | ||
| import type { | ||
| AnyMessage, | ||
| AnyResponse, | ||
| Result, | ||
| ErrorResponse, | ||
| PendingResponse, | ||
| RequestHandler, | ||
| NotificationHandler, | ||
| } from "./jsonrpc.js"; | ||
| /** | ||
| * An agent-side connection to a client. | ||
| * | ||
| * This class provides the agent's view of an ACP connection, allowing | ||
| * agents to communicate with clients. It implements the {@link Client} interface | ||
| * to provide methods for requesting permissions, accessing the file system, | ||
| * and sending session updates. | ||
| * | ||
| * See protocol docs: [Agent](https://agentclientprotocol.com/protocol/overview#agent) | ||
| */ | ||
| export class AgentSideConnection { | ||
| #connection: Connection; | ||
| /** | ||
| * Creates a new agent-side connection to a client. | ||
| * | ||
| * This establishes the communication channel from the agent's perspective | ||
| * following the ACP specification. | ||
| * | ||
| * @param toAgent - A function that creates an Agent handler to process incoming client requests | ||
| * @param stream - The bidirectional message stream for communication. Typically created using | ||
| * {@link ndJsonStream} for stdio-based connections. | ||
| * | ||
| * See protocol docs: [Communication Model](https://agentclientprotocol.com/protocol/overview#communication-model) | ||
| */ | ||
| constructor(toAgent: (conn: AgentSideConnection) => Agent, stream: Stream) { | ||
| const agent = toAgent(this); | ||
| const requestHandler = async ( | ||
| method: string, | ||
| params: unknown, | ||
| ): Promise<unknown> => { | ||
| switch (method) { | ||
| case schema.AGENT_METHODS.initialize: { | ||
| const validatedParams = schema.initializeRequestSchema.parse(params); | ||
| return agent.initialize(validatedParams); | ||
| } | ||
| case schema.AGENT_METHODS.session_new: { | ||
| const validatedParams = schema.newSessionRequestSchema.parse(params); | ||
| return agent.newSession(validatedParams); | ||
| } | ||
| case schema.AGENT_METHODS.session_load: { | ||
| if (!agent.loadSession) { | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| const validatedParams = schema.loadSessionRequestSchema.parse(params); | ||
| return agent.loadSession(validatedParams); | ||
| } | ||
| case schema.AGENT_METHODS.session_set_mode: { | ||
| if (!agent.setSessionMode) { | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| const validatedParams = | ||
| schema.setSessionModeRequestSchema.parse(params); | ||
| const result = await agent.setSessionMode(validatedParams); | ||
| return result ?? {}; | ||
| } | ||
| case schema.AGENT_METHODS.authenticate: { | ||
| const validatedParams = | ||
| schema.authenticateRequestSchema.parse(params); | ||
| const result = await agent.authenticate(validatedParams); | ||
| return result ?? {}; | ||
| } | ||
| case schema.AGENT_METHODS.session_prompt: { | ||
| const validatedParams = schema.promptRequestSchema.parse(params); | ||
| return agent.prompt(validatedParams); | ||
| } | ||
| case schema.AGENT_METHODS.session_set_model: { | ||
| if (!agent.setSessionModel) { | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| const validatedParams = | ||
| schema.setSessionModelRequestSchema.parse(params); | ||
| return agent.setSessionModel(validatedParams); | ||
| } | ||
| default: | ||
| if (method.startsWith("_")) { | ||
| if (!agent.extMethod) { | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| return agent.extMethod( | ||
| method.substring(1), | ||
| params as Record<string, unknown>, | ||
| ); | ||
| } | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| }; | ||
| const notificationHandler = async ( | ||
| method: string, | ||
| params: unknown, | ||
| ): Promise<void> => { | ||
| switch (method) { | ||
| case schema.AGENT_METHODS.session_cancel: { | ||
| const validatedParams = schema.cancelNotificationSchema.parse(params); | ||
| return agent.cancel(validatedParams); | ||
| } | ||
| default: | ||
| if (method.startsWith("_")) { | ||
| if (!agent.extNotification) { | ||
| return; | ||
| } | ||
| return agent.extNotification( | ||
| method.substring(1), | ||
| params as Record<string, unknown>, | ||
| ); | ||
| } | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| }; | ||
| this.#connection = new Connection( | ||
| requestHandler, | ||
| notificationHandler, | ||
| stream, | ||
| ); | ||
| } | ||
| /** | ||
| * Handles session update notifications from the agent. | ||
| * | ||
| * This is a notification endpoint (no response expected) that sends | ||
| * real-time updates about session progress, including message chunks, | ||
| * tool calls, and execution plans. | ||
| * | ||
| * Note: Clients SHOULD continue accepting tool call updates even after | ||
| * sending a `session/cancel` notification, as the agent may send final | ||
| * updates before responding with the cancelled stop reason. | ||
| * | ||
| * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output) | ||
| */ | ||
| async sessionUpdate(params: schema.SessionNotification): Promise<void> { | ||
| return await this.#connection.sendNotification( | ||
| schema.CLIENT_METHODS.session_update, | ||
| params, | ||
| ); | ||
| } | ||
| /** | ||
| * Requests permission from the user for a tool call operation. | ||
| * | ||
| * Called by the agent when it needs user authorization before executing | ||
| * a potentially sensitive operation. The client should present the options | ||
| * to the user and return their decision. | ||
| * | ||
| * If the client cancels the prompt turn via `session/cancel`, it MUST | ||
| * respond to this request with `RequestPermissionOutcome::Cancelled`. | ||
| * | ||
| * See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission) | ||
| */ | ||
| async requestPermission( | ||
| params: schema.RequestPermissionRequest, | ||
| ): Promise<schema.RequestPermissionResponse> { | ||
| return await this.#connection.sendRequest( | ||
| schema.CLIENT_METHODS.session_request_permission, | ||
| params, | ||
| ); | ||
| } | ||
| /** | ||
| * Reads content from a text file in the client's file system. | ||
| * | ||
| * Only available if the client advertises the `fs.readTextFile` capability. | ||
| * Allows the agent to access file contents within the client's environment. | ||
| * | ||
| * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) | ||
| */ | ||
| async readTextFile( | ||
| params: schema.ReadTextFileRequest, | ||
| ): Promise<schema.ReadTextFileResponse> { | ||
| return await this.#connection.sendRequest( | ||
| schema.CLIENT_METHODS.fs_read_text_file, | ||
| params, | ||
| ); | ||
| } | ||
| /** | ||
| * Writes content to a text file in the client's file system. | ||
| * | ||
| * Only available if the client advertises the `fs.writeTextFile` capability. | ||
| * Allows the agent to create or modify files within the client's environment. | ||
| * | ||
| * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) | ||
| */ | ||
| async writeTextFile( | ||
| params: schema.WriteTextFileRequest, | ||
| ): Promise<schema.WriteTextFileResponse> { | ||
| return ( | ||
| (await this.#connection.sendRequest( | ||
| schema.CLIENT_METHODS.fs_write_text_file, | ||
| params, | ||
| )) ?? {} | ||
| ); | ||
| } | ||
| /** | ||
| * Executes a command in a new terminal. | ||
| * | ||
| * Returns a `TerminalHandle` that can be used to get output, wait for exit, | ||
| * kill the command, or release the terminal. | ||
| * | ||
| * The terminal can also be embedded in tool calls by using its ID in | ||
| * `ToolCallContent` with type "terminal". | ||
| * | ||
| * @param params - The terminal creation parameters | ||
| * @returns A handle to control and monitor the terminal | ||
| */ | ||
| async createTerminal( | ||
| params: schema.CreateTerminalRequest, | ||
| ): Promise<TerminalHandle> { | ||
| const response = await this.#connection.sendRequest< | ||
| schema.CreateTerminalRequest, | ||
| schema.CreateTerminalResponse | ||
| >(schema.CLIENT_METHODS.terminal_create, params); | ||
| return new TerminalHandle( | ||
| response.terminalId, | ||
| params.sessionId, | ||
| this.#connection, | ||
| ); | ||
| } | ||
| /** | ||
| * Extension method | ||
| * | ||
| * Allows the Agent to send an arbitrary request that is not part of the ACP spec. | ||
| */ | ||
| async extMethod( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<Record<string, unknown>> { | ||
| return await this.#connection.sendRequest(`_${method}`, params); | ||
| } | ||
| /** | ||
| * Extension notification | ||
| * | ||
| * Allows the Agent to send an arbitrary notification that is not part of the ACP spec. | ||
| */ | ||
| async extNotification( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<void> { | ||
| return await this.#connection.sendNotification(`_${method}`, params); | ||
| } | ||
| } | ||
| /** | ||
| * Handle for controlling and monitoring a terminal created via `createTerminal`. | ||
| * | ||
| * Provides methods to: | ||
| * - Get current output without waiting | ||
| * - Wait for command completion | ||
| * - Kill the running command | ||
| * - Release terminal resources | ||
| * | ||
| * **Important:** Always call `release()` when done with the terminal to free resources. | ||
| * The terminal supports async disposal via `Symbol.asyncDispose` for automatic cleanup. | ||
| * You can use `await using` to ensure the terminal is automatically released when it | ||
| * goes out of scope. | ||
| */ | ||
| export class TerminalHandle { | ||
| #sessionId: string; | ||
| #connection: Connection; | ||
| constructor( | ||
| public id: string, | ||
| sessionId: string, | ||
| conn: Connection, | ||
| ) { | ||
| this.#sessionId = sessionId; | ||
| this.#connection = conn; | ||
| } | ||
| /** | ||
| * Gets the current terminal output without waiting for the command to exit. | ||
| */ | ||
| async currentOutput(): Promise<schema.TerminalOutputResponse> { | ||
| return await this.#connection.sendRequest( | ||
| schema.CLIENT_METHODS.terminal_output, | ||
| { | ||
| sessionId: this.#sessionId, | ||
| terminalId: this.id, | ||
| }, | ||
| ); | ||
| } | ||
| /** | ||
| * Waits for the terminal command to complete and returns its exit status. | ||
| */ | ||
| async waitForExit(): Promise<schema.WaitForTerminalExitResponse> { | ||
| return await this.#connection.sendRequest( | ||
| schema.CLIENT_METHODS.terminal_wait_for_exit, | ||
| { | ||
| sessionId: this.#sessionId, | ||
| terminalId: this.id, | ||
| }, | ||
| ); | ||
| } | ||
| /** | ||
| * Kills the terminal command without releasing the terminal. | ||
| * | ||
| * The terminal remains valid after killing, allowing you to: | ||
| * - Get the final output with `currentOutput()` | ||
| * - Check the exit status | ||
| * - Release the terminal when done | ||
| * | ||
| * Useful for implementing timeouts or cancellation. | ||
| */ | ||
| async kill(): Promise<schema.KillTerminalResponse> { | ||
| return ( | ||
| (await this.#connection.sendRequest(schema.CLIENT_METHODS.terminal_kill, { | ||
| sessionId: this.#sessionId, | ||
| terminalId: this.id, | ||
| })) ?? {} | ||
| ); | ||
| } | ||
| /** | ||
| * Releases the terminal and frees all associated resources. | ||
| * | ||
| * If the command is still running, it will be killed. | ||
| * After release, the terminal ID becomes invalid and cannot be used | ||
| * with other terminal methods. | ||
| * | ||
| * Tool calls that already reference this terminal will continue to | ||
| * display its output. | ||
| * | ||
| * **Important:** Always call this method when done with the terminal. | ||
| */ | ||
| async release(): Promise<schema.ReleaseTerminalResponse | void> { | ||
| return ( | ||
| (await this.#connection.sendRequest( | ||
| schema.CLIENT_METHODS.terminal_release, | ||
| { | ||
| sessionId: this.#sessionId, | ||
| terminalId: this.id, | ||
| }, | ||
| )) ?? {} | ||
| ); | ||
| } | ||
| async [Symbol.asyncDispose](): Promise<void> { | ||
| await this.release(); | ||
| } | ||
| } | ||
| /** | ||
| * A client-side connection to an agent. | ||
| * | ||
| * This class provides the client's view of an ACP connection, allowing | ||
| * clients (such as code editors) to communicate with agents. It implements | ||
| * the {@link Agent} interface to provide methods for initializing sessions, sending | ||
| * prompts, and managing the agent lifecycle. | ||
| * | ||
| * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) | ||
| */ | ||
| export class ClientSideConnection implements Agent { | ||
| #connection: Connection; | ||
| /** | ||
| * Creates a new client-side connection to an agent. | ||
| * | ||
| * This establishes the communication channel between a client and agent | ||
| * following the ACP specification. | ||
| * | ||
| * @param toClient - A function that creates a Client handler to process incoming agent requests | ||
| * @param stream - The bidirectional message stream for communication. Typically created using | ||
| * {@link ndJsonStream} for stdio-based connections. | ||
| * | ||
| * See protocol docs: [Communication Model](https://agentclientprotocol.com/protocol/overview#communication-model) | ||
| */ | ||
| constructor(toClient: (agent: Agent) => Client, stream: Stream) { | ||
| const client = toClient(this); | ||
| const requestHandler = async ( | ||
| method: string, | ||
| params: unknown, | ||
| ): Promise<unknown> => { | ||
| switch (method) { | ||
| case schema.CLIENT_METHODS.fs_write_text_file: { | ||
| const validatedParams = | ||
| schema.writeTextFileRequestSchema.parse(params); | ||
| return client.writeTextFile?.(validatedParams); | ||
| } | ||
| case schema.CLIENT_METHODS.fs_read_text_file: { | ||
| const validatedParams = | ||
| schema.readTextFileRequestSchema.parse(params); | ||
| return client.readTextFile?.(validatedParams); | ||
| } | ||
| case schema.CLIENT_METHODS.session_request_permission: { | ||
| const validatedParams = | ||
| schema.requestPermissionRequestSchema.parse(params); | ||
| return client.requestPermission(validatedParams); | ||
| } | ||
| case schema.CLIENT_METHODS.terminal_create: { | ||
| const validatedParams = | ||
| schema.createTerminalRequestSchema.parse(params); | ||
| return client.createTerminal?.(validatedParams); | ||
| } | ||
| case schema.CLIENT_METHODS.terminal_output: { | ||
| const validatedParams = | ||
| schema.terminalOutputRequestSchema.parse(params); | ||
| return client.terminalOutput?.(validatedParams); | ||
| } | ||
| case schema.CLIENT_METHODS.terminal_release: { | ||
| const validatedParams = | ||
| schema.releaseTerminalRequestSchema.parse(params); | ||
| const result = await client.releaseTerminal?.(validatedParams); | ||
| return result ?? {}; | ||
| } | ||
| case schema.CLIENT_METHODS.terminal_wait_for_exit: { | ||
| const validatedParams = | ||
| schema.waitForTerminalExitRequestSchema.parse(params); | ||
| return client.waitForTerminalExit?.(validatedParams); | ||
| } | ||
| case schema.CLIENT_METHODS.terminal_kill: { | ||
| const validatedParams = | ||
| schema.killTerminalCommandRequestSchema.parse(params); | ||
| const result = await client.killTerminal?.(validatedParams); | ||
| return result ?? {}; | ||
| } | ||
| default: | ||
| // Handle extension methods (any method starting with '_') | ||
| if (method.startsWith("_")) { | ||
| const customMethod = method.substring(1); | ||
| if (!client.extMethod) { | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| return client.extMethod( | ||
| customMethod, | ||
| params as Record<string, unknown>, | ||
| ); | ||
| } | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| }; | ||
| const notificationHandler = async ( | ||
| method: string, | ||
| params: unknown, | ||
| ): Promise<void> => { | ||
| switch (method) { | ||
| case schema.CLIENT_METHODS.session_update: { | ||
| const validatedParams = | ||
| schema.sessionNotificationSchema.parse(params); | ||
| return client.sessionUpdate(validatedParams); | ||
| } | ||
| default: | ||
| // Handle extension notifications (any method starting with '_') | ||
| if (method.startsWith("_")) { | ||
| const customMethod = method.substring(1); | ||
| if (!client.extNotification) { | ||
| return; | ||
| } | ||
| return client.extNotification( | ||
| customMethod, | ||
| params as Record<string, unknown>, | ||
| ); | ||
| } | ||
| throw RequestError.methodNotFound(method); | ||
| } | ||
| }; | ||
| this.#connection = new Connection( | ||
| requestHandler, | ||
| notificationHandler, | ||
| stream, | ||
| ); | ||
| } | ||
| /** | ||
| * Establishes the connection with a client and negotiates protocol capabilities. | ||
| * | ||
| * This method is called once at the beginning of the connection to: | ||
| * - Negotiate the protocol version to use | ||
| * - Exchange capability information between client and agent | ||
| * - Determine available authentication methods | ||
| * | ||
| * The agent should respond with its supported protocol version and capabilities. | ||
| * | ||
| * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) | ||
| */ | ||
| async initialize( | ||
| params: schema.InitializeRequest, | ||
| ): Promise<schema.InitializeResponse> { | ||
| return await this.#connection.sendRequest( | ||
| schema.AGENT_METHODS.initialize, | ||
| params, | ||
| ); | ||
| } | ||
| /** | ||
| * Creates a new conversation session with the agent. | ||
| * | ||
| * Sessions represent independent conversation contexts with their own history and state. | ||
| * | ||
| * The agent should: | ||
| * - Create a new session context | ||
| * - Connect to any specified MCP servers | ||
| * - Return a unique session ID for future requests | ||
| * | ||
| * May return an `auth_required` error if the agent requires authentication. | ||
| * | ||
| * See protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup) | ||
| */ | ||
| async newSession( | ||
| params: schema.NewSessionRequest, | ||
| ): Promise<schema.NewSessionResponse> { | ||
| return await this.#connection.sendRequest( | ||
| schema.AGENT_METHODS.session_new, | ||
| params, | ||
| ); | ||
| } | ||
| /** | ||
| * Loads an existing session to resume a previous conversation. | ||
| * | ||
| * This method is only available if the agent advertises the `loadSession` capability. | ||
| * | ||
| * The agent should: | ||
| * - Restore the session context and conversation history | ||
| * - Connect to the specified MCP servers | ||
| * - Stream the entire conversation history back to the client via notifications | ||
| * | ||
| * See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions) | ||
| */ | ||
| async loadSession( | ||
| params: schema.LoadSessionRequest, | ||
| ): Promise<schema.LoadSessionResponse> { | ||
| return ( | ||
| (await this.#connection.sendRequest( | ||
| schema.AGENT_METHODS.session_load, | ||
| params, | ||
| )) ?? {} | ||
| ); | ||
| } | ||
| /** | ||
| * Sets the operational mode for a session. | ||
| * | ||
| * Allows switching between different agent modes (e.g., "ask", "architect", "code") | ||
| * that affect system prompts, tool availability, and permission behaviors. | ||
| * | ||
| * The mode must be one of the modes advertised in `availableModes` during session | ||
| * creation or loading. Agents may also change modes autonomously and notify the | ||
| * client via `current_mode_update` notifications. | ||
| * | ||
| * This method can be called at any time during a session, whether the Agent is | ||
| * idle or actively generating a turn. | ||
| * | ||
| * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) | ||
| */ | ||
| async setSessionMode( | ||
| params: schema.SetSessionModeRequest, | ||
| ): Promise<schema.SetSessionModeResponse> { | ||
| return ( | ||
| (await this.#connection.sendRequest( | ||
| schema.AGENT_METHODS.session_set_mode, | ||
| params, | ||
| )) ?? {} | ||
| ); | ||
| } | ||
| /** | ||
| * **UNSTABLE** | ||
| * | ||
| * This capability is not part of the spec yet, and may be removed or changed at any point. | ||
| * | ||
| * Select a model for a given session. | ||
| */ | ||
| async setSessionModel( | ||
| params: schema.SetSessionModelRequest, | ||
| ): Promise<schema.SetSessionModelResponse> { | ||
| return ( | ||
| (await this.#connection.sendRequest( | ||
| schema.AGENT_METHODS.session_set_mode, | ||
| params, | ||
| )) ?? {} | ||
| ); | ||
| } | ||
| /** | ||
| * Authenticates the client using the specified authentication method. | ||
| * | ||
| * Called when the agent requires authentication before allowing session creation. | ||
| * The client provides the authentication method ID that was advertised during initialization. | ||
| * | ||
| * After successful authentication, the client can proceed to create sessions with | ||
| * `newSession` without receiving an `auth_required` error. | ||
| * | ||
| * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) | ||
| */ | ||
| async authenticate( | ||
| params: schema.AuthenticateRequest, | ||
| ): Promise<schema.AuthenticateResponse> { | ||
| return ( | ||
| (await this.#connection.sendRequest( | ||
| schema.AGENT_METHODS.authenticate, | ||
| params, | ||
| )) ?? {} | ||
| ); | ||
| } | ||
| /** | ||
| * Processes a user prompt within a session. | ||
| * | ||
| * This method handles the whole lifecycle of a prompt: | ||
| * - Receives user messages with optional context (files, images, etc.) | ||
| * - Processes the prompt using language models | ||
| * - Reports language model content and tool calls to the Clients | ||
| * - Requests permission to run tools | ||
| * - Executes any requested tool calls | ||
| * - Returns when the turn is complete with a stop reason | ||
| * | ||
| * See protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn) | ||
| */ | ||
| async prompt(params: schema.PromptRequest): Promise<schema.PromptResponse> { | ||
| return await this.#connection.sendRequest( | ||
| schema.AGENT_METHODS.session_prompt, | ||
| params, | ||
| ); | ||
| } | ||
| /** | ||
| * Cancels ongoing operations for a session. | ||
| * | ||
| * This is a notification sent by the client to cancel an ongoing prompt turn. | ||
| * | ||
| * Upon receiving this notification, the Agent SHOULD: | ||
| * - Stop all language model requests as soon as possible | ||
| * - Abort all tool call invocations in progress | ||
| * - Send any pending `session/update` notifications | ||
| * - Respond to the original `session/prompt` request with `StopReason::Cancelled` | ||
| * | ||
| * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation) | ||
| */ | ||
| async cancel(params: schema.CancelNotification): Promise<void> { | ||
| return await this.#connection.sendNotification( | ||
| schema.AGENT_METHODS.session_cancel, | ||
| params, | ||
| ); | ||
| } | ||
| /** | ||
| * Extension method | ||
| * | ||
| * Allows the Client to send an arbitrary request that is not part of the ACP spec. | ||
| */ | ||
| async extMethod( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<Record<string, unknown>> { | ||
| return await this.#connection.sendRequest(`_${method}`, params); | ||
| } | ||
| /** | ||
| * Extension notification | ||
| * | ||
| * Allows the Client to send an arbitrary notification that is not part of the ACP spec. | ||
| */ | ||
| async extNotification( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<void> { | ||
| return await this.#connection.sendNotification(`_${method}`, params); | ||
| } | ||
| } | ||
| export type { AnyMessage } from "./jsonrpc.js"; | ||
| class Connection { | ||
| #pendingResponses: Map<string | number | null, PendingResponse> = new Map(); | ||
| #nextRequestId: number = 0; | ||
| #requestHandler: RequestHandler; | ||
| #notificationHandler: NotificationHandler; | ||
| #stream: Stream; | ||
| #writeQueue: Promise<void> = Promise.resolve(); | ||
| constructor( | ||
| requestHandler: RequestHandler, | ||
| notificationHandler: NotificationHandler, | ||
| stream: Stream, | ||
| ) { | ||
| this.#requestHandler = requestHandler; | ||
| this.#notificationHandler = notificationHandler; | ||
| this.#stream = stream; | ||
| this.#receive(); | ||
| } | ||
| async #receive() { | ||
| const reader = this.#stream.readable.getReader(); | ||
| try { | ||
| while (true) { | ||
| const { value: message, done } = await reader.read(); | ||
| if (done) { | ||
| break; | ||
| } | ||
| if (!message) { | ||
| continue; | ||
| } | ||
| try { | ||
| this.#processMessage(message); | ||
| } catch (err) { | ||
| console.error( | ||
| "Unexpected error during message processing:", | ||
| message, | ||
| err, | ||
| ); | ||
| // Only send error response if the message had an id (was a request) | ||
| if ("id" in message && message.id !== undefined) { | ||
| this.#sendMessage({ | ||
| jsonrpc: "2.0", | ||
| id: message.id, | ||
| error: { | ||
| code: -32700, | ||
| message: "Parse error", | ||
| }, | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| } finally { | ||
| reader.releaseLock(); | ||
| } | ||
| } | ||
| async #processMessage(message: AnyMessage) { | ||
| if ("method" in message && "id" in message) { | ||
| // It's a request | ||
| const response = await this.#tryCallRequestHandler( | ||
| message.method, | ||
| message.params, | ||
| ); | ||
| if ("error" in response) { | ||
| console.error("Error handling request", message, response.error); | ||
| } | ||
| await this.#sendMessage({ | ||
| jsonrpc: "2.0", | ||
| id: message.id, | ||
| ...response, | ||
| }); | ||
| } else if ("method" in message) { | ||
| // It's a notification | ||
| const response = await this.#tryCallNotificationHandler( | ||
| message.method, | ||
| message.params, | ||
| ); | ||
| if ("error" in response) { | ||
| console.error("Error handling notification", message, response.error); | ||
| } | ||
| } else if ("id" in message) { | ||
| // It's a response | ||
| this.#handleResponse(message); | ||
| } else { | ||
| console.error("Invalid message", { message }); | ||
| } | ||
| } | ||
| async #tryCallRequestHandler( | ||
| method: string, | ||
| params: unknown, | ||
| ): Promise<Result<unknown>> { | ||
| try { | ||
| const result = await this.#requestHandler(method, params); | ||
| return { result: result ?? null }; | ||
| } catch (error: unknown) { | ||
| if (error instanceof RequestError) { | ||
| return error.toResult(); | ||
| } | ||
| if (error instanceof z.ZodError) { | ||
| return RequestError.invalidParams(error.format()).toResult(); | ||
| } | ||
| let details; | ||
| if (error instanceof Error) { | ||
| details = error.message; | ||
| } else if ( | ||
| typeof error === "object" && | ||
| error != null && | ||
| "message" in error && | ||
| typeof error.message === "string" | ||
| ) { | ||
| details = error.message; | ||
| } | ||
| try { | ||
| return RequestError.internalError( | ||
| details ? JSON.parse(details) : {}, | ||
| ).toResult(); | ||
| } catch (_err) { | ||
| return RequestError.internalError({ details }).toResult(); | ||
| } | ||
| } | ||
| } | ||
| async #tryCallNotificationHandler( | ||
| method: string, | ||
| params: unknown, | ||
| ): Promise<Result<unknown>> { | ||
| try { | ||
| await this.#notificationHandler(method, params); | ||
| return { result: null }; | ||
| } catch (error: unknown) { | ||
| if (error instanceof RequestError) { | ||
| return error.toResult(); | ||
| } | ||
| if (error instanceof z.ZodError) { | ||
| return RequestError.invalidParams(error.format()).toResult(); | ||
| } | ||
| let details; | ||
| if (error instanceof Error) { | ||
| details = error.message; | ||
| } else if ( | ||
| typeof error === "object" && | ||
| error != null && | ||
| "message" in error && | ||
| typeof error.message === "string" | ||
| ) { | ||
| details = error.message; | ||
| } | ||
| try { | ||
| return RequestError.internalError( | ||
| details ? JSON.parse(details) : {}, | ||
| ).toResult(); | ||
| } catch (_err) { | ||
| return RequestError.internalError({ details }).toResult(); | ||
| } | ||
| } | ||
| } | ||
| #handleResponse(response: AnyResponse) { | ||
| const pendingResponse = this.#pendingResponses.get(response.id); | ||
| if (pendingResponse) { | ||
| if ("result" in response) { | ||
| pendingResponse.resolve(response.result); | ||
| } else if ("error" in response) { | ||
| pendingResponse.reject(response.error); | ||
| } | ||
| this.#pendingResponses.delete(response.id); | ||
| } else { | ||
| console.error("Got response to unknown request", response.id); | ||
| } | ||
| } | ||
| async sendRequest<Req, Resp>(method: string, params?: Req): Promise<Resp> { | ||
| const id = this.#nextRequestId++; | ||
| const responsePromise = new Promise((resolve, reject) => { | ||
| this.#pendingResponses.set(id, { resolve, reject }); | ||
| }); | ||
| await this.#sendMessage({ jsonrpc: "2.0", id, method, params }); | ||
| return responsePromise as Promise<Resp>; | ||
| } | ||
| async sendNotification<N>(method: string, params?: N): Promise<void> { | ||
| await this.#sendMessage({ jsonrpc: "2.0", method, params }); | ||
| } | ||
| async #sendMessage(message: AnyMessage) { | ||
| this.#writeQueue = this.#writeQueue | ||
| .then(async () => { | ||
| const writer = this.#stream.writable.getWriter(); | ||
| try { | ||
| await writer.write(message); | ||
| } finally { | ||
| writer.releaseLock(); | ||
| } | ||
| }) | ||
| .catch((error) => { | ||
| // Continue processing writes on error | ||
| console.error("ACP write error:", error); | ||
| }); | ||
| return this.#writeQueue; | ||
| } | ||
| } | ||
| /** | ||
| * JSON-RPC error object. | ||
| * | ||
| * Represents an error that occurred during method execution, following the | ||
| * JSON-RPC 2.0 error object specification with optional additional data. | ||
| * | ||
| * See protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object) | ||
| */ | ||
| export class RequestError extends Error { | ||
| data?: unknown; | ||
| constructor( | ||
| public code: number, | ||
| message: string, | ||
| data?: unknown, | ||
| ) { | ||
| super(message); | ||
| this.name = "RequestError"; | ||
| this.data = data; | ||
| } | ||
| /** | ||
| * Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. | ||
| */ | ||
| static parseError(data?: object): RequestError { | ||
| return new RequestError(-32700, "Parse error", data); | ||
| } | ||
| /** | ||
| * The JSON sent is not a valid Request object. | ||
| */ | ||
| static invalidRequest(data?: object): RequestError { | ||
| return new RequestError(-32600, "Invalid request", data); | ||
| } | ||
| /** | ||
| * The method does not exist / is not available. | ||
| */ | ||
| static methodNotFound(method: string): RequestError { | ||
| return new RequestError(-32601, "Method not found", { method }); | ||
| } | ||
| /** | ||
| * Invalid method parameter(s). | ||
| */ | ||
| static invalidParams(data?: object): RequestError { | ||
| return new RequestError(-32602, "Invalid params", data); | ||
| } | ||
| /** | ||
| * Internal JSON-RPC error. | ||
| */ | ||
| static internalError(data?: object): RequestError { | ||
| return new RequestError(-32603, "Internal error", data); | ||
| } | ||
| /** | ||
| * Authentication required. | ||
| */ | ||
| static authRequired(data?: object): RequestError { | ||
| return new RequestError(-32000, "Authentication required", data); | ||
| } | ||
| /** | ||
| * Resource, such as a file, was not found | ||
| */ | ||
| static resourceNotFound(uri?: string): RequestError { | ||
| return new RequestError(-32002, "Resource not found", uri && { uri }); | ||
| } | ||
| toResult<T>(): Result<T> { | ||
| return { | ||
| error: { | ||
| code: this.code, | ||
| message: this.message, | ||
| data: this.data, | ||
| }, | ||
| }; | ||
| } | ||
| toErrorResponse(): ErrorResponse { | ||
| return { | ||
| code: this.code, | ||
| message: this.message, | ||
| data: this.data, | ||
| }; | ||
| } | ||
| } | ||
| /** | ||
| * The Client interface defines the interface that ACP-compliant clients must implement. | ||
| * | ||
| * Clients are typically code editors (IDEs, text editors) that provide the interface | ||
| * between users and AI agents. They manage the environment, handle user interactions, | ||
| * and control access to resources. | ||
| */ | ||
| export interface Client { | ||
| /** | ||
| * Requests permission from the user for a tool call operation. | ||
| * | ||
| * Called by the agent when it needs user authorization before executing | ||
| * a potentially sensitive operation. The client should present the options | ||
| * to the user and return their decision. | ||
| * | ||
| * If the client cancels the prompt turn via `session/cancel`, it MUST | ||
| * respond to this request with `RequestPermissionOutcome::Cancelled`. | ||
| * | ||
| * See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission) | ||
| */ | ||
| requestPermission( | ||
| params: schema.RequestPermissionRequest, | ||
| ): Promise<schema.RequestPermissionResponse>; | ||
| /** | ||
| * Handles session update notifications from the agent. | ||
| * | ||
| * This is a notification endpoint (no response expected) that receives | ||
| * real-time updates about session progress, including message chunks, | ||
| * tool calls, and execution plans. | ||
| * | ||
| * Note: Clients SHOULD continue accepting tool call updates even after | ||
| * sending a `session/cancel` notification, as the agent may send final | ||
| * updates before responding with the cancelled stop reason. | ||
| * | ||
| * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output) | ||
| */ | ||
| sessionUpdate(params: schema.SessionNotification): Promise<void>; | ||
| /** | ||
| * Writes content to a text file in the client's file system. | ||
| * | ||
| * Only available if the client advertises the `fs.writeTextFile` capability. | ||
| * Allows the agent to create or modify files within the client's environment. | ||
| * | ||
| * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) | ||
| */ | ||
| writeTextFile?( | ||
| params: schema.WriteTextFileRequest, | ||
| ): Promise<schema.WriteTextFileResponse>; | ||
| /** | ||
| * Reads content from a text file in the client's file system. | ||
| * | ||
| * Only available if the client advertises the `fs.readTextFile` capability. | ||
| * Allows the agent to access file contents within the client's environment. | ||
| * | ||
| * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) | ||
| */ | ||
| readTextFile?( | ||
| params: schema.ReadTextFileRequest, | ||
| ): Promise<schema.ReadTextFileResponse>; | ||
| /** | ||
| * Creates a new terminal to execute a command. | ||
| * | ||
| * Only available if the `terminal` capability is set to `true`. | ||
| * | ||
| * The Agent must call `releaseTerminal` when done with the terminal | ||
| * to free resources. | ||
| * @see {@link https://agentclientprotocol.com/protocol/terminals | Terminal Documentation} | ||
| */ | ||
| createTerminal?( | ||
| params: schema.CreateTerminalRequest, | ||
| ): Promise<schema.CreateTerminalResponse>; | ||
| /** | ||
| * Gets the current output and exit status of a terminal. | ||
| * | ||
| * Returns immediately without waiting for the command to complete. | ||
| * If the command has already exited, the exit status is included. | ||
| * | ||
| * @see {@link https://agentclientprotocol.com/protocol/terminals#getting-output | Getting Terminal Output} | ||
| */ | ||
| terminalOutput?( | ||
| params: schema.TerminalOutputRequest, | ||
| ): Promise<schema.TerminalOutputResponse>; | ||
| /** | ||
| * Releases a terminal and frees all associated resources. | ||
| * | ||
| * The command is killed if it hasn't exited yet. After release, | ||
| * the terminal ID becomes invalid for all other terminal methods. | ||
| * | ||
| * Tool calls that already contain the terminal ID continue to | ||
| * display its output. | ||
| * | ||
| * @see {@link https://agentclientprotocol.com/protocol/terminals#releasing-terminals | Releasing Terminals} | ||
| */ | ||
| releaseTerminal?( | ||
| params: schema.ReleaseTerminalRequest, | ||
| ): Promise<schema.ReleaseTerminalResponse | void>; | ||
| /** | ||
| * Waits for a terminal command to exit and returns its exit status. | ||
| * | ||
| * This method returns once the command completes, providing the | ||
| * exit code and/or signal that terminated the process. | ||
| * | ||
| * @see {@link https://agentclientprotocol.com/protocol/terminals#waiting-for-exit | Waiting for Exit} | ||
| */ | ||
| waitForTerminalExit?( | ||
| params: schema.WaitForTerminalExitRequest, | ||
| ): Promise<schema.WaitForTerminalExitResponse>; | ||
| /** | ||
| * Kills a terminal command without releasing the terminal. | ||
| * | ||
| * While `releaseTerminal` also kills the command, this method keeps | ||
| * the terminal ID valid so it can be used with other methods. | ||
| * | ||
| * Useful for implementing command timeouts that terminate the command | ||
| * and then retrieve the final output. | ||
| * | ||
| * Note: Call `releaseTerminal` when the terminal is no longer needed. | ||
| * | ||
| * @see {@link https://agentclientprotocol.com/protocol/terminals#killing-commands | Killing Commands} | ||
| */ | ||
| killTerminal?( | ||
| params: schema.KillTerminalCommandRequest, | ||
| ): Promise<schema.KillTerminalResponse | void>; | ||
| /** | ||
| * Extension method | ||
| * | ||
| * Allows the Agent to send an arbitrary request that is not part of the ACP spec. | ||
| * | ||
| * To help avoid conflicts, it's a good practice to prefix extension | ||
| * methods with a unique identifier such as domain name. | ||
| */ | ||
| extMethod?( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<Record<string, unknown>>; | ||
| /** | ||
| * Extension notification | ||
| * | ||
| * Allows the Agent to send an arbitrary notification that is not part of the ACP spec. | ||
| */ | ||
| extNotification?( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<void>; | ||
| } | ||
| /** | ||
| * The Agent interface defines the interface that all ACP-compliant agents must implement. | ||
| * | ||
| * Agents are programs that use generative AI to autonomously modify code. They handle | ||
| * requests from clients and execute tasks using language models and tools. | ||
| */ | ||
| export interface Agent { | ||
| /** | ||
| * Establishes the connection with a client and negotiates protocol capabilities. | ||
| * | ||
| * This method is called once at the beginning of the connection to: | ||
| * - Negotiate the protocol version to use | ||
| * - Exchange capability information between client and agent | ||
| * - Determine available authentication methods | ||
| * | ||
| * The agent should respond with its supported protocol version and capabilities. | ||
| * | ||
| * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) | ||
| */ | ||
| initialize( | ||
| params: schema.InitializeRequest, | ||
| ): Promise<schema.InitializeResponse>; | ||
| /** | ||
| * Creates a new conversation session with the agent. | ||
| * | ||
| * Sessions represent independent conversation contexts with their own history and state. | ||
| * | ||
| * The agent should: | ||
| * - Create a new session context | ||
| * - Connect to any specified MCP servers | ||
| * - Return a unique session ID for future requests | ||
| * | ||
| * May return an `auth_required` error if the agent requires authentication. | ||
| * | ||
| * See protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup) | ||
| */ | ||
| newSession( | ||
| params: schema.NewSessionRequest, | ||
| ): Promise<schema.NewSessionResponse>; | ||
| /** | ||
| * Loads an existing session to resume a previous conversation. | ||
| * | ||
| * This method is only available if the agent advertises the `loadSession` capability. | ||
| * | ||
| * The agent should: | ||
| * - Restore the session context and conversation history | ||
| * - Connect to the specified MCP servers | ||
| * - Stream the entire conversation history back to the client via notifications | ||
| * | ||
| * See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions) | ||
| */ | ||
| loadSession?( | ||
| params: schema.LoadSessionRequest, | ||
| ): Promise<schema.LoadSessionResponse>; | ||
| /** | ||
| * Sets the operational mode for a session. | ||
| * | ||
| * Allows switching between different agent modes (e.g., "ask", "architect", "code") | ||
| * that affect system prompts, tool availability, and permission behaviors. | ||
| * | ||
| * The mode must be one of the modes advertised in `availableModes` during session | ||
| * creation or loading. Agents may also change modes autonomously and notify the | ||
| * client via `current_mode_update` notifications. | ||
| * | ||
| * This method can be called at any time during a session, whether the Agent is | ||
| * idle or actively generating a turn. | ||
| * | ||
| * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) | ||
| */ | ||
| setSessionMode?( | ||
| params: schema.SetSessionModeRequest, | ||
| ): Promise<schema.SetSessionModeResponse | void>; | ||
| /** | ||
| * **UNSTABLE** | ||
| * | ||
| * This capability is not part of the spec yet, and may be removed or changed at any point. | ||
| * | ||
| * Select a model for a given session. | ||
| */ | ||
| setSessionModel?( | ||
| params: schema.SetSessionModelRequest, | ||
| ): Promise<schema.SetSessionModelResponse | void>; | ||
| /** | ||
| * Authenticates the client using the specified authentication method. | ||
| * | ||
| * Called when the agent requires authentication before allowing session creation. | ||
| * The client provides the authentication method ID that was advertised during initialization. | ||
| * | ||
| * After successful authentication, the client can proceed to create sessions with | ||
| * `newSession` without receiving an `auth_required` error. | ||
| * | ||
| * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) | ||
| */ | ||
| authenticate( | ||
| params: schema.AuthenticateRequest, | ||
| ): Promise<schema.AuthenticateResponse | void>; | ||
| /** | ||
| * Processes a user prompt within a session. | ||
| * | ||
| * This method handles the whole lifecycle of a prompt: | ||
| * - Receives user messages with optional context (files, images, etc.) | ||
| * - Processes the prompt using language models | ||
| * - Reports language model content and tool calls to the Clients | ||
| * - Requests permission to run tools | ||
| * - Executes any requested tool calls | ||
| * - Returns when the turn is complete with a stop reason | ||
| * | ||
| * See protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn) | ||
| */ | ||
| prompt(params: schema.PromptRequest): Promise<schema.PromptResponse>; | ||
| /** | ||
| * Cancels ongoing operations for a session. | ||
| * | ||
| * This is a notification sent by the client to cancel an ongoing prompt turn. | ||
| * | ||
| * Upon receiving this notification, the Agent SHOULD: | ||
| * - Stop all language model requests as soon as possible | ||
| * - Abort all tool call invocations in progress | ||
| * - Send any pending `session/update` notifications | ||
| * - Respond to the original `session/prompt` request with `StopReason::Cancelled` | ||
| * | ||
| * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation) | ||
| */ | ||
| cancel(params: schema.CancelNotification): Promise<void>; | ||
| /** | ||
| * Extension method | ||
| * | ||
| * Allows the Client to send an arbitrary request that is not part of the ACP spec. | ||
| * | ||
| * To help avoid conflicts, it's a good practice to prefix extension | ||
| * methods with a unique identifier such as domain name. | ||
| */ | ||
| extMethod?( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<Record<string, unknown>>; | ||
| /** | ||
| * Extension notification | ||
| * | ||
| * Allows the Client to send an arbitrary notification that is not part of the ACP spec. | ||
| */ | ||
| extNotification?( | ||
| method: string, | ||
| params: Record<string, unknown>, | ||
| ): Promise<void>; | ||
| } |
| #!/usr/bin/env node | ||
| import * as acp from "../acp.js"; | ||
| import { Readable, Writable } from "node:stream"; | ||
| interface AgentSession { | ||
| pendingPrompt: AbortController | null; | ||
| } | ||
| class ExampleAgent implements acp.Agent { | ||
| private connection: acp.AgentSideConnection; | ||
| private sessions: Map<string, AgentSession>; | ||
| constructor(connection: acp.AgentSideConnection) { | ||
| this.connection = connection; | ||
| this.sessions = new Map(); | ||
| } | ||
| async initialize( | ||
| params: acp.InitializeRequest, | ||
| ): Promise<acp.InitializeResponse> { | ||
| return { | ||
| protocolVersion: acp.PROTOCOL_VERSION, | ||
| agentCapabilities: { | ||
| loadSession: false, | ||
| }, | ||
| }; | ||
| } | ||
| async newSession( | ||
| params: acp.NewSessionRequest, | ||
| ): Promise<acp.NewSessionResponse> { | ||
| const sessionId = Math.random().toString(36).substring(2); | ||
| this.sessions.set(sessionId, { | ||
| pendingPrompt: null, | ||
| }); | ||
| return { | ||
| sessionId, | ||
| }; | ||
| } | ||
| async authenticate( | ||
| params: acp.AuthenticateRequest, | ||
| ): Promise<acp.AuthenticateResponse | void> { | ||
| // No auth needed - return empty response | ||
| return {}; | ||
| } | ||
| async setSessionMode( | ||
| params: acp.SetSessionModeRequest, | ||
| ): Promise<acp.SetSessionModeResponse> { | ||
| // Session mode changes not implemented in this example | ||
| return {}; | ||
| } | ||
| async prompt(params: acp.PromptRequest): Promise<acp.PromptResponse> { | ||
| const session = this.sessions.get(params.sessionId); | ||
| if (!session) { | ||
| throw new Error(`Session ${params.sessionId} not found`); | ||
| } | ||
| session.pendingPrompt?.abort(); | ||
| session.pendingPrompt = new AbortController(); | ||
| try { | ||
| await this.simulateTurn(params.sessionId, session.pendingPrompt.signal); | ||
| } catch (err) { | ||
| if (session.pendingPrompt.signal.aborted) { | ||
| return { stopReason: "cancelled" }; | ||
| } | ||
| throw err; | ||
| } | ||
| session.pendingPrompt = null; | ||
| return { | ||
| stopReason: "end_turn", | ||
| }; | ||
| } | ||
| private async simulateTurn( | ||
| sessionId: string, | ||
| abortSignal: AbortSignal, | ||
| ): Promise<void> { | ||
| // Send initial text chunk | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: "I'll help you with that. Let me start by reading some files to understand the current situation.", | ||
| }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| // Send a tool call that doesn't need permission | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "tool_call", | ||
| toolCallId: "call_1", | ||
| title: "Reading project files", | ||
| kind: "read", | ||
| status: "pending", | ||
| locations: [{ path: "/project/README.md" }], | ||
| rawInput: { path: "/project/README.md" }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| // Update tool call to completed | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "tool_call_update", | ||
| toolCallId: "call_1", | ||
| status: "completed", | ||
| content: [ | ||
| { | ||
| type: "content", | ||
| content: { | ||
| type: "text", | ||
| text: "# My Project\n\nThis is a sample project...", | ||
| }, | ||
| }, | ||
| ], | ||
| rawOutput: { content: "# My Project\n\nThis is a sample project..." }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| // Send more text | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: " Now I understand the project structure. I need to make some changes to improve it.", | ||
| }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| // Send a tool call that DOES need permission | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "tool_call", | ||
| toolCallId: "call_2", | ||
| title: "Modifying critical configuration file", | ||
| kind: "edit", | ||
| status: "pending", | ||
| locations: [{ path: "/project/config.json" }], | ||
| rawInput: { | ||
| path: "/project/config.json", | ||
| content: '{"database": {"host": "new-host"}}', | ||
| }, | ||
| }, | ||
| }); | ||
| // Request permission for the sensitive operation | ||
| const permissionResponse = await this.connection.requestPermission({ | ||
| sessionId, | ||
| toolCall: { | ||
| toolCallId: "call_2", | ||
| title: "Modifying critical configuration file", | ||
| kind: "edit", | ||
| status: "pending", | ||
| locations: [{ path: "/home/user/project/config.json" }], | ||
| rawInput: { | ||
| path: "/home/user/project/config.json", | ||
| content: '{"database": {"host": "new-host"}}', | ||
| }, | ||
| }, | ||
| options: [ | ||
| { | ||
| kind: "allow_once", | ||
| name: "Allow this change", | ||
| optionId: "allow", | ||
| }, | ||
| { | ||
| kind: "reject_once", | ||
| name: "Skip this change", | ||
| optionId: "reject", | ||
| }, | ||
| ], | ||
| }); | ||
| if (permissionResponse.outcome.outcome === "cancelled") { | ||
| return; | ||
| } | ||
| switch (permissionResponse.outcome.optionId) { | ||
| case "allow": { | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "tool_call_update", | ||
| toolCallId: "call_2", | ||
| status: "completed", | ||
| rawOutput: { success: true, message: "Configuration updated" }, | ||
| }, | ||
| }); | ||
| await this.simulateModelInteraction(abortSignal); | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: " Perfect! I've successfully updated the configuration. The changes have been applied.", | ||
| }, | ||
| }, | ||
| }); | ||
| break; | ||
| } | ||
| case "reject": { | ||
| await this.simulateModelInteraction(abortSignal); | ||
| await this.connection.sessionUpdate({ | ||
| sessionId, | ||
| update: { | ||
| sessionUpdate: "agent_message_chunk", | ||
| content: { | ||
| type: "text", | ||
| text: " I understand you prefer not to make that change. I'll skip the configuration update.", | ||
| }, | ||
| }, | ||
| }); | ||
| break; | ||
| } | ||
| default: | ||
| throw new Error( | ||
| `Unexpected permission outcome ${permissionResponse.outcome}`, | ||
| ); | ||
| } | ||
| } | ||
| private simulateModelInteraction(abortSignal: AbortSignal): Promise<void> { | ||
| return new Promise((resolve, reject) => | ||
| setTimeout(() => { | ||
| // In a real agent, you'd pass this abort signal to the LLM client | ||
| if (abortSignal.aborted) { | ||
| reject(); | ||
| } else { | ||
| resolve(); | ||
| } | ||
| }, 1000), | ||
| ); | ||
| } | ||
| async cancel(params: acp.CancelNotification): Promise<void> { | ||
| this.sessions.get(params.sessionId)?.pendingPrompt?.abort(); | ||
| } | ||
| } | ||
| const input = Writable.toWeb(process.stdout); | ||
| const output = Readable.toWeb(process.stdin) as ReadableStream<Uint8Array>; | ||
| const stream = acp.ndJsonStream(input, output); | ||
| new acp.AgentSideConnection((conn) => new ExampleAgent(conn), stream); |
| #!/usr/bin/env node | ||
| import { spawn } from "node:child_process"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { dirname, join } from "node:path"; | ||
| import { Writable, Readable } from "node:stream"; | ||
| import readline from "node:readline/promises"; | ||
| import * as acp from "../acp.js"; | ||
| class ExampleClient implements acp.Client { | ||
| async requestPermission( | ||
| params: acp.RequestPermissionRequest, | ||
| ): Promise<acp.RequestPermissionResponse> { | ||
| console.log(`\n🔐 Permission requested: ${params.toolCall.title}`); | ||
| console.log(`\nOptions:`); | ||
| params.options.forEach((option, index) => { | ||
| console.log(` ${index + 1}. ${option.name} (${option.kind})`); | ||
| }); | ||
| while (true) { | ||
| const rl = readline.createInterface({ | ||
| input: process.stdin, | ||
| output: process.stdout, | ||
| }); | ||
| let answer = await rl.question("\nChoose an option: "); | ||
| const trimmedAnswer = answer.trim(); | ||
| const optionIndex = parseInt(trimmedAnswer) - 1; | ||
| if (optionIndex >= 0 && optionIndex < params.options.length) { | ||
| return { | ||
| outcome: { | ||
| outcome: "selected", | ||
| optionId: params.options[optionIndex].optionId, | ||
| }, | ||
| }; | ||
| } else { | ||
| console.log("Invalid option. Please try again."); | ||
| } | ||
| } | ||
| } | ||
| async sessionUpdate(params: acp.SessionNotification): Promise<void> { | ||
| const update = params.update; | ||
| switch (update.sessionUpdate) { | ||
| case "agent_message_chunk": | ||
| if (update.content.type === "text") { | ||
| console.log(update.content.text); | ||
| } else { | ||
| console.log(`[${update.content.type}]`); | ||
| } | ||
| break; | ||
| case "tool_call": | ||
| console.log(`\n🔧 ${update.title} (${update.status})`); | ||
| break; | ||
| case "tool_call_update": | ||
| console.log( | ||
| `\n🔧 Tool call \`${update.toolCallId}\` updated: ${update.status}\n`, | ||
| ); | ||
| break; | ||
| case "plan": | ||
| case "agent_thought_chunk": | ||
| case "user_message_chunk": | ||
| console.log(`[${update.sessionUpdate}]`); | ||
| break; | ||
| } | ||
| } | ||
| async writeTextFile( | ||
| params: acp.WriteTextFileRequest, | ||
| ): Promise<acp.WriteTextFileResponse> { | ||
| console.error( | ||
| "[Client] Write text file called with:", | ||
| JSON.stringify(params, null, 2), | ||
| ); | ||
| return {}; | ||
| } | ||
| async readTextFile( | ||
| params: acp.ReadTextFileRequest, | ||
| ): Promise<acp.ReadTextFileResponse> { | ||
| console.error( | ||
| "[Client] Read text file called with:", | ||
| JSON.stringify(params, null, 2), | ||
| ); | ||
| return { | ||
| content: "Mock file content", | ||
| }; | ||
| } | ||
| } | ||
| async function main() { | ||
| // Get the current file's directory to find agent.ts | ||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = dirname(__filename); | ||
| const agentPath = join(__dirname, "agent.ts"); | ||
| // Spawn the agent as a subprocess using tsx | ||
| const agentProcess = spawn("npx", ["tsx", agentPath], { | ||
| stdio: ["pipe", "pipe", "inherit"], | ||
| }); | ||
| // Create streams to communicate with the agent | ||
| const input = Writable.toWeb(agentProcess.stdin!); | ||
| const output = Readable.toWeb( | ||
| agentProcess.stdout!, | ||
| ) as ReadableStream<Uint8Array>; | ||
| // Create the client connection | ||
| const client = new ExampleClient(); | ||
| const stream = acp.ndJsonStream(input, output); | ||
| const connection = new acp.ClientSideConnection((_agent) => client, stream); | ||
| try { | ||
| // Initialize the connection | ||
| const initResult = await connection.initialize({ | ||
| protocolVersion: acp.PROTOCOL_VERSION, | ||
| clientCapabilities: { | ||
| fs: { | ||
| readTextFile: true, | ||
| writeTextFile: true, | ||
| }, | ||
| }, | ||
| }); | ||
| console.log( | ||
| `✅ Connected to agent (protocol v${initResult.protocolVersion})`, | ||
| ); | ||
| // Create a new session | ||
| const sessionResult = await connection.newSession({ | ||
| cwd: process.cwd(), | ||
| mcpServers: [], | ||
| }); | ||
| console.log(`📝 Created session: ${sessionResult.sessionId}`); | ||
| console.log(`💬 User: Hello, agent!\n`); | ||
| process.stdout.write(" "); | ||
| // Send a test prompt | ||
| const promptResult = await connection.prompt({ | ||
| sessionId: sessionResult.sessionId, | ||
| prompt: [ | ||
| { | ||
| type: "text", | ||
| text: "Hello, agent!", | ||
| }, | ||
| ], | ||
| }); | ||
| console.log(`\n\n✅ Agent completed with: ${promptResult.stopReason}`); | ||
| } catch (error) { | ||
| console.error("[Client] Error:", error); | ||
| } finally { | ||
| agentProcess.kill(); | ||
| process.exit(0); | ||
| } | ||
| } | ||
| main().catch(console.error); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
| # ACP TypeScript Examples | ||
| This directory contains examples using the [ACP](https://agentclientprotocol.com) library for TypeScript: | ||
| - [`agent.ts`](./agent.ts) - A minimal agent implementation that simulates LLM interaction | ||
| - [`client.ts`](./client.ts) - A minimal client implementation that spawns the [`agent.ts`](./agent.ts) as a subprocess | ||
| ## Running the Agent | ||
| ### In Zed | ||
| While minimal, [`agent.ts`](./agent.ts) implements a compliant [ACP](https://agentclientprotocol.com) Agent. This means we can connect to it from an ACP client like [Zed](https://zed.dev)! | ||
| 1. Clone this repo | ||
| ```sh | ||
| $ git clone https://github.com/agentclientprotocol/agent-client-protocol.git | ||
| ``` | ||
| 2. Add the following at the root of your [Zed](https://zed.dev) settings: | ||
| ```json | ||
| "agent_servers": { | ||
| "Example Agent": { | ||
| "command": "npx", | ||
| "args": [ | ||
| "tsx", | ||
| "/path/to/agent-client-protocol/typescript/examples/agent.ts" | ||
| ] | ||
| } | ||
| ``` | ||
| ❕ Make sure to replace `/path/to/agent-client-protocol` with the path to your clone of this repository. | ||
| Note: This configuration assumes you have [npx](https://docs.npmjs.com/cli/v8/commands/npx) in your `PATH`. | ||
| 3. Run the `acp: open acp logs` action from the command palette (<kbd>⌘⇧P</kbd> on macOS, <kbd>ctrl-shift-p</kbd> on Windows/Linux) to see the messages exchanged between the example agent and Zed. | ||
| 4. Then open the Agent Panel, and click "New Example Agent Thread" from the `+` menu on the top-right. | ||
|  | ||
| 5. Finally, send a message and see the Agent respond! | ||
|  | ||
| ### By itself | ||
| You can also run the Agent directly and send messages to it: | ||
| ```bash | ||
| npx tsx typescript/examples/agent.ts | ||
| ``` | ||
| Paste this into your terminal and press <kbd>enter</kbd>: | ||
| ```json | ||
| {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":1}} | ||
| ``` | ||
| You should see it respond with something like: | ||
| ```json | ||
| {"jsonrpc":"2.0","id":0,"result":{"protocolVersion":1,"agentCapabilities":{"loadSession":false}}} | ||
| ``` | ||
| From there, you can try making a [new session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session) and [sending a prompt](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message). | ||
| ## Running the Client | ||
| Run the client example from the root directory: | ||
| ```bash | ||
| npx tsx typescript/examples/client.ts | ||
| ``` | ||
| This client will spawn the example agent as a subprocess, send a message, and print the content it receives from it. |
| #!/usr/bin/env node | ||
| import { compile } from "json-schema-to-typescript"; | ||
| import { generate } from "ts-to-zod"; | ||
| import fs from "fs"; | ||
| const jsonSchema = JSON.parse(fs.readFileSync("./schema/schema.json", "utf8")); | ||
| const metadata = JSON.parse(fs.readFileSync("./schema/meta.json", "utf8")); | ||
| const tsSrc = await compile(jsonSchema, "Agent Client Protocol", { | ||
| additionalProperties: false, | ||
| bannerComment: false, | ||
| }); | ||
| const zodGenerator = generate({ | ||
| sourceText: tsSrc, | ||
| bannerComment: false, | ||
| keepComments: false, | ||
| }); | ||
| const zodSchemas = zodGenerator.getZodSchemasFile(); | ||
| const schemaTs = ` | ||
| export const AGENT_METHODS = ${JSON.stringify(metadata.agentMethods, null, 2)} as const; | ||
| export const CLIENT_METHODS = ${JSON.stringify(metadata.clientMethods, null, 2)} as const; | ||
| export const PROTOCOL_VERSION = ${metadata.version}; | ||
| import { z } from "zod"; | ||
| ${markSpecificTypesAsInternal(tsSrc)} | ||
| ${markZodSchemasAsInternal(fixGeneratedZod(zodSchemas))} | ||
| `; | ||
| function fixGeneratedZod(src) { | ||
| return src | ||
| .replace(`// Generated by ts-to-zod\nimport { z } from "zod";\n`, "") | ||
| .replace(`import * as generated from "./zod";\n`, "") | ||
| .replace(/typeof generated./g, "typeof "); | ||
| } | ||
| function markSpecificTypesAsInternal(src) { | ||
| const typesToExclude = [ | ||
| "AgentRequest", | ||
| "AgentResponse", | ||
| "AgentNotification", | ||
| "ClientRequest", | ||
| "ClientResponse", | ||
| "ClientNotification", | ||
| ]; | ||
| let result = src; | ||
| for (const typeName of typesToExclude) { | ||
| const regex = new RegExp(`(export type ${typeName}\\b)`, "g"); | ||
| result = result.replace(regex, "/** @internal */\n$1"); | ||
| } | ||
| return result; | ||
| } | ||
| function markZodSchemasAsInternal(src) { | ||
| // Mark all zod schemas as internal - they're implementation details | ||
| return src.replace(/(export const \w+Schema = )/g, "/** @internal */\n$1"); | ||
| } | ||
| fs.writeFileSync("typescript/schema.ts", schemaTs, "utf8"); |
| /** | ||
| * JSON-RPC 2.0 type definitions for internal use. | ||
| */ | ||
| export type AnyMessage = AnyRequest | AnyResponse | AnyNotification; | ||
| export type AnyRequest = { | ||
| jsonrpc: "2.0"; | ||
| id: string | number | null; | ||
| method: string; | ||
| params?: unknown; | ||
| }; | ||
| export type AnyResponse = { | ||
| jsonrpc: "2.0"; | ||
| id: string | number | null; | ||
| } & Result<unknown>; | ||
| export type AnyNotification = { | ||
| jsonrpc: "2.0"; | ||
| method: string; | ||
| params?: unknown; | ||
| }; | ||
| export type Result<T> = | ||
| | { | ||
| result: T; | ||
| } | ||
| | { | ||
| error: ErrorResponse; | ||
| }; | ||
| export type ErrorResponse = { | ||
| code: number; | ||
| message: string; | ||
| data?: unknown; | ||
| }; | ||
| export type PendingResponse = { | ||
| resolve: (response: unknown) => void; | ||
| reject: (error: ErrorResponse) => void; | ||
| }; | ||
| export type RequestHandler = ( | ||
| method: string, | ||
| params: unknown, | ||
| ) => Promise<unknown>; | ||
| export type NotificationHandler = ( | ||
| method: string, | ||
| params: unknown, | ||
| ) => Promise<void>; |
| <a href="https://agentclientprotocol.com/" > | ||
| <img alt="Agent Client Protocol" src="https://zed.dev/img/acp/banner-dark.webp"> | ||
| </a> | ||
| # ACP TypeScript Library | ||
| The official TypeScript implementation of the Agent Client Protocol (ACP) — a standardized communication protocol between code editors and AI-powered coding agents. | ||
| Learn more at https://agentclientprotocol.com | ||
| ## Installation | ||
| ```bash | ||
| npm install @agentclientprotocol/sdk | ||
| ``` | ||
| ## Get Started | ||
| ### Understand the Protocol | ||
| Start by reading the [official ACP documentation](https://agentclientprotocol.com) to understand the core concepts and protocol specification. | ||
| ### Try the Examples | ||
| The [examples directory](https://github.com/agentclientprotocol/agent-client-protocol/tree/main/typescript/examples) contains simple implementations of both Agents and Clients in TypeScript. These examples can be run from your terminal or from an ACP Client like [Zed](https://zed.dev), making them great starting points for your own integration! | ||
| ### Explore the API | ||
| Browse the [TypeScript library reference](https://agentclientprotocol.github.io/agent-client-protocol) for detailed API documentation. | ||
| If you're building an [Agent](https://agentclientprotocol.com/protocol/overview#agent), start with [AgentSideConnection](https://agentclientprotocol.github.io/agent-client-protocol/classes/AgentSideConnection.html). | ||
| If you're building a [Client](https://agentclientprotocol.com/protocol/overview#client), start with [ClientSideConnection](https://agentclientprotocol.github.io/agent-client-protocol/classes/ClientSideConnection.html). | ||
| ### Study a Production Implementation | ||
| For a complete, production-ready implementation, check out the [Gemini CLI Agent](https://github.com/google-gemini/gemini-cli/blob/main/packages/cli/src/zed-integration/zedIntegration.ts). | ||
| ## Resources | ||
| - [Library docs](https://agentclientprotocol.github.io/agent-client-protocol) | ||
| - [Examples](https://github.com/agentclientprotocol/agent-client-protocol/tree/main/typescript/examples) | ||
| - [Protocol Documentation](https://agentclientprotocol.com) | ||
| - [GitHub Repository](https://github.com/agentclientprotocol/agent-client-protocol) | ||
| - [NPM Package](https://www.npmjs.com/package/@agentclientprotocol/sdk) | ||
| ## Contributing | ||
| See the main [repository](https://github.com/agentclientprotocol/agent-client-protocol) for contribution guidelines. |
-2446
| export const AGENT_METHODS = { | ||
| authenticate: "authenticate", | ||
| initialize: "initialize", | ||
| session_cancel: "session/cancel", | ||
| session_load: "session/load", | ||
| session_new: "session/new", | ||
| session_prompt: "session/prompt", | ||
| session_set_mode: "session/set_mode", | ||
| session_set_model: "session/set_model", | ||
| } as const; | ||
| export const CLIENT_METHODS = { | ||
| fs_read_text_file: "fs/read_text_file", | ||
| fs_write_text_file: "fs/write_text_file", | ||
| session_request_permission: "session/request_permission", | ||
| session_update: "session/update", | ||
| terminal_create: "terminal/create", | ||
| terminal_kill: "terminal/kill", | ||
| terminal_output: "terminal/output", | ||
| terminal_release: "terminal/release", | ||
| terminal_wait_for_exit: "terminal/wait_for_exit", | ||
| } as const; | ||
| export const PROTOCOL_VERSION = 1; | ||
| import { z } from "zod"; | ||
| export type AgentClientProtocol = | ||
| | ClientRequest | ||
| | ClientResponse | ||
| | ClientNotification | ||
| | AgentRequest | ||
| | AgentResponse | ||
| | AgentNotification; | ||
| /** | ||
| * All possible requests that an agent can send to a client. | ||
| * | ||
| * This enum is used internally for routing RPC requests. You typically won't need | ||
| * to use this directly - instead, use the methods on the [`Client`] trait. | ||
| * | ||
| * This enum encompasses all method calls from agent to client. | ||
| */ | ||
| /** @internal */ | ||
| export type ClientRequest = | ||
| | WriteTextFileRequest | ||
| | ReadTextFileRequest | ||
| | RequestPermissionRequest | ||
| | CreateTerminalRequest | ||
| | TerminalOutputRequest | ||
| | ReleaseTerminalRequest | ||
| | WaitForTerminalExitRequest | ||
| | KillTerminalCommandRequest | ||
| | ExtMethodRequest; | ||
| /** | ||
| * Content produced by a tool call. | ||
| * | ||
| * Tool calls can produce different types of content including | ||
| * standard content blocks (text, images) or file diffs. | ||
| * | ||
| * See protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content) | ||
| */ | ||
| export type ToolCallContent = | ||
| | { | ||
| /** | ||
| * Content blocks represent displayable information in the Agent Client Protocol. | ||
| * | ||
| * They provide a structured way to handle various types of user-facing content—whether | ||
| * it's text from language models, images for analysis, or embedded resources for context. | ||
| * | ||
| * Content blocks appear in: | ||
| * - User prompts sent via `session/prompt` | ||
| * - Language model output streamed through `session/update` notifications | ||
| * - Progress updates and results from tool calls | ||
| * | ||
| * This structure is compatible with the Model Context Protocol (MCP), enabling | ||
| * agents to seamlessly forward content from MCP tool outputs without transformation. | ||
| * | ||
| * See protocol docs: [Content](https://agentclientprotocol.com/protocol/content) | ||
| */ | ||
| content: | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| text: string; | ||
| type: "text"; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| data: string; | ||
| mimeType: string; | ||
| type: "image"; | ||
| uri?: string | null; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| data: string; | ||
| mimeType: string; | ||
| type: "audio"; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| description?: string | null; | ||
| mimeType?: string | null; | ||
| name: string; | ||
| size?: number | null; | ||
| title?: string | null; | ||
| type: "resource_link"; | ||
| uri: string; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| resource: EmbeddedResourceResource; | ||
| type: "resource"; | ||
| }; | ||
| type: "content"; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The new content after modification. | ||
| */ | ||
| newText: string; | ||
| /** | ||
| * The original content (None for new files). | ||
| */ | ||
| oldText?: string | null; | ||
| /** | ||
| * The file path being modified. | ||
| */ | ||
| path: string; | ||
| type: "diff"; | ||
| } | ||
| | { | ||
| terminalId: string; | ||
| type: "terminal"; | ||
| }; | ||
| /** | ||
| * The sender or recipient of messages and data in a conversation. | ||
| */ | ||
| export type Role = "assistant" | "user"; | ||
| /** | ||
| * Resource content that can be embedded in a message. | ||
| */ | ||
| export type EmbeddedResourceResource = | ||
| | TextResourceContents | ||
| | BlobResourceContents; | ||
| /** | ||
| * Categories of tools that can be invoked. | ||
| * | ||
| * Tool kinds help clients choose appropriate icons and optimize how they | ||
| * display tool execution progress. | ||
| * | ||
| * See protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating) | ||
| */ | ||
| export type ToolKind = | ||
| | "read" | ||
| | "edit" | ||
| | "delete" | ||
| | "move" | ||
| | "search" | ||
| | "execute" | ||
| | "think" | ||
| | "fetch" | ||
| | "switch_mode" | ||
| | "other"; | ||
| /** | ||
| * Execution status of a tool call. | ||
| * | ||
| * Tool calls progress through different statuses during their lifecycle. | ||
| * | ||
| * See protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status) | ||
| */ | ||
| export type ToolCallStatus = "pending" | "in_progress" | "completed" | "failed"; | ||
| /** | ||
| * All possible responses that a client can send to an agent. | ||
| * | ||
| * This enum is used internally for routing RPC responses. You typically won't need | ||
| * to use this directly - the responses are handled automatically by the connection. | ||
| * | ||
| * These are responses to the corresponding `AgentRequest` variants. | ||
| */ | ||
| /** @internal */ | ||
| export type ClientResponse = | ||
| | WriteTextFileResponse | ||
| | ReadTextFileResponse | ||
| | RequestPermissionResponse | ||
| | CreateTerminalResponse | ||
| | TerminalOutputResponse | ||
| | ReleaseTerminalResponse | ||
| | WaitForTerminalExitResponse | ||
| | KillTerminalResponse | ||
| | ExtMethodResponse; | ||
| /** | ||
| * All possible notifications that a client can send to an agent. | ||
| * | ||
| * This enum is used internally for routing RPC notifications. You typically won't need | ||
| * to use this directly - use the notification methods on the [`Agent`] trait instead. | ||
| * | ||
| * Notifications do not expect a response. | ||
| */ | ||
| /** @internal */ | ||
| export type ClientNotification = CancelNotification | ExtNotification; | ||
| /** | ||
| * All possible requests that a client can send to an agent. | ||
| * | ||
| * This enum is used internally for routing RPC requests. You typically won't need | ||
| * to use this directly - instead, use the methods on the [`Agent`] trait. | ||
| * | ||
| * This enum encompasses all method calls from client to agent. | ||
| */ | ||
| /** @internal */ | ||
| export type AgentRequest = | ||
| | InitializeRequest | ||
| | AuthenticateRequest | ||
| | NewSessionRequest | ||
| | LoadSessionRequest | ||
| | SetSessionModeRequest | ||
| | PromptRequest | ||
| | SetSessionModelRequest | ||
| | ExtMethodRequest1; | ||
| /** | ||
| * Configuration for connecting to an MCP (Model Context Protocol) server. | ||
| * | ||
| * MCP servers provide tools and context that the agent can use when | ||
| * processing prompts. | ||
| * | ||
| * See protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/session-setup#mcp-servers) | ||
| */ | ||
| export type McpServer = | ||
| | { | ||
| /** | ||
| * HTTP headers to set when making requests to the MCP server. | ||
| */ | ||
| headers: HttpHeader[]; | ||
| /** | ||
| * Human-readable name identifying this MCP server. | ||
| */ | ||
| name: string; | ||
| type: "http"; | ||
| /** | ||
| * URL to the MCP server. | ||
| */ | ||
| url: string; | ||
| } | ||
| | { | ||
| /** | ||
| * HTTP headers to set when making requests to the MCP server. | ||
| */ | ||
| headers: HttpHeader[]; | ||
| /** | ||
| * Human-readable name identifying this MCP server. | ||
| */ | ||
| name: string; | ||
| type: "sse"; | ||
| /** | ||
| * URL to the MCP server. | ||
| */ | ||
| url: string; | ||
| } | ||
| | Stdio; | ||
| /** | ||
| * Content blocks represent displayable information in the Agent Client Protocol. | ||
| * | ||
| * They provide a structured way to handle various types of user-facing content—whether | ||
| * it's text from language models, images for analysis, or embedded resources for context. | ||
| * | ||
| * Content blocks appear in: | ||
| * - User prompts sent via `session/prompt` | ||
| * - Language model output streamed through `session/update` notifications | ||
| * - Progress updates and results from tool calls | ||
| * | ||
| * This structure is compatible with the Model Context Protocol (MCP), enabling | ||
| * agents to seamlessly forward content from MCP tool outputs without transformation. | ||
| * | ||
| * See protocol docs: [Content](https://agentclientprotocol.com/protocol/content) | ||
| */ | ||
| export type ContentBlock = | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| text: string; | ||
| type: "text"; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| data: string; | ||
| mimeType: string; | ||
| type: "image"; | ||
| uri?: string | null; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| data: string; | ||
| mimeType: string; | ||
| type: "audio"; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| description?: string | null; | ||
| mimeType?: string | null; | ||
| name: string; | ||
| size?: number | null; | ||
| title?: string | null; | ||
| type: "resource_link"; | ||
| uri: string; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| annotations?: Annotations | null; | ||
| resource: EmbeddedResourceResource; | ||
| type: "resource"; | ||
| }; | ||
| /** | ||
| * All possible responses that an agent can send to a client. | ||
| * | ||
| * This enum is used internally for routing RPC responses. You typically won't need | ||
| * to use this directly - the responses are handled automatically by the connection. | ||
| * | ||
| * These are responses to the corresponding `ClientRequest` variants. | ||
| */ | ||
| /** @internal */ | ||
| export type AgentResponse = | ||
| | InitializeResponse | ||
| | AuthenticateResponse | ||
| | NewSessionResponse | ||
| | LoadSessionResponse | ||
| | SetSessionModeResponse | ||
| | PromptResponse | ||
| | SetSessionModelResponse | ||
| | ExtMethodResponse1; | ||
| /** | ||
| * Unique identifier for a Session Mode. | ||
| */ | ||
| export type SessionModeId = string; | ||
| /** | ||
| * All possible notifications that an agent can send to a client. | ||
| * | ||
| * This enum is used internally for routing RPC notifications. You typically won't need | ||
| * to use this directly - use the notification methods on the [`Client`] trait instead. | ||
| * | ||
| * Notifications do not expect a response. | ||
| */ | ||
| /** @internal */ | ||
| export type AgentNotification = SessionNotification | ExtNotification1; | ||
| /** | ||
| * The input specification for a command. | ||
| */ | ||
| export type AvailableCommandInput = UnstructuredCommandInput; | ||
| /** | ||
| * Request to write content to a text file. | ||
| * | ||
| * Only available if the client supports the `fs.writeTextFile` capability. | ||
| */ | ||
| export interface WriteTextFileRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The text content to write to the file. | ||
| */ | ||
| content: string; | ||
| /** | ||
| * Absolute path to the file to write. | ||
| */ | ||
| path: string; | ||
| /** | ||
| * The session ID for this request. | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| /** | ||
| * Request to read content from a text file. | ||
| * | ||
| * Only available if the client supports the `fs.readTextFile` capability. | ||
| */ | ||
| export interface ReadTextFileRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Maximum number of lines to read. | ||
| */ | ||
| limit?: number | null; | ||
| /** | ||
| * Line number to start reading from (1-based). | ||
| */ | ||
| line?: number | null; | ||
| /** | ||
| * Absolute path to the file to read. | ||
| */ | ||
| path: string; | ||
| /** | ||
| * The session ID for this request. | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| /** | ||
| * Request for user permission to execute a tool call. | ||
| * | ||
| * Sent when the agent needs authorization before performing a sensitive operation. | ||
| * | ||
| * See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission) | ||
| */ | ||
| export interface RequestPermissionRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Available permission options for the user to choose from. | ||
| */ | ||
| options: PermissionOption[]; | ||
| /** | ||
| * The session ID for this request. | ||
| */ | ||
| sessionId: string; | ||
| toolCall: ToolCallUpdate; | ||
| } | ||
| /** | ||
| * An option presented to the user when requesting permission. | ||
| */ | ||
| export interface PermissionOption { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Hint about the nature of this permission option. | ||
| */ | ||
| kind: "allow_once" | "allow_always" | "reject_once" | "reject_always"; | ||
| /** | ||
| * Human-readable label to display to the user. | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Unique identifier for this permission option. | ||
| */ | ||
| optionId: string; | ||
| } | ||
| /** | ||
| * Details about the tool call requiring permission. | ||
| */ | ||
| export interface ToolCallUpdate { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Replace the content collection. | ||
| */ | ||
| content?: ToolCallContent[] | null; | ||
| /** | ||
| * Update the tool kind. | ||
| */ | ||
| kind?: ToolKind | null; | ||
| /** | ||
| * Replace the locations collection. | ||
| */ | ||
| locations?: ToolCallLocation[] | null; | ||
| /** | ||
| * Update the raw input. | ||
| */ | ||
| rawInput?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Update the raw output. | ||
| */ | ||
| rawOutput?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Update the execution status. | ||
| */ | ||
| status?: ToolCallStatus | null; | ||
| /** | ||
| * Update the human-readable title. | ||
| */ | ||
| title?: string | null; | ||
| /** | ||
| * The ID of the tool call being updated. | ||
| */ | ||
| toolCallId: string; | ||
| } | ||
| /** | ||
| * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed | ||
| */ | ||
| export interface Annotations { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| audience?: Role[] | null; | ||
| lastModified?: string | null; | ||
| priority?: number | null; | ||
| } | ||
| /** | ||
| * Text-based resource contents. | ||
| */ | ||
| export interface TextResourceContents { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| mimeType?: string | null; | ||
| text: string; | ||
| uri: string; | ||
| } | ||
| /** | ||
| * Binary resource contents. | ||
| */ | ||
| export interface BlobResourceContents { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| blob: string; | ||
| mimeType?: string | null; | ||
| uri: string; | ||
| } | ||
| /** | ||
| * A file location being accessed or modified by a tool. | ||
| * | ||
| * Enables clients to implement "follow-along" features that track | ||
| * which files the agent is working with in real-time. | ||
| * | ||
| * See protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/tool-calls#following-the-agent) | ||
| */ | ||
| export interface ToolCallLocation { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Optional line number within the file. | ||
| */ | ||
| line?: number | null; | ||
| /** | ||
| * The file path being accessed or modified. | ||
| */ | ||
| path: string; | ||
| } | ||
| /** | ||
| * Request to create a new terminal and execute a command. | ||
| */ | ||
| export interface CreateTerminalRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Array of command arguments. | ||
| */ | ||
| args?: string[]; | ||
| /** | ||
| * The command to execute. | ||
| */ | ||
| command: string; | ||
| /** | ||
| * Working directory for the command (absolute path). | ||
| */ | ||
| cwd?: string | null; | ||
| /** | ||
| * Environment variables for the command. | ||
| */ | ||
| env?: EnvVariable[]; | ||
| /** | ||
| * Maximum number of output bytes to retain. | ||
| * | ||
| * When the limit is exceeded, the Client truncates from the beginning of the output | ||
| * to stay within the limit. | ||
| * | ||
| * The Client MUST ensure truncation happens at a character boundary to maintain valid | ||
| * string output, even if this means the retained output is slightly less than the | ||
| * specified limit. | ||
| */ | ||
| outputByteLimit?: number | null; | ||
| /** | ||
| * The session ID for this request. | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| /** | ||
| * An environment variable to set when launching an MCP server. | ||
| */ | ||
| export interface EnvVariable { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The name of the environment variable. | ||
| */ | ||
| name: string; | ||
| /** | ||
| * The value to set for the environment variable. | ||
| */ | ||
| value: string; | ||
| } | ||
| /** | ||
| * Request to get the current output and status of a terminal. | ||
| */ | ||
| export interface TerminalOutputRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The session ID for this request. | ||
| */ | ||
| sessionId: string; | ||
| /** | ||
| * The ID of the terminal to get output from. | ||
| */ | ||
| terminalId: string; | ||
| } | ||
| /** | ||
| * Request to release a terminal and free its resources. | ||
| */ | ||
| export interface ReleaseTerminalRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The session ID for this request. | ||
| */ | ||
| sessionId: string; | ||
| /** | ||
| * The ID of the terminal to release. | ||
| */ | ||
| terminalId: string; | ||
| } | ||
| /** | ||
| * Request to wait for a terminal command to exit. | ||
| */ | ||
| export interface WaitForTerminalExitRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The session ID for this request. | ||
| */ | ||
| sessionId: string; | ||
| /** | ||
| * The ID of the terminal to wait for. | ||
| */ | ||
| terminalId: string; | ||
| } | ||
| /** | ||
| * Request to kill a terminal command without releasing the terminal. | ||
| */ | ||
| export interface KillTerminalCommandRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The session ID for this request. | ||
| */ | ||
| sessionId: string; | ||
| /** | ||
| * The ID of the terminal to kill. | ||
| */ | ||
| terminalId: string; | ||
| } | ||
| export interface ExtMethodRequest { | ||
| [k: string]: unknown; | ||
| } | ||
| /** | ||
| * Response to `fs/write_text_file` | ||
| */ | ||
| export interface WriteTextFileResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| } | ||
| /** | ||
| * Response containing the contents of a text file. | ||
| */ | ||
| export interface ReadTextFileResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| content: string; | ||
| } | ||
| /** | ||
| * Response to a permission request. | ||
| */ | ||
| export interface RequestPermissionResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The user's decision on the permission request. | ||
| */ | ||
| outcome: | ||
| | { | ||
| outcome: "cancelled"; | ||
| } | ||
| | { | ||
| /** | ||
| * The ID of the option the user selected. | ||
| */ | ||
| optionId: string; | ||
| outcome: "selected"; | ||
| }; | ||
| } | ||
| /** | ||
| * Response containing the ID of the created terminal. | ||
| */ | ||
| export interface CreateTerminalResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The unique identifier for the created terminal. | ||
| */ | ||
| terminalId: string; | ||
| } | ||
| /** | ||
| * Response containing the terminal output and exit status. | ||
| */ | ||
| export interface TerminalOutputResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Exit status if the command has completed. | ||
| */ | ||
| exitStatus?: TerminalExitStatus | null; | ||
| /** | ||
| * The terminal output captured so far. | ||
| */ | ||
| output: string; | ||
| /** | ||
| * Whether the output was truncated due to byte limits. | ||
| */ | ||
| truncated: boolean; | ||
| } | ||
| /** | ||
| * Exit status of a terminal command. | ||
| */ | ||
| export interface TerminalExitStatus { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The process exit code (may be null if terminated by signal). | ||
| */ | ||
| exitCode?: number | null; | ||
| /** | ||
| * The signal that terminated the process (may be null if exited normally). | ||
| */ | ||
| signal?: string | null; | ||
| } | ||
| /** | ||
| * Response to terminal/release method | ||
| */ | ||
| export interface ReleaseTerminalResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| } | ||
| /** | ||
| * Response containing the exit status of a terminal command. | ||
| */ | ||
| export interface WaitForTerminalExitResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The process exit code (may be null if terminated by signal). | ||
| */ | ||
| exitCode?: number | null; | ||
| /** | ||
| * The signal that terminated the process (may be null if exited normally). | ||
| */ | ||
| signal?: string | null; | ||
| } | ||
| /** | ||
| * Response to terminal/kill command method | ||
| */ | ||
| export interface KillTerminalResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| } | ||
| export interface ExtMethodResponse { | ||
| [k: string]: unknown; | ||
| } | ||
| /** | ||
| * Notification to cancel ongoing operations for a session. | ||
| * | ||
| * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation) | ||
| */ | ||
| export interface CancelNotification { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The ID of the session to cancel operations for. | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| export interface ExtNotification { | ||
| [k: string]: unknown; | ||
| } | ||
| /** | ||
| * Request parameters for the initialize method. | ||
| * | ||
| * Sent by the client to establish connection and negotiate capabilities. | ||
| * | ||
| * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) | ||
| */ | ||
| export interface InitializeRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| clientCapabilities?: ClientCapabilities; | ||
| /** | ||
| * The latest protocol version supported by the client. | ||
| */ | ||
| protocolVersion: number; | ||
| } | ||
| /** | ||
| * Capabilities supported by the client. | ||
| */ | ||
| export interface ClientCapabilities { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| fs?: FileSystemCapability; | ||
| /** | ||
| * Whether the Client support all `terminal/*` methods. | ||
| */ | ||
| terminal?: boolean; | ||
| } | ||
| /** | ||
| * File system capabilities supported by the client. | ||
| * Determines which file operations the agent can request. | ||
| */ | ||
| export interface FileSystemCapability { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Whether the Client supports `fs/read_text_file` requests. | ||
| */ | ||
| readTextFile?: boolean; | ||
| /** | ||
| * Whether the Client supports `fs/write_text_file` requests. | ||
| */ | ||
| writeTextFile?: boolean; | ||
| } | ||
| /** | ||
| * Request parameters for the authenticate method. | ||
| * | ||
| * Specifies which authentication method to use. | ||
| */ | ||
| export interface AuthenticateRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The ID of the authentication method to use. | ||
| * Must be one of the methods advertised in the initialize response. | ||
| */ | ||
| methodId: string; | ||
| } | ||
| /** | ||
| * Request parameters for creating a new session. | ||
| * | ||
| * See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session) | ||
| */ | ||
| export interface NewSessionRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The working directory for this session. Must be an absolute path. | ||
| */ | ||
| cwd: string; | ||
| /** | ||
| * List of MCP (Model Context Protocol) servers the agent should connect to. | ||
| */ | ||
| mcpServers: McpServer[]; | ||
| } | ||
| /** | ||
| * An HTTP header to set when making requests to the MCP server. | ||
| */ | ||
| export interface HttpHeader { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The name of the HTTP header. | ||
| */ | ||
| name: string; | ||
| /** | ||
| * The value to set for the HTTP header. | ||
| */ | ||
| value: string; | ||
| } | ||
| /** | ||
| * Stdio transport configuration | ||
| * | ||
| * All Agents MUST support this transport. | ||
| */ | ||
| export interface Stdio { | ||
| /** | ||
| * Command-line arguments to pass to the MCP server. | ||
| */ | ||
| args: string[]; | ||
| /** | ||
| * Path to the MCP server executable. | ||
| */ | ||
| command: string; | ||
| /** | ||
| * Environment variables to set when launching the MCP server. | ||
| */ | ||
| env: EnvVariable[]; | ||
| /** | ||
| * Human-readable name identifying this MCP server. | ||
| */ | ||
| name: string; | ||
| } | ||
| /** | ||
| * Request parameters for loading an existing session. | ||
| * | ||
| * Only available if the Agent supports the `loadSession` capability. | ||
| * | ||
| * See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions) | ||
| */ | ||
| export interface LoadSessionRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The working directory for this session. | ||
| */ | ||
| cwd: string; | ||
| /** | ||
| * List of MCP servers to connect to for this session. | ||
| */ | ||
| mcpServers: McpServer[]; | ||
| /** | ||
| * The ID of the session to load. | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| /** | ||
| * Request parameters for setting a session mode. | ||
| */ | ||
| export interface SetSessionModeRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Unique identifier for a Session Mode. | ||
| */ | ||
| modeId: string; | ||
| /** | ||
| * The ID of the session to set the mode for. | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| /** | ||
| * Request parameters for sending a user prompt to the agent. | ||
| * | ||
| * Contains the user's message and any additional context. | ||
| * | ||
| * See protocol docs: [User Message](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message) | ||
| */ | ||
| export interface PromptRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The blocks of content that compose the user's message. | ||
| * | ||
| * As a baseline, the Agent MUST support [`ContentBlock::Text`] and [`ContentBlock::ResourceLink`], | ||
| * while other variants are optionally enabled via [`PromptCapabilities`]. | ||
| * | ||
| * The Client MUST adapt its interface according to [`PromptCapabilities`]. | ||
| * | ||
| * The client MAY include referenced pieces of context as either | ||
| * [`ContentBlock::Resource`] or [`ContentBlock::ResourceLink`]. | ||
| * | ||
| * When available, [`ContentBlock::Resource`] is preferred | ||
| * as it avoids extra round-trips and allows the message to include | ||
| * pieces of context from sources the agent may not have access to. | ||
| */ | ||
| prompt: ContentBlock[]; | ||
| /** | ||
| * The ID of the session to send this user message to | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| /** | ||
| * **UNSTABLE** | ||
| * | ||
| * This capability is not part of the spec yet, and may be removed or changed at any point. | ||
| * | ||
| * Request parameters for setting a session model. | ||
| */ | ||
| export interface SetSessionModelRequest { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The ID of the model to set. | ||
| */ | ||
| modelId: string; | ||
| /** | ||
| * The ID of the session to set the model for. | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| export interface ExtMethodRequest1 { | ||
| [k: string]: unknown; | ||
| } | ||
| /** | ||
| * Response from the initialize method. | ||
| * | ||
| * Contains the negotiated protocol version and agent capabilities. | ||
| * | ||
| * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) | ||
| */ | ||
| export interface InitializeResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| agentCapabilities?: AgentCapabilities; | ||
| /** | ||
| * Authentication methods supported by the agent. | ||
| */ | ||
| authMethods?: AuthMethod[]; | ||
| /** | ||
| * The protocol version the client specified if supported by the agent, | ||
| * or the latest protocol version supported by the agent. | ||
| * | ||
| * The client should disconnect, if it doesn't support this version. | ||
| */ | ||
| protocolVersion: number; | ||
| } | ||
| /** | ||
| * Capabilities supported by the agent. | ||
| */ | ||
| export interface AgentCapabilities { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Whether the agent supports `session/load`. | ||
| */ | ||
| loadSession?: boolean; | ||
| mcpCapabilities?: McpCapabilities; | ||
| promptCapabilities?: PromptCapabilities; | ||
| } | ||
| /** | ||
| * MCP capabilities supported by the agent. | ||
| */ | ||
| export interface McpCapabilities { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Agent supports [`McpServer::Http`]. | ||
| */ | ||
| http?: boolean; | ||
| /** | ||
| * Agent supports [`McpServer::Sse`]. | ||
| */ | ||
| sse?: boolean; | ||
| } | ||
| /** | ||
| * Prompt capabilities supported by the agent. | ||
| */ | ||
| export interface PromptCapabilities { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Agent supports [`ContentBlock::Audio`]. | ||
| */ | ||
| audio?: boolean; | ||
| /** | ||
| * Agent supports embedded context in `session/prompt` requests. | ||
| * | ||
| * When enabled, the Client is allowed to include [`ContentBlock::Resource`] | ||
| * in prompt requests for pieces of context that are referenced in the message. | ||
| */ | ||
| embeddedContext?: boolean; | ||
| /** | ||
| * Agent supports [`ContentBlock::Image`]. | ||
| */ | ||
| image?: boolean; | ||
| } | ||
| /** | ||
| * Describes an available authentication method. | ||
| */ | ||
| export interface AuthMethod { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Optional description providing more details about this authentication method. | ||
| */ | ||
| description?: string | null; | ||
| /** | ||
| * Unique identifier for this authentication method. | ||
| */ | ||
| id: string; | ||
| /** | ||
| * Human-readable name of the authentication method. | ||
| */ | ||
| name: string; | ||
| } | ||
| /** | ||
| * Response to authenticate method | ||
| */ | ||
| export interface AuthenticateResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| } | ||
| /** | ||
| * Response from creating a new session. | ||
| * | ||
| * See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session) | ||
| */ | ||
| export interface NewSessionResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * **UNSTABLE** | ||
| * | ||
| * This capability is not part of the spec yet, and may be removed or changed at any point. | ||
| * | ||
| * Initial model state if supported by the Agent | ||
| */ | ||
| models?: SessionModelState | null; | ||
| /** | ||
| * Initial mode state if supported by the Agent | ||
| * | ||
| * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) | ||
| */ | ||
| modes?: SessionModeState | null; | ||
| /** | ||
| * Unique identifier for the created session. | ||
| * | ||
| * Used in all subsequent requests for this conversation. | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| /** | ||
| * **UNSTABLE** | ||
| * | ||
| * This capability is not part of the spec yet, and may be removed or changed at any point. | ||
| * | ||
| * The set of models and the one currently active. | ||
| */ | ||
| export interface SessionModelState { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The set of models that the Agent can use | ||
| */ | ||
| availableModels: ModelInfo[]; | ||
| /** | ||
| * The current model the Agent is in. | ||
| */ | ||
| currentModelId: string; | ||
| } | ||
| /** | ||
| * **UNSTABLE** | ||
| * | ||
| * This capability is not part of the spec yet, and may be removed or changed at any point. | ||
| * | ||
| * Information about a selectable model. | ||
| */ | ||
| export interface ModelInfo { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Optional description of the model. | ||
| */ | ||
| description?: string | null; | ||
| /** | ||
| * Unique identifier for the model. | ||
| */ | ||
| modelId: string; | ||
| /** | ||
| * Human-readable name of the model. | ||
| */ | ||
| name: string; | ||
| } | ||
| /** | ||
| * The set of modes and the one currently active. | ||
| */ | ||
| export interface SessionModeState { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The set of modes that the Agent can operate in | ||
| */ | ||
| availableModes: SessionMode[]; | ||
| /** | ||
| * Unique identifier for a Session Mode. | ||
| */ | ||
| currentModeId: string; | ||
| } | ||
| /** | ||
| * A mode the agent can operate in. | ||
| * | ||
| * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) | ||
| */ | ||
| export interface SessionMode { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| description?: string | null; | ||
| id: SessionModeId; | ||
| name: string; | ||
| } | ||
| /** | ||
| * Response from loading an existing session. | ||
| */ | ||
| export interface LoadSessionResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * **UNSTABLE** | ||
| * | ||
| * This capability is not part of the spec yet, and may be removed or changed at any point. | ||
| * | ||
| * Initial model state if supported by the Agent | ||
| */ | ||
| models?: SessionModelState | null; | ||
| /** | ||
| * Initial mode state if supported by the Agent | ||
| * | ||
| * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) | ||
| */ | ||
| modes?: SessionModeState | null; | ||
| } | ||
| /** | ||
| * Response to `session/set_mode` method. | ||
| */ | ||
| export interface SetSessionModeResponse { | ||
| meta?: unknown; | ||
| } | ||
| /** | ||
| * Response from processing a user prompt. | ||
| * | ||
| * See protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/prompt-turn#4-check-for-completion) | ||
| */ | ||
| export interface PromptResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Indicates why the agent stopped processing the turn. | ||
| */ | ||
| stopReason: | ||
| | "end_turn" | ||
| | "max_tokens" | ||
| | "max_turn_requests" | ||
| | "refusal" | ||
| | "cancelled"; | ||
| } | ||
| /** | ||
| * **UNSTABLE** | ||
| * | ||
| * This capability is not part of the spec yet, and may be removed or changed at any point. | ||
| * | ||
| * Response to `session/set_model` method. | ||
| */ | ||
| export interface SetSessionModelResponse { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| } | ||
| export interface ExtMethodResponse1 { | ||
| [k: string]: unknown; | ||
| } | ||
| /** | ||
| * Notification containing a session update from the agent. | ||
| * | ||
| * Used to stream real-time progress and results during prompt processing. | ||
| * | ||
| * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output) | ||
| */ | ||
| export interface SessionNotification { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The ID of the session this update pertains to. | ||
| */ | ||
| sessionId: string; | ||
| /** | ||
| * The actual update content. | ||
| */ | ||
| update: | ||
| | { | ||
| content: ContentBlock; | ||
| sessionUpdate: "user_message_chunk"; | ||
| } | ||
| | { | ||
| content: ContentBlock; | ||
| sessionUpdate: "agent_message_chunk"; | ||
| } | ||
| | { | ||
| content: ContentBlock; | ||
| sessionUpdate: "agent_thought_chunk"; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Content produced by the tool call. | ||
| */ | ||
| content?: ToolCallContent[]; | ||
| /** | ||
| * The category of tool being invoked. | ||
| * Helps clients choose appropriate icons and UI treatment. | ||
| */ | ||
| kind?: | ||
| | "read" | ||
| | "edit" | ||
| | "delete" | ||
| | "move" | ||
| | "search" | ||
| | "execute" | ||
| | "think" | ||
| | "fetch" | ||
| | "switch_mode" | ||
| | "other"; | ||
| /** | ||
| * File locations affected by this tool call. | ||
| * Enables "follow-along" features in clients. | ||
| */ | ||
| locations?: ToolCallLocation[]; | ||
| /** | ||
| * Raw input parameters sent to the tool. | ||
| */ | ||
| rawInput?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Raw output returned by the tool. | ||
| */ | ||
| rawOutput?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| sessionUpdate: "tool_call"; | ||
| /** | ||
| * Current execution status of the tool call. | ||
| */ | ||
| status?: "pending" | "in_progress" | "completed" | "failed"; | ||
| /** | ||
| * Human-readable title describing what the tool is doing. | ||
| */ | ||
| title: string; | ||
| /** | ||
| * Unique identifier for this tool call within the session. | ||
| */ | ||
| toolCallId: string; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Replace the content collection. | ||
| */ | ||
| content?: ToolCallContent[] | null; | ||
| /** | ||
| * Update the tool kind. | ||
| */ | ||
| kind?: ToolKind | null; | ||
| /** | ||
| * Replace the locations collection. | ||
| */ | ||
| locations?: ToolCallLocation[] | null; | ||
| /** | ||
| * Update the raw input. | ||
| */ | ||
| rawInput?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Update the raw output. | ||
| */ | ||
| rawOutput?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| sessionUpdate: "tool_call_update"; | ||
| /** | ||
| * Update the execution status. | ||
| */ | ||
| status?: ToolCallStatus | null; | ||
| /** | ||
| * Update the human-readable title. | ||
| */ | ||
| title?: string | null; | ||
| /** | ||
| * The ID of the tool call being updated. | ||
| */ | ||
| toolCallId: string; | ||
| } | ||
| | { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * The list of tasks to be accomplished. | ||
| * | ||
| * When updating a plan, the agent must send a complete list of all entries | ||
| * with their current status. The client replaces the entire plan with each update. | ||
| */ | ||
| entries: PlanEntry[]; | ||
| sessionUpdate: "plan"; | ||
| } | ||
| | { | ||
| availableCommands: AvailableCommand[]; | ||
| sessionUpdate: "available_commands_update"; | ||
| } | ||
| | { | ||
| currentModeId: SessionModeId; | ||
| sessionUpdate: "current_mode_update"; | ||
| }; | ||
| } | ||
| /** | ||
| * A single entry in the execution plan. | ||
| * | ||
| * Represents a task or goal that the assistant intends to accomplish | ||
| * as part of fulfilling the user's request. | ||
| * See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries) | ||
| */ | ||
| export interface PlanEntry { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Human-readable description of what this task aims to accomplish. | ||
| */ | ||
| content: string; | ||
| /** | ||
| * The relative importance of this task. | ||
| * Used to indicate which tasks are most critical to the overall goal. | ||
| */ | ||
| priority: "high" | "medium" | "low"; | ||
| /** | ||
| * Current execution status of this task. | ||
| */ | ||
| status: "pending" | "in_progress" | "completed"; | ||
| } | ||
| /** | ||
| * Information about a command. | ||
| */ | ||
| export interface AvailableCommand { | ||
| /** | ||
| * Extension point for implementations | ||
| */ | ||
| _meta?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| /** | ||
| * Human-readable description of what the command does. | ||
| */ | ||
| description: string; | ||
| /** | ||
| * Input for the command if required | ||
| */ | ||
| input?: AvailableCommandInput | null; | ||
| /** | ||
| * Command name (e.g., `create_plan`, `research_codebase`). | ||
| */ | ||
| name: string; | ||
| } | ||
| /** | ||
| * All text that was typed after the command name is provided as input. | ||
| */ | ||
| export interface UnstructuredCommandInput { | ||
| /** | ||
| * A hint to display when the input hasn't been provided yet | ||
| */ | ||
| hint: string; | ||
| } | ||
| export interface ExtNotification1 { | ||
| [k: string]: unknown; | ||
| } | ||
| /** @internal */ | ||
| export const writeTextFileRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| content: z.string(), | ||
| path: z.string(), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const readTextFileRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| limit: z.number().optional().nullable(), | ||
| line: z.number().optional().nullable(), | ||
| path: z.string(), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const terminalOutputRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| sessionId: z.string(), | ||
| terminalId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const releaseTerminalRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| sessionId: z.string(), | ||
| terminalId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const waitForTerminalExitRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| sessionId: z.string(), | ||
| terminalId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const killTerminalCommandRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| sessionId: z.string(), | ||
| terminalId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const extMethodRequestSchema = z.record(z.unknown()); | ||
| /** @internal */ | ||
| export const roleSchema = z.union([z.literal("assistant"), z.literal("user")]); | ||
| /** @internal */ | ||
| export const textResourceContentsSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| mimeType: z.string().optional().nullable(), | ||
| text: z.string(), | ||
| uri: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const blobResourceContentsSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| blob: z.string(), | ||
| mimeType: z.string().optional().nullable(), | ||
| uri: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const toolKindSchema = z.union([ | ||
| z.literal("read"), | ||
| z.literal("edit"), | ||
| z.literal("delete"), | ||
| z.literal("move"), | ||
| z.literal("search"), | ||
| z.literal("execute"), | ||
| z.literal("think"), | ||
| z.literal("fetch"), | ||
| z.literal("switch_mode"), | ||
| z.literal("other"), | ||
| ]); | ||
| /** @internal */ | ||
| export const toolCallStatusSchema = z.union([ | ||
| z.literal("pending"), | ||
| z.literal("in_progress"), | ||
| z.literal("completed"), | ||
| z.literal("failed"), | ||
| ]); | ||
| /** @internal */ | ||
| export const writeTextFileResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const readTextFileResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| content: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const requestPermissionResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| outcome: z.union([ | ||
| z.object({ | ||
| outcome: z.literal("cancelled"), | ||
| }), | ||
| z.object({ | ||
| optionId: z.string(), | ||
| outcome: z.literal("selected"), | ||
| }), | ||
| ]), | ||
| }); | ||
| /** @internal */ | ||
| export const createTerminalResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| terminalId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const releaseTerminalResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const waitForTerminalExitResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| exitCode: z.number().optional().nullable(), | ||
| signal: z.string().optional().nullable(), | ||
| }); | ||
| /** @internal */ | ||
| export const killTerminalResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const extMethodResponseSchema = z.record(z.unknown()); | ||
| /** @internal */ | ||
| export const cancelNotificationSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const extNotificationSchema = z.record(z.unknown()); | ||
| /** @internal */ | ||
| export const authenticateRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| methodId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const setSessionModeRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| modeId: z.string(), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const setSessionModelRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| modelId: z.string(), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const extMethodRequest1Schema = z.record(z.unknown()); | ||
| /** @internal */ | ||
| export const httpHeaderSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| name: z.string(), | ||
| value: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const annotationsSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| audience: z.array(roleSchema).optional().nullable(), | ||
| lastModified: z.string().optional().nullable(), | ||
| priority: z.number().optional().nullable(), | ||
| }); | ||
| /** @internal */ | ||
| export const embeddedResourceResourceSchema = z.union([ | ||
| textResourceContentsSchema, | ||
| blobResourceContentsSchema, | ||
| ]); | ||
| /** @internal */ | ||
| export const authenticateResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const setSessionModeResponseSchema = z.object({ | ||
| meta: z.unknown().optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const promptResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| stopReason: z.union([ | ||
| z.literal("end_turn"), | ||
| z.literal("max_tokens"), | ||
| z.literal("max_turn_requests"), | ||
| z.literal("refusal"), | ||
| z.literal("cancelled"), | ||
| ]), | ||
| }); | ||
| /** @internal */ | ||
| export const setSessionModelResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const extMethodResponse1Schema = z.record(z.unknown()); | ||
| /** @internal */ | ||
| export const sessionModeIdSchema = z.string(); | ||
| /** @internal */ | ||
| export const extNotification1Schema = z.record(z.unknown()); | ||
| /** @internal */ | ||
| export const unstructuredCommandInputSchema = z.object({ | ||
| hint: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const permissionOptionSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| kind: z.union([ | ||
| z.literal("allow_once"), | ||
| z.literal("allow_always"), | ||
| z.literal("reject_once"), | ||
| z.literal("reject_always"), | ||
| ]), | ||
| name: z.string(), | ||
| optionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const toolCallContentSchema = z.union([ | ||
| z.object({ | ||
| content: z.union([ | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| text: z.string(), | ||
| type: z.literal("text"), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| data: z.string(), | ||
| mimeType: z.string(), | ||
| type: z.literal("image"), | ||
| uri: z.string().optional().nullable(), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| data: z.string(), | ||
| mimeType: z.string(), | ||
| type: z.literal("audio"), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| description: z.string().optional().nullable(), | ||
| mimeType: z.string().optional().nullable(), | ||
| name: z.string(), | ||
| size: z.number().optional().nullable(), | ||
| title: z.string().optional().nullable(), | ||
| type: z.literal("resource_link"), | ||
| uri: z.string(), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| resource: embeddedResourceResourceSchema, | ||
| type: z.literal("resource"), | ||
| }), | ||
| ]), | ||
| type: z.literal("content"), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| newText: z.string(), | ||
| oldText: z.string().optional().nullable(), | ||
| path: z.string(), | ||
| type: z.literal("diff"), | ||
| }), | ||
| z.object({ | ||
| terminalId: z.string(), | ||
| type: z.literal("terminal"), | ||
| }), | ||
| ]); | ||
| /** @internal */ | ||
| export const toolCallLocationSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| line: z.number().optional().nullable(), | ||
| path: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const envVariableSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| name: z.string(), | ||
| value: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const terminalExitStatusSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| exitCode: z.number().optional().nullable(), | ||
| signal: z.string().optional().nullable(), | ||
| }); | ||
| /** @internal */ | ||
| export const fileSystemCapabilitySchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| readTextFile: z.boolean().optional(), | ||
| writeTextFile: z.boolean().optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const stdioSchema = z.object({ | ||
| args: z.array(z.string()), | ||
| command: z.string(), | ||
| env: z.array(envVariableSchema), | ||
| name: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const mcpServerSchema = z.union([ | ||
| z.object({ | ||
| headers: z.array(httpHeaderSchema), | ||
| name: z.string(), | ||
| type: z.literal("http"), | ||
| url: z.string(), | ||
| }), | ||
| z.object({ | ||
| headers: z.array(httpHeaderSchema), | ||
| name: z.string(), | ||
| type: z.literal("sse"), | ||
| url: z.string(), | ||
| }), | ||
| stdioSchema, | ||
| ]); | ||
| /** @internal */ | ||
| export const contentBlockSchema = z.union([ | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| text: z.string(), | ||
| type: z.literal("text"), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| data: z.string(), | ||
| mimeType: z.string(), | ||
| type: z.literal("image"), | ||
| uri: z.string().optional().nullable(), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| data: z.string(), | ||
| mimeType: z.string(), | ||
| type: z.literal("audio"), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| description: z.string().optional().nullable(), | ||
| mimeType: z.string().optional().nullable(), | ||
| name: z.string(), | ||
| size: z.number().optional().nullable(), | ||
| title: z.string().optional().nullable(), | ||
| type: z.literal("resource_link"), | ||
| uri: z.string(), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| annotations: annotationsSchema.optional().nullable(), | ||
| resource: embeddedResourceResourceSchema, | ||
| type: z.literal("resource"), | ||
| }), | ||
| ]); | ||
| /** @internal */ | ||
| export const authMethodSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| description: z.string().optional().nullable(), | ||
| id: z.string(), | ||
| name: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const mcpCapabilitiesSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| http: z.boolean().optional(), | ||
| sse: z.boolean().optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const promptCapabilitiesSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| audio: z.boolean().optional(), | ||
| embeddedContext: z.boolean().optional(), | ||
| image: z.boolean().optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const modelInfoSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| description: z.string().optional().nullable(), | ||
| modelId: z.string(), | ||
| name: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const sessionModeSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| description: z.string().optional().nullable(), | ||
| id: sessionModeIdSchema, | ||
| name: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const sessionModelStateSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| availableModels: z.array(modelInfoSchema), | ||
| currentModelId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const sessionModeStateSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| availableModes: z.array(sessionModeSchema), | ||
| currentModeId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const planEntrySchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| content: z.string(), | ||
| priority: z.union([z.literal("high"), z.literal("medium"), z.literal("low")]), | ||
| status: z.union([ | ||
| z.literal("pending"), | ||
| z.literal("in_progress"), | ||
| z.literal("completed"), | ||
| ]), | ||
| }); | ||
| /** @internal */ | ||
| export const availableCommandInputSchema = unstructuredCommandInputSchema; | ||
| /** @internal */ | ||
| export const clientNotificationSchema = z.union([ | ||
| cancelNotificationSchema, | ||
| extNotificationSchema, | ||
| ]); | ||
| /** @internal */ | ||
| export const createTerminalRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| args: z.array(z.string()).optional(), | ||
| command: z.string(), | ||
| cwd: z.string().optional().nullable(), | ||
| env: z.array(envVariableSchema).optional(), | ||
| outputByteLimit: z.number().optional().nullable(), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const terminalOutputResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| exitStatus: terminalExitStatusSchema.optional().nullable(), | ||
| output: z.string(), | ||
| truncated: z.boolean(), | ||
| }); | ||
| /** @internal */ | ||
| export const newSessionRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| cwd: z.string(), | ||
| mcpServers: z.array(mcpServerSchema), | ||
| }); | ||
| /** @internal */ | ||
| export const loadSessionRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| cwd: z.string(), | ||
| mcpServers: z.array(mcpServerSchema), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const promptRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| prompt: z.array(contentBlockSchema), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const newSessionResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| models: sessionModelStateSchema.optional().nullable(), | ||
| modes: sessionModeStateSchema.optional().nullable(), | ||
| sessionId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const loadSessionResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| models: sessionModelStateSchema.optional().nullable(), | ||
| modes: sessionModeStateSchema.optional().nullable(), | ||
| }); | ||
| /** @internal */ | ||
| export const toolCallUpdateSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| content: z.array(toolCallContentSchema).optional().nullable(), | ||
| kind: toolKindSchema.optional().nullable(), | ||
| locations: z.array(toolCallLocationSchema).optional().nullable(), | ||
| rawInput: z.record(z.unknown()).optional(), | ||
| rawOutput: z.record(z.unknown()).optional(), | ||
| status: toolCallStatusSchema.optional().nullable(), | ||
| title: z.string().optional().nullable(), | ||
| toolCallId: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const clientCapabilitiesSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| fs: fileSystemCapabilitySchema.optional(), | ||
| terminal: z.boolean().optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const agentCapabilitiesSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| loadSession: z.boolean().optional(), | ||
| mcpCapabilities: mcpCapabilitiesSchema.optional(), | ||
| promptCapabilities: promptCapabilitiesSchema.optional(), | ||
| }); | ||
| /** @internal */ | ||
| export const availableCommandSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| description: z.string(), | ||
| input: availableCommandInputSchema.optional().nullable(), | ||
| name: z.string(), | ||
| }); | ||
| /** @internal */ | ||
| export const clientResponseSchema = z.union([ | ||
| writeTextFileResponseSchema, | ||
| readTextFileResponseSchema, | ||
| requestPermissionResponseSchema, | ||
| createTerminalResponseSchema, | ||
| terminalOutputResponseSchema, | ||
| releaseTerminalResponseSchema, | ||
| waitForTerminalExitResponseSchema, | ||
| killTerminalResponseSchema, | ||
| extMethodResponseSchema, | ||
| ]); | ||
| /** @internal */ | ||
| export const requestPermissionRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| options: z.array(permissionOptionSchema), | ||
| sessionId: z.string(), | ||
| toolCall: toolCallUpdateSchema, | ||
| }); | ||
| /** @internal */ | ||
| export const initializeRequestSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| clientCapabilities: clientCapabilitiesSchema.optional(), | ||
| protocolVersion: z.number(), | ||
| }); | ||
| /** @internal */ | ||
| export const initializeResponseSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| agentCapabilities: agentCapabilitiesSchema.optional(), | ||
| authMethods: z.array(authMethodSchema).optional(), | ||
| protocolVersion: z.number(), | ||
| }); | ||
| /** @internal */ | ||
| export const sessionNotificationSchema = z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| sessionId: z.string(), | ||
| update: z.union([ | ||
| z.object({ | ||
| content: contentBlockSchema, | ||
| sessionUpdate: z.literal("user_message_chunk"), | ||
| }), | ||
| z.object({ | ||
| content: contentBlockSchema, | ||
| sessionUpdate: z.literal("agent_message_chunk"), | ||
| }), | ||
| z.object({ | ||
| content: contentBlockSchema, | ||
| sessionUpdate: z.literal("agent_thought_chunk"), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| content: z.array(toolCallContentSchema).optional(), | ||
| kind: z | ||
| .union([ | ||
| z.literal("read"), | ||
| z.literal("edit"), | ||
| z.literal("delete"), | ||
| z.literal("move"), | ||
| z.literal("search"), | ||
| z.literal("execute"), | ||
| z.literal("think"), | ||
| z.literal("fetch"), | ||
| z.literal("switch_mode"), | ||
| z.literal("other"), | ||
| ]) | ||
| .optional(), | ||
| locations: z.array(toolCallLocationSchema).optional(), | ||
| rawInput: z.record(z.unknown()).optional(), | ||
| rawOutput: z.record(z.unknown()).optional(), | ||
| sessionUpdate: z.literal("tool_call"), | ||
| status: z | ||
| .union([ | ||
| z.literal("pending"), | ||
| z.literal("in_progress"), | ||
| z.literal("completed"), | ||
| z.literal("failed"), | ||
| ]) | ||
| .optional(), | ||
| title: z.string(), | ||
| toolCallId: z.string(), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| content: z.array(toolCallContentSchema).optional().nullable(), | ||
| kind: toolKindSchema.optional().nullable(), | ||
| locations: z.array(toolCallLocationSchema).optional().nullable(), | ||
| rawInput: z.record(z.unknown()).optional(), | ||
| rawOutput: z.record(z.unknown()).optional(), | ||
| sessionUpdate: z.literal("tool_call_update"), | ||
| status: toolCallStatusSchema.optional().nullable(), | ||
| title: z.string().optional().nullable(), | ||
| toolCallId: z.string(), | ||
| }), | ||
| z.object({ | ||
| _meta: z.record(z.unknown()).optional(), | ||
| entries: z.array(planEntrySchema), | ||
| sessionUpdate: z.literal("plan"), | ||
| }), | ||
| z.object({ | ||
| availableCommands: z.array(availableCommandSchema), | ||
| sessionUpdate: z.literal("available_commands_update"), | ||
| }), | ||
| z.object({ | ||
| currentModeId: sessionModeIdSchema, | ||
| sessionUpdate: z.literal("current_mode_update"), | ||
| }), | ||
| ]), | ||
| }); | ||
| /** @internal */ | ||
| export const clientRequestSchema = z.union([ | ||
| writeTextFileRequestSchema, | ||
| readTextFileRequestSchema, | ||
| requestPermissionRequestSchema, | ||
| createTerminalRequestSchema, | ||
| terminalOutputRequestSchema, | ||
| releaseTerminalRequestSchema, | ||
| waitForTerminalExitRequestSchema, | ||
| killTerminalCommandRequestSchema, | ||
| extMethodRequestSchema, | ||
| ]); | ||
| /** @internal */ | ||
| export const agentRequestSchema = z.union([ | ||
| initializeRequestSchema, | ||
| authenticateRequestSchema, | ||
| newSessionRequestSchema, | ||
| loadSessionRequestSchema, | ||
| setSessionModeRequestSchema, | ||
| promptRequestSchema, | ||
| setSessionModelRequestSchema, | ||
| extMethodRequest1Schema, | ||
| ]); | ||
| /** @internal */ | ||
| export const agentResponseSchema = z.union([ | ||
| initializeResponseSchema, | ||
| authenticateResponseSchema, | ||
| newSessionResponseSchema, | ||
| loadSessionResponseSchema, | ||
| setSessionModeResponseSchema, | ||
| promptResponseSchema, | ||
| setSessionModelResponseSchema, | ||
| extMethodResponse1Schema, | ||
| ]); | ||
| /** @internal */ | ||
| export const agentNotificationSchema = z.union([ | ||
| sessionNotificationSchema, | ||
| extNotification1Schema, | ||
| ]); | ||
| /** @internal */ | ||
| export const agentClientProtocolSchema = z.union([ | ||
| clientRequestSchema, | ||
| clientResponseSchema, | ||
| clientNotificationSchema, | ||
| agentRequestSchema, | ||
| agentResponseSchema, | ||
| agentNotificationSchema, | ||
| ]); |
| import type { AnyMessage } from "./jsonrpc.js"; | ||
| /** | ||
| * Stream interface for ACP connections. | ||
| * | ||
| * This type powers the bidirectional communication for an ACP connection, | ||
| * providing readable and writable streams of messages. | ||
| * | ||
| * The most common way to create a Stream is using {@link ndJsonStream}. | ||
| */ | ||
| export type Stream = { | ||
| writable: WritableStream<AnyMessage>; | ||
| readable: ReadableStream<AnyMessage>; | ||
| }; | ||
| /** | ||
| * Creates an ACP Stream from a pair of newline-delimited JSON streams. | ||
| * | ||
| * This is the typical way to handle ACP connections over stdio, converting | ||
| * between AnyMessage objects and newline-delimited JSON. | ||
| * | ||
| * @param output - The writable stream to send encoded messages to | ||
| * @param input - The readable stream to receive encoded messages from | ||
| * @returns A Stream for bidirectional ACP communication | ||
| */ | ||
| export function ndJsonStream( | ||
| output: WritableStream<Uint8Array>, | ||
| input: ReadableStream<Uint8Array>, | ||
| ): Stream { | ||
| const textEncoder = new TextEncoder(); | ||
| const textDecoder = new TextDecoder(); | ||
| const readable = new ReadableStream<AnyMessage>({ | ||
| async start(controller) { | ||
| let content = ""; | ||
| const reader = input.getReader(); | ||
| try { | ||
| while (true) { | ||
| const { value, done } = await reader.read(); | ||
| if (done) { | ||
| break; | ||
| } | ||
| if (!value) { | ||
| continue; | ||
| } | ||
| content += textDecoder.decode(value, { stream: true }); | ||
| const lines = content.split("\n"); | ||
| content = lines.pop() || ""; | ||
| for (const line of lines) { | ||
| const trimmedLine = line.trim(); | ||
| if (trimmedLine) { | ||
| try { | ||
| const message = JSON.parse(trimmedLine) as AnyMessage; | ||
| controller.enqueue(message); | ||
| } catch (err) { | ||
| console.error( | ||
| "Failed to parse JSON message:", | ||
| trimmedLine, | ||
| err, | ||
| ); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } finally { | ||
| reader.releaseLock(); | ||
| controller.close(); | ||
| } | ||
| }, | ||
| }); | ||
| const writable = new WritableStream<AnyMessage>({ | ||
| async write(message) { | ||
| const content = JSON.stringify(message) + "\n"; | ||
| const writer = output.getWriter(); | ||
| try { | ||
| await writer.write(textEncoder.encode(content)); | ||
| } finally { | ||
| writer.releaseLock(); | ||
| } | ||
| }, | ||
| }); | ||
| return { readable, writable }; | ||
| } |
| { | ||
| "$schema": "https://typedoc.org/schema.json", | ||
| "name": "Agent Client Protocol", | ||
| "entryPoints": ["./acp.ts"], | ||
| "out": "./docs", | ||
| "navigationLinks": { | ||
| "Protocol Docs": "https://agentclientprotocol.com", | ||
| "GitHub": "https://github.com/agentclientprotocol/agent-client-protocol", | ||
| "NPM": "https://www.npmjs.com/package/@agentclientprotocol/sdk" | ||
| }, | ||
| "tsconfig": "../tsconfig.json", | ||
| "excludePrivate": true, | ||
| "excludeProtected": true, | ||
| "excludeInternal": true, | ||
| "excludeExternals": false, | ||
| "includeVersion": true, | ||
| "searchInComments": true, | ||
| "categorizeByGroup": true, | ||
| "sort": ["source-order"], | ||
| "visibilityFilters": { | ||
| "protected": false, | ||
| "private": false, | ||
| "inherited": true, | ||
| "external": false | ||
| }, | ||
| "plugin": ["typedoc-github-theme"], | ||
| "theme": "typedoc-github-theme", | ||
| "lightHighlightTheme": "github-light", | ||
| "darkHighlightTheme": "github-dark", | ||
| "readme": "./README.md", | ||
| "exclude": [ | ||
| "**/node_modules/**", | ||
| "**/dist/**", | ||
| "**/tests/**", | ||
| "**/test/**", | ||
| "**/*.test.ts", | ||
| "**/*.spec.ts", | ||
| "**/generate.js" | ||
| ], | ||
| "externalPattern": ["**/node_modules/**"], | ||
| "excludeNotDocumented": false, | ||
| "excludeReferences": false, | ||
| "validation": { | ||
| "notExported": true, | ||
| "invalidLink": true, | ||
| "notDocumented": false | ||
| }, | ||
| "treatWarningsAsErrors": false, | ||
| "skipErrorChecking": false, | ||
| "disableSources": false, | ||
| "gitRevision": "main", | ||
| "gitRemote": "origin", | ||
| "hideGenerator": false | ||
| } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
54
8%1
-50%1189602
-69.42%15
36.36%25
-13.79%27139
-12.8%