Skip to content

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

feat: unify version, update, remove, and model refresh lifecycle into ai/harnesses

Adam Eivy86b8def3b381
diff --git a/client/src/components/providers/ProviderHarnessesTab.jsx b/client/src/components/providers/ProviderHarnessesTab.jsx
index 5644ce0004..ff75d39dea 100644
--- a/client/src/components/providers/ProviderHarnessesTab.jsx
+++ b/client/src/components/providers/ProviderHarnessesTab.jsx
@@ -1,10 +1,25 @@
-import { useEffect, useMemo, useRef, useState } from 'react';
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Link, useNavigate } from 'react-router';
-import { CheckCircle2, Download, Gauge, PowerOff, TerminalSquare } from 'lucide-react';
+import {
+ AlertTriangle,
+ ArrowUpCircle,
+ CheckCircle2,
+ Download,
+ ExternalLink,
+ Gauge,
+ Loader2,
+ PowerOff,
+ RefreshCw,
+ TerminalSquare,
+ Trash2,
+} from 'lucide-react';
import toast from '../ui/Toast';
import Pill from '../ui/Pill';
import Banner from '../ui/Banner';
import ToggleSwitch from '../ToggleSwitch';
+import InlineConfirmRow from '../ui/InlineConfirmRow';
+import RuntimeInstallModal from '../install/RuntimeInstallModal';
+import { useConfirmDelete } from '../../hooks/useConfirmDelete';
import * as api from '../../services/api';
import useProviderCatalog, { invalidateProviderCatalog } from '../../hooks/useProviderCatalog';
import { pluralize } from '../../lib/textUtils';
@@ -13,16 +28,15 @@ import { providerHarnessId } from '../../utils/providerHarnesses';
import ProviderCredentialBootstraps from './ProviderCredentialBootstraps';
/**
- * AI Providers → Harnesses (#7567, epic #7561): one card per registry harness
- * — the program that drives a model — with the switch that decides whether
- * compose offers it, what the machine knows about its binary, the methods it
- * runs, and how many switched-on services it can be pointed at. `direct`
- * (PortOS's own HTTP runner) is always on and says so.
+ * AI Providers → Harnesses: one card per registry harness — the program that
+ * drives a model — with the switch that decides whether compose offers it,
+ * what the machine knows about its binary, version/update/removal lifecycle,
+ * model list refresh, the methods it runs, and how many switched-on services it
+ * can be pointed at. `direct` (PortOS's own HTTP runner) is always on and says so.
*
* Read from the shared composition catalog (`useProviderCatalog`), so a toggle
* here is one write plus one cache invalidation, and every open picker's
- * compose flow reflects it without a reload. This card offers the install a
- * missing binary needs when available.
+ * compose flow reflects it without a reload.
*/
/** How the enablement verdict reads under the switch. */
@@ -38,16 +52,59 @@ const METHOD_LABEL = { cli: 'CLI', tui: 'TUI', api: 'API' };
/** Every harness whose vendor bills a subscription quota the Quota Burn page tracks. */
const QUOTA_TRACKED = new Set(['claude', 'codex', 'grok', 'antigravity']);
+const ACTION_COPY = {
+ install: {
+ title: 'Install harness',
+ description: "Installing the CLI and putting it on PortOS's PATH…",
+ done: 'Installed.',
+ },
+ update: {
+ title: 'Update harness',
+ description: 'Updating the CLI in place. Providers using it keep their settings.',
+ done: 'Update finished.',
+ },
+ uninstall: {
+ title: 'Remove harness',
+ description: 'Removing the CLI. Providers that use it will show as needing setup.',
+ done: 'Removed.',
+ },
+};
+
function HarnessCard({
- harness, runtime, compatibleCount, presetCount, subscription, selected, busy, onToggle, onInstallRuntime,
+ harness,
+ detail,
+ runtime,
+ compatibleCount,
+ presetCount,
+ subscription,
+ selected,
+ busy,
+ onToggle,
+ onAction,
+ onRefreshModels,
+ refreshing,
+ refreshResult,
}) {
const ref = useRef(null);
useEffect(() => {
if (selected) ref.current?.scrollIntoView?.({ block: 'nearest' });
}, [selected]);
- // `always` is the catalog's word for a harness with nothing to switch off or
- // install — PortOS's own runner — so no id is special-cased here.
+
const alwaysOn = harness.source === 'always';
+ const { isConfirming, requestDelete, cancelDelete, confirmDelete } = useConfirmDelete();
+
+ const isInstalled = detail ? Boolean(detail.installed) : harness.detected === true;
+ const isNotProbed = !detail && harness.detected === null;
+ const version = detail?.version || harness.version || null;
+ const latestVersion = detail?.latestVersion || null;
+ const updateAvailable = Boolean(detail?.updateAvailable);
+ const updatable = Boolean(detail?.updatable);
+ const installable = Boolean(detail?.installable ?? runtime?.installable);
+ const blockedReason = detail?.blockedReason || runtime?.blockedReason || null;
+ const removable = Boolean(detail?.removable);
+ const canRefreshModels = Boolean(detail?.listsModels && isInstalled);
+ const effectiveLabel = detail?.label || runtime?.label || harness.label;
+ const effectiveCommand = detail?.command || harness.id;
return (
<article
@@ -90,38 +147,122 @@ function HarnessCard({
</div>
{!alwaysOn && (
- <div className="flex flex-wrap items-center gap-2 text-xs">
- {harness.detected === true && (
- <Pill tone="success" size="xs" icon={CheckCircle2}>
- Installed{harness.version ? ` · ${harness.version}` : ''}
- </Pill>
+ <div className="space-y-2 text-xs">
+ {isInstalled && (
+ <div className="flex flex-wrap items-center gap-x-2 text-[11px] text-gray-500">
+ <span>Installed {version || 'version unknown'}</span>
+ {latestVersion && <span>· Latest {latestVersion}</span>}
+ {detail?.package && <span className="font-mono">· {detail.package}</span>}
+ </div>
)}
- {harness.detected === false && <Pill tone="warning" size="xs" icon={PowerOff}>Binary not found</Pill>}
- {harness.detected === null && <Pill tone="muted" size="xs">Binary not probed yet</Pill>}
- {harness.detected === false && runtime?.installable && (
- <button
- type="button"
- onClick={() => onInstallRuntime(runtime)}
- className="inline-flex items-center gap-1 px-2.5 py-1 rounded bg-port-accent/20 text-port-accent hover:bg-port-accent/30 transition-colors"
- >
- <Download className="w-3.5 h-3.5" aria-hidden="true" /> Install {runtime.label}
- </button>
- )}
- {harness.detected === false && runtime && !runtime.installable && runtime.blockedReason && (
- <span className="text-gray-500">{runtime.blockedReason}</span>
+
+ <div className="flex flex-wrap items-center gap-2">
+ {isInstalled ? (
+ updateAvailable ? (
+ <Pill tone="warning" size="xs" icon={ArrowUpCircle}>Update available</Pill>
+ ) : (
+ <Pill tone="success" size="xs" icon={CheckCircle2}>
+ Installed{version ? ` · ${version}` : ''}
+ </Pill>
+ )
+ ) : isNotProbed ? (
+ <Pill tone="muted" size="xs">Binary not probed yet</Pill>
+ ) : (
+ <Pill tone="warning" size="xs" icon={PowerOff}>Binary not found</Pill>
+ )}
+
+ {!isInstalled && installable && (
+ <button
+ type="button"
+ onClick={() => onAction(detail || runtime || harness, 'install')}
+ className="inline-flex items-center gap-1 px-2.5 py-1 rounded bg-port-accent/20 text-port-accent hover:bg-port-accent/30 transition-colors"
+ >
+ <Download className="w-3.5 h-3.5" aria-hidden="true" /> Install {effectiveLabel}
+ </button>
+ )}
+
+ {!isInstalled && !installable && blockedReason && (
+ <span className="text-gray-500">{blockedReason}</span>
+ )}
+
+ {isInstalled && (updateAvailable || updatable) && (
+ <button
+ type="button"
+ onClick={() => onAction(detail || harness, 'update')}
+ className={`inline-flex items-center gap-1 px-2.5 py-1 rounded transition-colors ${
+ updateAvailable
+ ? 'bg-port-accent text-white hover:bg-port-accent/80'
+ : 'border border-port-border text-gray-300 hover:border-port-accent hover:text-white'
+ }`}
+ >
+ <ArrowUpCircle className="w-3.5 h-3.5" aria-hidden="true" /> Update
+ </button>
+ )}
+
+ {canRefreshModels && (
+ <button
+ type="button"
+ disabled={refreshing}
+ onClick={() => onRefreshModels(detail || harness)}
+ className="inline-flex items-center gap-1 px-2.5 py-1 rounded border border-port-border text-gray-300 hover:border-port-accent hover:text-white transition-colors disabled:opacity-50"
+ >
+ {refreshing ? (
+ <Loader2 className="w-3.5 h-3.5 animate-spin" aria-hidden="true" />
+ ) : (
+ <RefreshCw className="w-3.5 h-3.5" aria-hidden="true" />
+ )}
+ Refresh models
+ </button>
+ )}
+
+ {isInstalled && removable && (
+ <button
+ type="button"
+ onClick={() => requestDelete(harness.id)}
+ className="inline-flex items-center gap-1 px-2.5 py-1 rounded border border-port-border text-gray-400 hover:border-port-error hover:text-port-error transition-colors"
+ >
+ <Trash2 className="w-3.5 h-3.5" aria-hidden="true" /> Remove
+ </button>
+ )}
+
+ {detail?.docsUrl && (
+ <a
+ href={detail.docsUrl}
+ target="_blank"
+ rel="noreferrer"
+ className="text-port-accent hover:underline inline-flex items-center gap-1"
+ >
+ Vendor docs <ExternalLink className="w-3 h-3" aria-hidden="true" />
+ </a>
+ )}
+
+ {QUOTA_TRACKED.has(harness.id) && (
+ <Link to="/devtools/quota-burn" className="text-port-accent hover:underline inline-flex items-center gap-1">
+ <Gauge className="w-3 h-3" aria-hidden="true" /> Quota
+ </Link>
+ )}
+ </div>
+
+ {isConfirming(harness.id) && (
+ <InlineConfirmRow
+ className="mt-2"
+ autoFocus
+ aria-label={`Remove ${effectiveLabel}`}
+ question={`Remove ${effectiveLabel}? ${pluralize(detail?.providers?.length || 0, 'provider')} use \`${effectiveCommand}\` and will show as needing setup until it is reinstalled — their settings are kept.`}
+ confirmText="Remove"
+ onConfirm={() => confirmDelete(() => onAction(detail || harness, 'uninstall'))}
+ onCancel={cancelDelete}
+ />
)}
- {QUOTA_TRACKED.has(harness.id) && (
- <Link to="/devtools/quota-burn" className="text-port-accent hover:underline inline-flex items-center gap-1">
- <Gauge className="w-3 h-3" aria-hidden="true" /> Quota
- </Link>
+
+ {refreshResult && (
+ <Banner tone={refreshResult.ok ? 'success' : 'warning'} size="sm" className="mt-2">
+ {refreshResult.message}
+ </Banner>
)}
</div>
)}
- {/* The subscription service only this program can reach: its sign-in
- lives inside the harness, so the card says how that service stands
- and where to manage it. Vendor-agnostic — any definition declaring
- `harnessOnly` for this harness lands here. */}
{subscription && (
<p className="text-xs text-gray-400">
Subscription:{' '}
@@ -139,20 +280,48 @@ function HarnessCard({
* @param {object} props
* @param {string|null} props.selectedHarnessId - from `/ai/harnesses/:harnessId`; highlighted and scrolled to.
* @param {object} props.runtimes - the `GET /providers/runtimes` map (by binary id).
- * @param {function} props.onInstallRuntime - opens the page's install modal for one runtime row.
+ * @param {function} [props.onInstallRuntime] - optional external install handler.
*/
export default function ProviderHarnessesTab({ selectedHarnessId = null, runtimes = {}, onInstallRuntime }) {
const navigate = useNavigate();
const catalog = useProviderCatalog(true);
const [pending, setPending] = useState({});
+ const [harnessDetails, setHarnessDetails] = useState([]);
+ const [detailsError, setDetailsError] = useState(null);
+ const [pendingAction, setPendingAction] = useState(null);
+ const [refreshingIds, setRefreshingIds] = useState(() => new Set());
+ const [refreshResults, setRefreshResults] = useState({});
+
+ const loadHarnessDetails = useCallback(async ({ fresh = false } = {}) => {
+ if (typeof api.getHarnesses !== 'function') return;
+ setDetailsError(null);
+ const data = await api.getHarnesses({ fresh, silent: true }).catch((err) => {
+ setDetailsError(err?.message || 'Could not load harnesses.');
+ return null;
+ });
+ if (data?.harnesses) {
+ setHarnessDetails(Array.isArray(data.harnesses) ? data.harnesses : []);
+ }
+ }, []);
+
+ useEffect(() => {
+ loadHarnessDetails();
+ }, [loadHarnessDetails]);
+
+ const detailsByHarness = useMemo(() => {
+ const map = {};
+ for (const item of harnessDetails) {
+ if (item.vendor) map[item.vendor] = item;
+ if (item.id) map[item.id] = map[item.id] || item;
+ }
+ return map;
+ }, [harnessDetails]);
// A runtime row is keyed by binary; the harness names it by vendor.
const runtimeByHarness = useMemo(() => Object.fromEntries(
Object.values(runtimes).filter((row) => row?.vendor).map((row) => [row.vendor, row]),
), [runtimes]);
- // The same classification the Presets view groups by, so the two counts agree
- // on a legacy record the backfill has not stamped.
const presetCountByHarness = useMemo(() => {
const counts = {};
for (const preset of catalog.presets || []) {
@@ -161,6 +330,7 @@ export default function ProviderHarnessesTab({ selectedHarnessId = null, runtime
}
return counts;
}, [catalog.presets]);
+
const subscriptionByHarness = useMemo(() => Object.fromEntries(
(catalog.services || []).filter((service) => service.definition?.harnessOnly).map((service) => [service.definition.harnessOnly, service]),
), [catalog.services]);
@@ -180,38 +350,126 @@ export default function ProviderHarnessesTab({ selectedHarnessId = null, runtime
toast.error(`Could not ${enabled ? 'enable' : 'disable'} ${harness.label}`);
return;
}
- // The verdict is server-computed; every mounted picker re-reads it.
invalidateProviderCatalog();
toast.success(`${harness.label} ${enabled ? 'enabled' : 'disabled'} — compose offers it ${enabled ? 'now' : 'no longer'}`);
};
+ const handleAction = (target, action) => {
+ const runtime = runtimeByHarness[target?.vendor || target?.id];
+ if (action === 'install' && onInstallRuntime && runtime) {
+ onInstallRuntime(runtime);
+ return;
+ }
+ setPendingAction({ harness: target, action });
+ };
+
+ const handleRefreshModels = async (target) => {
+ const runtimeId = target.id || target.vendor;
+ setRefreshingIds((prev) => new Set(prev).add(runtimeId));
+ setRefreshResults((prev) => {
+ const { [runtimeId]: _dropped, ...rest } = prev;
+ return rest;
+ });
+ const result = await api.refreshHarnessModels(runtimeId, { silent: true })
+ .then((data) => ({
+ ok: !data.reason,
+ message: [
+ `${data.models?.length || 0} models from ${target.command || runtimeId} → ${pluralize(data.updated?.length || 0, 'provider')} updated.`,
+ data.reason,
+ ].filter(Boolean).join(' '),
+ }))
+ .catch((err) => ({ ok: false, message: err?.message || 'Could not read the model list.' }));
+ setRefreshResults((prev) => ({ ...prev, [runtimeId]: result }));
+ setRefreshingIds((prev) => {
+ const next = new Set(prev);
+ next.delete(runtimeId);
+ return next;
+ });
+ };
+
+ const handleRecheck = () => {
+ loadHarnessDetails({ fresh: true });
+ invalidateProviderCatalog();
+ };
+
if (catalog.loading && catalog.harnesses.length === 0) {
return <p className="text-sm text-gray-400">Loading harnesses…</p>;
}
return (
<div className="space-y-6">
- <Banner tone="info" size="sm">
- A harness is the program that drives a model. Switch one off and no picker composes a run on it;
- presets that already name it stay stored but stop being offered.
- </Banner>
+ <div className="flex flex-wrap items-start justify-between gap-3">
+ <Banner tone="info" size="sm" className="flex-1 min-w-[280px]">
+ A harness is the program that drives a model. Switch one off and no picker composes a run on it;
+ presets that already name it stay stored but stop being offered.
+ </Banner>
+ <button
+ type="button"
+ onClick={handleRecheck}
+ className="inline-flex shrink-0 items-center gap-1.5 rounded-md border border-port-border px-3 py-1.5 text-xs font-medium text-gray-200 hover:border-port-accent hover:text-white transition-colors"
+ >
+ <RefreshCw className="h-3.5 w-3.5" aria-hidden="true" /> Re-check
+ </button>
+ </div>
+
+ {detailsError && (
+ <Banner tone="error" icon={AlertTriangle}>
+ <div className="flex items-center justify-between gap-3">
+ <span>{detailsError}</span>
+ <button
+ type="button"
+ onClick={handleRecheck}
+ className="shrink-0 rounded-md border border-port-error/50 px-3 py-1 text-xs hover:bg-port-error/20"
+ >
+ Retry
+ </button>
+ </div>
+ </Banner>
+ )}
+
<div className="grid gap-4 grid-cols-[repeat(auto-fill,minmax(min(100%,20rem),1fr))]">
- {catalog.harnesses.map((harness) => (
- <HarnessCard
- key={harness.id}
- harness={harness}
- runtime={runtimeByHarness[harness.id] || null}
- compatibleCount={catalog.compatiblePairs(harness.id).length}
- presetCount={presetCountByHarness[harness.id] || 0}
- subscription={subscriptionByHarness[harness.id] || null}
- selected={harness.id === selectedHarnessId}
- busy={Boolean(pending[harness.id])}
- onToggle={handleToggle}
- onInstallRuntime={onInstallRuntime}
- />
- ))}
+ {catalog.harnesses.map((harness) => {
+ const detail = detailsByHarness[harness.id] || null;
+ const targetId = detail?.id || harness.id;
+ return (
+ <HarnessCard
+ key={harness.id}
+ harness={harness}
+ detail={detail}
+ runtime={runtimeByHarness[harness.id] || null}
+ compatibleCount={catalog.compatiblePairs(harness.id).length}
+ presetCount={presetCountByHarness[harness.id] || 0}
+ subscription={subscriptionByHarness[harness.id] || null}
+ selected={harness.id === selectedHarnessId}
+ busy={Boolean(pending[harness.id])}
+ onToggle={handleToggle}
+ onAction={handleAction}
+ onRefreshModels={handleRefreshModels}
+ refreshing={refreshingIds.has(targetId)}
+ refreshResult={refreshResults[targetId]}
+ />
+ );
+ })}
</div>
+
<ProviderCredentialBootstraps harnesses={catalog.harnesses} presets={catalog.presets} />
+
+ <RuntimeInstallModal
+ open={Boolean(pendingAction)}
+ runtime={pendingAction?.harness?.id}
+ label={pendingAction?.harness?.label}
+ title={pendingAction ? ACTION_COPY[pendingAction.action]?.title : undefined}
+ description={pendingAction ? ACTION_COPY[pendingAction.action]?.description : undefined}
+ doneText={pendingAction ? ACTION_COPY[pendingAction.action]?.done : undefined}
+ installUrlBase="/api/harnesses/action"
+ params={pendingAction ? { action: pendingAction.action } : undefined}
+ streamMethod="POST"
+ onClose={() => setPendingAction(null)}
+ onComplete={() => {
+ loadHarnessDetails({ fresh: true });
+ invalidateProviderCatalog();
+ }}
+ />
</div>
);
}
diff --git a/client/src/components/providers/ProviderHarnessesTab.test.jsx b/client/src/components/providers/ProviderHarnessesTab.test.jsx
index e569c3f060..21a7d2f5b3 100644
--- a/client/src/components/providers/ProviderHarnessesTab.test.jsx
+++ b/client/src/components/providers/ProviderHarnessesTab.test.jsx
@@ -17,9 +17,20 @@ const api = vi.hoisted(() => ({
setProviderHarnessEnabled: vi.fn(),
getProviderBootstraps: vi.fn(),
saveProviderBootstraps: vi.fn(),
+ getHarnesses: vi.fn(),
+ refreshHarnessModels: vi.fn(),
}));
vi.mock('../../services/api', () => api);
+vi.mock('../install/RuntimeInstallModal', () => ({
+ default: ({ open, runtime, params, title, onComplete }) => (open ? (
+ <div data-testid="install-modal">
+ {title} · {runtime} · {params?.action}
+ <button type="button" data-testid="complete" onClick={onComplete}>complete</button>
+ </div>
+ ) : null),
+}));
+
const toast = vi.hoisted(() => ({ success: vi.fn(), error: vi.fn(), info: vi.fn(), warning: vi.fn() }));
vi.mock('../ui/Toast', () => ({ default: toast }));
@@ -77,6 +88,8 @@ beforeEach(() => {
__resetProviderCatalogCache();
api.getProviderCatalog.mockResolvedValue(CATALOG);
api.getProviderBootstraps.mockResolvedValue({ bootstraps: {} });
+ api.getHarnesses.mockResolvedValue({ harnesses: [] });
+ api.refreshHarnessModels.mockResolvedValue({ models: [], updated: [] });
});
describe('ProviderHarnessesTab', () => {
@@ -147,6 +160,106 @@ describe('ProviderHarnessesTab', () => {
await waitFor(() => expect(toast.error).toHaveBeenCalledWith('No harness with id "nope"'));
expect(screen.getByTestId('location')).toHaveTextContent('/ai/harnesses');
});
+
+ it('shows the installed and latest versions, and package name from details', async () => {
+ api.getHarnesses.mockResolvedValue({
+ harnesses: [{
+ id: 'claude',
+ vendor: 'claude',
+ label: 'Claude Code CLI',
+ command: 'claude',
+ installed: true,
+ version: '2.1.0',
+ latestVersion: '2.2.0',
+ package: '@anthropic-ai/claude-code',
+ updateAvailable: true,
+ updatable: true,
+ removable: true,
+ listsModels: true,
+ providers: [{ id: 'claude-code', name: 'Claude Code', enabled: true }],
+ }],
+ });
+ renderTab();
+ const claude = await screen.findByRole('article', { name: /Claude Code/ });
+ expect(await within(claude).findByText(/Installed 2\.1\.0/)).toBeInTheDocument();
+ expect(within(claude).getByText(/Latest 2\.2\.0/)).toBeInTheDocument();
+ expect(within(claude).getByText(/@anthropic-ai\/claude-code/)).toBeInTheDocument();
+ expect(within(claude).getByText('Update available')).toBeInTheDocument();
+ });
+
+ it('opens the shared install modal for update action', async () => {
+ api.getHarnesses.mockResolvedValue({
+ harnesses: [{
+ id: 'claude',
+ vendor: 'claude',
+ label: 'Claude Code CLI',
+ command: 'claude',
+ installed: true,
+ version: '2.1.0',
+ latestVersion: '2.2.0',
+ updateAvailable: true,
+ updatable: true,
+ }],
+ });
+ renderTab();
+ const claude = await screen.findByRole('article', { name: /Claude Code/ });
+ fireEvent.click(await within(claude).findByRole('button', { name: /Update/ }));
+ expect(await screen.findByTestId('install-modal')).toHaveTextContent('claude · update');
+ });
+
+ it('confirms a removal inline before opening the stream with uninstall', async () => {
+ api.getHarnesses.mockResolvedValue({
+ harnesses: [{
+ id: 'claude',
+ vendor: 'claude',
+ label: 'Claude Code CLI',
+ command: 'claude',
+ installed: true,
+ version: '2.1.0',
+ removable: true,
+ providers: [{ id: 'claude-code', name: 'Claude Code', enabled: true }],
+ }],
+ });
+ renderTab();
+ const claude = await screen.findByRole('article', { name: /Claude Code/ });
+ fireEvent.click(await within(claude).findByRole('button', { name: /Remove/ }));
+ expect(screen.queryByTestId('install-modal')).not.toBeInTheDocument();
+ expect(within(claude).getByText(/1 provider use `claude`/)).toBeInTheDocument();
+
+ const [, confirm] = within(claude).getAllByRole('button', { name: 'Remove' });
+ fireEvent.click(confirm);
+ expect(await screen.findByTestId('install-modal')).toHaveTextContent('claude · uninstall');
+ });
+
+ it('refreshes harness models and renders the report banner', async () => {
+ api.getHarnesses.mockResolvedValue({
+ harnesses: [{
+ id: 'claude',
+ vendor: 'claude',
+ label: 'Claude Code CLI',
+ command: 'claude',
+ installed: true,
+ listsModels: true,
+ }],
+ });
+ api.refreshHarnessModels.mockResolvedValue({
+ models: ['claude-3-7-sonnet', 'claude-3-5-haiku'],
+ updated: ['claude-code'],
+ });
+ renderTab();
+ const claude = await screen.findByRole('article', { name: /Claude Code/ });
+ fireEvent.click(await within(claude).findByRole('button', { name: /Refresh models/ }));
+
+ expect(await within(claude).findByText(/2 models from claude → 1 provider updated/)).toBeInTheDocument();
+ });
+
+ it('re-checks with fresh: true and invalidates catalog cache', async () => {
+ renderTab();
+ await screen.findByRole('heading', { name: /Claude Code/ });
+ fireEvent.click(screen.getByRole('button', { name: /Re-check/ }));
+ await waitFor(() => expect(api.getHarnesses).toHaveBeenCalledWith(expect.objectContaining({ fresh: true })));
+ await waitFor(() => expect(api.getProviderCatalog).toHaveBeenCalledTimes(2));
+ });
});
describe('credential bootstraps section', () => {
diff --git a/docs/AI_PROVIDERS.md b/docs/AI_PROVIDERS.md
index 077bc705f1..6e22fa01cb 100644
--- a/docs/AI_PROVIDERS.md
+++ b/docs/AI_PROVIDERS.md
@@ -30,7 +30,7 @@ The stored records, **grouped by harness** and ordered within a group by readine
### Harnesses (`/ai/harnesses`)
-One card per registry harness: the **enable switch** (the user's word; a harness with no word follows whether its binary is detected on PATH; `direct` is always on), the detected version, the methods it runs, how many switched-on services it can reach, the install a missing binary needs, and — for a program that signs into its own vendor — the subscription service only it can reach, with that service's readiness and a link to it. Sign-in itself (the ChatGPT device flow, for instance) stays on the preset card. A toggle here is one write plus a catalog invalidation, so an open picker's compose flow reflects it without a reload.
+One card per registry harness: the **enable switch** (the user's word; a harness with no word follows whether its binary is detected on PATH; `direct` is always on), the detected and latest versions, the methods it runs, how many switched-on services it can reach, the install/update/removal lifecycle for its binary, model catalog refresh, and — for a program that signs into its own vendor — the subscription service only it can reach, with that service's readiness and a link to it. Sign-in itself (the ChatGPT device flow, for instance) stays on the preset card. A toggle here is one write plus a catalog invalidation, so an open picker's compose flow reflects it without a reload.
**Credential bootstraps** sits under the cards, collapsed until one exists: the launch wrappers a composite's `+<slug>` suffix names (`<command> <args…> <harness-name> [<separator>] <harness args>`), with the per-harness name map a wrapper may use (`claude` → `claude-code`). Saving never spawns anything; the wrapper runs only when a composite naming it executes.