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.

add verified column to RunToolCallTrace

rcourtmand01c896e2c5c
diff --git a/frontend-modern/src/api/patrol.ts b/frontend-modern/src/api/patrol.ts
index bd7def50f7..5dd3b4b840 100644
--- a/frontend-modern/src/api/patrol.ts
+++ b/frontend-modern/src/api/patrol.ts
@@ -541,6 +541,17 @@ export const investigationOutcomeColors: Record<InvestigationOutcome, string> =
export type PatrolRunStatus = 'healthy' | 'issues_found' | 'critical' | 'error';
+export type ToolCallVerificationStatus =
+ | 'unknown'
+ | 'verified'
+ | 'unverified'
+ | 'failed';
+
+export interface ToolCallVerification {
+ status: ToolCallVerificationStatus;
+ evidenceSummary?: string;
+}
+
export interface ToolCallRecord {
id: string;
tool_name: string;
@@ -550,6 +561,7 @@ export interface ToolCallRecord {
start_time: number;
end_time: number;
duration_ms: number;
+ verification?: ToolCallVerification;
}
export interface PatrolRunRecord {
diff --git a/frontend-modern/src/components/patrol/RunToolCallTrace.tsx b/frontend-modern/src/components/patrol/RunToolCallTrace.tsx
index 80bfe124c6..5d19d96561 100644
--- a/frontend-modern/src/components/patrol/RunToolCallTrace.tsx
+++ b/frontend-modern/src/components/patrol/RunToolCallTrace.tsx
@@ -6,7 +6,12 @@
*/
import { Component, createSignal, createResource, Show, For } from 'solid-js';
-import { getPatrolRunWithToolCalls, type ToolCallRecord } from '@/api/patrol';
+import {
+ getPatrolRunWithToolCalls,
+ type ToolCallRecord,
+ type ToolCallVerification,
+ type ToolCallVerificationStatus,
+} from '@/api/patrol';
import {
getToolCallResultBadgeClass,
getToolCallsLoadingState,
@@ -18,6 +23,73 @@ interface RunToolCallTraceProps {
toolCallCount: number;
}
+const VERIFIED_LABELS: Record<ToolCallVerificationStatus, string> = {
+ unknown: 'Verification not run',
+ verified: 'Verified',
+ unverified: 'Verification inconclusive',
+ failed: 'Verification failed',
+};
+
+const verifiedStatus = (v?: ToolCallVerification): ToolCallVerificationStatus =>
+ v?.status ?? 'unknown';
+
+const verifiedTooltip = (v?: ToolCallVerification): string => {
+ const status = verifiedStatus(v);
+ const base = VERIFIED_LABELS[status];
+ const summary = v?.evidenceSummary?.trim();
+ return summary ? `${base}: ${summary}` : base;
+};
+
+const verifiedIconClass = (status: ToolCallVerificationStatus): string => {
+ switch (status) {
+ case 'verified':
+ return 'text-green-600 dark:text-green-400';
+ case 'failed':
+ return 'text-red-600 dark:text-red-400';
+ default:
+ return 'text-muted';
+ }
+};
+
+const VerifiedIcon: Component<{ status: ToolCallVerificationStatus }> = (p) => {
+ if (p.status === 'verified') {
+ return (
+ <svg
+ class={`w-3 h-3 ${verifiedIconClass(p.status)}`}
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ aria-hidden="true"
+ >
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M5 13l4 4L19 7" />
+ </svg>
+ );
+ }
+ if (p.status === 'failed') {
+ return (
+ <svg
+ class={`w-3 h-3 ${verifiedIconClass(p.status)}`}
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ aria-hidden="true"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M12 9v3m0 3h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"
+ />
+ </svg>
+ );
+ }
+ return (
+ <span class={`inline-block w-3 text-center font-mono text-xs ${verifiedIconClass(p.status)}`} aria-hidden="true">
+ –
+ </span>
+ );
+};
+
export const RunToolCallTrace: Component<RunToolCallTraceProps> = (props) => {
const [expanded, setExpanded] = createSignal(false);
const [expandedCall, setExpandedCall] = createSignal<string | null>(null);
@@ -74,53 +146,75 @@ export const RunToolCallTrace: Component<RunToolCallTraceProps> = (props) => {
<Show when={!toolCalls.loading && toolCalls() && toolCalls()!.length > 0}>
<div class="mt-2 space-y-1">
<For each={toolCalls()}>
- {(call: ToolCallRecord, index) => (
- <div class="border border-border rounded">
- <button
- type="button"
- onClick={() => setExpandedCall(expandedCall() === call.id ? null : call.id)}
- class="w-full flex items-center justify-between gap-2 px-2 py-1.5 text-xs hover:bg-surface-hover"
- >
- <div class="flex items-center gap-2 min-w-0">
- <span class="text-muted font-mono w-5 text-right flex-shrink-0">
- {index() + 1}.
- </span>
- <span class="font-medium text-base-content font-mono truncate">
- {call.tool_name}
- </span>
- </div>
- <div class="flex items-center gap-2 flex-shrink-0">
- <span
- class={`px-1.5 py-0.5 rounded text-[10px] font-medium ${getToolCallResultBadgeClass(call.success)}`}
- >
- {call.success ? 'success' : 'failed'}
- </span>
- <span class="text-muted font-mono">{call.duration_ms}ms</span>
- </div>
- </button>
-
- <Show when={expandedCall() === call.id}>
- <div class="border-t border-border p-2 space-y-2">
- <Show when={call.input}>
- <div>
- <div class="text-[10px] font-medium text-muted mb-1">Input</div>
- <pre class="text-[11px] font-mono bg-base rounded p-2 max-h-32 overflow-auto whitespace-pre-wrap text-base-content">
- {truncate(call.input, 500)}
- </pre>
- </div>
- </Show>
- <Show when={call.output}>
- <div>
- <div class="text-[10px] font-medium text-muted mb-1">Output</div>
- <pre class="text-[11px] font-mono bg-base rounded p-2 max-h-32 overflow-auto whitespace-pre-wrap text-base-content">
- {truncate(call.output, 500)}
- </pre>
- </div>
- </Show>
- </div>
- </Show>
- </div>
- )}
+ {(call: ToolCallRecord, index) => {
+ const status = verifiedStatus(call.verification);
+ return (
+ <div class="border border-border rounded">
+ <button
+ type="button"
+ onClick={() => setExpandedCall(expandedCall() === call.id ? null : call.id)}
+ class="w-full flex items-center justify-between gap-2 px-2 py-1.5 text-xs hover:bg-surface-hover"
+ >
+ <div class="flex items-center gap-2 min-w-0">
+ <span class="text-muted font-mono w-5 text-right flex-shrink-0">
+ {index() + 1}.
+ </span>
+ <span class="font-medium text-base-content font-mono truncate">
+ {call.tool_name}
+ </span>
+ </div>
+ <div class="flex items-center gap-2 flex-shrink-0">
+ <span
+ class="inline-flex items-center justify-center w-4"
+ title={verifiedTooltip(call.verification)}
+ aria-label={verifiedTooltip(call.verification)}
+ data-testid={`tool-call-verified-${call.id}`}
+ data-verification-status={status}
+ >
+ <VerifiedIcon status={status} />
+ </span>
+ <span
+ class={`px-1.5 py-0.5 rounded text-[10px] font-medium ${getToolCallResultBadgeClass(call.success)}`}
+ >
+ {call.success ? 'success' : 'failed'}
+ </span>
+ <span class="text-muted font-mono">{call.duration_ms}ms</span>
+ </div>
+ </button>
+
+ <Show when={expandedCall() === call.id}>
+ <div class="border-t border-border p-2 space-y-2">
+ <Show when={call.input}>
+ <div>
+ <div class="text-[10px] font-medium text-muted mb-1">Input</div>
+ <pre class="text-[11px] font-mono bg-base rounded p-2 max-h-32 overflow-auto whitespace-pre-wrap text-base-content">
+ {truncate(call.input, 500)}
+ </pre>
+ </div>
+ </Show>
+ <Show when={call.output}>
+ <div>
+ <div class="text-[10px] font-medium text-muted mb-1">Output</div>
+ <pre class="text-[11px] font-mono bg-base rounded p-2 max-h-32 overflow-auto whitespace-pre-wrap text-base-content">
+ {truncate(call.output, 500)}
+ </pre>
+ </div>
+ </Show>
+ <Show when={call.verification?.evidenceSummary}>
+ <div>
+ <div class="text-[10px] font-medium text-muted mb-1">
+ {VERIFIED_LABELS[status]}
+ </div>
+ <p class="text-[11px] text-base-content whitespace-pre-wrap">
+ {call.verification!.evidenceSummary}
+ </p>
+ </div>
+ </Show>
+ </div>
+ </Show>
+ </div>
+ );
+ }}
</For>
</div>
</Show>
diff --git a/frontend-modern/src/components/patrol/__tests__/RunToolCallTrace.test.tsx b/frontend-modern/src/components/patrol/__tests__/RunToolCallTrace.test.tsx
index c69e05b66f..c9d409f119 100644
--- a/frontend-modern/src/components/patrol/__tests__/RunToolCallTrace.test.tsx
+++ b/frontend-modern/src/components/patrol/__tests__/RunToolCallTrace.test.tsx
@@ -51,4 +51,68 @@ describe('RunToolCallTrace', () => {
await screen.findByText('Tool call details not available for this run.'),
).toBeInTheDocument();
});
+
+ it('renders the verified column with the right state per tool call', async () => {
+ getPatrolRunWithToolCallsMock.mockResolvedValue({
+ id: 'run-verify',
+ tool_calls: [
+ {
+ id: 'call-verified',
+ tool_name: 'pulse_control',
+ input: '{}',
+ output: 'restart dispatched',
+ success: true,
+ duration_ms: 12,
+ verification: { status: 'verified', evidenceSummary: 'vm:42 status=running in 8s' },
+ },
+ {
+ id: 'call-failed',
+ tool_name: 'pulse_control',
+ input: '{}',
+ output: 'restart dispatched',
+ success: true,
+ duration_ms: 15,
+ verification: { status: 'failed', evidenceSummary: 'vm:42 still stopped after 2m' },
+ },
+ {
+ id: 'call-unknown',
+ tool_name: 'pulse_read',
+ input: '{}',
+ output: 'ok',
+ success: true,
+ duration_ms: 9,
+ },
+ {
+ id: 'call-inconclusive',
+ tool_name: 'pulse_control',
+ input: '{}',
+ output: 'restart dispatched',
+ success: true,
+ duration_ms: 11,
+ verification: { status: 'unverified', evidenceSummary: 'agent offline during window' },
+ },
+ ],
+ });
+
+ render(() => <RunToolCallTrace runId="run-verify" toolCallCount={4} />);
+
+ fireEvent.click(screen.getByRole('button', { name: /Tool calls \(4\)/ }));
+
+ const verified = await screen.findByTestId('tool-call-verified-call-verified');
+ expect(verified.getAttribute('data-verification-status')).toBe('verified');
+ expect(verified.getAttribute('aria-label')).toContain('Verified');
+ expect(verified.getAttribute('aria-label')).toContain('vm:42 status=running');
+
+ const failed = await screen.findByTestId('tool-call-verified-call-failed');
+ expect(failed.getAttribute('data-verification-status')).toBe('failed');
+ expect(failed.getAttribute('aria-label')).toContain('Verification failed');
+
+ const unknown = await screen.findByTestId('tool-call-verified-call-unknown');
+ expect(unknown.getAttribute('data-verification-status')).toBe('unknown');
+ expect(unknown.getAttribute('aria-label')).toContain('Verification not run');
+
+ const inconclusive = await screen.findByTestId('tool-call-verified-call-inconclusive');
+ expect(inconclusive.getAttribute('data-verification-status')).toBe('unverified');
+ expect(inconclusive.getAttribute('aria-label')).toContain('inconclusive');
+ });
});