diff --git a/docs/superpowers/specs/2026-05-10-host-overview-info-section-design.md b/docs/superpowers/specs/2026-05-10-host-overview-info-section-design.md new file mode 100644 index 0000000..432c530 --- /dev/null +++ b/docs/superpowers/specs/2026-05-10-host-overview-info-section-design.md @@ -0,0 +1,135 @@ +# Host Overview Info Section + +**Date:** 2026-05-10 +**Status:** Approved + +## Summary + +Add an always-visible info section to each host card on the Host Overview (`/plugins`) page. The section shows owner, managers, agent version/type, last packet timestamp, and the host's effective alert thresholds. The fields `hbc_version` and `hbc_type` are moved out of the `os_info` plugin accordion into this section. + +--- + +## Backend: New API Endpoint + +**Route:** `GET /api/0/hosts/{hostname}/info` + +**Auth:** Same as other per-host endpoints (`_can_view_host`). + +**Response schema:** + +```json +{ + "owner": "alice", + "managers": ["bob", "carol"], + "hbc_version": "5.3.0", + "hbc_type": "full", + "last_packet": 1746894000.0, + "thresholds": [ + { + "metric": "cpu_monitor.cpu_percent", + "warning": 80.0, + "critical": 95.0, + "operator": ">" + } + ] +} +``` + +**Field details:** + +- `owner` — `host.owner`, or `null` if unset. +- `managers` — `host.managers` list (may be empty). +- `hbc_version` — from `host.get_latest_plugin_data("os_info")`, key `hbc_version`; `null` if no os_info data. +- `hbc_type` — same source, key `hbc_type`; `null` if unavailable. +- `last_packet` — `max(conn.lastbeat for conn in host.connections.values())`, or `null` if no connections. +- `thresholds` — list derived from `threshold_checker.get_thresholds_for_host(hostname)`, sorted by `metric` ascending. Each entry includes `metric`, `warning` (null if unset), `critical` (null if unset), `operator`. Returns `null` (not `[]`) if no `threshold_checker` is configured, so the frontend can distinguish "not configured" from "configured but empty". + +**Location:** `hbd/server/http.py`, added alongside the other `api_host_*` functions. Registered as `web.get("/api/0/hosts/{hostname}/info", api_host_info)`. + +--- + +## Frontend: Info Section + +### HTML structure + +Inserted as the first child of `.host-body`, before the plugin accordions. It is not a collapsible accordion — it is always visible when the host card is expanded. + +```html +