Compare commits

...

6 Commits

Author SHA1 Message Date
Agus Zubiaga
f717175cdc 0.1.11 2025-09-02 23:16:46 -03:00
Agus Zubiaga
d1fd794ecb Add backticks around glob pattern (#13)
Looks nicer and prevents potential markdown issues
2025-09-02 23:13:27 -03:00
Agus Zubiaga
f54da50bf5 Update README.md 2025-09-02 22:35:45 -03:00
Agus Zubiaga
55c61986e8 0.1.10 2025-09-02 20:03:22 -03:00
Agus Zubiaga
46f643b9f4 Improve background terminal output 2025-09-02 20:03:14 -03:00
Agus Zubiaga
07316e2eb0 Redirect console.log et al to stderr 2025-09-02 19:46:30 -03:00
7 changed files with 29 additions and 18 deletions

View File

@@ -26,7 +26,7 @@ To use Claude Code, open the Agent Panel and click "New Claude Code Thread" from
https://github.com/user-attachments/assets/ddce66c7-79ac-47a3-ad59-4a6a3ca74903
[Read the docs](https://zed.dev/docs/ai/external-agents) on External Agent support.
Read the docs on [External Agent](https://zed.dev/docs/ai/external-agents) support.
### Other clients

4
package-lock.json generated
View File

@@ -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",

View File

@@ -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",

View File

@@ -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();

View File

@@ -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) {

View File

@@ -216,7 +216,7 @@ describe("tool conversions", () => {
expect(toolInfoFromToolUse(tool_use, {})).toStrictEqual({
kind: "search",
title: "Find */**.ts",
title: "Find `*/**.ts`",
content: [],
locations: [],
});

View File

@@ -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,