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
Clear terminal Assistant affordances
rcourtmancf7c24f66d0a
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 758ad4da0d..059c4f5cea 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -140,6 +140,19 @@ runtime cost control, and shared AI transport surfaces.approval, and question transcript rows on explicit Stop while preservingalready-streamed answer text and completed tool evidence before showing theneutral stopped marker.+ The same terminal cleanup applies to non-interrupt terminal paths. When a+ stream reaches `done`, emits a structured `error`, or rejects before an SSE+ terminal event, the drawer must not leave pending tool, approval, or+ question controls live in the transcript. The referenced OpenCode source at+ commit `9ed17da55ab1f7360cc0e01075f763e27fa899e9` mutates active tool+ parts into terminal `success` or `failed` rows in+ `packages/opencode/src/cli/cmd/tui/context/sync-v2.tsx`+ (`session.next.tool.success`, lines 328-348;+ `session.next.tool.failed`, lines 350-371), and the processor marks+ interrupted active tools terminal before completing the assistant message in+ `packages/opencode/src/session/processor.ts` (lines 888-917). Pulse adapts+ that by retaining completed tool rows and assistant text while removing+ unresolved interactive rows from terminal browser transcript state.Composer prompt history is also drawer-local chat-runtime state: the drawermay persist a bounded local history of submitted prompt text and structuredmentions for ArrowUp/ArrowDown recall, but that history must not persist ordiff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.tsindex f2db335200..008798cd0a 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -313,6 +313,54 @@ describe('useChat', () => {dispose();});+ it('chat promise rejection removes unresolved interactive stream rows', async () => {+ mockChat.mockImplementation(+ (+ _prompt: string,+ _session: string,+ _model: string | undefined,+ onEvent: (event: StreamEvent) => void,+ ) => {+ dispatchTestStreamEvent(onEvent, { type: 'content', data: 'partial response' });+ dispatchTestStreamEvent(onEvent, {+ type: 'tool_start',+ data: { id: 'tool-1', name: 'pulse_read', input: '{}' },+ });+ dispatchTestStreamEvent(onEvent, {+ type: 'approval_needed',+ data: {+ command: 'systemctl restart nginx',+ tool_id: 'tool-2',+ tool_name: 'pulse_control',+ run_on_host: true,+ approval_id: 'approval-1',+ },+ });+ dispatchTestStreamEvent(onEvent, {+ type: 'question',+ data: {+ question_id: 'question-1',+ questions: [{ id: 'target', question: 'Which node?' }],+ },+ });+ return Promise.reject(new Error('server error'));+ },+ );++ const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 'sess' }));+ const result = await chat.sendMessage('hello');++ expect(result).toBe(false);+ const assistant = chat.messages().find((m) => m.role === 'assistant')!;+ expect(assistant.error).toBe('server error');+ expect(assistant.content).toBe('partial response');+ expect(assistant.pendingTools).toEqual([]);+ expect(assistant.pendingApprovals).toEqual([]);+ expect(assistant.pendingQuestions).toEqual([]);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['content']);+ dispose();+ });+it('retryMessage drops the failed turn and re-sends the prompt', async () => {mockChat.mockRejectedValueOnce(new Error('server error'));const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 'sess' }));@@ -1690,6 +1738,44 @@ describe('useChat', () => {dispose();});+ it('done event removes unresolved interactive stream rows', async () => {+ const { getFireEvent } = setupWithEventCapture();+ const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));++ await chat.sendMessage('hi');+ const fire = getFireEvent();++ fire({ type: 'content', data: 'partial response' });+ fire({ type: 'tool_start', data: { id: 'tool-1', name: 'pulse_read', input: '{}' } });+ fire({+ type: 'approval_needed',+ data: {+ command: 'systemctl restart nginx',+ tool_id: 'tool-2',+ tool_name: 'pulse_control',+ run_on_host: true,+ approval_id: 'approval-1',+ },+ });+ fire({+ type: 'question',+ data: {+ question_id: 'question-1',+ questions: [{ id: 'target', question: 'Which node?' }],+ },+ });+ fire({ type: 'done', data: { input_tokens: 1, output_tokens: 2 } });++ const assistant = chat.messages().find((m) => m.role === 'assistant')!;+ expect(assistant.isStreaming).toBe(false);+ expect(assistant.content).toBe('partial response');+ expect(assistant.pendingTools).toEqual([]);+ expect(assistant.pendingApprovals).toEqual([]);+ expect(assistant.pendingQuestions).toEqual([]);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['content']);+ dispose();+ });+it('processes error events', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -1707,6 +1793,45 @@ describe('useChat', () => {dispose();});+ it('error event removes unresolved interactive stream rows', async () => {+ const { getFireEvent } = setupWithEventCapture();+ const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));++ await chat.sendMessage('hi');+ const fire = getFireEvent();++ fire({ type: 'content', data: 'partial response' });+ fire({ type: 'tool_start', data: { id: 'tool-1', name: 'pulse_read', input: '{}' } });+ fire({+ type: 'approval_needed',+ data: {+ command: 'systemctl restart nginx',+ tool_id: 'tool-2',+ tool_name: 'pulse_control',+ run_on_host: true,+ approval_id: 'approval-1',+ },+ });+ fire({+ type: 'question',+ data: {+ question_id: 'question-1',+ questions: [{ id: 'target', question: 'Which node?' }],+ },+ });+ fire({ type: 'error', data: { message: 'Provider disconnected' } });++ const assistant = chat.messages().find((m) => m.role === 'assistant')!;+ expect(assistant.isStreaming).toBe(false);+ expect(assistant.error).toBe('Provider disconnected');+ expect(assistant.content).toBe('partial response');+ expect(assistant.pendingTools).toEqual([]);+ expect(assistant.pendingApprovals).toEqual([]);+ expect(assistant.pendingQuestions).toEqual([]);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['content']);+ dispose();+ });+it('processes error event with string data', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));diff --git a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts b/frontend-modern/src/components/AI/Chat/hooks/useChat.tsindex ff7687a700..d4a6a9cf2f 100644--- a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts+++ b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts@@ -157,11 +157,10 @@ export function useChat(options: UseChatOptions = {}) {return promise;};- const streamEventsAfterInterruption = (+ const streamEventsWithoutUnresolvedInteractiveRows = (events: StreamDisplayEvent[] | undefined,- interruption?: AssistantInterruption,): StreamDisplayEvent[] | undefined => {- if (!interruption || !events) return events;+ if (!events) return events;return events.filter((event) =>event.type !== 'pending_tool' && event.type !== 'approval' && event.type !== 'question',@@ -190,7 +189,9 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsAfterInterruption(msg.streamEvents, interruption),+ streamEvents: interruption+ ? streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents)+ : msg.streamEvents,workflowStatus: undefined,}: msg,@@ -1130,6 +1131,11 @@ export function useChat(options: UseChatOptions = {}) {completedAt,...(completedModel ? { model: completedModel } : {}),pendingTools: [],+ pendingApprovals: [],+ pendingQuestions: [],+ streamEvents: streamEventsWithoutUnresolvedInteractiveRows(+ flushedMsg.streamEvents,+ ),tokens,workflowStatus: undefined,};@@ -1140,6 +1146,9 @@ export function useChat(options: UseChatOptions = {}) {completedAt,...(completedModel ? { model: completedModel } : {}),pendingTools: [],+ pendingApprovals: [],+ pendingQuestions: [],+ streamEvents: streamEventsWithoutUnresolvedInteractiveRows(flushedMsg.streamEvents),workflowStatus: undefined,};}@@ -1154,6 +1163,9 @@ export function useChat(options: UseChatOptions = {}) {isStreaming: false,completedAt: new Date(),pendingTools: [],+ pendingApprovals: [],+ pendingQuestions: [],+ streamEvents: streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents),workflowStatus: undefined,error: errorMsg || 'Request failed',};@@ -1326,7 +1338,16 @@ export function useChat(options: UseChatOptions = {}) {setMessages((prev) =>prev.map((msg) =>msg.id === assistantId- ? { ...msg, isStreaming: false, workflowStatus: undefined, error: errorMessage }+ ? {+ ...msg,+ isStreaming: false,+ pendingTools: [],+ pendingApprovals: [],+ pendingQuestions: [],+ streamEvents: streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents),+ workflowStatus: undefined,+ error: errorMessage,+ }: msg,),);