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: deep-link scenes and drawers, add ⌘K and voice project search (#10168)
Adam Eivyb4239a3ad83e
diff --git a/client/src/App.jsx b/client/src/App.jsxindex 0745d44789..ee5ffecf55 100644--- a/client/src/App.jsx+++ b/client/src/App.jsx@@ -565,6 +565,8 @@ export default function App() {<Route path="music-video/:projectId" element={<MusicVideo />} />{/* Stage tab (setup | cast-sets | board | produce | compose | review); an unknown stage opens the project's default. */}<Route path="music-video/:projectId/:stage" element={<MusicVideo />} />+ <Route path="music-video/:projectId/:stage/scene/:sceneId" element={<MusicVideo />} />+ <Route path="music-video/:projectId/scene/:sceneId" element={<MusicVideo />} /><Route path="music-video/:projectId/dev/:artifactId" element={<MusicVideo />} /><Route path="music-video/:projectId/:stage/dev/:artifactId" element={<MusicVideo />} />{/* 3D — a top-level Create page (moved out of the Media Gen tabs). Thediff --git a/client/src/components/CmdKSearch.jsx b/client/src/components/CmdKSearch.jsxindex 1b853057b7..5bbba7b034 100644--- a/client/src/components/CmdKSearch.jsx+++ b/client/src/components/CmdKSearch.jsx@@ -1,7 +1,7 @@import { useState, useEffect, useRef, useCallback, useMemo, useId } from 'react';import { createPortal } from 'react-dom';import { useLocation, useNavigate } from 'react-router';-import { Brain, Cpu, Package, History, HeartPulse, Search, Loader2, Navigation, Play, LayoutGrid, BookMarked, Send } from 'lucide-react';+import { Brain, Cpu, Package, History, HeartPulse, Search, Loader2, Navigation, Play, LayoutGrid, BookMarked, Send, Video } from 'lucide-react';import { useCmdKSearch } from '../hooks/useCmdKSearch';import useFocusTrap from '../hooks/useFocusTrap.js';import { useInstanceFeatures } from '../hooks/useInstanceFeatures.js';@@ -17,7 +17,7 @@ import { safeReadJsonStorage } from '../lib/safeStorage.js';import { escapeRegExp } from '../lib/textUtils.js';import { onActivateKeyDown } from '../lib/a11yKeyboard.js';-const ICON_MAP = { Brain, Cpu, Package, History, HeartPulse };+const ICON_MAP = { Brain, Cpu, Package, History, HeartPulse, Video };// Subsequence-based fuzzy scorer. Tiered: exact label > label-prefix > alias// exact > label-contains > alias-contains > keyword-contains > section-contains@@ -342,7 +342,18 @@ export default function CmdKSearch() {}, [captureDraft, close]);const DISPATCH = useMemo(() => ({- nav: (item) => { navigate(item.path); close(); },+ nav: (item) => {+ let targetPath = item.path;+ const match = location.pathname.match(/^\/music-video\/([^/?#]+)/);+ if (match && match[1] !== 'new' && item.path.startsWith('/music-video/')) {+ const stage = item.path.replace(/^\/music-video\//, '').split(/[?#]/)[0];+ if (stage && !item.path.includes('?new=')) {+ targetPath = `/music-video/${match[1]}/${stage}`;+ }+ }+ navigate(targetPath);+ close();+ },search: (item) => { navigate(item.url); close(); },catalog: (item) => { navigate(item.path); close(); },layout: async (item) => {diff --git a/client/src/components/musicVideo/NeedsAttentionBanner.jsx b/client/src/components/musicVideo/NeedsAttentionBanner.jsxindex 1a01b7d0aa..d976fcd8d9 100644--- a/client/src/components/musicVideo/NeedsAttentionBanner.jsx+++ b/client/src/components/musicVideo/NeedsAttentionBanner.jsx@@ -1,4 +1,5 @@import { AlertTriangle, Link2, Play, X } from 'lucide-react';+import { Link } from 'react-router';import { ATTENTION_ANCHOR_ID } from '../../lib/musicVideoAttention.js';const BUTTON = 'inline-flex min-h-[44px] items-center gap-1 rounded border border-port-border px-2.5 text-xs disabled:opacity-50 sm:min-h-0 sm:py-1';@@ -79,6 +80,19 @@ export default function NeedsAttentionBanner({ items, busy = false, actions = {}<span className="min-w-0 flex-1 basis-60"><span className="font-medium">{item.title}</span><span className="block text-port-text-muted">{item.detail}</span>+ {item.scenes?.length > 0 && (+ <span className="mt-1 flex flex-wrap gap-1.5">+ {item.scenes.map((s) => (+ <Link+ key={s.sceneId}+ to={`/music-video/${item.projectId || ''}/board/scene/${s.sceneId}`}+ className="rounded bg-port-accent/10 px-1.5 py-0.5 text-[11px] text-port-accent hover:underline"+ >+ {s.label || `Scene ${(s.order ?? 0) + 1}`}+ </Link>+ ))}+ </span>+ )}</span><span className="flex flex-wrap items-center gap-2"><ItemActions item={item} busy={busy} actions={actions} />diff --git a/client/src/components/musicVideo/NeedsAttentionBanner.test.jsx b/client/src/components/musicVideo/NeedsAttentionBanner.test.jsxindex 83a729b84b..e6bc59d736 100644--- a/client/src/components/musicVideo/NeedsAttentionBanner.test.jsx+++ b/client/src/components/musicVideo/NeedsAttentionBanner.test.jsx@@ -1,10 +1,13 @@import { describe, expect, it, vi } from 'vitest';import { fireEvent, render, screen, within } from '@testing-library/react';+import { MemoryRouter } from 'react-router';import NeedsAttentionBanner from './NeedsAttentionBanner.jsx';import MusicVideoLayout from './MusicVideoLayout.jsx';import { MUSIC_VIDEO_STAGES } from '../../lib/musicVideoStages.js';import { deriveAttentionItems } from '../../lib/musicVideoAttention.js';+const renderWithRouter = (ui) => render(<MemoryRouter>{ui}</MemoryRouter>);+const actions = () => ({onResumeRevision: vi.fn(), onCancelRevision: vi.fn(), onResumeCastAndSets: vi.fn(),onContinueAutoReview: vi.fn(), onCancelAutoReview: vi.fn(), onReattachRender: vi.fn(),@@ -21,15 +24,16 @@ const stranded = {describe('NeedsAttentionBanner (#9940)', () => {it('renders nothing when there is nothing to attend to', () => {- const { container } = render(<NeedsAttentionBanner items={[]} />);+ const { container } = renderWithRouter(<NeedsAttentionBanner items={[]} />);expect(container).toBeEmptyDOMElement();});it('offers Resume and Cancel for an open revision, wired to the id the project holds', () => {const handlers = actions();- render(<NeedsAttentionBanner items={deriveAttentionItems({ ...stranded, status: 'complete', castAndSets: null })} actions={handlers} />);+ renderWithRouter(<NeedsAttentionBanner items={deriveAttentionItems({ ...stranded, status: 'complete', castAndSets: null })} actions={handlers} />);const banner = screen.getByRole('region', { name: 'Needs attention' });expect(banner).toHaveTextContent('A section revision is open');+ expect(within(banner).getByRole('link', { name: /scene 1/i })).toHaveAttribute('href', '/music-video/mv-example/board/scene/scene-a');fireEvent.click(within(banner).getByRole('button', { name: 'Resume the open revision' }));expect(handlers.onResumeRevision).toHaveBeenCalledWith('mvrev-open');fireEvent.click(within(banner).getByRole('button', { name: 'Cancel the open revision' }));@@ -43,7 +47,7 @@ describe('NeedsAttentionBanner (#9940)', () => {revisions: [{ id: 'mvrev-owned', status: 'open', sections: [{ sceneId: 'scene-a', kind: 'image', verdict: 'rejected' }] }],autoReviews: [{ id: 'mvar-example', status: 'running', attempts: [{ n: 1, revisionId: 'mvrev-owned' }] }],};- render(<NeedsAttentionBanner items={deriveAttentionItems(project)} actions={handlers} />);+ renderWithRouter(<NeedsAttentionBanner items={deriveAttentionItems(project)} actions={handlers} />);fireEvent.click(screen.getByRole('button', { name: 'Resume the Cast & Sets check-in' }));expect(handlers.onResumeCastAndSets).toHaveBeenCalledTimes(1);fireEvent.click(screen.getByRole('button', { name: 'Continue the auto-review run' }));@@ -58,13 +62,13 @@ describe('NeedsAttentionBanner (#9940)', () => {it('shows only Cancel while a revision re-renders, and disables every exit while a request is busy', () => {const rendering = { ...stranded, status: 'complete', castAndSets: null, revisions: [{ ...stranded.revisions[0], status: 'rendering' }] };- render(<NeedsAttentionBanner items={deriveAttentionItems(rendering)} busy actions={actions()} />);+ renderWithRouter(<NeedsAttentionBanner items={deriveAttentionItems(rendering)} busy actions={actions()} />);expect(screen.queryByRole('button', { name: 'Resume the open revision' })).not.toBeInTheDocument();expect(screen.getByRole('button', { name: 'Cancel the open revision' })).toBeDisabled();});it('sits in the Music Video header under the status line, on every stage', () => {- render(<MusicVideoLayout project={{ id: 'example-project', name: 'Example Project' }} stage="board"+ renderWithRouter(<MusicVideoLayout project={{ id: 'example-project', name: 'Example Project' }} stage="board"onStageChange={() => {}} progress={{ current: 'board', stages: MUSIC_VIDEO_STAGES.map((stage) => ({ ...stage, state: 'todo' })) }}spend={{ spentUsd: 0 }}status={{ headline: 'Stage 3 of 7: Board', tone: 'muted', facts: [] }}diff --git a/client/src/components/musicVideo/RevisionPanel.jsx b/client/src/components/musicVideo/RevisionPanel.jsxindex bcf075d5bf..a66ac66eaf 100644--- a/client/src/components/musicVideo/RevisionPanel.jsx+++ b/client/src/components/musicVideo/RevisionPanel.jsx@@ -1,4 +1,5 @@import { RotateCcw, Play, X } from 'lucide-react';+import { Link } from 'react-router';const STATUS_LABELS = { open: 'Open', rendering: 'Rendering revised draft…', complete: 'Complete', canceled: 'Cancelled' };const SLOT = { image: 'referenceImageId', video: 'videoHistoryId' };@@ -66,7 +67,12 @@ export default function RevisionPanel({ project, busy, genScenes = {}, genVideoSconst state = sectionState(section, entry?.scene, spinning, revision.repair);return (<li key={section.sceneId} className="flex flex-wrap items-center gap-2">- <span className="min-w-0 flex-1">{entry ? `Scene ${entry.number}` : section.sceneId} <span className="text-port-text-muted">({section.layer})</span></span>+ <Link+ to={`/music-video/${project?.id}/board/scene/${section.sceneId}`}+ className="min-w-0 flex-1 hover:underline text-port-accent"+ >+ {entry ? `Scene ${entry.number}` : section.sceneId} <span className="text-port-text-muted">({section.layer})</span>+ </Link><span className={`px-1.5 py-0.5 rounded text-[10px] uppercase ${section.verdict === 'rejected' ? 'bg-port-error/20 text-port-error' : 'bg-port-success/20 text-port-success'}`}>{section.verdict}</span><span className={state.tone}>{state.label}</span></li>diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex 45aea9dca9..3668dc2915 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -1,7 +1,7 @@import PlateComparison from './PlateComparison.jsx';import ShotActionInspector from './ShotActionInspector.jsx';import { MUSIC_VIDEO_MEDIUM_LABELS } from '../../../../server/lib/musicVideoMediumPlan.js';-import { useRef, useState } from 'react';+import { useEffect, useRef, useState } from 'react';import { Trash2, Activity, ArrowUp, ArrowDown, ChevronRight, Image as ImageIcon, Video, Maximize2, AlertTriangle, ImagePlus, Clapperboard, Scissors } from 'lucide-react';import { formatDurationSec, formatUsd } from '../../utils/formatters.js';import { useVideoFileSrc } from '../../hooks/useVideoFileSrc.js';@@ -72,7 +72,16 @@ export default function SceneCard({onGenerateFrame, onGenerateVideo, onContinueVideo,onOpenPreview, onSelectTake, onReviewTake, onImportTake, onImportClipTake, takeBusy = false, layered = false,lipSyncBackend = '', songDurationSec = null, onSplit, falVideoSettings = null, onSeek, performanceReview = null, onRepairPerformance, repairBusy = false,+ expanded, onToggleExpand,}) {+ const detailsRef = useRef(null);++ useEffect(() => {+ if (expanded && detailsRef.current) {+ detailsRef.current.scrollIntoView?.({ behavior: 'smooth', block: 'center' });+ }+ }, [expanded]);+// Pause the inline clip before opening the lightbox so the user can't hear// two desynced copies — MediaLightbox autoplays unmuted, and the thumb's// native controls let the user unmute it first (muted is only initial).@@ -126,7 +135,15 @@ export default function SceneCard({excerptStartSec: performanceReview?.excerptStartSec, backend: lipSyncBackend, videoSettings: falVideoSettings || {} });const shotModeId = `mv-shot-mode-${scene.sceneId}`;return (- <details className="group min-w-0 rounded-lg border border-port-border bg-port-card">+ <details+ ref={detailsRef}+ id={`scene-${scene.sceneId}`}+ open={expanded != null ? expanded : undefined}+ onToggle={(e) => {+ onToggleExpand?.(scene.sceneId, e.currentTarget.open);+ }}+ className="group min-w-0 rounded-lg border border-port-border bg-port-card"+ ><summaryonClick={() => onSeek?.(scene)}className="flex min-h-[44px] cursor-pointer select-none items-center gap-3 p-2 marker:content-none [&::-webkit-details-marker]:hidden"diff --git a/client/src/components/musicVideo/stages/BoardStage.jsx b/client/src/components/musicVideo/stages/BoardStage.jsxindex af0d453bdd..98e7a60658 100644--- a/client/src/components/musicVideo/stages/BoardStage.jsx+++ b/client/src/components/musicVideo/stages/BoardStage.jsx@@ -12,7 +12,7 @@ import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';* are collapsed to a thumbnail, lyric and status until tapped.*/export default function BoardStage({ board }) {- const { project, locked, busy, sceneMedia, videoSettings, takes } = board;+ const { project, locked, busy, sceneMedia, videoSettings, takes, activeSceneId, onToggleSceneExpand } = board;const scenes = project.scenes || [];const performanceReviews = new Map();const attempts = (project.autoReviews || []).flatMap((run) => run.attempts || []).slice().reverse();@@ -54,6 +54,8 @@ export default function BoardStage({ board }) {<SceneCardkey={scene.sceneId}scene={scene}+ expanded={activeSceneId === scene.sceneId}+ onToggleExpand={onToggleSceneExpand}performanceReview={performanceReviews.get(`${scene.sceneId}:${scene.videoHistoryId}`)}index={idx}isLast={idx === scenes.length - 1}diff --git a/client/src/lib/musicVideoAttention.js b/client/src/lib/musicVideoAttention.jsindex 0d1bc3b2e2..794628f031 100644--- a/client/src/lib/musicVideoAttention.js+++ b/client/src/lib/musicVideoAttention.js@@ -69,6 +69,15 @@ export function deriveAttentionItems(project, { generatingSceneIds = null, draft: `New takes: ${ready} of ${total}. Production and auto-review wait until it is resumed or cancelled.`,revisionId: revision.id,canResume: !rendering,+ projectId: project.id,+ scenes: rejected.map((s) => {+ const sc = (project.scenes || []).find((scene) => scene.sceneId === s.sceneId);+ return {+ sceneId: s.sceneId,+ order: sc?.order,+ label: sc ? (sc.sectionLabel || sc.label || `Scene ${(sc.order ?? 0) + 1}`) : s.sceneId,+ };+ }),});}}diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 2c46066192..7648ad931c 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -132,7 +132,21 @@ export default function MusicVideo() {// stage the project was in. A development artifact opens from its own deep// link (/music-video/:projectId/:stage/dev/:artifactId, or the older// /music-video/:projectId/dev/:artifactId), the version from `?v=`.- const { projectId: routeProjectId, artifactId: routeArtifactId, stage: routeStage } = useParams();+ const { projectId: routeProjectId, artifactId: routeArtifactId, stage: routeStage, sceneId: routeSceneId } = useParams();+ const [searchParams, setSearchParams] = useSearchParams();+ const newParam = searchParams.get('new');+ const createOpen = newParam === 'project';+ const autonomousOpen = newParam === 'autonomous';+ const setCreateOpen = (open) => setSearchParams((prev) => {+ const next = new URLSearchParams(prev);+ if (open) next.set('new', 'project'); else next.delete('new');+ return next;+ });+ const setAutonomousOpen = (open) => setSearchParams((prev) => {+ const next = new URLSearchParams(prev);+ if (open) next.set('new', 'autonomous'); else next.delete('new');+ return next;+ });const navigate = useNavigate();const [projects, setProjects] = useState([]);const [tracks, setTracks] = useState([]);@@ -152,8 +166,6 @@ export default function MusicVideo() {const cloning = !!cloningId;const [importingLyrics, setImportingLyrics] = useState(false);const [aligningLyrics, setAligningLyrics] = useState(false);- const [createOpen, setCreateOpen] = useState(false);- const [autonomousOpen, setAutonomousOpen] = useState(false);const [creating, setCreating] = useState(false);const [form, setForm] = useState(emptyCreateForm);const selected = projects.find((p) => p.id === selectedId) || null;@@ -189,7 +201,17 @@ export default function MusicVideo() {const [openedStage, setOpenedStage] = useState({ id: null, stage: null });if (selected && openedStage.id !== selected.id) setOpenedStage({ id: selected.id, stage: progress.current });const pinnedStage = openedStage.id === selected?.id ? openedStage.stage : null;- const activeStage = resolveStageParam(routeStage) || pinnedStage || progress.current;+ const activeStage = resolveStageParam(routeStage) || (routeSceneId ? 'board' : (pinnedStage || progress.current));++ const handleToggleSceneExpand = (sceneId, isExpanded) => {+ if (!selected) return;+ const stage = activeStage || 'board';+ if (isExpanded) {+ navigate(`/music-video/${selected.id}/${stage}/scene/${sceneId}`, { replace: true });+ } else if (routeSceneId === sceneId) {+ navigate(`/music-video/${selected.id}/${stage}`, { replace: true });+ }+ };// Functional merges keyed on the captured projectId/sceneId so an async result@@ -275,7 +297,6 @@ export default function MusicVideo() {useEffect(() => { setPickerTarget(null); }, [selectedId]);// Contact sheet open state lives in the URL (?sheet=contact) so it survives a// reload and Back closes it.- const [searchParams, setSearchParams] = useSearchParams();const contactSheetOpen = searchParams.get('sheet') === 'contact';const setContactSheetOpen = (open) => setSearchParams((prev) => {const next = new URLSearchParams(prev);@@ -304,7 +325,8 @@ export default function MusicVideo() {toast.error(youtube.switchBlockedMessage);return;}- navigate(id ? `/music-video/${id}` : '/music-video');+ const search = searchParams.toString();+ navigate(id ? `/music-video/${id}${search ? `?${search}` : ''}` : `/music-video${search ? `?${search}` : ''}`);};const loadProjects = useCallback(async () => {@@ -832,9 +854,9 @@ export default function MusicVideo() {focusable?.focus?.({ preventScroll: true });}, [activeStage, location.key, selectedId, !!selected]);const goToStage = (stage, anchor = null) => {- // The dock's picked source (`?play=`) follows the director across tabs.- const play = searchParams.get('play');- navigate(`/music-video/${encodeURIComponent(selected.id)}/${stage}${play ? `?play=${encodeURIComponent(play)}` : ''}${anchor ? `#${anchor}` : ''}`, { replace: activeStage === stage });+ // Preserve search params (e.g. ?play=, ?new=, ?sheet=) across tabs.+ const search = searchParams.toString();+ navigate(`/music-video/${encodeURIComponent(selected.id)}/${stage}${search ? `?${search}` : ''}${anchor ? `#${anchor}` : ''}`, { replace: activeStage === stage });};// The docked preview: scene cards seek it; on a phone it is a mini-player@@ -897,6 +919,8 @@ export default function MusicVideo() {// use, so a panel moving between tabs never changes a signature here.const board = selected ? {project: selected,+ activeSceneId: routeSceneId || null,+ onToggleSceneExpand: handleToggleSceneExpand,autopilotRun,autonomous,runStage,diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 9e3ab23af1..5ab4ac1d15 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -153,7 +153,15 @@ const pushSocket = (event, payload) => act(async () => {});vi.mock('../services/apiUniverseBuilder.js', () => ({ getUniverse: vi.fn(), listUniverseNames: vi.fn(() => Promise.resolve([])) }));vi.mock('../lib/downloadBlob.js', () => ({ downloadBlob: vi.fn() }));-vi.mock('../services/apiSystem.js', () => ({ generateImage: vi.fn(async () => ({ status: 'queued', jobId: 'example-frame-job' })), uploadGalleryImage: vi.fn() }));+vi.mock('../services/apiSystem.js', () => ({+ generateImage: vi.fn(async () => ({ status: 'queued', jobId: 'example-frame-job' })),+ uploadGalleryImage: vi.fn(),+ listImageModels: vi.fn(async () => []),+ getSettings: vi.fn(async () => ({})),+}));+vi.mock('../services/apiMoodBoard.js', () => ({+ listMoodBoardNames: vi.fn(async () => []),+}));vi.mock('../hooks/useProviderModels', () => ({default: () => ({providers: [], selectedProviderId: '', selectedModel: '', availableModels: [],@@ -165,6 +173,7 @@ vi.mock('../hooks/useMidiNotes.js', () => ({default: () => ({ status: 'idle', data: null, error: null, reload: vi.fn() }),}));vi.mock('../services/apiImageVideo.js', () => ({+ getVideoGenModelContext: vi.fn(async () => null),generateVideo: vi.fn(),uploadGalleryVideo: vi.fn(),listLorasFull: vi.fn(async () => [{@@ -271,6 +280,8 @@ const MV_ROUTES = (<Route path="/music-video" element={<MusicVideo />} /><Route path="/music-video/:projectId" element={<MusicVideo />} /><Route path="/music-video/:projectId/:stage" element={<MusicVideo />} />+ <Route path="/music-video/:projectId/:stage/scene/:sceneId" element={<MusicVideo />} />+ <Route path="/music-video/:projectId/scene/:sceneId" element={<MusicVideo />} /><Route path="/music-video/:projectId/dev/:artifactId" element={<MusicVideo />} /><Route path="/music-video/:projectId/:stage/dev/:artifactId" element={<MusicVideo />} /></Routes>@@ -2732,3 +2743,95 @@ describe('Autopilot collapsed review summary', () => {expect(summary.textContent).not.toContain(error);});});++describe('MusicVideo deep-linking and drawer URL routing (#10168)', () => {+ it('opens scene expanded when loaded via /music-video/:projectId/:stage/scene/:sceneId', async () => {+ listMusicVideoProjects.mockResolvedValue([PROJECT_WITH_CLIP]);+ render(+ <MemoryRouter initialEntries={[`/music-video/${PROJECT_WITH_CLIP.id}/board/scene/s1`]}>+ {MV_ROUTES}+ </MemoryRouter>+ );+ await screen.findByRole('heading', { level: 2, name: PROJECT_WITH_CLIP.name });+ const details = document.getElementById('scene-s1');+ expect(details).toBeInTheDocument();+ expect(details.open).toBe(true);+ });++ it('routes /music-video/:projectId/scene/:sceneId directly to board stage with scene expanded', async () => {+ listMusicVideoProjects.mockResolvedValue([PROJECT_WITH_CLIP]);+ render(+ <MemoryRouter initialEntries={[`/music-video/${PROJECT_WITH_CLIP.id}/scene/s1`]}>+ {MV_ROUTES}+ </MemoryRouter>+ );+ await screen.findByRole('heading', { level: 2, name: PROJECT_WITH_CLIP.name });+ const details = document.getElementById('scene-s1');+ expect(details).toBeInTheDocument();+ expect(details.open).toBe(true);+ });++ it('opens create project drawer via ?new=project and autonomous drawer via ?new=autonomous', async () => {+ listMusicVideoProjects.mockResolvedValue([PROJECT_WITH_CLIP]);+ const { unmount } = render(+ <MemoryRouter initialEntries={['/music-video?new=project']}>+ {MV_ROUTES}+ </MemoryRouter>+ );+ expect(await screen.findByRole('heading', { level: 2, name: 'New music video' })).toBeInTheDocument();+ unmount();++ render(+ <MemoryRouter initialEntries={['/music-video?new=autonomous']}>+ {MV_ROUTES}+ </MemoryRouter>+ );+ expect(await screen.findByRole('heading', { level: 2, name: 'Autonomous music video' })).toBeInTheDocument();+ });++ it('updates the URL when a scene is expanded and removes it when collapsed', async () => {+ listMusicVideoProjects.mockResolvedValue([PROJECT_WITH_CLIP]);+ render(+ <MemoryRouter initialEntries={[`/music-video/${PROJECT_WITH_CLIP.id}/board`]}>+ <LocationProbe />+ {MV_ROUTES}+ </MemoryRouter>+ );+ await screen.findByRole('heading', { level: 2, name: PROJECT_WITH_CLIP.name });+ expect(screen.getByTestId('loc')).toHaveTextContent(`/music-video/${PROJECT_WITH_CLIP.id}/board`);++ const details = document.getElementById('scene-s1');+ expect(details).toBeInTheDocument();+ await act(async () => {+ details.open = true;+ fireEvent(details, new Event('toggle'));+ });+ expect(screen.getByTestId('loc')).toHaveTextContent(`/music-video/${PROJECT_WITH_CLIP.id}/board/scene/s1`);++ await act(async () => {+ details.open = false;+ fireEvent(details, new Event('toggle'));+ });+ expect(screen.getByTestId('loc')).toHaveTextContent(`/music-video/${PROJECT_WITH_CLIP.id}/board`);+ await settle();+ });++ it('closes open drawer on back navigation', async () => {+ listMusicVideoProjects.mockResolvedValue([PROJECT_WITH_CLIP]);+ let routerNavigate;+ function NavigateGrabber() {+ const navigate = useNavigate();+ routerNavigate = navigate;+ return null;+ }+ render(+ <MemoryRouter initialEntries={['/music-video', '/music-video?new=project']}>+ <NavigateGrabber />+ {MV_ROUTES}+ </MemoryRouter>+ );+ expect(await screen.findByRole('heading', { level: 2, name: 'New music video' })).toBeInTheDocument();+ act(() => routerNavigate(-1));+ await waitFor(() => expect(screen.queryByRole('heading', { level: 2, name: 'New music video' })).not.toBeInTheDocument());+ });+});diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex 2c6a069035..1fe074bbc6 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -61,6 +61,14 @@ const RAW_NAV_COMMANDS = [{ 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', 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', 'autonomous', 'suno', 'one prompt', 'lyrics'] },+ { id: 'nav.create.music-video.new', path: '/music-video?new=project', label: 'New Music Video', section: 'Create', aliases: ['new-music-video', 'create-music-video', 'new music video', 'create music video'], keywords: ['music video', 'new', 'create', 'project', 'draft'] },+ { id: 'nav.create.music-video.setup', path: '/music-video/setup', label: 'Music Video Setup', section: 'Create', aliases: ['music-video-setup', 'mv-setup', 'music video setup'], keywords: ['music video', 'setup', 'track', 'audio'] },+ { id: 'nav.create.music-video.cast-sets', path: '/music-video/cast-sets', label: 'Music Video Cast & Sets', section: 'Create', aliases: ['cast-and-sets', 'cast-sets', 'cast and sets', 'music-video-cast-sets'], keywords: ['music video', 'cast', 'sets', 'characters', 'visual spec'] },+ { id: 'nav.create.music-video.board', path: '/music-video/board', label: 'Music Video Board', section: 'Create', aliases: ['board', 'open-the-board', 'open the board', 'music-video-board', 'scene-board'], keywords: ['music video', 'board', 'scenes', 'timeline', 'shots'] },+ { id: 'nav.create.music-video.produce', path: '/music-video/produce', label: 'Music Video Produce', section: 'Create', aliases: ['produce', 'music-video-produce', 'mv-produce'], keywords: ['music video', 'produce', 'render', 'takes', 'production'] },+ { id: 'nav.create.music-video.compose', path: '/music-video/compose', label: 'Music Video Compose', section: 'Create', aliases: ['compose', 'music-video-compose', 'mv-compose'], keywords: ['music video', 'compose', 'timeline', 'audio timing', 'lyrics'] },+ { id: 'nav.create.music-video.review', path: '/music-video/review', label: 'Music Video Review', section: 'Create', aliases: ['music-video-review', 'mv-review', 'music video review'], keywords: ['music video', 'review', 'export', 'proof'] },+ { id: 'nav.create.music-video.publish', path: '/music-video/publish', label: 'Music Video Publish', section: 'Create', aliases: ['music-video-publish', 'mv-publish', 'music video publish'], keywords: ['music video', 'publish', 'release', 'kit', 'social'] },{ id: 'nav.create.decks', path: '/decks', label: 'Decks', section: 'Create', aliases: ['decks', 'deck', 'card-deck', 'playing-cards', 'tarot', 'tarot-deck', 'cards'], keywords: ['playing cards', 'tarot', 'card deck', 'card design', 'suits', 'arcana', 'style guide', 'batch render', 'card art'] },{ 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).diff --git a/server/services/search.js b/server/services/search.jsindex 02fce9e45e..c470a59c32 100644--- a/server/services/search.js+++ b/server/services/search.js@@ -15,6 +15,7 @@ import { searchBM25 } from './memoryBM25.js';import { getMemories, ensureBackend, hybridSearchMemories } from './memoryBackend.js';import { getAllApps } from './apps.js';import { getHistory } from './history.js';+import { listProjects as listMusicVideoProjects } from './musicVideo/projects.js';// =============================================================================// SNIPPET HELPER@@ -286,11 +287,28 @@ function searchHealth(query) {return { id: 'health', label: 'Health', icon: 'HeartPulse', results };}+async function searchMusicVideo(query) {+ const q = query.toLowerCase();+ const projects = await listMusicVideoProjects({ includeDeleted: false }).catch(() => []);+ const results = (projects ?? [])+ .filter(p => p.name?.toLowerCase().includes(q))+ .map(p => ({+ id: p.id,+ title: p.name,+ snippet: extractSnippet(p.concept || p.description || p.name, query),+ url: `/music-video/${p.id}`,+ type: 'music-video'+ }))+ .slice(0, 5);++ return { id: 'musicVideo', label: 'Music Video', icon: 'Video', results };+}+// =============================================================================// FAN-OUT ENGINE// =============================================================================-const ADAPTERS = ['brain', 'memory', 'apps', 'history', 'health'];+const ADAPTERS = ['brain', 'memory', 'apps', 'history', 'health', 'musicVideo'];/*** Fan out a keyword query to all PortOS data sources in parallel.@@ -299,13 +317,14 @@ const ADAPTERS = ['brain', 'memory', 'apps', 'history', 'health'];export async function fanOutSearch(query) {console.log(`🔍 Search fan-out for "${query}" across ${ADAPTERS.length} sources`);- const [brainResult, memoryResult, appsResult, historyResult, healthResult] =+ const [brainResult, memoryResult, appsResult, historyResult, healthResult, musicVideoResult] =await Promise.allSettled([searchBrain(query),searchMemory(query),searchApps(query),searchHistory(query),- Promise.resolve(searchHealth(query))+ Promise.resolve(searchHealth(query)),+ searchMusicVideo(query)]);const FALLBACKS = [@@ -313,10 +332,11 @@ export async function fanOutSearch(query) {{ id: 'memory', label: 'Memory', icon: 'Cpu', results: [] },{ id: 'apps', label: 'Apps', icon: 'Package', results: [] },{ id: 'history', label: 'History', icon: 'History', results: [] },- { id: 'health', label: 'Health', icon: 'HeartPulse', results: [] }+ { id: 'health', label: 'Health', icon: 'HeartPulse', results: [] },+ { id: 'musicVideo', label: 'Music Video', icon: 'Video', results: [] }];- const settled = [brainResult, memoryResult, appsResult, historyResult, healthResult];+ const settled = [brainResult, memoryResult, appsResult, historyResult, healthResult, musicVideoResult];const sources = settled.map((r, i) => r.status === 'fulfilled' ? r.value : FALLBACKS[i]);const nonEmpty = sources.filter(s => s.results.length > 0);diff --git a/server/services/search.test.js b/server/services/search.test.jsindex 65dbe9471f..8c370e6518 100644--- a/server/services/search.test.js+++ b/server/services/search.test.js@@ -27,6 +27,10 @@ vi.mock('./history.js', () => ({getHistory: vi.fn().mockResolvedValue({ entries: [] })}))+vi.mock('./musicVideo/projects.js', () => ({+ listProjects: vi.fn().mockResolvedValue([])+}))+import { fanOutSearch } from './search.js'import { getAll } from './brainStorage.js'import { __resetBrainSearchIndex, BRAIN_SEARCH_TYPES } from './brainSearchIndex.js'@@ -34,6 +38,7 @@ import { searchBM25 } from './memoryBM25.js'import { getMemories, ensureBackend, hybridSearchMemories } from './memoryBackend.js'import { getAllApps } from './apps.js'import { getHistory } from './history.js'+import { listProjects as listMusicVideoProjects } from './musicVideo/projects.js'// Per-type record fixtures the mocked brainStorage.getAll serves.let brainRecords = {}@@ -317,5 +322,21 @@ describe('search service', () => {expect(appsSource).toBeDefined()expect(appsSource.results).toHaveLength(1)})++ it('should search across music-video projects', async () => {+ listMusicVideoProjects.mockResolvedValue([+ { id: 'mv-1', name: 'Cyberpunk Odyssey', concept: 'Sci-fi cyberpunk music video' },+ { id: 'mv-2', name: 'Acoustic Sunset', concept: 'Serene folk ballad' }+ ])++ const results = await fanOutSearch('cyberpunk')+ const mvSource = results.find(s => s.id === 'musicVideo')+ expect(mvSource).toBeDefined()+ expect(mvSource.results).toHaveLength(1)+ expect(mvSource.results[0].id).toBe('mv-1')+ expect(mvSource.results[0].title).toBe('Cyberpunk Odyssey')+ expect(mvSource.results[0].url).toBe('/music-video/mv-1')+ expect(mvSource.results[0].type).toBe('music-video')+ })})})diff --git a/server/services/voice/tools/ui.js b/server/services/voice/tools/ui.jsindex de3c01ac86..22678d7b17 100644--- a/server/services/voice/tools/ui.js+++ b/server/services/voice/tools/ui.js@@ -42,9 +42,43 @@ export const UI_TOOLS = [execute: async ({ page, path } = {}, ctx = {}) => {let target = null;let resolvedKey = null;- if (page && typeof page === 'string') {++ const currentPath = ctx.state?.ui?.path || '';+ const mvMatch = currentPath.match(/^\/music-video\/([^/?#]+)/);+ const openProjectId = mvMatch && mvMatch[1] !== 'new' ? mvMatch[1] : null;++ if (openProjectId && page && typeof page === 'string') {+ const norm = page.trim().toLowerCase().replace(/\s+/g, '-').replace(/[.!?:;,"']+$/, '');+ const MV_STAGES = {+ setup: 'setup',+ 'cast-and-sets': 'cast-sets',+ 'cast-sets': 'cast-sets',+ board: 'board',+ 'the-board': 'board',+ 'open-the-board': 'board',+ 'scene-board': 'board',+ produce: 'produce',+ compose: 'compose',+ review: 'review',+ publish: 'publish',+ };+ const stage = MV_STAGES[norm] || (norm.startsWith('open-') ? MV_STAGES[norm.replace(/^open-/, '')] : null);+ if (stage) {+ target = `/music-video/${openProjectId}/${stage}`;+ resolvedKey = stage;+ }+ }++ if (!target && page && typeof page === 'string') {const hit = resolveNavCommand(page);- if (hit) { target = hit.path; resolvedKey = hit.matched; }+ if (hit) {+ target = hit.path;+ resolvedKey = hit.matched;+ if (openProjectId && target.startsWith('/music-video/') && !target.includes('?')) {+ const stage = target.replace(/^\/music-video\//, '').split('/')[0];+ target = `/music-video/${openProjectId}/${stage}`;+ }+ }}if (!target && path && typeof path === 'string' && path.startsWith('/')) target = path;if (!target) {