Expand description
TeamSnapshot — point-in-time read of the dogfood team that the UI
renders against. Built by walking up to the nearest .team/,
parsing team-compose.yaml, querying the supervisor for each
agent’s process state, and aggregating a small set of mailbox
counters (unread + pending approvals).
Read by both App::tick() (live refresh every second) and the
snapshot tests (constructed manually). The snapshot is intentionally
cheap to build — every field is derived from a single SQL query
per agent — so refresh cadence stays well under tmux’s own
capture-pane cost.
Structs§
- Agent
Info - Per-agent fields the UI reads to render the roster + drive selection / detail-pane streaming.
- Channel
Info - One channel exposed in
team-compose.yaml. Used by PR-UI-6’s per-channel broadcast picker and by the Mailbox-first layout’s channel list.idis<project>:<name>(matches the broker’schannels.id);nameis the short label rendered as#name. - Team
Snapshot - Tree
RowMeta - Per-row metadata the Agents pane renderer needs to draw the
reports_totree (T-211). Computed bytree_row_metaover aVec<AgentInfo>that’s already in tree-DFS order (i.e. produced byinto_tree_dfs_orderduringTeamSnapshot::load). Lives next to the agents Vec rather than onAgentInfoitself because it’s purely view-layer state — the data struct stays clean.
Functions§
- agent_
label - Return the operator-facing label for
agent_id: the agent’sdisplay_namewhen set, otherwiseagent_iditself. Read-only borrow into the snapshot — callers that need an ownedStringcan.to_string()at the use-site. Unknown ids fall through toagent_id(the canonical id is always a valid label). - format_
rate_ limit_ window - T-212: format a rate-limit reset timestamp as a short label for
the status bar. Returns
Nonewhen the limit is in the past, at the current instant, or unset — the indicator hides in those cases. For active limits, formats as42s(under a minute),5m 12s(under an hour), or1h 23m(an hour or more). Operator-facing string; not for parsing. - into_
tree_ dfs_ order - Reorder
agentsinto depth-first tree order: each top-level (reports_to == None) agent is followed by its direct reports in their pre-existing order, recursively. The input order (managers-first sorted by id within each group, then workers) is preserved at each tier — this only interleaves workers under their manager rather than putting them all in a flat post-managers block. - recipient_
label - Return the operator-facing label for a
MessageRow.recipient. Recipients come in three shapes: - state_
glyph - Single-cell glyph for an agent’s primary state — derived from the
triplet (
state,pending_approvals,unread_mail) in priority order: pending approval beats unread mail beats process state. Plain ASCII fallback when the caller signals a monochrome / no-symbol terminal. - tree_
row_ meta - Compute per-row tree metadata for an
agentsslice that’s already in DFS order (post-into_tree_dfs_order). The renderer pairs this 1:1 with the Vec to draw├─/└─glyphs.