Compare commits

..

41 Commits

Author SHA1 Message Date
acp-release-bot[bot]
9f1ca6eb9c chore(main): release 0.109.0 (#1665)
🤖 I have created a release *beep* *boop*
---


##
[0.109.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.1...v0.109.0)
(2026-11-19)


### Features

* announce session cursors on v2 and fork at a cursor
([#1658](https://github.com/agentclientprotocol/claude-agent-acp/issues/1658))
([5075d2e](5075d2e0df))
* insert one message per idempotencyKey on v2 session/prompt
([#1657](https://github.com/agentclientprotocol/claude-agent-acp/issues/1657))
([1c0792e](1c0792ea8c))
* order config options as model, effort, fast, ultracode, mode, agent
([#1666](https://github.com/agentclientprotocol/claude-agent-acp/issues/1666))
([f31da7f](f31da7f9f5))
* report Fast mode in the speed config option category
([#1659](https://github.com/agentclientprotocol/claude-agent-acp/issues/1659))
([8990c24](8990c2441d))
* send the predicted next prompt as prompt_suggestions_update
([#1660](https://github.com/agentclientprotocol/claude-agent-acp/issues/1660))
([f20ed1d](f20ed1d96a))


### Bug Fixes

* send a session's settings to Claude Code over stdin
([#1669](https://github.com/agentclientprotocol/claude-agent-acp/issues/1669))
([a768a9f](a768a9f50c))
* update to @anthropic-ai/claude-agent-sdk 0.3.328
([#1668](https://github.com/agentclientprotocol/claude-agent-acp/issues/1668))
([6e30711](6e307116d4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
2026-11-19 14:31:59 +01:00
Ben Brandt
a768a9f50c fix: send a session's settings to Claude Code over stdin (#1669)
## Summary

The adapter now sends a session's `settings` to Claude Code over stdin,
in the SDK's initialize request, as it has done for MCP servers since
#1647. They went in the `--settings` flag before.

Builds on #1668, which updated the SDK to 0.3.328.

## What changes

`cliDelivery()` in `src/claude-cli.ts` replaces `mcpServersDelivery()`.
It returns the SDK options `mcpServersDelivery` and `settingsDelivery`
together, because one rule decides both:

- **The CLI that the adapter ships** gets MCP servers and settings over
stdin: `'initialize'`. Claude Code is then started with
`--await-initialize --initialize-fields=settings` and without
`--settings`.
- **A CLI that `CLAUDE_CODE_EXECUTABLE` names** gets both in flags as
before: `'argv'`. Its version is not known, and an older one fails the
session at startup. Checked with 2.1.323: "unknown option
'--initialize-fields=settings'".
- **Settings stay in the flag when the client's `extraArgs` hold
`settings` or `sdk-url`.** With `settings` there, Claude Code refuses to
start with both ("--initialize-fields=settings cannot be used with
--settings"), and in the flag the `settings` option replaces that
argument, as before. A session with `sdk-url` cannot read the initialize
request at launch, which is why the SDK sends its MCP servers in the
flag too.

Both cores set the two options before the client's options, so a
client's own `mcpServersDelivery` or `settingsDelivery` wins.

The settings in question are the ones the adapter passes as the SDK's
`settings` option: a client's `_meta.claudeCode.options.settings`, the
model configuration of the environment, and the route of a provider or
gateway. A `settings` value that is a file path stays in the flag: the
SDK only sends an object over stdin.

## `settingsDelivery` is not in the SDK's types

SDK 0.3.328 reads `settingsDelivery`, but `sdk.d.ts` does not declare it
and the changelog does not name it. The SDK version is pinned, and no
cast is needed: the options are spread into the query's options.

Nothing fails to compile if a later SDK drops the option. For that case
the v2 integration tests have a new test against the real CLI: it starts
a session with settings, and checks that Claude Code was started with
`--initialize-fields=settings` and that no command line holds the
settings' value.

## Delivery tests in `npm run test:integration`

Each core has a test that expects `'argv'` for the MCP servers and one
for the settings ("sends MCP servers as the CLI takes them", "sends
settings as the CLI takes them"). They now set `CLAUDE_CODE_EXECUTABLE`
themselves.

Before, they relied on the value that `vitest.config.ts` sets for unit
runs only. In `npm run test:integration` the variable is unset, the
adapter's own CLI gets `'initialize'`, and the tests failed. On `main`,
the MCP servers test fails in that run on both cores since #1647. This
PR fixes it.

## Checked against the real CLI

Through the built adapter, on v1 and on v2, without API usage:

| Session | Started with | Result |
| --- | --- | --- |
| A client's `settings` | `--await-initialize
--initialize-fields=settings` | the session starts |
| The same, with the client's `settingsDelivery: 'argv'` | `--settings`
| the session starts |
| A provider with a header (`providers/set`, a local stand-in gateway) |
`--await-initialize --initialize-fields=settings` | the session's model
request reaches the gateway, with the provider's header |

With the SDK alone:

- The settings land in the same layer as before (`flagSettings` in
`getSettings()`), and they survive `applyFlagSettings()` calls for
effort and Fast mode.
- Without a `settings` option, nothing changes in the launch flags.

## Testing

- `npm run build`, `npm run check`, `npm run test:run` (4,375 tests
pass)
- Real CLI: the whole suite, as `npm run test:integration` runs it (with
`CLAUDE_CODE_ENTRYPOINT` unset): 4,406 tests pass and 9 are skipped (the
live capability audits, the baseline recording, and one test that skips
itself). With `CLAUDE_CODE_EXECUTABLE` set, the new integration test is
skipped.
- Real CLI: the probes above
2026-11-19 14:28:44 +01:00
Ben Brandt
6e307116d4 fix: update to @anthropic-ai/claude-agent-sdk 0.3.328 (#1668)
## Summary

Updates `@anthropic-ai/claude-agent-sdk` from 0.3.326 to 0.3.328, which
bundles Claude Code 2.1.328. The new version needs one adapter fix,
included here: a session's settings are released when the SDK refuses
the session's options.

Also bumps these dev dependencies: `@anthropic-ai/sdk` 1.9.0 → 1.10.0
and `vitest` 5.1.0 → 5.1.1.

`npm update` brings the in-range lockfile bumps: `express-rate-limit`
8.7.4 → 8.7.5, `jose` 6.2.17 → 6.2.18, `object-inspect` 1.13.4 → 1.14.0,
`standardwebhooks` 1.1.1 → 1.3.0, `source-map-js` 1.2.2 → 1.2.3 and
`tinybench` 6.2.3 → 6.2.4.

TypeScript stays at 6.0.3: 7.0.2 is out, but `@typescript-eslint/parser`
8.73.0 still requires `typescript <6.1.0`.

## Options that the SDK refuses

SDK 0.3.327 has a breaking change: `query()` refuses options that it
cannot send to Claude Code, and it does so by throwing at once. Recorded
with the real SDK for `hooks: { PreToolUse: [{ matcher: "Bash" }] }`, a
matcher without `hooks`:

- 0.3.326: `query()` returns, and `initializationResult()` rejects with
"a.hooks is not iterable".
- 0.3.328: `query()` throws "The session was not started, because the
hooks option can't be sent to Claude Code: hooks.PreToolUse[0].hooks
must be an array of callbacks. Fix that value and try again."

Both cores disposed the settings of a session that fails to start (the
`SettingsManager` and its file watchers) only when
`initializationResult()` rejected. A `query()` that throws skipped that,
and v1 also left the session's input open. Both cores now release them
there too. On v1, `discardUnregisteredQuery` does it, and takes no query
for this case.

What changes for a client:

- The error for such options is still `-32603`, now with the SDK's
message in `data.details`. Checked through the built adapter on v1 and
v2. The adapter serves the next request as before.
- **The SDK is stricter.** `hooks` with an event that is no list of
matchers, such as `{ "SessionStart": { … } }`, started a session on
0.3.326. It is refused now ("hooks.SessionStart must be an array of
matchers"), for the events that the adapter adds no hooks of its own to.

## Changelog review

Read the SDK changelog for 0.3.327 and 0.3.328 and the Claude Code
changelog for 2.1.327 and 2.1.328. No other entry needs a code change:

- **Types.** Doc text and new optional members, plus one new
`SDKStartupFailureReason` (`initialize_fields_not_delivered`).
`startupFailureError` treats a reason it does not list as an internal
error with the CLI's message.
- **`task_started` has no `prompt` when Claude Code wakes a background
subagent with text of its own**, such as a task notification. Both cores
start a run without a prompt then (`promptText` in
`src/native-subagents.ts`, `startRun` in `src/v2/tasks.ts`), so the
child's session no longer gets that text as a prompt.
- **The error for usage credits that run out mid-response** no longer
names a rate limit. The adapter takes the failure kind from the SDK's
`error` field, not from the text.
- **More calls ask for permission:** `ExitWorktree` for a worktree that
may hold unsaved work, some paths and symbolic links, and a subagent
that a sibling's message resumed. They reach `canUseTool` as any other
request.
- **`agent` and `agents` fixes** (an inline definition wins over one of
the same name, `--agents` survive a plugin reload). Picked up as they
are: the adapter passes a client's `agents` on.
- **"Background agents still running" after an interrupt, and after a
permission request that waited 30 seconds.** Picked up as they are.
- **`CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME`** and
**`CLAUDE_CODE_DISABLE_SHELL_HEAD_START`.** The adapter sets neither, so
it keeps Claude Code's defaults.
- **`getSessionInfo` and `listSessions`** read a transcript as before: a
differential run of 0.3.326 against 0.3.328 over 4,500 generated
transcripts gave no mismatch. The run is not part of this PR.
- **`@anthropic-ai/sdk` 1.10.0.** The adapter uses its types only. The
release adds API error codes and fixes tool runners that the adapter
does not use.
- **`vitest` 5.1.1.** Bug fixes.

## Not in this PR

- A throw of the adapter's own between the settings read and `query()`
still skips the dispose. Example: a client's `hooks.PostToolUse` that is
an object, which the adapter's own merge of the hooks cannot spread.
- `-32602` for options that the SDK refuses. The code is `-32603`, as it
was for these requests before.

## Testing

- `npm run build`, `npm run check`, `npm run test:run` (4,369 tests
pass)
- Each core has a test with a `query()` that throws the SDK's refusal.
Both fail without the fix.
- Real CLI: the integration tests (`RUN_INTEGRATION_TESTS=true`, with
`CLAUDE_CODE_ENTRYPOINT` unset), 941 tests pass, and one that the test
file itself skips
- Real SDK and CLI, without a prompt: the two `hooks` cases above with
0.3.326 and 0.3.328, and through the built adapter on v1 and v2
2026-11-19 13:53:15 +01:00
Ben Brandt
f31da7f9f5 feat: order config options as model, effort, fast, ultracode, mode, agent (#1666)
## What

A session's config options now reach the client in a new order:

|        | Order                                       |
| ------ | ------------------------------------------- |
| Before | mode, model, effort, fast, ultracode, agent |
| After  | model, effort, fast, ultracode, mode, agent |

Options that do not apply to a session are still left out, and the rest
keep this relative order. The order is the same on ACP v1 and v2, and
for a subagent's (child) session, which was mode-first too and now sends
model, effort, mode, agent.

Clients that render config options in list order will show the model
picker first and the mode after ultracode.

## How

- The order is defined once, by option id, as `CONFIG_OPTION_ORDER` in
`src/session-config-options.ts`. `buildConfigOptions` (root sessions,
both cores) and the two senders of a child's options
(`NativeSubagentRuntime.publishConfiguration` on v1,
`ChildConfigurations.unsent` on v2) sort through the new
`orderedConfigOptions`.
- An option with an id the order does not name follows the named ones,
in the order it came.
- `orderedSubagentConfiguration` is removed. It ranked by `category`,
which the agent option does not have, and it did not rank `speed` (Fast
mode). It was not exported from `src/lib.ts`.
- `src/v1/acp-agent.ts` is unchanged: every other write to a session's
list replaces an option in place, by id.

## Tests

- New: the root order with all six options present, and the sorter with
ids the order does not name.
- Updated: `session/new` on v1; `session/new`, `session/resume` and
`session/set_config_option` on v2, including the list a model switch
rebuilds; the child session tests on the shared runtime, v1 and v2.
- 43 scenario golden files are regenerated. Five lines of the
`origin-main` baselines (plain and zed) are reordered in place, as #1533
did, instead of adding an allowed difference to `compare.ts`. Every
changed fixture line differs only in the order of `configOptions`.
2026-11-19 11:46:12 +01:00
Ben Brandt
f20ed1d96a feat: send the predicted next prompt as prompt_suggestions_update (#1660)
A client that advertises `session.promptSuggestions` now gets the prompt
that Claude Code predicts the user sends next, as ACP's unstable
`prompt_suggestions_update`, on v1 and v2.

## Why

Claude Code predicts the next prompt after a turn. The adapter sent that
prediction only to JetBrains AIR, as
`session_info_update._meta.promptSuggestions`, because ACP had no update
for it. ACP now has one, behind the client capability
`session.promptSuggestions` in both versions.

## What a client sees

- **With the capability:** `prompt_suggestions_update` with one
suggestion, whose prompt is one text block. An empty list withdraws it.
- **JetBrains AIR:** the `_meta` form, unchanged. An AIR client that
also advertises the capability gets both, the standard update first.
- **Neither:** nothing, and the session asks Claude Code for no
prediction. On v2 that was so before. On v1 it is new: see "v1 cost"
below.

The standard form follows the rules of the draft pages ("Prompt
suggestions (unstable)"):

- The list is withdrawn when a prompt is accepted, and at a
`conversation_reset`.
- A suggestion that is empty or only whitespace is not sent.
- A prediction that arrives while Claude works is dropped, for example
when another prompt was queued before the result. ACP requires a
prediction to match the conversation when it is sent.
- On v2, the list is withdrawn when foreground work starts without a
prompt, such as a cycle that Claude Code starts after a background task.
- Nothing is replayed. Predictions are not in the transcript.

## How

`PromptSuggestions` in `src/prompt-suggestions.ts`, which both cores
share, keeps one state per form and returns the updates to send. The
`_meta` form keeps the rules it had. The v1 core changes only its
existing call sites, and `src/v2/session-update.ts` passes the new
update through.

`promptSuggestionOptions` in the same module gives both cores the SDK
option, by the rule that `PromptSuggestions.forClient` uses: on for a
client that takes a form of the prediction, absent for any other.

## For the reviewer

- **v1 cost:** on `main`, the SDK option `promptSuggestions: true` is on
for every v1 client, not only AIR, so Claude Code spends a request per
turn on a prediction that a client other than AIR never gets. This PR
turns the option on only for AIR and for a client that advertises the
capability, as v2 does. A v1 client that is neither stops paying for the
prediction and sees no other change: it got nothing of it before. A
client's own `_meta.claudeCode.options.promptSuggestions` still wins, in
both directions.
- **v1 autonomous cycles:** the withdrawal when work starts without a
prompt is v2 only. On v1, a prediction that arrives during such a cycle
is dropped, but a list already shown stays until the next prompt.
- **A session that stays live through a load or resume** keeps its
state, while the client's list is empty by rule. The next clear can send
a redundant empty list, and an identical prediction is not sent again.

## Checked against the real CLI

A client that advertises the capability got one
`prompt_suggestions_update` after the second turn of a session, on v1
and on v2. Claude Code predicts nothing after a session's first turn. I
did not check the queued-prompt case live.

## Tests

- `prompt-suggestions.test.ts` (v1) and `v2.test.ts`: each form alone
and both together, the withdrawal at a prompt, the dropped prediction
while Claude works, and on v2 the withdrawal when work starts without a
prompt.
- `create-session-options.test.ts` (v1): the SDK option is on for AIR
and for a client with the capability, absent for any other client, and
off when the caller passes `false`.

`npm run build`, `npm run check` and `npm run test:run` pass (4364
tests, with `main` merged in). The live check above was made before the
v1 option was gated. I did not repeat it.
2026-11-19 09:46:26 +01:00
Ben Brandt
8990c2441d feat: report Fast mode in the speed config option category (#1659)
The Fast mode config option now has the `speed` category, on v1 and v2.
It was `model_config`.

## Why

ACP has an unstable `speed` category for "an option that changes how
fast the model responds, such as a fast mode toggle" (the [speed config
category
RFD](https://github.com/agentclientprotocol/agent-client-protocol/blob/main/docs/rfds/speed-config-category.mdx),
and the draft session config options pages of both versions).
`model_config` tells a client where to put an option, not what it does.
With `speed`, a client can treat this option like any other agent's fast
mode toggle.

A category needs no capability. A client that does not know `speed`
handles it as an unknown category.

## Changes

- `createFastModeConfigOption` in `src/session-fast-mode.ts` builds the
option for both versions, so one change covers both: `category:
"speed"`.
- The two-value select that a v1 client without boolean options gets now
lists Off before On. ACP asks for the values of a `speed` select from
slowest to fastest.

## For the reviewer

- A client that shows `model_config` options next to the model selector
and does not know `speed` will place Fast mode with its other options.
- A client that picks the select's value by position now gets Off first.
- Nothing in the adapter or in `docs/air-extensions.md` reads the
option's category. I did not check how AIR, Zed or Delta place it.

## Tests

- `fast-mode-config.test.ts` (v1): the category, and the order of the
select's values.
- `acp-v2.test.ts`: the category on v2.

`npm run build`, `npm run check` and `npm run test:run` pass (4338
tests).
2026-11-19 09:34:30 +01:00
Ben Brandt
5075d2e0df feat: announce session cursors on v2 and fork at a cursor (#1658)
Stacked on #1657: both change the same lines of `V2Session.start` and
the same README paragraph. Merge #1657 first. GitHub then points this PR
at `main`.

On v2, the adapter now announces a session cursor before each user
message, and `session/fork` forks at one. This is the validation step of
the [session cursors
RFD](https://github.com/agentclientprotocol/agent-client-protocol/blob/main/docs/rfds/session-cursors.mdx)
for this adapter, with the position that its "Adapter validation" table
calls the one both runtimes share: before a user message.

## What a client sees

- **Live:** a prompt that follows another entry of the conversation gets
a `cursor_update` right after its `user_message`:

  ```json
  {
    "sessionUpdate": "cursor_update",
    "cursorId": "before:<messageId>",
    "capabilities": { "fork": {} },
"anchor": { "type": "user_message", "messageId": "<messageId>",
"position": "before" }
  }
  ```

- **Replay:** `session/resume` with `replayFrom` sends the same update
after each replayed user message, with the same `cursorId`.
- **Fork:** `session/fork` with a `cursorId` copies the history before
that message. A client can edit the message, or send it again, in the
new session.
- Any other `cursorId` fails with `-32602` before anything is copied.
#1655 refused every `cursorId`.

No cursor:

- The first entry of a history. Nothing is before it, and Claude Code
forks at an entry.
- A slash command, live. Claude Code stores a command as command
metadata or not at all, so a replay shows no user message for it.
- A subagent's session. A client cannot fork a child.
- A v1 client. See "Not covered".

## How

`src/session-cursors.ts` owns the rules, for both cores:

- `hasForkCursor` decides which stored user messages have a cursor. The
replay uses it to announce, and the fork uses it to accept, so a fork
accepts exactly the cursors that a replay announces.
- The `cursorId` is derived from the uuid of the user message, which
Claude Code stores. It is the same live, in every replay and after a
restart. The adapter keeps no cursors of its own.
- `forkSession` (`src/fork-session.ts`) reads the stored history as a
replay reads it, with the messages before each compaction, and passes
the uuid of the entry before the cursor's message to the SDK's
`forkSession` as `upToMessageId`.

Live, `V2Session.inserted` announces the cursor with the prompt's
`user_message`. A fork finds it once Claude Code has stored the message.

## Not covered

- **v1.** The RFD's v1 form needs message IDs on every anchored message
and anchors a live prompt `after` the entity before it. That is the
RFD's open question, and it needs its own change in the v1 core. A fork
takes a `cursorId` on v1 too, but a v1 client is told of none.
- **Other positions.** The RFD's table also lists after a tool call's
result and after an agent message that ends a turn. The position before
the next user message covers every turn boundary but the last, and
forking the whole session covers that one.
- **A prompt folded into a running turn.** Its cursor's fork ends at a
tool result. I checked a fork at a turn boundary against the real CLI,
not this case.
- A cursor is never withdrawn: it works for as long as the transcript
holds its message.
- AIR's `_meta.jetbrains.air.fork` point is unchanged. A `cursorId` wins
when a request has both.

## Tests

- `fork-session.test.ts` (real SDK, temporary transcripts): a fork at a
cursor copies the history before its message. An unknown id, the first
entry's and a non-user entry's are rejected, and nothing is copied.
- `v2.test.ts`: the live cursor follows the second prompt's
`user_message`, with none for the first prompt or a slash command. A
replay sends the cursor after its message's chunks. `session/fork`
passes `upToMessageId`, and rejects a cursor that the history does not
have.
- `acp-v2.test.ts`: a replayed subagent session gets no cursor.
- The `task-create-update` golden file gains the cursor of its second
prompt.
- `v2-integration.test.ts` (real CLI, run locally): two prompts, a fork
at the second one's cursor, and the fork's replay shows only the first.

`npm run build`, `npm run check` and `npm run test:run` pass (4351
tests).
2026-11-19 09:32:43 +01:00
Ben Brandt
1c0792ea8c feat: insert one message per idempotencyKey on v2 session/prompt (#1657)
On v2, a `session/prompt` with an `idempotencyKey` now inserts at most
one user message for that key. This is the follow-up that #1655 left
open.

## Why

ACP v2 (schema v2.0.0-alpha.17) added an optional `idempotencyKey` to
`session/prompt`. Every Agent that advertises `capabilities.session`
must support it: a Client that lost a prompt's response sends the prompt
again with the same key, and the Agent answers with the first
`messageId` without inserting a second message.

The adapter accepted the field and ignored it, so a retry was inserted
again and started its work again.

## What a client sees

| The key in this session | Response |
| --- | --- |
| Not seen | The prompt is handled as before. Its `messageId` is
recorded with the key. |
| A prompt with the key is not answered yet | The same outcome as that
prompt, when it is answered. Nothing more goes to Claude Code. |
| A message was inserted with the key | That message's `messageId`. No
update, no new work. |
| A prompt with the key failed, for example with `-32800` after
`session/cancel` | The key is unused. The prompt is handled as a new
one. |

- A key is known for as long as Claude Code stores its message, also
after `session/close`, on a new connection, and after the adapter
restarts.
- A message that Claude Code does not store, such as a local command's,
keeps its key while the session is active on the connection: from its
start to `session/close`, across restarts of the session's query.
- The same key in another session, a fork too, names another prompt.
- Prompts of one key are not compared. A different prompt with a
recorded key is answered as a retry, which the protocol allows.
- The ACP SDK rejects a key that is not a string of 1 to 255 characters
with `-32602` before the adapter sees it.

## How

The protocol suggests storing the key as part of the message's id, and
Claude Code makes that possible: a prompt that the adapter pushes with a
uuid is stored under that uuid.

`src/v2/prompt-keys.ts` owns the keys of one session:

- A keyed prompt gets a version 8 (custom) UUID. Its first 32 characters
are a SHA-256 hash of the session id and the key. Its last 4 hex digits
count the attempts.
- The `messageId` is that uuid, so no update, `session/list` result or
replay shows the key.
- After a resume, the first keyed prompt reads the stored history once
(`getSessionMessages`, with the messages before each compaction, as a
replay reads it) and looks for a user message with the key's prefix. A
session that this connection created needs no read.
- When that read fails, the key counts as unused and the next lookup
reads again. The session stays usable.

`V2Session.prompt` calls `PromptKeys.once`, which returns the pending
attempt's promise, the stored `messageId`, or runs the prompt. The
promise is returned as it is, so the response keeps its order relative
to the turn's `running`.

`V2Agent` keeps one record per session, so a restart of the session's
query (a provider change, new additional directories) keeps the keys.

### Why each attempt has its own uuid

Claude Code ignores a prompt whose uuid it has seen: it echoes it and
starts no turn. A prompt that `session/cancel` answered with `-32800`
may already have reached Claude Code. If the next attempt reused the
uuid, Claude Code could drop it, and the adapter's own record of prompts
that a cancel stopped would take the new attempt for the old one. So an
attempt after a failure gets the next number, and the lookup matches on
the prefix.

## Checked against the real CLI

Bundled Claude Code of `@anthropic-ai/claude-agent-sdk` 0.3.326:

- A pushed version 8 uuid is accepted, echoed, and returned by
`getSessionMessages` as the user message's uuid.
- The same holds for a prompt that waited in Claude Code's queue, and
for one that it folded into a running turn. The raw transcript stores a
folded prompt as a `queued_command` attachment, and `getSessionMessages`
still returns it under the pushed uuid.
- A second push of a uuid gets an echo and an `idle`, with no
`command_lifecycle` frame and no result.

## Not covered

- `$/cancel_request` for a held prompt is still not honored, with or
without a key. The protocol makes it optional.
- A `session/cancel` that arrives while a retry's history lookup runs
answers the retry with `-32800`, also when the message is stored. The
client's next retry gets the `messageId`.
- If Claude Code took in a prompt that a cancel had already answered
with `-32800`, a retry is inserted as a new message. That is today's
behavior for any cancelled prompt.
- v1 has no `idempotencyKey`.

## Tests

- `v2.test.ts`: a retry of an inserted prompt, of a pending one, and
after a failure (with a new uuid). The same key in another session. The
record across a restart of the query. After a close and a resume, a key
that the stored history holds and one that it does not.
- `v2-integration.test.ts` (real CLI, run locally): one message for a
key, and the key is known after `session/close` and `session/resume`.

`npm run build`, `npm run check` and `npm run test:run` pass (4344
tests).
2026-11-19 09:32:43 +01:00
acp-release-bot[bot]
e62d084e9d chore(main): release 0.108.1 (#1650)
🤖 I have created a release *beep* *boop*
---


##
[0.108.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.0...v0.108.1)
(2026-11-18)


### Bug Fixes

* answer -32602 on v1 for a request that names a subagent's session
([#1656](https://github.com/agentclientprotocol/claude-agent-acp/issues/1656))
([253cd84](253cd84ed8))
* close a server tool call whose reply Claude Code gave up on, once its
next reply starts
([#1604](https://github.com/agentclientprotocol/claude-agent-acp/issues/1604))
([3205f0b](3205f0bf02))
* end a v1 turn at its result for a client in the subagents RFD form
([#1603](https://github.com/agentclientprotocol/claude-agent-acp/issues/1603))
([c4b64f6](c4b64f628d))
* reject session setup for an incompatible model provider
([#1506](https://github.com/agentclientprotocol/claude-agent-acp/issues/1506))
([90070d6](90070d6cbf))
* start a session without an MCP-over-ACP server whose local endpoint
cannot open
([#1653](https://github.com/agentclientprotocol/claude-agent-acp/issues/1653))
([96dd2bb](96dd2bb10d)),
closes
[#1651](https://github.com/agentclientprotocol/claude-agent-acp/issues/1651)
* update to @agentclientprotocol/sdk 2.8.0
([#1655](https://github.com/agentclientprotocol/claude-agent-acp/issues/1655))
([b6167a8](b6167a82db))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
2026-11-18 18:14:55 +01:00
Ben Brandt
253cd84ed8 fix: answer -32602 on v1 for a request that names a subagent's session (#1656)
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.
2026-11-18 16:47:24 +01:00
Ben Brandt
b6167a82db fix: update to @agentclientprotocol/sdk 2.8.0 (#1655)
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).
2026-11-18 16:46:44 +01:00
Hussain Hammad
c4b64f628d fix: end a v1 turn at its result for a client in the subagents RFD form (#1603)
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>
2026-11-18 15:01:48 +00:00
Ben Brandt
96dd2bb10d fix: start a session without an MCP-over-ACP server whose local endpoint cannot open (#1653)
## 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
2026-11-18 14:08:22 +01:00
Erdős Péter
3205f0bf02 fix: close a server tool call whose reply Claude Code gave up on, once its next reply starts (#1604)
## 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.
2026-11-17 22:12:53 +01:00
Slapoguzov Alexander
90070d6cbf fix: reject session setup for an incompatible model provider (#1506)
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>
2026-11-17 21:54:08 +01:00
acp-release-bot[bot]
a6ba98ff3c chore(main): release 0.108.0 (#1642)
🤖 I have created a release *beep* *boop*
---


##
[0.108.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.107.3...v0.108.0)
(2026-11-17)


### Features

* stream the output of foreground Bash commands
([#1587](https://github.com/agentclientprotocol/claude-agent-acp/issues/1587))
([378e85d](378e85d060))
* 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](20aeb46ece))


### 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](edab713502))
* do not count a confirmWithUser question as an unfinished tool call
([#1644](https://github.com/agentclientprotocol/claude-agent-acp/issues/1644))
([bcd3cda](bcd3cdad35))
* handle invalid file paths in tool reports
([#1419](https://github.com/agentclientprotocol/claude-agent-acp/issues/1419))
([0073280](0073280b97))
* 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](451bc04ae0))
* 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](9d71d12336))
* send MCP servers to Claude Code over stdin, not on its command line
([#1647](https://github.com/agentclientprotocol/claude-agent-acp/issues/1647))
([c4dd80d](c4dd80d739))
* update to @anthropic-ai/claude-agent-sdk 0.3.326
([#1646](https://github.com/agentclientprotocol/claude-agent-acp/issues/1646))
([4a07639](4a076397c6))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
2026-11-17 13:37:02 +00:00
Ben Brandt
c4dd80d739 fix: send MCP servers to Claude Code over stdin, not on its command line (#1647)
## 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.
2026-11-17 13:33:52 +00:00
Ben Brandt
4a076397c6 fix: update to @anthropic-ai/claude-agent-sdk 0.3.326 (#1646)
## 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.
2026-11-17 13:33:51 +00:00
Mikhail Rodionov
451bc04ae0 fix: keep a workflow agent's tool call out of the turn's unfinished tools (#1638)
## 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>
2026-11-17 12:52:59 +00:00
Ben Brandt
20aeb46ece feat: support MCP servers that the client serves over the ACP connection (MCP-over-ACP) (#1645)
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.
2026-11-17 13:47:34 +01:00
Ben Brandt
bcd3cdad35 fix: do not count a confirmWithUser question as an unfinished tool call (#1644)
## 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>
2026-11-17 13:26:26 +01:00
Hussain Hammad
9d71d12336 fix: offer clearing the context on plan approval only when Claude Code's setting is on (#1627)
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>
2026-11-17 11:22:59 +00:00
Viz
378e85d060 feat: stream the output of foreground Bash commands (#1587)
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>
2026-11-17 10:57:15 +00:00
Langning Zhang
0073280b97 fix: handle invalid file paths in tool reports (#1419)
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>
2026-11-16 15:00:24 +00:00
KlausUllrich
edab713502 fix: an autonomous result naming the original prompt must not end a steered turn early (#1451)
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>
2026-11-16 14:39:11 +00:00
acp-release-bot[bot]
7ad73cceb9 chore(main): release 0.107.3 (#1640)
🤖 I have created a release *beep* *boop*
---


##
[0.107.3](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.107.2...v0.107.3)
(2026-11-16)


### Bug Fixes

* allow Claude Enterprise accounts under --hide-claude-auth
([#1641](https://github.com/agentclientprotocol/claude-agent-acp/issues/1641))
([be2219c](be2219cef1))
* pass a model id the picker does not list to Claude Code
([#1630](https://github.com/agentclientprotocol/claude-agent-acp/issues/1630))
([dc769c1](dc769c132c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
2026-11-16 15:34:42 +01:00
Andrey Bragin
be2219cef1 fix: allow Claude Enterprise accounts under --hide-claude-auth (#1641)
## 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.
2026-11-16 15:30:58 +01:00
Sampanna Dahal
dc769c132c fix: pass a model id the picker does not list to Claude Code (#1630)
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>
2026-11-16 14:30:58 +01:00
acp-release-bot[bot]
b437e4ee16 chore(main): release 0.107.2 (#1635)
🤖 I have created a release *beep* *boop*
---


##
[0.107.2](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.107.1...v0.107.2)
(2026-11-16)


### Bug Fixes

* 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](8de49818f1))
* 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](81650db3d3))
* list a live Monitor whose task Claude Code reports as local_bash
([#1607](https://github.com/agentclientprotocol/claude-agent-acp/issues/1607))
([41417f6](41417f6eee))
* 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](c03b66cc9f))
* 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](7d9e1f6135))
* reject the SDK no-token sentinel in auth guards
([#1609](https://github.com/agentclientprotocol/claude-agent-acp/issues/1609))
([c203b91](c203b919ec))
* update to @anthropic-ai/claude-agent-sdk 0.3.325
([#1634](https://github.com/agentclientprotocol/claude-agent-acp/issues/1634))
([db54135](db5413513c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
2026-11-16 11:36:50 +00:00
Ben Brandt
81650db3d3 fix: keep Fast mode on when it is turned on after a model switch or mid-turn (#1637)
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.
2026-11-16 11:33:03 +00:00
Ben Brandt
c03b66cc9f fix: read the Claude Code stream after a query restart, not at the next prompt (#1636)
## 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.
2026-11-16 11:30:10 +00:00
Jonathan Ellis
7d9e1f6135 fix: read the Claude Code stream after every session setup, not at the first prompt (#1623)
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>
2026-11-16 11:16:46 +00:00
Slapoguzov Alexander
c203b919ec fix: reject the SDK no-token sentinel in auth guards (#1609)
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>
2026-11-16 11:14:18 +00:00
Dave Meehan
41417f6eee fix: list a live Monitor whose task Claude Code reports as local_bash (#1607)
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>
2026-11-16 11:13:21 +00:00
Jonathan Ellis
8de49818f1 fix: end the turn task of a cycle that has no turn to claim its result (#1622)
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>
2026-11-16 11:11:03 +00:00
Ben Brandt
db5413513c fix: update to @anthropic-ai/claude-agent-sdk 0.3.325 (#1634)
## 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.
2026-11-16 12:08:00 +01:00
acp-release-bot[bot]
3067a5db36 chore(main): release 0.107.1 (#1619)
🤖 I have created a release *beep* *boop*
---


##
[0.107.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.107.0...v0.107.1)
(2026-11-16)


### Bug Fixes

* end a v2 turn once when Claude Code folds a prompt into it
([#1618](https://github.com/agentclientprotocol/claude-agent-acp/issues/1618))
([7e857d5](7e857d59ec))
* resolve a model preference without a version to the newest listed row
([#1633](https://github.com/agentclientprotocol/claude-agent-acp/issues/1633))
([e73d790](e73d7909ce))
* send v2 terminal output with CR LF, as a PTY would
([#1632](https://github.com/agentclientprotocol/claude-agent-acp/issues/1632))
([29dde36](29dde3633a))
* update to @agentclientprotocol/sdk 2.7.0
([#1629](https://github.com/agentclientprotocol/claude-agent-acp/issues/1629))
([b1c1987](b1c198754d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
2026-11-16 10:46:25 +01:00
nikita-ashihmin
e73d7909ce fix: resolve a model preference without a version to the newest listed row (#1633)
## 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.
2026-11-16 12:30:08 +04:00
John Tur
29dde3633a fix: send v2 terminal output with CR LF, as a PTY would (#1632)
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>
2026-11-16 06:43:00 +00:00
Ben Brandt
b1c198754d fix: update to @agentclientprotocol/sdk 2.7.0 (#1629)
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).
2026-11-14 16:36:26 +00:00
Ben Brandt
7e857d59ec fix: end a v2 turn once when Claude Code folds a prompt into it (#1618)
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.
2026-11-13 13:48:52 +00:00
140 changed files with 7943 additions and 1185 deletions

View File

@@ -1,3 +1,3 @@
{
".": "0.107.0"
".": "0.109.0"
}

View File

@@ -1,5 +1,84 @@
# Changelog
## [0.109.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.1...v0.109.0) (2026-11-19)
### Features
* announce session cursors on v2 and fork at a cursor ([#1658](https://github.com/agentclientprotocol/claude-agent-acp/issues/1658)) ([5075d2e](https://github.com/agentclientprotocol/claude-agent-acp/commit/5075d2e0dffed68c4c1417d67c1c1e3ed43e6549))
* insert one message per idempotencyKey on v2 session/prompt ([#1657](https://github.com/agentclientprotocol/claude-agent-acp/issues/1657)) ([1c0792e](https://github.com/agentclientprotocol/claude-agent-acp/commit/1c0792ea8cbdfb96ac2afb1f675e4309446d0e5c))
* order config options as model, effort, fast, ultracode, mode, agent ([#1666](https://github.com/agentclientprotocol/claude-agent-acp/issues/1666)) ([f31da7f](https://github.com/agentclientprotocol/claude-agent-acp/commit/f31da7f9f5264eb2b57fbda577ac35141eb530c8))
* report Fast mode in the speed config option category ([#1659](https://github.com/agentclientprotocol/claude-agent-acp/issues/1659)) ([8990c24](https://github.com/agentclientprotocol/claude-agent-acp/commit/8990c2441d3d45cb4781cd81316b3ffbafee85ee))
* send the predicted next prompt as prompt_suggestions_update ([#1660](https://github.com/agentclientprotocol/claude-agent-acp/issues/1660)) ([f20ed1d](https://github.com/agentclientprotocol/claude-agent-acp/commit/f20ed1d96ac786af36b6bee3b4d5925a85b6d7ae))
### Bug Fixes
* send a session's settings to Claude Code over stdin ([#1669](https://github.com/agentclientprotocol/claude-agent-acp/issues/1669)) ([a768a9f](https://github.com/agentclientprotocol/claude-agent-acp/commit/a768a9f50c65b66b9f2d5806909a1db643fe3b6e))
* update to @anthropic-ai/claude-agent-sdk 0.3.328 ([#1668](https://github.com/agentclientprotocol/claude-agent-acp/issues/1668)) ([6e30711](https://github.com/agentclientprotocol/claude-agent-acp/commit/6e307116d461af22fb5d42eb4b8fbdb3643c6d6c))
## [0.108.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.0...v0.108.1) (2026-11-18)
### Bug Fixes
* answer -32602 on v1 for a request that names a subagent's session ([#1656](https://github.com/agentclientprotocol/claude-agent-acp/issues/1656)) ([253cd84](https://github.com/agentclientprotocol/claude-agent-acp/commit/253cd84ed84efd38fd9d90faaf954690d1610677))
* close a server tool call whose reply Claude Code gave up on, once its next reply starts ([#1604](https://github.com/agentclientprotocol/claude-agent-acp/issues/1604)) ([3205f0b](https://github.com/agentclientprotocol/claude-agent-acp/commit/3205f0bf0211f9346dad8583944f007bd0ef73c2))
* end a v1 turn at its result for a client in the subagents RFD form ([#1603](https://github.com/agentclientprotocol/claude-agent-acp/issues/1603)) ([c4b64f6](https://github.com/agentclientprotocol/claude-agent-acp/commit/c4b64f628d1fad37ed1d56016b91eefc59df5052))
* reject session setup for an incompatible model provider ([#1506](https://github.com/agentclientprotocol/claude-agent-acp/issues/1506)) ([90070d6](https://github.com/agentclientprotocol/claude-agent-acp/commit/90070d6cbf29f5425e4e08828552f91493dd3e59))
* start a session without an MCP-over-ACP server whose local endpoint cannot open ([#1653](https://github.com/agentclientprotocol/claude-agent-acp/issues/1653)) ([96dd2bb](https://github.com/agentclientprotocol/claude-agent-acp/commit/96dd2bb10d838aeb39d75bb0cfde1c7b4eae958a)), closes [#1651](https://github.com/agentclientprotocol/claude-agent-acp/issues/1651)
* update to @agentclientprotocol/sdk 2.8.0 ([#1655](https://github.com/agentclientprotocol/claude-agent-acp/issues/1655)) ([b6167a8](https://github.com/agentclientprotocol/claude-agent-acp/commit/b6167a82dba9864a13dad31a7cad151704badf5e))
## [0.108.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.107.3...v0.108.0) (2026-11-17)
### Features
* 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))
## [0.107.3](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.107.2...v0.107.3) (2026-11-16)
### Bug Fixes
* 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))
## [0.107.2](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.107.1...v0.107.2) (2026-11-16)
### Bug Fixes
* 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))
## [0.107.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.107.0...v0.107.1) (2026-11-16)
### Bug Fixes
* 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))
## [0.107.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.106.0...v0.107.0) (2026-11-13)

View File

@@ -16,9 +16,10 @@ This tool implements an ACP agent by using the official [Claude Agent SDK](https
- Nested subagent transcripts
- Interactive (and background) terminals
- Custom [Slash commands](https://docs.anthropic.com/en/docs/claude-code/slash-commands)
- Client MCP servers
- 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
- Prompt suggestions: the prompt that Claude Code predicts the user sends next, as ACP's unstable `prompt_suggestions_update`, for a client that advertises `session.promptSuggestions`
- Session-scoped long-running goals for AIR through the [goal extension](docs/air-extensions.md#goal) under `_meta.jetbrains.air.goal`
- Structured errors, recovery, and warnings through the opt-in [session failure extension](docs/air-extensions.md#session-failure)
- Concrete model and effort defaults through the opt-in [recommended config value extension](docs/air-extensions.md#recommended-config-values)
@@ -46,6 +47,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
@@ -64,12 +69,21 @@ for v2 is negotiated down to v1. With `v2`, the adapter rejects the `initialize`
`auto`, the default, serves both.
On v2 the adapter serves the session baseline (`session/new`, `session/list`, `session/resume`
with replay, `session/close`, `session/prompt`, `session/cancel`), `session/delete`,
`session/fork`, `session/status`, `session/options` (with initial `configOptions` on `session/new` and
`session/resume`), `session/set_title`, additional directories, config options (the mode is one), plans, notices,
with replay, which `replay_complete` ends, `session/close`, `session/prompt`, `session/cancel`), `session/delete`,
`session/fork`, `session/status`, `session/options` (with initial `configOptions` on `session/new`,
`session/resume` and `session/fork`), `session/set_title`, additional directories, config options (the mode is one), plans, notices,
compaction, display terminals for commands, permission requests, elicitation, providers, auth, and
[subagents](docs/subagent-sessions.md). Steering is v1 only for now.
`session/prompt` takes an `idempotencyKey`: a prompt that a client sends again with the same key
is inserted once, and the retry gets the first `messageId`. The key is known for as long as Claude
Code stores the message, also after a restart.
The adapter announces a session cursor (`cursor_update`) before each user message that follows
another entry of the conversation, live and in a replay. `session/fork` with its `cursorId` copies
the history before that message, and fails with `-32602` for any other `cursorId`. A v1 client gets
no cursors yet.
v2 is served by the v2 agent in `src/v2/`, which runs straight on Claude
Code instead of translating to v1. A v2 client that declares JetBrains AIR
(`_meta.jetbrains.air`) also gets the AIR extensions that ACP v2 does not cover.

View File

@@ -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
@@ -701,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. |
@@ -726,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.
@@ -857,8 +859,9 @@ A failed command restores the previous state.
After a turn, the Claude Code CLI can predict the prompt the user is likely to send next.
The adapter asks for it with the SDK option `promptSuggestions: true` and forwards the one prediction of the turn.
It asks only in a session of AIR or of a client that advertises `session.promptSuggestions`, on v1 and v2: a prediction costs a request per turn, and no other client would get it.
ACP has no field for a composer prefill, so the prediction travels outside the AIR namespace:
AIR reads the prediction from a `_meta` key outside the AIR namespace, which the adapter used before ACP had an update for it:
```json
{
@@ -867,9 +870,20 @@ ACP has no field for a composer prefill, so the prediction travels outside the A
}
```
The key names no vendor, so another client can read it.
The key names no vendor.
The adapter sends it only to an AIR client; see the [compatibility rule](#compatibility-rule).
Any client that advertises `session.promptSuggestions` gets the same prediction as ACP's unstable `prompt_suggestions_update`, on v1 and v2:
```json
{
"sessionUpdate": "prompt_suggestions_update",
"suggestions": [{ "prompt": [{ "type": "text", "text": "Run the tests" }] }]
}
```
An AIR client that advertises the capability gets both.
AIR shows the first non-blank `suggestions[].text` as gray text in an empty composer.
Tab fills the composer with it and sends nothing.
@@ -880,6 +894,11 @@ Tab fills the composer with it and sends nothing.
A prediction the next prompt outran — the user sent it before the adapter read the prediction off the SDK stream — is dropped instead of published.
`prompt_suggestions_update` follows two more rules of ACP, which the `_meta` form does not:
- a prediction that arrives while Claude works, such as on a prompt that was queued before the turn's result, is dropped;
- on v2, the list is withdrawn when foreground work starts without a prompt, such as a cycle that Claude Code starts after a background task ends.
The CLI predicts nothing on the first turn of a session, after an API error, in plan mode, and at the account's usage limit, so many turns end with no prediction.
A client must treat a turn without one as normal.
A caller can turn the whole feature off with `_meta.claudeCode.options.promptSuggestions: false` on `session/new`; a user can turn it off in Claude Code settings or with `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false`.
@@ -1643,7 +1662,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.
@@ -1672,7 +1691,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
@@ -1732,8 +1751,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:
@@ -1751,7 +1771,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.

View File

@@ -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).

View File

@@ -20,8 +20,8 @@ Task subagent as its own child session, following the [subagents RFD](https://gi
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.
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
@@ -32,6 +32,11 @@ Task subagent as its own child session, following the [subagents RFD](https://gi
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,
@@ -65,7 +70,8 @@ Task subagent as its own child session, following the [subagents RFD](https://gi
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.
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
@@ -78,11 +84,17 @@ Task subagent as its own child session, following the [subagents RFD](https://gi
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.
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.
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

366
package-lock.json generated
View File

@@ -1,16 +1,16 @@
{
"name": "@agentclientprotocol/claude-agent-acp",
"version": "0.107.0",
"version": "0.109.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@agentclientprotocol/claude-agent-acp",
"version": "0.107.0",
"version": "0.109.0",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "2.6.0",
"@anthropic-ai/claude-agent-sdk": "0.3.323",
"@agentclientprotocol/sdk": "2.8.0",
"@anthropic-ai/claude-agent-sdk": "0.3.328",
"diff": "9.0.0",
"zod": "4.6.7"
},
@@ -18,29 +18,29 @@
"claude-agent-acp": "dist/index.js"
},
"devDependencies": {
"@anthropic-ai/sdk": "1.8.0",
"@anthropic-ai/sdk": "1.10.0",
"@eslint/js": "10.0.1",
"@tsconfig/node22": "22.0.7",
"@types/node": "26.6.6",
"@typescript-eslint/eslint-plugin": "8.72.2",
"@typescript-eslint/parser": "8.72.2",
"@typescript-eslint/eslint-plugin": "8.73.0",
"@typescript-eslint/parser": "8.73.0",
"ajv": "8.20.0",
"ajv-formats": "3.0.1",
"eslint": "10.14.0",
"eslint": "10.15.0",
"eslint-config-prettier": "10.1.8",
"globals": "17.14.0",
"prettier": "3.10.1",
"typescript": "6.0.3",
"vitest": "5.1.0"
"vitest": "5.1.1"
},
"engines": {
"node": ">=22"
}
},
"node_modules/@agentclientprotocol/sdk": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-2.6.0.tgz",
"integrity": "sha512-3FtL6MkAV5F9qxg0FQV8wmBszIm2xuVPoDWOILIFSDQ+Vq3Twdh7Cw6Hk2GOPUbevgrTUpUAqZXQy7Geaj79mw==",
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-2.8.0.tgz",
"integrity": "sha512-EjsvoRX8nEH2z3PAVI2ILsVXAefVcSlLPeXGjlQoFgkJE71F2J0Fj7N6oL/k7SnP0vY+9hmONPFz/K2zalnTiw==",
"license": "Apache-2.0",
"peerDependencies": {
"@modelcontextprotocol/server": "^2.4.0",
@@ -53,22 +53,22 @@
}
},
"node_modules/@anthropic-ai/claude-agent-sdk": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.323.tgz",
"integrity": "sha512-GXIczMzzceNWB+bIImK59hWOQoBWZtSw+AESPc/qbAWmmHM8Wrqb5KvTwWZ07CmjyC/KcPC47nOLxxyHlWqKPA==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.328.tgz",
"integrity": "sha512-YcOWlpXVm7etPjPVrvSJEfynDksMiG11zvEybSBnk1EVWji6rSjU75HbbhJ8XPEB2ECEwRRP597Udu6IWMtsDw==",
"license": "SEE LICENSE IN README.md",
"engines": {
"node": ">=18.14.0"
},
"optionalDependencies": {
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.323",
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.323",
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.323",
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.323",
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.323",
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.323",
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.323",
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.323"
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.328",
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.328",
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.328",
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.328",
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.328",
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.328",
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.328",
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.328"
},
"peerDependencies": {
"@anthropic-ai/sdk": ">=0.93.0",
@@ -77,9 +77,9 @@
}
},
"node_modules/@anthropic-ai/claude-agent-sdk-darwin-arm64": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.323.tgz",
"integrity": "sha512-hWkXHsSMIv+78duw3mDi0bndCpWquGuMrCX6C7G9LzEtpcd+ZvzI5ZE4E6SwqX1bSy8rxhEg+hVJSTk4ABoxpA==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.328.tgz",
"integrity": "sha512-vjBASSSZFNs5M84XONCM4xAJMKPD0E9RtF0UDQ/a1Qqt5L+slNxhSADkH5n0tEM5HJMK7j9DCPi+0FVOBpZr3w==",
"cpu": [
"arm64"
],
@@ -90,9 +90,9 @@
]
},
"node_modules/@anthropic-ai/claude-agent-sdk-darwin-x64": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.323.tgz",
"integrity": "sha512-JHtMk+FBRQPvH046dUIda6s6bza8CRQkaAdy96JwV1zqgi3mtlAg5yXFxPA/QNoiHz5Ul225wCZr9lR7gbwkMg==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.328.tgz",
"integrity": "sha512-pkZuDNi16H4yJFo6cS2sw8mFj7m7ESAxV74t2gQ9EFzZOpXbQoJqhPBHNEZJ2q/+kr/3vHUtRc2W6jURA6nS+A==",
"cpu": [
"x64"
],
@@ -103,9 +103,9 @@
]
},
"node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.323.tgz",
"integrity": "sha512-ONhCJapk9UxpaZ3HY1GTZezMoiQ6Ab7fIubS+dJeXIyj8aQjGQALHQoEl9D1Hrr+q5ppZPOAt0hg69x8aGbTBA==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.328.tgz",
"integrity": "sha512-VvsUzOEf7r3ZtOPfliNGxqknsIvxEmnUOtQnq4+uw7MsfiALKR4s0bx2SP32UuXpqbmqxR1gn456D27XgsAmnA==",
"cpu": [
"arm64"
],
@@ -119,9 +119,9 @@
]
},
"node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64-musl": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.323.tgz",
"integrity": "sha512-N+ZTBRQj8Ew3/eLCZE7JADceyN6Yi1CncJAdzknF5RL9dckIujv4B7C9neBNOXdo+bGFEysjPcUbVsaRkPguKQ==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.328.tgz",
"integrity": "sha512-4Vui26/OZwr8AU7FpAt+R5s/1AKmj5qDorUZIqF1MMfdjAQf8/ut/+HyEkuMom/MVF2JeQLdvnFFFmbfgmAq/g==",
"cpu": [
"arm64"
],
@@ -135,9 +135,9 @@
]
},
"node_modules/@anthropic-ai/claude-agent-sdk-linux-x64": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.323.tgz",
"integrity": "sha512-9M0rnLcCa9sJdZoRCPbjyMOv3raoJm39u348t2ozCgE35Y9e/jGgxy+rG2jfRTaCBILDDrR57ClRQVRlpNeLpQ==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.328.tgz",
"integrity": "sha512-saP4fWgVZj1n7MYCqvTKADHXIc/hIAMRDpLVpXD5xB0IT68vhWgIMkzIrsg5P02P6zA49TDuoijbP1YBUEXT4A==",
"cpu": [
"x64"
],
@@ -151,9 +151,9 @@
]
},
"node_modules/@anthropic-ai/claude-agent-sdk-linux-x64-musl": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.323.tgz",
"integrity": "sha512-QMaFszyJraPnZyJTy6K9vr1wVA/4MIjWSFcaByGv/x3Hk/F7smsMnqpuATO6M6bRsev+IVPj0p6rsdpYAdt1yA==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.328.tgz",
"integrity": "sha512-oJowzzjhWGbdBGyRjqV9CT0nfh4A4/fEI11LjX6b1SkhrNNgy9QT2HzSe8A2yNlliOWo1xJl6nAHT8pLwMNlVg==",
"cpu": [
"x64"
],
@@ -167,9 +167,9 @@
]
},
"node_modules/@anthropic-ai/claude-agent-sdk-win32-arm64": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.323.tgz",
"integrity": "sha512-FS+eYSMU/x8Hmy98zypoOw9/+jMgtGmBEyYmE+jJUCdb3a4k1pwcx08XGici/hnBR3xiKK65ifxwVg2oNyZocQ==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.328.tgz",
"integrity": "sha512-FkqzA++c+giPH2k8svb0egWDiGDkvSLQJTp5bq7QFXOxPEael4ct1yjKit/Yu6Sd48uLEgNT1waBYbyApPzhOw==",
"cpu": [
"arm64"
],
@@ -180,9 +180,9 @@
]
},
"node_modules/@anthropic-ai/claude-agent-sdk-win32-x64": {
"version": "0.3.323",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.323.tgz",
"integrity": "sha512-mW2h1o0Kt92AKZBr05AwE3izJTAYpWNUurOppPdzH/hditbT1zwc0tAJ3p+G+XMkqUWenJNbpunVG0utfQ2hmA==",
"version": "0.3.328",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.328.tgz",
"integrity": "sha512-9Wd0XrZ0QWkgtcKxObcYDvUpQjUzN3Uq4Chbvu1SOWOoKPfQdD40dwRQMCeKx2KGxAfMrggJ7I3JYnvRWAFYjg==",
"cpu": [
"x64"
],
@@ -193,9 +193,9 @@
]
},
"node_modules/@anthropic-ai/sdk": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.8.0.tgz",
"integrity": "sha512-yDOArk2+Qpd/djEKmZjrv7JZ+pn5iBHARJ9PAdvfhGf4H5wNqTgY/2K0/yDKdQdm8G8hrNQchMlBAHpPK7yBfg==",
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.10.0.tgz",
"integrity": "sha512-j4uVct5p3aGIz/BU4K8VU5vt2A6AueHTvx2gfF3xr4mVpwH9IJMWEAUKNwSwdZSJOHQq1Za2tv5huYc5v02D0w==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/api": "^1.4.1",
@@ -314,15 +314,15 @@
}
},
"node_modules/@eslint/config-array": {
"version": "0.23.5",
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz",
"integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==",
"version": "0.23.6",
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.6.tgz",
"integrity": "sha512-WrTH7nioI9QPY4NZGnsywmecswJdgeq4BCM76qok9VgjTO29ZgUzUvcuJLVPYVQM4uDbaPBU0M33R9DIxI8X3w==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@eslint/object-schema": "^3.0.5",
"debug": "^4.3.1",
"minimatch": "^10.2.4"
"minimatch": "^11.0.5"
},
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
@@ -400,9 +400,9 @@
}
},
"node_modules/@hono/node-server": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.8.tgz",
"integrity": "sha512-jdf7FHh6A1lzjpHHQUgxsg2GeER2vMetnAOfeActzcoli6jamlK+NAwL6Dsr5Fl3BS3tYUQzCdtZjU8Qxv7bEA==",
"version": "2.1.9",
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.9.tgz",
"integrity": "sha512-Sk4NQd3GFY0WZWCzndwFMPwJhtD0y9qjsQ+pjID0/03nK9pxyBCUoUHCho8QYBLBVhi0ssL8UkNPHqbgSOFPIQ==",
"license": "MIT",
"peer": true,
"engines": {
@@ -478,6 +478,13 @@
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@isaacs/nonrecursive-glob-match": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz",
"integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",
"dev": true,
"license": "BlueOak-1.0.0"
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz",
@@ -944,9 +951,9 @@
"license": "MIT"
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz",
"integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==",
"version": "0.10.5",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.5.tgz",
"integrity": "sha512-dOGOPxlaNV+G046mZzN+9C0dAcQZeSKcXiVaM0TYy/LM4ttTmgSBDxYfovcYI8Em3+eAbiAYpvWLOv8+ZVRJKA==",
"dev": true,
"license": "MIT",
"optional": true,
@@ -1005,17 +1012,17 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.72.2.tgz",
"integrity": "sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.73.0.tgz",
"integrity": "sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.12.2",
"@typescript-eslint/scope-manager": "8.72.2",
"@typescript-eslint/type-utils": "8.72.2",
"@typescript-eslint/utils": "8.72.2",
"@typescript-eslint/visitor-keys": "8.72.2",
"@typescript-eslint/scope-manager": "8.73.0",
"@typescript-eslint/type-utils": "8.73.0",
"@typescript-eslint/utils": "8.73.0",
"@typescript-eslint/visitor-keys": "8.73.0",
"ignore": "^7.0.5",
"natural-compare": "^1.4.0",
"ts-api-utils": "^2.5.0"
@@ -1028,22 +1035,22 @@
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript-eslint/parser": "^8.72.2",
"@typescript-eslint/parser": "^8.73.0",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/parser": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.72.2.tgz",
"integrity": "sha512-llP+T1YuJOLlxEciP6OyQGtz5SMxyn+9LA2BvZw5RmToGVa1y4beEDVQL6Gje7T5WFYh19WREjDCN9Ev4gm5AA==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.73.0.tgz",
"integrity": "sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/scope-manager": "8.72.2",
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/typescript-estree": "8.72.2",
"@typescript-eslint/visitor-keys": "8.72.2",
"@typescript-eslint/scope-manager": "8.73.0",
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/typescript-estree": "8.73.0",
"@typescript-eslint/visitor-keys": "8.73.0",
"debug": "^4.4.3"
},
"engines": {
@@ -1059,14 +1066,14 @@
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.72.2.tgz",
"integrity": "sha512-6y5dLTZdHhI8Eh3yIQ/bfQhRKwn5e+TpJj64o18Cngc0iW/BCrVvrr6zGYqXPnYH31u6YXAYiFh0+qxX5mybJw==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.73.0.tgz",
"integrity": "sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.72.2",
"@typescript-eslint/types": "^8.72.2",
"@typescript-eslint/tsconfig-utils": "^8.73.0",
"@typescript-eslint/types": "^8.73.0",
"debug": "^4.4.3"
},
"engines": {
@@ -1081,14 +1088,14 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.72.2.tgz",
"integrity": "sha512-iIoMJ6/8c1/QpFNyFjU0d1YzPco4MsZjQw0k3V+vfzNWAFmUmvhlyMoYEoYYDQZXc+J6Gi1X5XcxlzW2taIIGQ==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.73.0.tgz",
"integrity": "sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/visitor-keys": "8.72.2"
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/visitor-keys": "8.73.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1099,9 +1106,9 @@
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.72.2.tgz",
"integrity": "sha512-+h3iCgZXuTNtoLXcnnjP12ZUHLMqoUcIHPfQrFEXTUqvb9dF8QK9b5nv5VtSo5fLkdHuks8ehbTzZj3rImAm9w==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.73.0.tgz",
"integrity": "sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==",
"dev": true,
"license": "MIT",
"engines": {
@@ -1116,15 +1123,15 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.72.2.tgz",
"integrity": "sha512-STfkR38qIdhfkLpgtXnUjAzsNy4xouqiBO0lrVc/Wpk9Kem5/aHXUx1J8dGC16zpdYN1+yc2ILQ28er1kXX7ag==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.73.0.tgz",
"integrity": "sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/typescript-estree": "8.72.2",
"@typescript-eslint/utils": "8.72.2",
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/typescript-estree": "8.73.0",
"@typescript-eslint/utils": "8.73.0",
"debug": "^4.4.3",
"ts-api-utils": "^2.5.0"
},
@@ -1141,9 +1148,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.72.2.tgz",
"integrity": "sha512-Xfn37OLZx03+PCU7qWx9DTv2FCRh1E6fk2+wONeNY15HXIwtcwuveaSwVpGAUptkNmPQegRxW5JyRel9T7wrog==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.73.0.tgz",
"integrity": "sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -1155,18 +1162,18 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.72.2.tgz",
"integrity": "sha512-pQEGqIK/cqEvKivVWaFLYpe7XYejFxfuAOi4mu1oAWFvIo36aRHI9esRFTUxcIy/z8N482RJyH+LpZB0ZIU7Ow==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.73.0.tgz",
"integrity": "sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.72.2",
"@typescript-eslint/tsconfig-utils": "8.72.2",
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/visitor-keys": "8.72.2",
"@typescript-eslint/project-service": "8.73.0",
"@typescript-eslint/tsconfig-utils": "8.73.0",
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/visitor-keys": "8.73.0",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"minimatch": "^11.0.1",
"semver": "^7.7.3",
"tinyglobby": "^0.2.15",
"ts-api-utils": "^2.5.0"
@@ -1179,20 +1186,26 @@
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev",
"typescript": ">=4.8.4 <6.1.0"
},
"peerDependenciesMeta": {
"@typescript/native": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/utils": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.2.tgz",
"integrity": "sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.73.0.tgz",
"integrity": "sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.9.1",
"@typescript-eslint/scope-manager": "8.72.2",
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/typescript-estree": "8.72.2"
"@typescript-eslint/scope-manager": "8.73.0",
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/typescript-estree": "8.73.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1207,13 +1220,13 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.2.tgz",
"integrity": "sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.73.0.tgz",
"integrity": "sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/types": "8.73.0",
"eslint-visitor-keys": "^5.0.0"
},
"engines": {
@@ -1238,16 +1251,16 @@
}
},
"node_modules/@vitest/mocker": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz",
"integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==",
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.1.tgz",
"integrity": "sha512-b2OgTB4+3ImWIVafXKazJXwLKwQxUNnix6b3xUvUTMh7RyXlrtzoxfZr8aEz9zkHOMAS4K5lu3TvFWoiVeVTQg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/trace-mapping": "0.3.31",
"@vitest/spy": "5.1.0",
"@vitest/spy": "5.1.1",
"estree-walker": "^3.0.3",
"magic-string": "^1.4.3"
"magic-string": "^1.4.5"
},
"funding": {
"url": "https://opencollective.com/vitest"
@@ -1266,9 +1279,9 @@
}
},
"node_modules/@vitest/spy": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz",
"integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==",
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.1.tgz",
"integrity": "sha512-6K8C6alQG1/Yc8/ZI22iJS7JEsxPdVzqtqDq+/xM4Z0mGVykemMVjLhqMy/q6/IHYG3kKD8hKSwRen/ZdyI9vQ==",
"dev": true,
"license": "MIT",
"funding": {
@@ -1709,9 +1722,9 @@
}
},
"node_modules/eslint": {
"version": "10.14.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-10.14.0.tgz",
"integrity": "sha512-T0pNsxkb9IKmtQjhpK3d7nWOpFv+YHuMbTJnSVMoQblF0onvXfErrtp4V1jHtsQPan7dKaGVD0q1WCXnzMF31A==",
"version": "10.15.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-10.15.0.tgz",
"integrity": "sha512-+5Wg4p+ze3sG1WErYgUO/3H1IQIfFBymVUA0Fo/XTeBOLS6UQIUekpSJ8sdRkn7O7wjh84b55w/roqavH2aScg==",
"dev": true,
"license": "MIT",
"workspaces": [
@@ -1720,7 +1733,7 @@
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.2",
"@eslint/config-array": "^0.23.5",
"@eslint/config-array": "^0.23.6",
"@eslint/config-helpers": "^0.7.0",
"@eslint/core": "^1.2.1",
"@eslint/plugin-kit": "^0.7.3",
@@ -1745,7 +1758,7 @@
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"minimatch": "^10.2.6",
"minimatch": "^11.0.5",
"natural-compare": "^1.4.0",
"optionator": "^0.9.3"
},
@@ -2037,9 +2050,9 @@
}
},
"node_modules/express-rate-limit": {
"version": "8.7.4",
"resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.4.tgz",
"integrity": "sha512-LKBXzX700wz3zAGNNmVnjRI5mEbYkLv7UbMI4+9Xa+JPcg2UZh6AgY/2CZh9RrJjFM5ttC/N1lD+KzyFoZITCw==",
"version": "8.7.5",
"resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.5.tgz",
"integrity": "sha512-wi+v38cx2EqD0JnhE/e74o5tFqKWUOAPFJIgyEiqJ8v2MNpoOAA3kI2hXYOI+YM+HE5yqbdAlVxm2GqOIeYOgA==",
"license": "MIT",
"peer": true,
"dependencies": {
@@ -2362,9 +2375,9 @@
}
},
"node_modules/hono": {
"version": "4.13.18",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.18.tgz",
"integrity": "sha512-H9q/E1XizaWstJxUW881dmLxEj+t/TrGGnyxINkm4+sK0qUwsMtFdo2BWI9Vs3cIS19MU6b6iCijoUoEf4f3DA==",
"version": "4.13.19",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.19.tgz",
"integrity": "sha512-KmXvQAXwcAHV+muzbIwoJ23niEB5nMoDVr9WcRkU8mvjUECm/1+7v4Jgp7P7a+H6MLFrh+vXrGonGrGS+RQfkA==",
"license": "MIT",
"peer": true,
"engines": {
@@ -2417,9 +2430,9 @@
}
},
"node_modules/ignore": {
"version": "7.0.14",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.14.tgz",
"integrity": "sha512-wCBiZ77u1tuWde6G/nfOtLaCTYcFDU5yCzARzK10y+rLhzYoL7a7yEemcopcc2Mzow7gZOIjnV2ym1NYmdiJOQ==",
"version": "7.0.16",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.16.tgz",
"integrity": "sha512-52N+Y4HRMOJmbLmr+DqO4iSRyyB7N52gm7PWCT6h0p978+oKbqHCB7gIJIwZvBUsjlSdWbrBFqUSmIFNZMpn0A==",
"dev": true,
"license": "MIT",
"engines": {
@@ -2500,9 +2513,9 @@
"license": "ISC"
},
"node_modules/jose": {
"version": "6.2.17",
"resolved": "https://registry.npmjs.org/jose/-/jose-6.2.17.tgz",
"integrity": "sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==",
"version": "6.2.18",
"resolved": "https://registry.npmjs.org/jose/-/jose-6.2.18.tgz",
"integrity": "sha512-doV4thUwgkrycJH4yLeqwTGIIZphHl+pk7CPReuMIhYhncmgzdko85MaCG4YQFTxqMFr1/oEH32tZuKKovcDEg==",
"license": "MIT",
"peer": true,
"funding": {
@@ -2942,16 +2955,17 @@
}
},
"node_modules/minimatch": {
"version": "10.2.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
"integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
"version": "11.0.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz",
"integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"brace-expansion": "^5.0.8"
"@isaacs/nonrecursive-glob-match": "^1.1.0",
"brace-expansion": "^5.0.12"
},
"engines": {
"node": "18 || 20 || >=22"
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
@@ -3032,9 +3046,9 @@
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.14.0.tgz",
"integrity": "sha512-IVgHNlp/jwQX271+Xzoq9LZNTWXxZK+cEOrGBOBxXNbn7fapnZ+Ts6TVMgNOuAezwG2wdtnMX97tTPK6VEnuOQ==",
"license": "MIT",
"peer": true,
"engines": {
@@ -3207,9 +3221,9 @@
}
},
"node_modules/postcss": {
"version": "8.5.32",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
"integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
"version": "8.5.33",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz",
"integrity": "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==",
"dev": true,
"funding": [
{
@@ -3403,9 +3417,9 @@
}
},
"node_modules/router": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/router/-/router-2.3.0.tgz",
"integrity": "sha512-bpowRfGjEPe8t9R6fJIzhwmyCGAXwKvxBUsgJm+bJukwdcWmUXbMo7p22w7aYmQBPQTUMNqMV39YX0kMou3z8w==",
"license": "MIT",
"peer": true,
"dependencies": {
@@ -3417,6 +3431,10 @@
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/safer-buffer": {
@@ -3591,9 +3609,9 @@
}
},
"node_modules/source-map-js": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
"integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.3.tgz",
"integrity": "sha512-xj+WrAkyv5Qp+t7r9N5HvCBu7g1qOe6CKRNpq22X1GGcPEQADFU54v5qsPVs3/vrUFQ7XivFrcAVKA2stI0kWA==",
"dev": true,
"license": "BSD-3-Clause",
"peer": true,
@@ -3602,9 +3620,9 @@
}
},
"node_modules/standardwebhooks": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.1.1.tgz",
"integrity": "sha512-bCbX9ZEyFkWPsRz7Bl3NuQUJohmwGSev/yhr7vhaGPlc4AfIrspIRa6cPTBuI1ItmrTDJ4d/S2hCsfe4+vQGnQ==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.3.0.tgz",
"integrity": "sha512-5W9skHjqAm2dlA9wWvglTP+oX47JX4lFXVk1aJV7+TG1snvTR4QXaVgPscEzvOw9GRreeavMwbqEeL+MGhZHCg==",
"license": "MIT",
"dependencies": {
"@stablelib/base64": "^1.0.0",
@@ -3629,9 +3647,9 @@
"license": "MIT"
},
"node_modules/tinybench": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz",
"integrity": "sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==",
"version": "6.2.4",
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.4.tgz",
"integrity": "sha512-SQ52jEncXxbMCzJuY2A/jGIbbAu6NYsBWW7grz2pNE+EnzQdoGaoBfpk4qC/opE7qiUcGmGgaGIz5EoHdS1O9w==",
"dev": true,
"license": "MIT",
"engines": {
@@ -3880,22 +3898,22 @@
}
},
"node_modules/vitest": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz",
"integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==",
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.1.tgz",
"integrity": "sha512-trVmzUFOSraCZcI3uZIMD5FqBh4atFkC/XuJP/IU7qtyQay0FCs3Ia+0QiQ2JJwGyWG/xrcBoJNel2+O7kEZ0g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/chai": "^5.2.2",
"@vitest/mocker": "5.1.0",
"@vitest/mocker": "5.1.1",
"chai": "^6.3.0",
"es-module-lexer": "^2.3.2",
"expect-type": "^1.4.0",
"magic-string": "^1.4.3",
"magic-string": "^1.4.5",
"obug": "^3.0.0",
"picomatch": "^4.0.7",
"std-env": "^4.3.0",
"tinybench": "^6.2.2",
"tinybench": "^6.2.3",
"tinyexec": "^1.3.1",
"tinyglobby": "^0.2.17",
"why-is-node-running": "3.2.1"
@@ -3913,12 +3931,12 @@
"@edge-runtime/vm": "*",
"@opentelemetry/api": "^1.9.0",
"@types/node": "^22.0.0 || >=24.0.0",
"@vitest/browser-playwright": "5.1.0",
"@vitest/browser-preview": "5.1.0",
"@vitest/browser-playwright": "5.1.1",
"@vitest/browser-preview": "5.1.1",
"@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
"@vitest/coverage-istanbul": "5.1.0",
"@vitest/coverage-v8": "5.1.0",
"@vitest/ui": "5.1.0",
"@vitest/coverage-istanbul": "5.1.1",
"@vitest/coverage-v8": "5.1.1",
"@vitest/ui": "5.1.1",
"happy-dom": "*",
"jsdom": "*",
"vite": "^6.4.0 || ^7.0.0 || ^8.0.0"

View File

@@ -3,7 +3,7 @@
"publishConfig": {
"access": "public"
},
"version": "0.107.0",
"version": "0.109.0",
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
"main": "dist/lib.js",
"types": "dist/lib.d.ts",
@@ -68,25 +68,25 @@
"node": ">=22"
},
"dependencies": {
"@agentclientprotocol/sdk": "2.6.0",
"@anthropic-ai/claude-agent-sdk": "0.3.323",
"@agentclientprotocol/sdk": "2.8.0",
"@anthropic-ai/claude-agent-sdk": "0.3.328",
"diff": "9.0.0",
"zod": "4.6.7"
},
"devDependencies": {
"@anthropic-ai/sdk": "1.8.0",
"@anthropic-ai/sdk": "1.10.0",
"@eslint/js": "10.0.1",
"@tsconfig/node22": "22.0.7",
"@types/node": "26.6.6",
"@typescript-eslint/eslint-plugin": "8.72.2",
"@typescript-eslint/parser": "8.72.2",
"@typescript-eslint/eslint-plugin": "8.73.0",
"@typescript-eslint/parser": "8.73.0",
"ajv": "8.20.0",
"ajv-formats": "3.0.1",
"eslint": "10.14.0",
"eslint": "10.15.0",
"eslint-config-prettier": "10.1.8",
"globals": "17.14.0",
"prettier": "3.10.1",
"typescript": "6.0.3",
"vitest": "5.1.0"
"vitest": "5.1.1"
}
}

View File

@@ -3,12 +3,14 @@ import type {
CompleteElicitationNotification,
CreateElicitationRequest,
CreateElicitationResponse,
McpServerAcp,
ReadTextFileRequest,
ReadTextFileResponse,
RequestPermissionResponse,
WriteTextFileRequest,
WriteTextFileResponse,
} from "@agentclientprotocol/sdk/unstable";
import type { McpHttpServerConfig } from "@anthropic-ai/claude-agent-sdk";
import type { AcpSessionNotification } from "./acp-subagents.js";
import type { AcpPermissionRequest } from "./permissions/presentation.js";
@@ -43,4 +45,10 @@ export interface AcpClient {
authStatusUpdate(params: AuthStatusUpdateNotification): Promise<void>;
/** Send a custom (extension) notification, e.g. `_claude/sdkMessage`. */
extNotification(method: string, params: Record<string, unknown>): Promise<void>;
/**
* The SDK config of an MCP server that the client serves over this
* connection (`"type": "acp"`): an endpoint that sends each MCP request to
* the client as `mcp/message` (see `McpOverAcp` in `mcp-servers.ts`).
*/
mcpServerOverAcp(server: McpServerAcp): Promise<McpHttpServerConfig>;
}

View File

@@ -1,7 +1,8 @@
import type {
ClientCapabilities,
SessionCapabilities,
SessionNotification,
import {
RequestError,
type ClientCapabilities,
type SessionCapabilities,
type SessionNotification,
} from "@agentclientprotocol/sdk/unstable";
import {
AIR_NATIVE_SUBAGENT_SESSIONS_CAPABILITY,
@@ -24,6 +25,18 @@ export { AIR_NATIVE_SUBAGENT_SESSIONS_CAPABILITY } from "./air-extension.js";
*/
export type SubagentForm = "rfd" | "air";
/**
* The error of a client's request that names a child session, other than
* `session/cancel`: invalid params (-32602), as the RFD asks, not the -32002
* of an unknown session. `method` completes "the client cannot … it".
*/
export function restrictedChild(sessionId: string, method: string): RequestError {
return RequestError.invalidParams(
{ sessionId },
`${sessionId} is a subagent session: the client cannot ${method} it. Its parent session runs it.`,
);
}
/** The form of native subagent sessions that the client gets, or none. */
export function subagentForm(capabilities?: ClientCapabilities | null): SubagentForm | undefined {
if (!clientSupportsSubagents(capabilities)) return undefined;

View File

@@ -129,3 +129,166 @@ export class BackgroundOutputTail {
await this.publish({ text, replaces });
}
}
/** What Claude Code's `get_task_output` returns: the end of a shell task's output. */
export interface TaskOutput {
/** At most the last 8 KiB of the output, decoded as UTF-8. */
output: string;
/** The size of the whole output in bytes. */
total_bytes: number;
/** Whether `output` holds only the end of the output. */
truncated: boolean;
}
/**
* The most bytes at the start of a truncated `output` that may not match the
* command's bytes: a character that the 8 KiB cut split decodes as U+FFFD.
*/
const CUT_CHARACTER_BYTES = 4;
/**
* Follows the output of a command that runs in the foreground, read with
* `read` (Claude Code's `get_task_output`), and hands each piece of new text
* to `publish`, in order. Claude Code streams no output of a foreground Bash
* command either: the output arrives in the tool result. Claude Code writes
* the output to the command's task before then, and `get_task_output` reads
* it, though the task's `task_started` names no output file.
*
* The new text is the output past the bytes already sent. When `output` does
* not hold all of it, or its bytes may not match the command's (not UTF-8),
* the whole `output` replaces the terminal's output, as a snapshot. A read
* that ends in U+FFFD may have cut a character that the command is still
* writing, so it is sent only at the next read.
*
* Once the command ends, Claude Code drops its output: the task then reads as
* empty (`total_bytes: 0`, CLI 2.1.325), up to the tool result that carries
* the whole output. A read that holds less than was sent is that end, so it
* stops the poll and publishes nothing: an empty snapshot would clear the
* terminal.
*
* One read runs at a time: a poll that comes during a read is skipped, so a
* read that Claude Code never answers queues nothing behind it. A read that
* fails is tried again at the next poll. `publish` must not reject.
*/
export class TaskOutputPoll {
private sentBytes = 0;
private sent = false;
private stopped = false;
/** A read is in progress, or the publish of its text. */
private busy = false;
/** The publish in progress, or the last one. */
private publishing: Promise<void> = Promise.resolve();
private readonly timer: ReturnType<typeof setInterval>;
constructor(
private readonly read: () => Promise<TaskOutput>,
private readonly publish: (output: BackgroundOutput) => Promise<void>,
) {
this.timer = setInterval(() => void this.poll(), BACKGROUND_OUTPUT_POLL_MS);
// A command that runs on must not keep the agent process alive.
this.timer.unref();
}
/**
* Stops, once a publish in progress is out. Returns whether any text was
* published: the tool result then replaces it with the whole output.
*
* A read in progress is not waited for. It publishes nothing after this,
* and Claude Code may never answer it.
*/
async finish(): Promise<boolean> {
this.stop();
await this.publishing;
return this.sent;
}
/**
* Stops now and returns whether any text was published, for a caller whose
* `publish` sends in the same synchronous step (v2), so none is in progress.
*/
end(): boolean {
this.stop();
return this.sent;
}
/** Stops without waiting: the command's task, the query or the session ended. */
stop(): void {
clearInterval(this.timer);
this.stopped = true;
}
private async poll(): Promise<void> {
if (this.stopped || this.busy) return;
this.busy = true;
try {
const read = await this.read();
if (this.stopped) return;
if (read.total_bytes < this.sentBytes) {
this.stop();
return;
}
const output = this.newText(read);
if (output === undefined) return;
this.sentBytes = read.total_bytes;
this.sent = true;
this.publishing = this.publish(output);
await this.publishing;
} catch {
// The read failed: try again at the next poll.
} finally {
this.busy = false;
}
}
/**
* The text that `read` adds to what was sent, or undefined when it adds none
* yet. `read` holds at least the bytes that were sent.
*/
private newText({ output, total_bytes, truncated }: TaskOutput): BackgroundOutput | undefined {
if (total_bytes === this.sentBytes || output.endsWith("\uFFFD")) return undefined;
const bytes = Buffer.from(output, "utf8");
const added = total_bytes - this.sentBytes;
const exact = truncated
? added <= bytes.length - CUT_CHARACTER_BYTES
: bytes.length === total_bytes;
// `sentBytes` ends a read that ended in a whole character, so the cut is
// at a character boundary.
if (exact) {
return { text: bytes.subarray(bytes.length - added).toString("utf8"), replaces: false };
}
return { text: output, replaces: true };
}
}
/**
* The id of the tool call whose command the task `started` runs in the
* foreground, or undefined for any other task. Claude Code starts the task of
* a foreground command once the command has run for a few seconds (3.1 s with
* CLI 2.1.325). A faster command gets no task, and its output comes with its
* tool result, as before.
*/
export function foregroundCommandToolCall(started: {
task_type?: string;
is_backgrounded?: boolean;
tool_use_id?: string;
}): string | undefined {
return started.task_type === "local_bash" && started.is_backgrounded === false
? started.tool_use_id
: undefined;
}
/** Whether a call of the tool `name` runs a command that a terminal shows. */
export function isCommandTool(name: string | undefined): boolean {
return name === "Bash" || name === "PowerShell";
}
/**
* Claude Code's `get_task_output` on the SDK's query. Like `mcpAuthenticate`,
* it is on the query object but not in the public `Query` declaration yet,
* though the SDK types its control request (`SDKControlGetTaskOutputRequest`).
*/
export type TaskOutputQuery = { getTaskOutput(taskId: string): Promise<TaskOutput> };
export function supportsTaskOutput<T extends object>(query: T): query is T & TaskOutputQuery {
return typeof (query as Partial<TaskOutputQuery>).getTaskOutput === "function";
}

View File

@@ -1,5 +1,6 @@
import { existsSync } from "node:fs";
import { join } from "node:path";
import type { Options } from "@anthropic-ai/claude-agent-sdk";
const CLI_FILE_NAME = process.platform === "win32" ? "claude.exe" : "claude";
@@ -30,6 +31,46 @@ export async function claudeCliPath(): Promise<string> {
return installedClaudeCliPath();
}
/** How an option reaches the Claude CLI: in a flag, or over stdin in the SDK's initialize request. */
type Delivery = NonNullable<Options["mcpServersDelivery"]>;
/**
* The SDK options that say how a session's MCP servers and its `settings`
* reach the CLI of {@link claudeCliPath}. A client's own options replace them.
*
* - `'initialize'` for the CLI that the adapter ships: over stdin, in the
* SDK's initialize request.
* - `'argv'` for a CLI that `CLAUDE_CODE_EXECUTABLE` names: in the
* `--mcp-config` and `--settings` flags, as before SDK 0.3.326. Its version
* is not known, and a CLI that cannot take them over stdin fails the session
* at startup (2.1.323: "too old to read MCP servers from the initialize
* request", "unknown option '--initialize-fields=settings'").
* - `settings` stay `'argv'` when the client's `extraArgs` hold `settings`:
* Claude Code refuses to start with both ("--initialize-fields=settings
* cannot be used with --settings"), and in the flag the `settings` option
* replaces that argument. They also stay `'argv'` with `sdk-url` in the
* `extraArgs`: such a session cannot read the request at launch, and the SDK
* sends its MCP servers in the flag for the same reason.
*
* The SDK reads `settingsDelivery` (0.3.328) but does not declare it in
* `sdk.d.ts`, so nothing fails to compile if a later SDK drops it. The v2
* integration tests check the delivery against the real CLI.
*
* `mcpServersDelivery` is always set. The adapter names the CLI to start
* (`pathToClaudeCodeExecutable`), and for such an app the SDK prints a
* `DeprecationWarning` when a session has MCP servers and the option is unset.
*/
export function cliDelivery(clientExtraArgs: Options["extraArgs"]): {
mcpServersDelivery: Delivery;
settingsDelivery: Delivery;
} {
const delivery = process.env.CLAUDE_CODE_EXECUTABLE ? "argv" : "initialize";
const settingsInFlag = Object.keys(clientExtraArgs ?? {}).some(
(name) => name === "settings" || name === "sdk-url" || name.startsWith("sdk-url="),
);
return { mcpServersDelivery: delivery, settingsDelivery: settingsInFlag ? "argv" : delivery };
}
function bundledClaudeCliPath(directory: string): string {
const path = join(directory, CLI_FILE_NAME);
// Without this check, spawning a missing CLI fails with a bare ENOENT.

View File

@@ -587,6 +587,17 @@ export async function answerMcpElicitation(
}
}
/**
* Whether `toolUseID` is the id of a question that Claude Code asks on its own
* (its `confirmWithUser`), such as whether to download a connector's file. It
* asks through `canUseTool` as AskUserQuestion under a `confirm_<uuid>` id,
* and reads the answer from the callback's result: no tool_use and no
* tool_result of the stream carry that id.
*/
export function isConfirmQuestion(toolUseID: string): boolean {
return toolUseID.startsWith("confirm_");
}
/**
* Presents the AskUserQuestion tool's questions as a form elicitation of
* `sessionId` through `elicit`, and returns the answers as the tool's

View File

@@ -9,7 +9,8 @@ import {
type SessionStoreEntry,
} from "@anthropic-ai/claude-agent-sdk";
import { createHash } from "node:crypto";
import { loadFullSessionHistory } from "./resumed-session.js";
import { loadFullSessionHistory, readHistoryAcrossCompactions } from "./resumed-session.js";
import { forkPointOf } from "./session-cursors.js";
import { assistantMessageText } from "./session-failure-extension.js";
import { SessionTiming } from "./session-timing.js";
@@ -176,6 +177,15 @@ function isUnknownSessionError(error: unknown, sessionId: string): boolean {
);
}
/**
* Copies the transcript of `params.sessionId` into a new session: all of it,
* or with a `cursorId` the history before that session cursor (see
* `session-cursors.ts`).
*
* Fails with invalid params (-32602) for a `cursorId` that is no cursor of
* the session's stored history. ACP forbids forking the whole session, or at
* another position, in its place.
*/
export async function forkSession(
params: ForkSessionRequest,
dependencies: ForkSessionDependencies,
@@ -195,6 +205,24 @@ async function forkTranscript(
dependencies: ForkSessionDependencies,
): Promise<ForkSessionResponse> {
const timing = new SessionTiming(dependencies.logger, "fork", params.sessionId);
if (params.cursorId != null) {
// The history as a replay reads it, which announces the cursors.
const history = await readHistoryAcrossCompactions(
params.sessionId,
await getSessionMessages(params.sessionId),
);
const upToMessageId = forkPointOf(params.cursorId, history);
timing.phase("cursor", ` resolution=${upToMessageId ? "found" : "missing"}`);
if (upToMessageId === undefined) {
throw RequestError.invalidParams(
{ cursorId: params.cursorId },
`Session ${params.sessionId} has no cursor ${params.cursorId} that a fork can start at. Use a cursor that the session announced with the \`fork\` capability, or send the request without \`cursorId\` to fork the whole session.`,
);
}
const forked = await forkClaudeSession(params.sessionId, { upToMessageId });
timing.phase("sdk-fork");
return { sessionId: forked.sessionId };
}
const point = forkPoint(params._meta);
// SDK `dir` scopes source lookup, not the fork's working directory. Search
// all projects: params.cwd can name a different workspace for the new session.

View File

@@ -1,9 +1,11 @@
/**
* `--hide-claude-auth`: this integration must never bill a claude.ai
* subscription. Under the flag the agent hides the claude.ai login method from
* `initialize`, and refuses with `authRequired` every session and every turn
* that a subscription would pay for. `v1/acp-agent.ts` decides when the guard
* applies (flag on, no provider override); this module decides what it refuses.
* subscription, except a Claude Enterprise plan. Under the flag the agent hides
* the claude.ai login method from `initialize`, and refuses with `authRequired`
* every session and every turn that a Free, Pro, Max or Team plan would pay
* for. `v1/acp-agent.ts` and `v2/subscription-guard.ts` decide when the guard
* applies (flag on, no provider override); {@link claudeAuthRefusal} decides
* what it refuses.
*
* The guard judges the `AccountInfo` that the SDK caches at `initialize`. That
* cache never changes during the life of a query, but the CLI itself picks up
@@ -77,6 +79,11 @@ const API_KEY_SOURCES_ABOVE_SUBSCRIPTION: ReadonlySet<string> = new Set([
"/login managed key",
]);
/** `none` is the SDK's explicit no-token source. */
function hasTokenSource(account: AccountInfo): boolean {
return Boolean(account.tokenSource && account.tokenSource !== "none");
}
/**
* True when a turn on this account is paid by a claude.ai subscription.
*
@@ -85,8 +92,8 @@ const API_KEY_SOURCES_ABOVE_SUBSCRIPTION: ReadonlySet<string> = new Set([
* proves it, and an unknown value keeps the guard on.
*
* - `subscriptionType` must be set. Without it the CLI reports no subscription.
* - `tokenSource` must be absent. The CLI sets it in place of the subscription
* when a bearer or OAuth environment token pays for the turn.
* - `tokenSource` must be absent, empty, or `none`. A bearer or OAuth
* environment token takes precedence over the subscription.
* - `apiProvider` must be absent or `firstParty`. The SDK documents that the
* Anthropic OAuth login applies only to `firstParty`; for a third-party
* backend such as `bedrock`, `vertex`, `foundry` or `gateway` the other
@@ -99,7 +106,7 @@ export function billsClaudeSubscription(account: AccountInfo | undefined): boole
if (!account?.subscriptionType) {
return false;
}
if (account.tokenSource) {
if (hasTokenSource(account)) {
return false;
}
if (account.apiProvider !== undefined && account.apiProvider !== "firstParty") {
@@ -108,6 +115,20 @@ export function billsClaudeSubscription(account: AccountInfo | undefined): boole
return !API_KEY_SOURCES_ABOVE_SUBSCRIPTION.has(account.apiKeySource ?? "");
}
/**
* True when `subscriptionType` names a Claude Enterprise plan, which the flag
* lets pay for turns: Anthropic allows an Enterprise plan in third-party
* integrations.
*
* The SDK's `AccountInfo` carries the CLI's display name, "Claude Enterprise";
* older CLIs report the raw plan, "enterprise". Any other value is refused,
* including a "Claude <name>" built from a custom `plan_display_name` in the
* claude.ai profile: the guard cannot tell which plan that name belongs to.
*/
export function isClaudeEnterprisePlan(subscriptionType: string | undefined): boolean {
return /^(claude\s+)?enterprise$/i.test(subscriptionType?.trim() ?? "");
}
/**
* True when the account already holds a credential this integration accepts:
* a third-party backend, a bearer or OAuth environment token, or one of the
@@ -125,12 +146,33 @@ export function holdsNonSubscriptionCredential(account: AccountInfo | undefined)
if (account.apiProvider !== undefined && account.apiProvider !== "firstParty") {
return true;
}
if (account.tokenSource) {
if (hasTokenSource(account)) {
return true;
}
return API_KEY_SOURCES_ABOVE_SUBSCRIPTION.has(account.apiKeySource ?? "");
}
/**
* The refusal the flag gives a session or turn on `account`, or `undefined`
* when the account may run it:
*
* - a subscription pays, and it is not {@link isClaudeEnterprisePlan}:
* {@link claudeSubscriptionNotSupportedError};
* - no subscription pays and the account holds no other credential (signed
* out): {@link claudeLoginRequiredError}.
*
* Session creation on v1 and v2 and the per-turn guard all decide through
* this function.
*/
export function claudeAuthRefusal(account: AccountInfo): RequestError | undefined {
if (billsClaudeSubscription(account)) {
return isClaudeEnterprisePlan(account.subscriptionType)
? undefined
: claudeSubscriptionNotSupportedError();
}
return holdsNonSubscriptionCredential(account) ? undefined : claudeLoginRequiredError();
}
export function claudeSubscriptionNotSupportedError(): RequestError {
return RequestError.authRequired(
{ reason: CLAUDE_SUBSCRIPTION_NOT_SUPPORTED_REASON satisfies AuthRequiredReason },
@@ -214,8 +256,8 @@ type GuardOptions = {
* real account. This guard does not see the residual case the module header
* names either.
*
* A turn is refused when the account bills a subscription, and also when it
* holds nothing this integration accepts, which is the user signing out in
* A turn is refused when the account bills a subscription other than Claude
* Enterprise, and also when it holds nothing this integration accepts, which is the user signing out in
* mid-session. The refusal mirrors the signed-out path exactly (see
* `failActiveWithSessionFailure` for `auth_required` in `v1/acp-agent.ts`): every
* client gets the `authRequired` JSON-RPC rejection that starts its own auth
@@ -257,13 +299,7 @@ async function evaluateGuard(options: GuardOptions): Promise<RequestError | unde
error instanceof Error ? error.message : String(error),
);
}
if (billsClaudeSubscription(account)) {
return claudeSubscriptionNotSupportedError();
}
if (!holdsNonSubscriptionCredential(account)) {
return claudeLoginRequiredError();
}
return undefined;
return claudeAuthRefusal(account);
}
/** The account the SDK cached at `initialize`. `undefined` when the query

View File

@@ -8,7 +8,8 @@ import type { Logger } from "./logger.js";
/**
* What a core advertises as `options` in its session capabilities:
* `session/options`, and `configOptions` on its setup requests.
* `session/options`, and `configOptions` on its setup requests, `session/fork`
* included.
*/
export const SESSION_OPTIONS_CAPABILITY = {};

View File

@@ -1,16 +1,46 @@
import type { McpServer } from "@agentclientprotocol/sdk/unstable";
import type { McpServerConfig } from "@anthropic-ai/claude-agent-sdk";
import {
McpOverAcpCaller,
type HasConnectionContext,
type McpServer,
type McpServerAcp,
} from "@agentclientprotocol/sdk/unstable";
import { McpOverAcpHttpBridge } from "@agentclientprotocol/sdk/experimental/mcp-http";
import type { McpHttpServerConfig, McpServerConfig } from "@anthropic-ai/claude-agent-sdk";
/**
* The SDK configs of a session's ACP MCP servers, by name. HTTP and SSE
* servers keep their URL and headers; a server without `type` is stdio. A
* server of any other transport is left out: the session's `initialize`
* advertises none.
* Makes the SDK config of an MCP server that the client serves over the ACP
* connection (`"type": "acp"`): {@link McpOverAcp.sdkConfig} for a connection.
*/
export function sdkMcpServers(
export type McpOverAcpConfig = (server: McpServerAcp) => Promise<McpHttpServerConfig>;
/**
* A client MCP server that Claude Code is not given, so it lists no entry for
* it. This is the entry it would list: `failed`, with the error.
*/
export type UnservedMcpServer = { name: string; status: "failed"; error: string };
/** A session's ACP MCP servers, as {@link sdkMcpServers} sorts them. */
export type SdkMcpServers = {
/** The SDK configs of the servers that Claude Code gets, by name. */
configs: Record<string, McpServerConfig>;
/** The `acp` servers that `overAcp` made no config for. */
unserved: UnservedMcpServer[];
};
/**
* The SDK configs of a session's ACP MCP servers. HTTP and SSE servers keep
* their URL and headers; a server without `type` is stdio; an `acp` server
* gets the config that `overAcp` makes. When `overAcp` rejects, the server is
* in `unserved` with the error and the session starts without it, as it
* starts without a server that Claude Code cannot connect to. A server of any
* other transport is left out: the session's `initialize` advertises none.
*/
export async function sdkMcpServers(
servers: readonly McpServer[] | null | undefined,
): Record<string, McpServerConfig> {
overAcp: McpOverAcpConfig,
): Promise<SdkMcpServers> {
const configs: Record<string, McpServerConfig> = {};
const unserved: UnservedMcpServer[] = [];
for (const server of servers ?? []) {
if ("type" in server && (server.type === "http" || server.type === "sse")) {
configs[server.name] = {
@@ -20,6 +50,16 @@ export function sdkMcpServers(
? Object.fromEntries(server.headers.map((e) => [e.name, e.value]))
: undefined,
};
} else if ("type" in server && server.type === "acp") {
try {
configs[server.name] = await overAcp(server);
} catch (error) {
unserved.push({
name: server.name,
status: "failed",
error: error instanceof Error ? error.message : String(error),
});
}
} else if (!("type" in server)) {
configs[server.name] = {
type: "stdio",
@@ -29,5 +69,62 @@ export function sdkMcpServers(
};
}
}
return configs;
return { configs, unserved };
}
/**
* Serves the MCP servers that a client declares with `"type": "acp"` to Claude
* Code (MCP-over-ACP). Claude Code's MCP client connects to a command or a
* URL, so each server gets an MCP 2026-07-28 HTTP endpoint on 127.0.0.1 that
* sends every MCP request to the client as an `mcp/message` request (the ACP
* SDK's `McpOverAcpHttpBridge`). The `acp` servers of a connection share one
* listener, which closes with the connection. A request needs the bearer
* token of its server, which only that server's config carries.
*
* The endpoint takes no `initialize`. Claude Code (2.1.325) sends
* `server/discover` to an HTTP server first, unless
* `MCP_PROTOCOL_NEGOTIATION=legacy` or its
* `tengu_mcp_protocol_negotiation_http` flag turns that off. Then it sends
* `initialize`, and the server is listed as failed.
*/
export class McpOverAcp {
private readonly caller = new McpOverAcpCaller();
private readonly bridge = new McpOverAcpHttpBridge(this.caller);
/**
* Hands an `mcp/message` notification of the client (such as the progress
* of a tool call) to the HTTP response of the MCP request that it names. An
* agent app registers it for `methods.agent.mcp.message`.
*/
readonly handleNotification = this.caller.handleNotification;
/**
* The SDK config of `server` for the sessions of the connection behind
* `client`. A server gets the same config every time for as long as the
* connection lives, so a session that restarts or resumes with the same
* servers sees no change. Rejects when the listener cannot open (e.g.
* `listen EPERM` where the process may not open a socket), or the
* connection is closed. The next call tries to open the listener again.
*/
async sdkConfig(
client: HasConnectionContext,
server: McpServerAcp,
): Promise<McpHttpServerConfig> {
let http;
try {
http = await this.bridge.toHttp(client, { ...server, type: "acp" });
} catch (error) {
throw new Error(
`The adapter could not open the local endpoint that serves it to Claude Code (${
error instanceof Error ? error.message : String(error)
}). A new session tries again.`,
{ cause: error },
);
}
return {
type: "http",
url: http.url,
headers: Object.fromEntries(http.headers.map((header) => [header.name, header.value])),
};
}
}

View File

@@ -7,8 +7,8 @@ import { realpath } from "node:fs/promises";
import path from "node:path";
import type { AcpSessionNotification, SubagentForm, SubagentState } from "./acp-subagents.js";
import { AIR_SUBAGENT_KEY, airExtensionMeta } from "./air-extension.js";
import { orderedConfigOptions } from "./session-config-options.js";
import { MODEL_CONFIG_ID } from "./session-model.js";
import { orderedSubagentConfiguration } from "./subagent-configuration.js";
import { isFinalToolCallStatus } from "./tool-calls/renderer.js";
/** The work state of a child, as the RFD's `subagent_update.state` carries it. */
@@ -402,7 +402,7 @@ export class NativeSubagentRuntime {
// so a delayed publication cannot replace newer settings with older ones.
const publishing = config.publishing.then(async () => {
if (this.configBySession.get(child.sessionId) !== config || ended()) return;
const configOptions = orderedSubagentConfiguration(config.options.values());
const configOptions = orderedConfigOptions(config.options.values());
const snapshot = JSON.stringify(configOptions);
if (config.published === snapshot) return;
await this.publish({
@@ -945,14 +945,30 @@ export class NativeSubagentRuntime {
* of this runtime. AIR's draft grants no `cancel`.
*/
async cancelChild(sessionId: string, stop: (taskId: string) => Promise<void>): Promise<boolean> {
if (this.form !== "rfd") return false;
for (const [taskId, child] of this.children) {
if (child.sessionId !== sessionId || !child.announced) continue;
child.cancels = (child.cancels ?? 0) + 1;
await stop(taskId);
return true;
const announced = this.announcedChild(sessionId);
if (!announced) return false;
const [taskId, child] = announced;
child.cancels = (child.cancels ?? 0) + 1;
await stop(taskId);
return true;
}
/**
* The RFD form: whether `sessionId` is a child session that this runtime
* announced. The client can cancel such a session and nothing else (see
* `restrictedChild`). False in AIR's draft, which keeps its own rules.
*/
hasChild(sessionId: string): boolean {
return this.announcedChild(sessionId) !== undefined;
}
/** The RFD form: the announced child session `sessionId`, with its task id. */
private announcedChild(sessionId: string): [string, NativeSubagent] | undefined {
if (this.form !== "rfd") return undefined;
for (const entry of this.children) {
if (entry[1].sessionId === sessionId && entry[1].announced) return entry;
}
return false;
return undefined;
}
/**

View File

@@ -33,6 +33,9 @@ export interface PermissionOptionContext {
/** False when no ACP turn can continue an accepted plan in a fresh
* context. Then an ExitPlanMode request offers no clear-context option. */
allowContextReset?: boolean;
/** Claude Code's `showClearContextOnPlanAccept` setting. An ExitPlanMode
* request offers the clear-context option only when it is true. */
showClearContextOnPlanAccept?: boolean;
}
export function allowOnce(name = "Yes"): PermissionOption {

View File

@@ -70,7 +70,11 @@ export function buildExitPlanModePermissionOptions(
: (["auto", "bypassPermissions"] as const)
).filter((mode) => modes.has(mode));
const preferredMode = elevatedModes[0] ?? "acceptEdits";
if (context.allowContextReset !== false && plainString(context.input.plan)) {
if (
context.showClearContextOnPlanAccept === true &&
context.allowContextReset !== false &&
plainString(context.input.plan)
) {
const usage =
context.contextUsedPercent === undefined ? "" : ` (${context.contextUsedPercent}% used)`;
options.push(

View File

@@ -3,9 +3,17 @@
*
* With `promptSuggestions` on, the CLI emits one `prompt_suggestion` message
* after a turn's `result` holding the prompt it expects the user to send next.
* ACP has no field for it, so it travels as
* `session_info_update._meta.promptSuggestions`: a client that does not read
* the key sees a session info update that says nothing and ignores it.
* The adapter turns it on only for a client that takes the prediction
* ({@link promptSuggestionOptions}).
* It reaches the client in up to two forms:
*
* - `prompt_suggestions_update`, ACP's unstable session update, for a client
* that advertised `session.promptSuggestions`, on v1 and v2. The CLI
* predicts one prompt, so the list holds one suggestion, whose prompt is
* one text block.
* - `session_info_update._meta.promptSuggestions`, for JetBrains AIR, which
* read the prediction there before ACP had an update for it. A client that
* does not read the key sees a session info update that says nothing.
*
* AIR renders the first non-blank `suggestions[].text` as gray text in an empty
* composer, where Tab fills the composer without sending.
@@ -14,6 +22,47 @@
* error, in plan mode, and at the account's usage limit, so most sessions have
* turns that end with no prediction at all.
*/
import type { SessionNotification } from "@agentclientprotocol/sdk/unstable";
import type { Options } from "@anthropic-ai/claude-agent-sdk";
type SuggestionUpdate = SessionNotification["update"];
/** The forms of the prediction that a client takes. */
export type PromptSuggestionForms = {
/** `session_info_update._meta.promptSuggestions`: the client is JetBrains AIR. */
meta: boolean;
/** `prompt_suggestions_update`: the client advertised `session.promptSuggestions`. */
update: boolean;
};
/**
* Whether a client advertised `session.promptSuggestions`. `session` is the
* session capabilities of its `initialize` request: `clientCapabilities.session`
* on v1, `capabilities.session` on v2. ACP forbids the update without it.
*/
export function clientTakesPromptSuggestions(
session: { promptSuggestions?: unknown } | null | undefined,
): boolean {
return session?.promptSuggestions != null;
}
/** Whether a client takes the prediction in any form. */
function takesPrediction(forms: PromptSuggestionForms): boolean {
return forms.meta || forms.update;
}
/**
* The SDK option that makes Claude Code predict the next prompt, for a
* session whose client takes the prediction in a form. Empty for any other
* client: a prediction costs a request per turn, and none of it would reach
* that client. Both cores spread it before the client's own options, so
* `_meta.claudeCode.options.promptSuggestions: false` turns the prediction off.
*/
export function promptSuggestionOptions(
forms: PromptSuggestionForms,
): Pick<Options, "promptSuggestions"> {
return takesPrediction(forms) ? { promptSuggestions: true } : {};
}
/** The `_meta` key the suggestion travels under. It names no vendor. */
export const PROMPT_SUGGESTIONS_META_KEY = "promptSuggestions";
@@ -26,7 +75,8 @@ export type PromptSuggestionsMetaValue = {
/**
* The suggestion as it goes on the wire, or `null` for a suggestion that says
* nothing: the CLI can predict whitespace, and an empty text would otherwise
* reach the composer as a hint with no content.
* reach the composer as a hint with no content. ACP forbids a suggestion whose
* only content is empty or whitespace-only text.
*/
export function promptSuggestionText(raw: string | null | undefined): string | null {
const text = raw?.trim();
@@ -44,12 +94,19 @@ export function promptSuggestionsMeta(text: string | null): Record<string, unkno
}
/**
* The prediction a session holds on the client, and whether an arriving
* `prompt_suggestion` still answers the turn the user waits on. Both cores
* keep one per session and send the `_meta` that its methods return as a
* `session_info_update`, to an AIR client only. Undefined: nothing to send.
* The `prompt_suggestions_update` that makes `text` the session's list of
* suggestions. `null` sends an empty list, which withdraws the list that the
* client is offering.
*/
export class PromptSuggestions {
export function promptSuggestionsUpdate(text: string | null): SuggestionUpdate {
return {
sessionUpdate: "prompt_suggestions_update",
suggestions: text === null ? [] : [{ prompt: [{ type: "text", text }] }],
};
}
/** The prediction that a client holds in one form, and what is still to come of the last result. */
class Lane {
/** The last text sent (`null` after a clear). Undefined until the first send. */
private published: string | null | undefined;
/**
@@ -60,33 +117,118 @@ export class PromptSuggestions {
*/
private expected = false;
/** A result came: the CLI predicts the next prompt right after it. */
constructor(
private readonly form: (text: string | null) => SuggestionUpdate,
/** `prompt_suggestions_update`, whose rules ACP sets. */
readonly standard: boolean,
) {}
resultArrived(): void {
this.expected = true;
}
/** The `_meta` of the CLI's `prompt_suggestion`, if it answers the last result and changes what the client holds. */
suggested(raw: string | null | undefined): Record<string, unknown> | undefined {
suggested(text: string | null, working: boolean): SuggestionUpdate | undefined {
if (!this.expected) return undefined;
this.expected = false;
return this.publish(promptSuggestionText(raw));
// ACP: a prediction is discarded when the conversation changed before it
// was sent. AIR's draft has no such rule.
if (working && this.standard) return undefined;
return this.publish(text);
}
/**
* The `_meta` that clears the prediction: a client prompt spent it, or a
* `conversation_reset` dropped the transcript it came from. It also drops
* a prediction still in flight for the last result. Undefined when the
* client holds none.
*/
clear(): Record<string, unknown> | undefined {
clear(): SuggestionUpdate | undefined {
this.expected = false;
return this.publish(null);
}
private publish(text: string | null): Record<string, unknown> | undefined {
private publish(text: string | null): SuggestionUpdate | undefined {
// An unchanged prediction is not sent again.
if ((this.published ?? null) === text) return undefined;
this.published = text;
return promptSuggestionsMeta(text);
return this.form(text);
}
}
/**
* The predictions that a session holds on the client, and whether an arriving
* `prompt_suggestion` still answers the turn the user waits on. Both cores
* keep one per session and send the updates that its methods return, in
* order. An empty list: nothing to send.
*
* Each form has its own state. The `_meta` form keeps the rules it had before
* ACP had the update. The `prompt_suggestions_update` form follows ACP's, so
* it also drops a prediction that arrives while Claude works
* ({@link suggested}) and withdraws its list when work starts
* ({@link workStarted}).
*/
export class PromptSuggestions {
private readonly lanes: Lane[];
/**
* The predictions of a session whose client takes `forms`. Undefined for a
* client that takes neither: nothing of a prediction goes to it.
*/
static forClient(forms: PromptSuggestionForms): PromptSuggestions | undefined {
return takesPrediction(forms) ? new PromptSuggestions(forms) : undefined;
}
private constructor(forms: PromptSuggestionForms) {
this.lanes = [
...(forms.update ? [new Lane(promptSuggestionsUpdate, true)] : []),
...(forms.meta
? [
new Lane(
(text) => ({
sessionUpdate: "session_info_update",
_meta: promptSuggestionsMeta(text),
}),
false,
),
]
: []),
];
}
/** A result came: the CLI predicts the next prompt right after it. */
resultArrived(): void {
for (const lane of this.lanes) lane.resultArrived();
}
/**
* The updates for the CLI's `prompt_suggestion`, in each form where it
* answers the last result and changes what the client holds.
*
* `working`: Claude works in the session now, such as on a prompt that was
* queued before the result, or in a cycle that Claude Code started on its
* own. The prediction does not account for that work, so the
* `prompt_suggestions_update` form drops it.
*/
suggested(raw: string | null | undefined, working: boolean): SuggestionUpdate[] {
const text = promptSuggestionText(raw);
return this.updates((lane) => lane.suggested(text, working));
}
/**
* The updates that clear the prediction: a client prompt spent it, or a
* `conversation_reset` dropped the transcript it came from. It also drops
* a prediction still in flight for the last result. Empty when the client
* holds none.
*/
clear(): SuggestionUpdate[] {
return this.updates((lane) => lane.clear());
}
/**
* Foreground work started. The `prompt_suggestions_update` form withdraws
* its list, as {@link clear} does: ACP asks for it when work starts without
* a prompt, and a prompt's own work finds the list withdrawn already. The
* `_meta` form keeps its prediction until the next prompt, as before.
*/
workStarted(): SuggestionUpdate[] {
return this.updates((lane) => (lane.standard ? lane.clear() : undefined));
}
private updates(of: (lane: Lane) => SuggestionUpdate | undefined): SuggestionUpdate[] {
return this.lanes.flatMap((lane) => of(lane) ?? []);
}
}

View File

@@ -1,7 +1,8 @@
/**
* The config options of a session, as both the v1 core and the v2 core
* build them: mode, model, effort, Fast mode, ultracode and the main-thread
* agent.
* build them: model, effort, Fast mode, ultracode, mode and the main-thread
* agent. A client gets them in that order (`orderedConfigOptions`), for a
* root session and for a subagent's session.
*/
import {
RequestError,
@@ -15,7 +16,7 @@ import {
AIR_RECOMMENDED_CONFIG_VALUE_CAPABILITY,
clientSupportsAirCapability,
} from "./air-extension.js";
import { AGENT_CONFIG_ID, DEFAULT_AGENT_ID } from "./session-config-ids.js";
import { AGENT_CONFIG_ID, DEFAULT_AGENT_ID, EFFORT_CONFIG_ID } from "./session-config-ids.js";
import { buildEffortConfigOption } from "./session-effort.js";
import {
createFastModeConfigOption,
@@ -105,6 +106,36 @@ export type ConfigOptionPresentation = {
useRecommendedValue: boolean;
};
/**
* The ids of a session's config options, in the order a client gets them.
* An option is ranked by its id and not by its `category`, which the agent
* option lacks.
*/
const CONFIG_OPTION_ORDER: readonly string[] = [
MODEL_CONFIG_ID,
EFFORT_CONFIG_ID,
FAST_MODE_CONFIG_ID,
ULTRACODE_CONFIG_ID,
MODE_CONFIG_ID,
AGENT_CONFIG_ID,
];
/**
* `options` as a client gets them, for a root session and for a subagent's
* session: in {@link CONFIG_OPTION_ORDER}'s order, then each option with
* another id, in the order it came.
*/
export function orderedConfigOptions(
options: Iterable<SessionConfigOption>,
): SessionConfigOption[] {
const rank = (option: SessionConfigOption) => {
const index = CONFIG_OPTION_ORDER.indexOf(option.id);
return index < 0 ? CONFIG_OPTION_ORDER.length : index;
};
return [...options].sort((left, right) => rank(left) - rank(right));
}
/** The config options of a root session, in the order a client gets them. */
export function buildConfigOptions(
modes: SessionModeState,
models: SessionModelState,
@@ -116,7 +147,7 @@ export function buildConfigOptions(
presentation?: ConfigOptionPresentation,
ultracode?: UltracodeOptionState,
): SessionConfigOption[] {
const options: SessionConfigOption[] = [SessionModeManager.configOption(modes)];
const options: SessionConfigOption[] = [];
// A gateway that lists none of the SDK's models leaves no model to offer, so
// there is no model option at all.
if (models.availableModels.length > 0) {
@@ -151,6 +182,8 @@ export function buildConfigOptions(
options.push(createUltracodeConfigOption(ultracode.enabled, ultracode.useBooleanOption));
}
options.push(SessionModeManager.configOption(modes));
// Only surface the Agent picker when there's a real choice — i.e. the user
// has configured at least one custom agent (built-ins are filtered out in
// discoverCustomAgents). With none configured, "Default" would be the only
@@ -173,7 +206,9 @@ export function buildConfigOptions(
});
}
return options;
// The statements above already follow CONFIG_OPTION_ORDER. Sorting by it
// keeps this list and a subagent's list on the one definition.
return orderedConfigOptions(options);
}
/**
@@ -192,12 +227,20 @@ export function buildConfigOptions(
* a fallback for resolutions that don't map back onto a selectable option
* (e.g. a fuzzy hit on an out-of-picker verbatim entry). `value` is then the
* canonical option value, the model id rather than the alias.
*
* With `passUnlisted`, a model value that resolves to none of the entries is
* returned as it is, marked `unlisted`, for Claude Code to decide: the CLI's
* picker leaves out models it runs, such as `claude-fable-5-2` before a CLI
* lists it, or `claude-opus-4-6` once a newer Opus replaces it.
* {@link setSelectedModel} refuses it with invalid params when Claude Code
* does. Without it, such a value is refused here.
*/
export function configOptionValue(
option: SessionConfigOption,
params: SetSessionConfigOptionRequest,
modelInfos: ModelInfo[],
): { enabled: boolean } | { value: string } {
passUnlisted = false,
): { enabled: boolean } | { value: string; unlisted?: true } {
const expectedType = option.type === "boolean" ? "boolean" : "string";
if (typeof params.value !== expectedType) {
throw RequestError.invalidParams(
@@ -233,6 +276,9 @@ export function configOptionValue(
}));
validValue = toOptionValue(resolveModelPreference(optionInfos, requested));
}
if (!validValue && passUnlisted && requested.trim() !== "") {
return { value: requested.trim(), unlisted: true };
}
}
if (!validValue) {
throw RequestError.invalidParams(
@@ -242,3 +288,59 @@ export function configOptionValue(
}
return { value: validValue.value };
}
/**
* The codes with which Claude Code's `setModel` refuses a model id that the
* session cannot use: an id it does not know (`not_found`,
* `catalog_unknown`), one that settings restrict (`restricted_by_org`: an
* `availableModels` allowlist, a managed `deniedModels` entry), one the
* account or this CLI does not offer, and a `[1m]` form that is turned off or
* that the model lacks.
*
* Claude Code sends the code as `error_code` of its answer and the SDK
* (0.3.325) copies it to `errorCode` of the error that `setModel()` rejects
* with. The SDK's types do not declare it.
*/
const UNUSABLE_MODEL_ERROR_CODES: ReadonlySet<string> = new Set([
"not_found",
"catalog_unknown",
"restricted_by_org",
"unavailable_for_account",
"not_offered",
"alias_1m_disabled",
"alias_1m_unsupported",
]);
/** Whether `setModel()` rejected with `error` because the session cannot use the model id. */
function refusesModelId(error: unknown): error is Error {
if (!(error instanceof Error)) return false;
const code = (error as { errorCode?: unknown }).errorCode;
return typeof code === "string" && UNUSABLE_MODEL_ERROR_CODES.has(code);
}
/**
* Switches `query` to the model that {@link configOptionValue} selected.
*
* When Claude Code refuses an `unlisted` id as one the session cannot use
* (see {@link UNUSABLE_MODEL_ERROR_CODES}), that is invalid params with Claude
* Code's reason ("Model 'gpt-4' not found"), as for a value the option lacks.
* Every other failure is thrown as it is and reaches the client as an
* internal error: a failed switch to a listed value, and a failure that does
* not judge the id, such as `auth_failed`, `rate_limit`, `check_unreachable`
* (the API did not answer), `blocked_by_hook`, a closed query, or a refusal
* without a code.
*/
export async function setSelectedModel(
query: Pick<Query, "setModel">,
selected: { value: string; unlisted?: true },
): Promise<void> {
try {
await query.setModel(selected.value);
} catch (error) {
if (!selected.unlisted || !refusesModelId(error)) throw error;
throw RequestError.invalidParams(
undefined,
`Invalid value for config option ${MODEL_CONFIG_ID}: ${selected.value}. ${error.message}`,
);
}
}

84
src/session-cursors.ts Normal file
View File

@@ -0,0 +1,84 @@
/**
* Session cursors (the unstable session cursors RFD): the positions of a
* session that a method can act at.
*
* The adapter announces one kind: the position before a user message that the
* session's history stores, with the `fork` capability. `session/fork` with
* its `cursorId` copies the history before that message, so a client can edit
* the message or ask again from there. The first entry of a history has no
* cursor: nothing is before it, and Claude Code forks at an entry, not before
* the first one.
*
* A `cursorId` is derived from the uuid of its user message, which Claude Code
* stores. So it is the same live, in every replay and after a restart, and
* the adapter keeps no cursors of its own: a fork finds the position in the
* stored history.
*/
import type { SessionMessage } from "@anthropic-ai/claude-agent-sdk";
import { isCompactSummaryMessage } from "./context-compaction.js";
import { isReplayHiddenMetaMessage, stripLocalCommandMetadata } from "./message-filters.js";
/** What the cursor ids start with. The rest is the uuid of the user message. */
const BEFORE_MESSAGE = "before:";
/** The `cursor_update` of the cursor before the user message `messageId`. */
export function forkCursorUpdate(messageId: string) {
return {
sessionUpdate: "cursor_update" as const,
cursorId: `${BEFORE_MESSAGE}${messageId}`,
capabilities: { fork: {} },
anchor: { type: "user_message" as const, messageId, position: "before" as const },
};
}
/**
* Whether a prompt with this content gets a cursor when it is inserted live.
* A slash command does not: Claude Code stores a command as command metadata
* or not at all, so a replay shows no user message for it and a fork finds no
* cursor (see {@link hasForkCursor}). Text that only starts like a command
* gets its cursor in the next replay.
*/
export function promptGetsCursor(prompt: ReadonlyArray<{ type: string; text?: unknown }>): boolean {
const first = prompt.find((block) => block.type === "text");
return !(typeof first?.text === "string" && first.text.trimStart().startsWith("/"));
}
/**
* Whether the entry `index` of the stored history `messages` is a user
* message with a cursor before it: one that a replay shows as a user message
* under its uuid, and that follows an entry that a fork can end with. A
* replay announces the cursor of each such message, and a fork accepts no
* other.
*/
export function hasForkCursor(messages: readonly SessionMessage[], index: number): boolean {
const message = messages[index];
if (!message || message.type !== "user" || !message.uuid) return false;
if (!messages[index - 1]?.uuid) return false;
if (message.parent_tool_use_id !== null) return false;
if (isReplayHiddenMetaMessage(message) || isCompactSummaryMessage(message)) return false;
// `null`: the message was command metadata alone, which a replay does not show.
const content = stripLocalCommandMetadata(
(message.message as { content?: unknown } | undefined)?.content,
);
if (typeof content === "string") return content.length > 0;
// A message of tool results alone is no user message.
return (
Array.isArray(content) &&
content.some((block) => (block as { type?: unknown } | null)?.type !== "tool_result")
);
}
/**
* The uuid of the entry that a fork at `cursorId` ends with: the entry before
* the cursor's user message in the stored history `messages`. Undefined for
* an id that is no cursor of that history (see {@link hasForkCursor}).
*/
export function forkPointOf(
cursorId: string,
messages: readonly SessionMessage[],
): string | undefined {
if (!cursorId.startsWith(BEFORE_MESSAGE)) return undefined;
const messageId = cursorId.slice(BEFORE_MESSAGE.length);
const index = messages.findIndex((message) => message.uuid === messageId);
return hasForkCursor(messages, index) ? messages[index - 1]!.uuid : undefined;
}

View File

@@ -110,6 +110,9 @@ export function buildEffortConfigOption(
useRecommendedValue: boolean,
): SessionConfigOption | undefined {
const currentModelInfo = modelInfos.find((model) => model.value === currentModelId);
// In Claude Code's order, which lists the levels from lowest to highest
// ("low" to "max"), as ACP v2 asks of a `thought_level` select. Nothing
// here sorts them.
const supportedLevels = currentModelInfo?.supportsEffort
? (currentModelInfo.supportedEffortLevels ?? [])
: [];

View File

@@ -74,9 +74,15 @@ export function normalizeFastModeDisabledReason(
/** Build the Fast mode config option. When the Client supports boolean config
* options we expose a native `type: "boolean"` toggle; otherwise we degrade to
* a two-value `select` ("on"/"off") so older Clients still get a usable
* a two-value `select` ("off"/"on") so older Clients still get a usable
* control.
*
* Its category is `speed`, the unstable ACP category of an option that
* changes how fast the model responds, in v1 and v2. A category needs no
* capability: a Client that does not know `speed` handles it as any unknown
* category. ACP asks for a `speed` select's values from slowest to fastest,
* so the fallback lists off before on.
*
* `disabledReason` (the SDK's `fast_mode_disabled_reason`) is folded into the
* description while the toggle reads off, so a user whose account or provider
* can't serve Fast mode sees why instead of a switch that silently refuses to
@@ -92,7 +98,7 @@ export function createFastModeConfigOption(
id: FAST_MODE_CONFIG_ID,
name: "Fast mode",
description: explanation ? `${FAST_MODE_DESCRIPTION} — ${explanation}` : FAST_MODE_DESCRIPTION,
category: "model_config",
category: "speed",
} as const;
if (useBooleanOption) {
@@ -104,8 +110,8 @@ export function createFastModeConfigOption(
type: "select",
currentValue: enabled ? FAST_MODE_ON : FAST_MODE_OFF,
options: [
{ value: FAST_MODE_ON, name: "On" },
{ value: FAST_MODE_OFF, name: "Off" },
{ value: FAST_MODE_ON, name: "On" },
],
};
}
@@ -130,6 +136,27 @@ export function resolveFastModeEnabled(params: SetSessionConfigOptionRequest): b
);
}
/** Set the Fast mode flag on Claude Code, through `applyFlagSettings`.
*
* Turning it on sends `fastMode: false` first, a workaround for Claude Code
* (CLI 2.1.325): it acts on `fastMode: true` only when its flag does not hold
* `true` already, and ignores a repeat. Its flag stays `true` while 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) and reports
* `fast_mode_state: "off"`. Without the reset, turning the toggle back on
* changes nothing there, and the next `system`/init turns it off again.
*
* A refusal of the reset changes nothing. If Claude Code takes the reset and
* refuses `true`, it is left off; the caller's option keeps its value, and the
* next `system`/init turns off an option that reads on. */
export async function applyFastModeFlag(
applyFlagSettings: (settings: { fastMode: boolean }) => Promise<void>,
enabled: boolean,
): Promise<void> {
if (enabled) await applyFlagSettings({ fastMode: false });
await applyFlagSettings({ fastMode: enabled });
}
/** Per-model Fast mode state threaded into `buildConfigOptions`. The
* option is only surfaced when the current model `supported`s fast mode. */
export type FastModeOptionState = {
@@ -162,8 +189,10 @@ export type FastModeOptionState = {
* `notice` is set when the user had Fast mode on and the SDK turned it off
* with a retained reason: the description carries the same explanation, but a
* toggle silently snapping back is worth saying out loud once. Off with no
* reason, `sdk_opt_in_required` or `pending` stays quiet: a `result` can carry
* the turn-start snapshot, so a notice there would falsely say "turned off". */
* reason, `sdk_opt_in_required` or `pending` stays quiet: a report can carry
* the flag as it was before a request of ours (see
* {@link fastModeResultIsNews}), so a notice there would falsely say "turned
* off". */
export function fastModeStateChange(
current: { enabled: boolean; disabledReason?: FastModeDisabledReason },
state: FastModeState | undefined,
@@ -195,6 +224,41 @@ export function fastModeStateChange(
};
}
/** A Fast mode report of Claude Code: the `fast_mode_state` and
* `fast_mode_disabled_reason` of a `system`/init or of a result. */
export type FastModeReport = {
state: FastModeState | undefined;
reason: FastModeDisabledReason | undefined;
};
/** Whether a result's Fast mode report says something that `init`, the report
* of its turn's `system`/init, did not.
*
* Claude Code (CLI 2.1.325) reads the `fastMode` flag once when a turn starts
* and builds that turn's init and result from the one reading. A result that
* repeats its init therefore predates a `session/set_config_option` that
* arrived in between: mirroring it would turn the toggle back, until the next
* turn's init. What a result adds is what Claude Code evaluates when it sends
* it: a refusal by the account or the model, or the end of one.
*
* Reasons compare as retained ({@link normalizeFastModeDisabledReason}):
* turning Fast mode on mid-turn drops `sdk_opt_in_required` from the result,
* which is no news. True without an init, as for a result whose turn sent none.
*
* Not covered: a request that Claude Code applies after it read the flag and
* before it sent the init. That init reports the earlier value too, and the
* next turn's init corrects the toggle. */
export function fastModeResultIsNews(
init: FastModeReport | undefined,
result: FastModeReport,
): boolean {
if (init === undefined) return true;
return (
result.state !== init.state ||
normalizeFastModeDisabledReason(result.reason) !== normalizeFastModeDisabledReason(init.reason)
);
}
/** The notice of Fast mode that the SDK turned off, and its transcript line
* for a client without `notice` updates. */
export type FastModeOffNotice = {

View File

@@ -1,3 +1,5 @@
import { RequestError } from "@agentclientprotocol/sdk/unstable";
import { PROVIDER_ID } from "./providers.js";
import type { SessionConfigOption } from "@agentclientprotocol/sdk/unstable";
// matchDeniedModels is marked @alpha in the SDK; API may shift in a future release.
import {
@@ -146,6 +148,8 @@ function modelCoversTokens(model: ModelInfo, tokens: string[]): boolean {
* of its model words, preferring one with the same context hint ("sonnet[1m]"
* for "claude-sonnet-5-1m"). The fuzzy tiers need a compatible version, and
* words match whole: "not-a-model", "son" and "foo-sonnet" name no entry.
* For a preference without a version, the fuzzy tiers take the entry of the
* newest version: "opus[1m]" gives "claude-opus-5-5", not "claude-opus-4-5".
*/
export function resolveModelPreference(models: ModelInfo[], preference: string): ModelInfo | null {
const trimmed = preference.trim();
@@ -175,27 +179,58 @@ export function resolveModelPreference(models: ModelInfo[], preference: string):
const preferenceHint = contextHintOf(trimmed);
const tokens = modelPreferenceTokens(trimmed);
const includesMatch = models.find((model) => {
if (!modelVersionsCompatible(trimmed, model)) return false;
if (contextHintOf(model.value) !== preferenceHint) return false;
return (
containsWords(model.value, trimmed) ||
containsWords(model.displayName, trimmed) ||
(containsWords(trimmed, model.value) && modelCoversTokens(model, tokens))
);
});
// A preference without a version (`opus`, `opus[1m]`) runs its family's
// newest model in the CLI, so the fuzzy tiers pick the newest row, not the
// first: an allowlist lists `claude-opus-4-5-20251101` before `claude-opus-5-5`.
const pick =
extractModelFamilyVersion(trimmed) === null
? newestModel
: (rows: ModelInfo[]): ModelInfo | undefined => rows[0];
const includesMatch = pick(
models.filter((model) => {
if (!modelVersionsCompatible(trimmed, model)) return false;
if (contextHintOf(model.value) !== preferenceHint) return false;
return (
containsWords(model.value, trimmed) ||
containsWords(model.displayName, trimmed) ||
(containsWords(trimmed, model.value) && modelCoversTokens(model, tokens))
);
}),
);
if (includesMatch) return includesMatch;
const candidates = models.filter(
(model) => modelVersionsCompatible(trimmed, model) && modelCoversTokens(model, tokens),
);
return (
candidates.find((model) => contextHintOf(model.value) === preferenceHint) ??
candidates[0] ??
pick(candidates.filter((model) => contextHintOf(model.value) === preferenceHint)) ??
pick(candidates) ??
null
);
}
/** The row of `models` that runs the newest family version, the first one of
* equal versions. A row of an unknown version (`my-model`) ranks below each
* row of a known one. */
function newestModel(models: ModelInfo[]): ModelInfo | undefined {
let newest: ModelInfo | undefined;
let newestVersion: { major: number; minor: number } | null = null;
for (const model of models) {
const version = familyVersionOf(normalizeModelId(model.resolvedModel ?? model.value));
const newer =
newest === undefined ||
(version !== null &&
(newestVersion === null ||
version.major > newestVersion.major ||
(version.major === newestVersion.major && version.minor > newestVersion.minor)));
if (newer) {
newest = model;
newestVersion = version;
}
}
return newest;
}
export function matchResumedModel(models: ModelInfo[], liveModel: string): ModelInfo {
const live = canonicalizeModelId(liveModel);
const defaultEntry = models.find((model) => model.value === "default");
@@ -562,7 +597,9 @@ export async function applyAvailableModelsAllowlist(
*
* When no row matches by its model (a `default` row kept only for lacking a
* `resolvedModel` does not count), the gateway serves none of the SDK's
* models, and nothing is left: the session offers no model.
* models. If every row has a nonempty `resolvedModel`, session setup fails
* with an error to choose a different provider. An empty catalog or any row
* without a resolved model leaves no model config option instead.
*/
export function narrowToGatewayModels(
models: ModelInfo[],
@@ -582,9 +619,16 @@ export function narrowToGatewayModels(
if (model.value === "default") return true;
return MODEL_FAMILY_ALIASES.has(id) && [...listed].some((entry) => entry.includes(`-${id}`));
});
return narrowed.some((model) => listed.has(normalizeModelId(model.resolvedModel ?? model.value)))
? narrowed
: [];
if (narrowed.some((model) => listed.has(normalizeModelId(model.resolvedModel ?? model.value)))) {
return narrowed;
}
if (models.length > 0 && models.every((model) => model.resolvedModel?.trim())) {
throw RequestError.internalError(
{ providerId: PROVIDER_ID },
"The selected provider offers no compatible Claude models. Choose a different provider and try again.",
);
}
return [];
}
/**

View File

@@ -132,18 +132,23 @@ export function informationalNotice(message: { level: string; content: string })
};
}
/** The notice of a client MCP server that the `system/init` lists as not
* started: `failed`, or `needs-auth` when the client cannot run the OAuth
* flow (`oauthAvailable`). Undefined for any other status. */
/** The notice of a client MCP server that did not start: `failed`, or
* `needs-auth` when the client cannot run the OAuth flow (`oauthAvailable`).
* Undefined for any other status. A server of the `system/init` list has no
* `error`: `/mcp` shows it. An `UnservedMcpServer` is on no list of Claude
* Code, so the notice has its `error`. */
export function mcpServerStartupNotice(
server: { name: string; status: string },
server: { name: string; status: string; error?: string },
oauthAvailable: boolean,
): SessionNotice | undefined {
if (server.status === "failed") {
return {
severity: "warning",
title: `MCP server "${server.name}" failed to start`,
description: "Its tools are unavailable in this session. Run /mcp for the error.",
description:
server.error === undefined
? "Its tools are unavailable in this session. Run /mcp for the error."
: `Its tools are unavailable in this session. ${server.error}`,
};
}
if (server.status === "needs-auth" && !oauthAvailable) {

View File

@@ -63,6 +63,7 @@ export class SettingsManager {
private managedModelSettings: ModelSelectionSettings = {};
private managedApiKeyHelper?: string;
private managedCompactionSettings: CompactionSettings = {};
private managedShowClearContextOnPlanAccept?: boolean;
/** The policy sources last logged as not loaded (see {@link unloadedPolicySources}). */
private unloadedPolicy?: string;
private watchers: fs.FSWatcher[] = [];
@@ -160,6 +161,9 @@ export class SettingsManager {
?.autoCompactEnabled,
env: Object.assign({}, ...managed.map((tier) => tier.env)),
};
this.managedShowClearContextOnPlanAccept = managed.findLast(
(tier) => tier.showClearContextOnPlanAccept !== undefined,
)?.showClearContextOnPlanAccept;
} catch (error) {
this.logger.error("Failed to resolve settings:", error);
this.effective = {};
@@ -167,6 +171,7 @@ export class SettingsManager {
this.managedModelSettings = {};
this.managedApiKeyHelper = undefined;
this.managedCompactionSettings = {};
this.managedShowClearContextOnPlanAccept = undefined;
}
}
@@ -284,6 +289,21 @@ export class SettingsManager {
};
}
/**
* Whether an approved plan may be continued in a fresh context, as the CLI
* resolves `showClearContextOnPlanAccept`: managed settings outrank the
* `--settings` override, which outranks the user/project/local files. Off
* unless one of them sets it, like the CLI.
*/
getShowClearContextOnPlanAccept(settingsOverride?: Settings): boolean {
return (
this.managedShowClearContextOnPlanAccept ??
settingsOverride?.showClearContextOnPlanAccept ??
this.effective.showClearContextOnPlanAccept ??
false
);
}
/**
* `deniedModels` entries from the managed tier, the only tier the CLI
* honors them from.

View File

@@ -2,7 +2,8 @@
* The configuration of a subagent's session, as its hooks report it. Both
* the v1 core (`ClaudeAcpAgent.subagentConfigurationHook`, for both forms of
* subagent sessions) and the v2 core (`v2/child-config.ts`)
* build a child's config options with these.
* build a child's config options with these, and send them in the root
* session's order (`orderedConfigOptions` in `session-config-options.ts`).
*/
import type { SessionConfigOption, SessionModeState } from "@agentclientprotocol/sdk/unstable";
import type { AgentInfo, HookInput } from "@anthropic-ai/claude-agent-sdk";
@@ -78,19 +79,3 @@ export function subagentHookOptions(
}
return options;
}
/**
* A child's configuration, as it goes to the client: every option it holds,
* the mode first, then the model, the effort and the model config, then the
* rest in the order they came.
*/
export function orderedSubagentConfiguration(
options: Iterable<SessionConfigOption>,
): SessionConfigOption[] {
const priority = ["mode", "model", "thought_level", "model_config"];
const rank = (option: SessionConfigOption) => {
const index = priority.indexOf(option.category ?? "");
return index < 0 ? priority.length : index;
};
return [...options].sort((left, right) => rank(left) - rank(right));
}

View File

@@ -5,7 +5,7 @@
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"rawInput":{"plan":"# Plan\n1. Do it"},"sessionUpdate":"tool_call_update","toolCallId":"toolu_plan"}}}
{"kind":"requestPermission","payload":{"_meta":{"jetbrains":{"air":{"permission":{"title":"Ready to code?","version":1},"version":1}}},"options":[{"kind":"allow_once","name":"Yes, manually approve edits","optionId":"exit-plan-default"},{"kind":"allow_always","name":"Yes, clear context (0% used) and use auto mode","optionId":"exit-plan-clear-auto"},{"kind":"allow_always","name":"Yes, and use auto mode","optionId":"exit-plan-auto"},{"kind":"allow_always","name":"Yes, and bypass permissions","optionId":"exit-plan-bypass"},{"kind":"reject_once","name":"No, keep planning","optionId":"reject"}],"sessionId":"<session>","toolCall":{"rawInput":{"plan":"# Plan\n1. Do it"},"title":"Approve Plan","toolCallId":"toolu_plan"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"currentModeId":"default","sessionUpdate":"current_mode_update"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"configOptions":[{"category":"mode","currentValue":"default","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"}],"sessionUpdate":"config_option_update"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"configOptions":[{"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"},{"category":"mode","currentValue":"default","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"}],"sessionUpdate":"config_option_update"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","status":"completed","title":"Exited Plan Mode","toolCallId":"toolu_plan"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}

View File

@@ -1,4 +1,4 @@
{"kind":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
{"kind":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"acp":true,"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
{"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"}}}
@@ -12,6 +12,6 @@
{"kind":"sessionUpdate","payload":{"sessionId":"<session>:replay-subagent:toolu_r_task","update":{"_meta":{"claudeCode":{"parentToolUseId":"toolu_r_task"}},"content":{"text":"Subagent text.","type":"text"},"messageId":"msg_r_sub","sessionUpdate":"agent_message_chunk"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Fixed.","type":"text"},"messageId":"msg_r2","sessionUpdate":"agent_message_chunk"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"subagent_state_update","state":"completed","subagentSessionId":"<session>:replay-subagent:toolu_r_task"}}}
{"kind":"loadSession","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":"loadSession","payload":{"configOptions":[{"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"},{"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"}],"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>:replay-subagent:toolu_r_task","update":{"configOptions":[{"category":"model","currentValue":"claude-sonnet-4-6","id":"model","name":"Model","options":[{"name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionUpdate":"config_option_update"}}}
{"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"}}}

View File

@@ -1,3 +1,3 @@
{"kind":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
{"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":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"acp":true,"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
{"kind":"newSession","payload":{"configOptions":[{"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"},{"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"}],"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"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
@@ -10,7 +10,7 @@
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"rawInput":{"command":"false"},"sessionUpdate":"tool_call_update","title":"false","toolCallId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"rawInput":{"command":"false","description":"Fail"},"sessionUpdate":"tool_call_update","toolCallId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"output":{"data":"RXhpdCBjb2RlIDEKYm9vbQ=="},"sessionUpdate":"terminal_update","terminalId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"output":{"data":"RXhpdCBjb2RlIDENCmJvb20="},"sessionUpdate":"terminal_update","terminalId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"exitStatus":{"exitCode":1},"sessionUpdate":"terminal_update","terminalId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","status":"failed","toolCallId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
@@ -13,7 +13,7 @@
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"requires_action"}}}
{"kind":"request","method":"session/request_permission","payload":{"options":[{"kind":"allow_once","name":"Yes","optionId":"allow-once"},{"kind":"reject_once","name":"No","optionId":"reject"}],"sessionId":"<session>","subject":{"toolCall":{"content":[{"terminalId":"toolu_bash","type":"terminal"}],"kind":"execute","name":"Bash","rawInput":{"command":"ls -la","description":"List files"},"title":"ls -la","toolCallId":"toolu_bash"},"type":"tool_call"},"title":"ls -la"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"output":{"data":"YS50cwpiLnRz"},"sessionUpdate":"terminal_update","terminalId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"output":{"data":"YS50cw0KYi50cw=="},"sessionUpdate":"terminal_update","terminalId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"exitStatus":{"exitCode":0},"sessionUpdate":"terminal_update","terminalId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_bash"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":{"text":"Do","type":"text"},"messageId":"msg_done","sessionUpdate":"agent_message_chunk"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
@@ -10,7 +10,7 @@
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"requires_action"}}}
{"kind":"request","method":"session/request_permission","payload":{"options":[{"kind":"allow_once","name":"Yes, manually approve edits","optionId":"exit-plan-default"},{"kind":"allow_always","name":"Yes, clear context (0% used) and use auto mode","optionId":"exit-plan-clear-auto"},{"kind":"allow_always","name":"Yes, and use auto mode","optionId":"exit-plan-auto"},{"kind":"allow_always","name":"Yes, and bypass permissions","optionId":"exit-plan-bypass"},{"kind":"reject_once","name":"No, keep planning","optionId":"reject"}],"sessionId":"<session>","subject":{"toolCall":{"content":[{"content":{"text":"# Plan\n1. Do it","type":"text"},"type":"content"}],"kind":"switch_mode","name":"ExitPlanMode","rawInput":{"plan":"# Plan\n1. Do it"},"title":"Approve Plan","toolCallId":"toolu_plan"},"type":"tool_call"},"title":"Ready to code?"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"configOptions":[{"category":"mode","configId":"mode","currentValue":"default","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"}],"sessionUpdate":"config_option_update"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"configOptions":[{"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"},{"category":"mode","configId":"mode","currentValue":"default","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"}],"sessionUpdate":"config_option_update"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"rawOutput":"User has approved your plan. You can now start coding.\n\n## Approved Plan:\n# Plan\n1. Do it","sessionUpdate":"tool_call_update","status":"completed","title":"Exited Plan Mode","toolCallId":"toolu_plan"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"plan":{"content":"# Plan\n1. Do it","planId":"plan-mode","type":"markdown"},"sessionUpdate":"plan_update"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"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/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,4 +1,4 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[],"messageId":"00000000-0000-4000-8000-00000000c001","sessionUpdate":"user_message"}}}
{"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":{"content":[],"messageId":"msg_r1","sessionUpdate":"agent_thought"}}}
@@ -16,7 +16,8 @@
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"content":{"text":"Report.","type":"text"},"type":"content"}],"rawOutput":"Report.","sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_r_task"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[],"messageId":"msg_r2","sessionUpdate":"agent_message"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":{"text":"Fixed.","type":"text"},"messageId":"msg_r2","sessionUpdate":"agent_message_chunk"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"sessionUpdate":"replay_complete"}}}
{"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":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"idle"}}}
{"kind":"response","method":"session/resume","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"}]}}
{"kind":"response","method":"session/resume","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":"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"},{"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"}]}}

View File

@@ -1,2 +1,2 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
@@ -15,6 +15,7 @@
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"background":[],"sessionUpdate":"state_update","state":"idle","stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 2","type":"text"}],"messageId":"<id-2>","sessionUpdate":"user_message"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"anchor":{"messageId":"<id-2>","position":"before","type":"user_message"},"capabilities":{"fork":{}},"cursorId":"before:<id-2>","sessionUpdate":"cursor_update"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-2>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -1,5 +1,5 @@
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
{"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":"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"},{"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"}],"sessionId":"<session>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}

View File

@@ -38,6 +38,10 @@
* `agentCapabilities.sessionCapabilities.options`, which origin/main did
* not: the agent now serves `session/options` and takes `configOptions` on
* session setup requests.
* - The `initialize` response also advertises
* `agentCapabilities.mcpCapabilities.acp`, which origin/main did not: the
* agent now takes MCP servers that the client serves over the ACP
* connection (`"type": "acp"`).
* - A SandboxNetworkAccess tool call is settled by a `tool_call_update` with
* only its final `status` once its permission request is answered. The
* callback runs nothing, so origin/main never settled the call (see
@@ -253,16 +257,16 @@ function withoutSessionCapabilities(record: Recorded, keys: readonly string[]):
} as Recorded;
}
/** `record` without `agentCapabilities.auth.status`, when it is an `initialize` response. */
function withoutAuthStatusCapability(record: Recorded): Recorded {
/** `record` without `agentCapabilities.<group>.<key>`, when it is an `initialize` response. */
function withoutAgentCapability(record: Recorded, group: string, key: string): Recorded {
if (record.kind !== "initialize") return record;
const payload = record.payload as Json;
const agent = payload.agentCapabilities as Json | undefined;
const auth = agent?.auth as Json | undefined;
if (!auth || !("status" in auth)) return record;
const capabilities = agent?.[group] as Json | undefined;
if (!capabilities || !(key in capabilities)) return record;
return {
...record,
payload: { ...payload, agentCapabilities: { ...agent, auth: without(auth, "status") } },
payload: { ...payload, agentCapabilities: { ...agent, [group]: without(capabilities, key) } },
} as Recorded;
}
@@ -281,8 +285,14 @@ export function compareWithBaseline(baseline: Recorded[], traffic: Recorded[]):
});
const current = withoutSandboxNetworkSettlements(
traffic.map((record) =>
withoutAuthStatusCapability(
withoutSessionCapabilities(record, ["systemPrompt", "status", "title", "options"]),
withoutAgentCapability(
withoutAgentCapability(
withoutSessionCapabilities(record, ["systemPrompt", "status", "title", "options"]),
"auth",
"status",
),
"mcpCapabilities",
"acp",
),
),
);

View File

@@ -5,7 +5,7 @@
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"ExitPlanMode"}},"content":[{"content":{"text":"# Plan\n1. Do it","type":"text"},"type":"content"}],"kind":"switch_mode","rawInput":{"plan":"# Plan\n1. Do it"},"sessionUpdate":"tool_call_update","title":"Approve Plan","toolCallId":"toolu_plan"}}}
{"kind":"requestPermission","payload":{"_meta":{"permission":{"title":"Ready to code?","version":1}},"options":[{"kind":"allow_once","name":"Yes, manually approve edits","optionId":"exit-plan-default"},{"kind":"allow_always","name":"Yes, clear context (0% used) and use auto mode","optionId":"exit-plan-clear-auto"},{"kind":"allow_always","name":"Yes, and use auto mode","optionId":"exit-plan-auto"},{"kind":"allow_always","name":"Yes, and bypass permissions","optionId":"exit-plan-bypass"},{"kind":"reject_once","name":"No, keep planning","optionId":"reject"}],"sessionId":"<session>","toolCall":{"content":[{"content":{"text":"# Plan\n1. Do it","type":"text"},"type":"content"}],"kind":"switch_mode","name":"ExitPlanMode","rawInput":{"plan":"# Plan\n1. Do it"},"status":"pending","title":"Approve Plan","toolCallId":"toolu_plan"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"currentModeId":"default","sessionUpdate":"current_mode_update"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"configOptions":[{"category":"mode","currentValue":"default","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"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"}],"sessionUpdate":"config_option_update"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"configOptions":[{"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"},{"category":"mode","currentValue":"default","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionUpdate":"config_option_update"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"ExitPlanMode"}},"rawOutput":"User has approved your plan. You can now start coding.\n\n## Approved Plan:\n# Plan\n1. Do it","sessionUpdate":"tool_call_update","status":"completed","title":"Exited Plan Mode","toolCallId":"toolu_plan"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}

View File

@@ -9,5 +9,5 @@
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Edit"}},"rawOutput":"The file <cwd>/src/app.ts has been updated successfully.","sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_r_edit"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Task"}},"content":[{"content":{"text":"Report.","type":"text"},"type":"content"}],"rawOutput":"Report.","sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_r_task"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Fixed.","type":"text"},"messageId":"msg_r2","sessionUpdate":"agent_message_chunk"}}}
{"kind":"loadSession","payload":{"configOptions":[{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"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":{"kind":"standard"},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"loadSession","payload":{"configOptions":[{"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"},{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"modes":{"availableModes":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[],"sessionUpdate":"available_commands_update"}}}

View File

@@ -1,3 +1,3 @@
{"kind":"initialize","payload":{"_meta":{"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","recommendedValue"],"version":1}},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{}},"loadSession":true,"mcpCapabilities":{"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"resume":{},"subagents":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
{"kind":"newSession","payload":{"configOptions":[{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"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":{"kind":"standard"},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"newSession","payload":{"configOptions":[{"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"},{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"modes":{"availableModes":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[],"sessionUpdate":"available_commands_update"}}}

View File

@@ -10,5 +10,5 @@
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Edit"}},"rawOutput":"The file <cwd>/src/app.ts has been updated successfully.","sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_r_edit"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Task"}},"content":[{"content":{"text":"Report.","type":"text"},"type":"content"}],"rawOutput":"Report.","sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_r_task"}}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Fixed.","type":"text"},"messageId":"msg_r2","sessionUpdate":"agent_message_chunk"}}}
{"kind":"loadSession","payload":{"configOptions":[{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"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":{"kind":"standard"},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"loadSession","payload":{"configOptions":[{"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"},{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"modes":{"availableModes":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[],"sessionUpdate":"available_commands_update"}}}

View File

@@ -1,3 +1,3 @@
{"kind":"initialize","payload":{"_meta":{"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","recommendedValue"],"version":1}},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{}},"loadSession":true,"mcpCapabilities":{"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"resume":{},"subagents":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[{"_meta":{"terminal-auth":{"args":["<argv>","--cli","auth","login","--claudeai"],"command":"<executable>","label":"Claude Login"}},"args":["--cli","auth","login","--claudeai"],"description":"Use Claude subscription ","id":"claude-ai-login","name":"Claude Subscription","type":"terminal"},{"_meta":{"terminal-auth":{"args":["<argv>","--cli","auth","login","--console"],"command":"<executable>","label":"Anthropic Console Login"}},"args":["--cli","auth","login","--console"],"description":"Use Anthropic Console (API usage billing)","id":"console-login","name":"Anthropic Console","type":"terminal"}],"protocolVersion":1}}
{"kind":"newSession","payload":{"configOptions":[{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"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":{"kind":"standard"},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"newSession","payload":{"configOptions":[{"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"},{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"modes":{"availableModes":[{"_meta":{"kind":"standard"},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"kind":"standard"},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"kind":"plan"},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"kind":"auto_review"},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"kind":"full_access"},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[],"sessionUpdate":"available_commands_update"}}}

View File

@@ -32,6 +32,9 @@ const hookHeartbeat = (event: "PreToolUse" | "PostToolUse", toolUseId: string, u
session_id: activeSdkSessionId(),
});
/** Project settings that make ExitPlanMode offer clearing the context. */
const CLEAR_CONTEXT_SETTINGS = JSON.stringify({ showClearContextOnPlanAccept: true });
export const SCENARIOS: Scenario[] = [
{
name: "session-setup",
@@ -963,6 +966,8 @@ export const SCENARIOS: Scenario[] = [
},
{
name: "exit-plan-approve",
// Claude Code offers clearing the context only with this setting on.
files: { ".claude/settings.json": CLEAR_CONTEXT_SETTINGS },
turns: [
async function* (ctx) {
yield* toolCall(
@@ -981,6 +986,8 @@ export const SCENARIOS: Scenario[] = [
},
{
name: "exit-plan-reject",
// Claude Code offers clearing the context only with this setting on.
files: { ".claude/settings.json": CLEAR_CONTEXT_SETTINGS },
permission: "reject_once",
turns: [
async function* (ctx) {

View File

@@ -1,12 +1,16 @@
import { appendFile, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { query } from "@anthropic-ai/claude-agent-sdk";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
BACKGROUND_OUTPUT_MAX_BACKLOG_BYTES,
BACKGROUND_OUTPUT_READ_BYTES,
type BackgroundOutput,
BackgroundOutputTail,
supportsTaskOutput,
type TaskOutput,
TaskOutputPoll,
} from "../background-output.js";
describe("BackgroundOutputTail", () => {
@@ -127,3 +131,129 @@ describe("BackgroundOutputTail", () => {
expect(published).toEqual([]);
});
});
describe("TaskOutputPoll", () => {
let published: BackgroundOutput[];
let poll: TaskOutputPoll | undefined;
/**
* `get_task_output` returning each of `reads` in turn, then the last one
* again. An `unanswered` read never returns.
*/
const follow = (reads: Array<TaskOutput | "unanswered">) => {
let next = 0;
const read = async () => {
const answer = reads[Math.min(next++, reads.length - 1)]!;
return answer === "unanswered" ? new Promise<never>(() => {}) : answer;
};
poll = new TaskOutputPoll(read, async (output) => void published.push(output));
return () => next;
};
const whole = (output: string): TaskOutput => ({
output,
total_bytes: Buffer.byteLength(output),
truncated: false,
});
beforeEach(() => {
published = [];
});
afterEach(() => {
poll?.stop();
});
it("appends what the output adds, and reports on finish that it sent text", async () => {
follow([whole(""), whole("line1\n"), whole("line1\nline2 ✓\n")]);
await vi.waitFor(() => expect(published).toHaveLength(2), { timeout: 3000 });
expect(await poll!.finish()).toBe(true);
expect(published).toEqual([
{ text: "line1\n", replaces: false },
{ text: "line2 ✓\n", replaces: false },
]);
});
it.each([
// More was added than the 8 KiB tail holds.
[
"a tail that misses text",
[whole("a\n"), { output: "z\n", total_bytes: 9000, truncated: true }],
],
// Bytes that are not UTF-8 decode to other bytes.
[
"an output that is not UTF-8",
[whole("a\n"), { output: "a\nb\n", total_bytes: 3, truncated: false }],
],
])("sends %s as a snapshot", async (_case, reads) => {
follow(reads);
await vi.waitFor(() => expect(published).toHaveLength(2), { timeout: 3000 });
expect(published[1]).toEqual({ text: reads[1]!.output, replaces: true });
});
// Claude Code drops a foreground command's output when the command ends:
// CLI 2.1.325 then answers `total_bytes: 0` until the tool result comes.
it("stops at a read that holds less than was sent, without clearing the terminal", async () => {
const reads = follow([whole("line1\n"), whole("")]);
await vi.waitFor(() => expect(reads()).toBe(2), { timeout: 3000 });
await new Promise((resolve) => setTimeout(resolve, 700));
expect(reads()).toBe(2);
expect(published).toEqual([{ text: "line1\n", replaces: false }]);
expect(await poll!.finish()).toBe(true);
});
it("does not wait at finish for a read that Claude Code never answers", async () => {
const reads = follow([whole("line1\n"), "unanswered"]);
await vi.waitFor(() => expect(reads()).toBe(2), { timeout: 3000 });
expect(await poll!.finish()).toBe(true);
expect(published).toEqual([{ text: "line1\n", replaces: false }]);
});
it("appends from the end of a truncated tail that holds all the new text", async () => {
const tail = "x".repeat(8000);
follow([
{ output: tail, total_bytes: 9000, truncated: true },
{ output: tail.slice(3) + "end", total_bytes: 9003, truncated: true },
]);
await vi.waitFor(() => expect(published).toHaveLength(2), { timeout: 3000 });
expect(published[1]).toEqual({ text: "end", replaces: false });
});
it("holds a read that ends in a cut character until the character is whole", async () => {
const reads = follow([whole("a\uFFFD"), whole("a✓")]);
await vi.waitFor(() => expect(reads()).toBeGreaterThan(2), { timeout: 3000 });
expect(published).toEqual([{ text: "a✓", replaces: false }]);
});
it("reports that it sent nothing when no read added text, and reads nothing after finish", async () => {
const reads = follow([whole("")]);
expect(await poll!.finish()).toBe(false);
await new Promise((resolve) => setTimeout(resolve, 700));
expect(reads()).toBe(0);
});
});
describe("supportsTaskOutput", () => {
// The SDK's `Query` type does not declare `getTaskOutput`, so the compiler
// does not report an SDK update that drops it, and no poll would start.
it("finds getTaskOutput on a query of the installed SDK", () => {
// The CLI of this query exits at once: the check reads the query object only.
const sdkQuery = query({
prompt: "hi",
options: { pathToClaudeCodeExecutable: "/usr/bin/false" },
});
try {
expect(supportsTaskOutput(sdkQuery)).toBe(true);
} finally {
sdkQuery.close();
}
});
it("finds none on a query without the method", () => {
expect(supportsTaskOutput({ interrupt: async () => {} })).toBe(false);
});
});

View File

@@ -55,3 +55,50 @@ describe("claudeCliPath", () => {
expect(await claudeCliPath()).toMatch(/@anthropic-ai\/claude-agent-sdk-[^/]+\/claude(\.exe)?$/);
});
});
describe("cliDelivery", () => {
afterEach(() => vi.unstubAllEnvs());
it.each<{
name: string;
cli: string;
extraArgs?: Record<string, string>;
mcpServers: string;
settings: string;
}>([
{
name: "is stdin for the CLI that it ships",
cli: "",
mcpServers: "initialize",
settings: "initialize",
},
{
name: "is a flag for a CLAUDE_CODE_EXECUTABLE",
cli: "/opt/claude",
mcpServers: "argv",
settings: "argv",
},
{
name: "keeps settings a flag beside a client's",
cli: "",
extraArgs: { settings: "{}" },
mcpServers: "initialize",
settings: "argv",
},
{
name: "keeps settings a flag with sdk-url",
cli: "",
extraArgs: { "sdk-url": "wss://example.com/session" },
mcpServers: "initialize",
settings: "argv",
},
])("$name", async ({ cli, extraArgs, mcpServers, settings }) => {
vi.stubEnv("CLAUDE_CODE_EXECUTABLE", cli);
const { cliDelivery } = await load();
expect(cliDelivery(extraArgs)).toEqual({
mcpServersDelivery: mcpServers,
settingsDelivery: settings,
});
});
});

View File

@@ -320,17 +320,25 @@ describe("narrowToGatewayModels", () => {
expect(narrowed.map((m) => m.value)).toEqual(["sonnet", "sonnet[1m]"]);
});
it("leaves no model when the listing matches none", () => {
expect(narrowToGatewayModels(MODELS, ["gpt-5", "gemini-3-pro"])).toEqual([]);
expect(narrowToGatewayModels(MODELS, [])).toEqual([]);
expect(narrowToGatewayModels(MODELS, ["anthropic/openai/gpt-5"])).toEqual([]);
// A default row without resolvedModel is not a match on its own.
expect(
narrowToGatewayModels(
[{ value: "default", displayName: "Default", description: "" }, ...MODELS.slice(1)],
["gpt-5"],
),
).toEqual([]);
it.each([
{ listing: ["gpt-5", "gemini-3-pro"] },
{ listing: [] },
{ listing: ["anthropic/openai/gpt-5"] },
])("rejects a listing $listing that matches none of the resolved models", ({ listing }) => {
expect(() => narrowToGatewayModels(MODELS, listing)).toThrow(
"The selected provider offers no compatible Claude models. Choose a different provider and try again.",
);
});
it.each([
{ name: "empty", models: [] },
{ name: "alias-only", models: MODELS.map(({ resolvedModel: _, ...model }) => model) },
{
name: "mixed",
models: [{ value: "default", displayName: "Default", description: "" }, ...MODELS.slice(1)],
},
])("leaves no model when a $name catalog has no match", ({ models }) => {
expect(narrowToGatewayModels(models, ["gpt-5"])).toEqual([]);
});
});

View File

@@ -10,6 +10,7 @@ import {
type InitializeRequest,
} from "@agentclientprotocol/sdk/unstable";
import { mkdir, writeFile } from "node:fs/promises";
import { request } from "node:http";
import path from "node:path";
/** The context-usage report the base mock query returns: a 200K window, as
@@ -62,6 +63,19 @@ export function startupFailure(reason: string, cliMessage: string): Error {
});
}
/**
* The error `setModel()` rejects with when Claude Code refuses the switch, as
* SDK 0.3.325 builds it from the CLI's answer: `errorCode` is the answer's
* `error_code`, such as `not_found` for "Model 'gpt-4' not found".
*/
export function setModelRefusal(message: string, errorCode: string): Error {
return Object.assign(new Error(message), {
telemetryMessage: "Claude Code control request failed (set_model)",
errorClass: "control_request_failed",
errorCode,
});
}
/**
* Declares the client capabilities through `initialize`, as a real client
* does. The agent reads its capability choices only there.
@@ -155,3 +169,82 @@ export async function writeTranscript(
});
await writeFile(path.join(directory, `${sessionId}.jsonl`), lines.join("\n") + "\n");
}
/** The `_meta` of every MCP 2026-07-28 request of Claude Code 2.1.325, as its HTTP client sends it. */
const CLAUDE_CODE_MCP_META = {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": {
name: "claude-code",
title: "Claude Code",
version: "2.1.325",
description: "Anthropic's agentic coding tool",
websiteUrl: "https://claude.com/claude-code",
},
"io.modelcontextprotocol/clientCapabilities": {
roots: { listChanged: true },
elicitation: { form: {}, url: {} },
},
};
/**
* Sends the MCP request `method` to the HTTP server of an SDK config, as
* Claude Code 2.1.325 sends it: one JSON-RPC request in a POST, with the
* headers that mirror its version, method and tool name. A `tools/call` has
* the tool use id and a progress token in `_meta`. `headers` replace the
* config's own, which carry the server's bearer token.
*
* Resolves with the HTTP status and the JSON-RPC messages of the response:
* the one message of a JSON body, or every message of an event stream. It
* uses `node:http`: the test setup stubs the global `fetch`.
*/
export function claudeCodeMcpRequest(
config: { url: string; headers?: Record<string, string> },
method: string,
params: Record<string, unknown> = {},
headers: Record<string, string> | undefined = config.headers,
): Promise<{ status: number; messages: Array<Record<string, any>> }> {
const meta =
method === "tools/call"
? { ...CLAUDE_CODE_MCP_META, "claudecode/toolUseId": "toolu_01", progressToken: 1 }
: CLAUDE_CODE_MCP_META;
const body = JSON.stringify({
jsonrpc: "2.0",
id: 1,
method,
params: { ...params, _meta: meta },
});
return new Promise((resolve, reject) => {
const post = request(
config.url,
{
method: "POST",
headers: {
...headers,
accept: "application/json, text/event-stream",
"content-type": "application/json",
"content-length": Buffer.byteLength(body),
"mcp-protocol-version": "2026-07-28",
"mcp-method": method,
...(typeof params.name === "string" ? { "mcp-name": params.name } : {}),
},
},
(response) => {
const chunks: Buffer[] = [];
response.on("data", (chunk: Buffer) => chunks.push(chunk));
response.on("error", reject);
response.on("end", () => {
const text = Buffer.concat(chunks).toString("utf8");
const messages = response.headers["content-type"]?.startsWith("text/event-stream")
? text
.split("\n\n")
.flatMap((event) => event.split("\n").filter((line) => line.startsWith("data: ")))
.map((line) => JSON.parse(line.slice("data: ".length)))
: [JSON.parse(text)];
resolve({ status: response.statusCode ?? 0, messages });
});
},
);
post.on("error", reject);
post.end(body);
});
}

View File

@@ -0,0 +1,173 @@
import { afterEach, describe, expect, it } from "vitest";
import * as acp from "@agentclientprotocol/sdk/unstable";
import { McpOverAcp, sdkMcpServers } from "../mcp-servers.js";
import { claudeCodeMcpRequest } from "./helpers.js";
describe("sdkMcpServers", () => {
it("maps each transport to its SDK config, and leaves out an unknown one", async () => {
const overAcp = { type: "http" as const, url: "http://127.0.0.1:1/mcp-tools" };
const servers = [
{ name: "files", command: "/bin/files", args: ["--stdio"], env: [{ name: "A", value: "1" }] },
{
type: "http",
name: "linear",
url: "https://mcp.linear.app/mcp",
headers: [{ name: "Authorization", value: "Bearer token" }],
},
{ type: "sse", name: "events", url: "https://example.com/sse", headers: [] },
{ type: "acp", name: "tools", serverId: "tools:1" },
{ type: "_custom", name: "custom" },
] as acp.McpServer[];
const acpServers: acp.McpServerAcp[] = [];
const configs = await sdkMcpServers(servers, async (server) => {
acpServers.push(server);
return overAcp;
});
expect(configs).toEqual({
configs: {
files: { type: "stdio", command: "/bin/files", args: ["--stdio"], env: { A: "1" } },
linear: {
type: "http",
url: "https://mcp.linear.app/mcp",
headers: { Authorization: "Bearer token" },
},
events: { type: "sse", url: "https://example.com/sse", headers: {} },
tools: overAcp,
},
unserved: [],
});
expect(acpServers).toEqual([{ type: "acp", name: "tools", serverId: "tools:1" }]);
});
it("leaves out an acp server that gets no config, and keeps the others", async () => {
const servers = [
{ type: "acp", name: "tools", serverId: "tools:1" },
{ name: "files", command: "/bin/files", args: [], env: [] },
] as acp.McpServer[];
const served = await sdkMcpServers(servers, async () => {
throw new Error("listen EPERM");
});
expect(served).toEqual({
configs: { files: { type: "stdio", command: "/bin/files", args: [], env: {} } },
unserved: [{ name: "tools", status: "failed", error: "listen EPERM" }],
});
});
});
describe("McpOverAcp", () => {
const connections: Array<{ close(): void }> = [];
afterEach(() => {
for (const connection of connections.splice(0)) connection.close();
});
/** An agent connection that serves `mcp`, and a client that provides MCP servers over it. */
function connect() {
const mcp = new McpOverAcp();
const provider = new acp.McpOverAcpProvider();
const toAgent = new TransformStream<Uint8Array, Uint8Array>();
const toClient = new TransformStream<Uint8Array, Uint8Array>();
const agent = acp
.agent()
.onNotification(acp.methods.agent.mcp.message, mcp.handleNotification)
.connect(acp.ndJsonStream(toClient.writable, toAgent.readable));
const client = acp
.client()
.onRequest(acp.methods.client.mcp.message, provider.handleRequest)
.connect(acp.ndJsonStream(toAgent.writable, toClient.readable));
connections.push(agent, client);
/** Registers a server on the client, and returns its declaration. */
const serve = (name: string, handler: acp.McpRequestHandler) =>
provider.registerServer(client.agent, { name, handler }).declaration;
return { mcp, agent, serve };
}
it("sends a request of Claude Code to the client, and its progress and result back", async () => {
const { mcp, agent, serve } = connect();
const requests: acp.McpOperationContext[] = [];
const tools = serve("tools", async (request) => {
requests.push(request);
await request.notify("notifications/progress", { progressToken: 1, progress: 1, total: 2 });
return { result: { resultType: "complete", content: [{ type: "text", text: "hello" }] } };
});
const config = await mcp.sdkConfig(agent.client, tools);
const call = { name: "echo", arguments: { message: "hello" } };
const response = await claudeCodeMcpRequest(config, "tools/call", call);
expect(config).toEqual({
type: "http",
url: expect.stringMatching(/^http:\/\/127\.0\.0\.1:\d+\//),
headers: { Authorization: expect.stringMatching(/^Bearer \S+$/) },
});
expect(requests).toMatchObject([
{ serverId: tools.serverId, method: "tools/call", params: call },
]);
expect(response.messages).toEqual([
{
jsonrpc: "2.0",
method: "notifications/progress",
params: { progressToken: 1, progress: 1, total: 2 },
},
{
jsonrpc: "2.0",
id: 1,
result: { resultType: "complete", content: [{ type: "text", text: "hello" }] },
},
]);
});
it("gives a server one config on one listener for as long as the connection lives", async () => {
const { mcp, agent, serve } = connect();
const tools = serve("tools", () => ({ result: {} }));
const docs = serve("docs", () => ({ result: {} }));
const config = await mcp.sdkConfig(agent.client, tools);
const other = await mcp.sdkConfig(agent.client, docs);
expect(await mcp.sdkConfig(agent.client, tools)).toEqual(config);
expect(new URL(other.url).origin).toBe(new URL(config.url).origin);
expect(other.url).not.toBe(config.url);
agent.close();
await agent.closed;
await expect(claudeCodeMcpRequest(config, "tools/list")).rejects.toThrow();
await expect(mcp.sdkConfig(agent.client, tools)).rejects.toThrow(
"The adapter could not open the local endpoint that serves it to Claude Code " +
"(ACP connection is closed). A new session tries again.",
);
});
it.each([
{
refused: "a request with the token of another server",
method: "tools/list",
token: "other" as const,
status: 401,
},
{ refused: "an initialize request", method: "initialize", token: "own" as const, status: 404 },
])("refuses $refused", async ({ method, token, status }) => {
const { mcp, agent, serve } = connect();
const requests: string[] = [];
const record = (request: acp.McpOperationContext) => {
requests.push(request.method);
return { result: {} };
};
const config = await mcp.sdkConfig(agent.client, serve("tools", record));
const other = await mcp.sdkConfig(agent.client, serve("docs", record));
const response = await claudeCodeMcpRequest(
config,
method,
{},
token === "own" ? config.headers : other.headers,
);
expect(response.status).toBe(status);
expect(requests).toEqual([]);
});
});

View File

@@ -178,6 +178,27 @@ describe("resolveModelPreference - resolvedModel matching", () => {
// Bare preferences still land on the bare row via the substring tier.
expect(resolveModelPreference(models, "claude-sonnet-5")?.value).toBe("sonnet");
});
// An `availableModels` allowlist of dated and versioned ids, oldest first,
// as `applyAvailableModelsAllowlist` gives it with `settings.model: "opus[1m]"`.
// `my-opus` has no version, so it ranks below each versioned row.
const VERSIONED_MODELS: ModelInfo[] = [
"my-opus",
"claude-sonnet-4-5-20250929",
"claude-opus-4-5-20251101",
"claude-opus-4-8",
"claude-opus-5",
"claude-opus-5-5",
"claude-sonnet-5",
].map((value) => ({ value, resolvedModel: value, displayName: value, description: "" }));
it.each([
["opus[1m]", "claude-opus-5-5"],
["opus", "claude-opus-5-5"],
["sonnet", "claude-sonnet-5"],
])("resolves %s to the newest listed row of its family, %s", (preference, value) => {
expect(resolveModelPreference(VERSIONED_MODELS, preference)?.value).toBe(value);
});
});
describe("matchResumedModel", () => {

View File

@@ -963,10 +963,11 @@ describe("NativeSubagentRuntime in the RFD form", () => {
update.sessionUpdate === "config_option_update" ? [update.configOptions] : [],
);
expect(configs).toHaveLength(4);
// The effort and the mode came first: a child's list has the root's order.
expect(configs.at(-1)?.map((option) => [option.id, option.currentValue])).toEqual([
["mode", "plan"],
["model", "fallback-model"],
["effort", "low"],
["mode", "plan"],
]);
expect(
configs.at(-1)?.every((option) => option.type === "select" && option.options.length === 1),
@@ -2214,6 +2215,7 @@ describe("NativeSubagentRuntime in the RFD form", () => {
const { runtime, published } = await runningWorker();
const stop = vi.fn(async (_taskId: string) => {});
expect(runtime.hasChild("worker-1")).toBe(true);
await expect(runtime.cancelChild("worker-1", stop)).resolves.toBe(true);
expect(stop).toHaveBeenCalledExactlyOnceWith("worker-1");
@@ -2240,6 +2242,9 @@ describe("NativeSubagentRuntime in the RFD form", () => {
await expect(runtime.cancelChild("other-1", stop)).resolves.toBe(false);
await expect(air.cancelChild("child-1", stop)).resolves.toBe(false);
expect(stop).not.toHaveBeenCalled();
// AIR's draft keeps its own rules for a request that names a child.
expect(["root", "other-1"].map((id) => runtime.hasChild(id))).toEqual([false, false]);
expect(air.hasChild("child-1")).toBe(false);
});
});

View File

@@ -26,6 +26,7 @@ describe("Claude permission response effects", () => {
durableChangeSet,
allowPersistentOptions,
availableModes,
showClearContextOnPlanAccept: true,
});
it.each([

View File

@@ -30,6 +30,7 @@ describe("Claude permission options and response mapping", () => {
availableModes,
contextUsedPercent,
prePlanMode,
showClearContextOnPlanAccept: true,
});
it("leads with the reject options when the CLI defaults the ask to no", () => {
@@ -589,6 +590,26 @@ describe("Claude permission options and response mapping", () => {
},
);
it.each([undefined, false])(
"does not offer clear-context ExitPlanMode when showClearContextOnPlanAccept is %s",
(showClearContextOnPlanAccept) => {
const optionIds = buildClaudePermissionOptions({
toolName: "ExitPlanMode",
input: { plan: "Implement it" },
cwd: "/workspace",
availableModes: ["auto", "bypassPermissions", "acceptEdits"],
contextUsedPercent: 73,
showClearContextOnPlanAccept,
}).map((option) => option.optionId);
expect(optionIds).toEqual([
PERMISSION_OPTION_ID.exitPlanDefault,
PERMISSION_OPTION_ID.exitPlanAuto,
PERMISSION_OPTION_ID.exitPlanBypass,
PERMISSION_OPTION_ID.reject,
]);
},
);
it("does not offer clear-context ExitPlanMode without a plan", () => {
expect(
build("ExitPlanMode", undefined, {}, undefined, true, ["auto"], 73).map(

View File

@@ -1,9 +1,10 @@
import { describe, expect, it } from "vitest";
import type { ClientCapabilities } from "@agentclientprotocol/sdk/unstable";
import type { ClientCapabilities, SessionConfigOption } from "@agentclientprotocol/sdk/unstable";
import type { ModelInfo } from "@anthropic-ai/claude-agent-sdk";
import {
buildConfigOptions,
clientSupportsRecommendedConfigValue,
orderedConfigOptions,
} from "../session-config-options.js";
import { AIR_RECOMMENDED_CONFIG_VALUE_CAPABILITY } from "../air-extension.js";
@@ -283,3 +284,51 @@ describe("buildConfigOptions recommended values presentation", () => {
});
});
});
describe("config option order", () => {
const TOGGLE = { supported: true, enabled: false, useBooleanOption: true };
/** The options of a root session that has all six. */
const allSix = () =>
buildConfigOptions(
MODES,
MODELS,
MODEL_INFOS,
undefined,
[{ name: "reviewer", description: "Reviews code" }],
"default",
TOGGLE,
undefined,
TOGGLE,
);
it("builds a root session's options as model, effort, Fast mode, ultracode, mode, agent", () => {
expect(allSix().map((option) => option.id)).toEqual([
"model",
"effort",
"fast",
"ultracode",
"mode",
"agent",
]);
});
it("orders options by id, and puts other ids last in the order they came", () => {
const other = (id: string): SessionConfigOption => ({
id,
name: id,
type: "boolean",
currentValue: false,
});
const options = [other("zeta"), ...allSix().reverse(), other("alpha")];
expect(orderedConfigOptions(options).map((option) => option.id)).toEqual([
"model",
"effort",
"fast",
"ultracode",
"mode",
"agent",
"zeta",
"alpha",
]);
});
});

View File

@@ -0,0 +1,98 @@
import { describe, expect, it } from "vitest";
import { UnansweredServerToolCalls } from "../tool-calls/server-tool-calls.js";
const text = { type: "text", text: "Next." };
const advisorCall = (id: string) => ({ type: "server_tool_use", id, name: "advisor", input: {} });
const advisorResult = (id: string) => ({
type: "advisor_tool_result",
tool_use_id: id,
content: { type: "advisor_result", text: "Check the edge case." },
});
const bashCall = (id: string) => ({ type: "tool_use", id, name: "Bash", input: {} });
describe("UnansweredServerToolCalls", () => {
it("never ends a call that its own reply answers", () => {
const calls = new UnansweredServerToolCalls();
calls.replyStarted(null, "msg_1");
expect(calls.observe(null, advisorCall("srvtoolu_1"))).toEqual([]);
expect(calls.observe(null, advisorResult("srvtoolu_1"))).toEqual([]);
expect(calls.observe(null, text)).toEqual([]);
calls.replyStarted(null, "msg_2");
expect(calls.observe(null, text)).toEqual([]);
});
it("waits for the next reply to start with the result of a call its reply left pending", () => {
const calls = new UnansweredServerToolCalls();
calls.replyStarted(null, "msg_1");
calls.observe(null, bashCall("toolu_1"));
calls.observe(null, advisorCall("srvtoolu_1"));
calls.replyStarted(null, "msg_2");
expect(calls.observe(null, advisorResult("srvtoolu_1"))).toEqual([]);
expect(calls.observe(null, text)).toEqual([]);
});
it("ends a call still waiting once a later reply starts any other block, and only once", () => {
const calls = new UnansweredServerToolCalls();
calls.replyStarted(null, "msg_cut_off");
calls.observe(null, advisorCall("srvtoolu_1"));
calls.replyStarted(null, "msg_asked_again");
expect(calls.observe(null, { type: "thinking", thinking: "" })).toEqual(["srvtoolu_1"]);
expect(calls.observe(null, text)).toEqual([]);
});
it("ends the earlier call at a later reply's own server tool use, which then waits in turn", () => {
const calls = new UnansweredServerToolCalls();
calls.replyStarted(null, "msg_cut_off");
calls.observe(null, advisorCall("srvtoolu_1"));
calls.replyStarted(null, "msg_asked_again");
expect(calls.observe(null, advisorCall("srvtoolu_2"))).toEqual(["srvtoolu_1"]);
expect(calls.observe(null, text)).toEqual([]);
calls.replyStarted(null, "msg_3");
expect(calls.observe(null, text)).toEqual(["srvtoolu_2"]);
});
it("takes a consolidated message's blocks as its own reply's, by the id it carries", () => {
const calls = new UnansweredServerToolCalls();
calls.replyStarted(null, "msg_1");
calls.observe(null, advisorCall("srvtoolu_1"));
expect(calls.observe(null, advisorCall("srvtoolu_1"), "msg_1")).toEqual([]);
expect(calls.observe(null, text, "msg_1")).toEqual([]);
expect(calls.observe(null, text, "msg_2")).toEqual(["srvtoolu_1"]);
});
it("follows calls of a reply that was not streamed, by its consolidated messages", () => {
const calls = new UnansweredServerToolCalls();
expect(calls.observe(null, advisorCall("srvtoolu_1"), "msg_1")).toEqual([]);
expect(calls.observe(null, text, "msg_2")).toEqual(["srvtoolu_1"]);
});
it("keeps each conversation's calls to that conversation", () => {
const calls = new UnansweredServerToolCalls();
calls.replyStarted(null, "msg_main");
calls.observe(null, advisorCall("srvtoolu_main"));
calls.replyStarted("toolu_agent", "msg_sub_1");
calls.observe("toolu_agent", advisorCall("srvtoolu_sub"));
calls.replyStarted("toolu_agent", "msg_sub_2");
expect(calls.observe("toolu_agent", text)).toEqual(["srvtoolu_sub"]);
calls.replyStarted(null, "msg_main_2");
expect(calls.observe(null, text)).toEqual(["srvtoolu_main"]);
});
it("does not follow the calls of a reply of unknown id", () => {
const calls = new UnansweredServerToolCalls();
calls.replyStarted(null, undefined);
calls.observe(null, advisorCall("srvtoolu_1"));
expect(calls.observe(null, text)).toEqual([]);
calls.replyStarted(null, "msg_2");
expect(calls.observe(null, text)).toEqual([]);
});
it("forgets the calls of a subagent that ended", () => {
const calls = new UnansweredServerToolCalls();
calls.replyStarted("toolu_agent", "msg_sub_1");
calls.observe("toolu_agent", advisorCall("srvtoolu_sub"));
calls.forget("toolu_agent");
calls.replyStarted("toolu_agent", "msg_sub_2");
expect(calls.observe("toolu_agent", text)).toEqual([]);
});
});

View File

@@ -97,3 +97,32 @@ describe("SettingsManager.getCompactionSettings", () => {
manager.dispose();
});
});
describe("SettingsManager.getShowClearContextOnPlanAccept", () => {
it("ranks managed settings over the --settings override over the files, and is off by default", async () => {
const managed = await managerResolving({
effective: { showClearContextOnPlanAccept: false },
provenance: {},
sources: [{ source: "managed", settings: { showClearContextOnPlanAccept: false } }],
});
expect(managed.getShowClearContextOnPlanAccept({ showClearContextOnPlanAccept: true })).toBe(
false,
);
managed.dispose();
const files = await managerResolving({
effective: { showClearContextOnPlanAccept: true },
provenance: {},
sources: [{ source: "userSettings", settings: { showClearContextOnPlanAccept: true } }],
});
expect(files.getShowClearContextOnPlanAccept({ showClearContextOnPlanAccept: false })).toBe(
false,
);
expect(files.getShowClearContextOnPlanAccept()).toBe(true);
files.dispose();
const unset = await managerResolving({ effective: {}, provenance: {}, sources: [] });
expect(unset.getShowClearContextOnPlanAccept()).toBe(false);
unset.dispose();
});
});

View File

@@ -3,14 +3,12 @@ import { beforeEach, vi } from "vitest";
// `providers/set` lists the gateway's models with `fetch` (gateway-models.ts),
// and a failed listing fails the call. Tests that set an `anthropic` or
// `bedrock` provider would otherwise send that request to their example
// gateway URLs, so every test gets an empty listing instead. An empty listing
// narrows the picker to no model: a test that checks the picker after
// `providers/set` stubs `fetch` with the models it expects. This default is
// deliberate: listing fixture models for every test would hide which tests
// depend on a listing.
// gateway URLs, so every test gets a 404 instead. That means the gateway has
// no listing and leaves the SDK catalog unchanged. Tests of model discovery
// supply their own listing, including authoritative empty results.
beforeEach(() => {
vi.stubGlobal(
"fetch",
vi.fn(async () => new Response(JSON.stringify({ data: [], modelSummaries: [] }))),
vi.fn(async () => new Response("No model listing", { status: 404 })),
);
});

View File

@@ -2498,6 +2498,25 @@ describe("toolInfoFromToolUse - Write input aliases", () => {
});
});
// The input is what the model wrote. Claude Code rejects a field of the wrong
// type when it runs the tool, after the adapter reported the tool use.
describe("toolInfoFromToolUse - an input field of the wrong type", () => {
it.each([
["Read", { file_path: 12345 }, "Read File", toolInfoFromToolUse],
["Edit", { file_path: 12345, old_string: "a", new_string: "b" }, "Edit", toolInfoFromToolUse],
// Only an AIR client gets the notebook's path.
["NotebookEdit", { notebook_path: 12345, new_source: "x" }, "Edit notebook", airToolInfo],
["Glob", { path: 12345, pattern: "*.ts" }, "Find `*.ts`", toolInfoFromToolUse],
["Bash", { command: 12345 }, "Terminal", toolInfoFromToolUse],
])("reports %s %j as %j, without a location or a diff", (name, input, title, toolInfo) => {
const info = toolInfo({ name, id: "toolu_wrong_type", input }, false, "/repo");
expect(info.title).toBe(title);
expect(info.locations ?? []).toEqual([]);
expect(info.content).not.toContainEqual(expect.objectContaining({ type: "diff" }));
});
});
describe("toolInfoFromToolUse - undefined input regression", () => {
it("Read with undefined input should not throw", () => {
const toolUse = { name: "Read", id: "toolu_read_undef", input: undefined };

View File

@@ -46,6 +46,7 @@ import {
stripLocalCommandMetadata,
} from "../../message-filters.js";
import type { AcpClient } from "../../acp-client.js";
import type { UnservedMcpServer } from "../../mcp-servers.js";
import type { SDKMessageFilter } from "../../new-session-meta.js";
import { SessionTitles } from "../../session-titles.js";
import { SessionBackgroundWork } from "../../v1/background-work.js";
@@ -5379,6 +5380,7 @@ describe("permission request cancellation", () => {
settingsManager: {
dispose: vi.fn(),
getApiKeyHelper: () => undefined,
getShowClearContextOnPlanAccept: () => false,
getCwd: () => "/test",
} as any,
accumulatedUsage: {
@@ -6020,6 +6022,7 @@ describe("permission request cancellation", () => {
} as unknown as AcpClient;
const agent = new ClaudeAcpAgent(mockClient, { log: () => {}, error: () => {} });
const session = injectSession(agent, "session-1");
session.settingsManager.getShowClearContextOnPlanAccept = () => true;
session.modes.availableModes = [
{ id: "default", name: "Manual" },
{ id: "acceptEdits", name: "Accept edits" },
@@ -8302,6 +8305,71 @@ describe("subagent permission attribution (issue #851)", () => {
});
});
describe("any other request that names a child session", () => {
const sessionId = "agent-42";
const setup = { sessionId, cwd: "/test", mcpServers: [] };
it.each<[string, Record<string, unknown>]>([
[methods.agent.session.load, setup],
[methods.agent.session.resume, setup],
[methods.agent.session.fork, setup],
[methods.agent.session.close, { sessionId }],
[methods.agent.session.delete, { sessionId }],
[methods.agent.session.setTitle, { sessionId, title: "Scout" }],
[methods.agent.session.status, { sessionId }],
[methods.agent.session.options, { sessionId, cwd: "/test" }],
[methods.agent.session.setMode, { sessionId, modeId: "default" }],
[methods.agent.session.setConfigOption, { sessionId, configId: "mode", value: "default" }],
[methods.agent.session.prompt, { sessionId, prompt: [{ type: "text", text: "hi" }] }],
])("rejects %s with invalid params", async (method, params) => {
const toAgent = new TransformStream<AnyMessage, AnyMessage>();
const toClient = new TransformStream<AnyMessage, AnyMessage>();
const logger = { log: () => {}, error: () => {} };
let agent!: ClaudeAcpAgent;
acpProtocolRouter(logger, (created) => (agent = created), "v1").connect({
readable: toAgent.readable,
writable: toClient.writable,
});
await acpClient({ name: "test-client" }).connectWith(
{ readable: toClient.readable, writable: toAgent.writable },
async (client) => {
await client.request(methods.agent.initialize, {
protocolVersion: 1,
clientCapabilities: { subagents: {} },
});
injectGeneratorSession(agent, async function* () {} as never);
const session = agent.sessions["test-session"]!;
session.nativeSubagentsByTaskId = new Map([
[
sessionId,
{
sessionId,
parentSessionId: "test-session",
name: "Explore",
task: "Go",
announced: true,
},
],
]);
session.nativeSubagentRuntime = new NativeSubagentRuntime(
"rfd",
"test-session",
session,
async () => {},
logger,
);
await expect(client.request(method as never, params as never)).rejects.toMatchObject({
code: -32602,
data: { sessionId },
message: expect.stringContaining("agent-42 is a subagent session"),
});
},
);
});
});
describe("session/cancel on the parent session", () => {
/**
* Runs a turn that starts a background workflow, a background command
@@ -8987,7 +9055,7 @@ describe("subagent permission attribution (issue #851)", () => {
}
});
it("closes a background child's tool call in its session when the SDK reports the stop after the cancelled response", async () => {
it("closes a background child's tool call in its session when the SDK reports the stop after the prompt response", async () => {
const log: string[] = [];
const updates: AcpSessionNotification[] = [];
const logError = vi.fn();
@@ -9048,9 +9116,9 @@ describe("subagent permission attribution (issue #851)", () => {
...rootToolUse("toolu_child", "Bash", { command: "make" }),
parent_tool_use_id: "toolu_agent",
};
// The turn's result comes while the subagent runs, so v1 holds the turn
// for it. The cancel settles the held turn, which leaves the subagent's
// command open, since the subagent runs.
// The turn's result comes while the subagent runs. The client declares
// `subagents`, so the turn ends at it, and the cancel comes while no
// prompt runs. The subagent's command stays open, since the subagent runs.
yield successResult();
await agent.cancel({ sessionId: "test-session" });
await responded.promise;
@@ -9087,14 +9155,14 @@ describe("subagent permission attribution (issue #851)", () => {
responded.resolve();
return response;
}),
).resolves.toMatchObject({ stopReason: "cancelled" });
).resolves.toMatchObject({ stopReason: "end_turn" });
await agent.sessions["test-session"]?.consumer;
// The command ends in the child's session, after the child reported idle.
// The background launch's own result is not shown in the parent.
expect(log).toEqual([
'agent-42 {"state":"running"}',
"prompt cancelled",
"prompt end_turn",
'agent-42 {"state":"idle","stopReason":"cancelled"}',
"tool @agent-42 toolu_child failed",
]);
@@ -14128,7 +14196,10 @@ describe("model refusal fallback handling", () => {
});
describe("MCP server startup failures", () => {
function setup(mcpServersStatus: { name: string; status: string; source?: string }[]) {
function setup(
mcpServersStatus: { name: string; status: string; source?: string }[],
unservedMcpServers?: UnservedMcpServer[],
) {
const sessionUpdate = vi.fn(async () => {});
const agent = new ClaudeAcpAgent({ sessionUpdate } as unknown as AcpClient, {
log: () => {},
@@ -14186,6 +14257,7 @@ describe("MCP server startup failures", () => {
{ name: "client-api", type: "http", url: "https://example.com/mcp", headers: [] },
],
},
unservedMcpServers,
});
const updates = () =>
sessionUpdate.mock.calls.map((c: any[]) => (c[0] as { update: any }).update);
@@ -14215,6 +14287,29 @@ describe("MCP server startup failures", () => {
]);
});
it("sends one notice, with the error, for a server the query started without", async () => {
// Claude Code was not given the server, so its init does not list it.
const { agent, updates } = setup(
[{ name: "client-api", status: "connected", source: "dynamic" }],
[{ name: "client-acp", status: "failed", error: "listen EPERM" }],
);
await agent.initialize({
protocolVersion: 1,
clientCapabilities: { session: { notices: {} } },
});
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "hi" }] });
expect(updates().filter((u) => u.sessionUpdate === "notice")).toEqual([
{
sessionUpdate: "notice",
severity: "warning",
title: 'MCP server "client-acp" failed to start',
description: "Its tools are unavailable in this session. listen EPERM",
},
]);
});
it("reports a needs-auth server only when the client can't run OAuth", async () => {
const withoutUrlElicitation = setup([{ name: "client-api", status: "needs-auth" }]);
await withoutUrlElicitation.agent.initialize({
@@ -15020,8 +15115,9 @@ describe("session/fork", () => {
const modes = { currentModeId: "plan", availableModes: [] };
/** An agent whose sessions start without Claude Code: each one gets a
* scripted query that runs `turn` for every prompt. */
function forkingAgent(turn: (prompt: any) => any[] = () => []) {
* scripted query that runs `turn` for every prompt, after it sent `backlog`
* with no prompt open. */
function forkingAgent(turn: (prompt: any) => any[] = () => [], backlog: any[] = []) {
const updates: SessionNotification[] = [];
const agent = new ClaudeAcpAgent(
{ sessionUpdate: async (n: SessionNotification) => updates.push(n) } as unknown as AcpClient,
@@ -15035,6 +15131,7 @@ describe("session/fork", () => {
const sessionId = options.resume as string;
const input = new Pushable<any>();
async function* answer() {
yield* backlog;
for await (const prompt of input) yield* turn(prompt);
}
agent.sessions[sessionId] = mockSessionState(
@@ -15115,6 +15212,57 @@ describe("session/fork", () => {
expect(agent.sessions["fork-id"]).toBe(forked);
});
// After a bridge restart, Claude Code runs a cron cycle and a background
// task's follow-up before the first prompt. Nothing read the stream until
// then, and the prompt took the cron cycle's result as its own.
it.each(["resumeSession", "loadSession"] as const)(
"reads what Claude Code sends before the first prompt after %s (#1621)",
async (method) => {
const state = (state: "running" | "idle") => ({
type: "system",
subtype: "session_state_changed",
state,
uuid: randomUUID(),
session_id: "resumed-id",
});
const usage = (input: number, output: number) => ({
input_tokens: input,
output_tokens: output,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
});
const { agent } = forkingAgent(
(prompt) => [
userEcho(prompt),
state("running"),
successfulResultMessage({ usage: usage(7, 3) }),
state("idle"),
],
[
// A cron prompt: its result has no origin.
state("running"),
successfulResultMessage({ usage: usage(111, 11) }),
state("idle"),
state("running"),
successfulResultMessage({ origin: { kind: "task-notification" }, usage: usage(222, 22) }),
state("idle"),
],
);
// Only a load replays the transcript.
if (method === "loadSession") vi.mocked(getSessionMessages).mockResolvedValueOnce([]);
await agent[method]({ sessionId: "resumed-id", cwd: "/workspace", mcpServers: [] });
// The reader starts after the response.
await vi.waitFor(() => expect(agent.sessions["resumed-id"].lastSessionState).toBe("idle"));
const response = await agent.prompt({
sessionId: "resumed-id",
prompt: [{ type: "text", text: "go on" }],
});
expect(response.usage).toMatchObject({ inputTokens: 7, outputTokens: 3 });
},
);
it("fails when the forked session cannot start", async () => {
const { agent, createSession } = forkingAgent();
createSession.mockRejectedValueOnce(new Error("Claude Code did not start"));
@@ -15448,6 +15596,7 @@ describe("session/close", () => {
settingsManager: {
dispose: vi.fn(),
getApiKeyHelper: () => undefined,
getShowClearContextOnPlanAccept: () => false,
getCwd: () => "/test",
} as any,
accumulatedUsage: {
@@ -15572,6 +15721,7 @@ describe("session/delete", () => {
settingsManager: {
dispose: vi.fn(),
getApiKeyHelper: () => undefined,
getShowClearContextOnPlanAccept: () => false,
getCwd: () => "/test",
} as any,
accumulatedUsage: {
@@ -15737,6 +15887,7 @@ describe("getOrCreateSession param change detection", () => {
settingsManager: {
dispose: vi.fn(),
getApiKeyHelper: () => undefined,
getShowClearContextOnPlanAccept: () => false,
getCwd: () => "/test",
} as any,
accumulatedUsage: {
@@ -20099,6 +20250,7 @@ describe("post-error recovery", () => {
settingsManager: {
dispose: vi.fn(),
getApiKeyHelper: () => undefined,
getShowClearContextOnPlanAccept: () => false,
getCwd: () => "/test",
} as any,
accumulatedUsage: {
@@ -20475,6 +20627,7 @@ describe("post-error recovery", () => {
{
settingsManager: {
getApiKeyHelper: () => undefined,
getShowClearContextOnPlanAccept: () => false,
getCwd: () => "/test",
dispose: vi.fn(() => {
throw new Error("dispose boom");
@@ -23158,6 +23311,258 @@ describe("terminal of a command in the background", () => {
});
});
// A client that appends terminal chunks sees the output of a command in the
// foreground as it runs: Claude Code streams none, so the adapter reads the
// command's task with `get_task_output` from its `task_started` until the Bash
// result, whose output then replaces what the terminal showed.
describe("output of a command in the foreground", () => {
/** Claude Code's result for a command that an interrupt stopped (CLI 2.1.325, shortened). */
const STOP_NOTICE =
"The user doesn't want to proceed with this tool use. The tool use was rejected. " +
"Correction to the text above: this call was stopped while running, not refused before it ran.";
/**
* A turn that runs `make test` in the foreground until `done` resolves. The
* command's tool result comes once `resulted` resolves too.
*
* With `cancelled`, a `session/cancel` (`cancel`) ends the turn at `done`.
* Claude Code's interrupt then stops the command, whose result is the
* `notice` for the model, stamped as not executed. A command that ended
* just before the interrupt has its `output` as its result instead.
*/
function foregroundCommand(
done: Promise<void>,
resulted: Promise<void>,
cancelled?: { cancel: () => Promise<void>; result: "notice" | "output" },
) {
return (input: Pushable<any>) =>
(async function* () {
const iter = input[Symbol.asyncIterator]();
yield userEcho((await iter.next()).value);
yield {
type: "assistant",
parent_tool_use_id: null,
uuid: randomUUID(),
session_id: "test-session",
message: {
id: "msg_fg",
role: "assistant",
model: "claude-sonnet-4-20250514",
content: [
{ type: "tool_use", id: "toolu_fg", name: "Bash", input: { command: "make test" } },
],
usage: {
input_tokens: 0,
output_tokens: 0,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
},
},
};
// What CLI 2.1.325 sends once the command has run for about 3 s.
yield {
type: "system",
subtype: "task_started",
task_id: "fg1",
task_type: "local_bash",
description: "make test",
tool_use_id: "toolu_fg",
is_backgrounded: false,
uuid: randomUUID(),
session_id: "test-session",
};
await done;
await cancelled?.cancel();
const stopped = cancelled?.result === "notice";
yield {
type: "system",
subtype: "task_notification",
task_id: "fg1",
tool_use_id: "toolu_fg",
status: stopped ? "stopped" : "completed",
output_file: "",
summary: "",
uuid: randomUUID(),
session_id: "test-session",
};
await resulted;
yield {
type: "user",
...(stopped
? {
message: {
role: "user",
content: [
{
type: "tool_result",
tool_use_id: "toolu_fg",
is_error: true,
content: STOP_NOTICE,
},
],
},
tool_use_result: "User rejected tool use",
tool_result_meta: [{ id: "toolu_fg", non_execution_kind: "user-rejected" }],
}
: {
message: {
role: "user",
content: [
{ type: "tool_result", tool_use_id: "toolu_fg", content: "line1\nline2" },
],
},
tool_use_result: {
stdout: "line1\nline2",
stderr: "",
interrupted: false,
isImage: false,
},
}),
parent_tool_use_id: null,
uuid: randomUUID(),
session_id: "test-session",
};
yield cancelled
? { ...successfulResultMessage(), is_error: true, terminal_reason: "aborted_tools" }
: successfulResultMessage();
yield { type: "system", subtype: "session_state_changed", state: "idle" };
})();
}
/** The terminal output of each report about the Bash call. */
const outputs = (updates: SessionNotification[]) =>
updates.flatMap(({ update }): ({ delta: string } | { snapshot: string })[] => {
if (update.sessionUpdate !== "tool_call_update" || update.toolCallId !== "toolu_fg")
return [];
const meta = update._meta as Record<string, { data: string } | undefined> | undefined;
if (meta?.terminal_output_delta) return [{ delta: meta.terminal_output_delta.data }];
if (meta?.terminal_output) return [{ snapshot: meta.terminal_output.data }];
return [];
});
/**
* Starts the turn for a client with `capabilities`. The query answers
* `get_task_output` with what `written` returns. With `cancelledResult`, the
* client cancels the turn once `taskEnds` is called (see `foregroundCommand`).
*/
async function start(
capabilities: ClientCapabilities,
written: () => string,
cancelledResult?: "notice" | "output",
) {
const updates: SessionNotification[] = [];
const agent = new ClaudeAcpAgent(
{ sessionUpdate: async (n: SessionNotification) => void updates.push(n) } as AcpClient,
{ log: () => {}, error: () => {} },
);
await initializeClient(agent, capabilities);
const done = Promise.withResolvers<void>();
const resulted = Promise.withResolvers<void>();
injectGeneratorSession(
agent,
foregroundCommand(
done.promise,
resulted.promise,
cancelledResult && {
cancel: () => agent.cancel({ sessionId: "test-session" }),
result: cancelledResult,
},
),
);
const getTaskOutput = vi.fn(async (taskId: string) => {
expect(taskId).toBe("fg1");
const output = written();
return { output, total_bytes: Buffer.byteLength(output), truncated: false };
});
// Not in the SDK's `Query` type (see `supportsTaskOutput`).
Object.assign(agent.sessions["test-session"]!.query, { getTaskOutput });
const prompt = agent.prompt({
sessionId: "test-session",
prompt: [{ type: "text", text: "test it" }],
});
return {
updates,
getTaskOutput,
prompt,
taskEnds: done.resolve,
resultComes: resulted.resolve,
};
}
/** Runs the turn for a client with `capabilities`. The command prints
* `line1` and, once the client was sent it (or after 1.5 s), `line2`. */
async function run(capabilities: ClientCapabilities) {
let written = "line1\n";
const turn = await start(capabilities, () => written);
await vi
.waitFor(() => expect(outputs(turn.updates)).not.toEqual([]), { timeout: 1500 })
.catch(() => {});
written = "line1\nline2";
await new Promise((resolve) => setTimeout(resolve, 700));
// Claude Code drops the output of a command that ended (CLI 2.1.325).
written = "";
turn.taskEnds();
turn.resultComes();
await turn.prompt;
return { outputs: outputs(turn.updates), reads: turn.getTaskOutput.mock.calls.length };
}
it("appends the output while the command runs, then replaces it with the result's", async () => {
expect((await run({ _meta: { terminal_output_delta: true } })).outputs).toEqual([
{ delta: "line1\n" },
{ delta: "line2" },
{ snapshot: "line1\nline2" },
]);
});
it("sends a client that appends no chunks the output with the result, as before", async () => {
expect(await run({ _meta: { terminal_output: true } })).toEqual({
outputs: [{ snapshot: "line1\nline2" }],
reads: 0,
});
});
// The result of a command that a cancel stopped is Claude Code's notice for
// the model: it must not replace the output that the user was reading.
it.each([
{
result: "notice" as const,
name: "keeps what the terminal showed, and appends Claude Code's notice",
expected: [{ delta: "line1\n" }, { delta: STOP_NOTICE }],
},
{
result: "output" as const,
name: "replaces what the terminal showed with the output of a command that had ended",
expected: [{ delta: "line1\n" }, { snapshot: "line1\nline2" }],
},
])("at a cancel, $name", async ({ result, expected }) => {
const turn = await start({ _meta: { terminal_output_delta: true } }, () => "line1\n", result);
await vi.waitFor(() => expect(outputs(turn.updates)).toHaveLength(1), { timeout: 1500 });
turn.taskEnds();
turn.resultComes();
await expect(turn.prompt).resolves.toMatchObject({ stopReason: "cancelled" });
await vi.waitFor(() => expect(outputs(turn.updates)).toEqual(expected), { timeout: 1500 });
});
// A tool call that gets no result, such as one of a reply that Claude Code
// took back, must not be read until the query closes.
it("reads no more output once the command's task ended", async () => {
// The command prints nothing, so no read tells that it ended.
const turn = await start({ _meta: { terminal_output_delta: true } }, () => "");
await vi.waitFor(() => expect(turn.getTaskOutput).toHaveBeenCalled(), { timeout: 1500 });
turn.taskEnds();
// The task's end reaches the agent a few steps later.
await new Promise((resolve) => setTimeout(resolve, 100));
const reads = turn.getTaskOutput.mock.calls.length;
await new Promise((resolve) => setTimeout(resolve, 700));
expect(turn.getTaskOutput).toHaveBeenCalledTimes(reads);
turn.resultComes();
await turn.prompt;
});
});
describe("deferred settlement for live background subagents (issues #864/#866)", () => {
// A turn whose terminal result arrives while background subagents IT
// spawned are still live must NOT settle at that result: ACP allows
@@ -23170,18 +23575,23 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
// subagents are done — at the followup's terminal result, or at an idle
// with none of them left.
//
// The tests without `declareBackgroundSubagents` are the cases of a client
// that does not declare the AIR `backgroundSubagents` capability. Such a
// client keeps the hold.
// The tests without `declareNoHold` are the cases of a client that keeps
// the hold: it neither declares the AIR `backgroundSubagents` capability nor
// gets the RFD form of subagent sessions.
/** Declares the AIR `backgroundSubagents` capability: no turn is held. */
const declareBackgroundSubagents = (agent: ClaudeAcpAgent) =>
agent.initialize({
protocolVersion: 1,
clientCapabilities: {
_meta: { jetbrains: { air: { version: 1, capabilities: ["backgroundSubagents"] } } },
},
});
/** AIR's `backgroundSubagents` capability. */
const AIR_BACKGROUND_SUBAGENTS: ClientCapabilities = {
_meta: { jetbrains: { air: { version: 1, capabilities: ["backgroundSubagents"] } } },
};
/** The clients that get no hold, by what each declares in `initialize`. */
const NO_HOLD_CLIENTS: [string, ClientCapabilities][] = [
["backgroundSubagents", AIR_BACKGROUND_SUBAGENTS],
["the RFD form of subagent sessions", { subagents: {} } as ClientCapabilities],
];
/** Declares a client that gets no hold: no turn of it is held. */
const declareNoHold = (agent: ClaudeAcpAgent, clientCapabilities: ClientCapabilities) =>
agent.initialize({ protocolVersion: 1, clientCapabilities });
function createMockAgent() {
const mockClient = {
@@ -23588,7 +23998,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
expect(agent.sessions["test-session"].pendingExitPlanModeInterruption).toBeUndefined();
});
describe("with backgroundSubagents", () => {
describe.each(NO_HOLD_CLIENTS)("with %s", (_client, noHold) => {
it("asks out of the turn without a clear-context option and drops the interrupt", async () => {
let request: RequestPermissionRequest | undefined;
const agent = new ClaudeAcpAgent(
@@ -23628,7 +24038,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
}
return messageGenerator();
});
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
const session = agent.sessions["test-session"]!;
const first = await agent.prompt({
@@ -23699,7 +24109,9 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
}
return messageGenerator();
});
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
agent.sessions["test-session"]!.settingsManager.getShowClearContextOnPlanAccept = () =>
true;
const prompt = agent.prompt({
sessionId: "test-session",
@@ -23745,7 +24157,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
},
},
);
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
const session = agent.sessions["test-session"]!;
const response = await agent.prompt({
@@ -23813,7 +24225,9 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
}
return messageGenerator();
});
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
agent.sessions["test-session"]!.settingsManager.getShowClearContextOnPlanAccept = () =>
true;
const session = agent.sessions["test-session"]!;
const prompt = agent.prompt({
@@ -23865,7 +24279,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
}
return messageGenerator();
});
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
const session = agent.sessions["test-session"]!;
const first = await agent.prompt({
@@ -23984,7 +24398,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
},
},
);
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
const response = await agent.prompt({
sessionId: "test-session",
@@ -24291,7 +24705,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
* agent-1 completes and the model sends its followup. */
function run(
resume: unknown[],
options: { subagents?: boolean; backgroundSubagents?: boolean } = {},
options: { subagents?: boolean; noHold?: ClientCapabilities } = {},
) {
const updates: AcpSessionNotification[] = [];
const requests: RequestPermissionRequest[] = [];
@@ -24342,7 +24756,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
clientCapabilities: AIR_NATIVE_SUBAGENTS,
});
}
if (options.backgroundSubagents) await declareBackgroundSubagents(agent);
if (options.noHold) await declareNoHold(agent, options.noHold);
const first = await agent.prompt({
sessionId: "test-session",
prompt: [{ type: "text", text: "explore" }],
@@ -24352,8 +24766,8 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
sessionId: "test-session",
prompt: [{ type: "text", text: "continue" }],
});
// With `backgroundSubagents` the turn is never held.
if (!options.backgroundSubagents) {
// A turn of a client that gets no hold is never held.
if (!options.noHold) {
await waitFor(() => !!agent.sessions["test-session"]?.activeTurn?.deferredSettle);
}
// Wrapped: an async function would unwrap and wait for the held prompt.
@@ -24504,7 +24918,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
await agent.sessions["test-session"]?.consumer;
});
describe("with backgroundSubagents", () => {
describe.each(NO_HOLD_CLIENTS)("with %s", (_client, noHold) => {
const summaryChunks = (updates: AcpSessionNotification[]) =>
updates.filter(
(n) =>
@@ -24514,7 +24928,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
it("settles the SendMessage turn at its result while the resumed subagent runs", async () => {
const { agent, updates, release, notified, start } = run([sendMessageResult()], {
backgroundSubagents: true,
noHold,
});
const { second } = await start();
const session = agent.sessions["test-session"]!;
@@ -24534,7 +24948,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
it("sends a permission request of the resumed subagent after the prompt response", async () => {
const { agent, updates, requests, release, start } = run([sendMessageResult()], {
backgroundSubagents: true,
noHold,
});
const { second } = await start();
await expect(second).resolves.toMatchObject({ stopReason: "end_turn" });
@@ -24560,7 +24974,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
});
});
describe("with backgroundSubagents", () => {
describe.each(NO_HOLD_CLIENTS)("with %s", (_client, noHold) => {
/** Agent whose client records the chunk texts as `chunk:<text>`, keeps
* every update, and allows every permission request. */
const recordingAgent = () => {
@@ -24605,7 +25019,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
}
return messageGenerator();
});
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
const session = agent.sessions["test-session"]!;
const response = await agent.prompt({
@@ -24647,7 +25061,12 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
expect(session.owedTrailingIdles).toBe(0);
});
it("keeps the streamed tool input of a running subagent when the turn ends at its result", async () => {
it("keeps the streamed tool input of a running subagent when the turn ends at its result", async ({
skip,
}) => {
// AIR only: this fixture has no Agent call that the RFD form could
// expose the child from, so an RFD client gets none of its updates.
skip(noHold !== AIR_BACKGROUND_SUBAGENTS);
const { agent, updates } = recordingAgent();
let release!: () => void;
const gate = new Promise<void>((resolve) => (release = resolve));
@@ -24687,7 +25106,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
}
return messageGenerator();
});
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
const session = agent.sessions["test-session"]!;
const response = await agent.prompt({
@@ -24749,7 +25168,7 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
}
return messageGenerator();
});
await declareBackgroundSubagents(agent);
await declareNoHold(agent, noHold);
const session = agent.sessions["test-session"]!;
const first = await agent.prompt({
@@ -26220,6 +26639,38 @@ describe("deferred settlement for live background subagents (issues #864/#866)",
]);
});
// A scheduler fire is not an autonomous origin: its result has no
// `origin`, so it takes the user lane with no turn to claim it.
it("ends the task at the result of the cycle that a fire started (#1620)", async () => {
const { agent, asyncTaskUpdates } = await airAgent();
injectGeneratorSession(agent, (input) => {
async function* messageGenerator() {
const iter = input[Symbol.asyncIterator]();
yield userEcho((await iter.next()).value);
yield running();
yield assistantText("working");
yield resultMessage();
// The overdue ScheduleWakeup fires at once, before the prompt's idle.
yield lifecycleStarted({ wakeup_source: "loop_wakeup" });
yield assistantText("That wakeup was stale");
yield resultMessage();
// One idle covers both results.
yield idle();
}
return messageGenerator();
});
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "go" }] });
await agent.sessions["test-session"]?.consumer;
// The stream ending closes an open task as failed, so a task that only the
// end of the stream ended would not be completed.
expect(asyncTaskUpdates().map((update) => update.state ?? update.sessionUpdate)).toEqual([
"async_task_spawned",
"completed",
]);
});
it("leaves the task as before for a started frame without a known wakeup source", async () => {
const updates = await autonomousTurn((afterRunning) =>
afterRunning
@@ -28307,6 +28758,64 @@ describe("turn steering (_session/steering)", () => {
expect(agent.sessions["test-session"].owedTrailingIdles).toBe(0);
});
// The same guard when the autonomous cycle's result is stamped with the
// original prompt: answersPendingPrompt then routes it to the user lane, and
// its idle must still not settle the turn while the steered work runs.
it.each(["end_turn", "refusal"] as const)(
"does not settle a steered turn on an autonomous %s result naming the original prompt",
async (stopReason) => {
const timeline: string[] = [];
const agent = new ClaudeAcpAgent(timelineClient(timeline), {
log: () => {},
error: () => {},
});
injectGeneratorSession(agent, (input) => {
async function* messageGenerator() {
const iter = input[Symbol.asyncIterator]();
const u1 = await iter.next();
yield userEcho(u1.value);
yield createAssistantText("working on it");
const steered = await iter.next();
yield { ...interruptedCycleResult(), user_message_uuid: u1.value.uuid };
yield userEcho(steered.value);
// A background cycle's result, stamped with the original prompt only.
yield {
...createResultMessage(),
stop_reason: stopReason,
origin: { kind: "task-notification" },
user_message_uuid: u1.value.uuid,
user_message_uuids: [u1.value.uuid],
};
yield idleMessage(); // that cycle's trailer
yield createAssistantText("STEERED-OK");
yield createResultMessage();
yield idleMessage();
}
return messageGenerator();
});
const turn = agent
.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "start" }] })
.then((response) => {
timeline.push(`prompt:${response.stopReason}`);
return response;
});
await waitFor(() => !!agent.sessions["test-session"]?.activeTurn);
await agent.steer({
sessionId: "test-session",
prompt: [{ type: "text", text: "also handle X" }],
});
await turn;
await agent.sessions["test-session"]?.consumer;
// The turn keeps one stop reason across its cycles, so a refusal trailer's
// reason is reported; what matters here is that the prompt ends last.
expect(timeline).toEqual(["working on it", "STEERED-OK", `prompt:${stopReason}`]);
},
);
it("always injects at 'now' priority, ignoring any client-supplied priority", async () => {
const agent = createMockAgent();
const captured: any[] = [];
@@ -28405,6 +28914,7 @@ describe("session/cancel wedge recovery (issue #680)", () => {
settingsManager: {
dispose: vi.fn(),
getApiKeyHelper: () => undefined,
getShowClearContextOnPlanAccept: () => false,
getCwd: () => "/test",
} as any,
accumulatedUsage: {
@@ -30315,6 +30825,7 @@ describe("agent selection config option", () => {
settingsManager: {
dispose: vi.fn(),
getApiKeyHelper: () => undefined,
getShowClearContextOnPlanAccept: () => false,
getCwd: () => "/test",
} as any,
accumulatedUsage: {

View File

@@ -8,6 +8,8 @@ import { ClaudeAcpAgent } from "../../v1/acp-agent.js";
import { AcpClient } from "../../acp-client.js";
import {
billsClaudeSubscription,
holdsNonSubscriptionCredential,
isClaudeEnterprisePlan,
CLAUDE_LOGIN_REQUIRED_MESSAGE,
CLAUDE_SUBSCRIPTION_NOT_SUPPORTED_MESSAGE,
CLAUDE_SUBSCRIPTION_NOT_SUPPORTED_REASON,
@@ -372,6 +374,32 @@ describe("authorization", () => {
return { cwd: process.cwd(), mcpServers: [] };
}
describe("tokenSource", () => {
it.each([
[undefined, false],
["", false],
["none", false],
["ANTHROPIC_AUTH_TOKEN", true],
["CLAUDE_CODE_OAUTH_TOKEN", true],
["a-future-token-source", true],
] as const)("classifies tokenSource %s", (tokenSource, hasToken) => {
const account = { tokenSource, apiProvider: "firstParty" } satisfies AccountInfo;
expect(holdsNonSubscriptionCredential(account)).toBe(hasToken);
expect(billsClaudeSubscription({ ...account, subscriptionType: "pro" })).toBe(!hasToken);
});
it.each([
{ apiKeySource: "ANTHROPIC_API_KEY" },
{ apiKeySource: "apiKeyHelper" },
{ apiKeySource: "/login managed key" },
{ apiProvider: "bedrock" },
] as const)("preserves an accepted credential beside tokenSource none: %j", (credential) => {
const account = { tokenSource: "none", subscriptionType: "pro", ...credential };
expect(holdsNonSubscriptionCredential(account)).toBe(true);
expect(billsClaudeSubscription(account)).toBe(false);
});
});
describe("billsClaudeSubscription", () => {
/** Every member of the SDK's `ApiKeySource` enum, plus a value no
* current CLI emits: the field is an open `string`, so an unknown one
@@ -439,12 +467,40 @@ describe("authorization", () => {
});
});
describe("isClaudeEnterprisePlan", () => {
it.each([
["Claude Enterprise", true],
["enterprise", true],
[" claude ENTERPRISE ", true],
["Claude Team", false],
["Claude Max", false],
["pro", false],
// A custom `plan_display_name` does not say which plan it belongs to.
["Claude Enterprise Trial", false],
["Claude Acme Enterprise", false],
["", false],
[undefined, false],
])("classifies subscriptionType %j", (subscriptionType, expected) => {
expect(isClaudeEnterprisePlan(subscriptionType)).toBe(expected);
});
});
describe("fails closed at session creation", () => {
/** What the flag does with an account at session creation. */
type Verdict = "subscription" | "signedOut" | "allowed";
const CASES: Array<{ name: string; account: AccountInfo; verdict: Verdict }> = [
{ name: "a logged-out CLI", account: {}, verdict: "signedOut" },
{
name: "the SDK reporting no token",
account: { tokenSource: "none", apiProvider: "firstParty" },
verdict: "signedOut",
},
{
name: "a subscription with no token",
account: { tokenSource: "none", subscriptionType: "pro", apiProvider: "firstParty" },
verdict: "subscription",
},
{
name: "an account with no key in use",
account: { apiKeySource: "none" },
@@ -471,6 +527,16 @@ describe("authorization", () => {
account: { tokenSource: "ANTHROPIC_AUTH_TOKEN" },
verdict: "allowed",
},
{
name: "a Claude Enterprise plan",
account: { subscriptionType: "Claude Enterprise", apiProvider: "firstParty" },
verdict: "allowed",
},
{
name: "a Claude Team plan",
account: { subscriptionType: "Claude Team", apiProvider: "firstParty" },
verdict: "subscription",
},
{ name: "bedrock", account: { apiProvider: "bedrock" }, verdict: "allowed" },
{ name: "vertex", account: { apiProvider: "vertex" }, verdict: "allowed" },
];
@@ -753,15 +819,26 @@ describe("authorization", () => {
prompt: [{ type: "text" as const, text: "hello" }],
});
it("rejects a turn when the live account became a subscription", async () => {
it.each([
[{ subscriptionType: "pro", apiKeySource: "none" }, refusal],
[
{ tokenSource: "none", apiProvider: "firstParty" },
{
code: AUTH_REQUIRED_CODE,
message: `Authentication required: ${LOGIN_REQUIRED_MESSAGE}`,
data: undefined,
},
],
[{ tokenSource: "none", subscriptionType: "pro", apiProvider: "firstParty" }, refusal],
])("rejects a turn before insertion for account %j", async (account, expectedRefusal) => {
const [agent] = await createAgentMock();
hideClaudeAuth();
// Spawn-time account passes; the store changes underneath the session.
const accountInfo = vi.fn(async () => ({ subscriptionType: "pro", apiKeySource: "none" }));
// Start with a legal session, then exercise the per-turn policy independently.
const accountInfo = vi.fn(async () => account);
mockAccount(SIGNED_IN_WITH_KEY, { accountInfo });
const { sessionId } = await agent.newSession(newSessionParams());
await expect(agent.prompt(promptParams(sessionId))).rejects.toMatchObject(refusal);
await expect(agent.prompt(promptParams(sessionId))).rejects.toMatchObject(expectedRefusal);
expect(accountInfo).toHaveBeenCalledTimes(1);
// Refused before anything reached the SDK: no turn was queued.
expect(agent.sessions[sessionId].turnQueue ?? []).toHaveLength(0);
@@ -890,10 +967,13 @@ describe("authorization", () => {
expect(accountInfo).not.toHaveBeenCalled();
});
it("lets the turn through when the live account is not a subscription", async () => {
it.each([
["an API key", { apiKeySource: "ANTHROPIC_API_KEY" }],
["a Claude Enterprise plan", { subscriptionType: "Claude Enterprise" }],
])("lets the turn through when the live account is %s", async (_case, account) => {
const [agent] = await createAgentMock();
hideClaudeAuth();
const accountInfo = vi.fn(async () => ({ apiKeySource: "ANTHROPIC_API_KEY" }));
const accountInfo = vi.fn(async () => account);
mockAccount(SIGNED_IN_WITH_KEY, { accountInfo });
const { sessionId } = await agent.newSession(newSessionParams());

View File

@@ -1,21 +1,24 @@
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
import { describe, it, expect, beforeEach, afterEach, onTestFinished, vi } from "vitest";
import {
CreateElicitationRequest,
RequestError,
SessionNotification,
} from "@agentclientprotocol/sdk/unstable";
import type { ClientCapabilities } from "@agentclientprotocol/sdk/unstable";
import { getSessionMessages, type Options } from "@anthropic-ai/claude-agent-sdk";
import { forkSession, getSessionMessages, type Options } from "@anthropic-ai/claude-agent-sdk";
import type { ClaudeAcpAgent as ClaudeAcpAgentType } from "../../v1/acp-agent.js";
import type { AcpClient } from "../../acp-client.js";
import type { AcpSessionNotification } from "../../acp-subagents.js";
import { ALLOW_BYPASS } from "../../permissions/modes.js";
import { NativeSubagentRuntime } from "../../native-subagents.js";
import { startupFailure } from "../helpers.js";
import { setModelRefusal, startupFailure } from "../helpers.js";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
/** The session that the mocked SDK `forkSession` makes. */
const FORK_ID = "3d0f7a52-9b1e-4c7d-8e2a-6f4b5c1d0e9a";
let capturedOptions: Options | undefined;
let contextUsageResult: (() => Promise<{ rawMaxTokens: number; model?: string }>) | undefined;
let contextUsageCalls: Array<{ detail?: "summary" | "full" } | undefined> = [];
@@ -25,6 +28,8 @@ let initModels: Record<string, unknown>[] | undefined;
/** Holds the CLI initialization until the test resolves it. */
let initGate: Promise<void> | undefined;
let initError: Error | undefined;
/** When set, the SDK refuses the query's options with it: `query()` throws. */
let optionsRefusal: Error | undefined;
let setModelImpl: ((model: string) => Promise<void>) | undefined;
let interruptImpl: (() => Promise<undefined>) | undefined;
let closeSpy: ReturnType<typeof vi.fn<() => void>>;
@@ -42,10 +47,21 @@ vi.mock("@anthropic-ai/claude-agent-sdk", async () => {
return {
...actual,
query: (args: { prompt: unknown; options: Options }) => {
if (optionsRefusal) throw optionsRefusal;
capturedOptions = args.options;
// Like Claude Code's, the stream stays open until the query is closed.
let streamClosed = () => {};
const closed = new Promise<void>((resolve) => (streamClosed = resolve));
return makeMockQuery({
interrupt: () => (interruptImpl ? interruptImpl() : Promise.resolve(undefined)),
close: () => closeSpy(),
close: () => {
closeSpy();
streamClosed();
},
next: async () => {
await closed;
return { done: true as const, value: undefined };
},
initializationResult: async () => {
await initGate;
if (initError) throw initError;
@@ -61,6 +77,7 @@ vi.mock("@anthropic-ai/claude-agent-sdk", async () => {
});
},
getSessionMessages: vi.fn(() => sessionMessagesResult()),
forkSession: vi.fn(async () => ({ sessionId: FORK_ID })),
};
});
@@ -105,9 +122,11 @@ describe("createSession options merging", () => {
sessionMessages = [];
sessionMessagesResult = async () => sessionMessages;
vi.mocked(getSessionMessages).mockClear();
vi.mocked(forkSession).mockClear();
initModels = undefined;
initGate = undefined;
initError = undefined;
optionsRefusal = undefined;
setModelImpl = undefined;
interruptImpl = undefined;
closeSpy = vi.fn<() => void>();
@@ -280,9 +299,9 @@ describe("createSession options merging", () => {
.at(-1)
?.map((option) => [option.id, option.currentValue]),
).toEqual([
["mode", "plan"],
["model", "child-model"],
["effort", "low"],
["mode", "plan"],
["agent", "Explore"],
]);
expect(
@@ -581,23 +600,63 @@ describe("createSession options merging", () => {
expect(capturedOptions?.env?.HOME).toBe("/custom/home");
});
it("asks the SDK for a predicted follow-up prompt per turn", async () => {
await agent.newSession({
cwd: process.cwd(),
mcpServers: [],
describe("the predicted follow-up prompt", () => {
const AIR = { _meta: { jetbrains: { air: { version: 1, capabilities: [] } } } };
const ADVERTISED = { session: { promptSuggestions: {} } };
// Claude Code spends a request per turn on a prediction: only a client
// that gets the prediction has it on.
it.each<[string, ClientCapabilities, true | undefined]>([
["AIR", AIR as ClientCapabilities, true],
["a client that advertises session.promptSuggestions", ADVERTISED, true],
["no other client", {}, undefined],
])("asks the SDK for it for %s", async (_, clientCapabilities, asked) => {
await agent.initialize({ protocolVersion: 1, clientCapabilities });
await agent.newSession({ cwd: process.cwd(), mcpServers: [] });
expect(capturedOptions!.promptSuggestions).toBe(asked);
});
expect(capturedOptions!.promptSuggestions).toBe(true);
it("lets a caller turn it off", async () => {
await agent.initialize({ protocolVersion: 1, clientCapabilities: ADVERTISED });
await agent.newSession({
cwd: process.cwd(),
mcpServers: [],
_meta: { claudeCode: { options: { promptSuggestions: false } } },
});
expect(capturedOptions!.promptSuggestions).toBe(false);
});
});
it("lets a caller turn the predicted follow-up prompt off", async () => {
it.each([
{ name: "sends MCP servers as the CLI takes them", option: "mcpServersDelivery" },
{
name: "lets a caller choose the MCP delivery",
option: "mcpServersDelivery",
own: "initialize",
},
{ name: "sends settings as the CLI takes them", option: "settingsDelivery" },
{
name: "lets a caller choose settings delivery",
option: "settingsDelivery",
own: "initialize",
},
])("$name", async ({ option, own }) => {
// A CLI that CLAUDE_CODE_EXECUTABLE names gets both in flags.
// `vitest.config.ts` sets the variable for unit runs only.
vi.stubEnv("CLAUDE_CODE_EXECUTABLE", "/usr/bin/false");
onTestFinished(() => {
vi.unstubAllEnvs();
});
await agent.newSession({
cwd: process.cwd(),
mcpServers: [],
_meta: { claudeCode: { options: { promptSuggestions: false } } },
...(own && { _meta: { claudeCode: { options: { [option]: own } } } }),
});
expect(capturedOptions!.promptSuggestions).toBe(false);
expect((capturedOptions as Record<string, unknown>)[option]).toBe(own ?? "argv");
});
it("defaults tools to claude_code preset when not provided", async () => {
@@ -1242,6 +1301,32 @@ describe("createSession options merging", () => {
expect(capturedOptions!.mcpServers).toHaveProperty("acp-server");
});
it("starts the session without an acp server that gets no endpoint", async () => {
agent = new ClaudeAcpAgent(
{
...createMockClient(),
mcpServerOverAcp: async () => {
throw new Error("listen EPERM");
},
},
{ log: () => {}, error: () => {} },
);
const { sessionId } = await agent.newSession({
cwd: process.cwd(),
mcpServers: [
{ type: "acp", name: "tools", serverId: "tools:1" },
{ name: "files", command: "node", args: ["files.js"], env: [] },
],
});
expect(Object.keys(capturedOptions!.mcpServers ?? {})).toEqual(["files"]);
// What the first turn reports (see "MCP server startup failures").
expect(agent.sessions[sessionId].unservedMcpServers).toEqual([
{ name: "tools", status: "failed", error: "listen EPERM" },
]);
});
describe("thinking config from MAX_THINKING_TOKENS", () => {
let originalMaxThinking: string | undefined;
@@ -1422,6 +1507,16 @@ describe("createSession options merging", () => {
expect(options).toEqual(created);
});
it("lists the options of session/new as model, effort, mode", async () => {
const created = await agent.newSession({ cwd, mcpServers: [] });
// The client lists them in this order.
expect(created.configOptions?.map((option) => option.id)).toEqual([
"model",
"effort",
"mode",
]);
});
it("answers session/options of a held session with its current options, without a query", async () => {
const { sessionId } = await agent.newSession({ cwd, mcpServers: [] });
const { configOptions } = await agent.setSessionConfigOption({
@@ -1489,9 +1584,13 @@ describe("createSession options merging", () => {
it.each([
["an unknown configId", { configId: "nope", value: "x" }],
["a boolean for a select", { configId: "model", type: "boolean" as const, value: true }],
["a value the option does not offer", { configId: "model", value: "gpt-4" }],
["a model Claude Code does not know", { configId: "model", value: "gpt-4" }],
])("skips an entry with %s and sets the entries after it", async (_name, entry) => {
const plain = await agent.newSession({ cwd, mcpServers: [] });
// An id the option does not list goes to Claude Code, which refuses an unknown one.
setModelImpl = async (model) => {
throw setModelRefusal(`Model '${model}' not found`, "not_found");
};
const response = await agent.newSession({
cwd,
@@ -1525,7 +1624,7 @@ describe("createSession options merging", () => {
errors.mockRestore();
});
it.each(["newSession", "loadSession", "resumeSession"] as const)(
it.each(["newSession", "loadSession", "resumeSession", "unstable_forkSession"] as const)(
"%s rejects two entries of one configId before it starts a query",
async (method) => {
await expect(
@@ -1543,6 +1642,8 @@ describe("createSession options merging", () => {
data: { configId: "mode" },
});
expect(capturedOptions).toBeUndefined();
// A fork copies no transcript either.
expect(forkSession).not.toHaveBeenCalled();
},
);
@@ -1571,6 +1672,24 @@ describe("createSession options merging", () => {
},
);
it("sets the configOptions of a session/fork on the fork, without an update", async () => {
const response = await agent.unstable_forkSession({
sessionId: "7f1c5b0e-3c53-4c0c-9d0a-0d6c1f0a2b11",
cwd,
mcpServers: [],
configOptions: [
{ configId: "model", value: "claude-haiku-4-5" },
{ configId: "mode", value: "plan" },
],
});
expect(response.sessionId).toBe(FORK_ID);
expect(capturedOptions).toMatchObject({ resume: FORK_ID });
expect(values(response)).toMatchObject({ model: "claude-haiku-4-5", mode: "plan" });
expect(response.modes?.currentModeId).toBe("plan");
expect(updates.filter((u) => u.sessionId === FORK_ID)).toEqual([]);
});
it("leaves the warning of an Auto mode fallback for the first prompt", async () => {
const response = await agent.newSession({
cwd,
@@ -1648,6 +1767,27 @@ describe("createSession options merging", () => {
initError,
);
});
it("disposes the settings of a session whose options the SDK refuses", async () => {
// What SDK 0.3.328 throws from `query()` for a hook matcher without `hooks`.
optionsRefusal = new Error(
"The session was not started, because the hooks option can't be sent to Claude Code: " +
"hooks.PreToolUse[0].hooks must be an array of callbacks. Fix that value and try again.",
);
// The module that the agent of this test loaded (see `beforeEach`).
const { SettingsManager } = await import("../../settings.js");
const initialized = vi.spyOn(SettingsManager.prototype, "initialize");
const disposed = vi.spyOn(SettingsManager.prototype, "dispose");
await expect(agent.newSession({ cwd: process.cwd(), mcpServers: [] })).rejects.toBe(
optionsRefusal,
);
expect(initialized).toHaveBeenCalled();
expect(disposed).toHaveBeenCalledTimes(initialized.mock.calls.length);
initialized.mockRestore();
disposed.mockRestore();
});
});
describe("elicitation", () => {

View File

@@ -1,6 +1,10 @@
import { describe, it, expect, vi } from "vitest";
import type { ClientCapabilities, SessionNotification } from "@agentclientprotocol/sdk/unstable";
import type { FastModeDisabledReason, ModelInfo } from "@anthropic-ai/claude-agent-sdk";
import type {
FastModeDisabledReason,
FastModeState,
ModelInfo,
} from "@anthropic-ai/claude-agent-sdk";
import { ClaudeAcpAgent } from "../../v1/acp-agent.js";
import {
buildConfigOptions,
@@ -8,6 +12,7 @@ import {
} from "../../session-config-options.js";
import {
createFastModeConfigOption,
fastModeResultIsNews,
fastModeStateEnabled,
normalizeFastModeDisabledReason,
resolveFastModeEnabled,
@@ -49,7 +54,7 @@ describe("createFastModeConfigOption", () => {
id: FAST_MODE_CONFIG_ID,
name: "Fast mode",
description: expect.any(String),
category: "model_config",
category: "speed",
type: "boolean",
currentValue: true,
});
@@ -97,16 +102,17 @@ describe("createFastModeConfigOption", () => {
);
});
it("falls back to an on/off select when the client did not opt in", () => {
it("falls back to a select that lists off before on when the client did not opt in", () => {
const option = createFastModeConfigOption(false, false);
expect(option).toMatchObject({
id: FAST_MODE_CONFIG_ID,
type: "select",
category: "model_config",
category: "speed",
currentValue: FAST_MODE_OFF,
// ACP: the values of a `speed` select go from slowest to fastest.
options: [
{ value: FAST_MODE_ON, name: "On" },
{ value: FAST_MODE_OFF, name: "Off" },
{ value: FAST_MODE_ON, name: "On" },
],
});
expect(option).not.toHaveProperty("currentValue", true);
@@ -197,6 +203,30 @@ describe("normalizeFastModeDisabledReason", () => {
);
});
describe("fastModeResultIsNews", () => {
type Report = [FastModeState | undefined, FastModeDisabledReason | undefined];
it.each([
["has no init to repeat", undefined, ["off", undefined], true],
["repeats its init", ["off", undefined], ["off", undefined], false],
// Turning Fast mode on mid-turn drops `sdk_opt_in_required` from the result.
[
"differs only by an unexplained reason",
["off", "sdk_opt_in_required"],
["off", undefined],
false,
],
["adds a refusal", ["off", undefined], ["off", "extra_usage_disabled"], true],
["reports another state", ["off", "network_error"], ["on", undefined], true],
] as [string, Report | undefined, Report, boolean][])(
"tells whether a result that %s is news",
(_case, init, result, news) => {
const report = ([state, reason]: Report) => ({ state, reason });
expect(fastModeResultIsNews(init && report(init), report(result))).toBe(news);
},
);
});
describe("buildConfigOptions Fast mode", () => {
it("omits the Fast mode option when the model does not support it", () => {
const options = buildConfigOptions(MODES, MODELS, MODEL_INFOS, undefined, [], "default", {
@@ -271,7 +301,8 @@ describe("setSessionConfigOption Fast mode toggle", () => {
type: "boolean",
value: true,
});
expect(applyFlagSettings).toHaveBeenCalledWith({ fastMode: true });
// Off first: Claude Code ignores a `true` while its flag holds `true`.
expect(applyFlagSettings.mock.calls).toEqual([[{ fastMode: false }], [{ fastMode: true }]]);
expect(onResponse.configOptions).toContainEqual(createFastModeConfigOption(true, true));
expect(
(agent as unknown as { sessions: Record<string, { fastModeEnabled: boolean }> }).sessions[
@@ -285,7 +316,7 @@ describe("setSessionConfigOption Fast mode toggle", () => {
type: "boolean",
value: false,
});
expect(applyFlagSettings).toHaveBeenLastCalledWith({ fastMode: false });
expect(applyFlagSettings.mock.calls.slice(2)).toEqual([[{ fastMode: false }]]);
expect(offResponse.configOptions).toContainEqual(createFastModeConfigOption(false, true));
});
@@ -569,12 +600,18 @@ describe("syncFastModeState (SDK-driven state changes)", () => {
});
});
describe("Fast mode that Claude Code refuses during a turn", () => {
describe("Fast mode that Claude Code reports during a turn", () => {
const SESSION_ID = "test-session";
/** A session whose Claude Code answers the first prompt with a `system`/init
* that reports Fast mode off with `reason`, as it does on every turn. */
async function setupTurn(reason: FastModeDisabledReason) {
* that reports Fast mode off with `reason`, as it does on every turn, and
* then with a result that carries the `result` fields. `duringTurn` runs
* between the two, once the adapter has handled the init. */
async function setupTurn(
reason: FastModeDisabledReason,
result: Record<string, unknown> = {},
duringTurn: (agent: ClaudeAcpAgent) => Promise<unknown> = async () => {},
) {
const updates: SessionNotification[] = [];
const client = {
sessionUpdate: async (n: SessionNotification) => {
@@ -595,7 +632,8 @@ describe("Fast mode that Claude Code refuses during a turn", () => {
fast_mode_disabled_reason: reason,
session_id: SESSION_ID,
};
yield successfulResultMessage();
await duringTurn(agent);
yield successfulResultMessage(result);
yield { type: "system", subtype: "session_state_changed", state: "idle" };
}
const query = Object.assign(wrapQuery(messages()), { applyFlagSettings: async () => {} });
@@ -653,4 +691,41 @@ describe("Fast mode that Claude Code refuses during a turn", () => {
},
]);
});
/**
* Scenario:
* 1. A turn's init reports Fast mode off (`sdk_opt_in_required`: no opt-in yet).
* 2. The client turns Fast mode on while the turn runs.
* 3. The turn's result reports Fast mode off: Claude Code read the flag when
* the turn started. It carries no reason, or the account's refusal.
* Expected:
* - Without a reason the result repeats the init: `fast` stays on, with no update.
* - With `extra_usage_disabled`, `fast` reads off again.
*/
it.each([
["keeps", "repeats the init", {}, true],
["turns off", "adds a refusal", { fast_mode_disabled_reason: "extra_usage_disabled" }, false],
])(
"%s a Fast mode that the client turned on during the turn when the result %s",
async (_outcome, _result, reported, enabled) => {
const { agent, updates } = await setupTurn(
"sdk_opt_in_required",
{ fast_mode_state: "off", ...reported },
(agent) =>
agent.setSessionConfigOption({
sessionId: SESSION_ID,
configId: "fast",
type: "boolean",
value: true,
}),
);
await agent.prompt({ sessionId: SESSION_ID, prompt: [{ type: "text", text: "hi" }] });
expect(agent.sessions[SESSION_ID].fastModeEnabled).toBe(enabled);
expect(updates.filter((n) => n.update.sessionUpdate === "config_option_update")).toHaveLength(
enabled ? 0 : 1,
);
},
);
});

View File

@@ -186,3 +186,44 @@ describe.each(["same directory", "different directory"])("fork into %s", (direct
expect(await fs.readFile(sourceFile, "utf8")).toBe(transcript);
});
});
describe("fork at a session cursor", () => {
/** The entries of the source transcript, as `getSessionMessages` returns its active chain. */
const history = () => getSessionMessages(sessionId, { dir: sourceCwd });
it("copies the history before the cursor's user message", async () => {
const [, firstAnswer, followup] = await history();
const response = await forkSession(
{ sessionId, cwd: destinationCwd, mcpServers: [], cursorId: `before:${followup!.uuid}` },
{ messageIdForGrouping },
);
const forked = await getSessionMessages(response.sessionId);
expect(forked.map((message) => message.message)).toEqual([
{ role: "user", content: "First prompt" },
expect.objectContaining({ id: "msg_first" }),
]);
expect(firstAnswer!.message).toMatchObject({ id: "msg_first" });
expect(await fs.readFile(sourceFile, "utf8")).toBe(transcript);
});
it.each([
["an id that the session did not announce", () => "cur_9f2c41"],
// Nothing is before the first entry.
["the first entry of the history", async () => `before:${(await history())[0]!.uuid}`],
["an entry that is no user message", async () => `before:${(await history())[1]!.uuid}`],
])("rejects %s without forking anything", async (_, cursor) => {
const cursorId = await cursor();
await expect(
forkSession(
{ sessionId, cwd: sourceCwd, mcpServers: [], cursorId },
{ messageIdForGrouping },
),
).rejects.toMatchObject({
code: -32602,
data: { cursorId },
message: expect.stringContaining("that a fork can start at"),
});
expect(await fs.readdir(path.dirname(sourceFile))).toEqual([path.basename(sourceFile)]);
});
});

View File

@@ -24,6 +24,8 @@ vi.mock("node:child_process", async () => ({
const sessionId = "test-session";
const toolCallId = "unfinished-bash";
/** The id of a question that Claude Code's confirmWithUser asks. */
const confirmId = "confirm_0b7c5f3e-5a7e-4d55-9a54-2f7f0a1c9e11";
afterEach(() => clearHookCallbacks(sessionId));
@@ -68,6 +70,90 @@ describe("incomplete foreground tools", () => {
expect(updates).toContainEqual(expect.objectContaining({ toolCallId, status: "failed" }));
});
it.each([
{
client: "answers",
answer: async () => ({ action: "accept", content: { question_0: "Download" } }),
toolCall: "completed",
},
// A declined form answers the question with nothing selected.
{ client: "declines", answer: async () => ({ action: "decline" }), toolCall: "completed" },
{ client: "cancels", answer: async () => ({ action: "cancel" }), toolCall: "failed" },
{
client: "cannot show",
answer: async () => {
throw new Error("Invalid params");
},
toolCall: "failed",
},
])(
"ends the turn after a confirmWithUser question that the client $client, with its tool call $toolCall",
async ({ answer, toolCall }) => {
const { agent, prompt, updates } = createTestSession(confirmQuestionMessages, {
createElicitation: answer as AcpClient["createElicitation"],
});
await agent.initialize({
protocolVersion: 1,
clientCapabilities: { elicitation: { form: {} } },
});
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
// No tool_result comes for the question, so its answer ends the tool call.
expect(
updates.filter((update) => update.toolCallId === confirmId).map((update) => update.status),
).toEqual(["pending", toolCall]);
},
);
it("ends the turn after a confirmWithUser question that Claude Code withdrew", async () => {
const { createElicitation, messages } = withdrawnConfirmQuestion(false);
const { agent, prompt } = createTestSession(messages, { createElicitation });
await agent.initialize({
protocolVersion: 1,
clientCapabilities: { elicitation: { form: {} } },
});
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
});
it.each([
{
cancel: "while the client shows it",
session: () => withdrawnConfirmQuestion(true),
// The cancel ends it, as it ends the turn's other open tool calls.
ends: [["failed", "The turn was cancelled before this tool call returned a result."]],
},
{
cancel: "after the client answered it",
session: () => ({
messages: answeredConfirmQuestionThenCancelMessages,
createElicitation: async () => ({
action: "accept" as const,
content: { question_0: "Download" },
}),
}),
// The answer ended it: the cancel does not end it again.
ends: [["completed", undefined]],
},
])(
"ends the tool call of a confirmWithUser question once at a cancel $cancel",
async ({ session, ends }) => {
const { createElicitation, messages } = session();
const { agent, prompt, updates } = createTestSession(messages, { createElicitation });
await agent.initialize({
protocolVersion: 1,
clientCapabilities: { elicitation: { form: {} } },
});
await expect(prompt()).resolves.toMatchObject({ stopReason: "cancelled" });
expect(
updates
.filter((update) => update.toolCallId === confirmId && update.status !== "pending")
.map((update) => [update.status, update.content?.[0].content.text]),
).toEqual(ends);
},
);
it("allows a completed tool with a late PostToolUse hook", async () => {
const { prompt, logError } = createTestSession(completedToolMessages);
@@ -168,6 +254,135 @@ describe("incomplete foreground tools", () => {
expect(agent.sessions[sessionId].dispatchedToolCalls?.has(advisorId)).toBe(false);
});
it("closes an advisor call whose reply Claude Code gave up on once the next reply's first block has reached the client, and ends the turn as usual", async () => {
const advisorId = "srvtoolu_cut_off";
const nextToolId = "toolu_next";
const { prompt, updates, logError, agent } = createTestSession(async function* (input) {
yield* echoNextPrompt(input);
yield messageStart("msg_cut_off");
yield advisorStart(advisorId);
yield advisorToolUse(advisorId, "msg_cut_off");
// No result: Claude Code gives up on the reply and asks again.
yield messageStart("msg_asked_again");
yield toolStart(nextToolId);
yield blockStart({ type: "text", text: "" }, 1);
yield {
...blockStart({}),
event: {
type: "content_block_delta",
index: 1,
delta: { type: "text_delta", text: "Next." },
},
};
yield successfulResultMessage();
});
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
const ends = updates.filter(
(update) =>
update.toolCallId === advisorId && ["completed", "failed"].includes(update.status),
);
expect(ends).toHaveLength(1);
expect(ends[0]).toMatchObject({ status: "failed" });
expect(ends[0].content[0].content.text).toBe(
"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.",
);
const advisorEnds = updates.indexOf(ends[0]);
const nextToolStarts = updates.findIndex(
(update) => update.sessionUpdate === "tool_call" && update.toolCallId === nextToolId,
);
const nextText = updates.findIndex(
(update) => update.sessionUpdate === "agent_message_chunk" && update.content.text === "Next.",
);
expect(nextToolStarts).toBeGreaterThanOrEqual(0);
expect(advisorEnds).toBeGreaterThan(nextToolStarts);
expect(advisorEnds).toBeLessThan(nextText);
expect(agent.sessions[sessionId].emittedToolCalls.has(advisorId)).toBe(false);
expect(logError).not.toHaveBeenCalled();
});
it("closes an advisor call whose reply Claude Code gave up on when the next reply does not stream, by its message id", async () => {
const advisorId = "srvtoolu_cut_off";
const retryToolId = "toolu_retry";
const retry = toolUse(retryToolId);
const { prompt, updates, logError } = createTestSession(async function* (input) {
yield* echoNextPrompt(input);
yield messageStart("msg_cut_off");
yield advisorStart(advisorId);
yield advisorToolUse(advisorId, "msg_cut_off");
// Claude Code asks again without streaming, as its fallback after a
// streaming error does: only the consolidated message comes.
yield { ...retry, message: { ...retry.message, id: "msg_retry" } };
yield toolResult(retryToolId);
yield successfulResultMessage();
});
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
const ends = updates.filter(
(update) =>
update.toolCallId === advisorId && ["completed", "failed"].includes(update.status),
);
expect(ends).toHaveLength(1);
expect(ends[0]).toMatchObject({ status: "failed" });
expect(ends[0].content[0].content.text).toBe(
"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.",
);
expect(updates).toContainEqual(
expect.objectContaining({ toolCallId: retryToolId, status: "completed" }),
);
expect(logError).not.toHaveBeenCalled();
});
it("names the subagent on the close of its advisor call whose reply Claude Code gave up on", async () => {
const advisorId = "srvtoolu_subagent_cut_off";
const subagent = { parent_tool_use_id: "toolu_agent" };
const { prompt, updates } = createTestSession(async function* (input) {
yield* echoNextPrompt(input);
yield { ...messageStart("msg_subagent_cut_off"), ...subagent };
yield { ...advisorStart(advisorId), ...subagent };
yield { ...messageStart("msg_subagent_asked_again"), ...subagent };
yield { ...blockStart({ type: "text", text: "" }), ...subagent };
yield assistantText("Done.");
yield successfulResultMessage();
});
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
const ends = updates.filter(
(update) =>
update.toolCallId === advisorId && ["completed", "failed"].includes(update.status),
);
expect(ends).toMatchObject([
{ status: "failed", _meta: { claudeCode: { parentToolUseId: "toolu_agent" } } },
]);
const mainText = updates.findIndex(
(update) => update.sessionUpdate === "agent_message_chunk" && update.content.text === "Done.",
);
expect(updates.indexOf(ends[0])).toBeLessThan(mainText);
});
it("leaves an advisor call that its reply left pending for the result that starts the next reply", async () => {
const advisorId = "srvtoolu_pending";
const result = { type: "advisor_result", text: "Check the edge case." };
const { prompt, updates, logError } = createTestSession(async function* (input) {
yield* echoNextPrompt(input);
yield messageStart("msg_paused");
yield advisorStart(advisorId);
yield advisorToolUse(advisorId, "msg_paused");
yield messageStart("msg_continued");
yield advisorResult(advisorId, result, "msg_continued");
yield blockStart({ type: "text", text: "" }, 1);
yield successfulResultMessage();
});
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
const ends = updates.filter(
(update) =>
update.toolCallId === advisorId && ["completed", "failed"].includes(update.status),
);
expect(ends.map((update) => update.status)).toEqual(["completed"]);
expect(logError).not.toHaveBeenCalled();
});
it("allows a tool explicitly handed off to a background task", async () => {
const { prompt, updates } = createTestSession(backgroundToolMessages);
@@ -181,6 +396,12 @@ describe("incomplete foreground tools", () => {
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
});
it("does not claim a workflow agent's permission tool as a foreground tool", async () => {
const { prompt } = createTestSession(workflowAgentPermissionMessages);
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
});
it("does not treat a request to run in the background as a confirmed handoff", async () => {
const { prompt } = createTestSession(unconfirmedBackgroundToolMessages);
@@ -1161,6 +1382,66 @@ describe("tool calls of a background subagent that a cancel stops", () => {
});
});
// The model can write an input that Claude Code rejects when it runs the tool,
// after the adapter reported the tool use (issue #1308).
describe("a tool use whose input Claude Code rejects", () => {
it("reports a Read with a number for file_path as failed, and ends the turn", async () => {
const id = "toolu_number_path";
const error =
"InputValidationError: Read failed due to the following issue:\n" +
"The parameter `file_path` type is expected as `string` but provided as `number`";
const { prompt, updates, logError } = createTestSession(async function* (prompts) {
yield* echoNextPrompt(prompts);
yield toolUse(id, null, "Read", { file_path: 12345 });
yield {
...toolResult(id),
message: {
role: "user",
content: [{ type: "tool_result", tool_use_id: id, is_error: true, content: error }],
},
};
yield successfulResultMessage();
});
await expect(prompt()).resolves.toMatchObject({ stopReason: "end_turn" });
const reports = updates.filter((update) => update.toolCallId === id);
expect(reports[0]).toMatchObject({
sessionUpdate: "tool_call",
title: "Read File",
locations: [],
rawInput: { file_path: 12345 },
});
expect(reports.at(-1)).toMatchObject({ status: "failed" });
expect(logError).not.toHaveBeenCalled();
});
});
/** The stream event that starts an API reply, which carries its message id. */
function messageStart(id: string) {
return {
type: "stream_event",
session_id: sessionId,
uuid: `stream-${id}`,
parent_tool_use_id: null,
event: {
type: "message_start",
message: { id, model: "claude-test", usage: successfulResultMessage().usage },
},
};
}
/** The stream event that starts a block of the reply streaming: `block` at `index`. */
function blockStart(block: Record<string, unknown>, index = 0) {
return {
type: "stream_event",
session_id: sessionId,
uuid: "stream-message",
parent_tool_use_id: null,
event: { type: "content_block_start", index, content_block: block },
};
}
function toolStart(id = toolCallId, parent: string | null = null, name = "Bash") {
return {
type: "stream_event",
@@ -1206,12 +1487,13 @@ function advisorStart(id: string) {
}
/** The complete assistant message that dispatches the advisor server tool. */
function advisorToolUse(id: string) {
function advisorToolUse(id: string, messageId?: string) {
return {
type: "assistant",
session_id: sessionId,
parent_tool_use_id: null,
message: {
...(messageId && { id: messageId }),
role: "assistant",
usage: successfulResultMessage().usage,
content: [{ type: "server_tool_use", id, name: "advisor", input: {} }],
@@ -1219,12 +1501,13 @@ function advisorToolUse(id: string) {
};
}
function advisorResult(id: string, content: unknown) {
function advisorResult(id: string, content: unknown, messageId?: string) {
return {
type: "assistant",
session_id: sessionId,
parent_tool_use_id: null,
message: {
...(messageId && { id: messageId }),
role: "assistant",
usage: successfulResultMessage().usage,
content: [{ type: "advisor_tool_result", tool_use_id: id, content }],
@@ -1259,6 +1542,7 @@ function toolResult(id = toolCallId, parent: string | null = null) {
function createTestSession(
createSdkMessages: (input: Pushable<any>, agent: ClaudeAcpAgent) => AsyncGenerator<any>,
client: Partial<AcpClient> = {},
) {
const updates: any[] = [];
const logError = vi.fn();
@@ -1271,6 +1555,7 @@ function createTestSession(
requestPermission: async () => ({ outcome: { outcome: "selected", optionId: "allow-once" } }),
extNotification: async () => {},
authStatusUpdate: async () => {},
...client,
} as unknown as AcpClient,
{ log: () => {}, error: logError },
);
@@ -1319,6 +1604,44 @@ async function* permissionOnlyToolMessages(input: Pushable<any>, agent: ClaudeAc
yield successfulResultMessage();
}
/** A workflow agent asks for permission while the turn runs. The workflow's
* task_started names the Workflow call, not the agent, and the agent's
* tool_use and tool_result never stream on the root query. */
async function* workflowAgentPermissionMessages(input: Pushable<any>, agent: ClaudeAcpAgent) {
yield* echoNextPrompt(input);
yield toolStart("workflow", null, "Workflow");
yield toolUse("workflow", null, "Workflow", { script: "await agent('Stamp the date')" });
yield {
type: "system",
subtype: "task_started",
session_id: sessionId,
task_id: "wzr1bosoo",
tool_use_id: "workflow",
description: "Stamp the date",
task_type: "local_workflow",
};
yield {
...toolResult("workflow"),
message: {
role: "user",
content: [
{
type: "tool_result",
tool_use_id: "workflow",
content: "Workflow launched in background. Task ID: wzr1bosoo",
},
],
},
};
await agent.canUseTool(sessionId)("Bash", { command: "date > stamp.txt; cat stamp.txt" }, {
toolUseID: toolCallId,
agentID: "a2a57f1ad0803996a",
signal: new AbortController().signal,
suggestions: [],
} as any);
yield successfulResultMessage();
}
async function* completedToolMessages(input: Pushable<any>) {
yield* echoNextPrompt(input);
yield toolStart();
@@ -1885,3 +2208,77 @@ async function* steeredAbandonedToolMessages(input: Pushable<any>, agent: Claude
yield assistantText("Done as you asked.");
yield successfulResultMessage();
}
/** How Claude Code's confirmWithUser asks the user: through AskUserQuestion,
* under a synthetic `confirm_` id, with no tool_use or tool_result. */
function askConfirmQuestion(agent: ClaudeAcpAgent, signal = new AbortController().signal) {
const questions = [
{
question: "Download report.pdf from Drive?",
header: "Download",
options: [
{ label: "Download", description: "" },
{ label: "Don't download", description: "" },
],
multiSelect: false,
},
];
return agent.canUseTool(sessionId)(
"AskUserQuestion",
{ questions, metadata: { source: "mcp_connector_download" } },
{ toolUseID: confirmId, signal, suggestions: [] } as any,
);
}
async function* confirmQuestionMessages(input: Pushable<any>, agent: ClaudeAcpAgent) {
yield* echoNextPrompt(input);
// A question that the client cancelled rejects.
await askConfirmQuestion(agent).catch(() => {});
yield successfulResultMessage();
}
/**
* A confirmWithUser question whose request Claude Code withdraws while the
* client still shows it: at a `session/cancel` (`cancel`), or with the turn
* going on, as when another client of the session answered it.
*/
function withdrawnConfirmQuestion(cancel: boolean) {
let asked!: () => void;
const shown = new Promise<void>((resolve) => (asked = resolve));
return {
// The ACP connection rejects a request whose signal aborts.
createElicitation: ((_request: unknown, signal: AbortSignal) => {
asked();
return new Promise((_resolve, reject) =>
signal.addEventListener("abort", () => reject(new Error("Request cancelled"))),
);
}) as unknown as AcpClient["createElicitation"],
async *messages(input: Pushable<any>, agent: ClaudeAcpAgent) {
yield* echoNextPrompt(input);
const withdrawal = new AbortController();
const answer = askConfirmQuestion(agent, withdrawal.signal).catch(() => {});
await shown;
if (cancel) void agent.cancel({ sessionId });
withdrawal.abort();
await answer;
if (cancel) {
yield interruptNote;
yield abortedResult();
} else {
yield successfulResultMessage();
}
},
};
}
/** A `session/cancel` later in the turn of a confirmWithUser question that the client answered. */
async function* answeredConfirmQuestionThenCancelMessages(
input: Pushable<any>,
agent: ClaudeAcpAgent,
) {
yield* echoNextPrompt(input);
await askConfirmQuestion(agent);
await agent.cancel({ sessionId });
yield interruptNote;
yield abortedResult();
}

View File

@@ -2,7 +2,11 @@ import { describe, it, expect } from "vitest";
import type { ClientCapabilities } from "@agentclientprotocol/sdk/unstable";
import { ClaudeAcpAgent } from "../../v1/acp-agent.js";
import type { AcpClient } from "../../acp-client.js";
import { promptSuggestionsMeta, promptSuggestionText } from "../../prompt-suggestions.js";
import {
promptSuggestionsMeta,
promptSuggestionsUpdate,
promptSuggestionText,
} from "../../prompt-suggestions.js";
import { Pushable } from "../../utils.js";
import {
mockSessionState,
@@ -11,11 +15,20 @@ import {
wrapQuery,
} from "./session-doubles.js";
/** An AIR client: the only one that renders the follow-up prompt. */
/** An AIR client, which reads the follow-up prompt from `_meta`. */
const AIR_CLIENT: ClientCapabilities = {
_meta: { jetbrains: { air: { version: 1, capabilities: [] } } },
};
/** A client that advertised ACP's `prompt_suggestions_update`. */
const SUGGESTIONS_CLIENT: ClientCapabilities = { session: { promptSuggestions: {} } };
/** The session info update that carries `text` to AIR. */
const metaUpdate = (text: string | null) => ({
sessionUpdate: "session_info_update",
_meta: promptSuggestionsMeta(text),
});
describe("the follow-up prompt on the wire", () => {
it("drops a prediction that says nothing", () => {
expect(promptSuggestionText("Run the tests")).toBe("Run the tests");
@@ -31,92 +44,122 @@ describe("the follow-up prompt on the wire", () => {
});
expect(promptSuggestionsMeta(null)).toEqual({ promptSuggestions: { suggestions: [] } });
});
it("is one suggestion of one text block in ACP's update, and an empty list withdraws it", () => {
expect(promptSuggestionsUpdate("Run the tests")).toEqual({
sessionUpdate: "prompt_suggestions_update",
suggestions: [{ prompt: [{ type: "text", text: "Run the tests" }] }],
});
expect(promptSuggestionsUpdate(null)).toEqual({
sessionUpdate: "prompt_suggestions_update",
suggestions: [],
});
});
});
describe("the follow-up prompt at turn-end", () => {
/** Collects the `_meta.promptSuggestions` of every session info update. */
function recorder() {
const published: unknown[] = [];
const client = {
sessionUpdate: async (notification: any) => {
const update = notification.update;
if (update?.sessionUpdate !== "session_info_update") return;
if (update._meta?.promptSuggestions === undefined) return;
published.push(update._meta.promptSuggestions);
},
} as unknown as AcpClient;
return { client, published };
}
/** Collects every update that carries a predicted prompt, in either form. */
function recorder() {
const published: unknown[] = [];
const client = {
sessionUpdate: async (notification: any) => {
const update = notification.update;
const carries =
update?.sessionUpdate === "prompt_suggestions_update" ||
(update?.sessionUpdate === "session_info_update" &&
update._meta?.promptSuggestions !== undefined);
if (carries) published.push(update);
},
} as unknown as AcpClient;
return { client, published };
}
/** One turn per entry: echo the prompt, succeed, predict `suggestion` (when
* the entry has one), go idle. A turn with `null` predicts nothing, as the
* CLI does in plan mode or after an API error. */
function turns(input: Pushable<any>, suggestions: (string | null)[]) {
return (async function* () {
const iter = input[Symbol.asyncIterator]();
for (const suggestion of suggestions) {
const { value: userMessage } = await iter.next();
yield userEcho(userMessage);
yield successfulResultMessage();
if (suggestion !== null) {
yield { type: "prompt_suggestion", suggestion, uuid: "uuid", session_id: "test-session" };
}
yield { type: "system", subtype: "session_state_changed", state: "idle" };
/** One turn per entry: echo the prompt, succeed, predict `suggestion` (when
* the entry has one), go idle. A turn with `null` predicts nothing, as the
* CLI does in plan mode or after an API error. */
function turns(input: Pushable<any>, suggestions: (string | null)[]) {
return (async function* () {
const iter = input[Symbol.asyncIterator]();
for (const suggestion of suggestions) {
const { value: userMessage } = await iter.next();
yield userEcho(userMessage);
yield successfulResultMessage();
if (suggestion !== null) {
yield { type: "prompt_suggestion", suggestion, uuid: "uuid", session_id: "test-session" };
}
})();
}
async function airAgent(client: AcpClient) {
const agent = new ClaudeAcpAgent(client, { log: () => {}, error: () => {} });
await agent.initialize({ protocolVersion: 1, clientCapabilities: AIR_CLIENT });
return agent;
}
async function run(
agent: ClaudeAcpAgent,
suggestions: (string | null)[],
{ drain = true }: { drain?: boolean } = {},
) {
const input = new Pushable<any>();
agent.sessions["test-session"] = mockSessionState(
{ query: wrapQuery(turns(input, suggestions)), input },
agent,
);
for (let i = 0; i < suggestions.length; i++) {
await agent.prompt({
sessionId: "test-session",
prompt: [{ type: "text", text: `prompt ${i}` }],
});
// The prediction lands after the turn's result, so let the consumer read
// it off the stream before the next prompt: a user types slower than this.
if (drain) await new Promise((resolve) => setTimeout(resolve, 0));
yield { type: "system", subtype: "session_state_changed", state: "idle" };
}
await agent.sessions["test-session"]?.consumer;
}
})();
}
async function agentFor(client: AcpClient, clientCapabilities: ClientCapabilities) {
const agent = new ClaudeAcpAgent(client, { log: () => {}, error: () => {} });
await agent.initialize({ protocolVersion: 1, clientCapabilities });
return agent;
}
/**
* Runs one turn per entry of `suggestions`. `drain` lets the consumer read a
* turn's prediction before the next prompt. `queued` sends every prompt
* before the first turn's result.
*/
async function run(
agent: ClaudeAcpAgent,
suggestions: (string | null)[],
{ drain = true, queued = false }: { drain?: boolean; queued?: boolean } = {},
) {
const input = new Pushable<any>();
agent.sessions["test-session"] = mockSessionState(
{ query: wrapQuery(turns(input, suggestions)), input },
agent,
);
const prompts: Promise<unknown>[] = [];
for (let i = 0; i < suggestions.length; i++) {
const prompt = agent.prompt({
sessionId: "test-session",
prompt: [{ type: "text", text: `prompt ${i}` }],
});
prompts.push(prompt);
if (queued) continue;
await prompt;
// The prediction lands after the turn's result, so let the consumer read
// it off the stream before the next prompt: a user types slower than this.
if (drain) await new Promise((resolve) => setTimeout(resolve, 0));
}
await Promise.all(prompts);
await agent.sessions["test-session"]?.consumer;
}
describe.each([
{ form: "AIR's _meta", capabilities: AIR_CLIENT, sent: metaUpdate },
{
form: "prompt_suggestions_update",
capabilities: SUGGESTIONS_CLIENT,
sent: promptSuggestionsUpdate,
},
])("the follow-up prompt at turn-end, as $form", ({ capabilities, sent }) => {
it("publishes the predicted prompt after the turn's result", async () => {
const { client, published } = recorder();
const agent = await airAgent(client);
const agent = await agentFor(client, capabilities);
await run(agent, ["Run the tests"]);
expect(published).toEqual([{ suggestions: [{ text: "Run the tests" }] }]);
expect(published).toEqual([sent("Run the tests")]);
});
it("clears the previous prediction when the next prompt arrives", async () => {
const { client, published } = recorder();
const agent = await airAgent(client);
const agent = await agentFor(client, capabilities);
// The second turn predicts nothing, so without the clear at the prompt the
// first turn's prediction would still sit in the composer after it.
await run(agent, ["Run the tests", null]);
expect(published).toEqual([{ suggestions: [{ text: "Run the tests" }] }, { suggestions: [] }]);
expect(published).toEqual([sent("Run the tests"), sent(null)]);
});
it("does not publish a prediction that is only whitespace", async () => {
const { client, published } = recorder();
const agent = await airAgent(client);
const agent = await agentFor(client, capabilities);
await run(agent, [" "]);
@@ -125,7 +168,7 @@ describe("the follow-up prompt at turn-end", () => {
it("drops a prediction the next prompt outran", async () => {
const { client, published } = recorder();
const agent = await airAgent(client);
const agent = await agentFor(client, capabilities);
// Both prompts are sent before the consumer reads the first turn's
// prediction: it answers a turn the user has already moved past, so it must
@@ -134,14 +177,60 @@ describe("the follow-up prompt at turn-end", () => {
expect(published).toEqual([]);
});
});
it("sends nothing to a client that is not AIR", async () => {
describe("the follow-up prompt of a client by what it declares", () => {
it("sends nothing to a client that is not AIR and advertises no prompt suggestions", async () => {
const { client, published } = recorder();
const agent = new ClaudeAcpAgent(client, { log: () => {}, error: () => {} });
await agent.initialize({ protocolVersion: 1, clientCapabilities: {} as ClientCapabilities });
const agent = await agentFor(client, {} as ClientCapabilities);
await run(agent, ["Run the tests"]);
expect(published).toEqual([]);
});
it("sends both forms to an AIR client that advertises prompt suggestions", async () => {
const { client, published } = recorder();
const agent = await agentFor(client, { ...AIR_CLIENT, ...SUGGESTIONS_CLIENT });
await run(agent, ["Run the tests"]);
expect(published).toEqual([
promptSuggestionsUpdate("Run the tests"),
metaUpdate("Run the tests"),
]);
});
/**
* Scenario:
* 1. Two prompts arrive before the first turn's result.
* 2. Each turn ends with a prediction.
* Expected:
* - The first prediction comes while the second prompt waits, so it does not
* account for that prompt. ACP's update drops it. AIR's `_meta` keeps its
* rules and carries it.
* - The second prediction goes out in both forms.
*/
it.each([
{
form: "prompt_suggestions_update",
capabilities: SUGGESTIONS_CLIENT,
expected: [promptSuggestionsUpdate("Commit")],
},
{
form: "AIR's _meta",
capabilities: AIR_CLIENT,
expected: [metaUpdate("Run the tests"), metaUpdate("Commit")],
},
])(
"handles a prediction that arrives while another prompt waits by the rules of $form",
async ({ capabilities, expected }) => {
const { client, published } = recorder();
const agent = await agentFor(client, capabilities);
await run(agent, ["Run the tests", "Commit"], { queued: true });
expect(published).toEqual(expected);
},
);
});

Some files were not shown because too many files have changed in this diff Show More