Skip to main content

Module agent_status_handlers

Module agent_status_handlers 

Source
Expand description

POST /api/v1/agent/status: Presence status. An agent says, in one line, what it is doing now. The line is kept in its pane’s block meta with the time (backend::work_facts::live_phrase), which is where the Swarm row and work.goal read it. A task claim writes the task’s title in the same place (work_queue::handle_work_claim).

Structs§

StatusParams
Presence status’s arguments, plus who is asking (agent, block: the MCP’s own AGENTMUX_AGENT_ID and block id; the request’s agent token wins).

Statics§

LINE_WRITES 🔒
The status line is written under this lock: a task’s end reads the line and clears it only if it is still the ended task’s, and a write that lands in between would otherwise be erased with it.

Functions§

bad_request 🔒
handle_agent_status 🔒
POST /api/v1/agent/status.
task_claimed 🔒
A task claim: the task’s title becomes the claimer’s line (source task), replacing a line from the task before. The agent replaces it with its own words by setting a status. Skipped when the claim names no pane, or a pane that is not the holder’s (holder is the claimer’s name and UID): a claim’s block_id is the client’s word.
task_ended 🔒
A task done or handed back: the line that task wrote goes, so the row does not go on naming work that ended. A line the agent set itself stays (it said “Done: …” or something newer), and so does the line of another task (found by task_id, which a rename of the task does not change). Only the holder’s pane is touched: uid is the holder’s, so another agent that shares its name keeps its line.
write_block_meta 🔒
Write meta to the block’s own meta, the way a pane title is set, so the change is stored and reaches every window.