Add durable user-message queue dispatch (#37204)

## What changed

- Add a storage-neutral queue extension for listing, adding, editing, reordering, deleting, and explicitly starting queued user messages.
- Dispatch queued messages in FIFO order when a thread becomes idle after a completed turn, while leaving them queued after interruptions or failures.
- Wait for user input to be persisted before removing its queue item, and report hook rejection, task termination, and persistence failures distinctly.
- Snapshot local image and audio attachments into validated data URLs before storing them, enforce input limits, and emit `ThreadQueueChanged` events after mutations.

## Testing

- Cover queue mutations, automatic and explicit dispatch, interruption and failure behavior, hook rejection, invalid records, input limits, and local attachment snapshotting.

GitOrigin-RevId: 14f39d7c8cbaccb767a6da84b82cced0edfcb4b9
This commit is contained in:
efrazer-oai authored and copyberry committed 2026-08-06 03:11:42 +00:00
1 parent 70b4653232
commit bc8b25ea02
42 files changed
+2114 -140

No files matched your search

@@ -42,8 +42,21 @@ pub struct ThreadResumeInput<'a> {
pub thread_store: &'a ExtensionData,
}
/// Why a thread has no immediately pending work.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ThreadIdleCause {
/// The previous turn completed and automatic follow-up work can run.
Completed,
/// The user interrupted the previous turn.
Interrupted,
/// The previous turn ended with a terminal error.
Failed,
}
/// Input supplied when the host has no immediately pending thread work.
pub struct ThreadIdleInput<'a> {
/// Why the thread became idle.
pub cause: ThreadIdleCause,
/// Store scoped to the host session runtime.
pub session_store: &'a ExtensionData,
/// Store scoped to this thread runtime.