Skip to main content

handle_discovery

Function handle_discovery 

Source
pub(super) async fn handle_discovery(__arg0: State<AppState>) -> Json<Value>
Expand description

GET /agentmux/discovery — a unified, agent-facing view of what exists and what is reachable across the muxbus delivery tiers, so an agent can resolve a target before sending. Aggregates:

  • host.addressable: the authoritative Tier-1/2 reachable set (reactive_handler.list_agents() — every entry has a live block_id).
  • host.agents: this host’s agent directory (SQLite instance_list), each flagged addressable iff its name is in the reachable set.
  • lan: Tier-3 mDNS peers (each LanInstance carries its own agents).
  • wan.local_agents_subscribed: this host’s own agents that are subscribed to the Tier-4 cloud relay (empty when no token). It is NOT a list of remote agents reachable over WAN — nothing here can answer that question, because the relay exposes no directory. Named wan.subscribed_agents until 2026-09-06, which read as “agents reachable via cloud” under a heading called wan in a response whose whole purpose is reachability, and produced a wrong diagnosis. See REPORT_NETWORK_ARCHITECTURE_DRYNESS_AND_ROBUST_LAN_2026_09_06.md §6. Addressing is case-insensitive (registration lowercases the key). Authed like the other reactive routes; agents reach it via AGENTMUX_LOCAL_URL + X-AuthKey. See SPEC_MUXBUS_AGENT_DISCOVERY_AND_PERSISTENT_DELIVERY_2026_06_16.