Skip to main content

Module agent_seat

Module agent_seat 

Source
Expand description

Agent seats: an agent’s role, the agent it reports to (its lead) and what it owns (its area), SPEC_AGENT_SEATS_IN_THE_UI_2026_10_23.md.

A seat is stored on the agent’s shared definition record (DefinitionRecordV1::seat), set by the operator through agent.setSeat or by an agent through Agents set_seat (app_api/agent_seats.rs). This module holds what reads and writes have in common: the validation of a new seat (§2), the effective seat of a spawned worker that has none of its own, and the summary shown in MuxAPI’s Agents list, a LAN peer’s agent list and My Agents (§4, §5). Seats inform; nothing is refused because of one.

Constants§

MAX_AREA_CHARS
MAX_LANE_CHARS
The spec gives lane no limit; it’s a short name, like the qualifier.
MAX_QUALIFIER_CHARS
ROLES
The roles a seat may name, as stored.
SEAT_META_KEY
The block meta key an agent pane keeps its agent’s seat summary under, for the pane header’s tooltip (§4). Seeded at agent.open, as ui:color is, and refreshed by agent.setSeat (stale_seat_meta).
SPAWNED_QUALIFIER
The qualifier of a spawned worker’s effective seat.
SUPER_ROLE
The role of the one agent that reviews sensitive operations (SPEC_SUPER_AGENT_2026_10_25.md): at most one in the shared agent roster, since a seat is stored on the shared definition.
WORKER_OF_CONTENT
The worker’s leader, {agent, id}, kept on the worker’s definition (agent content) as well as on its pane, so a worker reopened from My Agents, whose new pane has no agent:coached_by, is still a worker: it can’t spawn and still counts toward its leader’s limit. srv writes it; setagentcontent refuses it from a client, and a fork of a worker doesn’t inherit it.

Functions§

apply_effective_seats
Give every definition in defs (as agent_def_list returns them) its effective seat.
effective_seat
The seat a definition is shown with: its stored seat, or, for a spawned worker (agent:worker_of) with none, role worker, qualifier “spawned” and its leader as lead (§2). Computed when read, never stored; a seat the operator sets wins. def.seat must be the stored one, as agent_def_list reads it.
effective_seat_by_id
effective_seat by uid, for a reader that has no definition list: the stored seat from the shared record, else the spawned one.
is_remote_lead
A lead that is an agent on another machine, Name@host as Agents list shows it. A uid srv minted holds no @.
is_role
Whether role is one a seat may name.
is_steward
Whether a seat names its agent this computer’s steward: in its qualifier or the line about what it owns. There is no steward role; the steward is who the machine’s own notes go to (a low disk, a flag of the record).
no_cycle
Refuse lead as agent_id’s lead when following leads from it comes back to agent_id. Also checked when a spawned worker’s seat is cleared: its leader becomes its lead again.
sanitize_peer_summary
A seat summary a LAN peer sent, made safe to show (§5): a known role only, each text on one line and within its limit (cut, not refused: the peer validated it, this only bounds it). None when it can’t be read.
seat_meta
agent:seat as a meta value: the summary, or null for none, which a meta patch reads as “remove the key”.
seed_meta
Put agent id’s seat into the meta of a pane being opened for it, when it has one.
stale_seat_meta
The agent panes among blocks whose agent:seat no longer matches the seat summary_of gives their agent now, each with the value to patch in. summary_of is asked once per agent.
summarize
A seat as shown, with its lead’s name from name_of (§4).
summary_by_id
summary_in by uid, for a reader that has no definition list. The list is agent_def_list’s, which lays each shared record over the local row, so a lead renamed in another channel is named as My Agents names it (agent_def_get returns the local row as it is).
summary_in
The summary of the seat definition def_id is shown with (its effective seat), its lead named from defs. defs is agent_def_list’s, so each carries its stored seat. None when it has no seat.
super_holder
The uid of the agent whose stored seat is the super agent’s, if any.
validate
Validate the seat the operator asks for on agent agent_id, and stamp it with now_ms (§2). is_agent says whether a uid is an agent on this machine; lead_of gives an agent’s current lead (its effective seat’s), which is how a cycle is found: following leads from the new lead must not come back to agent_id.
worker_of
The leader definition def_id is a worker of, if any.