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.

Show hidden Assistant tool output metadata

rcourtman441276348928
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 5a67811c9b..da1db9546b 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -164,13 +164,21 @@ runtime cost control, and shared AI transport surfaces.
referenced OpenCode source at fetched `origin/dev` commit
`effd27b23900720a53e965396ff1a105c1f7e9c8` carries tool identity and
state through `toolCommit` / `startTool` / `doneTool` in
- `packages/opencode/src/cli/cmd/run/session-data.ts` (lines 622-733) and
- formats elapsed tool state with `span` in
- `packages/opencode/src/cli/cmd/run/tool.ts` (lines 191-200). Pulse adapts
- that by carrying the stream event start/end timestamps into the completed
- browser tool row, so the visible activity timeline does not collapse when a
- running command is replaced by its completed result.
- Live workflow activity is also active turn state, not disposable waiting
+ `packages/opencode/src/cli/cmd/run/session-data.ts` (lines 622-733) and
+ formats elapsed tool state with `span` in
+ `packages/opencode/src/cli/cmd/run/tool.ts` (lines 191-200). Pulse adapts
+ that by carrying the stream event start/end timestamps into the completed
+ browser tool row, so the visible activity timeline does not collapse when a
+ running command is replaced by its completed result. Completed browser tool
+ rows must also preserve output trust when a raw preview is intentionally
+ suppressed: the referenced OpenCode source at fetched `origin/dev` commit
+ `1025540fcc2a69609a0131a7168300205656d728` keeps output visibility as an
+ explicit tool-view policy in `packages/opencode/src/cli/cmd/run/tool.ts`
+ (`ToolView.output`, lines 40-44; tool display hooks, lines 117-123), so
+ Pulse completed rows must expose compact output metadata for hidden long,
+ structured, or binary outputs while keeping raw output behind the existing
+ details disclosure.
+ Live workflow activity is also active turn state, not disposable waiting
copy. The referenced OpenCode source at fetched `origin/dev` commit
`4519a1da329c1a4fc384054e7203ba7d06928205` defines model, shell, step,
and tool lifecycle events in `packages/core/src/session/event.ts` (model
diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
index 3a6527699d..418466713c 100644
--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
@@ -96,6 +96,19 @@ const formatOutputPreview = (output: string, success: boolean) => {
return linesTruncated || charsTruncated ? `${fullPreview}\n...` : fullPreview;
};
+const formatHiddenOutputSummary = (output: string) => {
+ const normalized = stripAnsiControlCodes(output).replace(/\r\n/g, '\n').trim();
+ if (!hasReadableToolOutput(normalized)) return '';
+ if (looksLikeStructuredOutput(normalized)) return 'structured output';
+ if (hasBinaryControlCharacters(normalized)) return 'binary output';
+
+ const lines = normalized.split('\n');
+ if (lines.length > 1) return `${lines.length} lines output`;
+
+ const characterCount = normalized.length;
+ return `${characterCount} ${characterCount === 1 ? 'char' : 'chars'} output`;
+};
+
const formatCompletedToolDuration = (startedAt?: number, completedAt?: number): string => {
if (!startedAt || !completedAt) return '';
const durationMs = completedAt - startedAt;
@@ -169,6 +182,9 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
return preview;
});
const outputPreview = createMemo(() => formatOutputPreview(outputText(), props.tool.success));
+ const hiddenOutputSummary = createMemo(() =>
+ outputPreview() ? '' : formatHiddenOutputSummary(outputText()),
+ );
const hasInput = createMemo(() => inputText().trim().length > 0);
const hasOutput = createMemo(() => hasReadableToolOutput(outputText()));
const hasDetails = createMemo(() => hasInput() || hasOutput());
@@ -254,6 +270,15 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
aria-hidden="true"
/>
</Show>
+ <Show when={hiddenOutputSummary()}>
+ <span
+ class="shrink-0 rounded border border-border-subtle bg-surface-alt px-1.5 py-0.5 text-[9px] font-medium text-muted"
+ title="Open tool details to inspect output"
+ aria-label={`Tool output available: ${hiddenOutputSummary()}`}
+ >
+ {hiddenOutputSummary()}
+ </span>
+ </Show>
</div>
<ToolInputSummary summary={inputSummary()} />
<Show when={commandPreview()}>
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 de13e70bed..9bb3aa639a 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
@@ -325,6 +325,7 @@ describe('ToolExecutionBlock', () => {
it('previews successful short plain-text output while keeping full details available', () => {
render(() => <ToolExecutionBlock tool={makeTool({ output: 'hello world' })} />);
expect(screen.getByLabelText('Tool output preview')).toHaveTextContent('hello world');
+ expect(screen.queryByLabelText(/Tool output available/)).not.toBeInTheDocument();
fireEvent.click(getToolDetailsTrigger());
expect(screen.getByText('Output')).toBeInTheDocument();
expect(screen.getAllByText('hello world')).toHaveLength(2);
@@ -342,6 +343,9 @@ describe('ToolExecutionBlock', () => {
));
expect(screen.queryByText(/total_nodes/)).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Tool output available: structured output')).toHaveTextContent(
+ 'structured output',
+ );
expect(getToolDetailsTrigger()).toBeInTheDocument();
});
@@ -358,9 +362,21 @@ describe('ToolExecutionBlock', () => {
expect(screen.queryByLabelText('Tool output preview')).not.toBeInTheDocument();
expect(text).not.toContain('line 1');
expect(text).not.toContain('line 5');
+ expect(screen.getByLabelText('Tool output available: 5 lines output')).toHaveTextContent(
+ '5 lines output',
+ );
expect(getToolDetailsTrigger()).toBeInTheDocument();
});
+ it('summarizes suppressed single-line output by character count', () => {
+ 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(
+ '160 chars output',
+ );
+ });
+
it('previews failed plain-text output while keeping full details available', () => {
render(() => (
<ToolExecutionBlock tool={makeTool({ success: false, output: 'permission denied' })} />