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.

Make Assistant empty sessions prompt-first

rcourtman659356076cad
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index aa0f49af6f..a9ceb56380 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -705,6 +705,17 @@ runtime cost control, and shared AI transport surfaces.
remain route-distinct: if the configured chat override resolves to the same
route as the effective default or the already selected session model, the
drawer must not render a duplicate override action.
+ Empty Assistant sessions are prompt-first transcript surfaces, not product
+ marketing or instruction panels. The referenced OpenCode source at commit
+ `9ed17da55ab1f7360cc0e01075f763e27fa899e9`
+ `packages/opencode/src/cli/cmd/tui/routes/session/index.tsx` derives
+ session messages in `Session` lines 185-203, renders only the message
+ stream inside the scrollbox at lines 1188-1295, and renders `Prompt` in the
+ `session_prompt` slot at lines 1313-1333 without inserting a centered
+ no-message title or subtitle. Pulse adapts that by leaving a blank
+ transcript blank, keeping scoped handoff context in the drawer context
+ strip, and limiting no-message transcript affordances to real
+ recent-session resume actions.
The referenced OpenCode source at fetched `origin/dev` commit
`1399323b78a04229d9bfe00c7436d7f41770fda8` renders the completed assistant
footer in
diff --git a/frontend-modern/src/components/AI/Chat/ChatMessages.tsx b/frontend-modern/src/components/AI/Chat/ChatMessages.tsx
index f7a89bddc2..ca5b3435f2 100644
--- a/frontend-modern/src/components/AI/Chat/ChatMessages.tsx
+++ b/frontend-modern/src/components/AI/Chat/ChatMessages.tsx
@@ -31,10 +31,6 @@ interface ChatMessagesProps {
// Dashboard props
recentSessions?: ChatSession[];
onLoadSession?: (sessionId: string) => void;
- emptyState?: {
- title: string;
- subtitle?: string;
- };
}
/**
@@ -42,7 +38,7 @@ interface ChatMessagesProps {
*
* Features:
* - Auto-scroll to bottom on new messages
- * - Empty state
+ * - Recent-session resume actions
* - Smooth scrolling behavior
*/
export const ChatMessages: Component<ChatMessagesProps> = (props) => {
@@ -115,49 +111,40 @@ export const ChatMessages: Component<ChatMessagesProps> = (props) => {
return (
<div ref={containerRef} class="flex-1 overflow-y-auto px-4 py-3 bg-surface">
- {/* Empty state */}
- <Show when={props.messages.length === 0 && props.emptyState}>
- <div class="flex min-h-full flex-col items-center justify-center px-2 py-8 text-center">
- <h3 class="text-base font-semibold text-base-content mb-3">{props.emptyState!.title}</h3>
- <Show when={props.emptyState!.subtitle}>
- <p class="text-sm text-muted max-w-xs">{props.emptyState!.subtitle}</p>
- </Show>
- <Show when={recentSessions().length > 0 && props.onLoadSession}>
- <div class="mt-6 w-full max-w-sm text-left" 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">
- <For each={recentSessions()}>
- {(session) => {
- const handoffLabel = () => formatSessionHandoffLabel(session);
- return (
- <button
- type="button"
- class="w-full rounded-md border border-border bg-surface px-3 py-2 text-left transition-colors hover:border-blue-300 hover:bg-surface-alt focus:outline-none focus:ring-2 focus:ring-blue-500/30"
- onClick={() => props.onLoadSession?.(session.id)}
- aria-label={`Resume ${session.title || 'Untitled Assistant session'}`}
- >
- <div class="truncate text-sm font-medium text-base-content">
- {session.title || 'Untitled'}
- </div>
- <div class="mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5 text-[11px] text-muted">
- <span>{formatSessionMessageCount(session.message_count)}</span>
- <Show when={handoffLabel()}>
- {(label) => (
- <>
- <span aria-hidden="true">/</span>
- <span class="truncate">{label()}</span>
- </>
- )}
- </Show>
- </div>
- </button>
- );
- }}
- </For>
- </div>
- </div>
- </Show>
- </div>
+ <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">
+ <For each={recentSessions()}>
+ {(session) => {
+ const handoffLabel = () => formatSessionHandoffLabel(session);
+ return (
+ <button
+ type="button"
+ class="w-full rounded-md border border-border bg-surface px-3 py-2 text-left transition-colors hover:border-blue-300 hover:bg-surface-alt focus:outline-none focus:ring-2 focus:ring-blue-500/30"
+ onClick={() => props.onLoadSession?.(session.id)}
+ aria-label={`Resume ${session.title || 'Untitled Assistant session'}`}
+ >
+ <div class="truncate text-sm font-medium text-base-content">
+ {session.title || 'Untitled'}
+ </div>
+ <div class="mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5 text-[11px] text-muted">
+ <span>{formatSessionMessageCount(session.message_count)}</span>
+ <Show when={handoffLabel()}>
+ {(label) => (
+ <>
+ <span aria-hidden="true">/</span>
+ <span class="truncate">{label()}</span>
+ </>
+ )}
+ </Show>
+ </div>
+ </button>
+ );
+ }}
+ </For>
+ </div>
+ </section>
</Show>
{/* Messages */}
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 5131df8c25..77e48f1219 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -204,7 +204,6 @@ vi.mock('../hooks/useChat', () => ({
vi.mock('../ChatMessages', () => ({
ChatMessages: (props: {
messages: ChatMessage[];
- emptyState?: { title: string; subtitle?: string };
onChangeModel?: () => void;
getModelRouteLabel?: (modelId: string) => string;
getModelRouteAlternative?: (message: ChatMessage) => ModelRouteRecoveryOption | null;
@@ -221,12 +220,6 @@ vi.mock('../ChatMessages', () => ({
mockChatMessagesProps.push(props);
return (
<div data-testid="chat-messages" data-msg-count={props.messages.length}>
- {props.emptyState?.title && (
- <span data-testid="empty-state-title">{props.emptyState.title}</span>
- )}
- {props.emptyState?.subtitle && (
- <span data-testid="empty-state-subtitle">{props.emptyState.subtitle}</span>
- )}
<button
type="button"
data-testid="mock-change-model"
@@ -1202,7 +1195,7 @@ describe('AIChat', () => {
).not.toBeInTheDocument();
});
- it('uses attached briefing context instead of product-authored empty-state prompts', () => {
+ it('uses the context strip instead of product-authored empty transcript prompts', () => {
mockAiChatStore.context = {
autonomousMode: false,
briefing: {
@@ -1214,10 +1207,11 @@ describe('AIChat', () => {
renderChat();
- expect(screen.getByText('Context attached')).toBeInTheDocument();
- expect(
- screen.getByText('Pulse Patrol · Patrol assessment attached · Coverage incomplete'),
- ).toBeInTheDocument();
+ expect(screen.getByText('Pulse Patrol')).toBeInTheDocument();
+ expect(screen.getByText('Coverage incomplete')).toBeInTheDocument();
+ expect(screen.getByText('Approval required before any action.')).toBeInTheDocument();
+ expect(screen.queryByText('Patrol assessment attached')).not.toBeInTheDocument();
+ expect(screen.queryByText('Ask about your infrastructure')).not.toBeInTheDocument();
expect(
screen.queryByRole('button', { name: 'Explain why coverage is incomplete' }),
).not.toBeInTheDocument();
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsx
index e66c0fa0c4..709be51c3f 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsx
@@ -85,69 +85,28 @@ function makeHandlers() {
}
describe('ChatMessages', () => {
- describe('empty state', () => {
- it('shows empty state when no messages and emptyState provided', () => {
- render(() => (
- <ChatMessages
- messages={[]}
- {...makeHandlers()}
- emptyState={{ title: 'Ask about your infrastructure' }}
- />
- ));
-
- expect(screen.getByText('Ask about your infrastructure')).toBeInTheDocument();
- });
-
- it('shows subtitle when provided in emptyState', () => {
- render(() => (
- <ChatMessages
- messages={[]}
- {...makeHandlers()}
- emptyState={{
- title: 'Welcome',
- subtitle: 'Ask me anything about your infrastructure',
- }}
- />
- ));
-
- expect(screen.getByText('Ask me anything about your infrastructure')).toBeInTheDocument();
- });
-
- it('does not show subtitle when not provided', () => {
- render(() => (
- <ChatMessages messages={[]} {...makeHandlers()} emptyState={{ title: 'Welcome' }} />
- ));
-
- expect(screen.getByText('Welcome')).toBeInTheDocument();
- expect(screen.queryByText('Ask me anything')).not.toBeInTheDocument();
- });
-
- it('does not show empty state when there are messages', () => {
- render(() => (
- <ChatMessages
- messages={[makeMessage()]}
- {...makeHandlers()}
- emptyState={{ title: 'Ask about your infrastructure' }}
- />
- ));
+ describe('empty transcript', () => {
+ it('keeps the transcript blank when there are no messages or resume actions', () => {
+ const { container } = render(() => <ChatMessages messages={[]} {...makeHandlers()} />);
expect(screen.queryByText('Ask about your infrastructure')).not.toBeInTheDocument();
+ expect(screen.queryByText('Chat with your configured model')).not.toBeInTheDocument();
+ expect(screen.queryByLabelText('Recent Assistant sessions')).not.toBeInTheDocument();
+ expect(container.querySelectorAll('[data-testid^="message-item-"]')).toHaveLength(0);
});
- it('does not show empty state when emptyState prop is not provided', () => {
- render(() => <ChatMessages messages={[]} {...makeHandlers()} />);
+ it('does not show empty transcript copy when there are messages', () => {
+ render(() => <ChatMessages messages={[makeMessage()]} {...makeHandlers()} />);
- expect(screen.queryByText('Welcome')).not.toBeInTheDocument();
- expect(screen.queryByText('Try asking')).not.toBeInTheDocument();
+ expect(screen.queryByText('Ask about your infrastructure')).not.toBeInTheDocument();
});
- it('shows recent sessions as resume actions in the empty state', () => {
+ it('shows recent sessions as resume actions in an empty transcript', () => {
const onLoadSession = vi.fn();
render(() => (
<ChatMessages
messages={[]}
{...makeHandlers()}
- emptyState={{ title: 'Ask about your infrastructure' }}
recentSessions={[
{
id: 'session-1',
@@ -193,7 +152,6 @@ describe('ChatMessages', () => {
<ChatMessages
messages={[makeMessage()]}
{...makeHandlers()}
- emptyState={{ title: 'Ask about your infrastructure' }}
recentSessions={[
{
id: 'session-1',
@@ -321,7 +279,7 @@ describe('ChatMessages', () => {
expect(anchor).toBeInTheDocument();
});
- it('renders no message items when messages is empty and no emptyState', () => {
+ it('renders no message items when messages is empty', () => {
const { container } = render(() => <ChatMessages messages={[]} {...makeHandlers()} />);
expect(container.querySelectorAll('[data-testid^="message-item-"]')).toHaveLength(0);
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index b53225211b..d50673b814 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -52,7 +52,6 @@ import {
AI_CHAT_SESSION_SEARCH_LOADING_STATE,
AI_CHAT_SESSION_SEARCH_PLACEHOLDER,
AI_CHAT_SESSION_SEARCH_TITLE,
- getAIChatEmptyStatePresentation,
getAIChatProviderReadinessPresentation,
} from '@/utils/aiChatPresentation';
import {
@@ -557,7 +556,6 @@ export const AIChat: Component<AIChatProps> = (props) => {
});
const byType = (type: Resource['type']) =>
allResources().filter((resource) => resource.type === type);
- const isCluster = createMemo(() => byType('agent').length > 1);
// @ mention autocomplete state
const [mentionActive, setMentionActive] = createSignal(false);
@@ -1328,13 +1326,6 @@ export const AIChat: Component<AIChatProps> = (props) => {
return '';
});
- const emptyStatePresentation = createMemo(() =>
- getAIChatEmptyStatePresentation({
- briefing: contextBriefing(),
- isCluster: isCluster(),
- }),
- );
-
const currentStatus = createMemo(() =>
getAssistantActiveTurnStatus(chat.messages(), chat.isLoading()),
);
@@ -2633,10 +2624,6 @@ export const AIChat: Component<AIChatProps> = (props) => {
.filter((s) => s.id !== chat.sessionId() && s.message_count > 0)
.slice(0, 3)}
onLoadSession={handleLoadSession}
- emptyState={{
- title: emptyStatePresentation().title,
- subtitle: emptyStatePresentation().subtitle,
- }}
/>
{/* Status indicator bar */}
diff --git a/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
index 75534522e7..46b53cc583 100644
--- a/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
@@ -6,8 +6,6 @@ import {
AI_CHAT_DISCOVERY_HINT_TITLE,
AI_CHAT_DRAWER_SUBTITLE,
AI_CHAT_DRAWER_TITLE,
- AI_CHAT_EMPTY_STATE_SUBTITLE,
- AI_CHAT_EMPTY_STATE_TITLE,
AI_CHAT_LAUNCHER_ARIA_LABEL,
AI_CHAT_LAST_TURN_USAGE_LABEL,
AI_CHAT_MODEL_SELECTOR_EMPTY_STATE,
@@ -27,7 +25,6 @@ import {
AI_CHAT_SESSION_SEARCH_TITLE,
getAIChatProviderReadinessPresentation,
getAIChatLauncherTitle,
- getAIChatEmptyStatePresentation,
} from '@/utils/aiChatPresentation';
describe('aiChatPresentation', () => {
@@ -40,10 +37,6 @@ describe('aiChatPresentation', () => {
expect(AI_CHAT_DISCOVERY_HINT_BODY).toBe(
'Enable it in Settings so Pulse Assistant can reference real services, versions, and commands instead of generic guidance.',
);
- expect(AI_CHAT_EMPTY_STATE_TITLE).toBe('Ask about your infrastructure');
- expect(AI_CHAT_EMPTY_STATE_SUBTITLE).toBe(
- 'Chat with your configured model using Pulse context and governed tools.',
- );
expect(AI_CHAT_NEW_SESSION_SHORT_LABEL).toBe('New');
expect(AI_CHAT_NEW_SESSION_MENU_LABEL).toBe('New session');
expect(AI_CHAT_LAUNCHER_ARIA_LABEL).toBe('Expand Pulse Assistant');
@@ -71,22 +64,6 @@ describe('aiChatPresentation', () => {
expect(getAIChatLauncherTitle()).not.toContain('⌘K');
});
- it('uses attached briefing context for scoped assistant handoff empty states', () => {
- expect(
- getAIChatEmptyStatePresentation({
- isCluster: true,
- briefing: {
- sourceLabel: 'Pulse Patrol',
- title: 'Patrol assessment attached',
- subject: 'Coverage incomplete',
- },
- }),
- ).toEqual({
- title: 'Context attached',
- subtitle: 'Pulse Patrol · Patrol assessment attached · Coverage incomplete',
- });
- });
-
it('builds neutral provider readiness presentation copy for Assistant checks', () => {
expect(
getAIChatProviderReadinessPresentation({
diff --git a/frontend-modern/src/utils/aiChatPresentation.ts b/frontend-modern/src/utils/aiChatPresentation.ts
index 57ac012bce..4a91ce0eda 100644
--- a/frontend-modern/src/utils/aiChatPresentation.ts
+++ b/frontend-modern/src/utils/aiChatPresentation.ts
@@ -18,9 +18,6 @@ export const AI_CHAT_MODEL_SELECTOR_EMPTY_STATE = 'No matching models.';
export const AI_CHAT_DISCOVERY_HINT_TITLE = 'Workload Discovery is off.';
export const AI_CHAT_DISCOVERY_HINT_BODY =
'Enable it in Settings so Pulse Assistant can reference real services, versions, and commands instead of generic guidance.';
-export const AI_CHAT_EMPTY_STATE_TITLE = 'Ask about your infrastructure';
-export const AI_CHAT_EMPTY_STATE_SUBTITLE =
- 'Chat with your configured model using Pulse context and governed tools.';
export const AI_CHAT_INPUT_PLACEHOLDER = 'Ask about your infrastructure...';
export const AI_CHAT_QUESTION_CARD_TITLE = 'Pulse Assistant needs your input';
export const AI_CHAT_QUESTION_CARD_PLACEHOLDER = 'Type your answer...';
@@ -31,17 +28,6 @@ export const AI_CHAT_PROVIDER_READINESS_SETTINGS_HREF = '/settings/system-ai';
export const AI_CHAT_PROVIDER_READINESS_SETTINGS_LABEL = 'Open settings';
export const AI_CHAT_PROVIDER_READINESS_RETRY_LABEL = 'Retry';
-export interface AIChatEmptyStateBriefingInput {
- sourceLabel?: string;
- subject?: string;
- title?: string;
-}
-
-export interface AIChatEmptyStatePresentation {
- subtitle?: string;
- title: string;
-}
-
export type AIChatProviderReadinessStatus = 'checking' | 'error';
export interface AIChatProviderReadinessPresentation {
@@ -59,28 +45,6 @@ export function getAIChatLauncherTitle(contextName?: unknown) {
return 'Open Pulse Assistant';
}
-export function getAIChatEmptyStatePresentation(args: {
- briefing?: AIChatEmptyStateBriefingInput;
- isCluster: boolean;
-}): AIChatEmptyStatePresentation {
- const sourceLabel = args.briefing?.sourceLabel?.trim();
- const title = args.briefing?.title?.trim();
- const subject = args.briefing?.subject?.trim();
- void args.isCluster;
-
- if (args.briefing && (sourceLabel || title || subject)) {
- return {
- title: 'Context attached',
- subtitle: [sourceLabel, title, subject].filter(Boolean).join(' · ') || undefined,
- };
- }
-
- return {
- title: AI_CHAT_EMPTY_STATE_TITLE,
- subtitle: AI_CHAT_EMPTY_STATE_SUBTITLE,
- };
-}
-
export function getAIChatProviderReadinessPresentation(args: {
message?: string;
providerLabel?: string;