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.

Use action-specific Assistant pending tool labels

rcourtman12ca34c26742
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 059c4f5cea..8598301cda 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -490,7 +490,17 @@ runtime cost control, and shared AI transport surfaces.
active alerts`, `topology summary`, `$ ls /dev | wc -l on current resource`)
instead of exposing only internal action names such as `QUERY search`,
`exec`, or raw JSON; raw input and full output stay available behind
- Details. The referenced OpenCode source at fetched `origin/dev` commit
+ Details. The referenced OpenCode source at commit
+ `9ed17da55ab1f7360cc0e01075f763e27fa899e9` also renders pending tool rows
+ through `InlineTool` pending text in
+ `packages/opencode/src/cli/cmd/tui/feature-plugins/system/session-v2.tsx`
+ (`InlineTool`, lines 563-651; `Bash`, lines 701-735; `Read`, lines
+ 758-770; `Grep`, lines 788-790). Pulse adapts that by using
+ action-specific pending copy such as `Writing command...`, `Preparing
+ query...`, and `Reading storage...` before streamed tool arguments are
+ parseable, then replacing that copy with the governed command/query/resource
+ summary as soon as input arrives.
+ The referenced OpenCode source at fetched `origin/dev` commit
`9ed17da55ab1f7360cc0e01075f763e27fa899e9` renders completed bash and
generic tool output inside the tool block and uses `collapseToolOutput` in
`packages/opencode/src/cli/cmd/tui/feature-plugins/system/session-v2.tsx`
diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
index f8ce18d79f..bde330f07d 100644
--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
@@ -30,6 +30,52 @@ const getToolLabel = (name: string) => {
const normalizedToolName = (name?: string) => (name || '').trim().replace(/^pulse_/, '');
+const pendingToolActionLabel = (name?: string) => {
+ const tool = normalizedToolName(name);
+ if (tool === 'run_command' || tool === 'control') return 'Writing command...';
+ if (tool === 'read') return 'Preparing read...';
+ if (tool === 'query') return 'Preparing query...';
+ if (tool === 'fetch_url') return 'Fetching URL...';
+ if (tool === 'get_infrastructure_state') return 'Reading infrastructure...';
+ if (tool === 'get_active_alerts' || tool === 'alerts') return 'Reading alerts...';
+ if (tool === 'get_metrics_history') return 'Reading metrics...';
+ if (tool === 'get_baselines') return 'Reading baselines...';
+ if (tool === 'get_patterns') return 'Reading patterns...';
+ if (tool === 'get_disk_health') return 'Checking disks...';
+ if (tool === 'get_storage' || tool === 'get_storage_config') return 'Reading storage...';
+ if (tool === 'get_resource_details') return 'Reading resource...';
+ if ((name || '').includes('finding')) return 'Preparing finding...';
+ return 'Preparing tool...';
+};
+
+const pendingToolActionState = (name?: string) => {
+ const tool = normalizedToolName(name);
+ if (tool === 'run_command' || tool === 'control') return 'writing';
+ if (tool === 'query') return 'preparing';
+ if (tool === 'fetch_url') return 'fetching';
+ if (tool === 'get_disk_health') return 'checking';
+ if (
+ tool === 'read' ||
+ tool === 'get_infrastructure_state' ||
+ tool === 'get_active_alerts' ||
+ tool === 'alerts' ||
+ tool === 'get_metrics_history' ||
+ tool === 'get_baselines' ||
+ tool === 'get_patterns' ||
+ tool === 'get_storage' ||
+ tool === 'get_storage_config' ||
+ tool === 'get_resource_details'
+ ) {
+ return 'reading';
+ }
+ return 'preparing';
+};
+
+const isPlaceholderToolInputSummary = (summary: string) => {
+ const normalized = summary.trim().toLowerCase();
+ return !normalized || normalized === 'request' || normalized === 'receiving input';
+};
+
const escapePartialJSONKey = (key: string) => key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const extractPartialJSONStringField = (rawInput: string, keys: string[]) => {
@@ -405,14 +451,19 @@ interface PendingToolBlockProps {
export const PendingToolBlock: Component<PendingToolBlockProps> = (props) => {
const toolLabel = createMemo(() => getToolLabel(props.tool.name));
const inputText = createMemo(() => toolValueText(props.tool.input));
- const inputSummary = createMemo(() =>
+ const parsedInputSummary = createMemo(() =>
parseToolInputSummary(inputText(), props.tool.name, props.tool.rawInput),
);
+ const inputSummary = createMemo(() => {
+ const summary = parsedInputSummary();
+ return isPlaceholderToolInputSummary(summary) ? pendingToolActionLabel(props.tool.name) : summary;
+ });
const status = createMemo(() => props.tool.status || 'pending');
const [now, setNow] = createSignal(Date.now());
const statusLabel = createMemo(() => {
if (status() === 'waiting') return 'waiting';
if (status() === 'running') return 'running';
+ if (isPlaceholderToolInputSummary(parsedInputSummary())) return pendingToolActionState(props.tool.name);
return 'pending';
});
const progressText = createMemo(() => (props.tool.progress || '').trim());
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 b5a346f3df..dc6e7ce6af 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
@@ -443,6 +443,14 @@ describe('PendingToolBlock', () => {
expect(screen.queryByText(/include/)).not.toBeInTheDocument();
});
+ it('renders an action-specific pending label before query arguments arrive', () => {
+ render(() => <PendingToolBlock tool={makePending({ name: 'pulse_query', input: '{}' })} />);
+
+ expect(screen.getByText('Preparing query...')).toBeInTheDocument();
+ expect(screen.getByText('preparing')).toBeInTheDocument();
+ expect(screen.queryByText('request')).not.toBeInTheDocument();
+ });
+
it('renders pending Pulse query list input as a readable action', () => {
render(() => (
<PendingToolBlock
@@ -499,6 +507,22 @@ describe('PendingToolBlock', () => {
expect(screen.getByText('$ ls /dev |')).toBeInTheDocument();
});
+ it('renders a command-specific pending label before governed command arguments arrive', () => {
+ render(() => <PendingToolBlock tool={makePending({ name: 'pulse_run_command', input: '{}' })} />);
+
+ expect(screen.getByText('Writing command...')).toBeInTheDocument();
+ expect(screen.getByText('writing')).toBeInTheDocument();
+ expect(screen.queryByText('request')).not.toBeInTheDocument();
+ });
+
+ it('renders a read-specific pending label before Pulse read arguments arrive', () => {
+ render(() => <PendingToolBlock tool={makePending({ name: 'pulse_read', input: '{}' })} />);
+
+ expect(screen.getByText('Preparing read...')).toBeInTheDocument();
+ expect(screen.getByText('reading')).toBeInTheDocument();
+ expect(screen.queryByText('request')).not.toBeInTheDocument();
+ });
+
// --- Activity state ---
it('renders a spinner SVG with animate-spin class while pending', () => {
@@ -547,7 +571,7 @@ describe('PendingToolsList', () => {
render(() => <PendingToolsList tools={tools} />);
expect(screen.getByText('cmd1')).toBeInTheDocument();
expect(screen.getByText('url1')).toBeInTheDocument();
- expect(screen.getByText('request')).toBeInTheDocument();
+ expect(screen.getByText('Reading storage...')).toBeInTheDocument();
});
it('collapses when more than 3 tools, showing first 2', () => {