Compare commits

...

3 Commits

Author SHA1 Message Date
Ben Brandt
75b44e945e Update to claude-agent-sdk 0.1.13 (#89) 2025-10-10 14:43:44 +00:00
Ben Brandt
ad8611c399 Migrate to @agentclientprotocol/sdk (#88) 2025-10-10 16:17:37 +02:00
ozer
c5abff0e43 Improve setSessionMode error handling for SDK messages (#85)
When `default`, `acceptEdits`, or `plan` modes fail, users see the real
error from the SDK instead of a generic message.

`Bypass permissions` gets special treatment - it shows both the SDK
error AND explains it needs proper configuration. I couldn't test SDK
thats why I added special treatment for bypass permissions. If you can
test it we can talk further.

Related to: https://github.com/zed-industries/zed/pull/39524 @benbrandt
2025-10-09 12:49:44 +02:00
7 changed files with 53 additions and 46 deletions

View File

@@ -1,5 +1,10 @@
# Changelog
## 0.5.5
- Migrate to @agentclientprotocol/sdk@0.4.5
- Update to @anthropic-ai/claude-agent-sdk@v0.1.13
## 0.5.4
- Update to @anthropic-ai/claude-agent-sdk@v0.1.11

56
package-lock.json generated
View File

@@ -1,18 +1,18 @@
{
"name": "@zed-industries/claude-code-acp",
"version": "0.5.4",
"version": "0.5.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@zed-industries/claude-code-acp",
"version": "0.5.4",
"version": "0.5.5",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "0.1.11",
"@anthropic-ai/claude-code": "2.0.11",
"@modelcontextprotocol/sdk": "1.19.1",
"@zed-industries/agent-client-protocol": "0.4.5",
"@agentclientprotocol/sdk": "0.4.5",
"@anthropic-ai/claude-agent-sdk": "0.1.13",
"@anthropic-ai/claude-code": "2.0.13",
"@modelcontextprotocol/sdk": "1.20.0",
"diff": "8.0.2",
"express": "5.1.0",
"minimist": "1.2.8",
@@ -25,7 +25,7 @@
"@anthropic-ai/sdk": "^0.65.0",
"@types/express": "5.0.3",
"@types/minimist": "1.2.5",
"@types/node": "24.7.0",
"@types/node": "24.7.1",
"@types/uuid": "10.0.0",
"@typescript-eslint/eslint-plugin": "8.46.0",
"@typescript-eslint/parser": "8.46.0",
@@ -39,10 +39,19 @@
"vitest": "3.2.4"
}
},
"node_modules/@agentclientprotocol/sdk": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-0.4.5.tgz",
"integrity": "sha512-1cKCZvy6xJ+9n7BkUzrgFfj+waJOj21HaiYvbE4elxBCT7WAHAk5zaQ5cQfmw876TZoEP062Vxy7qkYp1rzEfw==",
"license": "Apache-2.0",
"dependencies": {
"zod": "^3.0.0"
}
},
"node_modules/@anthropic-ai/claude-agent-sdk": {
"version": "0.1.11",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.1.11.tgz",
"integrity": "sha512-twlHobV2rK5+2Osr/FVTFiWjG0ah+37yhwNxdloLW7ldE84qVauENKjkJT3HzM8sRqvD0CmeAHYzF1foGf4SIA==",
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.1.13.tgz",
"integrity": "sha512-9/+/iVdVQx2o3INUxwNWuZQOhff3ISXgSc/G7jfD85qtEN/7ZK/uOnAtCH1PChMNBN5CGXgVKNMce++52tfZ5A==",
"license": "SEE LICENSE IN README.md",
"engines": {
"node": ">=18.0.0"
@@ -60,9 +69,9 @@
}
},
"node_modules/@anthropic-ai/claude-code": {
"version": "2.0.11",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-2.0.11.tgz",
"integrity": "sha512-DBQd5znEJn11JsmqFOhjTeSO6oihxPkl9KiHxsvc1kbyQKUNVRLFnaAjUfGUOktmWLN+d7e3vbIRKhHtXoA0BQ==",
"version": "2.0.13",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-2.0.13.tgz",
"integrity": "sha512-T5ZRNIHt/iKf443c9TWeXgzyRchfsicV00Tz4dgLlXfzehvjgTtvgeJBfk9p3AW412zpqwqXDKL4/UvOmhNffg==",
"license": "SEE LICENSE IN README.md",
"bin": {
"claude": "cli.js"
@@ -1057,9 +1066,9 @@
}
},
"node_modules/@modelcontextprotocol/sdk": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.19.1.tgz",
"integrity": "sha512-3Y2h3MZKjec1eAqSTBclATlX+AbC6n1LgfVzRMJLt3v6w0RCYgwLrjbxPDbhsYHt6Wdqc/aCceNJYgj448ELQQ==",
"version": "1.20.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.20.0.tgz",
"integrity": "sha512-kOQ4+fHuT4KbR2iq2IjeV32HiihueuOf1vJkq18z08CLZ1UQrTc8BXJpVfxZkq45+inLLD+D4xx4nBjUelJa4Q==",
"license": "MIT",
"dependencies": {
"ajv": "^6.12.6",
@@ -1559,9 +1568,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "24.7.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.7.0.tgz",
"integrity": "sha512-IbKooQVqUBrlzWTi79E8Fw78l8k1RNtlDDNWsFZs7XonuQSJ8oNYfEeclhprUldXISRMLzBpILuKgPlIxm+/Yw==",
"version": "24.7.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.7.1.tgz",
"integrity": "sha512-CmyhGZanP88uuC5GpWU9q+fI61j2SkhO3UGMUdfYRE6Bcy0ccyzn1Rqj9YAB/ZY4kOXmNf0ocah5GtphmLMP6Q==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1994,15 +2003,6 @@
"url": "https://opencollective.com/vitest"
}
},
"node_modules/@zed-industries/agent-client-protocol": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/@zed-industries/agent-client-protocol/-/agent-client-protocol-0.4.5.tgz",
"integrity": "sha512-OwHKfu5AiKul/GSJilHg36+kOSV9eOl2eYnjR6tenAQDdraSnt22WFk0SDFTeuAANz1Gxkv+DTf7Hq32rvX7FQ==",
"license": "Apache-2.0",
"dependencies": {
"zod": "^3.0.0"
}
},
"node_modules/accepts": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",

View File

@@ -6,7 +6,7 @@
"bin": {
"claude-code-acp": "./dist/index.js"
},
"version": "0.5.4",
"version": "0.5.5",
"description": "An ACP-compatible coding agent powered by the Claude Code SDK (TypeScript)",
"main": "dist/index.js",
"type": "module",
@@ -51,10 +51,10 @@
"author": "Zed Industries",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "0.1.11",
"@anthropic-ai/claude-code": "2.0.11",
"@modelcontextprotocol/sdk": "1.19.1",
"@zed-industries/agent-client-protocol": "0.4.5",
"@agentclientprotocol/sdk": "0.4.5",
"@anthropic-ai/claude-agent-sdk": "0.1.13",
"@anthropic-ai/claude-code": "2.0.13",
"@modelcontextprotocol/sdk": "1.20.0",
"diff": "8.0.2",
"express": "5.1.0",
"minimist": "1.2.8",
@@ -64,7 +64,7 @@
"@anthropic-ai/sdk": "^0.65.0",
"@types/express": "5.0.3",
"@types/minimist": "1.2.5",
"@types/node": "24.7.0",
"@types/node": "24.7.1",
"@types/uuid": "10.0.0",
"@typescript-eslint/eslint-plugin": "8.46.0",
"@typescript-eslint/parser": "8.46.0",

View File

@@ -21,7 +21,7 @@ import {
TerminalOutputResponse,
WriteTextFileRequest,
WriteTextFileResponse,
} from "@zed-industries/agent-client-protocol";
} from "@agentclientprotocol/sdk";
import {
McpServerConfig,
Options,
@@ -37,7 +37,7 @@ import * as path from "node:path";
import * as os from "node:os";
import { v7 as uuidv7 } from "uuid";
import { nodeToWebReadable, nodeToWebWritable, Pushable, unreachable } from "./utils.js";
import { SessionNotification } from "@zed-industries/agent-client-protocol";
import { SessionNotification } from "@agentclientprotocol/sdk";
import {
createMcpServer,
createPermissionMcpServer,
@@ -386,10 +386,17 @@ export class ClaudeAcpAgent implements Agent {
case "bypassPermissions":
case "plan":
this.sessions[params.sessionId].permissionMode = params.modeId;
await this.sessions[params.sessionId].query.setPermissionMode(params.modeId);
try {
await this.sessions[params.sessionId].query.setPermissionMode(params.modeId);
} catch (error) {
const errorMessage =
error instanceof Error && error.message ? error.message : "Invalid Mode";
throw new Error(errorMessage);
}
return {};
default:
throw new Error("Invalid mode");
throw new Error("Invalid Mode");
}
}

View File

@@ -5,7 +5,7 @@ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/
import { z } from "zod";
import { Server } from "node:http";
import { ClaudeAcpAgent } from "./acp-agent.js";
import { ClientCapabilities, TerminalOutputResponse } from "@zed-industries/agent-client-protocol";
import { ClientCapabilities, TerminalOutputResponse } from "@agentclientprotocol/sdk";
import * as diff from "diff";
import { sleep, unreachable, extractLinesWithByteLimit } from "./utils.js";

View File

@@ -14,7 +14,7 @@ import {
SessionNotification,
WriteTextFileRequest,
WriteTextFileResponse,
} from "@zed-industries/agent-client-protocol";
} from "@agentclientprotocol/sdk";
import { nodeToWebWritable, nodeToWebReadable } from "../utils.js";
import { markdownEscape, toolInfoFromToolUse, toolUpdateFromToolResult } from "../tools.js";
import { toAcpNotifications } from "../acp-agent.js";

View File

@@ -1,9 +1,4 @@
import {
PlanEntry,
ToolCallContent,
ToolCallLocation,
ToolKind,
} from "@zed-industries/agent-client-protocol";
import { PlanEntry, ToolCallContent, ToolCallLocation, ToolKind } from "@agentclientprotocol/sdk";
import { replaceAndCalculateLocation, SYSTEM_REMINDER, toolNames } from "./mcp-server.js";
import { ToolResultBlockParam } from "@anthropic-ai/sdk/resources";