Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
keep pinned sidebar rows alive when a page moves to a new route
[._.]/ Adam Eivy1e121308b65b
diff --git a/client/src/App.jsx b/client/src/App.jsxindex f5f143f52f..0fff983ba4 100644--- a/client/src/App.jsx+++ b/client/src/App.jsx@@ -163,12 +163,12 @@ function CanonRedirect() {// when the list/table index landed). Both keep old bookmarks + in-app// deep-links alive. The canon variant forces `#canon` to scroll the embedded// canon section; non-canon preserves whatever hash the user had.-function UniverseRouteRedirect({ fromPrefix, canon = false }) {+function UniverseRouteRedirect({ fromPrefix, to, canon = false }) {const { pathname, search, hash } = useLocation();const rest = pathname.replace(fromPrefix, '');const target = canon- ? `/universes${rest.replace(/\/canon\/?$/, '')}${search}#canon`- : `/universes${rest}${search}${hash}`;+ ? `${to}${rest.replace(/\/canon\/?$/, '')}${search}#canon`+ : `${to}${rest}${search}${hash}`;return <Navigate to={target} replace />;}@@ -428,8 +428,8 @@ export default function App() {redirects keep legacy /media/universe-builder bookmarks workingafter the MediaGen tab was removed. */}<Route path="universe-builder" element={<RedirectWithSearch to="/universes" />} />- <Route path="universe-builder/:universeId" element={<UniverseRouteRedirect fromPrefix={/^\/media\/universe-builder/} />} />- <Route path="universe-builder/:universeId/canon" element={<UniverseRouteRedirect fromPrefix={/^\/media\/universe-builder/} canon />} />+ <Route path="universe-builder/:universeId" element={<UniverseRouteRedirect fromPrefix={/^\/media\/universe-builder/} to="/universes" />} />+ <Route path="universe-builder/:universeId/canon" element={<UniverseRouteRedirect fromPrefix={/^\/media\/universe-builder/} to="/universes" canon />} /></Route>{/* Sprite Manager — a top-level Create page (moved out of the MediaGen tabs). The record id is the URL, per the ID-based deep-linking@@ -495,8 +495,8 @@ export default function App() {{/* Legacy /universe-builder* → /universes* (route renamed when theindex landed). Keeps old bookmarks + in-app deep-links working. */}<Route path="universe-builder" element={<RedirectWithSearch to="/universes" />} />- <Route path="universe-builder/:universeId/canon" element={<UniverseRouteRedirect fromPrefix={/^\/universe-builder/} canon />} />- <Route path="universe-builder/:universeId" element={<UniverseRouteRedirect fromPrefix={/^\/universe-builder/} />} />+ <Route path="universe-builder/:universeId/canon" element={<UniverseRouteRedirect fromPrefix={/^\/universe-builder/} to="/universes" canon />} />+ <Route path="universe-builder/:universeId" element={<UniverseRouteRedirect fromPrefix={/^\/universe-builder/} to="/universes" />} /><Route path="universe-builder/new" element={<RedirectWithSearch to="/universes/new" />} /><Route path="writers-room" element={<WritersRoom />} /><Route path="writers-room/guide" element={<WritersRoomGuide />} />diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex 556dcd8083..05d2f14783 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -120,6 +120,7 @@ import { useSharingNotifications } from '../hooks/useSharingNotifications';import UpdateBanners from './UpdateBanners';import { useAIStatusNotifications } from '../hooks/useAIStatusNotifications';import { useNavWorkingSet } from '../hooks/useNavWorkingSet.js';+import { migrateLegacyNavPath } from '../utils/navWorkingSet.js';import { useSidebarApps } from '../hooks/useSidebarApps.js';import { useSidebarSeries } from '../hooks/useSidebarSeries.js';import { useSidebarUniverses } from '../hooks/useSidebarUniverses.js';@@ -803,9 +804,23 @@ export default function Layout() {return map;}, [resolvedNavItems]);+ // Stored Pinned/Recent paths outlive the routes they were saved from. When a+ // page MOVES, its old path stops matching anything here and the row silently+ // renders nothing — so a miss falls back through the manifest's `previousPaths`+ // to where the page lives now, and the entry carries that CURRENT path so the+ // row navigates (and unpins) by it. Resolution is where this belongs rather+ // than a rewrite-on-read: a path that resolves to nothing is left untouched,+ // which matters because the dynamic app/series/universe rows load async and+ // "unresolvable" is a normal transient state during boot.const resolveNavEntry = useCallback(- (path) => navEntryByPath.get(path) || manifestEntryByPath.get(path) || null,- [navEntryByPath, manifestEntryByPath],+ (path) => {+ const direct = navEntryByPath.get(path) || manifestEntryByPath.get(path);+ if (direct) return direct;+ const current = migrateLegacyNavPath(path, manifestNav);+ if (current === path) return null;+ return navEntryByPath.get(current) || manifestEntryByPath.get(current) || null;+ },+ [navEntryByPath, manifestEntryByPath, manifestNav],);const { pinned, recent, pin, unpin, isPinned } = useNavWorkingSet(resolveNavEntry);diff --git a/client/src/hooks/useNavWorkingSet.js b/client/src/hooks/useNavWorkingSet.jsindex 5933e308ff..de69789982 100644--- a/client/src/hooks/useNavWorkingSet.js+++ b/client/src/hooks/useNavWorkingSet.js@@ -16,29 +16,26 @@ const readList = (key) => {// in-memory React state still updates and the app never crashes on a write.const writeList = (key, list) => safeWriteStorage(key, JSON.stringify(list));-const LEGACY_NAV_PATHS = {- '/system-health': '/system-resources',-};--// Whole-subtree renames: a stored path AT or UNDER the key moves to the value, keeping-// whatever followed. `/city` → `/openworld` (the 3D world's rename) covers `/city`,-// `/city/settings`, and `/city/apps/:id` in one rule, mirroring App.jsx's PrefixRedirect.-// Without it the browser URL redirects but the *stored* path doesn't, so a pinned `/city`-// row no longer resolves against the manifest and silently disappears on upgrade.-const LEGACY_NAV_PREFIXES = [- ['/city', '/openworld'],-];--const migratePath = (path) => {- const exact = LEGACY_NAV_PATHS[path];- if (exact) return exact;- for (const [from, to] of LEGACY_NAV_PREFIXES) {- // Segment-anchored so a sibling route like `/cityscape` is never rewritten.- if (path === from || path.startsWith(`${from}/`)) return `${to}${path.slice(from.length)}`;+// Replace each stored path with the CURRENT path it resolves to, so a page that+// has MOVED is stored under where it lives now — pin state and unpin() then+// compare against the same path the sidebar rendered. Returns the original list+// when nothing moved, so the effect below settles after one pass.+//+// Only paths that actually resolve are rewritten. A path resolving to nothing is+// left exactly as stored: during boot the dynamic app/series/universe rows have+// not loaded yet, and dropping or rewriting a pin on that transient miss would+// lose it for good.+const normalizeToCurrentPaths = (paths, resolveNavEntry) => {+ let changed = false;+ const next = [];+ for (const stored of paths) {+ const current = resolveNavEntry(stored)?.path || stored;+ if (current !== stored) changed = true;+ if (next.includes(current)) changed = true;+ else next.push(current);}- return path;+ return changed ? next : paths;};-const migratePaths = (paths) => [...new Set(paths.map(migratePath))];/*** Sidebar working-set state (Pinned + Recent), persisted to localStorage.@@ -53,11 +50,11 @@ export function useNavWorkingSet(resolveNavEntry) {// Record the initial visit synchronously so it's present on first render.// The useEffect below handles subsequent navigations only.const [recentPaths, setRecentPaths] = useState(() => {- const initial = recordVisit(location.pathname, migratePaths(readList(RECENT_KEY)));+ const initial = recordVisit(location.pathname, readList(RECENT_KEY));writeList(RECENT_KEY, initial);return initial;});- const [pinnedPaths, setPinnedPaths] = useState(() => migratePaths(readList(PINNED_KEY)));+ const [pinnedPaths, setPinnedPaths] = useState(() => readList(PINNED_KEY));// Track the last recorded path to skip the initial effect (already handled above).const lastRecordedRef = useRef(location.pathname);@@ -93,6 +90,22 @@ export function useNavWorkingSet(resolveNavEntry) {const isPinned = useCallback((path) => isPinnedPure(path, pinnedPaths), [pinnedPaths]);+ // Fold moved pages back into storage once the nav manifest can resolve them.+ // Settles after one pass: normalizeToCurrentPaths returns the SAME list when+ // nothing moved, so the state updates (and the effect's own deps) stop there.+ useEffect(() => {+ const nextPinned = normalizeToCurrentPaths(pinnedPaths, resolveNavEntry);+ if (nextPinned !== pinnedPaths) {+ setPinnedPaths(nextPinned);+ writeList(PINNED_KEY, nextPinned);+ }+ const nextRecent = normalizeToCurrentPaths(recentPaths, resolveNavEntry);+ if (nextRecent !== recentPaths) {+ setRecentPaths(nextRecent);+ writeList(RECENT_KEY, nextRecent);+ }+ }, [resolveNavEntry, pinnedPaths, recentPaths]);+const resolveAll = useCallback((paths) => paths.map((p) => resolveNavEntry(p)).filter(Boolean),[resolveNavEntry],diff --git a/client/src/hooks/useNavWorkingSet.test.jsx b/client/src/hooks/useNavWorkingSet.test.jsxindex d33ad6f3fb..77f3d0bf6a 100644--- a/client/src/hooks/useNavWorkingSet.test.jsx+++ b/client/src/hooks/useNavWorkingSet.test.jsx@@ -42,40 +42,58 @@ describe('useNavWorkingSet', () => {expect(result.current.pinned.map((r) => r.path)).toEqual(['/b']);});- it('migrates the legacy System Health pin to System Resources', () => {- localStorage.setItem(PINNED_KEY, JSON.stringify(['/system-health']));- const { result } = renderHook(() => useNavWorkingSet(resolveNavEntry), { wrapper });-- expect(result.current.pinned.map((row) => row.path)).toEqual(['/system-resources']);- expect(result.current.isPinned('/system-resources')).toBe(true);- });-- it('migrates the whole legacy /city subtree to /openworld', () => {- // The 3D world moved from /city to /openworld. App.jsx redirects the browser URL, but- // the STORED path is what pinned/recent resolve against — without a migration a pinned- // "OpenWorld" row stops matching the manifest and silently vanishes on upgrade.- localStorage.setItem(PINNED_KEY, JSON.stringify(['/city', '/city/settings', '/city/apps/portos']));- const { result } = renderHook(() => useNavWorkingSet(resolveNavEntry), { wrapper });-- expect(result.current.pinned.map((row) => row.path)).toEqual([- '/openworld', '/openworld/settings', '/openworld/apps/portos',- ]);+ // A page that MOVED is the reason a pin used to vanish on an app update: the+ // stored path stopped matching anything and the row silently rendered nothing.+ // Layout's resolver now falls back through the manifest's `previousPaths`, so+ // the hook sees the CURRENT entry for a legacy stored path.+ const movedResolver = (path) => {+ const current = path === '/city' ? '/openworld'+ : path.startsWith('/city/') ? `/openworld${path.slice('/city'.length)}`+ : path;+ return { path: current, label: current.replace('/', ''), icon: ICON };+ };++ it('renders a pin whose page has moved under its current path', () => {+ localStorage.setItem(PINNED_KEY, JSON.stringify(['/city', '/city/settings']));+ const { result } = renderHook(() => useNavWorkingSet(movedResolver), { wrapper });++ expect(result.current.pinned.map((row) => row.path)).toEqual(['/openworld', '/openworld/settings']);expect(result.current.isPinned('/openworld')).toBe(true);});- it('leaves a sibling route that merely starts with the legacy prefix alone', () => {- // The rewrite is segment-anchored: /cityscape is a different page, not /city.- localStorage.setItem(PINNED_KEY, JSON.stringify(['/cityscape']));- const { result } = renderHook(() => useNavWorkingSet(resolveNavEntry), { wrapper });- expect(result.current.pinned.map((row) => row.path)).toEqual(['/cityscape']);+ it('folds the moved path back into storage so unpin() matches the rendered row', () => {+ localStorage.setItem(PINNED_KEY, JSON.stringify(['/city']));+ const { result } = renderHook(() => useNavWorkingSet(movedResolver), { wrapper });+ expect(JSON.parse(localStorage.getItem(PINNED_KEY))).toEqual(['/openworld']);++ act(() => result.current.unpin('/openworld'));+ expect(result.current.pinned).toEqual([]);+ expect(JSON.parse(localStorage.getItem(PINNED_KEY))).toEqual([]);});- it('collapses a legacy path onto its already-migrated twin instead of duplicating', () => {+ it('collapses a moved path onto its already-current twin instead of duplicating', () => {localStorage.setItem(PINNED_KEY, JSON.stringify(['/city', '/openworld']));- const { result } = renderHook(() => useNavWorkingSet(resolveNavEntry), { wrapper });+ const { result } = renderHook(() => useNavWorkingSet(movedResolver), { wrapper });expect(result.current.pinned.map((row) => row.path)).toEqual(['/openworld']);});+ it('leaves a pin the resolver cannot place alone rather than dropping it', () => {+ // The dynamic app/series/universe rows load async, so "unresolvable" is a+ // normal transient state during boot — rewriting or pruning storage on that+ // miss would lose the pin for good.+ localStorage.setItem(PINNED_KEY, JSON.stringify(['/apps/not-loaded-yet']));+ const { result } = renderHook(() => useNavWorkingSet(() => null), { wrapper });++ expect(result.current.pinned).toEqual([]);+ expect(JSON.parse(localStorage.getItem(PINNED_KEY))).toEqual(['/apps/not-loaded-yet']);+ });++ it('migrates recent destinations too', () => {+ localStorage.setItem(RECENT_KEY, JSON.stringify(['/start', '/city/settings']));+ const { result } = renderHook(() => useNavWorkingSet(movedResolver), { wrapper });+ expect(result.current.recent.map((row) => row.path)).toEqual(['/openworld/settings']);+ });+it('excludes pinned and the current path from recent', () => {localStorage.setItem(RECENT_KEY, JSON.stringify(['/start', '/x', '/y']));localStorage.setItem(PINNED_KEY, JSON.stringify(['/x']));diff --git a/client/src/utils/README.md b/client/src/utils/README.mdindex a239993b99..ba173f56c4 100644--- a/client/src/utils/README.md+++ b/client/src/utils/README.md@@ -40,7 +40,7 @@ grep -i "what you want to do" client/src/utils/README.md| `sleep` | `sleep(ms)` — promise-returning `setTimeout` for retry backoffs and race timeouts. Use instead of re-declaring a local `delay`. || `urlNormalize` | `isUrl` detection, `normalizeUrl` (optional git/`requireDot` modes), `isHttpUrl` (explicit http(s) only — safe-href check), and `tiktokVideoId` / `tiktokEmbedSrc` (host-anchored TikTok video-id extraction + its Embed Player URL, so a reference embeds without loading TikTok's embed.js). || `platform` | `isMac` detection and `modKey` (⌘/Ctrl) for keyboard-shortcut display. |-| `navWorkingSet` | Recent/pinned nav persistence (`recordVisit`, `togglePin`, `isPinned`) plus `resolveRecentNavEntries` for mapping stored deep links back to their longest matching nav-manifest entry. |+| `navWorkingSet` | Recent/pinned nav persistence (`recordVisit`, `togglePin`, `isPinned`) plus `resolveRecentNavEntries` for mapping stored deep links back to their longest matching nav-manifest entry. Also `migrateLegacyNavPath(path, commands)` — maps a stored path onto the CURRENT path of the page that used to answer to it, driven by each command's own `previousPaths` (declared in `server/lib/navManifest.js` beside the page that moved, shipped whole in the palette manifest). A pin is a stored route path, so without it a moved page's pin stops matching the manifest and the sidebar row silently vanishes on update. || `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isAntigravityProvider`, `isOrcaRouterBackedProvider` (the OpenCode wrapper that inherits its API key from the sibling `orcarouter` API provider at spawn time), `filterSelectableModels`, `resolveCliEffort` (mirror — what a stored effort actually runs as, so the picker can name a clamped level), `configuredDefaultIn` — the sentinel a provider's catalog carries, so a picker can render an option matching a sentinel-valued tier instead of a blank select — `getProviderTimeout`, `resolveEffectiveProvider` — the provider a record actually runs on (its pin, else the active provider) plus whether it fell back, so a "Default" option can name what it resolves to — `resolveSeriesRunLlm` (mirror of server `seriesLlmOverride.js`: which provider/model a Pipeline **series** run resolves to — per-run override → `series.llm` → active provider) and `providerModelLabel` (the one "Provider / model" phrasing), configured-default sentinels, and the claude/codex/agy thinking-effort levels — `effortLevelsForProvider`, mirror of server `providerModels.js`). Also `isRunnerAllowedCommand(command, allowedCommands)` — would the CoS Agent Runner (`/spawn`, `/spawn-tui`) accept this command? Mirrors only the *normalization* in `server/cos-runner/allowedCommands.js` (the list itself arrives as `runnerAllowedCommands` on `GET /api/providers`, because the allowlist is an exec boundary and stays hand-curated server-side); returns `null` for "list not fetched / field blank" so a failed fetch never renders a warning. Pinned by `server/cos-runner/allowedCommands.parity.test.js`. `isPrivateNetworkEndpoint(endpoint)` — loopback, RFC1918/tailnet address, or a `.local`/`.ts.net`/single-label host, i.e. somewhere an unauthenticated OpenAI-compatible server is a normal setup rather than a missing API key. `isLocalInstanceProvider(provider)` — the narrower question, mirroring server `localProviderRuntime.js#isLocalInstanceEndpoint`: does this provider talk to a daemon on THIS machine (loopback, or no endpoint at all)? Gate anything that explains a provider by inspecting the host PortOS runs on — install state, "start it from Settings → Local LLM" — since `localBackendForProvider` matches by NAME and would otherwise claim a peer's LM Studio. And `credentialSource(provider)` plus `providerCardState(provider, { runtime, status, keySetFor, envVarSet })` + `PROVIDER_CARD_STATE` — is a provider ready to run, benched, blocked on a missing prerequisite (CLI not installed / API key absent / empty credential environment variable), or simply switched off? Reads the SERVER's `missingPrerequisites` (published per provider on `GET /api/providers` from `server/lib/providerPrerequisites.js`, and the same computation `getFallbackProvider` routes on) and adds the local-app runtime shape plus tri-state checks for stored, inherited, and process environment credentials. Unknown lookup values mean "not probed", never "missing". Drives the AI Providers page card colors and grouping — distinct from `ProviderReadiness`/`GET /api/providers/readiness`, which probes the local daemon behind a provider. `resolvesOutsidePortosPath(provider)` — does this provider resolve its binary somewhere the runtime probe never looked (an explicit path in `command`, or its own `PATH` in `envVars`)? Mirror of the same two guards in the server's `providerRuntimeKey`, and what keeps the card's badge from accusing a working provider the router happily routes. And `providerRuntimeKey(provider)` — the key a provider's runtime is published under by `GET /api/providers/runtimes`, so a card can show its CLI install status (bare binary name for a cli/tui provider, provider id for an API provider fronted by a local app); the runtime table itself stays server-side. || `layeredIntelligenceReasons` | Canonical gloss for the Layered Intelligence loop's run-outcome reason tokens, shared by the on-demand toast and the durable "Last run" line (`formatLiReason`, `liReasonTone`, `LI_NEUTRAL_REASONS`). |diff --git a/client/src/utils/navWorkingSet.js b/client/src/utils/navWorkingSet.jsindex ecb6d38933..a1c3241422 100644--- a/client/src/utils/navWorkingSet.js+++ b/client/src/utils/navWorkingSet.js@@ -28,6 +28,41 @@ export const togglePin = (path, list) => {export const isPinned = (path, list) => asList(list).includes(path);+// The static head of a previous path: everything before its first `:param`+// segment. `/media/training/:datasetId` → `/media/training`, so a stored deep+// link into one record matches the subtree its page moved out of.+const staticBase = (previous) => {+ const segments = previous.split('/');+ const param = segments.findIndex((s) => s.startsWith(':'));+ return (param === -1 ? segments : segments.slice(0, param)).join('/').replace(/\/$/, '');+};++// Map a stored path onto the current path of the page that used to answer to it,+// preserving whatever followed (`/media/sprites/s-1` → `/sprites/s-1`).+//+// Driven by each nav command's own `previousPaths` — declared in+// `server/lib/navManifest.js` beside the page that moved and shipped whole in the+// palette manifest — so a move is ONE edit there rather than a second table here+// that can disagree. Returns the path unchanged when no page has moved off it.+//+// This is what keeps a pinned sidebar row alive across an app update: a pin is a+// stored route path, and before this a moved page's old path simply stopped+// matching the manifest, so the row silently rendered nothing.+export const migrateLegacyNavPath = (path, commands) => {+ if (!isPath(path)) return path;+ let best = null;+ for (const command of asList(commands)) {+ if (!isPath(command?.path)) continue;+ for (const previous of asList(command.previousPaths)) {+ const base = staticBase(previous);+ if (!base || !(path === base || path.startsWith(`${base}/`))) continue;+ // Longest base wins, so `/media/universe-builder` beats `/universe-builder`.+ if (!best || base.length > best.base.length) best = { base, to: command.path };+ }+ }+ return best ? `${best.to}${path.slice(best.base.length)}` : path;+};+// Resolve stored recent paths against the server-backed nav manifest. Exact// routes win; deep-link selections fall back to the longest matching base route// while preserving the stored destination path for navigation.@@ -39,7 +74,10 @@ export const resolveRecentNavEntries = (paths, commands, {const seenPaths = new Set();const resolved = [];- for (const path of asList(paths)) {+ for (const stored of asList(paths)) {+ // A page that has MOVED still sits in storage under its old path; resolve+ // that to where it lives now so the destination survives the update.+ const path = migrateLegacyNavPath(stored, commandList);if (!isPath(path) || path === currentPath || seenPaths.has(path)) continue;seenPaths.add(path);diff --git a/client/src/utils/navWorkingSet.test.js b/client/src/utils/navWorkingSet.test.jsindex d08dcbd589..420a0e1e95 100644--- a/client/src/utils/navWorkingSet.test.js+++ b/client/src/utils/navWorkingSet.test.js@@ -1,7 +1,7 @@import { describe, it, expect } from 'vitest';import {RECENT_KEY, PINNED_KEY, RECENT_CAP,- recordVisit, togglePin, isPinned, resolveRecentNavEntries,+ recordVisit, togglePin, isPinned, resolveRecentNavEntries, migrateLegacyNavPath,} from './navWorkingSet.js';describe('navWorkingSet — constants', () => {@@ -60,6 +60,12 @@ describe('resolveRecentNavEntries', () => {]);});+ it('resolves a stored path whose page has moved to where it lives now', () => {+ const moved = [...commands, { id: 'nav.openworld', path: '/openworld', label: 'OpenWorld', previousPaths: ['/city'] }];+ expect(resolveRecentNavEntries(['/city/settings'], moved))+ .toEqual([{ ...moved[4], path: '/openworld/settings' }]);+ });+it('skips the current, stale, duplicate, and unsafe paths while honoring the limit', () => {expect(resolveRecentNavEntries(['/apps', '/missing', '/apps/example', '/apps/example', '//example.com'],@@ -69,6 +75,50 @@ describe('resolveRecentNavEntries', () => {});});+describe('migrateLegacyNavPath', () => {+ // Shaped like the real manifest: `previousPaths` is declared on the entry that+ // moved (server/lib/navManifest.js) and ships whole in the palette payload.+ const commands = [+ { id: 'nav.openworld', path: '/openworld', label: 'OpenWorld', previousPaths: ['/city'] },+ { id: 'nav.sprites', path: '/sprites', label: 'Sprites', previousPaths: ['/media/sprites', '/media/sprites/:id'] },+ { id: 'nav.universes', path: '/universes', label: 'Universes', previousPaths: ['/media/universe-builder', '/universe-builder'] },+ { id: 'nav.cityscape', path: '/cityscape', label: 'Cityscape' },+ ];++ it('maps a moved page onto its current path', () => {+ expect(migrateLegacyNavPath('/city', commands)).toBe('/openworld');+ expect(migrateLegacyNavPath('/media/sprites', commands)).toBe('/sprites');+ });++ it('carries the trailing path across, including a subtree the manifest never spells out', () => {+ // `/media/sprites/:id` declares the deep link; `/city/settings` is covered by+ // the bare `/city` base the same way App.jsx's `city/*` redirect covers it.+ expect(migrateLegacyNavPath('/media/sprites/s-1', commands)).toBe('/sprites/s-1');+ expect(migrateLegacyNavPath('/city/apps/portos', commands)).toBe('/openworld/apps/portos');+ });++ it('is segment-anchored, so a sibling route that merely shares a prefix is untouched', () => {+ expect(migrateLegacyNavPath('/cityscape', commands)).toBe('/cityscape');+ });++ it('prefers the longest matching previous path', () => {+ expect(migrateLegacyNavPath('/media/universe-builder/u-1', commands)).toBe('/universes/u-1');+ expect(migrateLegacyNavPath('/universe-builder/u-1', commands)).toBe('/universes/u-1');+ });++ it('returns a current path, an unknown path, and a non-path unchanged', () => {+ expect(migrateLegacyNavPath('/openworld', commands)).toBe('/openworld');+ expect(migrateLegacyNavPath('/whatever', commands)).toBe('/whatever');+ expect(migrateLegacyNavPath('//example.com', commands)).toBe('//example.com');+ expect(migrateLegacyNavPath(null, commands)).toBe(null);+ });++ it('tolerates an absent or malformed manifest', () => {+ expect(migrateLegacyNavPath('/city', undefined)).toBe('/city');+ expect(migrateLegacyNavPath('/city', [null, { path: '/x', previousPaths: 'nope' }])).toBe('/city');+ });+});+describe('togglePin / isPinned', () => {it('adds a path when absent', () => {expect(togglePin('/a', [])).toEqual(['/a']);diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex 2095f5d8b9..cc137fa32e 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -55,39 +55,39 @@ const OPEN_WORLD_REGION_COMMANDS = [export const NAV_COMMANDS = [{ id: 'nav.dashboard', path: '/', label: 'Dashboard', section: 'Main', aliases: ['dashboard', 'home'], keywords: ['overview', 'start'] },{ id: 'nav.review-hub', path: '/review', label: 'Review Hub', section: 'Main', aliases: ['review', 'review-hub'] },- { id: 'nav.cybercity', path: '/openworld', label: 'OpenWorld', section: 'Main', aliases: ['openworld', 'open world', 'open-world', 'city'], keywords: ['3d', 'visualization', 'game', 'map', 'explore'] },+ { id: 'nav.cybercity', path: '/openworld', label: 'OpenWorld', section: 'Main', previousPaths: ['/city'], aliases: ['openworld', 'open world', 'open-world', 'city'], keywords: ['3d', 'visualization', 'game', 'map', 'explore'] },{ id: 'nav.cybercity.settings', path: '/openworld/settings', label: 'OpenWorld Settings', section: 'Main', aliases: ['openworld settings', 'open world settings', 'world settings', 'city settings', 'city-settings', 'openworld-config'], keywords: ['openworld', 'settings', '3d', 'configure', 'world style', 'low poly'] },...OPEN_WORLD_REGION_COMMANDS,{ id: 'nav.apps', path: '/apps', label: 'Apps', section: 'Main', aliases: ['apps'] },// Submodules are per-app (a tab on the app detail page), so this entry is// explicitly PortOS's own — the only repo whose app id is a fixed constant.// Every other app reaches its tab from /apps/<id>/submodules.- { id: 'nav.apps.submodules', path: `/apps/${PORTOS_APP_ID}/submodules`, label: 'PortOS Submodules', section: 'Apps', aliases: ['submodules', 'devtools-submodules', 'portos-submodules'], keywords: ['git', 'slashdo', 'vendored', 'update submodule'] },+ { id: 'nav.apps.submodules', path: `/apps/${PORTOS_APP_ID}/submodules`, label: 'PortOS Submodules', section: 'Apps', previousPaths: ['/devtools/submodules'], aliases: ['submodules', 'devtools-submodules', 'portos-submodules'], keywords: ['git', 'slashdo', 'vendored', 'update submodule'] },{ id: 'nav.templates', path: '/templates', label: 'Templates', section: 'Main', aliases: ['templates', 'app-templates'], keywords: ['app template', 'create app', 'pre-configured', 'starter'] },{ id: 'nav.catalog', path: '/catalog', label: 'Catalog', section: 'Create', aliases: ['catalog', 'ingredients', 'cast', 'creative-catalog'], keywords: ['character', 'place', 'object', 'idea', 'scene', 'concept', 'inventory', 'reference', 'creative'] },{ id: 'nav.catalog.ingest', path: '/catalog/ingest', label: 'Catalog Ingest', section: 'Create', aliases: ['catalog-ingest', 'ingest', 'paste-scrap', 'extract-ingredients'], keywords: ['paste', 'snippet', 'scene', 'idea', 'extract', 'scrap', 'import-catalog'] },{ id: 'nav.media', path: '/media/image', label: 'Media Gen', section: 'Create', aliases: ['media', 'media-gen', 'mediagen', 'generate'], keywords: ['image', 'video', 'render', 'art', 'movie'] },- { id: 'nav.media.image', path: '/media/image', label: 'Image', section: 'Create', aliases: ['image-gen', 'imagegen', 'generate-image', 'sd', 'stable-diffusion'], keywords: ['stable diffusion', 'render', 'art', 'picture', 'photo', 'draw', 'flux', 'mflux'] },- { id: 'nav.media.video', path: '/media/video', label: 'Video', section: 'Create', aliases: ['video-gen', 'videogen', 'generate-video', 'ltx'], keywords: ['video', 'animate', 'movie', 'clip', 'ltx'] },- { id: 'nav.media.history', path: '/media/history', label: 'Media History', section: 'Create', aliases: ['media-history', 'video-history'], keywords: ['videos', 'gallery', 'stitch'] },- { id: 'nav.media.annotate', path: '/media/annotate', label: 'Annotate', section: 'Create', aliases: ['annotate', 'media-annotate', 'sketch', 'draw-over', 'markup'], keywords: ['annotation', 'sketch', 'draw', 'markup', 'scribble', 'label', 'canvas', 'overlay', 'stroke'] },+ { id: 'nav.media.image', path: '/media/image', label: 'Image', section: 'Create', previousPaths: ['/image-gen'], aliases: ['image-gen', 'imagegen', 'generate-image', 'sd', 'stable-diffusion'], keywords: ['stable diffusion', 'render', 'art', 'picture', 'photo', 'draw', 'flux', 'mflux'] },+ { id: 'nav.media.video', path: '/media/video', label: 'Video', section: 'Create', previousPaths: ['/video-gen'], aliases: ['video-gen', 'videogen', 'generate-video', 'ltx'], keywords: ['video', 'animate', 'movie', 'clip', 'ltx'] },+ { id: 'nav.media.history', path: '/media/history', label: 'Media History', section: 'Create', previousPaths: ['/media-history'], aliases: ['media-history', 'video-history'], keywords: ['videos', 'gallery', 'stitch'] },+ { id: 'nav.media.annotate', path: '/media/annotate', label: 'Annotate', section: 'Create', previousPaths: ['/annotate', '/annotate/:mediaKey'], aliases: ['annotate', 'media-annotate', 'sketch', 'draw-over', 'markup'], keywords: ['annotation', 'sketch', 'draw', 'markup', 'scribble', 'label', 'canvas', 'overlay', 'stroke'] },{ id: 'nav.media.collections', path: '/media/collections', label: 'Collections', section: 'Create', aliases: ['collections', 'media-collections', 'stacks', 'projects'], keywords: ['bucket', 'group', 'project', 'album', 'organize'] },- { id: 'nav.create.creative-director', path: '/creative-director', label: 'Creative Director', section: 'Create', aliases: ['creative-director', 'creative', 'director', 'producer', 'orchestrator', 'long-form', 'episode'], keywords: ['story', 'episode', 'narrative', 'agent', 'auto-video', 'long-form', 'directive', 'production plan', 'plan board', 'orchestrator', 'studio', 'producer'] },+ { id: 'nav.create.creative-director', path: '/creative-director', label: 'Creative Director', section: 'Create', previousPaths: ['/media/creative-director', '/media/creative-director/:id', '/media/creative-director/:id/:tab'], aliases: ['creative-director', 'creative', 'director', 'producer', 'orchestrator', 'long-form', 'episode'], keywords: ['story', 'episode', 'narrative', 'agent', 'auto-video', 'long-form', 'directive', 'production plan', 'plan board', 'orchestrator', 'studio', 'producer'] },{ id: 'nav.create.creative-commission', path: '/creative-commission', label: 'Creative Commissions', section: 'Create', aliases: ['creative-commission', 'commissions', 'commission', 'creation-engine', 'autonomous-creation', 'standing-brief', 'recurring-brief'], keywords: ['schedule', 'recurring', 'nightly', 'brief', 'autonomous', 'creation engine', 'cron', 'feedback', 'taste', 'standing commission', 'auto-generate'] },{ id: 'nav.create.fableloom', path: '/fableloom', label: 'FableLoom', section: 'Create', aliases: ['fableloom', 'fable-loom', 'loom', 'branching-narrative', 'interactive-story', 'branching-story'], keywords: ['branching', 'interactive', 'narrative', 'intent', 'endings', 'reader', 'scene', 'node', 'graph', 'nonlinear', 'play', 'story graph'] },{ id: 'nav.create.game', path: '/game', label: 'Game', section: 'Create', aliases: ['game', 'games', 'game-studio'], keywords: ['managed app', 'sprite', 'atlas', 'music', 'asset bundle', 'manifest', 'feedback'] },- { id: 'nav.create.music-video', path: '/music-video', label: 'Music Video', section: 'Create', aliases: ['music-video', 'musicvideo', 'music video', 'mv', 'sync-to-beat'], keywords: ['music', 'beat', 'sync', 'audio-reactive', 'director', 'scene board', 'tempo', 'choreography'] },+ { id: 'nav.create.music-video', path: '/music-video', label: 'Music Video', section: 'Create', previousPaths: ['/media/music-video', '/media/music-video/:projectId'], aliases: ['music-video', 'musicvideo', 'music video', 'mv', 'sync-to-beat'], keywords: ['music', 'beat', 'sync', 'audio-reactive', 'director', 'scene board', 'tempo', 'choreography'] },{ id: 'nav.create.mood-boards', path: '/mood-boards', label: 'Mood Boards', section: 'Create', aliases: ['mood-boards', 'mood-board', 'moodboard', 'mood', 'inspiration', 'references'], keywords: ['inspiration', 'reference', 'pin', 'visual', 'canvas', 'collect', 'pinboard', 'palette', 'ideas'] },// Promoted out of the Media Gen tabs to a top-level Create page (#2930).// The id stays `nav.media.sprites` — it's opaque and stored in palette// 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.sprites', path: '/sprites', label: 'Sprites', section: 'Create', previousPaths: ['/media/sprites', '/media/sprites/:id'], 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.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', 'render', 'generate', 'pbr'] },+ { id: 'nav.create.3d', path: '/3d', label: '3D', section: 'Create', previousPaths: ['/media/3d', '/media/3d/:id'], 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.universe-builder', path: '/universes', label: 'Universes', section: 'Create', previousPaths: ['/media/universe-builder', '/media/universe-builder/:universeId', '/universe-builder', '/universe-builder/:universeId'], 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'] },{ id: 'nav.create.pipeline', path: '/pipeline', label: 'Series Pipeline', section: 'Create', aliases: ['series', 'pipeline', 'production', 'series-pipeline', 'production-pipeline'], keywords: ['series', 'issue', 'episode', 'comic', 'script', 'prose', 'storyboard', 'narrative', 'workflow'] },{ id: 'nav.create.pipeline.editorial-checks', path: '/pipeline/editorial-checks', label: 'Editorial Checks', section: 'Create', aliases: ['editorial-checks', 'editorial', 'checks', 'editorial-review', 'content-checks', 'manuscript-checks'], keywords: ['editorial', 'check', 'review', 'naming', 'exposition', 'info-dumping', 'continuity', 'quality', 'lint', 'triage', 'findings', 'deterministic', 'llm'] },@@ -146,7 +146,7 @@ export const NAV_COMMANDS = [{ id: 'nav.cos.health', path: '/cos/health', label: 'Health', section: 'Chief of Staff', aliases: ['cos-health', 'health'] },{ id: 'nav.cos.learning', path: '/cos/learning', label: 'Learning', section: 'Chief of Staff', aliases: ['cos-learning'] },{ id: 'nav.cos.memory', path: '/cos/memory', label: 'Memory', section: 'Chief of Staff', aliases: ['cos-memory'] },- { id: 'nav.cos.runs', path: '/cos/runs', label: 'Runs', section: 'Chief of Staff', aliases: ['runs', 'ai-runs', 'cos-runs', 'recent-runs', 'run-history'], keywords: ['runs', 'run history', 'recent runs', 'ai runs', 'agent runs', 'failed runs'] },+ { id: 'nav.cos.runs', path: '/cos/runs', label: 'Runs', section: 'Chief of Staff', previousPaths: ['/devtools/runs'], aliases: ['runs', 'ai-runs', 'cos-runs', 'recent-runs', 'run-history'], keywords: ['runs', 'run history', 'recent runs', 'ai runs', 'agent runs', 'failed runs'] },{ id: 'nav.cos.run-events', path: '/cos/run-events', label: 'Run Events', section: 'Chief of Staff', aliases: ['run-events', 'cos-run-events', 'run-event-ledger', 'lifecycle-events'], keywords: ['run events', 'lifecycle', 'ledger', 'replay', 'diagnostics', 'orphaned', 'handoff', 'reconnect', 'interrupted', 'why did this run fail'] },{ id: 'nav.cos.schedule', path: '/cos/schedule', label: 'Schedule', section: 'Chief of Staff', aliases: ['schedule', 'cos-schedule'] },{ id: 'nav.social-agents', path: '/agents', label: 'Social Agents', section: 'Chief of Staff', aliases: ['social-agents'] },@@ -158,8 +158,8 @@ export const NAV_COMMANDS = [{ id: 'nav.messages.inbox', path: '/messages/inbox', label: 'Inbox', section: 'Comms', aliases: ['messages', 'comms', 'comms-inbox'], keywords: ['comms', 'email', 'inbox'] },{ id: 'nav.messages.drafts', path: '/messages/drafts', label: 'Drafts', section: 'Comms', aliases: ['drafts', 'comms-drafts'], keywords: ['comms'] },- { id: 'nav.messages.imessage', path: '/messages/imessage', label: 'iMessage', section: 'Comms', aliases: ['imessage', 'i-message', 'apple-messages', 'comms-imessage'], keywords: ['comms', 'imessage', 'sms', 'text messages', 'chat.db', 'blocklist', 'spam'] },- { id: 'nav.messages.contacts', path: '/messages/contacts', label: 'Contacts', section: 'Comms', aliases: ['contacts', 'address-book', 'comms-contacts', 'settings-contacts'], keywords: ['comms', 'contacts', 'address book', 'phone', 'email', 'tribe', 'imessage', 'names', 'resolve'] },+ { id: 'nav.messages.imessage', path: '/messages/imessage', label: 'iMessage', section: 'Comms', previousPaths: ['/imessage'], aliases: ['imessage', 'i-message', 'apple-messages', 'comms-imessage'], keywords: ['comms', 'imessage', 'sms', 'text messages', 'chat.db', 'blocklist', 'spam'] },+ { id: 'nav.messages.contacts', path: '/messages/contacts', label: 'Contacts', section: 'Comms', previousPaths: ['/settings/contacts'], aliases: ['contacts', 'address-book', 'comms-contacts', 'settings-contacts'], keywords: ['comms', 'contacts', 'address book', 'phone', 'email', 'tribe', 'imessage', 'names', 'resolve'] },// Ingestion config is a drawer over the iMessage manager (?settings=1), not a// Settings page — the settings-* aliases stay so "open iMessage settings" still lands.{ id: 'nav.messages.imessage-settings', path: '/messages/imessage?settings=1', label: 'iMessage Settings', section: 'Comms', aliases: ['settings-imessage', 'imessage-settings', 'imessage-sync'], keywords: ['imessage', 'sync', 'chat.db', 'sms', 'texts', 'tribe', 'timeline', 'full disk access'] },@@ -173,12 +173,12 @@ export const NAV_COMMANDS = [{ id: 'nav.devtools.agents', path: '/devtools/agents', label: 'AI Agents', section: 'Dev Tools', aliases: ['ai-agents', 'devtools'] },{ id: 'nav.browser', path: '/browser', label: 'Browser', section: 'Dev Tools', aliases: ['browser'] },{ id: 'nav.devtools.runner', path: '/devtools/runner', label: 'Code', section: 'Dev Tools', aliases: ['devtools-runner'] },- { id: 'nav.devtools.datadog', path: '/devtools/datadog', label: 'DataDog', section: 'Dev Tools', aliases: ['datadog', 'devtools-datadog'] },+ { id: 'nav.devtools.datadog', path: '/devtools/datadog', label: 'DataDog', section: 'Dev Tools', previousPaths: ['/datadog'], aliases: ['datadog', 'devtools-datadog'] },{ id: 'nav.devtools.flows', path: '/devtools/flows', label: 'Flows', section: 'Dev Tools', aliases: ['flows', 'integration-flows', 'workflows'], keywords: ['architecture', 'diagram', 'data flow', 'integrations', 'how it works'] },{ id: 'nav.devtools.github', path: '/devtools/github', label: 'GitHub', section: 'Dev Tools', aliases: ['github', 'devtools-github'] },{ id: 'nav.devtools.history', path: '/devtools/history', label: 'History', section: 'Dev Tools', aliases: ['devtools-history'] },{ id: 'nav.devtools.image-clean', path: '/devtools/image-clean', label: 'Image Cleaner', section: 'Dev Tools', aliases: ['image-clean', 'image-cleaner'], keywords: ['metadata', 'c2pa', 'content-credentials', 'sharp', 'denoise'] },- { id: 'nav.devtools.jira', path: '/devtools/jira', label: 'JIRA', section: 'Dev Tools', aliases: ['jira', 'devtools-jira'] },+ { id: 'nav.devtools.jira', path: '/devtools/jira', label: 'JIRA', section: 'Dev Tools', previousPaths: ['/jira'], aliases: ['jira', 'devtools-jira'] },{ id: 'nav.devtools.jira-reports', path: '/devtools/jira/reports', label: 'JIRA Reports', section: 'Dev Tools', aliases: ['jira-reports'] },{ id: 'nav.devtools.quota-burn', path: '/devtools/quota-burn', label: 'Quota Burn', section: 'Dev Tools', aliases: ['quota-burn', 'burn-quota', 'quota'], keywords: ['subscription', 'usage', 'reset window', 'spend quota', 'claude', 'codex', 'grok', 'agy', 'burn'] },{ id: 'nav.shell', path: '/shell', label: 'Shell', section: 'Dev Tools', aliases: ['shell', 'terminal'] },@@ -318,7 +318,7 @@ export const NAV_COMMANDS = [{ id: 'nav.loops', path: '/loops', label: 'Loops', section: 'Dev Tools', aliases: ['loops'] },{ id: 'nav.devtools.processes', path: '/devtools/processes', label: 'Processes', section: 'Dev Tools', aliases: ['devtools-processes', 'processes'] },{ 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', 'build', 'commit', 'running build', 'stale build', 'which code is running'] },+ { id: 'nav.system-health', path: '/system-resources/overview', label: 'System Resources', section: 'Dev Tools', previousPaths: ['/system-health'], aliases: ['system-resources', 'system-health', 'system-status', 'memory-usage', 'cpu-usage'], keywords: ['health', 'memory', 'cpu', 'disk', 'thresholds', 'top processes', 'resource usage', 'build', 'commit', 'running build', 'stale build', 'which code is running'] },{ 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.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'] },diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.jsindex 46fecde4f8..3b8f1faff0 100644--- a/server/lib/navManifest.test.js+++ b/server/lib/navManifest.test.js@@ -3,6 +3,7 @@ import fs from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';import { NAV_COMMANDS, getNavAliasMap, resolveNavCommand } from './navManifest.js';+import { PORTOS_APP_ID } from './appIdentity.js';const __dirname = path.dirname(fileURLToPath(import.meta.url));const REPO_ROOT = path.resolve(__dirname, '..', '..');@@ -501,13 +502,16 @@ function scanRoutes(appSrc) {// 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.+ // where each forwarding route points. `to` is read off the same line — as a+ // plain string, or as a template literal whose only interpolation is the+ // PortOS app id (`/apps/${PORTOS_APP_ID}/submodules`). A `from`-only wrapper+ // (CanonRedirect) records nothing rather than a bogus target.const redirectElement = line.match(REDIRECT_ELEMENT);if (redirectElement) {- const to = line.match(/\bto="([^"]*)"/);- if (to) redirects.push({ from: absolute, to: to[1], element: redirectElement[1] });+ const quoted = line.match(/\bto="([^"]*)"/);+ const templated = line.match(/\bto=\{`([^`]*)`\}/);+ const to = quoted?.[1] ?? templated?.[1]?.replace('${PORTOS_APP_ID}', PORTOS_APP_ID);+ if (to) redirects.push({ from: absolute, to, element: redirectElement[1] });continue;}@@ -585,6 +589,28 @@ describe('nav coverage — every navigable App.jsx route has a manifest entry',// The dataset workbench was its own deep-linkable path, and a bookmark into// one dataset breaks just as silently as the index.'/media/training/:datasetId',+ // The rest of the moves App.jsx already redirected but nothing declared.+ // A pinned sidebar row is a STORED route path, so an undeclared move made+ // the pin stop resolving and vanish on the next update — the client reads+ // these to map a stored path onto where its page lives now.+ '/city', // OpenWorld's rename (whole subtree)+ '/devtools/submodules',+ '/devtools/runs',+ '/settings/contacts',+ '/imessage',+ '/system-health',+ '/datadog',+ '/jira',+ '/image-gen',+ '/video-gen',+ '/media-history',+ '/annotate', '/annotate/:mediaKey',+ '/media/sprites', '/media/sprites/:id',+ '/media/3d', '/media/3d/:id',+ '/media/creative-director', '/media/creative-director/:id/:tab',+ '/media/music-video', '/media/music-video/:projectId',+ '/media/universe-builder', '/media/universe-builder/:universeId',+ '/universe-builder', '/universe-builder/:universeId',].filter((p) => !declared.has(p));expect(missing).toEqual([]);});