mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-11-21 16:51:28 +00:00
Compare commits
3 Commits
v0.109.1-p
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4af4581ad5 | ||
|
|
988a58b908 | ||
|
|
6d9e2766c7 |
@@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "0.109.0"
|
||||
".": "0.109.1"
|
||||
}
|
||||
|
||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,5 +1,23 @@
|
||||
# Changelog
|
||||
|
||||
## [0.109.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.109.0...v0.109.1) (2026-11-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* announce a live subagent again when its session is loaded or resumed ([#1688](https://github.com/agentclientprotocol/claude-agent-acp/issues/1688)) ([b977017](https://github.com/agentclientprotocol/claude-agent-acp/commit/b977017ed88148fbbc8bdd6e24cd275313c546e6))
|
||||
* apply a provider's route to the running session ([#1691](https://github.com/agentclientprotocol/claude-agent-acp/issues/1691)) ([988a58b](https://github.com/agentclientprotocol/claude-agent-acp/commit/988a58b908d55a933e9d297c142e9040d478bd69))
|
||||
* give a forked skill's child session its tool calls and text ([#1677](https://github.com/agentclientprotocol/claude-agent-acp/issues/1677)) ([1c90fb9](https://github.com/agentclientprotocol/claude-agent-acp/commit/1c90fb959a003eba1eed1dac94400c9cdef63195))
|
||||
* keep built-in web-fetch and claude-code-guide agents out of the Agent picker ([#1672](https://github.com/agentclientprotocol/claude-agent-acp/issues/1672)) ([eb4c16f](https://github.com/agentclientprotocol/claude-agent-acp/commit/eb4c16f10a753925090289c21f2d95bd902a7b63))
|
||||
* match v1 session/options to resume when workspace roots change ([#1679](https://github.com/agentclientprotocol/claude-agent-acp/issues/1679)) ([184b7df](https://github.com/agentclientprotocol/claude-agent-acp/commit/184b7df993c0c64df593188f15bb0e5206f3e6fb))
|
||||
* reject requests that name a replayed subagent session with -32602 ([#1686](https://github.com/agentclientprotocol/claude-agent-acp/issues/1686)) ([3304ca7](https://github.com/agentclientprotocol/claude-agent-acp/commit/3304ca724c25c7258c837cc0394adb4111ea8987))
|
||||
* report unusable Claude subscriptions as unauthenticated ([#1678](https://github.com/agentclientprotocol/claude-agent-acp/issues/1678)) ([a4f0f78](https://github.com/agentclientprotocol/claude-agent-acp/commit/a4f0f78bb31539005d0d54ab69f7e28f91443b14))
|
||||
* send a replayed subagent's configuration after the replay, not inside it ([#1685](https://github.com/agentclientprotocol/claude-agent-acp/issues/1685)) ([6a760cb](https://github.com/agentclientprotocol/claude-agent-acp/commit/6a760cbca64adc72634274088914e99a51da084a))
|
||||
* show readable titles for MCP tool calls ([#1674](https://github.com/agentclientprotocol/claude-agent-acp/issues/1674)) ([80440d8](https://github.com/agentclientprotocol/claude-agent-acp/commit/80440d8b8294f9d4cd086d7cba39c716107657f0))
|
||||
* update to @agentclientprotocol/sdk 2.9.0 ([#1687](https://github.com/agentclientprotocol/claude-agent-acp/issues/1687)) ([022ff53](https://github.com/agentclientprotocol/claude-agent-acp/commit/022ff532449371198a0d715a921578e27c101532))
|
||||
* update to @agentclientprotocol/sdk 2.9.1 ([#1690](https://github.com/agentclientprotocol/claude-agent-acp/issues/1690)) ([85a0d6c](https://github.com/agentclientprotocol/claude-agent-acp/commit/85a0d6c6f111119855b0e199801a9f71b60f50bf))
|
||||
* update to @anthropic-ai/claude-agent-sdk 0.3.330 ([#1689](https://github.com/agentclientprotocol/claude-agent-acp/issues/1689)) ([6d9e276](https://github.com/agentclientprotocol/claude-agent-acp/commit/6d9e2766c74dcd9ccd5c5a83b8523b65c234041f))
|
||||
|
||||
## [0.109.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.1...v0.109.0) (2026-11-19)
|
||||
|
||||
|
||||
|
||||
104
package-lock.json
generated
104
package-lock.json
generated
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "@agentclientprotocol/claude-agent-acp",
|
||||
"version": "0.109.0",
|
||||
"version": "0.109.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@agentclientprotocol/claude-agent-acp",
|
||||
"version": "0.109.0",
|
||||
"version": "0.109.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "2.9.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.330",
|
||||
"diff": "9.0.0",
|
||||
"zod": "4.6.7"
|
||||
},
|
||||
@@ -18,7 +18,7 @@
|
||||
"claude-agent-acp": "dist/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anthropic-ai/sdk": "1.10.0",
|
||||
"@anthropic-ai/sdk": "1.12.0",
|
||||
"@eslint/js": "10.0.1",
|
||||
"@tsconfig/node22": "22.0.7",
|
||||
"@types/node": "26.6.6",
|
||||
@@ -53,22 +53,22 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.328.tgz",
|
||||
"integrity": "sha512-YcOWlpXVm7etPjPVrvSJEfynDksMiG11zvEybSBnk1EVWji6rSjU75HbbhJ8XPEB2ECEwRRP597Udu6IWMtsDw==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.330.tgz",
|
||||
"integrity": "sha512-7om9Xus6tfkeCUCfzg6ilJuN6Z7okkEvJ0mx+ukXa/Id5U/6BGtPkOYni+3ebedwa3b9SVF7A05+ln+/9EoU/w==",
|
||||
"license": "SEE LICENSE IN README.md",
|
||||
"engines": {
|
||||
"node": ">=18.14.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.328"
|
||||
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.330",
|
||||
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.330",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.330",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.330",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.330",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.330",
|
||||
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.330",
|
||||
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.330"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@anthropic-ai/sdk": ">=0.93.0",
|
||||
@@ -77,9 +77,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-darwin-arm64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.328.tgz",
|
||||
"integrity": "sha512-vjBASSSZFNs5M84XONCM4xAJMKPD0E9RtF0UDQ/a1Qqt5L+slNxhSADkH5n0tEM5HJMK7j9DCPi+0FVOBpZr3w==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.330.tgz",
|
||||
"integrity": "sha512-J9nqvcfD2V90O5uoR8At66R51VYtSMKnxSmPc0S4A4F5oX1VbokcpJLXU1yVCOuTtzr/OIHjRr9nn2vKi/S6rQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -90,9 +90,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-darwin-x64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.328.tgz",
|
||||
"integrity": "sha512-pkZuDNi16H4yJFo6cS2sw8mFj7m7ESAxV74t2gQ9EFzZOpXbQoJqhPBHNEZJ2q/+kr/3vHUtRc2W6jURA6nS+A==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.330.tgz",
|
||||
"integrity": "sha512-woe+f9qeZYWML5fACibNyth0xMDf22riNRNDryIYuhdteh7IoWrK6zC31cC2MrZRoqDZcPVtfOLND79+iZbrLA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -103,9 +103,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.328.tgz",
|
||||
"integrity": "sha512-VvsUzOEf7r3ZtOPfliNGxqknsIvxEmnUOtQnq4+uw7MsfiALKR4s0bx2SP32UuXpqbmqxR1gn456D27XgsAmnA==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.330.tgz",
|
||||
"integrity": "sha512-2Q+kfzaoTvJv1rsyu+iR4UHDZ3nxiOfdXISk+2ydQShU9DqXNlgQAt3BdJMh0Yx4MrxB66TMphVvVQeRslwwhA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -119,9 +119,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64-musl": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.328.tgz",
|
||||
"integrity": "sha512-4Vui26/OZwr8AU7FpAt+R5s/1AKmj5qDorUZIqF1MMfdjAQf8/ut/+HyEkuMom/MVF2JeQLdvnFFFmbfgmAq/g==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.330.tgz",
|
||||
"integrity": "sha512-fXmuAEegw31v+kiBd51yn7RVhjs7Rz2lnhfx/+XJXqt5lyqR2v7Ul/U/9r1CQZKuIw8M3ms9jQqGpmKbgKndqQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -135,9 +135,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-linux-x64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.328.tgz",
|
||||
"integrity": "sha512-saP4fWgVZj1n7MYCqvTKADHXIc/hIAMRDpLVpXD5xB0IT68vhWgIMkzIrsg5P02P6zA49TDuoijbP1YBUEXT4A==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.330.tgz",
|
||||
"integrity": "sha512-9w4uMdA3vNZXocwOUhivOGotXoRDxN/C/xPMkZMY9WPpKLAlj8upMZskNgPjQKlVRXhxPfNagcBijGPUH4WepA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -151,9 +151,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-linux-x64-musl": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.328.tgz",
|
||||
"integrity": "sha512-oJowzzjhWGbdBGyRjqV9CT0nfh4A4/fEI11LjX6b1SkhrNNgy9QT2HzSe8A2yNlliOWo1xJl6nAHT8pLwMNlVg==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.330.tgz",
|
||||
"integrity": "sha512-kooZMdp6tFwNFkDXbGoNTZMgFcPQfJVfG+gZ2qAdkk11S6MFts9ybHRLQmzUK3VrqlahH7T9fmI2mNfzYgOXkw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -167,9 +167,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-win32-arm64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.328.tgz",
|
||||
"integrity": "sha512-FkqzA++c+giPH2k8svb0egWDiGDkvSLQJTp5bq7QFXOxPEael4ct1yjKit/Yu6Sd48uLEgNT1waBYbyApPzhOw==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.330.tgz",
|
||||
"integrity": "sha512-6jscch7vk/XBSn7mm1i6zwTeiz05q98nKrQ3HdTavQEDGvXycMcB/QxIdMrs3vrdNEjWuoxwrL1qlT1lOyAWLg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -180,9 +180,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-win32-x64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.328.tgz",
|
||||
"integrity": "sha512-9Wd0XrZ0QWkgtcKxObcYDvUpQjUzN3Uq4Chbvu1SOWOoKPfQdD40dwRQMCeKx2KGxAfMrggJ7I3JYnvRWAFYjg==",
|
||||
"version": "0.3.330",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.330.tgz",
|
||||
"integrity": "sha512-ooThWbUXlXKTDgj2VgWBXQ/6vSOTaAbBDWPvvCGNHi20haoSkw4uPX9gczkX+HJuVTslvvLiYIfe8zleVPzi7A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -193,9 +193,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/sdk": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.10.0.tgz",
|
||||
"integrity": "sha512-j4uVct5p3aGIz/BU4K8VU5vt2A6AueHTvx2gfF3xr4mVpwH9IJMWEAUKNwSwdZSJOHQq1Za2tv5huYc5v02D0w==",
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.12.0.tgz",
|
||||
"integrity": "sha512-0j9zwiQdkvr90LoiiBDUh7kae1lsNW2EqeE0vGceYne4BrmMDdDVoQ4KGOieUee0zWZbVJKsf/06JY8U5i63Xg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.4.1",
|
||||
@@ -215,9 +215,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.29.14",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.14.tgz",
|
||||
"integrity": "sha512-Y5tqevQaUAZhhj82BpYMNC1ssvLQTVAfwKdm8iy8qwmhvC2/CpcAu8OC+QEtjM7pMk7knx83u1Qj8gzkicyelw==",
|
||||
"version": "7.29.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.15.tgz",
|
||||
"integrity": "sha512-304gsbbGVmQc+cNGHzwHBlqepYdWLKj3VXCQBGt/EGcV7PUPfKI7kAUNW1FZEOCwlQiLvQjg1JEaAlRQ616h+Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -400,9 +400,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@hono/node-server": {
|
||||
"version": "2.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.9.tgz",
|
||||
"integrity": "sha512-Sk4NQd3GFY0WZWCzndwFMPwJhtD0y9qjsQ+pjID0/03nK9pxyBCUoUHCho8QYBLBVhi0ssL8UkNPHqbgSOFPIQ==",
|
||||
"version": "2.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.11.tgz",
|
||||
"integrity": "sha512-KzKz9vl4vvr1vgLHamj+g5uonbrj5NwAdO3yzOS6cd2HjALVeOgTgeZOyAzNxejbkfOOPIcvuf/Tg8l1pEFLog==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
@@ -3609,14 +3609,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.3.tgz",
|
||||
"integrity": "sha512-xj+WrAkyv5Qp+t7r9N5HvCBu7g1qOe6CKRNpq22X1GGcPEQADFU54v5qsPVs3/vrUFQ7XivFrcAVKA2stI0kWA==",
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.4.tgz",
|
||||
"integrity": "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/standardwebhooks": {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "0.109.0",
|
||||
"version": "0.109.1",
|
||||
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
|
||||
"main": "dist/lib.js",
|
||||
"types": "dist/lib.d.ts",
|
||||
@@ -69,12 +69,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "2.9.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.330",
|
||||
"diff": "9.0.0",
|
||||
"zod": "4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anthropic-ai/sdk": "1.10.0",
|
||||
"@anthropic-ai/sdk": "1.12.0",
|
||||
"@eslint/js": "10.0.1",
|
||||
"@tsconfig/node22": "22.0.7",
|
||||
"@types/node": "26.6.6",
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
* `providers/disable`, and the legacy gateway logins (`authenticate` or
|
||||
* `auth/login` with `gateway` or `gateway-bedrock`). Each core holds its own
|
||||
* {@link ProviderConfig} and gateway login, and builds the query env of its
|
||||
* sessions with {@link createEnvForProvider}.
|
||||
* sessions with {@link createEnvForProvider}. It holds that route above the
|
||||
* user's and the project's settings with {@link providerRouteSettings} and
|
||||
* {@link applyProviderRoute}.
|
||||
*/
|
||||
import {
|
||||
RequestError,
|
||||
@@ -15,6 +17,7 @@ import {
|
||||
type ProviderInfo,
|
||||
type SetProviderRequest,
|
||||
} from "@agentclientprotocol/sdk/unstable";
|
||||
import type { Query } from "@anthropic-ai/claude-agent-sdk";
|
||||
import {
|
||||
GatewayListingError,
|
||||
listBedrockModels,
|
||||
@@ -187,6 +190,50 @@ export function createEnvForProvider(config: ProviderConfig | null): Record<stri
|
||||
};
|
||||
}
|
||||
|
||||
/** A provider's route as settings of Claude Code (see {@link providerRouteSettings}). */
|
||||
export type ProviderRouteSettings = { apiKeyHelper: ""; env: Record<string, string> };
|
||||
|
||||
/**
|
||||
* The route of a provider as settings of Claude Code, for the tier of the
|
||||
* `settings` option. `env` is the result of {@link createEnvForProvider}.
|
||||
*
|
||||
* Claude Code applies the `env` of settings files after the process env, so
|
||||
* without this tier the user's or the project's settings could restore another
|
||||
* `ANTHROPIC_BASE_URL`. The empty `apiKeyHelper` turns off a helper of theirs.
|
||||
*/
|
||||
export function providerRouteSettings(env: Record<string, string>): ProviderRouteSettings {
|
||||
return { apiKeyHelper: "", env };
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends `route` to the running session, into the tier of the `settings`
|
||||
* option (`applyFlagSettings`). Call it right after the query's initialize
|
||||
* response, before a request of the session reaches the provider:
|
||||
* `getContextUsage()` sends one (`count_tokens`).
|
||||
*
|
||||
* The `settings` option holds the route too, in one object with the client's
|
||||
* settings and the model configuration. Claude Code loads that object as a
|
||||
* whole or not at all: one value that fails validation, e.g.
|
||||
* `permissions.allow: "Bash"`, leaves all of it out. This call does not depend
|
||||
* on that object. When the object did load, the call changes nothing: Claude
|
||||
* Code merges `env` key by key.
|
||||
*
|
||||
* Throws when Claude Code refuses the route. The caller must close the query.
|
||||
*/
|
||||
export async function applyProviderRoute(
|
||||
query: Pick<Query, "applyFlagSettings">,
|
||||
route: ProviderRouteSettings,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await query.applyFlagSettings(route);
|
||||
} catch (error) {
|
||||
throw RequestError.internalError(
|
||||
{ details: error instanceof Error ? error.message : String(error) },
|
||||
"The session was not started, because Claude Code did not take its provider or gateway route. Try again, or set the provider or the gateway login again.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function sameHeaders(a: Record<string, string>, b: Record<string, string>): boolean {
|
||||
const aKeys = Object.keys(a);
|
||||
return aKeys.length === Object.keys(b).length && aKeys.every((key) => b[key] === a[key]);
|
||||
|
||||
@@ -39,6 +39,7 @@ export function makeMockQuery(overrides: Record<string, unknown> = {}) {
|
||||
supportedCommands: async () => [],
|
||||
mcpServerStatus: async () => [],
|
||||
setMcpServers: async () => ({ added: [], removed: [], errors: {} }),
|
||||
applyFlagSettings: async () => {},
|
||||
getContextUsage: async () => DEFAULT_CONTEXT_USAGE,
|
||||
// No ultracode fields: session creation falls back to settings and the
|
||||
// model's effort levels, as with a CLI that does not report them.
|
||||
|
||||
@@ -149,6 +149,7 @@ function scriptedTurnQuery(args: any, account: Record<string, unknown>) {
|
||||
query.accountInfo = async () => account;
|
||||
query.setModel = async () => {};
|
||||
query.setPermissionMode = async () => {};
|
||||
query.applyFlagSettings = async () => {};
|
||||
query.supportedCommands = async () => [];
|
||||
query.mcpServerStatus = async () => [];
|
||||
query.getContextUsage = async () => DEFAULT_CONTEXT_USAGE;
|
||||
|
||||
@@ -15,6 +15,7 @@ const mockQuery = vi.hoisted(() =>
|
||||
}),
|
||||
setModel: vi.fn(),
|
||||
setPermissionMode: vi.fn(),
|
||||
applyFlagSettings: vi.fn().mockResolvedValue(undefined),
|
||||
supportedCommands: vi.fn().mockResolvedValue([]),
|
||||
close: vi.fn(() => closed.resolve()),
|
||||
interrupt: vi.fn().mockResolvedValue(undefined),
|
||||
@@ -221,9 +222,65 @@ describe("providers", () => {
|
||||
|
||||
expect(mockQuery).toHaveBeenCalledOnce();
|
||||
expect(mockQuery.mock.calls[0][0].options.resume).toBeUndefined();
|
||||
expect(mockQuery.mock.results[0].value.applyFlagSettings).not.toHaveBeenCalled();
|
||||
expect(mockQuery.mock.results[0].value.close).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("applies the route to the running session before its first context read", async () => {
|
||||
const [agent, mockQuery] = await createAgentMock();
|
||||
await agent.initialize({ protocolVersion: 1, clientCapabilities: {} });
|
||||
await agent.unstable_setProvider({
|
||||
providerId: "main",
|
||||
apiType: "anthropic",
|
||||
baseUrl: "https://gateway.example",
|
||||
headers: { "x-api-key": "test" },
|
||||
});
|
||||
|
||||
await agent.newSession({ cwd: process.cwd(), mcpServers: [] });
|
||||
|
||||
const query = mockQuery.mock.results[0].value;
|
||||
// The route of the `settings` option, without the client's settings.
|
||||
expect(query.applyFlagSettings.mock.calls[0]).toEqual([
|
||||
{
|
||||
apiKeyHelper: "",
|
||||
env: expect.objectContaining({
|
||||
ANTHROPIC_AUTH_TOKEN: "acp-proxy",
|
||||
ANTHROPIC_BASE_URL: "https://gateway.example",
|
||||
ANTHROPIC_CUSTOM_HEADERS: "x-api-key: test",
|
||||
}),
|
||||
},
|
||||
]);
|
||||
expect(query.applyFlagSettings.mock.invocationCallOrder[0]).toBeLessThan(
|
||||
query.getContextUsage.mock.invocationCallOrder[0],
|
||||
);
|
||||
});
|
||||
|
||||
it("starts no session when Claude Code refuses the route", async () => {
|
||||
const [agent, mockQuery] = await createAgentMock();
|
||||
await agent.initialize({ protocolVersion: 1, clientCapabilities: {} });
|
||||
await agent.unstable_setProvider({
|
||||
providerId: "main",
|
||||
apiType: "anthropic",
|
||||
baseUrl: "https://gateway.example",
|
||||
});
|
||||
// The text of Claude Code 2.1.328 for a refused `applyFlagSettings`.
|
||||
const refusal =
|
||||
"apply_flag_settings: nothing in this request was applied and earlier settings stay in force. Fix or remove these invalid settings and send it again: env";
|
||||
const query = mockQuery.getMockImplementation()!();
|
||||
query.applyFlagSettings.mockRejectedValue(new Error(refusal));
|
||||
mockQuery.mockReturnValueOnce(query);
|
||||
|
||||
await expect(agent.newSession({ cwd: process.cwd(), mcpServers: [] })).rejects.toMatchObject({
|
||||
code: -32603,
|
||||
message: expect.stringContaining("Claude Code did not take its provider or gateway route"),
|
||||
data: { details: refusal },
|
||||
});
|
||||
|
||||
expect(query.getContextUsage).not.toHaveBeenCalled();
|
||||
expect(query.close).toHaveBeenCalledOnce();
|
||||
expect(Object.keys(agent.sessions)).toEqual([]);
|
||||
});
|
||||
|
||||
it("recreates loaded sessions with the new provider between turns", async () => {
|
||||
const [agent, mockQuery] = await createAgentMock();
|
||||
await agent.initialize({ protocolVersion: 1, clientCapabilities: {} });
|
||||
@@ -615,6 +672,7 @@ describe("providers", () => {
|
||||
initializationResult: vi.fn().mockResolvedValue({ models }),
|
||||
setModel,
|
||||
setPermissionMode: vi.fn(),
|
||||
applyFlagSettings: vi.fn().mockResolvedValue(undefined),
|
||||
supportedCommands: vi.fn().mockResolvedValue([]),
|
||||
close: vi.fn(),
|
||||
interrupt: vi.fn().mockResolvedValue(undefined),
|
||||
|
||||
@@ -1558,6 +1558,11 @@ describe("ACP v2 sessions", () => {
|
||||
expect(sdk.queryOptions).toHaveLength(2);
|
||||
expect(sdk.queryOptions[1].effort).toBeUndefined();
|
||||
expect(sdk.flagSettings).toEqual([
|
||||
// The provider's route, before the session's own choices.
|
||||
{
|
||||
apiKeyHelper: "",
|
||||
env: expect.objectContaining({ ANTHROPIC_BASE_URL: "https://gateway.example.com" }),
|
||||
},
|
||||
{ ultracode: true },
|
||||
{ fastMode: false },
|
||||
{ fastMode: true },
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { spawn, spawnSync, type ChildProcess } from "node:child_process";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { once } from "node:events";
|
||||
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import { createServer, type Server } from "node:http";
|
||||
import type { AddressInfo } from "node:net";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
@@ -260,6 +263,57 @@ describe.skipIf(!process.env.RUN_INTEGRATION_TESTS)("v2 core with Claude Code",
|
||||
60_000,
|
||||
);
|
||||
|
||||
// The session's requests go to two local servers: it costs no API usage.
|
||||
it("keeps a provider's route when Claude Code does not load the client's settings", async () => {
|
||||
const servers: Server[] = [];
|
||||
/** Starts a local server that records the paths of its POST requests in `posts`. */
|
||||
const serve = async (posts: string[]): Promise<string> => {
|
||||
const server = createServer((request, response) => {
|
||||
if (request.method === "POST") posts.push(request.url ?? "");
|
||||
// No model listing (404), and no answer to a model request (400).
|
||||
response.writeHead(request.method === "POST" ? 400 : 404, {
|
||||
"content-type": "application/json",
|
||||
});
|
||||
response.end(
|
||||
JSON.stringify({
|
||||
type: "error",
|
||||
error: { type: "invalid_request_error", message: "local test server" },
|
||||
}),
|
||||
);
|
||||
}).listen(0, "127.0.0.1");
|
||||
servers.push(server);
|
||||
await once(server, "listening");
|
||||
return `http://127.0.0.1:${(server.address() as AddressInfo).port}`;
|
||||
};
|
||||
try {
|
||||
const providerPosts: string[] = [];
|
||||
const projectPosts: string[] = [];
|
||||
// The project's settings name another base URL than the provider's.
|
||||
await mkdir(path.join(cwd, ".claude"));
|
||||
await writeFile(
|
||||
path.join(cwd, ".claude", "settings.json"),
|
||||
JSON.stringify({ env: { ANTHROPIC_BASE_URL: await serve(projectPosts) } }),
|
||||
);
|
||||
await agent.request(v2.methods.agent.providers.set, {
|
||||
providerId: "main",
|
||||
apiType: "anthropic",
|
||||
baseUrl: await serve(providerPosts),
|
||||
});
|
||||
const { sessionId } = await agent.request(v2.methods.agent.session.new, {
|
||||
cwd,
|
||||
// `allow` must be a list, so Claude Code leaves the whole `settings` option out.
|
||||
_meta: { claudeCode: { options: { settings: { permissions: { allow: "Bash" } } } } },
|
||||
});
|
||||
await prompt(sessionId, "Reply with exactly the single word: pong");
|
||||
await until(() => states(sessionId).some((update) => update.state === "idle"));
|
||||
|
||||
expect(providerPosts.some((url) => url.startsWith("/v1/messages"))).toBe(true);
|
||||
expect(projectPosts).toEqual([]);
|
||||
} finally {
|
||||
for (const server of servers) server.close();
|
||||
}
|
||||
}, 180_000);
|
||||
|
||||
it("reports requires_action while a permission request waits", async () => {
|
||||
const sessionId = await newSession("default");
|
||||
await prompt(
|
||||
|
||||
@@ -75,6 +75,8 @@ const sdk = vi.hoisted(() => ({
|
||||
startFailure: undefined as Error | undefined,
|
||||
/** When set, the SDK refuses the query's options with it: `query()` throws. */
|
||||
optionsRefusal: undefined as Error | undefined,
|
||||
/** When set, Claude Code refuses flag settings with it: `applyFlagSettings` rejects. */
|
||||
flagRefusal: undefined as Error | undefined,
|
||||
/** When set, Claude Code's start waits for it. */
|
||||
startGate: undefined as Promise<void> | undefined,
|
||||
/** When set, the query serves Remote Control with it (`enableRemoteControl`). */
|
||||
@@ -119,7 +121,9 @@ vi.mock("@anthropic-ai/claude-agent-sdk", async () => {
|
||||
setModel: vi.fn(async () => {}),
|
||||
stopTask: vi.fn(async () => {}),
|
||||
close: vi.fn(() => push({ value: undefined, done: true })),
|
||||
applyFlagSettings: vi.fn(async () => {}),
|
||||
applyFlagSettings: vi.fn(async () => {
|
||||
if (sdk.flagRefusal) throw sdk.flagRefusal;
|
||||
}),
|
||||
rewindFiles: vi.fn(async () => ({ canRewind: true, filesChanged: [] })),
|
||||
};
|
||||
sdk.processes.push(fake);
|
||||
@@ -223,6 +227,7 @@ beforeEach(async () => {
|
||||
sdk.previewGate = undefined;
|
||||
sdk.startFailure = undefined;
|
||||
sdk.optionsRefusal = undefined;
|
||||
sdk.flagRefusal = undefined;
|
||||
sdk.startGate = undefined;
|
||||
sdk.enableRemoteControl = undefined;
|
||||
vi.mocked(forkSession).mockClear();
|
||||
@@ -650,6 +655,43 @@ describe("ACP v2 core", () => {
|
||||
});
|
||||
// In the settings tier too, so a settings.json env cannot restore another route.
|
||||
expect(settings).toMatchObject({ apiKeyHelper: "", env: { ANTHROPIC_BASE_URL: baseUrl } });
|
||||
// And applied to the running session, which does not depend on the `settings` option.
|
||||
expect(sdk.processes[0].applyFlagSettings.mock.calls[0]).toEqual([
|
||||
{ apiKeyHelper: "", env: expect.objectContaining({ ANTHROPIC_BASE_URL: baseUrl }) },
|
||||
]);
|
||||
});
|
||||
|
||||
it("starts no session when Claude Code refuses the route of a gateway login", async () => {
|
||||
// The text of Claude Code 2.1.328 for a refused `applyFlagSettings`.
|
||||
sdk.flagRefusal = new Error(
|
||||
"apply_flag_settings: nothing in this request was applied and earlier settings stay in force. " +
|
||||
"Fix or remove these invalid settings and send it again: env",
|
||||
);
|
||||
const initialized = vi.spyOn(SettingsManager.prototype, "initialize");
|
||||
const disposed = vi.spyOn(SettingsManager.prototype, "dispose");
|
||||
const client = v2Client();
|
||||
const error = await client.connect(async (agent) => {
|
||||
await agent.request(v2.methods.agent.initialize, {
|
||||
protocolVersion: v2.PROTOCOL_VERSION,
|
||||
info: { name: "v2-test-client", version: "1.0.0" },
|
||||
capabilities: { auth: { _meta: { gateway: true } } },
|
||||
});
|
||||
await agent.request(v2.methods.agent.auth.login, {
|
||||
methodId: "gateway",
|
||||
_meta: { gateway: { baseUrl: "https://gateway.example.com" } },
|
||||
});
|
||||
return agent.request(v2.methods.agent.session.new, { cwd }).catch((error: unknown) => error);
|
||||
});
|
||||
|
||||
expect(error).toMatchObject({
|
||||
code: -32603,
|
||||
message: expect.stringContaining("Claude Code did not take its provider or gateway route"),
|
||||
data: { details: sdk.flagRefusal.message },
|
||||
});
|
||||
expect(sdk.processes[0].close).toHaveBeenCalledOnce();
|
||||
expect(disposed).toHaveBeenCalledTimes(initialized.mock.calls.length);
|
||||
initialized.mockRestore();
|
||||
disposed.mockRestore();
|
||||
});
|
||||
|
||||
it("rejects an incompatible provider listing before a prompt and recovers", async () => {
|
||||
|
||||
@@ -379,6 +379,7 @@ import {
|
||||
withCurrentModelInfo,
|
||||
} from "../session-model.js";
|
||||
import {
|
||||
applyProviderRoute,
|
||||
createEnvForProvider,
|
||||
defaultProviderConfig,
|
||||
gatewayRequestToProviderConfig,
|
||||
@@ -389,6 +390,7 @@ import {
|
||||
PROVIDER_ID,
|
||||
type ProviderConfig,
|
||||
providerConfigFromSetRequest,
|
||||
providerRouteSettings,
|
||||
validatedGatewayAuthRequest,
|
||||
withListedModels,
|
||||
} from "../providers.js";
|
||||
@@ -10216,14 +10218,14 @@ export class ClaudeAcpAgent {
|
||||
userProvidedOptions?.settings,
|
||||
params.cwd,
|
||||
);
|
||||
// Claude Code applies env from settings.json after the subprocess env. Put
|
||||
// an active ACP route in the programmatic settings tier too so user/project
|
||||
// settings cannot silently restore a different ANTHROPIC_BASE_URL.
|
||||
const settings = resolvedProvider
|
||||
// An active ACP route goes into the programmatic settings tier too (see
|
||||
// `providerRouteSettings`).
|
||||
const route = resolvedProvider ? providerRouteSettings(providerEnv) : undefined;
|
||||
const settings = route
|
||||
? {
|
||||
...configuredSettingsObject,
|
||||
apiKeyHelper: "",
|
||||
env: { ...configuredSettingsObject?.env, ...providerEnv },
|
||||
...route,
|
||||
env: { ...configuredSettingsObject?.env, ...route.env },
|
||||
}
|
||||
: configuredSettingsObject;
|
||||
const env = {
|
||||
@@ -10520,6 +10522,8 @@ export class ClaudeAcpAgent {
|
||||
}
|
||||
throw startupFailureError(error) ?? error;
|
||||
}
|
||||
// Before a request of the session reaches the provider.
|
||||
if (route) await applyProviderRoute(q, route);
|
||||
timing.phase("sdk-initialize");
|
||||
|
||||
// Publish the identity BEFORE the guard can refuse this session. A
|
||||
|
||||
@@ -47,6 +47,7 @@ import {
|
||||
promptSuggestionOptions,
|
||||
type PromptSuggestionForms,
|
||||
} from "../prompt-suggestions.js";
|
||||
import { applyProviderRoute } from "../providers.js";
|
||||
import {
|
||||
readHistoryAcrossCompactions,
|
||||
readResumedTail,
|
||||
@@ -1230,6 +1231,16 @@ class V2Agent implements AgentHandle, SessionConnection {
|
||||
}
|
||||
throw startupFailureError(error) ?? error;
|
||||
}
|
||||
if (routing.settings) {
|
||||
// Before a request of the session reaches the provider.
|
||||
try {
|
||||
await applyProviderRoute(q, routing.settings);
|
||||
} catch (error) {
|
||||
q.close();
|
||||
settings.dispose();
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
authStarted(sessionId, initialization.account);
|
||||
try {
|
||||
this.guard.sessionStarted(sessionId, initialization.account, settings.getApiKeyHelper());
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
import { RequestError } from "@agentclientprotocol/sdk/unstable";
|
||||
import * as v2 from "@agentclientprotocol/sdk/experimental/v2/unstable";
|
||||
import type { AccountInfo, ModelInfo, Settings } from "@anthropic-ai/claude-agent-sdk";
|
||||
import type { AccountInfo, ModelInfo } from "@anthropic-ai/claude-agent-sdk";
|
||||
import type { AuthStatusKind } from "../auth-status.js";
|
||||
import type { Logger } from "../logger.js";
|
||||
import { terminalAuthMethods } from "../auth-methods.js";
|
||||
@@ -40,6 +40,8 @@ import {
|
||||
PROVIDER_ID,
|
||||
type ProviderConfig,
|
||||
providerConfigFromSetRequest,
|
||||
type ProviderRouteSettings,
|
||||
providerRouteSettings,
|
||||
validatedGatewayAuthRequest,
|
||||
withListedModels,
|
||||
} from "../providers.js";
|
||||
@@ -51,11 +53,11 @@ export interface SessionRouting {
|
||||
/** Added to the query's env. Empty without a gateway login or a provider. */
|
||||
env: Record<string, string>;
|
||||
/**
|
||||
* The programmatic settings of the query, with the route's env too: Claude
|
||||
* Code applies the env of settings.json after the process env, so user or
|
||||
* project settings could restore another `ANTHROPIC_BASE_URL` otherwise.
|
||||
* The route as settings, for the query's `settings` option and for the
|
||||
* running session (see `providerRouteSettings` and `applyProviderRoute`).
|
||||
* Absent without a gateway login or a provider.
|
||||
*/
|
||||
settings?: Settings;
|
||||
settings?: ProviderRouteSettings;
|
||||
/** The models the session offers: those the provider's gateway listed. */
|
||||
models(models: ModelInfo[]): ModelInfo[];
|
||||
/** Whether {@link models} narrows the models to a gateway's list. */
|
||||
@@ -243,7 +245,7 @@ export class V2Auth {
|
||||
const env = createEnvForProvider(config);
|
||||
return {
|
||||
env,
|
||||
...(config ? { settings: { apiKeyHelper: "", env } } : {}),
|
||||
...(config ? { settings: providerRouteSettings(env) } : {}),
|
||||
models: (models) =>
|
||||
config?.listedModels
|
||||
? narrowToGatewayModels(models, config.listedModels, config.bedrockRegionPrefix)
|
||||
|
||||
Reference in New Issue
Block a user