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: move music video shot pacing beside AI Plan and use friendly skip labels in the plan toast (#10209)

Adam Eivy2c985c47376a
diff --git a/client/src/components/musicVideo/LyricsPanel.jsx b/client/src/components/musicVideo/LyricsPanel.jsx
index 645ad71766..ed889da822 100644
--- a/client/src/components/musicVideo/LyricsPanel.jsx
+++ b/client/src/components/musicVideo/LyricsPanel.jsx
@@ -7,14 +7,6 @@ import { lyricSetupState } from '../../lib/musicVideoStages.js';
// tailnet origin PortOS is usually opened from).
const mintId = (prefix) => `${prefix}-${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
const toSec = (value) => (value === '' ? null : Number(value));
-// Bounds mirror musicVideoPacingSchema so an out-of-range value is refused
-// by the input rather than applied locally and then rejected by the server.
-const PACING_FIELDS = [
- ['minShotSec', 'Shortest shot (s)', 'Floor for a planned shot; a shorter section stays one shot.', 0.5, 60],
- ['maxShotSec', 'Longest shot (s)', 'Ceiling for a planned shot, never longer than one generated clip (5s local, 6/10s Grok).', 1, 120],
- ['hookSec', 'Opening hook (s)', 'Cap on the very first shot so the video opens on a cut.', 0.5, 60],
-];
-
const inputCls = 'bg-port-bg border border-port-border rounded px-1.5 py-1 text-xs min-h-[44px] sm:min-h-0';
const round3 = (n) => Math.round(n * 1000) / 1000;
const MIN_WORD_SEC = 0.02;
@@ -131,7 +123,7 @@ function WordTimingRow({ cue, lineNumber, disabled, onPreview, onCommit }) {
}
/**
- * Timed lyric cues, musical-phrase annotations and shot pacing for the AI
+ * Timed lyric cues and musical-phrase annotations for the AI
* shot planner (#8964). Every list is editable in place: edits apply to the
* board immediately (`onEditLocal`) and persist on blur (`onSave`, a project
* PATCH that replaces the list whole). Import parses pasted LRC, SRT/WebVTT or
@@ -167,7 +159,6 @@ export default function LyricsPanel({ project, onEditLocal, onSave, onImport, im
const markersAt = (line) => markers.filter((marker) => marker.line === line);
const trailingMarkers = markers.filter((marker) => marker.line >= cues.length);
const phrases = project.phrases || [];
- const pacing = project.pacing || {};
const [importText, setImportText] = useState('');
const [importFormat, setImportFormat] = useState('auto');
const [importMode, setImportMode] = useState('replace');
@@ -190,18 +181,6 @@ export default function LyricsPanel({ project, onEditLocal, onSave, onImport, im
const replaceCues = (next) => { onEditLocal({ lyricCues: next }); saveCues(next); };
const replacePhrases = (next) => { onEditLocal({ phrases: next }); savePhrases(next); };
- const commitPacing = (key, raw, min, max) => {
- const value = Number(raw);
- if (raw !== '' && !(Number.isFinite(value) && value >= min && value <= max)) return false;
- const next = { ...pacing };
- if (raw === '') delete next[key];
- else next[key] = value;
- const nextPacing = Object.keys(next).length > 0 ? next : null;
- onEditLocal({ pacing: nextPacing });
- onSave({ pacing: nextPacing });
- return true;
- };
-
const submitImport = () => {
if (!importText.trim()) return;
onImport({ text: importText, format: importFormat, mode: importMode }, () => setImportText(''));
@@ -223,7 +202,7 @@ export default function LyricsPanel({ project, onEditLocal, onSave, onImport, im
return (
<Shell className="mt-2 bg-port-bg border border-port-border rounded-lg p-2 text-xs">
<Heading className={`${inline ? '' : 'cursor-pointer select-none '}text-port-text-muted min-h-[44px] sm:min-h-0 flex flex-wrap items-center gap-x-1`}>
- Lyrics, phrases &amp; pacing — {cues.length} line{cues.length === 1 ? '' : 's'} ({timedCount} timed)
+ Lyrics &amp; phrases — {cues.length} line{cues.length === 1 ? '' : 's'} ({timedCount} timed)
· {phrases.length} phrase{phrases.length === 1 ? '' : 's'}
<span className="block sm:inline sm:ml-1">— AI Plan cuts on timed lines and phrase edges; no lyrics = an instrumental plan.</span>
</Heading>
@@ -271,24 +250,6 @@ export default function LyricsPanel({ project, onEditLocal, onSave, onImport, im
<Upload size={13} /> {importing ? 'Importing…' : 'Import lyrics'}
</button>
</div>
-
- <h4 className="font-medium text-port-text pt-1">Shot pacing</h4>
- <div className="flex flex-wrap gap-2">
- {PACING_FIELDS.map(([key, label, help, min, max]) => (
- <div key={key}>
- <label htmlFor={`mv-pacing-${key}`} className="block text-port-text-muted mb-0.5" title={help}>{label}</label>
- <input id={`mv-pacing-${key}`} type="number" min={min} max={max} step={0.5}
- defaultValue={pacing[key] ?? ''} key={`${project.id}-${key}-${pacing[key] ?? ''}`}
- placeholder="default" title={help}
- onBlur={(e) => {
- if (e.target.value === String(pacing[key] ?? '')) return;
- // Out of range: restore the saved value instead of showing an unsaved one.
- if (!commitPacing(key, e.target.value, min, max)) e.target.value = pacing[key] ?? '';
- }}
- className={`${inputCls} w-24`} />
- </div>
- ))}
- </div>
</section>
<section className="space-y-1 min-w-0">
diff --git a/client/src/components/musicVideo/ShotPacingFields.jsx b/client/src/components/musicVideo/ShotPacingFields.jsx
new file mode 100644
index 0000000000..8317a4a27d
--- /dev/null
+++ b/client/src/components/musicVideo/ShotPacingFields.jsx
@@ -0,0 +1,50 @@
+// Bounds mirror musicVideoPacingSchema so an out-of-range value is refused
+// by the input rather than applied locally and then rejected by the server.
+const PACING_FIELDS = [
+ ['minShotSec', 'Shortest shot (s)', 'Floor for a planned shot; a shorter section stays one shot.', 0.5, 60],
+ ['maxShotSec', 'Longest shot (s)', 'Ceiling for a planned shot, never longer than one generated clip (5s local, 6/10s Grok).', 1, 120],
+ ['hookSec', 'Opening hook (s)', 'Cap on the very first shot so the video opens on a cut.', 0.5, 60],
+];
+
+const inputCls = 'bg-port-bg border border-port-border rounded px-1.5 py-1 text-xs min-h-[44px] sm:min-h-0 w-24';
+
+/**
+ * Shot pacing for AI Plan (#8964), edited beside the AI Plan button on the
+ * Board because it only affects planning. Edits apply to the board at once
+ * (`onEditLocal`) and persist on blur (`onSave`, a project PATCH).
+ */
+export default function ShotPacingFields({ project, onEditLocal, onSave }) {
+ const pacing = project.pacing || {};
+
+ const commitPacing = (key, raw, min, max) => {
+ const value = Number(raw);
+ if (raw !== '' && !(Number.isFinite(value) && value >= min && value <= max)) return false;
+ const next = { ...pacing };
+ if (raw === '') delete next[key];
+ else next[key] = value;
+ const nextPacing = Object.keys(next).length > 0 ? next : null;
+ onEditLocal({ pacing: nextPacing });
+ onSave({ pacing: nextPacing });
+ return true;
+ };
+
+ return (
+ <div className="mt-2 flex flex-wrap items-end gap-2 text-xs" role="group" aria-label="Shot pacing">
+ <span className="font-medium text-port-text self-center">Shot pacing</span>
+ {PACING_FIELDS.map(([key, label, help, min, max]) => (
+ <div key={key}>
+ <label htmlFor={`mv-pacing-${key}`} className="block text-port-text-muted mb-0.5" title={help}>{label}</label>
+ <input id={`mv-pacing-${key}`} type="number" min={min} max={max} step={0.5}
+ defaultValue={pacing[key] ?? ''} key={`${project.id}-${key}-${pacing[key] ?? ''}`}
+ placeholder="default" title={help}
+ onBlur={(e) => {
+ if (e.target.value === String(pacing[key] ?? '')) return;
+ // Out of range: restore the saved value instead of showing an unsaved one.
+ if (!commitPacing(key, e.target.value, min, max)) e.target.value = pacing[key] ?? '';
+ }}
+ className={inputCls} />
+ </div>
+ ))}
+ </div>
+ );
+}
diff --git a/client/src/components/musicVideo/ShotPacingFields.test.jsx b/client/src/components/musicVideo/ShotPacingFields.test.jsx
new file mode 100644
index 0000000000..d1f3ef5bd3
--- /dev/null
+++ b/client/src/components/musicVideo/ShotPacingFields.test.jsx
@@ -0,0 +1,36 @@
+// @vitest-environment happy-dom
+import { describe, it, expect, vi } from 'vitest';
+import { render, screen, fireEvent } from '@testing-library/react';
+import ShotPacingFields from './ShotPacingFields.jsx';
+
+describe('ShotPacingFields', () => {
+ it('saves an in-range value locally and to the project', () => {
+ const onEditLocal = vi.fn();
+ const onSave = vi.fn();
+ render(<ShotPacingFields project={{ id: 'p', pacing: { hookSec: 2 } }} onEditLocal={onEditLocal} onSave={onSave} />);
+ const input = screen.getByLabelText('Longest shot (s)');
+ fireEvent.change(input, { target: { value: '4' } });
+ fireEvent.blur(input);
+ expect(onEditLocal).toHaveBeenCalledWith({ pacing: { hookSec: 2, maxShotSec: 4 } });
+ expect(onSave).toHaveBeenCalledWith({ pacing: { hookSec: 2, maxShotSec: 4 } });
+ });
+
+ it('refuses an out-of-range value and restores the saved one', () => {
+ const onSave = vi.fn();
+ render(<ShotPacingFields project={{ id: 'p', pacing: { minShotSec: 1 } }} onEditLocal={vi.fn()} onSave={onSave} />);
+ const input = screen.getByLabelText('Shortest shot (s)');
+ fireEvent.change(input, { target: { value: '999' } });
+ fireEvent.blur(input);
+ expect(onSave).not.toHaveBeenCalled();
+ expect(input.value).toBe('1');
+ });
+
+ it('clears the pacing object when the last field is emptied', () => {
+ const onSave = vi.fn();
+ render(<ShotPacingFields project={{ id: 'p', pacing: { hookSec: 2 } }} onEditLocal={vi.fn()} onSave={onSave} />);
+ const input = screen.getByLabelText('Opening hook (s)');
+ fireEvent.change(input, { target: { value: '' } });
+ fireEvent.blur(input);
+ expect(onSave).toHaveBeenCalledWith({ pacing: null });
+ });
+});
diff --git a/client/src/components/musicVideo/stages/BoardStage.jsx b/client/src/components/musicVideo/stages/BoardStage.jsx
index ebbd655887..6cfe6beafe 100644
--- a/client/src/components/musicVideo/stages/BoardStage.jsx
+++ b/client/src/components/musicVideo/stages/BoardStage.jsx
@@ -7,6 +7,7 @@ import SceneCard from '../SceneCard.jsx';
import TreatmentPanel, { treatmentSummary } from '../TreatmentPanel.jsx';
import StageSection from '../StageSection.jsx';
import { PlanActions } from '../ProjectActionGroups.jsx';
+import ShotPacingFields from '../ShotPacingFields.jsx';
import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';
import { FOOTAGE_OPTIONAL_MODES } from '../../../lib/musicVideoStages.js';
import { parseSceneFilter, sceneAttention, sceneMatchesFilter } from '../../../lib/musicVideoSceneAttention.js';
@@ -75,6 +76,7 @@ export default function BoardStage({ board }) {
<fieldset disabled={locked} className="min-w-0 space-y-3">
<div className="rounded-lg border border-port-border bg-port-card p-3">
<PlanActions project={project} busy={busy} onPlan={board.onPlan} onAutoArrange={board.onAutoArrange} />
+ <ShotPacingFields project={project} onEditLocal={board.editProjectLocal} onSave={board.saveProjectFields} />
</div>
<StageSection id="mv-board-treatment" title="Treatment" summary={scenes.length ? treatmentSummary(project) : 'Plan shots to direct them'}>
diff --git a/client/src/components/musicVideo/stages/SetupStage.test.jsx b/client/src/components/musicVideo/stages/SetupStage.test.jsx
index 930f2de9c3..7bb4193468 100644
--- a/client/src/components/musicVideo/stages/SetupStage.test.jsx
+++ b/client/src/components/musicVideo/stages/SetupStage.test.jsx
@@ -35,7 +35,7 @@ describe('SetupStage Song & lyrics', () => {
expect(advanced.contains(screen.getByText('Preview audio timing revision'))).toBe(true);
steps.forEach((s) => expect(advanced.contains(s)).toBe(false));
// The lyrics editor is inline in step 3, not a nested fold.
- expect(steps[2].contains(within(steps[2]).getByText(/Lyrics, phrases & pacing/).closest('details'))).toBe(false);
+ expect(steps[2].contains(within(steps[2]).getByText(/Lyrics & phrases/).closest('details'))).toBe(false);
});
it('marks later steps to do for an empty project', () => {
diff --git a/client/src/hooks/useMusicVideoTreatment.js b/client/src/hooks/useMusicVideoTreatment.js
index a93eff269a..f9c4538190 100644
--- a/client/src/hooks/useMusicVideoTreatment.js
+++ b/client/src/hooks/useMusicVideoTreatment.js
@@ -9,7 +9,7 @@ import {
reviewMusicVideoTreatmentProof,
} from '../services/apiMusicVideo.js';
-const AI_SKIP_LABELS = {
+export const AI_SKIP_LABELS = {
'no-provider': 'no AI provider is configured',
'provider-disabled': 'the AI provider is disabled',
'llm-failed': 'the AI call failed',
@@ -17,6 +17,9 @@ const AI_SKIP_LABELS = {
'too-many-shots': 'too many shots for one AI pass',
};
+/** Friendly text for an AI skip code, falling back to the raw code. */
+export const aiSkipLabel = (code) => AI_SKIP_LABELS[code] || code;
+
/**
* The Music Video pre-production treatment (#8980): brief/arc/shot-direction
* edits, compile, the Apply review and proof verdicts.
@@ -97,7 +100,7 @@ export default function useMusicVideoTreatment({ project, onProjectPatch, replac
adopt(id, treatment);
if (id === projectRef.current) setPreview(null);
const shots = treatment.shotDirections.length;
- if (useAi && !aiUsed) toast.error(`Drafted without AI — ${AI_SKIP_LABELS[aiSkippedReason] || aiSkippedReason}`);
+ if (useAi && !aiUsed) toast.error(`Drafted without AI — ${aiSkipLabel(aiSkippedReason)}`);
else toast.success(`Treatment compiled for ${shots} shot${shots === 1 ? '' : 's'}${aiUsed ? ' with AI' : ''}`);
return treatment;
}),
diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsx
index 3af2394c6c..d49706d2dc 100644
--- a/client/src/pages/MusicVideo.jsx
+++ b/client/src/pages/MusicVideo.jsx
@@ -50,7 +50,7 @@ import useMusicVideoModelSettings from '../hooks/useMusicVideoModelSettings.js';
import useMusicVideoManualTempo from '../hooks/useMusicVideoManualTempo.js';
import useMusicVideoSceneMedia from '../hooks/useMusicVideoSceneMedia.js';
import useMusicVideoTakes from '../hooks/useMusicVideoTakes.js';
-import useMusicVideoTreatment from '../hooks/useMusicVideoTreatment.js';
+import useMusicVideoTreatment, { aiSkipLabel } from '../hooks/useMusicVideoTreatment.js';
import useHydratedPreviewRoute from '../hooks/useHydratedPreviewRoute.js';
import { normalizeImage, normalizeVideo } from '../components/media/normalize.js';
import { useVideoFileSrc } from '../hooks/useVideoFileSrc.js';
@@ -555,7 +555,7 @@ export default function MusicVideo() {
replaceProject(project);
const suffix = promptsSeeded
? ' with first-pass prompts'
- : (promptsSkippedReason && promptsSkippedReason !== 'not-requested' ? ` (prompts skipped: ${promptsSkippedReason})` : '');
+ : (promptsSkippedReason && promptsSkippedReason !== 'not-requested' ? ` (prompts skipped: ${aiSkipLabel(promptsSkippedReason)})` : '');
toast.success(`Planned ${scenesAdded} shot${scenesAdded === 1 ? '' : 's'}${suffix}`);
})
.catch((err) => toast.error(err?.message || 'Plan failed'))