feat(deps): Bump @agentclientprotocol/sdk to 1.8.0 (#1287)

Bumps `@agentclientprotocol/sdk` from 1.7.0 to 1.8.0. The release is one
change: the protocol schema moves to v1.25.0 and v2.0.0-alpha.8.

## What changed in the SDK

Comparing the generated types of 1.7.0 and 1.8.0, the only type change
in v1 and v2 is the `error` stop reason from
[agent-client-protocol#2281](https://github.com/agentclientprotocol/agent-client-protocol/pull/2281):
`IdleStateUpdate` gains `ErrorStopReason & { stopReason: "error" }`, and
`ErrorStopReason` (an optional JSON-RPC `error`) is new. The v2 index no
longer exports `StopReason`; the adapter doesn't import it.

## The one code change

`idle()` in `src/v2/prompt.ts` built the v2 `state_update` for an ended
turn by spreading the turn's stop reason into a `SessionUpdate`. With
the larger `IdleStateUpdate` union, TypeScript can no longer match a
union of stop reasons against it (it falls through to the custom and
unknown members). The state is now typed as the members for the agent's
own stop reasons (`Extract<IdleStateUpdate, { stopReason: StopReason
}>`). A stop reason that v2 doesn't know is still a compile error, which
I checked with a throwaway probe. The output is unchanged.

## Not in this PR

The adapter doesn't use the new `error` stop reason yet. Two stand-ins
stay until a follow-up switches them, which changes behavior and golden
files:
- a failed v2 turn's `_error` stop reason with `_meta.claudeCode.error`,
and its error `notice` (`src/v2/prompt.ts`);
- a failed subagent's `_meta.claudeCode.error` in the RFD form (#1257,
not merged yet).

## Checks

- `npm run check`, `npm run build`, and all 2489 tests pass.
- The scenario suites validate every message against the schemas that
1.8.0 ships (`schema/schema.json`, `schema/v2/schema.unstable.json`),
loaded from the installed SDK. No golden file changes.
This commit is contained in:
Ben Brandt
2026-10-09 09:54:15 -07:00
committed by GitHub
parent 908c994901
commit 446a7217fa
3 changed files with 14 additions and 9 deletions

8
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "0.88.0",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "1.7.0",
"@agentclientprotocol/sdk": "1.8.0",
"@anthropic-ai/claude-agent-sdk": "0.3.293",
"diff": "9.0.0",
"zod": "4.6.5"
@@ -39,9 +39,9 @@
}
},
"node_modules/@agentclientprotocol/sdk": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-1.7.0.tgz",
"integrity": "sha512-ZORuxsuEnLjRly7t6Ad7zAsWitjWsyprswyPUHz/yycPb+tTm3DGa8XheaHhRXqX8LS9snuxaYavXSRA50TlHw==",
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-1.8.0.tgz",
"integrity": "sha512-fbP7qHZsFyTJVT0/RPrcWJ8An26qLXHEuGCHHEKDyxD1xpXV+Ejyh2LAE6vBAFePkpVjZeeohnbgvuEhZ7wLMg==",
"license": "Apache-2.0",
"peerDependencies": {
"zod": "^3.25.0 || ^4.0.0"

View File

@@ -65,7 +65,7 @@
"node": ">=22"
},
"dependencies": {
"@agentclientprotocol/sdk": "1.7.0",
"@agentclientprotocol/sdk": "1.8.0",
"@anthropic-ai/claude-agent-sdk": "0.3.293",
"diff": "9.0.0",
"zod": "4.6.5"

View File

@@ -14,7 +14,7 @@ import {
import * as v2 from "@agentclientprotocol/sdk/experimental/v2";
import type { ClaudeAcpAgent } from "../acp-agent.js";
import { splitNoticeText } from "../session-notices.js";
import type { TurnEvents, TurnOutcome } from "../turn-events.js";
import type { StopReason, TurnEvents, TurnOutcome } from "../turn-events.js";
/**
* Starts a turn for `params`, and answers when Claude Code takes the prompt
@@ -126,14 +126,19 @@ function jsonRpcError(error: unknown): { code: number; message: string; data?: u
};
}
/**
* The `idle` of a turn that ended. Every stop reason the agent reports is one
* of v2's own, so the state is typed as those members of `IdleStateUpdate`:
* the type checker matches each stop reason to its member, which it cannot do
* against the whole union with its custom and unknown members.
*/
function idle({ stopReason, usage, _meta }: TurnOutcome): v2.SessionUpdate {
return {
sessionUpdate: "state_update",
state: "idle",
const state: Extract<v2.IdleStateUpdate, { stopReason: StopReason }> = {
stopReason,
...(usage ? { usage } : {}),
...(_meta ? { _meta } : {}),
};
return { sessionUpdate: "state_update", state: "idle", ...state };
}
/**