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: plan code-only briefs as code shots and flag footage+code overlays (#10302)
[._.]/ Adam Eivyf86245604517
diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.jsindex 6aa36b5c23..b3b25369dc 100644--- a/server/lib/musicVideoValidation.js+++ b/server/lib/musicVideoValidation.js@@ -509,6 +509,8 @@ const sceneLayerFields = {visualLayer: z.enum(MUSIC_VIDEO_VISUAL_LAYERS).optional(),stillMove: z.enum(MUSIC_VIDEO_STILL_MOVES).optional(),cardText: z.string().max(500).nullable().optional(),+ // #10302: footage that the composition also draws code over; still counts as footage.+ codeOverlay: z.boolean().optional(),cardColor: z.string().regex(/^#[0-9a-f]{6}$/i, 'card color is #rrggbb').nullable().optional(),};diff --git a/server/services/musicVideo/planner.js b/server/services/musicVideo/planner.jsindex efec57a3ce..2f48cdf112 100644--- a/server/services/musicVideo/planner.js+++ b/server/services/musicVideo/planner.js@@ -84,10 +84,12 @@ function sceneInputsFromShots(shots) {loop: false,lyricText: shot.lyricText,visualIntent: shot.visualIntent,+ ...(shot.codeOverlay ? { codeOverlay: true } : {}),...(shot.visualLayer ? {visualLayer: shot.visualLayer, shotMode: shot.shotMode,...(shot.cardText !== undefined ? { cardText: shot.cardText } : {}),- ...directedPrompts(shot),+ // A code shot is drawn by the composition: it carries no generation prose.+ ...(shot.visualLayer === 'code' ? {} : directedPrompts(shot)),} : {}),};});@@ -335,6 +337,7 @@ export async function planProject(id, { seedPrompts = true, providerId, model, epromptsSeeded = true;for (const [idx, fields] of seeded) {if (!sceneInputs[idx]) continue;+ if (shots[idx].visualLayer === 'code') continue;if (shots[idx].visualLayer) Object.assign(sceneInputs[idx], directedPrompts(shots[idx], fields));else {if (fields.framePrompt) sceneInputs[idx].framePrompt = fields.framePrompt;@@ -353,7 +356,7 @@ export async function planProject(id, { seedPrompts = true, providerId, model, e// flight would otherwise be silently dropped from this response and// visually reverted by the client's replaceProject) and a redundant// second getProject round trip.- const hasCards = sceneInputs.some((s) => s.visualLayer === 'card');+ const hasCards = sceneInputs.some((s) => s.visualLayer === 'card' || s.visualLayer === 'code');// Persist card scenes and the mode that renders them in the same transaction.// Read the current composition under the lock so concurrent edits survive.const { project: persisted, scenes } = await persistPlan(id, sceneInputs, { hasCards, replace: mode === 'replace' });diff --git a/server/services/musicVideo/planner.test.js b/server/services/musicVideo/planner.test.jsindex 5c734d3dc6..a2c076c02b 100644--- a/server/services/musicVideo/planner.test.js+++ b/server/services/musicVideo/planner.test.js@@ -689,6 +689,30 @@ describe('directed planner', () => {expect(project.scenes[5].framePrompt).toContain('mouth fully visible');});+ it('plans a code-only brief as code shots with short intents and no generation prose', async () => {+ const project = { ...directedProject(), productionPolicy: { strategy: 'code-first', maxGeneratedVideoPercent: 0 } };+ const { project: planned } = await runDirected(project);+ const code = planned.scenes.filter((s) => s.visualLayer === 'code');+ expect(code.length).toBeGreaterThan(0);+ expect(planned.scenes.some((s) => s.visualLayer === 'footage')).toBe(false);+ for (const scene of code) {+ expect(scene.shotMode).toBe('cutaway');+ expect(scene.framePrompt).toBeNull();+ expect(scene.visualIntent.length).toBeLessThanOrEqual(120);+ }+ expect(planned.composition.mode).toBe('composed');+ });++ it('keeps footage and flags a code overlay when the brief still allows generated video', async () => {+ const project = { ...directedProject(), productionPolicy: { strategy: 'code-first', maxGeneratedVideoPercent: 60 } };+ const { project: planned } = await runDirected(project);+ const footage = planned.scenes.filter((s) => s.visualLayer === 'footage');+ expect(footage.length).toBeGreaterThan(0);+ expect(footage.every((s) => s.codeOverlay === true)).toBe(true);+ expect(planned.scenes.filter((s) => s.visualLayer === 'code')).toHaveLength(0);+ expect(planned.scenes.filter((s) => s.visualLayer === 'card').every((s) => !s.codeOverlay)).toBe(true);+ });+it('leaves skipped-stage projects on the legacy scene path even with retained direction', async () => {const project = directedProject();project.castAndSets.status = 'skipped';diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.jsindex caf21f23aa..2258fa5fee 100644--- a/server/services/musicVideo/projectsLogic.js+++ b/server/services/musicVideo/projectsLogic.js@@ -478,6 +478,7 @@ function buildScene(input, { order }) {visualLayer: input.visualLayer ?? 'footage',stillMove: input.stillMove ?? 'hold',cardText: input.cardText ?? null,+ ...(input.codeOverlay ? { codeOverlay: true } : {}),cardColor: input.cardColor ?? null,// #8977: cutaway (any image-to-video lane) unless the director asks for a// lip-synced performance shot, which only a source-audio provider renders.diff --git a/server/services/musicVideo/shotPlan.js b/server/services/musicVideo/shotPlan.jsindex 69a3bde4ec..8428a6e105 100644--- a/server/services/musicVideo/shotPlan.js+++ b/server/services/musicVideo/shotPlan.js@@ -25,6 +25,7 @@*/import { performanceCapability } from '../../lib/musicVideoShotTiming.js';+import { normalizeMusicVideoProductionPolicy } from '../../lib/musicVideoMediumPlan.js';import { deliveryNotesWithin } from './lyricMarkers.js';import { snapSectionsToGrid } from './audioAnalysis.js';@@ -268,8 +269,34 @@ export function planShots(sections, {return { shots, pacing: resolved };}+const CODE_INTENT_MAX = 120;+const codeIntent = (shot) => (shot.visualIntent || shot.lyricText || shot.sectionLabel || 'Code-drawn beat')+ .replace(/\s+/g, ' ').trim().slice(0, CODE_INTENT_MAX);++/**+ * A code-first brief draws its picture in code (#10302): with no generated+ * video allowed, every footage shot becomes a code shot with a short intent+ * (no generation prose); with generated video allowed, footage shots stay+ * footage and carry `codeOverlay` so the composition layers code over them.+ * Cards and stills are left alone.+ */+function applyCodePolicy(shots, project) {+ const policy = normalizeMusicVideoProductionPolicy(project.productionPolicy);+ if (policy.strategy !== 'code-first') return shots;+ const codeOnly = policy.maxGeneratedVideoPercent <= 0;+ return shots.map((shot) => {+ if ((shot.visualLayer ?? 'footage') !== 'footage') return shot;+ if (!codeOnly) return { ...shot, codeOverlay: true };+ return { ...shot, visualLayer: 'code', shotMode: 'cutaway', performanceCandidate: false, visualIntent: codeIntent(shot) };+ });+}+/** Enrich an already-tiled plan; never move a cut to accommodate direction. */export function directShots(shots, project) {+ return applyCodePolicy(directShotsByCast(shots, project), project);+}++function directShotsByCast(shots, project) {const direction = project.castAndSets?.status === 'skipped' ? null : project.castAndSets?.direction;const cues = project.lyricCues || [];const markers = project.lyricMarkers || [];