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.

Add live Assistant active-turn status

rcourtmanc858985c54a2
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index 6139999591..f9fc6f0353 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -6767,11 +6767,11 @@
{
"id": "codex-lane-followup-architecture-post-rc-canonicalization",
"agent_id": "codex",
- "summary": "Demote idle Assistant provider verification",
+ "summary": "Add live Assistant active-turn status",
"target_id": "v6-product-lane-expansion",
"claimed_at": "2026-06-05T21:57:48Z",
- "heartbeat_at": "2026-06-06T01:07:17Z",
- "expires_at": "2026-06-06T03:07:17Z",
+ "heartbeat_at": "2026-06-06T01:14:47Z",
+ "expires_at": "2026-06-06T03:14:47Z",
"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 795bb24443..e4cf94ecb6 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -193,11 +193,12 @@ runtime cost control, and shared AI transport surfaces.
turns, and selected-provider startup. These events are runtime progress, not
Assistant-authored analysis, and they must not become keyword routers,
explore pre-passes, or instructions that choose the model's next action.
- The drawer transcript owns visible in-flight progress for the active turn:
+ The drawer transcript owns detailed in-flight progress for the active turn:
a new assistant row must start with a neutral local preparation status until
stream progress arrives, must show the current effective model route while
- the turn is still streaming, and must render late workflow progress in the
- assistant row instead of only in drawer chrome. Workflow status is live
+ the turn is still streaming, and must render late workflow progress as typed
+ Assistant row evidence while the composer footer keeps a one-line live
+ heartbeat of the current active state. Workflow status is live
progress, not answer content or a delayed walkthrough; each new
`workflow_state` replaces the active status immediately instead of waiting
behind a dwell queue. Once visible assistant text, tool progress, approvals,
@@ -207,6 +208,16 @@ runtime cost control, and shared AI transport surfaces.
implementation for message parts, tool-state mutation, and progress
rendering before changing Pulse behavior; parity means adapting the proven
interaction model, not guessing from screenshots or observed behavior alone.
+ The referenced OpenCode source at fetched `origin/dev` commit
+ `fa2b63f850fc0a23bec2bdff9e660450d3fe7913` keeps prompt/footer status visible
+ only while the session is non-idle in
+ `packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx`, and maps
+ `turn.send`, `turn.wait`, and tool status patches into a live footer in
+ `packages/opencode/src/cli/cmd/run/footer.ts` plus
+ `packages/opencode/src/cli/cmd/run/session-data.ts`. Pulse's drawer adapts
+ that as an active-turn status strip: no idle diagnostics, but while a turn is
+ loading it must show waiting, current tool/workflow progress, or generating
+ status even when the transcript already contains an in-flight assistant row.
The referenced OpenCode source at commit
`f750deaa3e95098fdde5fb00305b273e43c5b2cd` mutates a single tool part from
`pending` input through `running` progress to completed/error in
@@ -331,11 +342,12 @@ runtime cost control, and shared AI transport surfaces.
frontend rendering. Compacted no-whitespace internal prelude text attached
to a leaked tool invocation is part of that same artifact and must be
suppressed or retracted from the current stream segment instead of rendered
- as assistant prose. Drawer-level loading/progress status must not duplicate
- transcript output once assistant content, governed tool progress, approvals,
- questions, errors, or restored tool evidence are already visible; progress
- stays in the transcript row that owns the active turn. Completed tool rows
- in the drawer may show compact tool name, action summary, status, and an
+ as assistant prose. Drawer-level loading/progress status must stay scoped to
+ the active turn and must collapse back to quiet when the turn is idle; it may
+ mirror the latest active tool/workflow state as a compact heartbeat, but raw
+ outputs, restored evidence, errors, and completed details stay in the
+ transcript row that owns the turn. Completed tool rows in the drawer may show
+ compact tool name, action summary, status, and an
explicit details affordance, but raw tool input/output JSON must not render
in the default transcript. Token accounting and other provider metadata
remain runtime/accounting data, not normal transcript prose.
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 4d1e20c412..8c97555105 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -2942,14 +2942,16 @@ describe('AIChat', () => {
// ── Status indicator ─────────────────────────────────────────────────
describe('status indicator', () => {
- it('shows "Thinking..." when loading with no assistant message', () => {
+ it('shows active turn status when loading with no assistant message', () => {
mockChat.isLoading.mockReturnValue(true);
mockChat.messages.mockReturnValue([]);
renderChat();
- expect(screen.getByText('Thinking...')).toBeInTheDocument();
+ expect(screen.getByLabelText('Assistant active turn status')).toHaveTextContent(
+ 'Waiting for assistant',
+ );
});
- it('does not duplicate first-token status in the footer once an assistant turn exists', () => {
+ it('keeps first-token status visible once an assistant turn exists', () => {
mockChat.isLoading.mockReturnValue(true);
mockChat.messages.mockReturnValue([
{
@@ -2962,11 +2964,13 @@ describe('AIChat', () => {
},
]);
renderChat();
- expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Assistant active turn status')).toHaveTextContent(
+ 'Waiting for assistant',
+ );
expect(screen.queryByText('Generating response...')).not.toBeInTheDocument();
});
- it('does not duplicate workflow progress in the footer once an assistant turn exists', () => {
+ it('keeps workflow progress visible in the active turn status', () => {
mockChat.isLoading.mockReturnValue(true);
mockChat.messages.mockReturnValue([
{
@@ -2986,13 +2990,12 @@ describe('AIChat', () => {
]);
renderChat();
expect(
- screen.queryByText('Planning governed action and safety checks before execution.'),
- ).not.toBeInTheDocument();
- expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
+ screen.getByLabelText('Assistant active turn status'),
+ ).toHaveTextContent('Planning governed action and safety checks before execution. · exec');
expect(screen.queryByText('Generating response...')).not.toBeInTheDocument();
});
- it('does not duplicate pending tool status in the footer once an assistant turn exists', () => {
+ it('keeps pending tool progress visible in the active turn status', () => {
mockChat.isLoading.mockReturnValue(true);
mockChat.messages.mockReturnValue([
{
@@ -3004,11 +3007,12 @@ describe('AIChat', () => {
},
]);
renderChat();
- expect(screen.queryByText('Running get nodes...')).not.toBeInTheDocument();
- expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Assistant active turn status')).toHaveTextContent(
+ 'Running get nodes',
+ );
});
- it('does not duplicate status in the footer when assistant content is streaming', () => {
+ it('shows generating status when assistant content is streaming', () => {
mockChat.isLoading.mockReturnValue(true);
mockChat.messages.mockReturnValue([
{
@@ -3020,11 +3024,12 @@ describe('AIChat', () => {
},
]);
renderChat();
- expect(screen.queryByText('Generating response...')).not.toBeInTheDocument();
- expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Assistant active turn status')).toHaveTextContent(
+ 'Generating response',
+ );
});
- it('does not fall back to thinking when loading outlives visible assistant content', () => {
+ it('does not fall back to waiting when loading outlives visible assistant content', () => {
mockChat.isLoading.mockReturnValue(true);
mockChat.messages.mockReturnValue([
{
@@ -3037,11 +3042,12 @@ describe('AIChat', () => {
},
]);
renderChat();
- expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
- expect(screen.queryByText('Generating response...')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Assistant active turn status')).toHaveTextContent(
+ 'Generating response',
+ );
});
- it('keeps queued follow-up status without duplicating active assistant streaming status', () => {
+ it('keeps queued follow-up status alongside active assistant streaming status', () => {
mockChat.isLoading.mockReturnValue(true);
mockChat.queuedFollowUpCount.mockReturnValue(1);
mockChat.messages.mockReturnValue([
@@ -3061,15 +3067,16 @@ describe('AIChat', () => {
},
]);
renderChat();
- expect(screen.queryByText('Generating response...')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Assistant active turn status')).toHaveTextContent(
+ 'Generating response',
+ );
expect(screen.getByText('1 follow-up queued')).toBeInTheDocument();
});
it('shows no status indicator when not loading', () => {
mockChat.isLoading.mockReturnValue(false);
renderChat();
- expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
- expect(screen.queryByText('Generating response...')).not.toBeInTheDocument();
+ expect(screen.queryByLabelText('Assistant active turn status')).not.toBeInTheDocument();
});
});
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
new file mode 100644
index 0000000000..b5b9352d47
--- /dev/null
+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
@@ -0,0 +1,105 @@
+import { describe, expect, it } from 'vitest';
+import { getAssistantActiveTurnStatus } from '../activeTurnStatus';
+import type { ChatMessage } from '../types';
+
+const assistantMessage = (overrides: Partial<ChatMessage> = {}): ChatMessage => ({
+ id: 'assistant-1',
+ role: 'assistant',
+ content: '',
+ timestamp: new Date(),
+ ...overrides,
+});
+
+describe('getAssistantActiveTurnStatus', () => {
+ it('stays quiet when no Assistant turn is active', () => {
+ expect(getAssistantActiveTurnStatus([], false)).toBeNull();
+ });
+
+ it('shows a waiting state before the first assistant event arrives', () => {
+ expect(getAssistantActiveTurnStatus([], true)).toEqual({
+ type: 'thinking',
+ text: 'Waiting for assistant',
+ });
+ });
+
+ it('surfaces the current pending tool from active message state', () => {
+ expect(
+ getAssistantActiveTurnStatus(
+ [
+ assistantMessage({
+ pendingTools: [{ id: 'tool-1', name: 'pulse_get_nodes', input: '{}' }],
+ }),
+ ],
+ true,
+ ),
+ ).toEqual({
+ type: 'tool',
+ text: 'Running get nodes',
+ });
+ });
+
+ it('prefers live tool progress over generic tool labels', () => {
+ expect(
+ getAssistantActiveTurnStatus(
+ [
+ assistantMessage({
+ streamEvents: [
+ {
+ type: 'pending_tool',
+ pendingTool: {
+ id: 'tool-1',
+ name: 'pulse_get_inventory',
+ input: '{}',
+ progress: 'Reading Proxmox inventory',
+ status: 'running',
+ },
+ toolId: 'tool-1',
+ },
+ ],
+ }),
+ ],
+ true,
+ ),
+ ).toEqual({
+ type: 'tool',
+ text: 'Reading Proxmox inventory',
+ });
+ });
+
+ it('surfaces neutral workflow progress while a turn is active', () => {
+ expect(
+ getAssistantActiveTurnStatus(
+ [
+ assistantMessage({
+ workflowStatus: {
+ phase: 'preflight',
+ message: 'Preparing governed tools',
+ tool: 'pulse_exec',
+ },
+ }),
+ ],
+ true,
+ ),
+ ).toEqual({
+ type: 'tool',
+ text: 'Preparing governed tools · exec',
+ });
+ });
+
+ it('shows generating status after visible assistant output starts streaming', () => {
+ expect(
+ getAssistantActiveTurnStatus(
+ [
+ assistantMessage({
+ content: 'Partial answer',
+ isStreaming: true,
+ }),
+ ],
+ true,
+ ),
+ ).toEqual({
+ type: 'generating',
+ text: 'Generating response',
+ });
+ });
+});
diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
new file mode 100644
index 0000000000..f576b45e89
--- /dev/null
+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
@@ -0,0 +1,107 @@
+import type { ChatMessage, PendingTool, StreamDisplayEvent, WorkflowStatus } from './types';
+import { formatIdentifierLabel } from '@/utils/textPresentation';
+
+export type AssistantActiveTurnStatusKind = 'thinking' | 'tool' | 'generating';
+
+export interface AssistantActiveTurnStatus {
+ text: string;
+ type: AssistantActiveTurnStatusKind;
+}
+
+const formatToolName = (name?: string) =>
+ formatIdentifierLabel(name, { stripPrefix: 'pulse_', fallback: 'tool', maxLength: 36 });
+
+const escapeRegExp = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+
+const messageContainsToolLabel = (message: string, label: string) => {
+ if (!label) return false;
+ return new RegExp(`(^|\\W)${escapeRegExp(label)}($|\\W)`, 'i').test(message);
+};
+
+export const formatAssistantWorkflowStatus = (status?: WorkflowStatus): string => {
+ const message = status?.message?.trim();
+ if (!message) return '';
+
+ const tool = status?.tool?.trim();
+ const toolLabel = tool ? formatToolName(tool) : '';
+ const toolSuffix =
+ toolLabel && !message.includes(tool || '') && !messageContainsToolLabel(message, toolLabel)
+ ? ` · ${toolLabel}`
+ : '';
+
+ return `${message}${toolSuffix}`;
+};
+
+const formatPendingToolStatus = (tool?: PendingTool): string => {
+ if (!tool) return '';
+
+ const progress = tool.progress?.trim();
+ if (progress) return progress;
+
+ const toolLabel = formatToolName(tool.name);
+ if (tool.status === 'waiting') return `Waiting on ${toolLabel}`;
+
+ return `Running ${toolLabel}`;
+};
+
+const activePendingToolFromEvents = (
+ events?: StreamDisplayEvent[],
+): PendingTool | undefined => {
+ for (let index = (events?.length || 0) - 1; index >= 0; index -= 1) {
+ const event = events?.[index];
+ if (!event) continue;
+ if (event.type === 'pending_tool' && event.pendingTool) {
+ return event.pendingTool;
+ }
+ if (event.type === 'tool') {
+ return undefined;
+ }
+ }
+
+ return undefined;
+};
+
+const hasVisibleAssistantOutput = (message: ChatMessage): boolean => {
+ if ((message.content || '').trim() || message.error) return true;
+
+ return (message.streamEvents || []).some((event) => {
+ if (event.type === 'content') return !!event.content?.trim();
+ if (event.type === 'tool') return !!event.tool;
+ if (event.type === 'approval') return !!event.approval;
+ if (event.type === 'question') return !!event.question;
+ return false;
+ });
+};
+
+export const getAssistantActiveTurnStatus = (
+ messages: ChatMessage[],
+ isLoading: boolean,
+): AssistantActiveTurnStatus | null => {
+ if (!isLoading) return null;
+
+ const assistantMessage = [...messages].reverse().find((message) => message.role === 'assistant');
+ if (!assistantMessage) {
+ return { type: 'thinking', text: 'Waiting for assistant' };
+ }
+
+ const pendingTool =
+ assistantMessage.pendingTools?.at(-1) || activePendingToolFromEvents(assistantMessage.streamEvents);
+ const pendingToolText = formatPendingToolStatus(pendingTool);
+ if (pendingToolText) {
+ return { type: 'tool', text: pendingToolText };
+ }
+
+ const workflowStatusText = formatAssistantWorkflowStatus(assistantMessage.workflowStatus);
+ if (workflowStatusText) {
+ return {
+ type: assistantMessage.workflowStatus?.tool ? 'tool' : 'thinking',
+ text: workflowStatusText,
+ };
+ }
+
+ if (hasVisibleAssistantOutput(assistantMessage)) {
+ return { type: 'generating', text: 'Generating response' };
+ }
+
+ return { type: 'thinking', text: 'Waiting for assistant' };
+};
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index c0346c36fb..82a1627cf4 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -76,6 +76,7 @@ import { useChat, type QueuedFollowUp, type SendMessageOptions } from './hooks/u
import { ChatMessages } from './ChatMessages';
import { ModelSelector } from './ModelSelector';
import { MentionAutocomplete, type MentionResource } from './MentionAutocomplete';
+import { getAssistantActiveTurnStatus } from './activeTurnStatus';
import type {
ChatMessage,
ModelRouteRecoveryOption,
@@ -1099,61 +1100,9 @@ export const AIChat: Component<AIChatProps> = (props) => {
}),
);
- const assistantHasVisibleTranscriptOutput = (message: ChatMessage) => {
- if (message.role !== 'assistant') return false;
- if ((message.content || '').trim() || message.error) return true;
- if (
- message.pendingTools?.length ||
- message.pendingApprovals?.length ||
- message.pendingQuestions?.length ||
- message.toolCalls?.length
- ) {
- return true;
- }
-
- return (message.streamEvents || []).some((event) => {
- switch (event.type) {
- case 'content':
- return !!event.content?.trim();
- case 'tool':
- return !!event.tool;
- case 'pending_tool':
- return !!event.pendingTool;
- case 'approval':
- return !!event.approval;
- case 'question':
- return !!event.question;
- default:
- return false;
- }
- });
- };
-
- // Compute current status for display
- const currentStatus = createMemo(() => {
- if (!chat.isLoading()) return null;
-
- const messages = chat.messages();
- const activeAssistant = [...messages]
- .reverse()
- .find((message) => message.role === 'assistant' && message.isStreaming);
- if (activeAssistant) {
- return null;
- }
-
- const lastAssistant = [...messages].reverse().find((message) => message.role === 'assistant');
- if (lastAssistant && assistantHasVisibleTranscriptOutput(lastAssistant)) {
- return null;
- }
-
- const lastMessage = messages[messages.length - 1];
-
- if (!lastMessage || lastMessage.role !== 'assistant') {
- return { type: 'thinking', text: 'Thinking...' };
- }
-
- return { type: 'thinking', text: 'Thinking...' };
- });
+ const currentStatus = createMemo(() =>
+ getAssistantActiveTurnStatus(chat.messages(), chat.isLoading()),
+ );
createEffect(() => {
input();
@@ -2310,7 +2259,12 @@ export const AIChat: Component<AIChatProps> = (props) => {
{/* Status indicator bar */}
<Show when={currentStatus()}>
- <div class="px-4 py-2 bg-surface-alt border-t border-border flex items-center gap-2.5 text-xs">
+ <div
+ class="px-4 py-2 bg-surface-alt border-t border-border flex min-w-0 items-center gap-2.5 text-xs"
+ role="status"
+ aria-label="Assistant active turn status"
+ aria-live="polite"
+ >
{/* Status icon based on type */}
<Show when={currentStatus()?.type === 'thinking'}>
<div class="flex items-center justify-center w-4 h-4">
@@ -2370,7 +2324,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
</div>
</Show>
- <span class="text-muted font-medium">{currentStatus()?.text}</span>
+ <span class="min-w-0 truncate text-muted font-medium">{currentStatus()?.text}</span>
{/* Subtle animated dots */}
<div class="flex gap-0.5 ml-1">