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
Expose resource correlations in intelligence drawer
rcourtman7cf0fd24ea99
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex bb92e81aaf..529f559317 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -175,9 +175,9 @@ client in `frontend-modern/src/api/resources.ts`, which fetches the governedcapability, relationship, and timeline surfaces from `internal/api/resources.go`instead of teaching the drawer or list views to reconstruct them inline.The same AI resource-intelligence payload now also carries dependency and-dependent graph arrays, so the drawer can render canonical graph context from-the shared AI contract instead of inferring it from the relationship facet-payload alone.+dependent graph arrays plus correlation evidence, so the drawer can render+canonical graph context from the shared AI contract instead of inferring it+from the relationship facet payload alone.The unified action, lifecycle, and export audit reads now also clamp oversized`limit` requests to the governed maximum of `1000`, so the control-plane auditsurface stays bounded even when callers ask for arbitrarily large historydiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 6ddbf4b42f..39c7f55739 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -96,9 +96,9 @@ The resource drawer now carries the same canonical posture snapshot throughthe resource-intelligence payload, so the resource-level AI card can show theorg posture context without introducing a separate posture endpoint.That same resource-intelligence payload also carries canonical dependency and-dependent graph context, so the resource drawer can surface relationship-reachability directly from the AI contract instead of inventing a second-graph summary.+dependent graph context plus canonical correlation evidence, so the resource+drawer can surface relationship reachability and learned edge patterns+directly from the AI contract instead of inventing a second graph summary.The Patrol page and resource drawer now also share the canonical`frontend-modern/src/utils/resourceChangePresentation.ts` formatter sorecent-change kind and headline wording stays aligned wherever the canonicaldiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 10c8c69595..177924703b 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -102,6 +102,10 @@ relationship labels, direction, provenance, freshness, and metadata flagsfrom `internal/unifiedresources/relationship_presentation.go`, so the graphsemantics live with the resource model instead of being duplicated in prompthelpers or drawer-specific markdown.+The same AI resource-intelligence payload now also carries canonical+correlation evidence from the shared detector, so the drawer can show learned+edge patterns alongside the dependency graph without rebuilding correlation+reasoning from raw events.The change emitter now also classifies canonical restart changes for Dockerand Kubernetes resources when restart counters increase or uptime resets, sothe timeline can distinguish restarts from generic state transitions insteaddiff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsxindex 22a87ffcce..de07b01e83 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx@@ -57,6 +57,12 @@ import {getResourceSensitivityLabel,} from '@/utils/resourcePolicyPresentation';import { formatResourceChangeKind } from '@/utils/resourceChangePresentation';+import {+ formatResourceCorrelationEndpoint,+ formatResourceCorrelationHeadline,+ formatResourceCorrelationPattern,+ formatResourceCorrelationSummary,+} from '@/utils/resourceCorrelationPresentation';import { describeResourceRelationship } from '@/utils/resourceRelationshipPresentation';import { ResourceFacetSummary } from './ResourceFacetSummary';import type { ResourceIntelligence } from '@/types/aiIntelligence';@@ -298,6 +304,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {);const resourceDependencies = createMemo(() => resourceIntelligence()?.dependencies ?? []);const resourceDependents = createMemo(() => resourceIntelligence()?.dependents ?? []);+ const resourceCorrelations = createMemo(() => resourceIntelligence()?.correlations ?? []);const policyPosture = createMemo(() => resourceIntelligence()?.policy_posture);const timelineFacetRequest = createMemo(() => {const id = resourceFacetId();@@ -417,6 +424,15 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {const historyFacetCounts = createMemo(() => historyFacetBundle()?.counts ?? resourceFacetCounts(),);+ const sortedResourceCorrelations = createMemo(() =>+ [...resourceCorrelations()].sort((left, right) => {+ const confidenceDiff = (right.confidence || 0) - (left.confidence || 0);+ if (confidenceDiff !== 0) return confidenceDiff;+ const leftTime = Date.parse(left.last_seen || '');+ const rightTime = Date.parse(right.last_seen || '');+ return (Number.isFinite(rightTime) ? rightTime : 0) - (Number.isFinite(leftTime) ? leftTime : 0);+ }),+ );const hasTimelineFilters = createMemo(() =>Boolean(@@ -954,14 +970,21 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {</div>)}</Show>- <Show when={resourceDependencies().length > 0 || resourceDependents().length > 0}>+ <Show+ when={+ resourceDependencies().length > 0 ||+ resourceDependents().length > 0 ||+ resourceCorrelations().length > 0+ }+ ><div class="rounded border border-border-subtle bg-base px-2 py-1.5"><div class="text-[10px] uppercase tracking-wide text-muted">Graph context</div><div class="mt-0.5 text-[11px] text-base-content">{resourceDependencies().length} dependencies ·{' '}- {resourceDependents().length} dependents+ {resourceDependents().length} dependents ·{' '}+ {resourceCorrelations().length} correlations</div><Show when={resourceDependencies().length > 0}><div class="mt-2">@@ -1017,6 +1040,91 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {</div></div></Show>+ <Show when={resourceCorrelations().length > 0}>+ <div class="mt-2">+ <div class="text-[9px] uppercase tracking-wide text-muted">+ Correlations+ </div>+ <div class="mt-1 space-y-1.5">+ <For each={sortedResourceCorrelations().slice(0, 3)}>+ {(correlation) => {+ const sourceHref = buildInfrastructureResourceHref(+ correlation.source_id,+ );+ const targetHref = buildInfrastructureResourceHref(+ correlation.target_id,+ );+ const headline = formatResourceCorrelationHeadline(correlation);+ const summary = formatResourceCorrelationSummary(correlation);+ const sourceLabel = formatResourceCorrelationEndpoint(+ correlation,+ 'source',+ );+ const targetLabel = formatResourceCorrelationEndpoint(+ correlation,+ 'target',+ );+ const patternLabel = formatResourceCorrelationPattern(correlation);+ const lastSeenLabel = correlation.last_seen+ ? formatRelativeTime(correlation.last_seen, {+ compact: true,+ emptyText: 'just now',+ })+ : '';+ return (+ <div class="rounded bg-surface px-2 py-1" title={headline}>+ <div class="flex flex-wrap items-center gap-1 text-[10px] text-base-content">+ {sourceHref ? (+ <a+ class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"+ href={sourceHref}+ aria-label={`Open source resource ${sourceLabel} in Infrastructure`}+ >+ {sourceLabel}+ </a>+ ) : (+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">+ {sourceLabel}+ </span>+ )}+ <span class="text-muted">→</span>+ {targetHref ? (+ <a+ class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"+ href={targetHref}+ aria-label={`Open target resource ${targetLabel} in Infrastructure`}+ >+ {targetLabel}+ </a>+ ) : (+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">+ {targetLabel}+ </span>+ )}+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-muted">+ {patternLabel}+ </span>+ </div>+ <div class="mt-0.5 text-[10px] text-muted">+ {summary}+ <Show when={lastSeenLabel}>+ <>{' '}· last seen {lastSeenLabel}</>+ </Show>+ </div>+ <Show when={correlation.description}>+ {(description) => (+ <div class="mt-0.5 text-[10px] text-muted">+ {description()}+ </div>+ )}+ </Show>+ </div>+ );+ }}+ </For>+ </div>+ </div>+ </Show></div></Show></div>diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsxindex d2a3b06c99..72a2bdb788 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx@@ -56,6 +56,22 @@ vi.mock('@/api/ai', () => ({],dependencies: ['storage-1'],dependents: ['vm-child'],+ correlations: [+ {+ source_id: 'storage-1',+ source_name: 'Storage 1',+ source_type: 'storage',+ target_id: 'resource-1',+ target_name: 'Host 1',+ target_type: 'vm',+ event_pattern: 'disk_full -> restart',+ occurrences: 2,+ avg_delay: 125000000000,+ confidence: 0.875,+ last_seen: '2026-03-01T00:15:00Z',+ description: 'Disk pressure often precedes restarts',+ },+ ],policy_posture: {total_resources: 2,sensitivity_counts: {@@ -319,7 +335,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {expect(getByText('Public')).toBeInTheDocument();expect(getByText('Cloud Summary')).toBeInTheDocument();expect(getByText('Graph context')).toBeInTheDocument();- expect(getByText('1 dependencies · 1 dependents')).toBeInTheDocument();+ expect(getByText('1 dependencies · 1 dependents · 1 correlations')).toBeInTheDocument();expect(getByRole('link', {name: 'Open dependency resource storage-1 in Infrastructure',@@ -330,6 +346,11 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {name: 'Open dependent resource vm-child in Infrastructure',}),).toHaveAttribute('href', expect.stringContaining('/infrastructure?resource=vm-child'));+ expect(getByText('Storage 1')).toBeInTheDocument();+ expect(getByText('Host 1')).toBeInTheDocument();+ expect(getByText('Disk Full → Restart')).toBeInTheDocument();+ expect(getByText(/2 occurrences · avg delay 2m · 88% confidence/)).toBeInTheDocument();+ expect(getByText('Disk pressure often precedes restarts')).toBeInTheDocument();const latestChange = getByText('Latest canonical change').parentElement;expect(latestChange).not.toBeNull();expect(latestChange).toHaveTextContent('Config update');diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.tsindex 803f7e4e7b..0c4937b793 100644--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts@@ -132,6 +132,7 @@ describe('aiIntelligenceStore', () => {},});expect(aiIntelligenceStore.intelligenceSummary?.recent_changes).toHaveLength(1);+ expect(aiIntelligenceStore.intelligenceSummary?.learning.correlations_learned).toBe(1);expect(aiIntelligenceStore.intelligenceSummary?.policy_posture?.routing_counts?.['local-only']).toBe(1);});diff --git a/frontend-modern/src/types/aiIntelligence.ts b/frontend-modern/src/types/aiIntelligence.tsindex 22046692bf..6181ac5ceb 100644--- a/frontend-modern/src/types/aiIntelligence.ts+++ b/frontend-modern/src/types/aiIntelligence.ts@@ -94,6 +94,21 @@ export interface IntelligencePolicyPostureSummary {redaction_counts?: Partial<Record<ResourceRedactionHint, number>>;}+export interface ResourceCorrelation {+ source_id: string;+ source_name: string;+ source_type: string;+ target_id: string;+ target_name: string;+ target_type: string;+ event_pattern: string;+ occurrences: number;+ avg_delay: number;+ confidence: number;+ last_seen: string;+ description: string;+}+export interface IntelligenceSummary {timestamp: string;overall_health: IntelligenceHealthScore;@@ -114,6 +129,7 @@ export interface ResourceIntelligence {health: IntelligenceHealthScore;dependencies?: string[];dependents?: string[];+ correlations?: ResourceCorrelation[];recent_changes?: ResourceChange[];policy_posture?: IntelligencePolicyPostureSummary;note_count: number;diff --git a/frontend-modern/src/utils/__tests__/resourceCorrelationPresentation.test.ts b/frontend-modern/src/utils/__tests__/resourceCorrelationPresentation.test.tsnew file mode 100644index 0000000000..2a701df449--- /dev/null+++ b/frontend-modern/src/utils/__tests__/resourceCorrelationPresentation.test.ts@@ -0,0 +1,38 @@+import { describe, expect, it } from 'vitest';++import {+ formatResourceCorrelationEndpoint,+ formatResourceCorrelationHeadline,+ formatResourceCorrelationPattern,+ formatResourceCorrelationSummary,+} from '@/utils/resourceCorrelationPresentation';++describe('resourceCorrelationPresentation utils', () => {+ const correlation = {+ source_id: 'storage-1',+ source_name: 'Storage 1',+ source_type: 'storage',+ target_id: 'vm-42',+ target_name: 'VM 42',+ target_type: 'vm',+ event_pattern: 'disk_full -> restart',+ occurrences: 2,+ avg_delay: 5_000_000_000,+ confidence: 0.875,+ last_seen: '2026-03-18T12:00:00Z',+ description: 'Disk pressure often precedes restarts',+ } as const;++ it('formats correlation endpoints and headline labels', () => {+ expect(formatResourceCorrelationEndpoint(correlation, 'source')).toBe('Storage 1');+ expect(formatResourceCorrelationEndpoint(correlation, 'target')).toBe('VM 42');+ expect(formatResourceCorrelationHeadline(correlation)).toBe('Storage 1 → VM 42');+ });++ it('formats correlation patterns and summaries', () => {+ expect(formatResourceCorrelationPattern(correlation)).toBe('Disk Full → Restart');+ expect(formatResourceCorrelationSummary(correlation)).toBe(+ '2 occurrences · avg delay 5s · 88% confidence',+ );+ });+});diff --git a/frontend-modern/src/utils/resourceCorrelationPresentation.ts b/frontend-modern/src/utils/resourceCorrelationPresentation.tsnew file mode 100644index 0000000000..84481bea5d--- /dev/null+++ b/frontend-modern/src/utils/resourceCorrelationPresentation.ts@@ -0,0 +1,56 @@+import type { ResourceCorrelation } from '@/types/aiIntelligence';+import { formatDurationMs } from '@/utils/patrolFormat';++const humanizeCorrelationToken = (value?: string): string => {+ const normalized = (value || '').trim();+ if (!normalized) return 'Correlation';+ return normalized+ .replace(/_/g, ' ')+ .replace(/\s*->\s*/g, ' → ')+ .replace(/\b\w/g, (char) => char.toUpperCase());+};++const formatResourceCorrelationEndpointLabel = (value?: string): string => {+ const normalized = (value || '').trim();+ if (!normalized) return 'Unknown resource';+ return normalized;+};++export function formatResourceCorrelationEndpoint(+ correlation: ResourceCorrelation,+ role: 'source' | 'target',+): string {+ return formatResourceCorrelationEndpointLabel(+ role === 'source'+ ? correlation.source_name || correlation.source_id+ : correlation.target_name || correlation.target_id,+ );+}++export function formatResourceCorrelationHeadline(correlation: ResourceCorrelation): string {+ return `${formatResourceCorrelationEndpoint(correlation, 'source')} → ${formatResourceCorrelationEndpoint(correlation, 'target')}`;+}++export function formatResourceCorrelationPattern(correlation: ResourceCorrelation): string {+ return humanizeCorrelationToken(correlation.event_pattern);+}++export function formatResourceCorrelationSummary(correlation: ResourceCorrelation): string {+ const parts: string[] = [];++ if (correlation.occurrences > 0) {+ parts.push(`${correlation.occurrences} occurrence${correlation.occurrences === 1 ? '' : 's'}`);+ }++ const avgDelayMs = Math.round((correlation.avg_delay || 0) / 1_000_000);+ const formattedDelay = formatDurationMs(avgDelayMs);+ if (formattedDelay) {+ parts.push(`avg delay ${formattedDelay}`);+ }++ if (typeof correlation.confidence === 'number' && Number.isFinite(correlation.confidence)) {+ parts.push(`${Math.round(correlation.confidence * 100)}% confidence`);+ }++ return parts.join(' · ');+}diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex fe5b448035..8ced62991b 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -377,6 +377,26 @@ func TestContract_ResourceIntelligenceIncludesRecentChanges(t *testing.T) {if len(dependencies) == 0 {t.Fatal("expected at least one dependency in response")}+ correlations, ok := payload["correlations"].([]interface{})+ if !ok {+ t.Fatalf("expected correlations array in response, got %T", payload["correlations"])+ }+ if len(correlations) == 0 {+ t.Fatal("expected at least one correlation in response")+ }+ firstCorrelation, ok := correlations[0].(map[string]interface{})+ if !ok {+ t.Fatalf("expected correlation object, got %T", correlations[0])+ }+ if firstCorrelation["event_pattern"] == "" {+ t.Fatal("expected correlation event_pattern in response")+ }+ if firstCorrelation["avg_delay"] == nil {+ t.Fatal("expected correlation avg_delay in response")+ }+ if firstCorrelation["confidence"] == nil {+ t.Fatal("expected correlation confidence in response")+ }}func TestContract_IntelligenceSummaryIncludesRecentChanges(t *testing.T) {