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

fix: derive Models breadcrumbs from route instead of hardcoding them (#7419)

Adam Eivy34fe603316bf
diff --git a/client/src/components/apps/ClaimReviewerSource.jsx b/client/src/components/apps/ClaimReviewerSource.jsx
index e21019dfaa..0ebe1096cd 100644
--- a/client/src/components/apps/ClaimReviewerSource.jsx
+++ b/client/src/components/apps/ClaimReviewerSource.jsx
@@ -1,4 +1,5 @@
import { Link } from 'react-router';
+import { getNavPageForPath } from '../../../../server/lib/navManifest.js';
/**
* Where a claim's reviewer list came from, in one sentence.
@@ -18,19 +19,20 @@ import { Link } from 'react-router';
* them — naming it here would send the user to a screen with no such control.
*/
export default function ClaimReviewerSource({ source }) {
+ const codeReviewersPage = getNavPageForPath('/models/code-reviewers')?.breadcrumb || 'its management page';
if (source === 'task-override') {
return (
<>
{' — from the '}<strong className="text-port-warning">claim-work</strong>{' reviewer override in '}
<Link to="/cos/schedule" className="text-port-accent hover:underline">Chief of Staff → Schedule</Link>
- {', not Models → Code Reviewers. Clear it there to follow the install default again.'}
+ {`, not ${codeReviewersPage}. Clear it there to follow the install default again.`}
</>
);
}
return (
<>
{' — from '}
- <Link to="/models/code-reviewers" className="text-port-accent hover:underline">Models → Code Reviewers</Link>.
+ <Link to="/models/code-reviewers" className="text-port-accent hover:underline">{codeReviewersPage}</Link>.
</>
);
}
diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.js
index 1daba96312..adbf0bce28 100644
--- a/client/src/components/cos/constants.js
+++ b/client/src/components/cos/constants.js
@@ -19,7 +19,7 @@ import {
import { normalizeReviewerSlug, REVIEWER_VALUES } from '../../lib/reviewerPins';
import { AVATAR_STYLE_LABELS } from '../../lib/avatarStyles';
import { inPlaceClipName } from '../../utils/animationClips';
-import { getPageNavTabs } from '../../../../server/lib/navManifest.js';
+import { getNavPageForPath, getPageNavTabs } from '../../../../server/lib/navManifest.js';
import { buildPageNavTabs } from '../../lib/pageNavTabs.js';
// Icon per tab id. The manifest (`tabGroup: 'cos'`) owns id/label/order — this
@@ -293,16 +293,17 @@ export function pinnedPrCompletion(metadata) {
//
// Copy only — the ROSTER is `REVIEWER_VALUES` in `client/src/lib/reviewerPins.js`,
// which the server suite pins against the server's own enum.
+const CODE_REVIEWERS_PAGE = getNavPageForPath('/models/code-reviewers')?.breadcrumb || 'its management page';
const REVIEWER_COPY = {
pi: { label: 'Pi', description: 'Pi Coding Agent CLI reviews the supplied diff without tools' },
copilot: { label: 'Copilot', description: 'GitHub Copilot (GitHub-only)' },
- claude: { label: 'Claude', description: 'Claude CLI reviews the PR diff (optional model on Models → Code Reviewers; supports an Ollama-backed Claude for local-only setups)' },
+ claude: { label: 'Claude', description: `Claude CLI reviews the PR diff (optional model on ${CODE_REVIEWERS_PAGE}; supports an Ollama-backed Claude for local-only setups)` },
antigravity: { label: 'Antigravity', description: 'Antigravity CLI (agy) reviews the PR diff' },
- codex: { label: 'Codex', description: 'Codex CLI reviews the PR diff (optional model tier on Models → Code Reviewers)' },
+ codex: { label: 'Codex', description: `Codex CLI reviews the PR diff (optional model tier on ${CODE_REVIEWERS_PAGE})` },
grok: { label: 'Grok', description: 'Grok Build CLI (grok) reviews the PR diff' },
cursor: { label: 'Cursor Agent', description: 'Cursor Agent CLI (cursor-agent) reviews the PR diff' },
- opencode: { label: 'OpenCode', description: 'OpenCode CLI reviews the PR diff (optional provider/model on Models → Code Reviewers)' },
- kimi: { label: 'Kimi', description: 'Kimi CLI reviews the PR diff (optional model on Models → Code Reviewers)' },
+ opencode: { label: 'OpenCode', description: `OpenCode CLI reviews the PR diff (optional provider/model on ${CODE_REVIEWERS_PAGE})` },
+ kimi: { label: 'Kimi', description: `Kimi CLI reviews the PR diff (optional model on ${CODE_REVIEWERS_PAGE})` },
lmstudio: { label: 'LM Studio', description: 'Local LM Studio model reviews the diff (set model on AI Providers)' },
ollama: { label: 'Ollama', description: 'Local Ollama model reviews the diff (set model on AI Providers)' },
mtplx: { label: 'MTPLX', description: 'Local MTPLX model reviews the diff (set model on AI Providers)' }
diff --git a/client/src/components/settings/ImageGenTab.jsx b/client/src/components/settings/ImageGenTab.jsx
index 5279f9a0a0..cbfc52fac4 100644
--- a/client/src/components/settings/ImageGenTab.jsx
+++ b/client/src/components/settings/ImageGenTab.jsx
@@ -21,6 +21,7 @@ import useLocalImageRuntime from '../../hooks/useLocalImageRuntime';
import useDrawerTab from '../../hooks/useDrawerTab';
import { isLoopbackHost } from '../../lib/loopbackHost.js';
import { PORTS } from '../../lib/ports.js';
+import { getNavPageForPath } from '../../../../server/lib/navManifest.js';
import {
getSettings, updateSettings, getImageGenStatus, generateImage,
registerTool, updateTool, getToolsList,
@@ -986,7 +987,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="/models/media" className="text-port-accent hover:underline">Models → Media</a>.
+ and are surfaced in <a href="/models/media" className="text-port-accent hover:underline">{getNavPageForPath('/models/media')?.breadcrumb || 'its management page'}</a>.
</p>
{/* The verdict first, then the interpreter detail below it. The
packages panel only ever probes the mflux interpreter, so on its
@@ -1029,7 +1030,7 @@ export function ImageGenTab() {
form, deck cards, sprite references, pipeline visuals, character sheets and
FableLoom. A model picked on one of those surfaces still wins for that render.
Weights download on first use; check what&apos;s already cached in{' '}
- <a href="/models/media" className="text-port-accent hover:underline">Models → Media</a>.
+ <a href="/models/media" className="text-port-accent hover:underline">{getNavPageForPath('/models/media')?.breadcrumb || 'its management page'}</a>.
</p>
{localModels?.length === 0 && (
<p role="status" className="text-xs text-port-warning">
diff --git a/client/src/pages/LocalLlmPlayground.jsx b/client/src/pages/LocalLlmPlayground.jsx
index 061c4bf574..9ce129bc9b 100644
--- a/client/src/pages/LocalLlmPlayground.jsx
+++ b/client/src/pages/LocalLlmPlayground.jsx
@@ -13,6 +13,7 @@ import { localLlmTargetKey } from '../lib/localLlmTargetKey';
import { formatBytes, recommendedRamGb, timeUntil } from '../utils/formatters';
import { filterHardwareCompatibleModels } from '../utils/systemCapabilities';
import { compareLocalLlmModels, getLoadedLlmModels, getLocalLlmCatalog, getLocalLlmStatus, streamLocalLlmTest } from '../services/api';
+import { getNavPageForPath } from '../../../server/lib/navManifest.js';
const BACKEND_LABEL = { ollama: 'Ollama', lmstudio: 'LM Studio' };
const DEFAULT_PROMPT = 'Write a short, vivid paragraph about a lighthouse computer waking up at dawn.';
@@ -511,7 +512,7 @@ export default function LocalLlmPlayground() {
<div className="flex flex-col h-full">
<div className="flex items-center justify-between gap-3 p-4 border-b border-port-border">
<div className="flex items-center gap-3 min-w-0">
- <Link to="/models/llms" className="p-2 rounded-lg bg-port-card border border-port-border text-gray-400 hover:text-white" title="Back to Models → LLMs">
+ <Link to="/models/llms" className="p-2 rounded-lg bg-port-card border border-port-border text-gray-400 hover:text-white" title={`Back to ${getNavPageForPath('/models/llms')?.breadcrumb || 'its management page'}`}>
<ArrowLeft size={16} />
</Link>
<div className="min-w-0">
diff --git a/client/src/pages/Media3D.jsx b/client/src/pages/Media3D.jsx
index 755cbf1961..e7bd29b9d6 100644
--- a/client/src/pages/Media3D.jsx
+++ b/client/src/pages/Media3D.jsx
@@ -16,6 +16,7 @@ import { imageTo3dStatusMeta } from '../components/media/imageTo3dStatus';
import ImageTo3dRenderOptions from '../components/media/ImageTo3dRenderOptions';
import { renderOptionsBody, SUBJECT_SCALE_DEFAULT } from '../lib/imageTo3dRenderOptions';
import { isTargetReady, unavailableReasonLabel } from '../lib/imageTo3dReasons';
+import { getNavPageForPath } from '../../../server/lib/navManifest.js';
// Poll cadence while a render is in flight (a real TRELLIS.2 render is multi-minute).
const POLL_INTERVAL_MS = 2500;
@@ -164,7 +165,7 @@ 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} from Models → 3D before generating.`;
+ if (selectedTarget.installed === false) return `Install ${selectedTarget.label} from ${getNavPageForPath('/models/3d')?.breadcrumb || 'its management page'} before generating.`;
return null;
})();
diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.js
index b743d22646..1a5199f1b3 100644
--- a/scripts/ci-test-plan.js
+++ b/scripts/ci-test-plan.js
@@ -218,6 +218,9 @@ export const ALWAYS_RUN_TESTS = [
// `.env.example` itself is not a scope the selector routes to a runner.
'server/envExampleDrift.test.js',
'server/lib/generatedManifests.test.js',
+ // Whole-tree scanner: any server/client file can add a hardcoded "Models →"
+ // breadcrumb, with no import edge back to this file.
+ 'server/lib/localProviderRuntime.test.js',
'server/lib/qwenAgentParsers.test.js',
'server/lib/testDataIsolation.guards.test.js',
'server/lib/testHelper.test.js',
diff --git a/server/lib/README.md b/server/lib/README.md
index 1eba26b983..c6f49890a1 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -490,7 +490,7 @@ pm` default, `NPM_CONFIG_PREFIX`, nvm/Volta) installed `codex` successfully and
| `migrationMarker.js` | Shared marker-file helpers for one-time migration/repair/reconcile scripts — `markerExists(filename)` (boolean gate), `readMarker(filename)` (parsed payload or null), `writeMarker(filename, payload)` (atomic write). All anchor `filename` under `PATHS.data` and use `tryReadFile`/`atomicWrite` so a crash can't leave a truncated marker. |
| `goalFeatureMap.js` | Deterministic goal `category` → PortOS feature-area map (deep-links sourced from `NAV_COMMANDS`). `getGoalFeatureAreas(goal)` honors the per-goal `featureAreas` override, else the category default. Mirrored byte-for-byte to `client/src/lib/`. |
| `goalFidelity.js` | Goal-fidelity review contract (#5994) — the value half of "does this diff deliver what was asked?", the question the quality-review chain structurally cannot answer because it never sees the request. `GOAL_FIDELITY_VERDICTS` (`ship` / `fix-first` / `rethink`, only `rethink` gating a run via `goalFidelityHoldsRun`), `taskObjective(task)` (the trusted operator-authored objective — the TASK's description + prompt block, never the agent's transcript, since a reviewer handed the transcript inherits the assumptions that produced the drift), `resolveGoalFidelityConfig(codeReview, chain)` (enabled/backend/model/effort, restricted to the local-LLM reviewers PortOS can call server-side and falling back to the quality chain's own local reviewer + its `<backend>Model`/`Effort` scalars), `normalizeGoalFidelityVerdict(parsed)` (`null` = nothing judged the run, never collapsed into a `ship` pass or a `rethink` hold) and `formatGoalFidelitySummary(review)`. `MAX_OBJECTIVE_CHARS` / `MAX_FIDELITY_DIFF_CHARS` bound what crosses into a fixed-window local model. Pure. |
-| `navManifest.js` | Single source of truth for nav (`⌘K` palette + voice). Add an entry when you add a page. Also `getNavPageForPath(pathname)` → `{ label, section, breadcrumb }` for the most specific command that owns a route (`null` for one nothing declares) — how user-facing copy NAMES a page it links to, instead of typing "Models → LLMs" beside the link and stranding it on the next move (#7414). |
+| `navManifest.js` | Single source of truth for nav (`⌘K` palette + voice). Add an entry when you add a page. Also `getNavPageForPath(pathname)` → `{ label, section, breadcrumb }` for the most specific command that owns a route (`null` for one nothing declares) — how user-facing copy NAMES a page it links to, instead of typing "Models → LLMs" beside the link and stranding it on the next move (#7414). `expandPageToken(text, runtime)` expands a `{page}` token in `text` using `getNavPageForPath(runtime?.manageUrl)`, falling back to generic prose rather than shipping a literal `{page}` (#7419). |
| `noReplaceMove.js` | `moveWithoutReplace(from, to)` — publish a staged file into its final name WITHOUT ever clobbering an existing one. `fs.rename` silently replaces its destination, which is the wrong default for a derived artifact; this uses `link(2)` + `unlink(2)`, so an existing destination fails atomically with `MOVE_DEST_EXISTS` and both files survive. Refuses rather than degrading when the filesystem cannot express it (`MOVE_CROSS_DEVICE`, `MOVE_NO_REPLACE_UNSUPPORTED`) — a `stat`-then-`rename` fallback would be a race. Used by the rigging publication contract (`services/rigging/autoSkin.js`). |
| `personaTraitBlend.js` | Digital-twin persona trait-blending (M34 P7). Blends a persona's `traitAdjustments` against the base twin's communication profile + Big-Five into a "Communication Calibration" directive. A pure leaf — `client/src/lib/personaTraitBlend.js` re-exports it for the Personas UI preview. |
| `textUtils.js` | Pure dependency-free prose helpers. `isStr(v)` and `isNonBlankStr(v)` are the ONLY string predicates under `server/` (#6837) — the bare type check, and type check plus a non-empty `trim()` for ids, keys, hosts, model names and prose fields where whitespace-only is already invalid; the "no private string predicate or bounder" guard in `textUtils.test.js` fails the suite when a copy of either, or a `trimTo`-shaped bounder, is re-declared in any non-test source under `server/` or any source under `client/src/` (`client/src/lib/textUtils.js` re-exports both for the browser bundle). `countWords(text)` is the canonical whitespace-token count (`\S+`) and the only one — every server word count (Writers Room, lettering density, rapid reader, autobiography, script-video beats) and the client's (`client/src/lib/textUtils.js` re-exports it) resolve here, and the "no private countWords" guard in `textUtils.test.js` fails the suite when a re-spelled count (the whitespace-token match, a split-and-filter, or a helper under either conventional name) reappears in any non-test source under `server/` or any source under `client/src/`; the editorial prose-analysis checks deliberately count LETTER words instead, through `editorial/proseTics.js#tokenizeWords`, which owns that tokenizer the same way; `trimTo(value, max)` trims and bounds strings without coercing non-strings, and is safe for shared modules consumed by the browser; `escapeRegExp(value)` is the one to import instead of re-inlining the escape (the sibling guard in `textUtils.test.js` fails the suite when a copy reappears in any non-test source under `server/`, or in ANY source under `client/src/`, tests and `.jsx` included — `client/src/lib/textUtils.js` re-exports this module for the browser bundle); `trimToClause(v, max)` is its boundary-aware twin for PROSE fields — it backs off to the last sentence terminator, then the last clause boundary, then the last whole word, so a capped field never ends mid-thought (it lives here rather than in `storyBible.js`, which re-exports it, so the pure story-model leaves the browser bundle shares can cap prose without pulling `crypto` / `fileUtils`); `kebabCase(text)` is the canonical ASCII slug transform (PLAN.md `[slug]` ids and `planner:<model>` labels); `clampToCharLimit(text, max)` is `trimTo`'s reader-facing twin — it cuts on a sentence end (when one sits 60%+ into the allowance) or a word boundary rather than mid-word and returns `{ text, truncated }` so the caller can say the text was cut, which is what bounds an AI-enhanced render prompt to a backend's hard cap (reactor.inc fast-h3 rejects an over-length prompt outright). |
diff --git a/server/lib/localPersistentMindRecommendation.js b/server/lib/localPersistentMindRecommendation.js
index 07769605aa..ca8375186f 100644
--- a/server/lib/localPersistentMindRecommendation.js
+++ b/server/lib/localPersistentMindRecommendation.js
@@ -7,10 +7,13 @@
* Ollama with a tool-capable ~7B instruct model, while Cursor Agent / OpenCode
* Zen (cloud CLIs) stay the coding harnesses.
*
- * Pure and dependency-free so the setup service, routes, and unit tests share
- * one source of truth without probing the host.
+ * Pure — no host probing — so the setup service, routes, and unit tests share
+ * one source of truth. The only import is the static nav manifest, which is
+ * itself pure route data, not a live check.
*/
+import { getNavPageForPath } from './navManifest.js';
+
/** Default Ollama tag — Qwen2.5 7B Instruct (Q4 in the official Ollama library). */
export const LOCAL_PERSISTENT_MIND_MODEL = 'qwen2.5:7b-instruct';
@@ -175,7 +178,7 @@ export function localPersistentMindRecommendation(capabilities) {
codingHarnesses: 'Cursor Agent / OpenCode Zen (cloud CLIs) for coding tasks',
topology: 'Local Ollama Persistent Mind + cloud coding CLIs',
note: 'Default for Grok Bot boxes and other CPU-only / no-GPU installs: a free local Persistent Mind on Ollama, with Cursor / OpenCode Zen reserved for coding.',
- alternatives: 'Do not enable vLLM or Qwen3.8-27B presets on this host. When you later add a GPU workstation, use Models → Runtimes → Recommended coding-agent setup instead.',
+ alternatives: `Do not enable vLLM or Qwen3.8-27B presets on this host. When you later add a GPU workstation, use ${getNavPageForPath('/models/llms-runtimes')?.breadcrumb ?? 'Runtimes'} → Recommended coding-agent setup instead.`,
warnings: Object.freeze(warnings),
suppressHeavyLocalPresets: shouldSuppressHeavyLocalPresets(capabilities),
cpuOnly,
diff --git a/server/lib/localProviderRuntime.test.js b/server/lib/localProviderRuntime.test.js
index 5a01689c20..4ba13682e3 100644
--- a/server/lib/localProviderRuntime.test.js
+++ b/server/lib/localProviderRuntime.test.js
@@ -1,4 +1,8 @@
import { describe, it, expect, vi, afterEach } from 'vitest';
+import { execFileSync } from 'node:child_process';
+import { readFileSync } from 'node:fs';
+import { dirname, join } from 'node:path';
+import { fileURLToPath } from 'node:url';
import {
LOCAL_RUNTIMES,
LOCAL_RUNTIME_MANAGE_URLS,
@@ -8,6 +12,7 @@ import {
} from './localProviderRuntime.js';
import { opencodeLocalBaseUrl } from './opencodeConfig.js';
import { PORTS } from './ports.js';
+import { NAV_COMMANDS } from './navManifest.js';
afterEach(() => {
vi.unstubAllEnvs();
@@ -247,3 +252,102 @@ describe('LOCAL_RUNTIMES — user-facing copy names its page by route, never by
});
});
});
+
+// #7419 repeated the #7414 hand-sweep — a SECOND breadcrumb split into runtimes
+// no LOCAL_RUNTIMES row was in scope for (fleetLlmHost.js, the Persistent Mind
+// recommenders, llamaServerManager.js, the playground back-link). Each of those
+// now resolves its page from `getNavPageForPath`/`expandPageToken` instead of a
+// literal, so this scans the whole server+client tree for the next one typed by
+// hand — a net, not a proof: a lexer-assisted line scan, not an AST pass.
+describe('shipped copy names a Models page by route, never by literal (#7419)', () => {
+ const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
+
+ const MODELS_TAB_LABELS = [...new Set(
+ NAV_COMMANDS.filter((c) => c.section === 'Models' && c.label).map((c) => c.label),
+ )];
+
+ // Longest-first so "Abuse Guard" cannot be shadowed by a shorter overlapping
+ // label (none currently overlap, but a future label might).
+ const BREADCRUMB_PATTERN = new RegExp(
+ `Models\\s*→\\s*(${MODELS_TAB_LABELS.slice().sort((a, b) => b.length - a.length)
+ .map((label) => label.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})`,
+ 'g',
+ );
+
+ // A hardcoded "Models → LLMs → Abuse Guard" names a THIRD-level breadcrumb
+ // (Abuse Guard nests under the LLMs tab in the sidebar) that
+ // `getNavPageForPath` cannot produce — it returns one `section → label` hop,
+ // never a drill-down chain. Deliberate, not a regression; #7419 leaves it.
+ const ABUSE_GUARD_CONTINUATION = /^\s*→\s*Abuse Guard/;
+
+ // Deliberate weights-catalog references #7419 leaves alone: the LLMs page
+ // they name has not moved, and rewriting them buys nothing a literal
+ // "Models → LLMs" doesn't already say correctly.
+ const ALLOWLISTED_FILES = new Set([
+ 'server/lib/navManifest.js',
+ 'server/services/loraDatasetCaption.js',
+ 'client/src/components/loraTraining/CaptionModelPicker.jsx',
+ ]);
+
+ /**
+ * Blank every comment — `//…`, `/* … *\/`, and the `{/* … *\/}` JSX form,
+ * which is the same block-comment syntax wrapped in a brace — while leaving
+ * string/template literals and JSX text untouched, so a hardcoded breadcrumb
+ * SHIPPED to a user still matches. Line-based and conservative: once a line
+ * opens a block comment it blanks every line through the one that closes it,
+ * so a rule merely DESCRIBED across a JSDoc block can't trip the guard.
+ */
+ function blankBlockComments(src) {
+ let inBlock = false;
+ return src.split('\n').map((line) => {
+ if (inBlock) {
+ if (line.includes('*/')) inBlock = false;
+ return '';
+ }
+ if (/^\s*\/\//.test(line)) return '';
+ if (/^\s*(\/\*|\{\/\*)/.test(line)) {
+ if (!line.includes('*/')) inBlock = true;
+ return '';
+ }
+ return line;
+ }).join('\n');
+ }
+
+ function breadcrumbOffenders(src) {
+ const code = blankBlockComments(src);
+ return [...code.matchAll(BREADCRUMB_PATTERN)]
+ .filter((match) => !ABUSE_GUARD_CONTINUATION.test(code.slice(match.index + match[0].length, match.index + match[0].length + 20)))
+ .map((match) => match[0]);
+ }
+
+ const trackedSources = () => [
+ ...execFileSync('git', ['ls-files', 'server/**/*.js'], { cwd: REPO_ROOT, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 }).split('\n'),
+ ...execFileSync('git', ['ls-files', 'client/src/**/*.js', 'client/src/**/*.jsx'], { cwd: REPO_ROOT, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 }).split('\n'),
+ ].filter((f) => f && !f.includes('.test.'));
+
+ it('scans the whole tree', () => {
+ // A broken `git ls-files` (wrong cwd, detached checkout) would otherwise let
+ // every assertion below pass by scanning nothing at all.
+ expect(trackedSources().length).toBeGreaterThan(800);
+ });
+
+ it('recognizes a real hardcoded breadcrumb as an offense', () => {
+ // Proves the extractor still catches a violation — without this the scan
+ // below could go vacuously green after a regex/comment-blanking regression.
+ expect(breadcrumbOffenders('const msg = "Start it from Models → Runtimes.";')).toEqual(['Models → Runtimes']);
+ });
+
+ it('still recognizes a deliberate breadcrumb it must NOT flag', () => {
+ // The guard's own negative case: `getNavPageForPath` cannot produce a
+ // third-level breadcrumb, so this must stay allowlisted rather than
+ // vacuously passing because nothing matched at all.
+ expect(breadcrumbOffenders('const msg = "Open Models → LLMs → Abuse Guard to repair it.";')).toEqual([]);
+ });
+
+ it('flags a hardcoded breadcrumb outside the allowlist', () => {
+ const offenders = trackedSources()
+ .filter((file) => !ALLOWLISTED_FILES.has(file))
+ .flatMap((file) => breadcrumbOffenders(readFileSync(join(REPO_ROOT, file), 'utf8')).map((text) => `${file}: ${text}`));
+ expect(offenders).toEqual([]);
+ });
+});
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index b5956437bb..91011e868f 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -475,6 +475,18 @@ export const getNavPageForPath = (pathname) => {
return { label: command.label, section: command.section, breadcrumb: `${command.section} → ${command.label}` };
};
+// Expand the `{page}` token user-facing copy writes instead of a breadcrumb,
+// resolved from `runtime.manageUrl` (or any object carrying that field) via
+// `getNavPageForPath` above — same reason as that lookup: the sentence and the
+// link it describes must name one page, decided by the route, not typed twice.
+// A `manageUrl` with no page (or `null`, for a runtime PortOS has no page for)
+// falls back to generic prose rather than shipping a literal `{page}`.
+export const expandPageToken = (text, runtime) => (
+ typeof text === 'string' && text.includes('{page}')
+ ? text.replaceAll('{page}', getNavPageForPath(runtime?.manageUrl)?.breadcrumb || 'its management page')
+ : text
+);
+
// Every feature id this manifest gates on, for the registry-drift guard.
export const NAV_FEATURE_IDS = [...new Set(NAV_COMMANDS.map((c) => c.feature).filter(Boolean))].sort();
diff --git a/server/services/fleetLlmHost.js b/server/services/fleetLlmHost.js
index 57fb4d216f..93f9c67448 100644
--- a/server/services/fleetLlmHost.js
+++ b/server/services/fleetLlmHost.js
@@ -16,6 +16,7 @@ import { createFleetLlmGateway } from './fleetLlmGateway.js';
import { peerFetch } from '../lib/peerHttpClient.js';
import { peerBaseUrl } from '../lib/peerUrl.js';
import { withAbortTimeout } from '../lib/abortTimeout.js';
+import { getNavPageForPath } from '../lib/navManifest.js';
const ENABLED_KEY = 'PORTOS_FLEET_LLM_ENABLED';
const MODEL = 'qwen3.8-27b';
@@ -29,8 +30,22 @@ export function recommendFleetLlmHost(specs) {
runtime: 'vllm', supported: true, title: 'Qwen3.8-27B · vLLM + DFlash 2',
reason: 'Validated RTX 3090 recipe with structured tool calls and prefix caching. Recorded warm decode: 105 tokens/sec; actual speed depends on context and workload.',
};
- if (specs.appleSilicon) return { runtime: 'mtplx', supported: false, title: 'MTPLX on Apple Silicon', reason: 'Use the managed MTPLX setup on Models → Runtimes. Automated dedicated hosting currently supports the validated RTX 3090 recipe.' };
- return { runtime: null, supported: false, title: specs.cuda?.status === 'unknown' ? 'Hardware detection needs attention' : 'Connect to a model host', reason: 'No validated automatic Qwen3.8-27B host recipe matches this machine. Connect to an existing host, or compare installed models on Models → Performance.' };
+ if (specs.appleSilicon) {
+ const page = getNavPageForPath('/models/llms-runtimes')?.breadcrumb;
+ return {
+ runtime: 'mtplx',
+ supported: false,
+ title: 'MTPLX on Apple Silicon',
+ reason: `Use the managed MTPLX setup${page ? ` on ${page}` : ''}. Automated dedicated hosting currently supports the validated RTX 3090 recipe.`,
+ };
+ }
+ const performancePage = getNavPageForPath('/models/performance')?.breadcrumb;
+ return {
+ runtime: null,
+ supported: false,
+ title: specs.cuda?.status === 'unknown' ? 'Hardware detection needs attention' : 'Connect to a model host',
+ reason: `No validated automatic Qwen3.8-27B host recipe matches this machine. Connect to an existing host${performancePage ? `, or compare installed models on ${performancePage}` : ''}.`,
+ };
}
async function readHostEnv() {
@@ -185,7 +200,10 @@ async function configure({ emit, isCancelled }) {
const probe = await probeOpenAiModels(`${upstream}/v1`, { apiKey, timeoutMs: 3000 });
if (!probe.reachable) {
const gpu = await getCudaUtilization({ refresh: true });
- if (gpu.gpus?.some((item) => item.memoryUsedMib > 3000)) throw new Error('Another application is holding GPU memory. Unload its model on Models → Runtimes, then retry.');
+ if (gpu.gpus?.some((item) => item.memoryUsedMib > 3000)) {
+ const page = getNavPageForPath('/models/llms-runtimes')?.breadcrumb;
+ throw new Error(`Another application is holding GPU memory. Unload its model${page ? ` on ${page}` : ''}, then retry.`);
+ }
}
let contents = await readFile(join(project.dir, '.env'), 'utf8');
for (const [key, value] of [['SPEC', 'dflash2'], ['PREFIX_CACHE', '1'], ['MAX_SEQS', '1']]) contents = upsertEnvLine(contents, key, value);
diff --git a/server/services/llamaServerManager.js b/server/services/llamaServerManager.js
index 04c3906cd9..d268356eb7 100644
--- a/server/services/llamaServerManager.js
+++ b/server/services/llamaServerManager.js
@@ -26,6 +26,8 @@ import {
wingetLinkDirs,
} from '../lib/llamaCppInstall.js';
import { PORTS } from '../lib/ports.js';
+import { getNavPageForPath } from '../lib/navManifest.js';
+import { LOCAL_RUNTIME_MANAGE_URLS } from '../lib/localProviderRuntime.js';
import { tuningSpecsFor } from '../lib/localModelTuning.js';
import { ServerError } from '../lib/errorHandler.js';
import { bufferedSpawn } from '../lib/bufferedSpawn.js';
@@ -1097,9 +1099,10 @@ export async function relaunchLlamaServerWithAlias(alias) {
};
}
if (!managed || !config?.model) {
+ const page = getNavPageForPath(LOCAL_RUNTIME_MANAGE_URLS.llama)?.breadcrumb;
return {
applied: false,
- reason: `llama-server is not running under PortOS, so its launch line is not PortOS's to change. Start it from Models → Runtimes, or add \`--alias ${wanted}\` to your own launch line.`,
+ reason: `llama-server is not running under PortOS, so its launch line is not PortOS's to change. ${page ? `Start it from ${page}` : 'Start it'}, or add \`--alias ${wanted}\` to your own launch line.`,
config: null,
};
}
diff --git a/server/services/localPersistentMindSetup.js b/server/services/localPersistentMindSetup.js
index d81753a9df..81d808300b 100644
--- a/server/services/localPersistentMindSetup.js
+++ b/server/services/localPersistentMindSetup.js
@@ -18,6 +18,7 @@ import {
} from '../lib/localPersistentMindRecommendation.js';
import { normalizePersistentMindProfile } from '../lib/persistentMindProfile.js';
import { findCommandOnPath } from '../lib/processEnv.js';
+import { getNavPageForPath } from '../lib/navManifest.js';
import { getProviderById, updateProvider } from './providers.js';
import { listModels } from './localLlm.js';
import * as ollamaManager from './ollamaManager.js';
@@ -70,7 +71,7 @@ export async function describeLocalPersistentMindSetup(deps = {}) {
steps.push(step(
'recommendation',
'skipped',
- 'This host has a curated GPU coding-agent path (or otherwise does not use the free local Persistent Mind default). Use Models → Runtimes → Recommended coding-agent setup when applicable.',
+ `This host has a curated GPU coding-agent path (or otherwise does not use the free local Persistent Mind default). Use ${getNavPageForPath('/models/llms-runtimes')?.breadcrumb ?? 'Runtimes'} → Recommended coding-agent setup when applicable.`,
));
return {
applicable: false,
diff --git a/server/services/localRuntimeSetup.js b/server/services/localRuntimeSetup.js
index 6317a1ff1c..b44b4500bc 100644
--- a/server/services/localRuntimeSetup.js
+++ b/server/services/localRuntimeSetup.js
@@ -55,6 +55,7 @@
*/
import { LOCAL_RUNTIMES, localEndpointPort } from '../lib/localProviderRuntime.js';
+import { expandPageToken } from '../lib/navManifest.js';
import { describeMtplxCache, listMtplxCachedModels } from '../lib/mtplxModels.js';
import { describeMtplxRuntime } from '../lib/mtplxRuntime.js';
import { listSlotstreamCachedModels } from '../lib/slotstreamModels.js';
@@ -112,11 +113,11 @@ const CONFIRM_TIMEOUT_MS = 5_000;
* it names the button that does, plus the in-app card that searches for and
* downloads a checkpoint other than MTPLX's own default.
*/
-const MTPLX_NO_MODEL_ERROR = 'no model weights are cached, so its server exits before it binds a port. Close this window — the checklist now offers “Download the default model & start MTPLX”, which fetches MTPLX\'s own verified checkpoint (a multi-gigabyte download) and then starts the server. To use a different MTP checkpoint instead, search for one on the MTPLX card in Models → Runtimes, download it there, then click Start MTPLX again.';
+const MTPLX_NO_MODEL_ERROR = expandPageToken('no model weights are cached, so its server exits before it binds a port. Close this window — the checklist now offers “Download the default model & start MTPLX”, which fetches MTPLX\'s own verified checkpoint (a multi-gigabyte download) and then starts the server. To use a different MTP checkpoint instead, search for one on the MTPLX card in {page}, download it there, then click Start MTPLX again.', LOCAL_RUNTIMES.mtplx);
/** The same dead end, reached from a cache holding only interrupted pulls. */
const mtplxPartialCacheError = (count) =>
- `its cache holds ${count} model${count === 1 ? '' : 's'}, but none passed its own file check — an interrupted download leaves a partial pack behind. Use “Download the default model & start MTPLX” on the checklist to re-fetch it, or pick another checkpoint on the MTPLX card in Models → Runtimes.`;
+ expandPageToken(`its cache holds ${count} model${count === 1 ? '' : 's'}, but none passed its own file check — an interrupted download leaves a partial pack behind. Use “Download the default model & start MTPLX” on the checklist to re-fetch it, or pick another checkpoint on the MTPLX card in {page}.`, LOCAL_RUNTIMES.mtplx);
/**
* MTPLX's cache state, read WITHOUT invoking `mtplx`'s Homebrew wrapper before
@@ -473,7 +474,7 @@ const SETUP_ROWS = Object.freeze({
const result = await installLlamaServer({ onProgress: (p) => { if (p?.message) emit(p.message); } })
.catch((err) => ({ success: false, error: err.message }));
return result.success
- ? { success: true, note: 'Choose a GGUF model on Models → Runtimes to start llama-server — PortOS does not pick weights for you.' }
+ ? { success: true, note: expandPageToken('Choose a GGUF model on {page} to start llama-server — PortOS does not pick weights for you.', LOCAL_RUNTIMES.llama) }
: result;
},
// llama-server takes a required model path, and the weights are a separate
@@ -653,7 +654,7 @@ export async function runLocalRuntimeSetup(kind, { endpoint, emit = () => {}, is
}
if (!row.start) {
- return { success: true, message: `${runtime.label} is installed. Pick a model on Models → Runtimes to start it.` };
+ return { success: true, message: expandPageToken(`${runtime.label} is installed. Pick a model on {page} to start it.`, runtime) };
}
if (isCancelled()) return { success: false, error: 'Cancelled after the install — nothing was started.' };
diff --git a/server/services/providerReadiness.js b/server/services/providerReadiness.js
index 9c54b304fe..9ae59d28a7 100644
--- a/server/services/providerReadiness.js
+++ b/server/services/providerReadiness.js
@@ -37,7 +37,7 @@
*/
import { localRuntimeForProvider } from '../lib/localProviderRuntime.js';
-import { getNavPageForPath } from '../lib/navManifest.js';
+import { expandPageToken, getNavPageForPath } from '../lib/navManifest.js';
import { isConfiguredDefaultModel } from '../lib/providerModels.js';
import { probeOpenAiModels } from '../lib/openAiModelsProbe.js';
import { findCommandOnPath } from '../lib/processEnv.js';
@@ -270,21 +270,6 @@ function weightsDetail(runtime, weights) {
*/
const managePage = (runtime) => getNavPageForPath(runtime.manageUrl)?.breadcrumb ?? null;
-/**
- * Expand the `{page}` token a runtime's user-facing copy writes instead of a
- * breadcrumb (`localProviderRuntime.js`). Same reason as `managePage`: the
- * sentence and the link it describes must name one page, decided by the route.
- *
- * A runtime with no page never uses the token, but fall back rather than ship a
- * literal `{page}` if one ever slips in — `localProviderRuntime.test.js` is the
- * guard that keeps that from happening quietly.
- */
-const expandPageToken = (text, runtime) => (
- typeof text === 'string' && text.includes('{page}')
- ? text.replaceAll('{page}', managePage(runtime) || 'its management page')
- : text
-);
-
/** The `runtime` check — is the daemon's software here at all? */
function runtimeCheck(runtime, { onPath, appInstalled, installed, reachable, setup }) {
const detail = onPath ? `\`${runtime.command}\` is on PortOS's PATH.`