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
Add Assistant command palette workflows
rcourtman9e7a42b7bf70
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsxindex 878269319e..2728b77827 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx@@ -128,6 +128,10 @@ const {const mockAiChatStore = {isOpenSignal: vi.fn(() => true),+ commandRequestSignal: vi.fn((): { id: number; action: 'new' | 'sessions' | 'models' } | null =>+ null,+ ),+ ackCommandRequest: vi.fn(),context: emptyChatContext() as {targetType?: string;targetId?: string;@@ -397,6 +401,7 @@ beforeEach(() => {setViewportWidth(1440);resetAIRuntimeState();mockAiChatStore.isOpenSignal.mockReturnValue(true);+ mockAiChatStore.commandRequestSignal.mockReturnValue(null);mockAiChatStore.context = {findingId: undefined,autonomousMode: undefined,@@ -1702,6 +1707,17 @@ describe('AIChat', () => {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();++ await waitFor(() => {+ expect(screen.getByTestId('model-selector')).toHaveAttribute('data-open-request', '1');+ });+ expect(mockAiChatStore.ackCommandRequest).toHaveBeenCalledWith(42);+ expect(mockChat.sendMessage).not.toHaveBeenCalled();+ });+it('copies the transcript from /copy without sending a provider prompt', async () => {const writeText = vi.fn().mockResolvedValue(undefined);Object.defineProperty(navigator, 'clipboard', {diff --git a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.tsindex a01c18437b..5b285ba9cb 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts@@ -14,6 +14,7 @@ describe('assistantSlashCommands', () => {expect(parseAssistantSlashCommand('/continue')).toBe('sessions');expect(parseAssistantSlashCommand('/models')).toBe('models');expect(parseAssistantSlashCommand('/model')).toBe('models');+ expect(parseAssistantSlashCommand('/mo')).toBe('models');expect(parseAssistantSlashCommand('/copy')).toBe('copy');expect(parseAssistantSlashCommand('/export')).toBe('export');expect(parseAssistantSlashCommand('/fork')).toBe('fork');@@ -50,5 +51,7 @@ describe('assistantSlashCommands', () => {it('exposes canonical and alias tokens for the picker', () => {const sessions = filterAssistantSlashCommands('resume')[0];expect(getAssistantSlashCommandTokens(sessions)).toEqual(['sessions', 'resume', 'continue']);+ const models = filterAssistantSlashCommands('mo')[0];+ expect(getAssistantSlashCommandTokens(models)).toEqual(['models', 'model', 'mo']);});});diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.tsindex da6bead59c..2ef428ecaf 100644--- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts+++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts@@ -28,7 +28,7 @@ export const ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [},{name: 'models',- aliases: ['model'],+ aliases: ['model', 'mo'],action: 'models',description: 'Choose the model and provider route',},diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsxindex 04727b7095..cfb0235153 100644--- a/frontend-modern/src/components/AI/Chat/index.tsx+++ b/frontend-modern/src/components/AI/Chat/index.tsx@@ -645,6 +645,7 @@ export const AIChat: Component<AIChatProps> = (props) => {let transcriptFallbackTextareaRef: HTMLTextAreaElement | undefined;let interruptArmTimeout: ReturnType<typeof setTimeout> | undefined;let composerSubmitDispatchLocked = false;+ let handledAssistantCommandRequestId = 0;const focusComposer = () => {queueMicrotask(() => {@@ -2273,6 +2274,15 @@ export const AIChat: Component<AIChatProps> = (props) => {}};+ createEffect(() => {+ const request = aiChatStore.commandRequestSignal?.();+ if (!request || request.id === handledAssistantCommandRequestId || !isOpen()) return;++ handledAssistantCommandRequestId = request.id;+ executeSlashCommand(request.action);+ aiChatStore.ackCommandRequest?.(request.id);+ });+// Handle submitconst handleSubmit = () => {if (composerSubmitDispatchLocked) return;diff --git a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsxindex 1a4b3ed60c..ac38ee834a 100644--- a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx@@ -1,11 +1,12 @@import { afterEach, describe, expect, it, vi } from 'vitest';-import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';import type { JSX } from 'solid-js';import type { Resource } from '@/types/resource';import commandPaletteModalSource from '@/components/shared/CommandPaletteModal.tsx?raw';import commandPaletteModelSource from '@/components/shared/commandPaletteModel.ts?raw';import commandPaletteStateSource from '@/components/shared/useCommandPaletteState.ts?raw';import { buildPrimaryPlatformNavigationVisibility } from '@/features/platformNavigation/platformNavigationModel';+import { aiChatStore } from '@/stores/aiChat';const navigateMock = vi.fn();@@ -47,6 +48,7 @@ describe('CommandPaletteModal', () => {afterEach(() => {cleanup();navigateMock.mockReset();+ vi.restoreAllMocks();});it('keeps the command palette on shell, runtime, and model owners', () => {@@ -60,6 +62,7 @@ describe('CommandPaletteModal', () => {expect(commandPaletteStateSource).toContain('buildStandalonePath');expect(commandPaletteStateSource).toContain('buildProxmoxPath');expect(commandPaletteStateSource).toContain('export function useCommandPaletteState');+ expect(commandPaletteStateSource).toContain('aiChatStore.requestCommand');// Infrastructure and aggregate workspaces are not command-palette routes;// platform/runtime pages own those workflows.@@ -79,6 +82,9 @@ describe('CommandPaletteModal', () => {expect(commandPaletteModelSource).toContain("id: 'nav-truenas'");expect(commandPaletteModelSource).toContain("id: 'nav-vmware'");expect(commandPaletteModelSource).toContain("id: 'nav-vmware-networks'");+ expect(commandPaletteModelSource).toContain("id: 'assistant-open'");+ expect(commandPaletteModelSource).toContain("id: 'assistant-switch-session'");+ expect(commandPaletteModelSource).toContain("id: 'assistant-switch-model'");expect(commandPaletteModelSource).not.toContain("id: 'nav-infrastructure'");expect(commandPaletteModelSource).not.toContain("id: 'nav-workloads'");expect(commandPaletteModelSource).not.toContain("id: 'nav-storage'");@@ -94,6 +100,10 @@ describe('CommandPaletteModal', () => {/>));+ expect(screen.getByText('Open Pulse Assistant')).toBeInTheDocument();+ expect(screen.getByText('New Assistant session')).toBeInTheDocument();+ expect(screen.getByText('Switch Assistant session')).toBeInTheDocument();+ expect(screen.getByText('Switch Assistant model')).toBeInTheDocument();expect(screen.getByText('Go to Machines')).toBeInTheDocument();expect(screen.getByText('/standalone/machines')).toBeInTheDocument();expect(screen.getByText('Go to Proxmox')).toBeInTheDocument();@@ -111,11 +121,50 @@ describe('CommandPaletteModal', () => {expect(screen.getByText('/vmware/networks')).toBeInTheDocument();const commandLabels = screen.getAllByRole('button').map((button) => button.textContent ?? '');+ expect(commandLabels.findIndex((label) => label.includes('Open Pulse Assistant'))).toBe(0);expect(commandLabels.findIndex((label) => label.includes('Go to Proxmox'))).toBeLessThan(commandLabels.findIndex((label) => label.includes('Go to Machines')),);});+ it('routes Assistant model 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('Switch Assistant model'));++ expect(onClose).toHaveBeenCalledTimes(1);+ await waitFor(() => {+ expect(requestCommand).toHaveBeenCalledWith('models');+ });+ });++ it('opens Pulse Assistant from the command palette after closing the palette', async () => {+ const onClose = vi.fn();+ const openAssistant = vi.spyOn(aiChatStore, 'open').mockImplementation(() => {});+ render(() => (+ <CommandPaletteModal+ isOpen={true}+ onClose={onClose}+ platformVisibility={platformVisibility}+ />+ ));++ await fireEvent.click(screen.getByText('Open Pulse Assistant'));++ expect(onClose).toHaveBeenCalledTimes(1);+ await waitFor(() => {+ expect(openAssistant).toHaveBeenCalledWith();+ });+ });+it('navigates to the Kubernetes workloads tab', async () => {const onClose = vi.fn();render(() => (diff --git a/frontend-modern/src/components/shared/commandPaletteModel.ts b/frontend-modern/src/components/shared/commandPaletteModel.tsindex 6b23bdd331..abab3f3506 100644--- a/frontend-modern/src/components/shared/commandPaletteModel.ts+++ b/frontend-modern/src/components/shared/commandPaletteModel.ts@@ -29,13 +29,54 @@ export type CommandPaletteCommandPaths = {vmwareNetworksPath: string;};+export type CommandPaletteAssistantActions = {+ open: () => void;+ newSession: () => void;+ sessions: () => void;+ models: () => void;+};+export function buildCommandPaletteCommands(options: {paths: CommandPaletteCommandPaths;platformVisibility: PlatformNavigationVisibility;navigate: (path: string) => void;+ assistantActions?: CommandPaletteAssistantActions;}): CommandPaletteModalCommand[] {const commands: CommandPaletteModalCommand[] = [];+ if (options.assistantActions) {+ commands.push(+ {+ id: 'assistant-open',+ label: 'Open Pulse Assistant',+ description: 'Chat with Pulse about this infrastructure',+ keywords: ['assistant', 'ai', 'chat', 'ask', 'pulse'],+ action: options.assistantActions.open,+ },+ {+ id: 'assistant-new-session',+ label: 'New Assistant session',+ description: '/new',+ keywords: ['assistant', 'chat', 'new', 'clear', 'session'],+ action: options.assistantActions.newSession,+ },+ {+ id: 'assistant-switch-session',+ label: 'Switch Assistant session',+ description: '/sessions',+ keywords: ['assistant', 'sessions', 'resume', 'continue', 'history'],+ action: options.assistantActions.sessions,+ },+ {+ id: 'assistant-switch-model',+ label: 'Switch Assistant model',+ description: '/models',+ keywords: ['assistant', 'models', 'model', 'provider', 'openrouter', 'deepseek'],+ action: options.assistantActions.models,+ },+ );+ }+if (primaryPlatformNavigationIsVisible(options.platformVisibility, 'proxmox')) {commands.push({id: 'nav-proxmox',diff --git a/frontend-modern/src/components/shared/useCommandPaletteState.ts b/frontend-modern/src/components/shared/useCommandPaletteState.tsindex 2727cccb50..c420bd229b 100644--- a/frontend-modern/src/components/shared/useCommandPaletteState.ts+++ b/frontend-modern/src/components/shared/useCommandPaletteState.ts@@ -8,6 +8,7 @@ import {buildTrueNASPath,buildVmwarePath,} from '@/routing/resourceLinks';+import { aiChatStore, type AIChatCommandRequestAction } from '@/stores/aiChat';import {buildCommandPaletteCommands,filterCommandPaletteCommands,@@ -17,11 +18,19 @@ import {export type { CommandPaletteModalCommand, CommandPaletteModalProps } from './commandPaletteModel';+const runAfterPaletteSelection = (action: () => void) => {+ queueMicrotask(action);+};+export function useCommandPaletteState(props: CommandPaletteModalProps) {const navigate = useNavigate();const [query, setQuery] = createSignal('');const [inputRef, setInputRef] = createSignal<HTMLInputElement>();+ const requestAssistantCommand = (action: AIChatCommandRequestAction) => {+ runAfterPaletteSelection(() => aiChatStore.requestCommand(action));+ };+const commands = createMemo(() =>buildCommandPaletteCommands({paths: {@@ -36,6 +45,12 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) {},platformVisibility: props.platformVisibility(),navigate,+ assistantActions: {+ open: () => runAfterPaletteSelection(() => aiChatStore.open()),+ newSession: () => requestAssistantCommand('new'),+ sessions: () => requestAssistantCommand('sessions'),+ models: () => requestAssistantCommand('models'),+ },}),);diff --git a/frontend-modern/src/stores/__tests__/aiChat.test.ts b/frontend-modern/src/stores/__tests__/aiChat.test.tsindex 58282f63dd..8061e2e81a 100644--- a/frontend-modern/src/stores/__tests__/aiChat.test.ts+++ b/frontend-modern/src/stores/__tests__/aiChat.test.ts@@ -11,6 +11,10 @@ const aiChatSource = readFileSync(describe('aiChatStore', () => {beforeEach(() => {+ const pendingCommand = aiChatStore.commandRequest;+ if (pendingCommand) {+ aiChatStore.ackCommandRequest(pendingCommand.id);+ }aiChatStore.close();aiChatStore.clearContext();aiChatStore.clearAllContext();@@ -32,6 +36,22 @@ describe('aiChatStore', () => {expect(aiChatStore.isOpen).toBe(false);});+ it('opens the drawer and exposes one-shot Assistant command requests', () => {+ expect(aiChatStore.commandRequest).toBeNull();++ aiChatStore.requestCommand('models');++ expect(aiChatStore.isOpen).toBe(true);+ const request = aiChatStore.commandRequest;+ expect(request).toMatchObject({ action: 'models' });++ aiChatStore.ackCommandRequest((request?.id ?? 0) + 1);+ expect(aiChatStore.commandRequest).toMatchObject({ action: 'models' });++ aiChatStore.ackCommandRequest(request!.id);+ expect(aiChatStore.commandRequest).toBeNull();+ });+it('sets legacy context and clears it', () => {aiChatStore.setContext({ targetType: 'vm', targetId: 'vm-101', context: { name: 'vm-101' } });expect(aiChatStore.context.targetType).toBe('vm');diff --git a/frontend-modern/src/stores/aiChat.ts b/frontend-modern/src/stores/aiChat.tsindex 769a6bb9a7..284a8f2463 100644--- a/frontend-modern/src/stores/aiChat.ts+++ b/frontend-modern/src/stores/aiChat.ts@@ -78,6 +78,13 @@ export interface AIChatContext {autonomousMode?: boolean;}+export type AIChatCommandRequestAction = 'new' | 'sessions' | 'models';++export interface AIChatCommandRequest {+ id: number;+ action: AIChatCommandRequestAction;+}+// A single context item that can be accumulatedinterface ContextItem {id: string; // unique identifier (e.g., "vm-pve-node-101")@@ -159,6 +166,8 @@ const saveMessagesToStorage = (msgs: Message[]) => {// Global state for the AI chat drawerconst [isAIChatOpen, setIsAIChatOpen] = createSignal(false);const [aiChatContext, setAIChatContext] = createSignal<AIChatContext>({});+const [aiChatCommandRequest, setAIChatCommandRequest] =+ createSignal<AIChatCommandRequest | null>(null);const [contextItems, setContextItems] = createSignal<ContextItem[]>([]);const [messages, setMessages] = createSignal<Message[]>(loadMessagesFromStorage());const [aiEnabled, setAiEnabled] = createSignal<boolean | null>(null); // null = not checked yet@@ -173,6 +182,7 @@ const [_isSyncing, _setIsSyncing] = createSignal<boolean>(false);// Debounce timer for savinglet saveDebounceTimer: ReturnType<typeof setTimeout> | null = null;const SAVE_DEBOUNCE_MS = 2000; // Save 2 seconds after last change+let nextAIChatCommandRequestId = 1;// Store reference to AI input for focusing from keyboard shortcutslet aiInputRef: HTMLTextAreaElement | null = null;@@ -208,6 +218,12 @@ export const aiChatStore = {// Reactive accessor - use this in Show/createEffect for proper reactivityisOpenSignal: isAIChatOpen,+ commandRequestSignal: aiChatCommandRequest,++ get commandRequest() {+ return aiChatCommandRequest();+ },+// Get current context (single-item compatibility shape)get context() {return aiChatContext();@@ -370,6 +386,18 @@ export const aiChatStore = {setIsAIChatOpen(true);},+ requestCommand(action: AIChatCommandRequestAction) {+ setAIChatCommandRequest({+ id: nextAIChatCommandRequestId++,+ action,+ });+ setIsAIChatOpen(true);+ },++ ackCommandRequest(id: number) {+ setAIChatCommandRequest((request) => (request?.id === id ? null : request));+ },+// Close the AI chatclose() {setIsAIChatOpen(false);@@ -531,6 +559,7 @@ eventBus.on('org_switched', () => {}// Clear context+ setAIChatCommandRequest(null);setContextItems([]);setAIChatContext({});setSessionTitle('');