host.sock: push a live agent-status stream instead of poll-only

This commit is contained in:
damocles 2026-09-07 18:24:22 +02:00 committed by mara
commit 3871749da9
3 changed files with 181 additions and 27 deletions

View file

@ -206,6 +206,22 @@ pub enum HostRequest {
/// pending reminders) — the `hivectl list-agents` roster view.
/// Reuses the dashboard's per-agent `ContainerView` aggregation.
AgentStatus,
/// Turn this connection into a live push feed of agent-status changes,
/// so a polling loop against [`HostRequest::AgentStatus`] is no longer
/// the only way to notice one. The one verb on this socket that answers
/// with more than one response: the server acks with a bare
/// [`HostResponse::success()`] first, then keeps the connection open
/// and writes one further [`HostResponse::agent_statuses`] (always a
/// single-row `Vec`) per changed agent, for as long as the client stays
/// connected. No further requests are read on this connection after
/// this one — open a fresh connection for anything else.
///
/// Best-effort, same contract the dashboard's own live channel already
/// has: a slow reader can miss updates rather than back-pressuring the
/// daemon, so a client that cares about the *current* state after a gap
/// should still fall back to a fresh [`HostRequest::AgentStatus`] poll,
/// not assume the stream alone is authoritative.
SubscribeAgentStatus,
/// Report this hive's canonical DNS domain
/// (`services.hyperhive.domain`) plus the browser-facing home /
/// forge / matrix URLs, daemon-sourced so custom forge/matrix