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
Show both frames' actions and takes at once, split any shot at a picked time, and show precise shot run times (#11346)
[._.]/d3fb9a6132d5
diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex fb04ad1c8e..b0f5e7d12b 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -7,7 +7,7 @@ import { Trash2, Activity, ArrowUp, ArrowDown, ChevronRight, Video, Maximize2, Aimport OverflowMenu from '../ui/OverflowMenu.jsx';import SceneTakePicker from './SceneTakePicker.jsx';import VideoStartTrimControl from '../media/VideoStartTrimControl.jsx';-import { formatDurationSec } from '../../utils/formatters.js';+import { formatTimecode } from '../../utils/formatters.js';import { useVideoFileSrc } from '../../hooks/useVideoFileSrc.js';import PerformanceEvidence from './PerformanceEvidence.jsx';import { isPerformanceScene, planPerformanceRepair } from '../../lib/musicVideoShotTiming.js';@@ -232,7 +232,8 @@ export default function SceneCard({const shotSettings = (<>{/* What this shot's render covers and costs, and what blocks it, stays in view. */}- <SceneTimingPlan timing={timing} sceneId={scene.sceneId} lipSyncBackend={renderLane} onSplit={onSplit} onMergeNext={onMergeNext} />+ <SceneTimingPlan timing={timing} sceneId={scene.sceneId} lipSyncBackend={renderLane} onSplit={onSplit} onMergeNext={onMergeNext}+ span={sceneHasAuthoredSpan(scene) ? { startSec: scene.startSec, endSec: scene.endSec } : null} />{/* A VHS glitch riding on the cut into or out of this shot; never moves the cut. */}<SceneTransitions fieldId={fieldId} scene={scene} onChange={applyPatch} />{/* Everything set once and rarely revisited: timing, shot mode, layer, camera. */}@@ -377,7 +378,7 @@ export default function SceneCard({</div><div className="truncate text-[11px] text-port-text-muted">{typeof scene.startSec === 'number' && typeof scene.endSec === 'number'- ? `${formatDurationSec(scene.endSec - scene.startSec)} · ${formatDurationSec(scene.startSec)}–${formatDurationSec(scene.endSec)}`+ ? `${(scene.endSec - scene.startSec).toFixed(2)}s · ${formatTimecode(scene.startSec)}–${formatTimecode(scene.endSec)}`: `#${scene.order + 1}`}{scene.referenceImageId ? ' · frame ready' : ''}{scene.videoHistoryId ? ' · video ready' : ''}diff --git a/client/src/components/musicVideo/SceneCard.test.jsx b/client/src/components/musicVideo/SceneCard.test.jsxindex 0454234177..a9b0bfe5ac 100644--- a/client/src/components/musicVideo/SceneCard.test.jsx+++ b/client/src/components/musicVideo/SceneCard.test.jsx@@ -2,6 +2,7 @@ import { useState } from 'react';import { beforeEach, describe, expect, it, vi } from 'vitest';import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';vi.mock('../../hooks/useVideoFileSrc.js', () => ({ useVideoFileSrc: () => ({}) }));+vi.mock('../../services/apiMusicVideo.js', async (importOriginal) => ({ ...(await importOriginal()), getMusicVideoMediaPool: vi.fn(async () => ({ items: [] })) }));import SceneCard from './SceneCard.jsx';import { GROK_VIDEO_DURATIONS } from '../../lib/grokVideoClip.js';@@ -62,6 +63,8 @@ describe('music-driven performance', () => {onEditLocal={(_id, patch) => setScene((current) => ({ ...current, ...patch }))} onSave={onSave} />;}render(<Harness />);+ // The header reads the shot's precise run time, then where it sits in the song.+ expect(screen.getByText(/^3\.50s · 0:10\.00–0:13\.50/)).toBeTruthy();const shot = screen.getByLabelText('Shot');fireEvent.change(shot, { target: { value: 'music' } });expect(onSave).toHaveBeenLastCalledWith('s1', { shotMode: 'performance', performanceStyle: 'music' });@@ -353,8 +356,8 @@ describe('Render follows the shot locks', () => {});describe('start and end frames', () => {- // Uniquely catches a frame's prompt or Render hiding away from its picture, a frame reference not reaching the render, or the Render section not saying which renderer ends on the end frame.- it('shows each frame with its prompt and Render, renders from a picked frame, and shows the tapped frame\'s takes', () => {+ // Uniquely catches a frame's prompt, Render, Swap or takes hiding away from its picture, a frame reference not reaching the render, or the Render section not saying which renderer ends on the end frame.+ it('shows each frame with its prompt, Render, Swap and takes, and renders from a picked frame', async () => {const scene = { sceneId: 's1', prompt: 'She looks into the lens', referenceImageId: 'start.png', endImageId: 'end.png', endFramePrompt: 'Head thrown back', startSec: 0, endSec: 4,takes: [{ takeId: 't1', kind: 'image', assetId: 'start.png', status: 'selected' }, { takeId: 't2', kind: 'endImage', assetId: 'end.png', status: 'selected' }] };const onGenerateFrame = vi.fn();@@ -364,6 +367,11 @@ describe('start and end frames', () => {const pair = screen.getByRole('group', { name: 'Start and end frames' });expect(within(pair).getByLabelText('Reference frame prompt')).toBeTruthy();expect(within(pair).getByLabelText('End frame prompt').value).toBe('Head thrown back');+ // Each frame swaps from the unused stills on its own, without tapping it first.+ fireEvent.click(within(pair).getByRole('button', { name: 'Swap end frame from unused' }));+ expect(await screen.findByRole('dialog', { name: /^Swap end frame for/ })).toBeTruthy();+ fireEvent.click(screen.getByRole('button', { name: 'Close' }));+ expect(within(pair).getByRole('button', { name: 'Swap start frame from unused' })).toBeTruthy();// The end frame renders from the start frame unless another frame is picked; the start frame from its prompt.fireEvent.click(within(pair).getByRole('button', { name: 'New end frame take' }));@@ -372,9 +380,9 @@ describe('start and end frames', () => {fireEvent.click(within(pair).getByRole('button', { name: 'New frame take' }));expect(onGenerateFrame).toHaveBeenLastCalledWith(scene, { referenceImageId: 'end.png' });- expect(screen.getByRole('list', { name: /^Frame takes/ })).toBeTruthy();- fireEvent.click(within(pair).getByRole('button', { name: 'End frame' }));- expect(screen.getByRole('list', { name: /^End frame takes/ })).toBeTruthy();+ // Both frames' takes show at once, each under its own frame.+ expect(within(pair).getByRole('list', { name: /^Frame takes/ })).toBeTruthy();+ expect(within(pair).getByRole('list', { name: /^End frame takes/ })).toBeTruthy();expect(screen.getByRole('button', { name: 'Clear scene 1 end frame' })).toBeTruthy();expect(screen.getByTestId('end-frame-plan').textContent).toMatch(/animates from the start frame only/);diff --git a/client/src/components/musicVideo/SceneFrames.jsx b/client/src/components/musicVideo/SceneFrames.jsxindex 19d3a67464..43aaa6f422 100644--- a/client/src/components/musicVideo/SceneFrames.jsx+++ b/client/src/components/musicVideo/SceneFrames.jsx@@ -1,29 +1,28 @@import { useLayoutEffect, useRef, useState } from 'react';-import { Activity, ArrowRight, Image as ImageIcon, ImagePlus, Maximize2, PencilLine, Shuffle, SkipForward, Wand2, X } from 'lucide-react';+import { Activity, ArrowRight, Image as ImageIcon, ImagePlus, PencilLine, Shuffle, SkipForward, Wand2, X } from 'lucide-react';import SceneTakeStrip from './SceneTakeStrip.jsx';const PRIMARY_BUTTON = 'flex items-center gap-1 bg-port-border hover:bg-port-border/70 disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0 whitespace-nowrap';const SECONDARY_BUTTON = 'flex items-center gap-1 bg-port-bg border border-port-border hover:bg-port-border/40 disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0 whitespace-nowrap';const SELECT = 'min-w-0 bg-port-bg border border-port-border rounded px-1 py-1 text-xs min-h-[44px] sm:min-h-0 disabled:opacity-50';-/** One of a shot's two frames: tap to work on its takes, the corner button to see it full size. */-function FrameTile({ label, imageId, empty, active, onPick, onOpen, openLabel }) {+/** One of a shot's two frames: tap it to see it full size. */+function FrameTile({ label, imageId, empty, onOpen, openLabel }) {+ const tag = <span className="port-media-overlay-strong absolute left-1 top-1 rounded px-1 text-[10px] leading-tight">{label}</span>;+ if (!imageId) {+ return (+ <div className="relative min-w-0 overflow-hidden rounded border border-dashed border-port-border">+ <span className="flex aspect-video w-full items-center justify-center text-[11px] text-port-text-muted">{empty}</span>+ {tag}+ </div>+ );+ }return (- <div className="relative min-w-0">- <button type="button" onClick={onPick} aria-pressed={active} aria-label={`${label} frame${imageId ? '' : `: ${empty}`}`}- className={`block w-full overflow-hidden rounded border ${active ? 'border-port-accent ring-2 ring-port-accent' : 'border-port-border'} focus:outline-none focus:ring-2 focus:ring-port-accent`}>- {imageId- ? <img src={`/data/images/${encodeURIComponent(imageId)}`} alt="" className="block aspect-video w-full bg-black object-cover" />- : <span className="flex aspect-video w-full items-center justify-center text-[11px] text-port-text-muted">{empty}</span>}- <span className="port-media-overlay-strong absolute left-1 top-1 rounded px-1 text-[10px] leading-tight">{label}</span>- </button>- {imageId && (- <button type="button" onClick={onOpen} aria-label={openLabel} title={openLabel}- className="port-media-overlay-strong absolute right-1 top-1 flex min-h-[44px] min-w-[44px] items-center justify-center rounded p-1 sm:min-h-0 sm:min-w-0">- <Maximize2 className="h-3 w-3" />- </button>- )}- </div>+ <button type="button" onClick={onOpen} aria-label={openLabel} title={openLabel}+ className="relative block w-full min-w-0 overflow-hidden rounded border border-port-border focus:outline-none focus:ring-2 focus:ring-port-accent">+ <img src={`/data/images/${encodeURIComponent(imageId)}`} alt="" className="block aspect-video w-full bg-black object-cover" />+ {tag}+ </button>);}@@ -56,15 +55,15 @@ const REFERENCE_LABELS = { '': 'Prompt only', start: 'Start frame', end: 'End fr* Render right under the picture, and can render from the start or end frame* as an image reference (`onGenerateFrame` / `onGenerateEndFrame` take* `{ referenceImageId }`, null for prompt only). Refine edits a frame by a- * short instruction (`{ referenceImageId, refine }`). Tapping a frame picks whose- * takes show below, as a grid, with that frame's swap and import actions.+ * short instruction (`{ referenceImageId, refine }`), and Swap puts one of the+ * video's unused stills on it. Each frame's own takes sit under it as a grid,+ * so both frames' actions and takes show at once; tapping a frame opens it full size.*/export default function SceneFrames({scene, index, endFrames, generatingFrame = false, generatingEndFrame = false, onGenerateFrame, onGenerateEndFrame,onEditLocal, onSave, onOpenPreview, takeBusy = false, onSelectTake, onReviewTake, onSwap = null, onImportTake = null,onContinueFromPrevious = null, previousHasClip = false, clipLocked = false,}) {- const [side, setSide] = useState('start');const [keepStillAsEnd, setKeepStillAsEnd] = useState(false);// Which frame each render starts from: the start frame renders from its prompt, the end frame from the start frame.const [refs, setRefs] = useState({ start: '', end: 'start' });@@ -75,7 +74,6 @@ export default function SceneFrames({const refOf = (which) => (frames[refs[which]] ? refs[which] : '');const lockedTitle = 'Video locked. Unlock the video to change it.';const id = (name) => `mv-scene-${scene.sceneId}-${name}`;- const activeSide = endFrames ? side : 'start';const column = (which) => {const start = which === 'start';@@ -97,8 +95,7 @@ export default function SceneFrames({};return (<div key={which} className="min-w-0 space-y-1.5">- <FrameTile label={label} imageId={imageId} empty={start ? 'No still yet' : 'Optional'} active={endFrames && activeSide === which}- onPick={() => setSide(which)} onOpen={() => onOpenPreview?.(`image:${imageId}`)}+ <FrameTile label={label} imageId={imageId} empty={start ? 'No still yet' : 'Optional'} onOpen={() => onOpenPreview?.(`image:${imageId}`)}openLabel={`View scene ${index + 1} ${start ? 'reference' : 'end'} frame full size`} /><FramePrompt id={id(`${which}-prompt`)} label={start ? 'Reference frame prompt' : 'End frame prompt'} value={scene[field] || ''}onChange={(e) => onEditLocal(scene.sceneId, { [field]: e.target.value })}@@ -125,6 +122,13 @@ export default function SceneFrames({<PencilLine size={14} /> Refine</button>)}+ {onSwap && (+ <button type="button" onClick={() => onSwap(start ? 'image' : 'endImage')} disabled={takeBusy || clipLocked} className={SECONDARY_BUTTON}+ aria-label={`Swap ${start ? 'start' : 'end'} frame from unused`}+ title={clipLocked ? lockedTitle : `Pick a still made for this video that no shot uses as the ${start ? 'start' : 'end'} frame`}>+ <Shuffle size={14} /> Swap+ </button>+ )}</div>{refining === which && imageId && (<form onSubmit={refine} className="flex min-w-0 gap-2">@@ -138,6 +142,40 @@ export default function SceneFrames({</button></form>)}+ {(start ? onImportTake || onContinueFromPrevious : scene.endImageId) && (+ <div className="flex flex-wrap gap-2">+ {start && onImportTake && (+ <button type="button" onClick={() => onImportTake(scene)} disabled={takeBusy} className={SECONDARY_BUTTON}+ title="Add a frame from the gallery or an upload (e.g. made in an external tool) as a take">+ <ImagePlus size={14} /> Import take+ </button>+ )}+ {start && onContinueFromPrevious && (+ <button type="button" onClick={() => onContinueFromPrevious(scene, { keepStillAsEnd: keepStillAsEnd && Boolean(scene.referenceImageId) })}+ disabled={takeBusy || !previousHasClip} className={SECONDARY_BUTTON}+ title={previousHasClip ? 'Start this shot from the last frame the previous shot shows in the cut' : 'The previous shot needs a clip first'}>+ <SkipForward size={14} /> From previous shot+ </button>+ )}+ {!start && scene.endImageId && (+ <button type="button" onClick={() => { onEditLocal(scene.sceneId, { endImageId: null }); onSave(scene.sceneId, { endImageId: null }); }}+ disabled={clipLocked} className={SECONDARY_BUTTON}+ aria-label={`Clear scene ${index + 1} end frame`} title="The clip ends where the model takes it; the end frame's takes stay">+ <X size={14} /> No end frame+ </button>+ )}+ </div>+ )}+ {start && onContinueFromPrevious && scene.referenceImageId && (+ <label htmlFor={id('keep-still-end')} className="flex items-center gap-1 text-[11px] text-port-text-muted min-h-[44px] sm:min-h-0">+ <input id={id('keep-still-end')} type="checkbox" checked={keepStillAsEnd} onChange={(e) => setKeepStillAsEnd(e.target.checked)} />+ From previous shot: keep this frame as the end frame+ </label>+ )}+ <SceneTakeStrip scene={scene} kind={start ? 'image' : 'endImage'} busy={takeBusy} grid+ onSelect={(take) => onSelectTake?.(scene, take)}+ onReview={(take, review) => onReviewTake?.(scene, take, review)}+ onOpenPreview={onOpenPreview} /></div>);};@@ -152,44 +190,6 @@ export default function SceneFrames({{column('end')}</div>) : column('start')}- <div className="flex flex-wrap gap-2">- {onSwap && (- <button type="button" onClick={() => onSwap(activeSide === 'end' ? 'endImage' : 'image')} disabled={takeBusy || clipLocked} className={SECONDARY_BUTTON}- title={clipLocked ? lockedTitle : `Pick a still made for this video that no shot uses as the ${activeSide === 'end' ? 'end' : 'start'} frame`}>- <Shuffle size={14} /> Swap from unused- </button>- )}- {activeSide === 'start' && onImportTake && (- <button type="button" onClick={() => onImportTake(scene)} disabled={takeBusy} className={SECONDARY_BUTTON}- title="Add a frame from the gallery or an upload (e.g. made in an external tool) as a take">- <ImagePlus size={14} /> Import take- </button>- )}- {activeSide === 'start' && onContinueFromPrevious && (- <button type="button" onClick={() => onContinueFromPrevious(scene, { keepStillAsEnd: keepStillAsEnd && Boolean(scene.referenceImageId) })}- disabled={takeBusy || !previousHasClip} className={SECONDARY_BUTTON}- title={previousHasClip ? 'Start this shot from the last frame the previous shot shows in the cut' : 'The previous shot needs a clip first'}>- <SkipForward size={14} /> From previous shot- </button>- )}- {activeSide === 'end' && scene.endImageId && (- <button type="button" onClick={() => { onEditLocal(scene.sceneId, { endImageId: null }); onSave(scene.sceneId, { endImageId: null }); }}- disabled={clipLocked} className={SECONDARY_BUTTON}- aria-label={`Clear scene ${index + 1} end frame`} title="The clip ends where the model takes it; the end frame's takes stay">- <X size={14} /> No end frame- </button>- )}- </div>- {activeSide === 'start' && onContinueFromPrevious && scene.referenceImageId && (- <label htmlFor={id('keep-still-end')} className="flex items-center gap-1 text-[11px] text-port-text-muted min-h-[44px] sm:min-h-0">- <input id={id('keep-still-end')} type="checkbox" checked={keepStillAsEnd} onChange={(e) => setKeepStillAsEnd(e.target.checked)} />- From previous shot: keep this frame as the end frame- </label>- )}- <SceneTakeStrip scene={scene} kind={activeSide === 'end' ? 'endImage' : 'image'} busy={takeBusy} grid- onSelect={(take) => onSelectTake?.(scene, take)}- onReview={(take, review) => onReviewTake?.(scene, take, review)}- onOpenPreview={onOpenPreview} /></section>);}diff --git a/client/src/components/musicVideo/SceneTimingPlan.jsx b/client/src/components/musicVideo/SceneTimingPlan.jsxindex 100caebdec..6351d5ef99 100644--- a/client/src/components/musicVideo/SceneTimingPlan.jsx+++ b/client/src/components/musicVideo/SceneTimingPlan.jsx@@ -1,9 +1,43 @@+import { useState } from 'react';import { AlertTriangle, Merge, Scissors } from 'lucide-react';import { formatDurationSec } from '../../utils/formatters.js';import { getFalVideoModel } from '../../lib/falVideoModels.js';-/** Stateless provider plan and scene split/merge controls, without wrapper DOM. */-export default function SceneTimingPlan({ timing, sceneId, lipSyncBackend, onSplit, onMergeNext }) {+const SPLIT_BUTTON = 'inline-flex items-center gap-1 rounded bg-port-bg border border-port-border hover:bg-port-border/40 px-2 py-1 text-xs min-h-[44px] sm:min-h-0';+// The shortest piece the server leaves on either side of a split (projectsLogic MIN_SPLIT_PIECE_SEC).+const MIN_PIECE_SEC = 0.1;+const tenth = (sec) => Math.round(sec * 10) / 10;++/** Cut a shot in two at a time the director picks on a slider (default: its middle). */+function SplitAt({ sceneId, startSec, endSec, onSplit }) {+ const [open, setOpen] = useState(false);+ const min = tenth(startSec + MIN_PIECE_SEC);+ const max = tenth(endSec - MIN_PIECE_SEC);+ const [atSec, setAtSec] = useState(() => tenth((startSec + endSec) / 2));+ if (!open) {+ return (+ <button type="button" onClick={() => setOpen(true)} className={SPLIT_BUTTON} title="Cut this shot in two at a time you pick">+ <Scissors size={13} /> Split shot+ </button>+ );+ }+ const inputId = `mv-scene-${sceneId}-split-at`;+ return (+ <div className="flex w-full min-w-0 flex-wrap items-center gap-2 text-xs">+ <label htmlFor={inputId} className="shrink-0">Split at</label>+ <input id={inputId} type="range" min={min} max={max} step={0.1} value={Math.min(max, Math.max(min, atSec))}+ onChange={(e) => setAtSec(Number(e.target.value))} className="min-w-0 flex-1 basis-32" />+ <span className="shrink-0 tabular-nums text-port-text-muted">{(atSec - startSec).toFixed(1)}s in · {formatDurationSec(atSec)}</span>+ <button type="button" onClick={() => { onSplit(sceneId, null, atSec); setOpen(false); }} className={SPLIT_BUTTON}>+ <Scissors size={13} /> Split here+ </button>+ <button type="button" onClick={() => setOpen(false)} className={SPLIT_BUTTON}>Cancel</button>+ </div>+ );+}++/** Stateless provider plan and scene split/merge controls, without wrapper DOM. `span` (the shot's start and end) offers a manual split. */+export default function SceneTimingPlan({ timing, sceneId, lipSyncBackend, onSplit, onMergeNext, span = null }) {const {performance, performanceBlocked, capability, plan, performanceCost,falTake, falCost, grokPlan, timedSpan, canSplit, splitLimit, canMerge,@@ -41,6 +75,9 @@ export default function SceneTimingPlan({ timing, sceneId, lipSyncBackend, onSpl<Scissors size={13} /> Split on lyric boundaries</button>)}+ {onSplit && span && span.endSec - span.startSec >= 2 * MIN_PIECE_SEC + 0.1 && (+ <SplitAt key={`${span.startSec}-${span.endSec}`} sceneId={sceneId} startSec={span.startSec} endSec={span.endSec} onSplit={onSplit} />+ )}{canMerge && (<button type="button" onClick={() => onMergeNext(sceneId, lipSyncBackend || null)}className="inline-flex items-center gap-1 rounded bg-port-bg border border-port-border hover:bg-port-border/40 px-2 py-1 text-xs min-h-[44px] sm:min-h-0"diff --git a/client/src/components/musicVideo/stages/BoardStage.jsx b/client/src/components/musicVideo/stages/BoardStage.jsxindex e5752486d2..d5c9bbc9f8 100644--- a/client/src/components/musicVideo/stages/BoardStage.jsx+++ b/client/src/components/musicVideo/stages/BoardStage.jsx@@ -173,7 +173,11 @@ export default function BoardStage({ board }) {<SceneMediaBadges scene={scene} layered={layered} /></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>+ {/* Run time first, then where it sits in the song. */}+ <span className="block text-xs text-port-text-muted">+ {Number.isFinite(scene.startSec) && Number.isFinite(scene.endSec) && <span className="font-medium text-port-text">{(scene.endSec - scene.startSec).toFixed(2)}s · </span>}+ {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>)}</div>diff --git a/client/src/components/musicVideo/stages/BoardStage.test.jsx b/client/src/components/musicVideo/stages/BoardStage.test.jsxindex f3cb883e77..45e968135b 100644--- a/client/src/components/musicVideo/stages/BoardStage.test.jsx+++ b/client/src/components/musicVideo/stages/BoardStage.test.jsx@@ -35,6 +35,8 @@ describe('BoardStage scene filter', () => {it('writes the filter to the URL and removes it for All', () => {renderBoard(board(scenes));expect(screen.getByText('Shot 1 · Part 1')).toBeTruthy();+ // Each card reads its run time beside where it sits in the song.+ expect(screen.getAllByText('3.00s ·')[0].parentElement.textContent).toBe('3.00s · 0:00.00–0:03.00');fireEvent.click(screen.getByRole('button', { name: 'Needs attention (1)' }));expect(screen.getByTestId('search').textContent).toBe('?scenes=attention');expect(screen.queryByText('Shot 1 · Part 1')).toBeNull();diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex caeabf3833..e2ca68d9de 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -939,8 +939,9 @@ export default function MusicVideo() {// #8977: split a shot its backend cannot render in one take on lyric/phrase// boundaries. `backend` is the lane the card measured against.- const handleSplitScene = (sceneId, backend) => {- splitMusicVideoScene(selected.id, sceneId, backend, { silent: true })+ // `atSec` cuts the shot in two at that song time instead (the card's "Split shot").+ const handleSplitScene = (sceneId, backend, atSec = null) => {+ splitMusicVideoScene(selected.id, sceneId, backend, { atSec, silent: true }).then(({ project, scenes }) => {replaceProject(project);toast.success(`Split into ${pluralize(scenes.length, 'shot')}`);diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex fb20891a6e..6a1802a2ee 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -1374,6 +1374,23 @@ describe('MusicVideo project video renderer', () => {expect(screen.queryByRole('button', { name: /Split on lyric boundaries/ })).toBeNull();});+ // Uniquely catches a shot with no way to be cut in two at a picked time (only merge, or the lyric-boundary split on a too-long shot).+ it('splits a shot in two at the time picked on its slider', async () => {+ const scene = { ...PROJECT_NO_CLIP.scenes[0], startSec: 10, endSec: 14 };+ const pieces = [{ ...scene, endSec: 11.5, label: 'Shot · 1/2' }, { ...scene, sceneId: 's1b', order: 1, startSec: 11.5, label: 'Shot · 2/2' }];+ splitMusicVideoScene.mockResolvedValue({ project: { ...PROJECT_NO_CLIP, scenes: pieces }, scenes: pieces });+ await openProject({ ...PROJECT_NO_CLIP, scenes: [scene] }, 'produce');++ fireEvent.click(await screen.findByRole('button', { name: /Split shot/ }));+ const slider = screen.getByLabelText('Split at');+ expect(slider.value).toBe('12');+ fireEvent.change(slider, { target: { value: '11.5' } });+ expect(screen.getByText(/1\.5s in/)).toBeTruthy();+ fireEvent.click(screen.getByRole('button', { name: /Split here/ }));+ await waitFor(() => expect(splitMusicVideoScene).toHaveBeenCalledWith('mv-2', 's1', null, expect.objectContaining({ atSec: 11.5 })));+ expect((await screen.findAllByText(/Shot · 2\/2$/, { selector: ':not(option)' })).length).toBeGreaterThan(0);+ });+it('requests the Grok clip that covers a cutaway and adds approximate motion timing', async () => {generateVideo.mockResolvedValue({ jobId: 'grok-job' });await openProject({diff --git a/client/src/services/apiMusicVideo.js b/client/src/services/apiMusicVideo.jsindex 4c9359b7d7..6ee56dd32c 100644--- a/client/src/services/apiMusicVideo.js+++ b/client/src/services/apiMusicVideo.js@@ -131,9 +131,10 @@ export const reorderMusicVideoScenes = (id, sceneIds, options = {}) =>});// Split a shot its backend cannot render in one take on lyric/phrase// boundaries (#8977) → { project, scenes }. `backend` omitted = project pin.-export const splitMusicVideoScene = (id, sceneId, backend, options = {}) =>+// `atSec` cuts it in two at that song time instead.+export const splitMusicVideoScene = (id, sceneId, backend, { atSec = null, ...options } = {}) =>request(`/music-video/${encodeURIComponent(id)}/scenes/${encodeURIComponent(sceneId)}/split`, {- method: 'POST', body: JSON.stringify(backend ? { backend } : {}), ...options,+ method: 'POST', body: JSON.stringify({ ...(backend ? { backend } : {}), ...(atSec != null ? { atSec } : {}) }), ...options,});// Join a scene with the next one, the inverse of split → { project, scene }.export const mergeMusicVideoNextScene = (id, sceneId, backend, options = {}) =>