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 read-only commands in Assistant activity

rcourtman9209f939c09b
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 5ff89eca19..52cba6ed6a 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -602,6 +602,21 @@ runtime cost control, and shared AI transport surfaces.
completed/error tool-part mutation by replacing stale provider-start footer
copy with completed or failed tool activity while still preferring any
separate unresolved pending tool over a terminal sibling tool.
+ Read-only shell-backed Assistant tools must expose the redacted `$ ...`
+ command preview in the active-turn status while the tool is running and when
+ its terminal row replaces stale workflow copy; friendly intent labels may
+ remain inside tool cards, but the live dock must not hide a known read-only
+ command behind generic "running command" text. Write/control commands remain
+ governed by approval and action surfaces rather than gaining a free-form live
+ shell shortcut. The referenced OpenCode source at fetched `origin/dev` commit
+ `e82542b8023a8374f29c23b70ec019c8f256354e` records shell commands as visible
+ commits in `packages/opencode/src/cli/cmd/run/session-data.ts`
+ (`startShell`, lines 690-702; `session.next.shell.started`, lines 783-795;
+ `session.next.shell.ended`, lines 803-821) and keeps non-shell tool status
+ visible through `toolStatus` on running tool parts (lines 932-942). Pulse
+ adapts that shell visibility by reusing its redacted read-only command
+ preview in the browser-safe active-turn status instead of exposing raw
+ outputs, secrets, or unrestricted control commands.
`frontend-modern/src/api/streaming.ts` must yield through an
animation-frame-backed browser paint checkpoint, with a bounded timer
fallback for inactive tabs, before draining the next opted-in event; a plain
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
index ff5b9c05b5..21f70c000d 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -5344,7 +5344,7 @@ describe('AIChat', () => {
]);
renderChat();
expect(screen.getByLabelText('Assistant active turn status')).toHaveTextContent(
- 'Completed Inspect devices on current resource',
+ 'Completed $ ls /dev | wc -l',
);
expect(screen.getByLabelText('Assistant active turn status')).not.toHaveTextContent(
'OpenRouter is starting the response.',
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
index 409dd0e873..b6a1bd5507 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
@@ -106,7 +106,7 @@ describe('getAssistantActiveTurnStatus', () => {
),
).toEqual({
type: 'tool',
- text: 'Running Inspect devices on current resource',
+ text: 'Running $ ls /dev | wc -l',
startedAt,
});
});
@@ -134,7 +134,32 @@ describe('getAssistantActiveTurnStatus', () => {
),
).toEqual({
type: 'tool',
- text: 'Running Inspect devices on current resource',
+ text: 'Running $ ls /dev | wc -l',
+ });
+ });
+
+ it('redacts sensitive read-only command previews in the active turn status', () => {
+ expect(
+ getAssistantActiveTurnStatus(
+ [
+ assistantMessage({
+ pendingTools: [
+ {
+ id: 'tool-1',
+ name: 'pulse_read',
+ input:
+ '{"action":"exec","target_host":"current_resource","command":"curl -H \\"Authorization: Bearer secret-token\\" --password hunter2 https://example.local"}',
+ status: 'running',
+ },
+ ],
+ }),
+ ],
+ true,
+ ),
+ ).toEqual({
+ type: 'tool',
+ text:
+ 'Running $ curl -H "Authorization: Bearer [redacted-secret]" --password [redacted-secret] https://example.local',
});
});
@@ -486,7 +511,7 @@ describe('getAssistantActiveTurnStatus', () => {
),
).toEqual({
type: 'tool',
- text: 'Completed Inspect devices on current resource',
+ text: 'Completed $ ls /dev | wc -l',
});
});
diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
index 1b6b42f82e..5d6cec2f3a 100644
--- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
@@ -4,6 +4,7 @@ import { formatAIModelRouteLabel } from '@/utils/aiProviderPresentation';
import { extractReasoningSummaryTitle } from './reasoningSummary';
import {
isPlaceholderToolInputSummary,
+ parseToolCommandPreview,
parseToolInputSummary,
toolValueText,
} from './toolPresentation';
@@ -180,11 +181,17 @@ export const formatAssistantWorkflowStatus = (status?: WorkflowStatus, now?: num
const formatPendingToolStatus = (tool?: PendingTool): string => {
if (!tool) return '';
+ const commandPreview = parseToolCommandPreview(
+ toolValueText(tool.input),
+ tool.name,
+ tool.rawInput,
+ );
const progress = tool.progress?.trim();
- if (progress) return progress;
+ if (progress && (!commandPreview || !isGenericToolProgress(progress))) return progress;
const inputSummary = parseToolInputSummary(toolValueText(tool.input), tool.name, tool.rawInput);
- const toolActivity = isPlaceholderToolInputSummary(inputSummary) ? '' : inputSummary;
+ const toolActivity =
+ commandPreview || (isPlaceholderToolInputSummary(inputSummary) ? '' : inputSummary);
if (toolActivity) {
if (tool.status === 'waiting') return `Waiting on ${toolActivity}`;
return `Running ${toolActivity}`;
@@ -326,11 +333,29 @@ const toolCancelStatusText = (event: StreamDisplayEvent): string => {
return reason ? `Skipped ${label}: ${reason}` : `Skipped ${label}`;
};
+const isGenericToolProgress = (progress: string): boolean => {
+ const normalized = progress.trim().toLowerCase().replace(/\s+/g, ' ');
+ return (
+ normalized === 'running' ||
+ normalized === 'running.' ||
+ normalized === 'running command' ||
+ normalized === 'running command.' ||
+ normalized === 'running read-only command' ||
+ normalized === 'running read-only command.'
+ );
+};
+
const completedToolStatusText = (event: StreamDisplayEvent): string => {
const tool = event.tool;
if (!tool) return '';
const inputSummary = parseToolInputSummary(toolValueText(tool.input), tool.name, tool.rawInput);
- const toolActivity = isPlaceholderToolInputSummary(inputSummary) ? '' : inputSummary;
+ const commandPreview = parseToolCommandPreview(
+ toolValueText(tool.input),
+ tool.name,
+ tool.rawInput,
+ );
+ const toolActivity =
+ commandPreview || (isPlaceholderToolInputSummary(inputSummary) ? '' : inputSummary);
const label = toolActivity || formatToolName(tool.name);
return tool.success === false ? `Failed ${label}` : `Completed ${label}`;
};