The open source coding agent.
TypeScript
fix(acp): use newer acp package (#3317)
Giuseppe Rota731122bf99c6
diff --git a/bun.lock b/bun.lockindex f68eb678115..69a5e3e9f19 100644--- a/bun.lock+++ b/bun.lock@@ -170,6 +170,7 @@"dependencies": {"@actions/core": "1.11.1","@actions/github": "6.0.1",+ "@agentclientprotocol/sdk": "0.4.9","@clack/prompts": "1.0.0-alpha.1","@hono/standard-validator": "0.1.5","@hono/zod-validator": "catalog:",@@ -182,7 +183,6 @@"@opencode-ai/sdk": "workspace:*","@parcel/watcher": "2.5.1","@standard-schema/spec": "1.0.0",- "@zed-industries/agent-client-protocol": "0.4.5","@zip.js/zip.js": "2.7.62","ai": "catalog:","chokidar": "4.0.3",@@ -373,6 +373,8 @@"@adobe/css-tools": ["@adobe/[email protected]", "", {}, "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg=="],+ "@agentclientprotocol/sdk": ["@agentclientprotocol/[email protected]", "", { "dependencies": { "zod": "^3.0.0" } }, "sha512-ExwH828LaTGoTTjxuw49l+fwOLA+Yx0+qkWn1TcHMOsY5mVI9CUfkj7ZDhv2klgZ7mJeT+lxX/Dn/KINv1AkNQ=="],+"@ai-sdk/amazon-bedrock": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "1.1.3", "@ai-sdk/provider-utils": "2.2.8", "@smithy/eventstream-codec": "^4.0.1", "@smithy/util-utf8": "^4.0.0", "aws4fetch": "^1.0.20" }, "peerDependencies": { "zod": "^3.0.0" } }, "sha512-icLGO7Q0NinnHIPgT+y1QjHVwH4HwV+brWbvM+FfCG2Afpa89PyKa3Ret91kGjZpBgM/xnj1B7K5eM+rRlsXQA=="],"@ai-sdk/anthropic": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4" } }, "sha512-uyyaO4KhxoIKZztREqLPh+6/K3ZJx/rp72JKoUEL9/kC+vfQTThUfPnY/bUryUpcnawx8IY/tSoYNOi/8PCv7w=="],@@ -1381,8 +1383,6 @@"@vitejs/plugin-react": ["@vitejs/[email protected]", "", { "dependencies": { "@babel/core": "^7.28.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.27", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA=="],- "@zed-industries/agent-client-protocol": ["@zed-industries/[email protected]", "", { "dependencies": { "zod": "^3.0.0" } }, "sha512-OwHKfu5AiKul/GSJilHg36+kOSV9eOl2eYnjR6tenAQDdraSnt22WFk0SDFTeuAANz1Gxkv+DTf7Hq32rvX7FQ=="],-"@zip.js/zip.js": ["@zip.js/[email protected]", "", {}, "sha512-OaLvZ8j4gCkLn048ypkZu29KX30r8/OfFF2w4Jo5WXFr+J04J+lzJ5TKZBVgFXhlvSkqNFQdfnY1Q8TMTCyBVA=="],"abbrev": ["[email protected]", "", {}, "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ=="],@@ -3379,6 +3379,8 @@"@actions/github/@octokit/request-error": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^13.1.0", "deprecation": "^2.0.0", "once": "^1.4.0" } }, "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g=="],+ "@agentclientprotocol/sdk/zod": ["[email protected]", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],+"@ai-sdk/amazon-bedrock/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg=="],"@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "1.1.3", "nanoid": "^3.3.8", "secure-json-parse": "^2.7.0" }, "peerDependencies": { "zod": "^3.23.8" } }, "sha512-fqhG+4sCVv8x7nFzYnFo19ryhAa3w096Kmc3hWxMQfW/TubPOmt3A6tYZhl4mUfQWWQMsuSkLrtjlWuXBVSGQA=="],@@ -3553,8 +3555,6 @@"@vinxi/server-components/magicast": ["[email protected]", "", { "dependencies": { "@babel/parser": "^7.22.16", "@babel/types": "^7.22.17", "recast": "^0.23.4" } }, "sha512-6saXbRDA1HMkqbsvHOU6HBjCVgZT460qheRkLhJQHWAbhXoWESI3Kn/dGGXyKs15FFKR85jsUqFx2sMK0wy/5g=="],- "@zed-industries/agent-client-protocol/zod": ["[email protected]", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],-"accepts/mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],"ai/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.3", "zod-to-json-schema": "^3.24.1" }, "peerDependencies": { "zod": "^3.25.76 || ^4" } }, "sha512-/iP1sKc6UdJgGH98OCly7sWJKv+J9G47PnTjIj40IJMUQKwDrUMyf7zOOfRtPwSuNifYhSoJQ4s1WltI65gJ/g=="],diff --git a/packages/opencode/package.json b/packages/opencode/package.jsonindex d2b1d55e024..de52826fef7 100644--- a/packages/opencode/package.json+++ b/packages/opencode/package.json@@ -35,6 +35,7 @@"dependencies": {"@actions/core": "1.11.1","@actions/github": "6.0.1",+ "@agentclientprotocol/sdk": "0.4.9","@clack/prompts": "1.0.0-alpha.1","@hono/standard-validator": "0.1.5","@hono/zod-validator": "catalog:",@@ -47,7 +48,6 @@"@opencode-ai/sdk": "workspace:*","@parcel/watcher": "2.5.1","@standard-schema/spec": "1.0.0",- "@zed-industries/agent-client-protocol": "0.4.5","@zip.js/zip.js": "2.7.62","ai": "catalog:","chokidar": "4.0.3",diff --git a/packages/opencode/src/acp/README.md b/packages/opencode/src/acp/README.mdindex 5e51af13c39..d998cb22da8 100644--- a/packages/opencode/src/acp/README.md+++ b/packages/opencode/src/acp/README.md@@ -8,7 +8,7 @@ The implementation follows a clean separation of concerns:### Core Components-- **`agent.ts`** - Implements the `Agent` interface from `@zed-industries/agent-client-protocol`+- **`agent.ts`** - Implements the `Agent` interface from `@agentclientprotocol/sdk`- Handles initialization and capability negotiation- Manages session lifecycle (`session/new`, `session/load`)- Processes prompts and returns responses@@ -130,7 +130,7 @@ echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":### Why the Official Library?-We use `@zed-industries/agent-client-protocol` instead of implementing JSON-RPC ourselves because:+We use `@agentclientprotocol/sdk` instead of implementing JSON-RPC ourselves because:- Ensures protocol compliance- Handles edge cases and future protocol versions@@ -160,5 +160,5 @@ ACP sessions map cleanly to opencode's internal session model:## References- [ACP Specification](https://agentclientprotocol.com/)-- [TypeScript Library](https://github.com/zed-industries/agent-client-protocol/tree/main/typescript)-- [Protocol Examples](https://github.com/zed-industries/agent-client-protocol/tree/main/typescript/examples)+- [TypeScript Library](https://github.com/agentclientprotocol/typescript-sdk)+- [Protocol Examples](https://github.com/agentclientprotocol/typescript-sdk/tree/main/src/examples)diff --git a/packages/opencode/src/acp/agent.ts b/packages/opencode/src/acp/agent.tsindex d0981b056ac..130cbdce65b 100644--- a/packages/opencode/src/acp/agent.ts+++ b/packages/opencode/src/acp/agent.ts@@ -12,7 +12,7 @@ import type {NewSessionResponse,PromptRequest,PromptResponse,-} from "@zed-industries/agent-client-protocol"+} from "@agentclientprotocol/sdk"import { Log } from "../util/log"import { ACPSessionManager } from "./session"import type { ACPConfig } from "./types"diff --git a/packages/opencode/src/acp/client.ts b/packages/opencode/src/acp/client.tsindex 50d5999165d..24119eabe80 100644--- a/packages/opencode/src/acp/client.ts+++ b/packages/opencode/src/acp/client.ts@@ -17,7 +17,7 @@ import type {WaitForTerminalExitResponse,WriteTextFileRequest,WriteTextFileResponse,-} from "@zed-industries/agent-client-protocol"+} from "@agentclientprotocol/sdk"import { Log } from "../util/log"export class ACPClient implements Client {diff --git a/packages/opencode/src/acp/server.ts b/packages/opencode/src/acp/server.tsindex 667a0987328..0e5306dcd17 100644--- a/packages/opencode/src/acp/server.ts+++ b/packages/opencode/src/acp/server.ts@@ -1,4 +1,4 @@-import { AgentSideConnection, ndJsonStream } from "@zed-industries/agent-client-protocol"+import { AgentSideConnection, ndJsonStream } from "@agentclientprotocol/sdk"import { Log } from "../util/log"import { Instance } from "../project/instance"import { OpenCodeAgent } from "./agent"diff --git a/packages/opencode/src/acp/session.ts b/packages/opencode/src/acp/session.tsindex 01d079bcf7c..c0a6db04b33 100644--- a/packages/opencode/src/acp/session.ts+++ b/packages/opencode/src/acp/session.ts@@ -1,4 +1,4 @@-import type { McpServer } from "@zed-industries/agent-client-protocol"+import type { McpServer } from "@agentclientprotocol/sdk"import { Identifier } from "../id/id"import { Session } from "../session"import type { ACPSessionState } from "./types"diff --git a/packages/opencode/src/acp/types.ts b/packages/opencode/src/acp/types.tsindex f10066a8be6..3f0768b8cd4 100644--- a/packages/opencode/src/acp/types.ts+++ b/packages/opencode/src/acp/types.ts@@ -1,4 +1,4 @@-import type { McpServer } from "@zed-industries/agent-client-protocol"+import type { McpServer } from "@agentclientprotocol/sdk"export interface ACPSessionState {id: stringdiff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.tsindex afca94864f8..1e92472dcb3 100644--- a/packages/sdk/js/src/gen/types.gen.ts+++ b/packages/sdk/js/src/gen/types.gen.ts@@ -970,6 +970,7 @@ export type FileNode = {}export type FileContent = {+ type: "text"content: stringdiff?: stringpatch?: {@@ -986,6 +987,8 @@ export type FileContent = {}>index?: string}+ encoding?: "base64"+ mimeType?: string}export type File = {