Skip to main content

Module agent_wanted_running

Module agent_wanted_running 

Source
Expand description

An agent that starts a turn is wanted running. A stop records agent:desired = stopped on the agent’s block (agent_attach::set_desired) and leaves its controller registered, so a message that comes later is taken by that controller, which runs a turn again with no start in between: nothing set the agent back to running, and its pane kept saying “This agent is stopped” over a turn that was working (AgentStoppedBanner). A start through agent.start, an open or jekt_start still sets it; this is the same rule for the path that has no start.

Only a turn that began after the stop counts, judged by the two times and not by whether the turn is still running when the write happens (a short turn is over by then). A turn that was already running when the stop was recorded (an agent quitting itself records it first, then closes) began before it, so it never flips the agent back.

Functions§

install 🔒
Start listening. Called once, from agent_lifecycle::install. A change is told to the open windows (event_bus): the write alone reaches SQLite, not a pane showing the banner.
is_new_turn 🔒
True the first time turn_id is seen for block_id; a turn’s later publishes, and an older id arriving late, are not new.
running_turn 🔒
The turn of an agentturn event whose turn is running.
wake 🔒
Record block_id’s agent as wanted running when it is recorded as stopped and the turn that began at started_at_ms began after that stop was decided (a stopped read from the database, with no time, is older than any turn of this run). Returns whether it changed. BLOCKING.

Type Aliases§

Turn 🔒
A turn that has begun: its block, its id and when it started (unix ms).