Skip to content

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

fix: split the music-video treatment so the brief lives in Setup and shot direction on the Board (#10159)

Adam Eivy6c251a78d83c
diff --git a/client/src/components/musicVideo/TreatmentPanel.jsx b/client/src/components/musicVideo/TreatmentPanel.jsx
index d9da1d85db..5a66526bca 100644
--- a/client/src/components/musicVideo/TreatmentPanel.jsx
+++ b/client/src/components/musicVideo/TreatmentPanel.jsx
@@ -1,5 +1,5 @@
import { useState } from 'react';
-import { ScrollText, Sparkles, Wand2, AlertTriangle, Plus, Trash2 } from 'lucide-react';
+import { Sparkles, Wand2, AlertTriangle, Plus, Trash2 } from 'lucide-react';
import useFieldDraft from '../../hooks/useFieldDraft.js';
import useProviderModels from '../../hooks/useProviderModels.js';
import ProviderModelSelector from '../ProviderModelSelector.jsx';
@@ -43,14 +43,36 @@ function BeatObjective({ beat, idFor, onSave }) {
);
}
+/** One-line state for the section header: revision, applied state and capability gaps. */
+export function treatmentSummary(project) {
+ const t = project.treatment;
+ if (!t) return 'Not started';
+ const parts = [`rev ${t.revision}`];
+ if (t.arc) {
+ parts.push(`${t.shotDirections.length} directed ${t.shotDirections.length === 1 ? 'shot' : 'shots'}`);
+ parts.push(t.appliedRevision != null && t.appliedRevision === t.revision ? 'applied' : 'not applied');
+ }
+ const gaps = t.capabilityGaps?.length || 0;
+ if (gaps) parts.push(`${gaps} capability ${gaps === 1 ? 'gap' : 'gaps'}`);
+ return parts.join(' · ');
+}
+
/**
* The pre-production treatment (#8980): a structured brief, the compiled
* whole-song arc (beats by section, motifs, balance), per-shot direction, the
* proof checklist and the Apply review. Compiling is always an explicit click —
* "Draft without AI" makes no provider call at all. Keyed by project id at the
* call site so a field draft never carries across projects.
+ *
+ * `part` splits it by what each piece depends on: the brief (what the planner
+ * reads) belongs in Setup, while compile / arc / shot direction / Apply need
+ * scenes and live on the Board. Omit it to render both. The caller supplies
+ * the collapsible section, so there is no fold of its own here.
*/
-export default function TreatmentPanel({ project, treatment: api }) {
+export default function TreatmentPanel({ project, treatment: api, part = 'all' }) {
+ const showBrief = part !== 'direction';
+ const showDirection = part !== 'brief';
+ const hasScenes = (project.scenes || []).length > 0;
const t = project.treatment || null;
const brief = t?.brief || {};
const arc = t?.arc || null;
@@ -73,7 +95,6 @@ export default function TreatmentPanel({ project, treatment: api }) {
providers, selectedProviderId, selectedModel, availableModels, setSelectedProviderId, setSelectedModel,
} = useProviderModels({ allowDefault: true, silent: true });
const analyzed = !!project.audioAnalysis;
- const applied = t?.appliedRevision != null && t.appliedRevision === t.revision;
const addNote = () => {
if (notesSaving || (!noteText.trim() && !noteUrl.trim()) || !urlValid) return;
@@ -86,17 +107,9 @@ export default function TreatmentPanel({ project, treatment: api }) {
};
return (
- <details className="mt-2 rounded border border-port-border bg-port-bg/40 p-2">
- <summary className="cursor-pointer text-xs text-port-text-muted select-none min-h-[44px] sm:min-h-[32px] flex flex-wrap items-center gap-2">
- <ScrollText size={13} />
- <span>Treatment</span>
- {t ? <span>· rev {t.revision}</span> : <span>· not started</span>}
- {arc && <span>· {t.shotDirections.length} directed shots</span>}
- {arc && <span className={applied ? 'text-port-success' : 'text-port-warning'}>· {applied ? 'applied' : 'not applied'}</span>}
- {t?.capabilityGaps?.length > 0 && <span className="text-port-warning">· {t.capabilityGaps.length} capability gap{t.capabilityGaps.length === 1 ? '' : 's'}</span>}
- </summary>
-
- <div className="mt-2 space-y-3">
+ <div className="space-y-3">
+ {showBrief && (
+ <>
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
<BriefField id={idFor('audience')} label="Audience" value={brief.audience} maxLength={500}
placeholder="Who this is for — e.g. late-night city pop fans" onCommit={(v) => saveBrief({ audience: v })} />
@@ -161,8 +174,21 @@ export default function TreatmentPanel({ project, treatment: api }) {
</button>
</div>
</div>
+ {part === 'brief' && (
+ <p className="text-xs text-port-text-muted">
+ The planner reads this brief when it plans shots. Compile the arc, direct each shot and apply it on the Board.
+ </p>
+ )}
+ </>
+ )}
+
+ {showDirection && !hasScenes && (
+ <p className="text-sm text-port-text-muted">Plan shots on the Board to direct them — the treatment's shot direction needs scenes to direct.</p>
+ )}
- <div className="flex flex-wrap items-center gap-2 border-t border-port-border pt-2">
+ {showDirection && hasScenes && (
+ <>
+ <div className="flex flex-wrap items-center gap-2">
{providers.length > 0 && (
<ProviderModelSelector
providers={providers}
@@ -246,7 +272,8 @@ export default function TreatmentPanel({ project, treatment: api }) {
<TreatmentApplyReview project={project} api={api} />
</div>
)}
- </div>
- </details>
+ </>
+ )}
+ </div>
);
}
diff --git a/client/src/components/musicVideo/TreatmentPanel.test.jsx b/client/src/components/musicVideo/TreatmentPanel.test.jsx
index 83e9c22b48..7167beccc3 100644
--- a/client/src/components/musicVideo/TreatmentPanel.test.jsx
+++ b/client/src/components/musicVideo/TreatmentPanel.test.jsx
@@ -27,7 +27,7 @@ vi.mock('../ui/Toast', () => ({ default: { success: vi.fn(), error: vi.fn() } })
import * as api from '../../services/apiMusicVideo.js';
import useMusicVideoTreatment from '../../hooks/useMusicVideoTreatment.js';
-import TreatmentPanel from './TreatmentPanel.jsx';
+import TreatmentPanel, { treatmentSummary } from './TreatmentPanel.jsx';
const TREATMENT = {
version: 1,
@@ -240,3 +240,29 @@ it('shows union totals and explicit exceptions before Apply, and pins a director
await waitFor(() => expect(screen.getAllByLabelText('Keep medium on recompile')[0].checked).toBe(true));
expect(screen.getByText(/generated video 10 \/ 20 seconds/)).toBeTruthy();
});
+
+describe('TreatmentPanel split by dependency', () => {
+ const noop = { save: vi.fn(), compile: vi.fn(), compiling: false };
+ it('Setup (brief) shows the brief without a fold or compile controls, and points to the Board', () => {
+ const { container } = render(<TreatmentPanel project={PROJECT} treatment={noop} part="brief" />);
+ expect(container.querySelector('details')).toBeNull();
+ expect(screen.getByLabelText('Audience')).toBeTruthy();
+ expect(screen.queryByText('Draft without AI')).toBeNull();
+ expect(screen.getByText(/on the Board/)).toBeTruthy();
+ });
+ it('the Board half explains what is needed instead of compiling 0 shots', () => {
+ render(<TreatmentPanel project={{ ...PROJECT, scenes: [] }} treatment={noop} part="direction" />);
+ expect(screen.getByText(/Plan shots on the Board to direct them/)).toBeTruthy();
+ expect(screen.queryByText('Draft without AI')).toBeNull();
+ expect(screen.queryByLabelText('Audience')).toBeNull();
+ });
+ it('the Board half offers compile once scenes exist', () => {
+ render(<TreatmentPanel project={PROJECT} treatment={noop} part="direction" />);
+ expect(screen.getByText('Draft without AI')).toBeTruthy();
+ expect(screen.queryByLabelText('Audience')).toBeNull();
+ });
+ it('summarizes revision, applied state and gaps for the section header', () => {
+ expect(treatmentSummary({})).toBe('Not started');
+ expect(treatmentSummary(PROJECT)).toBe('rev 3 · 0 directed shots · not applied · 1 capability gap');
+ });
+});
diff --git a/client/src/components/musicVideo/stages/BoardStage.jsx b/client/src/components/musicVideo/stages/BoardStage.jsx
index f92056a35a..786899d5cd 100644
--- a/client/src/components/musicVideo/stages/BoardStage.jsx
+++ b/client/src/components/musicVideo/stages/BoardStage.jsx
@@ -1,6 +1,8 @@
import { Plus } from 'lucide-react';
import BeatTimeline from '../BeatTimeline.jsx';
import SceneCard from '../SceneCard.jsx';
+import TreatmentPanel, { treatmentSummary } from '../TreatmentPanel.jsx';
+import StageSection from '../StageSection.jsx';
import { PlanActions } from '../ProjectActionGroups.jsx';
import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';
@@ -11,7 +13,7 @@ import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';
* are collapsed to a thumbnail, lyric and status until tapped.
*/
export default function BoardStage({ board }) {
- const { project, locked, busy, sceneMedia, videoSettings, takes, activeSceneId, onToggleSceneExpand } = board;
+ const { project, locked, busy, sceneMedia, videoSettings, takes, treatment, activeSceneId, onToggleSceneExpand } = board;
const scenes = project.scenes || [];
const performanceReviews = new Map();
const attempts = (project.autoReviews || []).flatMap((run) => run.attempts || []).slice().reverse();
@@ -32,6 +34,10 @@ export default function BoardStage({ board }) {
<PlanActions project={project} busy={busy} onPlan={board.onPlan} onAutoArrange={board.onAutoArrange} />
</div>
+ <StageSection id="mv-board-treatment" title="Treatment" summary={scenes.length ? treatmentSummary(project) : 'Plan shots to direct them'}>
+ <TreatmentPanel key={`treatment-${project.id}`} project={project} treatment={treatment} part="direction" />
+ </StageSection>
+
{project.audioAnalysis && scenes.length > 0 && (
<BeatTimeline audioAnalysis={project.audioAnalysis} scenes={scenes} lyricCues={project.lyricCues} narrativeEvents={project.composition?.narrativeEvents}
onSeek={(startSec) => board.seekToScene({ startSec })} onCommit={board.commitSceneTiming} />
diff --git a/client/src/components/musicVideo/stages/SetupStage.jsx b/client/src/components/musicVideo/stages/SetupStage.jsx
index 47d4e0b5e9..590727b8c7 100644
--- a/client/src/components/musicVideo/stages/SetupStage.jsx
+++ b/client/src/components/musicVideo/stages/SetupStage.jsx
@@ -9,7 +9,7 @@ import AudioTimingPanel from '../AudioTimingPanel.jsx';
import AnalysisPanel from '../AnalysisPanel.jsx';
import LyricsPanel from '../LyricsPanel.jsx';
import VisualSpecPanel from '../VisualSpecPanel.jsx';
-import TreatmentPanel from '../TreatmentPanel.jsx';
+import TreatmentPanel, { treatmentSummary } from '../TreatmentPanel.jsx';
import { AnalyzeAction, MidiAction } from '../ProjectActionGroups.jsx';
import StageSection from '../StageSection.jsx';
import ProjectOptionsPanel, { projectOptionsSummary } from '../ProjectOptionsPanel.jsx';
@@ -77,7 +77,7 @@ const directionSummary = (project) => {
* (workflow, media, render style, image/video services, autopilot tools), Song
* & lyrics (the track, its analysis/MIDI and lyrics), Creative direction
* (universe, cast, places, mood board, concept & style, visual spec) and the
- * Treatment. A section opens by default when it holds the next thing to do;
+ * Treatment brief. A section opens by default when it holds the next thing to do;
* an anchor inside a folded section unfolds it (see the page's hash effect).
*/
export default function SetupStage({ board }) {
@@ -221,9 +221,9 @@ export default function SetupStage({ board }) {
/>
</fieldset>
</StageSection>
- <StageSection id="mv-setup-treatment" title="Treatment" summary="The shot-by-shot treatment the plan builds on">
+ <StageSection id="mv-setup-treatment" title="Treatment brief" summary={`${treatmentSummary(project)} · feeds the shot planner`}>
<fieldset disabled={locked} className="min-w-0">
- <TreatmentPanel key={`treatment-${project.id}`} project={project} treatment={treatment} />
+ <TreatmentPanel key={`treatment-${project.id}`} project={project} treatment={treatment} part="brief" />
</fieldset>
</StageSection>
</>
diff --git a/client/src/components/musicVideo/stages/SetupStage.test.jsx b/client/src/components/musicVideo/stages/SetupStage.test.jsx
index 8e509013fa..930f2de9c3 100644
--- a/client/src/components/musicVideo/stages/SetupStage.test.jsx
+++ b/client/src/components/musicVideo/stages/SetupStage.test.jsx
@@ -8,7 +8,7 @@ vi.mock('../ProjectOptionsPanel.jsx', () => ({ default: () => null, projectOptio
vi.mock('../CreativeSetupPanel.jsx', () => ({ default: () => null }));
vi.mock('../StyleReferencesPanel.jsx', () => ({ default: () => null }));
vi.mock('../VisualSpecPanel.jsx', () => ({ default: () => null }));
-vi.mock('../TreatmentPanel.jsx', () => ({ default: () => null }));
+vi.mock('../TreatmentPanel.jsx', () => ({ default: () => null, treatmentSummary: () => 'Not started' }));
vi.mock('../VocalStemControl.jsx', () => ({ default: () => <div>vocal-stem</div> }));
vi.mock('../SoundBedControl.jsx', () => ({ default: () => <div>sound-bed</div> }));
vi.mock('../SongRevisionPanel.jsx', () => ({ default: () => <div>song-revision</div> }));