Skip to main content

Module queue

Module queue 

Source
Expand description

Message queueing: follow-ups typed while a reply runs.

While a chat is busy, crate::ClientMsg::SendMessage appends to that chat’s queue in the engine instead of being refused. When the running turn ends normally the engine starts the first queued message as the next turn, and so on. A turn that is stopped or fails pauses the queue (ChatQueue::paused); it stays, untouched, until a client resumes it (crate::ClientMsg::ResumeQueue), sends one item now (crate::ClientMsg::SendQueuedNow) or retries the failed reply. A turn waiting for an approval simply keeps the queue waiting.

The queue lives in the engine (so every client of the chat sees the same one, and it survives a closed window or tab) but only in memory: it is gone after an engine restart. Queued messages are not part of the transcript until they are sent.

Steering (crate::ClientMsg::Steer, engine cap CAP_STEER): a message meant for the reply that is running waits in the same queue, marked QueuedMessage::steer, ahead of the ones sent with crate::ClientMsg::SendMessage. At the reply’s next step (its tool calls have finished, the next model request hasn’t gone yet) the engine takes every steering item out of the queue and the reply goes on with them in view: the transcript shows the reply up to there, the user’s message (one entry, the items joined), and the rest of the reply as a new assistant entry, so later requests (and a reload) see the same order. A reply that ends without another step leaves them in the queue as ordinary items (the first one starts the next turn); a stop pauses them with the rest.

Structs§

ChatQueue
The queue of the chat a client looks at (chat: None for a new chat: always empty). Sent after crate::ServerMsg::Transcript and whenever it changes; replaces the client’s copy.
QueuedMessage
A message waiting to be sent.

Enums§

QueuePause
Why a queue stopped moving on.

Constants§

CAP_STEER
Engine cap: it takes crate::ClientMsg::Steer (send it only to an engine that lists it).
MAX_QUEUED
Most messages queued in one chat.
MAX_QUEUED_TEXT_BYTES
Most bytes of text in one queued message.
MAX_QUEUE_BYTES
Most bytes of text in one chat’s whole queue.