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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep Assistant transcript pinned to live activity
rcourtman9d7b02e18d7c
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 55ef664ccf..2d372000e1 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -181,17 +181,29 @@ runtime cost control, and shared AI transport surfaces.model-switch plus tool rows in`packages/opencode/src/cli/cmd/tui/feature-plugins/system/session-v2.tsx`(model switch lines 120-122 and 262-274; tool rows lines 455-500).- Pulse adapts that by keeping the latest browser `workflow_status` activity- visible in the live stream event sequence across content, tool, approval,- and question boundaries instead of dropping it the instant a richer row- arrives. Burst workflow statuses may still replace one another until a- durable stream boundary appears, and terminal cleanup on done/error/Stop- may remove transient workflow-status rows while preserving typed- model-switch and tool evidence. The generated frontend SSE contract must- include workflow `provider` and `model` fields so selected-route activity- is typed end to end.- Composer prompt history is also drawer-local chat-runtime state: the drawer- may persist a bounded local history of submitted prompt text and structured+ Pulse adapts that by keeping the latest browser `workflow_status` activity+ visible in the live stream event sequence across content, tool, approval,+ and question boundaries instead of dropping it the instant a richer row+ arrives. Burst workflow statuses may still replace one another until a+ durable stream boundary appears, and terminal cleanup on done/error/Stop+ may remove transient workflow-status rows while preserving typed+ model-switch and tool evidence. The generated frontend SSE contract must+ include workflow `provider` and `model` fields so selected-route activity+ is typed end to end.+ The transcript viewport is part of the same live activity contract. The+ referenced OpenCode source at fetched `origin/dev` commit+ `4519a1da329c1a4fc384054e7203ba7d06928205` forwards reducer commits into+ terminal scrollback in+ `packages/opencode/src/cli/cmd/run/stream.ts` (lines 140-145) and renders+ bottom-sticky activity in+ `packages/opencode/src/cli/cmd/run/footer.subagent.tsx` (lines 148-153)+ with `stickyScroll={true}` and `stickyStart="bottom"`. Pulse adapts that+ by tracking whether the browser transcript is pinned to the live bottom+ before streamed content or tool rows grow, continuing to follow active+ output while pinned, and preserving the operator's scroll position after+ they intentionally scroll away from live activity.+ Composer prompt history is also drawer-local chat-runtime state: the drawer+ may persist a bounded local history of submitted prompt text and structuredmentions for ArrowUp/ArrowDown recall, but that history must not persist orreplay one-shot finding handoff, approval, autonomous-mode, or other scopedsend options. The referenced OpenCode source at fetched `origin/dev` commitdiff --git a/frontend-modern/src/components/AI/Chat/ChatMessages.tsx b/frontend-modern/src/components/AI/Chat/ChatMessages.tsxindex 7689a6f121..7abe6a7906 100644--- a/frontend-modern/src/components/AI/Chat/ChatMessages.tsx+++ b/frontend-modern/src/components/AI/Chat/ChatMessages.tsx@@ -1,4 +1,4 @@-import { Component, Show, For, createEffect, createMemo } from 'solid-js';+import { Component, Show, For, createEffect, createMemo, createSignal } from 'solid-js';import { MessageItem } from './MessageItem';import type { ChatSession } from '@/api/aiChat';import type { QueuedFollowUp } from './hooks/useChat';@@ -12,6 +12,8 @@ import type {} from './types';import { humanizeToken } from '@/utils/textPresentation';+const STICKY_SCROLL_BOTTOM_THRESHOLD_PX = 200;+interface ChatMessagesProps {messages: ChatMessage[];onApprove: (messageId: string, approval: PendingApproval) => void;@@ -46,6 +48,17 @@ interface ChatMessagesProps {export const ChatMessages: Component<ChatMessagesProps> = (props) => {let messagesEndRef: HTMLDivElement | undefined;let containerRef: HTMLDivElement | undefined;+ const [isPinnedToBottom, setIsPinnedToBottom] = createSignal(true);++ const isContainerNearBottom = () => {+ if (!containerRef) return true;+ const { scrollTop, scrollHeight, clientHeight } = containerRef;+ return scrollHeight - scrollTop - clientHeight < STICKY_SCROLL_BOTTOM_THRESHOLD_PX;+ };++ const updatePinnedToBottom = () => {+ setIsPinnedToBottom(isContainerNearBottom());+ };const textActivityFingerprint = (value?: string) =>value ? `${value.length}:${value.slice(-32)}` : '0:';@@ -168,11 +181,7 @@ export const ChatMessages: Component<ChatMessagesProps> = (props) => {void scrollTrigger();if (props.messages.length > 0 && messagesEndRef && containerRef) {- // Only auto-scroll if user is near the bottom (within 200px)- const { scrollTop, scrollHeight, clientHeight } = containerRef;- const isNearBottom = scrollHeight - scrollTop - clientHeight < 200;-- if (isNearBottom) {+ if (isPinnedToBottom() || isContainerNearBottom()) {// Use instant scroll during active streaming for smoother experienceconst lastMsg = props.messages[props.messages.length - 1];const behavior = lastMsg.isStreaming ? 'instant' : 'smooth';@@ -182,8 +191,15 @@ export const ChatMessages: Component<ChatMessagesProps> = (props) => {});return (- <div ref={containerRef} class="flex-1 overflow-y-auto px-4 py-3 bg-surface">- <Show when={props.messages.length === 0 && recentSessions().length > 0 && props.onLoadSession}>+ <div+ ref={containerRef}+ class="flex-1 overflow-y-auto px-4 py-3 bg-surface"+ data-testid="assistant-message-list"+ onScroll={updatePinnedToBottom}+ >+ <Show+ when={props.messages.length === 0 && recentSessions().length > 0 && props.onLoadSession}+ ><section class="mb-3 w-full" aria-label="Recent Assistant sessions"><div class="mb-2 text-[11px] font-semibold uppercase text-muted">Recent sessions</div><div class="space-y-1.5">diff --git a/frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsxindex ae6b130653..b27e0e2c90 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsx@@ -85,6 +85,29 @@ function makeHandlers() {};}+function setScrollMetrics(+ element: Element,+ metrics: {+ scrollTop: number;+ scrollHeight: number;+ clientHeight: number;+ },+) {+ Object.defineProperty(element, 'scrollTop', {+ configurable: true,+ value: metrics.scrollTop,+ writable: true,+ });+ Object.defineProperty(element, 'scrollHeight', {+ configurable: true,+ value: metrics.scrollHeight,+ });+ Object.defineProperty(element, 'clientHeight', {+ configurable: true,+ value: metrics.clientHeight,+ });+}+describe('ChatMessages', () => {describe('empty transcript', () => {it('keeps the transcript blank when there are no messages or resume actions', () => {@@ -503,6 +526,79 @@ describe('ChatMessages', () => {expect(scrollIntoView).toHaveBeenCalled();});+ it('keeps following live output when a large streaming update grows from the bottom', async () => {+ const [messages, setMessages] = createSignal<ChatMessage[]>([+ makeMessage({+ id: 'assistant-1',+ role: 'assistant',+ content: 'Starting',+ isStreaming: true,+ }),+ ]);+ render(() => <ChatMessages messages={messages()} {...makeHandlers()} />);+ const scrollContainer = screen.getByTestId('assistant-message-list');+ const scrollIntoView = Element.prototype.scrollIntoView as ReturnType<typeof vi.fn>;++ setScrollMetrics(scrollContainer, {+ scrollTop: 800,+ scrollHeight: 1000,+ clientHeight: 200,+ });+ fireEvent.scroll(scrollContainer);+ scrollIntoView.mockClear();++ setScrollMetrics(scrollContainer, {+ scrollTop: 800,+ scrollHeight: 1400,+ clientHeight: 200,+ });+ setMessages([+ makeMessage({+ id: 'assistant-1',+ role: 'assistant',+ content: `${'Streaming update. '.repeat(80)}`,+ isStreaming: true,+ }),+ ]);+ await Promise.resolve();++ expect(scrollIntoView).toHaveBeenCalledWith({ behavior: 'instant' });+ });++ it('does not pull the transcript back down after the user scrolls away from live output', async () => {+ const [messages, setMessages] = createSignal<ChatMessage[]>([+ makeMessage({+ id: 'assistant-1',+ role: 'assistant',+ content: 'Starting',+ isStreaming: true,+ }),+ ]);+ render(() => <ChatMessages messages={messages()} {...makeHandlers()} />);+ const scrollContainer = screen.getByTestId('assistant-message-list');+ const scrollIntoView = Element.prototype.scrollIntoView as ReturnType<typeof vi.fn>;++ setScrollMetrics(scrollContainer, {+ scrollTop: 100,+ scrollHeight: 1000,+ clientHeight: 200,+ });+ fireEvent.scroll(scrollContainer);+ scrollIntoView.mockClear();++ setMessages([+ makeMessage({+ id: 'assistant-1',+ role: 'assistant',+ content: `${'Streaming update. '.repeat(80)}`,+ isStreaming: true,+ }),+ ]);+ await Promise.resolve();++ expect(scrollIntoView).not.toHaveBeenCalled();+ });+it('does not call scrollIntoView when messages list is empty', () => {// Reset the mock to clear any prior calls(Element.prototype.scrollIntoView as ReturnType<typeof vi.fn>).mockClear();@@ -519,6 +615,7 @@ describe('ChatMessages', () => {const scrollContainer = container.firstElementChild;expect(scrollContainer).toHaveClass('flex-1', 'overflow-y-auto');+ expect(scrollContainer).toHaveAttribute('data-testid', 'assistant-message-list');});});});