ACP v2 added an optional `idempotencyKey` to `session/prompt`, which every
agent that advertises `capabilities.session` must support. A client that
lost a prompt's response sends the prompt again with the same key, and the
agent must not insert the message twice. The adapter accepted the field and
ignored it.
`src/v2/prompt-keys.ts` keeps the keys of each session's prompts:
- A retry of a prompt that is not answered yet gets that prompt's outcome.
- A retry of an inserted prompt gets its `messageId`. Neither goes to
Claude Code again.
- A prompt that failed leaves its key unused.
The key is stored as the message's id. A keyed prompt goes to Claude Code
with a uuid that is a hash of the session id and the key, with the attempt
number in its last four hex digits. Claude Code keeps that uuid in the
transcript, so a key is known for as long as its message is stored, across
connections and restarts, and no update shows the key. The first keyed
prompt after a resume reads the stored history once to look its key up.
Each attempt has its own uuid because Claude Code ignores a prompt whose
uuid it has seen, and a prompt that `session/cancel` answered with -32800
may have reached it.
The agent keeps the record of a session from its start to `session/close`
or the end of the connection, across restarts of the session's query, so a
message that Claude Code does not store, such as a local command's, keeps
its key for that long.
On v1, a client's request that names a subagent's child session now
fails with `-32602` (Invalid params), as it already does on v2.
## Why
The subagents RFD changed on 2026-11-17: an Agent SHOULD reject a
client's request that is not permitted for a child session with
`-32602`, in both protocol versions. `session/close` and
`session/delete` are included, and do not report success for a child. A
child that the Agent announced is not an unknown session.
`session/cancel` is the one message that can name a child.
The v1 core treated a child's id as an unknown session:
| Request | Before | Now |
| --- | --- | --- |
| `session/prompt`, `session/load`, `session/resume`, `session/fork`,
`session/set_mode`, `session/set_config_option` | `-32002` | `-32602` |
| `session/close`, `session/delete` | success | `-32602` |
| `session/set_title`, `session/status`, `session/options` | handled as
a session without a transcript | `-32602` |
`session/cancel` of a child still stops the child.
## How
- `NativeSubagentRuntime.hasChild` tells whether a session id is a child
that the runtime announced in the RFD form. `cancelChild` now uses the
same lookup. AIR's earlier draft of the RFD keeps its own rules, so the
check is false there.
- `ClaudeAcpAgent.assertNoChildSession` asks the runtime of each session
of the connection.
- `v1AgentApp` wraps each request that names a session in
`ofRootSession`, so all of them get the same check before their handler
runs. The wrapper is not `async`. It returns the handler's promise as it
is, so a setup response keeps its place before the timer of
`afterSetupResponse`.
- `restrictedChild`, the error that the v2 core already threw, moves
from `src/v2/tasks.ts` to `src/acp-subagents.ts`, which both cores
share.
## Not covered
- A child that only a `session/load` replay announced, and whose agent
did not run again on this connection, is still an unknown session
(`-32002`). The check covers the children of a running session. The v2
core has the same limit.
- The adapter's own extension requests (steer, async task stop, goal)
are unchanged.
## Tests
- `acp-agent.test.ts`: each of the eleven requests, sent through the
protocol router with a child's id, fails with `-32602` and names the
child in `data.sessionId`.
- `native-subagents.test.ts`: `hasChild` is true for an announced child,
and false for the root, for an unknown id and in AIR's draft.
`npm run build`, `npm run check` and `npm run test:run` pass (4335
tests). This branch and #1655 merge without conflicts.
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).
Fixes#1527.
A v1 client that declares `clientCapabilities.subagents` and is not AIR
gets the RFD form of subagent sessions, but still got the prompt hold of
#864/#866: `session/prompt` stayed open until the turn's background
subagents ended. The RFD has the client keep receiving child events
after the parent's prompt response, so the reason for the hold doesn't
apply to it.
`endsTurnsWithLiveSubagents` now also returns true for
`subagentForm(...) === "rfd"`. The rest is the existing no-hold path
that AIR's `backgroundSubagents` uses: the turn ends at its result, and
the subagent's updates and requests go out after the response, with the
same routing. A client that declares neither keeps the hold.
What else changes for an RFD client: the parent's summary when a child
ends used to arrive inside the held turn. It now comes from a followup
cycle out of a turn. Its result ends no turn, and a plan approval that
cycle asks for has no clear-context option, as for AIR.
Tests: the no-hold blocks of "deferred settlement for live background
subagents" run for both clients, except the streamed-tool-input test,
whose fixture has no Agent call that the RFD form could expose the child
from. The RFD test of a background child's tool call closing after a
cancel expects `end_turn` at the result and the cancel while no prompt
runs. `docs/subagent-sessions.md` and `docs/air-extensions.md` say which
clients get the hold.
---------
Co-authored-by: Andrey Bragin <andrey.bragin@jetbrains.com>
## Summary
An MCP server that the client declares with `"type": "acp"` can no
longer fail session setup. The session starts without the server and the
user gets the usual "failed to start" warning.
This comes out of #1651. It does not make the server of that issue
connect (see "Not fixed here").
## What was failing
The adapter serves an `acp` server to Claude Code through a listener on
`127.0.0.1` (`McpOverAcp`, #1645). When that listener could not open,
for example `listen EPERM` where the process may not open a socket,
`session/new` failed with `-32603`:
> Could not open the local endpoint that serves MCP server tools to
Claude Code: listen EPERM: operation not permitted 127.0.0.1. Start the
session without the server, or try again.
A session starts without any other MCP server that does not connect (a
stdio command that is missing, an HTTP server that is down). The `acp`
case was the only one that ended setup.
## What changes
- **`sdkMcpServers`** (`src/mcp-servers.ts`) returns `{ configs,
unserved }`. An `acp` server that gets no endpoint is in `unserved` with
the error, and the other servers keep their configs.
- **Both cores report it** through the existing notice of a client
server that did not start (`mcpServerStartupNotice`), once per server,
on the first turn. On v1 that is `reportMcpServerStartupFailures`, on v2
`SessionReports.mcpStartupFailures`. A resume of the active session on
v2 (`setMcpServers`) reports it the same way.
- **The notice has the error.** Claude Code was never given the server,
so `/mcp` does not list it and "Run /mcp for the error" would lead
nowhere:
> **MCP server "tools" failed to start:** Its tools are unavailable in
this session. The adapter could not open the local endpoint that serves
it to Claude Code (listen EPERM: operation not permitted 127.0.0.1). A
new session tries again.
- The adapter also logs the server and the error at setup.
A later session, or a restart of the session's query, tries to open the
listener again.
## Not fixed here
In #1651 the server is listed as failed because Claude Code sends
`initialize` first and the endpoint accepts MCP 2026-07-28 requests
only. That is unchanged.
Setup did not fail in that case before this PR either. Checked through
the built adapter with Claude Code 2.1.326, without a model turn:
| Case | `session/new` | The server |
| --- | --- | --- |
| Claude Code as it starts by default | succeeds | connects
(`server/discover`, then `tools/list`) |
| `MCP_PROTOCOL_NEGOTIATION=legacy` (Claude Code sends `initialize`) |
succeeds | failed, with the warning |
| The client rejects `server/discover` | succeeds | failed, with the
warning |
| The client never answers `mcp/message` | succeeds | not connected |
| The listener cannot open, before this PR | fails with `-32603` | |
| The listener cannot open, with this PR | succeeds | left out, with the
warning above |
For the last two rows the adapter ran with a preload that makes
`http.Server.prototype.listen` fail.
## Testing
- `npm run check`, `npm run build`, `npm run test:run` (4,314 tests
pass)
- New tests: `sdkMcpServers` with an endpoint that rejects,
`session/new` on v1, the notice on v1, and on v2 both `session/new` and
a resume of the active session
- The live cases in the table above
Refs #1651
## Problem
Claude Code gives up on a reply that stays silent past its stream idle
timeout (5 minutes off Anthropic's API, for example on Bedrock or behind
a gateway), then asks again. If that reply had made a server tool call,
such as the advisor's, the call never gets a result:
- **v1:** the tool call stayed open until the turn ended. Because the
complete assistant message had dispatched it, the turn then failed with
`incomplete_tool_call`, even though Claude Code went on and finished the
work.
- **v2:** the tool call stayed open after the next reply started, and
ended `cancelled` only at the idle.
## Change
- `UnansweredServerToolCalls` (`src/tool-calls/server-tool-calls.ts`)
finds the server tool calls that will never get a result. It tracks each
conversation on its own: the main one, and each subagent's.
- The API puts a server tool's result in Claude's reply: right after the
call or, if the reply ended first (after a client `tool_use`, or at
`pause_turn`), at the start of the next reply. So once a later reply
starts with any other block, the calls still waiting will get no result,
and they close as `retracted`, as the calls of a message Claude Code
took back do: Claude Code replaced the response that made them, and they
may have run. They end `failed` on v1 and `cancelled` on v2.
- Both cores call it from the same two places:
- **Streamed block:** the calls close after that block's own updates, so
a client sees the next step start first.
- **Consolidated message:** matched by its message id, which covers a
retry that did not stream (Claude Code's non-streaming fallback). The
calls close before the message renders.
- On v1 the close carries `_meta.claudeCode.parentToolUseId` for a
subagent's call, as the call's other updates do.
- A server tool call that the turn's last reply leaves without a result
still fails a v1 turn, as before.
## Tests
- `server-tool-calls.test.ts`: unit tests for
`UnansweredServerToolCalls`.
- `v1/incomplete-tools.test.ts`:
- A cut-off advisor call closes once the next reply starts, and the turn
ends with `end_turn`. The close comes after the next reply's tool call
reaches the client and before its text.
- A cut-off advisor call closes when the retry does not stream, by the
consolidated message's id.
- A subagent's cut-off advisor call closes with its `parentToolUseId`.
- A call left pending is answered at the start of the next reply and is
not closed.
- `v2/acp-v2.test.ts`: a cut-off advisor call ends `cancelled` before
the next reply's text, for a retry that streams and one that does not.
- I disabled each change in turn (the consolidated path, the parent
stamp, the close after the block's updates, and each v2 call site), and
its test failed every time.
- `npm run test:run`: 4206 passed. `npm run build` and `npm run check`
are clean.
When a `providers/set` gateway lists none of the allowed models Claude
Code reports, session setup fails with an actionable standard ACP error
before any prompt reaches the provider. The shared
`narrowToGatewayModels` function now owns this check for both ACP
versions. Empty catalogs, model rows without a resolved identity, and
providers without model discovery retain their existing behavior.
Open sessions also fail if they cannot restart under the new provider:
v1 drops the session and reports a session failure to clients with the
AIR capability; v2 preserves the error code and data and tells the
client to fix the cause and then resume the session. Setting a
compatible provider alone does not revive a stopped v2 session. Other
standard restart errors, including authentication failures, also keep
their details and the resume instruction; unknown restart failures
retain the generic recovery message.
Validation: 671 focused tests passed (3 skipped), TypeScript build and
lint/format checks passed. Independent review accepted the exact commit
and separately passed all 206 directly affected tests. The restart
regression fails on the unchanged production code and passes with the
fix. Tests cover a prompt after restoring a compatible provider but
before resuming, preservation of authentication-error code/data,
incompatible listings and cleanup in both protocols, and empty,
alias-only, and mixed model catalogs. These checks use a fake SDK and
gateway with an isolated Claude config directory; the full suite,
installed Air, and a live provider were not exercised in this revision.
---------
Co-authored-by: Codex <codex@openai.com>
## Summary
The adapter now sends a session's MCP servers to Claude Code over stdin,
not on its command line. A server's `env` and `headers` were readable
there by other users of the machine (`ps`). That includes the bearer
token of the local endpoint that serves an MCP-over-ACP server (#1645).
This uses the `mcpServersDelivery` option of SDK 0.3.326. It is stacked
on #1646, which updates the SDK and sets the option to `'argv'`. Merge
#1646 first.
## What changes
`mcpServersDelivery()` in `src/claude-cli.ts` picks the delivery, next
to `claudeCliPath()`, because it depends on which CLI is started:
- **The CLI that the adapter ships** (next to the executable, or the
SDK's platform package) gets the servers in the SDK's initialize
request: `'initialize'`. The SDK starts it with `--await-initialize` and
without `--mcp-config`.
- **A CLI that `CLAUDE_CODE_EXECUTABLE` names** gets them in the
`--mcp-config` flag as before: `'argv'`. Its version is not known, and
the SDK ends the session at startup when the CLI cannot read the servers
from the initialize request. For such a CLI nothing changes, and the
README says so.
Both cores set the value before the client's options, so a client's
`_meta.claudeCode.options.mcpServersDelivery` still wins. A session
without MCP servers starts as before: the SDK adds `--await-initialize`
only when it has servers to send.
## Why `CLAUDE_CODE_EXECUTABLE` keeps `'argv'` for now
Reading the servers from the initialize request needs Claude Code
2.1.326, which came out on 2026-11-16. The `stable` channel of Claude
Code is at 2.1.311. With `'initialize'` for every CLI, a session with an
MCP server would fail for each user whose `CLAUDE_CODE_EXECUTABLE` CLI
is older. Checked with 2.1.323 through the adapter: `session/new` fails
with `-32603` and "This Claude Code (version 2.1.323) is too old to read
MCP servers from the initialize request".
The plan is to drop the `'argv'` case once the `stable` channel is at
2.1.326 or newer, with an error that names `CLAUDE_CODE_EXECUTABLE`.
## Checked against the real CLI
Through the built adapter, with a stdio server that has a secret in its
`env` and an HTTP server with a secret `Authorization` header, and
without a prompt:
| | The adapter's CLI | `CLAUDE_CODE_EXECUTABLE` |
| --- | --- | --- |
| Launch flag | `--await-initialize` | `--mcp-config` |
| Secret on a command line (`ps`) | no | yes, as before |
| stdio server connects and gets its `env` | yes | yes |
This holds on v1 (a probe that is not part of this PR) and on v2. On v2
the MCP-over-ACP integration test now also checks that no command line
of the adapter's processes holds the endpoint's bearer token. With
`CLAUDE_CODE_EXECUTABLE` set, that check finds the token, so the test
skips it there.
With the SDK alone, under `'initialize'`:
- A resumed session (`--resume`) gets its servers: `mcp_servers_applied`
is true and the server connects.
- A startup failure still rejects with its reason: an invalid
`HTTPS_PROXY` gives `startupFailureReason: "proxy_invalid"` and the same
message as under `'argv'`.
## Notes for review
- **One difference that the SDK documents:** a Claude Code process that
the session's own process starts is not handed servers that came in the
initialize request. Subagents run in the session's process and are not
affected.
- **Unit runs take the `'argv'` case.** `vitest.config.ts` sets
`CLAUDE_CODE_EXECUTABLE` for them. So the session tests of v1 and v2
show that the value is passed and that the client's option wins.
`src/tests/claude-cli.test.ts` covers the rule, and the integration test
covers `'initialize'` end to end.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,285 tests
pass)
- Real CLI: the integration tests (`RUN_INTEGRATION_TESTS=true`, with
`CLAUDE_CODE_ENTRYPOINT` unset), 916 tests pass
- Real CLI: the probes above. One of them sends a prompt (one short
Haiku turn, to make a session to resume).
Of 6 full unit runs, 4 passed and 2 had one failure each. The one I
captured is "reads only the changed transcript for a subscription" in
`src/tests/v1/session-index.test.ts`, which passed in 12 runs alone. It
counts the transcripts that the session index reads after a file watcher
event (3 where it expects at most 1). This PR does not touch that code.
Not changed here. The other failure was not captured.
## Summary
Updates `@anthropic-ai/claude-agent-sdk` from 0.3.325 to 0.3.326, which
bundles Claude Code 2.1.326. The new version needs one adapter change,
included here: the adapter now sets the SDK's new `mcpServersDelivery`
option. Its value keeps today's behavior. A follow-up PR changes the
value, so that MCP servers no longer reach Claude Code on its command
line.
Also bumps these dev dependencies: `@anthropic-ai/sdk` 1.8.0 → 1.9.0,
and `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser`
8.72.2 → 8.73.0.
`npm update` brings the in-range lockfile bumps: `hono` 4.13.18 →
4.13.19, `@hono/node-server` 2.1.8 → 2.1.9, `router` 2.2.0 → 2.3.0,
`ignore` 7.0.14 → 7.0.16 and `@tybys/wasm-util` 0.10.4 → 0.10.5.
typescript-eslint 8.73.0 depends on `minimatch` 11, so the lockfile now
holds one `minimatch`, 11.0.9, in place of 10.2.6 and two nested copies
of 11.0.8. That clears the advisory GHSA-g3hv-75wg-m249: `npm audit`
finds nothing.
TypeScript stays at 6.0.3: 7.0.2 is out, but `@typescript-eslint/parser`
8.73.0 still requires `typescript <6.1.0`.
## `mcpServersDelivery`
SDK 0.3.326 adds the option `mcpServersDelivery`, which says how a
session's MCP servers reach Claude Code:
- `'argv'`, the default: in one `--mcp-config` flag. A server's `env`
and `headers` are then on Claude Code's command line.
- `'initialize'`: over stdin, in the initialize request.
Without a change, the new SDK breaks the adapter in two ways:
- The build fails. `OPTION_REBUILDS_SESSION` in
`src/v1/session-fingerprint.ts` must classify every SDK option. The new
one is read when the process starts, so a changed value rebuilds the
query.
- The SDK prints a `DeprecationWarning`
(`CLAUDE_SDK_MCP_SERVERS_ARGV_DEPRECATED`) on stderr, once per process,
when an app names the Claude Code to start, a session has MCP servers
and the option is unset. The adapter always passes
`pathToClaudeCodeExecutable`, so every adapter process with an MCP
server would print it.
The adapter now sets `'argv'`, so MCP servers reach Claude Code as they
did before. The value is one constant, `MCP_SERVERS_DELIVERY` in
`src/claude-cli.ts`, which both cores set before the client's options: a
client's `_meta.claudeCode.options.mcpServersDelivery` wins.
## Changelog review
Read the SDK changelog for 0.3.326 and the Claude Code changelog for
2.1.326. No other entry needs a code change:
- **Types.** Besides `mcpServersDelivery`: doc text, new optional
members, and `BUILTIN_TOOL_NAMES` lists `SetGoal` in place of
`ProposeGoal`. The adapter names neither tool.
- **A warning for a tool list entry that does not look like a complete
rule**, on stderr and as a `system/informational` message. The adapter
adds only `AskUserQuestion` to `disallowedTools` and passes the
`claude_code` preset or `[]` as `tools`, so only a client's own list can
cause it. Both cores send an `informational` warning to the client as a
notice.
- **The `managed_mcp_arrived` warning** is an `informational` warning
too, and is sent the same way.
- **Some tool calls now ask in bypass permissions mode.** Such a call
reaches `canUseTool`. Neither core allows a call there because of the
session's mode, so the user is asked.
- **Bash permission checks ask before more commands.** These reach
`canUseTool` as any other request.
- **`modelUsage` and `total_cost_usd` count billed permission classifier
calls and calls that were stopped or cut.** Both cores take the row of
the turn's model and the increment over the last reading, so a new row
or a larger total needs no change.
- **`message_uuid` on `cancel_async_message` responses.**
`Query.cancelAsyncMessage()` still returns only `cancelled`, and the
adapter does not read the response.
- **`rewindFiles()` skips some files when the sandbox is on.** The
adapter only calls it with `dryRun: true`, for the file-change report.
- **`setMcpServers()`, `resumeSessionAt` and startup hook fixes.**
Picked up as they are: the adapter has no workaround for the old
behavior.
- **`getSessionInfo` and `listSessions`** read a transcript as before: a
differential run of 0.3.325 against 0.3.326 over 4,500 generated
transcripts gave no mismatch. The run is not part of this PR.
- **`@anthropic-ai/sdk` 1.9.0.** The adapter uses its types only. The
release changes API resources and tool helpers that the adapter does not
use.
- **typescript-eslint 8.73.0.** One new rule, which the config does not
turn on, and a narrower report location for `consistent-type-imports`.
`npm run lint` reports nothing.
## Not in this PR
- `mcpServersDelivery: 'initialize'`, which keeps a server's `env` and
`headers` off Claude Code's command line. It changes how a session with
MCP servers starts, and a Claude Code older than 2.1.326 cannot take it,
so it is its own PR, on top of this one.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,283 tests
pass)
- Real CLI: the integration tests (`RUN_INTEGRATION_TESTS=true`, with
`CLAUDE_CODE_ENTRYPOINT` unset), 914 tests pass. They include an MCP
server served over ACP, the output of a foreground Bash command and the
model list.
- Real CLI, without a prompt: with `'argv'`, Claude Code 2.1.326 and
2.1.323 both start a session with a stdio and an HTTP MCP server, and
the SDK prints no deprecation warning.
## Problem
With workflows on (`CLAUDE_CODE_WORKFLOWS=1`), the prompt fails when a
workflow agent asks for permission while the main agent's turn is open:
```text
RequestError: Internal error: Claude ended the turn without returning results for tool calls: toolu_…
data: { errorKind: "incomplete_tool_call" }
```
Seen in a client running workflows in default mode: the main agent
starts a background workflow and keeps working, a workflow agent runs a
quick Bash command after the user allows it, and the main agent's turn
then ends with this error. The workflow itself finishes fine.
## Cause
Claude Code calls `canUseTool` for a workflow agent with an `agentID`
that no `task_started` announces. The workflow's own `task_started`
names the Workflow call, and the agent's tool_use and tool_result never
stream on the root query. `toolUseOwner` finds no parent (the adapter
logs "No parent tool_use recorded for subagent a…; sending the Bash
permission request unattributed"), so `ensureToolCallEmitted` sees no
`parentToolUseId` and the root session id, and records the call as the
turn's foreground work:
```ts
if (!parentToolUseId && notificationSessionId === sessionId && toolName !== "SandboxNetworkAccess") {
recordForegroundToolCall(session, toolCallId);
}
```
The call is still open when the turn's result arrives. The permission
path also recorded it as dispatched, so `settleActive` counts it as
stuck and fails the prompt. A command that runs a few seconds gets a
`task_started`, and `registerLiveTask` forgets the call, so only quick
commands hit this.
## Fix
`ensureToolCallEmitted` takes `canUseTool`'s `agentID`, and a call with
an `agentID` is not recorded as foreground work:
```ts
if (!agentID && toolName !== "SandboxNetworkAccess") {
recordForegroundToolCall(session, toolCallId);
}
```
`toolUseOwner` finds a parent or a child session only for a set
`agentID`, so the two dropped conditions are implied by `!agentID`, and
the result changes only for a subagent with neither. That is a workflow
agent, or a Task subagent whose request beats its `task_started`; the
latter's call was already unlisted by its streamed frame.
`foregroundToolCallIds` feeds only the end-of-turn check. Both callers,
the permission request and the AskUserQuestion elicitation, pass
`agentID`.
v2 is not affected: it never fails a turn for an open tool call, and it
emits a permission's tool call early only for SandboxNetworkAccess.
## Tests
- `v1/incomplete-tools.test.ts`: "does not claim a workflow agent's
permission tool as a foreground tool". The stream is what the CLI sends:
a Workflow tool_use, its `local_workflow` `task_started` and launch
result, then the agent's `canUseTool` with an `agentID` no
`task_started` announced, then the result. It fails without the fix with
"Claude ended the turn without returning results for tool calls:
unfinished-bash".
- `npm run check`, `npm run build` and `tsc --noEmit` pass. `npm run
test:run`: 4179 passed, 36 skipped, 1 failed. The failure is
`acp-scenarios.test.ts` "replaces only the version of this adapter and
the path of this Node binary", which fails the same way on `main` on my
machine.
- Real repro: an ACP client spawning the adapter with Claude Code
2.1.325, default mode, permissions allowed after 1.5s. The main agent
starts a workflow whose one agent runs `date > stamp.txt; cat
stamp.txt`, then goes on with its own work:
| Build | Main turn ends | Result |
| --- | --- | --- |
| `main` (7d9e1f6) | ~27s after the workflow's command | failed 2/2 |
| this branch | ~27s after the workflow's command | clean 4/4 |
| `main` (7d9e1f6) | ~1s after the command is allowed | failed 3/3 |
| this branch | ~1s after the command is allowed | clean 3/3 |
0.101.1 fails the same way (2/2), and this change alone makes it clean
(2/2).
## Not covered
- The workflow agent's tool call still never closes in the client:
nothing streams its result on the root query. That was already the case
when the main turn ended before the request. A probe shows the adapter's
PostToolUse hook does fire for it, with the call's `tool_use_id`, its
`agent_id` and `agent_type: "workflow-subagent"`, so a follow-up could
close it from there.
- The "No parent tool_use recorded" log now fires on every workflow
agent's request, not only on a lost race with `task_started`. Its
comment says so; it is still only `logger.log`.
- `npm run test:integration` was not run.
Related: #1501 hits the same check through the same eager permission
call, for a root `confirm_<uuid>` question with no `agentID`. This PR
does not change it.
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Implements the [MCP-over-ACP
RFD](https://agentclientprotocol.com/rfds/mcp-over-acp) for ACP v1 and
v2. A client can declare an MCP server with `"type": "acp"` in a session
setup request, and the agent sends that server's MCP requests to the
client as `mcp/message` over the ACP connection it already has.
## What changes for a client
- `initialize` advertises the transport:
`agentCapabilities.mcpCapabilities.acp: true` on v1, and
`capabilities.session.mcp.acp: {}` on v2.
- `session/new`, `session/load`, `session/resume` and `session/fork`
take `acp` servers in `mcpServers`. v2 used to reject them with
`-32602`.
- Claude Code discovers the server, lists its tools and calls them. Each
request reaches the client as an `mcp/message` request, and the client's
request-scoped `mcp/message` notifications (such as progress) reach
Claude Code.
## How it works
Claude Code's MCP client connects to a command or a URL, so it cannot
send `mcp/message` itself. The adapter uses the ACP SDK's helpers for
this case: `McpOverAcpCaller` and `McpOverAcpHttpBridge`. Each `acp`
server gets an MCP 2026-07-28 HTTP endpoint on `127.0.0.1` that forwards
every MCP request over the ACP connection. The `acp` servers of a
connection share one listener, which closes with the connection, and a
request needs the bearer token of its server.
- The new `McpOverAcp` class in `src/mcp-servers.ts` owns the caller and
the bridge. `sdkMcpServers` is now async and maps an `acp` server to the
SDK's `http` config through it. Both cores use it: v1 through
`AcpClient.mcpServerOverAcp`, v2 through `V2Agent.sdkMcpServers`.
- Both agent apps register `McpOverAcp.handleNotification` for
`mcp/message` notifications.
- A server gets the same config for as long as the connection lives. A
session that restarts, or a v2 resume of an active session with the same
servers, does not reconnect it.
## Notes for review
- **Depends on Claude Code's MCP negotiation.** The endpoint speaks MCP
2026-07-28 only and takes no `initialize`. Claude Code 2.1.325 sends
`server/discover` to an HTTP server first by default. With
`MCP_PROTOCOL_NEGOTIATION=legacy`, or with its
`tengu_mcp_protocol_negotiation_http` flag off, it sends `initialize`
instead. Then the server is listed as failed in `/mcp`, and the client
gets the existing "failed to start" notice. The adapter does not force
`MCP_PROTOCOL_NEGOTIATION=auto`: that would also change the handshake of
the user's other servers.
- **A listener that cannot open fails the setup request** with `-32603`
and a message that names the server, instead of starting the session
without it.
- **Golden files.** The 42 scenario snapshots change only in the
`initialize` line. `compare.ts` documents the new capability as an
allowed difference from the origin/main baseline.
## Testing
- `src/tests/mcp-servers.test.ts`: the transport mapping, a request and
its progress through a real in-memory ACP connection, one config and one
listener per connection, and the requests the endpoint refuses (another
server's token, `initialize`).
- `src/tests/v2/acp-v2.test.ts`: a tool call of a v1 session and of a v2
session through the protocol router, also after a v2 resume of the
active session. Both fail when the `mcp/message` notification handler is
not registered.
- `src/tests/v2/v2-integration.test.ts`: the bundled Claude Code CLI
lists the tools of an `acp` server. It sends no prompt, so it costs no
API usage.
- Run by hand against the built adapter with a real ACP client that
serves a tool: on v1 and on v2, Claude Code 2.1.325 sent
`server/discover`, `subscriptions/listen`, `tools/list` and `tools/call`
as `mcp/message`, and answered with the tool's result.
## Summary
Fixes#1501. Supersedes #1643 by dreaifekks: this PR carries that commit
unchanged and adds one on top. The push to the author's branch was
refused, so the second commit could not go there.
Claude Code's `confirmWithUser` asks the user a question on its own, for
example whether to download a connector's file, or which model to
continue on after a refusal. It asks through `canUseTool` as
`AskUserQuestion` under a synthetic id `confirm_<uuid>`, and reads the
answer from the callback's result. No `tool_use` and no `tool_result`
stream for that id.
On v1, for a client with form elicitation, the adapter emitted a tool
call for the question and recorded it as the turn's foreground work.
Nothing ended that call, so the turn failed at its result, whatever the
user answered:
```text
RequestError: Internal error: Claude ended the turn without returning results for tool calls: confirm_…
data: { errorKind: "incomplete_tool_call" }
```
Two changes:
1. A `confirm_` id is not recorded as foreground work, next to the
SandboxNetworkAccess exemption in `ensureToolCallEmitted` (the commit
from #1643).
2. The answer ends the question's tool call. With the first change alone
the turn ended, but the call stayed `pending` in the client.
| What happens to the question | Tool call |
| --- | --- |
| The client answers | `completed` |
| The client declines the form | `completed`: the question is answered
with nothing selected |
| The client cancels it, or cannot show it | `failed` |
| `session/cancel` while the client shows it | `failed`, once, with the
cancel's report |
## Design
- No new mechanism. `settleSandboxNetworkCall` already ended the one
other tool call that no tool result ends. It is now
`settlePermissionOnlyCall` and ends both.
- That helper now forgets the call it ends, as `closeToolCall` does.
Before, a `session/cancel` later in the turn ended the same call a
second time, as `failed`. An answered SandboxNetworkAccess call had the
same defect.
- `isConfirmQuestion()` in `src/elicitation.ts` names the `confirm_`
rule for its two uses. Claude Code tests the same prefix itself.
- A request whose signal aborted is not settled. At a `session/cancel`
the turn ends its open tool calls itself (`closeOpenToolCalls`).
SandboxNetworkAccess follows the same rule on v1 and v2.
- v2 needs no change: it emits no tool call for the question, and it
never fails a turn for an open tool call.
- A v1 client without form elicitation is not affected either: the
callback rejects before a tool call is emitted, and Claude Code reads
the question as unanswered.
Not addressed: when the SDK aborts the callback's signal while the turn
goes on, the tool call stays `pending`. SandboxNetworkAccess has the
same limit on v1 and v2.
## Tests
`src/tests/v1/incomplete-tools.test.ts`:
- The client answers, declines, cancels, or cannot show the question:
the turn ends with `end_turn`, and the tool call gets the status of the
table above.
- Claude Code withdraws the question and the turn goes on: the turn ends
with `end_turn`. With the answer ending the call, this is the case that
still needs the foreground exemption.
- `session/cancel` while the client shows the question, and after the
client answered it: the tool call ends once.
Each rule fails one of these tests when it is removed.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,272 tests pass
on this branch merged with `main`)
- Not run against the real CLI: I found no cheap way to make Claude Code
ask such a question. The test doubles follow the code of CLI 2.1.325:
the id prefix, the shape of the question, and how it reads the answer.
---------
Co-authored-by: dreaife <dreaifehe@gmail.com>
Refs #1077
Claude Code's plan-approval dialog offers "clear context" only when
`showClearContextOnPlanAccept` is on (the SDK's `Settings` docs: "When
true, the plan-approval dialog offers a "clear context" option. Defaults
to false."). The adapter offered it on every ExitPlanMode request, and
#1077 shows what a cleared context then loses on `session/load`.
- `SettingsManager.getShowClearContextOnPlanAccept` resolves the setting
as the CLI does: managed settings, then the `--settings` override, then
the user/project/local files; false otherwise.
- `buildClaudePermissionOptions` offers the clear-context option only
when it is on, for v1 and v2.
Tests cover the default, the v1 wiring and the settings precedence; the
existing clear-context tests and the exit-plan scenarios turn the
setting on. Checked with a real session: without the setting, Approve
Plan offers `exit-plan-default`, `exit-plan-auto` and `reject`; with
`showClearContextOnPlanAccept: true` in the project's
`.claude/settings.json`, `exit-plan-clear-auto` is back and the plan
runs.
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Hi! I work on an ACP client that renders the agent's commands as
terminals. With Codex, a long command's terminal fills while it runs.
With this adapter, a foreground Bash command's terminal stays empty
until the command ends, and then gets all of its output at once. For
example, `for i in 1 2 3 4 5 6; do echo line$i; sleep 1; done` shows
nothing for about six seconds. Commands in the background already stream
(`BackgroundOutputTail` on v2); foreground ones don't, on v1 or v2.
As far as I can tell, Claude Code sends no output for a foreground
command before its tool result: `tool_progress` carries only
`elapsed_time_seconds`. But it does make the output available while the
command runs. After about 3 seconds it starts a `local_bash` task for
the command (`task_started` with `is_backgrounded: false` and the Bash
call's `tool_use_id`), and `get_task_output` returns that task's output
so far. I checked with a small script on the SDK pinned here (0.3.322),
polling every 0.3 s:
```
3.0 assistant tool_use toolu_015v...
6.2 system/task_started {"task_id":"bd1jlb3sb","task_type":"local_bash","is_backgrounded":false,"tool_use_id":"toolu_015v..."}
6.5 getTaskOutput {"output":"line1\nline2\nline3\nline4\n","total_bytes":24,"truncated":false}
7.4 getTaskOutput {"output":"line1\nline2\nline3\nline4\nline5\n","total_bytes":30,"truncated":false}
8.3 getTaskOutput {"output":"line1\nline2\nline3\nline4\nline5\nline6\n","total_bytes":36,"truncated":false}
9.2 system/task_notification {"status":"completed"}
9.3 tool_result
```
The same run logged every `tool_progress` and
`background_tasks_changed`: none came for the command before
`task_started`, so there's no earlier task id to read from.
This PR uses that to stream the output into the command's terminal, on
both agents.
**What changes**
- `TaskOutputPoll` (`src/background-output.ts`, shared): calls
`get_task_output` every `BACKGROUND_OUTPUT_POLL_MS` and publishes the
text past the bytes already sent, using `total_bytes`.
- When it can't cut the new text out exactly, it sends the whole
`output` as a snapshot instead. That happens when more was added than
the 8 KiB tail holds, when the output shrank (a new run), or when the
decoded text doesn't match `total_bytes` (output that isn't UTF-8).
- A read that ends in U+FFFD may have cut a character the command is
still writing, so it waits for the next read.
- `finish()` waits for a read in progress; `end()` stops at once, for
the v2 tool result path, which is synchronous. A read in progress
publishes nothing after either.
- `supportsTaskOutput()` (same file): the type guard for `getTaskOutput`
(see below).
- v2 (`src/v2/tasks.ts`): `SessionTasks` owns the polls, keyed by the
Bash tool call id, next to the background terminals it already tails.
`followForeground()` starts one on a foreground `local_bash`
`task_started` whose Bash call the session's stream holds. A subagent's
command goes to the subagent's session, and gets none before that
session is announced. `toolResults()` ends the poll; if anything was
streamed, `withStreamedTerminal()` (`src/tool-calls/background.ts`)
turns the result's `terminal_output_delta` into `terminal_output`, so
the result's full output replaces what the terminal showed
(`terminal_update` with `output`) instead of being appended again. A
command that went to the background keeps its streamed output, since its
result only has the "Command running in background" text and its output
file's tail takes over. `queryEnded()` and `withdrawAll()` stop the
polls. `src/v2/session.ts` gives the tasks `taskOutput()`.
- v1 (`src/v1/background-work.ts`, `src/v1/acp-agent.ts`):
`SessionBackgroundWork.followForeground()` / `finishForeground()` own
the polls, and `queryClosed()` stops them when the session's query
closes. `foregroundBashTerminal()` decides which `task_started` gets
one, as on v2; a subagent's command goes under its Agent call (via
`parent_task_id` and `liveBackgroundTasks`), and gets none if that call
isn't known. `acp-agent.ts` only wires it in: start on `task_started`,
finish on the tool result, `withStreamedTerminal()` on the result
update.
- Who gets it: every v2 client (chunks are `terminal_output_chunk`, the
final output a `terminal_update`), and v1 clients that declared
`terminal_output_delta` and aren't AIR. v1 clients that declared only
`terminal_output`, and AIR on v1, which shows commands through its async
tasks, get the output with the result, as before.
**Two things you may want to weigh in on**
- `getTaskOutput` is on the SDK's query object but not in the public
`Query` type yet, so it's reached through a type guard,
`supportsTaskOutput()`, the same way `mcpAuthenticate` is. Its doc in
the SDK also mentions only background tasks; the run above shows it
works on a foreground one. If you'd rather wait for the SDK to type and
document it, I understand.
- Output from the first ~3 seconds, before `task_started`, still arrives
in one piece, at the first read. Commands that finish sooner never get a
task, so nothing changes for them.
Tests in `src/tests/background-output.test.ts`,
`src/tests/v1/tool-call-contract.test.ts`,
`src/tests/v1/acp-agent.test.ts` and `src/tests/v2/acp-v2.test.ts`
(which also checks that a command Claude Code runs in the background is
never polled); the scenario recordings don't change. `npm run check`
passes, and the full suite passes (4042 passed, 33 skipped). I also ran
the built adapter against real Claude Code over both protocols with the
command above: on v2 the terminal got `line1`–`line4` at the first read
and then `line5` and `line6` a second apart, before the result's
`terminal_update` replaced it; v1 with `terminal_output_delta` got the
same as `terminal_output_delta` chunks, then `terminal_output` and
`terminal_exit`.
The changes are two commits: the first adds the shared pieces and v2,
the second v1 on top of it, so the v1 half can be dropped if you only
want v2. I'm happy to change the approach, the poll interval or which
clients get it if you'd prefer something else.
---------
Co-authored-by: Jonathan <visionik@administrators-Mac-mini.local>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Keep malformed Read/Edit paths out of display metadata so a tool
validation error reaches the client without aborting the ACP prompt.
Regression tests cover partial and consolidated input, adjacent Write
calls, and a subsequent prompt.
Fixes#1308.
Validation: the 42 file-path regression cases and all 380 tests in the
affected suites passed. `npm run check` and `npm run build` also passed.
The full suite failed locally: 40 failures, 3,288 passed, and 32
skipped. All 40 failure assertions were reproduced on unmodified
`f7d6030`: 39 in the full suite and the Skill file-rewrite fixture in a
focused run.
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Thanks for merging #1392, and for #1233, which fixed the original hang
we reported in #1145.
**Problem.** Call the original prompt P and the steered instruction S.
While S is still running, a result from a cycle Claude Code started
itself (`origin: task-notification`), stamped with P's uuid, clears
`steeredAwaitingResult`. Its trailing idle then meets
`isSteeredSettleReady` and `session/prompt` returns while the steered
work is still streaming. The `steeredAwaitingResult` doc already states
the rule: *"while this is set the recorded outcome predates the steered
work and an idle must not settle on it"*. The code doesn't keep it for
this one shape.
The sequence (v0.97.0):
1. the interrupted cycle's result names P: `settleOrDefer`'s steering
branch records it;
2. S's echo: `steeredAwaitingResult = true`;
3. an autonomous result stamped `[P]`: `answersPendingPrompt` is true (P
is still in `turnQueue`), so it takes the user lane, reaches
`settleOrDefer`, and **clears `steeredAwaitingResult`**;
4. that cycle's idle: `isSteeredSettleReady` is true, so P settles
before S's own result.
#1185 doesn't cover this: it matches results that name the *steer*, and
this one names the original prompt.
**Change.**
- `settleOrDefer` takes one optional `{ steeredWork }` (default `true`,
so every existing caller is unchanged). In the steering branch it still
records `steeredSettle` (the last result and its usage still win), but
clears `steeredAwaitingResult` only for steered work.
- `answersSteer` moves up to the head of the result handling, so the two
settle calls can read it. Both the refusal settle and the end-of-result
settle pass `steeredWork: !startedByClaudeCode || answersSteer`.
- No new state. No change to `answersPendingPrompt`,
`isSteeredSettleReady`, the idle lane, owed-idle accounting or usage.
- The steered cycle's own result is not autonomous (in the existing
steer tests it carries no origin), so it still clears the flag. A result
that names the steer still leaves the steer lane at the result, as
before. If a CLI ever answered the steer with an autonomous result
naming only P, the turn would wait for the next result, `session/cancel`
or the next prompt, instead of ending early.
**Test.** Two cases (`end_turn` and `refusal` trailers) beside "does not
settle a steered turn on a lagged owed idle before the steered result",
which covers the unstamped variant of the same guard. They are the same
shape, with the autonomous result stamped with P and placed after the
steer's echo. Both fail on main and pass with the fix. The turn keeps
one stop reason across its cycles, so the refusal case expects
`refusal`. What it asserts is that the prompt ends last.
**Repro.** We have a ~180-line fake-CLI replay (no model, no network)
that drives the real adapter over stdio and times `session/prompt`
against the steered result: on 0.97.0 the prompt returns ~2.5 s early,
and with this change 1 ms after. It's the repro offered on #1145, and we
can attach it.
**Not covered:**
- An `is_error` autonomous result naming a pending prompt mid-steer
still fails that prompt (`failActiveWithSessionFailure`). That is a
different behaviour, an early failure rather than an early completion,
and is not addressed here.
- The steer-error arm (`is_error && isSteering && steeredEchoes.size >
0`) is unchanged. It runs only before the steer's echo, when there is no
wait to end yet.
Related: #1144, #1145, #1185, #1292 (the same family of protection for
autonomous cycles with an empty queue; if it lands first, this can be
re-expressed on top of it).
**Validation.** Both new cases fail on main and pass with the fix. `npm
run check` and `tsc --noEmit` are clean. Default suite with the fix:
3358 passed, 32 skipped, 2 failed: the `acp-scenarios` path
normalization, which also fails on main at `/usr/bin/node`, and one run
of a timing-sensitive hold test under heavy machine load (re-run quiet:
0/50 both ways, with and without the fix). Re-run on current `main`
(c7c80f7): 3378 passed, 32 skipped, 1 failed (the same `acp-scenarios`
case). No live-provider tests were run.
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
## Problem
Under `--hide-claude-auth` the subscription guard refuses every
claude.ai account, Claude Enterprise included, so Enterprise users in
Air get `authRequired` (`claude_subscription_not_supported`) on every
session and prompt. Enterprise plans are allowed in this integration
(IJAI-2528).
## Change
- `isClaudeEnterprisePlan()` matches "Claude Enterprise" (the SDK's
`AccountInfo.subscriptionType`) and "enterprise" (older CLIs). Any other
name, including a custom `plan_display_name`, is still refused.
- `claudeAuthRefusal()` is now the guard's single decision, used by v1
and v2 session creation and the per-prompt guard instead of three copies
of the same check.
Free, Pro, Max and Team stay refused, and the claude.ai login method
stays hidden under the flag.
## Testing
v1 and v2 tests: Enterprise is allowed, Team is refused. `npm run build`
and `npm run check` pass. 24 tests in `create-session-options`,
`providers`, `session-index` and the v2 provider tests fail locally on
`main` too. Not checked against a real Enterprise account.
Fixes#1033. Same goal as #1034, which was closed because its rebase
reverted #1458. This version is written against current `main` and keeps
#1458's error codes.
## Problem
`session/set_config_option` refuses a model id that resolves to no entry
of the model option, even when Claude Code runs it. With telemetry off,
Claude Code 2.1.318 lists `default, opus, claude-fable-5-1[1m], sonnet,
haiku`. Against 0.107.0:
```
claude-opus-5-5 -> ok, now opus
claude-fable-5-1 -> ok, now claude-fable-5-1[1m]
claude-fable-5-2 -> -32602 Invalid value for config option model: claude-fable-5-2
claude-opus-4-6 -> -32602 Invalid value for config option model: claude-opus-4-6
```
`ANTHROPIC_MODEL` and a typed `/model` already reach these models, and
the option lists such a model once the session runs it
(`buildModelConfigOption`). Only this path refuses.
## Change
A model id that resolves to no entry goes to `query.setModel` as it is
(`configOptionValue` marks it `unlisted`, and `setSelectedModel` sends
it, shared by v1 and v2). Claude Code is the one that decides. Checked
against CLI 2.1.318 through the SDK's `setModel`:
| Request | Claude Code |
|---|---|
| `claude-fable-5-2`, `claude-opus-4-6`, `claude-opus-4-6[1m]` |
accepted |
| `gpt-4`, `not-a-model`, `son`, `foo-sonnet` | `Model '…' not found` |
| `claude-fable-5-2` with `availableModels: ["sonnet"]` | `Model
"claude-fable-5-2" is restricted by your organization's settings` |
A refusal from Claude Code becomes `-32602` with its reason (`Invalid
value for config option model: gpt-4. Model 'gpt-4' not found`), and the
option stays as it was. For a listed value, a `setModel` failure stays
the internal error it was.
Two cases still refuse without asking Claude Code:
- **A session whose models a `providers/set` gateway listed.** Only
those models can run there, but Claude Code would accept the id. v1
records this as `Session.modelsNarrowedByGateway`; v2 as
`ConfigSetup.narrowsModels`, from `routing.narrowsModels`.
- **Restoring the replaced query's choices after a restart**
(`restoreSessionChoices`, `SessionConfig.restoreFrom`). A model the new
provider dropped falls back as before ("reports the actual fallback when
a model disappears or its switch is refused").
Initial `configOptions` at setup behave like
`session/set_config_option`, as documented: an unlisted id goes to
Claude Code, and an entry it refuses is skipped.
## Tests
- **Updated.** The junk-id cases (`gpt-4`, `not-a-model`, `son`,
`foo-sonnet` in v1; `not-a-model` in v2 and in the setup entries) now
have the mock refuse unknown ids, as Claude Code does. They expect
`-32602` with Claude Code's reason and an unchanged option. "lists an
off-list current model until the session switches away" no longer
expects re-selecting that id to fail.
- **New (v1 and v2):** an unlisted id that Claude Code accepts becomes
the current value and is listed. A gateway-listed session refuses an
unlisted id without calling `setModel`.
- `npm run check`, `npm run build`, and `npm run test:run` all pass
(4146 passed, 34 skipped).
- **End to end:** I built this branch and drove it over ACP stdio
against Claude Code 2.1.318. `claude-fable-5-2` and `claude-opus-4-6`
switch, `gpt-4` gets `-32602 … Model 'gpt-4' not found`, and
`claude-opus-5-5` still resolves to `opus`.
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
A user reported that turning Fast mode on "does nothing or keeps getting
reset". This fixes two causes, in both cores.
## Turning Fast mode back on did nothing
Claude Code acts on `applyFlagSettings({ fastMode: true })` only when
its flag does not already hold `true`, and ignores a repeat. Its flag
stays `true` when it stops serving Fast mode at a model switch: Fable
5.2 and Mythos 5.2 take only a Fast mode that was turned on while they
were selected.
So with Fast mode on under Opus:
1. The user switches to Fable 5.2. The toggle still shows on.
2. The next `system`/init reports `fast_mode_state: "off"` with no
reason, and the adapter turns the toggle off.
3. The user turns it on again. The adapter sends `fastMode: true`, which
Claude Code ignores.
4. The next prompt turns the toggle off again.
The adapter now sends `fastMode: false` before `fastMode: true`. This is
a workaround for that Claude Code behaviour (CLI 2.1.325), and
`applyFastModeFlag` in `session-fast-mode.ts` says so.
## A toggle changed during a turn flipped back when the turn ended
Claude Code reads the `fastMode` flag once when a turn starts and builds
that turn's init and its result from the one reading. The result
therefore reported the value from before the request, and the adapter
mirrored it until the next turn's init.
A result that repeats its turn's init is now ignored
(`fastModeResultIsNews`). A result that says more, such as an
`extra_usage_disabled` refusal, is mirrored as before, with its notice.
## Not changed
- Fast mode is still dropped at a switch to Fable 5.2, as in Claude
Code. The toggle shows on until the next prompt's init turns it off,
without a notice. It can now be turned on again.
- A request that Claude Code applies after it read the flag and before
it sent the init is not covered: that init reports the earlier value
too, and the next turn's init corrects the toggle.
## Verification
Drove the built adapter over ACP against Claude Code 2.1.325, with and
without the change. The org check was skipped
(`CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK=1`) and the prompts were
`/context` only, so this shows the toggle state and makes no model
request.
| step | `fast` on main | `fast` with this change |
| --- | --- | --- |
| turn Fast mode on (Opus 5.5), prompt | on | on |
| switch to Fable 5.2, prompt | off | off |
| turn Fast mode on, prompt | off | on |
The mid-turn case was not run against the real CLI, because it needs a
model turn. It is covered by the tests below.
## Tests
- v1 and v2: a client turns Fast mode on during a turn whose result
repeats the init, and the option stays on. On v1 the same flow with an
`extra_usage_disabled` result turns it off.
- v1 and v2: the requests sent for the toggle are `fastMode: false`,
then `fastMode: true`.
- Unit cases for `fastModeResultIsNews`.
The flow and request tests fail without the change.
## Summary
Follow-up to #1623, which left this case open.
On v1, `replaceSessionQuery` resumes a session on a new query in two
cases: a provider change (`providers/set`, `providers/disable`) and a
sign-out respawn under `--hide-claude-auth`. The reader of the old query
ends with that query, and nothing started one for the new query until
the next prompt.
Claude Code can run a cycle of its own on the new query before that
prompt, for example a cron prompt or the follow-up to a finished
background task. Its output waited in the stream. At the next prompt the
consumer read the backlog with the prompt's turn queued, and the first
result in it, which has no `origin`, went to that turn. The prompt
resolved with another cycle's usage and stop reason. #1623 fixed the
same for `session/load`, `session/resume` and `session/fork`.
`replaceSessionQuery` now starts the reader once the session's choices
are restored and published.
## Design
- No new mechanism. `ensureConsumer` already owns starting the reader,
and `replaceSessionQuery` is the one function both restarts go through,
so one call covers the provider restart and the sign-out respawn.
- The reader starts after `restoreSessionChoices` and the
`config_option_update`, so what it reports is read against the restored
state. A setup has the same order: choices first, then the reader.
- The `queryClosed` check is at the call site, as in
`afterSetupResponse`, and not inside `ensureConsumer`. `prompt()` relies
on a consumer that starts on a closed stream to reject its queued turn.
- v2 needs no change: it reads every query from `Session.start()`, a
restart's included. A test now pins that.
Not addressed, as in #1623: a prompt sent while such a cycle is still
running can claim that cycle's result.
## Tests
- v1 (`provider-session-configuration.test.ts`): the new query of a
provider restart sends a cron cycle before the next prompt. The cycle is
read without a prompt, and the prompt gets its own usage. Fails without
the fix.
- v2 (`acp-v2.test.ts`): the same cycle after `providers/set` is
reported as it comes. v2 passed this before the change.
- `providers.test.ts`: the query mock's stream now stays open until
`close()`, like Claude Code's. It ended at once, so the reader that now
starts at a restart closed the query, and "switches every loaded session
through proxy replacements and back to native routing" saw a `close()`
it did not expect.
- Two comments said the reader starts only at a prompt
(`ensureConsumer`, and the Remote Control command). Both now name the
setup and the restart.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,183 tests
pass)
- Not run against the real CLI: no provider restart or sign-out respawn
was driven live.
On v1, `ensureConsumer` started only from `prompt()`, Remote Control and
the clear-context coordinator. `session/load`, `session/resume` and
`session/fork` did not start it. A resumed session can run cycles before
the first prompt: a cron prompt that came due while the bridge was down,
or the follow-up of a background task that finished. That output waited
in the stream. When the first prompt arrived, the consumer read the
backlog first, with the prompt's turn queued at the head and not yet
echoed. The first result in the backlog was a cron cycle's, which has no
`origin`, so it took the user lane and `ensureActiveTurn` gave it to the
queued head. The prompt resolved with another cycle's usage and stop
reason, and its own cycle then ran with no turn to claim it.
This change starts the consumer in `afterSetupResponse`, the existing
step that already runs after a setup response and sends the commands and
starts MCP authentication. It runs after a load's replay, so live output
cannot interleave with the replayed history. `ensureConsumer` is
idempotent, so a prompt that arrives later finds the consumer running,
and one that arrives first starts it as before.
## Design
- No new component: `ensureConsumer` already owns starting the reader,
and `afterSetupResponse` already owns "what follows a setup response".
The change is one call and the comments that said otherwise.
- Every setup starts the reader, new sessions included, not only resumed
ones. This is the rule v2 already has (`Session.start()` calls
`consume()` when the session opens), it needs no flag that tells a
resumed setup from a new one, and a new session has no history from
which Claude Code could start a cycle, so for it the early read only
means nothing waits unread.
- It does not start in `createSession`: a load replays history after
`createSession`, and live output from the reader would interleave with
it. `afterSetupResponse` runs after the replay.
- One behavior change: a stream that ends before the first prompt now
closes the session at that moment (the consumer's existing stream-end
handling and `queryClosed`) and not at the first prompt.
- The query mocks in `create-session-options.test.ts` returned an empty
stream, which Claude Code does not. With a reader running from setup,
the empty stream closed the session at once, so the mock now keeps the
stream open until `close()`, like Claude Code's.
## v2
Not affected. `Session.start()` calls `consume(query)` when the session
opens, for new, resumed and forked sessions alike, so output before the
first prompt is reported as it comes. A test in
`src/tests/v2/acp-v2.test.ts` resumes a session that runs a cron cycle
before the first prompt and checks that the cycle is reported apart from
the prompt's turn, with its own usage. It passes with and without this
change.
## Tests
`it.each(["resumeSession", "loadSession"])` in the `session/fork`
describe of `src/tests/v1/acp-agent.test.ts`: that describe holds
`forkingAgent`, the only helper that drives the real setup methods with
a scripted query. It gained a `backlog` parameter for what Claude Code
sends before the first prompt. The test sends a cron cycle (no origin)
and a task-notification cycle as the backlog, waits until the consumer
has read them, then prompts, and checks that the prompt's response
carries its own usage (7 input tokens, not the cron cycle's 111).
Without the fix the consumer never starts before the prompt, so the wait
times out, and with the wait replaced by a fixed delay the response
carries the cron cycle's usage.
This is independent of #1620: each fix passes its own tests alone. #1620
is the case where an unclaimed result leaves the turn task open; this
change removes the way a loaded session got there at its first prompt.
Fixes#1621.
## Validation
Rebased on `main` at 7e857d5.
- `npm run check` and `npm run build` pass.
- `npm run test:run`: 4,135 passed, 36 skipped, 1 failed. The failure is
`tools.test.ts` "picks up a rewrite that restored the modification time
of the file", which also fails on `main` at 7e857d5 without this change.
- The new v1 test fails on `main`, and passes with the fix.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The SDK reports `tokenSource: "none"` for a signed-out first-party
account. That non-empty string currently passes the `--hide-claude-auth`
credential guard and suppresses the subscription check. Treat the
sentinel as absent in both shared predicates, so signed-out sessions and
prompts are refused and a known subscription without another credential
retains its specific auth-required reason. Accepted keys, bearer/setup
tokens, external providers and unavailable-account fail-open behavior
are preserved.
Validation: 413 tests pass across the v1 authorization and v2 protocol
suites; 13 regression cases fail on unchanged main. TypeScript build and
lint/format checks pass. Native ACP v1/v2 signed-out session creation
returns auth-required with isolated configuration, no prompts and zero
loopback endpoint requests. Independently reviewed. The full repository
suite and live provider/client acceptance were not run.
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Fixes#1606
## Summary
Under ACP v2 a running `Monitor` never reached
`state_update.background`. Claude Code reports its task as `local_bash`
(no `ambient` flag), and the tool-result handling dropped every
`local_bash` task:
```diff
// src/v2/tasks.ts, tool-result handling
const task = taskId === undefined ? undefined : this.level.get(taskId);
-if (!task || task.taskType === "local_bash" || task.taskType === "local_agent") continue;
+if (!task || task.taskType === "local_agent") continue;
+// a command is its display terminal; the call of a task-starting tool is that task's entity
+if (task.taskType === "local_bash" && !TASK_TOOLS.has(toolUse.name)) continue;
this.toolCalls.set(taskId!, { toolCallId, ... });
```
Why nothing else caught the Monitor:
```text
Monitor result, taskType local_bash
toolResults skipped by the line above -> not in toolCalls
adoptTasks same local_bash skip -> no task_<id> call
terminals needs a Bash result with backgroundTaskId
lists() lists only toolCalls/terminals -> background: []
```
Plain commands still go through `terminals`; `local_agent` is still
skipped. `adoptTasks()` is unchanged, since it already skips a task
whose call is registered.
## Evidence
- **Before:** the new test fails, and a real agent lists nothing (3
runs, 30 `state_update` frames, every one `background: []`).
```text
keeps the call in_progress and listed when Claude Code reports the
Monitor's task as local_bash, not ambient
AssertionError: expected [ 'running []', 'idle end_turn []' ] to include
'idle end_turn [toolu_mon]'
```
**After:** the same test passes, and the full suite is green (`npx
vitest run`: 4104 passed, 33 skipped; `tsc --noEmit`, `eslint` and
`prettier --check` clean). A real agent built from this branch (SDK
0.3.322) lists the Monitor in 10 of 11 `state_update` frames (the one
before it starts is `[]`), and its call goes `pending` → `in_progress`
with `capabilities: { cancel: {} }`.
The test, in pseudocode:
```text
task = { id: mon1, type: "local_bash" } // no ambient, as the CLI sends it
script: Monitor tool_use, level [task], task_started, tool_result { taskId: mon1 },
result, idle, task_notification completed, level []
expect trace == running [] | pending | in_progress | cancel | running [toolu_mon]
| idle end_turn [toolu_mon] | completed | no cancel | idle []
```
The existing Monitor fixture models the task as `local_monitor` +
`ambient: true` (the shape #1538 fixed), which is why it never saw this.
`monitorStarts` now takes an optional task, defaulting to that fixture,
so the existing tests are unchanged.
## Merge Danger
**Door:** two-way
Revert the commit; nothing is persisted or migrated.
**Blast Radius:** Narrow
ACP v2 only (`src/v2`); v1 is untouched. A `Monitor`, or any tool in
`TASK_TOOLS` whose task Claude Code reports as `local_bash`, is now
registered and listed. A client that decides whether a session is quiet
(to restart or release it, say) will now see a live Monitor as
background work. That is the intended behavior, but it differs from what
those clients saw before.
Not covered:
- The late-level race in #1537 (a level that joins after the tool
result) is a separate bug, and a `local_bash` Monitor hit by it would
still go unlisted.
- `npm run test:integration` was not run against the real CLI. The
real-agent result above is a manual probe, not a test.
- `tool_call/cancel` and the task's end were not exercised against the
real agent, only through fixtures.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
When Claude Code's scheduler fires a `ScheduleWakeup` or a cron prompt
with no prompt open, the bridge opens an AIR async task for the cycle,
but nothing ends it. The cycle's result has no `origin`, so it is not in
`AUTONOMOUS_RESULT_ORIGINS` and takes the user lane. With no active or
queued turn it settles nothing, and it records an owed trailing idle.
The `idle` handler ends an open autonomous task only at
`owedTrailingIdles === 0`, and it absorbs the owed idle first. The task
stays open until the stream ends or a later cycle sweeps the debt.
This change ends the open autonomous task at any result that no turn can
own: the session is not cancelled and has no active turn and no
unsettled queued turn. That is the condition that already opens the
task, so both ends now call one helper (`noTurnOwnsCycle`, next to
`firstUnsettledQueuedTurn`). The new end uses the same placeholder rule
as the autonomous lane (`num_turns > 0 || is_error`).
It adds a scripted SDK-stream regression: a prompt's turn, a
`command_lifecycle` `started` with `wakeup_source: "loop_wakeup"` before
the prompt's idle, a cycle with a result that has no origin, then one
idle for both. It checks that the task completes. It fails before the
fix (the task is only closed as `failed` when the stream ends) and
passes after.
## Why this rule
I considered two designs:
1. End the task for any result with no turn to claim it (this PR).
2. Treat a scheduler-fired cycle as autonomous, so its result takes the
autonomous lane.
I chose 1:
- The result carries no origin, so 2 needs state that remembers "this
cycle started with a `wakeup_source`" from the `command_lifecycle`
frame, and a way to match that state to a later result. It would miss
cycles with no fire frame (Claude Code before 2.1.307 sends no
`wakeup_source`), and any other origin-less cycle that Claude Code
starts on its own, including origins it adds later.
- The comment on `AUTONOMOUS_RESULT_ORIGINS` explains why the lane
default is fail-open: moving a user result into the autonomous lane
hangs the prompt where the #825 detector cannot see it. This change
moves no result between lanes. It only ends a task when no turn exists
that a user-lane result could settle, so there is nothing to hang.
- Starting and ending the task now share one predicate, so they cannot
disagree about which cycles belong to no turn.
The state of the task lives in `AsyncTaskRuntime`
(`autonomousTurnEnded`, unchanged). The predicate reads the session's
turn queue, which `async-tasks.ts` does not own, so the check stays in
the v1 consumer next to `firstUnsettledQueuedTurn` and only calls the
runtime.
## What stays as it was
- #825 (the abandoned-turn detector) fails an unsettled active turn at
an idle that no result owes. The new end needs no active and no queued
turn, so the detector never has a turn to fail here. A result with an
active or queued turn is claimed as before (`ensureActiveTurn` still
ends the task when it promotes the head).
- The result keeps its owed trailing idle (`owedTrailingIdles++`), its
usage and its other user-lane handling. Its idle is absorbed as owed, so
it cannot be read as a later prompt being abandoned. The `running`
transition still sweeps unpaid debt.
- A cancelled session is excluded, so the orphan results of cancelled
prompts keep their existing handling.
## v2
Not affected. v2 reports a cycle as a turn and ends it at the cycle's
result, whatever its origin: `Session.result` opens a turn if none is
open, then ends it. v2 has no async task that a result must close
separately. A test in `src/tests/v2/acp-v2.test.ts` runs the same stream
(a prompt, a scheduler fire, one idle for both results) and checks that
the cycle reports `running` and `idle end_turn`. It passes with and
without this change.
Fixes#1620.
## Validation
Rebased on `main` at 7e857d5.
- `npm run check` and `npm run build` pass.
- `npm run test:run`: 4,134 passed, 36 skipped, 1 failed. The failure is
`tools.test.ts` "picks up a rewrite that restored the modification time
of the file", which also fails on `main` at 7e857d5 without this change.
- The new v1 test fails on `main` (`['async_task_spawned', 'failed']`
instead of `['async_task_spawned', 'completed']`) and passes with the
fix.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
Updates `@anthropic-ai/claude-agent-sdk` from 0.3.323 to 0.3.325, which
bundles Claude Code 2.1.325. The adapter needs no code change for it.
Also bumps the dev dependency `eslint` 10.14.0 → 10.15.0.
`npm update` brings the in-range lockfile bumps: `@eslint/config-array`
0.23.5 → 0.23.6 and `postcss` 8.5.32 → 8.5.33. `eslint` 10.15.0 and
`@eslint/config-array` 0.23.6 require `minimatch` ^11, so the lockfile
gains `minimatch` 11.0.8 under each of them, and its dependency
`@isaacs/nonrecursive-glob-match` 1.1.0. All are dev-only.
TypeScript stays at 6.0.3: 7.0.2 is out, but `@typescript-eslint/parser`
8.72.2 still requires `typescript <6.1.0`.
`npm audit` lists one moderate advisory, GHSA-g3hv-75wg-m249, for the
`minimatch` 10.2.6 that `@typescript-eslint/typescript-estree` depends
on. This PR does not change that package, and no typescript-eslint
release fixes it yet. It is dev-only: `npm audit --omit=dev` finds
nothing.
## Changelog review
Read the SDK changelog for 0.3.324 and 0.3.325 and the Claude Code
changelog for 2.1.325, which has no 2.1.324 section. Every type change
is in 0.3.324; the type files of 0.3.325 are the same. No entry needs a
code change:
- **Types.** Doc text and new optional members only, plus the new
functions `archiveSession()` and `unarchiveSession()`.
- **`applyFlagSettings()` rejects a call with an invalid value**, where
it used to drop the settings of earlier calls without an error. Checked
against the real CLI: it accepts every value the adapter sends (the five
effort levels, each with and without `ultracode: true`, `effortLevel:
null`, `fastMode` and `ultracode` as booleans, `agent: null` and a
listed agent). A value of the wrong type is rejected with "nothing in
this request was applied and earlier settings stay in force". Every call
site applies the setting before it changes its own state, so a rejection
leaves the config option as it was.
- **A new warning when a `PreToolUse` hook gives no verdict.** Recorded
from the real CLI, for a hook that timed out:
```json
{
"type": "system",
"subtype": "informational",
"content": "A hook didn't answer in time, so it didn't check this
action.",
"level": "warning",
"tag": "hook_no_verdict",
"hook_no_verdict": {
"hook_event": "PreToolUse",
"tool_use_id": "toolu_01E5…",
"timed_out": true
}
}
```
A hook whose command cannot run sends "A hook gave no usable answer, so
it didn't check this action." The frame comes after the tool call and
before its result, once per hook in a session. Both cores already send
an `informational` warning to the client: as a warning notice, or as a
`**Warning:**` line for a client without notices. The frame has no
top-level `tool_use_id`, so the rule that keeps one notice per tool use
does not drop it. The adapter's own `PreToolUse` hooks catch their
errors, so they do not cause this warning.
- **Sandboxed Bash commands and read-only git commands in a repository
outside the session's folders** now go through the permission flow, so
they reach `canUseTool`. The adapter passes ACP `additionalDirectories`
as the SDK option, which is `--add-dir`, so git commands in those
folders still run without a prompt.
- **`canUseTool` suggestions for Bash and Monitor** hold a list of rules
alone only when saving it would allow the command. Without suggestions
the adapter offers no "always allow" option.
- **`getSessionInfo` and `listSessions`** return `archived` and
otherwise read a transcript as before. A differential run of 0.3.323
against 0.3.325 over 4,500 generated transcripts gave no mismatch, so
`sdkTitles` in `src/session-index/transcript-scan.ts` stays as it is.
The run is not part of this PR.
- **`supportedEffortLevels`** no longer lists levels above the
organization's effort cap or `maxEffortLevel`. The effort option is
built from that list, so it follows.
- **`managed_lock` on `init.plugin_errors`.** The adapter only logs
these errors.
- **`refuseIfBusy` on `reloadPlugins()`.** The adapter does not call
`reloadPlugins()`.
- **`ProposeSkillsInput`** (`edits`, optional `skillMd`). The adapter
has no reporter for this tool and reads neither field.
## Not in this PR
Left for follow-ups, because each is its own change:
- The SDK's archive mark. `archiveSession()` writes `<session
id>/archived.json` beside the transcript, and `listSessions()` reports
it as `archived`. The adapter's `_session/archive` stores the
`[archived] ` title prefix instead
(`src/session-index/archive-title.ts`). The two are not synced: a
session archived through the SDK is listed as unarchived by the adapter,
and the reverse.
- `invalid_config_file` of the `config_file_invalid` startup failure.
The paths are on the result frame only; the error that
`initializationResult()` rejects with carries just the reason. Its
message already names the file.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,146 tests
pass)
- Real CLI: the integration tests (`RUN_INTEGRATION_TESTS=true`), 877 of
878 pass. The one failure is a unit test that uses no real CLI: "absorbs
the interrupt's lagged trailer after cancelling a held turn
mid-followup" in `src/tests/v1/acp-agent.test.ts`. It failed once in
that run, and passed in six runs alone and in every `npm run test:run`.
The test calls `cancel()` once the turn is held, which can be before the
adapter has read the follow-up's `running` frame; `cancel()` then counts
no trailing idle for the interrupt. Not changed here.
- Real CLI: `applyFlagSettings()` with each value above, without a
prompt
- Real CLI: one short turn with a `PreToolUse` hook that times out and
one whose command does not exist, to record the warning frames and their
order
Note for running the integration tests: `agent-discovery.test.ts` fails
in a shell that sets `CLAUDE_CODE_ENTRYPOINT` to a value other than
`sdk-ts`, `sdk-py` or `sdk-cli`, for example a terminal inside Claude
Code. The CLI inherits the variable and then lists a sixth built-in
agent, `claude-code-guide`, which `BUILTIN_AGENT_NAMES` does not hold.
Claude Code 2.1.323 does the same. Run the tests with the variable
unset.
## Problem
A `settings.model` of `opus[1m]`, with an `availableModels` allowlist of
versioned ids from oldest to newest, starts a new session on Opus 4.5:
```json
"model": "opus[1m]",
"availableModels": ["claude-sonnet-4-5-20250929", "claude-haiku-4-5-20251001", "claude-opus-4-5-20251101", "...", "claude-opus-5-5", "..."]
```
No row matches `opus[1m]` directly. The fuzzy tiers of
`resolveModelPreference` then return the first `opus` row,
`claude-opus-4-5-20251101`, and `getAvailableModels` calls `setModel`
with it. The CLI resolves the same settings to the newest Opus: the
`default` row of `supportedModels()` gives `claude-opus-5-5`.
## Fix
For a preference without a version (`opus`, `opus[1m]`, `sonnet`), the
fuzzy tiers take the row of the newest version. The new `newestModel`
reads the version with `familyVersionOf`. A row of an unknown version,
such as `my-opus`, ranks below each row of a known version. A preference
with a version keeps the first compatible row, as before.
## Tests
- `model-resolution.test.ts`: a new `it.each` resolves `opus[1m]`,
`opus` and `sonnet` against an allowlist from oldest to newest. Without
the fix the test fails and gives the oldest row.
- I checked the fix against the real `supportedModels()` with the
settings above. Before the fix, `opus[1m]` resolved to
`claude-opus-4-5-20251101`. After the fix, it resolves to
`claude-opus-5-5`.
- `npm run check` and `npm run build` pass.
- On my machine, `npm run test:run` has 26 failures in
`v1/create-session-options`, `v1/providers` and `v2/acp-v2`. They fail
the same way on `main` without this change. They come from the local
`ANTHROPIC_*` environment.
ACP v2 display terminals carry the bytes a terminal emulator receives.
Claude Code runs a command with its output piped, so no line discipline
turns each LF into CR LF (ONLCR), and the adapter sent the bare LFs
through. An emulator then moves down a row without returning to column
0, so each line starts where the previous one ended. Zed feeds v2 bytes
to its emulator unchanged and showed this staircase; on v1, Zed adds the
CRs itself.
V2Terminals now adds a CR before every LF of terminal_update snapshots
and terminal_output_chunks, which covers foreground commands and the
output files of background commands.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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).
Fixes#1611.
## Problem
On ACP v2, a prompt sent while the session works gets its reply twice.
The client sees:
1. the reply, streamed under the model's `msg_` id
2. `state_update` `idle` with `stopReason: end_turn` and zero usage
3. `state_update` `running`
4. the same reply again, under a UUID
5. `state_update` `idle` with the real usage
This happens whenever Claude Code folds the prompt into running work.
The work can be a cycle that Claude Code started on its own, as in the
issue, or the turn of an earlier prompt.
## Cause
Claude Code sends one result, not two. The order of its frames differs
for a folded prompt (CLI 2.1.323):
| Prompt | Order |
| --- | --- |
| started the work | `result`, then `command_lifecycle` `completed` |
| folded into the work | `command_lifecycle` `completed`, then `result`
|
`V2Session.lifecycle` took every `completed` frame of the last started
prompt as the end of a turn that had no result, and closed the turn. The
result then found no open turn. It opened a new one, saw no streamed
text in it, and sent `result.result` as the reply.
## Fix
The session remembers which prompt started Claude Code's current cycle
(`cycleCommand`). Only that prompt's `completed` frame closes a turn
that had no result. A folded prompt's `completed` frame leaves the turn
open, and the result ends it.
A result ends the cycle, so the next prompt of a turn that stays open
(the `/clear` and the plan prompt of a fresh context) starts its own.
The `cancelled` frame is unchanged: it still closes the turn for the
prompt that started last.
## Tests
- `v2.test.ts`: one `it.each` with the frames in the CLI's order, for a
prompt folded into another prompt's turn and into a cycle that Claude
Code started on its own. Both fail without the fix with `running, idle,
running, idle`.
- `v2-integration.test.ts`: one case against the bundled CLI. It passes
with the fix.
- Live, with the issue's steps: one reply and one `idle` with the real
usage.
## Not covered
- I did not capture what Claude Code sends when a cancel arrives during
work with a folded prompt.
- I observed the frame order on CLI 2.1.323 only.
ACP v1 is not affected: it does not end a turn at a `completed` frame.
When a turn fails with `errorKind: "rate_limit"`, the error's `data` now
also carries the turn's latest `rate_limit_event` info as `rateLimit`:
```json
"data": {
"errorKind": "rate_limit",
"rateLimit": { "status": "rejected", "rateLimitType": "five_hour", "resetsAt": 1763002200 }
}
```
## Why
ACP clients may want to handle a rate-limit failure better than showing
its message, for example by showing when the limit resets or offering to
continue the turn then. That needs the reset time as data. Today the
adapter forwards `rate_limit_event` info only on a `usage_update`
(`_meta["_claude/rateLimit"]`). A message sent while the account is
already over its limit is refused before its first usage, so no
`usage_update` goes out and the client gets only:
```json
"error": { "code": -32603, "message": "Internal error: You've hit your 5-hour limit · resets 5:30pm (America/Los_Angeles)", "data": { "errorKind": "rate_limit" } }
```
Without this change, the only way to get the reset time is parsing that
text.
## What changed
- `turnErrorData` in `src/result-end.ts` builds the `data` of the error
that fails a turn. It adds `rateLimit` only for a `rate_limit` failure
in a turn that saw a `rate_limit_event`. Other failures keep their
current data.
- v2: `TurnReport` records the turn's latest `rate_limit_event` info and
clears it on `reset()`. `idleOutcome` passes it to `turnErrorData`.
- v1: the prompt loop tracks `turnRateLimit` alongside
`lastAssistantError`, resets it with the other per-turn scratch state,
and passes it at the three result-failure sites that used
`errorKindData(lastAssistantError)`.
## Testing
- New v1 and v2 tests: a `rate_limit_event` followed by a `rate_limit`
failure puts `rateLimit` in the error data.
- `npm run build`, `npm run check` and `npm run test:run` pass.
- Manually tested with a locally built binary: a client received
`rateLimit` in the error for a message refused at the 5-hour limit.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
Follow-up to #1612. When a model refuses, Claude Code takes back the
response it already sent and retries on the fallback model. A tool call
of that response which has no result yet is stopped, and no result ever
comes for it. The adapter never read which messages were taken back, so
that tool call stayed open:
- **v1:** until the turn's end, where the prompt then failed with
`incomplete_tool_call`, although the retry had answered.
- **v2:** past the turn's idle, since a call that ran is left open for
its result.
Both cores now end the call as soon as it is named: `failed` on v1,
`cancelled` on v2, with a text that says why.
## What Claude Code sends
Read from the code of CLI 2.1.323. A refusal fallback cannot be produced
on demand, so none of this was observed live.
- The refused response reaches the host as usual: its stream and its
`assistant` frames, which can hold `tool_use` blocks, and the results of
tools that had finished.
- Claude Code then stops the tools that had not finished and sends no
result for them.
- It names the messages it took back, by the `uuid` their frames were
sent with, in two places: `retracted_message_uuids` of the
`model_refusal_fallback` notice, and `supersedes` of the first
`assistant` frame of the retry.
Since 2.1.323 `supersedes` also names a response whose tool call could
not be parsed. Such a response has stop reason `tool_use` and no
`tool_use` block, so it leaves no tool call open, and this change does
nothing for it.
## What changes
- `RetractedToolCalls` in `src/tool-calls/retracted.ts` (new) keeps the
tool uses of each assistant frame by `uuid`, for the last 1,000 frames,
and gives the tool calls of the messages that a frame takes back. It
reads both signals and gives each tool call once.
- `AcpToolCallRenderer.unfinished` gains a `retracted` case with its own
text: "Claude Code replaced the response that made this tool call, and
stopped the call. If it had started, some of its effects may have
happened."
- v1 closes through the existing `closeOpenToolCalls`, which now also
takes the tool call id. The change in `src/v1/acp-agent.ts` is wiring.
- v2 adds `SessionOutput.closeRetracted`, which shares one private
`close` with `closeUnfinished`.
Only a call that is still open is closed. A call that already has its
result is left alone, and a result that arrives after the close changes
nothing.
## Not in this PR
- **Superseded text stays in the transcript.** ACP v1 has no way to take
a message back. On v2 the `agent_message` upsert could clear one
(`content: []`), but that leaves an empty message whose rendering is up
to the client, and v1 and v2 would then differ. This needs a decision,
so it is left as it is.
- A tool use that streamed but whose `assistant` frame never arrived has
no `uuid` to match, so it is not closed by this.
- No scenario-harness case: its plain and Zed recordings must match the
origin/main baseline, so a deliberate difference there needs a
documented exception first.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,128 tests
pass)
- `src/tests/retracted-tool-calls.test.ts` for the shared class
- One `it.each` in `src/tests/v1/acp-agent.test.ts` and one in
`src/tests/v2/acp-v2.test.ts`, with one row per signal. The v1 rows fail
on main with `incomplete_tool_call`.
- The doubles follow the frames as read from the CLI's code, since the
case cannot be reproduced against the real CLI.
## Summary
Follow-up to #1612. With an `availableModels` allowlist, the model
picker rebuilds its rows from the allowlist entries and drops the ones a
managed `deniedModels` list blocks. It decided that with its own rule
(`isDeniedModel`), which differed from Claude Code's in both directions.
The rule is now the SDK's `matchDeniedModels()` (alpha, 0.3.323).
This only affects a session that has both an `availableModels` allowlist
and a managed `deniedModels` list. Without an allowlist the picker shows
Claude Code's own list, which Claude Code has filtered already.
## What Claude Code really does
Measured with CLI 2.1.323: sessions started with `managedSettings: {
deniedModels }`, then `setModel(id)` for each id. No prompt was sent.
The deny check runs before the "not found" check, so a refusal that says
"is restricted by your organization's settings" means the list blocks
the id.
| Entry | Model id | `setModel` | SDK matcher | Old adapter rule |
| --- | --- | --- | --- | --- |
| `claude-opus-5-5` | `vertex_ai/claude-opus-5-5` | refused | denied |
offered |
| `claude-opus-5-5` | `anthropic/claude-opus-5.5`,
`claude-opus-5-5:free` | refused | not denied | hidden |
| `claude-opus-5-5` | `openrouter/anthropic/claude-opus-5.5` | refused |
not denied | offered |
| `claude-opus-5` | `claude-opus-5-5` | refused | denied | hidden |
| `claude-opus-4.5` | `claude-opus-4-5` | allowed | not denied | hidden
|
| `claude-opus-4.5` | `anthropic/claude-opus-4.5` | refused | not denied
| hidden |
| `claude-haiku` | `claude-haiku-5-5` | allowed | not denied | hidden |
| `my-model` | `gateway/my-model` | refused | not denied | offered |
| `my-model` | `my-model:free` | not blocked | not denied | hidden |
| `default`, `opusplan` | the same name | allowed | not denied | hidden
|
Over 169 ids in 30 sessions:
- the old rule offered 14 ids that `setModel` refuses, and hid 27 that
the list does not block;
- `matchDeniedModels` alone missed 33 refused ids. Its doc says so: it
compares an id with the entries, and the CLI also judges path tails and
a model's other names;
- the new rule agrees on all 169.
## The rule
`deniedModelIds` in `src/session-model.ts` asks `matchDeniedModels`
about three spellings of each id, so the entry rules stay the SDK's:
- the id itself;
- its last path segment, because an exact-name entry also blocks
`gateway/my-model`;
- its version spelling: everything from the first `:` dropped, and `5.5`
written `5-5`.
**Workaround to note.** The version spelling is asked behind a fixed
path, `version-of/`. The SDK ignores a path for a versioned id, and the
path keeps the spelling from equalling an exact-name entry. Without it,
the entry `my-model` would block `my-model:free`, which Claude Code
allows. This leans on how the SDK function treats paths, which nothing
documents. The tests hold recorded CLI answers and fail if the path is
removed or if only the id itself is asked.
`isDeniedModel` and its own rule are removed.
`applyAvailableModelsAllowlist` is async now, because the SDK function
is; v1 (`src/v1/acp-agent.ts`) and v2 (`src/v2/setup.ts`) each gain one
`await`. The SDK call takes under 1 ms.
## Not verified
- A custom name such as `gpt-5` answers "not found" on a first-party
account. That is read as "not denied" from the order of the checks; no
gateway was available to confirm it.
- `modelOverrides` targets were checked as plain ids given to
`setModel`.
- `matchDeniedModels().warnings` are not logged: `/status` and `claude
doctor` already list them.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,125 tests
pass)
- The `isDeniedModel` tests became one `it.each` in
`src/tests/model-resolution.test.ts`. Every id in it is a recorded CLI
answer.
- A second, independent run against the real CLI reproduced nine of the
recorded answers.
## Summary
Follow-up to #1612. Logs when a machine policy source may be there and
did not load, using `machinePolicy.didNotLoad` (alpha) that
`resolveSettings()` reports since SDK 0.3.323.
## Why
`resolveSettings()` shows a policy source that it could not read (a
macOS MDM profile, the Windows registry policy, the managed-settings
file) as absent. The adapter then applies nothing from it, and nothing
said so:
- at start-up, `applyManagedPolicyEnv` copies no env vars from it into
the process;
- in `SettingsManager`, the session's settings and model list (managed
`deniedModels`, `availableModels`, `modelOverrides`) do not reflect it.
Claude Code reads the policy itself, so its own read is not affected.
The log line only explains why the adapter's side looks as if no policy
were set.
## What changes
- `unloadedPolicySources` in `src/managed-policy.ts` names the sources
for a log line. It is undefined when every source loaded, and for an SDK
that does not report the member.
- `applyManagedPolicyEnv` writes one line to stderr and still applies
the env vars of the sources that did load.
- `SettingsManager` logs once per change, because it resolves the
settings again after every settings file edit.
Not in this PR: reading the policy again later. The env vars are applied
once at start-up, so a source that loads later is picked up for env vars
only by a restart, which the message says.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,126 tests
pass)
- The real SDK reports `machinePolicy: { didNotLoad: false }` on this
machine; the doubles use that shape.
## Summary
Follow-up to #1612. The context window that `usage_update.size` reports
before Claude Code has said what the window is changes from 200K to 1M,
and the "1m" text heuristic that upgraded it is removed.
## Why
The adapter takes the window from Claude Code: a background
`getContextUsage` at session creation and at every model switch, then
each result's `modelUsage`. Until the first of those lands it reports a
placeholder, `DEFAULT_CONTEXT_WINDOW`.
Since Claude Code 2.1.323 that placeholder is the less likely value.
Asked directly (`getContextUsage`, no prompt sent):
| Model | Window |
| --- | --- |
| An id Claude Code does not know (`my-gateway-model`, `gpt-5`) |
1,000,000 |
| `opus`, `sonnet`, `haiku` | 1,000,000 |
| `claude-haiku-4-5`, `claude-sonnet-4-5` | 200,000 |
| An unknown id or `sonnet` with `CLAUDE_CODE_DISABLE_1M_CONTEXT=1` |
200,000 |
So 1M is what Claude Code itself assumes when it knows nothing about a
model, and what it reports for its current aliases.
## What changes
- `DEFAULT_CONTEXT_WINDOW` is 1,000,000.
- `inferContextWindowFromModel` is gone, with its two callers: the seed
in `immediateContextWindow` and the `message_start` upgrade in the v1
and v2 cores. It only ever turned 200K into 1M for a model whose id,
resolved id, name or description held a "1m" token. With a 1M default it
has nothing left to do, and the table shows that a model's names do not
give its window (`sonnet` is 1M, or 200K under the environment
variable).
- Nothing changes in how the real window is learned: the background
read, the per-result update and the cross-session cache are as before.
For a client: the first `usage_update` of a session or after a model
switch can carry `size: 1000000` where it carried `200000`, until the
read lands (0.2 to 0.6 s in the probe above) or, if the read fails,
until the first result. A model with a 200K window shows 1M for that
moment; before, a model with a 1M window showed 200K.
## Tests
- The session double (`mockSessionState`) starts with the default
window, as a real session does. It held 200K with
`contextWindowAuthoritative: false`, which can no longer occur.
- Tests of the heuristic are removed. Tests that tell a learned window
from the default now use values that differ from 1M.
- The scenario recordings are unchanged: their scripted Claude Code
reports a 200K window, and the read lands before the first turn.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,115 tests
pass; 6 tests of the removed heuristic are gone)
- Real CLI: the `getContextUsage` reads in the table above
## Summary
Updates `@anthropic-ai/claude-agent-sdk` from 0.3.322 to 0.3.323, which
bundles Claude Code 2.1.323. The new version needs two adapter fixes,
both included here:
- the session index reads titles by the SDK's new rule;
- the heartbeat of a long-running hook no longer lands on a tool call.
Also bumps these dev dependencies: `@anthropic-ai/sdk` 1.7.0 → 1.8.0,
`@tsconfig/node22` 22.0.6 → 22.0.7 and `prettier` 3.9.10 → 3.10.1.
`npm update` brings the in-range lockfile bumps: `rolldown` 1.2.18 →
1.2.19, `vite` 8.3.7 → 8.3.8, `hono` 4.13.17 → 4.13.18,
`@hono/node-server` 2.1.6 → 2.1.8, and patch releases of
`@babel/runtime`, `brace-expansion`, `encodeurl`,
`@jridgewell/resolve-uri` and `@rolldown/pluginutils`. `rolldown` 1.2.19
lists its wasm32 binding as an optional dependency, so the lockfile
gains `@rolldown/binding-wasm32-wasi`, `@napi-rs/wasm-runtime`,
`@emnapi/core` and `@emnapi/runtime` (2.0.0-beta.2),
`@emnapi/wasi-threads`, `@tybys/wasm-util` and `tslib`. All are dev-only
and optional.
TypeScript stays at 6.0.3: 7.0.2 is out, but `@typescript-eslint/parser`
8.72.2 still requires `typescript <6.1.0`.
## Session titles
`getSessionInfo` and `listSessions` of SDK 0.3.323 read titles
differently, and neither changelog says so. The session index mirrors
the SDK's rule (`sdkTitles` in `src/session-index/transcript-scan.ts`),
so it has to follow.
- Before: the SDK took the last `"customTitle":"…"` text of the tail or
the head, wherever it stood.
- Now: it parses each line that names the field, from the last one back,
and takes the top-level string of the record. For `customTitle` and
`aiTitle` the record must be of type `custom-title` or `ai-title`.
`lastPrompt` and `summary` may be on a record of any type.
What changes for a client:
- A `customTitle` or `lastPrompt` inside a message is no title. A tool
result that shows a transcript no longer renames the session.
- A `custom-title` record that the start of the 64 KB tail window cuts
is not read. The old rule still found its title text.
- A `custom-title` record appended to a line whose write was cut off is
read.
Checked against the real SDK: a differential run of `sdkTitles` against
`getSessionInfo` over 1,800 generated transcripts gave no mismatch. The
old rule mismatched on 371 of 600. The run is not part of this PR; the
tests in `src/tests/v1/session-index.test.ts` compare each case above
with `getSessionInfo`.
## Hook heartbeats
Since Claude Code 2.1.323, a hook that runs long sends a `tool_progress`
beat every 30 seconds. Recorded from the real CLI:
```json
{
"type": "tool_progress",
"tool_use_id": "hook-PreToolUse-toolu_01X…-heartbeat-0",
"tool_name": "PreToolUse",
"parent_tool_use_id": "toolu_01X…",
"elapsed_time_seconds": 30,
"heartbeat": true
}
```
For a PreToolUse or PostToolUse hook, `parent_tool_use_id` is the tool
call. For a UserPromptSubmit or Stop hook it is an id that names no tool
call. The PostToolUse beats come before the tool result.
Both cores send a beat under an unknown id to the call that
`parent_tool_use_id` names. So without a change, a slow PreToolUse or
PostToolUse hook:
- marked the tool call `in_progress` before it ran, on v1 and v2;
- restarted its elapsed time with the hook's (30 → 1 → 2 → 3 → 30 in the
scenario);
- named the call `PreToolUse` in `_meta.claudeCode.toolName` for a plain
or Zed client.
The adapter now drops these beats. This matches how it already ignores
`hook_started`, `hook_progress` and `hook_response`: hooks have no ACP
surface. The rule that picks the tool call of a beat was written twice,
in `src/v1/acp-agent.ts` and `src/v2/stream.ts`. It is now one function,
`progressToolCallId` in `src/tool-calls/renderer.ts`, which holds the
new rule too.
The `tool-progress` scenario carries a PreToolUse and a PostToolUse
beat. Its recordings for the plain, Zed, AIR and v2 clients are
unchanged, and all four fail without the fix.
## Changelog review
Read the SDK changelog for 0.3.323 and the Claude Code changelog for
2.1.323. No other entry needs a code change:
- **Types.** Doc text and new optional members only, plus one new
`SDKStartupFailureReason` (`managed_settings_not_delivered`).
`startupFailureError` treats a reason it does not list as an internal
error with the CLI's message.
- **Context window of an unknown model id**, 200K → 1M. The adapter
reads the window from Claude Code (`getContextUsage`) at session
creation and at every model switch, so it reports the new value. Its own
200K is only the placeholder until that read lands.
- **`canUseTool` suggestions** no longer hold a Bash allow rule for a
write to `.git` or `.claude`. The adapter then offers no "always allow"
option.
- **`init.plugin_errors`** also lists load errors of plugins that
managed settings enable. The adapter only logs them.
- **`forkSession` with `upToMessageId`** and **`getSessionMessages`**
compaction fixes. Picked up as they are: the adapter has no workaround
for the old behavior.
- **A subagent's WebSearch result can carry `tool_use_result`.** The
code reads only fields that this result does not have. One comment in
`src/async-tasks.ts` said that no subagent result carries one; it now
says Bash results.
- **A permission check that fails after a PreToolUse hook allowed the
call** goes to `canUseTool`, which the adapter always provides.
## Not in this PR
Left for follow-ups, because each is its own change:
- The 200K placeholder for the context window. 1M is now the more likely
value, and with it the "1m" text heuristic has nothing left to do.
- `matchDeniedModels()` (alpha). The adapter's own `isDeniedModel`
disagrees with it on 23 of 875 model and entry pairs.
- `supersedes` on the retry of a response whose tool call could not be
parsed. The adapter does not act on `supersedes`.
- `machinePolicy.didNotLoad` (alpha) of `resolveSettings()`.
## Testing
- `npm run build`, `npm run check`, `npm run test:run` (4,121 tests
pass)
- Real CLI: one short session with slow hooks and
`CLAUDE_CODE_HOOK_HEARTBEAT_INTERVAL_MS=1000`, to record the heartbeat
frames and their order
- Real CLI: `getContextUsage` for unknown and known model ids, without a
prompt
Brings the RFD form of subagent reporting in line with the ACP [Subagent
Sessions RFD](https://agentclientprotocol.com/rfds/subagents), which is
moving to Preview in agentclientprotocol/agent-client-protocol#2800. The
related RFD clarifications merged in
agentclientprotocol/agent-client-protocol#2801. AIR output is unchanged,
and no scenario snapshots changed.
## Changes
- **`unknown` at a conversation reset.** A child that is still working
at `conversation_reset` now reports `unknown` and `capabilities: null`,
not `idle`. The adapter forgets its children at reset, so it can no
longer observe or stop them. v1 reports it on the parent's
`subagent_update`. v2 also sends `state_update` `unknown` on the child.
- Stream end, stream error, `queryEnded`/`retire`, and `worker_restart`
keep `idle`, because the work is known to have stopped.
- In v2, the forgotten child's unfinished tool calls keep their last
status. They are no longer forced to `failed`.
- **`session` tool call content.** Added live and in replay, for the v1
RFD form and v2, only when the child is already announced:
- `TaskStop` whose `task_id` is a child's agent id.
- `SendMessage` that stays visible and targets a child's agent id.
- v1 only: an Agent/Task launch that a permission request keeps visible.
- The reference is repeated on every update that carries content,
because `content` replaces the whole array.
- **Docs.** The README's subagent section matches the code: SendMessage
is hidden and reported as linked messages, `unknown` at reset, `session`
content, and no `session_message_chunk`. Three stale comments are fixed.
## Workarounds and limits
- **Post-response ordering still uses `setTimeout(0)`.** SDK 2.6.0 gives
`onRequest` handlers no responder or after-response hook. The comments
in `src/v2/agent.ts` and `src/v1/acp-agent.ts` now state what the
ordering relies on: the response is queued in the microtask after the
handler returns, and `Connection.sendMessage` is first-in, first-out.
The SDK does not promise this.
- **The `unknown` change assumes Claude Code keeps subagents running
across `/clear`.** That comes from the existing v2 comment and test
double. It was not checked against the real CLI.
- No reference is added when a tool names a child by agent name, or for
v2 launch calls that a permission request shows.
- A child that is idle at reset keeps its `cancel` capability. Unchanged
here.
- A stream error with a client-supplied `spawnClaudeCodeProcess` still
reports `idle`, although closing may not stop a remote CLI.
## Testing
- `npm run build`: clean.
- `npm run check`: clean.
- `npm run test:run`: 73 files passed, 5 skipped. 4117 tests passed, 33
skipped.
- Integration tests against the real CLI were not run.
When the user turns Fast mode on, Claude Code can report
`fast_mode_state: "off"` on the next turn's `system`/init. The adapter
mirrored that into the option but explained it only for reasons listed
in `FAST_MODE_UNAVAILABLE_EXPLANATIONS`. `preference`, `unknown` and any
newer code were dropped, so the toggle snapped off with no reason. This
happens on every turn behind an API gateway that authenticates with
`ANTHROPIC_AUTH_TOKEN` only: Claude Code treats Fast mode as disabled by
the organization (`preference`) without asking the server.
Changes:
- `preference` ("not enabled for your organization or API gateway") and
`unknown` ("currently unavailable") are explained. A reason code the SDK
adds later gets a generic `not available (<code>)`.
- Only `sdk_opt_in_required` (every SDK session starts there; the toggle
is the opt-in) and `pending` (eligibility still resolving) stay
unexplained.
- The notice rule is unchanged: Fast mode was on, then off with an
explained reason. Off without a reason stays quiet, because a `result`
can carry the state from the start of the turn.
- One shared function in `session-fast-mode.ts` serves v1 and v2. In
`src/v1/acp-agent.ts` only comments change.
Limitation: the adapter still offers the toggle up front. Until a
session opts in, Claude Code reports `sdk_opt_in_required` and hides the
account or organization blocker, so the adapter can't tell in advance
that Fast mode will be refused.
Tests: unit tests for each reason, plus v1 and v2 flow tests (set `fast`
on, prompt, init reports off/`preference`). The flow tests fail without
the fix.
Moves `computeSessionFingerprint` and its helpers (`normalizeSkills`,
`OPTION_REBUILDS_SESSION`, `canonicalJson`) verbatim from
`src/v1/acp-agent.ts` into `src/v1/session-fingerprint.ts`. No behaviour
change.
- Only `computeSessionFingerprint` is exported, as before; the helpers
stay private to the new module.
- `session-fingerprint.ts` imports nothing from `acp-agent.ts`. The test
that used `computeSessionFingerprint` now imports it from the new
module.
- Emitted JS differs from `main` only in `dist/v1/acp-agent.js` (one
import, the moved code removed) plus the new module.
Review with `git diff --color-moved` to see the move.
## Problem
When a response stream drops after some blocks arrived, Claude Code
keeps the partial response and writes its own message into the
conversation, e.g. "API Error: Connection lost mid-response. The
response above may be incomplete."
If the partial response contained tool calls, Claude Code runs them and
the turn goes on. Since #1582 the v2 agent sends this text as a
`notice`, but only at the turn's result. In a turn that goes on, the
notice arrived after all the later work, so "the response above" pointed
at the wrong output.
## Change
The v2 agent sends the pending notice as soon as the main conversation
goes on past the failed request: at the next tool result, stream event
or assistant message.
A turn that ends at the failed request behaves as before: the idle's
`error` carries it when the turn fails, and a notice goes out at the
turn's end otherwise.
## Not changed
- v1 keeps its current behaviour, as in #1582.
- `session/load` replay still shows these messages as text.
## Testing
- New v2 case: a kept tool call, the API error message, the tool result,
then more output. The notice comes before the later text. It fails
without the change.
- The test double follows the message shape and order read from the
bundled CLI's code. Not run against a real dropped connection.
- `npm run check`, `npm run build` and `npm run test:run` pass.
## Problem
When an API request fails authentication, the v2 agent hides the message
Claude Code writes for it (#1582) and fails the turn with a bare
`Authentication required`. The reason is lost, for example:
> Failed to authenticate: this login reached its time limit and cannot
be renewed. Run `claude auth login` to sign in again, or use `claude
setup-token` and set CLAUDE_CODE_OAUTH_TOKEN for unattended jobs
A client can then only say that the agent is signed out, not why.
## Change
The turn's `authRequired` error now carries the result's error text in
its message: `Authentication required: <text>`. The code and `data` are
unchanged, so a client that starts its own sign-in from the code behaves
as before.
Text that tells the user to run `/login` is still left out, as that
instruction is for Claude Code's terminal (#863). Only the v2 agent
changes.
## Testing
`npm run check`, `npm run build` and `npm run test:run` pass. The v2
tests now pin both messages: the plain one for the `/login` text, and
the one with the reason for an authentication failure reported on the
assistant message.
Not checked against a real expired login.
Moves the `_session/steering` and `_session/async_task/stop` request
definitions verbatim from `src/v1/acp-agent.ts`, like
`goal-extension.ts` does for goals. No behaviour change.
- `src/v1/steering.ts`: `STEER_METHOD`, the steer priorities,
`SteerRequest`, `SteerResponse`, `parseSteerRequest`.
- `src/v1/async-task-stop.ts`: `ASYNC_TASK_STOP_METHOD`, its request and
response types, `parseAsyncTaskStopRequest`.
- Neither module imports `acp-agent.ts`. The one test that imported
`SteerRequest` from `acp-agent.js` now imports it from `steering.js`.
- Emitted JS differs from `main` only in `dist/v1/acp-agent.js` (imports
and the moved code) plus the two new modules.
Review with `git diff --color-moved` to see the move.
## Summary
The AIR warning for an SDK `api_retry` message had only a title, such as
`Retrying Claude, attempt 2 of 10.`. The user did not see why Claude
retries or how long the next attempt waits. The warning now carries
`details` with the cause and the wait.
## Changes
- `apiRetryWarning(message)` in `src/session-failure-extension.ts`
builds the title and the details. The title text does not change. The
`api_retry` case of `src/v1/acp-agent.ts` only calls it.
- The cause:
- `HTTP 529 (overloaded).` when the CLI sends a status;
- `Connection error: no HTTP response.` for a null status with the
`unknown` kind;
- `No HTTP status (overloaded).` for a null status with a kind. The CLI
sends `overloaded` with no status for an SSE `overloaded_error` event
after HTTP 200, so "no HTTP response" would be wrong there.
- The wait: `Next attempt now.` for 0 ms (a `no_response` retry), `Next
attempt in 8s.`, and whole minutes from 120 s (a background rate-limit
wait), e.g. `Next attempt in 30m.`.
- The `no_response` wait stays in the title only.
- The kind label map has the type
`Record<Exclude<SDKAssistantMessageError, "unknown">, string>`, so a new
SDK kind fails typecheck. A missing `error` reads as `unknown`.
- The 401 skip, the actions and the terminal failures do not change. The
subagent retry path sends a `tool_progress` update and no session
failure, so it does not change. v2 has no `api_retry` session failure.
## Tests
- `src/tests/session-failure-extension.test.ts` (new): 0 ms, minutes,
the 119 s / 2 m boundary, a null status with `cloud_credential_error`,
and a missing `error`.
- `src/tests/v1/acp-agent.test.ts`: the warning details on the wire,
revision 2 replaces the details, and the terminal revision has none. The
test doubles use status and kind pairs and delays that the bundled CLI
really sends.
- `npm run build`, `npm run check`: clean.
- `npx vitest run src/tests/session-failure-extension.test.ts
src/tests/v1/acp-agent.test.ts`: 766 passed, 9 skipped.
- `npm run test:run`: 17 tests in `create-session-options.test.ts`,
`providers.test.ts` and `acp-v2.test.ts` fail on `main` without this
change too. They read the model list of the local environment.
Implements the unstable [Session options
RFD](https://agentclientprotocol.com/rfds/session-options) on ACP v1 and
v2. Both cores advertise the `options` session capability.
## `session/options`
Answers with what a session would start with: modes and config options
on v1, config options and commands on v2.
- A session that the connection holds answers with what it has now.
- Otherwise a query starts as the session's would, without MCP servers,
and closes once its options are read. With `sessionId` it resumes that
session, and an unknown one fails with `-32002`.
- It sends no update and registers no session.
Claude Code only reports its models, modes and agents from a running
process, so there is no way to answer without starting one. The query
runs with `persistSession: false`, so it stores no session and does not
write to a resumed transcript. Two consequences: each call costs a CLI
start, and the user's `SessionStart` hooks run in it. The v2 commands
lack MCP prompts, which the RFD allows.
On v1 this is an `optionsOnly` exit in `createSession`, after the config
options are built and before the session is registered. On v2,
`launchSession` is split into `openQuery` (start the query, build the
config) and the part that makes the session active, and
`session/options` uses only the first.
## Initial `configOptions`
`session/new`, `session/load` (v1) and `session/resume` take
`configOptions`. They are set in list order through the same code as
`session/set_config_option`, so a model entry decides which effort
levels a later entry can pick.
- Two entries with the same `configId` fail with `-32602` before a query
starts. So does a value type that v2 does not take.
- An entry with an unknown `configId`, a value of another type, or a
value the option does not offer is skipped. An entry that Claude Code
refuses is skipped and logged.
- No update goes out for the entries. The response carries the modes and
options, and the warning of an Auto mode fallback waits for the next
prompt, as it does at a session's start.
`session/fork` does not take them yet: the schema has no field for it.
agentclientprotocol/agent-client-protocol#2794 adds one.
## Testing
New tests in `src/tests/v1/create-session-options.test.ts` and
`src/tests/v2/v2.test.ts` cover both versions. The scenario golden files
change only by the new capability in `initialize`.
Not verified against a real Claude Code yet: `persistSession: false`
together with `resume`. The tests run against the mocked SDK.
Stacked on the SDK 2.6.0 update (`acp-sdk-2.6.0`). Merge that first.
`auth/status` and `auth/status_update` carried the detail of an account,
such as the key source or the gateway host, in parentheses in its label:
`Anthropic API key (ANTHROPIC_API_KEY)`. SDK 2.6.0 adds
`AuthAccount.description` for it, so the account is now `label:
"Anthropic API key"` with `description: "ANTHROPIC_API_KEY"`.
`_meta.claudeCode.detail` still carries the detail for clients that read
it there. A client that shows only `label` no longer shows the detail.
The mapping is shared, so v1 and v2 both change.
`docs/air-extensions.md` is updated.
Updates `@agentclientprotocol/sdk` from 2.5.0 to 2.6.0 (schema v1.31.0
and v2.0.0-alpha.15).
The new schema adds `configOptions` to session setup requests. The v2
core converts a setup request to its v1 form, and the v2 entries are not
assignable to the v1 type, so `v1NewSessionRequest` leaves them out.
Nothing reads them yet: a Client only sends them to an Agent that
advertises `session.options`. #1592 serves them.
No behavior change. `npm run check`, `npm run build` and `npm run
test:run` pass.
Fixes#1579.
## Problem
The release executable is built with `bun build --compile`. By default a
compiled Bun executable loads `.env`, `.env.local` and `bunfig.toml`
from its working directory at startup. The editor starts the agent in
the user's project, so:
- The project's dotenv values land in the agent's `process.env` and are
passed on to Claude and every Bash command as real environment
variables. Most frameworks never override a variable that is already
set, so the project's own `.env.test` is silently ignored. In the
reported case this made a test suite drop the dev database.
- A `bunfig.toml` in the project that Bun cannot parse stops the agent
from starting (`SyntaxError: An error occurred while parsing code`, exit
1).
Only the executable is affected; running the npm package under Node does
not load these files.
## Fix
`scripts/build-binary.mjs` passes `--no-compile-autoload-dotenv` and
`--no-compile-autoload-bunfig`. Bun's other two autoloads
(`tsconfig.json`, `package.json`) are already off by default.
## Testing
`scripts/smoke-binary.mjs` gains a check that runs the executable in a
directory containing a `.env`, a `.env.local` and an unparseable
`bunfig.toml`, with Node standing in for `claude` to print the
environment the CLI is spawned with. It fails on an executable built
without the flags and passes with them.
Run locally on macOS arm64 only; the Linux, Alpine and Windows targets
are covered by the `binaries.yml` matrix.
## Problem
A client can pass Claude Code settings in
`_meta.claudeCode.options.settings`, and the CLI gets them as
`--settings`. Idle compaction ignored them: it read only
`settingsManager.getSettings()`, the settings files. A client that sent
`{ idleCompaction: false }` still got `/compact` after about 54 idle
minutes, though the CLI had the setting off. The same went for
`autoCompactEnabled` and the `env` block (`DISABLE_COMPACT`,
`DISABLE_AUTO_COMPACT`, `CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS`). This
affected both ACP v1 and v2.
## Change
- `SettingsManager.getCompactionSettings(override)` resolves
`idleCompaction`, `autoCompactEnabled` and `env` in the CLI's order:
managed settings, then `--settings`, then the user/project/local files.
`env` merges entry by entry. An `undefined` value in the override does
not hide the files' value. This sits next to `getApiKeyHelper` and
`getModelSelectionSettings`, which already take the override the same
way.
- v1 (`src/v1/acp-agent.ts`) and v2 (`src/v2/reports.ts`, via
`ReportsSetup.configuredSettings`) pass the client's settings to it.
`IdleCompaction` itself is unchanged.
## Tests
- `settings-api-key-helper.test.ts`: managed > override > files for each
key and each `env` entry; an `undefined` override key keeps the files'
value.
- `v1/idle-compaction-agent.test.ts` and `v2/acp-v2.test.ts`: a session
started with `settings: { idleCompaction: false }` gets no `/compact`.
Both fail without the wiring change.
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Erdős Péter <6430206+sodre90@users.noreply.github.com>
Fixes#1297.
After `/compact`, `session/load` replays from the summary of the last
compaction only. `getSessionMessages` follows `parentUuid` links, and
Claude Code writes each `compact_boundary` with `parentUuid: null`, so
the chain ends there. The messages before it are still in the `.jsonl`,
and the boundary still links the last one of them in
`logicalParentUuid`; nothing follows that link. The spec requires the
agent to "replay the entire conversation", and the replay test `replays
a compaction as one completed compaction_update at its position`
(`v2/acp-v2.test.ts`) already mocks a prompt before the summary, which
the real SDK never returns.
This now happens without `/compact` too: since #1522, idle sessions
compact on their own. It reproduces in Zed as well
([zed-industries/zed#66523](https://github.com/zed-industries/zed/issues/66523#issuecomment-6644375981)).
- When the chain starts at a compact summary, replay reads the
transcript again through `readHistoryAcrossCompactions`
(`resumed-session.ts`). It loads every record with
`loadFullSessionHistory`, which moves from `fork-session.ts` (where it
reads the inactive branches for the same reason) to sit beside
`findTranscript`. It links each boundary to its `logicalParentUuid` and
passes the records back to `getSessionMessages` as a `sessionStore`. The
SDK's own parsing (queued commands, meta messages, deliveries) is
unchanged.
- The boundary's `preservedSegment` and `preservedMessages` are dropped.
With them, `getSessionMessages` moves the messages a compaction kept to
after the summary, and the relinked boundary then leads from them back
to the summary, so the chain loops and ends there. Without them, the
kept messages replay once, where they were said.
- The v1 agent's `session/load` and the v2 agent's replay both read the
history this way.
- A session without a compaction reads its transcript once, as before.
Resume, fork and rewind still use the active chain. If the second read
fails, replay logs it and sends the active chain, as it does today.
## Testing
- `npm run check` and `npm run build` pass. `npm run test:run` passes
except for 2 tests that fail the same way on `main` on this machine:
`v1/acp-scenarios.test.ts > normalize > replaces only the version of
this adapter and the path of this Node binary` (Node at
`/usr/bin/node`), and `v2/v2.test.ts > lists bypass before auto in
ExitPlanMode's options after plan mode left bypass` (this machine runs
as root, where bypass is not offered).
- New: `compacted session replay` (`v1/acp-agent.test.ts`) replays a
real transcript file with one `/compact` between two prompts to a client
that declares `session.compaction`. It fails on `main` without this
change: the replay has no "hi" and no "Hello".
- New: `replays the messages before a compaction from the transcript`
(`v2/v2.test.ts`) resumes the same transcript on v2 with `replayFrom:
start`. Without the change, the replay has no user message before the
compaction.
- New: `readHistoryAcrossCompactions` (`resumed-session.test.ts`) covers
two compactions, a compaction with both forms of preserved metadata as
Claude Code 2.1.293 writes them, and a session without a compaction.
- On 10 local transcripts with 1 to 10 compactions, no message replays
twice. 9 of them now replay from the first prompt with one summary per
compaction, for example 414 → 1925 messages and 909 → 3693. The tenth
has many records written a second time, and replays 5 of its 10
compactions (1428 → 7526 messages). The second read took 4–220 ms, and
745 ms for that 33,000-line transcript.
- Rechecked with 4 transcripts written by Claude Code 2.1.280 to
2.1.318, with 1, 2, 3 and 6 compactions. `session/load` sends one
`compaction_update` per compaction, where `main` sends only the last
one; for the 6-compaction transcript `main` replays nothing before the
last summary. No summary replays as a user message and no tool call
replays twice.
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
When `CLAUDE_MODEL_CONFIG` or caller-provided SDK settings list a model
that the SDK omits, include those settings when rebuilding the picker.
Configured models such as Bedrock Haiku versions appear with their
provider override IDs and can be selected in both ACP v1 and v2.
Merge file and inline model lists with the SDK's array semantics,
preserve managed allowlists and override precedence, and keep the
existing shallow caller-over-environment merge. The refreshed change
preserves upstream's resumed-model alias handling and uses the v2 setup
path introduced on current main.
This repairs explicitly configured models; it does not discover an older
model from a gateway listing or change the SDK's family defaults.
Validation on upstream main `a1d83c60310f33cbc3cd78f6b6133278e754efd5`
with SDK 0.3.321:
- TypeScript compilation, ESLint and Prettier checks passed using their
installed executables (the host npm script launcher exits 194).
- 181 focused tests passed, including managed policy and environment,
caller-object and caller-file settings; both v1 and v2 select the
configured provider ID.
- The three new v2 regression cases fail on unchanged main because the
configured models are missing.
- Full suite passed: 3,952 tests, 33 skipped. The first sandboxed run
could not open a local socket or receive filesystem watcher events; the
unchanged candidate passed with host test execution.
- No real model inference or live provider calls were used.
---------
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Aleksandr Slapoguzov <aleksandr.slapoguzov@jetbrains.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
On ACP v2, changing the model of an idle session left the session
reporting `running` with no work in progress, and it never reported
`idle` again until some later turn ended. A client that refuses prompts
while the session is `running` could then never send the prompt that
would end it.
## Cause
After `setModel`, Claude Code echoes a user message that carries only
the local command's output:
```json
{
"type": "user",
"message": {
"role": "user",
"content": "<local-command-stdout>Set model to `haiku (claude-haiku-5-5)`</local-command-stdout>"
},
"parent_tool_use_id": null,
"uuid": "…",
"isReplay": true
}
```
The v2 session read every top-level echo as a prompt that Claude Code
took in, and opened a turn for it. A model change runs no turn: no
`command_lifecycle` frame, `result` or `session_state_changed` follows
the echo, so nothing closed that turn.
Captured against the bundled CLI (adapter 0.104.1): `state_update
running` went out 18 ms after `session/set_config_option`, and no `idle`
followed in the next 75 seconds.
## Fix
An echo whose content is only local command output, and whose uuid is
not one of the session's pending prompts, no longer opens a turn. The
check is `isLocalCommandOutput` in `message-filters.ts`, next to the
helpers that already recognize these markers.
The pending-prompt exception keeps a client's own prompt working with a
CLI that sends no `command_lifecycle` frames, where the echo is the only
sign that the prompt was inserted.
## Scope
- v2 only. The v1 core takes its state from `session_state_changed` and
does not open turns at echoes.
- I captured a model change. Other local commands that Claude Code runs
outside a turn and echoes the same way are covered by the same check,
but I did not capture them.
## Testing
- New case in `src/tests/v2/v2.test.ts` sends the echo as the CLI sent
it. Without the fix it fails with `expected [ 'running' ] to deeply
equal []`.
- Reran the capture against the bundled CLI with the fix: no `running`
after either model change, and the next prompt ran `running` then
`idle`.
- `npm run check` and `npm run test:run` pass.
Implements the [`session/set_title`
RFD](https://agentclientprotocol.com/rfds/session-set-title) on ACP v1
and v2.
## What clients get
- v1 advertises `agentCapabilities.sessionCapabilities.title: {}` and v2
advertises `capabilities.session.title: {}`. Both serve
`session/set_title` for every client.
- The session does not need to be loaded. A session that runs on this
connection is renamed through its CLI (`rename_session`). Any other
session gets the `custom-title` and `agent-name` records in every copy
of its transcript, plus the `custom-title.json` sidecar, as the CLI's
`/rename` writes them.
- The title is normalized the way `_session/rename` normalizes it:
whitespace collapsed, cut to the CLI's 200 characters. The response
carries the stored title, as that client's `session/list` shows it. On
v1 an AIR client gets it without the `[archived] ` prefix. An archived
session stays archived.
- A loaded session publishes `session_info_update { title }`. A title
generation in flight finishes first, and no generated title replaces the
client's.
- Errors: a title that is empty after normalization returns `-32602`. A
session that is not loaded and has no transcript returns `-32002`. On
v2, a subagent session is refused, as close and delete refuse it.
## Structure
- The transcript writer behind `_session/rename` lived in
`src/v1/session-index/`, which v2 cannot import. Everything there except
`connection.ts` moves to the shared `src/session-index/` with no change
beyond import paths. `connection.ts` becomes `src/v1/session-index.ts`.
- `src/session-index/rename.ts` holds the rename logic that used to be
in `SessionIndexConnection.rename`/`retitle`. `_session/rename` and
`session/set_title` on both versions call it.
- Clients without `sessionIndex` (and every v2 client) use a
`SessionIndexService` with no list and no watcher (`transcriptWriter`).
Their `session/delete` now runs inside that service's per-session
`exclusive()`, so a delete cannot race a rename that is still appending
records.
- If a restart or resume starts a new query of a v2 session while a
rename runs, v2 renames through the new query too. Its CLI could
otherwise hold the old title and write it back.
This doesn't use the SDK's top-level `renameSession()`. It writes only a
`custom-title` record to the first copy of the transcript it finds, with
no `agent-name` and no sidecar, so a session renamed earlier through
`/rename` would keep its old name in the CLI and in AIR.
## Tests
- v1 (`session-index.test.ts`): a stored session for a client without
the session index; an archived session for three clients (AIR with
`sessionIndex`, AIR without it, a client that is not AIR); unknown
session and empty title.
- v2 (`acp-v2.test.ts`): an active session through its CLI with the
published update; a stored session's records; the rename that a resume
overtakes; unknown session and empty title.
- Golden files: only the `initialize` capability line changes.
`compare.ts` now allows the `title` capability against the origin/main
baseline.
- Not run: `npm run test:integration` against the real CLI. The
delete/rename ordering has no test, since it is a timing race.
Implements the unstable [Session status
RFD](https://agentclientprotocol.com/rfds/session-status) on both
agents, and advertises `status: {}` in the v1 `sessionCapabilities` and
the v2 `capabilities.session`.
## What it answers
| Session | v1 | v2 |
| --- | --- | --- |
| Held by this connection | `open` | `open` with `state` |
| Not held, non-empty transcript stored | `saved` | `saved` |
| Not held, no transcript | `-32002` with `data.sessionId` | same |
| Subagent session | `-32002` | `-32602`, as resume, close, fork and
delete of one |
- The request starts no query, sends no update, and waits for no resume,
restart or close.
- On v2, `state` is the foreground state as a `state_update` snapshot
holds it: with the session's `background` list and without a stop
reason. `V2Background.snapshot` builds it without marking the list as
reported, so a status request does not change which later
`state_update`s go out.
- `saved` or unknown is decided in the new shared
`src/session-status.ts`: a non-empty `<sessionId>.jsonl` in any project
directory. The request names no `cwd`, so a resume with another `cwd`
can still fail with `-32002`. A directory that cannot be read for
another reason than being absent fails the request and does not answer
`-32002`.
## Behaviour to review
- **A v1 session whose query ended reads `open`.** The connection still
holds it, and a `session/load` with the same params returns it as it is,
so `saved` would point the client at a resume that revives nothing. Its
prompts fail with the "session ended" error. v2 drops such a session and
answers from its transcript.
- **A session that was never prompted is unknown once it is closed.**
Claude Code writes the transcript at the first prompt, and a resume of
it fails with `-32002` too.
- **A subagent session does not advertise `status`,** so v2 refuses the
request like its other requests, and v1 does not know the id.
- **`open` is per connection.** Each connection has its own agent and
its own Claude Code processes.
## Not done
- The lookup does one `readdir` and one `stat` per project directory for
each probe of a session that is not held. Sharing the v1 session index's
cached scan is a follow-up.
- Not run against the real CLI (`npm run test:integration`).
## Other changes
- `isSessionId` and `projectsRoot` moved from
`src/v1/session-index/project-dirs.ts` to `src/paths.ts`, so the shared
module can use them.
- The 40 v2 and 2 AIR scenario golden files gain the capability in
`initialize`, and the origin/main comparison allows it, next to
`systemPrompt` and `auth.status`.
- The README lists `session/status` in the v2 surface.
## Problem
When an API request fails, Claude Code writes its own assistant message
into the conversation, e.g. "API Error: Connection lost mid-response.
The response above may be incomplete." The SDK marks it with `error` on
a `<synthetic>` message.
The v2 agent forwarded that message as an ordinary
`agent_message_chunk`, so clients showed it as Claude's own prose. Right
after a thinking block it reads as if Claude wrote it, and a client
cannot tell it apart without matching the string.
## Change
The v2 agent no longer sends that message as Claude's text:
- When the turn fails, the idle's `error` already carries the failure,
so nothing else is sent.
- Otherwise the text goes out as a `notice` with severity `error`, once,
before the turn's idle. A result that repeats the same text is not shown
again.
Claude Code's sign-in message is handled as before.
## Not changed
- v1 keeps its current behaviour: clients with the session-failure
extension already drop this text, and others keep the transcript line.
- `session/load` replay still shows these messages as text.
`getSessionMessages` strips the `error` marker, so replay cannot
identify them without matching prose.
## Testing
- New v2 cases: a notice when the turn ends normally, one notice when
the result repeats the text, and no notice when the idle fails. They
fail without the change.
- `npm run check` and `npm run test:run` pass.
Moves `ClientConnection` and `ChangedMetaClient` verbatim from
`src/v1/acp-agent.ts` into `src/v1/client-connection.ts`. No behaviour
change.
- Both classes gain `export`; nothing else in them changes.
- `client-connection.ts` imports nothing from `acp-agent.ts`.
- The `acp-client.ts` comment that names where `ClientConnection` lives
now points to the new file.
- Emitted JS differs from `main` only in `dist/v1/acp-agent.js` (the
import and the two classes) plus the new `dist/v1/client-connection.js`.
Review with `git diff --color-moved` to see the move.
- Bumps `@anthropic-ai/claude-agent-sdk` 0.3.321 → 0.3.322.
- Runs `npm update` for in-range lockfile bumps: `rolldown` 1.2.16 →
1.2.18, `vite` 6.2.16 → 6.2.17, `express-rate-limit` 8.3.6 → 8.3.7,
`jose` 8.7.3 → 8.7.4.
TypeScript stays at 6.0.3: 7.0.2 is out, but the latest
`@typescript-eslint/parser` (8.72.2) requires `typescript <6.1.0`.
`npm run build`, `npm run check` and `npm run test:run` pass locally.
One test failed once after `npm update` (not captured); four later full
runs all passed, so it looks flaky.
## Summary
- Read the optional `planTier` field from the existing `claude auth
status --json` probe. Display Max subscriptions with `max_20x` as
**Claude Ultra**, while `max_5x` remains **Claude Max**.
- Fall back to the existing subscription label when the tier is missing,
unknown, or malformed. Preserve auth-source precedence and raw plan
metadata.
- Keep the CLI-derived label when a session SDK account read reports the
same identity and plan without a tier. A fresh CLI probe can still
replace the label, including when its tier is absent.
- Cover ACP v1 and v2 notifications and responses, and document the
display behavior.
The SDK AccountInfo omits the plan tier, but the bundled CLI already
emits it in auth-status JSON. This uses that CLI-only field as
best-effort display metadata, without additional probes, direct
credential-file reads, or entitlement checks.
## Validation
- `npm run build`
- `npm run check`
- `npm run test:run` — 4,002 passed, 33 skipped
- Targeted v1 auth-status and v2 protocol tests — 341 passed
- Local bundled CLI smoke check: `subscriptionType: "max"`, `planTier:
"max_20x"` maps to `Claude Ultra`
- Live model integration tests were not run.
## Summary
The ACP `auth/status` account (`label`, `active`, `name`, `email`,
`organization`) has no field for the identity's `detail`: an API key's
source, a gateway's host, or "OAuth token". It was only in
`_meta.claudeCode.detail`, so a client that shows the standard fields
could not tell which API key or gateway is in use.
`toAcpAuthStatus` now appends the detail to the account's `label` in
parentheses:
- `Anthropic API key (ANTHROPIC_API_KEY)`
- `Custom model gateway (gw.example.com)`
- `Claude subscription (OAuth token)`
An identity without a detail keeps its label as it was (`Claude Max`).
## Unchanged
- `_meta.claudeCode` still carries `kind`, `detail` and `plan` on their
own.
- The `_auth/status_update` extension payload (`label` and `detail` as
separate fields).
- The mapping is shared, so v1 and v2 report the same label in
`auth/status` and `auth/status_update`.
## Testing
- `src/tests/v1/auth-status.test.ts` expectations updated for the API
key and gateway labels.
- `npm run test:run`, `npm run check` and `npm run build` pass.
* stream the output of foreground Bash commands ([#1587](https://github.com/agentclientprotocol/claude-agent-acp/issues/1587)) ([378e85d](https://github.com/agentclientprotocol/claude-agent-acp/commit/378e85d06027f5fa1802e94535548747a0feccc9))
* support MCP servers that the client serves over the ACP connection (MCP-over-ACP) ([#1645](https://github.com/agentclientprotocol/claude-agent-acp/issues/1645)) ([20aeb46](https://github.com/agentclientprotocol/claude-agent-acp/commit/20aeb46ecedc60fef26ca8b1439b37e3bbd9b27a))
### Bug Fixes
* an autonomous result naming the original prompt must not end a steered turn early ([#1451](https://github.com/agentclientprotocol/claude-agent-acp/issues/1451)) ([edab713](https://github.com/agentclientprotocol/claude-agent-acp/commit/edab7135028d83efaeaa38d0f8efe62ea7ddf203))
* do not count a confirmWithUser question as an unfinished tool call ([#1644](https://github.com/agentclientprotocol/claude-agent-acp/issues/1644)) ([bcd3cda](https://github.com/agentclientprotocol/claude-agent-acp/commit/bcd3cdad35e4356247303870ac3137675e401227))
* handle invalid file paths in tool reports ([#1419](https://github.com/agentclientprotocol/claude-agent-acp/issues/1419)) ([0073280](https://github.com/agentclientprotocol/claude-agent-acp/commit/0073280b977a69934fb56670943d1ef42e7b687e))
* keep a workflow agent's tool call out of the turn's unfinished tools ([#1638](https://github.com/agentclientprotocol/claude-agent-acp/issues/1638)) ([451bc04](https://github.com/agentclientprotocol/claude-agent-acp/commit/451bc04ae022ef02473bdd92740cf19d8ceb5f3c))
* offer clearing the context on plan approval only when Claude Code's setting is on ([#1627](https://github.com/agentclientprotocol/claude-agent-acp/issues/1627)) ([9d71d12](https://github.com/agentclientprotocol/claude-agent-acp/commit/9d71d12336c392c28967c600f8409841deaab7e0))
* send MCP servers to Claude Code over stdin, not on its command line ([#1647](https://github.com/agentclientprotocol/claude-agent-acp/issues/1647)) ([c4dd80d](https://github.com/agentclientprotocol/claude-agent-acp/commit/c4dd80d7392b035f331b50bfdd802cfb3e144d37))
* update to @anthropic-ai/claude-agent-sdk 0.3.326 ([#1646](https://github.com/agentclientprotocol/claude-agent-acp/issues/1646)) ([4a07639](https://github.com/agentclientprotocol/claude-agent-acp/commit/4a076397c6e785a8dd9166e8ea1df14fe17c52ed))
* allow Claude Enterprise accounts under --hide-claude-auth ([#1641](https://github.com/agentclientprotocol/claude-agent-acp/issues/1641)) ([be2219c](https://github.com/agentclientprotocol/claude-agent-acp/commit/be2219cef1f5b2b93129d5eef4b80574f57bdb1b))
* pass a model id the picker does not list to Claude Code ([#1630](https://github.com/agentclientprotocol/claude-agent-acp/issues/1630)) ([dc769c1](https://github.com/agentclientprotocol/claude-agent-acp/commit/dc769c132cacc8bbc7aff0d512e5ab587a1802e3))
* end the turn task of a cycle that has no turn to claim its result ([#1622](https://github.com/agentclientprotocol/claude-agent-acp/issues/1622)) ([8de4981](https://github.com/agentclientprotocol/claude-agent-acp/commit/8de49818f1172c5187496a736f721dc6d2ba3fec))
* keep Fast mode on when it is turned on after a model switch or mid-turn ([#1637](https://github.com/agentclientprotocol/claude-agent-acp/issues/1637)) ([81650db](https://github.com/agentclientprotocol/claude-agent-acp/commit/81650db3d3ca6f7b640fd5e1bbb5e1ff45f62fb7))
* list a live Monitor whose task Claude Code reports as local_bash ([#1607](https://github.com/agentclientprotocol/claude-agent-acp/issues/1607)) ([41417f6](https://github.com/agentclientprotocol/claude-agent-acp/commit/41417f6eeeb5010c0eb439e256032cd7e9a44e37))
* read the Claude Code stream after a query restart, not at the next prompt ([#1636](https://github.com/agentclientprotocol/claude-agent-acp/issues/1636)) ([c03b66c](https://github.com/agentclientprotocol/claude-agent-acp/commit/c03b66cc9f1aa6aa5e56668ac05e5a7f48418850))
* read the Claude Code stream after every session setup, not at the first prompt ([#1623](https://github.com/agentclientprotocol/claude-agent-acp/issues/1623)) ([7d9e1f6](https://github.com/agentclientprotocol/claude-agent-acp/commit/7d9e1f6135b2c85cd8bdd0e76bc2bcf00795e6c9))
* reject the SDK no-token sentinel in auth guards ([#1609](https://github.com/agentclientprotocol/claude-agent-acp/issues/1609)) ([c203b91](https://github.com/agentclientprotocol/claude-agent-acp/commit/c203b919ecca8a58e11bebb72274a5a203653d88))
* update to @anthropic-ai/claude-agent-sdk 0.3.325 ([#1634](https://github.com/agentclientprotocol/claude-agent-acp/issues/1634)) ([db54135](https://github.com/agentclientprotocol/claude-agent-acp/commit/db5413513cbe58c045885e6bb015abfdb76be524))
* end a v2 turn once when Claude Code folds a prompt into it ([#1618](https://github.com/agentclientprotocol/claude-agent-acp/issues/1618)) ([7e857d5](https://github.com/agentclientprotocol/claude-agent-acp/commit/7e857d59ec777356969ab615af83eef02ac43e59))
* resolve a model preference without a version to the newest listed row ([#1633](https://github.com/agentclientprotocol/claude-agent-acp/issues/1633)) ([e73d790](https://github.com/agentclientprotocol/claude-agent-acp/commit/e73d7909ce0295bfa351da49940e067da02ea0e4))
* send v2 terminal output with CR LF, as a PTY would ([#1632](https://github.com/agentclientprotocol/claude-agent-acp/issues/1632)) ([29dde36](https://github.com/agentclientprotocol/claude-agent-acp/commit/29dde3633a13cb9f32fca6c1578a9d95b9e6c08e))
* update to @agentclientprotocol/sdk 2.7.0 ([#1629](https://github.com/agentclientprotocol/claude-agent-acp/issues/1629)) ([b1c1987](https://github.com/agentclientprotocol/claude-agent-acp/commit/b1c198754d1cb4e086de6c6bc6a9659ae3351a0a))
* report the turn's rate limit in rate-limit failure errors ([#1610](https://github.com/agentclientprotocol/claude-agent-acp/issues/1610)) ([4f474d6](https://github.com/agentclientprotocol/claude-agent-acp/commit/4f474d655b88a075ec7d0124d45cafa0f5565af7))
* report unknown subagent state at a conversation reset and reference children from tool calls ([#1608](https://github.com/agentclientprotocol/claude-agent-acp/issues/1608)) ([4804917](https://github.com/agentclientprotocol/claude-agent-acp/commit/4804917a6fa7050490d1d62c6689e78c231c752a))
* say the cause of an api retry in the AIR warning details ([#1594](https://github.com/agentclientprotocol/claude-agent-acp/issues/1594)) ([4f690e1](https://github.com/agentclientprotocol/claude-agent-acp/commit/4f690e129c01f22e2c2a87e0e0a3c5b503241f15))
### Bug Fixes
* assume a 1M context window until Claude Code reports it ([#1613](https://github.com/agentclientprotocol/claude-agent-acp/issues/1613)) ([9619805](https://github.com/agentclientprotocol/claude-agent-acp/commit/96198053067cf4d7b7440c52036174ad4f54183e))
* end the tool calls of a response that Claude Code took back ([#1616](https://github.com/agentclientprotocol/claude-agent-acp/issues/1616)) ([21f3e04](https://github.com/agentclientprotocol/claude-agent-acp/commit/21f3e0430b693e6b04750ab3018e1eaf726af173))
* explain why Claude Code turns Fast mode off ([#1602](https://github.com/agentclientprotocol/claude-agent-acp/issues/1602)) ([c331e17](https://github.com/agentclientprotocol/claude-agent-acp/commit/c331e178a5df47448be1a3ed2f71270c3aad2433))
* follow Claude Code's rule for managed deniedModels in the model picker ([#1615](https://github.com/agentclientprotocol/claude-agent-acp/issues/1615)) ([c78bcc7](https://github.com/agentclientprotocol/claude-agent-acp/commit/c78bcc7f417fc8d3da66f51021b43f4528826ec0))
* log a managed policy source that did not load ([#1614](https://github.com/agentclientprotocol/claude-agent-acp/issues/1614)) ([ca46b41](https://github.com/agentclientprotocol/claude-agent-acp/commit/ca46b412f51cdb7b5a303c751f5d48c216700887))
* report a mid-turn API error notice where the response broke off ([#1599](https://github.com/agentclientprotocol/claude-agent-acp/issues/1599)) ([4df6999](https://github.com/agentclientprotocol/claude-agent-acp/commit/4df69996ca74adff6c42fc60e4b9b742f2d3fdf5))
* say why the login failed in the v2 authRequired error ([#1598](https://github.com/agentclientprotocol/claude-agent-acp/issues/1598)) ([ecd066c](https://github.com/agentclientprotocol/claude-agent-acp/commit/ecd066c8700955e3456dd9387e6b8317f024e26c))
* update to @anthropic-ai/claude-agent-sdk 0.3.323 ([#1612](https://github.com/agentclientprotocol/claude-agent-acp/issues/1612)) ([ddee24e](https://github.com/agentclientprotocol/claude-agent-acp/commit/ddee24ef8fd0abc0401fb32d567914030fbf6944))
* report the auth detail as the account's description ([#1591](https://github.com/agentclientprotocol/claude-agent-acp/issues/1591)) ([f6d6429](https://github.com/agentclientprotocol/claude-agent-acp/commit/f6d64291876177f9f593415abfc7e50eb7e7ff56))
* serve session/options and initial config options ([#1592](https://github.com/agentclientprotocol/claude-agent-acp/issues/1592)) ([b1763c7](https://github.com/agentclientprotocol/claude-agent-acp/commit/b1763c750aef83fd05ce16901ff1a0d9b4b90234))
### Bug Fixes
* honour the client's settings option in idle compaction ([#1555](https://github.com/agentclientprotocol/claude-agent-acp/issues/1555)) ([b73ee49](https://github.com/agentclientprotocol/claude-agent-acp/commit/b73ee491c8f60a1584a95a7f03557f356e1a991c))
* replay the messages before each compaction on ACP v1 and v2 ([#1430](https://github.com/agentclientprotocol/claude-agent-acp/issues/1430)) ([626015b](https://github.com/agentclientprotocol/claude-agent-acp/commit/626015bf81fd34f952406ae77bf60feb9ca39a16))
* stop the release executable from loading the project's .env and bunfig.toml ([#1589](https://github.com/agentclientprotocol/claude-agent-acp/issues/1589)) ([4a3ff6a](https://github.com/agentclientprotocol/claude-agent-acp/commit/4a3ff6a1eb16075b96676616ab2bbb98694a4d24))
* update to @agentclientprotocol/sdk 2.6.0 ([#1590](https://github.com/agentclientprotocol/claude-agent-acp/issues/1590)) ([9fca22a](https://github.com/agentclientprotocol/claude-agent-acp/commit/9fca22a03bdec5dc265bfdc42df316fb286a8142))
* serve session/set_title on ACP v1 and v2 ([#1585](https://github.com/agentclientprotocol/claude-agent-acp/issues/1585)) ([a4a8534](https://github.com/agentclientprotocol/claude-agent-acp/commit/a4a8534c23b08cdfd7f656d25f9ab16068fd8ffd))
* serve session/status on v1 and v2 ([#1584](https://github.com/agentclientprotocol/claude-agent-acp/issues/1584)) ([6bc2e05](https://github.com/agentclientprotocol/claude-agent-acp/commit/6bc2e058cb27624b4307462ac46167535af400d1))
### Bug Fixes
* include inline model settings in the model picker ([#1488](https://github.com/agentclientprotocol/claude-agent-acp/issues/1488)) ([36cb674](https://github.com/agentclientprotocol/claude-agent-acp/commit/36cb6745897bf9dabcb967b54233c42b860436b3))
* keep a v2 session idle when the model changes between turns ([#1586](https://github.com/agentclientprotocol/claude-agent-acp/issues/1586)) ([f5d7916](https://github.com/agentclientprotocol/claude-agent-acp/commit/f5d79167a649737bdeb1ce3b55ad449a34bb9d47))
* report Claude Code's API error message as a notice in v2 ([#1582](https://github.com/agentclientprotocol/claude-agent-acp/issues/1582)) ([99cc1f3](https://github.com/agentclientprotocol/claude-agent-acp/commit/99cc1f324586fad07f1da14bb9764cd16c64e920))
* carry the auth detail in the ACP account label ([#1573](https://github.com/agentclientprotocol/claude-agent-acp/issues/1573)) ([3d6eb7b](https://github.com/agentclientprotocol/claude-agent-acp/commit/3d6eb7b5b650a1f9e5d2e869e92e313c32dbdc86))
* distinguish Ultra from Max in auth status ([#1574](https://github.com/agentclientprotocol/claude-agent-acp/issues/1574)) ([7d95d30](https://github.com/agentclientprotocol/claude-agent-acp/commit/7d95d30ec3a4813d580b3bfdedb08f03d93a3571))
* update to @anthropic-ai/claude-agent-sdk 0.3.322 ([#1577](https://github.com/agentclientprotocol/claude-agent-acp/issues/1577)) ([b89e449](https://github.com/agentclientprotocol/claude-agent-acp/commit/b89e4497da9184072e7f3c4bb28de79801659222))
* implement the ACP auth/status RFD next to _auth/status_update ([#1570](https://github.com/agentclientprotocol/claude-agent-acp/issues/1570)) ([d202748](https://github.com/agentclientprotocol/claude-agent-acp/commit/d20274897684e8813477389b83a268f2b4f4ad11))
### Bug Fixes
* offer Anthropic Console login in remote environments ([#1572](https://github.com/agentclientprotocol/claude-agent-acp/issues/1572)) ([c09543d](https://github.com/agentclientprotocol/claude-agent-acp/commit/c09543d85ae1067e8df315f1cd3179527701ea16))
- Client MCP servers, including the ones that the client serves over the ACP connection ([MCP-over-ACP](https://agentclientprotocol.com/rfds/mcp-over-acp), `"type": "acp"`)
- An Ultracode session config option, which turns on Claude Code's dynamic workflows for every task. It appears when dynamic workflows are enabled and the model supports ultracode (any model with `xhigh` effort)
-`/mcp` in the chat: the MCP server status as a list. The adapter runs `/mcp reconnect`, `/mcp enable`, and `/mcp disable` through the SDK control API, because Claude Code refuses them in SDK mode. A reconnect of an ACP server that needs authentication starts MCP OAuth through URL elicitation
- Session-scoped long-running goals for AIR through the [goal extension](docs/air-extensions.md#goal) under `_meta.jetbrains.air.goal`
@@ -46,6 +46,10 @@ Claude CLI (`claude`) it runs. Keep them in the same directory; a symlink to
instead, set `CLAUDE_CODE_EXECUTABLE`. On Alpine, install `libgcc` and
`libstdc++` first.
A CLI named with `CLAUDE_CODE_EXECUTABLE` gets a session's MCP servers on its
command line, where other users of the machine can read their `env` and
`headers`. The CLI that comes with the adapter gets them over stdin.
To build one for your machine (needs [Bun](https://bun.sh)) and check it:
```sh
@@ -53,81 +57,6 @@ npm run build:binary
npm run smoke:binary # add `-- --full` to drive a real session; needs a Claude login
```
### Subagent sessions
A client that declares `clientCapabilities.subagents`, other than JetBrains AIR, gets each Agent or
Task subagent as its own child session, following the [subagents RFD](https://github.com/agentclientprotocol/agent-client-protocol/blob/main/docs/rfds/subagents.mdx):
-`subagent_update` on the parent announces the child before any of its traffic, with the
parent's `title` and `description` for it, and reports its work state: `running`,
`requires_action` while one of its requests is open (and `running` again when the last one ends,
unless a cancel withdrew it: the child is stopping then), and `idle` when its work ends, with
`end_turn` or `cancelled` when the SDK gives the reason. A failure is `idle` with the `error`
stop reason and the SDK's error text as its `error`. The child keeps its session for every
delegation to it.
- A child that runs outside its parent's working directory, such as an Agent call with
`isolation: "worktree"`, gets its `cwd` on `subagent_update` before its first tool call. The
adapter takes it from the `cwd` of the child's own hooks: its SubagentStart hook runs before its
first model request. It sends `cwd: null` when the child is back in its parent's directory. A
child in its parent's directory gets no `cwd`, and no child gets `additionalDirectories`: Claude
Code gives a subagent the session's additional directories, so it inherits them. A replay
announces a child with the `cwd` that its transcript recorded, and clears it after the response
when that directory no longer exists.
- Session messages replace the Agent or Task call that launches the child, which its parent is
not shown:
- The launch's prompt is a `session_message` in both transcripts: the parent's outgoing view and
the child's incoming one. Both use the launch's tool use id, and each names the other with the
draft RFD's `recipientMessageId` and `senderMessageId`.
- A foreground child's answer, from the launch's result, is the child's `session_message` to
the parent. In Claude Code's hand-back mode, the child's `SubagentHandback` call is its
message to the parent instead, in both transcripts and linked the same way.
- A launch whose child is never exposed is shown as a tool call after all, with its final
status.
- The message of a SendMessage call that resumes the child is a `session_message` in the child's
transcript. The SendMessage call stays a tool call of the session that made it.
-`session/cancel` on the parent interrupts Claude Code, which stops the foreground children that
the turn waits on. Background children keep running, as the RFD prefers; a client stops one with
its own `cancel`. Each stopped child reports `idle` with `cancelled` from Claude Code's own
events, and its open requests are withdrawn. The adapter ends no child at a cancel itself, so a
child that keeps running keeps its open requests and its open tool calls. To spare background
children, the adapter declares the SDK option `perTaskStopAffordance`, which a client can turn
off in `_meta.claudeCode.options`. That option spares background workflows too, which a client
cannot stop, so the adapter stops them after the interrupt, as Claude Code did without it.
Background commands keep running after a cancel either way. A tool call of a stopped child that Claude Code reports no
result for, such as the command it was running, ends in the child's session before the cancelled
prompt resolves. When Claude Code stops a background child after that, or while no prompt runs,
the tool call ends right after the child reports `idle`. A child that still runs when Claude Code
exits is `idle` with no stop reason.
- A child whose parent is not yet known when it ends is not exposed, since the RFD forbids
guessing its parent.
- A replay restores each child under its live session id, from its own transcript, with the same
session messages as live, and its end is an `idle` before the response.
A launch without Claude Code's metadata file for the child stays an ordinary tool call of the
parent, and a notice, for a client that takes notices, says that subagent history is missing.
- After a load or resume, with or without replay, a SendMessage that resumes an agent from before
it runs that agent in its session from before. Before the agent's traffic, each of its ancestors
that the client was not told about in this connection is announced, parent before child and
with no work state, as the RFD requires. An agent whose launch the session's history does not
record stays unexposed.
- Each running child is announced with the `cancel` capability. `session/cancel` with the child's
session id stops that child's current work, through the SDK's `Query.stopTask`, and not its
parent's: Claude Code also stops the foreground children it waits on, and the parent's turn goes
on. Each stopped child reports `idle` with `cancelled` from Claude Code's own events, and its
requests that the stop withdraws report no `running` first. A replayed child, which no longer
runs, gets no capabilities. A client cannot prompt or otherwise change a child.
An [ACP v2](#experimental-acp-v2) client gets the same without declaring anything, since subagents
are part of v2's baseline. Each child also reports its work state as its own `state_update`, right
after the parent's copy.
JetBrains AIR keeps the earlier draft of the RFD (`subagent_spawned`, `subagent_state_update`),
which it enables with `nativeSubagentSessions` in `_meta.jetbrains.air.capabilities`. See
@@ -151,7 +151,7 @@ The v2 core (`src/v2/`) serves an AIR client only the extensions that ACP v2 doe
Its `initialize` response lists `agentFileChangeReport` and `recommendedValue`.
It also serves the [permission presentation](#permission-presentation), the [question custom answers](#question-custom-answers), the [predicted follow-up prompt](#predicted-follow-up-prompt), and [load replay end](#load-replay-end).
The [agent file-change report](#agent-file-change-report) goes out at the end of the turn that serves the prompt, before the turn's idle `state_update`, because a v2 `session/prompt` is answered when Claude Code takes the prompt in.
ACP v2 covers subagents, background work, file plans, patches, compaction, the system prompt, and turn failures itself, so the v2 core serves no `nativeSubagentSessions`, `backgroundSubagents`, `asyncTasks`, `planFile`, `diffPatch`, `contextCompaction`, `customInstructions`, or `sessionFailure`.
ACP v2 covers subagents, background work, plans, patches, compaction, the system prompt, and turn failures itself, so the v2 core serves no `nativeSubagentSessions`, `backgroundSubagents`, `asyncTasks`, `planFile`, `diffPatch`, `contextCompaction`, `customInstructions`, or `sessionFailure`.
It does not serve the [tool call contract](#tool-call-contract) yet.
### Capabilities
@@ -228,7 +228,7 @@ The adapter keeps them where they are.
## Auth source display
The connection-scoped `_auth/status_update` continues to report agent-owned authentication, not client-owned `providers/set` routing. The adapter also reports the same identity through the ACP `auth/status` method and `auth/status_update` notification (advertised as `auth.status`), with `kind`, `detail` and `plan` under the account's `_meta.claudeCode`. Each notification is sent when its own payload changed. `auth/status` answers with the identity last reported and starts a new read, whose change arrives as a notification. When the active key source is `apiKeyHelper`, the adapter reads the effective helper command through SDK `resolveSettings` / the session's `SettingsManager`, including programmatic settings overrides.
The connection-scoped `_auth/status_update` continues to report agent-owned authentication, not client-owned `providers/set` routing. The adapter also reports the same identity through the ACP `auth/status` method and `auth/status_update` notification (advertised as `auth.status`), with `kind`, `detail` and `plan` under the account's `_meta.claudeCode`. The account's `description` carries the `detail` too, e.g. `label: "Anthropic API key"` with `description: "ANTHROPIC_API_KEY"`. Each notification is sent when its own payload changed. `auth/status` answers with the identity last reported and starts a new read, whose change arrives as a notification. When the active key source is `apiKeyHelper`, the adapter reads the effective helper command through SDK `resolveSettings` / the session's `SettingsManager`, including programmatic settings overrides.
A command containing the whole word `central` and the word sequence `proxy start` is displayed as:
@@ -240,6 +240,8 @@ Matching is case-insensitive and accepts multiple whitespace characters between
Other active helpers use `label: "Anthropic API key"` and `detail: "API key helper"`; unknown key-source identifiers are not exposed as display text. CLI and SDK reads share this presentation, retain stale-probe protection, and suppress unchanged notifications.
For Max subscriptions, the existing `claude auth status --json` probe's optional `planTier` distinguishes `max_20x` (displayed as `Claude Ultra`) from `max_5x` (`Claude Max`). Missing, unrecognized, or malformed tiers fall back to the subscription's usual label. Other subscriptions and auth sources keep their existing classification. The raw `account.plan` and ACP `_meta.claudeCode.plan` remain unchanged. SDK account reads lack the tier, so they preserve the known label for the same account and plan; a fresh CLI read replaces it, including when the tier is absent. This is display metadata, not an entitlement check, and requires no additional probe or direct credential-file reads.
## Zed conventions
The adapter keeps these Zed and upstream conventions unchanged for every client.
@@ -699,7 +701,7 @@ When `matchedAskRule` is present, the adapter offers no persistent choice. A con
| WebFetch | One-time allow; a generated `domain:<hostname>` local rule; reject. |
| Skill | One-time allow; exact skill and optional `prefix:*` local rules; reject. |
| EnterPlanMode | Enter plan mode once, or reject and continue. |
| ExitPlanMode | One keep-context and one clear-context elevated mode (`auto` before bypass before accept edits), manual approval, or reject. |
| ExitPlanMode | One keep-context elevated mode, one clear-context mode (with `showClearContextOnPlanAccept` on), manual approval, or reject. |
| SandboxNetworkAccess | One-time allow; the exact SDK host rule when representable; reject. |
| Computer Use MCP | One-time allow; an exact representable SDK allow suggestion; reject. |
| MCP | One-time allow; an exact representable SDK allow suggestion for that tool; reject. |
@@ -724,7 +726,9 @@ A host removes `Bypass permissions` with `_meta.claudeCode.options.allowDangerou
A `bypassPermissions` settings default then falls back to `default`.
`ExitPlanMode` offers one elevated keep-context choice by priority: `auto`, then `bypassPermissions`, then `acceptEdits`.
A non-empty plan also gets one clear-context choice with the same priority.
When Claude Code's `showClearContextOnPlanAccept` setting is on, a non-empty plan also gets one clear-context choice with the same priority.
The setting is off by default, as in Claude Code.
The adapter reads it as Claude Code does: managed settings first, then the `settings` option of the session, then the user, project, and local settings files.
After that choice, the adapter stops the old private Claude query and hides that internal rejection.
It starts a new private query under the same ACP session.
It continues the turn with `Implement the following plan:` and the complete plan.
@@ -1406,6 +1410,8 @@ Each row carries `_meta.jetbrains.air` with flat row fields of the RFDs. `archiv
ACP's `session/set_title` renames the same way for every client, on v1 and v2, without `sessionIndex`, and returns `{ "title": "…" }`: the title as `session/list` shows it to the client. On v1 an AIR client gets it without the archive prefix, and every other client, and every v2 client, with it.
- A blank title is `-32602`. The adapter collapses whitespace and keeps the first 200 characters, trimmed, as the CLI does. An `[archived] ` prefix of the requested title is dropped: a rename never changes the archive state.
- The title is stored as the title records of [Archive](#archive): a `custom-title` and an `agent-name` record. An archived session keeps its `[archived] ` prefix (and the title is cut to 200 characters with it), so a rename does not unarchive it.
- A session that runs here on a CLI without the `rename_session` control request is refused with `-32600`: its CLI holds the title and would write it back.
@@ -1639,7 +1645,7 @@ Claude Code sends the result of the turn when the main agent stops, also while s
### Hold without the capability
A client that does not declare `backgroundSubagents` gets the hold of issues #864 and #866.
A client that does not declare `backgroundSubagents` gets the hold of issues #864 and #866, unless it gets the RFD form of [subagent sessions](subagent-sessions.md).
The adapter keeps the `session/prompt` request open while a subagent that the turn started or resumed runs.
The subagent output, its permission requests and the followup summary of the model then go out inside the turn.
The turn ends at the followup result, at an `idle` with no live subagent, at `session/cancel`, or when the next prompt starts.
@@ -1668,7 +1674,7 @@ The request has no clear-context option, because the fresh query must continue a
"No, keep planning" stops only the followup cycle. There is no turn to end.
A prompt turn owns the request when the turn is active, or when Claude Code asks before the echo of its prompt.
Then the request has the clear-context option.
Then the request has the clear-context option, when `showClearContextOnPlanAccept` is on.
A turn that took over a followup cycle also owns the request of that cycle, and the accepted plan continues in that turn.
## Context compaction
@@ -1728,8 +1734,9 @@ A client that is not AIR gets neither key.
## Load replay end
ACP has no signal that the history replay of `session/load` is over, other than the response.
ACP v1 has no signal that the history replay of `session/load` is over, other than the response.
The adapter replays the transcript while the Claude Code CLI starts, so the history can arrive long before the response.
ACP v2 has the `replay_complete` update for this, which the adapter sends to every v2 client.
The client declares `loadReplayEnd` in its capabilities. The agent does not advertise it.
After the history replay of the loaded session, the agent then sends one more update for that session:
@@ -1747,7 +1754,7 @@ After the history replay of the loaded session, the agent then sends one more up
- The update has no `title` and no `updatedAt`. A `null` there would clear the value.
- It comes after every replayed update, the subagent history that the replay sends to the child sessions included, and before the `session/load` response.
- It comes also for an empty history.
- It comes for `session/load` of a new or an already live session, and for the ACP v2 `session/resume` with `replayFrom: {type: "start"}`.
- It comes for `session/load` of a new or an already live session, and for the ACP v2 `session/resume` with `replayFrom: {type: "start"}`. On v2 it comes right after the session's `replay_complete`, which marks the same point.
- It does not come when the replay stops or fails. The replay stops when the CLI start fails during the replay.
- It does not come for a live update, and it does not come to a client without the capability.
- The `session/load` can still fail after it, for example when the CLI start fails after the replay. The event means that the recorded history arrived whole. The client decides what to do with the failed load.
@@ -64,4 +64,6 @@ When an ACP client routes the agent through a gateway with `providers/set`, the
The model picker then offers only the SDK models whose resolved model the gateway lists, matched without dates, version suffixes (`-v1:0`), `-fast`, `@` suffixes, context hints (`[1m]`) and provider prefixes, after the `availableModels` allowlist above. On Bedrock, a model the CLI resolved to another region prefix is dropped as well. When the gateway does not list the model a session runs, that is the default model or a resumed session's last model, the session switches to the first remaining picker row.
A 4xx answer means the gateway has no listing: `providers/set` succeeds and nothing is narrowed. A failed listing (network error, a status other than 2xx or 4xx, unexpected body, the 10 s timeout, an invalid header, or a base URL with credentials) fails `providers/set` with a JSON-RPC internal error, and the previous provider stays in effect. A listing that matches no SDK model leaves the session with no model to offer: there is no model config option. Gateways set through `authenticate`, `vertex` providers, and native routing are not listed. Setting the same gateway again (the same protocol, base URL and headers) reuses its listing, unless it answered 4xx; `providers/set` and `providers/disable` apply in the order they arrive, and logout clears the routing after `claude auth logout`, including a `providers/set` still listing; `providers/disable` and logout drop it.
A 4xx answer means the gateway has no listing: `providers/set` succeeds and nothing is narrowed. A failed listing (network error, a status other than 2xx or 4xx, unexpected body, the 10 s timeout, an invalid header, or a base URL with credentials) fails `providers/set` with a JSON-RPC internal error, and the previous provider stays in effect. Gateways set through `authenticate`, `vertex` providers, and native routing are not listed. Setting the same gateway again (the same protocol, base URL and headers) reuses its listing, unless it answered 4xx; `providers/set` and `providers/disable` apply in the order they arrive, and logout clears the routing after `claude auth logout`, including a `providers/set` still listing; `providers/disable` and logout drop it.
If the listing matches none of the models Claude Code reports after the `availableModels` allowlist, session setup (`session/new`, `session/load`, `session/resume`, `session/fork`) fails with an internal error that says to choose a different provider. Open sessions also fail when they restart under that provider: v1 drops them and sends a session failure update to clients with AIR's `sessionFailure` capability; v2 stops their queries and answers later requests with that error and an instruction to resume the session. After choosing a compatible provider, use `session/resume` to continue a stopped v2 session. When no model matches, session setup still succeeds with no model config option if Claude Code reports no models or any allowed model row has no `resolvedModel` (for example an `availableModels` entry Claude Code does not report).
A client that declares `clientCapabilities.subagents`, other than JetBrains AIR, gets each Agent or
Task subagent as its own child session, following the [subagents RFD](https://github.com/agentclientprotocol/agent-client-protocol/blob/main/docs/rfds/subagents.mdx):
-`subagent_update` on the parent announces the child before any of its traffic, with the
parent's `title` and `description` for it, and reports its work state: `running`,
`requires_action` while one of its requests is open (and `running` again when the last one ends,
unless a cancel withdrew it: the child is stopping then), and `idle` when its work ends, with
`end_turn` or `cancelled` when the SDK gives the reason. A failure is `idle` with the `error`
stop reason and the SDK's error text as its `error`. The child keeps its session for every
delegation to it.
- A child that still works when Claude Code starts a fresh conversation, such as for `/clear`, is
`unknown`, and loses its `cancel` capability. Claude Code can keep such a child running, but the
adapter forgets the children of the old conversation, so it reports nothing more for it and
cannot stop it. Its unfinished tool calls keep their status. An idle child keeps its state.
- A child that runs outside its parent's working directory, such as an Agent call with
`isolation: "worktree"`, gets its `cwd` on `subagent_update` before its first tool call. The
adapter takes it from the `cwd` of the child's own hooks: its SubagentStart hook runs before its
first model request. It sends `cwd: null` when the child is back in its parent's directory. A
child in its parent's directory gets no `cwd`, and no child gets `additionalDirectories`: Claude
Code gives a subagent the session's additional directories, so it inherits them. A replay
announces a child with the `cwd` that its transcript recorded, and clears it with the child's
current state (see below) when that directory no longer exists.
- Session messages replace the Agent or Task call that launches the child, which its parent is
not shown:
- The launch's prompt is a `session_message` in both transcripts: the parent's outgoing view and
the child's incoming one. Both use the launch's tool use id, and each names the other with the
RFD's `recipientMessageId` and `senderMessageId`.
- A foreground child's answer, from the launch's result, is the child's `session_message` to
the parent. In Claude Code's hand-back mode, the child's `SubagentHandback` call is its
message to the parent instead, in both transcripts and linked the same way.
- A launch whose child is never exposed is shown as a tool call after all, with its final
status.
- On v1, the parent's prompt turn ends at its result, also while a background child that it
launched or resumed still runs. The child's updates and requests follow the prompt response: the
RFD has a client keep receiving child events after it. The parent's summary when the child ends
comes from a followup cycle out of a turn. Its result ends no turn, and a plan approval it asks
for has no clear-context option.
- A SendMessage call that resumes the child is not shown either. Its message is a
`session_message` in both transcripts, the sender's outgoing view and the child's incoming one,
linked like a launch's prompt. A SendMessage call whose message resumes no announced child,
such as one to the parent, is shown as a tool call, with its final status.
- Every message is one whole `session_message`. The adapter sends no `session_message_chunk`: it
has each message's full text before it reports it, from the input or the result of the tool call
that sent it.
- A tool call that the client is shown and that operates on an announced child of another session
carries the RFD's `session` content, `{ "type": "session", "sessionId": "<child>" }`, after its
other content: a TaskStop call whose `task_id`, or a SendMessage call whose `to`, is the child's
agent id; a SendMessage call that resumed the child and stays shown because a permission request
showed it first; and, on v1, an Agent or Task call that stays shown for the same reason. A
`tool_call_update` without content carries none, since it would replace the content the client
holds. A call that names the child by its name gets no reference: Claude Code resolves the
name, and the adapter cannot tell which agent it picked.
-`session/cancel` on the parent interrupts Claude Code, which stops the foreground children that
the turn waits on. Background children keep running, as the RFD prefers; a client stops one with
its own `cancel`. Each stopped child reports `idle` with `cancelled` from Claude Code's own
events, and its open requests are withdrawn. The adapter ends no child at a cancel itself, so a
child that keeps running keeps its open requests and its open tool calls. To spare background
children, the adapter declares the SDK option `perTaskStopAffordance`, which a client can turn
off in `_meta.claudeCode.options`. That option spares background workflows too, which a client
cannot stop, so the adapter stops them after the interrupt, as Claude Code did without it.
Background commands keep running after a cancel either way. A tool call of a stopped child that Claude Code reports no
result for, such as the command it was running, ends in the child's session before the cancelled
prompt resolves. When Claude Code stops a background child after that, or while no prompt runs,
the tool call ends right after the child reports `idle`. A child that still runs when Claude Code
exits is `idle`, since its work ended with the process: with no stop reason on v1, and on v2
with the `error` stop reason and the error that ends the root's work.
- A child whose parent is not yet known when it ends is not exposed, since the RFD forbids
guessing its parent.
- A replay restores each child under its live session id, from its own transcript, with the same
session messages and `session` references as live, and its end is an `idle` before the response.
Each replayed child's current state follows the response: on v1, the response is what separates
a replayed child state from a current one.
A launch without Claude Code's metadata file for the child stays an ordinary tool call of the
parent, and a notice, for a client that takes notices, says that subagent history is missing.
- After a load or resume, with or without replay, a SendMessage that resumes an agent from before
it runs that agent in its session from before. Before the agent's traffic, each of its ancestors
that the client was not told about in this connection is announced, parent before child and
with no work state, as the RFD requires. An agent whose launch the session's history does not
record stays unexposed.
- Each running child is announced with the `cancel` capability. `session/cancel` with the child's
session id stops that child's current work, through the SDK's `Query.stopTask`, and not its
parent's: Claude Code also stops the foreground children it waits on, and the parent's turn goes
on. Each stopped child reports `idle` with `cancelled` from Claude Code's own events, and its
requests that the stop withdraws report no `running` first. A replayed child, which no longer
runs, gets no capabilities. A client cannot prompt or otherwise change a child: any other request
that names an announced child of a running session fails with `-32602` (Invalid params),
`session/close` and `session/delete` too.
An [ACP v2](../README.md#experimental-acp-v2) client gets the same without declaring anything, since subagents
are part of v2's baseline. Each child also reports its work state as its own `state_update`, right
after the parent's copy. A replay ends each child's history with a `replay_complete` on the child's
session. On v2, the parent's `replay_complete` is what separates a replayed child state from a
current one, so each replayed child's current state follows the root session's `replay_complete`
and comes before the response: on its parent, with the cleared `cwd`, and then as the child's own
`idle`. The notice that subagent history is missing follows the root's `replay_complete` too.
JetBrains AIR keeps the earlier draft of the RFD (`subagent_spawned`, `subagent_state_update`),
which it enables with `nativeSubagentSessions` in `_meta.jetbrains.air.capabilities`. See
* Copies the transcript of `params.sessionId` into a new session.
*
* Fails with invalid params (-32602) for a `cursorId`: the agent sends no
* `cursor_update`, so it issued no cursor, and ACP forbids forking the whole
* session in its place.
*/
exportasyncfunctionforkSession(
params: ForkSessionRequest,
dependencies: ForkSessionDependencies,
):Promise<ForkSessionResponse>{
if(params.cursorId!=null){
throwRequestError.invalidParams(
{cursorId: params.cursorId},
`Session ${params.sessionId} has no cursor ${params.cursorId}: this agent announces no session cursors. Send the request without \`cursorId\` to fork the whole session.`,
);
}
try{
returnawaitforkTranscript(params,dependencies);
}catch(error){
@@ -235,6 +234,7 @@ async function forkTranscript(
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Fix the bug","type":"text"},"messageId":"00000000-0000-4000-8000-00000000c001","sessionUpdate":"user_message_chunk"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Check the file.","type":"text"},"messageId":"msg_r1","sessionUpdate":"agent_thought_chunk"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"I will edit it.","type":"text"},"messageId":"msg_r1","sessionUpdate":"agent_message_chunk"}}}
{"kind":"newSession","payload":{"configOptions":[{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"jetbrains":{"air":{"kind":"plan","version":1}}},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"jetbrains":{"air":{"kind":"auto_review","version":1}}},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"jetbrains":{"air":{"kind":"full_access","version":1}}},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","id":"model","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"modes":{"availableModes":[{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"jetbrains":{"air":{"kind":"plan","version":1}}},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"jetbrains":{"air":{"kind":"auto_review","version":1}}},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"jetbrains":{"air":{"kind":"full_access","version":1}}},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"/goal Ship the feature","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":{"text":"Fix the bug","type":"text"},"messageId":"00000000-0000-4000-8000-00000000c001","sessionUpdate":"user_message_chunk"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"description":"The history of 1 subagent of this session could not be restored.","sessionUpdate":"notice","severity":"info","title":"Some subagent history is not available"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"sessionUpdate":"session_info_update","title":"Fix the app","updatedAt":"2026-01-01T00:00:00.000Z"}}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"},{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionId":"<session>"}}
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.