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.

Contextualize Assistant launcher

rcourtman4b0e60a448e5
diff --git a/docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md b/docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md
index 652158e3b0..faab8df8c5 100644
--- a/docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md
+++ b/docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md
@@ -98,6 +98,12 @@ loop, and routes the operator from real findings/evidence to safe action.
surface manifest so Patrol consistently reads as the checking loop: check
infrastructure, list current issues, ask according to Patrol mode, verify,
and record the result.
+- 2026-06-25: Demoted the shared Assistant shell entry from a generic chat
+ opener to contextual help. The floating launcher and command palette now use
+ the current route to label the action as "Ask about <view>" and open Assistant
+ with factual `pulse-view` context attached. Browser proof covered desktop
+ `/proxmox/overview` launcher, Assistant context strip, command palette first
+ action, and the mobile launcher.
## Evidence
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index d878b67c7f..9553050d77 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -141,18 +141,19 @@ can serve both standard and alternate (e.g. Z.ai coding) endpoint tiers.
11. `frontend-modern/src/components/Settings/AgentIntegrationsPanel.tsx`
12. `frontend-modern/src/components/AI/Chat/`
13. `frontend-modern/src/utils/aiChatPresentation.ts`
-14. `frontend-modern/src/utils/aiControlLevelPresentation.ts`
-15. `frontend-modern/src/utils/aiCostPresentation.ts`
-16. `frontend-modern/src/utils/aiProviderHealthPresentation.ts`
-17. `frontend-modern/src/utils/aiProviderPresentation.ts`
-18. `frontend-modern/src/utils/textPresentation.ts`
-19. `frontend-modern/src/stores/aiRuntimeState.ts`
-20. `frontend-modern/src/stores/aiChat.ts`
-21. `docs/AI.md`
-22. `pkg/aicontracts/investigation.go`
-23. `pkg/aicontracts/orchestrator_deps.go`
-24. `pkg/aicontracts/fix_execution.go`
-25. `pkg/extensions/ai_autofix.go`
+14. `frontend-modern/src/utils/assistantPageContext.ts`
+15. `frontend-modern/src/utils/aiControlLevelPresentation.ts`
+16. `frontend-modern/src/utils/aiCostPresentation.ts`
+17. `frontend-modern/src/utils/aiProviderHealthPresentation.ts`
+18. `frontend-modern/src/utils/aiProviderPresentation.ts`
+19. `frontend-modern/src/utils/textPresentation.ts`
+20. `frontend-modern/src/stores/aiRuntimeState.ts`
+21. `frontend-modern/src/stores/aiChat.ts`
+22. `docs/AI.md`
+23. `pkg/aicontracts/investigation.go`
+24. `pkg/aicontracts/orchestrator_deps.go`
+25. `pkg/aicontracts/fix_execution.go`
+26. `pkg/extensions/ai_autofix.go`
## Shared Boundaries
@@ -2538,7 +2539,7 @@ query...`, and `Reading storage...` before streamed tool arguments are
require an explicit `allow_broad_scope` request from a dedicated rule
management surface.
5. Add or change AI usage/cost dashboard presentation through `frontend-modern/src/components/AI/AICostDashboard.tsx` and `frontend-modern/src/utils/aiCostPresentation.ts`
-6. Add or change AI provider, control-level, or chat/session presentation through `frontend-modern/src/components/AI/Chat/`, `frontend-modern/src/utils/aiProviderPresentation.ts`, `frontend-modern/src/utils/aiProviderHealthPresentation.ts`, `frontend-modern/src/utils/aiControlLevelPresentation.ts`, and `frontend-modern/src/utils/aiChatPresentation.ts`
+6. Add or change AI provider, control-level, or chat/session presentation through `frontend-modern/src/components/AI/Chat/`, `frontend-modern/src/utils/aiProviderPresentation.ts`, `frontend-modern/src/utils/aiProviderHealthPresentation.ts`, `frontend-modern/src/utils/aiControlLevelPresentation.ts`, `frontend-modern/src/utils/assistantPageContext.ts`, and `frontend-modern/src/utils/aiChatPresentation.ts`
AI provider/model presentation must preserve the model transport route when
the selected provider is a gateway. OpenRouter-routed model IDs such as
`openrouter:deepseek/...` must render with an explicit `via OpenRouter`
@@ -2568,6 +2569,12 @@ query...`, and `Reading storage...` before streamed tool arguments are
the body explains that enabling it gives Assistant real service, version,
and command context instead of generic guidance. The hint must not
reintroduce the old `Workload Discovery` label as a separate product concept.
+ Authenticated shell Assistant launches must use
+ `frontend-modern/src/utils/assistantPageContext.ts` to attach factual
+ current-route context before the drawer opens. That helper may identify the
+ current platform, Patrol, Alerts, Settings, or unknown Pulse view and provide
+ neutral briefing metadata, but it must not synthesize a prompt, require a
+ tool choice, or turn Assistant back into the primary operations front door.
Assistant route and control chrome belongs with the prompt surface, not the
drawer title row. The referenced OpenCode source at commit
`9ed17da55ab1f7360cc0e01075f763e27fa899e9`
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index adfd0eb973..adecf8e28d 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -823,6 +823,11 @@ or other self-hosted uncapped continuity plans.
destination remains `Patrol` over the same `/patrol` route; it must not
alter hosted org bootstrap, entitlement loading, or commercial posture
loading.
+ The same AppLayout shell may contextualize the closed Pulse Assistant
+ launcher around the current monitoring, Patrol, Alerts, or Settings route,
+ but that launcher must remain a local product affordance. It must not read
+ hosted billing state, alter org bootstrap, or become a commercial
+ activation prompt while attaching current-view Assistant context.
Retired operator top-level route compatibility in
`frontend-modern/src/App.tsx` must stay inside authenticated app-owned
surfaces such as Infrastructure, Workloads, Storage, and Recovery. Those
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index e3f49c7a78..5e80a2dca6 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -592,6 +592,12 @@ AGENT_SURFACE_ID_PULSE_MCP)` and `getAgentSurfaceToolPosturePresentation`,
## Extension Points
+Assistant shell entry changes must keep Assistant contextual rather than
+generic: `AppLayout.tsx` and the command palette may expose a compact launcher,
+but that launcher must attach current-view context before opening the drawer
+and label the action around the current monitoring, Patrol, Alerts, or Settings
+view.
+
SSO provider settings changes must preserve the shared Community-tier action
path: SAML and OIDC provider creation stay on the same settings-shell control
surface, while paid-plan copy and compatibility feature probes stay out of the
@@ -3368,6 +3374,13 @@ logic. New session, session picker, model picker, Undo, and Redo commands must
flow through the shared `frontend-modern/src/stores/aiChat.ts` command request
contract so the drawer owns disabled/loading state, prompt restoration, and
notifications while the palette remains only a searchable command surface.
+The command-palette Assistant open command is also contextual shell routing:
+`frontend-modern/src/components/shared/useCommandPaletteState.ts` must derive
+current-view context through `frontend-modern/src/utils/assistantPageContext.ts`
+and pass that context into `aiChatStore.open(...)`, while
+`frontend-modern/src/components/shared/commandPaletteModel.ts` owns the
+corresponding `Ask about <view>` label. It must not fall back to an empty
+generic Assistant open action.
The shared search field now follows that same owner split.
`frontend-modern/src/components/shared/SearchField.tsx` stays the render shell,
`frontend-modern/src/components/shared/useSearchFieldState.ts` owns focused-
@@ -4703,6 +4716,13 @@ handoff, that same drawer shell must keep the empty conversation state aligned
with the attached briefing as neutral `Context attached` copy instead of
rendering generic cluster/system starter prompts or feature-authored suggested
prompt chips below the source-owned context.
+The global Assistant launcher and the command-palette Assistant open command
+follow the same contextual rule. They must derive current-view context through
+`frontend-modern/src/utils/assistantPageContext.ts`, label the action as asking
+about the current monitoring, Patrol, alerts, or settings view, and open the
+drawer with that `pulse-view` context attached. They must not call
+`aiChatStore.toggle()` or `aiChatStore.open()` without context from the
+authenticated shell, because that reintroduces a generic Assistant front door.
Shared table, disclosure, and form primitives must also stay explicitly typed
at the browser edge. Summary rows may memoize repeated pending-update reads,
shared buttons must preserve discriminated disclosure props, toggle and a11y
diff --git a/frontend-modern/src/AppLayout.tsx b/frontend-modern/src/AppLayout.tsx
index 2e5ff6dc70..d3bb19ce66 100644
--- a/frontend-modern/src/AppLayout.tsx
+++ b/frontend-modern/src/AppLayout.tsx
@@ -43,7 +43,7 @@ import { updateStore } from '@/stores/updates';
import { aiChatStore } from '@/stores/aiChat';
import { isPro } from '@/stores/licenseCommercial';
import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';
-import { AI_CHAT_LAUNCHER_ARIA_LABEL, getAIChatLauncherTitle } from '@/utils/aiChatPresentation';
+import { getAssistantPageContext } from '@/utils/assistantPageContext';
import type { AppConnectionStatus } from '@/useAppRuntimeState';
import { buildInfrastructureWorkspacePath } from '@/components/Settings/infrastructureWorkspaceModel';
@@ -314,6 +314,7 @@ export function AppLayout(props: AppLayoutProps) {
const getActiveTabDesktop = () => getActiveTabForPath(location.pathname);
const getActiveTabMobile = () => getActiveTabForPath(location.pathname);
+ const assistantPageContext = createMemo(() => getAssistantPageContext(location.pathname));
// Platform/runtime nav is resource-admitted. A platform or runtime lens only
// appears when the support manifest says the surface is supported and the
@@ -889,10 +890,10 @@ export function AppLayout(props: AppLayoutProps) {
>
<button
type="button"
- onClick={() => aiChatStore.toggle()}
+ onClick={() => aiChatStore.open(assistantPageContext().context)}
class={AI_CHAT_LAUNCHER_BUTTON_CLASS}
- title={getAIChatLauncherTitle(aiChatStore.context.context?.name)}
- aria-label={AI_CHAT_LAUNCHER_ARIA_LABEL}
+ title={assistantPageContext().title}
+ aria-label={assistantPageContext().ariaLabel}
>
<SparklesIcon class="h-5 w-5 flex-shrink-0" />
</button>
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index b9725d2d37..1268946cc5 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -323,8 +323,10 @@ describe('App architecture', () => {
expect(appLayoutSource).toContain('onMouseEnter={() => warmNavigationTarget(');
expect(appLayoutSource).toContain('aiChatStore.enabled === true &&');
expect(appLayoutSource).toContain('!dialogStackHasBlockingDialog()');
- expect(appLayoutSource).toContain('onClick={() => aiChatStore.toggle()}');
- expect(appLayoutSource).toContain('getAIChatLauncherTitle');
+ expect(appLayoutSource).toContain(
+ 'onClick={() => aiChatStore.open(assistantPageContext().context)}',
+ );
+ expect(appLayoutSource).toContain('getAssistantPageContext');
expect(appLayoutSource).toContain('const AI_CHAT_LAUNCHER_BUTTON_CLASS =');
expect(appLayoutSource).toContain('bottom-[calc(5rem+env(safe-area-inset-bottom,0px))]');
expect(appLayoutSource).toContain('lg:top-1/2');
diff --git a/frontend-modern/src/__tests__/AppLayout.test.tsx b/frontend-modern/src/__tests__/AppLayout.test.tsx
index 4d60b7e8c2..7da8791950 100644
--- a/frontend-modern/src/__tests__/AppLayout.test.tsx
+++ b/frontend-modern/src/__tests__/AppLayout.test.tsx
@@ -1,4 +1,4 @@
-import { cleanup, render, screen, within } from '@solidjs/testing-library';
+import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
import { Route, Router } from '@solidjs/router';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { State } from '@/types/api';
@@ -171,7 +171,7 @@ describe('AppLayout navigation icons', () => {
it('keeps the assistant launcher clear of the mobile navigation breakpoint', () => {
renderLayout();
- const launcher = screen.getByRole('button', { name: 'Expand Pulse Assistant' });
+ const launcher = screen.getByRole('button', { name: 'Ask Pulse Assistant about Settings' });
const launcherClass = launcher.getAttribute('class') ?? '';
expect(launcherClass).toContain('right-4');
@@ -182,4 +182,32 @@ describe('AppLayout navigation icons', () => {
expect(launcherClass).toContain('lg:bottom-auto');
expect(launcherClass).not.toContain('sm:top-1/2');
});
+
+ it('opens Assistant with the current route attached', async () => {
+ const openAssistant = vi.spyOn(aiChatStore, 'open').mockImplementation(() => {});
+ renderLayout();
+
+ await fireEvent.click(
+ screen.getByRole('button', { name: 'Ask Pulse Assistant about Settings' }),
+ );
+
+ await waitFor(() => {
+ expect(openAssistant).toHaveBeenCalledWith(
+ expect.objectContaining({
+ targetType: 'pulse-view',
+ targetId: '/settings/infrastructure',
+ context: expect.objectContaining({
+ name: 'Settings',
+ route: '/settings/infrastructure',
+ surface: 'settings',
+ }),
+ briefing: expect.objectContaining({
+ sourceLabel: 'Current view',
+ title: 'Settings attached',
+ statusLabel: 'Context only',
+ }),
+ }),
+ );
+ });
+ });
});
diff --git a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
index d7013c47d3..c2896ceee2 100644
--- a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
@@ -1,4 +1,4 @@
-import { afterEach, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
import { createSignal, type JSX } from 'solid-js';
import type { Resource } from '@/types/resource';
@@ -12,6 +12,7 @@ const navigateMock = vi.fn();
vi.mock('@solidjs/router', () => ({
useNavigate: () => navigateMock,
+ useLocation: () => ({ pathname: window.location.pathname }),
}));
vi.mock('@/components/shared/Dialog', () => ({
@@ -51,6 +52,10 @@ describe('CommandPaletteModal', () => {
vi.restoreAllMocks();
});
+ beforeEach(() => {
+ window.history.replaceState({}, '', '/proxmox/overview');
+ });
+
it('keeps the command palette on shell, runtime, and model owners', () => {
expect(commandPaletteModalSource).toContain('useCommandPaletteState');
expect(commandPaletteModalSource).not.toContain('useNavigate');
@@ -105,7 +110,7 @@ describe('CommandPaletteModal', () => {
/>
));
- expect(screen.getByText('Open Pulse Assistant')).toBeInTheDocument();
+ expect(screen.getByText('Ask about Proxmox')).toBeInTheDocument();
expect(screen.getByText('Show Assistant commands')).toBeInTheDocument();
expect(screen.getByText('New Assistant session')).toBeInTheDocument();
expect(screen.getByText('Switch Assistant session')).toBeInTheDocument();
@@ -133,7 +138,7 @@ describe('CommandPaletteModal', () => {
expect(screen.getByText('/vmware/networks')).toBeInTheDocument();
const commandLabels = screen.getAllByRole('option').map((button) => button.textContent ?? '');
- expect(commandLabels.findIndex((label) => label.includes('Open Pulse Assistant'))).toBe(0);
+ expect(commandLabels.findIndex((label) => label.includes('Ask about Proxmox'))).toBe(0);
expect(commandLabels.findIndex((label) => label.includes('Go to Proxmox'))).toBeLessThan(
commandLabels.findIndex((label) => label.includes('Go to Machines')),
);
@@ -152,7 +157,7 @@ describe('CommandPaletteModal', () => {
));
const input = screen.getByPlaceholderText('Type a command or search...');
- expect(screen.getByRole('option', { name: /Open Pulse Assistant/ })).toHaveAttribute(
+ expect(screen.getByRole('option', { name: /Ask about Proxmox/ })).toHaveAttribute(
'aria-selected',
'true',
);
@@ -236,7 +241,7 @@ describe('CommandPaletteModal', () => {
await fireEvent.keyDown(input, { key: 'Home' });
- expect(screen.getByRole('option', { name: /Open Pulse Assistant/ })).toHaveAttribute(
+ expect(screen.getByRole('option', { name: /Ask about Proxmox/ })).toHaveAttribute(
'aria-selected',
'true',
);
@@ -344,7 +349,7 @@ describe('CommandPaletteModal', () => {
});
});
- it('opens Pulse Assistant from the command palette after closing the palette', async () => {
+ it('opens Pulse Assistant with current view context after closing the palette', async () => {
const onClose = vi.fn();
const openAssistant = vi.spyOn(aiChatStore, 'open').mockImplementation(() => {});
render(() => (
@@ -355,11 +360,26 @@ describe('CommandPaletteModal', () => {
/>
));
- await fireEvent.click(screen.getByText('Open Pulse Assistant'));
+ await fireEvent.click(screen.getByText('Ask about Proxmox'));
expect(onClose).toHaveBeenCalledTimes(1);
await waitFor(() => {
- expect(openAssistant).toHaveBeenCalledWith();
+ expect(openAssistant).toHaveBeenCalledWith(
+ expect.objectContaining({
+ targetType: 'pulse-view',
+ targetId: '/proxmox/overview',
+ context: expect.objectContaining({
+ name: 'Proxmox',
+ route: '/proxmox/overview',
+ surface: 'proxmox',
+ }),
+ briefing: expect.objectContaining({
+ sourceLabel: 'Current view',
+ title: 'Proxmox attached',
+ statusLabel: 'Context only',
+ }),
+ }),
+ );
});
});
diff --git a/frontend-modern/src/components/shared/commandPaletteModel.ts b/frontend-modern/src/components/shared/commandPaletteModel.ts
index 25b600312f..8a54b5dc31 100644
--- a/frontend-modern/src/components/shared/commandPaletteModel.ts
+++ b/frontend-modern/src/components/shared/commandPaletteModel.ts
@@ -41,21 +41,31 @@ export type CommandPaletteAssistantActions = {
redo: () => void;
};
+export type CommandPaletteAssistantOpenPresentation = {
+ description: string;
+ label: string;
+};
+
export function buildCommandPaletteCommands(options: {
paths: CommandPaletteCommandPaths;
platformVisibility: PlatformNavigationVisibility;
navigate: (path: string) => void;
assistantActions?: CommandPaletteAssistantActions;
+ assistantOpenPresentation?: CommandPaletteAssistantOpenPresentation;
}): CommandPaletteModalCommand[] {
const commands: CommandPaletteModalCommand[] = [];
if (options.assistantActions) {
+ const assistantOpenPresentation = options.assistantOpenPresentation ?? {
+ label: 'Ask about this view',
+ description: 'Use the current Pulse view as context',
+ };
commands.push(
{
id: 'assistant-open',
- label: 'Open Pulse Assistant',
- description: 'Chat with Pulse about this infrastructure',
- keywords: ['assistant', 'ai', 'chat', 'ask', 'pulse'],
+ label: assistantOpenPresentation.label,
+ description: assistantOpenPresentation.description,
+ keywords: ['assistant', 'ai', 'chat', 'ask', 'pulse', 'view', 'context'],
action: options.assistantActions.open,
},
{
diff --git a/frontend-modern/src/components/shared/useCommandPaletteState.ts b/frontend-modern/src/components/shared/useCommandPaletteState.ts
index ecf48e875b..9f13fbdb98 100644
--- a/frontend-modern/src/components/shared/useCommandPaletteState.ts
+++ b/frontend-modern/src/components/shared/useCommandPaletteState.ts
@@ -1,4 +1,4 @@
-import { useNavigate } from '@solidjs/router';
+import { useLocation, useNavigate } from '@solidjs/router';
import { createEffect, createMemo, createSignal } from 'solid-js';
import {
buildDockerPath,
@@ -9,6 +9,7 @@ import {
buildVmwarePath,
} from '@/routing/resourceLinks';
import { aiChatStore, type AIChatCommandRequestAction } from '@/stores/aiChat';
+import { getAssistantPageContext } from '@/utils/assistantPageContext';
import {
buildCommandPaletteCommands,
filterCommandPaletteCommands,
@@ -24,9 +25,11 @@ const runAfterPaletteSelection = (action: () => void) => {
export function useCommandPaletteState(props: CommandPaletteModalProps) {
const navigate = useNavigate();
+ const location = useLocation();
const [query, setQuery] = createSignal('');
const [inputRef, setInputRef] = createSignal<HTMLInputElement>();
const [selectedIndex, setSelectedIndex] = createSignal(0);
+ const assistantPageContext = createMemo(() => getAssistantPageContext(location.pathname));
const requestAssistantCommand = (action: AIChatCommandRequestAction) => {
runAfterPaletteSelection(() => aiChatStore.requestCommand(action));
@@ -46,8 +49,13 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) {
},
platformVisibility: props.platformVisibility(),
navigate,
+ assistantOpenPresentation: {
+ label: assistantPageContext().commandLabel,
+ description: assistantPageContext().commandDescription,
+ },
assistantActions: {
- open: () => runAfterPaletteSelection(() => aiChatStore.open()),
+ open: () =>
+ runAfterPaletteSelection(() => aiChatStore.open(assistantPageContext().context)),
help: () => requestAssistantCommand('help'),
newSession: () => requestAssistantCommand('new'),
sessions: () => requestAssistantCommand('sessions'),
diff --git a/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
index 222eca1d50..27b971cd5f 100644
--- a/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
@@ -91,16 +91,14 @@ describe('aiChatPresentation', () => {
expect(AI_CHAT_REDO_LAST_TURN_LOADING_MESSAGE).toBe('Assistant is still working');
expect(AI_CHAT_REDO_LAST_TURN_ERROR_MESSAGE).toBe('Failed to redo Assistant turn');
expect(AI_CHAT_REDO_LAST_TURN_SUCCESS_MESSAGE).toBe('Assistant turn restored');
- expect(AI_CHAT_LAUNCHER_ARIA_LABEL).toBe('Expand Pulse Assistant');
+ expect(AI_CHAT_LAUNCHER_ARIA_LABEL).toBe('Ask Pulse Assistant about this view');
expect(AI_CHAT_CLOSE_LABEL).toBe('Close Pulse Assistant');
expect(AI_CHAT_SESSION_MENU_TITLE).toBe('Pulse Assistant sessions');
expect(AI_CHAT_AUTONOMOUS_WARNING_DISMISS_LABEL).toBe('Dismiss chat actions warning');
expect(AI_CHAT_DISCOVERY_HINT_DISMISS_LABEL).toBe('Dismiss discovery context warning');
expect(AI_CHAT_CONTROL_MODE_LABEL).toBe('Assistant chat action mode');
expect(AI_CHAT_CONTROL_MODE_MENU_LABEL).toBe('Assistant chat action options');
- expect(AI_CHAT_SWITCH_TO_APPROVAL_LABEL).toBe(
- 'Switch Assistant chat actions to Ask first',
- );
+ expect(AI_CHAT_SWITCH_TO_APPROVAL_LABEL).toBe('Switch Assistant chat actions to Ask first');
expect(AI_CHAT_COMMAND_HELP_TITLE).toBe('Assistant commands');
expect(AI_CHAT_COMMAND_HELP_BUTTON_LABEL).toBe('Open Assistant commands');
expect(AI_CHAT_COMMAND_HELP_CLOSE_LABEL).toBe('Close Assistant commands');
@@ -125,8 +123,8 @@ describe('aiChatPresentation', () => {
});
it('builds canonical launcher titles without implying a keyboard shortcut', () => {
- expect(getAIChatLauncherTitle()).toBe('Open Pulse Assistant');
- expect(getAIChatLauncherTitle('Core Fabric')).toBe('Open Pulse Assistant for Core Fabric');
+ expect(getAIChatLauncherTitle()).toBe('Ask Pulse Assistant about this view');
+ expect(getAIChatLauncherTitle('Core Fabric')).toBe('Ask Pulse Assistant about Core Fabric');
expect(getAIChatLauncherTitle()).not.toContain('⌘K');
});
diff --git a/frontend-modern/src/utils/__tests__/assistantPageContext.test.ts b/frontend-modern/src/utils/__tests__/assistantPageContext.test.ts
new file mode 100644
index 0000000000..879fafe878
--- /dev/null
+++ b/frontend-modern/src/utils/__tests__/assistantPageContext.test.ts
@@ -0,0 +1,56 @@
+import { describe, expect, it } from 'vitest';
+import { getAssistantPageContext } from '@/utils/assistantPageContext';
+
+describe('assistantPageContext', () => {
+ it('attaches monitor-first platform route context to Assistant launches', () => {
+ const presentation = getAssistantPageContext('/proxmox/overview');
+
+ expect(presentation).toMatchObject({
+ ariaLabel: 'Ask Pulse Assistant about Proxmox',
+ commandDescription: 'Use the current Proxmox view as context',
+ commandLabel: 'Ask about Proxmox',
+ label: 'Proxmox',
+ title: 'Ask Pulse Assistant about Proxmox',
+ });
+ expect(presentation.context).toMatchObject({
+ targetType: 'pulse-view',
+ targetId: '/proxmox/overview',
+ context: {
+ name: 'Proxmox',
+ route: '/proxmox/overview',
+ surface: 'proxmox',
+ },
+ briefing: {
+ sourceLabel: 'Current view',
+ title: 'Proxmox attached',
+ subject: 'Proxmox view',
+ statusLabel: 'Context only',
+ },
+ });
+ });
+
+ it('keeps Patrol as the visible checking-loop surface', () => {
+ const presentation = getAssistantPageContext('/patrol');
+
+ expect(presentation.commandLabel).toBe('Ask about Patrol');
+ expect(presentation.context.context).toMatchObject({
+ name: 'Patrol',
+ route: '/patrol',
+ surface: 'ai',
+ });
+ expect(presentation.context.briefing?.title).toBe('Patrol attached');
+ });
+
+ it('falls back to current-view context for unowned routes', () => {
+ const presentation = getAssistantPageContext('custom/report');
+
+ expect(presentation.ariaLabel).toBe('Ask Pulse Assistant about this view');
+ expect(presentation.commandLabel).toBe('Ask about this view');
+ expect(presentation.context.targetId).toBe('/custom/report');
+ expect(presentation.context.context).toMatchObject({
+ name: 'Current view',
+ route: '/custom/report',
+ surface: 'unknown',
+ });
+ });
+});
diff --git a/frontend-modern/src/utils/aiChatPresentation.ts b/frontend-modern/src/utils/aiChatPresentation.ts
index ecca94b42e..2c760381e5 100644
--- a/frontend-modern/src/utils/aiChatPresentation.ts
+++ b/frontend-modern/src/utils/aiChatPresentation.ts
@@ -4,7 +4,7 @@ export const AI_CHAT_DRAWER_TITLE = 'Pulse Assistant';
export const AI_CHAT_DRAWER_SUBTITLE =
'Observed context, provider-backed reasoning, and governed actions.';
export const AI_CHAT_COLLAPSE_TITLE = 'Collapse Pulse Assistant';
-export const AI_CHAT_LAUNCHER_ARIA_LABEL = 'Expand Pulse Assistant';
+export const AI_CHAT_LAUNCHER_ARIA_LABEL = 'Ask Pulse Assistant about this view';
export const AI_CHAT_SESSION_MENU_TITLE = 'Pulse Assistant sessions';
export const AI_CHAT_CLOSE_LABEL = 'Close Pulse Assistant';
export const AI_CHAT_NEW_SESSION_SHORT_LABEL = 'New';
@@ -85,10 +85,10 @@ export interface AIChatProviderReadinessPresentation {
export function getAIChatLauncherTitle(contextName?: unknown) {
if (typeof contextName === 'string' && contextName.trim().length > 0) {
- return `Open Pulse Assistant for ${contextName}`;
+ return `Ask Pulse Assistant about ${contextName}`;
}
- return 'Open Pulse Assistant';
+ return 'Ask Pulse Assistant about this view';
}
export function getAIChatProviderReadinessPresentation(args: {
diff --git a/frontend-modern/src/utils/assistantPageContext.ts b/frontend-modern/src/utils/assistantPageContext.ts
new file mode 100644
index 0000000000..6f36cdd0ea
--- /dev/null
+++ b/frontend-modern/src/utils/assistantPageContext.ts
@@ -0,0 +1,62 @@
+import type { AIChatContext } from '@/stores/aiChat';
+import { getActiveTabForPath, type ActiveAppTabId } from '@/routing/navigation';
+
+export interface AssistantPageContextPresentation {
+ ariaLabel: string;
+ commandDescription: string;
+ commandLabel: string;
+ context: AIChatContext;
+ label: string;
+ title: string;
+}
+
+const VIEW_LABELS: Record<Exclude<ActiveAppTabId, null>, string> = {
+ alerts: 'Alerts',
+ ai: 'Patrol',
+ docker: 'Docker',
+ kubernetes: 'Kubernetes',
+ proxmox: 'Proxmox',
+ settings: 'Settings',
+ standalone: 'Machines',
+ truenas: 'TrueNAS',
+ vmware: 'vSphere',
+};
+
+const normalizePathname = (pathname: string): string => {
+ const trimmed = pathname.trim();
+ if (!trimmed) return '/';
+ return trimmed.startsWith('/') ? trimmed : `/${trimmed}`;
+};
+
+export function getAssistantPageContext(pathname: string): AssistantPageContextPresentation {
+ const route = normalizePathname(pathname);
+ const activeTab = getActiveTabForPath(route);
+ const label = activeTab ? VIEW_LABELS[activeTab] : 'this view';
+ const contextName = activeTab ? label : 'Current view';
+ const subject = activeTab ? `${label} view` : 'Current Pulse view';
+
+ return {
+ ariaLabel: `Ask Pulse Assistant about ${label}`,
+ commandDescription: activeTab
+ ? `Use the current ${label} view as context`
+ : 'Use the current Pulse view as context',
+ commandLabel: `Ask about ${label}`,
+ label,
+ title: `Ask Pulse Assistant about ${label}`,
+ context: {
+ targetType: 'pulse-view',
+ targetId: route,
+ context: {
+ name: contextName,
+ route,
+ surface: activeTab ?? 'unknown',
+ },
+ briefing: {
+ sourceLabel: 'Current view',
+ title: `${contextName} attached`,
+ subject,
+ statusLabel: 'Context only',
+ },
+ },
+ };
+}