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(models): move media, LoRA, 3D and embedding model management under Models (#4728)

[._.]/ Adam Eivyf55d3df825aa
diff --git a/client/src/App.jsx b/client/src/App.jsx
index cde85ef3f3..1df3ed5e51 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -50,13 +50,10 @@ const MediaCollections = lazyWithReload(() => import('./pages/MediaCollections')
const MediaCollectionDetail = lazyWithReload(() => import('./pages/MediaCollectionDetail'));
const MediaCollectionSyncView = lazyWithReload(() => import('./pages/MediaCollectionSyncView'));
const SyncView = lazyWithReload(() => import('./pages/SyncView'));
-const MediaModels = lazyWithReload(() => import('./pages/MediaModels'));
const ThreejsModels = lazyWithReload(() => import('./pages/ThreejsModels'));
const Media3D = lazyWithReload(() => import('./pages/Media3D'));
const Media3DDetail = lazyWithReload(() => import('./pages/Media3DDetail'));
const ThreejsModelDetail = lazyWithReload(() => import('./pages/ThreejsModelDetail'));
-const Loras = lazyWithReload(() => import('./pages/Loras'));
-const LoraTraining = lazyWithReload(() => import('./pages/LoraTraining'));
const LoraDatasetDetail = lazyWithReload(() => import('./pages/LoraDatasetDetail'));
const UniverseBuilder = lazyWithReload(() => import('./pages/UniverseBuilder'));
const Universes = lazyWithReload(() => import('./pages/Universes'));
@@ -191,6 +188,7 @@ const MEDIA_CREATIVE_DIRECTOR_PREFIX = /^\/media\/creative-director/;
const MEDIA_SPRITES_PREFIX = /^\/media\/sprites/;
const MEDIA_MUSIC_VIDEO_PREFIX = /^\/media\/music-video/;
const MEDIA_3D_PREFIX = /^\/media\/3d/;
+const MEDIA_TRAINING_PREFIX = /^\/media\/training/;
// The annotator lives under the Media shell (/media/annotate). A bare /annotate
// is what a bookmark, a typed URL, or a half-remembered path lands on — alias it
// rather than letting the catch-all swallow it (issue #3793).
@@ -313,8 +311,15 @@ export default function App() {
{/* Local LLM management moved out of Settings into its own top-level
Models section (#4736). Bookmarks and stale ⌘K history keep working. */}
<Route path="settings/local-llm" element={<Navigate to="/models/llms" replace />} />
+ {/* Embeddings moved into Models with the rest of the model management
+ (#4728) — it picks a model, not a preference. */}
+ <Route path="settings/embeddings" element={<Navigate to="/models/embeddings" replace />} />
<Route path="settings/:tab" element={<Settings />} />
<Route path="models" element={<Navigate to="/models/performance" replace />} />
+ {/* The training tab has a routed dataset workbench. React Router ranks
+ the static `training` segment above `:tab`, so the drill-down wins
+ over the tab route without depending on declaration order. */}
+ <Route path="models/training/:datasetId" element={<LoraDatasetDetail />} />
<Route path="models/:tab" element={<Models />} />
<Route path="local-llm/playground" element={<LocalLlmPlayground />} />
<Route path="uploads" element={<Uploads />} />
@@ -328,6 +333,9 @@ export default function App() {
<Route path="workspace-contexts/:appId" element={<WorkspaceContexts />} />
<Route path="system-health" element={<Navigate to="/system-resources/overview" replace />} />
<Route path="system-resources" element={<Navigate to="/system-resources/overview" replace />} />
+ {/* The downloaded-model inventory folded into Models → Status (#4728),
+ which already answered "what is resident right now". */}
+ <Route path="system-resources/models" element={<Navigate to="/models/status" replace />} />
<Route path="system-resources/:tab" element={<SystemHealthPage />} />
<Route path="capabilities" element={<CapabilityMap />} />
<Route path="loops" element={<Loops />} />
@@ -401,7 +409,10 @@ export default function App() {
<Route path="sprites/:id" element={<PrefixRedirect from={MEDIA_SPRITES_PREFIX} to="/sprites" />} />
<Route path="timeline" element={<VideoTimeline />} />
<Route path="timeline/:projectId" element={<VideoTimelineEditor />} />
- <Route path="models" element={<MediaModels />} />
+ {/* Media models, LoRAs and LoRA training moved into the Models
+ section (#4728). Redirects keep legacy /media/* bookmarks and
+ stale ⌘K history working. */}
+ <Route path="models" element={<RedirectWithSearch to="/models/media" />} />
<Route path="threejs" element={<ThreejsModels />} />
<Route path="threejs/:id" element={<ThreejsModelDetail />} />
{/* 3D moved to the top-level /3d route (Create sidebar link). These
@@ -409,9 +420,9 @@ export default function App() {
working. */}
<Route path="3d" element={<PrefixRedirect from={MEDIA_3D_PREFIX} to="/3d" />} />
<Route path="3d/:id" element={<PrefixRedirect from={MEDIA_3D_PREFIX} to="/3d" />} />
- <Route path="loras" element={<Loras />} />
- <Route path="training" element={<LoraTraining />} />
- <Route path="training/:datasetId" element={<LoraDatasetDetail />} />
+ <Route path="loras" element={<RedirectWithSearch to="/models/loras" />} />
+ <Route path="training" element={<PrefixRedirect from={MEDIA_TRAINING_PREFIX} to="/models/training" />} />
+ <Route path="training/:datasetId" element={<PrefixRedirect from={MEDIA_TRAINING_PREFIX} to="/models/training" />} />
{/* Universes live at /universes (Create sidebar link). These
redirects keep legacy /media/universe-builder bookmarks working
after the MediaGen tab was removed. */}
@@ -454,7 +465,7 @@ export default function App() {
<Route path="image-gen" element={<RedirectWithSearch to="/media/image" />} />
<Route path="video-gen" element={<RedirectWithSearch to="/media/video" />} />
<Route path="media-history" element={<RedirectWithSearch to="/media/history" />} />
- <Route path="media-models" element={<RedirectWithSearch to="/media/models" />} />
+ <Route path="media-models" element={<RedirectWithSearch to="/models/media" />} />
<Route path="wiki" element={<RedirectWithSearch to="/wiki/overview" />} />
<Route path="wiki/:tab" element={<Wiki />} />
<Route path="rapid-reader" element={<RapidReaderPage />} />
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index 19015d33ea..24098d61b0 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -17,6 +17,7 @@ import {
Cpu,
Gauge,
FlaskConical,
+ Braces,
Wrench,
ExternalLink,
Crown,
@@ -310,10 +311,15 @@ const navItems = [
icon: Cpu,
defaultTo: '/models/performance',
children: [
+ { to: '/models/3d', label: '3D', icon: Boxes },
+ { to: '/models/embeddings', label: 'Embeddings', icon: Braces },
{ to: '/models/llms', label: 'LLMs', icon: Cpu },
+ { to: '/models/loras', label: 'LoRAs', icon: Sparkles },
+ { to: '/models/media', label: 'Media', icon: HardDrive },
{ to: '/models/performance', label: 'Performance', icon: Gauge },
{ to: '/local-llm/playground', label: 'Playground', icon: FlaskConical },
{ to: '/models/status', label: 'Status', icon: Activity },
+ { to: '/models/training', label: 'Training', icon: GraduationCap },
],
},
{
diff --git a/client/src/components/dashboard/ActiveProcessingWidget.jsx b/client/src/components/dashboard/ActiveProcessingWidget.jsx
index ba91bb6fc3..23bbc58a0c 100644
--- a/client/src/components/dashboard/ActiveProcessingWidget.jsx
+++ b/client/src/components/dashboard/ActiveProcessingWidget.jsx
@@ -39,7 +39,7 @@ function JobRow({ job, onCancel }) {
: kind === 'video' ? '/media/video'
: kind === 'image' ? '/media/image'
: kind === 'audio' ? '/media/history?type=audio'
- : kind === 'training' ? '/media/training' : '/media/history';
+ : kind === 'training' ? '/models/training' : '/media/history';
const Icon = kind === 'video' ? Film : kind === 'audio' ? AudioLines : kind === 'training' ? Cpu : ImageIcon;
const progress = Number.isFinite(job.progress) ? Math.max(0, Math.min(100, Math.round(job.progress * 100))) : null;
return (
diff --git a/client/src/components/imageGen/LoraPicker.jsx b/client/src/components/imageGen/LoraPicker.jsx
index 248a84e1db..4201248320 100644
--- a/client/src/components/imageGen/LoraPicker.jsx
+++ b/client/src/components/imageGen/LoraPicker.jsx
@@ -74,7 +74,7 @@ export default function LoraPicker({
{selected.length > 0 ? ` · ${selected.length}/${MAX_SELECTED_LORAS} selected` : ''})
</span>
</span>
- <Link to="/media/loras" className="text-[11px] text-port-accent hover:underline">Manage →</Link>
+ <Link to="/models/loras" className="text-[11px] text-port-accent hover:underline">Manage →</Link>
</div>
{compatible.length === 0 ? (
<p className="text-xs text-gray-500 italic">
diff --git a/client/src/components/loraTraining/CharacterLoraChip.jsx b/client/src/components/loraTraining/CharacterLoraChip.jsx
index 79c3a13bfe..2c3f95542f 100644
--- a/client/src/components/loraTraining/CharacterLoraChip.jsx
+++ b/client/src/components/loraTraining/CharacterLoraChip.jsx
@@ -38,7 +38,7 @@ export default function CharacterLoraChip({ entryId, ingredientId, universeId, s
setOpening(true);
try {
const dataset = await createLoraDataset({ universeId, entryId });
- navigate(`/media/training/${dataset.id}`);
+ navigate(`/models/training/${dataset.id}`);
} finally {
setOpening(false);
}
@@ -50,7 +50,7 @@ export default function CharacterLoraChip({ entryId, ingredientId, universeId, s
<div className="flex items-center gap-2 flex-wrap text-xs">
{lora && (
<Link
- to="/media/loras"
+ to="/models/loras"
className="inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-port-success/15 text-port-success border border-port-success/30 hover:bg-port-success/25"
title={`Trained LoRA: ${lora.filename}${lora.triggerWords?.[0] ? ` · trigger: ${lora.triggerWords[0]}` : ''}`}
>
@@ -72,7 +72,7 @@ export default function CharacterLoraChip({ entryId, ingredientId, universeId, s
)}
{showDatasetButton && !canCreate && existingDataset && (
<Link
- to={`/media/training/${existingDataset.id}`}
+ to={`/models/training/${existingDataset.id}`}
className="inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-port-card border border-port-border text-gray-400 hover:text-white"
title="Open the character's LoRA training dataset"
>
diff --git a/client/src/components/loraTraining/TrainingPanel.jsx b/client/src/components/loraTraining/TrainingPanel.jsx
index 85fdb69026..aff8621b8a 100644
--- a/client/src/components/loraTraining/TrainingPanel.jsx
+++ b/client/src/components/loraTraining/TrainingPanel.jsx
@@ -228,7 +228,7 @@ export default function TrainingPanel({ dataset, readiness, triggerSaving, onRun
<span className="text-gray-300">
Last run completed
{lastRun.output?.loraFilename && (
- <> — <Link to="/media/loras" className="text-port-accent hover:underline inline-flex items-center gap-1"><Sparkles className="w-3 h-3" />{lastRun.output.loraFilename}</Link></>
+ <> — <Link to="/models/loras" className="text-port-accent hover:underline inline-flex items-center gap-1"><Sparkles className="w-3 h-3" />{lastRun.output.loraFilename}</Link></>
)}
</span>
</>
diff --git a/client/src/components/media/Image3dHfAccessNotice.jsx b/client/src/components/media/Image3dHfAccessNotice.jsx
new file mode 100644
index 0000000000..d68bc79e4a
--- /dev/null
+++ b/client/src/components/media/Image3dHfAccessNotice.jsx
@@ -0,0 +1,59 @@
+import { useState } from 'react';
+import { KeyRound } from 'lucide-react';
+import HfTokenBanner, { GatedModelList, HF_SOURCE_LABEL } from '../imageGen/HfTokenBanner';
+
+/**
+ * Prerequisite notice for an image-to-3D target that needs gated Hugging Face
+ * access. Driven by the CENTRAL token store (GET /image-gen/setup/hf-token-status)
+ * — the same one the Image Gen page writes — so a user who already pasted a token
+ * isn't told to go set one up in a terminal. With no token, the inline
+ * paste-and-save banner appears instead of instructions. Either way the gated
+ * repos stay listed: a token doesn't grant access until their terms are accepted
+ * on the user's HF account.
+ *
+ * Shared by the 3D generate page (gated repos for the SELECTED target) and
+ * Models → 3D (gated repos across every installable target).
+ *
+ * `tokenPresent` is TRI-STATE — `null` means "status still loading", not
+ * "absent". Rendering the needs-setup banner on `null` would flash a false alarm
+ * at a user who already has a token.
+ */
+export default function Image3dHfAccessNotice({ models, tokenPresent, tokenSource, onSaved }) {
+ // Escape hatch for the stale/invalid-token case: `isHfAuthError` in the runner
+ // also matches `401` / `Invalid user token`, and its guidance now says to add a
+ // token *on this page* — so the paste form has to stay reachable even when one is
+ // already configured, or that instruction is impossible to follow here. Mirrors
+ // MidiGatedModal's "Use a different token".
+ const [replacing, setReplacing] = useState(false);
+
+ if (!models?.length) return null;
+ if (tokenPresent === null) return null;
+
+ const handleSaved = () => { setReplacing(false); onSaved?.(); };
+
+ if (!tokenPresent || replacing) {
+ return <HfTokenBanner models={models} onSaved={handleSaved} />;
+ }
+
+ return (
+ <div className="rounded-lg border border-port-border bg-port-bg/40 p-3 text-xs text-gray-400">
+ <div className="flex items-center gap-1.5 font-medium text-port-success">
+ <KeyRound className="h-3.5 w-3.5" />
+ Hugging Face token configured
+ {HF_SOURCE_LABEL[tokenSource] ? ` (${HF_SOURCE_LABEL[tokenSource]})` : ''}
+ </div>
+ <p className="mt-1">
+ Accept the terms for these gated models on your Hugging Face account if you haven’t — a token alone
+ doesn’t grant access:
+ </p>
+ <GatedModelList models={models} linkClassName="text-port-accent hover:underline" />
+ <button
+ type="button"
+ onClick={() => setReplacing(true)}
+ className="mt-2 text-xs underline text-gray-400 hover:text-white"
+ >
+ Use a different token
+ </button>
+ </div>
+ );
+}
diff --git a/client/src/components/models/Image3dRuntimes.jsx b/client/src/components/models/Image3dRuntimes.jsx
new file mode 100644
index 0000000000..73f1b05cf4
--- /dev/null
+++ b/client/src/components/models/Image3dRuntimes.jsx
@@ -0,0 +1,229 @@
+import { useCallback, useEffect, useMemo, useState } from 'react';
+import { AlertTriangle, CheckCircle2, Download, ExternalLink, Loader2 } from 'lucide-react';
+import { getImageTo3dTargets } from '../../services/api';
+import { useHfTokenStatus } from '../../hooks/useHfTokenStatus';
+import { unavailableReasonLabel } from '../../lib/imageTo3dReasons';
+import RuntimeInstallModal from '../install/RuntimeInstallModal';
+import Image3dHfAccessNotice from '../media/Image3dHfAccessNotice';
+
+/**
+ * Models → 3D: install, repair, and inspect the image-to-3D runtimes.
+ *
+ * These are installed weights and on-device runtimes (TRELLIS.2, Pixal3D), so
+ * they belong with the rest of the model inventory rather than inside the
+ * generate flow that consumes them (#4728). `/3d` keeps the generate flow — an
+ * image in, a mesh out, plus the library of past renders — and links here for
+ * the install lifecycle.
+ */
+
+const LANE_LABEL = {
+ 'local-mps': 'Runs on-device (Apple Silicon)',
+ 'local-cuda': 'Runs on-device (CUDA)',
+ 'hosted-api': 'Hosted API',
+};
+
+function StatusBadge({ target }) {
+ if (!target.available) {
+ return (
+ <span className="inline-flex items-center gap-1.5 text-xs font-medium text-port-warning">
+ <AlertTriangle className="w-3.5 h-3.5" />
+ {unavailableReasonLabel(target.unavailableReason)}
+ </span>
+ );
+ }
+ if (target.installed) {
+ // An installed-but-degraded target still renders — TRELLIS.2 with no Metal bake
+ // produces correct geometry with a scrambled surface; Pixal3D with no NATTEN
+ // falls back to DINO projection features — so "Ready" alone would be a lie. The
+ // server normalizes every such case into `degraded` (see the adapter contract),
+ // and a probe that could NOT run reports nothing here rather than crying wolf
+ // about an install that is probably fine.
+ if (target.degraded) {
+ return (
+ <span className="inline-flex items-center gap-1.5 text-xs font-medium text-port-warning">
+ <AlertTriangle className="w-3.5 h-3.5" /> Ready · {target.degraded.label}
+ </span>
+ );
+ }
+ return (
+ <span className="inline-flex items-center gap-1.5 text-xs font-medium text-port-success">
+ <CheckCircle2 className="w-3.5 h-3.5" /> Ready
+ </span>
+ );
+ }
+ return null;
+}
+
+function TargetCard({ target, onInstall }) {
+ // Install only applies to targets with a local install concept (installed is a
+ // boolean); hosted targets report installed:null and are Ready when available.
+ const canInstall = target.available && target.installed === false;
+ const degraded = target.degraded;
+ // Repair install re-runs setup — but only offer it when the server says it can
+ // actually fix this. On a Command-Line-Tools-only host `repairable` is false and the
+ // remedy is installing Xcode, so a Repair button would just fail the same way and
+ // read as broken.
+ const canRepair = !!degraded && degraded.repairable !== false;
+
+ return (
+ <div className="rounded-lg border border-port-border bg-port-card p-4">
+ <div className="flex flex-wrap items-start justify-between gap-3">
+ <div className="min-w-0">
+ <div className="flex items-center gap-2">
+ <h2 className="text-sm font-semibold text-white">{target.label}</h2>
+ {target.executionLane && (
+ <span className="rounded bg-port-bg px-1.5 py-0.5 text-[11px] text-gray-400">
+ {LANE_LABEL[target.executionLane] || target.executionLane}
+ </span>
+ )}
+ </div>
+ {target.description && (
+ <p className="mt-1 text-xs text-gray-400">{target.description}</p>
+ )}
+ {(target.upstream || target.port) && (
+ <div className="mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-gray-500">
+ {target.upstream && (
+ <a href={target.upstream} target="_blank" rel="noreferrer"
+ className="inline-flex items-center gap-1 hover:text-port-accent">
+ <ExternalLink className="w-3 h-3" /> Upstream
+ </a>
+ )}
+ {target.port && (
+ <a href={target.port} target="_blank" rel="noreferrer"
+ className="inline-flex items-center gap-1 hover:text-port-accent">
+ <ExternalLink className="w-3 h-3" /> Apple Silicon port
+ </a>
+ )}
+ </div>
+ )}
+ </div>
+ <div className="flex shrink-0 flex-col items-end gap-2">
+ <StatusBadge target={target} />
+ {(canInstall || canRepair) && (
+ <button
+ onClick={() => onInstall(target)}
+ className="inline-flex items-center gap-1.5 rounded-md bg-port-accent px-3 py-1.5 text-xs font-medium text-white hover:bg-blue-600"
+ >
+ <Download className="w-3.5 h-3.5" /> {canInstall ? 'Install' : 'Repair install'}
+ </button>
+ )}
+ </div>
+ </div>
+ {degraded?.help && (
+ <p className="mt-3 rounded border border-port-warning/40 bg-port-warning/10 p-2 text-[11px] leading-relaxed text-port-warning">
+ {degraded.help}
+ </p>
+ )}
+ </div>
+ );
+}
+
+export default function Image3dRuntimes() {
+ const [targets, setTargets] = useState([]);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState(null);
+ // The target whose install modal is open (only local-install targets); null = closed.
+ const [installTarget, setInstallTarget] = useState(null);
+ const { present: hfTokenPresent, source: hfTokenSource, refresh: refreshHfToken } = useHfTokenStatus();
+
+ const load = useCallback(() => {
+ setLoading(true);
+ getImageTo3dTargets()
+ .then((data) => { setTargets(data?.targets || []); setError(null); })
+ .catch((err) => setError(err?.message || 'Failed to load 3D targets'))
+ .finally(() => setLoading(false));
+ }, []);
+
+ useEffect(() => { load(); }, [load]);
+
+ // Every gated repo across the runnable targets, deduped by id — the token is
+ // central, so listing one target's repos twice would just be noise. Unavailable
+ // targets are excluded: their terms are irrelevant on a host that can't run them.
+ const gatedHfModels = useMemo(() => {
+ const seen = new Map();
+ for (const target of targets) {
+ if (!target.available) continue;
+ for (const model of target.gatedRepos || []) {
+ const key = model?.url || model?.label;
+ if (key && !seen.has(key)) seen.set(key, model);
+ }
+ }
+ return [...seen.values()];
+ }, [targets]);
+
+ const gatedRepoCount = installTarget?.gatedRepos?.length || 0;
+
+ return (
+ <div className="mx-auto max-w-4xl space-y-4">
+ <p className="text-sm text-gray-400">
+ On-device image-to-3D runtimes. Install one here, then render meshes from the 3D page under Create.
+ </p>
+
+ {gatedHfModels.length > 0 && (
+ <Image3dHfAccessNotice
+ models={gatedHfModels}
+ tokenPresent={hfTokenPresent}
+ tokenSource={hfTokenSource}
+ onSaved={refreshHfToken}
+ />
+ )}
+
+ {loading && (
+ <div className="flex items-center gap-2 text-sm text-gray-400">
+ <Loader2 className="h-4 w-4 animate-spin" /> Loading models…
+ </div>
+ )}
+
+ {error && !loading && (
+ <div className="flex items-center justify-between rounded-lg border border-port-error/40 bg-port-error/10 p-4 text-sm text-port-error">
+ <span>{error}</span>
+ <button onClick={load} className="rounded-md border border-port-error/50 px-3 py-1 text-xs hover:bg-port-error/20">
+ Retry
+ </button>
+ </div>
+ )}
+
+ {!loading && !error && (
+ <div className="space-y-3">
+ {targets.length === 0 && (
+ <p className="text-sm text-gray-500">No image-to-3D models are registered.</p>
+ )}
+ {targets.map((target) => (
+ <TargetCard key={target.id} target={target} onInstall={setInstallTarget} />
+ ))}
+ </div>
+ )}
+
+ {/* TRELLIS.2 (and any future local-install target) streams its clone +
+ setup.sh install through the shared runtime-install modal. */}
+ <RuntimeInstallModal
+ open={!!installTarget}
+ runtime={installTarget?.id}
+ label={installTarget?.label}
+ installUrlBase={installTarget ? `/api/image-to-3d/targets/${installTarget.id}/install` : undefined}
+ // Repairing an already-installed target must re-run its setup rather than
+ // short-circuit on "already installed" — that re-run is what rebuilds whatever
+ // was missing (TRELLIS.2's Metal backends, Pixal3D's NATTEN kernels) now that
+ // its build deps are present.
+ params={installTarget?.degraded ? { repair: '1' } : undefined}
+ // Copy comes from the target descriptor, never hard-coded here: this modal is
+ // shared by every target, so TRELLIS.2-specific prose would misdescribe the
+ // others. A degraded target explains its own remedy via `degraded.help`.
+ // `undefined` rather than '' when a target has nothing to say, so
+ // RuntimeInstallModal's own default description applies instead of a blank panel.
+ description={installTarget?.degraded
+ // The degraded help text owns the whole message (both targets' already end by
+ // saying downloaded models are kept) — appending to it would repeat that.
+ ? installTarget.degraded.help
+ : [
+ installTarget?.installNotes,
+ gatedRepoCount
+ ? `It also pulls ${gatedRepoCount} gated Hugging Face ${gatedRepoCount === 1 ? 'model' : 'models'} on first render — accept their terms and add a Hugging Face token above.`
+ : null,
+ ].filter(Boolean).join(' ') || undefined}
+ onClose={() => setInstallTarget(null)}
+ onComplete={() => { setInstallTarget(null); load(); }}
+ />
+ </div>
+ );
+}
diff --git a/client/src/components/models/Image3dRuntimes.test.jsx b/client/src/components/models/Image3dRuntimes.test.jsx
new file mode 100644
index 0000000000..1aa8afc31a
--- /dev/null
+++ b/client/src/components/models/Image3dRuntimes.test.jsx
@@ -0,0 +1,181 @@
+/**
+ * Models → 3D: the image-to-3D runtime manager.
+ *
+ * These cases moved here wholesale from `pages/Media3D.test.jsx` when the
+ * install/repair half of the 3D page moved into the Models section (#4728) —
+ * they were always about runtime state, not about rendering a mesh.
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, fireEvent } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+import Image3dRuntimes from './Image3dRuntimes';
+
+const getImageTo3dTargets = vi.fn();
+const getHfTokenStatus = vi.fn();
+vi.mock('../../services/api', () => ({
+ getImageTo3dTargets: (...a) => getImageTo3dTargets(...a),
+ getHfTokenStatus: (...a) => getHfTokenStatus(...a),
+}));
+
+// Stub the shared install modal so the test doesn't open a real EventSource;
+// assert only that it's opened with the chosen target.
+vi.mock('../install/RuntimeInstallModal', () => ({
+ default: ({ open, runtime, description }) => (open ? <div data-testid="install-modal">
+ installing {runtime}<span data-testid="install-description">{description}</span>
+ </div> : null),
+}));
+
+const target = (over = {}) => ({
+ id: 'trellis2',
+ label: 'TRELLIS.2',
+ description: 'Microsoft TRELLIS.2 — single image to a PBR-textured GLB mesh.',
+ executionLane: 'local-mps',
+ outputKind: 'glb-mesh',
+ available: true,
+ installed: false,
+ unavailableReason: null,
+ upstream: 'https://github.com/microsoft/TRELLIS.2',
+ port: 'https://github.com/shivampkumar/trellis-mac',
+ gatedRepos: [
+ {
+ label: 'facebook/dinov3-vitl16-pretrain-lvd1689m',
+ url: 'https://huggingface.co/facebook/dinov3-vitl16-pretrain-lvd1689m',
+ },
+ { label: 'briaai/RMBG-2.0', url: 'https://huggingface.co/briaai/RMBG-2.0' },
+ ],
+ ...over,
+});
+
+const renderPanel = () => render(<MemoryRouter><Image3dRuntimes /></MemoryRouter>);
+
+describe('Image3dRuntimes', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ getHfTokenStatus.mockResolvedValue({ hfTokenPresent: false, source: 'none' });
+ });
+
+ it('shows an Install button for an available, not-installed target and opens the modal', async () => {
+ getImageTo3dTargets.mockResolvedValue({ capabilities: {}, targets: [target()] });
+ renderPanel();
+ const btn = await screen.findByRole('button', { name: /^install$/i });
+ fireEvent.click(btn);
+ expect(await screen.findByTestId('install-modal')).toHaveTextContent('trellis2');
+ });
+
+ it('uses the selected target gated-repo count in the install description', async () => {
+ getImageTo3dTargets.mockResolvedValue({ capabilities: {}, targets: [target()] });
+ renderPanel();
+ fireEvent.click(await screen.findByRole('button', { name: /^install$/i }));
+ expect(await screen.findByTestId('install-description')).toHaveTextContent('2 gated Hugging Face models');
+ });
+
+ it('shows Ready and no Install button when the target is installed', async () => {
+ getImageTo3dTargets.mockResolvedValue({ targets: [target({ installed: true })] });
+ renderPanel();
+ expect(await screen.findByText(/ready/i)).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: /install/i })).toBeNull();
+ });
+
+ // #2952: `setup.sh` exits 0 even when its Metal texture-baking backends failed to
+ // build, and such an install renders correct geometry with a scrambled surface —
+ // so a flat "Ready" would be a lie, and re-running Install is the repair.
+ it('flags a degraded texture bake and offers Repair install', async () => {
+ getImageTo3dTargets.mockResolvedValue({
+ targets: [target({
+ installed: true,
+ degraded: { label: 'degraded textures', help: 'Install the Metal Toolchain.', repairable: true },
+ })],
+ });
+ renderPanel();
+ expect(await screen.findByText(/degraded textures/i)).toBeInTheDocument();
+ expect(screen.getByText('Install the Metal Toolchain.')).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /repair install/i })).toBeInTheDocument();
+ });
+
+ // #3041: on a Command-Line-Tools-only host, Repair install would fail the same
+ // way — so flag the problem but don't offer a button that can't fix it.
+ it('flags a degraded bake but offers no Repair button when the server says it is not repairable', async () => {
+ getImageTo3dTargets.mockResolvedValue({
+ targets: [target({
+ installed: true,
+ degraded: {
+ label: 'degraded textures', help: 'Install Xcode from the App Store.', repairable: false,
+ },
+ })],
+ });
+ renderPanel();
+ expect(await screen.findByText(/degraded textures/i)).toBeInTheDocument();
+ expect(screen.getByText('Install Xcode from the App Store.')).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: /install/i })).toBeNull();
+ });
+
+ // The degraded projection is normalized server-side, so a target degraded for an
+ // entirely different reason (Pixal3D with no NATTEN) renders through the same path
+ // with no per-target UI branch.
+ it('renders a non-TRELLIS degradation through the same badge and Repair button', async () => {
+ getImageTo3dTargets.mockResolvedValue({
+ targets: [target({
+ id: 'pixal3dCuda',
+ label: 'Pixal3D (CUDA)',
+ installed: true,
+ degraded: { label: 'NAF fallback', help: 'NATTEN is missing.', repairable: true },
+ })],
+ });
+ renderPanel();
+ expect(await screen.findByText(/NAF fallback/i)).toBeInTheDocument();
+ expect(screen.getByText('NATTEN is missing.')).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /repair install/i })).toBeInTheDocument();
+ // Must NOT leak the other lane's copy.
+ expect(screen.queryByText(/metal toolchain/i)).toBeNull();
+ });
+
+ it('stays plain Ready when the server reports no degradation', async () => {
+ // The server owns the unknown-vs-degraded distinction (a probe that merely failed
+ // must not cry wolf) and expresses it by OMITTING `degraded`. Asserting on the
+ // absence of that field is what actually exercises the component; a `textureBake`
+ // fixture would not, since nothing here reads it.
+ getImageTo3dTargets.mockResolvedValue({ targets: [target({ installed: true })] });
+ renderPanel();
+ expect(await screen.findByText(/ready/i)).toBeInTheDocument();
+ expect(screen.queryByText(/degraded/i)).toBeNull();
+ expect(screen.queryByRole('button', { name: /install/i })).toBeNull();
+ });
+
+ it('shows the unsupported reason and no Install button when the host cannot run it', async () => {
+ getImageTo3dTargets.mockResolvedValue({
+ targets: [target({ available: false, unavailableReason: 'requires-apple-silicon' })],
+ });
+ renderPanel();
+ expect(await screen.findAllByText(/requires an apple silicon mac/i)).not.toHaveLength(0);
+ expect(screen.queryByRole('button', { name: /install/i })).toBeNull();
+ });
+
+ it('surfaces a load error with Retry, and recovers on retry', async () => {
+ getImageTo3dTargets.mockRejectedValueOnce(new Error('boom'));
+ renderPanel();
+ expect(await screen.findByText('boom')).toBeInTheDocument();
+
+ getImageTo3dTargets.mockResolvedValueOnce({ targets: [target({ installed: true })] });
+ fireEvent.click(screen.getByRole('button', { name: /retry/i }));
+ expect(await screen.findByText(/ready/i)).toBeInTheDocument();
+ });
+
+ it('lists each gated repo once across targets that share it', async () => {
+ // Both lanes gate on the same two repos. The token is central, so listing the
+ // pair twice would just be noise in the prerequisite notice.
+ getImageTo3dTargets.mockResolvedValue({
+ targets: [target(), target({ id: 'pixal3dCuda', label: 'Pixal3D (CUDA)' })],
+ });
+ renderPanel();
+ expect(await screen.findAllByRole('link', { name: /briaai\/RMBG-2\.0/ })).toHaveLength(1);
+ });
+
+ it('omits an unavailable target’s gated repos — its terms are moot on this host', async () => {
+ getImageTo3dTargets.mockResolvedValue({
+ targets: [target({ available: false, unavailableReason: 'requires-apple-silicon' })],
+ });
+ renderPanel();
+ await screen.findAllByText(/requires an apple silicon mac/i);
+ expect(screen.queryByRole('link', { name: /briaai\/RMBG-2\.0/ })).toBeNull();
+ });
+});
diff --git a/client/src/components/models/ModelStatusTab.jsx b/client/src/components/models/ModelStatusTab.jsx
new file mode 100644
index 0000000000..687f503030
--- /dev/null
+++ b/client/src/components/models/ModelStatusTab.jsx
@@ -0,0 +1,30 @@
+import ModelsPanel from '../system-resources/ModelsPanel.jsx';
+import { useSystemResourceReport } from '../../hooks/useSystemResourceReport.js';
+
+/**
+ * Models → Status: what is resident right now, plus what is on disk.
+ *
+ * Residency (`MemoryManagement`) and the downloaded-model inventory used to be
+ * two pages in two sections — `/models/status` and Dev Tools'
+ * `/system-resources/models` — answering the same question ("what models does
+ * this machine have, and what is loaded?") in different places. `ModelsPanel`
+ * already rendered residency above the inventory, so folding them is a matter of
+ * hosting that panel here and feeding it the shared scan (#4728).
+ *
+ * The scan is deliberately NOT run on mount: it walks the Hugging Face cache,
+ * `data/loras/`, Ollama and LM Studio, which is slow and pointless for a user who
+ * came here to unload a model. `ModelsPanel` shows its own "Run model inventory"
+ * prompt until the user asks.
+ */
+export default function ModelStatusTab() {
+ const { report, loading, runReport, cleanup } = useSystemResourceReport();
+
+ return (
+ <ModelsPanel
+ report={report}
+ loading={loading}
+ onRunReport={runReport}
+ cleanup={cleanup}
+ />
+ );
+}
diff --git a/client/src/components/models/ModelStatusTab.test.jsx b/client/src/components/models/ModelStatusTab.test.jsx
new file mode 100644
index 0000000000..917ce706a6
--- /dev/null
+++ b/client/src/components/models/ModelStatusTab.test.jsx
@@ -0,0 +1,65 @@
+/**
+ * Models → Status hosts BOTH halves of "what models does this machine have":
+ * residency (loaded right now) and the downloaded-model inventory that used to
+ * live at Dev Tools' `/system-resources/models` (#4728).
+ *
+ * The fold is only real if the inventory actually renders here — and only
+ * tolerable if it does NOT scan on mount: the scan walks the Hugging Face cache,
+ * `data/loras/`, Ollama and LM Studio, which is slow and wasted on a user who
+ * came to unload a model.
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+
+const runSystemResourceReport = vi.fn();
+vi.mock('../../services/api', () => ({
+ runSystemResourceReport: (...a) => runSystemResourceReport(...a),
+ purgeDataCategory: vi.fn(),
+ deleteCachedModel: vi.fn(),
+ deleteLora: vi.fn(),
+ deleteLocalLlmModel: vi.fn(),
+}));
+
+vi.mock('../settings/MemoryManagement.jsx', () => ({ default: () => <div>residency panel</div> }));
+
+import ModelStatusTab from './ModelStatusTab';
+
+const REPORT = {
+ generatedAt: '2026-08-21T00:00:00.000Z',
+ cleanupCandidates: [],
+ sourceErrors: [],
+ models: {
+ downloaded: [{
+ id: 'huggingface:example-model',
+ name: 'example-model',
+ backend: 'huggingface',
+ sizeBytes: 2048,
+ loaded: false,
+ }],
+ loaded: [],
+ totals: { all: 2048 },
+ },
+};
+
+const renderTab = () => render(<MemoryRouter><ModelStatusTab /></MemoryRouter>);
+
+describe('ModelStatusTab', () => {
+ beforeEach(() => vi.clearAllMocks());
+
+ it('shows residency without scanning disk on mount', () => {
+ renderTab();
+ expect(screen.getByText('residency panel')).toBeInTheDocument();
+ expect(runSystemResourceReport).not.toHaveBeenCalled();
+ expect(screen.getByRole('button', { name: /run model inventory/i })).toBeInTheDocument();
+ });
+
+ it('renders the downloaded-model inventory once the user asks for it', async () => {
+ runSystemResourceReport.mockResolvedValue(REPORT);
+ renderTab();
+ fireEvent.click(screen.getByRole('button', { name: /run model inventory/i }));
+ await waitFor(() => expect(runSystemResourceReport).toHaveBeenCalledWith({ silent: true }));
+ expect(await screen.findByText('example-model')).toBeInTheDocument();
+ expect(screen.getByText(/downloaded model inventory/i)).toBeInTheDocument();
+ });
+});
diff --git a/client/src/components/models/ModelsTabsHeader.jsx b/client/src/components/models/ModelsTabsHeader.jsx
index c97b5b8586..24030ea30d 100644
--- a/client/src/components/models/ModelsTabsHeader.jsx
+++ b/client/src/components/models/ModelsTabsHeader.jsx
@@ -8,18 +8,40 @@ import RouteTabsHeader from '../ui/RouteTabsHeader';
// section gives each a URL you can land on (and reach from ⌘K / voice) instead
// of a scroll position on a page about something else.
//
+// The section now covers every KIND of model this install manages, not just
+// text (#4728): image/video checkpoints, LoRAs and their training datasets,
+// embedding models, and the on-device image-to-3D runtimes moved in from Create,
+// Settings and Dev Tools. What stayed behind is output, not weights — Three.js
+// Models is a gallery of generated meshes, and `/3d` is the render flow that
+// consumes the runtimes listed here.
+//
// Playground keeps its own `/local-llm/playground` path — it predates this
// section and the path is in ⌘K history — but it renders this header too, so
// selecting it does not strand the user outside the tab bar.
//
-// Keep this list alphabetical by label, matching the sidebar convention.
+// Keep this list alphabetical by label, matching the sidebar convention. It is
+// past the width a scrolling pill bar reads well at, so the header collapses to
+// a `<select>` under `sm`.
export const TABS = [
+ { id: '3d', label: '3D', to: '/models/3d' },
+ { id: 'embeddings', label: 'Embeddings', to: '/models/embeddings' },
{ id: 'llms', label: 'LLMs', to: '/models/llms' },
+ { id: 'loras', label: 'LoRAs', to: '/models/loras' },
+ { id: 'media', label: 'Media', to: '/models/media' },
{ id: 'performance', label: 'Performance', to: '/models/performance' },
{ id: 'playground', label: 'Playground', to: '/local-llm/playground' },
{ id: 'status', label: 'Status', to: '/models/status' },
+ { id: 'training', label: 'Training', to: '/models/training' },
];
export default function ModelsTabsHeader({ activeTab }) {
- return <RouteTabsHeader tabs={TABS} activeTab={activeTab} ariaLabel="Models sections" />;
+ return (
+ <RouteTabsHeader
+ tabs={TABS}
+ activeTab={activeTab}
+ ariaLabel="Models sections"
+ mobileDropdown
+ mobileSelectId="models-section-select"
+ />
+ );
}
diff --git a/client/src/components/settings/EmbeddingsTab.jsx b/client/src/components/settings/EmbeddingsTab.jsx
index 4ec4625089..9cb37d5b78 100644
--- a/client/src/components/settings/EmbeddingsTab.jsx
+++ b/client/src/components/settings/EmbeddingsTab.jsx
@@ -1,4 +1,5 @@
import { useEffect, useMemo, useState } from 'react';
+import { Link } from 'react-router';
import { Boxes, RefreshCw, AlertTriangle, Check } from 'lucide-react';
import BrailleSpinner from '../BrailleSpinner';
import toast from '../ui/Toast';
@@ -160,8 +161,9 @@ export default function EmbeddingsTab() {
<div className="flex items-start gap-2 text-xs text-amber-400">
<AlertTriangle size={14} className="mt-0.5 flex-shrink-0" />
<span>
- No installed embedding models detected on {provider}. Install one in Local LLMs
- (e.g. <code className="text-amber-300">nomic-embed-text</code> on Ollama).
+ No installed embedding models detected on {provider}. Install one in{' '}
+ <Link to="/models/llms" className="underline hover:text-amber-300">LLMs</Link>
+ {' '}(e.g. <code className="text-amber-300">nomic-embed-text</code> on Ollama).
</span>
</div>
)}
diff --git a/client/src/components/settings/ImageGenTab.jsx b/client/src/components/settings/ImageGenTab.jsx
index 2bbed1def0..c43df844e0 100644
--- a/client/src/components/settings/ImageGenTab.jsx
+++ b/client/src/components/settings/ImageGenTab.jsx
@@ -844,7 +844,7 @@ export function ImageGenTab() {
<p className="text-xs text-gray-500">
Pick a Python 3.10+ interpreter — PortOS auto-detects venvs and conda installs and can install
missing packages directly. HF model weights stream into the standard <code>~/.cache/huggingface</code>
- and are surfaced in <a href="/media/models" className="text-port-accent hover:underline">Media → Models</a>.
+ and are surfaced in <a href="/models/media" className="text-port-accent hover:underline">Models → Media</a>.
</p>
<LocalSetupPanel pythonPath={pythonPath} onPythonPathChange={setPythonPath} />
<CleanersToggles
diff --git a/client/src/components/settings/SettingsTabsHeader.jsx b/client/src/components/settings/SettingsTabsHeader.jsx
index 21a0c3e716..1405fe85f1 100644
--- a/client/src/components/settings/SettingsTabsHeader.jsx
+++ b/client/src/components/settings/SettingsTabsHeader.jsx
@@ -16,7 +16,6 @@ export const TABS = [
{ id: 'catalog', label: 'Catalog', to: '/settings/catalog' },
{ id: 'code-reviewers', label: 'Code Reviewers', to: '/settings/code-reviewers' },
{ id: 'database', label: 'Database', to: '/settings/database' },
- { id: 'embeddings', label: 'Embeddings', to: '/settings/embeddings' },
{ id: 'general', label: 'General', to: '/settings/general' },
{ id: 'mortalloom', label: 'MortalLoom', to: '/settings/mortalloom' },
{ id: 'openclaw', label: 'OpenClaw', to: '/openclaw' },
diff --git a/client/src/components/system-resources/ModelsPanel.jsx b/client/src/components/system-resources/ModelsPanel.jsx
index 700659d450..00feb63493 100644
--- a/client/src/components/system-resources/ModelsPanel.jsx
+++ b/client/src/components/system-resources/ModelsPanel.jsx
@@ -73,7 +73,7 @@ export default function ModelsPanel({ report, loading, onRunReport, cleanup }) {
</p>
</div>
<div className="flex flex-wrap items-center gap-2">
- <Link to="/media/models" className="min-h-[36px] rounded-lg border border-port-border px-3 py-2 text-xs text-gray-300 hover:bg-port-border/40">Media models</Link>
+ <Link to="/models/media" className="min-h-[36px] rounded-lg border border-port-border px-3 py-2 text-xs text-gray-300 hover:bg-port-border/40">Media models</Link>
<Link to="/models/llms" className="min-h-[36px] rounded-lg border border-port-border px-3 py-2 text-xs text-gray-300 hover:bg-port-border/40">Manage LLMs</Link>
<button
type="button"
diff --git a/client/src/components/ui/RouteTabsHeader.jsx b/client/src/components/ui/RouteTabsHeader.jsx
index 5e216e1784..61c7261cd3 100644
--- a/client/src/components/ui/RouteTabsHeader.jsx
+++ b/client/src/components/ui/RouteTabsHeader.jsx
@@ -15,9 +15,13 @@ import TabPills from './TabPills';
* whose `to` lives outside their route prefix (Models → Playground) — the id
* still selects it, so the host page passes its own `activeTab`.
*
- * @param {{ tabs: Array<{id:string,label:string,to:string}>, activeTab: string, ariaLabel: string }} props
+ * Sections with more tabs than a pill bar reads well at (Models) pass
+ * `mobileDropdown` — plus `mobileSelectId`, so the collapsed `<select>` gets a
+ * real `<label htmlFor>` rather than only an aria-label.
+ *
+ * @param {{ tabs: Array<{id:string,label:string,to:string}>, activeTab: string, ariaLabel: string, mobileDropdown?: boolean, mobileSelectId?: string }} props
*/
-export default function RouteTabsHeader({ tabs, activeTab, ariaLabel }) {
+export default function RouteTabsHeader({ tabs, activeTab, ariaLabel, mobileDropdown = false, mobileSelectId }) {
const navigate = useNavigate();
const handleChange = (tabId) => {
@@ -31,6 +35,8 @@ export default function RouteTabsHeader({ tabs, activeTab, ariaLabel }) {
activeTab={activeTab}
onChange={handleChange}
ariaLabel={ariaLabel}
+ mobileDropdown={mobileDropdown}
+ mobileSelectId={mobileSelectId}
className="w-full min-w-0 shrink-0"
/>
);
diff --git a/client/src/hooks/README.md b/client/src/hooks/README.md
index cdc5f82d81..da08edf15d 100644
--- a/client/src/hooks/README.md
+++ b/client/src/hooks/README.md
@@ -183,6 +183,7 @@ grep -i "what you want to do" client/src/hooks/README.md
| `useRoundPartners` | A Round's quodlibet partners: the all-rounds list (re-fetched per open song, best-effort), `partnerSongs` (ids resolved to records, missing ones dropped), `otherSongs` (alphabetical pick list) and `togglePartner` (capped at `PARTNERS_MAX`). | `/rounds/:id` — the "Sings with" editor and the stacked-parts view. |
| `useSongTraining` | Drives a song training run over one scope (whole song or a sliced section) on top of `useColorMatch`: counts in, walks + grades the scope's score, then folds the finished take into the rolling progress history (`songProgress.recordAttempt`) and surfaces the next aggregate via `onProgress`. Supports looping (auto-restart after a run) and keeps a `lastSummary`. Exposes `{ running, countingIn, noteColors, activeIndex, lastSummary, start, stop }`; cancels pending loop relaunches on stop/unmount. | The Song editor's Training panel. |
| `useSyncIntegrity` | Fetches per-kind integrity diff from every eligible online peer; reduces to worst-case `statusById` + `byPeer` breakdown maps. | Federated media sync integrity UI — badges, drawers, peer breakdown. |
+| `useSystemResourceReport` | The system-resource disk scan plus its cleanup lifecycle: generation-guarded `runReport` (a late scan can never resurrect rows a newer one removed), one-delete-at-a-time removal keyed on the candidate's server-issued action, and report invalidation after a successful delete. Returns `{ report, setReport, loading, runReport, cleanup }` — `cleanup` is the prop bag `StoragePanel`/`ModelsPanel`/`CleanupControl` expect. | Dev Tools → System Resources → Storage, and Models → Status. Don't re-wire the scan/cleanup pair by hand. |
| `useTwinEvaluationSuite` | Shared lifecycle for the three Digital Twin evaluation-suite panels (Values-Alignment, Adversarial-Boundary, Multi-Turn): loads suite + recent history (silenced), runs every selected provider/model in parallel, prepends fresh runs, and handles the stale-persona / partial-failure toast fan-out. `countField` names the suite's pass-count key so history stays generic. Returns `{ items, history, loading, running, results, expanded, setExpanded, run, reload }`. | The Digital Twin `TwinEvaluationSuitePanel` presentation shell — don't re-roll the load/run/history dance per suite. |
| `useRepoIntake` | The Brain capture boxes' GitHub-repo state: `repo` (the parsed `{owner,repo}` when the ENTIRE capture text is a repo URL — i.e. exactly when the server will clone it), the two sticky post-clone agent opt-ins (`options`/`toggle`, persisted to `localStorage`), per-capture repo-study context, and `intakeFor(submittedText)` which re-derives at submit time so a sticky tick can't ride along on a capture retyped into a plain thought. Also exports the pure `capturedGitHubRepo(text)`. | Any capture surface that should offer the malware-scan / repo-study runs. Render with `components/brain/RepoIntakeOptions`; don't re-parse the text in the component. |
| `useRenderJobQueue` | Per-entry render-job queue for the Universe Builder — `pendingByEntryId` (entryId → jobId[]), `pendingHeadByEntryId` (first jobId per entry for single-subscription thumbs), `enqueueEntryJobs` (append variation/canon jobs), `clearPendingForEntry` (shift a jobId out, or drop the entry). | Universe Builder render orchestration. Don't re-roll the per-entry pending-jobs reducer. |
diff --git a/client/src/hooks/index.js b/client/src/hooks/index.js
index 2c9bff2f50..93a3c3f82f 100644
--- a/client/src/hooks/index.js
+++ b/client/src/hooks/index.js
@@ -196,6 +196,7 @@ export * from './useRecordMerge.js';
export * from './useRenderJobQueue.js';
export * from './useRepoIntake.js';
export * from './useSyncIntegrity.js';
+export * from './useSystemResourceReport.js';
export * from './useTwinEvaluationSuite.js';
export * from './useUniverseNav.js';
export * from './useVideoFileSrc.js';
diff --git a/client/src/hooks/useSystemResourceReport.js b/client/src/hooks/useSystemResourceReport.js
new file mode 100644
index 0000000000..b868ac524c
--- /dev/null
+++ b/client/src/hooks/useSystemResourceReport.js
@@ -0,0 +1,98 @@
+/**
+ * The system-resource disk scan plus its cleanup lifecycle, as one hook.
+ *
+ * `runSystemResourceReport` is an expensive multi-store scan whose result feeds
+ * two unrelated surfaces — the Storage panel under Dev Tools and the downloaded-
+ * model inventory under Models → Status. Both need the same three things around
+ * it, and getting any of them subtly wrong is a data bug rather than a cosmetic
+ * one:
+ *
+ * - **Generation guarding.** Explicit refreshes and post-cleanup rescans
+ * overlap. Only the newest request may own the report or the loading flag —
+ * an older scan landing late must not resurrect candidates a newer scan
+ * already removed.
+ * - **One delete in flight.** `cleanupBusyRef` is checked *before* the state
+ * update, so a double-click can't fire two deletes for the same row.
+ * - **Invalidate on success.** Every candidate carries a server-issued action;
+ * after a removal the whole report is dropped (not patched) so no stale row
+ * stays clickable during the follow-up scan.
+ *
+ * Returns `{ report, setReport, loading, runReport, cleanup }`, where `cleanup`
+ * is the prop bag `StoragePanel` / `ModelsPanel` / `CleanupControl` expect.
+ */
+import { useCallback, useRef, useState } from 'react';
+import * as api from '../services/api';
+import toast from '../components/ui/Toast';
+import { useConfirmDelete } from './useConfirmDelete.js';
+
+// Maps a candidate's server-issued action to the delete call that honors it.
+// Returning null for an unknown type is deliberate: a newer server may describe
+// an action this client cannot perform, and refusing beats guessing.
+const removeForAction = (action) => {
+ if (action.type === 'data-category') return api.purgeDataCategory(action.key, {}, { silent: true });
+ if (action.type === 'hf-model') return api.deleteCachedModel(action.dirName, { silent: true });
+ if (action.type === 'lora') return api.deleteLora(action.filename, { silent: true });
+ if (action.type === 'local-model') return api.deleteLocalLlmModel(action.backend, action.modelId, { silent: true });
+ return null;
+};
+
+export function useSystemResourceReport() {
+ const [report, setReport] = useState(null);
+ const [loading, setLoading] = useState(false);
+ const [busyId, setBusyId] = useState(null);
+ const generationRef = useRef(0);
+ const busyRef = useRef(null);
+ const { isConfirming, requestDelete, cancelDelete, confirmDelete } = useConfirmDelete();
+
+ const runReport = useCallback(async () => {
+ const generation = ++generationRef.current;
+ cancelDelete();
+ setLoading(true);
+ const outcome = await api.runSystemResourceReport({ silent: true }).then(
+ (value) => ({ value }),
+ (error) => ({ error }),
+ );
+ if (generation !== generationRef.current) return outcome.value || null;
+ setLoading(false);
+ if (outcome.error) {
+ toast.error(outcome.error?.message || 'System report failed');
+ return null;
+ }
+ if (outcome.value) setReport(outcome.value);
+ return outcome.value || null;
+ }, [cancelDelete]);
+
+ const removeCandidate = useCallback(async (candidate) => {
+ const action = candidate.action;
+ if (!action || busyRef.current) return;
+ busyRef.current = candidate.id;
+ setBusyId(candidate.id);
+ const result = await (removeForAction(action) || Promise.resolve(null)).catch((error) => {
+ toast.error(error?.message || `Could not remove ${candidate.label}`);
+ return null;
+ });
+ if (!result) {
+ busyRef.current = null;
+ setBusyId(null);
+ return;
+ }
+ setReport(null);
+ toast.success(`${candidate.label} removed`);
+ await runReport();
+ busyRef.current = null;
+ setBusyId(null);
+ }, [runReport]);
+
+ const cleanup = {
+ busyId,
+ locked: busyId != null || loading,
+ isConfirming,
+ request: requestDelete,
+ cancel: cancelDelete,
+ confirm: (candidate) => confirmDelete(() => removeCandidate(candidate)),
+ };
+
+ return { report, setReport, loading, runReport, cleanup };
+}
+
+export default useSystemResourceReport;
diff --git a/client/src/hooks/useVideoGenForm.js b/client/src/hooks/useVideoGenForm.js
index 11d83e0ac9..3e1c9a9fb9 100644
--- a/client/src/hooks/useVideoGenForm.js
+++ b/client/src/hooks/useVideoGenForm.js
@@ -338,7 +338,7 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
}, [sourceImageFile, sourceUploadUrl, modelId, models]);
// ?lora=<filename> preselects a video LoRA when the user clicks "Test" on a
- // video LoRA card in /media/loras. Mirrors the ImageGen ?lora= handoff:
+ // video LoRA card in /models/loras. Mirrors the ImageGen ?lora= handoff:
// defer until the library has loaded (for name/scale/triggers), append the
// LoRA's trigger words, then strip the param so a refresh doesn't re-add it.
useEffect(() => {
@@ -355,7 +355,7 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
// ltx2 model is compatible, so the modelId-validation effect won't undo
// this. A non-video LoRA needs no switch (the image picker tolerates it).
// Family-agnostic on BOTH sides: an incoming H3 LoRA must be recognized as
- // video (else the Test handoff from /media/loras lands in the no-op
+ // video (else the Test handoff from /models/loras lands in the no-op
// branch), and the model it switches to must be one whose family matches,
// not an ltx2 model that would reject it.
const incomingFamily = loraFamilyOf(match);
diff --git a/client/src/lib/runnerFamilies.js b/client/src/lib/runnerFamilies.js
index 47e1bb3090..0e053bbab5 100644
--- a/client/src/lib/runnerFamilies.js
+++ b/client/src/lib/runnerFamilies.js
@@ -21,7 +21,7 @@ export const VIDEO_LORA_FAMILIES = Object.freeze({
});
// Predicate: is this LoRA family a video family (vs. an image RUNNER_FAMILIES
-// one)? Backs the Image/Video filter on /media/loras. Anything not in
+// one)? Backs the Image/Video filter on /models/loras. Anything not in
// VIDEO_LORA_FAMILIES (including null/legacy) is treated as image. Mirror of
// server/lib/runners.js.
const VIDEO_LORA_FAMILY_SET = new Set(Object.values(VIDEO_LORA_FAMILIES));
diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsx
index 4bbb4b5939..f9f35086e5 100644
--- a/client/src/pages/ImageGen.jsx
+++ b/client/src/pages/ImageGen.jsx
@@ -441,7 +441,7 @@ export default function ImageGen() {
}, [availableBackends, i2iCapable, switchMode]);
// ?lora=<filename> preselects a LoRA when the user clicks "Test" on the
- // /media/loras manager page. Defers until availableLoras has loaded so the
+ // /models/loras manager page. Defers until availableLoras has loaded so the
// metadata (recommendedScale, name, triggerWords) is available; once applied,
// strip the param so a refresh doesn't keep re-adding the LoRA. Also
// auto-appends the LoRA's trigger words to the prompt — the user came from
diff --git a/client/src/pages/LoraDatasetDetail.jsx b/client/src/pages/LoraDatasetDetail.jsx
index 4d5741f1b1..30b99f070b 100644
--- a/client/src/pages/LoraDatasetDetail.jsx
+++ b/client/src/pages/LoraDatasetDetail.jsx
@@ -1,5 +1,5 @@
/**
- * LoRA dataset workbench (/media/training/:datasetId).
+ * LoRA dataset workbench (/models/training/:datasetId).
*
* Build reference material for one universe bible subject (generate via the image
* queue, upload, slice the reference-sheet turnaround), caption it with
@@ -486,7 +486,7 @@ export default function LoraDatasetDetail() {
return (
<div className="bg-port-card border border-port-border rounded-lg p-6 text-center text-gray-400">
<AlertTriangle className="w-6 h-6 mx-auto mb-2 text-port-error" />
- {loadError} — <Link to="/media/training" className="text-port-accent hover:underline">back to datasets</Link>
+ {loadError} — <Link to="/models/training" className="text-port-accent hover:underline">back to datasets</Link>
</div>
);
}
@@ -498,7 +498,7 @@ export default function LoraDatasetDetail() {
<div className="space-y-4">
<div className="flex items-start justify-between gap-3 flex-wrap">
<div className="min-w-0">
- <Link to="/media/training" className="text-xs text-gray-400 hover:text-white flex items-center gap-1 mb-1">
+ <Link to="/models/training" className="text-xs text-gray-400 hover:text-white flex items-center gap-1 mb-1">
<ArrowLeft className="w-3 h-3" /> Datasets
</Link>
<div className="flex items-center gap-2 min-w-0">
diff --git a/client/src/pages/LoraTraining.jsx b/client/src/pages/LoraTraining.jsx
index 7fb260c56a..b20e053617 100644
--- a/client/src/pages/LoraTraining.jsx
+++ b/client/src/pages/LoraTraining.jsx
@@ -1,5 +1,5 @@
/**
- * LoRA Training — dataset list (/media/training).
+ * LoRA Training — dataset list (/models/training).
*
* One dataset per universe bible subject. Cards show the subject, a thumb
* strip, image/caption counts, and training status; "New dataset" walks
@@ -135,7 +135,7 @@ export default function LoraTraining() {
{(datasets || []).map((d) => (
<div key={d.id} className="bg-port-card border border-port-border rounded-lg p-4 flex flex-col gap-3">
<div className="flex items-start justify-between gap-2">
- <Link to={`/media/training/${d.id}`} className="min-w-0">
+ <Link to={`/models/training/${d.id}`} className="min-w-0">
<div className="text-white font-medium truncate">{d.character?.name || 'Unnamed'}</div>
<div className="text-xs text-gray-500 truncate">
<span className="font-mono">{d.triggerWord}</span>
@@ -148,7 +148,7 @@ export default function LoraTraining() {
</span>
</div>
{d.thumbnails?.length > 0 && (
- <Link to={`/media/training/${d.id}`} className="flex gap-1 overflow-hidden">
+ <Link to={`/models/training/${d.id}`} className="flex gap-1 overflow-hidden">
{d.thumbnails.map((file) => (
<img
key={file}
@@ -194,7 +194,7 @@ export default function LoraTraining() {
{showNew && (
<NewDatasetDialog
onClose={() => setShowNew(false)}
- onCreated={(dataset) => navigate(`/media/training/${dataset.id}`)}
+ onCreated={(dataset) => navigate(`/models/training/${dataset.id}`)}
/>
)}
</div>
diff --git a/client/src/pages/Loras.jsx b/client/src/pages/Loras.jsx
index 139fe81a85..c5e41ee7cc 100644
--- a/client/src/pages/Loras.jsx
+++ b/client/src/pages/Loras.jsx
@@ -1149,7 +1149,7 @@ function LoraCard({ lora, onDelete, deleting, deleteConfirm }) {
{lora.source === 'trained' && lora.character && (
<div className="mb-2">
<Link
- to={lora.trainedFromDatasetId ? `/media/training/${lora.trainedFromDatasetId}` : '/media/training'}
+ to={lora.trainedFromDatasetId ? `/models/training/${lora.trainedFromDatasetId}` : '/models/training'}
className="inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded-full bg-port-success/15 text-port-success border border-port-success/30 hover:bg-port-success/25"
title="Trained in PortOS — open the training dataset"
>
diff --git a/client/src/pages/Media3D.jsx b/client/src/pages/Media3D.jsx
index 58f0bc5b36..7dd67eee14 100644
--- a/client/src/pages/Media3D.jsx
+++ b/client/src/pages/Media3D.jsx
@@ -1,14 +1,13 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { Link } from 'react-router';
-import { Boxes, CheckCircle2, Download, AlertTriangle, Loader2, ExternalLink, ImagePlus, Sparkles, KeyRound } from 'lucide-react';
+import { Boxes, CheckCircle2, AlertTriangle, Loader2, ImagePlus, Sparkles, Settings2 } from 'lucide-react';
import { getImageTo3dTargets, createImageTo3dModel, getImageTo3dModel, listImageTo3dModels } from '../services/api';
import { useAutoRefetch } from '../hooks/useAutoRefetch';
import useMounted from '../hooks/useMounted';
import { nameFromImageFilename, timeAgo } from '../utils/formatters';
-import RuntimeInstallModal from '../components/install/RuntimeInstallModal';
import GalleryImagePicker from '../components/imageGen/GalleryImagePicker';
import GlbViewer from '../components/media/GlbViewer';
-import HfTokenBanner, { GatedModelList, HF_SOURCE_LABEL } from '../components/imageGen/HfTokenBanner';
+import Image3dHfAccessNotice from '../components/media/Image3dHfAccessNotice';
import { useHfTokenStatus } from '../hooks/useHfTokenStatus';
import useUrlParams from '../hooks/useUrlParams';
import MediaImage from '../components/MediaImage';
@@ -20,161 +19,11 @@ import { unavailableReasonLabel } from '../lib/imageTo3dReasons';
// Poll cadence while a render is in flight (a real TRELLIS.2 render is multi-minute).
const POLL_INTERVAL_MS = 2500;
-// Prerequisite notice for a target that needs gated Hugging Face access. Driven by
-// the CENTRAL token store (GET /image-gen/setup/hf-token-status) — the same one the
-// Image Gen page writes — so a user who already pasted a token isn't told to go set
-// one up in a terminal. With no token, the inline paste-and-save banner appears
-// instead of instructions. Either way the gated repos stay listed: a token doesn't
-// grant access until their terms are accepted on the user's HF account.
-function HfAccessNotice({ models, tokenPresent, tokenSource, onSaved }) {
- // Escape hatch for the stale/invalid-token case: `isHfAuthError` in the runner
- // also matches `401` / `Invalid user token`, and its guidance now says to add a
- // token *on this page* — so the paste form has to stay reachable even when one is
- // already configured, or that instruction is impossible to follow here. Mirrors
- // MidiGatedModal's "Use a different token".
- const [replacing, setReplacing] = useState(false);
-
- if (!models?.length) return null;
- // Status still loading (null) — don't flash a "needs setup" banner at a user who
- // already has a token.
- if (tokenPresent === null) return null;
-
- const handleSaved = () => { setReplacing(false); onSaved?.(); };
-
- if (!tokenPresent || replacing) {
- return <HfTokenBanner models={models} onSaved={handleSaved} />;
- }
-
- return (
- <div className="rounded-lg border border-port-border bg-port-bg/40 p-3 text-xs text-gray-400">
- <div className="flex items-center gap-1.5 font-medium text-port-success">
- <KeyRound className="h-3.5 w-3.5" />
- Hugging Face token configured
- {HF_SOURCE_LABEL[tokenSource] ? ` (${HF_SOURCE_LABEL[tokenSource]})` : ''}
- </div>
- <p className="mt-1">
- Accept the terms for these gated models on your Hugging Face account if you haven’t — a token alone
- doesn’t grant access:
- </p>
- <GatedModelList models={models} linkClassName="text-port-accent hover:underline" />
- <button
- type="button"
- onClick={() => setReplacing(true)}
- className="mt-2 text-xs underline text-gray-400 hover:text-white"
- >
- Use a different token
- </button>
- </div>
- );
-}
-
-const LANE_LABEL = {
- 'local-mps': 'Runs on-device (Apple Silicon)',
- 'local-cuda': 'Runs on-device (CUDA)',
- 'hosted-api': 'Hosted API',
-};
-
// A target is generation-ready when it can run on this host and its local model
// is present (installed:null means "no install concept" — a hosted target that's
// ready as soon as it's available).
const isTargetReady = (t) => !!t && t.available && t.installed !== false;
-function StatusBadge({ target }) {
- if (!target.available) {
- return (
- <span className="inline-flex items-center gap-1.5 text-xs font-medium text-port-warning">
- <AlertTriangle className="w-3.5 h-3.5" />
- {unavailableReasonLabel(target.unavailableReason)}
- </span>
- );
- }
- if (target.installed) {
- // An installed-but-degraded target still renders — TRELLIS.2 with no Metal bake
- // produces correct geometry with a scrambled surface; Pixal3D with no NATTEN
- // falls back to DINO projection features — so "Ready" alone would be a lie. The
- // server normalizes every such case into `degraded` (see the adapter contract),
- // and a probe that could NOT run reports nothing here rather than crying wolf
- // about an install that is probably fine.
- if (target.degraded) {
- return (
- <span className="inline-flex items-center gap-1.5 text-xs font-medium text-port-warning">
- <AlertTriangle className="w-3.5 h-3.5" /> Ready · {target.degraded.label}
- </span>
- );
- }
- return (
- <span className="inline-flex items-center gap-1.5 text-xs font-medium text-port-success">
- <CheckCircle2 className="w-3.5 h-3.5" /> Ready
- </span>
- );
- }
- return null;
-}
-
-function TargetCard({ target, onInstall }) {
- // Install only applies to targets with a local install concept (installed is a
- // boolean); hosted targets report installed:null and are Ready when available.
- const canInstall = target.available && target.installed === false;
- const degraded = target.degraded;
- // Repair install re-runs setup — but only offer it when the server says it can
- // actually fix this. On a Command-Line-Tools-only host `repairable` is false and the
- // remedy is installing Xcode, so a Repair button would just fail the same way and
- // read as broken.
- const canRepair = !!degraded && degraded.repairable !== false;
-
- return (
- <div className="rounded-lg border border-port-border bg-port-card p-4">
- <div className="flex flex-wrap items-start justify-between gap-3">
- <div className="min-w-0">
- <div className="flex items-center gap-2">
- <h2 className="text-sm font-semibold text-white">{target.label}</h2>
- {target.executionLane && (
- <span className="rounded bg-port-bg px-1.5 py-0.5 text-[11px] text-gray-400">
- {LANE_LABEL[target.executionLane] || target.executionLane}
- </span>
- )}
- </div>
- {target.description && (
- <p className="mt-1 text-xs text-gray-400">{target.description}</p>
- )}
- {(target.upstream || target.port) && (
- <div className="mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-gray-500">
- {target.upstream && (
- <a href={target.upstream} target="_blank" rel="noreferrer"
- className="inline-flex items-center gap-1 hover:text-port-accent">
- <ExternalLink className="w-3 h-3" /> Upstream
- </a>
- )}
- {target.port && (
- <a href={target.port} target="_blank" rel="noreferrer"
- className="inline-flex items-center gap-1 hover:text-port-accent">
- <ExternalLink className="w-3 h-3" /> Apple Silicon port
- </a>
- )}
- </div>
- )}
- </div>
- <div className="flex shrink-0 flex-col items-end gap-2">
- <StatusBadge target={target} />
- {(canInstall || canRepair) && (
- <button
- onClick={() => onInstall(target)}
- className="inline-flex items-center gap-1.5 rounded-md bg-port-accent px-3 py-1.5 text-xs font-medium text-white hover:bg-blue-600"
- >
- <Download className="w-3.5 h-3.5" /> {canInstall ? 'Install' : 'Repair install'}
- </button>
- )}
- </div>
- </div>
- {degraded?.help && (
- <p className="mt-3 rounded border border-port-warning/40 bg-port-warning/10 p-2 text-[11px] leading-relaxed text-port-warning">
- {degraded.help}
- </p>
- )}
- </div>
- );
-}
-
export default function Media3D() {
const [searchParams, updateParams] = useUrlParams();
// URL is the source of truth for what's open: the source image, the chosen
@@ -186,8 +35,6 @@ export default function Media3D() {
const [targets, setTargets] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
- // The target whose install modal is open (only local-install targets); null = closed.
- const [installTarget, setInstallTarget] = useState(null);
const [pickerOpen, setPickerOpen] = useState(false);
// Render lifecycle: a create kicks off an on-device render, then we poll the
// record (via useAutoRefetch below) until it lands (ready → preview) or fails
@@ -317,12 +164,11 @@ export default function Media3D() {
if (!selectedImage) return 'Pick a source image to continue.';
if (!selectedTarget) return 'No image-to-3D model is registered.';
if (!selectedTarget.available) return unavailableReasonLabel(selectedTarget.unavailableReason, 'This model can’t run on this host.');
- if (selectedTarget.installed === false) return `Install ${selectedTarget.label} below before generating.`;
+ if (selectedTarget.installed === false) return `Install ${selectedTarget.label} from Models → 3D before generating.`;
return null;
})();
const gatedHfModels = selectedTarget?.available ? selectedTarget.gatedRepos : null;
- const gatedRepoCount = installTarget?.gatedRepos?.length || 0;
return (
<div className="mx-auto max-w-4xl">
@@ -332,8 +178,7 @@ export default function Media3D() {
<h1 className="text-lg font-semibold text-white">3D</h1>
</div>
<p className="mt-1 text-sm text-gray-400">
- Turn a rendered image into a 3D mesh. Pick a source image and model here, then install
- and manage the image-to-3D runtimes below.
+ Turn a rendered image into a 3D mesh. Pick a source image and model, then render on-device.
</p>
</header>
@@ -392,7 +237,7 @@ export default function Media3D() {
</div>
{gatedHfModels?.length > 0 && (
- <HfAccessNotice
+ <Image3dHfAccessNotice
models={gatedHfModels}
tokenPresent={hfTokenPresent}
tokenSource={hfTokenSource}
@@ -497,68 +342,34 @@ export default function Media3D() {
</section>
)}
- <h2 className="mb-2 text-xs font-medium uppercase tracking-wide text-gray-400">Models &amp; runtimes</h2>
-
- {loading && (
- <div className="flex items-center gap-2 text-sm text-gray-400">
- <Loader2 className="h-4 w-4 animate-spin" /> Loading models…
- </div>
- )}
-
- {error && !loading && (
- <div className="flex items-center justify-between rounded-lg border border-port-error/40 bg-port-error/10 p-4 text-sm text-port-error">
- <span>{error}</span>
- <button onClick={load} className="rounded-md border border-port-error/50 px-3 py-1 text-xs hover:bg-port-error/20">
- Retry
- </button>
- </div>
- )}
-
- {!loading && !error && (
- <div className="space-y-3">
- {targets.length === 0 && (
- <p className="text-sm text-gray-500">No image-to-3D models are registered.</p>
- )}
- {targets.map((target) => (
- <TargetCard key={target.id} target={target} onInstall={setInstallTarget} />
- ))}
+ {/* Install/repair lives under Models → 3D — these are on-device runtimes, not
+ renders — so the generate flow just names the state and links there (#4728). */}
+ <section className="rounded-xl border border-port-border bg-port-card p-4">
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div className="min-w-0">
+ <h2 className="text-sm font-semibold text-white">Runtimes</h2>
+ <p className="mt-1 text-xs text-gray-400">
+ {loading
+ ? 'Checking which image-to-3D runtimes are installed…'
+ : error
+ ? error
+ : targets.length === 0
+ ? 'No image-to-3D models are registered.'
+ : `${targets.filter(isTargetReady).length} of ${targets.length} ready on this host.`}
+ </p>
+ </div>
+ <Link
+ to="/models/3d"
+ className="inline-flex shrink-0 items-center gap-1.5 rounded-md border border-port-border px-3 py-1.5 text-xs text-gray-300 hover:border-port-accent hover:text-white"
+ >
+ <Settings2 className="h-3.5 w-3.5" /> Manage runtimes
+ </Link>
</div>
- )}
+ </section>
{/* Searchable render-history picker (reused from Image Gen). Selecting an
image drives `?image=` so the choice is deep-linkable. */}
<GalleryImagePicker open={pickerOpen} onClose={() => setPickerOpen(false)} onSelect={handlePick} allowUpload />
-
- {/* TRELLIS.2 (and any future local-install target) streams its clone +
- setup.sh install through the shared runtime-install modal. */}
- <RuntimeInstallModal
- open={!!installTarget}
- runtime={installTarget?.id}
- label={installTarget?.label}
- installUrlBase={installTarget ? `/api/image-to-3d/targets/${installTarget.id}/install` : undefined}
- // Repairing an already-installed target must re-run its setup rather than
- // short-circuit on "already installed" — that re-run is what rebuilds whatever
- // was missing (TRELLIS.2's Metal backends, Pixal3D's NATTEN kernels) now that
- // its build deps are present.
- params={installTarget?.degraded ? { repair: '1' } : undefined}
- // Copy comes from the target descriptor, never hard-coded here: this modal is
- // shared by every target, so TRELLIS.2-specific prose would misdescribe the
- // others. A degraded target explains its own remedy via `degraded.help`.
- // `undefined` rather than '' when a target has nothing to say, so
- // RuntimeInstallModal's own default description applies instead of a blank panel.
- description={installTarget?.degraded
- // The degraded help text owns the whole message (both targets' already end by
- // saying downloaded models are kept) — appending to it would repeat that.
- ? installTarget.degraded.help
- : [
- installTarget?.installNotes,
- gatedRepoCount
- ? `It also pulls ${gatedRepoCount} gated Hugging Face ${gatedRepoCount === 1 ? 'model' : 'models'} on first render — accept their terms and add a Hugging Face token above (see the note on the 3D page).`
- : null,
- ].filter(Boolean).join(' ') || undefined}
- onClose={() => setInstallTarget(null)}
- onComplete={() => { setInstallTarget(null); load(); }}
- />
</div>
);
}
diff --git a/client/src/pages/Media3D.test.jsx b/client/src/pages/Media3D.test.jsx
index de836e0230..7499831b77 100644
--- a/client/src/pages/Media3D.test.jsx
+++ b/client/src/pages/Media3D.test.jsx
@@ -16,14 +16,6 @@ vi.mock('../services/api', () => ({
getHfTokenStatus: (...a) => getHfTokenStatus(...a),
}));
-// Stub the shared install modal so the test doesn't open a real EventSource;
-// assert only that it's opened with the chosen target.
-vi.mock('../components/install/RuntimeInstallModal', () => ({
- default: ({ open, runtime, description }) => (open ? <div data-testid="install-modal">
- installing {runtime}<span data-testid="install-description">{description}</span>
- </div> : null),
-}));
-
// GlbViewer wraps a WebGL canvas jsdom can't render — stub to a marker that
// echoes the src so the ?glb= deep-link wiring is assertable without three.js.
vi.mock('../components/media/GlbViewer', () => ({
@@ -75,120 +67,38 @@ function renderAt(entry = '/3d', extra = null) {
);
}
-describe('Media3D — models & install', () => {
+// Install/repair moved to Models → 3D (#4728) and is covered by
+// `components/models/Image3dRuntimes.test.jsx`. What stays here is the contract
+// the generate flow still owns: it must name the runtime state and point at the
+// page that fixes it, rather than silently offering a dead Generate button.
+describe('Media3D — runtime state', () => {
beforeEach(() => {
vi.clearAllMocks();
listImageTo3dModels.mockResolvedValue([]);
getHfTokenStatus.mockResolvedValue({ hfTokenPresent: false, source: 'none' });
});
- it('shows an Install button for an available, not-installed target and opens the modal', async () => {
- getImageTo3dTargets.mockResolvedValue({ capabilities: {}, targets: [target()] });
- renderAt();
- const btn = await screen.findByRole('button', { name: /install/i });
- fireEvent.click(btn);
- expect(await screen.findByTestId('install-modal')).toHaveTextContent('trellis2');
- });
-
- it('uses the selected target gated-repo count in the install description', async () => {
- getImageTo3dTargets.mockResolvedValue({ capabilities: {}, targets: [target()] });
- renderAt();
- fireEvent.click(await screen.findByRole('button', { name: /install/i }));
- expect(await screen.findByTestId('install-description')).toHaveTextContent('2 gated Hugging Face models');
- });
-
- it('shows Ready and no Install button when the target is installed', async () => {
- getImageTo3dTargets.mockResolvedValue({ targets: [target({ installed: true })] });
- renderAt();
- expect(await screen.findByText(/ready/i)).toBeInTheDocument();
- expect(screen.queryByRole('button', { name: /install/i })).toBeNull();
- });
-
- // #2952: `setup.sh` exits 0 even when its Metal texture-baking backends failed to
- // build, and such an install renders correct geometry with a scrambled surface —
- // so a flat "Ready" would be a lie, and re-running Install is the repair.
- it('flags a degraded texture bake and offers Repair install', async () => {
- getImageTo3dTargets.mockResolvedValue({
- targets: [target({
- installed: true,
- degraded: { label: 'degraded textures', help: 'Install the Metal Toolchain.', repairable: true },
- })],
- });
- renderAt();
- expect(await screen.findByText(/degraded textures/i)).toBeInTheDocument();
- expect(screen.getByText('Install the Metal Toolchain.')).toBeInTheDocument();
- expect(screen.getByRole('button', { name: /repair install/i })).toBeInTheDocument();
- });
-
- // #3041: on a Command-Line-Tools-only host, Repair install would fail the same
- // way — so flag the problem but don't offer a button that can't fix it.
- it('flags a degraded bake but offers no Repair button when the server says it is not repairable', async () => {
+ it('summarizes how many runtimes are ready and links to the manager', async () => {
getImageTo3dTargets.mockResolvedValue({
- targets: [target({
- installed: true,
- degraded: {
- label: 'degraded textures', help: 'Install Xcode from the App Store.', repairable: false,
- },
- })],
+ targets: [target({ installed: true }), target({ id: 'pixal3dCuda', label: 'Pixal3D (CUDA)' })],
});
renderAt();
- expect(await screen.findByText(/degraded textures/i)).toBeInTheDocument();
- expect(screen.getByText('Install Xcode from the App Store.')).toBeInTheDocument();
- expect(screen.queryByRole('button', { name: /install/i })).toBeNull();
- });
-
- // The degraded projection is normalized server-side, so a target degraded for an
- // entirely different reason (Pixal3D with no NATTEN) renders through the same path
- // with no per-target UI branch.
- it('renders a non-TRELLIS degradation through the same badge and Repair button', async () => {
- getImageTo3dTargets.mockResolvedValue({
- targets: [target({
- id: 'pixal3dCuda',
- label: 'Pixal3D (CUDA)',
- installed: true,
- degraded: { label: 'NAF fallback', help: 'NATTEN is missing.', repairable: true },
- })],
- });
- renderAt();
- expect(await screen.findByText(/NAF fallback/i)).toBeInTheDocument();
- expect(screen.getByText('NATTEN is missing.')).toBeInTheDocument();
- expect(screen.getByRole('button', { name: /repair install/i })).toBeInTheDocument();
- // Must NOT leak the other lane's copy.
- expect(screen.queryByText(/metal toolchain/i)).toBeNull();
+ expect(await screen.findByText(/1 of 2 ready on this host/i)).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: /manage runtimes/i }).getAttribute('href')).toBe('/models/3d');
});
- it('stays plain Ready when the server reports no degradation', async () => {
- // The server owns the unknown-vs-degraded distinction (a probe that merely failed
- // must not cry wolf) and expresses it by OMITTING `degraded`. Asserting on the
- // absence of that field is what actually exercises the component; a `textureBake`
- // fixture would not, since nothing here reads it.
- getImageTo3dTargets.mockResolvedValue({
- targets: [target({ installed: true })],
- });
+ it('surfaces a target-load failure in the runtime summary', async () => {
+ getImageTo3dTargets.mockRejectedValueOnce(new Error('boom'));
renderAt();
- expect(await screen.findByText(/ready/i)).toBeInTheDocument();
- expect(screen.queryByText(/degraded/i)).toBeNull();
- expect(screen.queryByRole('button', { name: /install/i })).toBeNull();
+ expect(await screen.findByText('boom')).toBeInTheDocument();
});
- it('shows the unsupported reason and no Install button when the host cannot run it', async () => {
- getImageTo3dTargets.mockResolvedValue({
- targets: [target({ available: false, unavailableReason: 'requires-apple-silicon' })],
- });
+ it('does not host the install controls any more', async () => {
+ getImageTo3dTargets.mockResolvedValue({ targets: [target()] });
renderAt();
- expect(await screen.findAllByText(/requires an apple silicon mac/i)).not.toHaveLength(0);
+ await screen.findByRole('link', { name: /manage runtimes/i });
expect(screen.queryByRole('button', { name: /install/i })).toBeNull();
});
-
- it('surfaces a load error with Retry, and recovers on retry', async () => {
- getImageTo3dTargets.mockRejectedValueOnce(new Error('boom'));
- renderAt();
- expect(await screen.findByText('boom')).toBeInTheDocument();
-
- getImageTo3dTargets.mockResolvedValueOnce({ targets: [target({ installed: true })] });
- fireEvent.click(screen.getByRole('button', { name: /retry/i }));
- expect(await screen.findByText(/ready/i)).toBeInTheDocument();
- });
});
describe('Media3D — generation workspace', () => {
@@ -323,7 +233,7 @@ describe('Media3D — generation workspace', () => {
renderAt('/3d?image=example-robot.png');
const btn = await screen.findByRole('button', { name: /Generate 3D/i });
expect(btn).toBeDisabled();
- expect(screen.getByText(/Install TRELLIS\.2 below before generating/i)).toBeInTheDocument();
+ expect(screen.getByText(/Install TRELLIS\.2 from Models → 3D before generating/i)).toBeInTheDocument();
});
it('writes a picked image into the shareable URL', async () => {
diff --git a/client/src/pages/MediaGen.jsx b/client/src/pages/MediaGen.jsx
index ea84af0edb..67ba994e22 100644
--- a/client/src/pages/MediaGen.jsx
+++ b/client/src/pages/MediaGen.jsx
@@ -1,17 +1,16 @@
import { useNavigate, useLocation, Outlet } from 'react-router';
-import { Layers, Image as ImageIcon, Film, History, HardDrive, Scissors, FolderOpen, Sparkles, GraduationCap, Box } from 'lucide-react';
+import { Layers, Image as ImageIcon, Film, History, Scissors, FolderOpen, Box } from 'lucide-react';
import TabPills from '../components/ui/TabPills';
+// LoRAs, Training and Models moved to the Models section (#4728) — they manage
+// installed weights, while everything left here generates or browses output.
const TABS = [
{ id: 'image', label: 'Image', icon: ImageIcon },
{ id: 'video', label: 'Video', icon: Film },
{ id: 'threejs', label: 'Three.js', icon: Box },
{ id: 'timeline', label: 'Timeline', icon: Scissors },
{ id: 'history', label: 'History', icon: History },
- { id: 'collections', label: 'Collections', icon: FolderOpen },
- { id: 'loras', label: 'LoRAs', icon: Sparkles },
- { id: 'training', label: 'Training', icon: GraduationCap },
- { id: 'models', label: 'Models', icon: HardDrive }
+ { id: 'collections', label: 'Collections', icon: FolderOpen }
];
export default function MediaGen() {
diff --git a/client/src/pages/Models.jsx b/client/src/pages/Models.jsx
index 80d287237b..f344213e67 100644
--- a/client/src/pages/Models.jsx
+++ b/client/src/pages/Models.jsx
@@ -2,31 +2,48 @@ import { useParams, Navigate } from 'react-router';
import { Cpu } from 'lucide-react';
import PageHeader from '../components/PageHeader';
import ModelsTabsHeader from '../components/models/ModelsTabsHeader';
-import MemoryManagement from '../components/settings/MemoryManagement.jsx';
+import Image3dRuntimes from '../components/models/Image3dRuntimes';
+import ModelStatusTab from '../components/models/ModelStatusTab';
+import EmbeddingsTab from '../components/settings/EmbeddingsTab';
import LocalModelAssessments from '../components/settings/LocalModelAssessments.jsx';
import { LocalLlmTab } from '../components/settings/LocalLlmTab';
+import Loras from './Loras';
+import LoraTraining from './LoraTraining';
+import MediaModels from './MediaModels';
/**
* Models — the top-level home for everything about the models this machine runs.
*
- * Three tabs, each of which was previously a card buried in
- * `/settings/local-llm`:
+ * The section started as three tabs carved out of `/settings/local-llm`, and now
+ * covers every KIND of model an install manages (#4728), not just text:
*
+ * - **3D** — image-to-3D runtime install/repair (TRELLIS.2, Pixal3D).
+ * - **Embeddings** — the embedding model backing pgvector search.
* - **LLMs** — backends, the install catalog, the llama.cpp launcher.
+ * - **LoRAs** — installed image/video adapters.
+ * - **Media** — image/video checkpoints and the Hugging Face cache.
* - **Performance** — measured assessments and launch-tuning comparison.
- * - **Status** — what is resident in memory right now.
+ * - **Status** — residency plus the downloaded-model inventory.
+ * - **Training** — LoRA fine-tuning datasets and runs.
+ *
+ * What deliberately stayed OUT is output rather than weights: Three.js Models is
+ * a gallery of generated meshes, and `/3d` is the render flow that consumes the
+ * runtimes listed here. Audio models stayed in the Music studio too — their
+ * picker is not separable from the generate form. Design record:
+ * `docs/plans/2026-08-21-models-navigation.md`.
*
* `?tab` is a route param, not local state, so every one is deep-linkable and
* reachable from ⌘K and voice (`client/src/CLAUDE.md`).
- *
- * Only LLM model management lives here so far. Media models (LoRAs, image/video
- * checkpoints, embeddings) are tracked for the same treatment in #4728; the
- * design record is `docs/plans/2026-08-21-models-navigation.md`.
*/
const TAB_CONTENT = {
+ '3d': Image3dRuntimes,
+ embeddings: EmbeddingsTab,
llms: LocalLlmTab,
+ loras: Loras,
+ media: MediaModels,
performance: LocalModelAssessments,
- status: MemoryManagement,
+ status: ModelStatusTab,
+ training: LoraTraining,
};
export default function Models() {
diff --git a/client/src/pages/Models.test.jsx b/client/src/pages/Models.test.jsx
index e38b4d490a..93315f90c1 100644
--- a/client/src/pages/Models.test.jsx
+++ b/client/src/pages/Models.test.jsx
@@ -1,7 +1,7 @@
/**
* Models page — tab routing only.
*
- * Each tab's panel owns its own fetches (and has its own suite), so all three
+ * Each tab's panel owns its own fetches (and has its own suite), so all of them
* are stubbed here. What this file is about is the contract that makes them
* reachable: `?tab` is a route param, so every panel is deep-linkable, and an
* unknown slug lands somewhere real instead of rendering blank.
@@ -10,10 +10,17 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { MemoryRouter, Route, Routes } from 'react-router';
+import { TABS } from '../components/models/ModelsTabsHeader';
vi.mock('../components/settings/MemoryManagement.jsx', () => ({ default: () => <div>memory panel</div> }));
vi.mock('../components/settings/LocalModelAssessments.jsx', () => ({ default: () => <div>assessments panel</div> }));
vi.mock('../components/settings/LocalLlmTab', () => ({ LocalLlmTab: () => <div>llms panel</div> }));
+vi.mock('../components/settings/EmbeddingsTab', () => ({ default: () => <div>embeddings panel</div> }));
+vi.mock('../components/models/Image3dRuntimes', () => ({ default: () => <div>3d runtimes panel</div> }));
+vi.mock('../components/models/ModelStatusTab', () => ({ default: () => <div>status panel</div> }));
+vi.mock('./Loras', () => ({ default: () => <div>loras panel</div> }));
+vi.mock('./LoraTraining', () => ({ default: () => <div>training panel</div> }));
+vi.mock('./MediaModels', () => ({ default: () => <div>media models panel</div> }));
import Models from './Models';
@@ -27,9 +34,14 @@ const renderAt = (path) => render(
describe('Models', () => {
it.each([
- ['/models/performance', 'assessments panel'],
- ['/models/status', 'memory panel'],
+ ['/models/3d', '3d runtimes panel'],
+ ['/models/embeddings', 'embeddings panel'],
['/models/llms', 'llms panel'],
+ ['/models/loras', 'loras panel'],
+ ['/models/media', 'media models panel'],
+ ['/models/performance', 'assessments panel'],
+ ['/models/status', 'status panel'],
+ ['/models/training', 'training panel'],
])('renders %s from the route param, not from local state', (path, expected) => {
renderAt(path);
expect(screen.getByText(expected)).toBeInTheDocument();
@@ -45,8 +57,33 @@ describe('Models', () => {
it('offers every Models destination in the sub-nav', () => {
renderAt('/models/performance');
- for (const label of ['LLMs', 'Performance', 'Playground', 'Status']) {
+ for (const { label } of TABS) {
expect(screen.getByRole('tab', { name: label })).toBeInTheDocument();
}
});
+
+ // The tab bar collapses to a `<select>` under `sm`, so every destination has to
+ // be reachable there too — nine tabs no longer fit a phone-width pill row.
+ it('mirrors every destination into the mobile select', () => {
+ renderAt('/models/performance');
+ const select = screen.getByRole('combobox', { name: 'Models sections' });
+ expect([...select.options].map((o) => o.textContent)).toEqual(TABS.map((t) => t.label));
+ });
+
+ // The header is the section's own map, so it must stay in sync with what the
+ // page can actually render. A tab listed but missing from TAB_CONTENT falls
+ // through to the unknown-slug redirect and silently lands on Performance —
+ // which the per-path cases above cannot see, because they enumerate the paths
+ // by hand. Selection state is what distinguishes "rendered this tab" from
+ // "bounced to Performance". Playground is the one deliberate exception: it
+ // predates the section and keeps its own `/local-llm/playground` path.
+ it('serves every /models tab the header advertises, without bouncing to Performance', () => {
+ const own = TABS.filter((t) => t.to.startsWith('/models/'));
+ expect(own.length).toBe(TABS.length - 1);
+ for (const tab of own) {
+ const { unmount } = renderAt(tab.to);
+ expect(screen.getByRole('tab', { name: tab.label })).toHaveAttribute('aria-selected', 'true');
+ unmount();
+ }
+ });
});
diff --git a/client/src/pages/Settings.jsx b/client/src/pages/Settings.jsx
index d7d1700b41..08f5a0c253 100644
--- a/client/src/pages/Settings.jsx
+++ b/client/src/pages/Settings.jsx
@@ -8,7 +8,6 @@ import { BackupTab } from '../components/settings/BackupTab';
import { CatalogTypesTab } from '../components/settings/CatalogTypesTab';
import CodeReviewersTab from '../components/settings/CodeReviewersTab';
import { DatabaseTab } from '../components/settings/DatabaseTab';
-import EmbeddingsTab from '../components/settings/EmbeddingsTab';
import { TelegramTab } from '../components/settings/TelegramTab';
import { GeneralTab } from '../components/settings/GeneralTab';
import { MortalLoomTab } from '../components/settings/MortalLoomTab';
@@ -46,7 +45,6 @@ export default function Settings() {
case 'catalog': return <CatalogTypesTab />;
case 'code-reviewers': return <CodeReviewersTab />;
case 'database': return <DatabaseTab />;
- case 'embeddings': return <EmbeddingsTab />;
case 'security': return <SecurityTab />;
case 'sharing': return <SharingTab />;
case 'signal': return <SignalTab />;
diff --git a/client/src/pages/SystemHealthPage.jsx b/client/src/pages/SystemHealthPage.jsx
index ea49d5ce27..2cae5226bb 100644
--- a/client/src/pages/SystemHealthPage.jsx
+++ b/client/src/pages/SystemHealthPage.jsx
@@ -1,14 +1,13 @@
-import { useCallback, useEffect, useState, useRef } from 'react';
+import { useEffect, useState, useRef } from 'react';
import { Link, Navigate, NavLink, useParams } from 'react-router';
-import { Activity, AlertTriangle, Boxes, CheckCircle, XCircle, HardDrive, Cpu, Database, ListOrdered, RefreshCw, ServerCog, Zap } from 'lucide-react';
+import { Activity, AlertTriangle, CheckCircle, XCircle, HardDrive, Cpu, Database, ListOrdered, RefreshCw, ServerCog, Zap } from 'lucide-react';
import * as api from '../services/api';
import toast from '../components/ui/Toast';
import PageSkeleton from '../components/ui/PageSkeleton';
import Banner from '../components/ui/Banner';
import { useAutoRefetch } from '../hooks/useAutoRefetch';
-import { useConfirmDelete } from '../hooks/useConfirmDelete.js';
+import { useSystemResourceReport } from '../hooks/useSystemResourceReport.js';
import StoragePanel from '../components/system-resources/StoragePanel.jsx';
-import ModelsPanel from '../components/system-resources/ModelsPanel.jsx';
import QueuesPanel from '../components/system-resources/QueuesPanel.jsx';
import MediaCapacityPanel from '../components/system-resources/MediaCapacityPanel.jsx';
@@ -51,89 +50,20 @@ function barTone(pct, warn, critical) {
return 'bg-port-success';
}
+// The downloaded-model inventory used to be a fourth tab here. It answered the
+// same question Models → Status answers, in a different section, so it folded
+// into that page (#4728); /system-resources/models redirects there.
const RESOURCE_TABS = [
{ id: 'overview', label: 'Overview', icon: Activity },
{ id: 'storage', label: 'Storage', icon: HardDrive },
- { id: 'models', label: 'Models', icon: Boxes },
{ id: 'queues', label: 'Queues', icon: ListOrdered },
];
export default function SystemResourcesPage() {
const { tab = 'overview' } = useParams();
- const [report, setReport] = useState(null);
- const [reportLoading, setReportLoading] = useState(false);
- const [cleanupBusyId, setCleanupBusyId] = useState(null);
- const reportRequestGenerationRef = useRef(0);
- const cleanupBusyRef = useRef(null);
- const { isConfirming, requestDelete, cancelDelete, confirmDelete } = useConfirmDelete();
-
- const runReport = useCallback(async () => {
- const generation = ++reportRequestGenerationRef.current;
- cancelDelete();
- setReportLoading(true);
- const outcome = await api.runSystemResourceReport({ silent: true }).then(
- (value) => ({ value }),
- (error) => ({ error }),
- );
- // Explicit refreshes and post-cleanup reconciliation can overlap. Only the
- // newest request may own the report or loading state; an older disk scan
- // must not resurrect candidates the newer scan already removed.
- if (generation !== reportRequestGenerationRef.current) return outcome.value || null;
- setReportLoading(false);
- if (outcome.error) {
- toast.error(outcome.error?.message || 'System report failed');
- return null;
- }
- if (outcome.value) setReport(outcome.value);
- return outcome.value || null;
- }, [cancelDelete]);
-
- const removeCandidate = useCallback(async (candidate) => {
- const action = candidate.action;
- if (!action || cleanupBusyRef.current) return;
- cleanupBusyRef.current = candidate.id;
- setCleanupBusyId(candidate.id);
- const result = await (async () => {
- if (action.type === 'data-category') {
- return api.purgeDataCategory(action.key, {}, { silent: true });
- }
- if (action.type === 'hf-model') {
- return api.deleteCachedModel(action.dirName, { silent: true });
- }
- if (action.type === 'lora') {
- return api.deleteLora(action.filename, { silent: true });
- }
- if (action.type === 'local-model') {
- return api.deleteLocalLlmModel(action.backend, action.modelId, { silent: true });
- }
- return null;
- })().catch((error) => {
- toast.error(error?.message || `Could not remove ${candidate.label}`);
- return null;
- });
- if (!result) {
- cleanupBusyRef.current = null;
- setCleanupBusyId(null);
- return;
- }
- // Invalidate every server-issued action immediately. The old row must not
- // become clickable again during the follow-up scan, and unmounting Storage
- // also drops any AI recommendations tied to the obsolete report.
- setReport(null);
- toast.success(`${candidate.label} removed`);
- await runReport();
- cleanupBusyRef.current = null;
- setCleanupBusyId(null);
- }, [runReport]);
-
- const cleanup = {
- busyId: cleanupBusyId,
- locked: cleanupBusyId != null || reportLoading,
- isConfirming,
- request: requestDelete,
- cancel: cancelDelete,
- confirm: (candidate) => confirmDelete(() => removeCandidate(candidate)),
- };
+ // The scan + cleanup lifecycle is shared with Models → Status, which renders
+ // the same server report from a different section.
+ const { report, setReport, loading: reportLoading, runReport, cleanup } = useSystemResourceReport();
const validTab = RESOURCE_TABS.some((item) => item.id === tab);
if (!validTab) return <Navigate to="/system-resources/overview" replace />;
@@ -146,11 +76,11 @@ export default function SystemResourcesPage() {
<div>
<h1 className="text-xl font-bold text-white">System Resources</h1>
<p className="mt-1 max-w-3xl text-sm text-gray-400">
- Health, disk intelligence, loaded models, and active work queues in one control center.
+ Health, disk intelligence, and active work queues in one control center.
</p>
</div>
</div>
- <nav aria-label="System resources sections" className="mt-5 grid grid-cols-4 border-b border-port-border sm:flex sm:gap-1">
+ <nav aria-label="System resources sections" className="mt-5 grid grid-cols-3 border-b border-port-border sm:flex sm:gap-1">
{RESOURCE_TABS.map(({ id, label, icon: Icon }) => (
<NavLink
key={id}
@@ -175,14 +105,6 @@ export default function SystemResourcesPage() {
cleanup={cleanup}
/>
)}
- {tab === 'models' && (
- <ModelsPanel
- report={report}
- loading={reportLoading}
- onRunReport={runReport}
- cleanup={cleanup}
- />
- )}
{tab === 'queues' && <QueuesPanel />}
</div>
);
diff --git a/client/src/services/apiImageVideo.js b/client/src/services/apiImageVideo.js
index 51d17d5d0d..6bc2da439b 100644
--- a/client/src/services/apiImageVideo.js
+++ b/client/src/services/apiImageVideo.js
@@ -436,7 +436,7 @@ export const removeCustomMediaModel = (id, { silent = false } = {}) => request(`
// LoRA manager — Civitai-aware list/install/patch/delete. Reads sidecar
// metadata so the manager UI can show trigger words, base model, recommended
-// scale, preview thumbnail. Used by /media/loras and the Image Gen LoRA picker.
+// scale, preview thumbnail. Used by /models/loras and the Image Gen LoRA picker.
export const listLorasFull = (options = {}) => request('/loras', options);
// `silent: true` suppresses the auto-toast in apiCore so the page can route
// CIVITAI_AUTH errors into the in-UI key prompt instead of a fire-and-forget
@@ -539,7 +539,7 @@ export const getCivitaiSuggestions = ({ force = false } = {}, options = {}) =>
request(`/loras/suggestions${force ? '?force=1' : ''}`, options);
// Live keyword search + cursor pagination within one runner family. Backs the
-// per-category search box and "Load more" button on /media/loras. `query`
+// per-category search box and "Load more" button on /models/loras. `query`
// blank pages the plain top-ranking; pass the previous response's `nextCursor`
// to load the next page. Returns `{ runnerFamily, query, items, nextCursor }`.
// `silent` defaults true because the caller (SuggestionsSection.fetchPage) owns
diff --git a/docs/plans/2026-08-21-models-navigation.md b/docs/plans/2026-08-21-models-navigation.md
index 30a2c3bed8..e35982e038 100644
--- a/docs/plans/2026-08-21-models-navigation.md
+++ b/docs/plans/2026-08-21-models-navigation.md
@@ -120,8 +120,17 @@ voice (`NAV_COMMANDS` gained `nav.models.performance` and `nav.models.status`;
## Follow-up
-Only LLM model management lives under Models so far. Media models — LoRAs,
-image/video checkpoints (`/media/models`), Three.js meshes, embeddings — are
-scattered across Create and Settings and belong in the same section. Tracked in
-[#4728](https://github.com/atomantic/PortOS/issues/4728) so this change stays
-reviewable.
+The rest of the model management followed in
+[#4728](https://github.com/atomantic/PortOS/issues/4728): media checkpoints
+(`/models/media`), LoRAs (`/models/loras`), LoRA training
+(`/models/training`), embeddings (`/models/embeddings`) and the image-to-3D
+runtimes (`/models/3d`) all moved in from Create and Settings, and Dev Tools'
+`/system-resources/models` folded into `/models/status`. Every old path
+redirects, and every moved command keeps its opaque id.
+
+Two things deliberately stayed out, because they are output or generation rather
+than installed weights: Three.js Models is a gallery of generated meshes, and
+`/3d` is the render flow that consumes the runtimes now listed under Models.
+Audio models stayed with the Music studio as well — the model picker there drives
+install-on-demand for the model being generated with, so it is not separable from
+the generate form.
diff --git a/server/lib/huggingfaceModel.js b/server/lib/huggingfaceModel.js
index 7d2cfadd56..07f83e337f 100644
--- a/server/lib/huggingfaceModel.js
+++ b/server/lib/huggingfaceModel.js
@@ -190,7 +190,7 @@ const looksLikeLora = ({ repo, model }) => {
const assertNotLora = ({ repo, model }) => {
if (looksLikeLora({ repo, model })) {
throw new ServerError(
- `HuggingFace repo "${repo}" looks like a LoRA adapter, not a base model — install LoRAs from the LoRA manager (/media/loras), not here.`,
+ `HuggingFace repo "${repo}" looks like a LoRA adapter, not a base model — install LoRAs from the LoRA manager (/models/loras), not here.`,
{ status: 422, code: 'HF_IS_LORA' },
);
}
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index 9855d2a07d..c32c0cd564 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -72,9 +72,8 @@ export const NAV_COMMANDS = [
// history, so renaming it would orphan those entries.
{ id: 'nav.media.sprites', path: '/sprites', label: 'Sprites', section: 'Create', aliases: ['sprites', 'sprite', 'sprite-manager', 'sprite-sheets'], keywords: ['sprite sheet', 'atlas', 'game art', 'pixel art', 'character animation', 'walk cycle', 'anchors'] },
{ id: 'nav.media.timeline', path: '/media/timeline', label: 'Timeline', section: 'Create', aliases: ['timeline', 'video-timeline', 'editor'], keywords: ['edit', 'trim', 'composite', 'stitch', 'cut', 'compose'] },
- { id: 'nav.media.models', path: '/media/models', label: 'Media Models', section: 'Create', aliases: ['media-models', 'image-models', 'video-models', 'huggingface'], keywords: ['hf cache', 'model storage', 'disk', 'add model', 'install model', 'custom model'] },
{ id: 'nav.media.threejs', path: '/media/threejs', label: 'Three.js Models', section: 'Create', aliases: ['threejs', 'three-js', '3d-models', 'image-to-3d', 'img2threejs'], keywords: ['procedural', '3d', 'mesh', 'model', 'gallery', 'webgl', 'preview'] },
- { id: 'nav.create.3d', path: '/3d', label: '3D', section: 'Create', aliases: ['3d', 'image-to-mesh', 'mesh', 'trellis', 'pixal3d', 'neural-3d'], keywords: ['trellis', 'pixal3d', 'pixal', 'glb', 'mesh', 'photogrammetry', 'neural', 'image to 3d', 'install', 'model', 'pbr'] },
+ { id: 'nav.create.3d', path: '/3d', label: '3D', section: 'Create', aliases: ['3d', 'image-to-mesh', 'mesh', 'trellis', 'pixal3d', 'neural-3d'], keywords: ['trellis', 'pixal3d', 'pixal', 'glb', 'mesh', 'photogrammetry', 'neural', 'image to 3d', 'render', 'generate', 'pbr'] },
{ id: 'nav.create.authors', path: '/authors', label: 'Authors', section: 'Create', aliases: ['authors', 'author', 'byline', 'author-persona', 'writer-persona'], keywords: ['author', 'byline', 'pen name', 'persona', 'writing style', 'bio', 'headshot', 'cover', 'book author'] },
{ id: 'nav.create.universe-builder', path: '/universes', label: 'Universes', section: 'Create', aliases: ['universes', 'universe', 'universe-builder', 'worldbuilder', 'worldbuild', 'world', 'lore', 'universe-canon', 'canon'], keywords: ['style template', 'sci-fi', 'fantasy', 'concept art', 'batch render', 'variations', 'characters', 'settings', 'objects', 'canon entries', 'list', 'manage'] },
{ id: 'nav.create.importer', path: '/importer', label: 'Importer', section: 'Create', aliases: ['importer', 'import'], keywords: ['paste', 'screenplay', 'novel', 'short story', 'comic script', 'analyze', 'reverse-engineer', 'extract'] },
@@ -95,8 +94,6 @@ export const NAV_COMMANDS = [
{ id: 'nav.create.music-albums', path: '/music/albums', label: 'Music Albums', section: 'Create', aliases: ['albums', 'album', 'music-albums', 'discography', 'lp', 'ep'], keywords: ['album', 'cover art', 'tracklist', 'release', 'discography', 'record'] },
{ id: 'nav.create.music-tracks', path: '/music/tracks', label: 'Music Tracks', section: 'Create', aliases: ['tracks', 'track', 'music-tracks', 'singles', 'songs-audio'], keywords: ['track', 'single', 'audio', 'recording', 'lyrics', 'mp3', 'wav', 'generate track'] },
{ id: 'nav.create.sharing-conflicts', path: '/sharing/conflicts', label: 'Conflicts', section: 'Create', aliases: ['conflicts', 'sync-conflicts', 'edit-conflicts', 'conflict-journal'], keywords: ['conflict', 'overwrite', 'lost edit', 'restore', 'merge fields', 'last write wins', 'diverged', 'recover'] },
- { id: 'nav.media.loras', path: '/media/loras', label: 'LoRAs', section: 'Create', aliases: ['loras', 'lora', 'lora-manager', 'civitai'], keywords: ['lora', 'civitai', 'fine-tune', 'style adapter', 'realstagram', 'photoreal', 'flux lora'] },
- { id: 'nav.media.training', path: '/media/training', label: 'LoRA Training', section: 'Create', aliases: ['training', 'lora-training', 'train-lora', 'datasets', 'character-lora'], keywords: ['fine-tune', 'dataset', 'caption', 'dreambooth', 'character consistency', 'train', 'flux lora'] },
{ id: 'nav.media.settings', path: '/media/image?settings=1', label: 'Media Gen Settings', section: 'Create', aliases: ['media-settings', 'image-gen-settings', 'sd-settings', 'video-gen-settings'] },
{ id: 'nav.writers-room', path: '/writers-room', label: 'Writers Room', section: 'Create', aliases: ['writers-room', 'writersroom', 'writer', 'write', 'studio', 'novel'], keywords: ['prose', 'screenplay', 'story', 'draft', 'manuscript', 'literary', 'novel', 'short story'] },
{ id: 'nav.writers-room.guide', path: '/writers-room/guide', label: 'Writers Room Guide', section: 'Create', aliases: ['writers-room-guide', 'writing-guide', 'writing-rules', 'word-count', 'length-targets'], keywords: ['microfiction', 'flash fiction', 'short story', 'novelette', 'novella', 'novel length', 'word count', 'character count', 'book length', 'craft', 'writing advice', 'emotional roadmap', 'documentation', 'help'] },
@@ -262,14 +259,24 @@ export const NAV_COMMANDS = [
{ id: 'nav.settings.catalog', path: '/settings/catalog', label: 'Catalog Types', section: 'Settings', aliases: ['settings-catalog', 'catalog-types'], keywords: ['catalog', 'types', 'character', 'place', 'object', 'taxonomy'] },
{ id: 'nav.settings.code-reviewers', path: '/settings/code-reviewers', label: 'Code Reviewers', section: 'Settings', aliases: ['code-reviewers', 'settings-code-reviewers', 'code-review', 'review-defaults', 'reviewers'], keywords: ['review loop', 'reviewer chain', 'codex', 'copilot', 'ollama', 'stop mode', 'max rounds', 'defaults'] },
{ id: 'nav.settings.database', path: '/settings/database', label: 'Database', section: 'Settings', aliases: ['settings-database', 'database'] },
- { id: 'nav.settings.embeddings', path: '/settings/embeddings', label: 'Embeddings', section: 'Settings', aliases: ['settings-embeddings', 'embeddings', 'embedding'], keywords: ['vector', 'pgvector', 'semantic search', 'nomic', 'ollama', 'lm studio'] },
{ id: 'nav.settings.general', path: '/settings/general', label: 'General', section: 'Settings', aliases: ['settings', 'settings-general', 'general'] },
- // Local-model management is its own top-level section (#4736). The ids keep
- // their `nav.settings.*` prefix — they are opaque and stored in palette
- // history, so renaming them would orphan those entries.
+ // Local-model management is its own top-level section (#4736), which grew to
+ // cover every KIND of model this install manages (#4728) — image/video
+ // checkpoints, LoRAs and their training datasets, embeddings, and the
+ // image-to-3D runtimes. Several ids keep a `nav.settings.*` / `nav.media.*`
+ // prefix: they are opaque and stored in palette history, so renaming them
+ // would orphan those entries — only the path, label and section move.
+ { id: 'nav.models.3d', path: '/models/3d', label: '3D Runtimes', section: 'Models', aliases: ['3d-runtimes', 'image-to-3d-runtimes', 'trellis-install', 'pixal3d-install'], keywords: ['trellis', 'pixal3d', 'install', 'repair', 'runtime', 'mesh', 'image to 3d', 'on-device'] },
+ { id: 'nav.settings.embeddings', path: '/models/embeddings', label: 'Embeddings', section: 'Models', aliases: ['settings-embeddings', 'embeddings', 'embedding'], keywords: ['vector', 'pgvector', 'semantic search', 'nomic', 'ollama', 'lm studio'] },
{ id: 'nav.settings.local-llm', path: '/models/llms', label: 'LLMs', section: 'Models', aliases: ['local-llm', 'local-llms', 'llms', 'models-llms', 'ollama', 'lm-studio', 'lmstudio'], keywords: ['ollama', 'lm studio', 'local model', 'local llm', 'gguf', 'pull model', 'install model', 'migrate', 'switch backend', 'llama.cpp'] },
+ { id: 'nav.media.loras', path: '/models/loras', label: 'LoRAs', section: 'Models', aliases: ['loras', 'lora', 'lora-manager', 'civitai'], keywords: ['lora', 'civitai', 'fine-tune', 'style adapter', 'realstagram', 'photoreal', 'flux lora'] },
+ { id: 'nav.media.training', path: '/models/training', label: 'LoRA Training', section: 'Models', aliases: ['training', 'lora-training', 'train-lora', 'datasets', 'character-lora'], keywords: ['fine-tune', 'dataset', 'caption', 'dreambooth', 'character consistency', 'train', 'flux lora'] },
+ { id: 'nav.media.models', path: '/models/media', label: 'Media Models', section: 'Models', aliases: ['media-models', 'image-models', 'video-models', 'huggingface'], keywords: ['hf cache', 'model storage', 'disk', 'add model', 'install model', 'custom model'] },
{ id: 'nav.models.performance', path: '/models/performance', label: 'Model Performance', section: 'Models', aliases: ['model-performance', 'performance', 'assessments', 'model-assessments', 'benchmark-models', 'tuning'], keywords: ['measure', 'assessment', 'benchmark', 'throughput', 'chars per second', 'ttft', 'context', 'tuning', 'llama.cpp', 'mtplx', 'vllm', 'which model', 'fastest model'] },
- { id: 'nav.models.status', path: '/models/status', label: 'Model Status', section: 'Models', aliases: ['model-status', 'models-status', 'memory-management', 'resident-models'], keywords: ['memory', 'resident', 'loaded', 'unload', 'ram', 'vram', 'free memory', 'what is loaded'] },
+ // Absorbed the Dev Tools 'Model Resources' page (#4728), so its aliases and
+ // keywords live here — 'model resources' and 'downloaded models' must keep
+ // resolving after the fold.
+ { id: 'nav.models.status', path: '/models/status', label: 'Model Status', section: 'Models', aliases: ['model-status', 'models-status', 'memory-management', 'resident-models', 'model-resources', 'loaded-models', 'downloaded-models', 'model-memory'], keywords: ['memory', 'resident', 'loaded', 'unload', 'ram', 'vram', 'free memory', 'what is loaded', 'ollama', 'lm studio', 'hugging face', 'lora', 'delete model', 'disk'] },
{ id: 'nav.settings.local-llm-playground', path: '/local-llm/playground', label: 'Local LLM Playground', section: 'Models', aliases: ['llm-playground', 'playground', 'model-playground', 'compare-models'], keywords: ['ollama', 'lm studio', 'compare', 'benchmark', 'chat', 'test model', 'ttft', 'tokens per second', 'local llm'] },
{ id: 'nav.settings.mortalloom', path: '/settings/mortalloom', label: 'MortalLoom', section: 'Settings', aliases: ['settings-mortalloom', 'mortalloom'] },
{ id: 'nav.settings.openclaw', path: '/openclaw', label: 'OpenClaw', section: 'Settings', aliases: ['openclaw', 'settings-openclaw'], keywords: ['operator', 'chat', 'agent', 'runtime', 'sessions', 'streaming'] },
@@ -290,7 +297,6 @@ export const NAV_COMMANDS = [
{ id: 'nav.security', path: '/security', label: 'Security', section: 'Dev Tools', aliases: ['security'] },
{ id: 'nav.system-health', path: '/system-resources/overview', label: 'System Resources', section: 'Dev Tools', aliases: ['system-resources', 'system-health', 'system-status', 'memory-usage', 'cpu-usage'], keywords: ['health', 'memory', 'cpu', 'disk', 'thresholds', 'top processes', 'resource usage'] },
{ id: 'nav.system-resources.storage', path: '/system-resources/storage', label: 'Storage Report', section: 'Dev Tools', aliases: ['disk-usage', 'storage-report', 'disk-cleanup'], keywords: ['disk', 'storage', 'space', 'cleanup', 'cache', 'data usage', 'ai triage'] },
- { id: 'nav.system-resources.models', path: '/system-resources/models', label: 'Model Resources', section: 'Dev Tools', aliases: ['model-resources', 'loaded-models', 'downloaded-models', 'model-memory'], keywords: ['ollama', 'lm studio', 'hugging face', 'lora', 'unload', 'delete model', 'vram'] },
{ id: 'nav.system-resources.queues', path: '/system-resources/queues', label: 'Active Queues', section: 'Dev Tools', aliases: ['active-queues', 'job-queues', 'pending-jobs', 'render-queue'], keywords: ['media jobs', 'agent tasks', 'pending', 'running', 'cancel', 'run now'] },
{ id: 'nav.cos.jobs', path: '/cos/jobs', label: 'System Tasks', section: 'Chief of Staff', aliases: ['cos-jobs', 'system-tasks'] },
{ id: 'nav.uploads', path: '/uploads', label: 'Uploads', section: 'Dev Tools', aliases: ['uploads'] },
diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.js
index 6b1182a5ff..18af8f7cdd 100644
--- a/server/lib/navManifest.test.js
+++ b/server/lib/navManifest.test.js
@@ -33,6 +33,7 @@ const TABBED_PAGES = [
{ prefix: '/messages', file: 'client/src/pages/Messages.jsx', kind: 'ids', constName: 'TABS' },
{ prefix: '/wiki', file: 'client/src/pages/Wiki.jsx', kind: 'ids', constName: 'TABS' },
{ prefix: '/settings', file: 'client/src/components/settings/SettingsTabsHeader.jsx', kind: 'links', constName: 'TABS' },
+ { prefix: '/models', file: 'client/src/components/models/ModelsTabsHeader.jsx', kind: 'links', constName: 'TABS' },
{ prefix: '/sharing', file: 'client/src/pages/Sharing.jsx', kind: 'links', constName: 'SECTIONS' },
// OpenWorld's fast-travel destinations aren't page tabs, but they follow the same
// contract: one `/openworld/region/<id>` nav command per region in the client's
@@ -147,10 +148,28 @@ describe('resolveNavCommand — fuzzy matching', () => {
it('resolves every canonical System Resources section name', () => {
expect(resolveNavCommand('system resources')?.path).toBe('/system-resources/overview');
- expect(resolveNavCommand('model resources')?.path).toBe('/system-resources/models');
expect(resolveNavCommand('active queues')?.path).toBe('/system-resources/queues');
});
+ it('resolves the folded Model Resources aliases to Models → Status', () => {
+ // The Dev Tools model-inventory page folded into /models/status (#4728),
+ // which already answered "what is resident right now". Its aliases moved with
+ // it rather than being dropped — a user who says "model resources" or
+ // "downloaded models" must still land on the inventory, not nowhere.
+ expect(resolveNavCommand('model resources')?.path).toBe('/models/status');
+ expect(resolveNavCommand('downloaded models')?.path).toBe('/models/status');
+ });
+
+ it('resolves the moved model-management pages to their Models paths', () => {
+ // Media models, LoRAs, LoRA training and embeddings moved out of Create and
+ // Settings (#4728). Their command ids are unchanged (they are opaque and
+ // persisted), so only these paths prove the move actually landed.
+ expect(resolveNavCommand('media models')?.path).toBe('/models/media');
+ expect(resolveNavCommand('loras')?.path).toBe('/models/loras');
+ expect(resolveNavCommand('lora training')?.path).toBe('/models/training');
+ expect(resolveNavCommand('embeddings')?.path).toBe('/models/embeddings');
+ });
+
it('resolves Universe Builder to the /universes index path', () => {
// Promoted out of /media/universe-builder; renamed to /universes when the
// list/table index landed (command id stays nav.create.universe-builder).
@@ -442,6 +461,7 @@ function joinRoutePath(segments) {
function scanRoutes(appSrc) {
const stack = []; // parent path segments of currently-open <Route> containers
const required = [];
+ const redirects = []; // { from, to } for every forwarding leaf route
const malformed = [];
for (const rawLine of appSrc.split('\n')) {
const line = rawLine.trim();
@@ -464,17 +484,26 @@ function scanRoutes(appSrc) {
stack.push(routePath ?? '');
continue;
}
- if (REDIRECT_ELEMENT.test(line)) continue;
-
// An index route resolves to its parent's path (e.g. the `/` index = Dashboard).
const absolute = routePath === null
? joinRoutePath(stack)
: joinRoutePath([...stack, routePath]);
+ // Redirects are recorded rather than dropped: a moved page's old path has to
+ // keep landing somewhere, and that is only assertable if the scanner reports
+ // where each forwarding route points. `to` is read off the same line, so a
+ // `from`-only wrapper (CanonRedirect, UniverseRouteRedirect) records nothing
+ // rather than a bogus target.
+ if (REDIRECT_ELEMENT.test(line)) {
+ const to = line.match(/\bto="([^"]*)"/);
+ if (to) redirects.push({ from: absolute, to: to[1] });
+ continue;
+ }
+
if (absolute.split('/').some((s) => s.startsWith(':'))) continue; // param route
required.push(absolute);
}
- return { required: [...new Set(required)], malformed, stackDepth: stack.length };
+ return { required: [...new Set(required)], redirects, malformed, stackDepth: stack.length };
}
describe('nav coverage — every navigable App.jsx route has a manifest entry', () => {
@@ -498,6 +527,45 @@ describe('nav coverage — every navigable App.jsx route has a manifest entry',
expect(uncovered).toEqual([]);
});
+ // Every page that has ever moved leaves its old path behind in bookmarks, in
+ // stale ⌘K history, and in links other installs' peers may hold. A move that
+ // forgets the redirect 404s all of them, and nothing else in this file would
+ // notice — the coverage guard above only looks at where routes point NOW.
+ it('keeps a redirect for every relocated model-management path', () => {
+ const moved = [
+ ['/media/models', '/models/media'],
+ ['/media/loras', '/models/loras'],
+ ['/media/training', '/models/training'],
+ ['/settings/embeddings', '/models/embeddings'],
+ ['/settings/local-llm', '/models/llms'],
+ ['/system-resources/models', '/models/status'],
+ ['/media-models', '/models/media'],
+ ];
+ const byFrom = new Map(scan.redirects.map((r) => [r.from, r.to]));
+ const broken = moved
+ .filter(([from, to]) => byFrom.get(from) !== to)
+ .map(([from, to]) => `${from} → ${byFrom.get(from) ?? 'NO REDIRECT'} (want ${to})`);
+ expect(broken).toEqual([]);
+ });
+
+ // A redirect that forwards to a path nothing serves is a 404 with extra steps.
+ it('every redirect lands on a real route or nav destination', () => {
+ const known = new Set([...routePaths, ...navPaths]);
+ const dangling = scan.redirects
+ // A RELATIVE target (`to="overview"`) resolves against its own route, so it
+ // has no absolute path to look up — /feature-agents/:id → overview and the
+ // two pipeline/story tab defaults are all this shape.
+ .filter((r) => r.to.startsWith('/'))
+ .map((r) => ({ ...r, bare: r.to.split(/[?#]/)[0] }))
+ // A param route can't be enumerated by path, so accept any target whose
+ // parent segment is served (e.g. /models/training covers the :datasetId
+ // drill-down the PrefixRedirect rebases onto).
+ .filter(({ bare }) => !known.has(bare)
+ && !known.has(bare.split('/').slice(0, -1).join('/')))
+ .map((r) => `${r.from} → ${r.to}`);
+ expect(dangling).toEqual([]);
+ });
+
it('opt-out list has no stale entries', () => {
// A stale opt-out is one whose route no longer exists, or that has since
// gained a manifest entry (so it should just be removed from the allow-list).
diff --git a/server/lib/runners.js b/server/lib/runners.js
index 0e79f18a1c..00640c0e49 100644
--- a/server/lib/runners.js
+++ b/server/lib/runners.js
@@ -40,7 +40,7 @@ export const VIDEO_LORA_FAMILIES = Object.freeze({
});
// Predicate: is this LoRA family a video family (vs. an image RUNNER_FAMILIES
-// one)? Backs the Image/Video filter on /media/loras — both the installed-list
+// one)? Backs the Image/Video filter on /models/loras — both the installed-list
// filter and the suggestion-panel section gating. Anything not in
// VIDEO_LORA_FAMILIES (including null/legacy) is treated as image. Mirror of
// client/src/lib/runnerFamilies.js.
diff --git a/server/routes/loraDatasets.js b/server/routes/loraDatasets.js
index 1ad1b92e0d..89bcf90695 100644
--- a/server/routes/loraDatasets.js
+++ b/server/routes/loraDatasets.js
@@ -3,7 +3,7 @@
*
* CRUD + image upload (multipart) + batch generation + reference-sheet
* slicing + vision captioning (SSE) for the per-subject training
- * datasets behind /media/training. Training-run launch lives at
+ * datasets behind /models/training. Training-run launch lives at
* `/api/lora-training` (routes/loraTraining.js); this surface ends at
* "dataset ready to train".
*/
diff --git a/server/routes/loras.js b/server/routes/loras.js
index 9449c6157b..0595495951 100644
--- a/server/routes/loras.js
+++ b/server/routes/loras.js
@@ -1,7 +1,7 @@
/**
* LoRA management routes.
*
- * REST surface for the new `/media/loras` manager UI. The legacy delete
+ * REST surface for the `/models/loras` manager UI. The legacy delete
* endpoint at `DELETE /api/image-video/models/lora/:filename` is kept for
* backward compat (the Models page still calls it); the new manager uses
* these endpoints exclusively so it can also surface Civitai metadata.
@@ -57,7 +57,7 @@ router.get('/suggestions', asyncHandler(async (req, res) => {
}));
// Live keyword search + cursor pagination within one runner family. Backs the
-// per-category search box and "Load more" button on /media/loras. Uncached —
+// per-category search box and "Load more" button on /models/loras. Uncached —
// results are query/cursor-specific. `query` blank = top ranking for that
// family (so "Load more" with no keyword just pages the leaderboard).
const searchQuerySchema = z.object({
diff --git a/server/services/aiAssignments.js b/server/services/aiAssignments.js
index 2c5e8c82c7..ffbb86d81f 100644
--- a/server/services/aiAssignments.js
+++ b/server/services/aiAssignments.js
@@ -159,7 +159,7 @@ const addSettingsEntries = async (entries) => {
providerOptions: embeddingProviders,
providerTypes: [],
notes: 'Powers semantic search, including Chief of Staff memory retrieval.',
- link: '/settings/embeddings',
+ link: '/models/embeddings',
}));
for (const [key, label] of [
diff --git a/server/services/civitaiSuggestions.js b/server/services/civitaiSuggestions.js
index c11dbf3738..b5fac81f0c 100644
--- a/server/services/civitaiSuggestions.js
+++ b/server/services/civitaiSuggestions.js
@@ -1,6 +1,6 @@
/**
* Civitai LoRA suggestions — pre-scans top LoRAs per runner family
- * (mflux / flux2 / z-image) so users land on /media/loras with a curated
+ * (mflux / flux2 / z-image) so users land on /models/loras with a curated
* "quick-install" list instead of a blank install form.
*
* Cached in-memory with a 1-hour TTL. The cache survives the lifetime of
@@ -40,7 +40,7 @@ const CURATED_SUGGESTIONS = [
const cache = new Map();
// Shape one Civitai model into the lightweight suggestion-card payload the
-// /media/loras UI consumes. Defensive: any field can be missing on Civitai.
+// /models/loras UI consumes. Defensive: any field can be missing on Civitai.
// Returns null on any malformed input (no published versions, no installable
// file, etc.) — the suggestion panel is best-effort, so a single bad entry
// must not poison the whole list.
@@ -203,7 +203,7 @@ const fetchSuggestionsFor = async (runnerFamily, { fetchImpl, force = false } =
};
// Live (uncached) search/pagination within one runner family. Backs the
-// per-category search box and "Load more" button on /media/loras:
+// per-category search box and "Load more" button on /models/loras:
// - `query` filters by keyword (model name/description) — blank = top ranking
// - `cursor` pages forward; pass the previous response's `nextCursor`
// Uncached because results are query-/cursor-specific and short-lived; the
diff --git a/server/services/systemResources.js b/server/services/systemResources.js
index 3dc28a3a37..687541b954 100644
--- a/server/services/systemResources.js
+++ b/server/services/systemResources.js
@@ -188,7 +188,7 @@ function downloadedModelInventory({
sizeBytes: model.size,
sizeIsEstimate: false,
loaded: false,
- managePath: '/media/models',
+ managePath: '/models/media',
action: { type: 'hf-model', dirName: model.id },
}));
const loras = (loraStorage?.loras || []).map((model) => ({
@@ -201,7 +201,7 @@ function downloadedModelInventory({
risk: 'high',
cleanupReason: 'A trained or imported LoRA adapter may be the only copy and can take hours to reproduce.',
loaded: false,
- managePath: '/media/loras',
+ managePath: '/models/loras',
action: { type: 'lora', filename: model.filename },
}));
const ollamaApi = new Map((ollamaStatus?.models || []).map((model) => [model.id, model]));
@@ -436,13 +436,13 @@ export async function buildSystemResourceReport() {
{
id: 'huggingface', label: 'Hugging Face models', kind: 'model',
sizeBytes: finiteOrNull(hf?.totalBytes), status: backendState(hf),
- managePath: '/media/models', protected: false,
+ managePath: '/models/media', protected: false,
note: 'Image, video, audio, and text-encoder weights in the shared Hub cache.',
},
{
id: 'loras', label: 'LoRA adapters', kind: 'model',
sizeBytes: finiteOrNull(loraStorage?.totalBytes), status: backendState(loraStorage),
- managePath: '/media/loras', protected: false,
+ managePath: '/models/loras', protected: false,
note: 'Fine-tuning adapters in PortOS data. This total also appears inside PortOS data.',
},
{
diff --git a/server/services/videoLoraSuggestions.js b/server/services/videoLoraSuggestions.js
index 2d2383aa86..a72873a733 100644
--- a/server/services/videoLoraSuggestions.js
+++ b/server/services/videoLoraSuggestions.js
@@ -1,6 +1,6 @@
/**
* Video-LoRA suggestions — a hand-curated quick-install list of HuggingFace
- * video LoRAs (LTX-2 / LTX-Video) so /media/loras surfaces them next to the
+ * video LoRAs (LTX-2 / LTX-Video) so /models/loras surfaces them next to the
* Civitai image suggestions instead of forcing the user to know the repo id.
*
* Why this is separate from civitaiSuggestions.js: video LoRAs live on