Schedule chat prompts: send_at holds a queued prompt until its time

A chat_prompt with a future send_at (epoch ms) is always queued, durable in
chat_prompt_queue (new send_at column, added to older databases on Open),
listed with send_at in chat_queue frames, and delivered by the room's runner
once the time passes, waking on a timer. The queue stays FIFO: prompts queued
after a scheduled one wait behind it. A past or zero send_at behaves as before;
chat_unqueue cancels as for any queued prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 00:51:06 +00:00
parent f72c46d599
commit 1ea1e5b73c
7 changed files with 258 additions and 12 deletions
+9
View File
@@ -539,6 +539,12 @@ type ChatPromptRequest struct {
// for a server on another machine; Data is standard base64 and the server
// writes it to a private temporary file before prompting the agent.
Attachments []ChatAttachment `json:"attachments,omitempty"`
// SendAt (epoch milliseconds) schedules the prompt: a time in the future
// always queues it, and the server delivers it once that time has passed
// and the session is otherwise free. Zero or a past time sends as usual.
// The queue stays FIFO, so prompts queued after a scheduled one wait
// behind it.
SendAt int64 `json:"send_at,omitempty"`
}
// ChatQueuedPrompt is one prompt the server holds for a session until its
@@ -552,6 +558,9 @@ type ChatQueuedPrompt struct {
Client string `json:"client,omitempty"`
Attachments []ChatPart `json:"attachments,omitempty"`
QueuedAt int64 `json:"queued_at,omitempty"`
// SendAt (epoch milliseconds) is set on a scheduled prompt: the earliest
// time the server will deliver it.
SendAt int64 `json:"send_at,omitempty"`
}
// ChatQueueFrame is a session's current server-side prompt queue, in delivery