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.

Make skipped Assistant tool evidence inspectable

rcourtmanb8ad2ae1af1e
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index e9352422d6..23bb30c393 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -744,6 +744,17 @@ runtime cost control, and shared AI transport surfaces.
typed message parts through terminal success/failed states; Pulse adapts
that lifecycle shape by making skipped policy/runtime tool calls visible as
terminal transcript rows.
+ The 2026-06-07 skipped-evidence slice rechecked OpenCode `origin/dev`
+ commit `31c099be435d59bd6749ace7a9f2bb2245e6d3fa`:
+ `packages/core/src/session/event.ts` lines 307-336 define replayable tool
+ input start/delta/end events and lines 386-399 define terminal failed tool
+ events, `packages/core/src/session/message-updater.ts` lines 247-267 and
+ 318-339 preserve and update the same assistant tool part through input and
+ failure, and `packages/opencode/src/session/tools.ts` lines 48-65 and
+ 180-200 keep terminal tool input/output evidence. Pulse skipped/canceled
+ tool rows must therefore keep raw tool input and skip reason behind the same
+ expandable, copyable Details panel used for completed terminal tool rows,
+ while the compact row remains the operator-readable action summary.
While streamed arguments are still invalid, incomplete JSON, or incomplete
provider-style function-call input, the frontend must use the `raw_input`
fragment to show a safe partial command/path/query summary instead of a
diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
index 750cfa5ee6..e3722f5f2e 100644
--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx
@@ -47,6 +47,15 @@ interface ToolCancellationBlockProps {
tool: ToolCancellation;
}
+type ToolDetailKind = 'input' | 'output' | 'reason';
+
+interface ToolDetailsPanelProps {
+ id: string;
+ input?: string;
+ output?: string;
+ reason?: string;
+}
+
const hasReadableToolOutput = (output: string) => {
const trimmed = output.trim();
return trimmed.length > 0 && !trimmed.toLowerCase().includes('not available');
@@ -172,15 +181,97 @@ const ToolCommandPreview: Component<ToolCommandPreviewProps> = (props) => (
</code>
);
+const normalizeDetailText = (value?: string) => value?.trim() ?? '';
+
+const detailTitle = (kind: ToolDetailKind) => {
+ if (kind === 'input') return 'Input';
+ if (kind === 'output') return 'Output';
+ return 'Reason';
+};
+
+const detailCopyTarget = (kind: ToolDetailKind) => {
+ if (kind === 'input') return 'tool input';
+ if (kind === 'output') return 'tool output';
+ return 'skip reason';
+};
+
+const detailPreClass = (kind: ToolDetailKind) =>
+ `${kind === 'output' ? 'max-h-72' : 'max-h-36'} overflow-auto rounded bg-surface-alt p-2 font-mono text-[10px] leading-5 text-muted whitespace-pre-wrap break-words`;
+
+const ToolDetailsPanel: Component<ToolDetailsPanelProps> = (props) => {
+ const [copiedDetail, setCopiedDetail] = createSignal<ToolDetailKind | null>(null);
+ let copiedResetTimer: number | undefined;
+
+ const details = createMemo(() => {
+ const items: Array<{ kind: ToolDetailKind; text: string }> = [];
+ const input = normalizeDetailText(props.input);
+ const output = normalizeDetailText(props.output);
+ const reason = normalizeDetailText(props.reason);
+
+ if (input) items.push({ kind: 'input', text: input });
+ if (output) items.push({ kind: 'output', text: output });
+ if (reason) items.push({ kind: 'reason', text: reason });
+ return items;
+ });
+
+ const detailCopyLabel = (kind: ToolDetailKind) => {
+ const target = detailCopyTarget(kind);
+ return copiedDetail() === kind ? `Copied ${target}` : `Copy ${target}`;
+ };
+
+ const copyDetail = async (kind: ToolDetailKind, value: string) => {
+ const text = value.trim();
+ if (!text) return;
+ const copied = await copyToClipboard(text);
+ if (!copied) return;
+ setCopiedDetail(kind);
+ if (copiedResetTimer) window.clearTimeout(copiedResetTimer);
+ copiedResetTimer = window.setTimeout(() => setCopiedDetail(null), 1500);
+ };
+
+ onCleanup(() => {
+ if (copiedResetTimer) window.clearTimeout(copiedResetTimer);
+ });
+
+ return (
+ <div id={props.id} class="border-t border-border-subtle px-3 py-2">
+ <For each={details()}>
+ {(detail) => (
+ <div class="mb-2 last:mb-0">
+ <div class="mb-1 flex items-center justify-between gap-2">
+ <div class="text-[9px] font-semibold uppercase tracking-wide text-muted">
+ {detailTitle(detail.kind)}
+ </div>
+ <button
+ type="button"
+ class="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30"
+ onClick={() => void copyDetail(detail.kind, detail.text)}
+ title={detailCopyLabel(detail.kind)}
+ aria-label={detailCopyLabel(detail.kind)}
+ >
+ <Show
+ when={copiedDetail() === detail.kind}
+ fallback={<CopyIcon class="h-3 w-3" aria-hidden="true" />}
+ >
+ <CheckIcon class="h-3 w-3 text-emerald-600" aria-hidden="true" />
+ </Show>
+ </button>
+ </div>
+ <pre class={detailPreClass(detail.kind)}>{detail.text}</pre>
+ </div>
+ )}
+ </For>
+ </div>
+ );
+};
+
/**
* ToolExecutionBlock - Displays completed tool executions in a compact terminal-like style.
*/
export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) => {
const [showDetails, setShowDetails] = createSignal(false);
- const [copiedDetail, setCopiedDetail] = createSignal<'input' | 'output' | null>(null);
const [settlingFastCompletion, setSettlingFastCompletion] = createSignal(false);
const detailsId = createUniqueId();
- let copiedResetTimer: number | undefined;
const toolLabel = createMemo(() => getToolLabel(props.tool.name));
const inputText = createMemo(() => toolValueText(props.tool.input));
@@ -226,9 +317,7 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
});
const durationLabel = createMemo(() =>
- settlingFastCompletion()
- ? ''
- : formatCompletedToolDuration(props.startedAt, props.completedAt),
+ settlingFastCompletion() ? '' : formatCompletedToolDuration(props.startedAt, props.completedAt),
);
const statusLabel = () =>
@@ -250,21 +339,6 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
event.preventDefault();
toggleDetails();
};
- const copyDetail = async (kind: 'input' | 'output', value: string) => {
- const text = value.trim();
- if (!text) return;
- const copied = await copyToClipboard(text);
- if (!copied) return;
- setCopiedDetail(kind);
- if (copiedResetTimer) window.clearTimeout(copiedResetTimer);
- copiedResetTimer = window.setTimeout(() => setCopiedDetail(null), 1500);
- };
- const detailCopyLabel = (kind: 'input' | 'output') =>
- copiedDetail() === kind ? `Copied tool ${kind}` : `Copy tool ${kind}`;
-
- onCleanup(() => {
- if (copiedResetTimer) window.clearTimeout(copiedResetTimer);
- });
return (
<div
@@ -368,52 +442,11 @@ export const ToolExecutionBlock: Component<ToolExecutionBlockProps> = (props) =>
</Show>
<Show when={showDetails() && hasDetails()}>
- <div id={detailsId} class="border-t border-border-subtle px-3 py-2">
- <Show when={hasInput()}>
- <div class="mb-1 flex items-center justify-between gap-2">
- <div class="text-[9px] font-semibold uppercase tracking-wide text-muted">Input</div>
- <button
- type="button"
- class="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30"
- onClick={() => void copyDetail('input', inputText())}
- title={detailCopyLabel('input')}
- aria-label={detailCopyLabel('input')}
- >
- <Show
- when={copiedDetail() === 'input'}
- fallback={<CopyIcon class="h-3 w-3" aria-hidden="true" />}
- >
- <CheckIcon class="h-3 w-3 text-emerald-600" aria-hidden="true" />
- </Show>
- </button>
- </div>
- <pre class="mb-2 max-h-36 overflow-auto rounded bg-surface-alt p-2 font-mono text-[10px] leading-5 text-muted whitespace-pre-wrap break-words">
- {inputText().trim()}
- </pre>
- </Show>
- <Show when={hasOutput()}>
- <div class="mb-1 flex items-center justify-between gap-2">
- <div class="text-[9px] font-semibold uppercase tracking-wide text-muted">Output</div>
- <button
- type="button"
- class="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30"
- onClick={() => void copyDetail('output', outputText())}
- title={detailCopyLabel('output')}
- aria-label={detailCopyLabel('output')}
- >
- <Show
- when={copiedDetail() === 'output'}
- fallback={<CopyIcon class="h-3 w-3" aria-hidden="true" />}
- >
- <CheckIcon class="h-3 w-3 text-emerald-600" aria-hidden="true" />
- </Show>
- </button>
- </div>
- <pre class="max-h-72 overflow-auto rounded bg-surface-alt p-2 font-mono text-[10px] leading-5 text-muted whitespace-pre-wrap break-words">
- {outputText().trim()}
- </pre>
- </Show>
- </div>
+ <ToolDetailsPanel
+ id={detailsId}
+ input={hasInput() ? inputText() : ''}
+ output={hasOutput() ? outputText() : ''}
+ />
</Show>
</div>
);
@@ -513,6 +546,8 @@ export const PendingToolBlock: Component<PendingToolBlockProps> = (props) => {
* ToolCancellationBlock - Durable row for tool calls skipped by policy/runtime boundaries.
*/
export const ToolCancellationBlock: Component<ToolCancellationBlockProps> = (props) => {
+ const [showDetails, setShowDetails] = createSignal(false);
+ const detailsId = createUniqueId();
const toolLabel = createMemo(() => getToolLabel(props.tool.name));
const inputText = createMemo(() => toolValueText(props.tool.input));
const parsedInputSummary = createMemo(() =>
@@ -520,7 +555,9 @@ export const ToolCancellationBlock: Component<ToolCancellationBlockProps> = (pro
);
const inputSummary = createMemo(() => {
const summary = parsedInputSummary();
- return isPlaceholderToolInputSummary(summary) ? pendingToolActionLabel(props.tool.name) : summary;
+ return isPlaceholderToolInputSummary(summary)
+ ? pendingToolActionLabel(props.tool.name)
+ : summary;
});
const commandPreview = createMemo(() => {
const preview = parseToolCommandPreview(inputText(), props.tool.name, props.tool.rawInput);
@@ -529,15 +566,42 @@ export const ToolCancellationBlock: Component<ToolCancellationBlockProps> = (pro
return preview;
});
const reason = createMemo(() => props.tool.reason?.trim() || 'Skipped before execution');
+ const hasInput = createMemo(() => inputText().trim().length > 0);
+ const hasReason = createMemo(() => reason().trim().length > 0);
+ const hasDetails = createMemo(() => hasInput() || hasReason());
+ const summaryControlTitle = () => (showDetails() ? 'Hide tool details' : 'Show tool details');
+ const toggleDetails = () => {
+ if (!hasDetails()) return;
+ setShowDetails(!showDetails());
+ };
+ const handleSummaryKeyDown = (event: KeyboardEvent) => {
+ if (!hasDetails()) return;
+ if (event.key !== 'Enter' && event.key !== ' ') return;
+ event.preventDefault();
+ toggleDetails();
+ };
return (
<div
- class="my-1 rounded-md border border-amber-200 bg-amber-50/70 px-2.5 py-2 text-[11px] dark:border-amber-900/60 dark:bg-amber-950/20"
+ class="my-1 overflow-hidden rounded-md border border-amber-200 bg-amber-50/70 text-[11px] dark:border-amber-900/60 dark:bg-amber-950/20"
role="status"
aria-label="Assistant tool canceled"
title={reason()}
>
- <div class="flex min-w-0 items-start gap-2">
+ <div
+ class={`flex min-w-0 items-start gap-2 px-2.5 py-2 ${
+ hasDetails()
+ ? 'cursor-pointer transition-colors hover:bg-amber-100/60 focus:outline-none focus:ring-2 focus:ring-amber-500/30 focus:ring-inset dark:hover:bg-amber-950/30'
+ : ''
+ }`}
+ role={hasDetails() ? 'button' : undefined}
+ tabIndex={hasDetails() ? 0 : undefined}
+ aria-expanded={hasDetails() ? showDetails() : undefined}
+ aria-controls={hasDetails() ? detailsId : undefined}
+ title={hasDetails() ? summaryControlTitle() : undefined}
+ onClick={toggleDetails}
+ onKeyDown={handleSummaryKeyDown}
+ >
<div class="pt-0.5">
<XCircleIcon
class="h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-300"
@@ -553,6 +617,14 @@ export const ToolCancellationBlock: Component<ToolCancellationBlockProps> = (pro
<span class="shrink-0 rounded border border-amber-200 bg-amber-100 px-1.5 py-0.5 text-[9px] font-medium text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-200">
skipped
</span>
+ <Show when={hasDetails()}>
+ <ChevronRightIcon
+ class={`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${
+ showDetails() ? 'rotate-90' : ''
+ }`}
+ aria-hidden="true"
+ />
+ </Show>
</div>
<ToolInputSummary summary={inputSummary()} />
<Show when={commandPreview()}>
@@ -563,6 +635,13 @@ export const ToolCancellationBlock: Component<ToolCancellationBlockProps> = (pro
</div>
</div>
</div>
+ <Show when={showDetails() && hasDetails()}>
+ <ToolDetailsPanel
+ id={detailsId}
+ input={hasInput() ? inputText() : ''}
+ reason={hasReason() ? reason() : ''}
+ />
+ </Show>
</div>
);
};
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 1b1465acb5..6529f4afa6 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx
@@ -8,7 +8,7 @@ import {
PendingToolsList,
ToolExecutionsList,
} from '../ToolExecutionBlock';
-import type { ToolExecution, PendingTool } from '../types';
+import type { ToolExecution, PendingTool, ToolCancellation } from '../types';
afterEach(() => {
cleanup();
@@ -36,6 +36,16 @@ function makePending(overrides?: Partial<PendingTool>): PendingTool {
};
}
+function makeCancellation(overrides?: Partial<ToolCancellation>): ToolCancellation {
+ return {
+ id: 'tool-1',
+ name: 'pulse_read',
+ input: '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}',
+ reason: 'current_resource unavailable',
+ ...overrides,
+ };
+}
+
const getToolDetailsTrigger = () => screen.getByTitle('Show tool details');
const FAST_TOOL_SETTLE_TEST_MS = 500;
@@ -110,17 +120,13 @@ describe('ToolExecutionBlock', () => {
});
it('shows completed tool duration when stream timing is available', () => {
- render(() => (
- <ToolExecutionBlock tool={makeTool()} startedAt={1_000} completedAt={4_200} />
- ));
+ render(() => <ToolExecutionBlock tool={makeTool()} startedAt={1_000} completedAt={4_200} />);
expect(screen.getByLabelText('Tool duration 3s')).toHaveTextContent('3s');
});
it('keeps very fast completed tools visible as sub-second work', () => {
- render(() => (
- <ToolExecutionBlock tool={makeTool()} startedAt={1_000} completedAt={1_450} />
- ));
+ render(() => <ToolExecutionBlock tool={makeTool()} startedAt={1_000} completedAt={1_450} />);
expect(screen.getByLabelText('Tool duration <1s')).toHaveTextContent('<1s');
});
@@ -877,16 +883,7 @@ describe('PendingToolBlock', () => {
describe('ToolCancellationBlock', () => {
it('renders skipped tool activity with the cancellation reason', () => {
- render(() => (
- <ToolCancellationBlock
- tool={{
- id: 'tool-1',
- name: 'pulse_read',
- input: '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}',
- reason: 'current_resource unavailable',
- }}
- />
- ));
+ render(() => <ToolCancellationBlock tool={makeCancellation()} />);
expect(screen.getByRole('status', { name: 'Assistant tool canceled' })).toHaveTextContent(
'skipped',
@@ -895,6 +892,78 @@ describe('ToolCancellationBlock', () => {
expect(screen.getByLabelText('Tool command')).toHaveTextContent('$ ls /dev | wc -l');
expect(screen.getByText('current_resource unavailable')).toBeInTheDocument();
});
+
+ it('makes the skipped tool row the details trigger when raw input or reason is available', () => {
+ render(() => <ToolCancellationBlock tool={makeCancellation()} />);
+
+ const trigger = getToolDetailsTrigger();
+ expect(trigger).toBeInTheDocument();
+ expect(trigger).toHaveAttribute('role', 'button');
+ expect(trigger).toHaveAttribute('aria-expanded', 'false');
+ });
+
+ it('shows canceled tool input and reason when details are opened', () => {
+ const input = '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}';
+ const reason = 'current_resource unavailable';
+ const { container } = render(() => (
+ <ToolCancellationBlock tool={makeCancellation({ input, reason })} />
+ ));
+
+ const trigger = getToolDetailsTrigger();
+ fireEvent.click(trigger);
+
+ expect(trigger).toHaveAttribute('aria-expanded', 'true');
+ expect(trigger).toHaveAttribute('title', 'Hide tool details');
+ expect(screen.getByText('Input')).toBeInTheDocument();
+ expect(screen.getByText('Reason')).toBeInTheDocument();
+ const rawDetails = Array.from(container.querySelectorAll('pre'))
+ .map((pre) => pre.textContent || '')
+ .join('\n');
+ expect(rawDetails).toContain(input);
+ expect(rawDetails).toContain(reason);
+ });
+
+ it('copies skipped tool input and skip reason from the details panel', async () => {
+ const writeText = vi.fn().mockResolvedValue(undefined);
+ Object.defineProperty(navigator, 'clipboard', {
+ value: { writeText },
+ configurable: true,
+ });
+ const input = '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}';
+ const reason = 'current_resource unavailable';
+
+ render(() => <ToolCancellationBlock tool={makeCancellation({ input, reason })} />);
+ fireEvent.click(getToolDetailsTrigger());
+ fireEvent.click(screen.getByRole('button', { name: 'Copy tool input' }));
+
+ await waitFor(() => {
+ expect(writeText).toHaveBeenCalledWith(input);
+ });
+ await waitFor(() => {
+ expect(screen.getByRole('button', { name: 'Copied tool input' })).toBeInTheDocument();
+ });
+
+ fireEvent.click(screen.getByRole('button', { name: 'Copy skip reason' }));
+ await waitFor(() => {
+ expect(writeText).toHaveBeenLastCalledWith(reason);
+ });
+ await waitFor(() => {
+ expect(screen.getByRole('button', { name: 'Copied skip reason' })).toBeInTheDocument();
+ });
+ });
+
+ it('toggles canceled tool details from the keyboard', () => {
+ render(() => <ToolCancellationBlock tool={makeCancellation()} />);
+
+ const trigger = getToolDetailsTrigger();
+ fireEvent.keyDown(trigger, { key: 'Enter' });
+ expect(trigger).toHaveAttribute('aria-expanded', 'true');
+ expect(screen.getByText('Reason')).toBeInTheDocument();
+
+ fireEvent.keyDown(trigger, { key: ' ' });
+ expect(trigger).toHaveAttribute('aria-expanded', 'false');
+ expect(screen.queryByText('Reason')).not.toBeInTheDocument();
+ });
});
// ============================================================