Compare commits

...

37 Commits

Author SHA1 Message Date
acp-release-bot[bot]
ca1fe79e6f chore(main): release 0.29.1 (#559)
🤖 I have created a release *beep* *boop*
---


##
[0.29.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.29.0...v0.29.1)
(2026-04-17)


### Bug Fixes

* emit usage updates from Claude stream events
([#506](https://github.com/agentclientprotocol/claude-agent-acp/issues/506))
([dd67450](dd67450fd9))
* Remove dot from auto mode description
([#561](https://github.com/agentclientprotocol/claude-agent-acp/issues/561))
([2ecfa83](2ecfa83b26))
* Update to claude-agent-sdk 0.2.112 to fix Auto bug with Opus 4.7
([#562](https://github.com/agentclientprotocol/claude-agent-acp/issues/562))
([079614a](079614ab05))

---
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-04-17 14:49:29 +02:00
Ben Brandt
079614ab05 fix: Update to claude-agent-sdk 0.2.112 to fix Auto bug with Opus 4.7 (#562) 2026-04-17 11:39:24 +00:00
José Valim
2ecfa83b26 fix: Remove dot from auto mode description (#561)
The other descriptions do not end with dot.
2026-04-17 10:11:40 +00:00
Michael Gendy
dd67450fd9 fix: emit usage updates from Claude stream events (#506)
## Summary
- emit ACP `usage_update` notifications from top-level Claude
`stream_event` message usage
- keep tracking a usage snapshot across `message_start` and
`message_delta` so partial deltas still produce a complete total
- preserve the existing `result`-path update as the final
exact/cost-bearing usage event

## Why
Claude SDK stream events already carry incremental usage on
`message_delta`, but `claude-agent-acp` currently ignores that path and
only emits `usage_update` from the final `result`. This makes usage
appear stale until the turn ends in ACP clients that expect live context
usage updates.

## Verification
- built the repo with `npm run build`
- ran a direct ACP stdio client against the patched local build
- observed `usage_update` notifications emitted before the final
result-path usage update

Patched local smoke-test output included this sequence:
- `usage_update used=20973 size=200000`
- `agent_message_chunk text=TEST_OK`
- `usage_update used=20989 size=200000`
- `usage_update used=20989 size=1000000 cost=0.1314875`

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-04-16 18:55:28 +02:00
acp-release-bot[bot]
d6a069f9fe chore(main): release 0.29.0 (#558)
🤖 I have created a release *beep* *boop*
---


##
[0.29.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.28.0...v0.29.0)
(2026-04-16)


### Features

* Update to claude-agent-sdk 0.2.111 (Opus 4.7)
([#557](https://github.com/agentclientprotocol/claude-agent-acp/issues/557))
([85cd70c](85cd70c9f3))

---
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-04-16 17:59:54 +02:00
Ben Brandt
85cd70c9f3 feat: Update to claude-agent-sdk 0.2.111 (Opus 4.7) (#557) 2026-04-16 15:55:36 +00:00
Ben Brandt
860c0441c7 Update to claude-agent-sdk 0.2.111 (Opus 4.7) (#556) 2026-04-16 15:51:05 +00:00
acp-release-bot[bot]
3c98d76197 chore(main): release 0.28.0 (#550)
🤖 I have created a release *beep* *boop*
---


##
[0.28.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.27.0...v0.28.0)
(2026-04-15)


### Features

* Update to claude-agent-sdk 0.2.109
([#549](https://github.com/agentclientprotocol/claude-agent-acp/issues/549))
([07a0fbc](07a0fbc2f6))

---
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-04-15 11:48:43 +02:00
Ben Brandt
07a0fbc2f6 feat: Update to claude-agent-sdk 0.2.109 (#549) 2026-04-15 09:23:23 +00:00
Ben Brandt
a0da4277e3 test: Test coverage for reload failure cases (#545) 2026-04-13 21:35:05 +00:00
acp-release-bot[bot]
e3b7d1b9b3 chore(main): release 0.27.0 (#529)
🤖 I have created a release *beep* *boop*
---


##
[0.27.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.26.0...v0.27.0)
(2026-04-13)


### Features

* allow clients to opt into receiving raw SDK messages
([#527](https://github.com/agentclientprotocol/claude-agent-acp/issues/527))
([403a668](403a668078))
* Update to claude-agent-sdk 0.2.104
([#537](https://github.com/agentclientprotocol/claude-agent-acp/issues/537))
([6811943](6811943f57))


### Bug Fixes

* Allow auto mode after plan mode and send description for auto mode
([#528](https://github.com/agentclientprotocol/claude-agent-acp/issues/528))
([fb9aced](fb9aced315))
* Better remote check for auth methods
([#538](https://github.com/agentclientprotocol/claude-agent-acp/issues/538))
([93f58c0](93f58c0d2f))
* better shutdown logic
([#543](https://github.com/agentclientprotocol/claude-agent-acp/issues/543))
([9fb631f](9fb631f5d7))
* exit process when ACP connection closes
([#530](https://github.com/agentclientprotocol/claude-agent-acp/issues/530))
([5c81e99](5c81e99fe5))
* guard tool info rendering when tool_use input is undefined
([#536](https://github.com/agentclientprotocol/claude-agent-acp/issues/536))
([d627b8c](d627b8c5e9))
* Remove backup auth check from new session
([#544](https://github.com/agentclientprotocol/claude-agent-acp/issues/544))
([32b16c1](32b16c1ad9))

---
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-04-13 19:05:16 +02:00
Ben Brandt
32b16c1ad9 fix: Remove backup auth check from new session (#544)
This was an optimistic check, and causes issues when users are using
alternate logins. Just removing
2026-04-13 17:00:55 +00:00
Ben Brandt
9fb631f5d7 fix: better shutdown logic (#543)
Make cancellation a no-op for unknown sessions, close each
session query during disposal, and run the same cleanup path on
SIGINT and SIGTERM in CLI mode.

Follow up to #530
2026-04-13 18:52:44 +02:00
Sway Chan
5c81e99fe5 fix: exit process when ACP connection closes (#530)
## Summary

- Return `AgentSideConnection` from `runAcp()` instead of discarding it
- Listen for `connection.closed` and call `process.exit(0)` on
resolution
- Fixes orphan process accumulation in oneshot mode (e.g. via ACPX)

## Problem

When used in oneshot mode, `claude-agent-acp` does not exit after the
client closes the stdin pipe. `process.stdin.resume()` keeps the Node.js
event loop alive indefinitely. Over time, orphan processes accumulate on
the host (~97MB RSS each), eventually exhausting system resources.

## Root cause

`runAcp()` creates an `AgentSideConnection` but discards the reference.
The `Connection.#receive()` loop detects stdin EOF and fires
`abortController.abort()`, resolving `connection.closed` — but no code
listens for it to trigger `process.exit()`.

## Fix

1. **`acp-agent.ts`**: `runAcp()` now returns the `AgentSideConnection`
instance
2. **`index.ts`**: Awaits `connection.closed` and calls
`process.exit(0)`

## Impact

- **Oneshot sessions**: Process now exits cleanly when the client closes
stdin (EOF)
- **Persistent sessions**: Unaffected — the client keeps stdin open, so
`connection.closed` does not fire until explicit disconnect

## Test plan

- [x] Verified oneshot: process exits within 1s after stdin EOF
- [x] Verified persistent: process remains alive while stdin is open
- [x] Measured idle RSS: ~97MB → freed on exit
- [x] Tested with ACPX runtime (OpenClaw gateway) in production

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: WayChan <dove.h14@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-04-13 16:40:45 +00:00
dependabot[bot]
de37577eaf chore(deps): bump actions/upload-artifact from 7.0.0 to 7.0.1 (#539)
Bumps
[actions/upload-artifact](https://github.com/actions/upload-artifact)
from 7.0.0 to 7.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/upload-artifact/releases">actions/upload-artifact's
releases</a>.</em></p>
<blockquote>
<h2>v7.0.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Update the readme with direct upload details by <a
href="https://github.com/danwkennedy"><code>@​danwkennedy</code></a> in
<a
href="https://redirect.github.com/actions/upload-artifact/pull/795">actions/upload-artifact#795</a></li>
<li>Readme: bump all the example versions to v7 by <a
href="https://github.com/danwkennedy"><code>@​danwkennedy</code></a> in
<a
href="https://redirect.github.com/actions/upload-artifact/pull/796">actions/upload-artifact#796</a></li>
<li>Include changes in typespec/ts-http-runtime 0.3.5 by <a
href="https://github.com/yacaovsnc"><code>@​yacaovsnc</code></a> in <a
href="https://redirect.github.com/actions/upload-artifact/pull/797">actions/upload-artifact#797</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/upload-artifact/compare/v7...v7.0.1">https://github.com/actions/upload-artifact/compare/v7...v7.0.1</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="043fb46d1a"><code>043fb46</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/upload-artifact/issues/797">#797</a>
from actions/yacaovsnc/update-dependency</li>
<li><a
href="634250c138"><code>634250c</code></a>
Include changes in typespec/ts-http-runtime 0.3.5</li>
<li><a
href="e454baaac2"><code>e454baa</code></a>
Readme: bump all the example versions to v7 (<a
href="https://redirect.github.com/actions/upload-artifact/issues/796">#796</a>)</li>
<li><a
href="74fad66b98"><code>74fad66</code></a>
Update the readme with direct upload details (<a
href="https://redirect.github.com/actions/upload-artifact/issues/795">#795</a>)</li>
<li>See full diff in <a
href="bbbca2ddaa...043fb46d1a">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/upload-artifact&package-manager=github_actions&previous-version=7.0.0&new-version=7.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-13 17:54:22 +02:00
dependabot[bot]
3c570c7673 chore(deps): bump googleapis/release-please-action from 4.4.0 to 4.4.1 (#540)
Bumps
[googleapis/release-please-action](https://github.com/googleapis/release-please-action)
from 4.4.0 to 4.4.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/release-please-action/releases">googleapis/release-please-action's
releases</a>.</em></p>
<blockquote>
<h2>v4.4.1</h2>
<h2><a
href="https://github.com/googleapis/release-please-action/compare/v4.4.0...v4.4.1">4.4.1</a>
(2026-02-20)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>bump release-please from 17.1.3 to 17.3.0 (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1183">#1183</a>)
(<a
href="ef9c2745db">ef9c274</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/release-please-action/blob/main/CHANGELOG.md">googleapis/release-please-action's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<h2><a
href="https://github.com/googleapis/release-please-action/compare/v4.4.0...v4.4.1">4.4.1</a>
(2026-02-20)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>bump release-please from 17.1.3 to 17.3.0 (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1183">#1183</a>)
(<a
href="ef9c2745db">ef9c274</a>)</li>
</ul>
<h2><a
href="https://github.com/googleapis/release-please-action/compare/v4.3.0...v4.4.0">4.4.0</a>
(2025-10-09)</h2>
<h3>Features</h3>
<ul>
<li>add ability to select versioning-strategy and release-as (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1121">#1121</a>)
(<a
href="ee0f5bae45">ee0f5ba</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><code>changelog-host</code> parameter ignored when using manifest
configuration (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1151">#1151</a>)
(<a
href="535c4130c1">535c413</a>)</li>
<li>bump mocha from 11.7.1 to 11.7.2 in the npm_and_yarn group across 1
directory (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1149">#1149</a>)
(<a
href="3612a99d75">3612a99</a>)</li>
<li>bump release-please from 17.1.2 to 17.1.3 (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1158">#1158</a>)
(<a
href="66fbfe9439">66fbfe9</a>)</li>
</ul>
<h2><a
href="https://github.com/googleapis/release-please-action/compare/v4.2.0...v4.3.0">4.3.0</a>
(2025-08-20)</h2>
<h3>Features</h3>
<ul>
<li><strong>deps:</strong> update release-please to 17.1.2 (<a
href="f07192c046">f07192c</a>)</li>
</ul>
<h2><a
href="https://github.com/googleapis/release-please-action/compare/v4.1.5...v4.2.0">4.2.0</a>
(2025-03-07)</h2>
<h3>Features</h3>
<ul>
<li>support for skip-labeling parameter for GitHub action (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1066">#1066</a>)
(<a
href="fb7f385da2">fb7f385</a>)</li>
</ul>
<h2><a
href="https://github.com/googleapis/release-please-action/compare/v4.1.4...v4.1.5">4.1.5</a>
(2025-02-27)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> update release-please to 16.18.0 (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1083">#1083</a>)
(<a
href="aeb7f8d384">aeb7f8d</a>)</li>
</ul>
<h2><a
href="https://github.com/googleapis/release-please-action/compare/v4.1.3...v4.1.4">4.1.4</a>
(2024-10-02)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>bump braces from 3.0.2 to 3.0.3 in the npm_and_yarn group (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1015">#1015</a>)
(<a
href="5ec1cbd9cb">5ec1cbd</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5c625bfb5d"><code>5c625bf</code></a>
chore(main): release 4.4.1 (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1187">#1187</a>)</li>
<li><a
href="8bb7a2ed0f"><code>8bb7a2e</code></a>
chore: build dist (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1186">#1186</a>)</li>
<li><a
href="ef9c2745db"><code>ef9c274</code></a>
fix: bump release-please from 17.1.3 to 17.3.0 (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1183">#1183</a>)</li>
<li><a
href="64d83e95d8"><code>64d83e9</code></a>
docs(README): add missing action inputs + package options (<a
href="https://redirect.github.com/googleapis/release-please-action/issues/1176">#1176</a>)</li>
<li>See full diff in <a
href="16a9c90856...5c625bfb5d">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=googleapis/release-please-action&package-manager=github_actions&previous-version=4.4.0&new-version=4.4.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-13 17:53:38 +02:00
dependabot[bot]
96abf29334 chore(deps): bump actions/create-github-app-token from 3.0.0 to 3.1.1 (#541)
Bumps
[actions/create-github-app-token](https://github.com/actions/create-github-app-token)
from 3.0.0 to 3.1.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/create-github-app-token/releases">actions/create-github-app-token's
releases</a>.</em></p>
<blockquote>
<h2>v3.1.1</h2>
<h2><a
href="https://github.com/actions/create-github-app-token/compare/v3.1.0...v3.1.1">3.1.1</a>
(2026-04-11)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>improve error message when app identifier is empty (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/362">#362</a>)
(<a
href="07e2b76066">07e2b76</a>),
closes <a
href="https://redirect.github.com/actions/create-github-app-token/issues/249">#249</a></li>
</ul>
<h2>v3.1.0</h2>
<h1><a
href="https://github.com/actions/create-github-app-token/compare/v3.0.0...v3.1.0">3.1.0</a>
(2026-04-11)</h1>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump p-retry from 7.1.1 to 8.0.0 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/357">#357</a>)
(<a
href="3bbe07d928">3bbe07d</a>)</li>
</ul>
<h3>Features</h3>
<ul>
<li>add <code>client-id</code> input and deprecate <code>app-id</code>
(<a
href="https://redirect.github.com/actions/create-github-app-token/issues/353">#353</a>)
(<a
href="e6bd4e6970">e6bd4e6</a>)</li>
<li>update permission inputs (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/358">#358</a>)
(<a
href="076e9480ca">076e948</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1b10c78c78"><code>1b10c78</code></a>
build(release): 3.1.1 [skip ci]</li>
<li><a
href="07e2b76066"><code>07e2b76</code></a>
fix: improve error message when app identifier is empty (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/362">#362</a>)</li>
<li><a
href="ea0121618b"><code>ea01216</code></a>
ci: remove publish-immutable-action workflow (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/361">#361</a>)</li>
<li><a
href="7bd0371149"><code>7bd0371</code></a>
build(release): 3.1.0 [skip ci]</li>
<li><a
href="e6bd4e6970"><code>e6bd4e6</code></a>
feat: add <code>client-id</code> input and deprecate <code>app-id</code>
(<a
href="https://redirect.github.com/actions/create-github-app-token/issues/353">#353</a>)</li>
<li><a
href="076e9480ca"><code>076e948</code></a>
feat: update permission inputs (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/358">#358</a>)</li>
<li><a
href="3bbe07d928"><code>3bbe07d</code></a>
fix(deps): bump p-retry from 7.1.1 to 8.0.0 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/357">#357</a>)</li>
<li><a
href="28a99e369c"><code>28a99e3</code></a>
build(deps-dev): bump c8 from 10.1.3 to 11.0.0</li>
<li><a
href="4df50600ef"><code>4df5060</code></a>
build(deps-dev): bump open-cli from 8.0.0 to 9.0.0</li>
<li><a
href="4843c538d9"><code>4843c53</code></a>
build(deps-dev): bump the development-dependencies group with 3
updates</li>
<li>See full diff in <a
href="f8d387b68d...1b10c78c78">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/create-github-app-token&package-manager=github_actions&previous-version=3.0.0&new-version=3.1.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-13 17:53:19 +02:00
Ben Brandt
93f58c0d2f fix: Better remote check for auth methods (#538)
The auth methods don't have interactive modes, which means they don't
work on remote machines when you need to paste a code in.

Our previous change might not have been enough, so added some heuristics
similar to what the SDK does for checking for remote.

It's not perfect because I think they are attempting to open the URL and
then falling back when it fails, but heopfully this is at least closer.
2026-04-13 17:34:27 +02:00
Ben Brandt
6811943f57 feat: Update to claude-agent-sdk 0.2.104 (#537) 2026-04-13 15:29:25 +00:00
zhangyc
d627b8c5e9 fix: guard tool info rendering when tool_use input is undefined (#536)
## Summary

- Guard `toolInfoFromToolUse()` against `undefined` input for Read,
Glob, Grep, WebSearch, and TodoWrite cases
- Make `planEntries()` resilient to `undefined` input (returns `[]`
instead of crashing)
- Guard TodoWrite plan updates in `streamEventToAcpNotifications()` with
optional chaining on `chunk.input?.todos`

## Why this change

Claude `tool_use` blocks can temporarily carry `input: undefined` during
streaming (before `input_json_delta` arrives), and historical `tool_use`
messages with incomplete input may be replayed when a JetBrains IDEA
session is resumed. Without these guards, ACP crashes with:

```
TypeError: Cannot read properties of undefined (reading 'limit')
TypeError: Cannot read properties of undefined (reading '-i')
TypeError: Cannot read properties of undefined (reading 'todos')
```

All three crashes share the same root cause: the ACP bridge assumes
`tool_use.input` is always defined, but it can be `undefined` during
streaming early chunks or session history replay.

## Test plan

- [x] Added regression tests for `toolInfoFromToolUse()` with `input:
undefined` (Read, Grep, Glob, WebSearch, TodoWrite)
- [x] Added regression test for `planEntries(undefined)` — returns `[]`
- [x] Added regression test for `planEntries({})` — graceful handling
- [x] Added regression test for `toAcpNotifications()` with TodoWrite +
undefined input — no crash, no spurious plan update
- [x] Added regression test verifying TodoWrite + valid input still
emits plan update
- [x] `npm run build` passes with no TypeScript errors
- [x] All 167 tests pass (10 new)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-04-13 17:03:01 +02:00
Steffen Deusch
403a668078 feat: allow clients to opt into receiving raw SDK messages (#527)
Relates to:
https://github.com/agentclientprotocol/claude-agent-acp/pull/508#discussion_r3050540393
2026-04-13 16:02:40 +02:00
Ben Brandt
fb9aced315 fix: Allow auto mode after plan mode and send description for auto mode (#528) 2026-04-08 11:51:24 +00:00
acp-release-bot[bot]
0a501434c0 chore(main): release 0.26.0 (#524)
🤖 I have created a release *beep* *boop*
---


##
[0.26.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.25.3...v0.26.0)
(2026-04-08)


### Features

* Update claude-agent-sdk to 0.2.96
([#526](https://github.com/agentclientprotocol/claude-agent-acp/issues/526))
([c073131](c073131488))


### Bug Fixes

* Remove bun builds from release
([#525](https://github.com/agentclientprotocol/claude-agent-acp/issues/525))
([fcf5aaf](fcf5aaf06d))
* Use TUI login for remote environments
([#523](https://github.com/agentclientprotocol/claude-agent-acp/issues/523))
([cc73e37](cc73e37b41))

---
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-04-08 12:51:09 +02:00
Ben Brandt
c073131488 feat: Update claude-agent-sdk to 0.2.96 (#526) 2026-04-08 12:48:54 +02:00
Ben Brandt
fcf5aaf06d fix: Remove bun builds from release (#525)
The SDK is broken for bun builds, and these had poor support for various
reasons anyway. Going to turn off these pipelines until we can fix.
2026-04-08 10:18:30 +00:00
Ben Brandt
cc73e37b41 fix: Use TUI login for remote environments (#523)
The auth subcommand goes through a flow that requires pasting in a code
on remote environments, but does not allow for pasting that code in.
Until they fix this in the CLI subcommand, we'll have to go to the old
flow of launching the full CLI.
2026-04-08 11:58:48 +02:00
dependabot[bot]
41f04ec31c chore(deps-dev): bump @anthropic-ai/sdk from 0.82.0 to 0.84.0 (#520)
Bumps
[@anthropic-ai/sdk](https://github.com/anthropics/anthropic-sdk-typescript)
from 0.82.0 to 0.84.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-typescript/releases"><code>@​anthropic-ai/sdk</code>'s
releases</a>.</em></p>
<blockquote>
<h2>sdk: v0.84.0</h2>
<h2>0.84.0 (2026-04-07)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.83.0...sdk-v0.84.0">sdk-v0.83.0...sdk-v0.84.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> Add support for claude-mythos-preview (<a
href="d4057b0a95">d4057b0</a>)</li>
<li><strong>tools:</strong> add AbortSignal support for tool runner (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/848">#848</a>)
(<a
href="972d5918a4">972d591</a>)</li>
</ul>
<h2>sdk: v0.83.0</h2>
<h2>0.83.0 (2026-04-03)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.82.0...sdk-v0.83.0">sdk-v0.82.0...sdk-v0.83.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>vertex:</strong> add support for US multi-region endpoint
(<a
href="5e5aea72e8">5e5aea7</a>)</li>
<li><strong>vertex:</strong> add support for US multi-region endpoint
(<a
href="0de0e98aac">0de0e98</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>client:</strong> deprecate client-side compaction helpers
(<a
href="1926e87039">1926e87</a>)</li>
<li><strong>client:</strong> internal updates (<a
href="3d64763154">3d64763</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-typescript/blob/main/CHANGELOG.md"><code>@​anthropic-ai/sdk</code>'s
changelog</a>.</em></p>
<blockquote>
<h2>0.84.0 (2026-04-07)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.83.0...sdk-v0.84.0">sdk-v0.83.0...sdk-v0.84.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> Add support for claude-mythos-preview (<a
href="d4057b0a95">d4057b0</a>)</li>
<li><strong>tools:</strong> add AbortSignal support for tool runner (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/848">#848</a>)
(<a
href="972d5918a4">972d591</a>)</li>
</ul>
<h2>0.83.0 (2026-04-03)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.82.0...sdk-v0.83.0">sdk-v0.82.0...sdk-v0.83.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>vertex:</strong> add support for US multi-region endpoint
(<a
href="5e5aea72e8">5e5aea7</a>)</li>
<li><strong>vertex:</strong> add support for US multi-region endpoint
(<a
href="0de0e98aac">0de0e98</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> dont upload aws artifact (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/844">#844</a>)
(<a
href="d1a31fcd59">d1a31fc</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>client:</strong> deprecate client-side compaction helpers
(<a
href="1926e87039">1926e87</a>)</li>
<li><strong>client:</strong> internal updates (<a
href="3d64763154">3d64763</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="4105fd6cf6"><code>4105fd6</code></a>
chore: release main (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/973">#973</a>)</li>
<li><a
href="0b536ae0e9"><code>0b536ae</code></a>
chore: release main (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/970">#970</a>)</li>
<li>See full diff in <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.82.0...sdk-v0.84.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@anthropic-ai/sdk&package-manager=npm_and_yarn&previous-version=0.82.0&new-version=0.84.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentclientprotocol/claude-agent-acp/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-08 08:04:37 +02:00
dependabot[bot]
8acd0bd27f chore(deps): bump @hono/node-server from 1.19.12 to 1.19.13 (#521)
Bumps [@hono/node-server](https://github.com/honojs/node-server) from
1.19.12 to 1.19.13.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/honojs/node-server/releases"><code>@​hono/node-server</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v1.19.13</h2>
<h2>Security Fix</h2>
<p>Fixed an issue in Serve Static Middleware where inconsistent handling
of repeated slashes (<code>//</code>) between the router and static file
resolution could allow middleware to be bypassed. Users of Serve Static
Middleware are encouraged to upgrade to this version.</p>
<p>See GHSA-92pp-h63x-v22m for details.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fd64e659a3"><code>fd64e65</code></a>
1.19.13</li>
<li><a
href="025c30f55d"><code>025c30f</code></a>
Merge commit from fork</li>
<li>See full diff in <a
href="https://github.com/honojs/node-server/compare/v1.19.12...v1.19.13">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@hono/node-server&package-manager=npm_and_yarn&previous-version=1.19.12&new-version=1.19.13)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentclientprotocol/claude-agent-acp/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-08 08:04:11 +02:00
dependabot[bot]
4b82236c1f chore(deps): bump hono from 4.12.11 to 4.12.12 (#522)
Bumps [hono](https://github.com/honojs/hono) from 4.12.11 to 4.12.12.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/honojs/hono/releases">hono's
releases</a>.</em></p>
<blockquote>
<h2>v4.12.12</h2>
<h2>Security fixes</h2>
<p>This release includes fixes for the following security issues:</p>
<h3>Middleware bypass via repeated slashes in serveStatic</h3>
<p>Affects: Serve Static middleware. Fixes a path normalization
inconsistency where repeated slashes (<code>//</code>) could bypass
route-based middleware protections and allow access to protected static
files. GHSA-wmmm-f939-6g9c</p>
<h3>Path traversal in toSSG() allows writing files outside the output
directory</h3>
<p>Affects: <code>toSSG()</code> for Static Site Generation. Fixes a
path traversal issue where crafted <code>ssgParams</code> values could
write files outside the configured output directory.
GHSA-xf4j-xp2r-rqqx</p>
<h3>Incorrect IP matching in ipRestriction() for IPv4-mapped IPv6
addresses</h3>
<p>Affects: IP Restriction Middleware. Fixes improper handling of
IPv4-mapped IPv6 addresses (e.g. <code>::ffff:127.0.0.1</code>) that
could cause allow/deny rules to be bypassed. GHSA-xpcf-pg52-r92g</p>
<h3>Missing validation of cookie name on write path in setCookie()</h3>
<p>Affects: <code>setCookie()</code>, <code>serialize()</code>, and
<code>serializeSigned()</code> from <code>hono/cookie</code>. Fixes
missing validation of cookie names on the write path, preventing
inconsistent handling between parsing and serialization.
GHSA-26pp-8wgv-hjvm</p>
<h3>Non-breaking space prefix bypass in cookie name handling in
getCookie()</h3>
<p>Affects: <code>getCookie()</code> from <code>hono/cookie</code>.
Fixes a discrepancy in cookie name handling that could allow
attacker-controlled cookies to override legitimate ones and bypass
prefix protections. GHSA-r5rp-j6wh-rvv4</p>
<hr />
<p>Users who use Serve Static, Static Site Generation, Cookie utilities,
or IP restriction middleware are strongly encouraged to upgrade to this
version.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c37ba26da9"><code>c37ba26</code></a>
4.12.12</li>
<li><a
href="cc067c8559"><code>cc067c8</code></a>
Merge commit from fork</li>
<li><a
href="a586cd72e3"><code>a586cd7</code></a>
Merge commit from fork</li>
<li><a
href="48fa2233bc"><code>48fa223</code></a>
Merge commit from fork</li>
<li><a
href="b470278920"><code>b470278</code></a>
Merge commit from fork</li>
<li><a
href="9aff14bd72"><code>9aff14b</code></a>
Merge commit from fork</li>
<li>See full diff in <a
href="https://github.com/honojs/hono/compare/v4.12.11...v4.12.12">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=hono&package-manager=npm_and_yarn&previous-version=4.12.11&new-version=4.12.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentclientprotocol/claude-agent-acp/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-08 08:03:57 +02:00
acp-release-bot[bot]
0111786af2 chore(main): release 0.25.3 (#514)
🤖 I have created a release *beep* *boop*
---


##
[0.25.3](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.25.2...v0.25.3)
(2026-04-06)


### Bug Fixes

* Drop claude-agent-sdk back to 0.2.91 to fix broken import
([#513](https://github.com/agentclientprotocol/claude-agent-acp/issues/513))
([26f3e8a](26f3e8a521))
* Recreate resumed sessions when params change
([#515](https://github.com/agentclientprotocol/claude-agent-acp/issues/515))
([aa82193](aa82193330))

---
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-04-06 22:45:35 +02:00
Ben Brandt
aa82193330 fix: Recreate resumed sessions when params change (#515)
Closes #512

Fingerprint session-defining params to detect cwd or MCP server
changes, reuse sessions when unchanged, and ignore MCP server
ordering differences. Extract session teardown into a helper and add
tests covering reuse and recreation paths.
2026-04-06 22:44:14 +02:00
Ben Brandt
26f3e8a521 fix: Drop claude-agent-sdk back to 0.2.91 to fix broken import (#513)
Seems they released with a missing file that breaks the release builds.
2026-04-06 19:59:41 +00:00
acp-release-bot[bot]
769255c9a9 chore(main): release 0.25.2 (#511)
🤖 I have created a release *beep* *boop*
---


##
[0.25.2](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.25.1...v0.25.2)
(2026-04-06)


### Bug Fixes

* prioritize ANTHROPIC_MODEL env var over settings.model in model …
([#505](https://github.com/agentclientprotocol/claude-agent-acp/issues/505))
([bea1a40](bea1a40e9b))

---
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-04-06 21:50:32 +02:00
soddygo
bea1a40e9b fix: prioritize ANTHROPIC_MODEL env var over settings.model in model … (#505)
Title:
fix: ANTHROPIC_MODEL env var not respected in ACP agent model selection
                                                                  
Body:
   
## Summary
                                                                  
The `ANTHROPIC_MODEL` environment variable is not being respected when
using Claude Code via the ACP (Agent Client Protocol). This causes users
who set their preferred model via
environment variable to have their setting ignored, with the default
model (`claude-sonnet-4-6`) being used instead.
  ## Problem                                                      

When using Claude Code through ACP integrations (e.g., agent platforms),
users expect the `ANTHROPIC_MODEL` environment variable to control which
model is used for LLM requests.
However, the current implementation only checks `settings.model` (from
configuration files) and completely ignores `ANTHROPIC_MODEL`.
  ## Root Cause                                                   

In `src/acp-agent.ts`, the `getAvailableModels` function only checks
`settings.model`:

  ```typescript
  let currentModel = models[0];

if (settings.model) {
    const match = resolveModelPreference(models, settings.model);
if (match) {
      currentModel = match;                                       
    }
  }

The ANTHROPIC_MODEL environment variable is never read, so
environment-based model configuration is silently ignored.
   
Reproduction
                                                                  
1. Set ANTHROPIC_MODEL=glm-4.7 (or any custom model)
  2. Start Claude Code via ACP protocol
3. Send a prompt request
4. Capture network traffic - the actual model used is claude-sonnet-4-6
instead of glm-4.7
  Fix
Added priority-based model selection that respects the ANTHROPIC_MODEL
environment variable, aligning with the main Claude Code CLI behavior:
   
// Model priority (highest to lowest):
  // 1. ANTHROPIC_MODEL environment variable                      
  // 2. settings.model (user configuration)
// 3. models[0] (default first model)
  if (process.env.ANTHROPIC_MODEL) {
const match = resolveModelPreference(models,
process.env.ANTHROPIC_MODEL);
    if (match) {                                                  
      currentModel = match;
    }
  } else if (settings.model) {
const match = resolveModelPreference(models, settings.model);
    if (match) {
currentModel = match;
    }                                                             
  }

This matches the model selection priority used by the main Claude Code
CLI.
   
Testing
                                                                  
- Verified ANTHROPIC_MODEL is now respected when set
  - Verified settings.model still works when ANTHROPIC_MODEL is not set
- Verified default model (models[0]) is used when neither is set
  Breaking Change
None - this fix makes behavior more consistent with user expectations
and the main CLI.
2026-04-06 19:48:24 +00:00
dependabot[bot]
f9b15ba1c5 chore(deps): bump the minor group with 10 updates (#510)
Bumps the minor group with 10 updates:

| Package | From | To |
| --- | --- | --- |
|
[@anthropic-ai/claude-agent-sdk](https://github.com/anthropics/claude-agent-sdk-typescript)
| `0.2.91` | `0.2.92` |
|
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
| `25.5.1` | `25.5.2` |
| [eslint](https://github.com/eslint/eslint) | `10.1.0` | `10.2.0` |
|
[@eslint/config-array](https://github.com/eslint/rewrite/tree/HEAD/packages/config-array)
| `0.23.3` | `0.23.4` |
|
[@eslint/config-helpers](https://github.com/eslint/rewrite/tree/HEAD/packages/config-helpers)
| `0.5.3` | `0.5.4` |
|
[@eslint/core](https://github.com/eslint/rewrite/tree/HEAD/packages/core)
| `1.1.1` | `1.2.0` |
|
[@eslint/object-schema](https://github.com/eslint/rewrite/tree/HEAD/packages/object-schema)
| `3.0.3` | `3.0.4` |
|
[@eslint/plugin-kit](https://github.com/eslint/rewrite/tree/HEAD/packages/plugin-kit)
| `0.6.1` | `0.7.0` |
| [hono](https://github.com/honojs/hono) | `4.12.10` | `4.12.11` |
| [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) |
`8.0.3` | `8.0.5` |

Updates `@anthropic-ai/claude-agent-sdk` from 0.2.91 to 0.2.92
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/claude-agent-sdk-typescript/releases"><code>@​anthropic-ai/claude-agent-sdk</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v0.2.92</h2>
<h2>What's changed</h2>
<ul>
<li>Updated to parity with Claude Code v2.1.92</li>
</ul>
<h2>Update</h2>
<pre lang="sh"><code>npm install @anthropic-ai/claude-agent-sdk@0.2.92
# or
yarn add @anthropic-ai/claude-agent-sdk@0.2.92
# or
pnpm add @anthropic-ai/claude-agent-sdk@0.2.92
# or
bun add @anthropic-ai/claude-agent-sdk@0.2.92
</code></pre>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/claude-agent-sdk-typescript/blob/main/CHANGELOG.md"><code>@​anthropic-ai/claude-agent-sdk</code>'s
changelog</a>.</em></p>
<blockquote>
<h2>0.2.92</h2>
<ul>
<li>Updated to parity with Claude Code v2.1.92</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="4d9db79513"><code>4d9db79</code></a>
chore: Update CHANGELOG.md</li>
<li>See full diff in <a
href="https://github.com/anthropics/claude-agent-sdk-typescript/compare/v0.2.91...v0.2.92">compare
view</a></li>
</ul>
</details>
<br />

Updates `@types/node` from 25.5.1 to 25.5.2
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />

Updates `eslint` from 10.1.0 to 10.2.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/eslint/releases">eslint's
releases</a>.</em></p>
<blockquote>
<h2>v10.2.0</h2>
<h2>Features</h2>
<ul>
<li><a
href="586ec2f430"><code>586ec2f</code></a>
feat: Add <code>meta.languages</code> support to rules (<a
href="https://redirect.github.com/eslint/eslint/issues/20571">#20571</a>)
(Copilot)</li>
<li><a
href="14207dee39"><code>14207de</code></a>
feat: add <code>Temporal</code> to <code>no-obj-calls</code> (<a
href="https://redirect.github.com/eslint/eslint/issues/20675">#20675</a>)
(Pixel998)</li>
<li><a
href="bbb2c93a2b"><code>bbb2c93</code></a>
feat: add Temporal to ES2026 globals (<a
href="https://redirect.github.com/eslint/eslint/issues/20672">#20672</a>)
(Pixel998)</li>
</ul>
<h2>Bug Fixes</h2>
<ul>
<li><a
href="542cb3e644"><code>542cb3e</code></a>
fix: update first-party dependencies (<a
href="https://redirect.github.com/eslint/eslint/issues/20714">#20714</a>)
(Francesco Trotta)</li>
</ul>
<h2>Documentation</h2>
<ul>
<li><a
href="a2af743ea6"><code>a2af743</code></a>
docs: add <code>language</code> to configuration objects (<a
href="https://redirect.github.com/eslint/eslint/issues/20712">#20712</a>)
(Francesco Trotta)</li>
<li><a
href="845f23f137"><code>845f23f</code></a>
docs: Update README (GitHub Actions Bot)</li>
<li><a
href="5fbcf5958b"><code>5fbcf59</code></a>
docs: remove <code>sourceType</code> from ts playground link (<a
href="https://redirect.github.com/eslint/eslint/issues/20477">#20477</a>)
(Tanuj Kanti)</li>
<li><a
href="8702a47465"><code>8702a47</code></a>
docs: Update README (GitHub Actions Bot)</li>
<li><a
href="ddeaded2ab"><code>ddeaded</code></a>
docs: Update README (GitHub Actions Bot)</li>
<li><a
href="2b44966912"><code>2b44966</code></a>
docs: add Major Releases section to Manage Releases (<a
href="https://redirect.github.com/eslint/eslint/issues/20269">#20269</a>)
(Milos Djermanovic)</li>
<li><a
href="eab65c700e"><code>eab65c7</code></a>
docs: update <code>eslint</code> versions in examples (<a
href="https://redirect.github.com/eslint/eslint/issues/20664">#20664</a>)
(루밀LuMir)</li>
<li><a
href="3e4a29903b"><code>3e4a299</code></a>
docs: update ESM Dependencies policies with note for own-usage packages
(<a
href="https://redirect.github.com/eslint/eslint/issues/20660">#20660</a>)
(Milos Djermanovic)</li>
</ul>
<h2>Chores</h2>
<ul>
<li><a
href="8120e30f83"><code>8120e30</code></a>
refactor: extract no unmodified loop condition (<a
href="https://redirect.github.com/eslint/eslint/issues/20679">#20679</a>)
(kuldeep kumar)</li>
<li><a
href="46e8469786"><code>46e8469</code></a>
chore: update dependency markdownlint-cli2 to ^0.22.0 (<a
href="https://redirect.github.com/eslint/eslint/issues/20697">#20697</a>)
(renovate[bot])</li>
<li><a
href="01ed3aa684"><code>01ed3aa</code></a>
test: add unit tests for unicode utilities (<a
href="https://redirect.github.com/eslint/eslint/issues/20622">#20622</a>)
(Manish chaudhary)</li>
<li><a
href="811f4930f8"><code>811f493</code></a>
ci: remove <code>--legacy-peer-deps</code> from types integration tests
(<a
href="https://redirect.github.com/eslint/eslint/issues/20667">#20667</a>)
(Milos Djermanovic)</li>
<li><a
href="6b86fcfc5c"><code>6b86fcf</code></a>
chore: update dependency npm-run-all2 to v8 (<a
href="https://redirect.github.com/eslint/eslint/issues/20663">#20663</a>)
(renovate[bot])</li>
<li><a
href="632c4f83bf"><code>632c4f8</code></a>
chore: add <code>prettier</code> update commit to
<code>.git-blame-ignore-revs</code> (<a
href="https://redirect.github.com/eslint/eslint/issues/20662">#20662</a>)
(루밀LuMir)</li>
<li><a
href="b0b0f21927"><code>b0b0f21</code></a>
chore: update dependency eslint-plugin-regexp to ^3.1.0 (<a
href="https://redirect.github.com/eslint/eslint/issues/20659">#20659</a>)
(Milos Djermanovic)</li>
<li><a
href="228a2dd4b2"><code>228a2dd</code></a>
chore: update dependency eslint-plugin-eslint-plugin to ^7.3.2 (<a
href="https://redirect.github.com/eslint/eslint/issues/20661">#20661</a>)
(Milos Djermanovic)</li>
<li><a
href="3ab4d7e244"><code>3ab4d7e</code></a>
test: Add tests for eslintrc-style keys (<a
href="https://redirect.github.com/eslint/eslint/issues/20645">#20645</a>)
(kuldeep kumar)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="000128c292"><code>000128c</code></a>
10.2.0</li>
<li><a
href="1988fad70e"><code>1988fad</code></a>
Build: changelog update for 10.2.0</li>
<li><a
href="542cb3e644"><code>542cb3e</code></a>
fix: update first-party dependencies (<a
href="https://redirect.github.com/eslint/eslint/issues/20714">#20714</a>)</li>
<li><a
href="a2af743ea6"><code>a2af743</code></a>
docs: add <code>language</code> to configuration objects (<a
href="https://redirect.github.com/eslint/eslint/issues/20712">#20712</a>)</li>
<li><a
href="845f23f137"><code>845f23f</code></a>
docs: Update README</li>
<li><a
href="5fbcf5958b"><code>5fbcf59</code></a>
docs: remove <code>sourceType</code> from ts playground link (<a
href="https://redirect.github.com/eslint/eslint/issues/20477">#20477</a>)</li>
<li><a
href="8702a47465"><code>8702a47</code></a>
docs: Update README</li>
<li><a
href="ddeaded2ab"><code>ddeaded</code></a>
docs: Update README</li>
<li><a
href="8120e30f83"><code>8120e30</code></a>
refactor: extract no unmodified loop condition (<a
href="https://redirect.github.com/eslint/eslint/issues/20679">#20679</a>)</li>
<li><a
href="46e8469786"><code>46e8469</code></a>
chore: update dependency markdownlint-cli2 to ^0.22.0 (<a
href="https://redirect.github.com/eslint/eslint/issues/20697">#20697</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/eslint/eslint/compare/v10.1.0...v10.2.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `@eslint/config-array` from 0.23.3 to 0.23.4
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/releases"><code>@​eslint/config-array</code>'s
releases</a>.</em></p>
<blockquote>
<h2>config-array: v0.23.4</h2>
<h2><a
href="https://github.com/eslint/rewrite/compare/config-array-v0.23.3...config-array-v0.23.4">0.23.4</a>
(2026-04-03)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>The following workspace dependencies were updated
<ul>
<li>dependencies
<ul>
<li><code>@​eslint/object-schema</code> bumped from ^3.0.3 to
^3.0.4</li>
</ul>
</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/blob/main/packages/config-array/CHANGELOG.md"><code>@​eslint/config-array</code>'s
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/eslint/rewrite/compare/config-array-v0.23.3...config-array-v0.23.4">0.23.4</a>
(2026-04-03)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>The following workspace dependencies were updated
<ul>
<li>dependencies
<ul>
<li><code>@​eslint/object-schema</code> bumped from ^3.0.3 to
^3.0.4</li>
</ul>
</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fe114eed69"><code>fe114ee</code></a>
chore: release main (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/config-array/issues/413">#413</a>)</li>
<li><a
href="8863791972"><code>8863791</code></a>
docs: Update README sponsors</li>
<li><a
href="ef16f80b92"><code>ef16f80</code></a>
fix: re-export ESM types in CommonJS (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/config-array/issues/416">#416</a>)</li>
<li><a
href="835ddf95b0"><code>835ddf9</code></a>
docs: Update README sponsors</li>
<li><a
href="8cd3676402"><code>8cd3676</code></a>
docs: Update README sponsors</li>
<li><a
href="4d734592f3"><code>4d73459</code></a>
docs: Update README sponsors</li>
<li>See full diff in <a
href="https://github.com/eslint/rewrite/commits/config-array-v0.23.4/packages/config-array">compare
view</a></li>
</ul>
</details>
<br />

Updates `@eslint/config-helpers` from 0.5.3 to 0.5.4
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/releases"><code>@​eslint/config-helpers</code>'s
releases</a>.</em></p>
<blockquote>
<h2>config-helpers: v0.5.4</h2>
<h2><a
href="https://github.com/eslint/rewrite/compare/config-helpers-v0.5.3...config-helpers-v0.5.4">0.5.4</a>
(2026-04-03)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>The following workspace dependencies were updated
<ul>
<li>dependencies
<ul>
<li><code>@​eslint/core</code> bumped from ^1.1.1 to ^1.2.0</li>
</ul>
</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/blob/main/packages/config-helpers/CHANGELOG.md"><code>@​eslint/config-helpers</code>'s
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/eslint/rewrite/compare/config-helpers-v0.5.3...config-helpers-v0.5.4">0.5.4</a>
(2026-04-03)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>The following workspace dependencies were updated
<ul>
<li>dependencies
<ul>
<li><code>@​eslint/core</code> bumped from ^1.1.1 to ^1.2.0</li>
</ul>
</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fe114eed69"><code>fe114ee</code></a>
chore: release main (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/config-helpers/issues/413">#413</a>)</li>
<li><a
href="8863791972"><code>8863791</code></a>
docs: Update README sponsors</li>
<li><a
href="ef16f80b92"><code>ef16f80</code></a>
fix: re-export ESM types in CommonJS (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/config-helpers/issues/416">#416</a>)</li>
<li><a
href="835ddf95b0"><code>835ddf9</code></a>
docs: Update README sponsors</li>
<li><a
href="8cd3676402"><code>8cd3676</code></a>
docs: Update README sponsors</li>
<li><a
href="4d734592f3"><code>4d73459</code></a>
docs: Update README sponsors</li>
<li><a
href="a6c7a26a85"><code>a6c7a26</code></a>
chore: update <code>eslint</code> and <code>eslint-config-eslint</code>
(<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/config-helpers/issues/401">#401</a>)</li>
<li>See full diff in <a
href="https://github.com/eslint/rewrite/commits/config-helpers-v0.5.4/packages/config-helpers">compare
view</a></li>
</ul>
</details>
<br />

Updates `@eslint/core` from 1.1.1 to 1.2.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/releases"><code>@​eslint/core</code>'s
releases</a>.</em></p>
<blockquote>
<h2>core: v1.2.0</h2>
<h2><a
href="https://github.com/eslint/rewrite/compare/core-v1.1.1...core-v1.2.0">1.2.0</a>
(2026-04-03)</h2>
<h3>Features</h3>
<ul>
<li>add <code>languages</code> and <code>docs.dialects</code> to rule
<code>meta</code> types (<a
href="https://redirect.github.com/eslint/rewrite/issues/421">#421</a>)
(<a
href="7680f69211">7680f69</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
<li>type-check defaultLanguageOptions against LangOptions (<a
href="https://redirect.github.com/eslint/rewrite/issues/420">#420</a>)
(<a
href="7bf57046b8">7bf5704</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/blob/main/packages/core/CHANGELOG.md"><code>@​eslint/core</code>'s
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/eslint/rewrite/compare/core-v1.1.1...core-v1.2.0">1.2.0</a>
(2026-04-03)</h2>
<h3>Features</h3>
<ul>
<li>add <code>languages</code> and <code>docs.dialects</code> to rule
<code>meta</code> types (<a
href="https://redirect.github.com/eslint/rewrite/issues/421">#421</a>)
(<a
href="7680f69211">7680f69</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
<li>type-check defaultLanguageOptions against LangOptions (<a
href="https://redirect.github.com/eslint/rewrite/issues/420">#420</a>)
(<a
href="7bf57046b8">7bf5704</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fe114eed69"><code>fe114ee</code></a>
chore: release main (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/core/issues/413">#413</a>)</li>
<li><a
href="7680f69211"><code>7680f69</code></a>
feat: add <code>languages</code> and <code>docs.dialects</code> to rule
<code>meta</code> types (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/core/issues/421">#421</a>)</li>
<li><a
href="8863791972"><code>8863791</code></a>
docs: Update README sponsors</li>
<li><a
href="ef16f80b92"><code>ef16f80</code></a>
fix: re-export ESM types in CommonJS (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/core/issues/416">#416</a>)</li>
<li><a
href="835ddf95b0"><code>835ddf9</code></a>
docs: Update README sponsors</li>
<li><a
href="8cd3676402"><code>8cd3676</code></a>
docs: Update README sponsors</li>
<li><a
href="7bf57046b8"><code>7bf5704</code></a>
fix: type-check defaultLanguageOptions against LangOptions (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/core/issues/420">#420</a>)</li>
<li><a
href="4d734592f3"><code>4d73459</code></a>
docs: Update README sponsors</li>
<li>See full diff in <a
href="https://github.com/eslint/rewrite/commits/core-v1.2.0/packages/core">compare
view</a></li>
</ul>
</details>
<br />

Updates `@eslint/object-schema` from 3.0.3 to 3.0.4
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/releases"><code>@​eslint/object-schema</code>'s
releases</a>.</em></p>
<blockquote>
<h2>object-schema: v3.0.4</h2>
<h2><a
href="https://github.com/eslint/rewrite/compare/object-schema-v3.0.3...object-schema-v3.0.4">3.0.4</a>
(2026-04-03)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>avoid mutating object schema definitions during construction (<a
href="https://redirect.github.com/eslint/rewrite/issues/412">#412</a>)
(<a
href="f0fd9a2ff7">f0fd9a2</a>)</li>
<li>correct ValidationStrategy parameter types (<a
href="https://redirect.github.com/eslint/rewrite/issues/406">#406</a>)
(<a
href="42a30eaae5">42a30ea</a>)</li>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/blob/main/packages/object-schema/CHANGELOG.md"><code>@​eslint/object-schema</code>'s
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/eslint/rewrite/compare/object-schema-v3.0.3...object-schema-v3.0.4">3.0.4</a>
(2026-04-03)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>avoid mutating object schema definitions during construction (<a
href="https://redirect.github.com/eslint/rewrite/issues/412">#412</a>)
(<a
href="f0fd9a2ff7">f0fd9a2</a>)</li>
<li>correct ValidationStrategy parameter types (<a
href="https://redirect.github.com/eslint/rewrite/issues/406">#406</a>)
(<a
href="42a30eaae5">42a30ea</a>)</li>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fe114eed69"><code>fe114ee</code></a>
chore: release main (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/object-schema/issues/413">#413</a>)</li>
<li><a
href="8863791972"><code>8863791</code></a>
docs: Update README sponsors</li>
<li><a
href="ef16f80b92"><code>ef16f80</code></a>
fix: re-export ESM types in CommonJS (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/object-schema/issues/416">#416</a>)</li>
<li><a
href="835ddf95b0"><code>835ddf9</code></a>
docs: Update README sponsors</li>
<li><a
href="8cd3676402"><code>8cd3676</code></a>
docs: Update README sponsors</li>
<li><a
href="b281abb94e"><code>b281abb</code></a>
docs: clarify ValidationStrategy object behavior (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/object-schema/issues/415">#415</a>)</li>
<li><a
href="42a30eaae5"><code>42a30ea</code></a>
fix: correct ValidationStrategy parameter types (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/object-schema/issues/406">#406</a>)</li>
<li><a
href="f0fd9a2ff7"><code>f0fd9a2</code></a>
fix: avoid mutating object schema definitions during construction (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/object-schema/issues/412">#412</a>)</li>
<li><a
href="9189536016"><code>9189536</code></a>
refactor: use lowercase boolean in validation errors (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/object-schema/issues/405">#405</a>)</li>
<li><a
href="4d734592f3"><code>4d73459</code></a>
docs: Update README sponsors</li>
<li>See full diff in <a
href="https://github.com/eslint/rewrite/commits/object-schema-v3.0.4/packages/object-schema">compare
view</a></li>
</ul>
</details>
<br />

Updates `@eslint/plugin-kit` from 0.6.1 to 0.7.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/releases"><code>@​eslint/plugin-kit</code>'s
releases</a>.</em></p>
<blockquote>
<h2>plugin-kit: v0.7.0</h2>
<h2><a
href="https://github.com/eslint/rewrite/compare/plugin-kit-v0.6.1...plugin-kit-v0.7.0">0.7.0</a>
(2026-04-03)</h2>
<h3>Features</h3>
<ul>
<li>add <code>languages</code> and <code>docs.dialects</code> to rule
<code>meta</code> types (<a
href="https://redirect.github.com/eslint/rewrite/issues/421">#421</a>)
(<a
href="7680f69211">7680f69</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>The following workspace dependencies were updated
<ul>
<li>dependencies
<ul>
<li><code>@​eslint/core</code> bumped from ^1.1.1 to ^1.2.0</li>
</ul>
</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/eslint/rewrite/blob/main/packages/plugin-kit/CHANGELOG.md"><code>@​eslint/plugin-kit</code>'s
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/eslint/rewrite/compare/plugin-kit-v0.6.1...plugin-kit-v0.7.0">0.7.0</a>
(2026-04-03)</h2>
<h3>Features</h3>
<ul>
<li>add <code>languages</code> and <code>docs.dialects</code> to rule
<code>meta</code> types (<a
href="https://redirect.github.com/eslint/rewrite/issues/421">#421</a>)
(<a
href="7680f69211">7680f69</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>re-export ESM types in CommonJS (<a
href="https://redirect.github.com/eslint/rewrite/issues/416">#416</a>)
(<a
href="ef16f80b92">ef16f80</a>)</li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>The following workspace dependencies were updated
<ul>
<li>dependencies
<ul>
<li><code>@​eslint/core</code> bumped from ^1.1.1 to ^1.2.0</li>
</ul>
</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="80eb5455aa"><code>80eb545</code></a>
chore: release main (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/plugin-kit/issues/124">#124</a>)</li>
<li><a
href="0008606415"><code>0008606</code></a>
docs: Use prerendered sponsors for README (<a
href="https://github.com/eslint/rewrite/tree/HEAD/packages/plugin-kit/issues/122">#122</a>)</li>
<li><a
href="169d83bf82"><code>169d83b</code></a>
docs: Update README sponsors</li>
<li><a
href="8d2509a218"><code>8d2509a</code></a>
docs: Update README sponsors</li>
<li><a
href="dcacd03f4b"><code>dcacd03</code></a>
docs: Update README sponsors</li>
<li><a
href="002a6da6e3"><code>002a6da</code></a>
docs: Update README sponsors</li>
<li><a
href="5cb3dad034"><code>5cb3dad</code></a>
docs: Update README sponsors</li>
<li><a
href="dc69bd15a5"><code>dc69bd1</code></a>
docs: Update README sponsors</li>
<li><a
href="47db20bc82"><code>47db20b</code></a>
docs: Update README sponsors</li>
<li><a
href="9dbefdff4f"><code>9dbefdf</code></a>
docs: Update README sponsors</li>
<li>Additional commits viewable in <a
href="https://github.com/eslint/rewrite/commits/core-v0.7.0/packages/plugin-kit">compare
view</a></li>
</ul>
</details>
<br />

Updates `hono` from 4.12.10 to 4.12.11
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/honojs/hono/releases">hono's
releases</a>.</em></p>
<blockquote>
<h2>v4.12.11</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(css): add classNameSlug option to createCssContext by <a
href="https://github.com/flow-pie"><code>@​flow-pie</code></a> in <a
href="https://redirect.github.com/honojs/hono/pull/4834">honojs/hono#4834</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/flow-pie"><code>@​flow-pie</code></a>
made their first contribution in <a
href="https://redirect.github.com/honojs/hono/pull/4834">honojs/hono#4834</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/honojs/hono/compare/v4.12.10...v4.12.11">https://github.com/honojs/hono/compare/v4.12.10...v4.12.11</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2c403c67eb"><code>2c403c6</code></a>
4.12.11</li>
<li><a
href="f82aba8e8e"><code>f82aba8</code></a>
feat(css): add classNameSlug option to createCssContext (<a
href="https://redirect.github.com/honojs/hono/issues/4834">#4834</a>)</li>
<li>See full diff in <a
href="https://github.com/honojs/hono/compare/v4.12.10...v4.12.11">compare
view</a></li>
</ul>
</details>
<br />

Updates `vite` from 8.0.3 to 8.0.5
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vitejs/vite/releases">vite's
releases</a>.</em></p>
<blockquote>
<h2>v8.0.5</h2>
<p>Please refer to <a
href="https://github.com/vitejs/vite/blob/v8.0.5/packages/vite/CHANGELOG.md">CHANGELOG.md</a>
for details.</p>
<h2>v8.0.4</h2>
<p>Please refer to <a
href="https://github.com/vitejs/vite/blob/v8.0.4/packages/vite/CHANGELOG.md">CHANGELOG.md</a>
for details.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md">vite's
changelog</a>.</em></p>
<blockquote>
<h2><!-- raw HTML omitted --><a
href="https://github.com/vitejs/vite/compare/v8.0.4...v8.0.5">8.0.5</a>
(2026-04-06)<!-- raw HTML omitted --></h2>
<h3>Bug Fixes</h3>
<ul>
<li>apply server.fs check to env transport (<a
href="https://redirect.github.com/vitejs/vite/issues/22159">#22159</a>)
(<a
href="f02d9fde0b">f02d9fd</a>)</li>
<li>avoid path traversal with optimize deps sourcemap handler (<a
href="https://redirect.github.com/vitejs/vite/issues/22161">#22161</a>)
(<a
href="79f002f228">79f002f</a>)</li>
<li>check <code>server.fs</code> after stripping query as well (<a
href="https://redirect.github.com/vitejs/vite/issues/22160">#22160</a>)
(<a
href="a9a3df2993">a9a3df2</a>)</li>
<li>disallow referencing files outside the package from sourcemap (<a
href="https://redirect.github.com/vitejs/vite/issues/22158">#22158</a>)
(<a
href="f05f501734">f05f501</a>)</li>
</ul>
<h2><!-- raw HTML omitted --><a
href="https://github.com/vitejs/vite/compare/v8.0.3...v8.0.4">8.0.4</a>
(2026-04-06)<!-- raw HTML omitted --></h2>
<h3>Features</h3>
<ul>
<li>allow esbuild 0.28 as peer deps (<a
href="https://redirect.github.com/vitejs/vite/issues/22155">#22155</a>)
(<a
href="b0da97372f">b0da973</a>)</li>
<li><strong>hmr:</strong> truncate list of files on hmr update (<a
href="https://redirect.github.com/vitejs/vite/issues/21535">#21535</a>)
(<a
href="d00e806d7b">d00e806</a>)</li>
<li><strong>optimizer:</strong> log when dependency scanning or bundling
takes over 1s (<a
href="https://redirect.github.com/vitejs/vite/issues/21797">#21797</a>)
(<a
href="f61a1ab33b">f61a1ab</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><code>hasBothRollupOptionsAndRolldownOptions</code> should return
<code>false</code> for proxy case (<a
href="https://redirect.github.com/vitejs/vite/issues/22043">#22043</a>)
(<a
href="99897d27b4">99897d2</a>)</li>
<li>add types for <code>vite/modulepreload-polyfill</code> (<a
href="https://redirect.github.com/vitejs/vite/issues/22126">#22126</a>)
(<a
href="17330d2b9e">17330d2</a>)</li>
<li><strong>deps:</strong> update all non-major dependencies (<a
href="https://redirect.github.com/vitejs/vite/issues/22073">#22073</a>)
(<a
href="6daa10ff1e">6daa10f</a>)</li>
<li><strong>deps:</strong> update all non-major dependencies (<a
href="https://redirect.github.com/vitejs/vite/issues/22143">#22143</a>)
(<a
href="22b0166127">22b0166</a>)</li>
<li><strong>resolve:</strong> resolve tsconfig paths starting with
<code>#</code> (<a
href="https://redirect.github.com/vitejs/vite/issues/22038">#22038</a>)
(<a
href="3460fc55aa">3460fc5</a>)</li>
<li><strong>ssr:</strong> use browser platform for webworker SSR builds
(fix <a
href="https://redirect.github.com/vitejs/vite/issues/21969">#21969</a>)
(<a
href="https://redirect.github.com/vitejs/vite/issues/21963">#21963</a>)
(<a
href="364c2273a1">364c227</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>add <code>environment.fetchModule</code> documentation (<a
href="https://redirect.github.com/vitejs/vite/issues/22035">#22035</a>)
(<a
href="54229e7863">54229e7</a>)</li>
</ul>
<h3>Miscellaneous Chores</h3>
<ul>
<li><strong>deps:</strong> update rolldown-related dependencies (<a
href="https://redirect.github.com/vitejs/vite/issues/21989">#21989</a>)
(<a
href="0ded627457">0ded627</a>)</li>
</ul>
<h3>Code Refactoring</h3>
<ul>
<li>upgrade to typescript 6 (<a
href="https://redirect.github.com/vitejs/vite/issues/22110">#22110</a>)
(<a
href="cc41398c2c">cc41398</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1a12d4ca4c"><code>1a12d4c</code></a>
release: v8.0.5</li>
<li><a
href="79f002f228"><code>79f002f</code></a>
fix: avoid path traversal with optimize deps sourcemap handler (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/22161">#22161</a>)</li>
<li><a
href="a9a3df2993"><code>a9a3df2</code></a>
fix: check <code>server.fs</code> after stripping query as well (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/22160">#22160</a>)</li>
<li><a
href="f02d9fde0b"><code>f02d9fd</code></a>
fix: apply server.fs check to env transport (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/22159">#22159</a>)</li>
<li><a
href="f05f501734"><code>f05f501</code></a>
fix: disallow referencing files outside the package from sourcemap (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/22158">#22158</a>)</li>
<li><a
href="7339bdc915"><code>7339bdc</code></a>
release: v8.0.4</li>
<li><a
href="54229e7863"><code>54229e7</code></a>
docs: add <code>environment.fetchModule</code> documentation (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/22035">#22035</a>)</li>
<li><a
href="b0da97372f"><code>b0da973</code></a>
feat: allow esbuild 0.28 as peer deps (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/22155">#22155</a>)</li>
<li><a
href="22b0166127"><code>22b0166</code></a>
fix(deps): update all non-major dependencies (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/22143">#22143</a>)</li>
<li><a
href="17330d2b9e"><code>17330d2</code></a>
fix: add types for <code>vite/modulepreload-polyfill</code> (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/22126">#22126</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vitejs/vite/commits/v8.0.5/packages/vite">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-06 19:31:14 +02:00
acp-release-bot[bot]
0990a8e520 chore(main): release 0.25.1 (#509)
🤖 I have created a release *beep* *boop*
---


##
[0.25.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.25.0...v0.25.1)
(2026-04-06)


### Bug Fixes

* add `auto` to valid modes in applySessionMode to fix mode cycling
([#507](https://github.com/agentclientprotocol/claude-agent-acp/issues/507))
([15e91fb](15e91fb5c3))

---
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-04-06 09:01:18 +02:00
K4YT3X
15e91fb5c3 fix: add auto to valid modes in applySessionMode to fix mode cycling (#507)
ACP version is `v0.25.0`. Should be the newest.

I get this error when pressing Shift+Tab to cycle through the modes:

```
Caused by:
    RPC request LspQuery failed: unknown buffer id 12884902333
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: Error handling request {
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: jsonrpc: '2.0',
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: id: 48,
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: method: 'session/set_config_option',
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: params: {
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: sessionId: '$UUID_GOES_HERE',
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: configId: 'mode',
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: value: 'auto'
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: }
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: } {
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: code: -32603,
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: message: 'Internal error',
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: data: { details: 'Invalid Mode' }
2026-04-05T21:46:02+00:00 WARN  [agent_servers::acp] agent stderr: }
2026-04-05T21:46:02+00:00 ERROR [agent_ui::config_options] Failed to set config option: Internal error: {
  "details": "Invalid Mode"
}
```

I looked through the code on both sides and I think what might be
happening is, here are the modes:


f422c7c954/src/acp-agent.ts (L236-L244)

When a user gets to `bypassPermissions` and cycle again, the next
selected mode is `auto` but that option seems to be missing from here:


f422c7c954/src/acp-agent.ts (L1007-L1013)

Could the maintainers please help verify and test?

Signed-off-by: k4yt3x <i@k4yt3x.com>
2026-04-06 06:59:16 +00:00
14 changed files with 1972 additions and 429 deletions

View File

@@ -16,14 +16,14 @@ jobs:
# Generating a GitHub token, so that PRs and tags created by
# the release-please-action can trigger actions workflows.
- name: Generate GitHub token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3
id: generate-token
with:
# GitHub App ID secret name
app-id: ${{ secrets.RELEASE_PLZ_APP_ID }}
# GitHub App private key secret name
private-key: ${{ secrets.RELEASE_PLZ_APP_PRIVATE_KEY }}
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38
- uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071
id: release
with:
token: ${{ steps.generate-token.outputs.token }}
@@ -38,7 +38,8 @@ jobs:
name: Build (${{ matrix.target }})
runs-on: ubuntu-latest
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
# TODO: Re-enable once Bun SDK compatibility is fixed
if: false
permissions:
contents: read
timeout-minutes: 15
@@ -99,7 +100,7 @@ jobs:
fi
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: ${{ matrix.archive }}
path: ${{ matrix.archive }}
@@ -107,7 +108,7 @@ jobs:
publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
needs: [build-binaries, release-please]
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
environment: release # Optional: for enhanced security
permissions:
@@ -129,8 +130,9 @@ jobs:
release:
name: Create Release
runs-on: ubuntu-latest
needs: [build-binaries, publish-npm, release-please]
if: ${{ needs.release-please.outputs.release_created }}
needs: [publish-npm, release-please]
# TODO: Re-enable once Bun SDK compatibility is fixed
if: false
permissions:
contents: write

View File

@@ -1,3 +1,3 @@
{
".": "0.25.0"
".": "0.29.1"
}

View File

@@ -1,5 +1,81 @@
# Changelog
## [0.29.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.29.0...v0.29.1) (2026-04-17)
### Bug Fixes
* emit usage updates from Claude stream events ([#506](https://github.com/agentclientprotocol/claude-agent-acp/issues/506)) ([dd67450](https://github.com/agentclientprotocol/claude-agent-acp/commit/dd67450fd9bddc82db3e71273b535e07b2672804))
* Remove dot from auto mode description ([#561](https://github.com/agentclientprotocol/claude-agent-acp/issues/561)) ([2ecfa83](https://github.com/agentclientprotocol/claude-agent-acp/commit/2ecfa83b26db58deaded210463fa6ff21d0dff70))
* Update to claude-agent-sdk 0.2.112 to fix Auto bug with Opus 4.7 ([#562](https://github.com/agentclientprotocol/claude-agent-acp/issues/562)) ([079614a](https://github.com/agentclientprotocol/claude-agent-acp/commit/079614ab05afba17e2cce0d3d238df7b90e17389))
## [0.29.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.28.0...v0.29.0) (2026-04-16)
### Features
* Update to claude-agent-sdk 0.2.111 (Opus 4.7) ([#557](https://github.com/agentclientprotocol/claude-agent-acp/issues/557)) ([85cd70c](https://github.com/agentclientprotocol/claude-agent-acp/commit/85cd70c9f3be47c9c404958547c4046d866db1c9))
## [0.28.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.27.0...v0.28.0) (2026-04-15)
### Features
* Update to claude-agent-sdk 0.2.109 ([#549](https://github.com/agentclientprotocol/claude-agent-acp/issues/549)) ([07a0fbc](https://github.com/agentclientprotocol/claude-agent-acp/commit/07a0fbc2f6bc388541d064a436412bdd850772cb))
## [0.27.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.26.0...v0.27.0) (2026-04-13)
### Features
* allow clients to opt into receiving raw SDK messages ([#527](https://github.com/agentclientprotocol/claude-agent-acp/issues/527)) ([403a668](https://github.com/agentclientprotocol/claude-agent-acp/commit/403a668078c067868062ed26cd4d3e36665b66b6))
* Update to claude-agent-sdk 0.2.104 ([#537](https://github.com/agentclientprotocol/claude-agent-acp/issues/537)) ([6811943](https://github.com/agentclientprotocol/claude-agent-acp/commit/6811943f57ef08616be633a8197223d4072663cf))
### Bug Fixes
* Allow auto mode after plan mode and send description for auto mode ([#528](https://github.com/agentclientprotocol/claude-agent-acp/issues/528)) ([fb9aced](https://github.com/agentclientprotocol/claude-agent-acp/commit/fb9aced3151c40694f1f01fd95665c4f5d90eb67))
* Better remote check for auth methods ([#538](https://github.com/agentclientprotocol/claude-agent-acp/issues/538)) ([93f58c0](https://github.com/agentclientprotocol/claude-agent-acp/commit/93f58c0d2fcf7365c7ca5a6e52f56663e2065ddb))
* better shutdown logic ([#543](https://github.com/agentclientprotocol/claude-agent-acp/issues/543)) ([9fb631f](https://github.com/agentclientprotocol/claude-agent-acp/commit/9fb631f5d76a5c5f6f0a1b61bdef05fe368c754c))
* exit process when ACP connection closes ([#530](https://github.com/agentclientprotocol/claude-agent-acp/issues/530)) ([5c81e99](https://github.com/agentclientprotocol/claude-agent-acp/commit/5c81e99fe5ccdf774819b7ff3a2bc78a6519d730))
* guard tool info rendering when tool_use input is undefined ([#536](https://github.com/agentclientprotocol/claude-agent-acp/issues/536)) ([d627b8c](https://github.com/agentclientprotocol/claude-agent-acp/commit/d627b8c5e95be31ac03923ef67d91748ec8564c5))
* Remove backup auth check from new session ([#544](https://github.com/agentclientprotocol/claude-agent-acp/issues/544)) ([32b16c1](https://github.com/agentclientprotocol/claude-agent-acp/commit/32b16c1ad99394238b0e5cd6c2f761c12debe142))
## [0.26.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.25.3...v0.26.0) (2026-04-08)
### Features
* Update claude-agent-sdk to 0.2.96 ([#526](https://github.com/agentclientprotocol/claude-agent-acp/issues/526)) ([c073131](https://github.com/agentclientprotocol/claude-agent-acp/commit/c07313148808a55f27f385c10babbaf7511a7f12))
### Bug Fixes
* Remove bun builds from release ([#525](https://github.com/agentclientprotocol/claude-agent-acp/issues/525)) ([fcf5aaf](https://github.com/agentclientprotocol/claude-agent-acp/commit/fcf5aaf06dfe9f7d1b285b976eeb2d1e20ea8dec))
* Use TUI login for remote environments ([#523](https://github.com/agentclientprotocol/claude-agent-acp/issues/523)) ([cc73e37](https://github.com/agentclientprotocol/claude-agent-acp/commit/cc73e37b41678aa67813c4fbef66ba33ca538743))
## [0.25.3](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.25.2...v0.25.3) (2026-04-06)
### Bug Fixes
* Drop claude-agent-sdk back to 0.2.91 to fix broken import ([#513](https://github.com/agentclientprotocol/claude-agent-acp/issues/513)) ([26f3e8a](https://github.com/agentclientprotocol/claude-agent-acp/commit/26f3e8a5216295985fadb80fb3b977045c0c1b2c))
* Recreate resumed sessions when params change ([#515](https://github.com/agentclientprotocol/claude-agent-acp/issues/515)) ([aa82193](https://github.com/agentclientprotocol/claude-agent-acp/commit/aa82193330026bae132fed8391c47dde777dcf5a))
## [0.25.2](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.25.1...v0.25.2) (2026-04-06)
### Bug Fixes
* prioritize ANTHROPIC_MODEL env var over settings.model in model … ([#505](https://github.com/agentclientprotocol/claude-agent-acp/issues/505)) ([bea1a40](https://github.com/agentclientprotocol/claude-agent-acp/commit/bea1a40e9bfe1e06672b118a727f9339def3be23))
## [0.25.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.25.0...v0.25.1) (2026-04-06)
### Bug Fixes
* add `auto` to valid modes in applySessionMode to fix mode cycling ([#507](https://github.com/agentclientprotocol/claude-agent-acp/issues/507)) ([15e91fb](https://github.com/agentclientprotocol/claude-agent-acp/commit/15e91fb5c3449de2600b583cb7a8d36b5b510443))
## [0.25.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.24.2...v0.25.0) (2026-04-03)

619
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
"publishConfig": {
"access": "public"
},
"version": "0.25.0",
"version": "0.29.1",
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
"main": "dist/lib.js",
"types": "dist/lib.d.ts",
@@ -60,22 +60,22 @@
"author": "Zed Industries",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "0.18.0",
"@anthropic-ai/claude-agent-sdk": "0.2.91",
"@agentclientprotocol/sdk": "0.19.0",
"@anthropic-ai/claude-agent-sdk": "0.2.112",
"zod": "^3.25.0 || ^4.0.0"
},
"devDependencies": {
"@anthropic-ai/sdk": "0.82.0",
"@anthropic-ai/sdk": "0.89.0",
"@eslint/js": "10.0.1",
"@types/node": "25.5.1",
"@typescript-eslint/eslint-plugin": "8.58.0",
"@typescript-eslint/parser": "8.58.0",
"eslint": "10.1.0",
"@types/node": "25.6.0",
"@typescript-eslint/eslint-plugin": "8.58.2",
"@typescript-eslint/parser": "8.58.2",
"eslint": "10.2.0",
"eslint-config-prettier": "10.1.8",
"globals": "17.4.0",
"prettier": "3.8.1",
"globals": "17.5.0",
"prettier": "3.8.3",
"ts-node": "10.9.2",
"typescript": "6.0.2",
"vitest": "4.1.2"
"typescript": "6.0.3",
"vitest": "4.1.4"
}
}

View File

@@ -54,14 +54,12 @@ import {
Query,
query,
SDKPartialAssistantMessage,
SDKResultMessage,
SDKUserMessage,
SlashCommand,
} from "@anthropic-ai/claude-agent-sdk";
import { ContentBlockParam } from "@anthropic-ai/sdk/resources";
import { BetaContentBlock, BetaRawContentBlockDelta } from "@anthropic-ai/sdk/resources/beta.mjs";
import { randomUUID } from "node:crypto";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import packageJson from "../package.json" with { type: "json" };
@@ -109,11 +107,30 @@ type AccumulatedUsage = {
cachedWriteTokens: number;
};
type UsageSnapshot = {
input_tokens: number;
output_tokens: number;
cache_read_input_tokens: number;
cache_creation_input_tokens: number;
};
const ZERO_USAGE = Object.freeze({
input_tokens: 0,
output_tokens: 0,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
});
const DEFAULT_CONTEXT_WINDOW = 200000;
type Session = {
query: Query;
input: Pushable<SDKUserMessage>;
cancelled: boolean;
cwd: string;
/** Serialized snapshot of session-defining params (cwd, mcpServers) used to
* detect when loadSession/resumeSession is called with changed values. */
sessionFingerprint: string;
settingsManager: SettingsManager;
accumulatedUsage: AccumulatedUsage;
modes: SessionModeState;
@@ -123,8 +140,27 @@ type Session = {
pendingMessages: Map<string, { resolve: (cancelled: boolean) => void; order: number }>;
nextPendingOrder: number;
abortController: AbortController;
emitRawSDKMessages: boolean | SDKMessageFilter[];
/** Context window size of the last top-level assistant model, carried across
* prompts so mid-stream usage_update notifications report a correct `size`
* before the turn's first result message arrives. Defaults to
* DEFAULT_CONTEXT_WINDOW, refreshed from each result's modelUsage, and
* invalidated when the user switches the session's model. */
contextWindowSize: number;
};
/** Compute a stable fingerprint of the session-defining params so we can
* detect when a loadSession/resumeSession call requires tearing down and
* recreating the underlying Query process. MCP servers are sorted by name
* so that ordering differences don't trigger unnecessary recreations. */
function computeSessionFingerprint(params: {
cwd: string;
mcpServers?: NewSessionRequest["mcpServers"];
}): string {
const servers = [...(params.mcpServers ?? [])].sort((a, b) => a.name.localeCompare(b.name));
return JSON.stringify({ cwd: params.cwd, mcpServers: servers });
}
type BackgroundTerminal =
| {
handle: TerminalHandle;
@@ -136,6 +172,11 @@ type BackgroundTerminal =
pendingOutput: TerminalOutputResponse;
};
export type SDKMessageFilter = {
type: string;
subtype?: string;
};
/**
* Extra metadata that can be given when creating a new session.
*/
@@ -157,6 +198,14 @@ export type NewSessionMeta = {
* - tools (passed through; defaults to claude_code preset if not provided)
*/
options?: Options;
/**
* When set, raw SDK messages are emitted as extNotification("_claude/sdkMessage", message)
* in addition to normal processing.
* - true: emit all messages
* - false/undefined: emit nothing (default)
* - SDKMessageFilter[]: emit only messages matching at least one filter
*/
emitRawSDKMessages?: boolean | SDKMessageFilter[];
};
additionalRoots?: string[];
};
@@ -311,39 +360,82 @@ export class ClaudeAcpAgent implements Agent {
const supportsTerminalAuth = request.clientCapabilities?.auth?.terminal === true;
const supportsMetaTerminalAuth = request.clientCapabilities?._meta?.["terminal-auth"] === true;
const claudeLoginMethod: any = {
description: "Use Claude subscription ",
name: "Claude Subscription",
id: "claude-ai-login",
type: "terminal",
args: ["--cli", "auth", "login", "--claudeai"],
};
// Detect remote environments where the OAuth browser redirect to localhost
// won't work. This matches the SDK's internal isRemote check. In these cases,
// the `auth login` subcommand would fall back to a device-code-like manual
// flow, which doesn't work well over ACP, so we offer the TUI login instead.
const isRemote = !!(
process.env.NO_BROWSER ||
process.env.SSH_CONNECTION ||
process.env.SSH_CLIENT ||
process.env.SSH_TTY ||
process.env.CLAUDE_CODE_REMOTE
);
const terminalAuthMethods: AuthMethod[] = [];
const consoleLoginMethod: any = {
description: "Use Anthropic Console (API usage billing)",
name: "Anthropic Console",
id: "console-login",
type: "terminal",
args: ["--cli", "auth", "login", "--console"],
};
if (isRemote) {
const remoteLoginMethod: AuthMethod = {
description: "Run `claude /login` in the terminal",
name: "Log in with Claude",
id: "claude-login",
type: "terminal",
args: ["--cli"],
};
// If client supports terminal-auth capability, use that instead.
if (supportsMetaTerminalAuth) {
const baseArgs = process.argv.slice(1);
claudeLoginMethod._meta = {
"terminal-auth": {
command: process.execPath,
args: [...baseArgs, "--cli", "auth", "login", "--claudeai"],
label: "Claude Login",
},
if (supportsMetaTerminalAuth) {
remoteLoginMethod._meta = {
"terminal-auth": {
command: process.execPath,
args: [...process.argv.slice(1), "--cli"],
label: "Claude Login",
},
};
}
if (!shouldHideClaudeAuth() && (supportsTerminalAuth || supportsMetaTerminalAuth)) {
terminalAuthMethods.push(remoteLoginMethod);
}
} else {
const claudeLoginMethod: AuthMethod = {
description: "Use Claude subscription ",
name: "Claude Subscription",
id: "claude-ai-login",
type: "terminal",
args: ["--cli", "auth", "login", "--claudeai"],
};
consoleLoginMethod._meta = {
"terminal-auth": {
command: process.execPath,
args: [...baseArgs, "--cli", "auth", "login", "--console"],
label: "Anthropic Console Login",
},
const consoleLoginMethod: AuthMethod = {
description: "Use Anthropic Console (API usage billing)",
name: "Anthropic Console",
id: "console-login",
type: "terminal",
args: ["--cli", "auth", "login", "--console"],
};
if (supportsMetaTerminalAuth) {
const baseArgs = process.argv.slice(1);
claudeLoginMethod._meta = {
"terminal-auth": {
command: process.execPath,
args: [...baseArgs, "--cli", "auth", "login", "--claudeai"],
label: "Claude Login",
},
};
consoleLoginMethod._meta = {
"terminal-auth": {
command: process.execPath,
args: [...baseArgs, "--cli", "auth", "login", "--console"],
label: "Anthropic Console Login",
},
};
}
if (!shouldHideClaudeAuth() && (supportsTerminalAuth || supportsMetaTerminalAuth)) {
terminalAuthMethods.push(claudeLoginMethod);
}
if (supportsTerminalAuth || supportsMetaTerminalAuth) {
terminalAuthMethods.push(consoleLoginMethod);
}
}
return {
@@ -375,25 +467,11 @@ export class ClaudeAcpAgent implements Agent {
title: "Claude Agent",
version: packageJson.version,
},
authMethods: [
...(!shouldHideClaudeAuth() && (supportsTerminalAuth || supportsMetaTerminalAuth)
? [claudeLoginMethod]
: []),
...(supportsTerminalAuth || supportsMetaTerminalAuth ? [consoleLoginMethod] : []),
...(supportsGatewayAuth ? [gatewayAuthMethod] : []),
],
authMethods: [...terminalAuthMethods, ...(supportsGatewayAuth ? [gatewayAuthMethod] : [])],
};
}
async newSession(params: NewSessionRequest): Promise<NewSessionResponse> {
if (
!this.gatewayAuthMeta &&
fs.existsSync(path.resolve(os.homedir(), ".claude.json.backup")) &&
!fs.existsSync(path.resolve(os.homedir(), ".claude.json"))
) {
throw RequestError.authRequired();
}
const response = await this.createSession(params, {
// Revisit these meta values once we support resume
resume: (params._meta as NewSessionMeta | undefined)?.claudeCode?.options?.resume,
@@ -488,8 +566,8 @@ export class ClaudeAcpAgent implements Agent {
};
let lastAssistantTotalUsage: number | null = null;
let lastAssistantUsage: UsageSnapshot | null = null;
let lastAssistantModel: string | null = null;
let lastContextWindowSize: number = 200000;
const userMessage = promptToClaude(params);
@@ -531,6 +609,16 @@ export class ClaudeAcpAgent implements Agent {
break;
}
if (
session.emitRawSDKMessages &&
shouldEmitRawMessage(session.emitRawSDKMessages, message)
) {
await this.client.extNotification("_claude/sdkMessage", {
sessionId: params.sessionId,
message: message as Record<string, unknown>,
});
}
switch (message.type) {
case "system":
switch (message.subtype) {
@@ -561,12 +649,13 @@ export class ClaudeAcpAgent implements Agent {
// "944k/1m" right after the user sees "Compacting completed",
// which is confusing and wrong.
lastAssistantTotalUsage = 0;
lastAssistantUsage = null;
await this.client.sessionUpdate({
sessionId: message.session_id,
update: {
sessionUpdate: "usage_update",
used: 0,
size: lastContextWindowSize,
size: session.contextWindowSize,
},
});
await this.client.sessionUpdate({
@@ -601,7 +690,11 @@ export class ClaudeAcpAgent implements Agent {
case "task_started":
case "task_notification":
case "task_progress":
case "task_updated":
case "elicitation_complete":
case "plugin_install":
case "memory_recall":
case "notification":
case "api_retry":
// Todo: process via status api: https://docs.claude.com/en/docs/claude-code/hooks#hook-output
break;
@@ -620,8 +713,13 @@ export class ClaudeAcpAgent implements Agent {
const matchingModelUsage = lastAssistantModel
? getMatchingModelUsage(message.modelUsage, lastAssistantModel)
: null;
const contextWindowSize = matchingModelUsage?.contextWindow ?? 200000;
lastContextWindowSize = contextWindowSize;
// Only overwrite when we have an authoritative value — a miss
// (e.g. a turn with no top-level assistant message) would
// otherwise discard the window learned on a prior turn and
// leave the next prompt's mid-stream updates reporting 200k.
if (matchingModelUsage) {
session.contextWindowSize = matchingModelUsage.contextWindow;
}
// Send usage_update notification
if (lastAssistantTotalUsage !== null) {
@@ -630,7 +728,7 @@ export class ClaudeAcpAgent implements Agent {
update: {
sessionUpdate: "usage_update",
used: lastAssistantTotalUsage,
size: contextWindowSize,
size: session.contextWindowSize,
cost: {
amount: message.total_cost_usd,
currency: "USD",
@@ -704,6 +802,57 @@ export class ClaudeAcpAgent implements Agent {
break;
}
case "stream_event": {
if (
message.parent_tool_use_id === null &&
(message.event.type === "message_start" || message.event.type === "message_delta")
) {
if (message.event.type === "message_start") {
lastAssistantUsage = snapshotFromUsage(message.event.message.usage);
const model = message.event.message.model;
if (model && model !== "<synthetic>") {
lastAssistantModel = model;
// Only upgrade from the default — once a `result` has given
// us an authoritative window, trust it over the heuristic.
// Model switches invalidate the cached window via
// `syncSessionConfigState`, which resets us back to the
// default so this branch runs again for the new model.
if (session.contextWindowSize === DEFAULT_CONTEXT_WINDOW) {
const inferred = inferContextWindowFromModel(model);
if (inferred !== null) {
session.contextWindowSize = inferred;
}
}
}
} else {
const usage = message.event.usage;
const prev: Readonly<UsageSnapshot> = lastAssistantUsage ?? ZERO_USAGE;
// Per Anthropic API, message_delta usage fields are *cumulative*;
// nullable fields (input_tokens and the cache fields) fall back
// to the prior snapshot when the server omits them from this
// delta. Only output_tokens is guaranteed non-null.
lastAssistantUsage = {
input_tokens: usage.input_tokens ?? prev.input_tokens,
output_tokens: usage.output_tokens,
cache_read_input_tokens:
usage.cache_read_input_tokens ?? prev.cache_read_input_tokens,
cache_creation_input_tokens:
usage.cache_creation_input_tokens ?? prev.cache_creation_input_tokens,
};
}
const nextUsage = totalTokens(lastAssistantUsage);
if (nextUsage !== lastAssistantTotalUsage) {
lastAssistantTotalUsage = nextUsage;
await this.client.sessionUpdate({
sessionId: params.sessionId,
update: {
sessionUpdate: "usage_update",
used: nextUsage,
size: session.contextWindowSize,
},
});
}
}
for (const notification of streamEventToAcpNotifications(
message,
params.sessionId,
@@ -746,29 +895,16 @@ export class ClaudeAcpAgent implements Agent {
}
}
// Store latest assistant usage (excluding subagents)
// Sum all token types as a proxy for post-turn context occupancy:
// current turn's output will become next turn's input.
// Note: per the Anthropic API, input_tokens excludes cache tokens —
// cache_read and cache_creation are reported separately, so summing
// all four fields is not double-counting.
if ((message.message as any).usage && message.parent_tool_use_id === null) {
const messageWithUsage = message.message as unknown as SDKResultMessage;
lastAssistantTotalUsage =
messageWithUsage.usage.input_tokens +
messageWithUsage.usage.output_tokens +
messageWithUsage.usage.cache_read_input_tokens +
messageWithUsage.usage.cache_creation_input_tokens;
}
// Track the current top-level model for context window size lookup
// (exclude subagent messages to stay in sync with lastAssistantTotalUsage)
if (
message.type === "assistant" &&
message.parent_tool_use_id === null &&
message.message.model &&
message.message.model !== "<synthetic>"
) {
lastAssistantModel = message.message.model;
// Snapshot the latest top-level assistant usage and model so the
// next `result` can emit a usage_update tied to the right context
// window. Subagent messages are excluded to keep the snapshot
// aligned with what the user's current selection is producing.
if (message.type === "assistant" && message.parent_tool_use_id === null) {
lastAssistantUsage = snapshotFromUsage(message.message.usage);
lastAssistantTotalUsage = totalTokens(lastAssistantUsage);
if (message.message.model && message.message.model !== "<synthetic>") {
lastAssistantModel = message.message.model;
}
}
// Slash commands like /compact can generate invalid output... doesn't match
@@ -891,7 +1027,7 @@ export class ClaudeAcpAgent implements Agent {
async cancel(params: CancelNotification): Promise<void> {
const session = this.sessions[params.sessionId];
if (!session) {
throw new Error("Session not found");
return;
}
session.cancelled = true;
for (const [, pending] of session.pendingMessages) {
@@ -901,17 +1037,30 @@ export class ClaudeAcpAgent implements Agent {
await session.query.interrupt();
}
async unstable_closeSession(params: CloseSessionRequest): Promise<CloseSessionResponse> {
const session = this.sessions[params.sessionId];
/** Cleanly tear down a session: cancel in-flight work, dispose resources,
* and remove it from the session map. */
private async teardownSession(sessionId: string): Promise<void> {
const session = this.sessions[sessionId];
if (!session) {
throw new Error("Session not found");
return;
}
await this.cancel({ sessionId: params.sessionId });
await this.cancel({ sessionId });
session.settingsManager.dispose();
session.abortController.abort();
delete this.sessions[params.sessionId];
session.query.close();
delete this.sessions[sessionId];
}
/** Tear down all active sessions. Called when the ACP connection closes. */
async dispose(): Promise<void> {
await Promise.all(Object.keys(this.sessions).map((id) => this.teardownSession(id)));
}
async unstable_closeSession(params: CloseSessionRequest): Promise<CloseSessionResponse> {
if (!this.sessions[params.sessionId]) {
throw new Error("Session not found");
}
await this.teardownSession(params.sessionId);
return {};
}
@@ -1006,6 +1155,7 @@ export class ClaudeAcpAgent implements Agent {
private async applySessionMode(sessionId: string, modeId: string): Promise<void> {
switch (modeId) {
case "auto":
case "default":
case "acceptEdits":
case "bypassPermissions":
@@ -1078,6 +1228,7 @@ export class ClaudeAcpAgent implements Agent {
if (toolName === "ExitPlanMode") {
const options = [
{ kind: "allow_always", name: 'Yes, and use "auto" mode', optionId: "auto" },
{
kind: "allow_always",
name: "Yes, and auto-accept edits",
@@ -1115,6 +1266,7 @@ export class ClaudeAcpAgent implements Agent {
response.outcome?.outcome === "selected" &&
(response.outcome.optionId === "default" ||
response.outcome.optionId === "acceptEdits" ||
response.outcome.optionId === "auto" ||
response.outcome.optionId === "bypassPermissions")
) {
await this.client.sessionUpdate({
@@ -1247,6 +1399,13 @@ export class ClaudeAcpAgent implements Agent {
if (configId === "mode") {
session.modes = { ...session.modes, currentModeId: value };
} else if (configId === "model") {
if (session.models.currentModelId !== value) {
// The cached context window was learned for the previous model; reset
// to the new model's heuristic so mid-stream updates between now and
// the next `result` reflect the user's selection instead of the old
// model's window.
session.contextWindowSize = inferContextWindowFromModel(value) ?? DEFAULT_CONTEXT_WINDOW;
}
session.models = { ...session.models, currentModelId: value };
}
}
@@ -1259,12 +1418,20 @@ export class ClaudeAcpAgent implements Agent {
}): Promise<NewSessionResponse> {
const existingSession = this.sessions[params.sessionId];
if (existingSession) {
return {
sessionId: params.sessionId,
modes: existingSession.modes,
models: existingSession.models,
configOptions: existingSession.configOptions,
};
const fingerprint = computeSessionFingerprint(params);
if (fingerprint === existingSession.sessionFingerprint) {
return {
sessionId: params.sessionId,
modes: existingSession.modes,
models: existingSession.models,
configOptions: existingSession.configOptions,
};
}
// Session-defining params changed (e.g. cwd pointed at a git worktree,
// or MCP servers reconfigured). Tear down the existing session and
// recreate it so the underlying Query process picks up the new values.
await this.teardownSession(params.sessionId);
}
const response = await this.createSession(
@@ -1462,7 +1629,8 @@ export class ClaudeAcpAgent implements Agent {
if (
creationOpts.resume &&
error instanceof Error &&
error.message === "Query closed before response received"
(error.message === "Query closed before response received" ||
error.message.includes("No conversation found with session ID"))
) {
throw RequestError.resourceNotFound(sessionId);
}
@@ -1486,7 +1654,7 @@ export class ClaudeAcpAgent implements Agent {
{
id: "auto",
name: "Auto",
decription: "Use a model classifier to approve/deny permission prompts.",
description: "Use a model classifier to approve/deny permission prompts",
},
{
id: "default",
@@ -1530,6 +1698,7 @@ export class ClaudeAcpAgent implements Agent {
input: input,
cancelled: false,
cwd: params.cwd,
sessionFingerprint: computeSessionFingerprint(params),
settingsManager,
accumulatedUsage: {
inputTokens: 0,
@@ -1544,6 +1713,9 @@ export class ClaudeAcpAgent implements Agent {
pendingMessages: new Map(),
nextPendingOrder: 0,
abortController,
emitRawSDKMessages: sessionMeta?.claudeCode?.emitRawSDKMessages ?? false,
contextWindowSize:
inferContextWindowFromModel(models.currentModelId) ?? DEFAULT_CONTEXT_WINDOW,
};
return {
@@ -1555,6 +1727,17 @@ export class ClaudeAcpAgent implements Agent {
}
}
function shouldEmitRawMessage(
config: boolean | SDKMessageFilter[],
message: { type: string; subtype?: string },
): boolean {
if (config === true) return true;
if (config === false) return false;
return config.some(
(f) => f.type === message.type && (f.subtype === undefined || f.subtype === message.subtype),
);
}
function sessionUsage(session: Session) {
return {
inputTokens: session.accumulatedUsage.inputTokens,
@@ -1569,6 +1752,38 @@ function sessionUsage(session: Session) {
};
}
/** Sum all four fields as a proxy for post-turn context occupancy: the current
* turn's output becomes next turn's input. Per the Anthropic API, input_tokens
* excludes cache tokens — cache_read and cache_creation are reported
* separately — so summing all four is not double-counting. */
function totalTokens(usage: UsageSnapshot): number {
return (
usage.input_tokens +
usage.output_tokens +
usage.cache_read_input_tokens +
usage.cache_creation_input_tokens
);
}
/** Project a nullable API usage object into our non-null snapshot shape.
* Both SDK message_start and assistant message `usage` have `number | null`
* cache fields; we coerce absent values to 0 so `totalTokens` never hits
* NaN. Delta events have different semantics (cumulative + prev fallback)
* and are handled inline. */
function snapshotFromUsage(usage: {
input_tokens: number;
output_tokens: number;
cache_read_input_tokens: number | null;
cache_creation_input_tokens: number | null;
}): UsageSnapshot {
return {
input_tokens: usage.input_tokens,
output_tokens: usage.output_tokens,
cache_read_input_tokens: usage.cache_read_input_tokens ?? 0,
cache_creation_input_tokens: usage.cache_creation_input_tokens ?? 0,
};
}
function createEnvForGateway(gatewayMeta?: GatewayAuthMeta) {
if (!gatewayMeta) {
return {};
@@ -1698,7 +1913,16 @@ async function getAvailableModels(
let currentModel = models[0];
if (settings.model) {
// Model priority (highest to lowest):
// 1. ANTHROPIC_MODEL environment variable
// 2. settings.model (user configuration)
// 3. models[0] (default first model)
if (process.env.ANTHROPIC_MODEL) {
const match = resolveModelPreference(models, process.env.ANTHROPIC_MODEL);
if (match) {
currentModel = match;
}
} else if (settings.model) {
const match = resolveModelPreference(models, settings.model);
if (match) {
currentModel = match;
@@ -1930,8 +2154,8 @@ export function toAcpNotifications(
const alreadyCached = chunk.id in toolUseCache;
toolUseCache[chunk.id] = chunk;
if (chunk.name === "TodoWrite") {
// @ts-expect-error - sometimes input is empty object
if (Array.isArray(chunk.input.todos)) {
// @ts-expect-error - sometimes input is empty object or undefined
if (Array.isArray(chunk.input?.todos)) {
update = {
sessionUpdate: "plan",
entries: planEntries(chunk.input as { todos: ClaudePlanEntry[] }),
@@ -2085,6 +2309,7 @@ export function toAcpNotifications(
case "container_upload":
case "compaction":
case "compaction_delta":
case "advisor_tool_result":
break;
default:
@@ -2167,7 +2392,12 @@ export function runAcp() {
const output = nodeToWebReadable(process.stdin);
const stream = ndJsonStream(input, output);
new AgentSideConnection((client) => new ClaudeAcpAgent(client), stream);
let agent!: ClaudeAcpAgent;
const connection = new AgentSideConnection((client) => {
agent = new ClaudeAcpAgent(client);
return agent;
}, stream);
return { connection, agent };
}
function commonPrefixLength(a: string, b: string) {
@@ -2178,6 +2408,16 @@ function commonPrefixLength(a: string, b: string) {
return i;
}
/** Best-effort first guess of a model's context window from its ID, used only
* until a `result` message arrives with the authoritative `modelUsage` value.
* Anthropic 1M-context variants encode "1m" as a distinct token in the SDK
* model ID (e.g., "claude-opus-4-6-1m"), which `\b1m\b` catches without also
* matching things like "10m" or embedded substrings. */
function inferContextWindowFromModel(model: string): number | null {
if (/\b1m\b/i.test(model)) return 1_000_000;
return null;
}
function getMatchingModelUsage(modelUsage: Record<string, ModelUsage>, currentModel: string) {
let bestKey: string | null = null;
let bestLen = 0;

View File

@@ -24,8 +24,23 @@ if (process.argv.includes("--cli")) {
console.error("Unhandled Rejection at:", promise, "reason:", reason);
});
runAcp();
const { connection, agent } = runAcp();
// Keep process alive
async function shutdown() {
await agent.dispose().catch((err) => {
console.error("Error during cleanup:", err);
});
process.exit(0);
}
// Exit cleanly when the ACP connection closes (e.g. stdin EOF, transport
// error). Without this, `process.stdin.resume()` keeps the event loop
// alive indefinitely, causing orphan process accumulation in oneshot mode.
connection.closed.then(shutdown);
process.on("SIGTERM", shutdown);
process.on("SIGINT", shutdown);
// Keep process alive while connection is open
process.stdin.resume();
}

View File

@@ -6,6 +6,7 @@ export {
streamEventToAcpNotifications,
type ToolUpdateMeta,
type NewSessionMeta,
type SDKMessageFilter,
} from "./acp-agent.js";
export {
loadManagedSettings,

View File

@@ -1328,6 +1328,7 @@ describe("stop reason propagation", () => {
input,
cancelled: false,
cwd: "/test",
sessionFingerprint: JSON.stringify({ cwd: "/test", mcpServers: [] }),
modes: {
currentModeId: "default",
availableModes: [],
@@ -1348,6 +1349,8 @@ describe("stop reason propagation", () => {
pendingMessages: new Map(),
nextPendingOrder: 0,
abortController: new AbortController(),
emitRawSDKMessages: false,
contextWindowSize: 200000,
};
}
@@ -1466,6 +1469,7 @@ describe("stop reason propagation", () => {
query: messageGenerator() as any,
input,
cwd: "/tmp/test",
sessionFingerprint: JSON.stringify({ cwd: "/tmp/test", mcpServers: [] }),
cancelled: false,
modes: {
currentModeId: "default",
@@ -1487,6 +1491,8 @@ describe("stop reason propagation", () => {
promptRunning: false,
pendingMessages: new Map(),
nextPendingOrder: 0,
emitRawSDKMessages: false,
contextWindowSize: 200000,
};
const response = await agent.prompt({
@@ -1534,12 +1540,13 @@ describe("session/close", () => {
function injectSession(agent: ClaudeAcpAgent, sessionId: string) {
function* empty() {}
const gen = Object.assign(empty(), { interrupt: vi.fn() });
const gen = Object.assign(empty(), { interrupt: vi.fn(), close: vi.fn() });
agent.sessions[sessionId] = {
query: gen as any,
input: new Pushable(),
cancelled: false,
cwd: "/test",
sessionFingerprint: JSON.stringify({ cwd: "/test", mcpServers: [] }),
modes: {
currentModeId: "default",
availableModes: [],
@@ -1560,6 +1567,8 @@ describe("session/close", () => {
pendingMessages: new Map(),
nextPendingOrder: 0,
abortController: new AbortController(),
emitRawSDKMessages: false,
contextWindowSize: 200000,
};
return agent.sessions[sessionId]!;
}
@@ -1609,6 +1618,144 @@ describe("session/close", () => {
});
});
describe("getOrCreateSession param change detection", () => {
function createMockAgent() {
const mockClient = {
sessionUpdate: async () => {},
} as unknown as AgentSideConnection;
return new ClaudeAcpAgent(mockClient, { log: () => {}, error: () => {} });
}
function injectSession(
agent: ClaudeAcpAgent,
sessionId: string,
opts: { cwd?: string; mcpServers?: { name: string }[] } = {},
) {
const cwd = opts.cwd ?? "/test";
const mcpServers = (opts.mcpServers ?? []) as any[];
function* empty() {}
const gen = Object.assign(empty(), {
interrupt: vi.fn(),
close: vi.fn(),
supportedCommands: vi.fn().mockResolvedValue([]),
});
agent.sessions[sessionId] = {
query: gen as any,
input: new Pushable(),
cancelled: false,
cwd,
sessionFingerprint: JSON.stringify({
cwd,
mcpServers: [...mcpServers].sort((a: any, b: any) => a.name.localeCompare(b.name)),
}),
modes: { currentModeId: "default", availableModes: [] },
models: { currentModelId: "default", availableModels: [] },
settingsManager: { dispose: vi.fn() } as any,
accumulatedUsage: {
inputTokens: 0,
outputTokens: 0,
cachedReadTokens: 0,
cachedWriteTokens: 0,
},
configOptions: [],
promptRunning: false,
pendingMessages: new Map(),
nextPendingOrder: 0,
abortController: new AbortController(),
emitRawSDKMessages: false,
contextWindowSize: 200000,
};
return agent.sessions[sessionId]!;
}
it("returns cached session when params are unchanged", async () => {
const agent = createMockAgent();
const session = injectSession(agent, "s1", { cwd: "/project" });
await agent.unstable_resumeSession({
sessionId: "s1",
cwd: "/project",
mcpServers: [],
});
// Session object should be the exact same reference (not recreated)
expect(agent.sessions["s1"]).toBe(session);
expect(session.settingsManager.dispose).not.toHaveBeenCalled();
});
it("tears down existing session when cwd changes", async () => {
const agent = createMockAgent();
const session = injectSession(agent, "s1", { cwd: "/old" });
// Mock createSession to avoid spawning a real process.
// It will throw, but we can catch that — we only need to verify
// the old session was torn down before createSession was attempted.
const createSessionSpy = vi
.spyOn(agent as any, "createSession")
.mockRejectedValue(new Error("mock"));
await expect(
agent.unstable_resumeSession({ sessionId: "s1", cwd: "/new", mcpServers: [] }),
).rejects.toThrow("mock");
// Old session should have been fully torn down
expect(session.settingsManager.dispose).toHaveBeenCalled();
expect(session.abortController.signal.aborted).toBe(true);
expect(session.query.interrupt).toHaveBeenCalled();
expect(agent.sessions["s1"]).toBeUndefined();
// createSession should have been called with the new cwd
expect(createSessionSpy).toHaveBeenCalledWith(
expect.objectContaining({ cwd: "/new" }),
expect.objectContaining({ resume: "s1" }),
);
});
it("tears down existing session when mcpServers change", async () => {
const agent = createMockAgent();
const session = injectSession(agent, "s1", { cwd: "/project" });
const createSessionSpy = vi
.spyOn(agent as any, "createSession")
.mockRejectedValue(new Error("mock"));
await expect(
agent.unstable_resumeSession({
sessionId: "s1",
cwd: "/project",
mcpServers: [{ name: "new-server", command: "node", args: ["server.js"], env: [] }],
}),
).rejects.toThrow("mock");
expect(session.settingsManager.dispose).toHaveBeenCalled();
expect(session.abortController.signal.aborted).toBe(true);
expect(agent.sessions["s1"]).toBeUndefined();
expect(createSessionSpy).toHaveBeenCalled();
});
it("treats mcpServers in different order as unchanged", async () => {
const agent = createMockAgent();
const servers = [
{ name: "b-server", command: "node", args: ["b.js"], env: [] },
{ name: "a-server", command: "node", args: ["a.js"], env: [] },
] as const;
const session = injectSession(agent, "s1", {
cwd: "/project",
mcpServers: servers as any,
});
// Same servers but reversed order — should NOT trigger teardown
await agent.unstable_resumeSession({
sessionId: "s1",
cwd: "/project",
mcpServers: [...servers].reverse() as any,
});
expect(agent.sessions["s1"]).toBe(session);
expect(session.settingsManager.dispose).not.toHaveBeenCalled();
});
});
describe("usage_update computation", () => {
function createAssistantMessage(overrides: {
model: string;
@@ -1676,6 +1823,23 @@ describe("usage_update computation", () => {
};
}
function createStreamEvent(
eventType: "message_start" | "message_delta",
payload: Record<string, unknown>,
parentToolUseId: string | null = null,
) {
return {
type: "stream_event" as const,
parent_tool_use_id: parentToolUseId,
uuid: randomUUID(),
session_id: "test-session",
event:
eventType === "message_start"
? { type: "message_start" as const, message: payload }
: { type: "message_delta" as const, ...payload },
};
}
function createMockAgentWithCapture() {
const updates: any[] = [];
const mockClient = {
@@ -1710,6 +1874,7 @@ describe("usage_update computation", () => {
input,
cancelled: false,
cwd: "/test",
sessionFingerprint: JSON.stringify({ cwd: "/test", mcpServers: [] }),
modes: {
currentModeId: "default",
availableModes: [],
@@ -1730,6 +1895,8 @@ describe("usage_update computation", () => {
pendingMessages: new Map(),
nextPendingOrder: 0,
abortController: new AbortController(),
emitRawSDKMessages: false,
contextWindowSize: 200000,
};
}
@@ -1770,6 +1937,461 @@ describe("usage_update computation", () => {
expect(usageUpdate.update.used).toBe(1800);
});
it("stream_event message_start emits usage_update before result", async () => {
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent("message_start", {
model: "claude-opus-4-20250514",
usage: {
input_tokens: 1000,
output_tokens: 500,
cache_read_input_tokens: 200,
cache_creation_input_tokens: 100,
},
}),
createResultMessageWithModel({
modelUsage: {
"claude-opus-4-20250514": {
inputTokens: 1000,
outputTokens: 500,
cacheReadInputTokens: 200,
cacheCreationInputTokens: 100,
webSearchRequests: 0,
costUSD: 0.01,
contextWindow: 1000000,
maxOutputTokens: 16384,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
expect(usageUpdates).toHaveLength(2);
expect(usageUpdates[0].update.used).toBe(1800);
// First prompt of a session has no prior result to learn the window from,
// so the mid-stream update falls back to the default context window.
expect(usageUpdates[0].update.size).toBe(200000);
expect(usageUpdates[0].update.cost).toBeUndefined();
expect(usageUpdates[1].update.used).toBe(1800);
expect(usageUpdates[1].update.size).toBe(1000000);
expect(usageUpdates[1].update.cost).toBeDefined();
});
it("stream_event message_delta patches previous snapshot", async () => {
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent("message_start", {
model: "claude-opus-4-20250514",
usage: {
input_tokens: 1000,
output_tokens: 0,
cache_read_input_tokens: 200,
cache_creation_input_tokens: 100,
},
}),
createStreamEvent("message_delta", {
usage: { output_tokens: 500 },
}),
createResultMessageWithModel({
modelUsage: {
"claude-opus-4-20250514": {
inputTokens: 1000,
outputTokens: 500,
cacheReadInputTokens: 200,
cacheCreationInputTokens: 100,
webSearchRequests: 0,
costUSD: 0.01,
contextWindow: 1000000,
maxOutputTokens: 16384,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
expect(usageUpdates).toHaveLength(3);
expect(usageUpdates[0].update.used).toBe(1300);
expect(usageUpdates[0].update.cost).toBeUndefined();
expect(usageUpdates[1].update.used).toBe(1800);
expect(usageUpdates[1].update.cost).toBeUndefined();
expect(usageUpdates[2].update.used).toBe(1800);
expect(usageUpdates[2].update.cost).toBeDefined();
});
it("mid-stream size is inferred from a 1M model name before the first result", async () => {
// On the very first prompt there is no learned context window yet, so the
// mid-stream update would otherwise fall back to 200k. A "-1m" suffix in
// the SDK model ID is enough signal to emit 1_000_000 up front.
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent("message_start", {
model: "claude-opus-4-6-1m",
usage: {
input_tokens: 2000,
output_tokens: 1000,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
},
}),
createResultMessageWithModel({
modelUsage: {
"claude-opus-4-6-1m": {
inputTokens: 2000,
outputTokens: 1000,
cacheReadInputTokens: 0,
cacheCreationInputTokens: 0,
webSearchRequests: 0,
costUSD: 0.02,
contextWindow: 1000000,
maxOutputTokens: 16384,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
expect(usageUpdates).toHaveLength(2);
expect(usageUpdates[0].update.size).toBe(1000000);
expect(usageUpdates[1].update.size).toBe(1000000);
});
it("duplicate stream_event totals do not re-emit usage_update", async () => {
// A message_delta whose cumulative totals match the prior snapshot should
// not trigger a duplicate usage_update — only the result adds cost on top.
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent("message_start", {
model: "claude-opus-4-20250514",
usage: {
input_tokens: 1000,
output_tokens: 500,
cache_read_input_tokens: 200,
cache_creation_input_tokens: 100,
},
}),
createStreamEvent("message_delta", {
usage: { output_tokens: 500 },
}),
createResultMessageWithModel({
modelUsage: {
"claude-opus-4-20250514": {
inputTokens: 1000,
outputTokens: 500,
cacheReadInputTokens: 200,
cacheCreationInputTokens: 100,
webSearchRequests: 0,
costUSD: 0.01,
contextWindow: 1000000,
maxOutputTokens: 16384,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
expect(usageUpdates).toHaveLength(2);
expect(usageUpdates[0].update.used).toBe(1800);
expect(usageUpdates[0].update.cost).toBeUndefined();
expect(usageUpdates[1].update.used).toBe(1800);
expect(usageUpdates[1].update.cost).toBeDefined();
});
it("mid-stream size uses the session's learned context window", async () => {
// Session state persists the model's context window across prompts, so a
// mid-stream update in a later prompt reports the real size immediately
// instead of snapping back to the 200k default before the result arrives.
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent("message_start", {
model: "claude-opus-4-20250514",
usage: {
input_tokens: 2000,
output_tokens: 1000,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
},
}),
createResultMessageWithModel({
modelUsage: {
"claude-opus-4-20250514": {
inputTokens: 2000,
outputTokens: 1000,
cacheReadInputTokens: 0,
cacheCreationInputTokens: 0,
webSearchRequests: 0,
costUSD: 0.02,
contextWindow: 1000000,
maxOutputTokens: 16384,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
// Simulate a prior prompt having learned the 1M window for this model.
agent.sessions["test-session"].contextWindowSize = 1000000;
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
expect(usageUpdates).toHaveLength(2);
expect(usageUpdates[0].update.size).toBe(1000000);
expect(usageUpdates[1].update.size).toBe(1000000);
});
it("switching to a 1M model seeds the context window from the heuristic", async () => {
// The heuristic runs at config-change time so mid-stream updates in the
// next prompt already report 1M — without waiting for message_start or
// the next `result` to correct us.
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent("message_start", {
model: "claude-opus-4-6-1m",
usage: {
input_tokens: 2000,
output_tokens: 1000,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
},
}),
createResultMessageWithModel({
modelUsage: {
"claude-opus-4-6-1m": {
inputTokens: 2000,
outputTokens: 1000,
cacheReadInputTokens: 0,
cacheCreationInputTokens: 0,
webSearchRequests: 0,
costUSD: 0.02,
contextWindow: 1000000,
maxOutputTokens: 16384,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
const session = agent.sessions["test-session"];
expect(session.contextWindowSize).toBe(200000);
(agent as any).syncSessionConfigState(session, "model", "claude-opus-4-6-1m");
expect(session.contextWindowSize).toBe(1000000);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
expect(usageUpdates).toHaveLength(2);
expect(usageUpdates[0].update.size).toBe(1000000);
expect(usageUpdates[1].update.size).toBe(1000000);
});
it("result with no matching modelUsage preserves the learned window", async () => {
// A turn whose `result.modelUsage` doesn't contain the current top-level
// model (e.g. no top-level assistant message, or only a subagent ran) must
// not clobber the window learned on a prior turn — otherwise the next
// prompt's mid-stream updates regress to the 200k default.
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createResultMessageWithModel({
modelUsage: {
"claude-haiku-4-5-20251001": {
inputTokens: 100,
outputTokens: 50,
cacheReadInputTokens: 0,
cacheCreationInputTokens: 0,
webSearchRequests: 0,
costUSD: 0.001,
contextWindow: 200000,
maxOutputTokens: 8192,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
const session = agent.sessions["test-session"];
session.contextWindowSize = 1000000;
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
expect(session.contextWindowSize).toBe(1000000);
// The emit itself falls back to session.contextWindowSize, which is
// unchanged from the learned value.
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
// No lastAssistantTotalUsage was set (no top-level assistant / stream
// event), so the result branch skips its emit entirely.
expect(usageUpdates).toHaveLength(0);
});
it("switching the session's model invalidates the learned context window", async () => {
// When the user switches models mid-session, the window learned for the
// previous model would otherwise persist into the next prompt's first
// mid-stream update. syncSessionConfigState should reset it so the next
// turn's first update falls back to the heuristic (here: 200k default).
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent("message_start", {
model: "claude-sonnet-4-6",
usage: {
input_tokens: 1000,
output_tokens: 500,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
},
}),
createResultMessageWithModel({
modelUsage: {
"claude-sonnet-4-6": {
inputTokens: 1000,
outputTokens: 500,
cacheReadInputTokens: 0,
cacheCreationInputTokens: 0,
webSearchRequests: 0,
costUSD: 0.01,
contextWindow: 200000,
maxOutputTokens: 16384,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
const session = agent.sessions["test-session"];
session.contextWindowSize = 1000000;
session.models = { ...session.models, currentModelId: "claude-opus-4-6-1m" };
// User flips the selector to a 200k model.
(agent as any).syncSessionConfigState(session, "model", "claude-sonnet-4-6");
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
expect(usageUpdates).toHaveLength(2);
expect(usageUpdates[0].update.size).toBe(200000);
expect(usageUpdates[1].update.size).toBe(200000);
});
it("non-usage stream events do not re-emit usage_update", async () => {
// content_block_* and message_stop carry no usage fields; they must not
// trigger duplicate emits between the real message_start / message_delta
// / result updates.
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent("message_start", {
model: "claude-opus-4-20250514",
usage: {
input_tokens: 1000,
output_tokens: 0,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
},
}),
{
type: "stream_event" as const,
parent_tool_use_id: null,
uuid: randomUUID(),
session_id: "test-session",
event: { type: "content_block_start", index: 0, content_block: { type: "text", text: "" } },
},
{
type: "stream_event" as const,
parent_tool_use_id: null,
uuid: randomUUID(),
session_id: "test-session",
event: { type: "content_block_delta", index: 0, delta: { type: "text_delta", text: "hi" } },
},
{
type: "stream_event" as const,
parent_tool_use_id: null,
uuid: randomUUID(),
session_id: "test-session",
event: { type: "content_block_stop", index: 0 },
},
createStreamEvent("message_delta", {
usage: { output_tokens: 200 },
}),
{
type: "stream_event" as const,
parent_tool_use_id: null,
uuid: randomUUID(),
session_id: "test-session",
event: { type: "message_stop" },
},
createResultMessageWithModel({
modelUsage: {
"claude-opus-4-20250514": {
inputTokens: 1000,
outputTokens: 200,
cacheReadInputTokens: 0,
cacheCreationInputTokens: 0,
webSearchRequests: 0,
costUSD: 0.01,
contextWindow: 1000000,
maxOutputTokens: 16384,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
// Exactly three: message_start (1000), message_delta (1200), result (1200 + cost).
expect(usageUpdates).toHaveLength(3);
expect(usageUpdates[0].update.used).toBe(1000);
expect(usageUpdates[1].update.used).toBe(1200);
expect(usageUpdates[2].update.used).toBe(1200);
expect(usageUpdates[2].update.cost).toBeDefined();
});
it("subagent stream_event does not emit usage_update", async () => {
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
createStreamEvent(
"message_start",
{
model: "claude-haiku-4-5-20251001",
usage: {
input_tokens: 500,
output_tokens: 100,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
},
},
"tool_use_123",
),
createResultMessageWithModel({
modelUsage: {
"claude-haiku-4-5-20251001": {
inputTokens: 500,
outputTokens: 100,
cacheReadInputTokens: 0,
cacheCreationInputTokens: 0,
webSearchRequests: 0,
costUSD: 0.001,
contextWindow: 200000,
maxOutputTokens: 8192,
},
},
}),
{ type: "system", subtype: "session_state_changed", state: "idle" },
]);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const usageUpdates = updates.filter((u: any) => u.update?.sessionUpdate === "usage_update");
expect(usageUpdates).toHaveLength(0);
});
it("size reflects the current model's context window, not min across all", async () => {
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
@@ -2051,3 +2673,200 @@ describe("usage_update computation", () => {
expect(usageUpdate.update.size).toBe(1000000);
});
});
describe("emitRawSDKMessages", () => {
function createMockAgentWithExtNotification() {
const updates: any[] = [];
const extNotifications: { method: string; params: any }[] = [];
const mockClient = {
sessionUpdate: async (notification: any) => {
updates.push(notification);
},
extNotification: async (method: string, params: any) => {
extNotifications.push({ method, params });
},
} as unknown as AgentSideConnection;
const agent = new ClaudeAcpAgent(mockClient, { log: () => {}, error: () => {} });
return { agent, updates, extNotifications };
}
function injectSession(
agent: ClaudeAcpAgent,
messages: any[],
emitRawSDKMessages: boolean | { type: string; subtype?: string }[],
) {
const input = new Pushable<any>();
async function* messageGenerator() {
const iter = input[Symbol.asyncIterator]();
const { value: userMessage, done } = await iter.next();
if (!done && userMessage) {
yield {
type: "user",
message: userMessage.message,
parent_tool_use_id: null,
uuid: userMessage.uuid,
session_id: "test-session",
isReplay: true,
};
}
yield* messages;
}
agent.sessions["test-session"] = {
query: messageGenerator() as any,
input,
cancelled: false,
cwd: "/test",
sessionFingerprint: JSON.stringify({ cwd: "/test", mcpServers: [] }),
modes: { currentModeId: "default", availableModes: [] },
models: { currentModelId: "default", availableModels: [] },
settingsManager: { dispose: vi.fn() } as any,
accumulatedUsage: {
inputTokens: 0,
outputTokens: 0,
cachedReadTokens: 0,
cachedWriteTokens: 0,
},
configOptions: [],
promptRunning: false,
pendingMessages: new Map(),
nextPendingOrder: 0,
abortController: new AbortController(),
emitRawSDKMessages,
contextWindowSize: 200000,
};
}
function createResultMessage() {
return {
type: "result" as const,
subtype: "success" as const,
is_error: false,
result: "",
errors: [],
stop_reason: "end_turn" as const,
cost_usd: 0,
duration_ms: 0,
duration_api_ms: 0,
num_turns: 1,
total_cost_usd: 0,
usage: {
input_tokens: 10,
output_tokens: 5,
cache_read_input_tokens: 0,
cache_creation_input_tokens: 0,
},
modelUsage: {},
permission_denials: [],
uuid: randomUUID(),
session_id: "test-session",
};
}
it("emits all raw messages when set to true", async () => {
const { agent, extNotifications } = createMockAgentWithExtNotification();
const systemMsg = {
type: "system",
subtype: "status",
status: "compacting",
session_id: "test-session",
};
injectSession(
agent,
[
systemMsg,
createResultMessage(),
{ type: "system", subtype: "session_state_changed", state: "idle" },
],
true,
);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
// Should have emitted extNotifications for all messages (user replay + system + result + session_state_changed)
expect(extNotifications.length).toBeGreaterThanOrEqual(3);
expect(extNotifications.every((n) => n.method === "_claude/sdkMessage")).toBe(true);
});
it("does not emit when set to false", async () => {
const { agent, extNotifications } = createMockAgentWithExtNotification();
injectSession(
agent,
[
{ type: "system", subtype: "status", status: "compacting", session_id: "test-session" },
createResultMessage(),
{ type: "system", subtype: "session_state_changed", state: "idle" },
],
false,
);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
expect(extNotifications).toHaveLength(0);
});
it("emits only messages matching a filter array", async () => {
const { agent, extNotifications } = createMockAgentWithExtNotification();
injectSession(
agent,
[
{ type: "system", subtype: "compact_boundary", session_id: "test-session" },
{ type: "system", subtype: "status", status: "compacting", session_id: "test-session" },
createResultMessage(),
{ type: "system", subtype: "session_state_changed", state: "idle" },
],
[{ type: "system", subtype: "compact_boundary" }],
);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
// Only the compact_boundary message should have been emitted
const sdkMessages = extNotifications.filter((n) => n.method === "_claude/sdkMessage");
expect(sdkMessages).toHaveLength(1);
expect(sdkMessages[0].params.sessionId).toBe("test-session");
expect(sdkMessages[0].params.message.type).toBe("system");
expect(sdkMessages[0].params.message.subtype).toBe("compact_boundary");
});
it("filter without subtype matches all messages of that type", async () => {
const { agent, extNotifications } = createMockAgentWithExtNotification();
injectSession(
agent,
[
{ type: "system", subtype: "compact_boundary", session_id: "test-session" },
{ type: "system", subtype: "status", status: "compacting", session_id: "test-session" },
createResultMessage(),
{ type: "system", subtype: "session_state_changed", state: "idle" },
],
[{ type: "system" }],
);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const sdkMessages = extNotifications.filter((n) => n.method === "_claude/sdkMessage");
// All system messages should match (compact_boundary + status + session_state_changed)
const systemMessages = sdkMessages.filter((n) => n.params.message.type === "system");
expect(systemMessages).toHaveLength(3);
});
it("supports multiple filters", async () => {
const { agent, extNotifications } = createMockAgentWithExtNotification();
injectSession(
agent,
[
{ type: "system", subtype: "compact_boundary", session_id: "test-session" },
{ type: "system", subtype: "status", status: "compacting", session_id: "test-session" },
createResultMessage(),
{ type: "system", subtype: "session_state_changed", state: "idle" },
],
[{ type: "system", subtype: "compact_boundary" }, { type: "result" }],
);
await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "test" }] });
const sdkMessages = extNotifications.filter((n) => n.method === "_claude/sdkMessage");
expect(sdkMessages).toHaveLength(2);
expect(sdkMessages[0].params.message.type).toBe("system");
expect(sdkMessages[0].params.message.subtype).toBe("compact_boundary");
expect(sdkMessages[1].params.message.type).toBe("result");
});
});

View File

@@ -169,6 +169,64 @@ describe("authorization", () => {
);
});
it("SSH session falls back to single legacy login method", async () => {
const [agent] = await createAgentMock();
vi.stubGlobal("process", { ...process, env: { ...process.env, SSH_TTY: "/dev/pts/0" } });
const initializeResponse = await agent.initialize({
protocolVersion: 1,
clientCapabilities: { auth: { terminal: true } },
});
expect(initializeResponse.authMethods).toContainEqual(
expect.objectContaining({ id: "claude-login" }),
);
expect(initializeResponse.authMethods).not.toContainEqual(
expect.objectContaining({ id: "claude-ai-login" }),
);
expect(initializeResponse.authMethods).not.toContainEqual(
expect.objectContaining({ id: "console-login" }),
);
});
it("CLAUDE_CODE_REMOTE falls back to single legacy login method", async () => {
const [agent] = await createAgentMock();
vi.stubGlobal("process", { ...process, env: { ...process.env, CLAUDE_CODE_REMOTE: "1" } });
const initializeResponse = await agent.initialize({
protocolVersion: 1,
clientCapabilities: { auth: { terminal: true } },
});
expect(initializeResponse.authMethods).toContainEqual(
expect.objectContaining({ id: "claude-login" }),
);
expect(initializeResponse.authMethods).not.toContainEqual(
expect.objectContaining({ id: "claude-ai-login" }),
);
expect(initializeResponse.authMethods).not.toContainEqual(
expect.objectContaining({ id: "console-login" }),
);
});
it("remote environment respects hide-claude-auth", async () => {
const [agent] = await createAgentMock();
vi.stubGlobal("process", {
...process,
argv: ["--hide-claude-auth"],
env: { ...process.env, SSH_CONNECTION: "192.168.1.1 12345 192.168.1.2 22" },
});
const initializeResponse = await agent.initialize({
protocolVersion: 1,
clientCapabilities: { auth: { terminal: true } },
});
expect(initializeResponse.authMethods).not.toContainEqual(
expect.objectContaining({ id: "claude-login" }),
);
});
it("show claude authentication", async () => {
const [agent] = await createAgentMock();

View File

@@ -93,7 +93,10 @@ describe("session config options", () => {
cancelled: false,
permissionMode: "default",
settingsManager: {},
modes: structuredClone(MOCK_MODES),
models: structuredClone(MOCK_MODELS),
configOptions: structuredClone(MOCK_CONFIG_OPTIONS),
contextWindowSize: 200000,
};
}

View File

@@ -0,0 +1,148 @@
import { describe, it, expect } from "vitest";
import { randomUUID } from "crypto";
import { AgentSideConnection, RequestError, SessionNotification } from "@agentclientprotocol/sdk";
import { query, getSessionMessages } from "@anthropic-ai/claude-agent-sdk";
import { ClaudeAcpAgent } from "../acp-agent.js";
import { Pushable } from "../utils.js";
import type { SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
function createMockClient(): AgentSideConnection {
return {
sessionUpdate: async (_notification: SessionNotification) => {},
requestPermission: async () => ({ outcome: { outcome: "cancelled" } }),
readTextFile: async () => ({ content: "" }),
writeTextFile: async () => ({}),
} as unknown as AgentSideConnection;
}
describe.skipIf(!process.env.RUN_INTEGRATION_TESTS)("session load/resume lifecycle", () => {
it("SDK: session created but never prompted has no messages and is not resumable", async () => {
// Create a session via the SDK, initialize it, but never send a prompt
const sessionId = randomUUID();
const input = new Pushable<SDKUserMessage>();
const q = query({
prompt: input,
options: {
systemPrompt: { type: "preset", preset: "claude_code" },
sessionId,
settingSources: ["user", "project", "local"],
includePartialMessages: true,
},
});
// initializationResult() works without needing a prompt pushed
const initResult = await q.initializationResult();
expect(initResult).toBeDefined();
// Close without ever prompting
input.end();
q.return(undefined);
// Verify no messages were stored
const messages = await getSessionMessages(sessionId);
expect(messages).toEqual([]);
// Verify the session is not resumable
const input2 = new Pushable<SDKUserMessage>();
const q2 = query({
prompt: input2,
options: {
systemPrompt: { type: "preset", preset: "claude_code" },
resume: sessionId,
settingSources: ["user", "project", "local"],
includePartialMessages: true,
},
});
await expect(q2.initializationResult()).rejects.toThrow(
/No conversation found with session ID/,
);
input2.end();
q2.return(undefined);
}, 30000);
it("ACP: loadSession throws resourceNotFound for a non-existent session", async () => {
const agent = new ClaudeAcpAgent(createMockClient());
const bogusSessionId = randomUUID();
try {
await expect(
agent.loadSession({
sessionId: bogusSessionId,
cwd: process.cwd(),
mcpServers: [],
}),
).rejects.toThrow(RequestError);
} finally {
await agent.dispose();
}
}, 30000);
it("ACP: resumeSession throws resourceNotFound for a non-existent session", async () => {
const agent = new ClaudeAcpAgent(createMockClient());
const bogusSessionId = randomUUID();
try {
await expect(
agent.unstable_resumeSession({
sessionId: bogusSessionId,
cwd: process.cwd(),
mcpServers: [],
}),
).rejects.toThrow(RequestError);
} finally {
await agent.dispose();
}
}, 30000);
it("ACP: newSession without prompt, then loadSession on fresh agent throws resourceNotFound", async () => {
// Step 1: Create a real session via ACP, never prompt, dispose
const agentA = new ClaudeAcpAgent(createMockClient());
const { sessionId } = await agentA.newSession({
cwd: process.cwd(),
mcpServers: [],
});
expect(sessionId).toBeDefined();
await agentA.dispose();
// Step 2: Fresh agent tries to load that session
const agentB = new ClaudeAcpAgent(createMockClient());
try {
await expect(
agentB.loadSession({
sessionId,
cwd: process.cwd(),
mcpServers: [],
}),
).rejects.toThrow(RequestError);
} finally {
await agentB.dispose();
}
}, 30000);
it("ACP: newSession without prompt, then resumeSession on fresh agent throws resourceNotFound", async () => {
const agentA = new ClaudeAcpAgent(createMockClient());
const { sessionId } = await agentA.newSession({
cwd: process.cwd(),
mcpServers: [],
});
await agentA.dispose();
const agentB = new ClaudeAcpAgent(createMockClient());
try {
await expect(
agentB.unstable_resumeSession({
sessionId,
cwd: process.cwd(),
mcpServers: [],
}),
).rejects.toThrow(RequestError);
} finally {
await agentB.dispose();
}
}, 30000);
});

View File

@@ -11,7 +11,12 @@ import {
BetaBashCodeExecutionToolResultBlockParam,
} from "@anthropic-ai/sdk/resources/beta.mjs";
import { toAcpNotifications, ToolUseCache, Logger } from "../acp-agent.js";
import { toolUpdateFromToolResult, createPostToolUseHook, toolInfoFromToolUse } from "../tools.js";
import {
toolUpdateFromToolResult,
createPostToolUseHook,
toolInfoFromToolUse,
planEntries,
} from "../tools.js";
describe("rawOutput in tool call updates", () => {
const mockClient = {} as AgentSideConnection;
@@ -1271,3 +1276,112 @@ describe("toolInfoFromToolUse - ExitPlanMode", () => {
expect(info.content).toEqual([]);
});
});
describe("toolInfoFromToolUse - undefined input regression", () => {
it("Read with undefined input should not throw", () => {
const toolUse = { name: "Read", id: "toolu_read_undef", input: undefined };
const info = toolInfoFromToolUse(toolUse, false);
expect(info.title).toBe("Read File");
expect(info.locations).toEqual([]);
});
it("Grep with undefined input should not throw", () => {
const toolUse = { name: "Grep", id: "toolu_grep_undef", input: undefined };
const info = toolInfoFromToolUse(toolUse, false);
expect(info.title).toBe("grep");
});
it("Glob with undefined input should not throw", () => {
const toolUse = { name: "Glob", id: "toolu_glob_undef", input: undefined };
const info = toolInfoFromToolUse(toolUse, false);
expect(info.title).toBe("Find");
expect(info.locations).toEqual([]);
});
it("WebSearch with undefined input should not throw", () => {
const toolUse = { name: "WebSearch", id: "toolu_ws_undef", input: undefined };
const info = toolInfoFromToolUse(toolUse, false);
expect(info.title).toBe("Web search");
});
it("TodoWrite with undefined input should not throw", () => {
const toolUse = { name: "TodoWrite", id: "toolu_todo_undef", input: undefined };
const info = toolInfoFromToolUse(toolUse, false);
expect(info.title).toBe("Update TODOs");
});
});
describe("planEntries - undefined input regression", () => {
it("should return empty array when input is undefined", () => {
expect(planEntries(undefined)).toEqual([]);
});
it("should return empty array when input has no todos", () => {
expect(planEntries({} as any)).toEqual([]);
});
it("should still map valid todos correctly", () => {
const result = planEntries({
todos: [
{ content: "Task 1", status: "pending", activeForm: "" },
{ content: "Task 2", status: "completed", activeForm: "" },
],
});
expect(result).toEqual([
{ content: "Task 1", status: "pending", priority: "medium" },
{ content: "Task 2", status: "completed", priority: "medium" },
]);
});
});
describe("toAcpNotifications - TodoWrite with undefined input regression", () => {
const mockClient = {} as AgentSideConnection;
const mockLogger: Logger = { log: () => {}, error: () => {} };
it("should not throw when TodoWrite tool_use has undefined input", () => {
const toolUseCache: ToolUseCache = {};
const notifications = toAcpNotifications(
[
{
type: "tool_use" as const,
id: "toolu_todo_undef",
name: "TodoWrite",
input: undefined as any,
},
],
"assistant",
"test-session",
toolUseCache,
mockClient,
mockLogger,
);
// TodoWrite with undefined input should not crash, and should not emit plan update
const planUpdates = notifications.filter((n) => (n.update as any).sessionUpdate === "plan");
expect(planUpdates).toHaveLength(0);
});
it("should still emit plan update when TodoWrite has valid input", () => {
const toolUseCache: ToolUseCache = {};
const notifications = toAcpNotifications(
[
{
type: "tool_use" as const,
id: "toolu_todo_valid",
name: "TodoWrite",
input: { todos: [{ content: "Do X", status: "pending" }] },
},
],
"assistant",
"test-session",
toolUseCache,
mockClient,
mockLogger,
);
const planUpdates = notifications.filter((n) => (n.update as any).sessionUpdate === "plan");
expect(planUpdates).toHaveLength(1);
});
});

View File

@@ -128,7 +128,7 @@ export function toolInfoFromToolUse(
switch (name) {
case "Agent":
case "Task": {
const input = toolUse.input as AgentInput | BashInput;
const input = toolUse.input as AgentInput | BashInput | undefined;
return {
title: input?.description ? input.description : "Task",
kind: "think",
@@ -145,7 +145,7 @@ export function toolInfoFromToolUse(
}
case "Bash": {
const input = toolUse.input as BashInput;
const input = toolUse.input as BashInput | undefined;
return {
title: input?.command ? input.command : "Terminal",
kind: "execute",
@@ -163,18 +163,18 @@ export function toolInfoFromToolUse(
}
case "Read": {
const input = toolUse.input as FileReadInput;
const input = toolUse.input as FileReadInput | undefined;
let limit = "";
if (input.limit && input.limit > 0) {
if (input?.limit && input.limit > 0) {
limit = " (" + (input.offset ?? 1) + " - " + ((input.offset ?? 1) + input.limit - 1) + ")";
} else if (input.offset) {
} else if (input?.offset) {
limit = " (from line " + input.offset + ")";
}
const displayPath = input.file_path ? toDisplayPath(input.file_path, cwd) : "File";
const displayPath = input?.file_path ? toDisplayPath(input.file_path, cwd) : "File";
return {
title: "Read " + displayPath + limit,
kind: "read",
locations: input.file_path
locations: input?.file_path
? [
{
path: input.file_path,
@@ -187,7 +187,7 @@ export function toolInfoFromToolUse(
}
case "Write": {
const input = toolUse.input as FileWriteInput;
const input = toolUse.input as FileWriteInput | undefined;
let content: ToolCallContent[] = [];
if (input && input.file_path) {
content = [
@@ -216,7 +216,7 @@ export function toolInfoFromToolUse(
}
case "Edit": {
const input = toolUse.input as FileEditInput;
const input = toolUse.input as FileEditInput | undefined;
let content: ToolCallContent[] = [];
if (input && input.file_path && (input.old_string || input.new_string)) {
content = [
@@ -238,44 +238,44 @@ export function toolInfoFromToolUse(
}
case "Glob": {
const input = toolUse.input as GlobInput;
const input = toolUse.input as GlobInput | undefined;
let label = "Find";
if (input.path) {
if (input?.path) {
label += ` \`${input.path}\``;
}
if (input.pattern) {
if (input?.pattern) {
label += ` \`${input.pattern}\``;
}
return {
title: label,
kind: "search",
content: [],
locations: input.path ? [{ path: input.path }] : [],
locations: input?.path ? [{ path: input.path }] : [],
};
}
case "Grep": {
const input = toolUse.input as GrepInput;
const input = toolUse.input as GrepInput | undefined;
let label = "grep";
if (input["-i"]) {
if (input?.["-i"]) {
label += " -i";
}
if (input["-n"]) {
if (input?.["-n"]) {
label += " -n";
}
if (input["-A"] !== undefined) {
if (input?.["-A"] !== undefined) {
label += ` -A ${input["-A"]}`;
}
if (input["-B"] !== undefined) {
if (input?.["-B"] !== undefined) {
label += ` -B ${input["-B"]}`;
}
if (input["-C"] !== undefined) {
if (input?.["-C"] !== undefined) {
label += ` -C ${input["-C"]}`;
}
if (input.output_mode) {
if (input?.output_mode) {
switch (input.output_mode) {
case "files_with_matches":
label += " -l";
@@ -289,27 +289,27 @@ export function toolInfoFromToolUse(
}
}
if (input.head_limit !== undefined) {
if (input?.head_limit !== undefined) {
label += ` | head -${input.head_limit}`;
}
if (input.glob) {
if (input?.glob) {
label += ` --include="${input.glob}"`;
}
if (input.type) {
if (input?.type) {
label += ` --type=${input.type}`;
}
if (input.multiline) {
if (input?.multiline) {
label += " -P";
}
if (input.pattern) {
if (input?.pattern) {
label += ` "${input.pattern}"`;
}
if (input.path) {
if (input?.path) {
label += ` ${input.path}`;
}
@@ -338,14 +338,14 @@ export function toolInfoFromToolUse(
}
case "WebSearch": {
const input = toolUse.input as WebSearchInput;
let label = `"${input.query}"`;
const input = toolUse.input as WebSearchInput | undefined;
let label = input?.query ? `"${input.query}"` : "Web search";
if (input.allowed_domains && input.allowed_domains.length > 0) {
if (input?.allowed_domains && input.allowed_domains.length > 0) {
label += ` (allowed: ${input.allowed_domains.join(", ")})`;
}
if (input.blocked_domains && input.blocked_domains.length > 0) {
if (input?.blocked_domains && input.blocked_domains.length > 0) {
label += ` (blocked: ${input.blocked_domains.join(", ")})`;
}
@@ -357,7 +357,7 @@ export function toolInfoFromToolUse(
}
case "TodoWrite": {
const input = toolUse.input as TodoWriteInput;
const input = toolUse.input as TodoWriteInput | undefined;
return {
title: Array.isArray(input?.todos)
? `Update TODOs: ${input.todos.map((todo: any) => todo.content).join(", ")}`
@@ -368,7 +368,7 @@ export function toolInfoFromToolUse(
}
case "ExitPlanMode": {
const planInput = toolUse.input as { plan?: string };
const planInput = toolUse.input as { plan?: string } | undefined;
return {
title: "Ready to code?",
kind: "switch_mode",
@@ -661,10 +661,10 @@ export type ClaudePlanEntry = {
activeForm: string;
};
export function planEntries(input: { todos: ClaudePlanEntry[] }): PlanEntry[] {
return input.todos.map((input) => ({
content: input.content,
status: input.status,
export function planEntries(input: { todos: ClaudePlanEntry[] } | undefined): PlanEntry[] {
return (input?.todos ?? []).map((todo) => ({
content: todo.content,
status: todo.status,
priority: "medium",
}));
}