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
Choose a character style when creating or starting a music video (#10887)
[._.]/b6978b16755d
diff --git a/client/src/components/musicVideo/AutonomousRunPanel.test.jsx b/client/src/components/musicVideo/AutonomousRunPanel.test.jsxindex f3c211db96..44d0fff58f 100644--- a/client/src/components/musicVideo/AutonomousRunPanel.test.jsx+++ b/client/src/components/musicVideo/AutonomousRunPanel.test.jsx@@ -20,6 +20,7 @@ vi.mock('../../services/apiMusicVideo.js', () => ({resumeAutonomousMusicVideo: vi.fn(),stopAutonomousMusicVideo: vi.fn(),cancelAutonomousMusicVideo: vi.fn(),+ listMusicVideoCharacterStyles: vi.fn(async () => [{ id: 'example-style', label: 'Example style', characterName: 'Example Performer', referenceImageId: null }]),}));vi.mock('../../services/apiMoodBoard.js', () => ({ listMoodBoardNames: vi.fn(async () => [{ id: 'mb-1', name: 'Neon Rain' }]) }));vi.mock('../../services/apiMusic.js', () => ({@@ -317,11 +318,14 @@ describe('AutonomousStartDrawer', () => {fireEvent.change(screen.getByLabelText(/video generation budget/i), { target: { value: '12' } });await waitFor(() => expect(screen.getByRole('option', { name: 'Neon Rain' })).toBeTruthy());fireEvent.change(screen.getByLabelText('Mood board'), { target: { value: 'mb-1' } });+ await waitFor(() => expect(screen.getByRole('option', { name: 'Example style' })).toBeTruthy());+ fireEvent.change(screen.getByLabelText('Character style'), { target: { value: 'example-style' } });+ expect(screen.getByText(/Example Performer is cast as protagonist/)).toBeTruthy();fireEvent.change(screen.getByLabelText('Code authoring provider'), { target: { value: 'fixture-api' } });fireEvent.click(screen.getByRole('button', { name: /start autonomous video/i }));await waitFor(() => expect(api.startAutonomousMusicVideo).toHaveBeenCalled());expect(api.startAutonomousMusicVideo.mock.calls[0][0]).toMatchObject({- checkpoints: ['lyrics'], models: { 'image:local': 'example-image' }, budgetUsd: 12, moodBoardId: 'mb-1',+ checkpoints: ['lyrics'], models: { 'image:local': 'example-image' }, budgetUsd: 12, moodBoardId: 'mb-1', characterStyleId: 'example-style',});});diff --git a/client/src/components/musicVideo/AutonomousStartDrawer.jsx b/client/src/components/musicVideo/AutonomousStartDrawer.jsxindex b38507df15..da4c690aca 100644--- a/client/src/components/musicVideo/AutonomousStartDrawer.jsx+++ b/client/src/components/musicVideo/AutonomousStartDrawer.jsx@@ -7,6 +7,7 @@ import Drawer from '../Drawer.jsx';import ToggleChip from '../ui/ToggleChip.jsx';import ToolPicker from './ToolPicker.jsx';import MoodBoardPicker from './MoodBoardPicker.jsx';+import CharacterStyleSelect from './CharacterStyleSelect.jsx';import SongSourcePicker from './SongSourcePicker.jsx';import ProviderModelSelector from '../ProviderModelSelector.jsx';import MusicVideoLlmStagesPicker from './MusicVideoLlmStagesPicker.jsx';@@ -142,6 +143,7 @@ export default function AutonomousStartDrawer({ open, onClose, onStarted }) {<CodeAuthoringPicker value={draft.authoring} onChange={(authoring) => patch({ authoring })} onValidityChange={setAuthoringReady} disabled={submitting} /><ToolPicker tools={draft.tools} models={draft.models} onChange={patch} />+ <CharacterStyleSelect id="mv-auto-character-style" value={draft.characterStyleId} onChange={(characterStyleId) => patch({ characterStyleId })} /><MoodBoardPicker id="mv-auto-mood-board" value={draft.moodBoardId} onChange={(moodBoardId) => patch({ moodBoardId })} /><div>diff --git a/client/src/components/musicVideo/CharacterStyleSelect.jsx b/client/src/components/musicVideo/CharacterStyleSelect.jsxnew file mode 100644index 0000000000..20cfac2230--- /dev/null+++ b/client/src/components/musicVideo/CharacterStyleSelect.jsx@@ -0,0 +1,42 @@+import { useEffect, useState } from 'react';+import { listMusicVideoCharacterStyles } from '../../services/apiMusicVideo.js';++const inputClass = 'w-full min-w-0 bg-port-bg border border-port-border rounded px-2 py-1.5 text-sm';++/**+ * Character style choice for a project that does not exist yet (New music+ * video, Autonomous music video). The server casts the style's character as+ * protagonist and attaches this install's character sheet on create; the+ * sheet itself is chosen later on the Look step (CharacterStylePicker).+ */+export default function CharacterStyleSelect({ id, value, onChange }) {+ // null = not loaded yet; a failed fetch shows just "No character style".+ const [styles, setStyles] = useState(null);+ const style = (styles || []).find((s) => s.id === value) || null;++ useEffect(() => {+ let active = true;+ listMusicVideoCharacterStyles({ silent: true })+ .then((list) => { if (active) setStyles(list); })+ .catch(() => { if (active) setStyles([]); });+ return () => { active = false; };+ }, []);++ return (+ <div className="min-w-0">+ <label htmlFor={id} className="block text-xs text-port-text-muted mb-1">Character style</label>+ <select id={id} value={value || ''} onChange={(e) => onChange(e.target.value)} className={inputClass}>+ <option value="">{styles === null ? 'Loading…' : 'No character style'}</option>+ {(styles || []).map((s) => <option key={s.id} value={s.id}>{s.label}</option>)}+ </select>+ {style && (+ <p className="mt-1 text-xs text-port-text-muted">+ {style.characterName} is cast as protagonist.{' '}+ {style.referenceImageId+ ? 'Their character sheet is added as the character reference.'+ : 'No character sheet on this install yet; add one on the Look step.'}+ </p>+ )}+ </div>+ );+}diff --git a/client/src/components/musicVideo/CreateProjectDrawer.jsx b/client/src/components/musicVideo/CreateProjectDrawer.jsxindex 461b5832f5..d18548075c 100644--- a/client/src/components/musicVideo/CreateProjectDrawer.jsx+++ b/client/src/components/musicVideo/CreateProjectDrawer.jsx@@ -1,4 +1,5 @@import MediaModePicker from './MediaModePicker.jsx';+import CharacterStyleSelect from './CharacterStyleSelect.jsx';import { Bot, Clapperboard, Plus, Music, Sparkles, FileText, CheckCircle2 } from 'lucide-react';import Drawer from '../Drawer.jsx';import YoutubeImportControls from './YoutubeImportControls.jsx';@@ -18,7 +19,7 @@ const MODES = [* "New music video" drawer — track-first workflow:* 1. Select the music track (or import a Suno song or YouTube audio) — audio source for the video.* 2. Lyrics, concept, and style info are automatically read from the chosen track.- * 3. Name, mode, universe/moodboard, and brief settings.+ * 3. Name, mode, character style, universe/moodboard, and brief settings.*/export default function CreateProjectDrawer({ open, onClose, form, onFormChange, tracks, universes, trackName, youtube, onSubmit, submitting }) {const autopilot = form.mode === 'autonomous';@@ -157,8 +158,9 @@ export default function CreateProjectDrawer({ open, onClose, form, onFormChange,))}</div>- {/* 4. Universe & Mood Board */}+ {/* 4. Character style, Universe & Mood Board */}<div className="grid grid-cols-1 gap-3">+ <CharacterStyleSelect id="mv-character-style" value={form.characterStyleId} onChange={(characterStyleId) => onFormChange({ characterStyleId })} /><div className="min-w-0"><label htmlFor="mv-universe" className="block text-xs text-port-text-muted mb-1">Universe</label><selectdiff --git a/client/src/components/musicVideo/TrackSelectors.test.jsx b/client/src/components/musicVideo/TrackSelectors.test.jsxindex 03a6a4a277..52ccd3c153 100644--- a/client/src/components/musicVideo/TrackSelectors.test.jsx+++ b/client/src/components/musicVideo/TrackSelectors.test.jsx@@ -1,6 +1,6 @@import { useState } from 'react';import { beforeEach, describe, expect, it, vi } from 'vitest';-import { fireEvent, render, screen, within, waitFor } from '@testing-library/react';+import { act, fireEvent, render, screen, within, waitFor } from '@testing-library/react';import CreateProjectDrawer from './CreateProjectDrawer.jsx';import TrackPanel from './TrackPanel.jsx';import AudioTimingPanel from './AudioTimingPanel.jsx';@@ -11,6 +11,7 @@ vi.mock('../../services/apiMusicVideo.js', () => ({previewMusicVideoAudioTiming: vi.fn(),applyMusicVideoAudioTiming: vi.fn(),updateMusicVideoProject: vi.fn(),+ listMusicVideoCharacterStyles: vi.fn(() => Promise.resolve([])),}));vi.mock('../moodBoard/MoodBoardReferenceStrip.jsx', () => ({ default: () => null }));vi.mock('./VocalStemControl.jsx', () => ({ default: () => null }));@@ -35,7 +36,7 @@ beforeEach(() => vi.clearAllMocks());// Uniquely catches inaccessible duplicate choices, wrong-record selection,// and eligibility drift at the rendered selectors rather than helper internals.describe('Music Video track choices', () => {- it('distinguishes colliding records and shows metadata for the chosen ID without submitting or importing', () => {+ it('distinguishes colliding records and shows metadata for the chosen ID without submitting or importing', async () => {const onSubmit = vi.fn();function NewProject() {const [form, setForm] = useState({ mode: 'director', mediaMode: 'code-images-video', name: '', trackId: '', universeId: '' });@@ -59,6 +60,28 @@ describe('Music Video track choices', () => {expect(screen.queryByText('Suno')).not.toBeInTheDocument();expect(onSubmit).not.toHaveBeenCalled();expect(youtube.startCreate).not.toHaveBeenCalled();+ await act(async () => {});+ });++ // Uniquely catches the character style dropping out of the New music video drawer.+ it('offers built-in character styles on a new project and says who is cast', async () => {+ api.listMusicVideoCharacterStyles.mockResolvedValueOnce([+ { id: 'example-style', label: 'Example style', characterName: 'Example Performer', referenceImageId: null },+ ]);+ let latest = null;+ function NewProject() {+ const [form, setForm] = useState({ mode: 'director', mediaMode: 'code-images-video', name: '', trackId: '', universeId: '' });+ latest = form;+ return <CreateProjectDrawer open form={form} onFormChange={(patch) => setForm((current) => ({ ...current, ...patch }))}+ tracks={tracks} universes={[]} trackName={trackName} youtube={youtube} onSubmit={vi.fn()} onClose={vi.fn()} />;+ }+ render(<NewProject />);+ const select = screen.getByRole('combobox', { name: 'Character style' });+ await waitFor(() => expect(within(select).getByRole('option', { name: 'Example style' })).toBeInTheDocument());+ fireEvent.change(select, { target: { value: 'example-style' } });+ expect(latest.characterStyleId).toBe('example-style');+ expect(screen.getByText(/Example Performer is cast as protagonist/)).toBeInTheDocument();+ expect(screen.getByText(/No character sheet on this install yet/)).toBeInTheDocument();});it('uses the same stable labels after reordering and relinks the exact ID while preserving render locks', () => {diff --git a/client/src/components/musicVideo/stages/CastSetsStage.jsx b/client/src/components/musicVideo/stages/CastSetsStage.jsxindex b46fd2f191..41f98332f4 100644--- a/client/src/components/musicVideo/stages/CastSetsStage.jsx+++ b/client/src/components/musicVideo/stages/CastSetsStage.jsx@@ -9,7 +9,10 @@ import { formatCount } from '../../../utils/formatters.js';const directionSummary = (project) => {const refs = (project.visualSpec?.references || []).length + (project.styleReferences || []).length;+ const characterStyle = project.concept?.characterStyleId+ ? (project.concept.characterStyle?.split(':')[0] || project.concept.characterStyleId) : '';return [+ characterStyle ? `Character style: ${characterStyle}` : 'No character style',project.concept?.prompt?.trim() ? 'Concept written' : 'No concept yet',project.concept?.style?.trim() ? 'Style set' : 'No style yet',refs ? `${formatCount(refs)} look ${refs === 1 ? 'reference' : 'references'}` : 'No look references',diff --git a/client/src/lib/musicVideoAutonomous.js b/client/src/lib/musicVideoAutonomous.jsindex 8557681a8b..592c567067 100644--- a/client/src/lib/musicVideoAutonomous.js+++ b/client/src/lib/musicVideoAutonomous.js@@ -74,6 +74,7 @@ export const emptyAutonomousDraft = () => ({maxGenerations: String(AUTONOMOUS_DEFAULT_LIMITS.maxGenerations),checkpoints: [],moodBoardId: '',+ characterStyleId: '',// Suno's Advanced-form options; blank leaves that control as Suno has it.suno: { excludeStyles: '', vocalGender: '', model: '', maxMode: '' },// A provider/model/effort per LLM stage (`{ [stage]: llmDraft }`; absent = the direction LLM).@@ -144,6 +145,7 @@ export function autonomousRequestFromDraft(draft, { providerId, model, effort }...(draft.orchestrator.effort ? { effort: draft.orchestrator.effort } : {}),} } : {}),...(draft.moodBoardId ? { moodBoardId: draft.moodBoardId } : {}),+ ...(draft.characterStyleId ? { characterStyleId: draft.characterStyleId } : {}),...(llmStages ? { llmStages } : {}),...(draft.lyricsReview === true ? { lyricsReview: true } : {}),...(providerId ? { providerId, ...(model ? { model } : {}), ...(effort ? { effort } : {}) } : {}),diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 857aa78228..3454b57fb6 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -99,7 +99,7 @@ import { AUTONOMOUS_VIEWABLE_STAGES } from '../lib/musicVideoAutonomous.js';// Automation first: a new project defaults to autopilot with the free tools.const emptyCreateForm = () => ({- name: '', mode: 'autonomous', trackId: '', universeId: '', moodBoardId: '', automation: automationDraftFrom(null),+ name: '', mode: 'autonomous', trackId: '', characterStyleId: '', universeId: '', moodBoardId: '', automation: automationDraftFrom(null),});// Format project label for the header dropdown: omit trailing media type parentheticals@@ -507,7 +507,7 @@ export default function MusicVideo() {mediaMode: form.mediaMode || 'code-images-video',mode: form.mode,trackId: form.trackId || null,- concept: { universeId: form.universeId || null },+ concept: { universeId: form.universeId || null, ...(form.characterStyleId ? { characterStyleId: form.characterStyleId } : {}) },...(form.moodBoardId ? { visualSpec: { moodBoardId: form.moodBoardId } } : {}),...(form.mode === 'autonomous' ? { automation: automationFromDraft(form.automation) } : {}),}, { silent: true })diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 49eeb252c9..ee5faefd47 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -44,6 +44,8 @@ vi.mock('../hooks/useMusicVideoProductionReview.js', () => ({ default: ({ projec}) }));vi.mock('../services/apiMusicVideo.js', () => ({+ // Never settles: the create drawer's character-style list is covered in TrackSelectors.test.jsx.+ listMusicVideoCharacterStyles: vi.fn(() => new Promise(() => {})),getMusicVideoMakingOfCatalog: vi.fn(async id => ({ project: { id, name: 'Example making-of project', version: 1 }, snapshot: 'a'.repeat(64), assets: [] })),previewMusicVideoMakingOf: vi.fn(),exportMusicVideoMakingOf: vi.fn(),diff --git a/server/lib/musicVideoAutonomous.js b/server/lib/musicVideoAutonomous.jsindex b79deddcdf..a1227db83d 100644--- a/server/lib/musicVideoAutonomous.js+++ b/server/lib/musicVideoAutonomous.js@@ -29,6 +29,7 @@ import { MUSIC_VIDEO_MEDIA_MODES, musicVideoMediaMode } from './musicVideoMediaPimport { MUSIC_VIDEO_AUTOMATION_TOOL_IDS, normalizeMusicVideoEffort, normalizeMusicVideoLlm, normalizeMusicVideoLlmStages } from './musicVideoAutomation.js';import { isStr, trimTo } from './textUtils.js';+import { getMusicVideoCharacterStyle } from './musicVideoCharacterStyles.js';export const AUTONOMOUS_STAGES = Object.freeze([Object.freeze({ id: 'brief', label: 'Creative brief' }),@@ -225,6 +226,8 @@ function normalizeAutonomousSettings(raw = {}) {checkpoints,// An existing mood board to reuse instead of generating one (blank = generate).moodBoardId: clean(raw.moodBoardId, 64) || null,+ // A built-in character style cast as protagonist (null = none).+ characterStyleId: getMusicVideoCharacterStyle(raw.characterStyleId)?.id || null,llm: llm ? { providerId: llm.providerId, model: llm.model, ...(llm.effort ? { effort: llm.effort } : {}) } : null,authoring: authoringProvider && authoringModel? { providerId: authoringProvider, model: authoringModel, ...(authoringEffort ? { effort: authoringEffort } : {}) } : null,diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.jsindex 92c365c31d..b16f4015d2 100644--- a/server/lib/musicVideoValidation.js+++ b/server/lib/musicVideoValidation.js@@ -1006,6 +1006,8 @@ export const musicVideoAutonomousStartSchema = z.object({checkpoints: z.array(z.enum(AUTONOMOUS_CHECKPOINT_IDS)).max(AUTONOMOUS_CHECKPOINT_IDS.length).optional(),// Reuse this existing mood board instead of generating one from the prompt.moodBoardId: z.string().trim().min(1).max(64).nullable().optional(),+ // A built-in character style (musicVideoCharacterStyles.js) cast as protagonist from the start.+ characterStyleId: z.enum(MUSIC_VIDEO_CHARACTER_STYLE_IDS).nullable().optional(),// The LLM that writes the brief and lyrics (blank = an eligible TUI provider, else the// install's active provider — see services/musicVideo/llmRoute.js).providerId: z.string().trim().min(1).max(200).nullable().optional(),diff --git a/server/services/musicVideo/autonomousService.js b/server/services/musicVideo/autonomousService.jsindex 064f854820..49f40dfaee 100644--- a/server/services/musicVideo/autonomousService.js+++ b/server/services/musicVideo/autonomousService.js@@ -62,6 +62,7 @@ import { PATHS } from '../../lib/fileUtils.js';import { probeVideoDuration } from '../../lib/ffmpeg.js';import { ServerError } from '../../lib/errorHandler.js';import { trimTo } from '../../lib/textUtils.js';+import { getMusicVideoCharacterStyle } from '../../lib/musicVideoCharacterStyles.js';import { RENDER_TARGET } from '../../lib/renderTargets.js';import { IMAGE_GEN_MODE } from '../../lib/generationModes.js';import { assertFootageVideoModelsCapable, loadPoolEnv } from './productionPool.js';@@ -920,11 +921,20 @@ async function createRunStyle({ project, run }) {return { output: { moodBoardId } };}+// The brief is written knowing who stars in the video, so its concept and look+// fit the fixed character instead of inventing a different lead.+function briefGuidance(brief) {+ const style = getMusicVideoCharacterStyle(brief.characterStyleId);+ if (!style) return brief.guidance;+ const lead = `The video stars ${style.character.name} (${style.label} character style), a fixed-identity performer: ${style.summary}`;+ return [brief.guidance, lead].filter(Boolean).join('\n\n');+}+const STAGES = {async brief({ project, run }) {const { route, ...llm } = await llmOf(run, 'brief');const { brief } = await deps.draftCreativeBrief({- prompt: run.brief.prompt, guidance: run.brief.guidance, instrumental: run.brief.instrumental, ...llm,+ prompt: run.brief.prompt, guidance: briefGuidance(run.brief), instrumental: run.brief.instrumental, ...llm,});// A blank project name from the prompt gives way to the song title.if (!run.brief.name) await deps.updateProject(project.id, { name: trimTo(brief.title, 200) });@@ -1224,7 +1234,8 @@ export async function startAutonomousVideo(input, { autoApproveAuthorized = falsmode: 'autonomous',mediaMode: brief.mediaMode,...(brief.mediaMode !== 'code-images-video' ? { productionPolicy: { strategy: 'code-first', maxGeneratedVideoPercent: 0 } } : {}),- concept: { prompt: trimTo(brief.prompt, 8000) },+ // The style id makes createProject cast its character and attach the sheet (styleSnapshots.js).+ concept: { prompt: trimTo(brief.prompt, 8000), ...(brief.characterStyleId ? { characterStyleId: brief.characterStyleId } : {}) },automation: {tools: brief.tools,guidance: brief.guidance,diff --git a/server/services/musicVideo/autonomousService.test.js b/server/services/musicVideo/autonomousService.test.jsindex 6fae041c2c..5f61714048 100644--- a/server/services/musicVideo/autonomousService.test.js+++ b/server/services/musicVideo/autonomousService.test.js@@ -592,6 +592,15 @@ describe('startAutonomousVideo', () => {expect(doubles.updateProject).toHaveBeenCalledWith('mv-auto', expect.objectContaining({ visualSpec: { moodBoardId: 'board-existing' } }));});+ // Uniquely catches a character style chosen at start not reaching the project or the brief.+ it('casts a chosen character style on the new project and writes the brief around that lead', async () => {+ await service.startAutonomousVideo({ prompt: 'p', guidance: 'Keep it short', characterStyleId: 'claudia-slopcore' });+ await vi.waitFor(() => expect(calls).toContain('production'));+ expect(doubles.createProject).toHaveBeenCalledWith(expect.objectContaining({ concept: { prompt: 'p', characterStyleId: 'claudia-slopcore' } }));+ const { guidance } = doubles.draftCreativeBrief.mock.calls[0][0];+ expect(guidance).toMatch(/^Keep it short\n\nThe video stars Claudia \(Claudia slopcore character style\)/);+ });+it('rejects a blank prompt', async () => {await expect(service.startAutonomousVideo({ prompt: ' ' })).rejects.toMatchObject({ status: 400 });expect(calls).toEqual([]);