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
Number storyboard cards, settle locked shots, mark code-rendered clips (#11231)
[._.]/02bf5c2642ad
diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex dbd5d02908..d4956a85a4 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -22,7 +22,8 @@ import { buildSceneTimingPresentation } from '../../lib/musicVideoSceneTiming.jsimport SceneTimingPlan from './SceneTimingPlan.jsx';import SceneRenderProgress from './SceneRenderProgress.jsx';import { COVERAGE_TOLERANCE_SEC, SCENE_ATTENTION_LABELS, sceneAttention } from '../../lib/musicVideoSceneAttention.js';-import { ShotLockButton } from './ShotLock.jsx';+import { ShotLockButton, useShotLock } from './ShotLock.jsx';+import ScenePoster from './ScenePoster.jsx';// The two timeline-bound scene fields rendered as identical number inputs.const SCENE_TIME_FIELDS = [['Start', 'startSec'], ['End', 'endSec']];@@ -85,7 +86,7 @@ function videoGenerationRefusal({ settingsSaving, speakerUnsaved, referenceImage}export default function SceneCard({- scene, index, isLast, generatingFrame, generatingVideo, frameProgress = null, videoProgress = null,+ scene, index, shotNumber = null, isLast, generatingFrame, generatingVideo, frameProgress = null, videoProgress = null,settingsSaving, videoBlockedReason, canContinueShot,onMove, onDelete, onEditLocal, onSave,onGenerateFrame, onGenerateVideo, onContinueVideo, onGenerateEndFrame, generatingEndFrame = false, onContinueFromPrevious, previousHasClip = false,@@ -143,7 +144,8 @@ export default function SceneCard({excerptStartSec: performanceReview?.excerptStartSec, backend: lipSyncBackend, videoSettings: falVideoSettings || {} });const shotModeId = `mv-shot-mode-${scene.sceneId}`;// #10152: what needs the director's attention, visible without opening the card.- const attention = sceneAttention(scene, { layered, footageOptional, lipSyncBackend, songDurationSec, clipSec, failed: failedScenes || {}, songReview, videoSettings: falVideoSettings });+ const locked = useShotLock(scene.sceneId)?.state === 'locked';+ const attention = sceneAttention(scene, { layered, footageOptional, lipSyncBackend, songDurationSec, clipSec, failed: failedScenes || {}, songReview, videoSettings: falVideoSettings, locked });const songChange = songReview?.[scene.sceneId];const generatingLane = generatingFrame && generatingVideo ? 'Frame + clip' : generatingFrame ? 'Frame' : generatingVideo ? 'Clip' : null;// #10154: the server-persisted failure of the last render, shown until a@@ -171,22 +173,15 @@ export default function SceneCard({className="flex min-h-[44px] cursor-pointer select-none items-center gap-3 p-2 marker:content-none [&::-webkit-details-marker]:hidden"><ChevronRight size={14} aria-hidden="true" className="shrink-0 text-port-text-muted transition-transform group-open:rotate-90" />- {scene.referenceImageId ? (- <img src={`/data/images/${scene.referenceImageId}`} alt="" loading="lazy" className="aspect-video w-16 shrink-0 rounded border border-port-border object-cover sm:w-20" />- ) : (- <span className="flex aspect-video w-16 shrink-0 items-center justify-center rounded border border-dashed border-port-border text-port-text-muted sm:w-20" aria-hidden="true">- <ImageIcon size={14} />- </span>- )}+ <ScenePoster scene={scene} iconSize={14} className="aspect-video w-16 shrink-0 rounded border border-port-border sm:w-20" /><div className="min-w-0 flex-1"><div className="truncate text-sm font-medium">- {scene.sectionLabel || scene.label || `Scene ${scene.order + 1}`}+ {[shotNumber ? `Shot ${shotNumber}` : null, scene.sectionLabel || scene.label].filter(Boolean).join(' · ') || `Scene ${scene.order + 1}`}</div><div className="truncate text-[11px] text-port-text-muted">- #{scene.order + 1}{typeof scene.startSec === 'number' && typeof scene.endSec === 'number'- ? ` · ${formatDurationSec(scene.endSec - scene.startSec)} · ${formatDurationSec(scene.startSec)}–${formatDurationSec(scene.endSec)}`- : ''}+ ? `${formatDurationSec(scene.endSec - scene.startSec)} · ${formatDurationSec(scene.startSec)}–${formatDurationSec(scene.endSec)}`+ : `#${scene.order + 1}`}{scene.referenceImageId ? ' · frame ready' : ''}{scene.videoHistoryId ? ' · video ready' : ''}{clipSec != null ? ` · clip ${clipSec.toFixed(1)}s` : ''}diff --git a/client/src/components/musicVideo/ScenePoster.jsx b/client/src/components/musicVideo/ScenePoster.jsxnew file mode 100644index 0000000000..736081d144--- /dev/null+++ b/client/src/components/musicVideo/ScenePoster.jsx@@ -0,0 +1,14 @@+import { useState } from 'react';+import { Image as ImageIcon } from 'lucide-react';+import { scenePosterSrc } from '../../lib/musicVideoPreview.js';++/**+ * A scene's picture on the board: its frame, else its clip's poster, else (or+ * when the poster is missing) a placeholder icon. `className` sizes both.+ */+export default function ScenePoster({ scene, className = '', iconSize = 22 }) {+ const src = scenePosterSrc(scene);+ const [failed, setFailed] = useState(null);+ if (src && failed !== src) return <img src={src} alt="" loading="lazy" onError={() => setFailed(src)} className={`object-cover ${className}`} />;+ return <span className={`flex items-center justify-center bg-port-bg text-port-text-muted ${className}`}><ImageIcon size={iconSize} aria-hidden="true" /></span>;+}diff --git a/client/src/components/musicVideo/ShotStepper.jsx b/client/src/components/musicVideo/ShotStepper.jsxindex d6f6cb872f..059548e4b5 100644--- a/client/src/components/musicVideo/ShotStepper.jsx+++ b/client/src/components/musicVideo/ShotStepper.jsx@@ -31,6 +31,15 @@ export function shotSteps(scenes, t, range = null) {return { back, next, index: current + 1, count: starts.length };}+/**+ * Each shot's number as the player counts it ("Shot n / N"): its place in song+ * order. A shot with no start time has no number.+ */+export function shotNumbers(scenes) {+ const timed = (scenes || []).filter((scene) => Number.isFinite(scene?.startSec));+ return new Map([...timed].sort((a, b) => a.startSec - b.startSec).map((scene, i) => [scene.sceneId, i + 1]));+}+/** The shot playing at song time `t`: the last one that has started. */function shotOnScreen(scenes, t) {let current = null;diff --git a/client/src/components/musicVideo/stages/BoardStage.jsx b/client/src/components/musicVideo/stages/BoardStage.jsxindex 06ef9204aa..4646136f2a 100644--- a/client/src/components/musicVideo/stages/BoardStage.jsx+++ b/client/src/components/musicVideo/stages/BoardStage.jsx@@ -4,7 +4,9 @@ import { Plus, Image as ImageIcon, Film, Code2, Type, FlagTriangleRight, Lock, Limport BeatTimeline from '../BeatTimeline.jsx';import ContactSheetButton from '../ContactSheetButton.jsx';import SceneCard from '../SceneCard.jsx';+import ScenePoster from '../ScenePoster.jsx';import { ShotLockContext, SHOT_LOCK_LABELS } from '../ShotLock.jsx';+import { shotNumbers } from '../ShotStepper.jsx';import TreatmentPanel, { treatmentSummary } from '../TreatmentPanel.jsx';import StageSection from '../StageSection.jsx';import { PlanActions } from '../ProjectActionGroups.jsx';@@ -13,7 +15,6 @@ import { previousShot } from '../../../../../server/lib/musicVideoHandoffFrame.jimport { isLayeredComposition } from '../../../lib/musicVideoLayers.js';import { FOOTAGE_OPTIONAL_MODES } from '../../../lib/musicVideoStages.js';import { parseSceneFilter, sceneAttention, sceneMatchesFilter, sceneMediaKind, SCENE_ATTENTION_LABELS, SCENE_MEDIA_LABELS } from '../../../lib/musicVideoSceneAttention.js';-import { musicVideoImageSrc } from '../../../lib/musicVideoPreview.js';import { formatTimecode } from '../../../utils/formatters.js';const FILTER_LABELS = [['all', 'All'], ['attention', 'Needs attention'], ['missing', 'Missing footage']];@@ -72,7 +73,11 @@ export default function BoardStage({ board }) {songReview: project.songRevision?.sceneReview || null,videoSettings: videoSettings.settings,};- const codesById = new Map(scenes.map((scene) => [scene.sceneId, sceneAttention(scene, attentionCtx)]));+ // A locked shot is settled: its other takes are no longer something to review.+ const codesById = new Map(scenes.map((scene) => [scene.sceneId, sceneAttention(scene, { ...attentionCtx, locked: shotLocks[scene.sceneId] === 'locked' })]));+ const numbers = shotNumbers(scenes);+ const shotName = (scene) => [numbers.has(scene.sceneId) ? `Shot ${numbers.get(scene.sceneId)}` : null,+ scene.sectionLabel || scene.label].filter(Boolean).join(' · ') || `Scene ${scene.order + 1}`;const counts = { all: scenes.length, attention: 0, missing: 0 };for (const codes of codesById.values()) {if (sceneMatchesFilter(codes, 'attention')) counts.attention += 1;@@ -176,17 +181,16 @@ export default function BoardStage({ board }) {{visible.map(scene => <button key={scene.sceneId} type="button" aria-pressed={activeSceneId === scene.sceneId}ref={element => { if (element) thumbnailsRef.current.set(scene.sceneId, element); else thumbnailsRef.current.delete(scene.sceneId); }}onClick={() => { board.seekToScene?.(scene); onToggleSceneExpand?.(scene.sceneId, true); }}- aria-label={`Open ${scene.sectionLabel || scene.label || `Scene ${scene.order + 1}`}`}+ aria-label={`Open ${shotName(scene)}`}aria-describedby={[['locked', 'changed'].includes(shotLocks[scene.sceneId]) && `scene-lock-${scene.sceneId}`,(sceneMediaKind(scene, { layered }) || scene.endImageId) && `scene-media-${scene.sceneId}`].filter(Boolean).join(' ') || undefined}className={`min-w-0 rounded border p-2 text-left ${activeSceneId === scene.sceneId ? 'border-port-accent bg-port-accent/10' : 'border-port-border bg-port-card'}`}><span className="relative block">- {scene.referenceImageId ? <img src={musicVideoImageSrc(scene.referenceImageId)} alt="" loading="lazy" className="aspect-video w-full rounded object-cover" />- : <span className="flex aspect-video items-center justify-center rounded bg-port-bg text-port-text-muted"><ImageIcon size={22} aria-hidden="true" /></span>}+ <ScenePoster scene={scene} className="aspect-video w-full rounded" /><SceneLockBadge sceneId={scene.sceneId} state={shotLocks[scene.sceneId]} /><SceneMediaBadges scene={scene} layered={layered} /></span>- <span className="mt-1 block truncate text-sm">{scene.sectionLabel || scene.label || `Scene ${scene.order + 1}`}</span>+ <span className="mt-1 block truncate text-sm">{shotName(scene)}</span><span className="block text-xs text-port-text-muted">{formatTimecode(scene.startSec)}–{formatTimecode(scene.endSec)}</span>{codesById.get(scene.sceneId).length > 0 && <span className="block text-xs text-port-warning">{SCENE_ATTENTION_LABELS[codesById.get(scene.sceneId)[0]]}</span>}</button>)}@@ -200,6 +204,7 @@ export default function BoardStage({ board }) {onToggleExpand={toggleInspector}performanceReview={performanceReviews.get(`${scene.sceneId}:${scene.videoHistoryId}`)}index={idx}+ shotNumber={numbers.get(scene.sceneId)}isLast={idx === scenes.length - 1}generatingFrame={sceneMedia.genScenes[scene.sceneId]}generatingVideo={sceneMedia.genVideoScenes[scene.sceneId]}diff --git a/client/src/components/musicVideo/stages/BoardStage.test.jsx b/client/src/components/musicVideo/stages/BoardStage.test.jsxindex 594be58f9c..5a8e764162 100644--- a/client/src/components/musicVideo/stages/BoardStage.test.jsx+++ b/client/src/components/musicVideo/stages/BoardStage.test.jsx@@ -11,7 +11,7 @@ vi.mock('../ContactSheetButton.jsx', () => ({ default: () => null }));vi.mock('../TreatmentPanel.jsx', () => ({ default: () => null, treatmentSummary: () => '' }));vi.mock('../ProjectActionGroups.jsx', () => ({ PlanActions: () => null }));-const scene = (n, extra = {}) => ({ sceneId: `s${n}`, order: n - 1, label: `Shot ${n}`, referenceImageId: 'f.png', videoHistoryId: 'v', startSec: 0, endSec: 3, takes: [], ...extra });+const scene = (n, extra = {}) => ({ sceneId: `s${n}`, order: n - 1, label: `Part ${n}`, referenceImageId: 'f.png', videoHistoryId: 'v', startSec: (n - 1) * 3, endSec: n * 3, takes: [], ...extra });const board = (scenes, over = {}) => ({project: { id: 'p', scenes, composition: { mode: 'concat' } }, locked: false, busy: {},sceneMedia: { genScenes: {}, genVideoScenes: {}, failedScenes: { frame: {}, video: {} } },@@ -27,17 +27,17 @@ describe('BoardStage scene filter', () => {renderBoard(board(scenes), '/?scenes=missing');expect(screen.getByRole('button', { name: 'Needs attention (1)' })).toBeTruthy();expect(screen.getByRole('button', { name: 'Missing footage (1)' }).getAttribute('aria-pressed')).toBe('true');- expect(screen.getAllByText('Shot 2').length).toBeGreaterThan(0);- expect(screen.queryByText('Shot 1')).toBeNull();+ expect(screen.getAllByText('Shot 2 · Part 2').length).toBeGreaterThan(0);+ expect(screen.queryByText('Shot 1 · Part 1')).toBeNull();expect(screen.getByText('No clip')).toBeTruthy();});it('writes the filter to the URL and removes it for All', () => {renderBoard(board(scenes));- expect(screen.getByText('Shot 1')).toBeTruthy();+ expect(screen.getByText('Shot 1 · Part 1')).toBeTruthy();fireEvent.click(screen.getByRole('button', { name: 'Needs attention (1)' }));expect(screen.getByTestId('search').textContent).toBe('?scenes=attention');- expect(screen.queryByText('Shot 1')).toBeNull();+ expect(screen.queryByText('Shot 1 · Part 1')).toBeNull();fireEvent.click(screen.getByRole('button', { name: 'All (3)' }));expect(screen.getByTestId('search').textContent).toBe('');});@@ -63,9 +63,9 @@ describe('BoardStage thumbnail media badges', () => {];renderBoard(board(scenes, { project: { id: 'p', scenes, composition: { mode: 'composed' } } }));const descriptionOf = (name) => screen.getByRole('button', { name }).getAttribute('aria-describedby');- expect(document.getElementById(descriptionOf('Open Shot 1')).textContent).toBe('Clip');- expect(document.getElementById(descriptionOf('Open Shot 2')).textContent).toBe('ImageEnd frame');- expect(document.getElementById(descriptionOf('Open Shot 3')).textContent).toBe('Code');+ expect(document.getElementById(descriptionOf('Open Shot 1 · Part 1')).textContent).toBe('Clip');+ expect(document.getElementById(descriptionOf('Open Shot 2 · Part 2')).textContent).toBe('ImageEnd frame');+ expect(document.getElementById(descriptionOf('Open Shot 3 · Part 3')).textContent).toBe('Code');});});@@ -76,8 +76,31 @@ describe('BoardStage thumbnail lock marks', () => {<BoardStage board={board(scenes)} /></ShotLockContext.Provider></MemoryRouter>);const described = (name) => screen.getByRole('button', { name }).getAttribute('aria-describedby').split(' ').map(id => document.getElementById(id).textContent);- expect(described('Open Shot 1')).toEqual(['Locked', 'Clip']);- expect(described('Open Shot 2')).toEqual(['Changed since locked', 'Clip']);- expect(described('Open Shot 3')).toEqual(['Clip']);+ expect(described('Open Shot 1 · Part 1')).toEqual(['Locked', 'Clip']);+ expect(described('Open Shot 2 · Part 2')).toEqual(['Changed since locked', 'Clip']);+ expect(described('Open Shot 3 · Part 3')).toEqual(['Clip']);+ });+});++describe('BoardStage scene cards', () => {+ // Uniquely catches the board card naming only its section (no shot number), a locked shot still+ // flagged "Takes to review", and a code-rendered clip labelled Clip with no picture.+ it('numbers shots in song order, settles a locked shot, and marks a code-rendered clip', () => {+ const pending = { takes: [{ takeId: 't1', kind: 'video', assetId: 'v', status: 'selected' }, { takeId: 't2', kind: 'video', assetId: 'v2', status: 'candidate' }] };+ const scenes = [scene(1, { startSec: 3, endSec: 6, sectionLabel: 'Verse', ...pending }), scene(2, { startSec: 0, endSec: 3, sectionLabel: 'Intro' }),+ scene(3, { startSec: 6, endSec: 9, sectionLabel: 'Code', referenceImageId: null, videoHistoryId: 'upload-1', codeClip: true })];+ const view = (locks) => render(<MemoryRouter><ShotLockContext.Provider value={{ locks, toggle: vi.fn() }}>+ <BoardStage board={board(scenes, { project: { id: 'p', scenes, composition: { mode: 'composed' } } })} /></ShotLockContext.Provider></MemoryRouter>);+ const { unmount } = view({ s1: 'open', s2: 'open', s3: 'open' });+ expect(screen.getByRole('button', { name: 'Open Shot 1 · Intro' })).toBeTruthy();+ const verse = screen.getByRole('button', { name: 'Open Shot 2 · Verse' });+ expect(verse.textContent).toContain('Takes to review');+ const code = screen.getByRole('button', { name: 'Open Shot 3 · Code' });+ expect(document.getElementById('scene-media-s3').textContent).toBe('Code');+ expect(code.querySelector('img').getAttribute('src')).toBe('/data/video-thumbnails/upload-1.jpg');+ expect(code.textContent).not.toContain('No frame');+ unmount();+ view({ s1: 'locked', s2: 'open', s3: 'open' });+ expect(screen.getByRole('button', { name: 'Open Shot 2 · Verse' }).textContent).not.toContain('Takes to review');});});diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex 330bfc0db8..6325ac35ff 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -71,7 +71,7 @@ grep -i "what you want to do" client/src/lib/README.md| `musicVideoStages.js` | Music Video page stage model: `MUSIC_VIDEO_STAGES` (six steps: Song `setup` → Look `cast-sets` → Storyboard `board` → Make `produce` → Final render `review` → Publish; a retired `compose` link resolves to Make), `resolveStageParam(value)` for the `:stage` route param, `deriveStages(project)` (per-stage `done`/`active`/`blocked`/`todo` + `current`, the first incomplete step; a live production run pins Make), `deriveNextAction(project, ctx)` (the one primary action the sticky header offers — approve Cast & Sets, verify lyric timing, stop/resume production, render final, …), `describeProjectStatus` (the header line and the step that needs the director), `autopilotStatus` (the header Autopilot button), `projectSpend(project)` (paid generation used vs. cap), `projectShotSummary(project)` (document shots or scene counts), `stageChecklist(stageId, project, readiness)` (what one step still needs, with the open approval's reason and a scroll anchor; an `optional` item, such as Make's animated proof, is listed but not counted), `summarizeStoryboardProblems(problems)` (folds the server's one-sentence-per-shot storyboard problems into one count line per kind), `stepNotes(project, readiness, publish)` (one fact per step for the step list), `listPreviewSources` (final, live composition, drafts, then the storyboard animatic), `projectServicesSummary(project)` (the saved image/video render services), `compareMusicVideoProjectsNewestFirst(a, b)` (sort projects newest created / updated first for project cards and pickers), and `currentProductionRun`; `productionReviewStopGuidance` separates current approval blockers from historical run stops. Used by `components/musicVideo/MusicVideoLayout.jsx` and `pages/MusicVideo.jsx`. || `musicVideoAttention.js` | Music Video "Needs attention" model (#9940): `deriveAttentionItems(project, live)` returns the banner rows for server-held states a client-orchestrated workflow can strand — an open/rendering revision, an interrupted Cast & Sets stage, a running auto-review waiting on its revised sections, a final render nobody is watching — derived from the persisted record so they survive a reload (healthy work this tab can see progressing is not flagged); `openRevisionOf(project)`; `ATTENTION_ANCHOR_ID` + `revealAttention()` scroll a refusal toast to the banner. Used by `components/musicVideo/NeedsAttentionBanner.jsx` and `pages/MusicVideo.jsx`. || `musicVideoProjectList.js` | Music Video project index model (#10167): `projectRunPill(project)` (Running / Needs you / Interrupted / Done, from the same next-action and attention logic as the header), `groupMusicVideoProjects(projects, query)` (collapse forks under their root, newest version first, name filter, groups ordered by last touch), and `compareMusicVideoProjectsRecentlyTouched`. Used by `pages/MusicVideo.jsx` and `components/musicVideo/MusicVideoProjectCard.jsx`. |-| `musicVideoPreview.js` | Pick the representative produced asset for a Music Video project card (`selectMusicVideoPreview`: final video → latest excerpt → latest rendered scene clip → latest scene reference frame → visual spec reference) for the main project grid. Pure, computed off the project record, with image path and fallback helpers (`musicVideoImageSrc`, `musicVideoImageFallback`). |+| `musicVideoPreview.js` | Pick the representative produced asset for a Music Video project card (`selectMusicVideoPreview`: final video → latest excerpt → latest rendered scene clip → latest scene reference frame → visual spec reference) for the main project grid. Pure, computed off the project record, with image path and fallback helpers (`musicVideoImageSrc`, `musicVideoImageFallback`, `scenePosterSrc`: a scene's frame or its clip's poster). || `musicVideoUniverseRefs.js` | `pullUniverseCanonReferences(universe, existingReferences)` (#8978) maps a linked universe's characters/places/objects to visual-spec references (character/set/prop roles), skipping images already present and capping at `MUSIC_VIDEO_MAX_REFERENCES` (24, mirrors the server schema). Returns `{ next, added, skipped }`; the caller persists `next` via the ordinary visualSpec PATCH. Used by `components/musicVideo/VisualSpecPanel.jsx`. (The style snapshots are derived server-side, #9105.) || `musicVideoAutonomous.js` | Fully-autonomous Music Video, client half: re-exports the server stage vocabulary (`AUTONOMOUS_STAGES`, checkpoint ids, default tools/limits, `autonomousMedium`), the status/checkpoint labels, and owns the start form's `emptyAutonomousDraft` / `autonomousRequestFromDraft` mapping (including the Suno form options and `isSunoModelValid`) plus `autonomousStageRows(run)` and `isAutonomousLive(run)` for the run panel, and `autopilotDraftFromParams` / `autopilotParamsFromDraft` for the music-video-autopilot Schedule settings form. || `musicVideoAutomation.js` | Music Video automation brief, client half: re-exports the server tool catalog (`MUSIC_VIDEO_AUTOMATION_TOOLS` / `_TOOL_IDS`), `DEFAULT_AUTOMATION_TOOLS` (the unmetered tools), and the form mapping `automationDraftFrom(automation)` / `automationFromDraft(draft)` (empty budget = no cap; the direction-LLM pin rides as `llm`, absent = Auto), plus `llmRouteLabel(route)` for the stage-route summary. Used by the create drawer and `AutopilotPanel`. |diff --git a/client/src/lib/musicVideoPreview.js b/client/src/lib/musicVideoPreview.jsindex c4a2d1732f..1367dffe5f 100644--- a/client/src/lib/musicVideoPreview.js+++ b/client/src/lib/musicVideoPreview.js@@ -10,6 +10,13 @@ export const musicVideoImageSrc = (assetId) => {return `/data/images/${raw}`;};+/**+ * The picture a scene card shows: its frame, else a poster cut from its selected+ * clip (a code-rendered or uploaded clip often has no frame), else null.+ */+export const scenePosterSrc = (scene) => musicVideoImageSrc(scene?.referenceImageId)+ || (nonEmptyString(scene?.videoHistoryId) ? videoPosterForJob(encodeURIComponent(scene.videoHistoryId)) : null);+export const musicVideoImageFallback = (assetId) => {const raw = nonEmptyString(assetId);if (!raw || raw.includes('.')) return null;diff --git a/client/src/lib/musicVideoSceneAttention.js b/client/src/lib/musicVideoSceneAttention.jsindex dfee3def29..959aab48d3 100644--- a/client/src/lib/musicVideoSceneAttention.js+++ b/client/src/lib/musicVideoSceneAttention.js@@ -56,15 +56,18 @@ function performanceBlocked(scene, { lipSyncBackend, songDurationSec, videoSetti* and `failed: { frame: {sceneId: true}, video: {sceneId: true} }` for renders* that failed this session, and `songReview` (the project's revised-song* verdicts by sceneId) so a shot the new lyrics changed is flagged until acted on.+ * `locked`: the director locked this shot, so its other takes are not waiting on review.*/export function sceneAttention(scene, ctx = {}) {if (!scene) return [];- const { layered = false, footageOptional = false, lipSyncBackend = '', songDurationSec = null, clipSec = null, failed = {}, songReview = null, videoSettings = null } = ctx;+ const { layered = false, footageOptional = false, lipSyncBackend = '', songDurationSec = null, clipSec = null, failed = {}, songReview = null, videoSettings = null, locked = false } = ctx;const layer = sceneVisualLayer(scene, { layered });const codes = [];const songChange = songReview?.[scene.sceneId];if (songChange && !songChange.resolved && SONG_REVIEW_CODES[songChange.status]) codes.push(SONG_REVIEW_CODES[songChange.status]);- if (!isSelfDrawnLayer(layer) && !scene.referenceImageId) codes.push('missing-frame');+ // A code-rendered clip was made without a seed frame, so it needs none.+ const codeRendered = scene.codeClip && scene.videoHistoryId;+ if (!isSelfDrawnLayer(layer) && !scene.referenceImageId && !codeRendered) 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 != null@@ -73,7 +76,7 @@ export function sceneAttention(scene, ctx = {}) {const contract = scene.direction?.actionContract;if (contract && shotActionContractProblem(contract, scene)) codes.push('contract-problem');if (layer === 'footage' && isPerformanceScene(scene) && performanceBlocked(scene, { lipSyncBackend, songDurationSec, videoSettings })) codes.push('perf-blocked');- if (sceneHasPendingDecision(scene)) codes.push('candidates-pending');+ if (!locked && sceneHasPendingDecision(scene)) codes.push('candidates-pending');if (contract && scene.referenceImageId) {const selected = sceneTakeList(scene, 'image').find((take) => take.assetId === scene.referenceImageId);if (currentPlateEvidence(scene, selected)?.verdict !== 'pass') codes.push('plate-unverified');@@ -95,12 +98,14 @@ export const SCENE_MEDIA_LABELS = Object.freeze({ clip: 'Clip', image: 'Image',* What a scene's selected media is, for the Board thumbnail badge: `clip` (a* rendered video is selected), `image` (only a still frame, whether the shot is* a still or footage still waiting on its clip), `code` / `card` (the- * composition draws it), or null when nothing is selected yet.+ * composition draws it, or the clip was rendered from code), or null when+ * nothing is selected yet.*/export function sceneMediaKind(scene, { layered = false } = {}) {if (!scene) return null;const layer = sceneVisualLayer(scene, { layered });if (isSelfDrawnLayer(layer)) return layer;- if (layer === 'footage' && scene.videoHistoryId) return 'clip';+ // A clip rendered from code (`codeClip`) is still footage to the render, but it reads as Code.+ if (layer === 'footage' && scene.videoHistoryId) return scene.codeClip ? 'code' : 'clip';return scene.referenceImageId ? 'image' : null;}diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex c06dee5f4d..52c5614c6e 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -1717,7 +1717,7 @@ describe('MusicVideo lyrics and shot coverage (#8964)', () => {await waitFor(() => expect(updateMusicVideoScene).toHaveBeenCalledWith('mv-1', 's1', { endSec: 7 }, { silent: true }));await waitFor(() => expect(screen.queryByRole('alert')).toBeNull());- await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Open Scene 2' })));+ await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Open Shot 2' })));const legacyPlayers = cardPlayers();expect(legacyPlayers).toHaveLength(1);expect(legacyPlayers[0]).toHaveAttribute('src', '/data/videos/h2.mp4');@@ -1771,7 +1771,7 @@ describe('MusicVideo section layers (#8985)', () => {expect(renderBtn).toBeDisabled();await openStage('board');- await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Open Scene 2' })));+ await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Open Shot 2' })));const layer = document.getElementById('mv-scene-s2-layer');fireEvent.change(layer, { target: { value: 'card' } });await waitFor(() => expect(updateMusicVideoScene).toHaveBeenCalledWith('mv-1', 's2', { visualLayer: 'card' }, { silent: true }));@@ -1788,7 +1788,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');- await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Open Scene 2' })));+ await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Open Shot 2' })));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();@@ -2935,9 +2935,9 @@ describe('MusicVideo stage tabs (#9243)', () => {await openStage('board');expect(screen.getByTitle('Composition document preview')).toBeTruthy();await waitFor(() => expect(screen.getByText('0.00s / 60.0s')).toBeTruthy());- fireEvent.click(screen.getByRole('button', { name: 'Open Scene 2' }));+ fireEvent.click(screen.getByRole('button', { name: 'Open Shot 2' }));await waitFor(() => expect(screen.getByText('4.00s / 60.0s')).toBeTruthy());- fireEvent.click(screen.getByRole('button', { name: 'Open Scene 1' }));+ fireEvent.click(screen.getByRole('button', { name: 'Open Shot 1' }));await waitFor(() => expect(screen.getByText('0.00s / 60.0s')).toBeTruthy());});diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.jsindex c703c4c046..24a1516a3d 100644--- a/server/lib/musicVideoValidation.js+++ b/server/lib/musicVideoValidation.js@@ -561,6 +561,8 @@ const sceneLayerFields = {cardText: z.string().max(500).nullable().optional(),// #10302: footage that the composition also draws code over; still counts as footage.codeOverlay: z.boolean().optional(),+ // Footage whose clip was rendered from code (an uploaded code render): the board labels it Code.+ codeClip: z.boolean().optional(),cardColor: z.string().regex(/^#[0-9a-f]{6}$/i, 'card color is #rrggbb').nullable().optional(),// #10583: where a composition document's lyric type may sit in this shot, and the role of its lines.textZone: z.enum(MUSIC_VIDEO_TEXT_ZONES).nullable().optional(),diff --git a/server/services/musicVideo/productionReview.storyboard.test.js b/server/services/musicVideo/productionReview.storyboard.test.jsindex 16ffc3373f..9cc15a9a49 100644--- a/server/services/musicVideo/productionReview.storyboard.test.js+++ b/server/services/musicVideo/productionReview.storyboard.test.js@@ -145,6 +145,12 @@ describe('locking shots one at a time', () => {const art = artApproved();const approved = approveProductionStage(art, { stage: 'storyboard', basis: productionReadiness(art).basis.storyboard });expect(productionReadiness(approved).storyboard.shotLocks).toEqual({ s1: 'locked', s2: 'locked', s3: 'locked' });+ // Marking a clip as code-rendered only relabels it on the board: the board stays approved.+ const coded = applySceneUpdate(approved, 's3', { codeClip: true }).project;+ expect(productionReadiness(coded).storyboard.approved).toBe(true);+ // The mark belongs to the clip it was set on: choosing another clip drops it.+ expect(applySceneUpdate(coded, 's3', { videoHistoryId: 'ai-clip' }).updated.codeClip).toBeUndefined();+ expect(applySceneUpdate(coded, 's3', { prompt: 'Same clip, new words' }).updated.codeClip).toBe(true);const { project: edited } = applySceneUpdate(approved, 's2', { prompt: 'ASCII-art music video on the CRT' });const board = productionReadiness(edited).storyboard;expect(board.shotLocks).toEqual({ s1: 'locked', s2: 'changed', s3: 'locked' });diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.jsindex ec7f429e60..f98d40a932 100644--- a/server/services/musicVideo/projectsLogic.js+++ b/server/services/musicVideo/projectsLogic.js@@ -34,7 +34,7 @@ import { sanitizeProjectForSync } from '../../lib/projectStoreKit.js';import { isPerformanceScene, planShotSplit, shotSplitLimit } from '../../lib/musicVideoShotTiming.js';import { normalizeLyricCues, normalizePhrases, invalidateTimedText } from './timedText.js';import { normalizeLyricMarkers } from './lyricMarkers.js';-import { ensureSceneTakes, TAKE_SLOT } from './takes.js';+import { ensureSceneTakes, keepCodeClipWithItsClip, TAKE_SLOT } from './takes.js';import { normalizeComposition, invalidateCompositionTiming, withStoredCompositionDocument } from './composition.js';import { normalizeSoundBed } from './soundBed.js';import { normalizeFilmLook } from '../../lib/filmLook.js';@@ -511,6 +511,7 @@ function buildScene(input, { order }) {...(input.camera ? { camera: input.camera } : {}),cardText: input.cardText ?? null,...(input.codeOverlay ? { codeOverlay: true } : {}),+ ...(input.codeClip ? { codeClip: 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.@@ -591,7 +592,7 @@ export function replaceScenes(project, sceneInputs) {// Scene fields a director edits within an approved shot (its span, wording and// selected takes) without adding a shot or lyric the storyboard approval did not cover.const SCENE_SHOT_EDIT_FIELDS = ['startSec', 'endSec', 'beatAligned', 'label', 'prompt', 'framePrompt', 'visualIntent',- 'referenceImageId', 'videoHistoryId', 'endImageId'];+ 'referenceImageId', 'videoHistoryId', 'endImageId', 'codeClip'];/*** Apply a patch to a single scene. Returns `{ project, updated }`. Throws if the@@ -602,7 +603,7 @@ export function applySceneUpdate(project, sceneId, patch) {const scenes = project.scenes || [];const idx = scenes.findIndex((s) => s.sceneId === sceneId);if (idx < 0) throw new ServerError('Scene not found', { status: 404, code: 'NOT_FOUND' });- const merged = { ...scenes[idx], ...data };+ const merged = 'codeClip' in data ? { ...scenes[idx], ...data } : keepCodeClipWithItsClip(scenes[idx], { ...scenes[idx], ...data });// Setting a slot directly (an older client, or a hand edit) still records the// asset as a take so the candidate list stays a superset of the selection.const touchesSlot = Object.values(TAKE_SLOT).some((field) => typeof data[field] === 'string');diff --git a/server/services/musicVideo/takes.js b/server/services/musicVideo/takes.jsindex 6cb2012a52..1fa301cdef 100644--- a/server/services/musicVideo/takes.js+++ b/server/services/musicVideo/takes.js@@ -30,6 +30,13 @@ import { isNonBlankStr, trimTo } from '../../lib/textUtils.js';// `endImage` (#11173): an optional style-break end frame a fal clip ends on.export const TAKE_SLOT = Object.freeze({ image: 'referenceImageId', video: 'videoHistoryId', endImage: 'endImageId' });+/** `codeClip` describes the clip it was set on: another clip in the slot is not code-rendered. */+export function keepCodeClipWithItsClip(before, after) {+ if (!after.codeClip || before?.videoHistoryId === after.videoHistoryId) return after;+ const { codeClip: _stale, ...rest } = after;+ return rest;+}+// Per-scene cap. Takes are small pointer records, but an unattended "regenerate// until it looks right" loop must not grow one project row without bound. When// full, the oldest rejected take is dropped first, then the oldest unselected@@ -115,7 +122,7 @@ function findSceneIndex(project, sceneId) {function replaceScene(project, idx, scene) {const scenes = project.scenes.slice();- scenes[idx] = scene;+ scenes[idx] = keepCodeClipWithItsClip(project.scenes[idx], scene);return retainMusicVideoDependencies(project, { ...project, scenes, updatedAt: new Date().toISOString() });}