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
Render partial Assistant tool input while streaming
rcourtman8e09fda936d6
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 0ace78d912..1d4284997a 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -317,7 +317,11 @@ runtime cost control, and shared AI transport surfaces.until `[DONE]`, `message_stop`, or execution completion recreates thedelayed batch feeling this contract is meant to prevent. Policy-hiddenplaceholder attempts remain governed by the runtime and may cancel a pending- row instead of persisting a failed tool card.+ row instead of persisting a failed tool card. While streamed arguments are+ still invalid or incomplete JSON, the frontend must use the `raw_input`+ fragment to show a safe partial command/path/query summary instead of a+ blank `{}` request row, then replace it with the structured summary once+ parsing succeeds.The referenced OpenCode source at fetched `origin/dev` commit`09d9cf01f93798939c1284fbe974b6e1f4d2759d` renders tool-specific inlinelabels such as `Read <path>`, `Grep "<pattern>"`, `WebFetch <url>`, and bashdiff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsxindex 456b1deefa..0fcebc0984 100644--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx@@ -30,6 +30,22 @@ const getToolLabel = (name: string) => {const normalizedToolName = (name?: string) => (name || '').trim().replace(/^pulse_/, '');+const escapePartialJSONKey = (key: string) => key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');++const extractPartialJSONStringField = (rawInput: string, keys: string[]) => {+ const raw = rawInput.trim();+ if (!raw) return '';++ for (const key of keys) {+ const escapedKey = escapePartialJSONKey(key);+ const match = raw.match(new RegExp(`"${escapedKey}"\\s*:\\s*"((?:\\\\.|[^"\\\\])*)`));+ if (match?.[1]) {+ return match[1].replace(/\\"/g, '"').replace(/\\\\/g, '\\').trim();+ }+ }+ return '';+};+const stringField = (record: Record<string, unknown>, keys: string[]) => {for (const key of keys) {const value = record[key];@@ -57,6 +73,48 @@ const targetSuffix = (record: Record<string, unknown>) => {return ` on ${formatIdentifierLabel(target, { maxLength: 18 })}`;};+const formatPartialRawInputSummary = (rawInput: string | undefined, toolName?: string) => {+ if (!rawInput?.trim()) return '';++ const action = extractPartialJSONStringField(rawInput, ['action', 'type']).toLowerCase();+ const command = extractPartialJSONStringField(rawInput, ['command', 'cmd']);+ const path = extractPartialJSONStringField(rawInput, ['path', 'file', 'file_path', 'filePath']);+ const pattern = extractPartialJSONStringField(rawInput, ['pattern', 'grep', 'grep_pattern', 'grepPattern']);+ const query = extractPartialJSONStringField(rawInput, ['query', 'search', 'name', 'resource_name']);+ const target = extractPartialJSONStringField(rawInput, [+ 'target_host',+ 'targetHost',+ 'resource_id',+ 'resourceId',+ ]);+ const record: Record<string, unknown> = {+ ...(action ? { action } : {}),+ ...(command ? { command } : {}),+ ...(path ? { path } : {}),+ ...(pattern ? { pattern } : {}),+ ...(query ? { query } : {}),+ ...(target ? { target_host: target } : {}),+ };+ const tool = normalizedToolName(toolName);++ if ((tool === 'read' || tool === 'run_command' || tool === 'control') && command) {+ return `$ ${inlineValue(command, 64)}${targetSuffix(record)}`;+ }+ if (tool === 'read') {+ if (action === 'file' && path) return `read ${inlineValue(path, 36)}${targetSuffix(record)}`;+ if (action === 'tail' && path) return `tail ${inlineValue(path, 36)}${targetSuffix(record)}`;+ if (action === 'find' && pattern) return `find "${inlineValue(pattern, 28)}"${targetSuffix(record)}`;+ if (action === 'logs') return `read logs${targetSuffix(record)}`;+ }+ if (tool === 'query') {+ if (action === 'search' && query) return `search "${inlineValue(query, 28)}"`;+ if (action === 'list') return 'list resources';+ if (action) return formatIdentifierLabel(action, { maxLength: 28 });+ }+ if (action) return formatIdentifierLabel(action, { maxLength: 28 });+ return 'receiving input';+};+const formatCommandSummary = (record: Record<string, unknown>) => {const command = stringField(record, ['command', 'cmd']);if (!command) return '';@@ -147,7 +205,7 @@ const formatAlertsInputSummary = (record: Record<string, unknown>) => {return action ? formatIdentifierLabel(action, { maxLength: 28 }) : 'read alerts';};-const parseToolInputSummary = (input: string, toolName?: string) => {+const parseToolInputSummary = (input: string, toolName?: string, rawInput?: string) => {const trimmed = input.trim();if (!trimmed) return '';@@ -155,6 +213,9 @@ const parseToolInputSummary = (input: string, toolName?: string) => {const parsed = JSON.parse(trimmed) as unknown;if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {const record = parsed as Record<string, unknown>;+ if (Object.keys(record).length === 0) {+ return formatPartialRawInputSummary(rawInput, toolName) || 'request';+ }const tool = normalizedToolName(toolName);if (tool === 'read') {return formatPulseReadInputSummary(record) || 'read resource';@@ -287,7 +348,9 @@ interface PendingToolBlockProps {export const PendingToolBlock: Component<PendingToolBlockProps> = (props) => {const toolLabel = createMemo(() => getToolLabel(props.tool.name));const inputText = createMemo(() => toolValueText(props.tool.input));- const inputSummary = createMemo(() => parseToolInputSummary(inputText(), props.tool.name));+ const inputSummary = createMemo(() =>+ parseToolInputSummary(inputText(), props.tool.name, props.tool.rawInput),+ );const status = createMemo(() => props.tool.status || 'pending');const [now, setNow] = createSignal(Date.now());const statusLabel = createMemo(() => {diff --git a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsxindex e0920915d6..bac44683c3 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx@@ -415,6 +415,36 @@ describe('PendingToolBlock', () => {expect(screen.queryByText(/"command"/)).not.toBeInTheDocument();});+ it('uses raw partial input while pending Pulse read command JSON is still streaming', () => {+ render(() => (+ <PendingToolBlock+ tool={makePending({+ name: 'pulse_read',+ input: '{}',+ rawInput:+ '{"action": "exec", "command": "ls /dev | wc -l", "target_host": "current_resource',+ })}+ />+ ));++ expect(screen.getByText('$ ls /dev | wc -l on current resource')).toBeInTheDocument();+ expect(screen.queryByText(/"target_host"/)).not.toBeInTheDocument();+ });++ it('shows the currently streamed command fragment before the tool input is valid JSON', () => {+ render(() => (+ <PendingToolBlock+ tool={makePending({+ name: 'pulse_read',+ input: '{}',+ rawInput: '{"action": "exec", "command": "ls /dev |',+ })}+ />+ ));++ expect(screen.getByText('$ ls /dev |')).toBeInTheDocument();+ });+// --- Activity state ---it('renders a spinner SVG with animate-spin class while pending', () => {diff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.tsindex 00923b3ab7..cb71f79b07 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -1222,6 +1222,7 @@ describe('useChat', () => {id: 'tool-1',name: 'get_logs',input: '{}',+ raw_input: '{"action": "logs"',phase: 'running',message: 'Running.',},@@ -1233,6 +1234,7 @@ describe('useChat', () => {id: 'tool-1',name: 'get_logs',input: '{}',+ rawInput: '{"action": "logs"',status: 'running',progress: 'Running.',});@@ -1240,6 +1242,7 @@ describe('useChat', () => {expect(pendingToolEvents).toHaveLength(1);expect(pendingToolEvents![0].pendingTool).toMatchObject({id: 'tool-1',+ rawInput: '{"action": "logs"',status: 'running',progress: 'Running.',});