mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-08 01:43:07 +00:00
feat(claude): mid-turn Steer for remote Claude sessions (#2259)
* feat(claude): mid-turn Steer for remote Claude sessions Queued messages can now be steered into a running Claude turn, the same as Ctrl+X Ctrl+S in the Claude TUI. The row is written to the live stream-json stdin and Claude folds it in at its next tool boundary. - Spawn Claude with --replay-user-messages and tag every stdin message with a uuid; the echo acks pickup and is never relayed to chat - A result that arrives while a steer is still unacked does not end the turn: Claude runs a follow-up turn for it, so ready waits for that result - Launcher registers steer-queued-message: reserve the row, reject control commands and mode mismatches, ack the hub after the write, mark consumed (steered) on the echo; abort before pickup holds the row indeterminate, an unprompted exit requeues it - Open the shared steer gate and peer/hub wording to Claude (remote only) * fix(claude): retire completed input before a steer follow-up turn - Generalize onCompactResultAccepted to onResultAccepted and fire it when a result arrives with a steer still unacked, so a stream failure during the follow-up turn recovers only the steer instead of replaying the finished prompt - Close the steer target and settle pending steers when query() setup throws, so a retry backoff cannot accept a steer nobody will read
This commit is contained in:
@@ -191,7 +191,7 @@ Response `{"ok": true}`. Sending to an inactive session returns `409 {"error":"S
|
||||
|
||||
Other subscribers learn the same outcome via `message-cancelled` / `messages-consumed` SSE events.
|
||||
|
||||
**Steer a queued message into the current turn**: `POST /api/sessions/:id/messages/:messageId/steer` → `SteerQueuedMessageResponseSchema`. Unlike the send-time `deliveryMode` option above, this endpoint supports Pi, Codex, and Cursor ACP sessions (`isSteeringSupportedForSession` in `shared/src/modes.ts`). It rejects all scheduled messages, and rejects terminal-controlled sessions unless they advertise `concurrentClients`.
|
||||
**Steer a queued message into the current turn**: `POST /api/sessions/:id/messages/:messageId/steer` → `SteerQueuedMessageResponseSchema`. Unlike the send-time `deliveryMode` option above, this endpoint supports Claude (remote mode), Pi, Codex, and Cursor ACP sessions (`isSteeringSupportedForSession` in `shared/src/modes.ts`). It rejects all scheduled messages, and rejects terminal-controlled sessions unless they advertise `concurrentClients`.
|
||||
|
||||
| Response | Client action |
|
||||
|---|---|
|
||||
|
||||
Reference in New Issue
Block a user