Skip to main content

Module held_input

Module held_input 

Source
Expand description

Held input for an agent no pane shows (docs/specs/SPEC_OFFLINE_RESILIENCE_2026_10_20.md §4.4, “Held input for a parked agent”). The operator’s messages typed while the model API was out wait in the block’s meta (agent:held_input) and the pane sends them when it is open and the API answers. A parked block (agent:parked: no tab, so no pane, as after closing the pane of an agent that keeps running) has no pane to do that, so srv sends them: the oldest, when its agent runs, is between turns and the API answers. A stopped agent has no controller, so its message waits; the look that follows an agent registering (reactive::held_input_wake) sends it as the agent starts.

Only parked blocks: a block in a tab has a pane, or will when its window opens, and that pane keeps the send path it has (slash commands, runtime arguments, the busy queue).

The claim is the pane’s own mark. Before a message goes, agent:held_input is rewritten in one transaction that also checks the block is still parked: the message is unconfirmed, which a pane that mounts later reads as “may have gone” and never sends by itself. A pane attaching in between clears the parked mark in a transaction of its own, so exactly one of the two wins. Once srv accepted the message it is taken off the list; a send that failed is marked held again.

Constants§

BACKOFF 🔒
After a failed send a block is left alone this long.
EVERY 🔒
HELD_INPUT_META_KEY 🔒
The block meta a pane keeps its held messages in (useOfflineInput.ts).

Functions§

backoff 🔒
Blocks to leave alone until a time, after a send that failed.
claim 🔒
Mark the message id as sent by srv and possibly gone, if it is still first and unmarked and the block is still parked.
deliver_next 🔒
One parked block: send its oldest held message if it may go.
edit_held 🔒
Edit the held list of a block inside one transaction. edit gets the messages; None back means leave the block as it is.
held_input_decision 🔒
What may be done about the oldest held message of block now: the one decision every path asks (agent_status::decide). It goes only on Deliver: not while the agent has no process, is out of quota until a known reset, is signed out, or its model API does not answer.
held_messages 🔒
The held list of a block, if it is the agent’s own: agentId is the agent the messages were typed to.
install 🔒
Start looking for parked blocks with input to send: every EVERY, and when an agent registers, so the input held for an agent that was stopped goes out as it starts.
is_parked 🔒
pass 🔒
One look at every parked block that holds input.
release 🔒
The send failed and the message did not go: held as before, for the next pass or a pane.
sendable 🔒
The oldest held message, when it may go: one marked unconfirmed may have gone already and waits for the operator.
service_of 🔒
The block’s model API, as its pane reads it (agentProvider, and agent:api_endpoint when the CLI was pointed at another address).
settle 🔒
srv accepted the message: it is no longer held.