web-ui: expose per-agent paused status, add pause/resume to the agent page's own overflow menu

hive-agent's own web_ui module never exposed the agent's own paused
status to its own /api/state — the dashboard's cross-container view
knew it, but a per-agent page had no way to know it's paused. Added
StateSnapshot.paused (a direct stat of the same harness-local pause
marker hive-c0re's Coordinator::is_paused checks).

The per-agent page's ⋯ overflow menu now has a pause/resume item that
POSTs to hive-c0re's existing /api/pause/<name> / /api/resume/<name> —
the same endpoints the dashboard's <hive-agent-menu> already uses,
same cross-origin form-submit pattern the existing rebuild-container
item uses. The item's label tracks state.paused on every /api/state
refresh so a pause/resume triggered from the dashboard while this page
is open doesn't leave a stale action showing.
This commit is contained in:
iris 2026-08-11 17:25:07 +02:00 committed by mara
commit 5bd085fbac
3 changed files with 85 additions and 2 deletions

View file

@ -66,6 +66,7 @@ pub(super) async fn api_state(State(state): State<AppState>) -> axum::Json<State
.iter()
.map(ToString::to_string)
.collect(),
paused: crate::paths::paused_marker().exists(),
})
}
@ -185,6 +186,18 @@ pub(super) struct StateSnapshot {
/// [`crate::harness_state::EFFORT_LEVELS`], not operator-configurable like
/// `available_models`. The frontend renders one button per entry.
available_efforts: Vec<String>,
/// Whether this agent's turn loop is currently parked (the harness
/// keeps serving this page + its MCP daemons but drives no turns).
/// Same on-disk marker hive-c0re's `Coordinator::is_paused` checks
/// (`crate::paths::paused_marker`) — read directly here rather than
/// asking hive-c0re over the socket, since the harness already has
/// the file locally. hive-c0re owns the actual pause/resume *writes*
/// (via hive-priv, this process runs unprivileged) — the per-agent
/// page's own `⋯` menu POSTs to hive-c0re's existing
/// `/api/pause/<name>` / `/api/resume/<name>` (same endpoints
/// `<hive-agent-menu>` on the dashboard already uses), this field
/// only tells the frontend which of the two to show.
paused: bool,
}
#[derive(Serialize)]