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 operator summaries in Assistant context footer

rcourtman752aa979db1c
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 3abc03a1a3..b7244280e1 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -195,6 +195,12 @@ runtime cost control, and shared AI transport surfaces.
structured, or binary outputs while keeping raw output behind the existing
details disclosure, and those raw input/output details must be copyable
from the disclosure without expanding the default transcript.
+ Completed Assistant context summaries must use the same operator-facing
+ tool-input presentation as the visible tool rows, not raw internal tool
+ identifiers. A completed `pulse_read` device inspection should therefore
+ summarize as the inspected resource/action, while raw tool names such as
+ `pulse_read` or bare fallback labels such as `read` remain fallback-only
+ debug/detail vocabulary.
Live workflow activity is also active turn state, not disposable waiting
copy. The referenced OpenCode source at fetched `origin/dev` commit
`1025540fcc2a69609a0131a7168300205656d728` defines model, shell, step,
diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
index 3d838078fa..9c57927f4f 100644
--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx
+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
@@ -31,6 +31,11 @@ import {
latestWorkflowStatus,
normalizeWorkflowStatusSequence,
} from './workflowStatusPresentation';
+import {
+ isPlaceholderToolInputSummary,
+ parseToolInputSummary,
+ toolValueText,
+} from './toolPresentation';
import type {
ChatMessage,
ModelRouteRecoveryOption,
@@ -326,17 +331,26 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
.slice(0, index)
.every((evt) => evt.type === 'thinking');
- const contextTools = createMemo(() => {
+ const contextToolSummaries = createMemo(() => {
const events = props.message.streamEvents || [];
- const names = new Set<string>();
+ const summaries = new Set<string>();
for (const evt of events) {
if (evt.type === 'tool' && evt.tool?.name) {
- names.add(evt.tool.name);
+ const summary = parseToolInputSummary(
+ toolValueText(evt.tool.input),
+ evt.tool.name,
+ evt.tool.rawInput,
+ );
+ const label =
+ summary && !isPlaceholderToolInputSummary(summary)
+ ? summary
+ : formatIdentifierLabel(evt.tool.name, { stripPrefix: 'pulse_' });
+ summaries.add(label);
}
}
- return Array.from(names);
+ return Array.from(summaries);
});
const visibleMessageContent = () =>
stripAssistantOutputArtifacts(props.message.content || '').text;
@@ -802,15 +816,18 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
<span class="inline-block w-1.5 h-4 ml-0.5 align-middle bg-blue-500 dark:bg-blue-400 animate-pulse rounded-full" />
</Show>
- <Show when={!props.message.isStreaming && contextTools().length > 0}>
+ <Show when={!props.message.isStreaming && contextToolSummaries().length > 0}>
<div class="mt-4 pt-3 border-t border-border-subtle flex flex-wrap gap-2">
<span class="text-[10px] uppercase font-semibold text-muted">
{AI_CHAT_CONTEXT_USED_LABEL}
</span>
<div class="flex flex-wrap gap-1.5">
- {contextTools().map((name) => (
- <span class="px-1.5 py-0.5 rounded text-[10px] bg-surface-hover text-muted border border-border font-medium">
- {formatIdentifierLabel(name, { stripPrefix: 'pulse_' })}
+ {contextToolSummaries().map((summary) => (
+ <span
+ class="max-w-[18rem] truncate px-1.5 py-0.5 rounded text-[10px] bg-surface-hover text-muted border border-border font-medium"
+ title={summary}
+ >
+ {summary}
</span>
))}
</div>
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
index c63ab702e3..874c54b08a 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
@@ -1428,15 +1428,25 @@ describe('MessageItem', () => {
});
describe('context tools display', () => {
- it('shows "Context used" with unique tool names when not streaming', () => {
+ it('shows "Context used" with unique tool summaries when not streaming', () => {
const events: StreamDisplayEvent[] = [
{
type: 'tool',
- tool: { name: 'pulse_get_nodes', input: '{}', output: 'ok', success: true },
+ tool: {
+ name: 'pulse_read',
+ input: '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}',
+ output: 'ok',
+ success: true,
+ },
},
{
type: 'tool',
- tool: { name: 'pulse_get_metrics', input: '{}', output: 'ok', success: true },
+ tool: {
+ name: 'pulse_get_metrics',
+ input: '{"action":"history","resource":"vm-101"}',
+ output: 'ok',
+ success: true,
+ },
},
];
@@ -1452,20 +1462,30 @@ describe('MessageItem', () => {
));
expect(screen.getByText('Context used')).toBeInTheDocument();
- // Shared identifier formatter strips 'pulse_' and replaces underscores
- expect(screen.getByText('get nodes')).toBeInTheDocument();
- expect(screen.getByText('get metrics')).toBeInTheDocument();
+ expect(screen.getByText('Inspect devices on current resource')).toBeInTheDocument();
+ expect(screen.getByText('history')).toBeInTheDocument();
+ expect(screen.queryByText('read')).not.toBeInTheDocument();
});
- it('deduplicates tool names in context footer', () => {
+ it('deduplicates tool summaries in context footer', () => {
const events: StreamDisplayEvent[] = [
{
type: 'tool',
- tool: { name: 'pulse_get_nodes', input: '{}', output: 'first', success: true },
+ tool: {
+ name: 'pulse_read',
+ input: '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}',
+ output: 'first',
+ success: true,
+ },
},
{
type: 'tool',
- tool: { name: 'pulse_get_nodes', input: '{}', output: 'second', success: true },
+ tool: {
+ name: 'pulse_read',
+ input: '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}',
+ output: 'second',
+ success: true,
+ },
},
{
type: 'tool',
@@ -1484,9 +1504,8 @@ describe('MessageItem', () => {
/>
));
- // Should show 2 unique tool names, not 3
- const toolLabels = screen.getAllByText(/get (nodes|metrics)/);
- expect(toolLabels.length).toBe(2);
+ expect(screen.getAllByText('Inspect devices on current resource')).toHaveLength(1);
+ expect(screen.getByText('get metrics')).toBeInTheDocument();
});
it('does not show context tools section when streaming', () => {