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: pick a scene's visual layer on the Music Video board (#8985)
[._.]/ Adam Eivy3cad40294bb8
diff --git a/client/src/components/musicVideo/ProjectToolbar.jsx b/client/src/components/musicVideo/ProjectToolbar.jsxindex a6c2c7bc86..7311b81e28 100644--- a/client/src/components/musicVideo/ProjectToolbar.jsx+++ b/client/src/components/musicVideo/ProjectToolbar.jsx@@ -2,6 +2,7 @@ import { Film, Trash2, Music, Activity, Image as ImageIcon, Video, Wand2, Copy }import RecordRenderPinRow from '../imageGen/RecordRenderPinRow.jsx';import { MUSCRIPTOR_MODELS } from '../../lib/muscriptorModels.js';import VideoRenderSettings from './VideoRenderSettings.jsx';+import { sceneRenderReady, sceneVisualLayer } from '../../lib/musicVideoLayers.js';const uniqueCount = (scenes, key) => new Set(scenes.map((scene) => scene[key]).filter(Boolean)).size;@@ -20,12 +21,19 @@ export default function ProjectToolbar({}) {const scenes = project.scenes || [];const sceneCount = scenes.length;- const referenceFrameCount = scenes.filter((scene) => scene.referenceImageId).length;- const renderableSceneCount = scenes.filter((scene) => scene.videoHistoryId).length;- const uniqueReferenceFrameCount = uniqueCount(scenes, 'referenceImageId');- const uniqueVideoCount = uniqueCount(scenes, 'videoHistoryId');- const missingFrameCount = sceneCount - referenceFrameCount;- const missingVideoCount = sceneCount - renderableSceneCount;+ // #8985: in a composed render a still needs only its frame and a title card+ // needs neither frame nor clip, so the counts cover the scenes that use them.+ const layered = project.composition?.mode === 'composed';+ const frameScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) !== 'card');+ const footageScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) === 'footage');+ const referenceFrameCount = frameScenes.filter((scene) => scene.referenceImageId).length;+ const renderableSceneCount = footageScenes.filter((scene) => scene.videoHistoryId).length;+ const readySceneCount = scenes.filter((scene) => sceneRenderReady(scene, { layered })).length;+ const uniqueReferenceFrameCount = uniqueCount(frameScenes, 'referenceImageId');+ const uniqueVideoCount = uniqueCount(footageScenes, 'videoHistoryId');+ const missingFrameCount = frameScenes.length - referenceFrameCount;+ const missingVideoCount = footageScenes.length - renderableSceneCount;+ const footageFramesReady = footageScenes.every((scene) => scene.referenceImageId);const generatingFrames = Object.keys(sceneMedia.genScenes).length > 0;const generatingVideos = Object.keys(sceneMedia.genVideoScenes).length > 0;const noAudio = !project.trackId && !project.uploadedAudioFilename;@@ -94,18 +102,18 @@ export default function ProjectToolbar({: (missingFrameCount > 0 ? `Generate ${missingFrameCount} missing reference frame${missingFrameCount === 1 ? '' : 's'}` : 'Every scene has a reference frame')}className="flex items-center gap-1 bg-port-bg border border-port-border rounded px-2 py-1.5 text-sm min-h-[44px] sm:min-h-0 disabled:opacity-50">- <ImageIcon size={15} /> Frames {referenceFrameCount}/{sceneCount}+ <ImageIcon size={15} /> Frames {referenceFrameCount}/{frameScenes.length}</button><buttononClick={sceneMedia.generateMissingVideos}- disabled={videoSettings.saving || sceneCount === 0 || missingVideoCount === 0 || referenceFrameCount !== sceneCount || generatingVideos || !!videoSettings.videoBlockedReason}+ disabled={videoSettings.saving || footageScenes.length === 0 || missingVideoCount === 0 || !footageFramesReady || generatingVideos || !!videoSettings.videoBlockedReason}title={videoSettings.videoBlockedReason- || (referenceFrameCount !== sceneCount+ || (!footageFramesReady? 'Generate every reference frame first': (missingVideoCount > 0 ? `Generate ${missingVideoCount} missing scene video${missingVideoCount === 1 ? '' : 's'}` : 'Every scene has a video'))}className="flex items-center gap-1 bg-port-bg border border-port-border rounded px-2 py-1.5 text-sm min-h-[44px] sm:min-h-0 disabled:opacity-50">- <Video size={15} /> Videos {renderableSceneCount}/{sceneCount}+ <Video size={15} /> Videos {renderableSceneCount}/{footageScenes.length}</button>{(uniqueReferenceFrameCount < referenceFrameCount || uniqueVideoCount < renderableSceneCount) && (<span@@ -130,13 +138,15 @@ export default function ProjectToolbar({<Activity size={15} className="animate-spin" /> {renderJob.pending ? 'Preparing render…' : `${renderJob.progress}% · Cancel`}</button>) : (- <button onClick={() => renderJob.start(project.id)} disabled={renderJob.active || sceneCount === 0 || renderableSceneCount !== sceneCount}+ <button onClick={() => renderJob.start(project.id)} disabled={renderJob.active || sceneCount === 0 || readySceneCount !== sceneCount}title={renderJob.active? 'Wait for the other project render to finish, or return to it to cancel': sceneCount === 0? 'Add scenes first'- : renderableSceneCount !== sceneCount- ? `Generate videos for all ${sceneCount} scenes first`+ : readySceneCount !== sceneCount+ ? (layered+ ? `${sceneCount - readySceneCount} scene${sceneCount - readySceneCount === 1 ? ' is' : 's are'} not ready — footage needs a video, a still needs a frame and a span, a card needs a span`+ : `Generate videos for all ${sceneCount} scenes first`): 'Render the complete music video over the track'}className="flex items-center gap-1 bg-port-accent text-white rounded px-2 py-1.5 text-sm min-h-[44px] sm:min-h-0 disabled:opacity-50"><Film size={15} /> {renderJob.active ? 'Rendering another project…' : 'Render final'}diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex 49d060b61e..c71c8a2d5d 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -3,6 +3,11 @@ import { Trash2, Activity, ArrowUp, ArrowDown, Image as ImageIcon, Video, Maximiimport { formatDurationSec } from '../../utils/formatters.js';import { useVideoFileSrc } from '../../hooks/useVideoFileSrc.js';import SceneTakeStrip from './SceneTakeStrip.jsx';+import { MUSIC_VIDEO_VISUAL_LAYERS, sceneHasAuthoredSpan } from '../../lib/musicVideoLayers.js';++// #8985: what a composed render shows for this scene's span.+const LAYER_LABELS = { footage: 'Footage', still: 'Still image', card: 'Title card' };+const STILL_MOVE_LABELS = [['hold', 'Hold'], ['push', 'Push in'], ['pan', 'Pan']];// The two timeline-bound scene fields rendered as identical number inputs.const SCENE_TIME_FIELDS = [['Start', 'startSec'], ['End', 'endSec']];@@ -25,13 +30,17 @@ const COVERAGE_TOLERANCE_SEC = 0.25;* rejects, or notes takes there. `onImportTake` adds an externally generated* frame (gallery pick or upload) as a take; `onImportClipTake` (#8978) does the* same for an existing gallery clip.+ *+ * The layer picker (#8985) chooses what a composed render (`layered`) shows+ * for the scene's span: its footage, its selected frame with a camera move, or+ * a title card. A plain render always plays footage, and says so.*/export default function SceneCard({scene, index, isLast, generatingFrame, generatingVideo,settingsSaving, videoBlockedReason, canContinueShot,onMove, onDelete, onEditLocal, onSave,onGenerateFrame, onGenerateVideo, onContinueVideo,- onOpenPreview, onSelectTake, onReviewTake, onImportTake, onImportClipTake, takeBusy = false,+ onOpenPreview, onSelectTake, onReviewTake, onImportTake, onImportClipTake, takeBusy = false, layered = false,}) {// Pause the inline clip before opening the lightbox so the user can't hear// two desynced copies — MediaLightbox autoplays unmuted, and the thumb's@@ -58,6 +67,8 @@ export default function SceneCard({const shortBySec = !loops && spanSec != null && clipSec != null ? spanSec - clipSec : 0;const underCovered = shortBySec > COVERAGE_TOLERANCE_SEC;const applyPatch = (patch) => { onEditLocal(scene.sceneId, patch); onSave(scene.sceneId, patch); };+ const layer = MUSIC_VIDEO_VISUAL_LAYERS.includes(scene.visualLayer) ? scene.visualLayer : 'footage';+ const fieldId = (name) => `mv-scene-${scene.sceneId}-${name}`;return (<div className="bg-port-card border border-port-border rounded-lg p-3 space-y-2"><div className="flex items-center justify-between gap-2">@@ -116,6 +127,47 @@ export default function SceneCard({Loop clip</label></div>+ <div className="flex flex-wrap gap-2 items-center text-xs">+ <label htmlFor={fieldId('layer')}>Layer</label>+ <select id={fieldId('layer')} value={layer} onChange={(e) => applyPatch({ visualLayer: e.target.value })}+ className="bg-port-bg border border-port-border rounded px-1 py-1">+ {MUSIC_VIDEO_VISUAL_LAYERS.map((value) => <option key={value} value={value}>{LAYER_LABELS[value]}</option>)}+ </select>+ {layer === 'still' && (+ <>+ <label htmlFor={fieldId('move')}>Move</label>+ <select id={fieldId('move')} value={scene.stillMove || 'hold'} onChange={(e) => applyPatch({ stillMove: e.target.value })}+ className="bg-port-bg border border-port-border rounded px-1 py-1">+ {STILL_MOVE_LABELS.map(([value, text]) => <option key={value} value={value}>{text}</option>)}+ </select>+ </>+ )}+ {layer === 'card' && (+ <>+ <label htmlFor={fieldId('card-text')}>Card text</label>+ <input id={fieldId('card-text')} type="text" maxLength={500} value={scene.cardText || ''}+ placeholder="Title shown on the card"+ onChange={(e) => onEditLocal(scene.sceneId, { cardText: e.target.value })}+ onBlur={(e) => onSave(scene.sceneId, { cardText: e.target.value.trim() || null })}+ className="min-w-0 flex-1 basis-40 bg-port-bg border border-port-border rounded px-1 py-1" />+ <label htmlFor={fieldId('card-color')}>Background</label>+ <input id={fieldId('card-color')} type="color" value={scene.cardColor || '#000000'}+ onChange={(e) => onEditLocal(scene.sceneId, { cardColor: e.target.value })}+ onBlur={(e) => onSave(scene.sceneId, { cardColor: e.target.value })}+ className="h-8 w-10 bg-port-bg border border-port-border rounded" />+ </>+ )}+ </div>+ {layer !== 'footage' && !layered && (+ <p className="text-[11px] text-port-text-muted">+ {LAYER_LABELS[layer]} sections render in composed mode — a plain render plays this scene's footage.+ </p>+ )}+ {layer !== 'footage' && layered && !sceneHasAuthoredSpan(scene) && (+ <p role="alert" className="text-[11px] text-port-warning">+ Set a start and end — a {layer === 'card' ? 'title card' : 'still'} runs for exactly its span.+ </p>+ )}{underCovered && (<div role="alert" className="flex flex-wrap items-center gap-2 rounded border border-port-warning/40 bg-port-warning/10 px-2 py-1.5 text-xs text-port-warning"><AlertTriangle size={13} className="shrink-0" />diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.jsindex b5c76daee3..37901ecb37 100644--- a/client/src/hooks/useMusicVideoSceneMedia.js+++ b/client/src/hooks/useMusicVideoSceneMedia.js@@ -4,6 +4,7 @@ import { generateImage } from '../services/apiSystem.js';import { generateVideo } from '../services/apiImageVideo.js';import useSceneRenderLifecycle from './useSceneRenderLifecycle.js';import { isLtx2FamilyRuntime } from '../lib/runnerFamilies';+import { sceneVisualLayer } from '../lib/musicVideoLayers.js';// Audio-reactive generation conditions motion on the song itself, so the prompt// has to rule out anything that reads as a performance of it.@@ -249,8 +250,13 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS};const scenes = project?.scenes || [];+ // #8985: a composed render's title cards need no frame, and its stills need+ // no clip — the batch generators skip them.+ const layered = project?.composition?.mode === 'composed';+ const frameScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) !== 'card');+ const footageScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) === 'footage');const generateMissingFrames = () => {- const pending = scenes.filter((scene) =>+ const pending = frameScenes.filter((scene) =>!scene.referenceImageId && !genScenes[scene.sceneId] && buildFramePrompt(scene));if (pending.length === 0) {toast.info('Every scene already has a reference frame');@@ -260,11 +266,11 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS};const generateMissingVideos = () => {- const pending = scenes.filter((scene) =>+ const pending = footageScenes.filter((scene) =>scene.referenceImageId && !scene.videoHistoryId && !genVideoScenes[scene.sceneId] && buildShotPrompt(scene));if (pending.length === 0) {- const referenceFrameCount = scenes.filter((scene) => scene.referenceImageId).length;- toast.info(referenceFrameCount < scenes.length+ const referenceFrameCount = footageScenes.filter((scene) => scene.referenceImageId).length;+ toast.info(referenceFrameCount < footageScenes.length? 'Generate every reference frame before generating the remaining videos': 'Every scene already has a video');return;diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex 9c52896862..abc2fe8464 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -58,6 +58,7 @@ grep -i "what you want to do" client/src/lib/README.md| `backupExcludes.js` | CLIENT MIRROR of the backup-exclude block in `server/lib/sharedSchemas.js` (#7241) — `anchorUserExclude` / `anchorUserExcludes` / `isSafeExcludePattern` / `EXCLUDE_PATTERN_MAX_LENGTH`. The Backup settings tab anchors a newly added exclude and renders the effective list with these, so the chip the user sees is the rsync filter the server will actually run instead of an unanchored pattern that matches at any depth. || `beatColors.js` | `BEAT_KIND_COLORS` + `getBeatKindColor(kind)` — per-kind display colors for reader-map emotional beats (kinds defined server-side in `storyArc.js`). Keeps every beat visualization consistent. || `beatGrid.js` | Music-video beat-quantized timeline arranger (#1854). `buildBeatGridPoints(audioAnalysis)` merges beats/downbeats/section edges into one ranked snap-point list; `snapTimeToGrid(timeSec, gridPoints, toleranceSec)` finds the nearest point within tolerance; `computeSceneSpans(scenes, durationSec)` lays out scenes without a persisted `startSec`/`endSec` contiguously as a display-only fallback; `computeDragSpan({kind, startSpan, deltaSec, gridPoints, ...})` resolves a timeline drag gesture (`'move'` or `'right'` — no `'left'`, since the render can only trim from a clip's own frame 0) into a new span; `shouldMarkBeatAligned({kind, snapped, wasPersisted})` gates the `beatAligned` flag so a reposition-only drag can't silently promote an unpersisted scene's placeholder fallback duration into a "saved exactly" render duration; `autoArrangeScenes(scenes, audioAnalysis)` proposes a full `{ sceneId, startSec, endSec, beatAligned }[]` arrangement by distributing scenes across song sections weighted by each section's `energy` (#1915). Used by `components/musicVideo/BeatTimeline.jsx` and `pages/MusicVideo.jsx`. |+| `musicVideoLayers.js` | Music-video per-scene visual layers (#8985), re-exported from `server/lib/musicVideoLayers.js`: `MUSIC_VIDEO_VISUAL_LAYERS`, `MUSIC_VIDEO_STILL_MOVES`, `sceneVisualLayer(scene, { layered })`, `sceneHasAuthoredSpan`, `sceneRenderReady(scene, { layered })`. Used by `components/musicVideo/SceneCard.jsx`, `ProjectToolbar.jsx` and `hooks/useMusicVideoSceneMedia.js`. || `musicVideoTakes.js` | Music-video scene takes view helpers (#8965): `sceneTakeList(scene, kind)` lists a scene's image/video takes with an un-materialized pre-takes selection appended as a read-only `legacy` take; `takePreviewKey`, `takeThumbUrl`, `takeProvenance`; `TAKE_SLOT` maps a take kind to its selection field. Used by `components/musicVideo/SceneTakeStrip.jsx` and `pages/MusicVideo.jsx`. || `musicVideoUniverseRefs.js` | `pullUniverseCanonReferences(universe, existingReferences)` (#8978) maps a linked universe's characters/places/objects to visual-spec references (character/set/prop roles), skipping images already present and capping at `MUSIC_VIDEO_MAX_REFERENCES` (24, mirrors the server schema). Returns `{ next, added, skipped }`; the caller persists `next` via the ordinary visualSpec PATCH. Used by `components/musicVideo/VisualSpecPanel.jsx`. || `bibleLimits.js` | `BIBLE_LIMITS` re-exported from the pure leaf `server/lib/bibleLimits.js`, plus the client-only `capImageRefs` / `appendImageRefById` for the optimistic imageRefs-append paths. |diff --git a/client/src/lib/index.js b/client/src/lib/index.jsindex 608dc7534a..c2503c0448 100644--- a/client/src/lib/index.js+++ b/client/src/lib/index.js@@ -66,6 +66,7 @@ export * from './issueLength.js';export * from './issueRefs.js';export * from './musicDuration.js';export * from './muscriptorModels.js';+export * from './musicVideoLayers.js';export * from './musicVideoTakes.js';export * from './musicVideoUniverseRefs.js';export * from './pipelineImageDefaults.js';diff --git a/client/src/lib/musicVideoLayers.js b/client/src/lib/musicVideoLayers.jsnew file mode 100644index 0000000000..b90c44023b--- /dev/null+++ b/client/src/lib/musicVideoLayers.js@@ -0,0 +1,12 @@+/**+ * Music Video per-scene visual layers (#8985) — re-export of+ * `server/lib/musicVideoLayers.js`, so the board's layer picker and Render+ * readiness follow the same rules as the server's render preflight.+ */+export {+ MUSIC_VIDEO_VISUAL_LAYERS,+ MUSIC_VIDEO_STILL_MOVES,+ sceneVisualLayer,+ sceneHasAuthoredSpan,+ sceneRenderReady,+} from '../../../server/lib/musicVideoLayers.js';diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 6939d26ecc..b778051c88 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -731,6 +731,7 @@ export default function MusicVideo() {onReviewTake={takes.reviewTake}onImportTake={(target) => setPickerTarget({ type: 'take', sceneId: target.sceneId })}onImportClipTake={(target) => setPickerTarget({ type: 'clip', sceneId: target.sceneId })}+ layered={selected.composition?.mode === 'composed'}/>))}</div>diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 41a8186930..c1be2826d3 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -783,6 +783,38 @@ describe('MusicVideo typography composition (#8984)', () => {});});+describe('MusicVideo section layers (#8985)', () => {+ const scenes = [+ { sceneId: 's1', order: 0, prompt: 'a', referenceImageId: 'img1', videoHistoryId: 'h1', startSec: 0, endSec: 4 },+ { sceneId: 's2', order: 1, prompt: 'b', referenceImageId: null, videoHistoryId: null, startSec: 4, endSec: 6 },+ ];+ const composition = (mode) => ({ version: 1, mode, textCues: [], style: { color: '#ffffff', font: 'sans' }, posterSec: null });++ it('makes a footage-less scene a title card so a composed project can render', async () => {+ updateMusicVideoScene.mockResolvedValue({});+ await openProject({ ...PROJECT_WITH_CLIP, scenes, composition: composition('composed') });+ const renderBtn = await screen.findByRole('button', { name: /^Render final$/ });+ expect(renderBtn).toBeDisabled();++ const layer = document.getElementById('mv-scene-s2-layer');+ fireEvent.change(layer, { target: { value: 'card' } });+ await waitFor(() => expect(updateMusicVideoScene).toHaveBeenCalledWith('mv-1', 's2', { visualLayer: 'card' }, { silent: true }));+ const cardText = await screen.findByLabelText('Card text');+ fireEvent.change(cardText, { target: { value: 'Chapter two' } });+ fireEvent.blur(cardText);+ await waitFor(() => expect(updateMusicVideoScene).toHaveBeenCalledWith('mv-1', 's2', { cardText: 'Chapter two' }, { silent: true }));+ // A card needs no frame or clip, so the board is ready; only the footage scene counts toward Videos.+ await waitFor(() => expect(screen.getByRole('button', { name: /^Render final$/ })).toBeEnabled());+ expect(screen.getByRole('button', { name: /Videos 1\/1/ })).toBeTruthy();+ });++ it('keeps a plain render on footage and says the layer only applies to composed renders', async () => {+ await openProject({ ...PROJECT_WITH_CLIP, scenes: [scenes[0], { ...scenes[1], visualLayer: 'card' }], composition: composition('concat') });+ expect(await screen.findByText(/Title card sections render in composed mode/)).toBeTruthy();+ expect(screen.getByRole('button', { name: /^Render final$/ })).toBeDisabled();+ });+});+describe('MusicVideo concept & style editor (#3168)', () => {it('seeds the fields from the project and persists each on blur', async () => {const withConcept = { ...PROJECT_NO_CLIP, concept: { prompt: 'A road trip through neon ruins', style: 'Cyberpunk anime' } };