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

Plan generated footage when the brief selects video tools; stop demanding Performance mode without lip-sync

[._.]/ Adam Eivycf40bb3967c8
diff --git a/server/lib/musicVideoMediumPlan.js b/server/lib/musicVideoMediumPlan.js
index e36ac257c7..df0bc81c51 100644
--- a/server/lib/musicVideoMediumPlan.js
+++ b/server/lib/musicVideoMediumPlan.js
@@ -1,4 +1,5 @@
import { musicVideoAllowsMedia } from './musicVideoMediaPolicy.js';
+import { performanceCapability } from './musicVideoShotTiming.js';
/**
* Planning-only medium policy. Final-edit seconds are an interval union, not
* provider clip lengths or a sum that double-counts overlapping footage.
@@ -123,6 +124,8 @@ export function codeFirstProductionAssets(project) {
if (plan.strategy !== 'code-first') return null;
const directions = new Map((project?.treatment?.shotDirections || []).map((d) => [d.sceneId, d]));
const steps = [];
+ // Without a lip-sync lane a performance direction is planned as a non-sync shot, so the shot mode cannot (and need not) become Performance.
+ const lipSync = !!performanceCapability(project?.videoSettings?.backend || null);
const conflicts = plan.unresolved.filter((item) => item.blocking || item.message.startsWith('Visible performance')).map((item) => item.message);
if (!Number.isInteger(project.treatment?.revision) || project.treatment.appliedRevision !== project.treatment.revision) {
conflicts.push('Apply the current medium plan to approve it before production.');
@@ -132,7 +135,7 @@ export function codeFirstProductionAssets(project) {
const medium = direction?.medium;
if (!MUSIC_VIDEO_MEDIA.includes(medium)) continue;
if (scene.shotMode === 'performance' && !['existing-footage', 'generated-footage'].includes(medium)) conflicts.push(`Performance shot ${scene.label || scene.sceneId} requires selected footage; revise its shot mode or medium explicitly.`);
- if ((direction?.mode === 'performance' || scene.shotMode === 'performance')
+ if (((direction?.mode === 'performance' && lipSync) || scene.shotMode === 'performance')
&& ['existing-footage', 'generated-footage'].includes(medium)
&& (scene.shotMode !== 'performance' || (scene.visualLayer != null && scene.visualLayer !== 'footage'))) {
conflicts.push(`Set ${scene.label || scene.sceneId} to a Performance footage shot before production; its approved performance must retain source-audio timing.`);
@@ -162,6 +165,8 @@ export function codeFirstProductionAssets(project) {
export function planMusicVideoMedia(project, directions) {
const policy = normalizeMusicVideoProductionPolicy(project.productionPolicy);
const codeFirst = policy.strategy === 'code-first';
+ // A brief that explicitly selected a video tool expects footage; the allowance below trims it.
+ const footageSeeded = codeFirst && policy.maxGeneratedVideoPercent > 0 && musicVideoBriefTools(project).some((t) => t.startsWith('video:'));
const scenes = new Map((project.scenes || []).map((s) => [s.sceneId, s]));
const previous = new Map((project.treatment?.shotDirections || []).map((d) => [d.sceneId, d]));
const planned = directions.map((d) => {
@@ -186,6 +191,10 @@ export function planMusicVideoMedia(project, directions) {
rationale = codeFirst ? 'Carry the section motif and transitions with code or available images.'
: 'Retain the legacy treatment route.';
}
+ if (codeFirst && footageSeeded && !manualLayer && medium === 'procedural' && !scene?.referenceImageId && !scene?.videoHistoryId && d.route !== 'code-2d') {
+ medium = 'generated-footage';
+ rationale = 'The brief selected video tools; plan generated footage for this shot, within the generated-video allowance.';
+ }
if (!manualLayer && !scene?.referenceImageId && !scene?.videoHistoryId && (medium === 'still' && !musicVideoAllowsMedia(project, 'image') || ['existing-footage', 'generated-footage'].includes(medium) && !musicVideoAllowsMedia(project, 'video'))) {
medium = 'procedural'; rationale = 'Author the full scene in code within the selected media mode.';
}
diff --git a/server/lib/musicVideoMediumPlan.test.js b/server/lib/musicVideoMediumPlan.test.js
index 6c0da25563..e626284bcc 100644
--- a/server/lib/musicVideoMediumPlan.test.js
+++ b/server/lib/musicVideoMediumPlan.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { musicVideoBriefAllowsVideo, musicVideoToolPolicyConflict } from './musicVideoMediumPlan.js';
+import { codeFirstProductionAssets, musicVideoBriefAllowsVideo, musicVideoToolPolicyConflict, planMusicVideoMedia } from './musicVideoMediumPlan.js';
describe('brief tools vs production policy', () => {
const codeFirst = (percent) => ({ strategy: 'code-first', maxGeneratedVideoPercent: percent });
@@ -21,3 +21,28 @@ describe('brief tools vs production policy', () => {
expect(musicVideoToolPolicyConflict({ productionPolicy: codeFirst(20) })).toBeNull();
});
});
+
+describe('footage tools on a code-first project (#10450)', () => {
+ const project = (tools, backend) => ({
+ automation: { tools },
+ productionPolicy: { strategy: 'code-first', maxGeneratedVideoPercent: 100 },
+ videoSettings: { backend },
+ audioAnalysis: { durationSec: 20 },
+ scenes: [
+ { sceneId: 's1', startSec: 0, endSec: 10, shotMode: 'cutaway' },
+ { sceneId: 's2', startSec: 10, endSec: 20, shotMode: 'cutaway' },
+ ],
+ });
+ const directions = [{ sceneId: 's1', mode: 'performance', route: 'generated' }, { sceneId: 's2', mode: 'cutaway', route: 'generated' }];
+
+ it('plans generated footage for a brief that selected a video tool, and stays procedural without one', () => {
+ expect(planMusicVideoMedia(project(['image:local', 'video:local']), directions).map((d) => d.medium)).toEqual(['generated-footage', 'generated-footage']);
+ expect(planMusicVideoMedia(project(['image:local']), directions).map((d) => d.medium)).toEqual(['procedural', 'procedural']);
+ });
+
+ it('does not demand a Performance shot mode when the backend has no lip-sync lane', () => {
+ const p = project(['video:local'], 'local');
+ p.treatment = { revision: 1, appliedRevision: 1, shotDirections: planMusicVideoMedia(p, directions).map((d) => ({ ...d, mediumRationale: 'x' })) };
+ expect(codeFirstProductionAssets(p).conflicts).toEqual([]);
+ });
+});
diff --git a/server/services/musicVideo/treatment.js b/server/services/musicVideo/treatment.js
index 3c0b9c3072..85ff37d623 100644
--- a/server/services/musicVideo/treatment.js
+++ b/server/services/musicVideo/treatment.js
@@ -642,6 +642,14 @@ function renderFieldPatch(scene, direction, { lipSyncAvailable, imagesAllowed =
return { visualLayer: 'still', ...((scene.stillMove ?? 'hold') === 'hold' ? { stillMove: 'push' } : {}) };
}
+/** Code-first Apply never reinterprets layers, but a lip-sync performance footage shot must carry the Performance shot mode preflight demands. */
+function codeFirstRenderFieldPatch(scene, direction, lipSyncAvailable) {
+ const footage = ['existing-footage', 'generated-footage'].includes(direction.medium);
+ if (!lipSyncAvailable || !footage || direction.mode !== 'performance') return {};
+ if ((scene.visualLayer ?? 'footage') !== 'footage' || (scene.shotMode ?? 'cutaway') !== 'cutaway') return {};
+ return { shotMode: 'performance' };
+}
+
const withPlannedScenes = (project, planned) => {
const byId = new Map(planned.map((s) => [s.sceneId, s]));
return { ...project, scenes: (project.scenes || []).map((s) => byId.get(s.sceneId) || s) };
@@ -714,7 +722,7 @@ export function buildApplyPreview(project) {
const fields = promptFieldPlans(scene, direction);
// This slice only plans code-first execution: never reinterpret procedural
// direction as legacy footage/card selection or switch a render mode.
- const renderFields = mediumPlan.strategy === 'code-first' ? {} : renderFieldPatch(scene, direction, { lipSyncAvailable, imagesAllowed });
+ const renderFields = mediumPlan.strategy === 'code-first' ? codeFirstRenderFieldPatch(scene, direction, lipSyncAvailable) : renderFieldPatch(scene, direction, { lipSyncAvailable, imagesAllowed });
planned.push({ ...scene, ...renderFields });
scenes.push({
sceneId: scene.sceneId,