Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: commission standalone videos through Creative Director (#6586)

[._.]/213348ebe560
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 4c34b0f35c..6fa6174d2b 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -185,11 +185,12 @@ function UniverseRouteRedirect({ fromPrefix, to, canon = false }) {
// 3D (`/media/3d/:id`) so far — so it's parameterized rather than copied per
// move. `from` must be an anchored regex so it can only match the prefix.
function PrefixRedirect({ from, to }) {
- const { pathname, search, hash } = useLocation();
+ const { pathname, search, hash, state } = useLocation();
const rest = pathname.replace(from, '');
- return <Navigate to={`${to}${rest}${search}${hash}`} replace />;
+ return <Navigate to={`${to}${rest}${search}${hash}`} state={state} replace />;
}
+const VIDEO_PROJECT_PREFIX = /^\/video/;
const MEDIA_CREATIVE_DIRECTOR_PREFIX = /^\/media\/creative-director/;
const MEDIA_SPRITES_PREFIX = /^\/media\/sprites/;
const MEDIA_MUSIC_VIDEO_PREFIX = /^\/media\/music-video/;
@@ -483,11 +484,11 @@ export default function App() {
carrying any query string + hash (relative Navigate preserves the
:id in the path) so a deep-link like /creative-director/abc?x#y
lands on /creative-director/abc/overview?x#y intact. */}
- <Route path="video" element={<CreativeDirector basePath="/video" workspace="video" />} />
+ <Route path="video" element={<CreativeDirector browseOnly />} />
<Route path="video/generate" element={<VideoGen />} />
- <Route path="video/:id" element={<CreativeDirectorOverviewRedirect />} />
- <Route path="video/:id/:tab/:sceneId" element={<CreativeDirectorDetail basePath="/video" />} />
- <Route path="video/:id/:tab" element={<CreativeDirectorDetail basePath="/video" />} />
+ <Route path="video/:id" element={<PrefixRedirect from={VIDEO_PROJECT_PREFIX} to="/creative-director" />} />
+ <Route path="video/:id/:tab/:sceneId" element={<PrefixRedirect from={VIDEO_PROJECT_PREFIX} to="/creative-director" />} />
+ <Route path="video/:id/:tab" element={<PrefixRedirect from={VIDEO_PROJECT_PREFIX} to="/creative-director" />} />
<Route path="creative-director" element={<CreativeDirector />} />
<Route path="creative-director/:id" element={<CreativeDirectorOverviewRedirect />} />
<Route path="creative-director/:id/:tab/:sceneId" element={<CreativeDirectorDetail />} />
diff --git a/client/src/App.videoRoutes.test.jsx b/client/src/App.videoRoutes.test.jsx
index 1036e78449..ef95a8eb19 100644
--- a/client/src/App.videoRoutes.test.jsx
+++ b/client/src/App.videoRoutes.test.jsx
@@ -18,5 +18,11 @@ it.each(['/media/video', '/video-gen'])('preserves clip handoff state through %s
it('normalizes a bare Video project URL while preserving its identity and handoff', async () => {
const state = { selected: 'example' };
render(<MemoryRouter initialEntries={[{ pathname: '/video/example-project', search: '?x=1', hash: '#shot', state }]}><App /></MemoryRouter>);
- expect(JSON.parse((await screen.findByTestId('project-location')).textContent)).toEqual({ pathname: '/video/example-project/overview', search: '?x=1', hash: '#shot', state });
+ expect(JSON.parse((await screen.findByTestId('project-location')).textContent)).toEqual({ pathname: '/creative-director/example-project/overview', search: '?x=1', hash: '#shot', state });
+});
+
+
+it('redirects a Video shot deep link to the same Creative Director shot', async () => {
+ render(<MemoryRouter initialEntries={['/video/example-project/artifacts/example-shot?revision=2#script']}><App /></MemoryRouter>);
+ expect(JSON.parse((await screen.findByTestId('project-location')).textContent)).toMatchObject({ pathname: '/creative-director/example-project/artifacts/example-shot', search: '?revision=2', hash: '#script' });
});
diff --git a/client/src/pages/CreativeDirector.jsx b/client/src/pages/CreativeDirector.jsx
index 4042406372..6dc8c104e9 100644
--- a/client/src/pages/CreativeDirector.jsx
+++ b/client/src/pages/CreativeDirector.jsx
@@ -40,26 +40,25 @@ const STATUS_COLORS = {
const EMPTY_DIRECTIVE = { goal: '', deliverables: [], constraints: { universeId: null, seriesId: null, budgetCap: null } };
-export default function CreativeDirector({ basePath = '/creative-director', workspace } = {}) {
- const isVideo = workspace === 'video';
+export default function CreativeDirector({ basePath = '/creative-director', browseOnly = false } = {}) {
const location = useLocation();
const navigate = useNavigate();
const [searchParams, setSearchParams] = useSearchParams();
const [projects, setProjects] = useState([]);
const [loading, setLoading] = useState(true);
- const [legacyFormOpen, setLegacyFormOpen] = useState(false);
- const showForm = isVideo ? searchParams.get('new') === 'video' : legacyFormOpen;
- const setShowForm = value => {
- const open = typeof value === 'function' ? value(showForm) : value;
- if (!isVideo) { setLegacyFormOpen(open); return; }
- setSearchParams(prev => { const next = new URLSearchParams(prev); if (open) next.set('new', 'video'); else next.delete('new'); return next; }, { replace: true });
- };
+ const [showForm, setShowForm] = useState(false);
+ const videoDraftOpen = !browseOnly && searchParams.get('new') === 'video';
+ const setVideoDraftOpen = open => setSearchParams(prev => {
+ const next = new URLSearchParams(prev);
+ if (open) next.set('new', 'video'); else next.delete('new');
+ return next;
+ }, { replace: true });
const [models, setModels] = useState([]);
// Directive composer (CDO Phase 4, #2186) — deep-linkable drawer (`?new=directive`)
// that creates a studio production project seeded with a directive. State is
// hoisted here (above the Drawer body) per the Drawer state-hoisting rule.
- const directiveOpen = searchParams.get('new') === 'directive';
- const modelsOpen = searchParams.get('models') === '1';
+ const directiveOpen = !browseOnly && searchParams.get('new') === 'directive';
+ const modelsOpen = !browseOnly && searchParams.get('models') === '1';
const [directiveName, setDirectiveName] = useState('');
const [directiveDraft, setDirectiveDraft] = useState(EMPTY_DIRECTIVE);
const [creatingDirective, setCreatingDirective] = useState(false);
@@ -109,24 +108,32 @@ export default function CreativeDirector({ basePath = '/creative-director', work
}).catch(() => {});
}, [fetchProjects]);
- // Consume the remix handoff once at mount, then clear the history state so a
+ // Consume each remix handoff, then clear the history state so a
// refresh doesn't re-seed (mirrors Story Builder's prefill-consume pattern).
// Auto-open the create form so the seeded ingredient chips are visible.
useEffect(() => {
+ if (browseOnly) {
+ if (searchParams.get('new') || location.state?.remix) {
+ const next = new URLSearchParams(location.search);
+ if (!next.has('new')) next.set('new', 'video');
+ navigate({ pathname: '/creative-director', search: next.toString(), hash: location.hash }, { replace: true, state: location.state });
+ }
+ return;
+ }
const ids = location.state?.remix?.ingredientIds;
if (!Array.isArray(ids) || ids.length === 0) return;
const cleanIds = ids.filter(Boolean).slice(0, 50);
if (cleanIds.length === 0) return;
setRemixIds(cleanIds);
- setShowForm(true);
+ if (!videoDraftOpen) setShowForm(true);
listCatalogIngredientsByIds(cleanIds, { silent: true })
.then((res) => setRemixIngredients(Array.isArray(res) ? res : (Array.isArray(res?.items) ? res.items : [])))
.catch(() => {});
// Clear the handoff state so a refresh doesn't re-seed (ids already captured).
const nextSearch = new URLSearchParams(location.search);
- if (isVideo) nextSearch.set('new', 'video');
+ if (videoDraftOpen) nextSearch.set('new', 'video');
navigate({ pathname: location.pathname, search: nextSearch.toString(), hash: location.hash }, { replace: true, state: {} });
- }, []);
+ }, [browseOnly, location.key]);
// Drop any pending remix handoff so abandoned ingredient ids can't leak into
// a later, unrelated project created from this list page (#1808 review).
@@ -290,18 +297,18 @@ export default function CreativeDirector({ basePath = '/creative-director', work
<div className="flex flex-col h-full">
<PageHeader
icon={Film}
- title={isVideo ? 'Video' : 'Creative Director'}
- subtitle={isVideo ? 'Draft standalone shorts, then review each production stage' : 'Long-form video projects driven by an autonomous CoS agent'}
- actions={
+ title={browseOnly ? 'Video' : 'Creative Director'}
+ subtitle={browseOnly ? 'Browse videos from Creative Director and Creative Commissions' : 'Plan and produce videos and creative projects'}
+ actions={browseOnly ? <Link to="/creative-director" className="px-3 py-2 rounded border border-port-border text-sm">Open Creative Director</Link> :
<>
- {!isVideo && <button
+ <button
onClick={openDirective}
className="flex items-center gap-2 bg-port-card border border-port-border hover:bg-port-card/60 text-port-text px-3 py-2 rounded text-sm"
title="Compose a directive — the Creative Director plans and executes it across the creative suite"
>
<Wand2 className="w-4 h-4" />
New directive
- </button>}
+ </button>
<button
onClick={() => setModelsOpen(true)}
className="flex items-center gap-2 bg-port-card border border-port-border hover:bg-port-card/60 text-port-text px-3 py-2 rounded text-sm"
@@ -310,7 +317,7 @@ export default function CreativeDirector({ basePath = '/creative-director', work
<SlidersHorizontal className="w-4 h-4" />
Model defaults
</button>
- {!isVideo && <OverflowMenu
+ <OverflowMenu
label="More Creative Director actions"
triggerRef={smokeMenuTriggerRef}
items={[
@@ -322,14 +329,14 @@ export default function CreativeDirector({ basePath = '/creative-director', work
onSelect: () => setConfirmingSmokeTest(true),
},
]}
- />}
- {isVideo && <Link to="/video/generate" className="px-3 py-2 rounded border border-port-border text-sm">Generate clip</Link>}
+ />
+ <button onClick={() => { clearRemix(); setVideoDraftOpen(true); }} className="px-3 py-2 rounded bg-port-accent text-white text-sm">New video draft</button>
<button
onClick={() => { setShowForm((s) => !s); clearRemix(); }}
className="flex items-center gap-2 bg-port-accent hover:bg-port-accent/80 text-white px-3 py-2 rounded text-sm"
>
<Plus className="w-4 h-4" />
- {isVideo ? 'New video draft' : 'New project'}
+ New project
</button>
</>
}
@@ -353,7 +360,7 @@ export default function CreativeDirector({ basePath = '/creative-director', work
/>
)}
- {showForm && !isVideo && (
+ {showForm && !browseOnly && (
<form onSubmit={handleCreate} className="shrink-0 p-6 border-b border-port-border bg-port-card/40 space-y-3">
{remixIngredients.length > 0 && (
<div className="rounded border border-port-accent/40 bg-port-accent/10 px-3 py-2">
@@ -483,7 +490,7 @@ export default function CreativeDirector({ basePath = '/creative-director', work
<div className="flex-1 overflow-auto p-6">
{projects.length === 0 && !showForm && (
<div className="text-port-text-muted text-sm">
- No projects yet. Click <span className="text-port-text">New project</span> to start one.
+ No projects yet. Open <Link to="/creative-director?new=video" className="text-port-accent">Creative Director</Link> to create a video draft.
</div>
)}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
@@ -508,19 +515,19 @@ export default function CreativeDirector({ basePath = '/creative-director', work
{/* Pause is meaningful only when the agent could be in flight.
`draft` has nothing running yet, and the terminal states are
obviously inert — match the detail page's gating. */}
- {!['paused', 'complete', 'failed', 'draft'].includes(p.status) && (
+ {!browseOnly && !['paused', 'complete', 'failed', 'draft'].includes(p.status) && (
<button onClick={() => handlePause(p.id)} className="flex items-center gap-1 px-2 py-1 bg-port-bg border border-port-border rounded text-xs">
<Pause className="w-3 h-3" /> Pause
</button>
)}
- {p.workspace !== 'video' && (p.status === 'paused' || p.status === 'draft' || p.status === 'failed') && (
+ {!browseOnly && p.workspace !== 'video' && (p.status === 'paused' || p.status === 'draft' || p.status === 'failed') && (
<button onClick={() => handleStart(p.id)} className="flex items-center gap-1 px-2 py-1 bg-port-accent/30 text-port-accent rounded text-xs">
<Play className="w-3 h-3" /> Start
</button>
)}
- <button onClick={() => handleDelete(p.id)} aria-label="Delete" className="ml-auto flex items-center gap-1 px-2 py-1 bg-port-bg border border-port-border rounded text-xs hover:bg-port-error/20 hover:text-port-error">
+ {!browseOnly && <button onClick={() => handleDelete(p.id)} aria-label="Delete" className="ml-auto flex items-center gap-1 px-2 py-1 bg-port-bg border border-port-border rounded text-xs hover:bg-port-error/20 hover:text-port-error">
<Trash2 className="w-3 h-3" />
- </button>
+ </button>}
</div>
</div>
))}
@@ -567,7 +574,7 @@ export default function CreativeDirector({ basePath = '/creative-director', work
</div>
</Drawer>
- {isVideo && <VideoDraftDrawer open={showForm} onClose={() => { setShowForm(false); clearRemix(); }} catalogIngredientIds={remixIds} onSaved={created => { setProjects(prev => [created, ...prev]); navigate(`${basePath}/${created.id}/overview`); }} />}
+ {!browseOnly && <VideoDraftDrawer open={videoDraftOpen} onClose={() => { setVideoDraftOpen(false); clearRemix(); }} catalogIngredientIds={remixIds} onSaved={created => { setProjects(prev => [created, ...prev]); navigate(`${basePath}/${created.id}/overview`); }} />}
<CreativeDirectorModelsDrawer
scope="global"
open={modelsOpen}
diff --git a/client/src/pages/CreativeDirector.test.jsx b/client/src/pages/CreativeDirector.test.jsx
index 25ef0f06e7..4605110974 100644
--- a/client/src/pages/CreativeDirector.test.jsx
+++ b/client/src/pages/CreativeDirector.test.jsx
@@ -2,7 +2,7 @@ vi.mock('../services/apiMusic.js', () => ({ listMusicEngines: vi.fn(() => Promis
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { MemoryRouter } from 'react-router';
+import { MemoryRouter, Routes, Route } from 'react-router';
vi.mock('../services/apiCreativeDirector.js', () => ({
listCreativeDirectorProjects: vi.fn(() => Promise.resolve([])),
@@ -135,14 +135,14 @@ describe('CreativeDirector header action hierarchy (#3287)', () => {
describe('Video workspace draft creation', () => {
- it('saves an inert draft and links existing project IDs within Video', async () => {
+ it('saves an inert draft and links existing project IDs within Creative Director', async () => {
const user = userEvent.setup();
vi.clearAllMocks();
cdApi.listCreativeDirectorProjects.mockResolvedValue([{ id: 'existing-project', name: 'Existing project', status: 'draft', workspace: 'video' }]);
cdApi.createCreativeDirectorProject.mockResolvedValue({ id: 'new-draft', name: 'Example short', workspace: 'video', status: 'draft' });
- render(<MemoryRouter initialEntries={['/video']}><CreativeDirector basePath="/video" workspace="video" /></MemoryRouter>);
+ render(<MemoryRouter initialEntries={['/creative-director']}><CreativeDirector /></MemoryRouter>);
await user.click(await screen.findByRole('button', { name: 'New video draft' }));
- expect(screen.getByRole('link', { name: 'Open Existing project' })).toHaveAttribute('href', '/video/existing-project/overview');
+ expect(screen.getByRole('link', { name: 'Open Existing project' })).toHaveAttribute('href', '/creative-director/existing-project/overview');
expect(screen.queryByRole('button', { name: 'Start' })).toBeNull();
await user.type(screen.getByLabelText('Name'), 'Example short');
await user.type(screen.getByRole('textbox', { name: 'Brief' }), 'A traveler returns home.');
@@ -155,14 +155,26 @@ describe('Video workspace draft creation', () => {
});
});
-it('keeps a Video remix draft open and forwards source IDs once on save', async () => {
+it.each(['/creative-director', '/video'])('keeps a Video remix from %s open and forwards source IDs once on save', async pathname => {
vi.clearAllMocks();
cdApi.listCreativeDirectorProjects.mockResolvedValue([]);
cdApi.createCreativeDirectorProject.mockResolvedValue({ id: 'remix-draft', name: 'Example remix', workspace: 'video', status: 'draft' });
const user = userEvent.setup();
- render(<MemoryRouter initialEntries={[{ pathname: '/video', search: '?view=all', hash: '#drafts', state: { remix: { ingredientIds: ['source-example'] } } }]}><CreativeDirector basePath="/video" workspace="video" /></MemoryRouter>);
+ render(<MemoryRouter initialEntries={[{ pathname, search: '?view=all&new=video', hash: '#drafts', state: { remix: { ingredientIds: ['source-example'] } } }]}><Routes><Route path="/video" element={<CreativeDirector browseOnly />} /><Route path="/creative-director" element={<CreativeDirector />} /><Route path="/creative-director/:id/overview" element={<div>Saved draft</div>} /></Routes></MemoryRouter>);
await user.type(await screen.findByRole('textbox', { name: 'Name' }), 'Example remix');
await user.click(screen.getByRole('button', { name: 'Save draft' }));
await waitFor(() => expect(cdApi.createCreativeDirectorProject).toHaveBeenCalledTimes(1));
expect(cdApi.createCreativeDirectorProject).toHaveBeenCalledWith(expect.objectContaining({ catalogIngredientIds: ['source-example'], videoDraft: expect.objectContaining({ sources: [{ kind: 'catalog', id: 'source-example' }] }) }), { silent: true });
});
+
+
+it('keeps Video as a browsing surface and sends production actions to Creative Director', async () => {
+ vi.clearAllMocks();
+ cdApi.listCreativeDirectorProjects.mockResolvedValue([{ id: 'commission-video', name: 'Example commission video', status: 'complete', commissionId: 'example-commission' }]);
+ render(<MemoryRouter initialEntries={['/video']}><CreativeDirector browseOnly /></MemoryRouter>);
+ expect(await screen.findByRole('link', { name: 'Open Example commission video' })).toHaveAttribute('href', '/creative-director/commission-video/overview');
+ expect(screen.getByRole('link', { name: 'Open Creative Director' })).toHaveAttribute('href', '/creative-director');
+ expect(screen.queryByRole('button', { name: /New|Start|Delete|Model defaults/ })).toBeNull();
+ expect(cdApi.createCreativeDirectorProject).not.toHaveBeenCalled();
+ expect(cdApi.startCreativeDirectorProject).not.toHaveBeenCalled();
+});
diff --git a/docs/STORAGE.md b/docs/STORAGE.md
index 289bd35569..134ab0f5b9 100644
--- a/docs/STORAGE.md
+++ b/docs/STORAGE.md
@@ -262,6 +262,11 @@ their existing dedicated stores and management flows.
### Video workspace drafts
+Creative Director is the production entry point (`/creative-director?new=video`).
+Create > Video (`/video`) browses existing project and commission outputs; old
+Video project/tab/shot URLs redirect to the same Creative Director project ID.
+The standalone clip generator remains `/video/generate`.
+
Video reuses `creative_director_projects` and its existing project IDs, collection
links, PostgreSQL JSONB record, and test-only file adapter. New records opt in
with `workspace: 'video'`; missing workspace means the existing Creative Director
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index 39901cce32..d04492b71c 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -52,8 +52,8 @@ const RAW_NAV_COMMANDS = [
{ id: 'nav.media.timeline', path: '/media/timeline', label: 'Timeline', section: 'Create', tabGroup: 'media', tabId: 'timeline', aliases: ['timeline', 'video-timeline', 'editor'], keywords: ['edit', 'trim', 'composite', 'stitch', 'cut', 'compose'] },
{ id: 'nav.media.history', path: '/media/history', label: 'Media History', section: 'Create', tabGroup: 'media', tabId: 'history', tabLabel: 'History', previousPaths: ['/media-history'], aliases: ['media-history', 'video-history'], keywords: ['videos', 'gallery', 'stitch'] },
{ id: 'nav.media.collections', path: '/media/collections', label: 'Collections', section: 'Create', tabGroup: 'media', tabId: 'collections', aliases: ['collections', 'media-collections', 'stacks', 'projects'], keywords: ['bucket', 'group', 'project', 'album', 'organize'] },
- { id: 'nav.create.video', path: '/video', label: 'Video', section: 'Create', aliases: ['video', 'create-video', 'video-workspace'], keywords: ['shorts', 'brief', 'script', 'production', 'review'] },
- { 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.video', path: '/video', label: 'Video', section: 'Create', aliases: ['video', 'browse-video'], keywords: ['videos', 'watch', 'browse', 'commission outputs'] },
+ { 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', 'video-production', 'create-video', 'video-workspace'], 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'] },
diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.js
index a9c5cd6b3a..55adc00048 100644
--- a/server/lib/navManifest.test.js
+++ b/server/lib/navManifest.test.js
@@ -740,3 +740,9 @@ describe('nav contract — POST Practice Library links are registered destinatio
});
}
});
+
+it('keeps Video browsing separate from Creative Director production aliases', () => {
+ expect(resolveNavCommand('video').path).toBe('/video');
+ expect(resolveNavCommand('create-video').path).toBe('/creative-director');
+ expect(resolveNavCommand('video-production').path).toBe('/creative-director');
+});