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.

Group Assistant command palette

rcourtman6c8a6cc03ed8
diff --git a/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx b/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx
index 7d629c789a..6a21891695 100644
--- a/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx
+++ b/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx
@@ -4,6 +4,7 @@ import {
type AssistantSlashCommandAvailability,
filterAssistantSlashCommands,
getAssistantSlashCommandTokens,
+ groupAssistantSlashCommands,
type AssistantSlashCommand,
} from './assistantSlashCommands';
import { AssistantSlashCommandIcon } from './SlashCommandAutocomplete';
@@ -32,6 +33,8 @@ export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogProp
includeDisabled: true,
}),
);
+ const groupedCommands = createMemo(() => groupAssistantSlashCommands(commands()));
+ const shouldGroupCommands = createMemo(() => !commandSearchQuery().trim());
const selectedCommand = () => commands()[selectedCommandIndex()];
const consumeDialogCloseKey = (event: KeyboardEvent) => {
@@ -159,55 +162,70 @@ export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogProp
</div>
}
>
- <For each={commands()}>
- {(command, index) => {
- const aliases = () => getAssistantSlashCommandTokens(command).slice(1);
- return (
- <button
- type="button"
- role="option"
- aria-selected={index() === selectedCommandIndex()}
- 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">
- <AssistantSlashCommandIcon action={command.action} />
- </span>
- <span class="min-w-0 flex-1">
- <span class="flex min-w-0 flex-wrap items-center gap-2">
- <span class="font-mono text-xs font-semibold text-base-content">
- /{command.name}
- </span>
- <Show when={aliases().length > 0}>
- <span class="min-w-0 truncate text-[10px] text-muted">
- {aliases()
- .map((alias) => `/${alias}`)
- .join(', ')}
+ <For each={groupedCommands()}>
+ {(group) => (
+ <>
+ <Show when={shouldGroupCommands()}>
+ <div
+ role="presentation"
+ class="px-3 pb-1 pt-2 text-[10px] font-semibold uppercase text-muted"
+ >
+ {group.category}
+ </div>
+ </Show>
+ <For each={group.items}>
+ {(item) => {
+ const command = item.command;
+ const aliases = () => getAssistantSlashCommandTokens(command).slice(1);
+ return (
+ <button
+ type="button"
+ role="option"
+ aria-selected={item.index === selectedCommandIndex()}
+ 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'
+ } ${item.index === selectedCommandIndex() ? 'bg-surface-hover' : ''}`}
+ onClick={() => {
+ if (command.disabled) return;
+ props.onRunCommand(command);
+ }}
+ onMouseEnter={() => setSelectedCommandIndex(item.index)}
+ >
+ <span class="mt-0.5 text-muted">
+ <AssistantSlashCommandIcon action={command.action} />
+ </span>
+ <span class="min-w-0 flex-1">
+ <span class="flex min-w-0 flex-wrap items-center gap-2">
+ <span class="font-mono text-xs font-semibold text-base-content">
+ /{command.name}
+ </span>
+ <Show when={aliases().length > 0}>
+ <span class="min-w-0 truncate text-[10px] text-muted">
+ {aliases()
+ .map((alias) => `/${alias}`)
+ .join(', ')}
+ </span>
+ </Show>
+ </span>
+ <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>
- </Show>
- </span>
- <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>
- );
- }}
+ </button>
+ );
+ }}
+ </For>
+ </>
+ )}
</For>
</Show>
</div>
diff --git a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
index 101ce06739..17889a2c62 100644
--- a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
+++ b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
@@ -17,6 +17,7 @@ import {
type AssistantSlashCommandAvailability,
filterAssistantSlashCommands,
getAssistantSlashCommandTokens,
+ groupAssistantSlashCommands,
} from './assistantSlashCommands';
interface SlashCommandAutocompleteProps {
@@ -66,6 +67,8 @@ export function SlashCommandAutocomplete(props: SlashCommandAutocompleteProps) {
availability: props.availability,
}),
);
+ const groupedCommands = createMemo(() => groupAssistantSlashCommands(commands()));
+ const shouldGroupCommands = createMemo(() => !props.query.trim());
const emptyMessage = createMemo(() => {
const query = props.query.trim();
return query ? `No Assistant commands match /${query}` : 'No Assistant commands available';
@@ -152,46 +155,63 @@ export function SlashCommandAutocomplete(props: SlashCommandAutocompleteProps) {
</div>
}
>
- <For each={commands()}>
- {(command, index) => (
- <button
- type="button"
- role="option"
- aria-selected={index() === selectedIndex()}
- aria-label={`${
- command.insertText ? 'Insert' : 'Run'
- } /${command.name}: ${command.description}`}
- class={`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-surface-hover ${
- index() === selectedIndex() ? 'bg-surface-hover' : ''
- }`}
- onClick={(event) => {
- event.stopPropagation();
- selectCommand(command);
- }}
- onMouseEnter={() => setSelectedIndex(index())}
- >
- <span class="mt-0.5 text-muted">
- <AssistantSlashCommandIcon action={command.action} />
- </span>
- <span class="min-w-0 flex-1">
- <span class="flex min-w-0 items-center gap-2">
- <span class="font-mono text-xs font-semibold text-base-content">
- /{command.name}
- </span>
- <Show when={command.aliases?.length}>
- <span class="truncate text-[10px] text-muted">
- {getAssistantSlashCommandTokens(command)
- .slice(1)
- .map((alias) => `/${alias}`)
- .join(', ')}
- </span>
- </Show>
- </span>
- <span class="mt-0.5 block truncate text-xs text-muted">
- {command.description}
- </span>
- </span>
- </button>
+ <For each={groupedCommands()}>
+ {(group) => (
+ <>
+ <Show when={shouldGroupCommands()}>
+ <div
+ role="presentation"
+ class="px-3 pb-1 pt-2 text-[10px] font-semibold uppercase text-muted"
+ >
+ {group.category}
+ </div>
+ </Show>
+ <For each={group.items}>
+ {(item) => {
+ const command = item.command;
+ return (
+ <button
+ type="button"
+ role="option"
+ aria-selected={item.index === selectedIndex()}
+ aria-label={`${
+ command.insertText ? 'Insert' : 'Run'
+ } /${command.name}: ${command.description}`}
+ class={`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-surface-hover ${
+ item.index === selectedIndex() ? 'bg-surface-hover' : ''
+ }`}
+ onClick={(event) => {
+ event.stopPropagation();
+ selectCommand(command);
+ }}
+ onMouseEnter={() => setSelectedIndex(item.index)}
+ >
+ <span class="mt-0.5 text-muted">
+ <AssistantSlashCommandIcon action={command.action} />
+ </span>
+ <span class="min-w-0 flex-1">
+ <span class="flex min-w-0 items-center gap-2">
+ <span class="font-mono text-xs font-semibold text-base-content">
+ /{command.name}
+ </span>
+ <Show when={command.aliases?.length}>
+ <span class="truncate text-[10px] text-muted">
+ {getAssistantSlashCommandTokens(command)
+ .slice(1)
+ .map((alias) => `/${alias}`)
+ .join(', ')}
+ </span>
+ </Show>
+ </span>
+ <span class="mt-0.5 block truncate text-xs text-muted">
+ {command.description}
+ </span>
+ </span>
+ </button>
+ );
+ }}
+ </For>
+ </>
)}
</For>
</Show>
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx
index 7a5d7c5f2e..cf3d50db6a 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx
@@ -47,18 +47,39 @@ describe('AssistantCommandHelpDialog', () => {
const onRunCommand = vi.fn();
render(() => <AssistantCommandHelpDialog onClose={vi.fn()} onRunCommand={onRunCommand} />);
- const newCommand = screen.getByRole('option', { name: /\/new/ });
- expect(newCommand).toHaveAttribute('aria-selected', 'false');
+ const sessionsCommand = screen.getByRole('option', { name: /\/sessions/ });
+ expect(sessionsCommand).toHaveAttribute('aria-selected', 'false');
fireEvent.keyDown(document, { key: 'ArrowDown' });
- expect(newCommand).toHaveAttribute('aria-selected', 'true');
+ expect(sessionsCommand).toHaveAttribute('aria-selected', 'true');
fireEvent.keyDown(document, { key: 'Enter' });
expect(onRunCommand).toHaveBeenCalledWith(
- expect.objectContaining({ action: 'new', name: 'new' }),
+ expect.objectContaining({ action: 'sessions', name: 'sessions' }),
);
});
+ it('groups unfiltered commands by purpose without making headers selectable', () => {
+ render(() => <AssistantCommandHelpDialog onClose={vi.fn()} onRunCommand={vi.fn()} />);
+
+ expect(screen.getByText('Session')).toBeInTheDocument();
+ expect(screen.getByText('Model')).toBeInTheDocument();
+ expect(screen.getByText('Transcript')).toBeInTheDocument();
+ expect(screen.getByText('Help')).toBeInTheDocument();
+ expect(screen.getAllByRole('option')).toHaveLength(13);
+ });
+
+ it('hides command group headers once help search is filtered', () => {
+ render(() => <AssistantCommandHelpDialog onClose={vi.fn()} onRunCommand={vi.fn()} />);
+
+ fireEvent.input(screen.getByLabelText('Search Assistant commands'), {
+ target: { value: 'runtime' },
+ });
+
+ expect(screen.getByRole('option', { name: /\/status/ })).toBeInTheDocument();
+ expect(screen.queryByText('Model')).not.toBeInTheDocument();
+ });
+
it('shows disabled commands in help without running them', () => {
const onRunCommand = vi.fn();
render(() => (
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/SlashCommandAutocomplete.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/SlashCommandAutocomplete.test.tsx
index 7f1f4489c3..79649059f0 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/SlashCommandAutocomplete.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/SlashCommandAutocomplete.test.tsx
@@ -121,6 +121,25 @@ describe('SlashCommandAutocomplete', () => {
'Run /compact: Summarize older turns and keep this session moving',
);
expect(container.querySelectorAll('[role="option"] svg')).toHaveLength(activeCommands.length);
+ expect(screen.getByText('Session')).toBeInTheDocument();
+ expect(screen.getByText('Model')).toBeInTheDocument();
+ expect(screen.getByText('Transcript')).toBeInTheDocument();
+ expect(screen.getByText('Developer')).toBeInTheDocument();
+ });
+
+ it('hides command group headers once the user filters', () => {
+ render(() => (
+ <SlashCommandAutocomplete
+ query="runtime"
+ visible
+ position={{ top: 58, left: 0 }}
+ onClose={vi.fn()}
+ onSelect={vi.fn()}
+ />
+ ));
+
+ expect(screen.getByRole('option', { name: /\/status/ })).toBeInTheDocument();
+ expect(screen.queryByText('Model')).not.toBeInTheDocument();
});
it('surfaces dev stream fixtures through slash command search', () => {
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 dc8e1c3a41..f062aaa393 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
filterAssistantSlashCommands,
getAssistantSlashCommandTokens,
+ groupAssistantSlashCommands,
parseAssistantSlashCommand,
parseAssistantSlashCommandInput,
} from '../assistantSlashCommands';
@@ -98,18 +99,18 @@ describe('assistantSlashCommands', () => {
it('filters commands by canonical name, alias, and description', () => {
expect(filterAssistantSlashCommands('').map((command) => command.name)).toEqual([
- 'help',
'new',
'sessions',
'compact',
+ 'fork',
+ 'undo',
+ 'redo',
'models',
'providers',
'status',
'copy',
'export',
- 'fork',
- 'undo',
- 'redo',
+ 'help',
'fixture',
]);
expect(filterAssistantSlashCommands('resume').map((command) => command.name)).toEqual([
@@ -137,6 +138,26 @@ describe('assistantSlashCommands', () => {
]);
});
+ it('groups the unfiltered command surface by user task area', () => {
+ const groups = groupAssistantSlashCommands(filterAssistantSlashCommands(''));
+
+ expect(groups.map((group) => group.category)).toEqual([
+ 'Session',
+ 'Model',
+ 'Transcript',
+ 'Help',
+ 'Developer',
+ ]);
+ expect(groups.map((group) => group.items.map((item) => item.command.name))).toEqual([
+ ['new', 'sessions', 'compact', 'fork', 'undo', 'redo'],
+ ['models', 'providers', 'status'],
+ ['copy', 'export'],
+ ['help'],
+ ['fixture'],
+ ]);
+ expect(groups[1].items[0].index).toBe(6);
+ });
+
it('keeps dev fixture commands out of production command surfaces', () => {
expect(
filterAssistantSlashCommands('', undefined, {
diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
index 9ea491b477..e5dfc85ab8 100644
--- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
+++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
@@ -18,10 +18,18 @@ export type AssistantSlashCommandAction =
| 'undo'
| 'sessions';
+export type AssistantSlashCommandCategory =
+ | 'Session'
+ | 'Model'
+ | 'Transcript'
+ | 'Help'
+ | 'Developer';
+
export interface AssistantSlashCommand {
action: AssistantSlashCommandAction;
aliases?: string[];
acceptsArgs?: boolean;
+ category: AssistantSlashCommandCategory;
disabled?: boolean;
disabledReason?: string;
description: string;
@@ -49,6 +57,14 @@ export interface ParsedAssistantSlashCommand {
args: string;
}
+export interface AssistantSlashCommandGroup {
+ category: AssistantSlashCommandCategory;
+ items: Array<{
+ command: AssistantSlashCommand;
+ index: number;
+ }>;
+}
+
const isAssistantDevCommandSurfaceEnabled = () =>
import.meta.env.DEV || import.meta.env.MODE === 'test';
@@ -61,6 +77,7 @@ const DEV_ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [
aliases: ['fixtures'],
acceptsArgs: true,
action: 'fixture',
+ category: 'Developer',
description: 'Run a local stream fixture by name (/fixture provider-retry)',
insertText: '/fixture ',
keywords: [
@@ -75,16 +92,11 @@ const DEV_ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [
];
export const ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [
- {
- name: 'help',
- aliases: ['commands'],
- action: 'help',
- description: 'Show Assistant commands',
- },
{
name: 'new',
aliases: ['clear'],
action: 'new',
+ category: 'Session',
description: 'Start a blank Assistant session',
},
{
@@ -92,57 +104,74 @@ export const ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [
aliases: ['resume', 'continue'],
acceptsArgs: true,
action: 'sessions',
+ category: 'Session',
description: 'Search or resume Assistant sessions (/sessions backup)',
},
{
name: 'compact',
aliases: ['summarize'],
action: 'compact',
+ category: 'Session',
description: 'Summarize older turns and keep this session moving',
},
+ {
+ name: 'fork',
+ action: 'fork',
+ category: 'Session',
+ description: 'Fork this session into a new copy',
+ },
+ {
+ name: 'undo',
+ action: 'undo',
+ category: 'Session',
+ description: 'Restore the last prompt for editing',
+ },
+ {
+ name: 'redo',
+ action: 'redo',
+ category: 'Session',
+ description: 'Restore the last undone turn',
+ },
{
name: 'models',
aliases: ['model', 'mo'],
acceptsArgs: true,
action: 'models',
+ category: 'Model',
description: 'Open model search or set a route (/model openrouter/qwen or provider:model-id)',
},
{
name: 'providers',
aliases: ['connect', 'settings', 'keys'],
action: 'providers',
+ category: 'Model',
description: 'Open Assistant provider settings',
},
{
name: 'status',
aliases: ['runtime', 'health'],
action: 'status',
+ category: 'Model',
description: 'Check the selected model route',
},
{
name: 'copy',
action: 'copy',
+ category: 'Transcript',
description: 'Copy the current transcript',
},
{
name: 'export',
action: 'export',
+ category: 'Transcript',
description: 'Download the current transcript',
},
{
- name: 'fork',
- action: 'fork',
- description: 'Fork this session into a new copy',
- },
- {
- name: 'undo',
- action: 'undo',
- description: 'Restore the last prompt for editing',
- },
- {
- name: 'redo',
- action: 'redo',
- description: 'Restore the last undone turn',
+ name: 'help',
+ aliases: ['commands'],
+ action: 'help',
+ category: 'Help',
+ description: 'Show Assistant commands',
},
];
@@ -245,6 +274,20 @@ export const getAssistantSlashCommandTokens = (command: AssistantSlashCommand):
...commandAliases(command),
];
+export const groupAssistantSlashCommands = (
+ commands: AssistantSlashCommand[],
+): AssistantSlashCommandGroup[] => {
+ const groups: AssistantSlashCommandGroup[] = [];
+ for (const [index, command] of commands.entries()) {
+ const lastGroup = groups[groups.length - 1];
+ if (!lastGroup || lastGroup.category !== command.category) {
+ groups.push({ category: command.category, items: [] });
+ }
+ groups[groups.length - 1].items.push({ command, index });
+ }
+ return groups;
+};
+
export const filterAssistantSlashCommands = (
query: string,
limit?: number,