mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-27 20:42:10 +00:00
Compare commits
5 Commits
v0.1.9
...
glob-backt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0df3dea08d | ||
|
|
182a40ccae | ||
|
|
55c61986e8 | ||
|
|
46f643b9f4 | ||
|
|
07316e2eb0 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@zed-industries/claude-code-acp",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.11",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@zed-industries/claude-code-acp",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.11",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/claude-code": "^1.0.100",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"bin": {
|
||||
"claude-code-acp": "./dist/index.js"
|
||||
},
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.11",
|
||||
"description": "An ACP-compatible coding agent powered by the Claude Code SDK (TypeScript)",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// stdout is used to send messages to the client
|
||||
// we redirect everything else to stderr to make sure it doesn't interfere with ACP
|
||||
console.log = console.error;
|
||||
console.info = console.error;
|
||||
console.warn = console.error;
|
||||
console.debug = console.error;
|
||||
|
||||
import { runAcp as runAcp } from "./acp-agent.js";
|
||||
runAcp();
|
||||
|
||||
|
||||
@@ -379,13 +379,13 @@ File editing instructions:
|
||||
});
|
||||
|
||||
const statusPromise = Promise.race([
|
||||
handle.waitForExit().then(() => ({ status: "exited" as const })),
|
||||
abortPromise.then(() => ({ status: "aborted" as const })),
|
||||
handle.waitForExit().then((exitStatus) => ({ status: "exited" as const, exitStatus })),
|
||||
abortPromise.then(() => ({ status: "aborted" as const, exitStatus: null })),
|
||||
sleep(input.timeout_ms).then(async () => {
|
||||
if (agent.backgroundTerminals[handle.id]?.status === "started") {
|
||||
await handle.kill();
|
||||
}
|
||||
return { status: "timedOut" as const };
|
||||
return { status: "timedOut" as const, exitStatus: null };
|
||||
}),
|
||||
]);
|
||||
|
||||
@@ -396,7 +396,7 @@ File editing instructions:
|
||||
status: "started",
|
||||
};
|
||||
|
||||
statusPromise.then(async ({ status }) => {
|
||||
statusPromise.then(async ({ status, exitStatus }) => {
|
||||
const bgTerm = agent.backgroundTerminals[handle.id];
|
||||
|
||||
if (bgTerm.status !== "started") {
|
||||
@@ -410,6 +410,7 @@ File editing instructions:
|
||||
pendingOutput: {
|
||||
...currentOutput,
|
||||
output: stripCommonPrefix(bgTerm.lastOutput?.output ?? "", currentOutput.output),
|
||||
exitStatus: exitStatus ?? currentOutput.exitStatus,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -700,9 +701,10 @@ function toolCommandOutput(
|
||||
let toolOutput = "";
|
||||
|
||||
switch (status) {
|
||||
case "started": {
|
||||
case "started":
|
||||
case "exited": {
|
||||
if (exitStatus && (exitStatus.exitCode ?? null) === null) {
|
||||
toolOutput += `Interrupted. `;
|
||||
toolOutput += `Interrupted by the user. `;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -712,7 +714,6 @@ function toolCommandOutput(
|
||||
case "timedOut":
|
||||
toolOutput += `Timed out. `;
|
||||
break;
|
||||
case "exited":
|
||||
case "aborted":
|
||||
break;
|
||||
default: {
|
||||
@@ -722,16 +723,19 @@ function toolCommandOutput(
|
||||
}
|
||||
|
||||
if (exitStatus) {
|
||||
if (typeof exitStatus.exitCode === "number" && exitStatus.exitCode !== 0) {
|
||||
toolOutput += `Failed with exit code ${exitStatus.exitCode}.`;
|
||||
if (typeof exitStatus.exitCode === "number") {
|
||||
toolOutput += `Exited with code ${exitStatus.exitCode}.`;
|
||||
}
|
||||
|
||||
if (typeof exitStatus.signal === "string") {
|
||||
toolOutput += `Signal \`${exitStatus.signal}\`. `;
|
||||
}
|
||||
|
||||
toolOutput += "Final output:\n\n";
|
||||
} else {
|
||||
toolOutput += "New output:\n\n";
|
||||
}
|
||||
|
||||
toolOutput += "Output:\n\n";
|
||||
toolOutput += commandOutput;
|
||||
|
||||
if (truncated) {
|
||||
|
||||
@@ -216,7 +216,7 @@ describe("tool conversions", () => {
|
||||
|
||||
expect(toolInfoFromToolUse(tool_use, {})).toStrictEqual({
|
||||
kind: "search",
|
||||
title: "Find */**.ts",
|
||||
title: "Find `*/**.ts`",
|
||||
content: [],
|
||||
locations: [],
|
||||
});
|
||||
|
||||
@@ -160,7 +160,7 @@ export function toolInfoFromToolUse(
|
||||
}
|
||||
}
|
||||
return {
|
||||
title: path ? `Edit ${path}` : "Edit",
|
||||
title: path ? `Edit \`${path}\`` : "Edit",
|
||||
kind: "edit",
|
||||
content:
|
||||
input && path
|
||||
@@ -272,10 +272,10 @@ export function toolInfoFromToolUse(
|
||||
case "Glob": {
|
||||
let label = "Find";
|
||||
if (input.path) {
|
||||
label += ` ${input.path}`;
|
||||
label += ` \`${input.path}\``;
|
||||
}
|
||||
if (input.pattern) {
|
||||
label += ` ${input.pattern}`;
|
||||
label += ` \`${input.pattern}\``;
|
||||
}
|
||||
return {
|
||||
title: label,
|
||||
|
||||
Reference in New Issue
Block a user