Skip to main content

Module data

Module data 

Source
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§

AgentInfo
Per-agent fields the UI reads to render the roster + drive selection / detail-pane streaming.
ChannelInfo
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. id is <project>:<name> (matches the broker’s channels.id); name is the short label rendered as #name.
TeamSnapshot
TreeRowMeta
Per-row metadata the Agents pane renderer needs to draw the reports_to tree (T-211). Computed by tree_row_meta over a Vec<AgentInfo> that’s already in tree-DFS order (i.e. produced by into_tree_dfs_order during TeamSnapshot::load). Lives next to the agents Vec rather than on AgentInfo itself 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’s display_name when set, otherwise agent_id itself. Read-only borrow into the snapshot — callers that need an owned String can .to_string() at the use-site. Unknown ids fall through to agent_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 None when the limit is in the past, at the current instant, or unset — the indicator hides in those cases. For active limits, formats as 42s (under a minute), 5m 12s (under an hour), or 1h 23m (an hour or more). Operator-facing string; not for parsing.
into_tree_dfs_order
Reorder agents into 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 agents slice that’s already in DFS order (post-into_tree_dfs_order). The renderer pairs this 1:1 with the Vec to draw ├─ / └─ glyphs.