mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-11-23 01:31:16 +00:00
Updates `@agentclientprotocol/sdk` from 2.7.0 to 2.8.0 (schema v1.33.0 and v2.0.0-alpha.17), and follows the protocol rules that changed for what the adapter already serves. The adapter compiles and passes against 2.8.0 unchanged. The behavior rules are in the protocol docs, so I read the protocol repo from `schema-v2.0.0-alpha.16` to its current `main`, which is four docs commits past the alpha.17 tag. ## Changes ### `session/fork` refuses a `cursorId` (v1 and v2) `ForkSessionRequest` gained `cursorId` with the session cursors RFD. An Agent must reject a cursor it did not issue with `-32602`, and must not fork the whole session in its place. The adapter sends no `cursor_update`, so it issued no cursor. Before this change it ignored the field and copied the whole session. `forkSession` in `src/fork-session.ts` now fails with `-32602` before it copies anything. Both cores call it. ### No `pattern` in a v2 elicitation form v2 removed `pattern` from string properties. v1 still has it. The adapter builds its own forms without it, but it relays an MCP server's schema as the server sent it. `v2ElicitationRequest` in `src/v2/elicitation.ts` drops `pattern` from the string properties of a form before it goes to a v2 client. Nothing else in the schema changes. The MCP server still gets the answer as the client sent it and checks it against its own schema. ### A replayed child's current state comes before the response (v2) On a `session/resume` with replay, the adapter replays each subagent's end on its parent, then sends the child's current state once more as current. - Until alpha.16, the response separated a replayed child state from a current one. The adapter sent the current states from a timer after the response, because the ACP SDK has no after-response hook. - In alpha.17, a `subagent_update` is an update of the child's parent, so the parent's `replay_complete` is the boundary. A `state_update` on the child's own stream is never replayed. The current states now go out after the root's `replay_complete` and before the state snapshot and the response: - `SubagentReplay.finish` sends each child's replayed end on its parent, then the child's `replay_complete`. It no longer sends a `state_update` on the child's stream. - `SubagentReplay.currentStates` (was `afterResponse`) then sends each child's current state on its parent and on its own stream, with `cwd: null` for a directory that is gone, and the child's configuration when it differs from what the replay sent. - The timer is gone from the v2 core. The v1 core keeps `afterSetupResponse`: on v1 the response is still the boundary. One case changes besides the order. A child that the live session still tracks and whose work has ended used to get no current state on its parent after a replay. It now gets its replayed end there, as a child whose process is gone does. A child that works now still gets its state from the resume snapshot. A v2 client that still reads a child state before the response as history shows such a child without a confirmed state until it follows alpha.17. ### Docs - The README says that `session/prompt` does not use `idempotencyKey` yet, and that `session/fork` refuses a `cursorId`. - `docs/subagent-sessions.md` describes the v2 order. ## Already compliant, checked - `$/cancel_request` for every permission request and elicitation that a cancel withdraws, now a MUST, and for a closed session's descendants. - Tool call status: no update moves a live tool call back to `pending`, and a final status does not change. The `status: null` of `v2RestartedToolCall` only resets a tool call that a replay or a repeated `tool_call` starts again. - A v2 diff always carries one change. - A `systemPrompt` the adapter cannot apply fails with `-32602` and creates no session. - Replay sends terminal output, session messages and compaction summaries whole, so the wider "clear before replaying chunks" rule adds nothing. Message chunks were already cleared. - `tool_call/cancel` and `terminal/cancel`: `-32002` for an unknown session, `-32602` for an item that cannot be cancelled, and a child session's id is accepted. - A request that names a child session fails with `-32602` on v2. - Only the root session reports a cost, and Claude Code's total includes its subagents. - A child's `model` option offers only its current value. - SDK 2.8.0 dispatches a notification that arrived before the peer closed its stream. A late `session/cancel` finds the session closed and does nothing. ## Not covered - `idempotencyKey` on v2 `session/prompt`. It is part of the v2 baseline since alpha.17. The adapter accepts the field and does not use it, so a retry with the same key inserts the message again. The SDK rejects a malformed key with `-32602`. A follow-up PR adds the lookup. - Session cursors (`cursor_update`, forking at a cursor) are a new draft RFD. - The plan operations RFD now says an Agent can send an empty `items` plan before `plan_removed`, for a v2 client without plan operations. I left it out: a client that shows plan updates in its transcript would show an empty plan. - I did not run the integration tests against the real CLI. ## Tests - `fork-session.test.ts`: a `cursorId` fails with `-32602` and no transcript is copied. - `v2.test.ts`: `v2ElicitationRequest` drops `pattern` from string properties only, and passes a URL request as it is. - `acp-v2.test.ts`: the three replay tests now expect the child's current state, its parent's copy and a live child's configuration before the response, and the parent's copy after the root's `replay_complete`. `npm run build`, `npm run check` and `npm run test:run` pass (4327 tests).
93 lines
2.5 KiB
JSON
93 lines
2.5 KiB
JSON
{
|
|
"name": "@agentclientprotocol/claude-agent-acp",
|
|
"publishConfig": {
|
|
"access": "public"
|
|
},
|
|
"version": "0.108.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-agent-acp": "dist/index.js"
|
|
},
|
|
"type": "module",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/lib.d.ts",
|
|
"import": "./dist/lib.js"
|
|
},
|
|
"./package.json": "./package.json"
|
|
},
|
|
"files": [
|
|
"dist/",
|
|
"!dist/tests/",
|
|
"!dist/binary-entry.*",
|
|
"README.md",
|
|
"LICENSE",
|
|
"package.json"
|
|
],
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"build:binary": "node scripts/build-binary.mjs",
|
|
"smoke:binary": "node scripts/smoke-binary.mjs",
|
|
"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": "2.8.0",
|
|
"@anthropic-ai/claude-agent-sdk": "0.3.326",
|
|
"diff": "9.0.0",
|
|
"zod": "4.6.7"
|
|
},
|
|
"devDependencies": {
|
|
"@anthropic-ai/sdk": "1.9.0",
|
|
"@eslint/js": "10.0.1",
|
|
"@tsconfig/node22": "22.0.7",
|
|
"@types/node": "26.6.6",
|
|
"@typescript-eslint/eslint-plugin": "8.73.0",
|
|
"@typescript-eslint/parser": "8.73.0",
|
|
"ajv": "8.20.0",
|
|
"ajv-formats": "3.0.1",
|
|
"eslint": "10.15.0",
|
|
"eslint-config-prettier": "10.1.8",
|
|
"globals": "17.14.0",
|
|
"prettier": "3.10.1",
|
|
"typescript": "6.0.3",
|
|
"vitest": "5.1.0"
|
|
}
|
|
}
|