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.

Pace Assistant workflow activity

rcourtmanfcf4be5f8523
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 52c6d6e36e..0092a7e035 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -299,13 +299,17 @@ runtime cost control, and shared AI transport surfaces.
through the composer footer while transcript rows continue to render typed
Assistant evidence. 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,
- or questions begin, stale workflow text must clear so the row does not keep
- saying it is waiting on a phase that has already been superseded. Live
- workflow and pending-tool activity must retain a per-state start timestamp
- so the drawer can show elapsed wait/run time for long provider starts and
- tool calls instead of repeating a timeless waiting label.
+ `workflow_state` replaces the canonical active status immediately. The
+ browser may retain a bounded in-flight presentation history of those replaced
+ labels and pace one visible workflow row through them when backend/network
+ coalescing would otherwise make the row jump straight to the last state.
+ That history must stay live-only: once visible assistant text, tool progress,
+ approvals, questions, terminal `done`, terminal `error`, or explicit Stop
+ take over, stale workflow text and the presentation history must clear so
+ the row does not keep saying it is waiting on a phase that has already been
+ superseded. Live workflow and pending-tool activity must retain a per-state
+ start timestamp so the drawer can show elapsed wait/run time for long
+ provider starts and tool calls instead of repeating a timeless waiting label.
The referenced OpenCode source at fetched `origin/dev` commit
`4519a1da329c1a4fc384054e7203ba7d06928205` mutates typed message parts as
events arrive in `packages/opencode/src/cli/cmd/tui/context/sync.tsx`
@@ -366,6 +370,16 @@ runtime cost control, and shared AI transport surfaces.
`createPacedValue` live markdown pattern in
`packages/ui/src/components/message-part.tsx` so Pulse feels active without
delaying copy/export, tool boundaries, approvals, or audit evidence.
+ Live workflow labels follow that same presentation-layer constraint: the
+ canonical SSE/store state remains the latest typed `workflow_state`, while a
+ bounded live-only browser history paces a single replacing activity row
+ through recent states. This adapts OpenCode's status/title motion in
+ `packages/ui/src/components/tool-status-title.tsx` and timeline thinking
+ row treatment in `packages/app/src/pages/session/message-timeline.data.ts`
+ at fetched `origin/dev` commit `4519a1da329c1a4fc384054e7203ba7d06928205`;
+ Pulse uses it only for short workflow labels, not for audit evidence,
+ approvals, tool boundaries, transcript export, or completed/restored
+ messages.
Completed Assistant tool rows follow the same source-anchored display policy:
the referenced OpenCode commit
`9ed17da55ab1f7360cc0e01075f763e27fa899e9` keeps ordinary tool activity terse
@@ -1653,9 +1667,12 @@ frontend `workflow_status` display event: each incoming backend
`workflow_state` replaces the prior workflow row, the active footer reads the
same typed status, and visible assistant content, reasoning, tool,
approval/question, terminal `done`, and terminal `error` events clear that row.
-The transcript therefore shows current motion while the provider is starting,
-retrying, or reasoning, but completed answers do not retain stale
-internal-progress prose.
+The frontend now also keeps a bounded live-only `workflowStatusHistory` for the
+active assistant message so one row can visibly step through bursty preparation,
+context, provider-start, retry, and fallback labels instead of showing them all
+only after the final state arrives. The transcript therefore shows current
+motion while the provider is starting, retrying, or reasoning, but completed
+answers do not retain stale internal-progress prose.
Primary nav moved to governed platform/runtime destinations on 2026-05-16 and
was clarified on 2026-05-25 through `frontend-modern/src/App.tsx` and
diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
index 9521120a44..f23743cdb3 100644
--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx
+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
@@ -85,6 +85,7 @@ const markdownClass =
const TEXT_RENDER_PACE_MS = 24;
const TEXT_RENDER_SNAP = /[\s.,!?;:)\]]/;
+const WORKFLOW_STATUS_RENDER_PACE_MS = 420;
const textRenderStep = (size: number) => {
if (size <= 12) return 2;
@@ -128,6 +129,127 @@ const schedulePacedTextCleanup = (key: string) => {
);
};
+const workflowStatusRenderKey = (status?: WorkflowStatus) =>
+ status
+ ? [
+ status?.phase || '',
+ status?.message || '',
+ status?.state || '',
+ status?.tool || '',
+ status?.attempt || 0,
+ status?.maxAttempts || 0,
+ status?.retryAfterMs || 0,
+ status?.startedAt || 0,
+ ].join('\u001f')
+ : '';
+
+const normalizeWorkflowStatusSequence = (statuses: Array<WorkflowStatus | undefined>) => {
+ const sequence: WorkflowStatus[] = [];
+ for (const status of statuses) {
+ if (!status || !formatAssistantWorkflowStatus(status)) continue;
+ const previous = sequence[sequence.length - 1];
+ if (workflowStatusRenderKey(previous) === workflowStatusRenderKey(status)) continue;
+ sequence.push(status);
+ }
+ return sequence;
+};
+
+interface PacedWorkflowStatusClock {
+ firstKey: string;
+ startedAt: number;
+}
+
+const pacedWorkflowStatusCache = new Map<string, PacedWorkflowStatusClock>();
+const pacedWorkflowStatusCleanupTimers = new Map<string, ReturnType<typeof setTimeout>>();
+
+const cancelPacedWorkflowStatusCleanup = (key: string) => {
+ const timer = pacedWorkflowStatusCleanupTimers.get(key);
+ if (!timer) return;
+ clearTimeout(timer);
+ pacedWorkflowStatusCleanupTimers.delete(key);
+};
+
+const deletePacedWorkflowStatusCache = (key: string) => {
+ cancelPacedWorkflowStatusCleanup(key);
+ pacedWorkflowStatusCache.delete(key);
+};
+
+const schedulePacedWorkflowStatusCleanup = (key: string) => {
+ cancelPacedWorkflowStatusCleanup(key);
+ pacedWorkflowStatusCleanupTimers.set(
+ key,
+ setTimeout(() => {
+ pacedWorkflowStatusCleanupTimers.delete(key);
+ pacedWorkflowStatusCache.delete(key);
+ }, 1000),
+ );
+};
+
+const createPacedWorkflowStatus = (
+ getStatuses: () => WorkflowStatus[],
+ live: () => boolean,
+ cacheKey: () => string,
+) => {
+ const [now, setNow] = createSignal(Date.now());
+ let interval: ReturnType<typeof setInterval> | undefined;
+
+ createEffect(() => {
+ const statuses = getStatuses();
+ if (!live()) {
+ if (interval) {
+ clearInterval(interval);
+ interval = undefined;
+ }
+ const key = cacheKey();
+ if (key) deletePacedWorkflowStatusCache(key);
+ return;
+ }
+
+ const key = cacheKey();
+ if (key) {
+ cancelPacedWorkflowStatusCleanup(key);
+ }
+
+ if (statuses.length > 1 && !interval) {
+ interval = setInterval(() => setNow(Date.now()), WORKFLOW_STATUS_RENDER_PACE_MS);
+ } else if (statuses.length <= 1 && interval) {
+ clearInterval(interval);
+ interval = undefined;
+ }
+ });
+
+ onCleanup(() => {
+ if (interval) {
+ clearInterval(interval);
+ }
+ const key = cacheKey();
+ if (key) schedulePacedWorkflowStatusCleanup(key);
+ });
+
+ return createMemo(() => {
+ const statuses = getStatuses();
+ if (statuses.length === 0) return undefined;
+ if (!live()) return statuses[statuses.length - 1];
+ if (statuses.length === 1) return statuses[0];
+
+ const key = cacheKey();
+ const firstKey = workflowStatusRenderKey(statuses[0]);
+ if (!key || !firstKey) return statuses[0];
+
+ const cached = pacedWorkflowStatusCache.get(key);
+ const startedAt = cached?.firstKey === firstKey ? cached.startedAt : now();
+ if (!cached || cached.firstKey !== firstKey) {
+ pacedWorkflowStatusCache.set(key, { firstKey, startedAt });
+ }
+
+ const index = Math.min(
+ statuses.length - 1,
+ Math.floor(Math.max(0, now() - startedAt) / WORKFLOW_STATUS_RENDER_PACE_MS),
+ );
+ return statuses[index] || statuses[statuses.length - 1];
+ });
+};
+
const createPacedText = (getText: () => string, live: () => boolean, cacheKey: () => string) => {
const initialText = getText();
const initialKey = cacheKey();
@@ -351,9 +473,24 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
const workflowStatusText = createMemo(() =>
formatWorkflowStatus(props.message.workflowStatus, true),
);
- const inlineStreamingStatusText = createMemo(() => {
- return workflowStatusText() || 'Thinking...';
- });
+ const workflowStatusSequence = (status?: WorkflowStatus) =>
+ normalizeWorkflowStatusSequence([...(props.message.workflowStatusHistory || []), status]);
+ const WorkflowStatusText: Component<{
+ status?: WorkflowStatus;
+ includeElapsed?: boolean;
+ paceKey: string;
+ }> = (statusProps) => {
+ const statuses = createMemo(() => workflowStatusSequence(statusProps.status));
+ const displayedStatus = createPacedWorkflowStatus(
+ () => statuses(),
+ () => props.message.isStreaming === true,
+ () => statusProps.paceKey,
+ );
+ const text = createMemo(() =>
+ formatWorkflowStatus(displayedStatus(), statusProps.includeElapsed),
+ );
+ return <>{text()}</>;
+ };
const shouldShowHeaderWorkflowStatus = () =>
props.message.isStreaming &&
!isWaitingForFirstToken() &&
@@ -469,7 +606,13 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
aria-live="polite"
>
<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500 animate-pulse" />
- <span class="truncate">{workflowStatusText()}</span>
+ <span class="truncate">
+ <WorkflowStatusText
+ status={props.message.workflowStatus}
+ includeElapsed
+ paceKey={`${props.message.id}:workflow-header`}
+ />
+ </span>
</span>
</Show>
<Show when={canCopy()}>
@@ -504,7 +647,15 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
style="animation-delay: 240ms"
/>
</span>
- <span>{inlineStreamingStatusText()}</span>
+ <Show when={workflowStatusText()} fallback={<span>Thinking...</span>}>
+ <span>
+ <WorkflowStatusText
+ status={props.message.workflowStatus}
+ includeElapsed
+ paceKey={`${props.message.id}:workflow-inline`}
+ />
+ </span>
+ </Show>
</div>
</Show>
@@ -548,7 +699,11 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
aria-hidden="true"
/>
<span class="min-w-0 truncate">
- {formatWorkflowStatus(evt.workflowStatus, props.message.isStreaming)}
+ <WorkflowStatusText
+ status={evt.workflowStatus}
+ includeElapsed={props.message.isStreaming}
+ paceKey={`${props.message.id}:workflow-row`}
+ />
</span>
</div>
</Match>
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 5a27c5c0f7..a5b632d6d9 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
@@ -630,6 +630,63 @@ describe('MessageItem', () => {
expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
});
+ it('paces burst workflow activity through one live transcript row', async () => {
+ vi.useFakeTimers();
+ const workflowStatusHistory = [
+ {
+ phase: 'request_start',
+ message: 'Preparing Pulse context.',
+ startedAt: 1_000,
+ },
+ {
+ phase: 'context',
+ message: 'Reading current Pulse inventory with pulse_query.',
+ tool: 'pulse_query',
+ startedAt: 1_100,
+ },
+ {
+ phase: 'provider_start',
+ message: 'Sent request to OpenRouter; waiting for the first token.',
+ startedAt: 1_200,
+ },
+ ];
+
+ render(() => (
+ <MessageItem
+ message={makeMessage({
+ role: 'assistant',
+ content: '',
+ isStreaming: true,
+ pendingTools: [],
+ workflowStatusHistory,
+ streamEvents: [
+ {
+ type: 'workflow_status',
+ workflowStatus: workflowStatusHistory[2],
+ },
+ ],
+ workflowStatus: workflowStatusHistory[2],
+ })}
+ {...makeHandlers()}
+ />
+ ));
+
+ expect(screen.getByText(/Preparing Pulse context\./)).toBeInTheDocument();
+ expect(
+ screen.queryByText(/Sent request to OpenRouter; waiting for the first token\./),
+ ).not.toBeInTheDocument();
+
+ await vi.advanceTimersByTimeAsync(420);
+ expect(
+ screen.getByText(/Reading current Pulse inventory with pulse_query\./),
+ ).toBeInTheDocument();
+
+ await vi.advanceTimersByTimeAsync(420);
+ expect(
+ screen.getByText(/Sent request to OpenRouter; waiting for the first token\./),
+ ).toBeInTheDocument();
+ });
+
it('hides stale workflow progress after visible content starts', () => {
render(() => (
<MessageItem
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts
index e367d28d21..e4d3b8429b 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts
@@ -1340,6 +1340,12 @@ describe('useChat', () => {
}),
}),
]);
+ expect(assistant.workflowStatusHistory?.map((status) => status.message)).toEqual([
+ 'Preparing Pulse context.',
+ 'Reading current Pulse inventory with pulse_query.',
+ 'Built compact inventory context for the model.',
+ 'Sent request to OpenRouter; waiting for the first token.',
+ ]);
dispose();
});
diff --git a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts
index bf5d32ce6f..f4276a6262 100644
--- a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts
+++ b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts
@@ -31,6 +31,7 @@ import type {
const generateId = () => Math.random().toString(36).substring(2, 9);
type AssistantInterruption = NonNullable<ChatMessage['interruption']>;
+const WORKFLOW_STATUS_HISTORY_LIMIT = 8;
const createInitialAssistantWorkflowStatus = (): WorkflowStatus => ({
phase: 'request_start',
@@ -136,8 +137,19 @@ export function useChat(options: UseChatOptions = {}) {
(a.maxAttempts || 0) === (b.maxAttempts || 0) &&
(a.retryAfterMs || 0) === (b.retryAfterMs || 0);
- const isStreamIdleWorkflowStatus = (status?: WorkflowStatus) =>
- status?.phase === 'stream_idle';
+ const appendWorkflowStatusHistory = (
+ history: WorkflowStatus[] | undefined,
+ workflowStatus: WorkflowStatus,
+ ): WorkflowStatus[] => {
+ const current = history || [];
+ const previous = current[current.length - 1];
+ if (workflowStatusesMatch(previous, workflowStatus)) {
+ return current;
+ }
+ return [...current, workflowStatus].slice(-WORKFLOW_STATUS_HISTORY_LIMIT);
+ };
+
+ const isStreamIdleWorkflowStatus = (status?: WorkflowStatus) => status?.phase === 'stream_idle';
// stream_idle is transport liveness, not a new Assistant step.
const visibleWorkflowStatusForHeartbeat = (
@@ -234,6 +246,7 @@ export function useChat(options: UseChatOptions = {}) {
? streamEventsWithoutTransientRows(msg.streamEvents)
: msg.streamEvents,
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
}
: msg,
),
@@ -381,6 +394,10 @@ export function useChat(options: UseChatOptions = {}) {
updatedAt: nextEvent.updatedAt || now,
},
],
+ workflowStatusHistory: appendWorkflowStatusHistory(
+ msg.workflowStatusHistory,
+ visibleStatus,
+ ),
};
}
return msg;
@@ -394,10 +411,17 @@ export function useChat(options: UseChatOptions = {}) {
startedAt: nextEvent.startedAt || last.startedAt,
},
],
+ workflowStatusHistory: appendWorkflowStatusHistory(
+ msg.workflowStatusHistory,
+ visibleStatus,
+ ),
};
}
- return addStreamEvent(msg, nextEvent);
+ return {
+ ...addStreamEvent(msg, nextEvent),
+ workflowStatusHistory: appendWorkflowStatusHistory(msg.workflowStatusHistory, visibleStatus),
+ };
};
const normalizePendingToolStatus = (phase?: string): PendingTool['status'] => {
@@ -522,6 +546,7 @@ export function useChat(options: UseChatOptions = {}) {
now,
),
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
pendingTools: updatedPendingTools,
};
};
@@ -603,6 +628,7 @@ export function useChat(options: UseChatOptions = {}) {
)
: msg.streamEvents,
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
pendingTools: updatedPendingTools,
};
};
@@ -1040,6 +1066,7 @@ export function useChat(options: UseChatOptions = {}) {
...updated,
content: appendMessageContent(baseMsg, visible.text),
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
};
}
@@ -1109,15 +1136,17 @@ export function useChat(options: UseChatOptions = {}) {
return {
...msg,
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
pendingTools: (msg.pendingTools || []).filter(
(tool) => !matchesTool(tool, tool.id),
),
- streamEvents: (streamEventsWithoutWorkflowStatusRows(msg.streamEvents || []) || [])
- .filter(
- (streamEvent) =>
- streamEvent.type !== 'pending_tool' ||
- !matchesTool(streamEvent.pendingTool, streamEvent.toolId),
- ),
+ streamEvents: (
+ streamEventsWithoutWorkflowStatusRows(msg.streamEvents || []) || []
+ ).filter(
+ (streamEvent) =>
+ streamEvent.type !== 'pending_tool' ||
+ !matchesTool(streamEvent.pendingTool, streamEvent.toolId),
+ ),
};
}
@@ -1245,6 +1274,7 @@ export function useChat(options: UseChatOptions = {}) {
...msg,
streamEvents: updatedEvents,
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
pendingTools: updatedPending,
pendingApprovals: updatedApprovals,
toolCalls: [...(msg.toolCalls || []), newToolCall],
@@ -1332,6 +1362,7 @@ export function useChat(options: UseChatOptions = {}) {
return {
...updated,
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
pendingApprovals: [...(msg.pendingApprovals || []), approval],
};
}
@@ -1371,6 +1402,7 @@ export function useChat(options: UseChatOptions = {}) {
return {
...updated,
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
pendingQuestions: [...(msg.pendingQuestions || []), pendingQuestion],
};
}
@@ -1407,6 +1439,7 @@ export function useChat(options: UseChatOptions = {}) {
streamEvents: streamEventsWithoutTransientRows(flushedMsg.streamEvents),
tokens,
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
};
}
return {
@@ -1419,6 +1452,7 @@ export function useChat(options: UseChatOptions = {}) {
pendingQuestions: [],
streamEvents: streamEventsWithoutTransientRows(flushedMsg.streamEvents),
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
};
}
@@ -1436,6 +1470,7 @@ export function useChat(options: UseChatOptions = {}) {
pendingQuestions: [],
streamEvents: streamEventsWithoutTransientRows(msg.streamEvents),
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
error: errorMsg || 'Request failed',
};
}
@@ -1532,6 +1567,7 @@ export function useChat(options: UseChatOptions = {}) {
toolCalls: [],
streamEvents: [],
workflowStatus: initialWorkflowStatus,
+ workflowStatusHistory: [initialWorkflowStatus],
};
if (options?.queuedMessageId) {
@@ -1615,6 +1651,7 @@ export function useChat(options: UseChatOptions = {}) {
pendingQuestions: [],
streamEvents: streamEventsWithoutTransientRows(msg.streamEvents),
workflowStatus: undefined,
+ workflowStatusHistory: undefined,
error: errorMessage,
}
: msg,
diff --git a/frontend-modern/src/components/AI/Chat/types.ts b/frontend-modern/src/components/AI/Chat/types.ts
index d3ff524587..5ef1a57df9 100644
--- a/frontend-modern/src/components/AI/Chat/types.ts
+++ b/frontend-modern/src/components/AI/Chat/types.ts
@@ -163,6 +163,7 @@ export interface ChatMessage {
toolCalls?: ToolExecution[];
isStreaming?: boolean;
workflowStatus?: WorkflowStatus;
+ workflowStatusHistory?: WorkflowStatus[];
pendingTools?: PendingTool[];
pendingApprovals?: PendingApproval[];
pendingQuestions?: PendingQuestion[];