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.

Keep Assistant tool output behind details

rcourtmanf7ee1244f0eb
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 359959c56a..b6efdb8417 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -257,6 +257,17 @@ runtime cost control, and shared AI transport surfaces.
already finished. Token content and hidden reasoning may continue to opt out
of those checkpoints through the caller predicate so answer streaming remains
fast.
+ Completed Assistant tool rows follow the same source-anchored display policy:
+ the referenced OpenCode commit
+ `9ed17da55ab1f7360cc0e01075f763e27fa899e9` keeps ordinary tool activity terse
+ through `GenericTool`/`InlineToolRow` in
+ `packages/opencode/src/cli/cmd/tui/routes/session/index.tsx`, hides generic
+ output unless `showGenericToolOutput` is enabled, and bounds output-heavy
+ blocks with `packages/opencode/src/cli/cmd/tui/util/collapse-tool-output.ts`.
+ Pulse adapts that by keeping the completed tool action/command visible in the
+ transcript while raw command/tool output remains an explicit Details expansion
+ instead of a default preview. This preserves evidence for inspection without
+ letting large command output dominate the Assistant answer flow.
OpenCode-parity Assistant UX work must reference OpenCode's actual source
implementation for message parts, tool-state mutation, progress rendering,
and model/session selection before changing Pulse behavior; parity means
diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
index a30a27a1fd..0fcebc0984 100644
--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
@@ -249,36 +249,6 @@ const hasReadableToolOutput = (output: string) => {
return trimmed.length > 0 && !trimmed.toLowerCase().includes('not available');
};
-const looksLikeStructuredJSON = (value: string) => {
- const trimmed = value.trim();
- if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) return false;
- if (trimmed.length > 5000) return true;
- try {
- JSON.parse(trimmed);
- return true;
- } catch {
- return false;
- }
-};
-
-const formatToolOutputPreview = (output: string) => {
- const normalized = output.trim().replace(/\r\n/g, '\n');
- if (!hasReadableToolOutput(normalized) || looksLikeStructuredJSON(normalized)) return '';
-
- const lines = normalized.split('\n');
- const maxLines = 3;
- const maxChars = 240;
- let preview = lines.slice(0, maxLines).join('\n').trimEnd();
- let truncated = lines.length > maxLines;
-
- if (preview.length > maxChars) {
- preview = preview.slice(0, maxChars).trimEnd();
- truncated = true;
- }
-
- return truncated ? `${preview}\n...` : preview;
-};
-
const toolValueText = (value: unknown) => {
if (typeof value === 'string') return value;
if (value === null || value === undefined) return '';
@@ -302,7 +272,6 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
const hasInput = createMemo(() => inputText().trim().length > 0);
const hasOutput = createMemo(() => hasReadableToolOutput(outputText()));
const hasDetails = createMemo(() => hasInput() || hasOutput());
- const outputPreview = createMemo(() => formatToolOutputPreview(outputText()));
const statusLabel = () => (props.tool.success ? 'completed' : 'failed');
@@ -344,11 +313,6 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
</button>
</Show>
</div>
- <Show when={outputPreview()}>
- <pre class="ml-[calc(0.75rem+56px)] mt-0.5 max-h-20 overflow-hidden rounded bg-surface-alt px-2 py-1 text-[10px] leading-snug text-muted whitespace-pre-wrap break-words">
- {outputPreview()}
- </pre>
- </Show>
<Show when={showDetails() && hasDetails()}>
<div class="ml-4 mt-1 mb-2 pl-2 border-l-2 border-border overflow-hidden">
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 5ce5bb6550..58599b6c43 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
@@ -225,9 +225,9 @@ describe('ToolExecutionBlock', () => {
// --- Output display ---
- it('shows compact plain-text output by default when non-empty', () => {
+ it('keeps plain-text output behind details by default', () => {
render(() => <ToolExecutionBlock tool={makeTool({ output: 'hello world' })} />);
- expect(screen.getByText('hello world')).toBeInTheDocument();
+ expect(screen.queryByText('hello world')).not.toBeInTheDocument();
expect(screen.getByText('Details')).toBeInTheDocument();
});
@@ -246,7 +246,7 @@ describe('ToolExecutionBlock', () => {
expect(screen.getByText('Details')).toBeInTheDocument();
});
- it('collapses long plain-text output previews', () => {
+ it('does not push long plain-text output into the transcript by default', () => {
const { container } = render(() => (
<ToolExecutionBlock
tool={makeTool({
@@ -256,10 +256,10 @@ describe('ToolExecutionBlock', () => {
));
const text = container.textContent || '';
- expect(text).toContain('line 1');
- expect(text).toContain('line 3');
+ expect(text).not.toContain('line 1');
+ expect(text).not.toContain('line 3');
expect(text).not.toContain('line 5');
- expect(text).toContain('...');
+ expect(screen.getByText('Details')).toBeInTheDocument();
});
it('hides output that is only whitespace', () => {