mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-11-18 07:11:20 +00:00
Updates `@agentclientprotocol/sdk` from 2.6.0 to 2.7.0 (schema v1.32.0 and v2.0.0-alpha.16), and follows the two protocol changes that affect what the adapter already serves. The SDK's runtime is unchanged apart from an SSE BOM fix. The rest of the release is schema and doc comments, so I read the protocol docs and RFDs between the two schema tags for behavior changes. ## Changes ### `configOptions` on `session/fork` (v1 and v2) `ForkSessionRequest` now has `configOptions`, and clients may send it to an agent that advertises `options`. The adapter advertises `fork` and `options`, so both cores accept it: - Two entries with the same `configId` fail with `-32602` before the transcript is copied. On v2, so does a value type that `session/set_config_option` does not take. - The entries are set on the started fork, in list order, over what the copy starts with. An entry that the session refuses is skipped, as on `session/new`. - No update goes out for them. The response carries the options. This was the only compile break: `v1ForkSessionRequest` passed the v2 entries on to the v1 request. ### `replay_complete` on v2 v2 now requires a `replay_complete` update after the history replay of a `session/resume` with `replayFrom`, and allows only replayed history between the request and that update. - The adapter sends it on the resumed session after the last replayed update, also for an empty history. It does not send it without `replayFrom`, or when the resume fails. - Each subagent session that the replay announces gets its own `replay_complete`, also one without history. - A replayed child's `state_update` now follows the child's `replay_complete`, and the notice that subagent history is missing follows the root's. Neither is history. - AIR's `loadReplayEnd` update is still sent to a v2 client that declares it, right after `replay_complete`. ### Holding live updates during a replay (new mechanism) From the request to `replay_complete`, a session can only send its replay. An active session keeps working while it is resumed, and a session that starts sends its first updates while the transcript is read. So the adapter needs a place to hold them. No existing mechanism did this. `src/v2/replay-hold.ts` holds every update of the session and of its subagent sessions that is not the replay, and their permission requests and elicitations, and sends them after `replay_complete` in the order they were sent. `V2Agent.send` is the one place where v2 session updates leave the agent, so the hold sits there. The replay runs in one synchronous step, so what a session sends during that step is its replay. Nothing else tells the two apart. The comment in the module says so. A resume of an active session now reads the transcript before its other steps, so the history ends as close to the request as it can. ## Already compliant, checked - Initial config values: no notice or mode update before the setup response, and a value that Claude Code refuses is skipped. - `auth/logout` is idempotent, because `claude auth logout` is. - A `tool_call/cancel` or `terminal/cancel` sent again after the item ended gets `-32602`. - The subagent clarifications: no assumed `senderSessionId`, session references sent again with new tool call content, and `unknown` for a child that can no longer be observed. - `thought_level` values go from lowest to highest. This rests on Claude Code's order, which a comment now says. ## Not covered - An active session that streams while it is resumed with a replay: if Claude Code writes a block to the transcript during the few milliseconds of the read, the held chunks of that block reach the client twice. I found no cheap way to close that window. - The new RFD features are left for separate PRs: the `speed` config category for Fast mode, `prompt_suggestions_update`, v2 skills, and `path` on markdown plans (the `file` plan type is gone, and the adapter never sent it). - I did not run the integration tests against the real CLI. ## Tests - `create-session-options.test.ts` (v1) and `v2.test.ts` (v2): a fork sets its `configOptions`, and rejects duplicates before the copy. - `v2.test.ts`: `replay_complete` for an empty history and none without `replayFrom`. What an active session sends during a replay goes out after `replay_complete`, a permission request too, and goes out without one when the replay fails. The same for a live subagent's session. - The existing replay tests and the `session-load-replay` golden file now include `replay_complete`. `npm run build`, `npm run check` and `npm run test:run` pass (4142 tests).