mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-27 12:40:32 +00:00
Step 2 of opt-in ACP v2 support (step 1: #1217). Behind `CLAUDE_AGENT_ACP_EXPERIMENTAL_V2=1`, the v2 surface now serves `session/new`, `session/list`, `session/resume` (without replay), `session/close`, `session/delete`, and `session/set_config_option`. ACP v1 is unchanged. `capabilities.session` is still not advertised. Under v2, advertising it commits the agent to the whole baseline, including `session/prompt` and `replayFrom: start` replay, and those come in later steps. Until then these methods are served but not advertised. ## Translation As in step 1, each v2 request becomes the v1 request that `ClaudeAcpAgent` already serves, and each v1 response or update becomes its v2 form (`src/v2/session.ts`, `src/v2/session-update.ts`): - **MCP servers:** v2 requires a `type` on every transport, but the agent recognizes a v1 stdio server by its *missing* `type`. A v2 `type: "stdio"` config passed through as is would be silently skipped, so the tag is dropped. The lists v1 requires (`args`, `env`, `headers`) are defaulted. A transport v1 can't express is rejected with invalid params instead of being left out of the session. - **Config options:** `id` → `configId`, a select group's `group` → `groupId`. A select value in `session/set_config_option` drops its v2 `type: "id"`, and value types v1 can't express are rejected. - **Modes:** responses drop `modes`, and `current_mode_update` is dropped. The agent always lists the mode as the `mode` config option, and every mode change also reaches the client as a `config_option_update` or in the `set_config_option` response. - **Commands:** `available_commands_update` inputs gain `type: "text"`. - **Notices, session info, usage:** passed through unchanged. v2 needs no capability for notices, so a v2 client is reported to the agent as taking them, and advisories arrive as `notice` instead of transcript messages. - **Elicitation:** the same in v1 and v2, so it's forwarded. MCP OAuth at `session/new` works. - Update kinds that aren't translated yet (messages, tool calls, plans, extensions) throw, so a gap shows up as an error, not a missing update. - `replayFrom` is rejected until replayed history can be translated. Also bumps `@agentclientprotocol/sdk`: - to 1.6.1, whose router types `closed` as always present, so `serveAcp` drops its `closed!`; - to 1.7.0, which type-checks the v2 extensible-union values the adapter builds, at any depth ([typescript-sdk#268](https://github.com/agentclientprotocol/typescript-sdk/pull/268)). The v2 translations compile unchanged. The exception is `createElicitation`, which relays the v1 request: v1 types a property schema's tag as any string, and an MCP server's schema passes through unchecked, as on v1. It gets a cast with a comment saying so. ## Testing - `src/tests/acp-v2.test.ts` drives the router with the SDK's v2 client app, which validates every response, session update, and elicitation against the v2 schema. New cases cover session creation with v2 MCP servers, config options, and commands; rejected MCP transports; list/close/resume/delete and rejected `replayFrom`; setting the mode with no `current_mode_update` reaching the client; notice support; MCP OAuth through URL elicitation; and unit tests for grouped options, rejected value types, and untranslated updates. Breaking the stdio or command-input translation makes the tests fail. - Ran the built binary over stdio against a real Claude Code session: v2 `initialize`, `session/new`, `list`, setting the mode, and `close` all passed the v2 client's validation, and the 52 real commands arrived with `type: "text"` inputs. `session/new` took ~0.7 s, the same as over v1. - `npm run build`, `npm run check`, `npm run test:run`.
91 lines
2.4 KiB
JSON
91 lines
2.4 KiB
JSON
{
|
|
"name": "@agentclientprotocol/claude-agent-acp",
|
|
"publishConfig": {
|
|
"access": "public"
|
|
},
|
|
"version": "0.85.1",
|
|
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
|
|
"main": "dist/lib.js",
|
|
"types": "dist/lib.d.ts",
|
|
"bin": {
|
|
"claude-agent-acp": "dist/index.js"
|
|
},
|
|
"type": "module",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/lib.d.ts",
|
|
"import": "./dist/lib.js"
|
|
},
|
|
"./*": "./*"
|
|
},
|
|
"files": [
|
|
"dist/",
|
|
"!dist/tests/",
|
|
"README.md",
|
|
"LICENSE",
|
|
"package.json"
|
|
],
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"start": "node dist/index.js",
|
|
"dev": "npm run build && npm run start",
|
|
"example:simple-client": "node --experimental-strip-types --disable-warning=ExperimentalWarning examples/simple-client.ts",
|
|
"lint": "eslint src --ext .ts",
|
|
"lint:fix": "eslint src --ext .ts --fix",
|
|
"format": "prettier --write .",
|
|
"format:check": "prettier --check .",
|
|
"check": "npm run lint && npm run format:check",
|
|
"release:preflight": "bash scripts/release-preflight.sh",
|
|
"test": "vitest",
|
|
"test:integration": "RUN_INTEGRATION_TESTS=true vitest run",
|
|
"test:run": "vitest run",
|
|
"test:coverage": "vitest run --coverage",
|
|
"prepublishOnly": "npm run build"
|
|
},
|
|
"keywords": [
|
|
"claude",
|
|
"acp",
|
|
"agent",
|
|
"anthropic",
|
|
"typescript",
|
|
"sdk",
|
|
"code"
|
|
],
|
|
"homepage": "https://github.com/agentclientprotocol/claude-agent-acp#readme",
|
|
"bugs": {
|
|
"url": "https://github.com/agentclientprotocol/claude-agent-acp/issues"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/agentclientprotocol/claude-agent-acp.git"
|
|
},
|
|
"author": "Zed Industries",
|
|
"license": "Apache-2.0",
|
|
"engines": {
|
|
"node": ">=22"
|
|
},
|
|
"dependencies": {
|
|
"@agentclientprotocol/sdk": "1.7.0",
|
|
"@anthropic-ai/claude-agent-sdk": "0.3.286",
|
|
"diff": "9.0.0",
|
|
"zod": "4.6.5"
|
|
},
|
|
"devDependencies": {
|
|
"@anthropic-ai/sdk": "0.131.0",
|
|
"@eslint/js": "10.0.1",
|
|
"@tsconfig/node22": "22.0.6",
|
|
"@types/node": "26.6.3",
|
|
"@typescript-eslint/eslint-plugin": "8.71.0",
|
|
"@typescript-eslint/parser": "8.71.0",
|
|
"ajv": "8.20.0",
|
|
"ajv-formats": "3.0.1",
|
|
"eslint": "10.11.0",
|
|
"eslint-config-prettier": "10.1.8",
|
|
"globals": "17.13.0",
|
|
"prettier": "3.9.9",
|
|
"ts-node": "10.9.2",
|
|
"typescript": "6.0.3",
|
|
"vitest": "5.0.3"
|
|
}
|
|
}
|