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
Show completed Assistant tool durations
rcourtmanb4bf81341fdd
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex e263e917a0..e81708e6db 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -153,15 +153,25 @@ runtime cost control, and shared AI transport surfaces.question controls live in the transcript. The referenced OpenCode source atcommit `9ed17da55ab1f7360cc0e01075f763e27fa899e9` mutates active toolparts into terminal `success` or `failed` rows in- `packages/opencode/src/cli/cmd/tui/context/sync-v2.tsx`- (`session.next.tool.success`, lines 328-348;- `session.next.tool.failed`, lines 350-371), and the processor marks- interrupted active tools terminal before completing the assistant message in- `packages/opencode/src/session/processor.ts` (lines 888-917). Pulse adapts- that by retaining completed tool rows and assistant text while removing- unresolved interactive rows from terminal browser transcript state.- Composer prompt history is also drawer-local chat-runtime state: the drawer- may persist a bounded local history of submitted prompt text and structured+ `packages/opencode/src/cli/cmd/tui/context/sync-v2.tsx`+ (`session.next.tool.success`, lines 328-348;+ `session.next.tool.failed`, lines 350-371), and the processor marks+ interrupted active tools terminal before completing the assistant message in+ `packages/opencode/src/session/processor.ts` (lines 888-917). Pulse adapts+ that by retaining completed tool rows and assistant text while removing+ unresolved interactive rows from terminal browser transcript state.+ Completed tool rows must preserve timing once a pending row resolves. The+ referenced OpenCode source at fetched `origin/dev` commit+ `effd27b23900720a53e965396ff1a105c1f7e9c8` carries tool identity and+ state through `toolCommit` / `startTool` / `doneTool` in+ `packages/opencode/src/cli/cmd/run/session-data.ts` (lines 622-733) and+ formats elapsed tool state with `span` in+ `packages/opencode/src/cli/cmd/run/tool.ts` (lines 191-200). Pulse adapts+ that by carrying the stream event start/end timestamps into the completed+ browser tool row, so the visible activity timeline does not collapse when a+ running command is replaced by its completed result.+ Composer prompt history is also drawer-local chat-runtime state: the drawer+ may persist a bounded local history of submitted prompt text and structuredmentions for ArrowUp/ArrowDown recall, but that history must not persist orreplay one-shot finding handoff, approval, autonomous-mode, or other scopedsend options. The referenced OpenCode source at fetched `origin/dev` commitdiff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsxindex ab9115541d..6b740d4c5c 100644--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx@@ -584,6 +584,8 @@ export const MessageItem: Component<MessageItemProps> = (props) => {<Match when={evt.type === 'tool' && evt.tool}><ToolExecutionBlock+ startedAt={evt.startedAt}+ completedAt={evt.updatedAt}tool={{name: evt.tool?.name || 'unknown',input: evt.tool?.input || '{}',diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsxindex aee9133a67..3a6527699d 100644--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx@@ -27,6 +27,8 @@ import {interface ToolExecutionBlockProps {tool: ToolExecution;+ startedAt?: number;+ completedAt?: number;}interface ToolInputSummaryProps {@@ -94,6 +96,24 @@ const formatOutputPreview = (output: string, success: boolean) => {return linesTruncated || charsTruncated ? `${fullPreview}\n...` : fullPreview;};+const formatCompletedToolDuration = (startedAt?: number, completedAt?: number): string => {+ if (!startedAt || !completedAt) return '';+ const durationMs = completedAt - startedAt;+ if (!Number.isFinite(durationMs) || durationMs < 0) return '';+ if (durationMs < 1000) return '<1s';++ const totalSeconds = Math.max(1, Math.round(durationMs / 1000));+ if (totalSeconds < 60) return `${totalSeconds}s`;++ const minutes = Math.floor(totalSeconds / 60);+ const seconds = totalSeconds % 60;+ if (minutes < 60) return seconds ? `${minutes}m ${seconds}s` : `${minutes}m`;++ const hours = Math.floor(minutes / 60);+ const remainingMinutes = minutes % 60;+ return remainingMinutes ? `${hours}h ${remainingMinutes}m` : `${hours}h`;+};+const ToolInputSummary: Component<ToolInputSummaryProps> = (props) => {const isShellSummary = createMemo(() => props.summary.trim().startsWith('$ '));const className = createMemo(@@ -152,6 +172,9 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>const hasInput = createMemo(() => inputText().trim().length > 0);const hasOutput = createMemo(() => hasReadableToolOutput(outputText()));const hasDetails = createMemo(() => hasInput() || hasOutput());+ const durationLabel = createMemo(() =>+ formatCompletedToolDuration(props.startedAt, props.completedAt),+ );const statusLabel = () => (props.tool.success ? 'completed' : 'failed');const statusPillClass = () =>@@ -213,6 +236,16 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>>{statusLabel()}</span>+ <Show when={durationLabel()}>+ <span+ class="inline-flex shrink-0 items-center gap-1 text-[10px] font-medium text-muted"+ title="Tool duration"+ aria-label={`Tool duration ${durationLabel()}`}+ >+ <ClockIcon class="h-3 w-3" aria-hidden="true" />+ {durationLabel()}+ </span>+ </Show><Show when={hasDetails()}><ChevronRightIconclass={`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${diff --git a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsxindex 195476c03d..2bbe1c8737 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx@@ -31,8 +31,15 @@ vi.mock('../ToolExecutionBlock', () => ({),ToolExecutionBlock: (props: {tool: { name: string; input: string; output: string; success: boolean };+ startedAt?: number;+ completedAt?: number;}) => (- <div data-testid="tool-execution-block" data-tool-name={props.tool.name}>+ <div+ data-testid="tool-execution-block"+ data-tool-name={props.tool.name}+ data-started-at={props.startedAt}+ data-completed-at={props.completedAt}+ >{props.tool.output}</div>),@@ -897,6 +904,33 @@ describe('MessageItem', () => {expect(block.getAttribute('data-tool-name')).toBe('pulse_get_nodes');});+ it('passes completed stream timing into completed tool rows', () => {+ const events: StreamDisplayEvent[] = [+ {+ type: 'tool',+ startedAt: 1_000,+ updatedAt: 4_200,+ tool: {+ name: 'pulse_get_nodes',+ input: '{}',+ output: 'node1, node2',+ success: true,+ },+ },+ ];++ render(() => (+ <MessageItem+ message={makeMessage({ role: 'assistant', streamEvents: events })}+ {...makeHandlers()}+ />+ ));++ const block = screen.getByTestId('tool-execution-block');+ expect(block).toHaveAttribute('data-started-at', '1000');+ expect(block).toHaveAttribute('data-completed-at', '4200');+ });+it('does not render tool block when tool property is undefined', () => {render(() => (<MessageItemdiff --git a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsxindex a63d68662d..dc0fbe3be6 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx@@ -104,6 +104,28 @@ describe('ToolExecutionBlock', () => {expect(icon).not.toBeNull();});+ it('shows completed tool duration when stream timing is available', () => {+ render(() => (+ <ToolExecutionBlock tool={makeTool()} startedAt={1_000} completedAt={4_200} />+ ));++ expect(screen.getByLabelText('Tool duration 3s')).toHaveTextContent('3s');+ });++ it('keeps very fast completed tools visible as sub-second work', () => {+ render(() => (+ <ToolExecutionBlock tool={makeTool()} startedAt={1_000} completedAt={1_450} />+ ));++ expect(screen.getByLabelText('Tool duration <1s')).toHaveTextContent('<1s');+ });++ it('does not invent completed tool duration without a valid start and end', () => {+ render(() => <ToolExecutionBlock tool={makeTool()} startedAt={4_000} completedAt={3_000} />);++ expect(screen.queryByLabelText(/Tool duration/)).not.toBeInTheDocument();+ });+// --- Input display ---it('renders input text', () => {diff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.tsindex 0fcd98f6dc..cab85f48d9 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -1787,6 +1787,14 @@ describe('useChat', () => {output: 'log data',success: true,});+ expect(assistant.streamEvents).toContainEqual(+ expect.objectContaining({+ type: 'tool',+ toolId: 'tool-1',+ startedAt: expect.any(Number),+ updatedAt: expect.any(Number),+ }),+ );dispose();});