Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
collapse VoiceTab's five remaining stale-pin selects onto withUnlistedOption
[._.]/ Adam Eivy72dcbfc5e86d
diff --git a/client/src/components/settings/VoiceTab.jsx b/client/src/components/settings/VoiceTab.jsxindex 40c35dce4c..17838a0bb9 100644--- a/client/src/components/settings/VoiceTab.jsx+++ b/client/src/components/settings/VoiceTab.jsx@@ -312,10 +312,32 @@ export function VoiceTab() {const llmModel = cfg.llm.model || 'auto';const llmVisionModel = cfg.llm.visionModel || 'auto';const selectedProvider = apiProviders.find((p) => p.id === llmProvider);+ // Still used to gate the refresh buttons below, so kept alongside+ // providerOptions rather than folded away.const providerMissing = apiProviders.length > 0 && !selectedProvider;+ // An empty registry means "not loaded yet" (or the fetch failed), not+ // "confirmed not an API provider" — the synthetic option's own text makes+ // that distinction, since `withUnlistedOption` can't know why a value is+ // absent from an empty list.+ const providerOptions = withUnlistedOption(+ apiProviders,+ llmProvider,+ (id) => ({ id, name: apiProviders.length === 0 ? id : `${id} (not an API provider)` }),+ );const providerModels = selectedProvider?.models || [];- const modelMissing = llmModel !== 'auto' && !providerModels.includes(llmModel);- const visionModelMissing = llmVisionModel !== 'auto' && !providerModels.includes(llmVisionModel);+ // `providerModels` is a flat id-string list; wrap each as `{id}` so the+ // shared helper's default `key: 'id'` object contract applies uniformly to+ // real and synthetic entries alike.+ const modelChoices = providerModels.map((m) => ({ id: m }));+ // 'auto' is a sentinel rendered as its own hardcoded option below, never a+ // real catalog id — routing it through the helper would wrongly flag it as+ // an unlisted pin and duplicate the `value="auto"` option.+ const modelOptions = llmModel === 'auto'+ ? modelChoices+ : withUnlistedOption(modelChoices, llmModel, (id) => ({ id, current: true }));+ const visionModelOptions = llmVisionModel === 'auto'+ ? modelChoices+ : withUnlistedOption(modelChoices, llmVisionModel, (id) => ({ id, current: true }));// Code-agent delegation picker. Empty provider/model = "system default" (the// CoS spawner's activeProvider + selectModelForTask). The saved choice is@@ -324,12 +346,17 @@ export function VoiceTab() {const codeProvider = codeAgentCfg.provider || '';const codeModel = codeAgentCfg.model || '';const selectedCodeProvider = codeProviders.find((p) => p.id === codeProvider);- // Only flag a missing provider AFTER the registry loads — otherwise a saved+ // Only flag a missing agent AFTER the registry loads — otherwise a saved// agent is briefly mislabeled "(not a coding agent)" during the fetch (or if- // it fails and codeProviders stays []). Mirrors providerMissing above.- const codeProviderMissing = codeProviders.length > 0 && !!codeProvider && !selectedCodeProvider;+ // it fails and codeProviders stays []). Mirrors providerOptions above,+ // but this picker suppresses the synthetic entirely while unloaded rather+ // than showing an unannotated fallback.+ const codeProviderOptions = codeProviders.length === 0+ ? codeProviders+ : withUnlistedOption(codeProviders, codeProvider, (id) => ({ id, name: `${id} (not a coding agent)` }));const codeProviderModels = selectedCodeProvider?.models || [];- const codeModelMissing = !!codeModel && !codeProviderModels.includes(codeModel);+ const codeModelChoices = codeProviderModels.map((m) => ({ id: m }));+ const codeModelOptions = withUnlistedOption(codeModelChoices, codeModel, (id) => ({ id, current: true }));// Fast-resolution cascade config + on-device availability pill.const fastPathCfg = cfg.llm.fastPath || {};@@ -602,15 +629,11 @@ export function VoiceTab() {}}className={inputCls}>- {providerMissing && (- <option value={llmProvider}>{llmProvider} (not an API provider)</option>- )}- {apiProviders.map((p) => (+ {providerOptions.map((p) => (<option key={p.id} value={p.id}>{p.name}{p.enabled === false ? ' (disabled)' : ''}</option>))}- {apiProviders.length === 0 && <option value={llmProvider}>{llmProvider}</option>}</select></FormField>@@ -629,9 +652,8 @@ export function VoiceTab() {className={`${inputCls} flex-1`}><option value="auto">auto</option>- {modelMissing && <option value={llmModel}>{llmModel} (current)</option>}- {providerModels.map((m) => (- <option key={m} value={m}>{m}</option>+ {modelOptions.map((opt) => (+ <option key={opt.id} value={opt.id}>{opt.id}{opt.current ? ' (current)' : ''}</option>))}</select><button@@ -658,9 +680,8 @@ export function VoiceTab() {className={`${inputCls} flex-1`}><option value="auto">auto</option>- {visionModelMissing && <option value={llmVisionModel}>{llmVisionModel} (current)</option>}- {providerModels.map((m) => (- <option key={m} value={m}>{m}</option>+ {visionModelOptions.map((opt) => (+ <option key={opt.id} value={opt.id}>{opt.id}{opt.current ? ' (current)' : ''}</option>))}</select><button@@ -789,10 +810,7 @@ export function VoiceTab() {className={inputCls}><option value="">System default</option>- {codeProviderMissing && (- <option value={codeProvider}>{codeProvider} (not a coding agent)</option>- )}- {codeProviders.map((p) => (+ {codeProviderOptions.map((p) => (<option key={p.id} value={p.id}>{p.name}{p.enabled === false ? ' (disabled)' : ''}</option>@@ -806,9 +824,8 @@ export function VoiceTab() {className={inputCls}><option value="">System default</option>- {codeModelMissing && <option value={codeModel}>{codeModel} (current)</option>}- {codeProviderModels.map((m) => (- <option key={m} value={m}>{m}</option>+ {codeModelOptions.map((opt) => (+ <option key={opt.id} value={opt.id}>{opt.id}{opt.current ? ' (current)' : ''}</option>))}</select></FormField>diff --git a/client/src/components/settings/VoiceTab.test.jsx b/client/src/components/settings/VoiceTab.test.jsxindex e3670fb0a4..2e585a8e61 100644--- a/client/src/components/settings/VoiceTab.test.jsx+++ b/client/src/components/settings/VoiceTab.test.jsx@@ -2,6 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';import { fireEvent, render, screen, waitFor } from '@testing-library/react';import { MemoryRouter } from 'react-router';import VoiceTab from './VoiceTab';+import { getProviders } from '../../services/apiProviders';const voiceApi = vi.hoisted(() => ({getVoiceStatus: vi.fn(),@@ -161,3 +162,92 @@ describe('VoiceTab TTS engine registry', () => {expect(screen.getByRole('option', { name: 'retired-voice (current)' })).toBeTruthy();});});++describe('VoiceTab LLM / code-agent pickers', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ voiceApi.getVoiceConfig.mockResolvedValue(structuredClone(config));+ voiceApi.getVoiceStatus.mockResolvedValue({ services: {} });+ voiceApi.listVoiceEngines.mockResolvedValue({ engines: [] });+ voiceApi.listVoices.mockResolvedValue({ engine: 'qwen3-tts', voices: [] });+ });++ it('keeps a linked LLM provider, model, and vision model the registry no longer lists selectable', async () => {+ getProviders.mockResolvedValue({+ providers: [{ id: 'lmstudio', type: 'api', name: 'LM Studio', models: ['some-model'] }],+ });+ voiceApi.getVoiceConfig.mockResolvedValue({+ ...structuredClone(config),+ llm: {+ ...structuredClone(config.llm),+ provider: 'retired-provider',+ model: 'retired-model',+ visionModel: 'retired-vision-model',+ },+ });++ render(<MemoryRouter><VoiceTab /></MemoryRouter>);++ const providerSelect = await screen.findByRole('combobox', { name: 'LLM provider' });+ expect(providerSelect).toHaveValue('retired-provider');+ expect(screen.getByRole('option', { name: 'retired-provider (not an API provider)' })).toBeTruthy();++ expect(screen.getByRole('combobox', { name: 'LLM model' })).toHaveValue('retired-model');+ expect(screen.getByRole('option', { name: 'retired-model (current)' })).toBeTruthy();++ expect(screen.getByRole('combobox', { name: 'Vision model' })).toHaveValue('retired-vision-model');+ expect(screen.getByRole('option', { name: 'retired-vision-model (current)' })).toBeTruthy();+ });++ it('shows the saved LLM provider without a false "not an API provider" label while the registry has not loaded', async () => {+ getProviders.mockReturnValue(new Promise(() => {})); // never resolves+ voiceApi.getVoiceConfig.mockResolvedValue({+ ...structuredClone(config),+ llm: { ...structuredClone(config.llm), provider: 'lmstudio' },+ });++ render(<MemoryRouter><VoiceTab /></MemoryRouter>);++ const providerSelect = await screen.findByRole('combobox', { name: 'LLM provider' });+ expect(providerSelect).toHaveValue('lmstudio');+ expect(screen.getByRole('option', { name: 'lmstudio' })).toBeTruthy();+ expect(screen.queryByRole('option', { name: /not an API provider/ })).toBeNull();+ });++ it('keeps a linked coding agent and its model selectable once the registry has loaded', async () => {+ getProviders.mockResolvedValue({+ providers: [{ id: 'claude-code', type: 'cli', name: 'Claude Code', models: ['sonnet'] }],+ });+ voiceApi.getVoiceConfig.mockResolvedValue({+ ...structuredClone(config),+ llm: {+ ...structuredClone(config.llm),+ codeAgent: { enabled: true, provider: 'retired-agent', model: 'retired-agent-model' },+ },+ });++ render(<MemoryRouter><VoiceTab /></MemoryRouter>);++ const agentSelect = await screen.findByRole('combobox', { name: 'Coding agent' });+ expect(agentSelect).toHaveValue('retired-agent');+ expect(screen.getByRole('option', { name: 'retired-agent (not a coding agent)' })).toBeTruthy();+ expect(screen.getByRole('combobox', { name: 'Model' })).toHaveValue('retired-agent-model');+ expect(screen.getByRole('option', { name: 'retired-agent-model (current)' })).toBeTruthy();+ });++ it('does not mislabel a saved coding agent while the registry has not loaded', async () => {+ getProviders.mockReturnValue(new Promise(() => {})); // never resolves+ voiceApi.getVoiceConfig.mockResolvedValue({+ ...structuredClone(config),+ llm: {+ ...structuredClone(config.llm),+ codeAgent: { enabled: true, provider: 'retired-agent', model: 'retired-agent-model' },+ },+ });++ render(<MemoryRouter><VoiceTab /></MemoryRouter>);++ await screen.findByRole('combobox', { name: 'Coding agent' });+ expect(screen.queryByRole('option', { name: /not a coding agent/ })).toBeNull();+ });+});