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
Keep the open shot card readable on a phone, and refine a frame by instruction (#11283)
[._.]/3e456268a582
diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex bc01169852..a9ff8c4798 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -366,7 +366,7 @@ export default function SceneCard({><summaryonClick={() => onSeek?.(scene)}- className="flex min-h-[44px] cursor-pointer select-none items-center gap-3 p-2 marker:content-none group-open:pr-52 [&::-webkit-details-marker]:hidden"+ className="flex min-h-[44px] cursor-pointer select-none items-center gap-3 p-2 marker:content-none flex-wrap group-open:pr-40 sm:group-open:pr-52 [&::-webkit-details-marker]:hidden"><ChevronRight size={14} aria-hidden="true" className="shrink-0 text-port-text-muted transition-transform group-open:rotate-90" /><ScenePoster scene={scene} iconSize={14} className="aspect-video w-16 shrink-0 rounded border border-port-border sm:w-20 max-sm:group-open:hidden" />@@ -386,26 +386,31 @@ export default function SceneCard({{attention.length > 0 && (<ul aria-label="Needs attention" className="mt-0.5 flex flex-wrap gap-1">{attention.map((code) => (- <li key={code} data-attention={code} className="rounded border border-port-warning/40 bg-port-warning/10 px-1.5 text-[10px] text-port-warning">+ <li key={code} data-attention={code} className="whitespace-nowrap rounded border border-port-warning/40 bg-port-warning/10 px-1.5 text-[10px] text-port-warning">{SCENE_ATTENTION_LABELS[code]}</li>))}</ul>)}</div>- {generatingLane && (- <span className="flex shrink-0 items-center gap-1 text-[11px] text-port-accent">- <Activity size={14} className="animate-spin" aria-label="Generating" />- {generatingLane}+ {/* Render status wraps under the title on a phone instead of squeezing it. */}+ {(generatingLane || generatingFrame || generatingVideo) && (+ <span className="flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 max-sm:basis-full max-sm:pl-6">+ {generatingLane && (+ <span className="flex items-center gap-1 text-[11px] text-port-accent">+ <Activity size={14} className="animate-spin" aria-label="Generating" />+ {generatingLane}+ </span>+ )}+ <SceneRenderProgress kind="Frame" generating={generatingFrame} progress={frameProgress} />+ <SceneRenderProgress kind="Video" generating={generatingVideo} progress={videoProgress} /></span>)}- <SceneRenderProgress kind="Frame" generating={generatingFrame} progress={frameProgress} />- <SceneRenderProgress kind="Video" generating={generatingVideo} progress={videoProgress} /></summary>{/* The open card's lock and "…" menu sit in its top-right corner. A move swaps thisshot with its neighbor; the song timing and lyric stay with the slot. */}<div className="absolute right-2 top-2 z-10 flex items-center gap-1">- <ShotLockButton scene={scene} />+ <ShotLockButton scene={scene} compact /><OverflowMenu label="Shot actions" items={[{ id: 'earlier', label: 'Move earlier', icon: ArrowUp, onSelect: () => onMove(index, -1), disabled: index === 0 || documentComposition },{ id: 'later', label: 'Move later', icon: ArrowDown, onSelect: () => onMove(index, 1), disabled: isLast || documentComposition },diff --git a/client/src/components/musicVideo/SceneCard.test.jsx b/client/src/components/musicVideo/SceneCard.test.jsxindex a37ad7cc01..29483ee070 100644--- a/client/src/components/musicVideo/SceneCard.test.jsx+++ b/client/src/components/musicVideo/SceneCard.test.jsx@@ -345,6 +345,8 @@ describe('Render follows the shot locks', () => {expect(screen.getByRole('button', { name: 'Render again' }).disabled).toBe(true);expect(screen.getByRole('button', { name: 'Render again' }).title).toMatch(/^Video locked/);rerender(card('locked', 'open'));+ // The corner lock shows only its icon on a phone; its label stays the button's name.+ expect(screen.getByRole('button', { name: 'Lock video' })).toBeTruthy();fireEvent.click(screen.getByRole('button', { name: 'Render again' }));expect(onGenerateVideo).toHaveBeenCalledWith(scene, { card: expect.objectContaining({ prompt: scene.prompt }) });});diff --git a/client/src/components/musicVideo/SceneFrames.jsx b/client/src/components/musicVideo/SceneFrames.jsxindex 35509af34c..19d3a67464 100644--- a/client/src/components/musicVideo/SceneFrames.jsx+++ b/client/src/components/musicVideo/SceneFrames.jsx@@ -1,5 +1,5 @@-import { useState } from 'react';-import { Activity, ArrowRight, Image as ImageIcon, ImagePlus, Maximize2, Shuffle, SkipForward, Wand2, X } from 'lucide-react';+import { useLayoutEffect, useRef, useState } from 'react';+import { Activity, ArrowRight, Image as ImageIcon, ImagePlus, Maximize2, 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';@@ -27,6 +27,27 @@ function FrameTile({ label, imageId, empty, active, onPick, onOpen, openLabel }));}+/**+ * A frame prompt that grows to fit its text, so a long prompt never sits+ * scrolled partway inside a short box (on iOS that left a half-cut line).+ */+function FramePrompt({ id, label, value, ...props }) {+ const ref = useRef(null);+ useLayoutEffect(() => {+ const el = ref.current;+ if (!el) return;+ el.style.height = 'auto';+ el.style.height = `${el.scrollHeight + el.offsetHeight - el.clientHeight}px`;+ }, [value]);+ return (+ <>+ <label htmlFor={id} className="sr-only">{label}</label>+ <textarea ref={ref} id={id} value={value} rows={3} {...props}+ className="block max-h-80 w-full resize-none overflow-y-auto bg-port-bg border border-port-border rounded px-2 py-1.5 text-sm" />+ </>+ );+}+const REFERENCE_LABELS = { '': 'Prompt only', start: 'Start frame', end: 'End frame' };/**@@ -34,7 +55,8 @@ const REFERENCE_LABELS = { '': 'Prompt only', start: 'Start frame', end: 'End fr* optional one it ends on (#11173). Each frame shows its prompt and its own* 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). Tapping a frame picks whose+ * `{ 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.*/export default function SceneFrames({@@ -46,6 +68,9 @@ export default function SceneFrames({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' });+ // Refine: which frame's edit box is open, and the instruction typed into it.+ const [refining, setRefining] = useState(null);+ const [instruction, setInstruction] = useState('');const frames = { start: scene.referenceImageId || null, end: endFrames ? scene.endImageId || null : null };const refOf = (which) => (frames[refs[which]] ? refs[which] : '');const lockedTitle = 'Video locked. Unlock the video to change it.';@@ -62,17 +87,23 @@ export default function SceneFrames({const refChoices = ['', ...['start', 'end'].filter((key) => frames[key])];const needsPrompt = !start && !scene.endFramePrompt?.trim();const render = () => (start ? onGenerateFrame : onGenerateEndFrame)?.(scene, { referenceImageId: ref ? frames[ref] : null });+ const refineLocked = !!generating || (!start && clipLocked);+ const refine = (e) => {+ e.preventDefault();+ if (!instruction.trim() || refineLocked) return;+ (start ? onGenerateFrame : onGenerateEndFrame)?.(scene, { referenceImageId: imageId, refine: instruction.trim() });+ setRefining(null);+ setInstruction('');+ };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}`)}openLabel={`View scene ${index + 1} ${start ? 'reference' : 'end'} frame full size`} />- <label htmlFor={id(`${which}-prompt`)} className="sr-only">{start ? 'Reference frame prompt' : 'End frame prompt'}</label>- <textarea id={id(`${which}-prompt`)} value={scene[field] || ''} rows={3}+ <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 })}onBlur={(e) => onSave(scene.sceneId, { [field]: e.target.value || null })}- placeholder={start ? 'Start frame prompt (defaults to the shot prompt)' : 'Where the shot ends, e.g. her head thrown back, eyes white'}- className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-sm" />+ placeholder={start ? 'Start frame prompt (defaults to the shot prompt)' : 'Where the shot ends, e.g. her head thrown back, eyes white'} /><div className="flex flex-wrap items-center gap-2"><button type="button" onClick={render} disabled={!!generating || needsPrompt || (!start && clipLocked)} className={PRIMARY_BUTTON}title={needsPrompt ? 'Describe the end frame first' : ref ? `Render from the ${REFERENCE_LABELS[ref].toLowerCase()} with this prompt` : 'Render from this prompt'}>@@ -88,7 +119,25 @@ export default function SceneFrames({</select></span>)}+ {imageId && (+ <button type="button" onClick={() => { setRefining(refining === which ? null : which); setInstruction(''); }} disabled={refineLocked}+ aria-expanded={refining === which} className={SECONDARY_BUTTON} title="Edit this frame with a short instruction, keeping the rest">+ <PencilLine size={14} /> Refine+ </button>+ )}</div>+ {refining === which && imageId && (+ <form onSubmit={refine} className="flex min-w-0 gap-2">+ <label htmlFor={id(`${which}-refine`)} className="sr-only">{`What to change in the ${start ? 'start' : 'end'} frame`}</label>+ <input id={id(`${which}-refine`)} type="text" value={instruction} onChange={(e) => setInstruction(e.target.value)}+ placeholder="What to change, e.g. remove the hand"+ className="min-w-0 flex-1 bg-port-bg border border-port-border rounded px-2 py-1.5 text-base sm:text-sm" />+ <button type="submit" disabled={!instruction.trim() || refineLocked} className={PRIMARY_BUTTON}+ aria-label={`Render refined ${start ? 'start' : 'end'} frame`}>+ <Wand2 size={14} /> Render+ </button>+ </form>+ )}</div>);};diff --git a/client/src/components/musicVideo/ShotLock.jsx b/client/src/components/musicVideo/ShotLock.jsxindex 16a65fbc2e..1615426ed5 100644--- a/client/src/components/musicVideo/ShotLock.jsx+++ b/client/src/components/musicVideo/ShotLock.jsx@@ -36,13 +36,13 @@ export function useShotLock(sceneId) {const baseCls = 'inline-flex min-h-[44px] shrink-0 items-center justify-center gap-1 rounded border px-2 text-xs disabled:opacity-50 sm:min-h-[28px]';const toneCls = { locked: 'border-port-success/50 bg-port-success/10 text-port-success', changed: 'border-port-warning/50 bg-port-warning/10 text-port-warning', open: 'border-port-border text-port-text' };-function LockButton({ lock, locking, stage, tone, label, title, iconOnly = false, className = '' }) {+function LockButton({ lock, locking, stage, tone, label, title, iconOnly = false, compact = false, className = '' }) {const Icon = locking ? LockOpen : Lock;return (<button type="button" onClick={() => lock.toggle(locking, stage)} disabled={lock.busy} aria-pressed={!locking}- title={title} aria-label={iconOnly ? label : undefined} className={`${baseCls} ${toneCls[tone]} ${className}`}>+ title={title} aria-label={iconOnly ? label : undefined} className={`${baseCls} ${toneCls[tone]} ${compact ? 'max-sm:min-w-[44px]' : ''} ${className}`}><Icon size={14} aria-hidden="true" />- {!iconOnly && label}+ {!iconOnly && (compact ? <span className="max-sm:sr-only">{label}</span> : label)}</button>);}@@ -51,26 +51,27 @@ function LockButton({ lock, locking, stage, tone, label, title, iconOnly = false* The tap that moves one shot through its locks. A still, card or code shot* locks once. A video shot locks its still (ready to render), then, once it* has a clip, its video; Unlock steps back one lock at a time. An edited lock- * keeps its warning color and says so in its title.+ * keeps its warning color and says so in its title. `compact` shows only the+ * icons on a phone, keeping each label as the accessible name.*/-export function ShotLockButton({ scene, className = '' }) {+export function ShotLockButton({ scene, compact = false, className = '' }) {const lock = useShotLock(scene?.sceneId);if (!lock) return null;const { still, clip } = lock;const video = clip != null;if (still !== 'locked') {const changed = still === 'changed' ? 'Changed since locked. ' : '';- return <LockButton lock={lock} locking stage="still" tone={still === 'changed' ? 'changed' : 'open'} className={className}+ return <LockButton compact={compact} lock={lock} locking stage="still" tone={still === 'changed' ? 'changed' : 'open'} className={className}label={video ? 'Lock still' : 'Lock'}title={`${changed}${video ? 'Approve this still so its clip can be rendered' : 'Lock this shot'}`} />;}- if (!video) return <LockButton lock={lock} locking={false} stage="still" tone="locked" label="Unlock" title="Locked. Tap to unlock." className={className} />;- if (clip === 'locked') return <LockButton lock={lock} locking={false} stage="video" tone="locked" label="Unlock video" title="Video locked: this shot can't change. Tap to unlock the video." className={className} />;- if (!scene.videoHistoryId) return <LockButton lock={lock} locking={false} stage="still" tone="locked" label="Unlock still" title="Still locked: make its clip, then lock the video. Tap to unlock the still." className={className} />;+ if (!video) return <LockButton compact={compact} lock={lock} locking={false} stage="still" tone="locked" label="Unlock" title="Locked. Tap to unlock." className={className} />;+ if (clip === 'locked') return <LockButton compact={compact} lock={lock} locking={false} stage="video" tone="locked" label="Unlock video" title="Video locked: this shot can't change. Tap to unlock the video." className={className} />;+ if (!scene.videoHistoryId) return <LockButton compact={compact} lock={lock} locking={false} stage="still" tone="locked" label="Unlock still" title="Still locked: make its clip, then lock the video. Tap to unlock the still." className={className} />;return (<span className={`inline-flex shrink-0 gap-1 ${className}`}>- <LockButton lock={lock} locking stage="video" tone={clip === 'changed' ? 'changed' : 'open'} label="Lock video" title={`${clip === 'changed' ? 'Changed since locked. ' : ''}Lock this clip so the shot can't change`} />- <LockButton lock={lock} locking={false} stage="still" tone="locked" iconOnly label="Unlock still" title="Still locked. Tap to unlock the still." />+ <LockButton compact={compact} lock={lock} locking stage="video" tone={clip === 'changed' ? 'changed' : 'open'} label="Lock video" title={`${clip === 'changed' ? 'Changed since locked. ' : ''}Lock this clip so the shot can't change`} />+ <LockButton compact={compact} lock={lock} locking={false} stage="still" tone="locked" iconOnly label="Unlock still" title="Still locked. Tap to unlock the still." /></span>);}diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.jsindex e64b4ff81e..7d18776f5f 100644--- a/client/src/hooks/useMusicVideoSceneMedia.js+++ b/client/src/hooks/useMusicVideoSceneMedia.js@@ -27,6 +27,9 @@ export const MAX_CONDITIONING_REFERENCES = MUSIC_VIDEO_MAX_CONDITIONING_REFERENC// Refusals the image route returns when the resolved backend can't consume// reference images — surfaced as explicit capability feedback, never retried// silently without the references.+// Refine: edit one frame by a short instruction, keeping the rest of the picture.+const refineFramePrompt = (instruction) => `Edit the reference image: ${instruction.trim()}. Keep everything else exactly as it is: composition, framing, subject, lighting, color and film look.`;+const REFERENCE_CAPABILITY_CODES = new Set(['REFERENCE_IMAGES_FLUX2_ONLY','IMAGE_EDIT_UNSUPPORTED_MODE',@@ -217,15 +220,19 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS* returns its `jobId`, and `onJob(jobId)` is told of it before the lane starts* tracking it (a batch registers the job there, so a terminal event that raced* ahead of the kickoff is still attributed to it).+ *+ * `refine` (with `referenceImageId`) edits that frame by a short instruction+ * instead: the frame is the only reference and the prompt is the instruction.*/- const generateFrame = (scene, { revisionId, onJob, referenceImageId = null } = {}) => {- const conditioning = conditioningReferences(project, scene);- const problem = shotActionContractProblem(scene.direction?.actionContract, scene);+ const generateFrame = (scene, { revisionId, onJob, referenceImageId = null, refine = null } = {}) => {+ const refining = Boolean(refine?.trim() && referenceImageId);+ const conditioning = refining ? [] : conditioningReferences(project, scene);+ const problem = refining ? null : shotActionContractProblem(scene.direction?.actionContract, scene);if (problem) { toast.error(problem); return Promise.resolve({ ok: false }); }- const framePrompt = buildFramePrompt(scene);+ const framePrompt = refining ? refineFramePrompt(refine) : buildFramePrompt(scene);if (!framePrompt) { toast.error('Add a frame prompt or shot prompt first'); return Promise.resolve({ ok: false }); }// A frame picked on the card (its start or end frame) leads the references, as the image this render reworks.- const prompt = referenceImageId ? `${framePrompt}\nStart from the first reference image and rework it to match this prompt.` : framePrompt;+ const prompt = referenceImageId && !refining ? `${framePrompt}\nStart from the first reference image and rework it to match this prompt.` : framePrompt;const references = [...(referenceImageId ? [referenceImageId] : []), ...conditioning.map((ref) => ref.imageId).filter((id) => id !== referenceImageId)];const projectId = project.id;frameLane.startScene(scene.sceneId);@@ -277,14 +284,16 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS* `slot: 'end'` tag); a fal clip on a model that takes an end frame then ends* on it. Resolves `{ ok }` like generateFrame.*/- const generateEndFrame = (scene, { referenceImageId = scene.referenceImageId } = {}) => {+ const generateEndFrame = (scene, { referenceImageId = scene.referenceImageId, refine = null } = {}) => {+ const refining = Boolean(refine?.trim() && referenceImageId);const endPrompt = scene.endFramePrompt?.trim();- if (!endPrompt) { toast.error('Describe the end frame first'); return Promise.resolve({ ok: false }); }+ if (!endPrompt && !refining) { toast.error('Describe the end frame first'); return Promise.resolve({ ok: false }); }const projectId = project.id;endFrameLane.startScene(scene.sceneId);return generateImage({// From a frame, keep its shot and change what the prompt asks; prompt only, render it like a start frame.- prompt: referenceImageId+ prompt: refining ? refineFramePrompt(refine)+ : referenceImageId? `${endPrompt}. Keep the reference image's composition, subject and framing; change only what this prompt describes.`: [endPrompt, style, direction].filter(Boolean).join(', '),...musicVideoFrameGenSize(project),diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex c91536bd48..365d03a405 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -2511,6 +2511,20 @@ describe('MusicVideo visual spec, takes and handoff (#8965)', () => {}), { silent: true }));});+ // Uniquely catches Refine sending the shot prompt or the mood references instead of editing just this frame by the instruction.+ it('refines the start frame by a short instruction, with that frame as the only reference', async () => {+ await openProject({ ...SPEC_PROJECT, scenes: [{ ...SPEC_PROJECT.scenes[0], referenceImageId: 'start.png' }] }, 'produce');+ fireEvent.click(screen.getByRole('button', { name: 'Refine' }));+ fireEvent.change(screen.getByLabelText('What to change in the start frame'), { target: { value: 'remove the hand' } });+ fireEvent.click(screen.getByRole('button', { name: 'Render refined start frame' }));+ await waitFor(() => expect(generateImage).toHaveBeenCalledWith(expect.objectContaining({+ prompt: expect.stringMatching(/^Edit the reference image: remove the hand\. Keep everything else/),+ referenceImageFiles: ['start.png'],+ musicVideo: { projectId: 'mv-spec', sceneId: 's1' },+ }), { silent: true }));+ expect(screen.queryByLabelText('What to change in the start frame')).toBeNull();+ });+// Uniquely catches a trimmed clip landing only in Video Gen history, never as this shot's take, or not becoming the shot's clip.it('trims the shot clip to a later start frame and makes it the shot\'s selected clip take', async () => {const scene = { sceneId: 's1', order: 0, prompt: 'waves', referenceImageId: 'img1', videoHistoryId: 'h1',