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
refactor([sweep-provider-type-tui-inline-checks-in-client]): adopt isTuiProvider + new isCliProvider/isProcessProvider at saved-provider chip sites
[._.]/ Adam Eivy9f9dad3a6c42
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsxindex 0a64d902c5..dcbe84c76f 100644--- a/client/src/components/cos/TaskAddForm.jsx+++ b/client/src/components/cos/TaskAddForm.jsx@@ -5,7 +5,7 @@ import AppContextPicker from '../AppContextPicker';import * as api from '../../services/api';import { processScreenshotUploads, processAttachmentUploads } from '../../utils/fileUpload';import { formatBytes } from '../../utils/formatters';-import { filterSelectableModels } from '../../utils/providers';+import { filterSelectableModels, isTuiProvider, isCliProvider } from '../../utils/providers';import { REVIEWER_OPTIONS, DEFAULT_REVIEWER } from './constants';const isCodexProvider = (provider) => {@@ -83,9 +83,9 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faconst availableModels = filterSelectableModels(selectedProvider?.models);const providerModelNote = (() => {if (!selectedProvider) return '';- if (selectedProvider.type === 'tui') return `${selectedProvider.name} runs in an attachable terminal UI session.`;+ if (isTuiProvider(selectedProvider)) return `${selectedProvider.name} runs in an attachable terminal UI session.`;if (isCodexProvider(selectedProvider)) return 'Codex uses the model configured in ~/.codex/config.toml.';- if (selectedProvider.type === 'cli') return `${selectedProvider.name} uses its CLI configured default model.`;+ if (isCliProvider(selectedProvider)) return `${selectedProvider.name} uses its CLI configured default model.`;return 'No models are configured. PortOS will use the provider default.';})();diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsxindex b40fbae57d..51c0a27faf 100644--- a/client/src/pages/AIProviders.jsx+++ b/client/src/pages/AIProviders.jsx@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';import toast from '../components/ui/Toast';import * as api from '../services/api';import socket from '../services/socket';-import { filterSelectableModels, providerTypeClass, isTuiProvider } from '../utils/providers';+import { filterSelectableModels, providerTypeClass, isTuiProvider, isProcessProvider } from '../utils/providers';export default function AIProviders() {const [providers, setProviders] = useState([]);@@ -259,7 +259,7 @@ export default function AIProviders() {)}</div><div className="mt-1 text-xs text-gray-400 space-y-0.5">- {(provider.type === 'cli' || provider.type === 'tui') && (+ {isProcessProvider(provider) && (<p>Command: <code className="text-gray-300">{provider.command} {provider.args?.join(' ')}</code></p>)}{provider.type === 'api' && (@@ -307,7 +307,7 @@ export default function AIProviders() {><option value="">Select Provider</option>{providers.filter(p => p.enabled).map(p => (- <option key={p.id} value={p.id}>{p.name}{p.type === 'tui' ? ' (CoS TUI)' : ''}</option>+ <option key={p.id} value={p.id}>{p.name}{isTuiProvider(p) ? ' (CoS TUI)' : ''}</option>))}</select>@@ -393,7 +393,7 @@ export default function AIProviders() {</div><div className="mt-2 text-sm text-gray-400 space-y-1">- {(provider.type === 'cli' || provider.type === 'tui') && (+ {isProcessProvider(provider) && (<p className="break-words">Command: <code className="text-gray-300 break-all">{provider.command} {provider.args?.join(' ')}</code></p>)}{provider.type === 'api' && (diff --git a/client/src/utils/providers.js b/client/src/utils/providers.jsindex 5f7ce91421..425b667f43 100644--- a/client/src/utils/providers.js+++ b/client/src/utils/providers.js@@ -20,6 +20,17 @@ export const filterSelectableModels = (models) =>*/export const isTuiProvider = (provider) => provider?.type === 'tui';+/**+ * Check if a provider is a one-shot CLI agent provider.+ */+export const isCliProvider = (provider) => provider?.type === 'cli';++/**+ * Check if a provider is process-backed (cli or tui), as opposed to an+ * HTTP-API provider. Use this for "shows a Command + args" config predicates.+ */+export const isProcessProvider = (provider) => isCliProvider(provider) || isTuiProvider(provider);+/*** Tailwind chip classes for the provider type badge ('cli' / 'tui' / 'api').* Lifted out of AIProviders.jsx so other components can render the samediff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.jsnew file mode 100644index 0000000000..05ac707471--- /dev/null+++ b/client/src/utils/providers.test.js@@ -0,0 +1,70 @@+import { describe, it, expect } from 'vitest';+import {+ CODEX_CONFIGURED_DEFAULT,+ filterSelectableModels,+ isTuiProvider,+ isCliProvider,+ isProcessProvider,+ providerTypeClass,+} from './providers.js';++describe('filterSelectableModels', () => {+ it('drops the codex-configured-default sentinel', () => {+ expect(filterSelectableModels(['gpt-4', CODEX_CONFIGURED_DEFAULT, 'gpt-5'])).toEqual(['gpt-4', 'gpt-5']);+ });++ it('returns an empty array for null/undefined input', () => {+ expect(filterSelectableModels(null)).toEqual([]);+ expect(filterSelectableModels(undefined)).toEqual([]);+ });++ it('passes lists through unchanged when no sentinel present', () => {+ expect(filterSelectableModels(['a', 'b'])).toEqual(['a', 'b']);+ });+});++describe('provider type predicates', () => {+ const tui = { type: 'tui' };+ const cli = { type: 'cli' };+ const api = { type: 'api' };++ it('isTuiProvider matches only tui providers', () => {+ expect(isTuiProvider(tui)).toBe(true);+ expect(isTuiProvider(cli)).toBe(false);+ expect(isTuiProvider(api)).toBe(false);+ });++ it('isCliProvider matches only cli providers', () => {+ expect(isCliProvider(cli)).toBe(true);+ expect(isCliProvider(tui)).toBe(false);+ expect(isCliProvider(api)).toBe(false);+ });++ it('isProcessProvider matches cli and tui but not api', () => {+ expect(isProcessProvider(cli)).toBe(true);+ expect(isProcessProvider(tui)).toBe(true);+ expect(isProcessProvider(api)).toBe(false);+ });++ it('all predicates safely return false for nullish input', () => {+ expect(isTuiProvider(null)).toBe(false);+ expect(isTuiProvider(undefined)).toBe(false);+ expect(isCliProvider(null)).toBe(false);+ expect(isProcessProvider(null)).toBe(false);+ });+});++describe('providerTypeClass', () => {+ it('returns blue chip for cli', () => {+ expect(providerTypeClass('cli')).toBe('bg-blue-500/20 text-blue-400');+ });++ it('returns emerald chip for tui', () => {+ expect(providerTypeClass('tui')).toBe('bg-emerald-500/20 text-emerald-400');+ });++ it('falls back to purple chip for api/unknown', () => {+ expect(providerTypeClass('api')).toBe('bg-purple-500/20 text-purple-400');+ expect(providerTypeClass('mystery')).toBe('bg-purple-500/20 text-purple-400');+ });+});