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: add a code shot layer so code-drawn shots stop reading as missing footage (#10297)
[._.]/ Adam Eivy8f3d4ff804fd
diff --git a/client/src/components/musicVideo/ProjectActionGroups.jsx b/client/src/components/musicVideo/ProjectActionGroups.jsxindex 734a219681..e86855e22e 100644--- a/client/src/components/musicVideo/ProjectActionGroups.jsx+++ b/client/src/components/musicVideo/ProjectActionGroups.jsx@@ -146,7 +146,7 @@ export function GenerationActions({ project, videoSettings, sceneMedia, onEditSeconst mode = project.composition?.mode || 'concat';const layered = isLayeredComposition(project);const codeMode = mode === 'code' || mode === 'eidoverse';- const frameScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) !== 'card');+ const frameScenes = scenes.filter((scene) => !['card', 'code'].includes(sceneVisualLayer(scene, { layered })));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;diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex 9e8cdcf331..dda5f0d076 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -11,7 +11,7 @@ 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 LAYER_LABELS = { footage: 'Footage', still: 'Still image', card: 'Title card', code: 'Code-drawn' };const STILL_MOVE_LABELS = [['hold', 'Hold'], ['push', 'Push in'], ['pan', 'Pan']];import {falSceneTake, grokCoverage, isPerformanceScene, performanceBlockedReason, performanceCapability, planPerformanceWindow, shotSplitLimit,@@ -311,7 +311,7 @@ export default function SceneCard({)}{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.+ Set a start and end — a {{ card: 'title card', code: 'code-drawn shot' }[layer] || 'still'} runs for exactly its span.</p>)}{performance && performanceBlocked && (diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.jsindex e3dee4bf00..7f883f9c40 100644--- a/client/src/hooks/useMusicVideoSceneMedia.js+++ b/client/src/hooks/useMusicVideoSceneMedia.js@@ -372,7 +372,7 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS// #8985: a composed render's title cards need no frame, and its stills need// no clip — the batch generators skip them.const layered = isLayeredComposition(project);- const frameScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) !== 'card');+ const frameScenes = scenes.filter((scene) => !['card', 'code'].includes(sceneVisualLayer(scene, { layered })));const footageScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) === 'footage');const planMissingFrames = () => frameScenes.filter((scene) =>!scene.referenceImageId && !genScenes[scene.sceneId] && buildFramePrompt(scene));diff --git a/client/src/lib/musicVideoSceneAttention.js b/client/src/lib/musicVideoSceneAttention.jsindex 34eb3b55e6..d6ada0de60 100644--- a/client/src/lib/musicVideoSceneAttention.js+++ b/client/src/lib/musicVideoSceneAttention.js@@ -55,7 +55,7 @@ export function sceneAttention(scene, ctx = {}) {const { layered = false, footageOptional = false, lipSyncBackend = '', songDurationSec = null, clipSec = null, failed = {} } = ctx;const layer = sceneVisualLayer(scene, { layered });const codes = [];- if (layer !== 'card' && !scene.referenceImageId) codes.push('missing-frame');+ if (layer !== 'card' && layer !== 'code' && !scene.referenceImageId) codes.push('missing-frame');if (layer === 'footage' && !footageOptional && !scene.videoHistoryId) codes.push('missing-clip');if (layer !== 'footage' && !sceneHasAuthoredSpan(scene)) codes.push('no-span');if (layer === 'footage' && scene.loop === false && scene.beatAligned && clipSec != nulldiff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.jsindex d45982532e..1a0c802848 100644--- a/client/src/lib/musicVideoStages.test.js+++ b/client/src/lib/musicVideoStages.test.js@@ -410,6 +410,9 @@ describe('stageChecklist', () => {expect(stageChecklist('produce', castProject({ scenes: [scene(), scene({ sceneId: 's2', videoHistoryId: null })] }), APPROVED)[0]).toMatchObject({ id: 'footage', label: 'Footage for every shot (1 of 2)', done: false,action: { stage: 'board', params: { scenes: 'missing' } } });+ // A code-typed shot (#10297) is drawn by the composition, so it never reads as missing footage.+ expect(stageChecklist('produce', castProject({ composition: { mode: 'composed' }, scenes: [scene(), scene({ sceneId: 's2', videoHistoryId: null, visualLayer: 'code', startSec: 0, endSec: 2 })] }), APPROVED)[0])+ .toMatchObject({ id: 'footage', label: 'Footage for every shot (2 of 2)', done: true });// A code render draws its own picture: no footage to wait on.expect(stageChecklist('produce', castProject({ composition: { mode: 'code' } }), APPROVED).map((i) => [i.id, i.done])).toEqual([['footage', true]]);// The proof closes Compose, after the composition work it is judged over.diff --git a/server/lib/README.md b/server/lib/README.mdindex 5df5f2cbef..3e08cb7ac2 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -544,7 +544,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `claimFlowTaskTypes.js` | `CLAIM_FLOW_TASK_TYPES` — the ONE list of task kinds whose prompts own their own `claim/<item>` worktree and push/PR/MR/review lifecycle (#6613). `services/cosTaskGenerator.js` stamps `metadata.claimFlow` from it (WRITE side); `services/agentPromptBuilder.js` reads it back through `isClaimFlowTask()` to pick a run's claim posture (READ side). It lived as two byte-identical copies, so a new claim type added to one silently split the writer from the reader — no error, just a claim run treated as a plain commit-only handoff; `claimFlowTaskTypes.test.js` fails if a local copy reappears. Imports nothing. || `chiptuneRender.js` | Deterministic chiptune score → mono PCM → 16-bit WAV buffer (pure Node, no audio deps); `renderScoreToPcm` / `pcmToWavBuffer` / `renderScoreToWav`. || `chiptuneScore.js` | Chiptune score contract (#2911): `chiptuneScoreSchema` (Zod) + `sanitizeChiptuneScore`, `buildScoreEvents` — the pattern/order → absolute-time flatten mirrored by `client/src/lib/chiptunePlayback.js`. |-| `musicVideoLayers.js` | Music Video per-scene visual layers (#8985): `MUSIC_VIDEO_VISUAL_LAYERS` (`footage`/`still`/`card`), `MUSIC_VIDEO_STILL_MOVES` (`hold`/`push`/`pan`), `sceneVisualLayer(scene, { layered })` (only a composed render honors a still/card), `sceneHasAuthoredSpan`, and `sceneRenderReady(scene, { layered })`. Pure leaf shared by `services/musicVideo/render.js` and the client board (`client/src/lib/musicVideoLayers.js`). |+| `musicVideoLayers.js` | Music Video per-scene visual layers (#8985): `MUSIC_VIDEO_VISUAL_LAYERS` (`footage`/`still`/`card`/`code`), `MUSIC_VIDEO_STILL_MOVES` (`hold`/`push`/`pan`), `sceneVisualLayer(scene, { layered })` (only a composed render honors a still/card), `sceneHasAuthoredSpan`, and `sceneRenderReady(scene, { layered })`. Pure leaf shared by `services/musicVideo/render.js` and the client board (`client/src/lib/musicVideoLayers.js`). || `pitchMath.js` | Dependency-free scientific-pitch math shared by the LLM-authored music formats on both runtimes: `pitchToMidi("C4")` → 60 (null when unparseable) and `midiToFreq(69)` → 440. || `wavAudioFile.js` | `writeWavAudioFile(wav, dir, basename)` — land a synthesized WAV Buffer as `<basename>.ogg` via the system ffmpeg, falling back to `<basename>.wav` (and dropping a stale `.ogg`) when ffmpeg is missing or the encode fails; resolves to the filename used. Shared by the chiptune and drawn-waveform renderers and the code-engine take upload. `wavDurationMs(buffer)` reads a PCM WAV's duration from its RIFF header (0 for anything that is not a parseable WAV). `measureWavAudio(buffer)` decodes PCM 16/24/32-bit or float 32/64 (EXTENSIBLE included) into `{ channels, sampleRate, frames, durationMs, peak, rms, nonFinite }` so native renders are judged by their samples (null when undecodable). || `superColliderRuntime.js` | Managed SuperCollider runtime contract (#9412), pure: image/runtime/policy version constants, `buildSuperColliderRunArgs` (the one contained `docker run` for untrusted `sclang` source: no network/caps, read-only root, limits, ro input, private output), `buildSuperColliderBuildArgs`, the shipped synthetic probe, `evaluateSuperColliderStatus` (docker-missing … ready, with stale image/evidence invalidation), and the render contract (#9413): `SUPERCOLLIDER_RENDER` bounds, the trusted NRT `SUPERCOLLIDER_RENDER_WRAPPER_SOURCE`, `classifySuperColliderRenderLog` (syntax/source/pattern/score/synthesis failures) and `parseDockerContainerList` for orphan sweeps. I/O lives in `services/superColliderRuntime.js`. |diff --git a/server/lib/musicVideoDependencies.js b/server/lib/musicVideoDependencies.jsindex dc98a1367d..2b21c8b2db 100644--- a/server/lib/musicVideoDependencies.js+++ b/server/lib/musicVideoDependencies.js@@ -42,7 +42,7 @@ export function captureMusicVideoEvidence(project, { sceneIds = null, startSec =for (const scene of project.scenes || []) {if (sceneIds ? !sceneIds.includes(scene.sceneId) : !intersects(scene, startSec, endSec)) continue;references.push(layerRef(scene));- const role = scene.visualLayer === 'still' ? 'plate' : scene.visualLayer === 'card' ? null : 'clip';+ const role = scene.visualLayer === 'still' ? 'plate' : ['card', 'code'].includes(scene.visualLayer) ? null : 'clip';if (!role) continue;references.push(assetRef(scene, role));const take = selectedTake(scene, role);diff --git a/server/lib/musicVideoLayers.js b/server/lib/musicVideoLayers.jsindex a0cd4b4dd8..21798ab8f9 100644--- a/server/lib/musicVideoLayers.js+++ b/server/lib/musicVideoLayers.js@@ -3,14 +3,15 @@** In a composed render a scene can show its generated footage (the default,* and every scene saved before the field existed), its selected still frame- * with a deterministic camera move, or a code-rendered title card (a solid- * colour whose text the typography layer draws). A plain concat render always+ * with a deterministic camera move, a code-rendered title card (a solid+ * colour whose text the typography layer draws), or a code shot (picture drawn+ * by the composition code — no frame or clip is ever generated). A plain concat render always* uses footage. Pure and dependency-free: the server render and the client* board read the same rules, so the Render button's readiness matches what the* render preflight accepts.*/-export const MUSIC_VIDEO_VISUAL_LAYERS = ['footage', 'still', 'card'];+export const MUSIC_VIDEO_VISUAL_LAYERS = ['footage', 'still', 'card', 'code'];export const MUSIC_VIDEO_STILL_MOVES = ['hold', 'push', 'pan'];/**@@ -26,7 +27,7 @@ export const isLayeredComposition = (project) => LAYERED_COMPOSITION_MODES.inclu/** 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';+ return layered && (layer === 'still' || layer === 'card' || layer === 'code') ? layer : 'footage';}/** A generated document executes the explicit code-first medium plan. */@@ -47,11 +48,11 @@ export function sceneHasAuthoredSpan(scene) {/*** Whether the render can include this scene as-is: footage needs its clip, a- * still needs its reference frame and a span, and a card needs only a span.+ * still needs its reference frame and a span, and a card or code shot needs only a span (code is drawn by the composition itself).*/export function sceneRenderReady(scene, { layered = false } = {}) {const layer = sceneVisualLayer(scene, { layered });if (layer === 'footage') return Boolean(scene?.videoHistoryId);if (!sceneHasAuthoredSpan(scene)) return false;- return layer === 'card' || Boolean(scene.referenceImageId);+ return layer === 'card' || layer === 'code' || Boolean(scene.referenceImageId);}diff --git a/server/lib/musicVideoLayers.test.js b/server/lib/musicVideoLayers.test.jsindex c0a2c8f696..6f80f0d55f 100644--- a/server/lib/musicVideoLayers.test.js+++ b/server/lib/musicVideoLayers.test.js@@ -18,4 +18,12 @@ describe('musicVideoLayers', () => {expect(sceneRenderReady(card, { layered: true })).toBe(true);expect(sceneRenderReady({ visualLayer: 'still', startSec: 0, endSec: 2 }, { layered: true })).toBe(false);});++ it('a code shot needs only an authored span — never a frame or clip', () => {+ const code = { visualLayer: 'code', startSec: 0, endSec: 2 };+ expect(sceneVisualLayer(code, { layered: true })).toBe('code');+ expect(sceneVisualLayer(code, { layered: false })).toBe('footage');+ expect(sceneRenderReady(code, { layered: true })).toBe(true);+ expect(sceneRenderReady({ visualLayer: 'code' }, { layered: true })).toBe(false);+ });});diff --git a/server/lib/musicVideoMediumPlan.js b/server/lib/musicVideoMediumPlan.jsindex cc6b892019..098d059076 100644--- a/server/lib/musicVideoMediumPlan.js+++ b/server/lib/musicVideoMediumPlan.js@@ -172,7 +172,7 @@ export function planMusicVideoMedia(project, directions) {}let medium = d.medium;let rationale = d.mediumRationale;- const manualLayer = scene?.visualLayer === 'still' || scene?.visualLayer === 'card';+ const manualLayer = scene?.visualLayer === 'still' || scene?.visualLayer === 'card' || scene?.visualLayer === 'code';if (manualLayer) {medium = scene.visualLayer === 'still' ? 'still' : 'procedural';rationale = 'Retain the director-selected visual layer.';diff --git a/server/services/musicVideo/performanceShot.js b/server/services/musicVideo/performanceShot.jsindex 0b242ad9fa..eabfd300aa 100644--- a/server/services/musicVideo/performanceShot.js+++ b/server/services/musicVideo/performanceShot.js@@ -159,7 +159,7 @@ async function reviewPerformanceTakes(project, masterPath) {let sha256 = null;for (const scene of Array.isArray(project?.scenes) ? project.scenes : []) {const supplied = (scene.takes || []).find((take) => take.kind === 'video' && take.assetId === scene.videoHistoryId)?.shotInstruction;- if (scene.videoHistoryId && !['still', 'card'].includes(scene.visualLayer) && supplied?.audioConditioning) {+ if (scene.videoHistoryId && !['still', 'card', 'code'].includes(scene.visualLayer) && supplied?.audioConditioning) {sha256 ??= await hashFile(masterPath);if (supplied.audioConditioning.sourceSha256 !== sha256) results.push({ sceneId: scene.sceneId, reason: 'source-audio-changed', stale: true });else if (Math.round(scene.startSec * 48000) !== supplied.audioConditioning.startSamplediff --git a/server/services/musicVideo/production.js b/server/services/musicVideo/production.jsindex a7ee43fbda..3b95fd40ee 100644--- a/server/services/musicVideo/production.js+++ b/server/services/musicVideo/production.js@@ -366,7 +366,7 @@ function productionTargets(project) {const layered = isLayeredComposition(project);const scenes = Array.isArray(project?.scenes) ? project.scenes : [];return {- frame: scenes.filter((s) => sceneVisualLayer(s, { layered }) === 'still' || (sceneVisualLayer(s, { layered }) !== 'card' && !s.videoHistoryId)),+ frame: scenes.filter((s) => sceneVisualLayer(s, { layered }) === 'still' || (!['card', 'code'].includes(sceneVisualLayer(s, { layered })) && !s.videoHistoryId)),clip: scenes.filter((s) => sceneVisualLayer(s, { layered }) === 'footage'),};}diff --git a/server/services/musicVideo/productionPilot.js b/server/services/musicVideo/productionPilot.jsindex e51acb8525..1733386bee 100644--- a/server/services/musicVideo/productionPilot.js+++ b/server/services/musicVideo/productionPilot.js@@ -21,7 +21,7 @@ export function selectProductionPilots(project) {const seen = new Set();const rank = { performance: 5, interaction: 4, camera: 3, cutaway: 2, still: 1 };return (project.scenes || [])- .filter((scene) => allowed ? allowed.has(scene.sceneId) : sceneVisualLayer(scene, { layered: isLayeredComposition(project) }) !== 'card')+ .filter((scene) => allowed ? allowed.has(scene.sceneId) : !['card', 'code'].includes(sceneVisualLayer(scene, { layered: isLayeredComposition(project) }))).map((scene) => ({ sceneId: scene.sceneId, operation: pilotClass(scene, project),missing: Number(!scene.referenceImageId) + Number(pilotClass(scene, project) !== 'still' && !scene.videoHistoryId),complexity: (scene.direction?.actionContract?.actions?.length || 0)diff --git a/server/services/musicVideo/productionService.js b/server/services/musicVideo/productionService.jsindex cea305818c..e5f40ab242 100644--- a/server/services/musicVideo/productionService.js+++ b/server/services/musicVideo/productionService.js@@ -153,7 +153,7 @@ const present = (run, project) => {return { ...run, interrupted: run.status === 'running' && run.processId !== PROCESS_ID,accounting: {plannedGenerations: assets ? assets.steps.filter((s) => ['generate-image', 'generate-video'].includes(s.action)).length- : (project?.scenes || []).reduce((n, scene) => n + (scene.visualLayer !== 'card' && !scene.referenceImageId && (!scene.videoHistoryId || pilotClass(scene, project) === 'still') ? 1 : 0) + (!scene.videoHistoryId && pilotClass(scene, project) !== 'still' && scene.visualLayer !== 'card' ? 1 : 0), 0),+ : (project?.scenes || []).reduce((n, scene) => n + (!['card', 'code'].includes(scene.visualLayer) && !scene.referenceImageId && (!scene.videoHistoryId || pilotClass(scene, project) === 'still') ? 1 : 0) + (!scene.videoHistoryId && pilotClass(scene, project) !== 'still' && !['card', 'code'].includes(scene.visualLayer) ? 1 : 0), 0),reservedUsd: reserved.reduce((n, s) => n + (s.costUsd || 0), 0),spentUsd: spent.reduce((n, s) => n + (s.costUsd || 0), 0),unpriced: counted.some((s) => s.costUsd == null),diff --git a/server/services/musicVideo/render.js b/server/services/musicVideo/render.jsindex b39201e9ce..b11e931614 100644--- a/server/services/musicVideo/render.js+++ b/server/services/musicVideo/render.js@@ -241,8 +241,8 @@ export async function resolveSceneClips(project, { layered = false } = {}) {const spanSec = authoredSpan(scene);if (spanSec == null) { untimed.push(scene.sceneId); continue; }const section = { sceneId: scene.sceneId, layer, inSec: 0, outSec: spanSec, duration: spanSec, sourceSec: spanSec };- if (layer === 'card') {- clips.push({ ...section, cardText: typeof scene.cardText === 'string' ? scene.cardText.trim() : '', cardColor: /^#[0-9a-f]{6}$/i.test(scene.cardColor || '') ? scene.cardColor : '#000000' });+ if (layer === 'card' || layer === 'code') {+ clips.push({ ...section, cardText: layer === 'card' && typeof scene.cardText === 'string' ? scene.cardText.trim() : '', cardColor: /^#[0-9a-f]{6}$/i.test(scene.cardColor || '') ? scene.cardColor : '#000000' });continue;}const imagePath = scene.referenceImageId ? safeUnder(PATHS.images, scene.referenceImageId) : null;@@ -600,7 +600,7 @@ export function excerptBoundaryTimes(sections, cues, startSec, endSec, { fps = 2// authored span. Both callers build on the exact same resolved clip list, so// an excerpt frame matches what a full render would produce at that song time.export function assertCurrentClipDependencies(project) {- const stale = (project.scenes || []).filter((scene) => scene.videoHistoryId && scene.visualLayer !== 'still' && scene.visualLayer !== 'card')+ const stale = (project.scenes || []).filter((scene) => scene.videoHistoryId && !['still', 'card', 'code'].includes(scene.visualLayer)).filter((scene) => musicVideoTakeChanges(project, scene, (scene.takes || []).find((take) => take.kind === 'video' && take.assetId === scene.videoHistoryId)).length);if (stale.length) throw new ServerError('Selected clips were derived from changed plates — preview and repair their dependencies before rendering',{ status: 422, code: 'STALE_CLIP_DEPENDENCIES', context: { sceneIds: stale.map((scene) => scene.sceneId) } });diff --git a/server/services/musicVideo/revisionService.js b/server/services/musicVideo/revisionService.jsindex 9bb8c51226..1672430e7f 100644--- a/server/services/musicVideo/revisionService.js+++ b/server/services/musicVideo/revisionService.js@@ -158,7 +158,7 @@ export async function cancelRevision(projectId, revisionId, { alsoOnProject = nuasync function dependencyImpactFor(project) {const performanceScenes = (project.scenes || []).filter((scene) => scene.videoHistoryId- && (scene.shotMode === 'performance' || (!['still', 'card'].includes(scene.visualLayer)+ && (scene.shotMode === 'performance' || (!['still', 'card', 'code'].includes(scene.visualLayer)&& scene.takes?.some((take) => take.assetId === scene.videoHistoryId && take.shotInstruction?.audioConditioning))));let performanceChanges = [];if (performanceScenes.length) {