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

feat: pick a film style in the Launch Video form and the Music Video Compose stage (#10254)

[._.]/ Adam Eivya53ea4169761
diff --git a/client/src/components/apps/LaunchVideoPanel.jsx b/client/src/components/apps/LaunchVideoPanel.jsx
index b90b975f10..a7ec6851cd 100644
--- a/client/src/components/apps/LaunchVideoPanel.jsx
+++ b/client/src/components/apps/LaunchVideoPanel.jsx
@@ -3,6 +3,7 @@ import { Link } from 'react-router';
import { Download, Images, Upload, X } from 'lucide-react';
import Drawer from '../Drawer';
import ProviderModelSelector from '../ProviderModelSelector';
+import FilmStylePicker from '../codeAnimation/FilmStylePicker';
import FilePickerButton from '../ui/FilePickerButton';
import GalleryImagePicker from '../imageGen/GalleryImagePicker';
import GalleryVideoPicker from '../videoGen/GalleryVideoPicker';
@@ -50,6 +51,7 @@ function LaunchVideoForm({ appId, onQueued }) {
const [formats, setFormats] = useState(['landscape']);
const [duration, setDuration] = useState(20);
const [motionStyle, setMotionStyle] = useState('walkthrough');
+ const [styleGrammarId, setStyleGrammarId] = useState('');
const [critiqueRounds, setCritiqueRounds] = useState(2);
const [motionBlur, setMotionBlur] = useState('');
const [motionSkills, setMotionSkills] = useState(false);
@@ -120,6 +122,7 @@ function LaunchVideoForm({ appId, onQueued }) {
await createAppLaunchVideo(appId, {
// A single frame keeps the original `format` request shape.
tone, direction, ...(formats.length === 1 ? { format: formats[0] } : { formats }), targetDurationSec: duration, motionStyle, critiqueRounds,
+ ...(styleGrammarId ? { styleGrammarId } : {}),
...(motionBlur ? { motionBlur } : {}),
...(consultSkills ? { motionSkills: true } : {}),
...(music ? (generateMusic ? { generateMusic: true, musicMethod } : { musicTrack }) : {}),
@@ -179,6 +182,8 @@ function LaunchVideoForm({ appId, onQueued }) {
</select>
<p className="text-sm text-port-text-muted">{MOTION_STYLES.find(([value]) => value === motionStyle)[2]}</p>
</div>
+ <FilmStylePicker id="launch-film-style" value={styleGrammarId} onChange={setStyleGrammarId} inputClass={inputClass}
+ hint="optional motion, camera and sound rules; the app's palette and fonts still win" noneLabel="None (motion style only)" />
<div>
<label htmlFor="launch-critique-rounds">Critique rounds</label>
<select id="launch-critique-rounds" className={inputClass} value={critiqueRounds} onChange={event => setCritiqueRounds(Number(event.target.value))}>
diff --git a/client/src/components/apps/LaunchVideoPanel.test.jsx b/client/src/components/apps/LaunchVideoPanel.test.jsx
index 30581d81cd..b407678a44 100644
--- a/client/src/components/apps/LaunchVideoPanel.test.jsx
+++ b/client/src/components/apps/LaunchVideoPanel.test.jsx
@@ -6,6 +6,11 @@ import { createAppLaunchVideo, getAppLaunchVideos, getMotionToolkit, installMoti
vi.mock('../../services/apiApps', () => ({ getAppLaunchVideos: vi.fn(async () => ({ videos: [] })), createAppLaunchVideo: vi.fn(), publishAppLaunchVideo: vi.fn(),
getMotionToolkit: vi.fn(async () => ({ ffmpeg: true, skillPacks: [] })), installMotionSkills: vi.fn() }));
vi.mock('../../services/apiPipeline', () => ({ listPipelineMusicLibrary: async () => ({ tracks: [{ filename: 'track-1a2b.wav', label: 'Example track', sizeBytes: 2048, updatedAt: '2026-01-01T00:00:00.000Z' }] }) }));
+// The shared Film style picker reads the catalog through the api barrel.
+vi.mock('../../services/api', () => ({
+ listFilmStyles: vi.fn(async () => [{ id: 'example-style', label: 'Example style', summary: 'A fixture style.', nativeMoves: [] }]),
+ getFilmStyle: vi.fn(async () => ({ id: 'example-style', nativeMoves: [] })),
+}));
vi.mock('../../services/socket', () => ({ default: { on: vi.fn(), off: vi.fn() } }));
vi.mock('../../lib/clipboard', () => ({ copyToClipboard: vi.fn() }));
// The picker's tool-use annotation fetches from apiLocalLlm; park it unresolved.
@@ -83,6 +88,18 @@ describe('launch video drawer', () => {
expect(createAppLaunchVideo.mock.calls[0][1].format).toBeUndefined();
});
+ it('sends the chosen film style grammar with the launch video and omits it when None', async () => {
+ createAppLaunchVideo.mockResolvedValue({ taskId: 'task-1' });
+ renderPanel();
+ fireEvent.click(screen.getByRole('button', { name: 'Make launch video' }));
+ const select = screen.getByLabelText(/^film style/i);
+ await screen.findByRole('option', { name: 'Example style' });
+ fireEvent.change(select, { target: { value: 'example-style' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Queue launch video' }));
+ await waitFor(() => expect(createAppLaunchVideo).toHaveBeenCalledTimes(1));
+ expect(createAppLaunchVideo.mock.calls.at(-1)[1]).toMatchObject({ styleGrammarId: 'example-style', motionStyle: 'walkthrough' });
+ });
+
it('previews the URL-selected take and offers it for download', async () => {
getAppLaunchVideos.mockResolvedValueOnce({ videos: [
{ id: 'newest', filename: 'composition-newest.mp4', thumbnail: 'newest.jpg', createdAt: '2026-01-02T00:00:00.000Z', durationSec: 20, caption: 'Newest caption.' },
diff --git a/client/src/components/codeAnimation/FilmStylePicker.jsx b/client/src/components/codeAnimation/FilmStylePicker.jsx
index 2db783c967..9b12488a84 100644
--- a/client/src/components/codeAnimation/FilmStylePicker.jsx
+++ b/client/src/components/codeAnimation/FilmStylePicker.jsx
@@ -1,14 +1,20 @@
-import { useEffect, useState } from 'react';
+import { useEffect, useRef, useState } from 'react';
import { AlertTriangle } from 'lucide-react';
import { getFilmStyle, listFilmStyles } from '../../services/api';
/**
- * "Film style" select for the Code Animation form (#10253). The catalog loads
+ * "Film style" select shared by the Code Animation form (#10253), the Launch
+ * Video form and the Music Video Compose stage (#10254); `hint` and `noneLabel`
+ * let each surface say what an empty choice falls back to. The catalog loads
* once on mount; the full record of the chosen grammar loads on selection so
* its native moves can be judged before an agent run is spent. A failed load
* leaves the form usable with "None".
*/
-export default function FilmStylePicker({ id, value, onChange, labelClass, inputClass }) {
+export default function FilmStylePicker({
+ id, value, onChange, labelClass, inputClass, disabled = false,
+ hint = 'optional medium recipe: rendering, camera and sound',
+ noneLabel = 'None (derive from universe / notes)',
+}) {
const [styles, setStyles] = useState(null);
const [loadError, setLoadError] = useState('');
const [detail, setDetail] = useState(null);
@@ -22,8 +28,13 @@ export default function FilmStylePicker({ id, value, onChange, labelClass, input
}, []);
// A stored choice the catalog no longer carries must not reach the server.
+ // Cleared once per value so a caller whose onChange persists (and may fail)
+ // is not re-invoked on every render.
+ const clearedRef = useRef(null);
useEffect(() => {
- if (styles && value && !styles.some((style) => style.id === value)) onChange('');
+ if (!styles || !value || styles.some((style) => style.id === value) || clearedRef.current === value) return;
+ clearedRef.current = value;
+ onChange('');
}, [styles, value, onChange]);
const selected = styles?.find((style) => style.id === value) || null;
@@ -41,9 +52,9 @@ export default function FilmStylePicker({ id, value, onChange, labelClass, input
return (
<div>
- <label htmlFor={id} className={labelClass}>Film style <span className="text-gray-600">(optional medium recipe: rendering, camera and sound)</span></label>
- <select id={id} value={selected ? value : ''} onChange={(event) => onChange(event.target.value)} className={inputClass}>
- <option value="">None (derive from universe / notes)</option>
+ <label htmlFor={id} className={labelClass}>Film style <span className="text-gray-600">({hint})</span></label>
+ <select id={id} value={selected ? value : ''} disabled={disabled} onChange={(event) => onChange(event.target.value)} className={inputClass}>
+ <option value="">{noneLabel}</option>
{(styles || []).map((style) => <option key={style.id} value={style.id}>{style.label}</option>)}
</select>
{loadError && (
diff --git a/client/src/components/musicVideo/DocumentCompositionPanel.jsx b/client/src/components/musicVideo/DocumentCompositionPanel.jsx
index 9cbef2d987..e6b79e019d 100644
--- a/client/src/components/musicVideo/DocumentCompositionPanel.jsx
+++ b/client/src/components/musicVideo/DocumentCompositionPanel.jsx
@@ -9,6 +9,7 @@ import toast from '../ui/Toast';
import useProviderModels from '../../hooks/useProviderModels.js';
import ProviderModelSelector from '../ProviderModelSelector.jsx';
import CompositionPreviewPlayer from './CompositionPreviewPlayer.jsx';
+import FilmStylePicker from '../codeAnimation/FilmStylePicker.jsx';
import NarrativeEventsEditor from './NarrativeEventsEditor.jsx';
import StageSection from './StageSection.jsx';
import { downloadBlob } from '../../lib/downloadBlob';
@@ -197,6 +198,11 @@ export default function DocumentCompositionPanel({ project, audioUrl, onProject,
downloadBlob(buffer, `${(project.name || 'music-video').replace(/[^\w.-]+/g, '-')}-composition.zip`, 'application/zip');
return {};
});
+ // Cleared by omitting the key: the composition body is replaced whole.
+ const setFilmStyle = (styleGrammarId) => {
+ const { styleGrammarId: _previous, ...composition } = compositionDraft(project);
+ return run('film-style', () => updateMusicVideoProject(project.id, { composition: styleGrammarId ? { ...composition, styleGrammarId } : composition }, { silent: true }).then((project) => ({ project })), 'Film style saved');
+ };
const detach = confirmFirst('detach', () => run('detach', () => detachMusicVideoCompositionDocument(project.id, { silent: true }), 'Composition document detached'));
const effectiveModel = selectedModel || selectedProvider?.defaultModel || '';
const authoringValid = supportsToolFreeOneShot(providers.find((entry) => entry.id === selectedProviderId)) && Boolean(selectedProviderId && effectiveModel);
@@ -271,6 +277,9 @@ export default function DocumentCompositionPanel({ project, audioUrl, onProject,
<StageSection id="mv-doc-generate" title="Generate & revise" summary={generateSummary} defaultOpen={!candidate}>
<NarrativeEventsEditor key={`${project.id}-${JSON.stringify([project.composition?.narrativeEvents, project.composition?.reactiveSections])}`}
project={project} sections={candidate?.sections || []} disabled={!!busy} onSave={saveEvents} onPendingChange={setEventPending} />
+ <FilmStylePicker id="mv-doc-film-style" value={project.composition?.styleGrammarId || ''} onChange={setFilmStyle} disabled={!!busy}
+ labelClass="block text-xs text-port-text-muted mb-0.5" inputClass={`${inputCls} w-full`}
+ hint="optional medium rulebook every section follows; the approved palette and lyric readability win" noneLabel="None (treatment only)" />
<p className="text-xs text-port-text-muted">Generate from the approved treatment, song timing and selected project assets. Missing media is reported before any provider call.</p>
{providers.length > 0 && <ProviderModelSelector
providers={providers} selectedProviderId={selectedProviderId} selectedModel={selectedModel}
diff --git a/client/src/components/musicVideo/DocumentCompositionPanel.test.jsx b/client/src/components/musicVideo/DocumentCompositionPanel.test.jsx
index 4dccb8f446..b5143eb71e 100644
--- a/client/src/components/musicVideo/DocumentCompositionPanel.test.jsx
+++ b/client/src/components/musicVideo/DocumentCompositionPanel.test.jsx
@@ -17,6 +17,11 @@ const api = vi.hoisted(() => ({
updateMusicVideoProject: vi.fn(),
}));
vi.mock('../../services/apiMusicVideo.js', () => api);
+// The shared Film style picker reads the catalog through the api barrel.
+vi.mock('../../services/api', () => ({
+ listFilmStyles: vi.fn(async () => [{ id: 'example-style', label: 'Example style', summary: 'A fixture style.', nativeMoves: [] }]),
+ getFilmStyle: vi.fn(async () => ({ id: 'example-style', nativeMoves: [] })),
+}));
const authorProvider = vi.hoisted(() => ({ type: 'api', toolFreeOneShot: true }));
vi.mock('../../hooks/useProviderModels.js', () => ({ default: () => ({
providers: [{ id: 'stub-provider', name: 'Stub Provider', models: ['fixture-model'], ...authorProvider }],
@@ -113,6 +118,22 @@ describe('DocumentCompositionPanel', () => {
expect(api.generateMusicVideoMixedMediaDocument).not.toHaveBeenCalled();
});
+ it('saves a film style grammar on the composition and clears it by omitting the key', async () => {
+ const styled = { ...attached, composition: { ...attached.composition, styleGrammarId: 'example-style' } };
+ api.updateMusicVideoProject.mockResolvedValueOnce(styled).mockResolvedValueOnce(attached);
+ const onProject = vi.fn();
+ const view = render(<DocumentCompositionPanel project={attached} onProject={onProject} onSave={vi.fn()} />);
+ await screen.findByRole('option', { name: 'Example style' });
+ fireEvent.change(screen.getByLabelText(/^film style/i), { target: { value: 'example-style' } });
+ await waitFor(() => expect(onProject).toHaveBeenCalledWith(styled));
+ expect(api.updateMusicVideoProject.mock.calls[0][1].composition).toMatchObject({ mode: 'document', styleGrammarId: 'example-style' });
+ view.rerender(<DocumentCompositionPanel project={styled} onProject={onProject} onSave={vi.fn()} />);
+ await waitFor(() => expect(screen.getByLabelText(/^film style/i).value).toBe('example-style'));
+ fireEvent.change(screen.getByLabelText(/^film style/i), { target: { value: '' } });
+ await waitFor(() => expect(api.updateMusicVideoProject).toHaveBeenCalledTimes(2));
+ expect(api.updateMusicVideoProject.mock.calls[1][1].composition).not.toHaveProperty('styleGrammarId');
+ });
+
it('starts from the template in one click when nothing is attached', async () => {
const onProject = vi.fn();
render(<DocumentCompositionPanel project={bare} onProject={onProject} onSave={vi.fn()} />);
@@ -139,9 +160,10 @@ describe('DocumentCompositionPanel', () => {
await waitFor(() => expect(onProject).toHaveBeenLastCalledWith(bare));
});
- it('expires the replace and detach confirmations after 5 seconds without acting', () => {
+ it('expires the replace and detach confirmations after 5 seconds without acting', async () => {
vi.useFakeTimers();
render(<DocumentCompositionPanel project={attached} onProject={vi.fn()} onSave={vi.fn()} />);
+ await act(async () => {}); // settle the film style catalog load
fireEvent.click(screen.getByRole('button', { name: /Replace with template/ }));
expect(screen.getByRole('button', { name: /Click again to replace/ })).toBeTruthy();