Add stable v1 schema IDs and docs

This commit is contained in:
Luna 2026-06-16 04:05:12 -07:00
parent bfef23fc4a
commit 7a176ea238
13 changed files with 409 additions and 8 deletions

View file

@ -24,6 +24,7 @@ from pathlib import Path
from urllib.parse import parse_qs, unquote, urlparse
from . import __version__
from . import schemas
from .config import Config
_STATIC = Path(__file__).parent / "static"
@ -199,6 +200,7 @@ def daemon_status(cfg: Config) -> dict:
from .selfprotect import heartbeat_age
age = heartbeat_age(cfg)
return {
"schema": schemas.STATUS_V1,
"version": __version__,
"running": pid_alive,
"total_alerts": len(alerts),
@ -246,7 +248,12 @@ def get_incident(cfg: Config, incident_id: str) -> dict | None:
if isinstance(p.get("pid"), int)],
})
timeline.sort(key=lambda r: r.get("time", ""))
return {"incident": inc, "timeline": timeline, "snapshots": snapshots}
return {
"schema": schemas.INCIDENT_VIEW_V1,
"incident": inc,
"timeline": timeline,
"snapshots": snapshots,
}
def response_plan(cfg: Config, incident_id: str) -> dict | None: