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.

Hide successful Assistant tool output previews

rcourtmanedabb6c05948
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index f036da9d7e..0a17beb66e 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -249,10 +249,13 @@ leave the transcript without exposing hidden provider/tool metadata.
(`ToolView.output`, lines 40-44; tool display hooks, lines 117-123), and
commits allowed tool output into scrollback in
`packages/opencode/src/cli/cmd/run/session-data.ts` (lines 960-964). Pulse
- completed rows must expose compact output metadata for hidden long,
- structured, or binary outputs while keeping raw output behind the existing
- details disclosure, and those raw input/output details must be copyable
- from the disclosure without expanding the default transcript.
+ completed rows must expose compact output metadata for hidden successful
+ outputs while keeping raw output behind the existing details disclosure, and
+ those raw input/output details must be copyable from the disclosure without
+ expanding the default transcript. Failed tool output may stay visible as a
+ bounded inline preview because it is the operator-facing failure reason;
+ successful command output belongs in details unless the Assistant answer
+ explicitly summarizes it as normal response text.
Completed Assistant context summaries must use the same operator-facing
tool-input presentation as the visible tool rows, not raw internal tool
identifiers. A completed `pulse_read` device inspection should therefore
diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
index b5577131c1..d3589c43d2 100644
--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
@@ -342,7 +342,10 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
if (!preview || summary.startsWith('$ ') || preview === summary) return '';
return preview;
});
- const outputPreview = createMemo(() => formatOutputPreview(outputText()));
+ const shouldPreviewOutput = createMemo(() => props.tool.success === false);
+ const outputPreview = createMemo(() =>
+ shouldPreviewOutput() ? formatOutputPreview(outputText()) : '',
+ );
const hiddenOutputSummary = createMemo(() =>
outputPreview() ? '' : formatHiddenOutputSummary(outputText()),
);
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
index 9c8891eb0a..3f504e9fd4 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
@@ -451,13 +451,15 @@ describe('ToolExecutionBlock', () => {
// --- Output display ---
- it('previews successful short plain-text output while keeping full details available', () => {
+ it('keeps successful short plain-text output behind details', () => {
render(() => <ToolExecutionBlock tool={makeTool({ output: 'hello world' })} />);
- expect(screen.getByLabelText('Tool output preview')).toHaveTextContent('hello world');
- expect(screen.queryByLabelText(/Tool output available/)).not.toBeInTheDocument();
+ expect(screen.queryByLabelText('Tool output preview')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Tool output available: 11 chars output')).toHaveTextContent(
+ 'output available',
+ );
fireEvent.click(getToolDetailsTrigger());
expect(screen.getByText('Output')).toBeInTheDocument();
- expect(screen.getAllByText('hello world')).toHaveLength(2);
+ expect(screen.getByText('hello world')).toBeInTheDocument();
});
it('does not preview structured JSON output by default', () => {
@@ -478,7 +480,7 @@ describe('ToolExecutionBlock', () => {
expect(getToolDetailsTrigger()).toBeInTheDocument();
});
- it('previews successful long plain-text output with a bounded collapsed view', () => {
+ it('keeps successful long plain-text output behind details', () => {
const { container } = render(() => (
<ToolExecutionBlock
tool={makeTool({
@@ -488,22 +490,22 @@ describe('ToolExecutionBlock', () => {
));
const text = container.textContent || '';
- const preview = screen.getByLabelText('Tool output preview');
- expect(preview).toHaveTextContent('line 1');
- expect(preview).toHaveTextContent('line 4');
- expect(preview).toHaveTextContent('...');
+ expect(screen.queryByLabelText('Tool output preview')).not.toBeInTheDocument();
expect(text).not.toContain('line 5');
- expect(screen.queryByLabelText(/Tool output available/)).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Tool output available: 5 lines output')).toHaveTextContent(
+ 'output available',
+ );
expect(screen.queryByText('5 lines output')).not.toBeInTheDocument();
expect(getToolDetailsTrigger()).toBeInTheDocument();
});
- it('previews long successful single-line output without showing raw output counts', () => {
+ it('hides long successful single-line output without showing raw output counts', () => {
render(() => <ToolExecutionBlock tool={makeTool({ output: 'x'.repeat(160) })} />);
- const preview = screen.getByLabelText('Tool output preview');
- expect(preview).toHaveTextContent(`${'x'.repeat(120)}...`);
- expect(screen.queryByLabelText(/Tool output available/)).not.toBeInTheDocument();
+ expect(screen.queryByLabelText('Tool output preview')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Tool output available: 160 chars output')).toHaveTextContent(
+ 'output available',
+ );
expect(screen.queryByText('160 chars output')).not.toBeInTheDocument();
});
@@ -531,7 +533,10 @@ describe('ToolExecutionBlock', () => {
expect(screen.getByText('Inspect devices on current resource')).toBeInTheDocument();
expect(screen.getByLabelText('Tool command')).toHaveTextContent('$ ls /dev | wc -l');
- expect(screen.getByLabelText('Tool output preview')).toHaveTextContent('42');
+ expect(screen.queryByLabelText('Tool output preview')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Tool output available: 2 chars output')).toHaveTextContent(
+ 'output available',
+ );
});
it('hides output that is only whitespace', () => {