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.

Link Patrol Assistant briefing next steps

rcourtmanaf99032d9bd9
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 8ba42114b4..cee2fa7793 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -415,6 +415,9 @@ runtime cost control, and shared AI transport surfaces.
The Assistant drawer may also render an attached context briefing for that
handoff, but the briefing is runtime context visibility only: it must not
mutate chat control settings, execute tools, or reveal raw command payloads.
+ Safe route-owned briefing actions may render as app links when the handoff
+ includes an `actionHref`, but those links are navigation guidance only and
+ do not grant tool execution or approval authority.
When the drawer renders a request-local approval-required banner for a
scoped handoff, the banner must derive its subject from the attached
briefing or structured finding context, so Patrol approval/finding handoffs
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index bf9e165fa7..45d0f6e4f1 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -357,7 +357,7 @@ the canonical monitored-system blocked payload.
`internal/api/contract_test.go` together. Patrol-originated handoffs must
keep `[Operator Briefing]`, `[Finding Context]`, `[Finding Lifecycle
Context]`, structured handoff resources, safe route-owned next-step action
- labels, related root-cause/correlation finding context, and structured
+ labels/hrefs, related root-cause/correlation finding context, and structured
handoff actions model-only, with the briefing summarizing operator next
steps, latest lifecycle event, and governed action posture without raw
command text. Structured handoff action
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 9c110a8dc7..8f24c5c988 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1224,7 +1224,10 @@ handoffs. Patrol handoffs render as Patrol, and alert plus alert incident
timeline handoffs render as alert investigations rather than dashboard briefs.
Those same drawer handoffs may carry model-only chat context and resource
references to the backend, but the drawer remains a presentation and transport
-owner rather than the source of approval or execution truth.
+owner rather than the source of approval or execution truth. If a feature-owned
+briefing includes a safe route-owned `actionHref`, the drawer may render the
+briefing action label as a normal app link; that link is navigation guidance
+only and must not become approval or execution authority.
`SettingsTab` no longer includes `infrastructure-connections` or
`infrastructure-install`. The single `infrastructure-systems` entry in
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 4fef8fd1c4..d4fbc5c780 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -180,12 +180,12 @@ Patrol-specific presentation helpers.
and safest-next-step review instead of generic incident discussion. Finding
handoffs must be assembled through the Patrol-owned handoff model so the
prompt, visible briefing, model-only finding context, resource reference,
- safe next-step action label, bounded action reference, and request-local
+ safe next-step action label/href, bounded action reference, and request-local
approval-required posture stay in sync. The model-only context may include
current finding status, recurrence, investigation record facts, evidence,
verification, approval posture, dry-run posture, proposed-fix summary, target
- resource references, and safe route-owned next-step labels such as provider
- settings without raw command payloads. Inline Patrol approval actions in
+ resource references, and safe route-owned next-step labels/hrefs such as
+ provider settings without raw command payloads. Inline Patrol approval actions in
`frontend-modern/src/components/patrol/ApprovalSection.tsx` that open
Assistant must follow that same Patrol-owned handoff model rather than a
prompt-only local shortcut: pass approval ID/status/risk/target plus safe
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
index 029cc59cf6..0fc6f7dbfe 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -113,6 +113,7 @@ const {
commandSummary?: string;
safetyNote?: string;
suggestedPrompts?: string[];
+ actionHref?: string;
};
},
setContext: vi.fn((context: any) => {
@@ -370,6 +371,26 @@ describe('AIChat', () => {
expect(screen.queryByText('systemctl restart workload.service')).not.toBeInTheDocument();
});
+ it('renders safe briefing actions as links when a route is attached', () => {
+ mockAiChatStore.context = {
+ initialPrompt: undefined,
+ autonomousMode: false,
+ briefing: {
+ sourceLabel: 'Pulse Patrol',
+ title: 'Operator briefing attached',
+ subject: 'Provider connection issue on Patrol runtime',
+ actionLabel: 'Open Patrol provider settings',
+ actionHref: '/settings/system-ai',
+ },
+ };
+
+ renderChat();
+
+ expect(
+ screen.getByRole('link', { name: 'Open Patrol provider settings' }),
+ ).toHaveAttribute('href', '/settings/system-ai');
+ });
+
it('uses Patrol briefing context instead of generic empty-state suggestions', () => {
mockAiChatStore.context = {
initialPrompt: undefined,
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index ad1ee096f5..5579684bcb 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -1594,9 +1594,23 @@ export const AIChat: Component<AIChatProps> = (props) => {
<Show when={contextBriefing()!.actionLabel || contextBriefing()!.commandSummary}>
<div class="mt-2 rounded border border-border bg-surface-alt px-2.5 py-2 text-[11px] text-muted">
<Show when={contextBriefing()!.actionLabel}>
- <div class="font-medium text-base-content">
- {contextBriefing()!.actionLabel}
- </div>
+ <Show
+ when={contextBriefing()!.actionHref}
+ fallback={
+ <div class="font-medium text-base-content">
+ {contextBriefing()!.actionLabel}
+ </div>
+ }
+ >
+ {(href) => (
+ <a
+ href={href()}
+ class="font-medium text-blue-600 hover:text-blue-700 dark:text-blue-300 dark:hover:text-blue-200"
+ >
+ {contextBriefing()!.actionLabel}
+ </a>
+ )}
+ </Show>
</Show>
<Show when={contextBriefing()!.commandSummary}>
<div>{contextBriefing()!.commandSummary}</div>
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
index 10bdabfbe1..85b9b07ca6 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
@@ -1289,6 +1289,7 @@ describe('patrolInvestigationContextModel', () => {
);
expect(handoff.context.briefing).toMatchObject({
actionLabel: 'Open Patrol provider settings',
+ actionHref: '/settings/system-ai',
suggestedPrompts: [
'Review Patrol next step',
'Explain current Patrol loop state',
diff --git a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
index e4f4d4596c..813c0c0b23 100644
--- a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
+++ b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
@@ -2408,6 +2408,11 @@ export function buildPatrolAssistantFindingBriefing(
.filter(isNonEmptyString)
.slice(0, 4);
const verificationLines = record.verificationSummaries.map((summary) => `Verified: ${summary}`);
+ const actionLabel =
+ proposedFix?.description ||
+ (pendingApproval.id ? `Approval ${pendingApproval.id}` : undefined) ||
+ nextStepAction.label ||
+ undefined;
return {
sourceLabel: 'Pulse Patrol',
@@ -2416,11 +2421,8 @@ export function buildPatrolAssistantFindingBriefing(
statusLabel: statusParts.join(' · ') || undefined,
detailLines,
evidence: [...record.evidenceSummaries, ...verificationLines].slice(0, 4),
- actionLabel:
- proposedFix?.description ||
- (pendingApproval.id ? `Approval ${pendingApproval.id}` : undefined) ||
- nextStepAction.label ||
- undefined,
+ actionLabel,
+ actionHref: actionLabel === nextStepAction.label ? nextStepAction.href || undefined : undefined,
commandSummary: proposedFix?.commandSummary,
safetyNote: buildPatrolAssistantSafetyNote(proposedFix, pendingApproval),
suggestedPrompts: buildPatrolFindingSuggestedPrompts(
diff --git a/frontend-modern/src/stores/__tests__/aiChat.test.ts b/frontend-modern/src/stores/__tests__/aiChat.test.ts
index a6acb192f3..96a0ebaece 100644
--- a/frontend-modern/src/stores/__tests__/aiChat.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiChat.test.ts
@@ -107,6 +107,8 @@ describe('aiChatStore', () => {
briefing: {
sourceLabel: 'Pulse Patrol',
title: 'Investigation record attached',
+ actionLabel: 'Open Patrol provider settings',
+ actionHref: '/settings/system-ai',
suggestedPrompts: ['Explain recent changes and correlations'],
},
});
@@ -114,6 +116,8 @@ describe('aiChatStore', () => {
expect(aiChatStore.context.initialPrompt).toBe('hello');
expect(aiChatStore.context.targetId).toBe('vm-101');
expect(aiChatStore.context.briefing?.title).toBe('Investigation record attached');
+ expect(aiChatStore.context.briefing?.actionLabel).toBe('Open Patrol provider settings');
+ expect(aiChatStore.context.briefing?.actionHref).toBe('/settings/system-ai');
expect(aiChatStore.context.briefing?.suggestedPrompts).toEqual([
'Explain recent changes and correlations',
]);
diff --git a/frontend-modern/src/stores/aiChat.ts b/frontend-modern/src/stores/aiChat.ts
index c83e2c74e3..8f12b2c65d 100644
--- a/frontend-modern/src/stores/aiChat.ts
+++ b/frontend-modern/src/stores/aiChat.ts
@@ -12,6 +12,7 @@ export interface AIChatContextBriefing {
detailLines?: string[];
evidence?: string[];
actionLabel?: string;
+ actionHref?: string;
commandSummary?: string;
safetyNote?: string;
suggestedPrompts?: string[];