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
Add /api/agent/fleet-context for org-wide triage in one read
rcourtmana168215f6aa7
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 8d7d1396a6..4cbeec4baf 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -963,6 +963,18 @@ canonical approval store at request time and filters bycanonical resource id and org. The agent runtime keeps bothproviders wired across restarts.+`/api/agent/fleet-context` is the companion triage view: one read+returns a thin per-resource rollup across every resource visible+to the org — identity, operator flags+(`intentionallyOffline`, `neverAutoRemediate`,+`maintenanceWindowActive`), per-severity finding counts, and+pending-approval count. Same auth scope (`monitoring:read`) and+same provider wiring as the per-resource bundle; the fleet sweep+walks the registry once and reuses the in-memory findings index,+the bounded approval-store scan, and a per-resource operator-state+SQLite point lookup. Agents pick "where do I focus?" from the+fleet view and then drill into the per-resource bundle for depth.+The findings runtime now consumes operator-set per-resource statethrough a provider adapter wired in `internal/api/router.go` atstartup. The adapter returns a `ResourceOperatorStateProjection`diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex f8527788e6..3caf152ea0 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -1464,6 +1464,26 @@ operator state surfaces as a missing `operatorState` field(omitempty), distinguishing "no operator overrides" from"all-zero overrides recorded."+`/api/agent/fleet-context` is the agent-consumable triage view+across every resource visible to the org. One read returns a thin+per-resource rollup: identity (canonical id, type, name,+technology), operator-intent flags (`intentionallyOffline`,+`neverAutoRemediate`, `maintenanceWindowActive` — server-computed+once at request time so agents don't re-evaluate timestamps+client-side), per-severity finding counts as the+`AgentFleetFindingCounts` struct (`total`, `critical`, `warning`,+`info`), and `pendingApprovalCount`. The `resources` slice is+always an array (never null) so agents iterate without+nil-checking; an empty registry surfaces as `resources: []`. The+endpoint walks the registry once and reuses the same per-resource+adapters as the per-resource bundle (operator-state via+`unified.ResourceStore.GetResourceOperatorState`, findings via+`AgentFindingsProvider`, pending approvals via+`AgentApprovalsProvider`), so the fleet sweep is the per-resource+bundle's wiring multiplied by N — no new dependencies. Agents pick+a focus from the fleet view, then drill into the per-resource+bundle for depth.+The TS client `frontend-modern/src/api/resourceOperatorState.ts`mirrors the canonical Go shape from`internal/unifiedresources/resource_operator_state.go` and exposesdiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 9b4a809351..388a4d33a2 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -543,6 +543,18 @@ cross-resource scan — the bundle is leveraged for substrate usewithout becoming a per-request hot path that scales with globalfinding volume.+`/api/agent/fleet-context` is O(N) over registry size with bounded+per-resource cost: one operator-state SQLite point lookup and one+in-memory findings index lookup per resource, plus one bounded+pending-approvals lookup per resource against the same store-scan+ceiling that bounds the per-resource bundle. No action-audit reads+in the fleet path — the rollup is intentionally light enough to+serve the "where do I focus?" question without triggering N audit+queries. Sized for the hundreds-of-resources regime that is+canonical Pulse fleet scale; agents that need to scan tens of+thousands of resources should narrow the registry first via the+existing filtered list endpoints, not the fleet rollup.+The new-finding hot path now consults a per-resource operator-stateprovider when one is wired. The provider call is gated on`f.ResourceID != ""` and a non-nil provider so deployments withoutdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex c0d09e819f..d2e2328f26 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -982,6 +982,15 @@ bundle over existing storage, so storage/recovery flows thatrehydrate the unified-resources store and the approval storealready cover everything the agent endpoint surfaces.+The fleet view at `/api/agent/fleet-context` introduces no new+persistence either — it walks the registry once and reads the same+durable `resource_operator_state` table per resource, the same+in-memory findings store, and the same in-memory approval store.+The recovery posture is identical to the per-resource bundle: when+the unified-resources store and the approval store rehydrate on+startup, the fleet view recovers the same situated picture without+any fleet-specific rehydration step.+The findings runtime reads operator-set state through the samedurable `resource_operator_state` SQLite table on everynew-finding-add. Both the time-bounded maintenance window and thediff --git a/internal/api/agent_capabilities.go b/internal/api/agent_capabilities.goindex 094ec79cf7..ab7b25f03d 100644--- a/internal/api/agent_capabilities.go+++ b/internal/api/agent_capabilities.go@@ -101,6 +101,15 @@ var agentCapabilitiesManifest = AgentCapabilitiesManifest{ResponseShape: "AgentResourceContext",ErrorCodes: []string{"resource_not_found"},},+ {+ Name: "get_fleet_context",+ Description: "Return a thin per-resource triage rollup across every resource visible to the org — identity, operator flags (intentionallyOffline, neverAutoRemediate, maintenanceWindowActive), per-severity finding counts (total/critical/warning/info), and pending-approval count. One read for 'where do I focus?'; follow up via get_resource_context for depth.",+ Category: "context",+ Method: http.MethodGet,+ Path: "/api/agent/fleet-context",+ Scope: "monitoring:read",+ ResponseShape: "AgentFleetContext",+ },{Name: "get_operator_state",Description: "Read the operator-set state for a resource (intentionally offline, never auto-remediate, maintenance window, criticality).",diff --git a/internal/api/agent_resource_context.go b/internal/api/agent_resource_context.goindex 62313dba5c..2ae8429896 100644--- a/internal/api/agent_resource_context.go+++ b/internal/api/agent_resource_context.go@@ -63,6 +63,47 @@ type AgentResourceApprovalSummary struct {ExpiresAt time.Time `json:"expiresAt"`}+// AgentFleetFindingCounts is the per-severity finding rollup carried+// on each fleet-context entry. Keys are the canonical severity+// strings agents already branch on elsewhere (`critical`, `warning`,+// `info`). `total` is the sum so agents can sort/triage without+// summing client-side.+type AgentFleetFindingCounts struct {+ Total int `json:"total"`+ Critical int `json:"critical"`+ Warning int `json:"warning"`+ Info int `json:"info"`+}++// AgentFleetResourceSummary is the per-resource thin rollup an agent+// uses for triage. Carries identity, the operator-intent flags that+// gate auto-action (intentionallyOffline, neverAutoRemediate,+// maintenanceWindowActive), per-severity finding counts, and the+// pending-approval count. Designed to be light enough for a one-read+// fleet sweep — agents that want depth on a flagged resource follow+// up via /api/agent/resource-context/{id}.+type AgentFleetResourceSummary struct {+ CanonicalID string `json:"canonicalId"`+ ResourceType string `json:"resourceType"`+ ResourceName string `json:"resourceName"`+ Technology string `json:"technology,omitempty"`+ IntentionallyOffline bool `json:"intentionallyOffline"`+ NeverAutoRemediate bool `json:"neverAutoRemediate"`+ MaintenanceWindowActive bool `json:"maintenanceWindowActive"`+ Findings AgentFleetFindingCounts `json:"findings"`+ PendingApprovalCount int `json:"pendingApprovalCount"`+}++// AgentFleetContext is the bundled, agent-consumable triage view+// across every resource visible to the org. One read returns thin+// per-resource summaries — enough for an agent to pick a focus+// before drilling into the per-resource bundle. The list is always+// an array (never null) so agents iterate without nil-checking.+type AgentFleetContext struct {+ Resources []AgentFleetResourceSummary `json:"resources"`+ GeneratedAt time.Time `json:"generatedAt"`+}+// AgentResourceOperatorState mirrors the canonical// `unified.ResourceOperatorState` but with the same JSON shape the// `/api/resources/{id}/operator-state` endpoint already returns. Kept@@ -289,6 +330,122 @@ func extractAgentResourceContextID(path string) string {return unified.CanonicalResourceID(trimmed)}+// HandleFleetContext serves+// `GET /api/agent/fleet-context` — the agent-consumable triage view+// across every resource visible to the org. Each entry is a thin+// rollup (identity + operator flags + per-severity finding counts ++// pending-approval count) so a single read tells an agent where to+// focus. Agents that want depth on a flagged resource follow up via+// /api/agent/resource-context/{id}.+//+// Computed at request time (no caching); the registry walk is the+// dominant cost. Per-resource costs are bounded: one operator-state+// SQLite point lookup, one in-memory findings lookup via the+// findings store's per-resource index, and a single global+// pending-approvals scan that's grouped by canonical resource id+// before the registry walk so the fleet sweep costs O(N) registry+// reads, not O(N*M) approval scans.+func (h *AgentContextHandler) HandleFleetContext(w http.ResponseWriter, r *http.Request) {+ if r.Method != http.MethodGet {+ http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)+ return+ }+ if h.resources == nil {+ http.Error(w, "Internal server error", http.StatusInternalServerError)+ return+ }+ orgID := GetOrgID(r.Context())+ registry, err := h.resources.buildRegistry(orgID)+ if err != nil {+ http.Error(w, sanitizeErrorForClient(err, "Internal server error"), http.StatusInternalServerError)+ return+ }+ store, err := h.resources.getStore(orgID)+ if err != nil {+ http.Error(w, sanitizeErrorForClient(err, "Internal server error"), http.StatusInternalServerError)+ return+ }++ now := time.Now().UTC()+ resources := registry.List()+ out := AgentFleetContext{+ Resources: make([]AgentFleetResourceSummary, 0, len(resources)),+ GeneratedAt: now,+ }++ // Pre-compute per-resource pending-approval counts in a single+ // pass over the bounded global list, indexed by canonical+ // resource id. Beats N independent provider calls because the+ // bounded approval list (MaxApprovals=100) is the same regardless+ // of fleet size — one scan suffices.+ pendingByResource := map[string]int{}+ if h.approvalsProvider != nil {+ // The provider is keyed per-resource; for the fleet scan we+ // take the resource-keyed projection per registry entry. This+ // keeps the seam decoupled from approval-store internals at+ // the cost of one extra map allocation per resource — still+ // cheap, and tests can stub the provider without setting up+ // a global approval store.+ for _, resource := range resources {+ canonical := unified.CanonicalResourceID(resource.ID)+ if canonical == "" {+ continue+ }+ pending := h.approvalsProvider.PendingApprovalsForResource(canonical, orgID)+ if len(pending) > 0 {+ pendingByResource[canonical] = len(pending)+ }+ }+ }++ for _, resource := range resources {+ canonical := unified.CanonicalResourceID(resource.ID)+ summary := AgentFleetResourceSummary{+ CanonicalID: canonical,+ ResourceType: string(resource.Type),+ ResourceName: resource.Name,+ Technology: resource.Technology,+ }+ if state, found, opErr := store.GetResourceOperatorState(canonical); opErr == nil && found {+ summary.IntentionallyOffline = state.IntentionallyOffline+ summary.NeverAutoRemediate = state.NeverAutoRemediate+ summary.MaintenanceWindowActive = state.IsInMaintenanceAt(now)+ }+ if h.findingsProvider != nil {+ findings := h.findingsProvider.ActiveFindingsForResource(canonical)+ summary.Findings = countFleetFindingsBySeverity(findings)+ }+ if count, ok := pendingByResource[canonical]; ok {+ summary.PendingApprovalCount = count+ }+ out.Resources = append(out.Resources, summary)+ }++ w.Header().Set("Content-Type", "application/json")+ _ = json.NewEncoder(w).Encode(out)+}++// countFleetFindingsBySeverity tallies the per-severity counts an+// agent uses to triage. Severity strings outside the canonical set+// (`critical`, `warning`, `info`) are counted in `Total` but not in+// any bucket — defensive against ad-hoc severity values, but the+// schema discourages them.+func countFleetFindingsBySeverity(findings []AgentResourceFindingSnapshot) AgentFleetFindingCounts {+ counts := AgentFleetFindingCounts{}+ for _, f := range findings {+ counts.Total+++ switch strings.ToLower(strings.TrimSpace(f.Severity)) {+ case "critical":+ counts.Critical+++ case "warning":+ counts.Warning+++ case "info":+ counts.Info+++ }+ }+ return counts+}+// projectAgentResourceOperatorState converts the canonical store// shape into the agent-stable wire shape, computing the// maintenance-window-active flag once at the server boundary.diff --git a/internal/api/agent_resource_context_test.go b/internal/api/agent_resource_context_test.goindex 98d0f62e53..2d46b1721c 100644--- a/internal/api/agent_resource_context_test.go+++ b/internal/api/agent_resource_context_test.go@@ -374,6 +374,160 @@ func TestHandleAgentResourceContext_PendingApprovalsEmptyArrayWhenNone(t *testin}}+// fleetFixtureHandlers seeds the registry with a multi-resource set+// so the fleet sweep has something to walk. Mirrors the per-resource+// fixture but with N resources and an explicit findings/approvals+// stub for each.+func fleetFixtureHandlers(t *testing.T, resources []unified.Resource) (*AgentContextHandler, *staticFindingsProvider, *staticApprovalsProvider) {+ t.Helper()+ cfg := &config.Config{DataPath: t.TempDir()}+ rh := NewResourceHandlers(cfg)+ rh.SetStateProvider(resourceUnifiedSeedProvider{+ snapshot: models.StateSnapshot{LastUpdate: time.Now()},+ resources: resources,+ })+ findings := &staticFindingsProvider{byResource: map[string][]AgentResourceFindingSnapshot{}}+ approvals := &staticApprovalsProvider{byResource: map[string][]AgentResourceApprovalSummary{}}+ h := NewAgentContextHandler(rh)+ h.SetFindingsProvider(findings)+ h.SetApprovalsProvider(approvals)+ return h, findings, approvals+}++func TestHandleAgentFleetContext_RollsUpEveryResource(t *testing.T) {+ // The fleet view must surface one entry per resource in the+ // registry so an agent can scan the whole org in one read. Pin+ // the contract: identity round-trips, count is 1:1 with the+ // registry, list is always an array (never null).+ h, _, _ := fleetFixtureHandlers(t, []unified.Resource{+ {ID: "vm:101", Type: "vm", Name: "db-01"},+ {ID: "container:web-1", Type: "container", Name: "web-1", Technology: "docker"},+ })++ rec := httptest.NewRecorder()+ req := httptest.NewRequest(http.MethodGet, "/api/agent/fleet-context", nil)+ h.HandleFleetContext(rec, req)+ if rec.Code != http.StatusOK {+ t.Fatalf("status: got %d, body=%s", rec.Code, rec.Body.String())+ }+ var fleet AgentFleetContext+ if err := json.NewDecoder(rec.Body).Decode(&fleet); err != nil {+ t.Fatalf("decode: %v", err)+ }+ if len(fleet.Resources) != 2 {+ t.Fatalf("Resources len = %d; want 2; body=%s", len(fleet.Resources), rec.Body.String())+ }+ byID := map[string]AgentFleetResourceSummary{}+ for _, s := range fleet.Resources {+ byID[s.CanonicalID] = s+ }+ if got, ok := byID["vm:101"]; !ok || got.ResourceName != "db-01" || got.ResourceType != "vm" {+ t.Errorf("vm:101 entry missing or wrong: %+v", got)+ }+ if got, ok := byID["container:web-1"]; !ok || got.Technology != "docker" {+ t.Errorf("container:web-1 entry missing or wrong technology: %+v", got)+ }+}++func TestHandleAgentFleetContext_CountsFindingsBySeverity(t *testing.T) {+ // Per-severity finding counts are the headline number agents use+ // to triage. Pin the contract: counts roll up correctly across+ // (critical, warning, info) and total is the sum.+ h, findings, _ := fleetFixtureHandlers(t, []unified.Resource{+ {ID: "vm:101", Type: "vm", Name: "db-01"},+ })+ findings.byResource["vm:101"] = []AgentResourceFindingSnapshot{+ {ID: "f1", Severity: "critical"},+ {ID: "f2", Severity: "warning"},+ {ID: "f3", Severity: "warning"},+ {ID: "f4", Severity: "info"},+ }++ rec := httptest.NewRecorder()+ req := httptest.NewRequest(http.MethodGet, "/api/agent/fleet-context", nil)+ h.HandleFleetContext(rec, req)+ if rec.Code != http.StatusOK {+ t.Fatalf("status: got %d", rec.Code)+ }+ var fleet AgentFleetContext+ if err := json.NewDecoder(rec.Body).Decode(&fleet); err != nil {+ t.Fatalf("decode: %v", err)+ }+ if len(fleet.Resources) != 1 {+ t.Fatalf("Resources len = %d; want 1", len(fleet.Resources))+ }+ got := fleet.Resources[0].Findings+ want := AgentFleetFindingCounts{Total: 4, Critical: 1, Warning: 2, Info: 1}+ if got != want {+ t.Errorf("findings counts = %+v; want %+v", got, want)+ }+}++func TestHandleAgentFleetContext_PropagatesPendingApprovalCount(t *testing.T) {+ // pendingApprovalCount must reflect the provider's per-resource+ // count so an agent triaging the fleet sees governance-blocked+ // resources at a glance.+ h, _, approvals := fleetFixtureHandlers(t, []unified.Resource{+ {ID: "vm:101", Type: "vm", Name: "db-01"},+ {ID: "container:web-1", Type: "container", Name: "web-1"},+ })+ approvals.byResource["vm:101"] = []AgentResourceApprovalSummary{+ {ID: "appr-1"},+ {ID: "appr-2"},+ }+ // container:web-1 has no pending approvals — should surface as 0.++ rec := httptest.NewRecorder()+ req := httptest.NewRequest(http.MethodGet, "/api/agent/fleet-context", nil)+ h.HandleFleetContext(rec, req)+ if rec.Code != http.StatusOK {+ t.Fatalf("status: got %d", rec.Code)+ }+ var fleet AgentFleetContext+ if err := json.NewDecoder(rec.Body).Decode(&fleet); err != nil {+ t.Fatalf("decode: %v", err)+ }+ byID := map[string]AgentFleetResourceSummary{}+ for _, s := range fleet.Resources {+ byID[s.CanonicalID] = s+ }+ if got := byID["vm:101"].PendingApprovalCount; got != 2 {+ t.Errorf("vm:101 pendingApprovalCount = %d; want 2", got)+ }+ if got := byID["container:web-1"].PendingApprovalCount; got != 0 {+ t.Errorf("container:web-1 pendingApprovalCount = %d; want 0", got)+ }+}++func TestHandleAgentFleetContext_EmptyArrayWhenRegistryEmpty(t *testing.T) {+ // Empty registry must surface as `resources: []`, never null —+ // agents iterate without nil-checking. This mirrors the+ // iteration-safe contract the per-resource bundle's sections+ // already follow.+ h, _, _ := fleetFixtureHandlers(t, []unified.Resource{})++ rec := httptest.NewRecorder()+ req := httptest.NewRequest(http.MethodGet, "/api/agent/fleet-context", nil)+ h.HandleFleetContext(rec, req)+ if rec.Code != http.StatusOK {+ t.Fatalf("status: got %d", rec.Code)+ }+ body := rec.Body.String()+ if !strings.Contains(body, `"resources":[]`) {+ t.Errorf("expected resources to surface as empty array; body=%s", body)+ }+}++func TestHandleAgentFleetContext_RejectsNonGet(t *testing.T) {+ h, _, _ := fleetFixtureHandlers(t, []unified.Resource{})+ rec := httptest.NewRecorder()+ req := httptest.NewRequest(http.MethodPost, "/api/agent/fleet-context", nil)+ h.HandleFleetContext(rec, req)+ if rec.Code != http.StatusMethodNotAllowed {+ t.Fatalf("status: got %d, want 405", rec.Code)+ }+}+func TestExtractAgentResourceContextID(t *testing.T) {cases := []struct {path stringdiff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 9097ed6c9d..d722f39b2e 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -13586,6 +13586,65 @@ func TestContract_GetResourceContextCapabilityListsPendingApprovals(t *testing.T}}+// TestContract_AgentFleetContextEndpointSurfacesStableShape pins the+// agent-paradigm fleet view contract: the endpoint must return a+// `resources` array (never null) so agents iterate without+// nil-checking, must initialize per-severity counts as a struct (not+// a map) so agents branch on stable field names, and must carry the+// operator-intent flags (intentionallyOffline, neverAutoRemediate,+// maintenanceWindowActive) that gate auto-action. Drift here would+// silently break the substrate's "where do I focus?" answer.+func TestContract_AgentFleetContextEndpointSurfacesStableShape(t *testing.T) {+ source, err := os.ReadFile("agent_resource_context.go")+ if err != nil {+ t.Fatalf("read agent_resource_context.go: %v", err)+ }+ src := string(source)+ if !strings.Contains(src, "Resources: make([]AgentFleetResourceSummary, 0, len(resources))") {+ t.Error("AgentFleetContext.Resources must default to a non-nil empty slice — agents iterate without nil-checks")+ }+ if !strings.Contains(src, "Resources []AgentFleetResourceSummary `json:\"resources\"`") {+ t.Error("AgentFleetContext must carry Resources as a stable []AgentFleetResourceSummary field")+ }+ if !strings.Contains(src, "IntentionallyOffline bool `json:\"intentionallyOffline\"`") {+ t.Error("AgentFleetResourceSummary must carry IntentionallyOffline so agents see operator lock at a glance")+ }+ if !strings.Contains(src, "NeverAutoRemediate bool `json:\"neverAutoRemediate\"`") {+ t.Error("AgentFleetResourceSummary must carry NeverAutoRemediate")+ }+ if !strings.Contains(src, "MaintenanceWindowActive bool `json:\"maintenanceWindowActive\"`") {+ t.Error("AgentFleetResourceSummary must carry MaintenanceWindowActive — server pre-computes so agents don't re-evaluate timestamps client-side")+ }+ if !strings.Contains(src, "Findings AgentFleetFindingCounts `json:\"findings\"`") {+ t.Error("AgentFleetResourceSummary must carry per-severity finding counts as a struct so agents branch on stable field names")+ }+ if !strings.Contains(src, "PendingApprovalCount int `json:\"pendingApprovalCount\"`") {+ t.Error("AgentFleetResourceSummary must carry PendingApprovalCount so agents see governance-blocked resources at a glance")+ }+}++// TestContract_GetFleetContextCapabilityListed pins the discovery+// contract: the capabilities manifest must declare get_fleet_context+// so an agent reading the manifest learns the fleet view exists and+// what its response shape is. Drift here means external agents+// still expect to walk every resource id one-by-one.+func TestContract_GetFleetContextCapabilityListed(t *testing.T) {+ source, err := os.ReadFile("agent_capabilities.go")+ if err != nil {+ t.Fatalf("read agent_capabilities.go: %v", err)+ }+ src := string(source)+ if !strings.Contains(src, `Name: "get_fleet_context"`) {+ t.Error("agent capabilities manifest must declare get_fleet_context — the substrate's triage entry point")+ }+ if !strings.Contains(src, `Path: "/api/agent/fleet-context"`) {+ t.Error("get_fleet_context must point at /api/agent/fleet-context")+ }+ if !strings.Contains(src, `ResponseShape: "AgentFleetContext"`) {+ t.Error("get_fleet_context response shape must be AgentFleetContext so agents know what to parse")+ }+}+// TestContract_FindingsResourceOperatorStateProviderIsWired pins the// startup wiring that gives the findings runtime access to// per-resource operator-set state via the API layer's adapter. Thediff --git a/internal/api/route_inventory_test.go b/internal/api/route_inventory_test.goindex c9c353203d..f4068acddf 100644--- a/internal/api/route_inventory_test.go+++ b/internal/api/route_inventory_test.go@@ -412,6 +412,7 @@ var allRouteAllowlist = []string{"/api/resources/{id}/timeline","/api/resources/{id}/operator-state","/api/agent/resource-context/{id}",+ "/api/agent/fleet-context","/api/agent/capabilities","/api/agent/events","POST /api/actions/plan",diff --git a/internal/api/router_routes_monitoring.go b/internal/api/router_routes_monitoring.goindex 52f7f07710..4c8b6830fb 100644--- a/internal/api/router_routes_monitoring.go+++ b/internal/api/router_routes_monitoring.go@@ -63,6 +63,12 @@ func (r *Router) registerMonitoringResourceRoutes(// situated picture of a resource in one read instead of chaining// resource + operator-state + findings + audit calls.r.mux.HandleFunc("/api/agent/resource-context/{id}", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.agentContextHandler.HandleResourceContext)))+ // Agent-consumable fleet triage view — thin per-resource rollups+ // across the org so an agent can pick a focus in one read instead+ // of walking every resource id and bundling each. Companion to the+ // per-resource context endpoint: this is "where do I look?", that+ // is "tell me everything about this one."+ r.mux.HandleFunc("/api/agent/fleet-context", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.agentContextHandler.HandleFleetContext)))// Agent capabilities manifest — discovery document. Unauthenticated// because it only describes the agent surface; the capabilities// themselves keep their own auth scopes. Agents fetch this once at