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
Align Assistant command availability with toolbar state
rcourtman2e486fbbf9b0
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex cd4bcf89c1..e1d28df9b8 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -2144,6 +2144,18 @@ remain visible/inspectable.## Current State+Assistant slash-command availability is part of the command runtime contract,+not only visual polish. The OpenCode reference at fetched `origin/dev` commit+`c495635` filters prompt slash commands through the registered command catalog+and omits disabled builtin commands from the prompt popover in+`packages/app/src/components/prompt-input.tsx` (slash command list creation,+lines 677-699), while command metadata owns `disabled` and `slash` in+`packages/app/src/context/command.tsx`. Pulse adapts that by deriving command+availability from the same predicates as the drawer toolbar: prompt slash+autocomplete hides unavailable local commands, command help may show them+disabled with a reason, and manual slash submissions respect the same+availability before running local session actions.+Assistant tool activity now follows an OpenCode-referenced chronological rowmodel where appropriate for Pulse. Consecutive context/read/query tools renderas visible transcript rows in arrival order instead of being replaced by adiff --git a/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx b/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsxindex ca57d0a0aa..7d629c789a 100644--- a/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx+++ b/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx@@ -1,6 +1,7 @@import { For, Show, createEffect, createMemo, createSignal, onCleanup, onMount } from 'solid-js';import XIcon from 'lucide-solid/icons/x';import {+ type AssistantSlashCommandAvailability,filterAssistantSlashCommands,getAssistantSlashCommandTokens,type AssistantSlashCommand,@@ -15,6 +16,7 @@ import {} from '@/utils/aiChatPresentation';interface AssistantCommandHelpDialogProps {+ availability?: AssistantSlashCommandAvailability;onClose: () => void;onRunCommand: (command: AssistantSlashCommand) => void;}@@ -24,7 +26,12 @@ export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogPropconst [selectedCommandIndex, setSelectedCommandIndex] = createSignal(0);let searchInputRef: HTMLInputElement | undefined;- const commands = createMemo(() => filterAssistantSlashCommands(commandSearchQuery()));+ const commands = createMemo(() =>+ filterAssistantSlashCommands(commandSearchQuery(), undefined, {+ availability: props.availability,+ includeDisabled: true,+ }),+ );const selectedCommand = () => commands()[selectedCommandIndex()];const consumeDialogCloseKey = (event: KeyboardEvent) => {@@ -70,7 +77,7 @@ export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogPropcase 'Enter': {consumeDialogCloseKey(event);const command = selectedCommand();- if (!command) return;+ if (!command || command.disabled) return;props.onRunCommand(command);break;}@@ -160,10 +167,17 @@ export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogProptype="button"role="option"aria-selected={index() === selectedCommandIndex()}- class={`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left transition-colors hover:bg-surface-hover focus:bg-surface-hover focus:outline-none ${- index() === selectedCommandIndex() ? 'bg-surface-hover' : ''- }`}- onClick={() => props.onRunCommand(command)}+ aria-disabled={command.disabled ? 'true' : undefined}+ disabled={command.disabled}+ class={`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left transition-colors focus:outline-none ${+ command.disabled+ ? 'cursor-not-allowed opacity-55'+ : 'hover:bg-surface-hover focus:bg-surface-hover'+ } ${index() === selectedCommandIndex() ? 'bg-surface-hover' : ''}`}+ onClick={() => {+ if (command.disabled) return;+ props.onRunCommand(command);+ }}onMouseEnter={() => setSelectedCommandIndex(index())}><span class="mt-0.5 text-muted">@@ -185,6 +199,11 @@ export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogProp<span class="mt-0.5 block text-xs leading-5 text-muted">{command.description}</span>+ <Show when={command.disabled && command.disabledReason}>+ <span class="mt-0.5 block text-[11px] leading-4 text-muted">+ {command.disabledReason}+ </span>+ </Show></span></button>);diff --git a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsxindex d83012639e..3d751ed334 100644--- a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx+++ b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx@@ -13,11 +13,13 @@ import Undo2Icon from 'lucide-solid/icons/undo-2';import CircleHelpIcon from 'lucide-solid/icons/circle-help';import type { AssistantSlashCommand, AssistantSlashCommandAction } from './assistantSlashCommands';import {+ type AssistantSlashCommandAvailability,filterAssistantSlashCommands,getAssistantSlashCommandTokens,} from './assistantSlashCommands';interface SlashCommandAutocompleteProps {+ availability?: AssistantSlashCommandAvailability;query: string;visible: boolean;position: { top: number; left: number };@@ -56,7 +58,11 @@ export const AssistantSlashCommandIcon = (props: { action: AssistantSlashCommandexport function SlashCommandAutocomplete(props: SlashCommandAutocompleteProps) {const [selectedIndex, setSelectedIndex] = createSignal(0);- const commands = createMemo(() => filterAssistantSlashCommands(props.query));+ const commands = createMemo(() =>+ filterAssistantSlashCommands(props.query, undefined, {+ availability: props.availability,+ }),+ );createEffect(() => {props.query;diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsxindex e87fad13ce..106e026a9c 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx@@ -1745,6 +1745,34 @@ describe('AIChat', () => {expect(mockChat.sendMessage).not.toHaveBeenCalled();});+ it('omits unavailable session commands from slash suggestions', () => {+ renderChat();+ const textarea = screen.getByPlaceholderText('Ask about your infrastructure...');++ fireEvent.input(textarea, { target: { value: '/compact' } });++ expect(screen.queryByRole('listbox', { name: 'Assistant commands' })).not.toBeInTheDocument();+ expect(screen.queryByRole('option', { name: /Run \/compact/ })).not.toBeInTheDocument();+ });++ it('explains unavailable manual slash commands without sending a provider prompt', async () => {+ renderChat();+ const textarea = screen.getByPlaceholderText(+ 'Ask about your infrastructure...',+ ) as HTMLTextAreaElement;++ fireEvent.input(textarea, { target: { value: '/compact' } });+ fireEvent.keyDown(textarea, { key: 'Enter' });++ expect(mockAIChatAPI.summarizeSession).not.toHaveBeenCalled();+ expect(mockChat.sendMessage).not.toHaveBeenCalled();+ expect(mockNotificationStore.info).toHaveBeenCalledWith(+ 'Requires a saved Assistant session.',+ 2000,+ );+ await waitFor(() => expect(textarea.value).toBe(''));+ });+it('opens Assistant command help from the composer chrome without sending a provider prompt', () => {renderChat();const textarea = screen.getByPlaceholderText('Ask about your infrastructure...');diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsxindex 5d5f7b26ad..313367361d 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx@@ -48,6 +48,34 @@ describe('AssistantCommandHelpDialog', () => {);});+ it('shows disabled commands in help without running them', () => {+ const onRunCommand = vi.fn();+ render(() => (+ <AssistantCommandHelpDialog+ availability={{+ compact: {+ disabled: true,+ reason: 'Requires transcript content.',+ },+ }}+ onClose={vi.fn()}+ onRunCommand={onRunCommand}+ />+ ));++ fireEvent.input(screen.getByLabelText('Search Assistant commands'), {+ target: { value: 'compact' },+ });++ const compactCommand = screen.getByRole('option', { name: /\/compact/ });+ expect(compactCommand).toHaveAttribute('aria-disabled', 'true');+ expect(compactCommand).toBeDisabled();+ expect(screen.getByText('Requires transcript content.')).toBeInTheDocument();++ fireEvent.keyDown(document, { key: 'Enter' });+ expect(onRunCommand).not.toHaveBeenCalled();+ });+it('consumes Escape as a local dialog close command', () => {const onClose = vi.fn();render(() => <AssistantCommandHelpDialog onClose={onClose} onRunCommand={vi.fn()} />);diff --git a/frontend-modern/src/components/AI/Chat/__tests__/SlashCommandAutocomplete.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/SlashCommandAutocomplete.test.tsxindex a08d8d1948..bf486b1686 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/SlashCommandAutocomplete.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/SlashCommandAutocomplete.test.tsx@@ -122,4 +122,25 @@ describe('SlashCommandAutocomplete', () => {ASSISTANT_SLASH_COMMANDS.length,);});++ it('omits disabled commands from prompt autocomplete', () => {+ render(() => (+ <SlashCommandAutocomplete+ availability={{+ compact: {+ disabled: true,+ reason: 'Requires transcript content.',+ },+ }}+ query="compact"+ visible+ position={{ top: 58, left: 0 }}+ onClose={vi.fn()}+ onSelect={vi.fn()}+ />+ ));++ expect(screen.queryByRole('listbox', { name: 'Assistant commands' })).not.toBeInTheDocument();+ expect(screen.queryByRole('option', { name: /\/compact/ })).not.toBeInTheDocument();+ });});diff --git a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.tsindex 91e83724fc..23b17034e1 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts@@ -102,6 +102,40 @@ describe('assistantSlashCommands', () => {]);});+ it('filters disabled commands from the prompt slash list by default', () => {+ expect(+ filterAssistantSlashCommands('compact', undefined, {+ availability: {+ compact: {+ disabled: true,+ reason: 'Requires transcript content.',+ },+ },+ }).map((command) => command.name),+ ).toEqual([]);+ });++ it('can include disabled commands for full command help', () => {+ const commands = filterAssistantSlashCommands('compact', undefined, {+ availability: {+ compact: {+ disabled: true,+ reason: 'Requires transcript content.',+ },+ },+ includeDisabled: true,+ });++ expect(commands).toHaveLength(1);+ expect(commands[0]).toEqual(+ expect.objectContaining({+ disabled: true,+ disabledReason: 'Requires transcript content.',+ name: 'compact',+ }),+ );+ });+it('exposes canonical and alias tokens for the picker', () => {const help = filterAssistantSlashCommands('commands')[0];expect(getAssistantSlashCommandTokens(help)).toEqual(['help', 'commands']);diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.tsindex 6a9aef5a2c..ea45ff1f38 100644--- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts+++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts@@ -15,10 +15,21 @@ export type AssistantSlashCommandAction =export interface AssistantSlashCommand {action: AssistantSlashCommandAction;aliases?: string[];+ disabled?: boolean;+ disabledReason?: string;description: string;name: string;}+export type AssistantSlashCommandAvailability = Partial<+ Record<AssistantSlashCommandAction, { disabled: boolean; reason?: string }>+>;++export interface AssistantSlashCommandFilterOptions {+ availability?: AssistantSlashCommandAvailability;+ includeDisabled?: boolean;+}+export interface ParsedAssistantSlashCommand {action: AssistantSlashCommandAction;args: string;@@ -132,6 +143,19 @@ const normalizeSlashQuery = (query: string) => query.trim().toLowerCase();const commandAliases = (command: AssistantSlashCommand): string[] => command.aliases || [];+const commandWithAvailability = (+ command: AssistantSlashCommand,+ availability?: AssistantSlashCommandAvailability,+): AssistantSlashCommand => {+ const state = availability?.[command.action];+ if (!state) return command;+ return {+ ...command,+ disabled: state.disabled,+ disabledReason: state.reason,+ };+};+const commandMatchesQuery = (command: AssistantSlashCommand, query: string) => {if (!query) return true;if (command.name.toLowerCase().includes(query)) return true;@@ -156,9 +180,14 @@ export const getAssistantSlashCommandTokens = (command: AssistantSlashCommand):export const filterAssistantSlashCommands = (query: string,limit = ASSISTANT_SLASH_COMMANDS.length,+ options: AssistantSlashCommandFilterOptions = {},): AssistantSlashCommand[] => {const normalizedQuery = normalizeSlashQuery(query);- return ASSISTANT_SLASH_COMMANDS.filter((command) => commandMatchesQuery(command, normalizedQuery))+ return ASSISTANT_SLASH_COMMANDS.map((command) =>+ commandWithAvailability(command, options.availability),+ )+ .filter((command) => options.includeDisabled || !command.disabled)+ .filter((command) => commandMatchesQuery(command, normalizedQuery)).map((command, index) => ({ command, index })).sort((left, right) => {const scoreDelta =diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsxindex 3fafe7d660..656f2d2cef 100644--- a/frontend-modern/src/components/AI/Chat/index.tsx+++ b/frontend-modern/src/components/AI/Chat/index.tsx@@ -162,6 +162,7 @@ import {normalizeAssistantRecentModelRoutes,} from './assistantModelRoutes';import {+ type AssistantSlashCommandAvailability,filterAssistantSlashCommands,parseAssistantSlashCommandInput,type AssistantSlashCommand,@@ -1699,6 +1700,54 @@ export const AIChat: Component<AIChatProps> = (props) => {!redoingLastTurn() &&redoLastTurnAvailable(),);+ const assistantCommandAvailability = createMemo<AssistantSlashCommandAvailability>(() => ({+ compact: {+ disabled: !canCompactCurrentSession(),+ reason: chat.isLoading()+ ? 'Available after the active response finishes.'+ : !chat.sessionId().trim()+ ? 'Requires a saved Assistant session.'+ : !hasCurrentTranscript()+ ? 'Requires transcript content.'+ : 'Unavailable while another session action is running.',+ },+ copy: {+ disabled: !hasCurrentTranscript(),+ reason: 'Requires transcript content.',+ },+ export: {+ disabled: !hasCurrentTranscript(),+ reason: 'Requires transcript content.',+ },+ fork: {+ disabled: !canForkCurrentSession(),+ reason: chat.isLoading()+ ? 'Available after the active response finishes.'+ : !chat.sessionId().trim()+ ? 'Requires a saved Assistant session.'+ : !hasCurrentTranscript()+ ? 'Requires transcript content.'+ : 'Forking is already running.',+ },+ redo: {+ disabled: !canRedoLastTurn(),+ reason: 'No undone Assistant turn is available.',+ },+ status: {+ disabled: providerReadiness().status === 'checking',+ reason: 'Route health check already running.',+ },+ undo: {+ disabled: !canUndoLastTurn(),+ reason: chat.isLoading()+ ? 'Available after the active response finishes.'+ : 'Requires a sent Assistant prompt.',+ },+ }));+ const disabledAssistantCommandReason = (command: AssistantSlashCommandAction) => {+ const state = assistantCommandAvailability()[command];+ return state?.disabled ? state.reason || 'Assistant command is unavailable right now.' : '';+ };const buildCurrentTranscript = (generatedAt = new Date()) => {const sessionId = chat.sessionId().trim();@@ -2851,6 +2900,15 @@ export const AIChat: Component<AIChatProps> = (props) => {const executeSlashCommand = (command: AssistantSlashCommandAction, args = '') => {const commandArgs = args.trim();+ const disabledReason = disabledAssistantCommandReason(command);+ if (disabledReason) {+ clearLocalComposerCommand();+ setShowCommandHelp(false);+ notificationStore.info(disabledReason, 2000);+ focusComposer();+ return true;+ }+if (command === 'models' && commandArgs) {const consumed = runModelSlashCommand(commandArgs);if (consumed) {@@ -3044,7 +3102,10 @@ export const AIChat: Component<AIChatProps> = (props) => {) {const query = textBeforeCursor.slice(1);setSlashCommandQuery(query);- const hasMatches = filterAssistantSlashCommands(query, 1).length > 0;+ const hasMatches =+ filterAssistantSlashCommands(query, 1, {+ availability: assistantCommandAvailability(),+ }).length > 0;setSlashCommandActive(hasMatches);if (hasMatches) {setMentionActive(false);@@ -3634,6 +3695,7 @@ export const AIChat: Component<AIChatProps> = (props) => {</Show><Show when={showCommandHelp()}><AssistantCommandHelpDialog+ availability={assistantCommandAvailability()}onClose={() => setShowCommandHelp(false)}onRunCommand={handleCommandHelpRun}/>@@ -4528,6 +4590,7 @@ export const AIChat: Component<AIChatProps> = (props) => {/></div><SlashCommandAutocomplete+ availability={assistantCommandAvailability()}query={slashCommandQuery()}position={{ top: 58, left: 0 }}onSelect={handleSlashCommandSelect}