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 fast Assistant model route commands
rcourtmanbfe888b70b16
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 84ba227f8a..3039a2776e 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -632,7 +632,23 @@ runtime cost control, and shared AI transport surfaces.`provider:model` routes that the backend chat stream can execute. Unknownrecent or custom Pulse routes may survive catalog hydration only when theystill have a valid provider/model shape; malformed route strings must not- become selectable chat routes. The referenced OpenCode source at commit+ become selectable chat routes. The 2026-06-07 fast-model-route slice+ rechecked OpenCode `origin/dev` commit+ `31c099be435d59bd6749ace7a9f2bb2245e6d3fa`: the TUI command registry+ exposes `model.list` as `/models` plus `/mo` and hidden+ `model.cycle_recent` / `model.cycle_recent_reverse` commands in+ `packages/tui/src/app.tsx` lines 725-751, the app command registry exposes+ `model.choose` as `/model` with keybind `mod+'` in+ `packages/app/src/pages/session/use-session-commands.tsx` lines 514-522,+ and `DialogModel` promotes favorites/recents before provider catalog rows+ in `packages/tui/src/component/dialog-model.tsx` lines 23-54. Pulse adapts+ that command model by letting the composer consume `/model <provider:model>`+ as a local route switch, `/model default` as an inherited-default reset, and+ `/model next` / `/model previous` as recent-route cycling without sending+ those command strings to the provider. Malformed `/model ...` arguments must+ remain editable in the composer with a local correction message rather than+ being silently cleared or treated as assistant prompts. The referenced+ OpenCode source at commit`9ed17da55ab1f7360cc0e01075f763e27fa899e9``packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx` passes thecurrent structured model route into `DialogSelect` at lines 146-171, anddiff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsxindex add231aa76..7a00ec9649 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx@@ -1643,7 +1643,7 @@ describe('AIChat', () => {expect(screen.getByRole('dialog', { name: 'Assistant commands' })).toBeInTheDocument();expect(screen.getByRole('button', { name: /\/models/ })).toHaveTextContent(- 'Choose the model and provider route',+ 'Choose or set the model route (/model provider:model-id)',);expect(screen.getByRole('button', { name: /\/status/ })).toHaveTextContent('Check the selected model route',@@ -1799,6 +1799,73 @@ describe('AIChat', () => {expect(mockChat.sendMessage).not.toHaveBeenCalled();});+ it('sets an explicit model route from /model without sending a provider prompt', async () => {+ renderChat();+ const textarea = screen.getByPlaceholderText(+ 'Ask about your infrastructure...',+ ) as HTMLTextAreaElement;++ fireEvent.input(textarea, {+ target: { value: '/model openrouter:deepseek/deepseek-v4-pro' },+ });+ fireEvent.keyDown(textarea, { key: 'Enter' });++ expect(mockChat.setModel).toHaveBeenCalledWith('openrouter:deepseek/deepseek-v4-pro');+ expect(mockChat.sendMessage).not.toHaveBeenCalled();+ await waitFor(() => expect(textarea.value).toBe(''));+ });++ it('returns to the configured default model from /model default', async () => {+ mockChat.model.mockReturnValue('openrouter:qwen/qwen3.7-plus');+ renderChat();+ const textarea = screen.getByPlaceholderText(+ 'Ask about your infrastructure...',+ ) as HTMLTextAreaElement;++ fireEvent.input(textarea, { target: { value: '/model default' } });+ fireEvent.keyDown(textarea, { key: 'Enter' });++ expect(mockChat.setModel).toHaveBeenCalledWith('');+ expect(mockChat.sendMessage).not.toHaveBeenCalled();+ await waitFor(() => expect(textarea.value).toBe(''));+ });++ it('cycles recent model routes from /model next without opening the picker', async () => {+ localStorage.setItem(+ 'pulse:ai_chat_recent_models',+ JSON.stringify(['openrouter:anthropic/claude-sonnet-4.5', 'openrouter:qwen/qwen3.7-plus']),+ );+ renderChat();+ const textarea = screen.getByPlaceholderText(+ 'Ask about your infrastructure...',+ ) as HTMLTextAreaElement;++ fireEvent.input(textarea, { target: { value: '/model next' } });+ fireEvent.keyDown(textarea, { key: 'Enter' });++ expect(mockChat.setModel).toHaveBeenCalledWith('openrouter:anthropic/claude-sonnet-4.5');+ expect(screen.getByTestId('model-selector')).toHaveAttribute('data-open-request', '0');+ expect(mockChat.sendMessage).not.toHaveBeenCalled();+ await waitFor(() => expect(textarea.value).toBe(''));+ });++ it('keeps invalid /model route drafts editable instead of sending them', async () => {+ renderChat();+ const textarea = screen.getByPlaceholderText(+ 'Ask about your infrastructure...',+ ) as HTMLTextAreaElement;++ fireEvent.input(textarea, { target: { value: '/model qwen3.7-plus' } });+ fireEvent.keyDown(textarea, { key: 'Enter' });++ expect(mockChat.setModel).not.toHaveBeenCalled();+ expect(mockChat.sendMessage).not.toHaveBeenCalled();+ expect(mockNotificationStore.error).toHaveBeenCalledWith(+ 'Use /model provider:model-id, /model default, /model next, or /model previous.',+ );+ expect(textarea.value).toBe('/model qwen3.7-plus');+ });+it('checks selected provider status from /status without sending a provider prompt', async () => {mockAIAPI.getSettings.mockResolvedValue({model: 'openrouter:deepseek/deepseek-v4-pro',diff --git a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.tsindex 8bf26446fb..0185507aac 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts@@ -3,6 +3,7 @@ import {filterAssistantSlashCommands,getAssistantSlashCommandTokens,parseAssistantSlashCommand,+ parseAssistantSlashCommandInput,} from '../assistantSlashCommands';describe('assistantSlashCommands', () => {@@ -42,6 +43,27 @@ describe('assistantSlashCommands', () => {expect(parseAssistantSlashCommand('/copy this sentence')).toBeNull();});+ it('parses model commands with route arguments for local composer handling', () => {+ expect(parseAssistantSlashCommandInput('/model openrouter:qwen/qwen3.7-plus')).toEqual({+ action: 'models',+ args: 'openrouter:qwen/qwen3.7-plus',+ });+ expect(parseAssistantSlashCommandInput('/models default')).toEqual({+ action: 'models',+ args: 'default',+ });+ expect(parseAssistantSlashCommandInput('/mo previous')).toEqual({+ action: 'models',+ args: 'previous',+ });+ expect(parseAssistantSlashCommand('/model openrouter:qwen/qwen3.7-plus')).toBeNull();+ });++ it('does not parse arguments for non-model commands', () => {+ expect(parseAssistantSlashCommandInput('/copy this sentence')).toBeNull();+ expect(parseAssistantSlashCommandInput('/status now')).toBeNull();+ });+it('filters commands by canonical name, alias, and description', () => {expect(filterAssistantSlashCommands('').map((command) => command.name)).toEqual(['help',diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.tsindex a2f5c60797..99f31bb817 100644--- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts+++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts@@ -18,6 +18,11 @@ export interface AssistantSlashCommand {name: string;}+export interface ParsedAssistantSlashCommand {+ action: AssistantSlashCommandAction;+ args: string;+}+export const ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [{name: 'help',@@ -41,7 +46,7 @@ export const ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [name: 'models',aliases: ['model', 'mo'],action: 'models',- description: 'Choose the model and provider route',+ description: 'Choose or set the model route (/model provider:model-id)',},{name: 'providers',@@ -89,14 +94,31 @@ const commandByToken = new Map<string, AssistantSlashCommandAction>(]),);-export const parseAssistantSlashCommand = (input: string): AssistantSlashCommandAction | null => {+export const parseAssistantSlashCommandInput = (+ input: string,+): ParsedAssistantSlashCommand | null => {const trimmed = input.trim();if (!trimmed.startsWith('/')) return null;- const token = trimmed.slice(1).toLowerCase();- if (!token || /\s/.test(token)) return null;+ const body = trimmed.slice(1);+ const match = body.match(/^(\S+)(?:\s+([\s\S]*))?$/);+ if (!match) return null;++ const token = match[1].toLowerCase();+ if (!token) return null;+ const action = commandByToken.get(token);+ if (!action) return null;- return commandByToken.get(token) ?? null;+ const args = (match[2] || '').trim();+ if (args && action !== 'models') return null;++ return { action, args };+};++export const parseAssistantSlashCommand = (input: string): AssistantSlashCommandAction | null => {+ const parsed = parseAssistantSlashCommandInput(input);+ if (!parsed || parsed.args) return null;+ return parsed.action;};const normalizeSlashQuery = (query: string) => query.trim().toLowerCase();diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsxindex 876563924e..1b71451fea 100644--- a/frontend-modern/src/components/AI/Chat/index.tsx+++ b/frontend-modern/src/components/AI/Chat/index.tsx@@ -155,7 +155,7 @@ import {} from './assistantModelRoutes';import {filterAssistantSlashCommands,- parseAssistantSlashCommand,+ parseAssistantSlashCommandInput,type AssistantSlashCommand,type AssistantSlashCommandAction,} from './assistantSlashCommands';@@ -193,6 +193,8 @@ const STRUCTURED_PATROL_CONTEXT_TARGETS = new Set(['patrol-configuration', 'patrconst STRUCTURED_RESOURCE_CONTEXT_HANDOFF_KINDS = new Set(['resource_context']);const AI_CHAT_CYCLE_RECENT_MODEL_LABEL = 'Cycle recent Assistant model';const AI_CHAT_CONTROL_LEVEL_ORDER: AIControlLevel[] = ['read_only', 'controlled', 'autonomous'];+const AI_CHAT_MODEL_SLASH_HELP =+ 'Use /model provider:model-id, /model default, /model next, or /model previous.';type SessionPickerSection = {title: string;@@ -1974,24 +1976,91 @@ export const AIChat: Component<AIChatProps> = (props) => {}};- const nextRecentModelRoute = createMemo(() =>+ const recentModelRouteByDirection = (direction: 1 | -1) =>getNextAssistantRecentModelRoute({currentModel: selectedChatModel(),+ direction,recentModelIds: recentModelIds(),- }),- );+ });+ const nextRecentModelRoute = createMemo(() => recentModelRouteByDirection(1));const nextRecentModelRouteLabel = createMemo(() => {const next = nextRecentModelRoute();return next ? formatChatMessageModelRoute(next) : '';});- const cycleRecentModelRoute = () => {- const next = nextRecentModelRoute();+ const cycleRecentModelRoute = (direction: 1 | -1 = 1) => {+ const next = recentModelRouteByDirection(direction);if (!next) return;selectModel(next, { rememberRecent: false });focusComposer();};+ const runModelSlashCommand = (argument: string) => {+ const target = argument.trim();+ if (!target) {+ setShowSessions(false);+ setShowCommandHelp(false);+ setSessionRefreshLoading(false);+ resetSessionSearch();+ setModelSelectorOpenRequest((value) => value + 1);+ return true;+ }++ const normalizedTarget = target.toLowerCase();+ if (normalizedTarget === 'default' || normalizedTarget === 'configured') {+ selectModel('', { rememberRecent: false });+ notificationStore.success('Assistant model route set to default', 2000);+ focusComposer();+ return true;+ }++ if (normalizedTarget === 'next' || normalizedTarget === 'recent') {+ const next = recentModelRouteByDirection(1);+ if (!next) {+ notificationStore.info('No recent Assistant model route to cycle to.', 2000);+ focusComposer();+ return true;+ }+ selectModel(next, { rememberRecent: false });+ notificationStore.success(+ `Assistant model route set to ${formatChatMessageModelRoute(next)}`,+ 2000,+ );+ focusComposer();+ return true;+ }++ if (normalizedTarget === 'previous' || normalizedTarget === 'prev') {+ const previous = recentModelRouteByDirection(-1);+ if (!previous) {+ notificationStore.info('No previous Assistant model route to cycle to.', 2000);+ focusComposer();+ return true;+ }+ selectModel(previous, { rememberRecent: false });+ notificationStore.success(+ `Assistant model route set to ${formatChatMessageModelRoute(previous)}`,+ 2000,+ );+ focusComposer();+ return true;+ }++ if (!isAssistantExplicitModelRoute(target)) {+ notificationStore.error(AI_CHAT_MODEL_SLASH_HELP);+ focusComposer();+ return false;+ }++ selectModel(target);+ notificationStore.success(+ `Assistant model route set to ${formatChatMessageModelRoute(target)}`,+ 2000,+ );+ focusComposer();+ return true;+ };+const openModelSelectorFromError = () => {setModelSelectorOpenRequest((value) => value + 1);};@@ -2727,7 +2796,16 @@ export const AIChat: Component<AIChatProps> = (props) => {});};- const executeSlashCommand = (command: AssistantSlashCommandAction) => {+ const executeSlashCommand = (command: AssistantSlashCommandAction, args = '') => {+ const commandArgs = args.trim();+ if (command === 'models' && commandArgs) {+ const consumed = runModelSlashCommand(commandArgs);+ if (consumed) {+ clearLocalComposerCommand();+ }+ return consumed;+ }+clearLocalComposerCommand();switch (command) {@@ -2780,6 +2858,7 @@ export const AIChat: Component<AIChatProps> = (props) => {void handleRedoLastTurn();break;}+ return true;};createEffect(() => {@@ -2805,9 +2884,9 @@ export const AIChat: Component<AIChatProps> = (props) => {if (submittedInput !== input()) {setInput(submittedInput);}- const slashCommand = parseAssistantSlashCommand(prompt);+ const slashCommand = parseAssistantSlashCommandInput(prompt);if (slashCommand) {- executeSlashCommand(slashCommand);+ executeSlashCommand(slashCommand.action, slashCommand.args);return;}setSlashCommandActive(false);@@ -4376,7 +4455,7 @@ export const AIChat: Component<AIChatProps> = (props) => {/><buttontype="button"- onClick={cycleRecentModelRoute}+ onClick={() => cycleRecentModelRoute()}disabled={!nextRecentModelRoute()}class="flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border bg-surface text-muted transition-colors hover:border-border hover:text-base-content disabled:cursor-not-allowed disabled:opacity-45"title={