Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Share recent change feed across AI views

rcourtman716e9e0da93f
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 716d4e5602..526a04b574 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -169,6 +169,10 @@ card, so the learned-correlation layout and edge wording stay aligned across
both surfaces. That shared card also owns the correlation ordering and
truncation rule, so callers pass raw learned edges instead of page-specific
top-N slices.
+The same page and drawer now also render their recent-change timeline through
+the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx`
+card, so the canonical recent-change layout and relative-time wording stay
+aligned across both surfaces instead of being rebuilt as page-local feeds.
The Patrol intelligence seed context now also prefers the canonical
unified-resource timeline before falling back to the patrol-local change
detector, so deterministic patrol context and resource detail context share
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 89ef8b6d9f..f074207fc1 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -76,6 +76,7 @@ Own canonical runtime payload shapes between backend and frontend.
5. Route unified-resource action, lifecycle, and export audit reads through `internal/api/activity_audit_handlers.go`, `internal/api/router_routes_licensing.go`, and `internal/api/contract_test.go` together so the control-plane execution trail stays on a governed API contract instead of a store-only shape
6. Route dedicated unified-resource capability, relationship, timeline, and facet-bundle reads through `frontend-modern/src/api/resources.ts`, `internal/api/resources.go`, and `internal/api/contract_test.go` together so the backend facet contract and the frontend client stay aligned on one governed surface, including the backend-provided facet counts needed to distinguish loaded slices from total history
7. Route canonical AI intelligence summary and resource-intelligence reads through `frontend-modern/src/api/ai.ts`, `frontend-modern/src/stores/aiIntelligence.ts`, `frontend-modern/src/pages/AIIntelligence.tsx`, `internal/api/ai_handlers.go`, and `internal/api/contract_test.go` together so the summary card, store state, and backend payload stay aligned on one governed surface, including the canonical recent-changes slice
+ and the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` card, so canonical recent-change timelines stay rendered through one governed frontend card instead of separate page-local list loops
and the shared `frontend-modern/src/utils/resourceChangePresentation.ts` formatter used by the summary page and resource drawer, so canonical change wording does not drift across surfaces
and the canonical policy-posture snapshot derived from unified resources, so sensitivity, routing, and redaction counts stay owned by the same AI summary contract instead of being reconstructed as a page-local governance rollup
and the resource-intelligence payload carried by the drawer AI card, so the governed posture snapshot remains visible on the resource-detail surface without introducing a separate posture endpoint
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 12a6248826..603cd85eda 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -109,6 +109,10 @@ card, so the correlation layout stays governed by one component instead of
two page-local card implementations. That shared card also owns the
correlation ordering and truncation rule, so the page and drawer hand it raw
correlation lists instead of slicing or re-sorting them locally.
+The same page and drawer now also share the canonical
+`frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx`
+card for recent changes, so the timeline layout and relative-time wording
+stay governed by one frontend feed instead of separate page-local loops.
That same store now owns the Patrol dashboard load bundle as well, so the
page refresh path stays aligned on a single orchestrated AI bundle instead of
repeating the individual summary, findings, approval, and correlation fetches
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 10c9ad0e73..3b8c13af0f 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -112,6 +112,10 @@ card, so the same learned-edge list stays governed by one frontend surface
instead of separate page-local implementations. That shared card also owns
the correlation ordering and truncation rule, so callers pass raw correlation
lists instead of encoding their own sort or top-N behavior.
+The same surfaces now also render recent changes through the shared
+`frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx`
+card, so canonical timeline wording and ordering stay governed by one
+frontend feed instead of separate page-local loops.
The change emitter now also classifies canonical restart changes for Docker
and Kubernetes resources when restart counters increase or uptime resets, so
the timeline can distinguish restarts from generic state transitions instead
diff --git a/frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx
new file mode 100644
index 0000000000..cd90617919
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx
@@ -0,0 +1,154 @@
+import { type Component, For, Show, createMemo } from 'solid-js';
+import type { ResourceChange } from '@/types/resource';
+import { formatRelativeTime } from '@/utils/format';
+import {
+ formatResourceChangeHeadline,
+ formatResourceChangeKind,
+} from '@/utils/resourceChangePresentation';
+
+interface ResourceChangeSummaryProps {
+ changes?: ResourceChange[] | null;
+ title: string;
+ subtitle?: string;
+ emptyText?: string;
+ buildResourceHref: (resourceId: string) => string | null | undefined;
+ maxChanges?: number;
+ compact?: boolean;
+ class?: string;
+}
+
+const sortRecentChanges = (changes: ResourceChange[]): ResourceChange[] =>
+ [...changes].sort((left, right) => {
+ const observedDelta =
+ new Date(right.observedAt).getTime() - new Date(left.observedAt).getTime();
+ if (observedDelta !== 0) {
+ return observedDelta;
+ }
+
+ return right.id.localeCompare(left.id);
+ });
+
+export const ResourceChangeSummary: Component<ResourceChangeSummaryProps> = (props) => {
+ const sortedChanges = createMemo(() => sortRecentChanges(props.changes ?? []));
+ const maxChanges = () => props.maxChanges ?? sortedChanges().length;
+ const visibleChanges = createMemo(() => sortedChanges().slice(0, maxChanges()));
+ const hasChanges = () => visibleChanges().length > 0;
+ const compact = () => props.compact ?? false;
+ const itemPadding = () => (compact() ? 'p-2.5' : 'p-3');
+ const itemText = () => (compact() ? 'text-[11px]' : 'text-xs');
+ const headlineText = () => (compact() ? 'text-[11px]' : 'text-sm');
+ const badgeText = () => (compact() ? 'text-[10px]' : 'text-[11px]');
+ const gapSize = () => (compact() ? 'gap-2' : 'gap-3');
+
+ const renderRelatedResource = (resourceId: string) => {
+ const href = props.buildResourceHref(resourceId);
+ const className =
+ 'rounded-full border border-border-subtle bg-surface px-2 py-0.5 font-medium text-muted transition-colors hover:border-border hover:text-base-content';
+
+ return href ? (
+ <a
+ href={href}
+ class={className}
+ aria-label={`Open related resource ${resourceId} in Infrastructure`}
+ >
+ {resourceId}
+ </a>
+ ) : (
+ <span class={className}>{resourceId}</span>
+ );
+ };
+
+ return (
+ <section class={props.class}>
+ <div class="flex items-start justify-between gap-2">
+ <div class="min-w-0">
+ <h3 class={`font-semibold text-base-content ${headlineText()}`}>{props.title}</h3>
+ <Show when={props.subtitle}>
+ <p class="text-xs text-muted">{props.subtitle}</p>
+ </Show>
+ </div>
+ </div>
+
+ <Show
+ when={hasChanges()}
+ fallback={
+ <p class={`mt-3 ${itemText()} text-muted`}>
+ {props.emptyText ?? 'No canonical changes were recorded in the last 24 hours.'}
+ </p>
+ }
+ >
+ <ul class="mt-3 space-y-2">
+ <For each={visibleChanges()}>
+ {(change) => {
+ const headline = formatResourceChangeHeadline(change);
+ const resourceHref = props.buildResourceHref(change.resourceId);
+ const relatedResources = (change.relatedResources ?? []).slice(0, 3);
+
+ return (
+ <li class={`rounded-md border border-border-subtle bg-base ${itemPadding()}`}>
+ <div class={`flex flex-wrap items-start justify-between ${gapSize()}`}>
+ <div class="min-w-0">
+ <p class={headlineText()}>
+ {headline}
+ </p>
+ <p class={`mt-1 ${itemText()} text-muted`}>
+ {resourceHref ? (
+ <a
+ href={resourceHref}
+ class="font-mono hover:text-base-content"
+ aria-label={`Open resource ${change.resourceId} in Infrastructure`}
+ >
+ {change.resourceId}
+ </a>
+ ) : (
+ <span class="font-mono">{change.resourceId}</span>
+ )}
+ <span class="mx-1.5">·</span>
+ {formatRelativeTime(change.observedAt, {
+ compact: true,
+ emptyText: 'just now',
+ })}
+ </p>
+ <Show when={change.actor}>
+ <p class={`mt-1 ${itemText()} text-muted`}>By {change.actor}</p>
+ </Show>
+ </div>
+
+ <div class="flex flex-wrap items-center gap-1.5">
+ <span
+ class={`rounded-full border border-border-subtle bg-surface px-2 py-0.5 ${badgeText()} font-medium text-muted`}
+ >
+ {formatResourceChangeKind(change.kind)}
+ </span>
+ <span
+ class={`rounded-full border border-border-subtle bg-surface px-2 py-0.5 ${badgeText()} font-medium text-muted`}
+ >
+ {change.sourceType}
+ </span>
+ <Show when={change.sourceAdapter}>
+ <span
+ class={`rounded-full border border-border-subtle bg-surface px-2 py-0.5 ${badgeText()} font-medium text-muted`}
+ >
+ {change.sourceAdapter}
+ </span>
+ </Show>
+ </div>
+ </div>
+
+ <Show when={(change.relatedResources ?? []).length > 0}>
+ <div class={`mt-2 flex flex-wrap items-center gap-1.5 ${itemText()} text-muted`}>
+ <span>Related:</span>
+ <For each={relatedResources}>{renderRelatedResource}</For>
+ </div>
+ </Show>
+ </li>
+ );
+ }}
+ </For>
+ </ul>
+ </Show>
+ </section>
+ );
+};
+
+export default ResourceChangeSummary;
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index c926835da1..fec3da7ffc 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -52,9 +52,9 @@ import {
getResourceRoutingScopeLabel,
getResourceSensitivityLabel,
} from '@/utils/resourcePolicyPresentation';
-import { formatResourceChangeKind } from '@/utils/resourceChangePresentation';
import { describeResourceRelationship } from '@/utils/resourceRelationshipPresentation';
import { ResourceGraphSummary } from './ResourceGraphSummary';
+import { ResourceChangeSummary } from './ResourceChangeSummary';
import { ResourceFacetSummary } from './ResourceFacetSummary';
import { ResourcePolicySummary } from './ResourcePolicySummary';
import type { ResourceIntelligence } from '@/types/aiIntelligence';
@@ -856,27 +856,14 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
{intel().recent_changes?.length ?? 0}
</span>
</div>
- <Show when={intel().recent_changes?.[0]}>
- <div class="rounded border border-border bg-surface-hover px-2 py-1.5">
- <div class="text-[10px] uppercase tracking-wide text-muted">
- Latest canonical change
- </div>
- <div class="mt-0.5 text-[11px] text-base-content">
- {formatResourceChangeKind(
- intel().recent_changes?.[0]?.kind as ResourceChangeKind,
- )}{' '}
- ·{' '}
- {intel().recent_changes?.[0]?.reason ||
- intel().recent_changes?.[0]?.resourceId}
- </div>
- <div class="mt-0.5 text-[10px] text-muted">
- {formatRelativeTime(intel().recent_changes?.[0]?.observedAt, {
- compact: true,
- emptyText: 'just now',
- })}
- </div>
- </div>
- </Show>
+ <ResourceChangeSummary
+ class="space-y-0"
+ title="Latest canonical change"
+ changes={intel().recent_changes}
+ buildResourceHref={buildInfrastructureResourceHref}
+ maxChanges={1}
+ compact
+ />
<ResourcePolicySummary posture={policyPosture()} title="Policy posture" />
<ResourceGraphSummary
title="Graph context"
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceChangeSummary.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceChangeSummary.test.tsx
new file mode 100644
index 0000000000..055c91d9a1
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceChangeSummary.test.tsx
@@ -0,0 +1,70 @@
+import { render, screen } from '@solidjs/testing-library';
+import { describe, expect, it } from 'vitest';
+
+import { ResourceChangeSummary } from '../ResourceChangeSummary';
+
+describe('ResourceChangeSummary', () => {
+ it('sorts recent changes canonically and truncates the feed', () => {
+ render(() => (
+ <ResourceChangeSummary
+ class="mt-2"
+ title="Recent changes"
+ subtitle="Canonical 24h timeline"
+ changes={[
+ {
+ id: 'older-change',
+ resourceId: 'storage-1',
+ kind: 'config_update',
+ reason: 'Updated retention policy',
+ observedAt: '2026-03-18T10:00:00Z',
+ sourceType: 'pulse_diff',
+ confidence: 'medium',
+ actor: 'agent:ops-helper',
+ relatedResources: ['vm-100'],
+ },
+ {
+ id: 'newer-change',
+ resourceId: 'storage-2',
+ kind: 'restart',
+ from: 'running',
+ to: 'restarting',
+ observedAt: '2026-03-18T12:00:00Z',
+ sourceType: 'platform_event',
+ sourceAdapter: 'docker_adapter',
+ confidence: 'high',
+ actor: 'agent:ops-helper',
+ relatedResources: ['vm-200', 'vm-300'],
+ },
+ ]}
+ buildResourceHref={(resourceId) => `/infrastructure?resource=${resourceId}`}
+ maxChanges={1}
+ />
+ ));
+
+ expect(screen.getByText('Recent changes')).toBeInTheDocument();
+ expect(screen.getByText('Canonical 24h timeline')).toBeInTheDocument();
+ expect(screen.getByText('Restart: running → restarting')).toBeInTheDocument();
+ expect(
+ screen.getByRole('link', { name: 'Open resource storage-2 in Infrastructure' }),
+ ).toHaveAttribute('href', '/infrastructure?resource=storage-2');
+ expect(
+ screen.getByRole('link', { name: 'Open related resource vm-200 in Infrastructure' }),
+ ).toHaveAttribute('href', '/infrastructure?resource=vm-200');
+ expect(screen.getByText('By agent:ops-helper')).toBeInTheDocument();
+ expect(screen.queryByRole('link', { name: 'Open resource storage-1 in Infrastructure' })).toBeNull();
+ });
+
+ it('renders the empty state when no recent changes are available', () => {
+ render(() => (
+ <ResourceChangeSummary
+ title="Latest canonical change"
+ emptyText="No canonical changes were recorded."
+ changes={[]}
+ buildResourceHref={(resourceId) => `/infrastructure?resource=${resourceId}`}
+ />
+ ));
+
+ expect(screen.getByText('Latest canonical change')).toBeInTheDocument();
+ expect(screen.getByText('No canonical changes were recorded.')).toBeInTheDocument();
+ });
+});
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.tsx
index a8f3d1ef32..c7950ae692 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
@@ -351,10 +351,9 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
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');
- expect(latestChange).toHaveTextContent('Updated canonical config');
- expect(latestChange).toHaveTextContent(/just now|m ago|h ago|d ago/);
+ expect(getByText('Latest canonical change')).toBeInTheDocument();
+ const latestChangeItem = getByText('Config update: Updated canonical config').closest('li');
+ expect(latestChangeItem).not.toBeNull();
+ expect(latestChangeItem).toHaveTextContent(/just now|m ago|h ago|d ago/);
});
});
diff --git a/frontend-modern/src/pages/AIIntelligence.tsx b/frontend-modern/src/pages/AIIntelligence.tsx
index 4526275572..06263a36f0 100644
--- a/frontend-modern/src/pages/AIIntelligence.tsx
+++ b/frontend-modern/src/pages/AIIntelligence.tsx
@@ -89,12 +89,9 @@ import {
} from '@/utils/patrolFormat';
import { getAIQuickstartCreditsPresentation } from '@/utils/aiQuickstartPresentation';
import { buildPatrolScheduleOptions } from '@/utils/aiPatrolSchedulePresentation';
-import {
- formatResourceChangeHeadline,
- formatResourceChangeKind,
-} from '@/utils/resourceChangePresentation';
import { ResourcePolicySummary } from '@/components/Infrastructure/ResourcePolicySummary';
import { ResourceGraphSummary } from '@/components/Infrastructure/ResourceGraphSummary';
+import { ResourceChangeSummary } from '@/components/Infrastructure/ResourceChangeSummary';
import {
getProTrialStartedMessage,
getTrialAlreadyUsedMessage,
@@ -102,6 +99,11 @@ import {
getTrialTryAgainLaterMessage,
} from '@/utils/upgradePresentation';
import { buildInfrastructurePath } from '@/routing/resourceLinks';
+
+const buildInfrastructureResourceHref = (resourceId: string): string | null => {
+ const trimmed = resourceId.trim();
+ return trimmed ? buildInfrastructurePath({ resource: trimmed }) : null;
+};
type PatrolTab = 'findings' | 'history';
export function AIIntelligence() {
@@ -1275,68 +1277,13 @@ export function AIIntelligence() {
</div>
<div class="mt-4 grid gap-4 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]">
- <div>
- <div class="flex items-center justify-between gap-2">
- <h3 class="text-sm font-semibold text-base-content">Recent changes</h3>
- <span class="text-xs text-muted">Canonical 24h timeline</span>
- </div>
- <Show
- when={(summary().recent_changes ?? []).length > 0}
- fallback={
- <p class="mt-3 text-sm text-muted">
- No canonical changes were recorded in the last 24 hours.
- </p>
- }
- >
- <ul class="mt-3 space-y-2">
- <For each={summary().recent_changes ?? []}>
- {(change) => (
- <li class="rounded-md border border-border-subtle bg-base p-3">
- <div class="flex flex-wrap items-start justify-between gap-3">
- <div class="min-w-0">
- <p class="text-sm font-medium text-base-content">
- {formatResourceChangeHeadline(change)}
- </p>
- <p class="mt-1 text-xs text-muted">
- <span class="font-mono">{change.resourceId}</span>
- <span class="mx-1.5">·</span>
- {formatRelativeTime(change.observedAt, {
- compact: true,
- emptyText: 'just now',
- })}
- </p>
- </div>
-
- <div class="flex flex-wrap items-center gap-1.5">
- <span class="rounded-full border border-border-subtle bg-surface px-2 py-0.5 text-[11px] font-medium text-muted">
- {formatResourceChangeKind(change.kind)}
- </span>
- <span class="rounded-full border border-border-subtle bg-surface px-2 py-0.5 text-[11px] font-medium text-muted">
- {change.sourceType}
- </span>
- <Show when={change.sourceAdapter}>
- <span class="rounded-full border border-border-subtle bg-surface px-2 py-0.5 text-[11px] font-medium text-muted">
- {change.sourceAdapter}
- </span>
- </Show>
- </div>
- </div>
-
- <Show when={change.reason}>
- <p class="mt-2 text-xs text-muted">{change.reason}</p>
- </Show>
-
- <Show when={(change.relatedResources ?? []).length > 0}>
- <p class="mt-2 text-xs text-muted">
- Related: {(change.relatedResources ?? []).slice(0, 3).join(', ')}
- </p>
- </Show>
- </li>
- )}
- </For>
- </ul>
- </Show>
- </div>
+ <ResourceChangeSummary
+ class="space-y-0"
+ title="Recent changes"
+ subtitle="Canonical 24h timeline"
+ changes={summary().recent_changes}
+ buildResourceHref={buildInfrastructureResourceHref}
+ />
<div class="space-y-4">
<div class="rounded-md border border-border-subtle bg-base p-4">
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index 9c180eab79..429f876ba2 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -589,7 +589,12 @@ describe('AIIntelligence entitlement gating', () => {
expect(screen.getByText(/Health A · 91\/100/)).toBeInTheDocument();
expect(screen.getByText(/Recent changes 1/)).toBeInTheDocument();
expect(screen.getByText('Config update: Updated guest configuration')).toBeInTheDocument();
- expect(screen.getByText('vm-100')).toBeInTheDocument();
+ expect(
+ screen.getByRole('link', { name: 'Open resource vm-100 in Infrastructure' }),
+ ).toHaveAttribute('href', '/infrastructure?resource=vm-100');
+ expect(
+ screen.getByRole('link', { name: 'Open related resource agent-1 in Infrastructure' }),
+ ).toHaveAttribute('href', '/infrastructure?resource=agent-1');
expect(screen.getByText('proxmox_adapter')).toBeInTheDocument();
expect(screen.getByText('Learning signals')).toBeInTheDocument();
expect(screen.getByText('Data Governance')).toBeInTheDocument();