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
Music video: rename a version from its title or card, and stop a final render
Claude8d0eb135e048
diff --git a/client/src/components/musicVideo/CancelRenderButton.jsx b/client/src/components/musicVideo/CancelRenderButton.jsxnew file mode 100644index 0000000000..a18f70ee33--- /dev/null+++ b/client/src/components/musicVideo/CancelRenderButton.jsx@@ -0,0 +1,38 @@+import { useState } from 'react';+import { Square } from 'lucide-react';+import ConfirmButtonPair from '../ui/ConfirmButtonPair.jsx';++/**+ * Stop the in-flight final render. A stop discards the partial file, so the+ * first tap only asks; earlier renders stay attached either way.+ */+export default function CancelRenderButton({ onCancel, cancelling = false, className = '' }) {+ const [confirming, setConfirming] = useState(false);+ if (confirming || cancelling) {+ return (+ <ConfirmButtonPair+ prompt={cancelling ? null : 'Stop render?'}+ confirmText="Stop"+ cancelText="Keep"+ busy={cancelling}+ busyText="Stopping…"+ ariaLabel="Confirm stopping the render"+ confirmAriaLabel="Stop the render"+ cancelAriaLabel="Keep rendering"+ onConfirm={() => { onCancel(); setConfirming(false); }}+ onCancel={() => setConfirming(false)}+ largeTouchTargets+ className={className}+ />+ );+ }+ return (+ <button+ type="button"+ onClick={() => setConfirming(true)}+ className={`flex min-h-[44px] shrink-0 items-center gap-1 rounded-lg border border-port-error/40 px-3 text-sm text-port-error ${className}`.trim()}+ >+ <Square size={13} aria-hidden="true" /> Cancel render+ </button>+ );+}diff --git a/client/src/components/musicVideo/MusicVideoLayout.jsx b/client/src/components/musicVideo/MusicVideoLayout.jsxindex b893fb25e0..35dc3385a5 100644--- a/client/src/components/musicVideo/MusicVideoLayout.jsx+++ b/client/src/components/musicVideo/MusicVideoLayout.jsx@@ -1,7 +1,8 @@import { useEffect, useRef } from 'react';import {- ArrowRight, Bot, Check, Clapperboard, Film, History, LayoutGrid, Music, Play, Send, Settings, Users,+ ArrowRight, Bot, Check, Clapperboard, Film, History, LayoutGrid, Music, Pencil, Play, Send, Settings, Users,} from 'lucide-react';+import CancelRenderButton from './CancelRenderButton.jsx';import TabPills from '../ui/TabPills.jsx';import Pill from '../ui/Pill.jsx';import { formatUsd } from '../../utils/formatters.js';@@ -100,6 +101,9 @@ const DOCK_CLASSES = 'min-w-0 max-xl:order-first max-xl:col-span-full xl:sticky* `autopilotStatus(…)` (`{ label, short, tone }`) for the header's Autopilot* button (or null to hide it);* `onOpenSettings(tab)` opens Project settings. `dock` is the `PreviewDock`.+ * `onRename` opens the title editor, which the page hands back as `renameForm`+ * to show in place of the title. `cancelRender` (`{ onCancel, cancelling }`, or+ * null) puts a stop control beside a running final render's progress.* `lead` (the step checklist) opens the step; `review` is the step's approval.* With `playerFirst` the player and the approval sit together at the top of the* step; otherwise the player docks at the side and the approval closes the step.@@ -107,7 +111,7 @@ const DOCK_CLASSES = 'min-w-0 max-xl:order-first max-xl:col-span-full xl:stickyexport default function MusicVideoLayout({project, trackLabel, stage, onStageChange, progress, nextAction, onNextAction, spend, status = null,attention = null, dock = null, notes = null, autopilot = null, onOpenSettings = null,- playerFirst = false, lead = null, review = null, children,+ playerFirst = false, lead = null, review = null, onRename = null, renameForm = null, cancelRender = null, children,}) {const headerRef = useRef(null);const rootRef = useRef(null);@@ -164,7 +168,22 @@ export default function MusicVideoLayout({><div className="flex min-w-0 flex-wrap items-center gap-2"><div className="min-w-0 flex-1 basis-full sm:basis-auto">- <h2 className="truncate text-lg font-semibold max-sm:whitespace-normal max-sm:break-words" title={project.name}>{project.name}</h2>+ {renameForm || (+ <div className="flex min-w-0 items-center gap-1">+ <h2 className="truncate text-lg font-semibold max-sm:whitespace-normal max-sm:break-words" title={project.name}>{project.name}</h2>+ {onRename && (+ <button+ type="button"+ onClick={onRename}+ aria-label={`Rename v${project.version || 1}`}+ title="Rename this version"+ className="flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center rounded text-port-text-muted hover:text-port-text sm:min-h-[32px] sm:min-w-[32px]"+ >+ <Pencil size={14} aria-hidden="true" />+ </button>+ )}+ </div>+ )}<p className="flex min-w-0 items-center gap-1 text-xs text-port-text-muted"><span>v{project.version || 1}</span>{trackLabel && (@@ -195,6 +214,9 @@ export default function MusicVideoLayout({<span className="hidden sm:inline">{nextAction.label}</span></button>)}+ {cancelRender && nextAction?.id === 'render-progress' && (+ <CancelRenderButton onCancel={cancelRender.onCancel} cancelling={cancelRender.cancelling} />+ )}{autopilot && onOpenSettings && (<buttontype="button"diff --git a/client/src/components/musicVideo/MusicVideoProjectCard.jsx b/client/src/components/musicVideo/MusicVideoProjectCard.jsxindex 7930dc8aa3..6745840944 100644--- a/client/src/components/musicVideo/MusicVideoProjectCard.jsx+++ b/client/src/components/musicVideo/MusicVideoProjectCard.jsx@@ -1,5 +1,5 @@import { useState, useEffect } from 'react';-import { Film, Play, Music, Wand2, Sparkles, Copy, Trash2, ArrowUpRight, ChevronLeft, ChevronRight } from 'lucide-react';+import { Film, Play, Music, Wand2, Sparkles, Copy, Trash2, ArrowUpRight, ChevronLeft, ChevronRight, Pencil } from 'lucide-react';import MediaImage from '../MediaImage.jsx';import ScenePreview from '../creative-director/ScenePreview.jsx';import VideoArtifactThumbnail from './VideoArtifactThumbnail.jsx';@@ -39,6 +39,7 @@ export default function MusicVideoProjectCard({versionCount = 1,versionIndex = 0,onVersionStep,+ onRename,}) {const [playing, setPlaying] = useState(false);// The index loads bounded summaries (#10169) that carry these derived values; a@@ -97,6 +98,17 @@ export default function MusicVideoProjectCard({{project.name}</button><div className="flex items-center gap-1 shrink-0">+ {onRename && (+ <button+ type="button"+ onClick={onRename}+ aria-label={`Rename v${project.version || 1} of ${project.name}`}+ title="Rename this version"+ className="flex min-h-[44px] min-w-[44px] items-center justify-center rounded text-port-text-muted hover:text-port-text sm:min-h-[28px] sm:min-w-[28px]"+ >+ <Pencil size={13} aria-hidden="true" />+ </button>+ )}{versionCount > 1 ? (<span className="flex items-center gap-0.5 text-[10px] px-1 py-0.5 rounded bg-port-border text-port-text-muted font-mono" data-testid={`mv-version-switcher-${project.id}`}><buttondiff --git a/client/src/components/musicVideo/ProjectActionGroups.jsx b/client/src/components/musicVideo/ProjectActionGroups.jsxindex 3a84ea7756..8229f1f650 100644--- a/client/src/components/musicVideo/ProjectActionGroups.jsx+++ b/client/src/components/musicVideo/ProjectActionGroups.jsx@@ -1,5 +1,6 @@import { useState } from 'react';import LlmRouteNote from './LlmRouteNote.jsx';+import CancelRenderButton from './CancelRenderButton.jsx';import { Film, Music, Activity, Image as ImageIcon, Video, Wand2, X } from 'lucide-react';import { MUSCRIPTOR_MODELS } from '../../lib/muscriptorModels.js';import { isLayeredComposition, isSelfDrawnLayer, sceneRenderReady, sceneVisualLayer } from '../../lib/musicVideoLayers.js';@@ -290,11 +291,12 @@ export function RenderFinalButton({ project, renderJob, readiness }) {if (renderJob.active && renderJob.context === project.id) {return (- <button onClick={renderJob.cancel} disabled={renderJob.pending}- title={renderJob.pending ? 'Preparing render' : 'Cancel render'}- className="flex items-center gap-1 bg-port-warning/20 text-port-warning border border-port-border rounded px-2 py-1.5 text-sm min-h-[44px] sm:min-h-0">- <Activity size={15} className="animate-spin" /> {renderJob.pending ? 'Preparing render…' : `${renderJob.progress}% · Cancel`}- </button>+ <div className="flex flex-wrap items-center gap-2">+ <span role="status" className="flex min-h-[44px] items-center gap-1 rounded border border-port-border bg-port-warning/20 px-2 py-1.5 text-sm text-port-warning sm:min-h-0">+ <Activity size={15} className="animate-spin" aria-hidden="true" /> {renderJob.pending ? 'Preparing render…' : `Rendering ${Math.round(renderJob.progress)}%`}+ </span>+ {!renderJob.pending && <CancelRenderButton onCancel={renderJob.cancel} cancelling={renderJob.cancelling} />}+ </div>);}diff --git a/client/src/hooks/useMusicVideoRenderJob.js b/client/src/hooks/useMusicVideoRenderJob.jsindex 0c4e537aa9..7e61afef8d 100644--- a/client/src/hooks/useMusicVideoRenderJob.js+++ b/client/src/hooks/useMusicVideoRenderJob.js@@ -53,6 +53,9 @@ export default function useMusicVideoRenderJob({ project, onRendered, onFailed,});const [reattaching, setReattaching] = useState(false);+ // The job a stop was requested for: the button reads "Stopping" until the+ // job's terminal frame clears the slot, and re-arms if the server refuses.+ const [cancelRequestedFor, setCancelRequestedFor] = useState(null);const slotRef = useRef(slot);slotRef.current = slot;@@ -92,8 +95,26 @@ export default function useMusicVideoRenderJob({ project, onRendered, onFailed,return () => { active = false; };}, [projectId, rendering]);+ const cancel = () => {+ const jobId = slot.jobId;+ if (!jobId || cancelRequestedFor === jobId) return;+ setCancelRequestedFor(jobId);+ cancelMusicVideoRender(jobId, { silent: true })+ .then((res) => {+ if (res?.ok) return;+ setCancelRequestedFor(null);+ toast.error('This render can no longer be stopped — it may be finishing');+ })+ .catch((err) => {+ setCancelRequestedFor(null);+ toast.error(err?.message || 'Could not stop the render');+ });+ };+return {...slot,+ cancel,+ cancelling: !!slot.jobId && cancelRequestedFor === slot.jobId,failure,reattaching,reattach,diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex a4542dd309..857aa78228 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -251,6 +251,25 @@ export default function MusicVideo() {const [renamingId, setRenamingId] = useState(null);const renaming = !!selected && renamingId === selected.id;const [renameDraft, setRenameDraft] = useState('');+ const renameForm = renaming ? (+ <form+ onSubmit={(e) => { e.preventDefault(); commitRename(); }}+ className="flex min-w-0 flex-wrap items-center gap-2"+ >+ <label htmlFor="mv-rename-input" className="sr-only">Project title</label>+ <input+ id="mv-rename-input"+ autoFocus+ value={renameDraft}+ maxLength={120}+ onChange={(e) => setRenameDraft(e.target.value)}+ onKeyDown={(e) => { if (e.key === 'Escape') setRenamingId(null); }}+ className="min-w-0 flex-1 basis-48 sm:max-w-md bg-port-bg border border-port-border rounded px-2 py-1.5 text-base sm:text-sm"+ />+ <button type="submit" disabled={!renameDraft.trim()} className="rounded bg-port-accent px-3 py-1.5 text-sm text-white disabled:opacity-50 min-h-[44px] sm:min-h-0">Save</button>+ <button type="button" onClick={() => setRenamingId(null)} className="rounded border border-port-border px-3 py-1.5 text-sm min-h-[44px] sm:min-h-0">Cancel</button>+ </form>+ ) : null;// A full record replaces its summary in the index list; the project card// derives from whichever it holds, so no summary-only field can go stale.const replaceProject = (next) => {@@ -1287,11 +1306,11 @@ export default function MusicVideo() {<buttontype="button"onClick={handleRename}- title="Rename project"+ title="Rename this version"aria-label="Rename project"- className="flex min-h-[44px] min-w-[44px] items-center justify-center rounded border border-port-border bg-port-bg px-2 py-1.5 text-sm sm:min-h-0 sm:min-w-0"+ className="flex min-h-[44px] items-center justify-center gap-1 rounded border border-port-border bg-port-bg px-2 py-1.5 text-sm sm:min-h-0">- <Pencil size={15} />+ <Pencil size={15} aria-hidden="true" /> Rename</button><buttontype="button"@@ -1356,25 +1375,6 @@ export default function MusicVideo() {</>)}/>- {renaming && (- <form- onSubmit={(e) => { e.preventDefault(); commitRename(); }}- className="flex flex-wrap items-center gap-2 px-4 py-2 border-b border-port-border"- >- <label htmlFor="mv-rename-input" className="text-sm text-gray-400">Project title</label>- <input- id="mv-rename-input"- autoFocus- value={renameDraft}- maxLength={120}- onChange={(e) => setRenameDraft(e.target.value)}- onKeyDown={(e) => { if (e.key === 'Escape') setRenamingId(null); }}- className="min-w-0 flex-1 sm:max-w-md bg-port-bg border border-port-border rounded px-2 py-1.5 text-sm"- />- <button type="submit" disabled={!renameDraft.trim()} className="rounded bg-port-accent px-3 py-1.5 text-sm text-white disabled:opacity-50 min-h-[44px] sm:min-h-0">Save</button>- <button type="button" onClick={() => setRenamingId(null)} className="rounded border border-port-border px-3 py-1.5 text-sm min-h-[44px] sm:min-h-0">Cancel</button>- </form>- )}<CreateProjectDraweropen={createOpen}@@ -1473,6 +1473,11 @@ export default function MusicVideo() {cloning={cloningId === project.id}versionCount={versions.length}versionIndex={versionIndex}+ onRename={() => {+ setRenameDraft(project.name || '');+ setRenamingId(project.id);+ selectProject(project.id);+ }}onVersionStep={(delta) => {const target = versions[versionIndex + delta];if (target) setPickedVersion((prev) => ({ ...prev, [rootId]: target.id }));@@ -1510,6 +1515,9 @@ export default function MusicVideo() {autopilot={autopilotStatus(selected)}onOpenSettings={setSettingsTab}playerFirst={playerFirst}+ onRename={handleRename}+ renameForm={renameForm}+ cancelRender={renderTargetsSelected && !renderJob.pending ? { onCancel: renderJob.cancel, cancelling: renderJob.cancelling } : null}lead={(<StageChecklistitems={stageChecklist(activeStage, selected, productionReview.readiness, publish)}diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 3cbb1d5d9d..49eeb252c9 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -603,6 +603,19 @@ describe('MusicVideo project header', () => {});});+describe('MusicVideo version title', () => {+ it('renames the open version from the pencil beside its title', async () => {+ await openProject(PROJECT_WITH_CLIP);+ fireEvent.click(screen.getByRole('button', { name: 'Rename v1' }));+ // The editor takes the title's place, so the old heading is gone while editing.+ expect(screen.queryByRole('heading', { level: 2, name: PROJECT_WITH_CLIP.name })).toBeNull();+ updateMusicVideoProject.mockImplementationOnce(async (_id, patch) => ({ ...PROJECT_WITH_CLIP, ...patch }));+ fireEvent.change(screen.getByLabelText('Project title'), { target: { value: 'Title Renamed' } });+ fireEvent.click(screen.getByRole('button', { name: 'Save' }));+ await screen.findByRole('heading', { level: 2, name: 'Title Renamed' });+ });+});+describe('MusicVideo render control (#1760)', () => {it('enables Render and kicks off the job when a scene has a clip', async () => {await openProject(PROJECT_WITH_CLIP, 'review');@@ -633,7 +646,7 @@ describe('MusicVideo render control (#1760)', () => {sseState.latest = null;currentProject = freshProject;fireEvent.click(screen.getByRole('button', { name: /^Render final$/ }));- await screen.findByTitle('Cancel render');+ await screen.findAllByRole('button', { name: 'Cancel render' });sseState.latest = { type: 'complete', result: { id: 'rh-new' } };forceRerender();@@ -652,7 +665,9 @@ describe('MusicVideo render control (#1760)', () => {await openStage('review');fireEvent.click(screen.getByRole('button', { name: /^Render final$/ }));- expect(screen.getByRole('button', { name: 'Preparing render…' })).toBeDisabled();+ expect(screen.getByText('Preparing render…')).toBeInTheDocument();+ // No job id yet, so there is nothing to stop.+ expect(screen.queryByRole('button', { name: 'Cancel render' })).not.toBeInTheDocument();await openStage('setup');expect(screen.getByLabelText('Change track')).toBeDisabled();fireEvent.change(screen.getByLabelText('Change track'), { target: { value: 'other-track' } });@@ -664,7 +679,7 @@ describe('MusicVideo render control (#1760)', () => {expect(otherRender).toBeDisabled();fireEvent.click(otherRender);expect(renderMusicVideoProject).toHaveBeenCalledTimes(1);- expect(screen.queryByTitle('Cancel render')).not.toBeInTheDocument();+ expect(screen.queryByRole('button', { name: 'Cancel render' })).not.toBeInTheDocument();await openStage('setup');expect(screen.getByLabelText('Change track')).not.toBeDisabled();@@ -672,7 +687,7 @@ describe('MusicVideo render control (#1760)', () => {sseState.latest = { type: 'progress', progress: 0.375 };await selectProject(PROJECT_WITH_CLIP.id);await openStage('review');- expect(screen.getByTitle('Cancel render')).toHaveTextContent('38%');+ expect(screen.getByText('Rendering 38%')).toBeInTheDocument();// The header offers no second render while this one is in flight — it shows the progress.expect(screen.getByRole('button', { name: 'Rendering… 38%' })).toBeDisabled();await openStage('setup');@@ -682,7 +697,7 @@ describe('MusicVideo render control (#1760)', () => {sseState.latest = { type: 'status', message: 'Finishing output' };await clickNewProject();await openStage('review');- expect(screen.getByTitle('Cancel render')).toHaveTextContent('38%');+ expect(screen.getByText('Rendering 38%')).toBeInTheDocument();await selectProject(other.id);sseState.latest = { type: 'complete', result: { id: 'rh-9' } };fireEvent.change(screen.getByPlaceholderText('Project name'), { target: { value: 'Unrelated draft' } });@@ -707,8 +722,12 @@ describe('MusicVideo render control (#1760)', () => {await openStage('review');fireEvent.click(screen.getByRole('button', { name: /^Render final$/ }));- fireEvent.click(await screen.findByTitle('Cancel render'));+ // Stopping discards the partial render, so the first tap only asks.+ fireEvent.click((await screen.findAllByRole('button', { name: 'Cancel render' }))[0]);+ expect(cancelMusicVideoRender).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole('button', { name: 'Stop the render' }));expect(cancelMusicVideoRender).toHaveBeenCalledWith('existing-render', { silent: true });+ await waitFor(() => expect(screen.getAllByText('Stopping…').length).toBeGreaterThan(0));expect(toast.error).toHaveBeenCalledTimes(1);sseState.latest = { type: 'canceled' };forceRerender();@@ -725,7 +744,7 @@ describe('MusicVideo render control (#1760)', () => {await selectProject(PROJECT_WITH_CLIP.id);await openStage('review');fireEvent.click(screen.getByRole('button', { name: /^Render final$/ }));- await screen.findByTitle('Cancel render');+ await screen.findAllByRole('button', { name: 'Cancel render' });await selectProject(other.id);await openStage('review');sseState.latest = { type: 'error', error: 'Renderer stopped' };@@ -747,7 +766,7 @@ describe('MusicVideo render control (#1760)', () => {sseState.latest = null;fireEvent.click(screen.getByRole('button', { name: /^Render final$/ }));- await screen.findByTitle('Cancel render');+ await screen.findAllByRole('button', { name: 'Cancel render' });sseState.latest = { type: 'progress', progress: 0.4 };fireEvent.change(screen.getByPlaceholderText('Project name'), { target: { value: 'Draft' } });sseState.closed = true;@@ -761,8 +780,8 @@ describe('MusicVideo render control (#1760)', () => {getMusicVideoActiveRender.mockResolvedValue({ jobId: 'render-live' });sseState.latest = { type: 'progress', progress: 0.5 };await openProject({ ...PROJECT_WITH_CLIP, status: 'rendering' }, 'review');- await screen.findByTitle('Cancel render');- await waitFor(() => expect(screen.getByTitle('Cancel render')).toHaveTextContent('50%'));+ await screen.findAllByRole('button', { name: 'Cancel render' });+ await waitFor(() => expect(screen.getByText('Rendering 50%')).toBeInTheDocument());expect(getMusicVideoActiveRender).toHaveBeenCalledWith('mv-1', { silent: true });// A page load only READS the render — it never starts one.expect(renderMusicVideoProject).not.toHaveBeenCalled();@@ -776,8 +795,8 @@ describe('MusicVideo render control (#1760)', () => {await openProject({ ...PROJECT_WITH_CLIP, status: 'rendering' }, 'review');const reattach = await screen.findByRole('button', { name: 'Reattach to the final render' });fireEvent.click(reattach);- await screen.findByTitle('Cancel render');- await waitFor(() => expect(screen.getByTitle('Cancel render')).toHaveTextContent('25%'));+ await screen.findAllByRole('button', { name: 'Cancel render' });+ await waitFor(() => expect(screen.getByText('Rendering 25%')).toBeInTheDocument());expect(renderMusicVideoProject).not.toHaveBeenCalled();await waitFor(() => expect(screen.queryByRole('button', { name: 'Reattach to the final render' })).not.toBeInTheDocument());});@@ -2968,6 +2987,22 @@ describe('MusicVideo main page project cards', () => {expect(await screen.findByRole('heading', { level: 2, name: PROJECT_WITH_CLIP.name })).toBeInTheDocument();});+ it('renames a version straight from its project card', async () => {+ listMusicVideoProjects.mockResolvedValue([PROJECT_WITH_CLIP]);+ renderMV();+ const card = await screen.findByTestId(`mv-project-card-${PROJECT_WITH_CLIP.id}`);+ await act(async () => {+ fireEvent.click(within(card).getByRole('button', { name: `Rename v1 of ${PROJECT_WITH_CLIP.name}` }));+ });+ const input = await screen.findByLabelText('Project title');+ expect(input).toHaveValue(PROJECT_WITH_CLIP.name);+ updateMusicVideoProject.mockImplementationOnce(async (_id, patch) => ({ ...PROJECT_WITH_CLIP, ...patch }));+ fireEvent.change(input, { target: { value: 'Card Renamed' } });+ fireEvent.click(screen.getByRole('button', { name: 'Save' }));+ await waitFor(() => expect(updateMusicVideoProject).toHaveBeenCalledWith(PROJECT_WITH_CLIP.id, { name: 'Card Renamed' }));+ await screen.findByRole('heading', { level: 2, name: 'Card Renamed' });+ });+it('opens an existing final directly in Final render from the project card', async () => {const project = { ...PROJECT_WITH_CLIP, renderHistoryId: 'example-final' };listMusicVideoProjects.mockResolvedValue([project]);