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.

Polish Pulse Assistant runtime route labels

rcourtman7327f815465f
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 3621e6645f..a98309912f 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -607,7 +607,12 @@ runtime cost control, and shared AI transport surfaces.
`pulse_read(...)`. That fixture keeps session restore, transcript tooling,
stream-contract tests, and live browser checks exercising the same
backend-to-browser shape as a real provider/tool turn, including the raw
- function-call syntax Pulse must summarize instead of rendering. Mock mode is
+ function-call syntax Pulse must summarize instead of rendering. Pulse-owned
+ local Assistant routes such as `pulse:local-inventory` and
+ `pulse:mock-assistant` must render through named labels (`Pulse inventory`,
+ `Pulse mock Assistant`) in shared model picker and transcript chrome; the
+ raw route IDs are implementation details, unlike external provider route IDs
+ that may remain visible for disambiguation. Mock mode is
also an effective runtime-config
overlay: `internal/api/ai_handler.go` startup, restart, config sync, and
tenant service initialization must treat Assistant as enabled in memory when
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index f1aa8b0df8..84793b08e1 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -356,6 +356,13 @@ scan-friendly without hiding any container from drilldown.
`patrol-assessment`/`pulse-patrol-assessment` target identity rather than a
retired dashboard target, so first-open and restored-session chrome remain
source-named.
+ The shared `frontend-modern/src/components/shared/AIModelPicker.tsx`
+ primitive must keep model route presentation delegated to the AI runtime
+ label helpers. Pulse-owned local Assistant routes such as
+ `pulse:local-inventory` and `pulse:mock-assistant` are implementation
+ routes and must render as named choices without secondary raw route IDs,
+ while external provider route IDs may remain visible where they disambiguate
+ catalog entries.
9. `frontend-modern/src/utils/platformSupportManifest.generated.ts` shared with `unified-resources`: the generated platform support projection is both a canonical unified-resource platform union boundary and a shared frontend source/platform vocabulary boundary.
It must expose the manifest `surface_kind` field so runtime lenses such as
`docker` are not collapsed back into owning platform semantics.
diff --git a/frontend-modern/src/components/shared/AIModelPicker.tsx b/frontend-modern/src/components/shared/AIModelPicker.tsx
index 5a7f664eeb..f14f476895 100644
--- a/frontend-modern/src/components/shared/AIModelPicker.tsx
+++ b/frontend-modern/src/components/shared/AIModelPicker.tsx
@@ -19,6 +19,7 @@ import {
formatAIModelRouteLabel,
getAIProviderDisplayName,
getProviderFromModelId,
+ isPulseOwnedLocalModelRoute,
} from '@/utils/aiProviderPresentation';
type AIModelPickerDefaultOption = {
@@ -108,6 +109,7 @@ const modelRouteDescription = (entry: ResolvedModelRoute) =>
const modelRouteSecondaryId = (entry: ResolvedModelRoute) => {
const model = entry.model;
+ if (model && isPulseOwnedLocalModelRoute(model.id)) return '';
if (!model?.name || model.name === model.id) return '';
return model.id;
};
@@ -781,44 +783,51 @@ export const AIModelPicker: Component<AIModelPickerProps> = (props) => {
{getAIProviderDisplayName(provider) || provider}
</div>
<For each={providerModels}>
- {(model) => (
- <button
- type="button"
- ref={(button) => {
- optionRefs.set(optionKeyForModel(model.id), button);
- }}
- onClick={() => handleSelect(model.id)}
- onKeyDown={(event) =>
- handleOptionKeyDown(event, optionKeyForModel(model.id))
- }
- role="option"
- aria-selected={isSelectedRoute(model.id)}
- aria-label={optionAriaLabel(
- formatAIModelRouteLabel(model),
- isSelectedRoute(model.id),
- [
- model.description,
- model.name && model.name !== model.id ? model.id : undefined,
- ],
- )}
- class={optionClass(isSelectedRoute(model.id))}
- >
- <div class="flex min-w-0 items-center gap-2">
- <span class="min-w-0 flex-1 truncate font-medium text-base-content">
- {formatAIModelRouteLabel(model)}
- </span>
- <Show when={isSelectedRoute(model.id)}>
- <CurrentSelectionBadge />
+ {(model) => {
+ const secondaryModelId = () =>
+ model.name &&
+ model.name !== model.id &&
+ !isPulseOwnedLocalModelRoute(model.id)
+ ? model.id
+ : undefined;
+ return (
+ <button
+ type="button"
+ ref={(button) => {
+ optionRefs.set(optionKeyForModel(model.id), button);
+ }}
+ onClick={() => handleSelect(model.id)}
+ onKeyDown={(event) =>
+ handleOptionKeyDown(event, optionKeyForModel(model.id))
+ }
+ role="option"
+ aria-selected={isSelectedRoute(model.id)}
+ aria-label={optionAriaLabel(
+ formatAIModelRouteLabel(model),
+ isSelectedRoute(model.id),
+ [model.description, secondaryModelId()],
+ )}
+ class={optionClass(isSelectedRoute(model.id))}
+ >
+ <div class="flex min-w-0 items-center gap-2">
+ <span class="min-w-0 flex-1 truncate font-medium text-base-content">
+ {formatAIModelRouteLabel(model)}
+ </span>
+ <Show when={isSelectedRoute(model.id)}>
+ <CurrentSelectionBadge />
+ </Show>
+ </div>
+ <Show when={model.description}>
+ <div class="line-clamp-2 text-[11px] text-muted">
+ {model.description}
+ </div>
</Show>
- </div>
- <Show when={model.description}>
- <div class="line-clamp-2 text-[11px] text-muted">{model.description}</div>
- </Show>
- <Show when={model.name && model.name !== model.id}>
- <div class="text-[10px] text-muted">{model.id}</div>
- </Show>
- </button>
- )}
+ <Show when={secondaryModelId()}>
+ {(modelId) => <div class="text-[10px] text-muted">{modelId()}</div>}
+ </Show>
+ </button>
+ );
+ }}
</For>
</>
)}
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 8439efb443..bf937dd187 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -193,6 +193,9 @@ describe('shared primitive guardrails', () => {
it('keeps AI model picker labels route-aware for gateway providers', () => {
expect(aiModelPickerSource).toContain('formatAIModelRouteLabel(match)');
expect(aiModelPickerSource).toContain('formatAIModelRouteLabel(model)');
+ expect(aiModelPickerSource).toContain('isPulseOwnedLocalModelRoute');
+ expect(aiModelPickerSource).toContain('const secondaryModelId = () =>');
+ expect(aiModelPickerSource).toContain('!isPulseOwnedLocalModelRoute(model.id)');
expect(aiModelPickerSource).not.toContain("model.id.split(':').pop()");
});
diff --git a/frontend-modern/src/components/shared/__tests__/AIModelPicker.test.tsx b/frontend-modern/src/components/shared/__tests__/AIModelPicker.test.tsx
index dde34efb2e..67fa5aa2f0 100644
--- a/frontend-modern/src/components/shared/__tests__/AIModelPicker.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/AIModelPicker.test.tsx
@@ -84,6 +84,34 @@ describe('AIModelPicker', () => {
expect(screen.getByText('DeepSeek: DeepSeek V4 Pro')).toBeInTheDocument();
});
+ it('labels Pulse-owned mock routes as Assistant runtime choices', () => {
+ const routeModels: ModelInfo[] = [
+ {
+ id: 'pulse:mock-assistant',
+ name: 'Pulse mock Assistant',
+ provider: 'pulse',
+ notable: true,
+ },
+ ];
+
+ render(() => (
+ <AIModelPicker
+ models={routeModels}
+ selectedModel="pulse:mock-assistant"
+ onModelSelect={vi.fn()}
+ title="Select shared default model"
+ />
+ ));
+
+ expect(screen.getByText('Pulse mock Assistant')).toBeInTheDocument();
+
+ fireEvent.click(screen.getByTitle('Select shared default model'));
+
+ expect(screen.getByText('Pulse')).toBeInTheDocument();
+ expect(screen.getAllByText('Pulse mock Assistant').length).toBeGreaterThan(0);
+ expect(screen.queryByText('pulse:mock-assistant')).not.toBeInTheDocument();
+ });
+
it('separates selected model labels from selection badges in composer chrome', () => {
render(() => (
<AIModelPicker
diff --git a/frontend-modern/src/utils/__tests__/aiProviderPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiProviderPresentation.test.ts
index c383f5d797..0626a5a47a 100644
--- a/frontend-modern/src/utils/__tests__/aiProviderPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiProviderPresentation.test.ts
@@ -4,6 +4,7 @@ import {
formatAIModelRouteLabel,
getAIProviderDisplayName,
getProviderFromModelId,
+ isPulseOwnedLocalModelRoute,
} from '@/utils/aiProviderPresentation';
describe('aiProviderPresentation', () => {
@@ -11,6 +12,7 @@ describe('aiProviderPresentation', () => {
expect(AI_PROVIDER_DISPLAY_NAMES.openai).toBe('OpenAI');
expect(getAIProviderDisplayName('anthropic')).toBe('Anthropic');
expect(getAIProviderDisplayName('gemini')).toBe('Google Gemini');
+ expect(getAIProviderDisplayName('pulse')).toBe('Pulse');
expect(getAIProviderDisplayName('custom-provider')).toBe('custom-provider');
});
@@ -70,5 +72,16 @@ describe('aiProviderPresentation', () => {
it('labels Pulse-owned local runtime routes without provider wording', () => {
expect(formatAIModelRouteLabel('pulse:local-inventory')).toBe('Pulse inventory');
+ expect(formatAIModelRouteLabel('pulse:mock-assistant')).toBe('Pulse mock Assistant');
+ expect(
+ formatAIModelRouteLabel({
+ id: 'pulse:mock-assistant',
+ name: 'Pulse mock Assistant',
+ provider: 'pulse',
+ }),
+ ).toBe('Pulse mock Assistant');
+ expect(isPulseOwnedLocalModelRoute('pulse:local-inventory')).toBe(true);
+ expect(isPulseOwnedLocalModelRoute('pulse:mock-assistant')).toBe(true);
+ expect(isPulseOwnedLocalModelRoute('pulse:unknown')).toBe(false);
});
});
diff --git a/frontend-modern/src/utils/aiProviderPresentation.ts b/frontend-modern/src/utils/aiProviderPresentation.ts
index 52b77f9b18..8e6b4ee86c 100644
--- a/frontend-modern/src/utils/aiProviderPresentation.ts
+++ b/frontend-modern/src/utils/aiProviderPresentation.ts
@@ -7,6 +7,7 @@ export const AI_PROVIDER_DISPLAY_NAMES: Record<string, string> = {
deepseek: 'DeepSeek',
gemini: 'Google Gemini',
ollama: 'Ollama',
+ pulse: 'Pulse',
};
export const getAIProviderDisplayName = (provider: string): string =>
@@ -54,7 +55,10 @@ type AIModelRouteLabelInput =
const GATEWAY_MODEL_PROVIDERS = new Set<string>(['openrouter']);
const LOCAL_MODEL_ROUTE_LABELS: Record<string, string> = {
'pulse:local-inventory': 'Pulse inventory',
+ 'pulse:mock-assistant': 'Pulse mock Assistant',
};
+export const isPulseOwnedLocalModelRoute = (modelId: string): boolean =>
+ Boolean(LOCAL_MODEL_ROUTE_LABELS[modelId.trim()]);
const UPSTREAM_PROVIDER_DISPLAY_NAMES: Record<string, string> = {
anthropic: 'Anthropic',
'arcee-ai': 'Arcee AI',