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
fix: honor per-scene layers in composition-document projects
[._.]/ Adam Eivya3282bb306a7
diff --git a/client/src/components/musicVideo/ProjectActionGroups.jsx b/client/src/components/musicVideo/ProjectActionGroups.jsxindex 1179993f95..bc7aa410f5 100644--- a/client/src/components/musicVideo/ProjectActionGroups.jsx+++ b/client/src/components/musicVideo/ProjectActionGroups.jsx@@ -2,7 +2,7 @@ import { Film, Music, Activity, Image as ImageIcon, Video, Wand2 } from 'lucide-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';+import { isLayeredComposition, sceneRenderReady, sceneVisualLayer } from '../../lib/musicVideoLayers.js';import { compositionDraft, RENDER_STYLES } from './compositionDraft.js';/**@@ -89,7 +89,7 @@ export function GenerationActions({ project, videoSettings, sceneMedia }) {// #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 mode = project.composition?.mode || 'concat';- const layered = mode === 'composed';+ const layered = isLayeredComposition(project);const codeMode = mode === 'code';const frameScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) !== 'card');const footageScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) === 'footage');@@ -165,7 +165,7 @@ export function RenderFinalButton({ project, renderJob }) {const scenes = project.scenes || [];const sceneCount = scenes.length;const mode = project.composition?.mode || 'concat';- const layered = mode === 'composed';+ const layered = isLayeredComposition(project);const codeMode = mode === 'code';const documentMode = mode === 'document';const readySceneCount = scenes.filter((scene) => sceneRenderReady(scene, { layered })).length;diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex 15c5e39e91..f15ba0ffb8 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -242,7 +242,7 @@ export default function SceneCard({</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.+ {LAYER_LABELS[layer]} sections render in composed or document mode — a plain render plays this scene's footage.</p>)}{layer !== 'footage' && layered && !sceneHasAuthoredSpan(scene) && (diff --git a/client/src/components/musicVideo/stages/BoardStage.jsx b/client/src/components/musicVideo/stages/BoardStage.jsxindex bd5093a5db..361de76144 100644--- a/client/src/components/musicVideo/stages/BoardStage.jsx+++ b/client/src/components/musicVideo/stages/BoardStage.jsx@@ -2,6 +2,7 @@ import { Plus } from 'lucide-react';import BeatTimeline from '../BeatTimeline.jsx';import SceneCard from '../SceneCard.jsx';import { PlanActions } from '../ProjectActionGroups.jsx';+import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';/*** Board: plan and arrange the shots, the beat timeline, and the scene cards —@@ -61,7 +62,7 @@ export default function BoardStage({ board }) {onReviewTake={takes.reviewTake}onImportTake={(target) => board.setPickerTarget({ type: 'take', sceneId: target.sceneId })}onImportClipTake={(target) => board.setPickerTarget({ type: 'clip', sceneId: target.sceneId })}- layered={project.composition?.mode === 'composed'}+ layered={isLayeredComposition(project)}/>))}</div>diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.jsindex 49bf9b880e..e63b57620b 100644--- a/client/src/hooks/useMusicVideoSceneMedia.js+++ b/client/src/hooks/useMusicVideoSceneMedia.js@@ -6,7 +6,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';+import { isLayeredComposition, sceneVisualLayer } from '../lib/musicVideoLayers.js';import {approximateMotionCues, falSceneTake, falTakeRequestFields, grokCoverage, isPerformanceScene, performanceBlockedReason,} from '../lib/musicVideoShotTiming.js';@@ -305,7 +305,7 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applySconst 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 layered = isLayeredComposition(project);const frameScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) !== 'card');const footageScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) === 'footage');const generateMissingFrames = () => {diff --git a/client/src/lib/musicVideoLayers.js b/client/src/lib/musicVideoLayers.jsindex b90c44023b..ce47b6328a 100644--- a/client/src/lib/musicVideoLayers.js+++ b/client/src/lib/musicVideoLayers.js@@ -9,4 +9,6 @@ export {sceneVisualLayer,sceneHasAuthoredSpan,sceneRenderReady,+ isLayeredComposition,+ LAYERED_COMPOSITION_MODES,} from '../../../server/lib/musicVideoLayers.js';diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.jsindex 0296cae517..423b2107cb 100644--- a/client/src/lib/musicVideoStages.js+++ b/client/src/lib/musicVideoStages.js@@ -4,7 +4,7 @@* spend. Pure functions over the project record so the header, the progress* strip and the tests all read the same answer.*/-import { sceneRenderReady } from './musicVideoLayers.js';+import { isLayeredComposition, sceneRenderReady } from './musicVideoLayers.js';export const MUSIC_VIDEO_STAGES = [{ id: 'setup', label: 'Setup', title: 'Setup' },@@ -85,7 +85,7 @@ export function deriveStages(project) {const cast = project?.castAndSets || null;const run = currentProductionRun(project);const liveRun = !!run && RESUMABLE_RUN_STATUSES.has(run.status);- const layered = mode === 'composed';+ const layered = isLayeredComposition(project);// Code and document renders draw the picture themselves; scene footage is optional there.const footageOptional = mode === 'code' || mode === 'document';const planned = scenes.length > 0;diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 74a63b3983..24ac19b54b 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -1217,7 +1217,7 @@ describe('MusicVideo section layers (#8985)', () => {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') }, 'board');- expect(await screen.findByText(/Title card sections render in composed mode/)).toBeTruthy();+ expect(await screen.findByText(/Title card sections render in composed or document mode/)).toBeTruthy();await openStage('review');expect(screen.getByRole('button', { name: /^Render final$/ })).toBeDisabled();});diff --git a/server/lib/musicVideoLayers.js b/server/lib/musicVideoLayers.jsindex 3ddfe90d71..6d3c6209f0 100644--- a/server/lib/musicVideoLayers.js+++ b/server/lib/musicVideoLayers.js@@ -13,7 +13,17 @@export const MUSIC_VIDEO_VISUAL_LAYERS = ['footage', 'still', 'card'];export const MUSIC_VIDEO_STILL_MOVES = ['hold', 'push', 'pan'];-/** The layer a scene contributes; `layered` is true only for a composed render. */+/**+ * Whether a composition honours per-scene layers: a composed render cuts+ * stills and cards itself, and a composition document (mode `document`) is+ * handed each scene's layer in `window.PORTOS_MV` and draws still/card scenes+ * itself — neither needs a clip for them, and a card needs no frame either.+ * Plain concat and code renders play footage only.+ */+export const LAYERED_COMPOSITION_MODES = Object.freeze(['composed', 'document']);+export const isLayeredComposition = (project) => LAYERED_COMPOSITION_MODES.includes(project?.composition?.mode);++/** The layer a scene contributes; `layered` is true only for a layered composition (see isLayeredComposition). */export function sceneVisualLayer(scene, { layered = false } = {}) {const layer = scene?.visualLayer;return layered && (layer === 'still' || layer === 'card') ? layer : 'footage';diff --git a/server/lib/musicVideoLayers.test.js b/server/lib/musicVideoLayers.test.jsnew file mode 100644index 0000000000..c0a2c8f696--- /dev/null+++ b/server/lib/musicVideoLayers.test.js@@ -0,0 +1,21 @@+import { describe, it, expect } from 'vitest';+import { isLayeredComposition, sceneRenderReady, sceneVisualLayer } from './musicVideoLayers.js';++describe('musicVideoLayers', () => {+ it('treats composed renders and composition documents as layered, concat and code as footage-only', () => {+ expect(isLayeredComposition({ composition: { mode: 'composed' } })).toBe(true);+ expect(isLayeredComposition({ composition: { mode: 'document' } })).toBe(true);+ expect(isLayeredComposition({ composition: { mode: 'concat' } })).toBe(false);+ expect(isLayeredComposition({ composition: { mode: 'code' } })).toBe(false);+ expect(isLayeredComposition({})).toBe(false);+ expect(isLayeredComposition(null)).toBe(false);+ });++ it('keeps a still or card layer only in a layered composition', () => {+ const card = { visualLayer: 'card', startSec: 0, endSec: 2 };+ expect(sceneVisualLayer(card, { layered: true })).toBe('card');+ expect(sceneVisualLayer(card, { layered: false })).toBe('footage');+ expect(sceneRenderReady(card, { layered: true })).toBe(true);+ expect(sceneRenderReady({ visualLayer: 'still', startSec: 0, endSec: 2 }, { layered: true })).toBe(false);+ });+});diff --git a/server/services/musicVideo/production.js b/server/services/musicVideo/production.jsindex 4738177f16..525dab6022 100644--- a/server/services/musicVideo/production.js+++ b/server/services/musicVideo/production.js@@ -41,7 +41,7 @@ import { randomUUID } from 'crypto';import { ServerError } from '../../lib/errorHandler.js';import { canonicalSnapshotChecksum } from '../../lib/snapshotChecksum.js';import { isNonBlankStr, trimTo } from '../../lib/textUtils.js';-import { sceneVisualLayer } from '../../lib/musicVideoLayers.js';+import { isLayeredComposition, sceneVisualLayer } from '../../lib/musicVideoLayers.js';import { projectAutoReviews } from './autoReview.js';import { projectRevisions } from './revision.js';import { castAndSetsSettled } from './castAndSets.js';@@ -230,7 +230,7 @@ const JOB_KIND = Object.freeze({ frame: 'image', clip: 'video' });/** The scenes that need a still frame and a clip, per the project's render mode. */function productionTargets(project) {- const layered = project?.composition?.mode === 'composed';+ const layered = isLayeredComposition(project);const scenes = Array.isArray(project?.scenes) ? project.scenes : [];return {frame: scenes.filter((s) => sceneVisualLayer(s, { layered }) !== 'card'),diff --git a/server/services/musicVideo/productionService.test.js b/server/services/musicVideo/productionService.test.jsindex e2748119a4..64197506a3 100644--- a/server/services/musicVideo/productionService.test.js+++ b/server/services/musicVideo/productionService.test.js@@ -173,6 +173,24 @@ describe('music video production run (#9066)', () => {expect(theRun().status).toBe('completed');});+ it('in a composition document, skips frames for card scenes and clips for still/card scenes', async () => {+ seedProject({+ composition: { mode: 'document' },+ scenes: [+ { sceneId: 'mvs-a', label: 'A', framePrompt: 'a lighthouse', prompt: 'waves roll', startSec: 0, endSec: 4, takes: [] },+ { sceneId: 'mvs-card', label: 'Card', visualLayer: 'card', startSec: 4, endSec: 6, takes: [] },+ { sceneId: 'mvs-still', label: 'Still', visualLayer: 'still', framePrompt: 'a harbor', referenceImageId: 'harbor.png', startSec: 6, endSec: 8, takes: [] },+ ],+ });+ await start();+ // Only the footage scene needs a frame; the card needs none and the still already has one.+ expect(dispatch.mock.calls.map(([a]) => [a.stepKind, a.scene.sceneId])).toEqual([['frame', 'mvs-a']]);+ completeJob('job-1');+ await settle();+ // Only the footage scene needs a clip — the document draws the still and the card itself.+ expect(dispatch.mock.calls.slice(1).map(([a]) => [a.stepKind, a.scene.sceneId])).toEqual([['clip', 'mvs-a']]);+ });+it('plans an empty board once, with the directive, before generating', async () => {seedProject({ scenes: [], castAndSets: { status: 'skipped' } });planProject.mockImplementation(async () => {