Send mid-turn chat prompts to the harness and queue the rest durably on the server

Claude Code (stream-json stdin) and Codex (turn/steer pinned to the active
turn) receive a prompt sent while a turn runs immediately. Other harnesses
(OpenCode) get a durable chat_prompt_queue row owned by the session: it
survives the last client detaching and a server restart, is delivered in
order when the turn ends with or without a client, and is deduplicated by
operation id. chat_subscribe carries the queue, chat_queue frames report
delivered/removed/failed changes, and chat_unqueue removes a waiting prompt.
This commit is contained in:
2026-11-01 18:30:20 +00:00
parent d300fdc5a5
commit e42f9cc031
25 changed files with 1568 additions and 78 deletions
+7
View File
@@ -51,6 +51,13 @@ type chatHub struct {
attentionSeen map[string]struct{}
attentionOrder []string
attentionWG sync.WaitGroup
// queueStore persists prompts queued behind a running turn; nil keeps the
// queue in memory only (tests and store-less servers).
queueStore chatPromptQueueStore
// recentOps/recentOpOrder are the bounded record of accepted prompt
// operation ids, so a client retry is acknowledged instead of re-sent.
recentOps map[string]struct{}
recentOpOrder []string
}
// chatPart is the retained form of one part. Text and reasoning deltas append to