mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-27 12:40:32 +00:00
Claude Code -> Claude Agent (#319)
Update based on https://platform.claude.com/docs/en/agent-sdk/overview#branding-guidelines
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 0.17.0
|
||||
|
||||
Rename from `@zed-industries/claude-code-acp` to `@zed-industries/claude-agent-acp` to align with the current [branding guidelines](https://platform.claude.com/docs/en/agent-sdk/overview#branding-guidelines)
|
||||
|
||||
## 0.16.2
|
||||
|
||||
- Update to @anthropic-ai/claude-agent-sdk@0.2.44
|
||||
|
||||
14
README.md
14
README.md
@@ -1,8 +1,8 @@
|
||||
# ACP adapter for Claude Code
|
||||
# ACP adapter for the Claude Agent SDK
|
||||
|
||||
[](https://www.npmjs.com/package/@zed-industries/claude-code-acp)
|
||||
[](https://www.npmjs.com/package/@zed-industries/claude-agent-acp)
|
||||
|
||||
Use [Claude Code](https://www.anthropic.com/claude-code) from [ACP-compatible](https://agentclientprotocol.com) clients such as [Zed](https://zed.dev)!
|
||||
Use [Claude Agent SDK](https://platform.claude.com/docs/en/agent-sdk/overview#branding-guidelines) from [ACP-compatible](https://agentclientprotocol.com) clients such as [Zed](https://zed.dev)!
|
||||
|
||||
This tool implements an ACP agent by using the official [Claude Agent SDK](https://platform.claude.com/docs/en/agent-sdk/overview), supporting:
|
||||
|
||||
@@ -24,7 +24,7 @@ Learn more about the [Agent Client Protocol](https://agentclientprotocol.com/).
|
||||
|
||||
The latest version of Zed can already use this adapter out of the box.
|
||||
|
||||
To use Claude Code, open the Agent Panel and click "New Claude Code Thread" from the `+` button menu in the top-right:
|
||||
To use Claude Agent, open the Agent Panel and click "New Claude Agent Thread" from the `+` button menu in the top-right:
|
||||
|
||||
https://github.com/user-attachments/assets/ddce66c7-79ac-47a3-ad59-4a6a3ca74903
|
||||
|
||||
@@ -39,13 +39,13 @@ Or try it with any of the other [ACP compatible clients](https://agentclientprot
|
||||
Install the adapter from `npm`:
|
||||
|
||||
```bash
|
||||
npm install -g @zed-industries/claude-code-acp
|
||||
npm install -g @zed-industries/claude-agent-acp
|
||||
```
|
||||
|
||||
You can then use `claude-code-acp` as a regular ACP agent:
|
||||
You can then use `claude-agent-acp` as a regular ACP agent:
|
||||
|
||||
```
|
||||
ANTHROPIC_API_KEY=sk-... claude-code-acp
|
||||
ANTHROPIC_API_KEY=sk-... claude-agent-acp
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zed-industries/claude-code-acp",
|
||||
"version": "0.16.2",
|
||||
"name": "@zed-industries/claude-agent-acp",
|
||||
"version": "0.17.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
14
package.json
14
package.json
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "@zed-industries/claude-code-acp",
|
||||
"name": "@zed-industries/claude-agent-acp",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "0.16.2",
|
||||
"description": "An ACP-compatible coding agent powered by the Claude Code SDK (TypeScript)",
|
||||
"version": "0.17.0",
|
||||
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
|
||||
"main": "dist/lib.js",
|
||||
"types": "dist/lib.d.ts",
|
||||
"bin": {
|
||||
"claude-code-acp": "./dist/index.js"
|
||||
"claude-agent-acp": "./dist/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
@@ -49,13 +49,13 @@
|
||||
"sdk",
|
||||
"code"
|
||||
],
|
||||
"homepage": "https://github.com/zed-industries/claude-code-acp#readme",
|
||||
"homepage": "https://github.com/zed-industries/claude-agent-acp#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zed-industries/claude-code-acp/issues"
|
||||
"url": "https://github.com/zed-industries/claude-agent-acp/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zed-industries/claude-code-acp.git"
|
||||
"url": "git+https://github.com/zed-industries/claude-agent-acp.git"
|
||||
},
|
||||
"author": "Zed Industries",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -136,7 +136,7 @@ type BackgroundTerminal =
|
||||
};
|
||||
|
||||
/**
|
||||
* Extra metadata that can be given to Claude Code when creating a new session.
|
||||
* Extra metadata that can be given when creating a new session.
|
||||
*/
|
||||
export type NewSessionMeta = {
|
||||
claudeCode?: {
|
||||
@@ -207,7 +207,7 @@ export class ClaudeAcpAgent implements Agent {
|
||||
// Default authMethod
|
||||
const authMethod: any = {
|
||||
description: "Run `claude /login` in the terminal",
|
||||
name: "Log in with Claude Code",
|
||||
name: "Log in with Claude",
|
||||
id: "claude-login",
|
||||
};
|
||||
|
||||
@@ -219,7 +219,7 @@ export class ClaudeAcpAgent implements Agent {
|
||||
"terminal-auth": {
|
||||
command: "node",
|
||||
args: [cliPath],
|
||||
label: "Claude Code Login",
|
||||
label: "Claude Login",
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -244,7 +244,7 @@ export class ClaudeAcpAgent implements Agent {
|
||||
},
|
||||
agentInfo: {
|
||||
name: packageJson.name,
|
||||
title: "Claude Code",
|
||||
title: "Claude Agent",
|
||||
version: packageJson.version,
|
||||
},
|
||||
authMethods: [authMethod],
|
||||
@@ -1511,7 +1511,7 @@ export function toAcpNotifications(
|
||||
});
|
||||
} else {
|
||||
logger.error(
|
||||
`[claude-code-acp] Got a tool response for tool use that wasn't tracked: ${toolUseId}`,
|
||||
`[claude-agent-acp] Got a tool response for tool use that wasn't tracked: ${toolUseId}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -1551,7 +1551,7 @@ export function toAcpNotifications(
|
||||
const toolUse = toolUseCache[chunk.tool_use_id];
|
||||
if (!toolUse) {
|
||||
logger.error(
|
||||
`[claude-code-acp] Got a tool result for tool use that wasn't tracked: ${chunk.tool_use_id}`,
|
||||
`[claude-agent-acp] Got a tool result for tool use that wasn't tracked: ${chunk.tool_use_id}`,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -325,13 +325,13 @@ describe("tool conversions", () => {
|
||||
id: "toolu_01EEqsX7Eb9hpx87KAHVPTey",
|
||||
name: "LS",
|
||||
input: {
|
||||
path: "/Users/test/github/claude-code-acp",
|
||||
path: "/Users/test/github/claude-agent-acp",
|
||||
},
|
||||
};
|
||||
|
||||
expect(toolInfoFromToolUse(tool_use)).toStrictEqual({
|
||||
kind: "search",
|
||||
title: "List the `/Users/test/github/claude-code-acp` directory's contents",
|
||||
title: "List the `/Users/test/github/claude-agent-acp` directory's contents",
|
||||
content: [],
|
||||
locations: [],
|
||||
});
|
||||
|
||||
@@ -241,7 +241,7 @@ describe("unstable_listSessions", () => {
|
||||
});
|
||||
|
||||
it("returns the true cwd for paths containing hyphens", async () => {
|
||||
const cwd = "/Users/test/claude-code-acp";
|
||||
const cwd = "/Users/test/claude-agent-acp";
|
||||
writeSessionFile(cwd, "hyphen-session", { userMessage: "Hyphen test" });
|
||||
|
||||
const result = await agent.unstable_listSessions({});
|
||||
@@ -252,14 +252,14 @@ describe("unstable_listSessions", () => {
|
||||
});
|
||||
|
||||
it("filters hyphenated paths by cwd correctly", async () => {
|
||||
writeSessionFile("/Users/test/claude-code-acp", "hyphen-a", { userMessage: "A" });
|
||||
writeSessionFile("/Users/test/claude-agent-acp", "hyphen-a", { userMessage: "A" });
|
||||
writeSessionFile("/Users/test/other-project", "hyphen-b", { userMessage: "B" });
|
||||
|
||||
const result = await agent.unstable_listSessions({ cwd: "/Users/test/claude-code-acp" });
|
||||
const result = await agent.unstable_listSessions({ cwd: "/Users/test/claude-agent-acp" });
|
||||
|
||||
expect(result.sessions).toHaveLength(1);
|
||||
expect(result.sessions[0]!.sessionId).toBe("hyphen-a");
|
||||
expect(result.sessions[0]!.cwd).toBe("/Users/test/claude-code-acp");
|
||||
expect(result.sessions[0]!.cwd).toBe("/Users/test/claude-agent-acp");
|
||||
});
|
||||
|
||||
it("returns all sessions when cwd is not specified", async () => {
|
||||
|
||||
@@ -180,7 +180,7 @@ import {
|
||||
toolUpdateFromToolResult,
|
||||
createPreToolUseHook,
|
||||
toolNames,
|
||||
} from "@zed-industries/claude-code-acp";
|
||||
} from "@zed-industries/claude-agent-acp";
|
||||
|
||||
// Type-only imports
|
||||
import type {
|
||||
@@ -192,7 +192,7 @@ import type {
|
||||
PermissionCheckResult,
|
||||
SettingsManagerOptions,
|
||||
ClaudePlanEntry,
|
||||
} from "@zed-industries/claude-code-acp";
|
||||
} from "@zed-industries/claude-agent-acp";
|
||||
|
||||
// Verify exports exist and have expected types
|
||||
const _runAcp: typeof runAcp = runAcp;
|
||||
@@ -222,13 +222,13 @@ import {
|
||||
ACP_TOOL_NAME_PREFIX,
|
||||
toolInfoFromToolUse,
|
||||
planEntries,
|
||||
} from "@zed-industries/claude-code-acp/dist/tools.js";
|
||||
} from "@zed-industries/claude-agent-acp/dist/tools.js";
|
||||
|
||||
// Deep import from dist/settings.js
|
||||
import {
|
||||
SettingsManager,
|
||||
getManagedSettingsPath,
|
||||
} from "@zed-industries/claude-code-acp/dist/settings.js";
|
||||
} from "@zed-industries/claude-agent-acp/dist/settings.js";
|
||||
|
||||
// Deep import from dist/utils.js
|
||||
import {
|
||||
@@ -236,7 +236,7 @@ import {
|
||||
nodeToWebReadable,
|
||||
nodeToWebWritable,
|
||||
loadManagedSettings,
|
||||
} from "@zed-industries/claude-code-acp/dist/utils.js";
|
||||
} from "@zed-industries/claude-agent-acp/dist/utils.js";
|
||||
|
||||
// Verify types work
|
||||
const prefix: string = ACP_TOOL_NAME_PREFIX;
|
||||
@@ -263,7 +263,7 @@ import {
|
||||
ClaudeCodeSettings,
|
||||
PermissionCheckResult,
|
||||
SettingsManagerOptions
|
||||
} from "@zed-industries/claude-code-acp";
|
||||
} from "@zed-industries/claude-agent-acp";
|
||||
|
||||
// Test constructor signature
|
||||
const options: SettingsManagerOptions = {
|
||||
@@ -318,7 +318,7 @@ async function testMethods() {
|
||||
await writeTestFile(
|
||||
"test-claude-acp-agent.ts",
|
||||
`
|
||||
import { ClaudeAcpAgent } from "@zed-industries/claude-code-acp";
|
||||
import { ClaudeAcpAgent } from "@zed-industries/claude-agent-acp";
|
||||
import type { AgentSideConnection } from "@agentclientprotocol/sdk";
|
||||
|
||||
// ClaudeAcpAgent should be a class that can be instantiated
|
||||
@@ -362,7 +362,7 @@ import type {
|
||||
ClaudePlanEntry,
|
||||
ToolUpdateMeta,
|
||||
NewSessionMeta,
|
||||
} from "@zed-industries/claude-code-acp";
|
||||
} from "@zed-industries/claude-agent-acp";
|
||||
|
||||
// Test ClaudeCodeSettings shape
|
||||
const settings: ClaudeCodeSettings = {
|
||||
@@ -441,9 +441,9 @@ import {
|
||||
loadManagedSettings,
|
||||
applyEnvironmentSettings,
|
||||
SettingsManager,
|
||||
} from "@zed-industries/claude-code-acp";
|
||||
} from "@zed-industries/claude-agent-acp";
|
||||
|
||||
import type { ClaudeCodeSettings } from "@zed-industries/claude-code-acp";
|
||||
import type { ClaudeCodeSettings } from "@zed-industries/claude-agent-acp";
|
||||
|
||||
// runAcp should be a function with no parameters that returns void
|
||||
const runAcpType: () => void = runAcp;
|
||||
@@ -488,7 +488,7 @@ const applyResult: void = applyEnvironmentSettings({ permissions: {} });
|
||||
await writeTestFile(
|
||||
"test-pushable.ts",
|
||||
`
|
||||
import { Pushable } from "@zed-industries/claude-code-acp";
|
||||
import { Pushable } from "@zed-industries/claude-agent-acp";
|
||||
|
||||
// Pushable should be a generic class
|
||||
const pushable = new Pushable<string>();
|
||||
@@ -530,7 +530,7 @@ customPushable.push({ id: 1, name: "test" });
|
||||
await writeTestFile(
|
||||
"test-invalid-types.ts",
|
||||
`
|
||||
import { SettingsManager, ClaudeCodeSettings } from "@zed-industries/claude-code-acp";
|
||||
import { SettingsManager, ClaudeCodeSettings } from "@zed-industries/claude-agent-acp";
|
||||
|
||||
// This should fail - SettingsManager constructor requires string cwd
|
||||
// @ts-expect-error - Testing that wrong argument type fails
|
||||
|
||||
Reference in New Issue
Block a user