Skip to content

feat(v2): serve delivery: "steer" on session/prompt - #1

Merged
n1kben merged 2 commits into
mainfrom
feat/v2-prompt-delivery-steer
Nov 3, 2026
Merged

n1kben merged 2 commits into
mainfrom
feat/v2-prompt-delivery-steer

Conversation

@n1kben

@n1kben n1kben commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Implements the steer half of the prompt delivery RFD (agentclientprotocol/agent-client-protocol#1261, revision 2026-10-24, ee193af) on the ACP v2 surface, with the RFD's field names.

Behavior

  • Turn running: the message is pushed into it at SDK priority next (later while a permission request or question is open). Running tool calls finish; nothing is cancelled. The request answers with the steer's messageId once Claude Code takes it in: its echo, its command_lifecycle started frame, or a result whose user_message_uuids names it.
  • Idle session: the steer starts a turn, as a prompt.
  • session/cancel while a steer waits: the steer is dropped from Claude Code's queue and starts the next turn after idle cancelled.
  • Withdrawal: $/cancel_request on a waiting steer (or its connection closing) drops it from Claude Code's queue (cancelAsyncMessage) and fails it with -32800. If Claude Code already took it, the request answers with its messageId as usual. Only attempted while the turn's running cycle has no result yet; after that the steer stays and is taken in.
  • Other delivery values (queue included): -32602 before anything is inserted.
  • Capability: session.prompt.delivery.steer: {}.
  • v1 _session/steering: unchanged (still now/later); it now shares the inject path with v2 steer.

Workaround

@agentclientprotocol/sdk 2.4.0 has no delivery field and its session/prompt parser drops unknown keys (built-in parsers can't be replaced). src/v2/prompt-delivery.ts reads delivery off incoming JSON-RPC messages before the SDK parses them; the handler takes it by request id. Remove once the SDK parses delivery.

Verification

  • npm run check, tsc, vitest run: 3566 passed.
  • 10 new cases in acp-v2.test.ts, doubles modelled on frames Claude Code 2.1.316 sent for a next message pushed during a foreground Bash call. Disabling the cancel restart or the result-based insertion fails the matching tests.
  • 40 v2 golden files: the initialize response gains delivery: {steer: {}}, nothing else.
  • End to end over stdio with the real CLI (haiku): steer sent during sleep 6, the tool completed, then user_message + response with the steer's messageId, answer FIRST SECOND, one idle end_turn; delivery: "queue" → -32602. Withdrawal end to end: $/cancel_request 1 s after the steer → -32800, the tool completed, answer FIRST only, one idle end_turn.

🤖 Generated with Claude Code

n1kben and others added 2 commits November 3, 2026 10:22
Implements the steer half of the prompt delivery RFD
(agentclientprotocol/agent-client-protocol#1261, revision 2026-10-24,
ee193af). A `session/prompt` with `delivery: "steer"` joins the running
turn at SDK priority `next` (`later` while a permission request is open),
so running tool calls finish instead of being cancelled. It answers with
the steer's `messageId` once Claude Code takes the message in: its echo,
its `started` lifecycle frame, or a result that names it. With no turn
running it starts one; a steer still waiting when a cancel ends the turn
starts the next turn. Other `delivery` values fail with -32602.

Advertises `session.prompt.delivery.steer`. SDK 2.4.0 drops unknown
`session/prompt` params, so the v2 surface reads `delivery` off the
incoming messages until the SDK parses it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A steer whose `session/prompt` request is cancelled (`$/cancel_request`,
or its connection closed) before Claude Code takes it in is dropped from
Claude Code's queue with `cancelAsyncMessage` and fails with -32800. When
Claude Code already dequeued it, the request answers as usual once the
steer is inserted, as the RFD's race rule allows.

Withdrawal is attempted only while the steered turn's running cycle has no
result yet; the turn then settles at the idle after its result, as the
steer lane does. Later, the steer stays and is taken in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@n1kben
n1kben merged commit 36e0b85 into main Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant