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.

Improve Assistant tool row summaries

rcourtmanab957c33497a
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index fdb40f8f95..d54eda937e 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -6825,9 +6825,9 @@
"agent_id": "codex",
"summary": "Align Assistant live tool progress with OpenCode source workflow",
"target_id": "v6-product-lane-expansion",
- "claimed_at": "2026-06-05T21:57:48Z",
- "heartbeat_at": "2026-06-06T01:58:08Z",
- "expires_at": "2026-06-06T03:58:08Z",
+ "claimed_at": "2026-06-06T04:02:24Z",
+ "heartbeat_at": "2026-06-06T04:02:24Z",
+ "expires_at": "2026-06-06T12:02:24Z",
"work_item": {
"kind": "lane-followup",
"id": "architecture-post-rc-canonicalization"
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index b5ee6f3ad6..c0560a885b 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -305,6 +305,16 @@ runtime cost control, and shared AI transport surfaces.
attempts remain governed by the runtime and may cancel a pending row instead
of persisting a failed tool card.
The referenced OpenCode source at fetched `origin/dev` commit
+ `09d9cf01f93798939c1284fbe974b6e1f4d2759d` renders tool-specific inline
+ labels such as `Read <path>`, `Grep "<pattern>"`, `WebFetch <url>`, and bash
+ commands in
+ `packages/opencode/src/cli/cmd/tui/feature-plugins/system/session-v2.tsx`.
+ Pulse's compact tool rows must follow that operator-language model: the row
+ should summarize the actual governed action (`search "prowlarr"`, `list
+ active alerts`, `topology summary`) instead of exposing only internal
+ action names such as `QUERY search` or raw JSON; raw input and output stay
+ available behind Details.
+ The referenced OpenCode source at fetched `origin/dev` commit
`fa2b63f850fc0a23bec2bdff9e660450d3fe7913` also keeps assistant text,
reasoning, and tool invocation as typed message parts in
`packages/opencode/src/session/message.ts`, while
diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
index 1a6c3e08d0..17219bf8eb 100644
--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
@@ -28,7 +28,75 @@ const getToolLabel = (name: string) => {
return formatIdentifierLabel(name, { stripPrefix: 'pulse_', maxLength: 12 });
};
-const parseToolInputSummary = (input: string) => {
+const normalizedToolName = (name?: string) => (name || '').trim().replace(/^pulse_/, '');
+
+const stringField = (record: Record<string, unknown>, keys: string[]) => {
+ for (const key of keys) {
+ const value = record[key];
+ if (typeof value === 'string' && value.trim()) {
+ return value.trim();
+ }
+ if (typeof value === 'number' && Number.isFinite(value)) {
+ return String(value);
+ }
+ }
+ return '';
+};
+
+const booleanField = (record: Record<string, unknown>, key: string) => record[key] === true;
+
+const inlineValue = (value: string, maxLength = 24) =>
+ value.replace(/["\r\n]+/g, ' ').trim().substring(0, maxLength);
+
+const formatQueryInputSummary = (record: Record<string, unknown>) => {
+ const action = stringField(record, ['action', 'type']).toLowerCase();
+ const resourceType = stringField(record, ['resource_type', 'resourceType', 'kind', 'include']);
+ const listType = stringField(record, ['type', 'resource_type', 'resourceType', 'kind']);
+ const query = inlineValue(stringField(record, ['query', 'search', 'name', 'resource_name']));
+ const resourceId = inlineValue(stringField(record, ['resource_id', 'resourceId', 'id', 'vmid']));
+ const node = inlineValue(stringField(record, ['node', 'host']));
+
+ switch (action) {
+ case 'search':
+ return query ? `search "${query}"` : 'search resources';
+ case 'list':
+ return listType
+ ? `list ${formatIdentifierLabel(listType, { maxLength: 22 })}`
+ : 'list resources';
+ case 'get':
+ return resourceId ? `get ${resourceId}` : 'get resource';
+ case 'config':
+ if (resourceId && node) return `config ${resourceId} on ${node}`;
+ return resourceId ? `config ${resourceId}` : 'resource config';
+ case 'topology':
+ return booleanField(record, 'summary_only') ? 'topology summary' : 'topology';
+ case 'health':
+ return 'health summary';
+ default:
+ if (action) return formatIdentifierLabel(action, { maxLength: 28 });
+ return resourceType
+ ? `query ${formatIdentifierLabel(resourceType, { maxLength: 22 })}`
+ : 'query resources';
+ }
+};
+
+const formatAlertsInputSummary = (record: Record<string, unknown>) => {
+ const action = stringField(record, ['action']).toLowerCase();
+ const severity = stringField(record, ['severity', 'level']);
+ const resource = stringField(record, ['resource', 'resource_id', 'resourceId', 'name']);
+
+ if (action === 'list') {
+ return severity
+ ? `list ${formatIdentifierLabel(severity, { maxLength: 18 })} alerts`
+ : 'list active alerts';
+ }
+ if (action === 'get') {
+ return resource ? `get alert for ${inlineValue(resource, 18)}` : 'get alert';
+ }
+ return action ? formatIdentifierLabel(action, { maxLength: 28 }) : 'read alerts';
+};
+
+const parseToolInputSummary = (input: string, toolName?: string) => {
const trimmed = input.trim();
if (!trimmed) return '';
@@ -36,6 +104,13 @@ const parseToolInputSummary = (input: string) => {
const parsed = JSON.parse(trimmed) as unknown;
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
const record = parsed as Record<string, unknown>;
+ const tool = normalizedToolName(toolName);
+ if (tool === 'query') {
+ return formatQueryInputSummary(record);
+ }
+ if (tool === 'alerts') {
+ return formatAlertsInputSummary(record);
+ }
if (typeof record.action === 'string' && record.action.trim()) {
return formatIdentifierLabel(record.action, { maxLength: 28 });
}
@@ -56,6 +131,16 @@ const hasReadableToolOutput = (output: string) => {
return trimmed.length > 0 && !trimmed.toLowerCase().includes('not available');
};
+const toolValueText = (value: unknown) => {
+ if (typeof value === 'string') return value;
+ if (value === null || value === undefined) return '';
+ try {
+ return JSON.stringify(value);
+ } catch {
+ return String(value);
+ }
+};
+
/**
* ToolExecutionBlock - Displays completed tool executions in a compact terminal-like style.
*/
@@ -63,9 +148,13 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
const [showDetails, setShowDetails] = createSignal(false);
const toolLabel = createMemo(() => getToolLabel(props.tool.name));
- const inputSummary = createMemo(() => parseToolInputSummary(props.tool.input || ''));
- const hasInput = createMemo(() => (props.tool.input || '').trim().length > 0);
- const hasOutput = createMemo(() => hasReadableToolOutput(props.tool.output || ''));
+ const inputText = createMemo(() => toolValueText(props.tool.input));
+ const outputText = createMemo(() => toolValueText(props.tool.output));
+ const inputSummary = createMemo(() =>
+ parseToolInputSummary(inputText(), props.tool.name),
+ );
+ const hasInput = createMemo(() => inputText().trim().length > 0);
+ const hasOutput = createMemo(() => hasReadableToolOutput(outputText()));
const hasDetails = createMemo(() => hasInput() || hasOutput());
const statusLabel = () => (props.tool.success ? 'completed' : 'failed');
@@ -116,7 +205,7 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
Input
</div>
<pre class="mb-2 max-h-32 overflow-y-auto overflow-x-hidden rounded bg-surface-alt p-2 text-[10px] leading-relaxed text-muted whitespace-pre-wrap break-all">
- {(props.tool.input || '').trim()}
+ {inputText().trim()}
</pre>
</Show>
<Show when={hasOutput()}>
@@ -124,7 +213,7 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
Output
</div>
<pre class="max-h-64 overflow-y-auto overflow-x-hidden rounded bg-surface-alt p-2 text-[10px] leading-relaxed text-muted whitespace-pre-wrap break-all">
- {(props.tool.output || '').trim()}
+ {outputText().trim()}
</pre>
</Show>
</div>
@@ -142,7 +231,10 @@ interface PendingToolBlockProps {
export const PendingToolBlock: Component<PendingToolBlockProps> = (props) => {
const toolLabel = createMemo(() => getToolLabel(props.tool.name));
- const inputSummary = createMemo(() => parseToolInputSummary(props.tool.input || ''));
+ const inputText = createMemo(() => toolValueText(props.tool.input));
+ const inputSummary = createMemo(() =>
+ parseToolInputSummary(inputText(), props.tool.name),
+ );
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.tsx
index f559977550..a08e6dafd8 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
@@ -126,11 +126,60 @@ describe('ToolExecutionBlock', () => {
/>
));
- expect(screen.getByText('topology')).toBeInTheDocument();
+ expect(screen.getByText('topology summary')).toBeInTheDocument();
expect(screen.queryByText(/summary_only/)).not.toBeInTheDocument();
expect(screen.queryByText(/total_nodes/)).not.toBeInTheDocument();
});
+ it('renders Pulse query search input as a readable action', () => {
+ render(() => (
+ <ToolExecutionBlock
+ tool={makeTool({
+ name: 'pulse_query',
+ input: '{"action":"search","query":"prowlarr"}',
+ output: '{"matches":[]}',
+ })}
+ />
+ ));
+
+ expect(screen.getByText('search "prowlarr"')).toBeInTheDocument();
+ expect(screen.queryByText(/"query"/)).not.toBeInTheDocument();
+ });
+
+ it('tolerates structured Pulse query input from persisted transcripts', () => {
+ render(() => (
+ <ToolExecutionBlock
+ tool={
+ {
+ ...makeTool({
+ name: 'pulse_query',
+ }),
+ input: { action: 'search', query: 'prowlarr' },
+ output: { matches: [] },
+ } as unknown as ToolExecution
+ }
+ />
+ ));
+
+ expect(screen.getByText('search "prowlarr"')).toBeInTheDocument();
+ fireEvent.click(screen.getByText('Details'));
+ expect(screen.getByText(/"action":"search"/)).toBeInTheDocument();
+ });
+
+ it('renders Pulse alerts list input as active alerts', () => {
+ render(() => (
+ <ToolExecutionBlock
+ tool={makeTool({
+ name: 'pulse_alerts',
+ input: '{"action":"list"}',
+ output: '{"alerts":[]}',
+ })}
+ />
+ ));
+
+ expect(screen.getByText('list active alerts')).toBeInTheDocument();
+ });
+
// --- Output display ---
it('does not show output by default when non-empty', () => {
@@ -297,6 +346,17 @@ describe('PendingToolBlock', () => {
expect(screen.queryByText(/include/)).not.toBeInTheDocument();
});
+ it('renders pending Pulse query list input as a readable action', () => {
+ render(() => (
+ <PendingToolBlock
+ tool={makePending({ name: 'pulse_query', input: '{"action":"list","type":"vms"}' })}
+ />
+ ));
+
+ expect(screen.getByText('list vms')).toBeInTheDocument();
+ expect(screen.queryByText(/"type"/)).not.toBeInTheDocument();
+ });
+
// --- Activity state ---
it('renders a spinner SVG with animate-spin class while pending', () => {