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
Preview bounded Assistant tool output
rcourtmaneed41dc9a2ce
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 4849db1952..19643ca6b7 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -557,6 +557,12 @@ runtime cost control, and shared AI transport surfaces.superseded. Live workflow and pending-tool activity must retain a per-statestart timestamp so the drawer can show elapsed wait/run time for longprovider starts and tool calls instead of repeating a timeless waiting label.+ Completed plain-text tool output must keep a bounded transcript preview+ visible by default, with full input/output available through expansion, so+ the operator sees evidence of what completed without receiving a raw output+ dump. Structured, binary, unavailable, or otherwise noisy output may stay+ collapsed behind details, but a successful text command must not degrade to+ an opaque `output available` badge when a safe preview can be rendered.If the UI enters a loading turn before the assistant shell or first`workflow_state` exists, the active-turn footer must show the active startupstatus `Sending prompt` and derive elapsed time from the submitted, non-queueddiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex fb816a2a2e..03c5bc5e0e 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -596,8 +596,12 @@ payload shape change when the portal presents compact client rows.emitting placeholder structured input plus raw provider-style input on`tool_start`, mutating that same row through `tool_progress`, and pacing therunning state long enough for browser proof to inspect and copy both the- completed input and current progress before `tool_end`. At least one- fixture-backed Assistant tool sequence must exercise compacted provider artifact+ completed input and current progress before `tool_end`. At least one+ fixture-backed Assistant tool sequence must exercise successful long+ plain-text tool output by emitting enough output lines to prove the browser+ drawer renders a bounded collapsed preview, avoids an opaque output badge,+ and preserves the full output in expandable details. At least one+ fixture-backed Assistant tool sequence must exercise compacted provider artifactsuppression by emitting compacted pre-tool content before a governed tool rowand final normal answer content. At least one fixture-backed Assistant toolsequence must exercise a buffered `tool_start` -> `tool_end` burst with nodiff --git a/frontend-modern/src/api/__tests__/aiChat.test.ts b/frontend-modern/src/api/__tests__/aiChat.test.tsindex ea5b882f3e..daefc1541f 100644--- a/frontend-modern/src/api/__tests__/aiChat.test.ts+++ b/frontend-modern/src/api/__tests__/aiChat.test.ts@@ -503,6 +503,43 @@ describe('AIChatAPI', () => {});});+ it('runs the long-output dev stream fixture without opening a provider request', async () => {+ const onEvent = vi.fn();++ await AIChatAPI.chat(+ '/fixture long-output',+ undefined,+ 'openrouter:deepseek/deepseek-chat',+ onEvent,+ );++ expect(apiFetchMock).not.toHaveBeenCalled();+ expect(onEvent.mock.calls.map(([event]) => event.type)).toEqual([+ 'session',+ 'workflow_state',+ 'tool_start',+ 'tool_end',+ 'content',+ 'done',+ ]);+ expect(onEvent.mock.calls[3][0]).toMatchObject({+ type: 'tool_end',+ data: {+ id: 'fixture-tool-long-output',+ name: 'pulse_read',+ output: expect.stringContaining('line 6'),+ success: true,+ },+ });+ expect(onEvent.mock.calls[5][0]).toMatchObject({+ type: 'done',+ data: {+ session_id: 'dev-fixture-long-output',+ model: 'openrouter:deepseek/deepseek-chat',+ },+ });+ });+it('runs the provider-retry 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 3c8965417d..1b192ad1b2 100644--- a/frontend-modern/src/api/aiChatDevStreamFixture.ts+++ b/frontend-modern/src/api/aiChatDevStreamFixture.ts@@ -8,6 +8,7 @@ export const AI_CHAT_DEV_STREAM_FIXTURE_PROMPTS = ['/fixture context-group','/fixture status-boundary','/fixture pending-tool',+ '/fixture long-output','/fixture provider-retry','/fixture stream-idle','/fixture queue-hold',@@ -541,6 +542,59 @@ const buildPendingToolFixtureEvents = (model?: string): AIChatStreamEvent[] => [},];+const buildLongOutputFixtureEvents = (model?: string): AIChatStreamEvent[] => [+ {+ type: 'session',+ data: { id: 'dev-fixture-long-output' },+ },+ {+ type: 'workflow_state',+ data: {+ phase: 'request_start',+ message: 'Preparing Pulse context.',+ },+ },+ {+ type: 'tool_start',+ data: {+ id: 'fixture-tool-long-output',+ name: 'pulse_read',+ input:+ '{"action":"exec","target_host":"current_resource","command":"cat /tmp/pulse-long-output-fixture.txt"}',+ raw_input:+ 'pulse_read(target_host="current_resource", command="cat /tmp/pulse-long-output-fixture.txt")',+ },+ },+ {+ type: 'tool_end',+ data: {+ id: 'fixture-tool-long-output',+ name: 'pulse_read',+ input:+ '{"action":"exec","target_host":"current_resource","command":"cat /tmp/pulse-long-output-fixture.txt"}',+ raw_input:+ 'pulse_read(target_host="current_resource", command="cat /tmp/pulse-long-output-fixture.txt")',+ output: ['line 1', 'line 2', 'line 3', 'line 4', 'line 5', 'line 6'].join('\n'),+ success: true,+ },+ },+ {+ type: 'content',+ data: {+ text: 'The long-output fixture kept a bounded plain-text tool preview visible while preserving the full output in details.',+ },+ },+ {+ type: 'done',+ data: {+ session_id: 'dev-fixture-long-output',+ model: assistantFixtureModel(model),+ input_tokens: 64,+ output_tokens: 24,+ },+ },+];+const buildProviderRetryFixtureEvents = (): AIChatStreamEvent[] => [{type: 'session',@@ -831,6 +885,9 @@ const buildFixtureEvents = (prompt: string, model?: string): AIChatStreamEvent[]if (normalized === '/fixture pending-tool') {return buildPendingToolFixtureEvents(model);}+ if (normalized === '/fixture long-output') {+ return buildLongOutputFixtureEvents(model);+ }if (normalized === '/fixture provider-retry') {return buildProviderRetryFixtureEvents();}diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsxindex a2f39622cf..2d4070af78 100644--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx@@ -95,7 +95,7 @@ const trimPreviewLine = (line: string, maxLength: number) => {return `${trimmed.slice(0, maxLength).trimEnd()}...`;};-const formatOutputPreview = (output: string, success: boolean) => {+const formatOutputPreview = (output: string) => {const normalized = stripAnsiControlCodes(output).replace(/\r\n/g, '\n').trim();if (!hasReadableToolOutput(normalized)) return '';if (looksLikeStructuredOutput(normalized)) return '';@@ -112,7 +112,6 @@ const formatOutputPreview = (output: string, success: boolean) => {const charsTruncated = lines.slice(0, maxLines).some((line) => line.trimEnd().length > maxLineLength);- if (success && (linesTruncated || charsTruncated)) return '';return linesTruncated || charsTruncated ? `${fullPreview}\n...` : fullPreview;};@@ -298,7 +297,7 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>if (!preview || summary.startsWith('$ ') || preview === summary) return '';return preview;});- const outputPreview = createMemo(() => formatOutputPreview(outputText(), props.tool.success));+ const outputPreview = createMemo(() => formatOutputPreview(outputText()));const hiddenOutputSummary = createMemo(() =>outputPreview() ? '' : formatHiddenOutputSummary(outputText()),);diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsxindex 0fec329228..0c90c73d14 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx@@ -865,7 +865,7 @@ describe('AIChat', () => {role: 'assistant',content: '',error:- 'Unknown Assistant fixture "/fixture typo-check". Available fixtures: devices, assistant-stream, tool-burst, context-group, pending-tool, provider-retry, stream-idle, queue-hold, queue-drain, compacted-artifact, skipped-tool.',+ 'Unknown Assistant fixture "/fixture typo-check". Available fixtures: devices, assistant-stream, tool-burst, context-group, pending-tool, long-output, provider-retry, stream-idle, queue-hold, queue-drain, compacted-artifact, skipped-tool.',timestamp: new Date('2026-06-05T10:00:00Z'),model: 'openrouter:qwen/qwen3.7-plus',streamEvents: [diff --git a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsxindex 7e38bc9a25..f01032d2d3 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx@@ -419,7 +419,7 @@ describe('ToolExecutionBlock', () => {expect(getToolDetailsTrigger()).toBeInTheDocument();});- it('keeps successful long plain-text output behind details', () => {+ it('previews successful long plain-text output with a bounded collapsed view', () => {const { container } = render(() => (<ToolExecutionBlocktool={makeTool({@@ -429,23 +429,22 @@ describe('ToolExecutionBlock', () => {));const text = container.textContent || '';- expect(screen.queryByLabelText('Tool output preview')).not.toBeInTheDocument();- expect(text).not.toContain('line 1');+ const preview = screen.getByLabelText('Tool output preview');+ expect(preview).toHaveTextContent('line 1');+ expect(preview).toHaveTextContent('line 4');+ expect(preview).toHaveTextContent('...');expect(text).not.toContain('line 5');- expect(screen.getByLabelText('Tool output available: 5 lines output')).toHaveTextContent(- 'output available',- );+ expect(screen.queryByLabelText(/Tool output available/)).not.toBeInTheDocument();expect(screen.queryByText('5 lines output')).not.toBeInTheDocument();expect(getToolDetailsTrigger()).toBeInTheDocument();});- it('keeps suppressed single-line output counts out of the visible row', () => {+ it('previews long successful single-line output without showing raw output counts', () => {render(() => <ToolExecutionBlock tool={makeTool({ output: 'x'.repeat(160) })} />);- expect(screen.queryByLabelText('Tool output preview')).not.toBeInTheDocument();- expect(screen.getByLabelText('Tool output available: 160 chars output')).toHaveTextContent(- 'output available',- );+ const preview = screen.getByLabelText('Tool output preview');+ expect(preview).toHaveTextContent(`${'x'.repeat(120)}...`);+ expect(screen.queryByLabelText(/Tool output available/)).not.toBeInTheDocument();expect(screen.queryByText('160 chars output')).not.toBeInTheDocument();});