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
feat: nest Casting, Environments, and Objects under Catalog as 3rd-level navigation
[._.]/ Adam Eivy082abf66f1b8
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex bcfc746ca5..899a82b801 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -131,6 +131,7 @@ const navRowForPath = (path) => {section: command.section,feature: command.feature,...(command.navGroup ? { navGroup: command.navGroup } : {}),+ ...(command.parentPath ? { parentPath: command.parentPath } : {}),...NAV_PRESENTATION[path],};};@@ -149,7 +150,7 @@ const pathWithinRow = (pathname, rowPath) => {const sectionNavItem = (section) => {const children = presentedNavRows- .filter((row) => row.section === section && !row.single)+ .filter((row) => row.section === section && !row.single && !row.parentPath).concat(LOCAL_SECTION_ROWS[section] || []).sort((a, b) => a.label.localeCompare(b.label));const sharedFeature = children[0]?.feature@@ -425,6 +426,24 @@ export default function Layout() {})),};};+ const decorateParentChild = (child) => {+ const parentGrandChildren = presentedNavRows+ .filter((row) => row.parentPath === child.to)+ .sort((a, b) => a.label.localeCompare(b.label))+ .map((row) => ({+ to: row.to,+ label: row.label,+ title: row.label,+ activePathPrefix: row.to,+ }));+ if (parentGrandChildren.length > 0) {+ return {+ ...child,+ grandChildren: parentGrandChildren,+ };+ }+ return child;+ };// Feature gate, applied before any decoration: a disabled feature drops its// whole section (POST) or just its tagged rows (DataDog, JIRA), and a// section left with no navigable child disappears with them. Sections that@@ -454,7 +473,7 @@ export default function Layout() {};}if (Array.isArray(item.children)) {- return { ...item, children: item.children.map((c) => decoratePipelineChild(decorateUniverseChild(c))) };+ return { ...item, children: item.children.map((c) => decorateParentChild(decoratePipelineChild(decorateUniverseChild(c)))) };}return item;});@@ -505,7 +524,11 @@ export default function Layout() {resolvedNavItems.forEach(item => {if (item.children) {const isChildActive = item.children.some(child =>- child.to && pathWithinRow(location.pathname, child.to)+ (child.to && pathWithinRow(location.pathname, child.to)) ||+ (Array.isArray(child.grandChildren) && child.grandChildren.some(gc => {+ const prefix = gc.activePathPrefix || gc.to;+ return location.pathname === prefix || location.pathname.startsWith(prefix + '/');+ })));if (isChildActive) {setExpandedSections(prev => ({ ...prev, [item.label]: true }));@@ -558,7 +581,13 @@ export default function Layout() {return isActive(item.to);}if (item.children) {- return item.children.some(child => child.to && isActive(child.to));+ return item.children.some(child =>+ (child.to && isActive(child.to)) ||+ (Array.isArray(child.grandChildren) && child.grandChildren.some(gc => {+ const prefix = gc.activePathPrefix || gc.to;+ return location.pathname === prefix || location.pathname.startsWith(prefix + '/');+ }))+ );}return false;};@@ -1042,6 +1071,30 @@ export default function Layout() {<ChildIcon size={16} className="shrink-0 mt-0.5" aria-hidden="true" /><span className="min-w-0 break-words leading-snug">{child.label}</span></NavLink>+ {child.grandChildren && child.grandChildren.length > 0 && (+ <ul className="ml-7 my-0.5 border-l border-port-border/50 pl-2">+ {child.grandChildren.map((gc) => {+ const prefix = gc.activePathPrefix || gc.to;+ const gcActive = location.pathname === prefix || location.pathname.startsWith(prefix + '/');+ return (+ <li key={`flyout-gc-${gc.to}`}>+ <NavLink+ to={gc.to}+ onClick={() => setFlyoutSection(null)}+ title={gc.title || gc.label}+ className={`block px-2 py-1 rounded text-xs transition-colors min-w-0 break-words leading-snug ${+ gcActive+ ? 'text-port-accent font-medium'+ : 'text-gray-400 hover:text-white hover:bg-port-border/30'+ }`}+ >+ {gc.label}+ </NavLink>+ </li>+ );+ })}+ </ul>+ )}</li>);})}diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsxindex 517ab1c24d..377c830921 100644--- a/client/src/components/Layout.test.jsx+++ b/client/src/components/Layout.test.jsx@@ -606,6 +606,37 @@ describe('Layout — dynamic third-level navigation', () => {expect(screen.getByRole('link', { name: 'Example Universe' })).toBeTruthy();});+ it('renders Casting, Environments, and Objects as 3rd-level sub-pages under Catalog in Create', async () => {+ await renderLayout('/catalog');++ const collapseCatalog = screen.getByRole('button', { name: 'Collapse Catalog' });+ expect(collapseCatalog).toBeInTheDocument();++ expect(screen.getByRole('link', { name: 'Casting' })).toHaveAttribute('href', '/casting');+ expect(screen.getByRole('link', { name: 'Environments' })).toHaveAttribute('href', '/environments');+ expect(screen.getByRole('link', { name: 'Objects' })).toHaveAttribute('href', '/objects');++ fireEvent.click(collapseCatalog);+ expect(screen.queryByRole('link', { name: 'Casting' })).toBeNull();+ expect(screen.queryByRole('link', { name: 'Environments' })).toBeNull();+ expect(screen.queryByRole('link', { name: 'Objects' })).toBeNull();++ fireEvent.click(screen.getByRole('button', { name: 'Expand Catalog' }));+ expect(screen.getByRole('link', { name: 'Casting' })).toHaveAttribute('href', '/casting');+ expect(screen.getByRole('link', { name: 'Environments' })).toHaveAttribute('href', '/environments');+ expect(screen.getByRole('link', { name: 'Objects' })).toHaveAttribute('href', '/objects');+ });++ it('auto-expands Create and Catalog when visiting a grandchild route', async () => {+ await renderLayout('/casting');++ expect(screen.getByRole('button', { name: 'Collapse Create' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Collapse Catalog' })).toBeInTheDocument();+ const castingLink = screen.getByRole('link', { name: 'Casting' });+ expect(castingLink).toHaveAttribute('href', '/casting');+ expect(castingLink.className).toContain('text-port-accent');+ });+it('updates dynamic apps navigation when apps:changed is emitted', async () => {let appsChangedHandler;socket.on.mockImplementation((event, handler) => {diff --git a/client/src/lib/creativeLibraries.js b/client/src/lib/creativeLibraries.jsindex a5e3226c83..7722feee91 100644--- a/client/src/lib/creativeLibraries.js+++ b/client/src/lib/creativeLibraries.js@@ -1,7 +1,16 @@+import { Sparkles, Drama, Mountain, Package } from 'lucide-react';+// Casting, Environments and Objects: focused library pages over the catalog's// character, place and object ingredients. The catalog row stays the single// record; these entries only say which page owns a type and how to name it.+export const CATALOG_NAV_TABS = Object.freeze([+ Object.freeze({ id: 'catalog', label: 'Catalog', to: '/catalog', icon: Sparkles }),+ Object.freeze({ id: 'casting', label: 'Casting', to: '/casting', icon: Drama }),+ Object.freeze({ id: 'environments', label: 'Environments', to: '/environments', icon: Mountain }),+ Object.freeze({ id: 'objects', label: 'Objects', to: '/objects', icon: Package }),+]);+// `detailTabs` are the record page's sections (`/casting/:id/:tab`); the// first is the default and an unknown tab falls back to it.const tab = (id, label) => Object.freeze({ id, label });diff --git a/client/src/pages/Catalog.jsx b/client/src/pages/Catalog.jsxindex 1b9639dd75..1e73103b50 100644--- a/client/src/pages/Catalog.jsx+++ b/client/src/pages/Catalog.jsx@@ -21,6 +21,7 @@ import { Sparkles, Plus, Search, FileInput, Loader2, RefreshCw, Wand2, X, Layoutimport BrailleSpinner from '../components/BrailleSpinner';import Drawer from '../components/Drawer';import PageHeader from '../components/PageHeader';+import RouteTabsHeader from '../components/ui/RouteTabsHeader';import toast from '../components/ui/Toast';import {listCatalogIngredients,@@ -39,6 +40,7 @@ import CatalogCard from '../components/catalog/CatalogCard';import CatalogAlbum from '../components/catalog/CatalogAlbum';import { CatalogTypesTab } from '../components/settings/CatalogTypesTab';import { catalogRefRoleForType } from '../lib/catalogTypes';+import { CATALOG_NAV_TABS } from '../lib/creativeLibraries';import { useCatalogTypes } from '../hooks/useCatalogTypes.jsx';import useDrawerTab from '../hooks/useDrawerTab';import useUrlParams from '../hooks/useUrlParams';@@ -625,6 +627,9 @@ export default function Catalog() {</div>)}/>+ <div className="shrink-0">+ <RouteTabsHeader tabs={CATALOG_NAV_TABS} activeTab="catalog" ariaLabel="Catalog sections" />+ </div><div className="flex-1 min-h-0 overflow-auto p-4">{/* Search sits directly under the header so the primary way to find aningredient stays above the fold on a phone, ahead of the filters. */}diff --git a/client/src/pages/Catalog.test.jsx b/client/src/pages/Catalog.test.jsxindex b0dae3decc..1f2d0e46df 100644--- a/client/src/pages/Catalog.test.jsx+++ b/client/src/pages/Catalog.test.jsx@@ -573,4 +573,13 @@ describe('Catalog page', () => {expect(btn.textContent.startsWith(visiblePrefix)).toBe(true);}});++ it('renders section navigation tabs linking to Catalog, Casting, Environments, and Objects', async () => {+ renderCatalog();+ await act(async () => {});+ expect(screen.getByRole('tab', { name: 'Catalog' })).toHaveAttribute('aria-selected', 'true');+ expect(screen.getByRole('tab', { name: 'Casting' })).toHaveAttribute('aria-selected', 'false');+ expect(screen.getByRole('tab', { name: 'Environments' })).toHaveAttribute('aria-selected', 'false');+ expect(screen.getByRole('tab', { name: 'Objects' })).toHaveAttribute('aria-selected', 'false');+ });});diff --git a/client/src/pages/CreativeLibrary.jsx b/client/src/pages/CreativeLibrary.jsxindex eeb010c4c3..c412b2ed54 100644--- a/client/src/pages/CreativeLibrary.jsx+++ b/client/src/pages/CreativeLibrary.jsx@@ -11,6 +11,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';import { Link, useNavigate } from 'react-router';import { Drama, Mountain, Package, Plus, Search, Loader2, Sparkles, Library, Import } from 'lucide-react';import PageHeader from '../components/PageHeader';+import RouteTabsHeader from '../components/ui/RouteTabsHeader';import MediaImage from '../components/MediaImage';import InfiniteScrollFooter from '../components/ui/InfiniteScrollFooter';import toast from '../components/ui/Toast';@@ -19,7 +20,7 @@ import { useCatalogTypes } from '../hooks/useCatalogTypes.jsx';import { usePagedCollection } from '../hooks/usePagedCollection';import useUrlParams from '../hooks/useUrlParams';import useCancelableDebounce from '../hooks/useCancelableDebounce';-import { libraryById, ingredientPath, ingredientCoverUrl, usageSummary } from '../lib/creativeLibraries';+import { libraryById, ingredientPath, ingredientCoverUrl, usageSummary, CATALOG_NAV_TABS } from '../lib/creativeLibraries';import { formatCount } from '../utils/formatters';const PAGE_SIZE = 48;@@ -121,20 +122,16 @@ export default function CreativeLibrary({ libraryId }) {)}actions={(<div className="flex items-center gap-2">- <Link- to="/casting/import"- aria-label="Import from music videos"- title="Import from music videos"- className="inline-flex items-center gap-1.5 px-3 py-2 min-h-[40px] rounded-lg border border-port-border bg-port-card hover:bg-port-bg text-gray-300 hover:text-white text-sm"- >- <Import size={16} aria-hidden="true" /> <span className="hidden sm:inline">From videos</span>- </Link>- <Link- to={`/catalog?type=${encodeURIComponent(library.type)}`}- className="inline-flex items-center gap-1.5 px-3 py-2 min-h-[40px] rounded-lg border border-port-border bg-port-card hover:bg-port-bg text-gray-300 hover:text-white text-sm"- >- <Library size={16} aria-hidden="true" /> Catalog- </Link>+ {library.id === 'casting' && (+ <Link+ to="/casting/import"+ aria-label="Import from music videos"+ title="Import from music videos"+ className="inline-flex items-center gap-1.5 px-3 py-2 min-h-[40px] rounded-lg border border-port-border bg-port-card hover:bg-port-bg text-gray-300 hover:text-white text-sm"+ >+ <Import size={16} aria-hidden="true" /> <span className="hidden sm:inline">From videos</span>+ </Link>+ )}<buttontype="button"onClick={() => setShowForm((v) => !v)}@@ -145,6 +142,9 @@ export default function CreativeLibrary({ libraryId }) {</div>)}/>+ <div className="shrink-0">+ <RouteTabsHeader tabs={CATALOG_NAV_TABS} activeTab={library.id} ariaLabel="Catalog sections" />+ </div><div className="flex-1 min-h-0 overflow-auto p-3 sm:p-4 flex flex-col gap-3">{showForm && (<form onSubmit={handleCreate} className="p-3 bg-port-card border border-port-border rounded-lg flex flex-col gap-3">diff --git a/client/src/pages/CreativeLibrary.test.jsx b/client/src/pages/CreativeLibrary.test.jsxindex cbe358c280..5d3cafe2c6 100644--- a/client/src/pages/CreativeLibrary.test.jsx+++ b/client/src/pages/CreativeLibrary.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach } from 'vitest';-import { render, screen, fireEvent, waitFor } from '@testing-library/react';+import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';import { MemoryRouter } from 'react-router';const navigateMock = vi.hoisted(() => vi.fn());@@ -85,4 +85,17 @@ describe('CreativeLibrary', () => {{ silent: true },);});++ it('renders section navigation tabs with the current library active', async () => {+ listCatalogIngredients.mockResolvedValue({ items: [] });+ renderLibrary('casting', '/casting');+ await act(async () => {});+ expect(screen.getByRole('tab', { name: 'Casting' })).toHaveAttribute('aria-selected', 'true');+ expect(screen.getByRole('tab', { name: 'Catalog' })).toHaveAttribute('aria-selected', 'false');+ expect(screen.getByRole('tab', { name: 'Environments' })).toHaveAttribute('aria-selected', 'false');+ expect(screen.getByRole('tab', { name: 'Objects' })).toHaveAttribute('aria-selected', 'false');++ fireEvent.click(screen.getByRole('tab', { name: 'Objects' }));+ expect(navigateMock).toHaveBeenCalledWith('/objects');+ });});diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex 69931e47af..4f623ec7c8 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -1,6 +1,6 @@// Single source of truth for PortOS navigation. Consumed by the sidebar,// server/services/voice/tools.js#ui_navigate, and the Cmd+K palette.-// Entry: { id, path, label, section, tabId?, tabGroup?, navGroup?, tabLabel?, aliases?, keywords?, previousPaths?, preservePreviousPathSuffix? }.+// Entry: { id, path, label, section, tabId?, tabGroup?, navGroup?, parentPath?, tabLabel?, aliases?, keywords?, previousPaths?, preservePreviousPathSuffix? }.// See AGENTS.md "Command Palette & Voice Nav" for the contract.//// `previousPaths` lists every path this page has ANSWERED TO BEFORE — including@@ -44,11 +44,11 @@ const RAW_NAV_COMMANDS = [{ id: 'nav.catalog', path: '/catalog', label: 'Catalog', section: 'Create', aliases: ['catalog', 'ingredients', '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.catalog.settings', path: '/catalog?settings=1', label: 'Catalog Types', section: 'Create', previousPaths: ['/settings/catalog'], aliases: ['catalog settings', 'catalog-settings', 'settings-catalog', 'catalog-types'], keywords: ['catalog', 'types', 'labels', 'character', 'place', 'object', 'taxonomy'] },- { id: 'nav.create.casting', path: '/casting', label: 'Casting', section: 'Create', aliases: ['casting', 'cast', 'characters', 'actors', 'casting-sheets', 'cast-list'], keywords: ['character', 'casting sheet', 'turnaround', 'wardrobe', 'looks', 'performer', 'actor', 'reference'] },+ { id: 'nav.create.casting', path: '/casting', label: 'Casting', section: 'Create', parentPath: '/catalog', aliases: ['casting', 'cast', 'characters', 'actors', 'casting-sheets', 'cast-list'], keywords: ['character', 'casting sheet', 'turnaround', 'wardrobe', 'looks', 'performer', 'actor', 'reference'] },// ⌘K / voice only — no sidebar row: reached from the Casting, Environments and Objects headers.{ id: 'nav.create.casting-import', path: '/casting/import', label: 'Import Cast from Music Videos', section: 'Create', aliases: ['import-cast', 'cast-import', 'import-sets', 'backfill-cast'], keywords: ['music video', 'casting sheet', 'set plate', 'catalog', 'backfill', 'import'] },- { id: 'nav.create.environments', path: '/environments', label: 'Environments', section: 'Create', aliases: ['environments', 'environment', 'sets', 'locations', 'places', 'set-list'], keywords: ['place', 'set', 'location', 'clean plate', 'background', 'scene setting', 'reference'] },- { id: 'nav.create.objects', path: '/objects', label: 'Objects', section: 'Create', aliases: ['objects', 'props', 'prop-list', 'items'], keywords: ['object', 'prop', 'artifact', 'talisman', 'macguffin', 'reference'] },+ { id: 'nav.create.environments', path: '/environments', label: 'Environments', section: 'Create', parentPath: '/catalog', aliases: ['environments', 'environment', 'sets', 'locations', 'places', 'set-list'], keywords: ['place', 'set', 'location', 'clean plate', 'background', 'scene setting', 'reference'] },+ { id: 'nav.create.objects', path: '/objects', label: 'Objects', section: 'Create', parentPath: '/catalog', aliases: ['objects', 'props', 'prop-list', 'items'], keywords: ['object', 'prop', 'artifact', 'talisman', 'macguffin', 'reference'] },{ id: 'nav.media', path: '/media', 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', tabGroup: 'media', tabId: 'image', 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: '/video/generate', label: 'Generate Video', tabLabel: 'Video', section: 'Create', tabGroup: 'media', tabId: 'video', previousPaths: ['/video-gen', '/media/video'], aliases: ['video-gen', 'videogen', 'generate-video', 'ltx'], keywords: ['video', 'animate', 'movie', 'clip', 'ltx', 'episode composer', 'continuous video', 'multi-scene'] },@@ -594,6 +594,14 @@ for (const cmd of NAV_COMMANDS) {if (cmd.tabLabel !== undefined && (typeof cmd.tabLabel !== 'string' || !cmd.tabLabel.trim())) {throw new Error(`navManifest: tabLabel must be a non-empty string — got "${cmd.tabLabel}" for ${cmd.id}`);}+ if (cmd.parentPath !== undefined) {+ if (typeof cmd.parentPath !== 'string' || !cmd.parentPath.startsWith('/')) {+ throw new Error(`navManifest: parentPath must start with / — got "${cmd.parentPath}" for ${cmd.id}`);+ }+ if (!RAW_NAV_COMMANDS.some((c) => c.path === cmd.parentPath)) {+ throw new Error(`navManifest: parentPath "${cmd.parentPath}" not found for ${cmd.id}`);+ }+ }if (seenIds.has(cmd.id)) throw new Error(`navManifest: duplicate id ${cmd.id}`);seenIds.add(cmd.id);}diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.jsindex e6e133a4be..c1723135fb 100644--- a/server/lib/navManifest.test.js+++ b/server/lib/navManifest.test.js@@ -128,6 +128,20 @@ describe('navManifest — shape invariants', () => {const bad = NAV_COMMANDS.filter((c) => !ALLOWED_SECTIONS.has(c.section));expect(bad.map((c) => `${c.id}:${c.section}`)).toEqual([]);});++ it('every parentPath references a declared command path', () => {+ const commandPaths = new Set(NAV_COMMANDS.map((c) => c.path));+ const parentPaths = NAV_COMMANDS.filter((c) => c.parentPath).map((c) => c.parentPath);+ expect(parentPaths.length).toBeGreaterThan(0);+ expect(parentPaths.every((p) => commandPaths.has(p))).toBe(true);++ const casting = NAV_COMMANDS.find((c) => c.id === 'nav.create.casting');+ const environments = NAV_COMMANDS.find((c) => c.id === 'nav.create.environments');+ const objects = NAV_COMMANDS.find((c) => c.id === 'nav.create.objects');+ expect(casting?.parentPath).toBe('/catalog');+ expect(environments?.parentPath).toBe('/catalog');+ expect(objects?.parentPath).toBe('/catalog');+ });});describe('navManifest — persistent mind dashboard', () => {