Expand description
The open windows, one per agent. A window is read and changed under the lock and nowhere else, and
its closure is taken out under the same lock by the window’s task alone, so it runs exactly once
however Agents ready, “Switch now”, a cancel and the deadline race.
Structs§
- Answer
- What an agent answers with
Agents ready. - Closing 🔒
- Held while a window’s closure runs; the agent is open until it is dropped.
- Entry 🔒
- Opened
- An open window.
Statics§
- CLOSING 🔒
- Agents whose window has ended and whose closure is still running. They count as open, so
apply_pendingdoesn’t apply the same switch a second time while the closure does. - LEDGER 🔒
Functions§
- answer 🔒
- The agent
def_id(its slugslug) answers the window open for it. The handoff is stored at once, so it is kept even if the window runs out; a request for more time moves the deadline, once. - audit 🔒
- One audit row for the request
id, recorded asactor. - cancel
- The change is not going to happen (the person chose the account the agent is on): end the window without running the closure, take back what the agent left and tell it to carry on. BLOCKING.
- clear_
meta 🔒 - Clear the chip on the agent’s panes.
- finish_
row 🔒 - The
prep.answeredrow of a window that ended ashow: who it is recorded as (the agent when it answered, whoever pressed “Switch now” (the person, or the agent that did), AgentMux otherwise) and why. - is_open
- Whether a window is open for the agent, or its closure is still running: the account change it
waited on is the window’s to apply, not
apply_pending’s. - ledger 🔒
- open
- Open the window for
prepand ask the agent;proceedruns once when it ends. Asking again for the same target changes nothing; for another one replaces the closure and keeps the window and its deadline. BLOCKING (store writes); needs a tokio runtime for the window’s task. - open_
with open, runningrecord(the choice the closure acts on) before the window can end: with the window already open it runs under the ledger lock, so the window cannot end between the two, and for a new window it runs before the window’s task starts. The closure therefore always findsrecord’s write already made, never one that outlives it.- person_
says_ now - “Switch now” for the agent
def_id, pressed by the window (callerempty: the person) or by the agentcaller: the window ends and the closure runs. BLOCKING. - refs 🔒
- take 🔒
- Take the window
idofdef_idout of the ledger: whoever gets it runs its closure. - with 🔒
- Read or change the window
idofdef_id;Nonewhen it is gone (it ended, or was replaced).