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: map treatment direction onto real shot modes and visual layers (#8980)

[._.]/ Adam Eivy9cb149544cff
diff --git a/client/src/components/musicVideo/TreatmentApplyReview.jsx b/client/src/components/musicVideo/TreatmentApplyReview.jsx
index 690a701652..aaa505cf7a 100644
--- a/client/src/components/musicVideo/TreatmentApplyReview.jsx
+++ b/client/src/components/musicVideo/TreatmentApplyReview.jsx
@@ -10,6 +10,15 @@ const PROMPT_LABELS = {
};
const PROMPT_FIELDS = [['framePrompt', 'Frame prompt'], ['prompt', 'Motion prompt']];
+// The scene render fields Apply sets (#8977 shot mode, #8985 visual layer).
+function renderFieldLabel(fields) {
+ if (!fields) return null;
+ if (fields.shotMode === 'performance') return 'becomes a lip-synced performance shot';
+ if (fields.visualLayer === 'card') return 'becomes a title card (composed render only)';
+ if (fields.visualLayer === 'still') return 'becomes a moving still (composed render only)';
+ return null;
+}
+
const snippet = (text) => (text && text.length > 90 ? `${text.slice(0, 89)}…` : text || '—');
/**
@@ -80,6 +89,7 @@ export default function TreatmentApplyReview({ project, api }) {
<span className="font-medium">{labels.get(s.sceneId) || s.label}</span>
<span className="text-port-text-muted">{s.directionChanged ? 'direction updated' : 'direction unchanged'} · {PROMPT_LABELS[s.prompt]}</span>
{s.keepsSelection && <span className="text-port-text-muted">· selected takes kept</span>}
+ {renderFieldLabel(s.renderFields) && <span className="text-port-accent">· {renderFieldLabel(s.renderFields)}</span>}
</div>
{s.prompt === 'manual' && (
<div className="mt-1 space-y-0.5">
diff --git a/client/src/components/musicVideo/TreatmentPanel.test.jsx b/client/src/components/musicVideo/TreatmentPanel.test.jsx
index 25fcadd073..b4462c00ad 100644
--- a/client/src/components/musicVideo/TreatmentPanel.test.jsx
+++ b/client/src/components/musicVideo/TreatmentPanel.test.jsx
@@ -62,7 +62,7 @@ const PREVIEW = {
blocked: false,
scenes: [
{ sceneId: 's1', label: 'Intro · 1/2', directionChanged: true, prompt: 'manual', fields: { framePrompt: 'manual', prompt: 'manual' }, promptFingerprint: 'fp-s1', current: { framePrompt: 'my own frame', prompt: 'my own motion' }, suggested: { framePrompt: 'train window', prompt: 'push in' }, keepsSelection: true },
- { sceneId: 's2', label: 'Intro · 2/2', directionChanged: true, prompt: 'fill', fields: { framePrompt: 'fill', prompt: 'fill' }, promptFingerprint: 'fp-s2', current: { framePrompt: '', prompt: '' }, suggested: { framePrompt: 'rain', prompt: 'drift' }, keepsSelection: false },
+ { sceneId: 's2', label: 'Intro · 2/2', directionChanged: true, prompt: 'fill', fields: { framePrompt: 'fill', prompt: 'fill' }, promptFingerprint: 'fp-s2', current: { framePrompt: '', prompt: '' }, suggested: { framePrompt: 'rain', prompt: 'drift' }, keepsSelection: false, renderFields: { shotMode: 'performance' } },
],
missingSceneIds: [],
unmappedSceneIds: [],
@@ -98,6 +98,7 @@ describe('TreatmentPanel apply review', () => {
expect(await screen.findByText(/2 of 2 scenes would change/)).toBeTruthy();
expect(screen.getByText(/your edited prompts are kept/)).toBeTruthy();
expect(screen.getByText(/selected takes kept/)).toBeTruthy();
+ expect(screen.getByText(/becomes a lip-synced performance shot/)).toBeTruthy();
// Both hand-edited fields the tick would replace are shown, not just one.
expect(screen.getByText('Frame prompt — yours: my own frame')).toBeTruthy();
expect(screen.getByText('Motion prompt — treatment: push in')).toBeTruthy();
diff --git a/client/src/components/musicVideo/TreatmentShotList.jsx b/client/src/components/musicVideo/TreatmentShotList.jsx
index 4fb53a5716..12aece5a1f 100644
--- a/client/src/components/musicVideo/TreatmentShotList.jsx
+++ b/client/src/components/musicVideo/TreatmentShotList.jsx
@@ -2,7 +2,7 @@ import useFieldDraft from '../../hooks/useFieldDraft.js';
import { formatTimecode } from '../../utils/formatters.js';
const MODES = ['performance', 'cutaway', 'graphic'];
-const ROUTES = [['generated', 'Generated'], ['supplied-asset', 'Supplied asset'], ['code-2d', '2D / code motion']];
+const ROUTES = [['generated', 'Generated'], ['supplied-asset', 'Supplied asset'], ['code-2d', 'Title card / still']];
const REGIONS = [['none', 'No text region'], ['upper', 'Upper third'], ['center', 'Center'], ['lower', 'Lower third']];
const TYPE_ROLES = [['none', 'No text'], ['subtitle', 'Subtitle'], ['hero', 'Hero title']];
const cellCls = 'w-full bg-port-bg border border-port-border rounded px-1.5 py-1 text-xs';
diff --git a/docs/HTML_COMPOSITIONS.md b/docs/HTML_COMPOSITIONS.md
index 85f4a17fc9..a1d5904cc4 100644
--- a/docs/HTML_COMPOSITIONS.md
+++ b/docs/HTML_COMPOSITIONS.md
@@ -180,6 +180,11 @@ low-detail negative space and asks the image/video model for no lettering, so
the generated picture leaves room for the composited text rather than baking
text into pixels. Apply can also add text cues from the timed lyrics, placed
in each shot's reserved region; it never switches the render to `composed`.
+Apply also maps direction onto the scene's own render fields, but only while
+they are still at their defaults: a shot routed to 2D/code motion becomes a
+title card carrying its first sung line (or a pushed-in still when it has no
+line), and a performance shot becomes a `performance` shot mode only when the
+project's video backend has a source-audio lip-sync lane (fal.ai today).
The treatment's proof checklist treats readable text and audio alignment as
judgeable only in the final render.
diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.js
index 61254ebc8c..c34b6983a3 100644
--- a/server/lib/musicVideoValidation.js
+++ b/server/lib/musicVideoValidation.js
@@ -241,7 +241,10 @@ const sceneLayerFields = {
// revision it was based on. See services/musicVideo/treatment.js.
export const MUSIC_VIDEO_ASPECT_RATIOS = ['16:9', '9:16', '1:1', '4:5', '2.39:1'];
export const MUSIC_VIDEO_BEAT_ROLES = ['opening', 'build', 'contrast', 'payoff', 'release'];
-export const MUSIC_VIDEO_SHOT_MODES = ['performance', 'cutaway', 'graphic'];
+// Treatment shot categories (the arc's balance axis). Distinct from the scene's
+// render-facing `shotMode` (#8977: cutaway | performance) — Apply maps a
+// performance direction onto it when the backend can lip-sync.
+export const MUSIC_VIDEO_TREATMENT_SHOT_MODES = ['performance', 'cutaway', 'graphic'];
export const MUSIC_VIDEO_SHOT_ROUTES = ['generated', 'supplied-asset', 'code-2d'];
export const MUSIC_VIDEO_NEGATIVE_SPACE = ['none', 'upper', 'center', 'lower'];
export const MUSIC_VIDEO_TYPOGRAPHY_ROLES = ['none', 'subtitle', 'hero'];
@@ -282,7 +285,7 @@ export const musicVideoTreatmentMotifSchema = z.object({
export const musicVideoShotDirectionPatchSchema = z.object({
sceneId: z.string().min(1).max(64),
- mode: z.enum(MUSIC_VIDEO_SHOT_MODES).optional(),
+ mode: z.enum(MUSIC_VIDEO_TREATMENT_SHOT_MODES).optional(),
route: z.enum(MUSIC_VIDEO_SHOT_ROUTES).optional(),
focalSubject: treatmentText(500),
framing: treatmentText(500),
diff --git a/server/routes/musicVideoTreatment.test.js b/server/routes/musicVideoTreatment.test.js
index ea768ab49f..c987c858e4 100644
--- a/server/routes/musicVideoTreatment.test.js
+++ b/server/routes/musicVideoTreatment.test.js
@@ -66,8 +66,12 @@ function seedVideoHistory(rows) {
const base = (id) => `/api/music-video/${id}`;
const reload = (id) => projects.getProject(id);
-async function plannedProject({ lyrics = LYRICS } = {}) {
- const project = await projects.createProject({ name: 'Example Video', concept: { prompt: 'a night run through Example City' } });
+async function plannedProject({ lyrics = LYRICS, backend } = {}) {
+ const project = await projects.createProject({
+ name: 'Example Video',
+ concept: { prompt: 'a night run through Example City' },
+ ...(backend ? { videoSettings: { backend } } : {}),
+ });
await projects.setProjectAnalysis(project.id, ANALYSIS);
if (lyrics.length) await projects.updateProject(project.id, { lyricCues: lyrics });
const plan = await request(app).post(`${base(project.id)}/plan`).send({ seedPrompts: false });
@@ -341,6 +345,69 @@ describe('treatment apply', () => {
});
});
+describe('treatment → scene render fields (#8977 shot mode, #8985 visual layer)', () => {
+ it('states the lip-sync gap for a backend without it and never marks scenes as performances there', async () => {
+ const project = await plannedProject();
+ const { body } = await compile(project.id, { baseRevision: 0, useAi: false });
+ const gap = body.treatment.capabilityGaps.find((g) => g.id === 'lip-sync');
+ expect(gap.detail).toMatch(/fal\.ai/);
+ const res = await request(app).post(`${base(project.id)}/treatment/apply`).send({ revision: body.treatment.revision });
+ expect(res.body.result.renderFieldsSet).toEqual([]);
+ expect((await reload(project.id)).scenes.every((s) => s.shotMode === 'cutaway')).toBe(true);
+ });
+
+ it('maps performance direction onto shotMode on a lip-sync backend and proves sync in the render', async () => {
+ const project = await plannedProject({ backend: 'fal' });
+ const { body } = await compile(project.id, { baseRevision: 0, useAi: false });
+ expect(body.treatment.capabilityGaps.map((g) => g.id)).not.toContain('lip-sync');
+ const riskShot = body.treatment.proofs.find((p) => p.kind === 'risk-shot');
+ expect(riskShot.checks).toContain('lip-sync');
+ const performing = body.treatment.shotDirections.filter((d) => d.mode === 'performance').map((d) => d.sceneId);
+ expect(performing.length).toBeGreaterThan(0);
+ const res = await request(app).post(`${base(project.id)}/treatment/apply`).send({ revision: body.treatment.revision });
+ expect(res.body.result.renderFieldsSet.sort()).toEqual([...performing].sort());
+ const after = await reload(project.id);
+ for (const scene of after.scenes) expect(scene.shotMode).toBe(performing.includes(scene.sceneId) ? 'performance' : 'cutaway');
+ // The motion clause no longer tells the singer not to sing.
+ expect(after.scenes.find((sc) => performing.includes(sc.sceneId)).direction.motionClause).not.toMatch(/does not sing/);
+ });
+
+ it('turns code-2d shots into a lyric title card or a pushed still, additively and without switching the render mode', async () => {
+ const project = await plannedProject();
+ const scenes = (await reload(project.id)).scenes;
+ const sung = scenes.findIndex((sc) => sc.lyricText);
+ const instrumental = scenes.findLastIndex((sc) => !sc.lyricText);
+ const chosen = scenes.findIndex((sc, i) => i !== sung && sc.lyricText);
+ // A director's own layer choice on another code-2d shot is left alone.
+ await projects.updateScene(project.id, scenes[chosen].sceneId, { visualLayer: 'still', stillMove: 'pan' });
+ runPromptThroughProvider.mockResolvedValueOnce({
+ text: JSON.stringify({
+ beats: [{ sectionIndex: 0, objective: 'Open' }],
+ shots: [
+ { index: sung, route: 'code-2d', mode: 'graphic', typographyRole: 'subtitle', focalSubject: 'type' },
+ { index: instrumental, route: 'code-2d', mode: 'graphic', focalSubject: 'rain' },
+ { index: chosen, route: 'code-2d', mode: 'graphic', typographyRole: 'subtitle', focalSubject: 'type' },
+ ],
+ }),
+ });
+ const { body } = await compile(project.id, { baseRevision: 0 });
+ expect(body.aiUsed).toBe(true);
+ const gap = body.treatment.capabilityGaps.find((g) => g.id === 'code-2d');
+ expect(gap.detail).toMatch(/title card/);
+ expect(gap.detail).toMatch(/composed/);
+ const res = await request(app).post(`${base(project.id)}/treatment/apply`).send({ revision: body.treatment.revision, addTextCues: true });
+ expect(res.status).toBe(200);
+ const after = await reload(project.id);
+ expect(after.scenes[sung]).toMatchObject({ visualLayer: 'card', cardText: scenes[sung].lyricText.split(' / ')[0] });
+ expect(after.scenes[instrumental]).toMatchObject({ visualLayer: 'still', stillMove: 'push' });
+ expect(after.scenes[chosen]).toMatchObject({ visualLayer: 'still', stillMove: 'pan' });
+ expect(after.composition.mode).toBe('concat');
+ // The card draws its own line, so no lyric cue is stacked over it.
+ const card = after.scenes[sung];
+ expect(after.composition.textCues.some((c) => c.startSec >= card.startSec && c.startSec < card.endSec)).toBe(false);
+ });
+});
+
describe('treatment proofs, clone and motion references', () => {
it('only passes a proof on evidence that can show every check', async () => {
const project = await plannedProject();
diff --git a/server/services/musicVideo/treatment.js b/server/services/musicVideo/treatment.js
index 1cba1a0341..cd13fc299e 100644
--- a/server/services/musicVideo/treatment.js
+++ b/server/services/musicVideo/treatment.js
@@ -47,13 +47,14 @@ import { trimTo, isNonBlankStr } from '../../lib/textUtils.js';
import {
MUSIC_VIDEO_ASPECT_RATIOS as ASPECT_RATIOS,
MUSIC_VIDEO_BEAT_ROLES as BEAT_ROLES,
- MUSIC_VIDEO_SHOT_MODES as SHOT_MODES,
+ MUSIC_VIDEO_TREATMENT_SHOT_MODES as SHOT_MODES,
MUSIC_VIDEO_SHOT_ROUTES as SHOT_ROUTES,
MUSIC_VIDEO_NEGATIVE_SPACE as NEGATIVE_SPACE,
MUSIC_VIDEO_TYPOGRAPHY_ROLES as TYPOGRAPHY_ROLES,
MUSIC_VIDEO_PROOF_CHECKS as PROOF_CHECKS,
MUSIC_VIDEO_PROOF_STATUSES as PROOF_STATUSES,
} from '../../lib/musicVideoValidation.js';
+import { performanceCapability } from '../../lib/musicVideoShotTiming.js';
import { normalizeComposition } from './composition.js';
const TREATMENT_VERSION = 1;
@@ -556,6 +557,37 @@ function promptFieldPlans(scene, direction) {
const PLAN_PRIORITY = ['manual', 'fill', 'replace', 'unchanged', 'none'];
const summarizePlans = (plans) => PLAN_PRIORITY.find((p) => Object.values(plans).includes(p));
+/**
+ * The scene render fields a direction maps onto (#8977 `shotMode`, #8985
+ * visual layer), as a patch. Additive only: a field is set only while the scene
+ * still has its default (cutaway, footage), so a director's own choice is never
+ * overridden or downgraded, and the project's render mode is never switched —
+ * a still/card layer shows only in a composed render.
+ * - a performance direction becomes `shotMode: 'performance'` only when the
+ * project's backend has a verified source-audio lip-sync lane;
+ * - a code-2d route becomes a title card carrying the shot's first sung line
+ * (never invented text), or a pushed-in still when there is no line to set.
+ */
+function renderFieldPatch(scene, direction, { lipSyncAvailable }) {
+ const defaultLayer = (scene.visualLayer ?? 'footage') === 'footage';
+ const defaultMode = (scene.shotMode ?? 'cutaway') === 'cutaway';
+ if (!defaultLayer || !defaultMode) return {};
+ if (direction.mode === 'performance' && direction.route !== 'code-2d') {
+ return lipSyncAvailable ? { shotMode: 'performance' } : {};
+ }
+ if (direction.route !== 'code-2d') return {};
+ const line = direction.typographyRole !== 'none' && isNonBlankStr(scene.lyricText)
+ ? scene.lyricText.split(' / ')[0].trim().slice(0, 500)
+ : '';
+ if (line) return { visualLayer: 'card', ...(isNonBlankStr(scene.cardText) ? {} : { cardText: line }) };
+ return { visualLayer: 'still', ...((scene.stillMove ?? 'hold') === 'hold' ? { stillMove: 'push' } : {}) };
+}
+
+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) };
+};
+
function textCueCandidates(project, treatment) {
const scenes = new Map((project.scenes || []).map((s) => [s.sceneId, s]));
const cues = (project.lyricCues || []).filter((c) => isNonBlankStr(c?.text) && isTime(c.startSec));
@@ -565,6 +597,8 @@ function textCueCandidates(project, treatment) {
if (direction.typographyRole === 'none') continue;
const scene = scenes.get(direction.sceneId);
if (!scene || !isTime(scene.startSec) || !isTime(scene.endSec)) continue;
+ // A title card draws its own text; a lyric cue over it would double it.
+ if (scene.visualLayer === 'card') continue;
for (const cue of cues) {
if (cue.startSec < scene.startSec || cue.startSec >= scene.endSec) continue;
const cueText = cue.text.trim().slice(0, 500);
@@ -599,6 +633,8 @@ export function buildApplyPreview(project) {
}
const stale = treatmentStaleness(project, treatment);
const scenesById = new Map((project.scenes || []).map((s) => [s.sceneId, s]));
+ const lipSyncAvailable = !!performanceCapability(project.videoSettings?.backend || null);
+ const planned = [];
const directed = new Set();
const scenes = [];
const missingSceneIds = [];
@@ -608,6 +644,8 @@ export function buildApplyPreview(project) {
directed.add(scene.sceneId);
const next = sceneDirection(treatment, direction);
const fields = promptFieldPlans(scene, direction);
+ const renderFields = renderFieldPatch(scene, direction, { lipSyncAvailable });
+ planned.push({ ...scene, ...renderFields });
scenes.push({
sceneId: scene.sceneId,
label: scene.label || scene.sectionLabel || '',
@@ -619,6 +657,7 @@ export function buildApplyPreview(project) {
current: { framePrompt: scene.framePrompt || '', prompt: scene.prompt || '' },
suggested: { framePrompt: direction.suggestedFramePrompt, prompt: direction.suggestedPrompt },
keepsSelection: isNonBlankStr(scene.referenceImageId) || isNonBlankStr(scene.videoHistoryId),
+ renderFields,
});
}
return {
@@ -628,7 +667,7 @@ export function buildApplyPreview(project) {
scenes,
missingSceneIds,
unmappedSceneIds: (project.scenes || []).map((s) => s.sceneId).filter((id) => !directed.has(id)),
- textCueCandidates: textCueCandidates(project, treatment).length,
+ textCueCandidates: textCueCandidates(withPlannedScenes(project, planned), treatment).length,
};
}
@@ -654,13 +693,14 @@ export function applyTreatmentToProject(project, { revision, overwrite = [], add
const approved = new Map(overwrite.map((o) => [o.sceneId, o.promptFingerprint]));
const plans = new Map(preview.scenes.map((p) => [p.sceneId, p]));
const directions = new Map(treatment.shotDirections.map((d) => [d.sceneId, d]));
- const result = { directed: 0, promptsWritten: [], promptsKept: [], conflicted: [], textCuesAdded: 0 };
+ const result = { directed: 0, promptsWritten: [], promptsKept: [], conflicted: [], renderFieldsSet: [], textCuesAdded: 0 };
const scenes = (project.scenes || []).map((scene) => {
const plan = plans.get(scene.sceneId);
if (!plan) return scene;
const direction = directions.get(scene.sceneId);
- const next = { ...scene };
+ const next = { ...scene, ...plan.renderFields };
+ if (Object.keys(plan.renderFields).length > 0) result.renderFieldsSet.push(scene.sceneId);
const hasManual = Object.values(plan.fields).includes('manual');
// The fingerprint pins the exact prompts the director reviewed: an edit
// made after that review is newer work and is kept.
@@ -692,7 +732,7 @@ export function applyTreatmentToProject(project, { revision, overwrite = [], add
let composition = project.composition ?? null;
if (addTextCues) {
- const added = textCueCandidates(project, treatment);
+ const added = textCueCandidates({ ...project, scenes }, treatment);
if (added.length > 0) {
const base = normalizeComposition(composition || {});
composition = normalizeComposition({ ...base, textCues: [...base.textCues, ...added].sort((a, b) => (a.startSec ?? 0) - (b.startSec ?? 0)) });
diff --git a/server/services/musicVideo/treatmentDraft.js b/server/services/musicVideo/treatmentDraft.js
index 88d06761d8..327dbaa30c 100644
--- a/server/services/musicVideo/treatmentDraft.js
+++ b/server/services/musicVideo/treatmentDraft.js
@@ -25,11 +25,12 @@ import { ServerError } from '../../lib/errorHandler.js';
import { extractJson } from '../../lib/jsonExtract.js';
import { isNonBlankStr, trimTo } from '../../lib/textUtils.js';
import {
- MUSIC_VIDEO_SHOT_MODES as SHOT_MODES,
+ MUSIC_VIDEO_TREATMENT_SHOT_MODES as SHOT_MODES,
MUSIC_VIDEO_SHOT_ROUTES as SHOT_ROUTES,
MUSIC_VIDEO_NEGATIVE_SPACE as NEGATIVE_SPACE,
MUSIC_VIDEO_TYPOGRAPHY_ROLES as TYPOGRAPHY_ROLES,
} from '../../lib/musicVideoValidation.js';
+import { performanceCapability } from '../../lib/musicVideoShotTiming.js';
import { validSections } from './shotPlan.js';
import { normalizeBrief } from './treatment.js';
@@ -231,6 +232,8 @@ function draftProofs(directions, scenes, beatsById, gaps) {
}
const checks = ['identity-continuity', 'continuous-motion'];
if (best.d.typographyRole !== 'none') checks.push('readable-text');
+ // A lip-sync lane (#8977) makes sync a real, provable requirement.
+ if (best.d.mode === 'performance' && !lipSyncGap) checks.push('lip-sync');
const riskShot = {
kind: 'risk-shot',
sceneIds: [best.d.sceneId],
@@ -238,7 +241,7 @@ function draftProofs(directions, scenes, beatsById, gaps) {
risk: best.risk.reasons.join('; ') || 'the highest-energy shot in the song',
route: best.d.mode === 'performance' && lipSyncGap
? `${best.d.route} — performance framed as non-sync (wide, silhouette, hands, backs); cut away on sung lines if mouth motion reads wrong`
- : best.d.route === 'code-2d' ? 'code-2d — simple 2D motion over the motion reference' : best.d.route,
+ : best.d.route === 'code-2d' ? 'code-2d — a code-rendered title card or moved still in a composed render' : best.d.route,
checks,
passCriteria: checks.map((c) => PASS_CRITERIA[c]),
status: 'proposed',
@@ -270,8 +273,11 @@ function draftProofs(directions, scenes, beatsById, gaps) {
/** What the treatment asks for that this install cannot do (yet). */
function deriveCapabilityGaps(project, brief, directions) {
const gaps = [];
- if (directions.some((d) => d.mode === 'performance')) {
- gaps.push({ id: 'lip-sync', detail: 'No source-audio lip-sync is available: performance shots render without mouth movement synced to the song. Frame them as non-sync (wide, silhouette, hands, backs) or cut away on sung lines.' });
+ // Source-audio lip-sync exists only on a verified lane (#8977, fal.ai today);
+ // judged against the project's pinned video backend at compile time.
+ const backend = project.videoSettings?.backend || null;
+ if (directions.some((d) => d.mode === 'performance') && !performanceCapability(backend)) {
+ gaps.push({ id: 'lip-sync', detail: `This project's video backend (${backend || 'install default'}) cannot lip-sync to the song — source-audio lip-sync is only available on fal.ai MiniMax H3. Pin fal.ai for performance shots, or frame them as non-sync (wide, silhouette, hands, backs) and cut away on sung lines.` });
}
const motionRefs = (project.visualSpec?.references || []).some((r) => r.use === 'motion-reference')
|| (project.scenes || []).some((s) => (s.takes || []).some((t) => t?.use === 'motion-reference'));
@@ -279,7 +285,10 @@ function deriveCapabilityGaps(project, brief, directions) {
gaps.push({ id: 'rotoscope', detail: 'Motion-reference media is scaffolding only: turning footage into hand-drawn or vector animation is not automated, and it is never selected into the timeline automatically.' });
}
if (directions.some((d) => d.route === 'code-2d')) {
- gaps.push({ id: 'code-2d', detail: 'Shots routed to simple 2D/code motion need a code-rendered composition section; until one is authored, the shot falls back to a generated clip.' });
+ // #8985 supplies title cards and moved stills — but only a composed render
+ // draws them, and richer 2D animation is not available.
+ const composed = project.composition?.mode === 'composed';
+ gaps.push({ id: 'code-2d', detail: `Shots routed to 2D/code motion become a code-rendered title card (sung text) or a moved still on Apply — no richer 2D animation is available${composed ? '.' : ', and these layers only show when the final render is set to composed; a plain render plays footage instead.'}` });
}
if (brief.aspectRatio && brief.aspectRatio !== '16:9') {
gaps.push({ id: 'aspect-ratio', detail: `The brief targets ${brief.aspectRatio}: prompts are composed for it, but clips render at the video model's native frame size — confirm the model outputs ${brief.aspectRatio} or reframe in the edit.` });
@@ -335,6 +344,7 @@ export function buildTreatmentDraft(project) {
/** Build the provider prompt that refines a deterministic draft. */
export function buildTreatmentPrompt(project, draft) {
const brief = normalizeBrief(project.treatment?.brief);
+ const lipSync = performanceCapability(project.videoSettings?.backend || null);
const concept = project.concept || {};
const spec = project.visualSpec || {};
const hasLyrics = draft.arc.lyricInterpretation !== null;
@@ -379,9 +389,9 @@ Write the treatment:
- For each section, an "objective" (what the picture must achieve there) and a "rationale" tied to the audience, the lyrics or the emotion. Keep the roles as given.
- Two or three recurring "motifs" (an image, object, color or gesture) with how each changes across the arc.
- The balance of "performance", "cutaway" and "graphic" shots as percentages, with a rationale.
-${hasLyrics ? '- "lyricInterpretation": what the lyrics mean and how the picture interprets them (not word-for-word illustration).\n' : '- The song is instrumental: set "lyricInterpretation" to null and invent no lyrics.\n'}- For EACH shot: "mode" (performance|cutaway|graphic), "route" (generated|supplied-asset|code-2d — prefer code-2d simple 2D motion where a video model cannot hold the requirement), "focalSubject", "framing", "negativeSpace" (none|upper|center|lower — the region kept clean for the separately composited text), "typographyRole" (none|subtitle|hero; must be none on instrumental shots), "emphasis", "transitionIn", "transitionOut", "rationale", and a "framePrompt" (the opening still) and "prompt" (the motion) for the image/video model.
+${hasLyrics ? '- "lyricInterpretation": what the lyrics mean and how the picture interprets them (not word-for-word illustration).\n' : '- The song is instrumental: set "lyricInterpretation" to null and invent no lyrics.\n'}- For EACH shot: "mode" (performance|cutaway|graphic), "route" (generated|supplied-asset|code-2d — code-2d becomes a code-rendered title card for a sung line or a moved still; prefer it where a video model cannot hold the requirement), "focalSubject", "framing", "negativeSpace" (none|upper|center|lower — the region kept clean for the separately composited text), "typographyRole" (none|subtitle|hero; must be none on instrumental shots), "emphasis", "transitionIn", "transitionOut", "rationale", and a "framePrompt" (the opening still) and "prompt" (the motion) for the image/video model.
- Never ask the image or video model to render the lyrics or any text: typography is composited separately into the reserved region.
-- No shot can rely on lip-sync to the song.
+${lipSync ? `- Performance shots are lip-synced to the song on ${lipSync.label} (each shot a ${lipSync.minAudioSec}–${lipSync.maxAudioSec}s song window); use them for sung lines where a visible singer matters.` : '- This project\'s video backend cannot lip-sync: no shot can rely on a singer synced to the song.'}
Respond with ONLY a JSON object (replace every <…> with real content; do NOT output the literal angle-bracket text), no other text:
{ "rationale": "<why this arc serves the brief>", "lyricInterpretation": ${hasLyrics ? '"<interpretation>"' : 'null'},