Przeglądaj źródła

fix(acp): use newer acp package (#3317)

Giuseppe Rota 4 miesięcy temu
rodzic
commit
731122bf99

+ 5 - 5
bun.lock

@@ -170,6 +170,7 @@
       "dependencies": {
       "dependencies": {
         "@actions/core": "1.11.1",
         "@actions/core": "1.11.1",
         "@actions/github": "6.0.1",
         "@actions/github": "6.0.1",
+        "@agentclientprotocol/sdk": "0.4.9",
         "@clack/prompts": "1.0.0-alpha.1",
         "@clack/prompts": "1.0.0-alpha.1",
         "@hono/standard-validator": "0.1.5",
         "@hono/standard-validator": "0.1.5",
         "@hono/zod-validator": "catalog:",
         "@hono/zod-validator": "catalog:",
@@ -182,7 +183,6 @@
         "@opencode-ai/sdk": "workspace:*",
         "@opencode-ai/sdk": "workspace:*",
         "@parcel/watcher": "2.5.1",
         "@parcel/watcher": "2.5.1",
         "@standard-schema/spec": "1.0.0",
         "@standard-schema/spec": "1.0.0",
-        "@zed-industries/agent-client-protocol": "0.4.5",
         "@zip.js/zip.js": "2.7.62",
         "@zip.js/zip.js": "2.7.62",
         "ai": "catalog:",
         "ai": "catalog:",
         "chokidar": "4.0.3",
         "chokidar": "4.0.3",
@@ -373,6 +373,8 @@
 
 
     "@adobe/css-tools": ["@adobe/[email protected]", "", {}, "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg=="],
     "@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/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=="],
     "@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=="],
     "@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=="],
     "@zip.js/zip.js": ["@zip.js/[email protected]", "", {}, "sha512-OaLvZ8j4gCkLn048ypkZu29KX30r8/OfFF2w4Jo5WXFr+J04J+lzJ5TKZBVgFXhlvSkqNFQdfnY1Q8TMTCyBVA=="],
 
 
     "abbrev": ["[email protected]", "", {}, "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ=="],
     "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=="],
     "@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": ["@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=="],
     "@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=="],
     "@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=="],
     "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=="],
     "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=="],

+ 1 - 1
packages/opencode/package.json

@@ -35,6 +35,7 @@
   "dependencies": {
   "dependencies": {
     "@actions/core": "1.11.1",
     "@actions/core": "1.11.1",
     "@actions/github": "6.0.1",
     "@actions/github": "6.0.1",
+    "@agentclientprotocol/sdk": "0.4.9",
     "@clack/prompts": "1.0.0-alpha.1",
     "@clack/prompts": "1.0.0-alpha.1",
     "@hono/standard-validator": "0.1.5",
     "@hono/standard-validator": "0.1.5",
     "@hono/zod-validator": "catalog:",
     "@hono/zod-validator": "catalog:",
@@ -47,7 +48,6 @@
     "@opencode-ai/sdk": "workspace:*",
     "@opencode-ai/sdk": "workspace:*",
     "@parcel/watcher": "2.5.1",
     "@parcel/watcher": "2.5.1",
     "@standard-schema/spec": "1.0.0",
     "@standard-schema/spec": "1.0.0",
-    "@zed-industries/agent-client-protocol": "0.4.5",
     "@zip.js/zip.js": "2.7.62",
     "@zip.js/zip.js": "2.7.62",
     "ai": "catalog:",
     "ai": "catalog:",
     "chokidar": "4.0.3",
     "chokidar": "4.0.3",

+ 4 - 4
packages/opencode/src/acp/README.md

@@ -8,7 +8,7 @@ The implementation follows a clean separation of concerns:
 
 
 ### Core Components
 ### 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
   - Handles initialization and capability negotiation
   - Manages session lifecycle (`session/new`, `session/load`)
   - Manages session lifecycle (`session/new`, `session/load`)
   - Processes prompts and returns responses
   - Processes prompts and returns responses
@@ -130,7 +130,7 @@ echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":
 
 
 ### Why the Official Library?
 ### 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
 - Ensures protocol compliance
 - Handles edge cases and future protocol versions
 - Handles edge cases and future protocol versions
@@ -160,5 +160,5 @@ ACP sessions map cleanly to opencode's internal session model:
 ## References
 ## References
 
 
 - [ACP Specification](https://agentclientprotocol.com/)
 - [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)

+ 1 - 1
packages/opencode/src/acp/agent.ts

@@ -12,7 +12,7 @@ import type {
   NewSessionResponse,
   NewSessionResponse,
   PromptRequest,
   PromptRequest,
   PromptResponse,
   PromptResponse,
-} from "@zed-industries/agent-client-protocol"
+} from "@agentclientprotocol/sdk"
 import { Log } from "../util/log"
 import { Log } from "../util/log"
 import { ACPSessionManager } from "./session"
 import { ACPSessionManager } from "./session"
 import type { ACPConfig } from "./types"
 import type { ACPConfig } from "./types"

+ 1 - 1
packages/opencode/src/acp/client.ts

@@ -17,7 +17,7 @@ import type {
   WaitForTerminalExitResponse,
   WaitForTerminalExitResponse,
   WriteTextFileRequest,
   WriteTextFileRequest,
   WriteTextFileResponse,
   WriteTextFileResponse,
-} from "@zed-industries/agent-client-protocol"
+} from "@agentclientprotocol/sdk"
 import { Log } from "../util/log"
 import { Log } from "../util/log"
 
 
 export class ACPClient implements Client {
 export class ACPClient implements Client {

+ 1 - 1
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 { Log } from "../util/log"
 import { Instance } from "../project/instance"
 import { Instance } from "../project/instance"
 import { OpenCodeAgent } from "./agent"
 import { OpenCodeAgent } from "./agent"

+ 1 - 1
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 { Identifier } from "../id/id"
 import { Session } from "../session"
 import { Session } from "../session"
 import type { ACPSessionState } from "./types"
 import type { ACPSessionState } from "./types"

+ 1 - 1
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 {
 export interface ACPSessionState {
   id: string
   id: string

+ 3 - 0
packages/sdk/js/src/gen/types.gen.ts

@@ -970,6 +970,7 @@ export type FileNode = {
 }
 }
 
 
 export type FileContent = {
 export type FileContent = {
+  type: "text"
   content: string
   content: string
   diff?: string
   diff?: string
   patch?: {
   patch?: {
@@ -986,6 +987,8 @@ export type FileContent = {
     }>
     }>
     index?: string
     index?: string
   }
   }
+  encoding?: "base64"
+  mimeType?: string
 }
 }
 
 
 export type File = {
 export type File = {