Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Document the report-narrative surface in ai-runtime and api-contracts
rcourtman9905383f704d
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 33c8a671a4..23463f7c4f 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -1729,3 +1729,33 @@ copy `f.AutoResolved` on both the live wire-up callback and thepersistence-recovery resync, so the frontend can honestly attribute whoclosed the loop instead of flattening every resolution into a generic"resolved" state.++The same canonical AI runtime now also owns the report-narrative surface.+`internal/ai.Service` implements `pkg/reporting.Narrator` and+`pkg/reporting.FindingsProvider` directly through `report_narrator.go` and+`report_findings.go` so the reporting engine can request an AI-generated+executive summary without depending on AI-internal types. The narrator is a+single-turn, no-tools call that reuses the canonical provider abstraction+already powering Patrol and Assistant; the request sanitizer, model+selection (`PatrolModel` preferred, falling back to `GetChatModel()`), cost+budget enforcement (`enforceBudget("report_narrative")`), and provider+factory must be the same shared seams used by `QuickAnalysis`, not a+parallel report-only provider stack. The structured report payload sent to+the model is denormalised through `buildReportNarratorPayload` so reporting+package types do not leak into the prompt surface, and the response is+parsed through `parseReportNarratorResponse` which tolerates an optional+`json` code fence the model may emit despite the no-fences instruction.+Severity normalisation maps the model's free-form output back onto the+narrative bullet severity set the renderer understands (`ok`, `info`,+`warning`, `critical`); unknown values default to `info` rather than+silently rendering as muted. Both interfaces fail closed: a nil provider,+parse failure, empty narrative, or context cancellation returns an error+so the reporting engine falls back to the deterministic heuristic+narrator. The findings provider filters the patrol findings store by+resource ID and lifecycle overlap with the report window via+`findingOverlapsWindow`, and truncates to `reportFindingsLimit` (25)+sorted entries so retrospective summaries stay within a predictable+prompt budget. Reporting is therefore an additive consumer of AI+runtime, not a new ownership boundary, and the narrator/findings+surfaces inherit the same governance the rest of the canonical AI+runtime already enforces.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 1b841c6d2e..fb0abba919 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -4357,3 +4357,42 @@ owners must not rely on that 402 as normal control flow for stale local state:when the current entitlement locks safe remediation, they submit `monitor` evenif older persisted settings or a previous entitlement left `approval`,`assisted`, or `full` in memory.+The reporting transport contract now also carries an optional narrative+interpretation layer alongside the deterministic data surface. The Go-side+`pkg/reporting.MetricReportRequest` gains optional `Narrator` and+`FindingsProvider` fields that handlers populate from the per-tenant AI+service when configured; both fields stay handler-internal and never+appear on the wire. The corresponding `ReportData` struct gains+`Narrative *Narrative`, `PriorPeriod *PriorPeriodInput`, and+`Findings []FindingSummary` fields that the engine populates before+rendering. When the request omits a narrator, the engine still attaches+a heuristic narrative through `HeuristicNarrator` so renderers always+have one source of truth, and the rendered PDF output is+byte-equivalent to the prior heuristic-only contract. When the+narrator is supplied, the engine queries the comparable prior window+automatically (same length, ending at `req.Start`) and threads its+aggregate stats through `NarrativeInput.PriorPeriod` so deltas can be+expressed; `internal/api/metrics_reporting_handlers.go` does not have+to plumb a second request for this.+The PDF output owns three additional rendered sections gated on+`ReportData.Narrative`: an executive prose paragraph between the+deterministic health card and the deterministic Quick Stats table, a+`Period-over-period changes` section after Recommended Actions, and a+muted provenance footer (`Narrative generated by Pulse Assistant.+Verify against the data tables in this report.`) when+`Narrative.Source` is `ai`. Charts, stats tables, alert lists, storage+and disk sections must remain deterministic and rendered from the+same underlying `ReportData` aggregates so every AI claim is+verifiable against the data immediately adjacent to it; the AI+narrator owns the prose layer only, not the verifiable surface. The+narrator must fail closed: nil provider, parse failure, timeout, or+empty response causes the engine to fall back to the heuristic+narrative without surfacing the AI failure to the caller, so reporting+is never blocked by AI availability.+Multi-resource fleet reports (`engine.GenerateMulti`) intentionally+remain heuristic-only at this transport layer: a fleet narrative is a+distinct contract shape from a single-resource narrative, and the+narrator surface in `MetricReportRequest` does not propagate through+`MultiReportRequest`. Adding fleet-level AI narrative is a future+contract delta and must extend the multi-report request shape+explicitly rather than reusing the per-resource narrator hook.