Compare commits

...

2 Commits

Author SHA1 Message Date
Ben Brandt
8df7f10058 Use better file path resolution for experimental auth support (#156) 2025-11-14 12:21:49 +01:00
Ben Brandt
6a0d0b5522 Fix incorrect stop reason after tool call rejection (#153)
We were mapping tool call rejections to actual "refusals" which isn't
quite right in ACP.

Also filters out more of these status messages that Claude is returning.
2025-11-13 11:19:48 +01:00
4 changed files with 26 additions and 11 deletions

View File

@@ -1,5 +1,13 @@
# Changelog
## 0.10.3
- Fix for experimental terminal auth support
## 0.10.2
- Fix incorrect stop reason for tool call refusals
## 0.10.1
- Add additional structured metadata to tool calls

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@zed-industries/claude-code-acp",
"version": "0.10.1",
"version": "0.10.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@zed-industries/claude-code-acp",
"version": "0.10.1",
"version": "0.10.3",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "0.5.1",

View File

@@ -3,7 +3,7 @@
"publishConfig": {
"access": "public"
},
"version": "0.10.1",
"version": "0.10.3",
"description": "An ACP-compatible coding agent powered by the Claude Code SDK (TypeScript)",
"main": "dist/lib.js",
"bin": {

View File

@@ -53,6 +53,7 @@ import {
import { ContentBlockParam } from "@anthropic-ai/sdk/resources";
import { BetaContentBlock, BetaRawContentBlockDelta } from "@anthropic-ai/sdk/resources/beta.mjs";
import packageJson from "../package.json" with { type: "json" };
import { fileURLToPath } from "node:url";
type Session = {
query: Query;
@@ -126,14 +127,12 @@ export class ClaudeAcpAgent implements Agent {
// If client supports terminal-auth capability, use that instead.
if (request.clientCapabilities?._meta?.["terminal-auth"] === true) {
const cliPath = import.meta
.resolve("@anthropic-ai/claude-agent-sdk/cli.js")
.replace("file://", "");
const cliPath = fileURLToPath(import.meta.resolve("@anthropic-ai/claude-agent-sdk/cli.js"));
authMethod._meta = {
"terminal-auth": {
command: "node",
args: [cliPath, "/login"],
command: cliPath,
args: ["/login"],
label: "Claude Code Login",
},
};
@@ -377,12 +376,14 @@ export class ClaudeAcpAgent implements Agent {
return { stopReason: "end_turn" };
}
case "error_during_execution":
return { stopReason: "refusal" };
return { stopReason: "end_turn" };
case "error_max_budget_usd":
case "error_max_turns":
return { stopReason: "max_turn_requests" };
default:
return { stopReason: "refusal" };
unreachable(message);
}
break;
}
case "stream_event": {
for (const notification of streamEventToAcpNotifications(
@@ -420,7 +421,13 @@ export class ClaudeAcpAgent implements Agent {
break;
}
// Skip these user messages for now, since they seem to just be messages we don't want in the feed
if (message.type === "user" && typeof message.message.content === "string") {
if (
message.type === "user" &&
(typeof message.message.content === "string" ||
(Array.isArray(message.message.content) &&
message.message.content.length === 1 &&
message.message.content[0].type === "text"))
) {
break;
}