Skip to main content

Module inventory

Module inventory 

Source
Expand description

Agent inventory + target validation for the supervisor /agents and /tell routing commands.

The inventory is composed from two sources (design D1):

  • broker GET /statusbranch_id, status, last_seen, cli;
  • tmux list-panes with pane_current_path — the live branch_id → pane_index mapping (v0.5.0 doctrine: never assume pane index ordering; resolve via the worktree path).

The join, mode detection, target validation, and the freshness cache are all factored as library functions (design D6) so the v0.6.0 consumer (the /tell skill) and future consumers — notably the v1.0.0 MCP write tools’ publish_agent_feedback — share one inventory + validation shape rather than re-implementing it.

Structs§

AgentEntry
One agent’s inventory record.
AgentInventory
A point-in-time inventory snapshot.
InventoryCache
In-memory inventory cache with a freshness window (design D2).
StatusAgent
One agent row parsed from the broker /status JSON.

Enums§

Mode
Best-effort detected interaction mode of an agent’s CLI pane.
ValidationError
Rejection returned by validate_target for an unknown target.

Functions§

build_inventory
Builds an inventory snapshot from the live broker and tmux session.
detect_mode
Best-effort mode detection from an agent pane’s title and recent capture.
fetch_status_agents_over_http
Fetches and parses the broker GET /status agent list over HTTP.
join_inventory
Joins broker status rows with the tmux pane mapping and per-pane detected modes into inventory entries.
match_pane
Resolves the pane index for agent_id from the pane_current_path mapping, per the v0.5.0 doctrine (match on the worktree path, never on index ordering).
parse_pane_paths
Parses tmux list-panes -F '#{pane_index} #{pane_current_path}' output into (pane_index, current_path) pairs.
parse_status_agents
Parses the broker GET /status JSON body into agent rows.
validate_target
Validates a /tell target against the inventory.