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
Pace fast Assistant tool completions
rcourtman0ec94e6f6a5d
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 9c37caea96..6cf98b1d4c 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -169,7 +169,18 @@ runtime cost control, and shared AI transport surfaces.`packages/opencode/src/cli/cmd/run/tool.ts` (lines 191-200). Pulse adaptsthat by carrying the stream event start/end timestamps into the completedbrowser tool row, so the visible activity timeline does not collapse when a- running command is replaced by its completed result. Completed browser tool+ running command is replaced by its completed result. When a live browser+ stream receives a `tool_start` and successful `tool_end` in the same+ buffered burst, the completed row may briefly present as running before it+ settles to completed, matching OpenCode's perceptible pending-tool motion+ at fetched `origin/dev` commit+ `1025540fcc2a69609a0131a7168300205656d728` in+ `packages/ui/src/components/basic-tool.tsx` (`pending`, lines 90 and+ 195-205) and `packages/ui/src/components/tool-status-title.tsx` while+ keeping Pulse's typed completed tool row, persisted status, answer stream,+ and failure state authoritative. That settle interval must be bounded,+ live-only, success-only, and must not delay assistant content, terminal+ cleanup, or failed-tool visibility. Completed browser toolrows must also preserve output trust when a raw preview is intentionallysuppressed: the referenced OpenCode source at fetched `origin/dev` commit`1025540fcc2a69609a0131a7168300205656d728` keeps output visibility as andiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex b34778c2e5..192c6b7f76 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -567,7 +567,11 @@ payload shape change when the portal presents compact client rows.`tool_cancel` instead of hiding the activity. At least one fixture-backedAssistant tool sequence must exercise compacted provider artifactsuppression by emitting compacted pre-tool content before a governed tool row- and final normal answer content.+ and final normal answer content. At least one fixture-backed Assistant tool+ sequence must exercise a buffered `tool_start` -> `tool_end` burst with no+ provider delay between the two events, followed by a paced content/terminal+ step, so browser proof can verify that fast command activity remains+ perceptible without a real provider request.34. `internal/api/ai_handlers.go` shared with `ai-runtime`: AI settings and remediation handlers are both an AI runtime control surface and a canonical API payload contract boundary.Legacy Assistant SSE routes in this handler that still use the olderexecute envelope, including `/api/ai/execute/stream` anddiff --git a/frontend-modern/src/api/__tests__/aiChat.test.ts b/frontend-modern/src/api/__tests__/aiChat.test.tsindex 4dfffdf87a..91bff1d1ce 100644--- a/frontend-modern/src/api/__tests__/aiChat.test.ts+++ b/frontend-modern/src/api/__tests__/aiChat.test.ts@@ -194,6 +194,53 @@ describe('AIChatAPI', () => {});});+ it('runs the tool-burst dev stream fixture without opening a provider request', async () => {+ const onEvent = vi.fn();++ await AIChatAPI.chat(+ '/fixture tool-burst',+ undefined,+ 'openrouter:deepseek/deepseek-chat',+ onEvent,+ );++ expect(apiFetchMock).not.toHaveBeenCalled();+ expect(onEvent.mock.calls.map(([event]) => event.type)).toEqual([+ 'session',+ 'workflow_state',+ 'workflow_state',+ 'tool_start',+ 'tool_end',+ 'content',+ 'done',+ ]);+ expect(onEvent.mock.calls[2][0]).toMatchObject({+ type: 'workflow_state',+ data: {+ phase: 'provider_start',+ message: 'Sent request to OpenRouter; waiting for the first token.',+ model: 'openrouter:deepseek/deepseek-chat',+ },+ });+ expect(onEvent.mock.calls[3][0]).toMatchObject({+ type: 'tool_start',+ data: {+ id: 'fixture-tool-burst',+ name: 'pulse_read',+ input: expect.stringContaining('ls /dev | wc -l'),+ },+ });+ expect(onEvent.mock.calls[4][0]).toMatchObject({+ type: 'tool_end',+ data: {+ id: 'fixture-tool-burst',+ name: 'pulse_read',+ output: '4358',+ success: true,+ },+ });+ });+it('runs the compacted-artifact dev stream fixture without opening a provider request', async () => {const onEvent = vi.fn();diff --git a/frontend-modern/src/api/aiChatDevStreamFixture.ts b/frontend-modern/src/api/aiChatDevStreamFixture.tsindex 3aecb98bb5..eb6d226a48 100644--- a/frontend-modern/src/api/aiChatDevStreamFixture.ts+++ b/frontend-modern/src/api/aiChatDevStreamFixture.ts@@ -3,6 +3,7 @@ import type { AIChatStreamEvent } from './generated/aiChatEvents';export const AI_CHAT_DEV_STREAM_FIXTURE_PROMPTS = ['/fixture devices','/fixture assistant-stream',+ '/fixture tool-burst','/fixture compacted-artifact','/fixture skipped-tool',] as const;@@ -191,6 +192,67 @@ const buildSkippedToolFixtureEvents = (model?: string): AIChatStreamEvent[] => [},];+const buildToolBurstFixtureEvents = (model?: string): AIChatStreamEvent[] => [+ {+ type: 'session',+ data: { id: 'dev-fixture-tool-burst' },+ },+ {+ type: 'workflow_state',+ data: {+ phase: 'request_start',+ message: 'Preparing Pulse context.',+ },+ },+ {+ type: 'workflow_state',+ data: {+ phase: 'provider_start',+ message: 'Sent request to OpenRouter; waiting for the first token.',+ model: assistantFixtureModel(model),+ },+ },+ {+ type: 'tool_start',+ data: {+ id: 'fixture-tool-burst',+ name: 'pulse_read',+ input:+ '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}',+ raw_input:+ 'pulse_read(target_host="current_resource", command="ls /dev | wc -l")',+ },+ },+ {+ type: 'tool_end',+ data: {+ id: 'fixture-tool-burst',+ name: 'pulse_read',+ input:+ '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}',+ raw_input:+ 'pulse_read(target_host="current_resource", command="ls /dev | wc -l")',+ output: '4358',+ success: true,+ },+ },+ {+ type: 'content',+ data: {+ text: 'The burst fixture completed a fast `pulse_read` command and kept the tool transition visible.',+ },+ },+ {+ type: 'done',+ data: {+ session_id: 'dev-fixture-tool-burst',+ model: assistantFixtureModel(model),+ input_tokens: 64,+ output_tokens: 31,+ },+ },+];+const buildCompactedArtifactFixtureEvents = (model?: string): AIChatStreamEvent[] => [{type: 'session',@@ -258,13 +320,27 @@ const buildFixtureEvents = (prompt: string, model?: string): AIChatStreamEvent[]if (normalized === '/fixture skipped-tool') {return buildSkippedToolFixtureEvents(model);}+ if (normalized === '/fixture tool-burst') {+ return buildToolBurstFixtureEvents(model);+ }return buildDeviceCountFixtureEvents(model);};+const fixtureStepDelay = (+ normalizedPrompt: string,+ event: AIChatStreamEvent,+ defaultDelayMs: number,+): number => {+ if (normalizedPrompt !== '/fixture tool-burst') return defaultDelayMs;+ if (event.type === 'tool_start') return 0;+ return defaultDelayMs;+};+export const maybeRunAIChatDevStreamFixture = async (options: AIChatDevStreamFixtureOptions,): Promise<boolean> => {- if (!isAIChatDevStreamFixtureAvailable() || !isAIChatDevStreamFixturePrompt(options.prompt)) {+ const normalizedPrompt = normalizeFixturePrompt(options.prompt);+ if (!isAIChatDevStreamFixtureAvailable() || !isAIChatDevStreamFixturePrompt(normalizedPrompt)) {return false;}@@ -273,14 +349,14 @@ export const maybeRunAIChatDevStreamFixture = async ((import.meta.env.MODE === 'test'? TEST_FIXTURE_STEP_DELAY_MS: DEFAULT_DEV_FIXTURE_STEP_DELAY_MS);- const events = buildFixtureEvents(options.prompt, options.model);+ const events = buildFixtureEvents(normalizedPrompt, options.model);for (let index = 0; index < events.length; index += 1) {const event = events[index];throwIfAborted(options.signal);options.onEvent(event);if (index < events.length - 1) {- await waitForFixtureStep(delayMs, options.signal);+ await waitForFixtureStep(fixtureStepDelay(normalizedPrompt, event, delayMs), options.signal);}}diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsxindex 8a89308780..1c3a9125fe 100644--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx@@ -625,6 +625,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {<ToolExecutionBlockstartedAt={evt.startedAt}completedAt={evt.updatedAt}+ live={props.message.isStreaming}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 5534c731dc..750cfa5ee6 100644--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx@@ -32,6 +32,7 @@ interface ToolExecutionBlockProps {tool: ToolExecution;startedAt?: number;completedAt?: number;+ live?: boolean;}interface ToolInputSummaryProps {@@ -134,6 +135,8 @@ const formatCompletedToolDuration = (startedAt?: number, completedAt?: number):return remainingMinutes ? `${hours}h ${remainingMinutes}m` : `${hours}h`;};+const FAST_TOOL_COMPLETION_SETTLE_MS = 420;+const ToolInputSummary: Component<ToolInputSummaryProps> = (props) => {const isShellSummary = createMemo(() => props.summary.trim().startsWith('$ '));const className = createMemo(@@ -175,6 +178,7 @@ const ToolCommandPreview: Component<ToolCommandPreviewProps> = (props) => (export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) => {const [showDetails, setShowDetails] = createSignal(false);const [copiedDetail, setCopiedDetail] = createSignal<'input' | 'output' | null>(null);+ const [settlingFastCompletion, setSettlingFastCompletion] = createSignal(false);const detailsId = createUniqueId();let copiedResetTimer: number | undefined;@@ -197,15 +201,44 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>const hasInput = createMemo(() => inputText().trim().length > 0);const hasOutput = createMemo(() => hasReadableToolOutput(outputText()));const hasDetails = createMemo(() => hasInput() || hasOutput());+ createEffect(() => {+ if (!props.live || !props.tool.success || !props.startedAt || !props.completedAt) {+ setSettlingFastCompletion(false);+ return;+ }++ const durationMs = props.completedAt - props.startedAt;+ if (+ !Number.isFinite(durationMs) ||+ durationMs < 0 ||+ durationMs >= FAST_TOOL_COMPLETION_SETTLE_MS+ ) {+ setSettlingFastCompletion(false);+ return;+ }++ setSettlingFastCompletion(true);+ const timeout = window.setTimeout(+ () => setSettlingFastCompletion(false),+ FAST_TOOL_COMPLETION_SETTLE_MS - durationMs,+ );+ onCleanup(() => window.clearTimeout(timeout));+ });+const durationLabel = createMemo(() =>- formatCompletedToolDuration(props.startedAt, props.completedAt),+ settlingFastCompletion()+ ? ''+ : formatCompletedToolDuration(props.startedAt, props.completedAt),);- const statusLabel = () => (props.tool.success ? 'completed' : 'failed');+ const statusLabel = () =>+ settlingFastCompletion() ? 'running' : props.tool.success ? 'completed' : 'failed';const statusPillClass = () =>- props.tool.success- ? 'border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/60 dark:bg-emerald-950/30 dark:text-emerald-300'- : 'border-red-200 bg-red-50 text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300';+ settlingFastCompletion()+ ? 'border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/60 dark:bg-blue-950/30 dark:text-blue-300'+ : props.tool.success+ ? 'border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/60 dark:bg-emerald-950/30 dark:text-emerald-300'+ : 'border-red-200 bg-red-50 text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300';const summaryControlTitle = () => (showDetails() ? 'Hide tool details' : 'Show tool details');const toggleDetails = () => {if (!hasDetails()) return;@@ -234,7 +267,11 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>});return (- <div class="my-2 overflow-hidden rounded-md border border-border-subtle bg-surface text-[11px] shadow-sm">+ <div+ class="my-2 overflow-hidden rounded-md border border-border-subtle bg-surface text-[11px] shadow-sm"+ role={settlingFastCompletion() ? 'status' : undefined}+ aria-label={settlingFastCompletion() ? 'Assistant tool running' : undefined}+ ><divclass={`flex min-w-0 items-start gap-2 px-2.5 py-2 ${hasDetails()@@ -251,18 +288,28 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>><div class="pt-0.5"><Show- when={props.tool.success}+ when={!settlingFastCompletion()}fallback={- <XCircleIcon- class={`${getToolCallResultTextClass(props.tool.success)} h-3.5 w-3.5 shrink-0`}- aria-label={statusLabel()}+ <LoaderCircleIcon+ class="h-3.5 w-3.5 shrink-0 animate-spin text-blue-500 dark:text-blue-400"+ aria-label="running"/>}>- <CheckCircleIcon- class={`${getToolCallResultTextClass(props.tool.success)} h-3.5 w-3.5 shrink-0`}- aria-label={statusLabel()}- />+ <Show+ when={props.tool.success}+ fallback={+ <XCircleIcon+ class={`${getToolCallResultTextClass(props.tool.success)} h-3.5 w-3.5 shrink-0`}+ aria-label={statusLabel()}+ />+ }+ >+ <CheckCircleIcon+ class={`${getToolCallResultTextClass(props.tool.success)} h-3.5 w-3.5 shrink-0`}+ aria-label={statusLabel()}+ />+ </Show></Show></div>diff --git a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsxindex 2b1b7dadc9..1b1465acb5 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx@@ -10,7 +10,10 @@ import {} from '../ToolExecutionBlock';import type { ToolExecution, PendingTool } from '../types';-afterEach(cleanup);+afterEach(() => {+ cleanup();+ vi.useRealTimers();+});// --- Factories ---@@ -34,6 +37,7 @@ function makePending(overrides?: Partial<PendingTool>): PendingTool {}const getToolDetailsTrigger = () => screen.getByTitle('Show tool details');+const FAST_TOOL_SETTLE_TEST_MS = 500;// ============================================================// ToolExecutionBlock@@ -121,6 +125,42 @@ describe('ToolExecutionBlock', () => {expect(screen.getByLabelText('Tool duration <1s')).toHaveTextContent('<1s');});+ it('briefly presents fresh live fast completions as running before settling', async () => {+ vi.useFakeTimers();++ render(() => (+ <ToolExecutionBlock tool={makeTool()} startedAt={1_000} completedAt={1_040} live />+ ));++ expect(screen.getByLabelText('Assistant tool running')).toBeInTheDocument();+ expect(screen.getByLabelText('running')).toBeInTheDocument();+ expect(screen.getByText('running')).toBeInTheDocument();+ expect(screen.queryByText('completed')).not.toBeInTheDocument();+ expect(screen.queryByLabelText(/Tool duration/)).not.toBeInTheDocument();++ await vi.advanceTimersByTimeAsync(FAST_TOOL_SETTLE_TEST_MS);++ expect(screen.queryByLabelText('Assistant tool running')).not.toBeInTheDocument();+ expect(screen.getByLabelText('completed')).toBeInTheDocument();+ expect(screen.getByText('completed')).toBeInTheDocument();+ expect(screen.getByLabelText('Tool duration <1s')).toHaveTextContent('<1s');+ });++ it('does not defer failed fast completions behind a running state', () => {+ render(() => (+ <ToolExecutionBlock+ tool={makeTool({ success: false })}+ startedAt={1_000}+ completedAt={1_040}+ live+ />+ ));++ expect(screen.getByLabelText('failed')).toBeInTheDocument();+ expect(screen.getByText('failed')).toBeInTheDocument();+ expect(screen.queryByText('running')).not.toBeInTheDocument();+ });+it('does not invent completed tool duration without a valid start and end', () => {render(() => <ToolExecutionBlock tool={makeTool()} startedAt={4_000} completedAt={3_000} />);