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 Assistant status command

rcourtman908c4278d839
diff --git a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
index ca48c04d41..b42edcb1a2 100644
--- a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
+++ b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
@@ -1,10 +1,13 @@
import { For, Show, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';
+import ActivityIcon from 'lucide-solid/icons/activity';
import ClockIcon from 'lucide-solid/icons/clock';
import CopyIcon from 'lucide-solid/icons/copy';
import DownloadIcon from 'lucide-solid/icons/download';
import GitForkIcon from 'lucide-solid/icons/git-fork';
import PlusIcon from 'lucide-solid/icons/plus';
+import Redo2Icon from 'lucide-solid/icons/redo-2';
import SettingsIcon from 'lucide-solid/icons/settings';
+import Undo2Icon from 'lucide-solid/icons/undo-2';
import type { AssistantSlashCommand, AssistantSlashCommandAction } from './assistantSlashCommands';
import {
filterAssistantSlashCommands,
@@ -27,12 +30,18 @@ const commandIcon = (action: AssistantSlashCommandAction) => {
return <ClockIcon class="h-4 w-4" aria-hidden="true" />;
case 'models':
return <SettingsIcon class="h-4 w-4" aria-hidden="true" />;
+ case 'status':
+ return <ActivityIcon class="h-4 w-4" aria-hidden="true" />;
case 'copy':
return <CopyIcon class="h-4 w-4" aria-hidden="true" />;
case 'export':
return <DownloadIcon class="h-4 w-4" aria-hidden="true" />;
case 'fork':
return <GitForkIcon class="h-4 w-4" aria-hidden="true" />;
+ case 'undo':
+ return <Undo2Icon class="h-4 w-4" aria-hidden="true" />;
+ case 'redo':
+ return <Redo2Icon class="h-4 w-4" aria-hidden="true" />;
}
};
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 989ef48973..22891ce60e 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -133,7 +133,7 @@ const {
commandRequestSignal: vi.fn(
(): {
id: number;
- action: 'new' | 'sessions' | 'models' | 'undo' | 'redo';
+ action: 'new' | 'sessions' | 'models' | 'status' | 'undo' | 'redo';
} | null => null,
),
ackCommandRequest: vi.fn(),
@@ -1714,6 +1714,55 @@ describe('AIChat', () => {
expect(mockChat.sendMessage).not.toHaveBeenCalled();
});
+ it('checks selected provider status from /status without sending a provider prompt', async () => {
+ mockAIAPI.getSettings.mockResolvedValue({
+ model: 'openrouter:deepseek/deepseek-v4-pro',
+ chat_model: '',
+ control_level: 'read_only',
+ autonomous_mode: false,
+ discovery_enabled: true,
+ });
+ mockAIAPI.testProvider.mockResolvedValue({
+ success: true,
+ message: 'Connection successful',
+ provider: 'openrouter',
+ model: 'openrouter:deepseek/deepseek-v4-pro',
+ });
+
+ renderChat();
+
+ await waitFor(() => {
+ expect(mockAIAPI.testProvider).toHaveBeenCalledWith(
+ 'openrouter',
+ 'openrouter:deepseek/deepseek-v4-pro',
+ );
+ });
+ expect(screen.queryByLabelText('Assistant provider status')).not.toBeInTheDocument();
+ mockAIAPI.testProvider.mockClear();
+
+ const textarea = screen.getByPlaceholderText('Ask about your infrastructure...');
+ fireEvent.input(textarea, { target: { value: '/status' } });
+ fireEvent.keyDown(textarea, { key: 'Enter' });
+
+ await waitFor(() => {
+ expect(mockAIAPI.testProvider).toHaveBeenCalledWith(
+ 'openrouter',
+ 'openrouter:deepseek/deepseek-v4-pro',
+ );
+ });
+
+ await waitFor(() => {
+ expect(screen.getByLabelText('Assistant provider status')).toHaveTextContent(
+ 'OpenRouter provider ready',
+ );
+ });
+ const status = screen.getByLabelText('Assistant provider status');
+ expect(status).toHaveTextContent('Connection successful');
+ expect(status).toHaveTextContent('Route:');
+ expect(screen.getByRole('button', { name: 'Hide provider status' })).toBeInTheDocument();
+ expect(mockChat.sendMessage).not.toHaveBeenCalled();
+ });
+
it('consumes pending command palette model requests without sending a provider prompt', async () => {
mockAiChatStore.commandRequestSignal.mockReturnValue({ id: 42, action: 'models' });
renderChat();
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
index e7c47eea55..c5696754ee 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
@@ -15,6 +15,9 @@ describe('assistantSlashCommands', () => {
expect(parseAssistantSlashCommand('/models')).toBe('models');
expect(parseAssistantSlashCommand('/model')).toBe('models');
expect(parseAssistantSlashCommand('/mo')).toBe('models');
+ expect(parseAssistantSlashCommand('/status')).toBe('status');
+ expect(parseAssistantSlashCommand('/runtime')).toBe('status');
+ expect(parseAssistantSlashCommand('/health')).toBe('status');
expect(parseAssistantSlashCommand('/copy')).toBe('copy');
expect(parseAssistantSlashCommand('/export')).toBe('export');
expect(parseAssistantSlashCommand('/fork')).toBe('fork');
@@ -38,6 +41,7 @@ describe('assistantSlashCommands', () => {
'new',
'sessions',
'models',
+ 'status',
'copy',
'export',
'fork',
@@ -50,6 +54,9 @@ describe('assistantSlashCommands', () => {
expect(filterAssistantSlashCommands('provider').map((command) => command.name)).toEqual([
'models',
]);
+ expect(filterAssistantSlashCommands('runtime').map((command) => command.name)).toEqual([
+ 'status',
+ ]);
});
it('exposes canonical and alias tokens for the picker', () => {
@@ -57,5 +64,7 @@ describe('assistantSlashCommands', () => {
expect(getAssistantSlashCommandTokens(sessions)).toEqual(['sessions', 'resume', 'continue']);
const models = filterAssistantSlashCommands('mo')[0];
expect(getAssistantSlashCommandTokens(models)).toEqual(['models', 'model', 'mo']);
+ const status = filterAssistantSlashCommands('status')[0];
+ expect(getAssistantSlashCommandTokens(status)).toEqual(['status', 'runtime', 'health']);
});
});
diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
index 9af3e37876..1d757a5672 100644
--- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
+++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
@@ -5,6 +5,7 @@ export type AssistantSlashCommandAction =
| 'models'
| 'new'
| 'redo'
+ | 'status'
| 'undo'
| 'sessions';
@@ -34,6 +35,12 @@ export const ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [
action: 'models',
description: 'Choose the model and provider route',
},
+ {
+ name: 'status',
+ aliases: ['runtime', 'health'],
+ action: 'status',
+ description: 'Check the selected model route',
+ },
{
name: 'copy',
action: 'copy',
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index 43b6e06c74..a2bab4cf96 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -642,6 +642,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
status: 'idle',
provider: '',
});
+ const [providerReadinessVisible, setProviderReadinessVisible] = createSignal(false);
const [providerReadinessRetryNonce, setProviderReadinessRetryNonce] = createSignal(0);
const [controlLevel, setControlLevel] = createSignal<AIControlLevel>('read_only');
const [showControlMenu, setShowControlMenu] = createSignal(false);
@@ -1566,14 +1567,24 @@ export const AIChat: Component<AIChatProps> = (props) => {
const providerReadinessPresentation = createMemo(() => {
const readiness = providerReadiness();
- if (!readiness.provider || readiness.status === 'idle' || readiness.status === 'ready') {
+ const visible = providerReadinessVisible();
+ if (!readiness.provider || readiness.status === 'idle') {
return null;
}
- if (readiness.status === 'checking' && !chat.isLoading()) {
+ if (readiness.status === 'ready' && !visible) {
return null;
}
+ if (readiness.status === 'checking' && !chat.isLoading() && !visible) {
+ return null;
+ }
+
return getAIChatProviderReadinessPresentation({
- status: readiness.status === 'checking' ? 'checking' : 'error',
+ status:
+ readiness.status === 'ready'
+ ? 'ready'
+ : readiness.status === 'checking'
+ ? 'checking'
+ : 'error',
providerLabel: getAIProviderDisplayName(readiness.provider),
message: readiness.message,
summary: readiness.summary,
@@ -1631,6 +1642,34 @@ export const AIChat: Component<AIChatProps> = (props) => {
focusComposer();
};
+ const runSelectedProviderStatusCheck = () => {
+ setShowSessions(false);
+ setSessionRefreshLoading(false);
+ resetSessionSearch();
+ setProviderReadinessVisible(true);
+
+ const model = selectedChatModel().trim();
+ const provider = selectedChatProvider().trim();
+
+ if (!provider || !model) {
+ providerReadinessRequestId += 1;
+ lastProviderReadinessKey = '';
+ setProviderReadiness({
+ status: 'error',
+ provider: provider || 'Selected',
+ model,
+ message: 'No provider route selected',
+ summary: 'Pulse does not have a selected Assistant model route to check.',
+ recommendation: 'Choose an Assistant model route, then run /status again.',
+ action: 'open_provider_settings',
+ });
+ return;
+ }
+
+ lastProviderReadinessKey = '';
+ void refreshSelectedProviderReadiness(provider, model);
+ };
+
const isOverlayLayout = createMemo(() => width() < AI_CHAT_MIN_DOCKED_VIEWPORT_WIDTH);
const rootClassName = createMemo(() => {
if (isOverlayLayout()) {
@@ -1970,6 +2009,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
if (!open) {
providerReadinessRequestId += 1;
lastProviderReadinessKey = '';
+ setProviderReadinessVisible(false);
setProviderReadiness({ status: 'idle', provider: '' });
return;
}
@@ -1977,6 +2017,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
if (!provider || !model) {
providerReadinessRequestId += 1;
lastProviderReadinessKey = '';
+ setProviderReadinessVisible(false);
setProviderReadiness({ status: 'idle', provider: '' });
return;
}
@@ -2385,6 +2426,9 @@ export const AIChat: Component<AIChatProps> = (props) => {
resetSessionSearch();
setModelSelectorOpenRequest((value) => value + 1);
break;
+ case 'status':
+ runSelectedProviderStatusCheck();
+ break;
case 'copy':
void copyAssistantTranscript();
break;
@@ -3558,7 +3602,9 @@ export const AIChat: Component<AIChatProps> = (props) => {
class={`border-b px-4 py-2.5 text-[11px] ${
presentation().tone === 'checking'
? 'border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200'
- : 'border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100'
+ : presentation().tone === 'ready'
+ ? 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-800 dark:bg-emerald-950 dark:text-emerald-100'
+ : 'border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100'
}`}
aria-label="Assistant provider status"
>
@@ -3568,18 +3614,27 @@ export const AIChat: Component<AIChatProps> = (props) => {
class={`mt-1 h-2 w-2 flex-shrink-0 rounded-full ${
presentation().tone === 'checking'
? 'bg-blue-500 dark:bg-blue-300'
- : 'bg-amber-500 dark:bg-amber-300'
+ : presentation().tone === 'ready'
+ ? 'bg-emerald-500 dark:bg-emerald-300'
+ : 'bg-amber-500 dark:bg-amber-300'
}`}
/>
<div class="min-w-0">
<div class="font-semibold text-base-content">{presentation().title}</div>
<div class="mt-0.5 leading-5">{presentation().body}</div>
+ <Show when={providerReadiness().model}>
+ {(model) => (
+ <div class="mt-0.5 truncate text-[10px] leading-5 text-muted">
+ Route: {formatAIModelRouteLabel(model())}
+ </div>
+ )}
+ </Show>
<Show when={presentation().recommendation}>
{(recommendation) => <div class="mt-0.5 leading-5">{recommendation()}</div>}
</Show>
</div>
</div>
- <Show when={providerReadiness().status === 'error'}>
+ <Show when={providerReadiness().status === 'error' || providerReadinessVisible()}>
<div class="flex flex-wrap items-center gap-2 sm:justify-end">
<Show when={providerReadinessAlternative()}>
{(alternative) => (
@@ -3597,7 +3652,8 @@ export const AIChat: Component<AIChatProps> = (props) => {
<button
type="button"
onClick={retrySelectedProviderReadiness}
- class="inline-flex items-center gap-1.5 rounded-md border border-current/20 bg-surface px-2 py-1 text-[10px] font-medium text-base-content hover:bg-surface-hover"
+ disabled={providerReadiness().status === 'checking'}
+ class="inline-flex items-center gap-1.5 rounded-md border border-current/20 bg-surface px-2 py-1 text-[10px] font-medium text-base-content hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60"
aria-label="Retry provider check"
>
<RefreshCwIcon class="h-3.5 w-3.5" />
@@ -3610,6 +3666,17 @@ export const AIChat: Component<AIChatProps> = (props) => {
<SettingsIcon class="h-3.5 w-3.5" />
<span>{AI_CHAT_PROVIDER_READINESS_SETTINGS_LABEL}</span>
</a>
+ <Show when={providerReadinessVisible()}>
+ <button
+ type="button"
+ onClick={() => setProviderReadinessVisible(false)}
+ class="inline-flex items-center gap-1.5 rounded-md border border-current/20 bg-surface px-2 py-1 text-[10px] font-medium text-base-content hover:bg-surface-hover"
+ aria-label="Hide provider status"
+ >
+ <XIcon class="h-3.5 w-3.5" />
+ <span>Hide</span>
+ </button>
+ </Show>
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
index ab095e549a..b201f727a3 100644
--- a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
@@ -85,6 +85,7 @@ describe('CommandPaletteModal', () => {
expect(commandPaletteModelSource).toContain("id: 'assistant-open'");
expect(commandPaletteModelSource).toContain("id: 'assistant-switch-session'");
expect(commandPaletteModelSource).toContain("id: 'assistant-switch-model'");
+ expect(commandPaletteModelSource).toContain("id: 'assistant-status'");
expect(commandPaletteModelSource).toContain("id: 'assistant-undo-last-turn'");
expect(commandPaletteModelSource).toContain("id: 'assistant-redo-last-turn'");
expect(commandPaletteModelSource).not.toContain("id: 'nav-infrastructure'");
@@ -106,6 +107,7 @@ describe('CommandPaletteModal', () => {
expect(screen.getByText('New Assistant session')).toBeInTheDocument();
expect(screen.getByText('Switch Assistant session')).toBeInTheDocument();
expect(screen.getByText('Switch Assistant model')).toBeInTheDocument();
+ expect(screen.getByText('Check Assistant status')).toBeInTheDocument();
expect(screen.getByText('Undo last Assistant turn')).toBeInTheDocument();
expect(screen.getByText('Redo last Assistant turn')).toBeInTheDocument();
expect(screen.getByText('Go to Machines')).toBeInTheDocument();
@@ -150,6 +152,25 @@ describe('CommandPaletteModal', () => {
});
});
+ it('routes Assistant status workflow commands through the Assistant store', async () => {
+ const onClose = vi.fn();
+ const requestCommand = vi.spyOn(aiChatStore, 'requestCommand').mockImplementation(() => {});
+ render(() => (
+ <CommandPaletteModal
+ isOpen={true}
+ onClose={onClose}
+ platformVisibility={platformVisibility}
+ />
+ ));
+
+ await fireEvent.click(screen.getByText('Check Assistant status'));
+
+ expect(onClose).toHaveBeenCalledTimes(1);
+ await waitFor(() => {
+ expect(requestCommand).toHaveBeenCalledWith('status');
+ });
+ });
+
it('routes Assistant undo workflow commands through the Assistant store', async () => {
const onClose = vi.fn();
const requestCommand = vi.spyOn(aiChatStore, 'requestCommand').mockImplementation(() => {});
diff --git a/frontend-modern/src/components/shared/commandPaletteModel.ts b/frontend-modern/src/components/shared/commandPaletteModel.ts
index 8a834bd377..8eedcc1114 100644
--- a/frontend-modern/src/components/shared/commandPaletteModel.ts
+++ b/frontend-modern/src/components/shared/commandPaletteModel.ts
@@ -34,6 +34,7 @@ export type CommandPaletteAssistantActions = {
newSession: () => void;
sessions: () => void;
models: () => void;
+ status: () => void;
undo: () => void;
redo: () => void;
};
@@ -76,6 +77,13 @@ export function buildCommandPaletteCommands(options: {
keywords: ['assistant', 'models', 'model', 'provider', 'openrouter', 'deepseek'],
action: options.assistantActions.models,
},
+ {
+ id: 'assistant-status',
+ label: 'Check Assistant status',
+ description: '/status',
+ keywords: ['assistant', 'status', 'runtime', 'health', 'provider', 'openrouter', 'deepseek'],
+ action: options.assistantActions.status,
+ },
{
id: 'assistant-undo-last-turn',
label: 'Undo last Assistant turn',
diff --git a/frontend-modern/src/components/shared/useCommandPaletteState.ts b/frontend-modern/src/components/shared/useCommandPaletteState.ts
index 78eb758fac..02f0586d56 100644
--- a/frontend-modern/src/components/shared/useCommandPaletteState.ts
+++ b/frontend-modern/src/components/shared/useCommandPaletteState.ts
@@ -50,6 +50,7 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) {
newSession: () => requestAssistantCommand('new'),
sessions: () => requestAssistantCommand('sessions'),
models: () => requestAssistantCommand('models'),
+ status: () => requestAssistantCommand('status'),
undo: () => requestAssistantCommand('undo'),
redo: () => requestAssistantCommand('redo'),
},
diff --git a/frontend-modern/src/stores/__tests__/aiChat.test.ts b/frontend-modern/src/stores/__tests__/aiChat.test.ts
index 09995fded7..33ec57c036 100644
--- a/frontend-modern/src/stores/__tests__/aiChat.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiChat.test.ts
@@ -53,6 +53,9 @@ describe('aiChatStore', () => {
aiChatStore.requestCommand('undo');
expect(aiChatStore.commandRequest).toMatchObject({ action: 'undo' });
+
+ aiChatStore.requestCommand('status');
+ expect(aiChatStore.commandRequest).toMatchObject({ action: 'status' });
});
it('sets legacy context and clears it', () => {
diff --git a/frontend-modern/src/stores/aiChat.ts b/frontend-modern/src/stores/aiChat.ts
index 5d85d8f3aa..11eaaad286 100644
--- a/frontend-modern/src/stores/aiChat.ts
+++ b/frontend-modern/src/stores/aiChat.ts
@@ -78,7 +78,13 @@ export interface AIChatContext {
autonomousMode?: boolean;
}
-export type AIChatCommandRequestAction = 'new' | 'sessions' | 'models' | 'undo' | 'redo';
+export type AIChatCommandRequestAction =
+ | 'new'
+ | 'sessions'
+ | 'models'
+ | 'status'
+ | 'undo'
+ | 'redo';
export interface AIChatCommandRequest {
id: number;
diff --git a/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
index ec09480526..91cbbc632d 100644
--- a/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
@@ -137,5 +137,17 @@ describe('aiChatPresentation', () => {
providerLabel: 'OpenRouter',
}).title,
).toBe('Verifying OpenRouter provider');
+
+ expect(
+ getAIChatProviderReadinessPresentation({
+ status: 'ready',
+ providerLabel: 'OpenRouter',
+ message: 'Connection successful',
+ }),
+ ).toEqual({
+ tone: 'ready',
+ title: 'OpenRouter provider ready',
+ body: 'Connection successful',
+ });
});
});
diff --git a/frontend-modern/src/utils/aiChatPresentation.ts b/frontend-modern/src/utils/aiChatPresentation.ts
index b4c138bcc5..d9aa07ebf9 100644
--- a/frontend-modern/src/utils/aiChatPresentation.ts
+++ b/frontend-modern/src/utils/aiChatPresentation.ts
@@ -66,7 +66,7 @@ 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 type AIChatProviderReadinessStatus = 'checking' | 'error';
+export type AIChatProviderReadinessStatus = 'checking' | 'ready' | 'error';
export interface AIChatProviderReadinessPresentation {
body: string;
@@ -99,6 +99,17 @@ export function getAIChatProviderReadinessPresentation(args: {
};
}
+ if (args.status === 'ready') {
+ return {
+ tone: 'ready',
+ title: `${providerLabel} provider ready`,
+ body:
+ args.summary?.trim() ||
+ args.message?.trim() ||
+ 'Pulse can reach the selected provider route.',
+ };
+ }
+
const body =
args.summary?.trim() ||
args.message?.trim() ||