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: design from the song's Suno style, keep it out of image prompts
Claude3fb72b174c86
diff --git a/client/src/components/musicVideo/stages/CastSetsStage.jsx b/client/src/components/musicVideo/stages/CastSetsStage.jsxindex 41f98332f4..620053b757 100644--- a/client/src/components/musicVideo/stages/CastSetsStage.jsx+++ b/client/src/components/musicVideo/stages/CastSetsStage.jsx@@ -15,13 +15,14 @@ const directionSummary = (project) => {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',+ ...(project.concept?.songStyle?.trim() ? ['Song style set'] : []),refs ? `${formatCount(refs)} look ${refs === 1 ? 'reference' : 'references'}` : 'No look references',].join(' · ');};/** Concept, style, universe and look references: what the cast and sets are built from. */function CreativeDirection({ board }) {- const { project, locked, conceptDraft, styleDraft } = board;+ const { project, locked, conceptDraft, styleDraft, songStyleDraft } = board;return (<><CreativeSetupPanel@@ -61,6 +62,22 @@ function CreativeDirection({ board }) {className="min-h-[44px] w-full rounded border border-port-border bg-port-bg px-2 py-1.5 text-sm"/></div>+ {songStyleDraft && (+ <div className="sm:col-span-2">+ <label htmlFor="mv-song-style" className="mb-1 block text-xs text-port-text-muted">Song style</label>+ <AutoSizeTextarea+ id="mv-song-style"+ value={songStyleDraft.value}+ rows={2}+ maxLength={2000}+ onChange={songStyleDraft.onChange}+ onBlur={songStyleDraft.onBlur}+ placeholder="The song's Suno style. Excluded styles start with a minus."+ className="min-h-[44px] w-full rounded border border-port-border bg-port-bg px-2 py-1.5 text-sm"+ />+ <p className="mt-1 text-xs text-port-text-muted">With the lyrics, it shapes the world, cast and scenes. It is never added to frame prompts.</p>+ </div>+ )}</div><VisualSpecPanel key={project.id} project={project} onSave={board.saveVisualSpec} /></fieldset>diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 3454b57fb6..281e852c23 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -712,9 +712,7 @@ export default function MusicVideo() {if (selectedTrack?.concept && !selected.concept?.prompt) {patch.concept = { ...(selected.concept || {}), prompt: selectedTrack.concept };}- if (selectedTrack?.prompt && !selected.concept?.style) {- patch.concept = { ...(patch.concept || selected.concept || {}), style: selectedTrack.prompt };- }+ // The track's Suno style becomes the project's song style on the server.// Fork first so the original keeps its analysis/alignment; the new track is// applied to the fork only.const base = fork@@ -841,13 +839,14 @@ export default function MusicVideo() {// and a focus-without-edit blur doesn't re-PATCH an unchanged value.const conceptDraft = useFieldDraft(selected?.concept?.prompt, (v) => commitConcept({ prompt: v }));const styleDraft = useFieldDraft(selected?.concept?.style, (v) => commitConcept({ style: v }));+ const songStyleDraft = useFieldDraft(selected?.concept?.songStyle, (v) => commitConcept({ songStyle: v }));// The route (not a remount) drives which project is "selected" here, so a// still-focused, unblurred draft survives a project switch (deep link,// browser Back, future ⌘K/voice jump) with the OLD project's typed text.// Without this, the next incidental blur would commit that leftover draft// onto the NEW project via commitConcept's captured `selected`. Discard// (never auto-commit) any pending edit the instant the selection changes.- useEffect(() => { conceptDraft.reset(); styleDraft.reset(); }, [selectedId]);+ useEffect(() => { conceptDraft.reset(); styleDraft.reset(); songStyleDraft.reset(); }, [selectedId]);// BeatTimeline drag commit — same optimistic-local + silent-PATCH pattern as// the other scene field editors (#1854).const commitSceneTiming = (sceneId, patch) => {@@ -1152,6 +1151,7 @@ export default function MusicVideo() {kickoff,conceptDraft,styleDraft,+ songStyleDraft,importingLyrics,aligningLyrics,alignStatus,diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex ee5faefd47..76baaf6122 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -2127,7 +2127,7 @@ describe('MusicVideo YouTube audio import (#1945)', () => {});});- it('changing a track in the edit view auto-seeds track concept and style if not set', async () => {+ it('changing a track in the edit view auto-seeds the track concept, leaving the song style to the server', async () => {const project = { ...PROJECT_NO_CLIP, trackId: null, concept: null };listTracks.mockResolvedValue([{id: 'track-new',@@ -2135,7 +2135,7 @@ describe('MusicVideo YouTube audio import (#1945)', () => {concept: 'Space journey',prompt: 'Cosmic sci-fi',}]);- updateMusicVideoProject.mockResolvedValue({ ...project, trackId: 'track-new', concept: { prompt: 'Space journey', style: 'Cosmic sci-fi' } });+ updateMusicVideoProject.mockResolvedValue({ ...project, trackId: 'track-new', concept: { prompt: 'Space journey', songStyle: 'Cosmic sci-fi' } });await openProject(project, 'setup');const changeTrackSelect = screen.getByLabelText('Change track');@@ -2145,7 +2145,8 @@ describe('MusicVideo YouTube audio import (#1945)', () => {project.id,{trackId: 'track-new',- concept: { prompt: 'Space journey', style: 'Cosmic sci-fi' },+ // The Suno style is the song's sound, not the visual style on every frame prompt.+ concept: { prompt: 'Space journey' },},{ silent: true },));diff --git a/server/lib/README.md b/server/lib/README.mdindex a70ff473c3..0fb4271b77 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -832,7 +832,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `databaseWriterRegistry.js` | `createDatabaseWriterRegistry(dataDir?)` supplies durable detached launch reservations and inventory observations (reservation, POSIX launcher group, job PID, abandonment, completion) plus `retire(id, archiveDir?)` for proven-quiescent records; `reserveDatabaseWriter` is the mandatory `spawnDetached` admission boundary. `classifyWriterQuiescence(row, processes)` classifies a row against a process-table snapshot (quiescent / running / orphaned / pending / ambiguous) without probing PIDs. Legacy compacted history and Windows completions stay unresolved. |-| `musicVideoCreativeContext.js` | `musicVideoDirectionContext(direction)` bounds the authoritative Cast & Sets bible; `musicVideoCodeDirectionContext(direction)` renders the approved procedural direction (rules + reusable character definitions) for code-authoring requests; `musicVideoCreativeContext(concept)` composes the selected universe style and authored cast/place/object bible for planning and generation. |+| `musicVideoCreativeContext.js` | `musicVideoDirectionContext(direction)` bounds the authoritative Cast & Sets bible; `musicVideoCodeDirectionContext(direction)` renders the approved procedural direction (rules + reusable character definitions) for code-authoring requests; `musicVideoCreativeContext(concept)` composes the selected universe style and authored cast/place/object bible for planning and generation; `parseSongStyle(text)` splits a Suno style prompt into `{ sound, avoid }` (minus-prefixed excluded styles) and `musicVideoSongStyleContext(concept)` turns `concept.songStyle` into design direction for the planning LLMs (never an image prompt). || `musicVideoCharacterStyles.js` | Built-in Music Video character styles (a fixed-identity performer a project loads as its base concept and cast): `MUSIC_VIDEO_CHARACTER_STYLES` / `_IDS`, `getMusicVideoCharacterStyle`, `summarizeMusicVideoCharacterStyle` (picker projection), `musicVideoCharacterStyleSnapshot` (the `concept.characterStyle` text), `musicVideoCharacterStyleSubject` / `…SubjectId` / `…ReferenceId` (the protagonist and character-sheet reference a pick adds), `musicVideoCharacterSheetPrompt` (renders the style's own sheet). Pure; `services/musicVideo/characterStyles.js` keeps each install's sheet image. || `moodBoardStyleContext.js` | `collectBoardStyleContext(board)` bounds a board's notes, captions, analyzed prompts, and composite style for creative prompts. `moodBoardImageCandidates(board, resolveItem)` lists the poster first, then pinned local images. || `musicVideoAutonomous.js` | Fully-autonomous Music Video vocabulary: `AUTONOMOUS_STAGES` (brief → lyrics → style → song → analyze → produce), optional `AUTONOMOUS_CHECKPOINT_IDS`, `normalizeAutonomousSettings` / `normalizeAutonomousBrief` / `normalizeAutopilotParams` (the shared run settings, a run's stored brief, and the scheduled task's params), `autonomousMedium` / `autonomousPool` (tool picks → footage vs code, production route pool), `sunoSongFields` + Suno limits/URL helpers, `normalizeSunoOptions` (the brief's optional `suno` form options: exclude styles, vocal gender, model version), and `pickBrainIdea` / `ideaToPrompt` for the scheduled task. Pure; the client drawer and the run service import it. |diff --git a/server/lib/musicVideoCreativeContext.js b/server/lib/musicVideoCreativeContext.jsindex d4002b1d31..fd3c3e9729 100644--- a/server/lib/musicVideoCreativeContext.js+++ b/server/lib/musicVideoCreativeContext.js@@ -40,6 +40,37 @@ export function musicVideoCreativeContext(concept, { moodBoard = true } = {}) {return [...styles, ...(lines.length ? [BIBLE_HEADER, ...lines] : [])].join('\n').slice(0, CONTEXT_MAX);}+// Suno writes an excluded style as a leading minus; people type it as a+// hyphen, a non-breaking hyphen (U+2011), an en dash or a minus sign.+const EXCLUDED_STYLE = /^[-\u2010\u2011\u2012\u2013\u2212]\s*/;++/**+ * Split a Suno style prompt into what the song sounds like and the styles it+ * excludes (`-bubblegum pop`). Terms are comma separated; '' and [] when unset.+ */+export function parseSongStyle(text) {+ const terms = String(text || '').split(',').map((t) => t.trim()).filter(Boolean);+ const sound = terms.filter((t) => !EXCLUDED_STYLE.test(t));+ const avoid = terms.filter((t) => EXCLUDED_STYLE.test(t)).map((t) => t.replace(EXCLUDED_STYLE, '').trim()).filter(Boolean);+ return { sound: sound.join(', '), avoid };+}++/**+ * The song's own style (the Suno prompt it was made from) as direction for an+ * LLM that designs the picture. Music words are translated, never pasted into+ * an image prompt; the excluded styles name what the picture must not feel+ * like. '' when the project has no song style.+ */+export function musicVideoSongStyleContext(concept) {+ const { sound, avoid } = parseSongStyle(concept?.songStyle);+ if (!sound && !avoid.length) return '';+ return [+ 'SONG STYLE (the Suno style prompt this song was made from). Let it shape the design of the world, the cast and the scenes together with the lyrics and the director\'s direction: translate its era, genre, energy, instrumentation and vocal character into period, wardrobe, locations, palette, lighting, camera movement and performance. Never copy these music words into an image or video prompt. A fixed character style still decides who the protagonist is; the song style only informs the protagonist\'s looks and the world around them.',+ sound && `Sound: ${trimTo(sound, 1500)}`,+ avoid.length && `The song deliberately avoids: ${trimTo(avoid.join(', '), 800)}. Keep the picture clear of their visual equivalents too: a song that avoids "cutesy" gets no cute design.`,+ ].filter(Boolean).join('\n');+}+/** Bounded Cast & Sets bible; mood-board subjects are never location authority. */export function musicVideoDirectionContext(direction) {if (!direction) return '';diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.jsindex b16f4015d2..4ce12ba7ce 100644--- a/server/lib/musicVideoValidation.js+++ b/server/lib/musicVideoValidation.js@@ -88,7 +88,12 @@ export const MUSIC_VIDEO_STATUSES = ['draft', 'analyzed', 'ready', 'rendering',// Optional global visual direction for the whole video.export const musicVideoConceptSchema = z.object({prompt: z.string().max(8000).optional(),+ // The director's visual style, appended to every frame and shot prompt.style: z.string().max(2000).optional(),+ // The song's own style (the Suno style prompt, excluded styles included),+ // snapshotted from the track. Planning LLMs translate it into design; it+ // never reaches an image or video prompt verbatim.+ songStyle: z.string().max(2000).optional(),universeId: z.string().max(64).nullable().optional(),// Authored snapshots keep the production stable when source canon changes.universeStyle: z.string().max(4000).optional(),diff --git a/server/lib/sunoSong.js b/server/lib/sunoSong.jsindex 0a959fba9a..f0a8eeb15a 100644--- a/server/lib/sunoSong.js+++ b/server/lib/sunoSong.js@@ -130,6 +130,18 @@ const isSunoUrl = (value) => {return url.protocol === 'https:' && isSunoHost(url.hostname);};+/**+ * Suno keeps "Exclude styles" apart from the style tags. Fold them into the+ * style as minus-prefixed terms (Suno's own inline spelling) so the song's+ * style text carries what it avoids; a term already excluded inline is kept once.+ */+function withExcludedStyles(tags, negativeTags) {+ const dash = /^[-\u2010-\u2013\u2212]\s*/;+ const present = new Set(tags.split(',').map((t) => t.trim()).filter((t) => dash.test(t)).map((t) => t.replace(dash, '').toLowerCase()));+ const excluded = negativeTags.split(',').map((t) => t.trim().replace(dash, '')).filter((t) => t && !present.has(t.toLowerCase()));+ return [tags, ...excluded.map((t) => `-${t}`)].filter(Boolean).join(', ');+}+/*** Read what a Suno song page says about `songId`. Every field is best effort:* '' (or null for a URL) when the page doesn't carry it, so a page Suno@@ -154,7 +166,7 @@ export function parseSunoSongPage(html, songId) {return {title,lyrics: text(song.metadata?.prompt),- style: text(song.metadata?.tags),+ style: withExcludedStyles(text(song.metadata?.tags), text(song.metadata?.negative_tags)),audioUrl,imageUrl,};diff --git a/server/lib/sunoSong.test.js b/server/lib/sunoSong.test.jsindex c803cbfca5..b5fc6d3424 100644--- a/server/lib/sunoSong.test.js+++ b/server/lib/sunoSong.test.js@@ -53,6 +53,12 @@ describe('parseSunoSongPage', () => {});});+ it('folds Suno\'s excluded styles into the style as minus terms, once each', () => {+ const metadata = { prompt: 'words', tags: 'synth-pop, \u2011bubblegum pop', negative_tags: 'Bubblegum Pop, metal' };+ const html = page([`4:${JSON.stringify({ song: { id: ID, title: 'Full', metadata } })}\n`]);+ expect(parseSunoSongPage(html, ID).style).toBe('synth-pop, \u2011bubblegum pop, -metal');+ });+it('prefers the full record over a slimmer listing of the same song', () => {const html = page([`4:${JSON.stringify({ playbar: { id: ID, title: 'Short' }, song: { id: ID, title: 'Full', metadata: { prompt: 'words', tags: 'rock' } } })}\n`]);expect(parseSunoSongPage(html, ID)).toMatchObject({ title: 'Full', lyrics: 'words', style: 'rock' });diff --git a/server/scripts/db-migrations/016-music-video-song-style.js b/server/scripts/db-migrations/016-music-video-song-style.jsnew file mode 100644index 0000000000..de77b03e09--- /dev/null+++ b/server/scripts/db-migrations/016-music-video-song-style.js@@ -0,0 +1,31 @@+/**+ * Give Music Video projects the song's own style. A project+ * linked to a track used to copy the track's Suno style prompt into+ * `concept.style`, the visual style suffixed onto every frame and shot+ * prompt, so music words ("gated snare", "-metal") reached the image model.+ * Snapshot the track's prompt into `concept.songStyle`, which the planners+ * translate into design, and clear `concept.style` only where it is still that+ * untouched copy. Idempotent: rows already carrying `songStyle` are skipped.+ */++/** The concept a legacy project gets, or null when nothing changes. */+export function migrateSongStyle(concept, trackPrompt) {+ const songStyle = typeof trackPrompt === 'string' ? trackPrompt.trim().slice(0, 2000) : '';+ if (!songStyle || (concept && Object.hasOwn(concept, 'songStyle'))) return null;+ const copied = typeof concept?.style === 'string' && concept.style.trim() === songStyle;+ return { ...concept, songStyle, ...(copied ? { style: '' } : {}) };+}++export async function up(client) {+ const tables = await client.query("SELECT to_regclass('public.music_video_projects') AS projects, to_regclass('public.tracks') AS tracks");+ if (!tables.rows[0]?.projects || !tables.rows[0]?.tracks) return;+ const { rows } = await client.query(`SELECT p.id, p.data->'concept' AS concept, t.data->>'prompt' AS prompt+ FROM music_video_projects p JOIN tracks t ON t.id = p.data->>'trackId'+ WHERE NOT COALESCE(p.data->'concept' ? 'songStyle', FALSE)`);+ for (const { id, concept, prompt } of rows) {+ const next = migrateSongStyle(concept, prompt);+ if (!next) continue;+ await client.query(`UPDATE music_video_projects SET data = jsonb_set(data, '{concept}', $2::jsonb)+ WHERE id = $1 AND NOT COALESCE(data->'concept' ? 'songStyle', FALSE)`, [id, JSON.stringify(next)]);+ }+}diff --git a/server/scripts/db-migrations/016-music-video-song-style.test.js b/server/scripts/db-migrations/016-music-video-song-style.test.jsnew file mode 100644index 0000000000..c4123b2b6a--- /dev/null+++ b/server/scripts/db-migrations/016-music-video-song-style.test.js@@ -0,0 +1,31 @@+import { describe, it, expect, vi } from 'vitest';+import { migrateSongStyle, up } from './016-music-video-song-style.js';++describe('db-migration 016 - music video song style', () => {+ it('moves an untouched copy of the Suno style off the visual style', () => {+ expect(migrateSongStyle({ prompt: 'a story', style: 'synth-pop, -metal ' }, 'synth-pop, -metal'))+ .toEqual({ prompt: 'a story', style: '', songStyle: 'synth-pop, -metal' });+ });++ it('keeps a visual style the director wrote, and skips migrated or trackless projects', () => {+ expect(migrateSongStyle({ style: 'grainy 16mm' }, 'synth-pop')).toEqual({ style: 'grainy 16mm', songStyle: 'synth-pop' });+ expect(migrateSongStyle(null, 'synth-pop')).toEqual({ songStyle: 'synth-pop' });+ expect(migrateSongStyle({ songStyle: '' }, 'synth-pop')).toBeNull();+ expect(migrateSongStyle({ style: 'x' }, null)).toBeNull();+ });++ it('writes the migrated concept and does nothing without both tables', async () => {+ const updates = [];+ const query = vi.fn(async (sql, params) => {+ if (sql.includes('to_regclass')) return { rows: [{ projects: 'music_video_projects', tracks: 'tracks' }] };+ if (sql.startsWith('SELECT')) return { rows: [{ id: 'p1', concept: { style: 'pop' }, prompt: 'pop' }] };+ updates.push(params);+ return { rows: [] };+ });+ await up({ query });+ expect(updates).toEqual([['p1', JSON.stringify({ style: '', songStyle: 'pop' })]]);+ const bare = vi.fn(async () => ({ rows: [{ projects: 'music_video_projects', tracks: null }] }));+ await up({ query: bare });+ expect(bare).toHaveBeenCalledTimes(1);+ });+});diff --git a/server/services/musicVideo/castAndSetsDirection.js b/server/services/musicVideo/castAndSetsDirection.jsindex 01e430277a..439ed4d6c9 100644--- a/server/services/musicVideo/castAndSetsDirection.js+++ b/server/services/musicVideo/castAndSetsDirection.js@@ -33,7 +33,7 @@ import { musicVideoAllowsMedia } from '../../lib/musicVideoMediaPolicy.js';import { z } from 'zod';import { ServerError } from '../../lib/errorHandler.js';import { extractJson } from '../../lib/jsonExtract.js';-import { musicVideoCreativeContext } from '../../lib/musicVideoCreativeContext.js';+import { musicVideoCreativeContext, musicVideoSongStyleContext } from '../../lib/musicVideoCreativeContext.js';import { musicVideoBriefTools as briefTools } from '../../lib/musicVideoMediumPlan.js';import { trimTo } from '../../lib/textUtils.js';import { CAST_SETS_DEFINITION_LIMITS, normalizeDefinitions } from './castAndSetsDefinitions.js';@@ -206,7 +206,9 @@ export function buildCastAndSetsPrompt(project, { moodImages = [], board = null,const sections = songSections(project);const lyrics = lyricSheetText(project);const guidance = trimTo(project?.automation?.guidance, 2000);- const trackStyle = trimTo(track?.prompt, 1500) || trimTo(concept.style, 1500);+ // The song's Suno style shapes the design; the director's visual style is the look.+ const songStyle = musicVideoSongStyleContext({ songStyle: concept.songStyle || track?.prompt });+ const visualStyle = trimTo(concept.style, 1500);const boardStyle = trimTo(board?.style?.prompt, 1500) || trimTo(concept.moodBoardStyle, 1500);const boardNegative = trimTo(board?.style?.negativePrompt, 600);const moodLines = moodImages.map((img, i) => `${i}. ${[img.caption, img.analysis].filter(Boolean).join(' — ') || '(no caption or analysis)'}`);@@ -227,8 +229,8 @@ export function buildCastAndSetsPrompt(project, { moodImages = [], board = null,const facts = [`Duration: ${fmtTime(analysis.durationSec)}${analysis.bpm ? ` · ${Math.round(analysis.bpm)} BPM` : ''}`,- trackStyle && `Track style prompt: ${trackStyle}`,concept.prompt && `Concept: ${trimTo(concept.prompt, 2000)}`,+ visualStyle && `Director's visual style: ${visualStyle}`,guidance && `Director guidance: ${guidance}`,bible && bible,].filter(Boolean).join('\n');@@ -279,6 +281,7 @@ export function buildCastAndSetsPrompt(project, { moodImages = [], board = null,header,facts,characterStyle,+ songStyle,`Lyrics (section headers and delivery directions in brackets):\n${lyrics || '(instrumental — no lyrics)'}`,sectionLines.length ? `Song sections (index. label start–end):\n${sectionLines.join('\n')}` : 'The song has not been sectioned.',board_,diff --git a/server/services/musicVideo/castAndSetsDirection.test.js b/server/services/musicVideo/castAndSetsDirection.test.jsindex 1b16f85446..32faf0e632 100644--- a/server/services/musicVideo/castAndSetsDirection.test.js+++ b/server/services/musicVideo/castAndSetsDirection.test.js@@ -53,6 +53,18 @@ describe('Cast & Sets direction', () => {expect(prompt).not.toContain('This is a REVISION');});+ it('designs from the song\'s Suno style, falling back to the track, and keeps it apart from the visual style', () => {+ const songStyle = '1980s synth-pop, gated snare, \u2011cutesy, -musical theater';+ const prompt = buildCastAndSetsPrompt({ ...project, concept: { ...project.concept, songStyle } });+ expect(prompt).toContain('SONG STYLE');+ expect(prompt).toContain('Sound: 1980s synth-pop, gated snare');+ expect(prompt).toContain('The song deliberately avoids: cutesy, musical theater.');+ expect(prompt).toContain("Director's visual style: raw flash");+ // A project made before songStyle existed still reads its track's prompt.+ expect(buildCastAndSetsPrompt(project, { track: { prompt: 'dark wave' } })).toContain('Sound: dark wave');+ expect(buildCastAndSetsPrompt(project)).not.toContain('SONG STYLE');+ });+it('fixes the protagonist to a loaded character style, stating it once with its wardrobe', () => {const characterStyle = 'Claudia slopcore: Claudia.\nWardrobe options: Look 00: a white shirt\nNever: a second streak';const prompt = buildCastAndSetsPrompt({ ...project, concept: { ...project.concept, characterStyle } });diff --git a/server/services/musicVideo/handoff.test.js b/server/services/musicVideo/handoff.test.jsindex 3f3d972a75..db93ed8dc8 100644--- a/server/services/musicVideo/handoff.test.js+++ b/server/services/musicVideo/handoff.test.js@@ -91,7 +91,8 @@ describe('buildHandoffManifest typography (#8992)', () => {it('keeps typography prose out of the exported frame/shot prompts but leaves it in visualSpec', () => {const project = {id: 'mv-typo', name: 'Typo Project', version: 1,- concept: { prompt: '', style: 'grainy 16mm' },+ // The song's Suno style shapes planning only; it never reaches a generation prompt.+ concept: { prompt: '', style: 'grainy 16mm', songStyle: 'synth-pop, -metal' },visualSpec: {palette: ['#112233'],cameraRules: 'locked-off wides',diff --git a/server/services/musicVideo/planner.js b/server/services/musicVideo/planner.jsindex 2996aa160c..8e1c771ee9 100644--- a/server/services/musicVideo/planner.js+++ b/server/services/musicVideo/planner.js@@ -1,4 +1,4 @@-import { musicVideoCreativeContext, musicVideoDirectionContext } from '../../lib/musicVideoCreativeContext.js';+import { musicVideoCreativeContext, musicVideoDirectionContext, musicVideoSongStyleContext } from '../../lib/musicVideoCreativeContext.js';/*** Music Video — autonomous shot planner (#1855; multi-shot + lyrics #8964).*@@ -179,6 +179,7 @@ export function buildScenePlanPrompt(project, shots) {return `You are directing a music video for "${project.name}".${conceptLine}${styleLine}+${musicVideoSongStyleContext(concept)}${musicVideoCreativeContext(concept)}${musicVideoDirectionContext(direction)}${briefLines}diff --git a/server/services/musicVideo/projects.js b/server/services/musicVideo/projects.jsindex 096393964e..8dc6f75cdc 100644--- a/server/services/musicVideo/projects.js+++ b/server/services/musicVideo/projects.js@@ -93,6 +93,8 @@ async function seedVideoBackendDefault(input) {// Automatically read lyrics and creative context from the linked music track// in the music creation system when creating a project.+const trackSongStyle = (track) => (typeof track?.prompt === 'string' ? track.prompt.trim().slice(0, 2000) : '');+async function seedTrackMetadata(input) {if (!input?.trackId) return input;const track = await getTrack(input.trackId).catch(() => null);@@ -111,11 +113,13 @@ async function seedTrackMetadata(input) {name = track.title;}let concept = input.concept;+ // The track's prompt is the song's Suno style: it seeds `songStyle`, which+ // the planners translate into design. It is not the visual style.if (track.concept || track.prompt) {concept = {...(concept || {}),...(track.concept && !concept?.prompt ? { prompt: track.concept } : {}),- ...(track.prompt && !concept?.style ? { style: track.prompt } : {}),+ ...(track.prompt && !concept?.songStyle ? { songStyle: trackSongStyle(track) } : {}),};}return {@@ -144,12 +148,14 @@ async function seedTrackMetadataOnUpdate(id, patch) {}}let concept = patch.concept;- if ((track.concept && !project.concept?.prompt) || (track.prompt && !project.concept?.style)) {+ // A different song brings its own style, so the snapshot follows the track.+ const songStyle = typeof concept?.songStyle === 'string' ? concept.songStyle : trackSongStyle(track);+ if ((track.concept && !project.concept?.prompt) || songStyle !== (project.concept?.songStyle || '')) {concept = {...(project.concept || {}),...(concept || {}),...(track.concept && !project.concept?.prompt && !concept?.prompt ? { prompt: track.concept } : {}),- ...(track.prompt && !project.concept?.style && !concept?.style ? { style: track.prompt } : {}),+ songStyle,};}return {diff --git a/server/services/musicVideo/projects.test.js b/server/services/musicVideo/projects.test.jsindex 1e2d434659..4e75056068 100644--- a/server/services/musicVideo/projects.test.js+++ b/server/services/musicVideo/projects.test.js@@ -163,8 +163,10 @@ describe('track metadata and lyrics auto-reading on create and update', () => {expect(project.lyricCues[1].text).toBe('Shining like a spark');expect(project.concept).toMatchObject({prompt: 'A cyberpunk nocturnal story',- style: 'Neon noir 80s anime style',+ songStyle: 'Neon noir 80s anime style',});+ // The Suno style is the song's sound, never the visual style appended to frame prompts.+ expect(project.concept.style).toBeUndefined();});it('preserves explicitly authored project fields over track defaults at creation', async () => {@@ -189,6 +191,7 @@ describe('track metadata and lyrics auto-reading on create and update', () => {expect(project.concept).toMatchObject({prompt: 'Custom concept',style: 'Custom style',+ songStyle: 'Track style',});});@@ -214,8 +217,9 @@ describe('track metadata and lyrics auto-reading on create and update', () => {expect(updated.lyricCues[0].text).toBe('Golden light breaks through');expect(updated.concept).toMatchObject({prompt: 'Dawn over the horizon',- style: 'Impressionist pastel colors',+ songStyle: 'Impressionist pastel colors',});+ expect(updated.concept.style).toBeUndefined();});});diff --git a/server/services/musicVideo/songRevision.js b/server/services/musicVideo/songRevision.jsindex 30d47c3afd..0c74f2b92f 100644--- a/server/services/musicVideo/songRevision.js+++ b/server/services/musicVideo/songRevision.js@@ -159,7 +159,8 @@ export async function selectSongRevision(projectId, revisionId, songId) {if (!candidate) fail('Import and listen to a candidate before selecting it');const applied = applyRevisedMaster(project, { uploadedAudioFilename: candidate.filename,lyrics: revision.fields.lyrics, instrumental: revision.fields.instrumental });- return { project: { ...applied.project, songRevision: { ...revision, ...applied.revision,+ const songStyle = String(revision.fields?.style || '').trim().slice(0, 2000);+ return { project: { ...applied.project, concept: { ...applied.project.concept, songStyle }, songRevision: { ...revision, ...applied.revision,status: 'selected', selectedSongId: songId, selectedAt: new Date().toISOString() } } };}));}@@ -183,7 +184,9 @@ export async function reviseSongFromTrack(projectId, { trackId }) {return startRetime(await mutate(fork.id, (project) => {const applied = applyRevisedMaster(project, { trackId: track.id, lyrics: lyrics.trim() ? lyrics : null });const now = new Date().toISOString();- return { project: { ...applied.project, songRevision: { id: `mvsr-${randomUUID()}`, source: 'track', trackId: track.id,+ // The new song brings its own Suno style for the planners to design from.+ const songStyle = typeof track.prompt === 'string' ? track.prompt.trim().slice(0, 2000) : '';+ return { project: { ...applied.project, concept: { ...applied.project.concept, songStyle }, songRevision: { id: `mvsr-${randomUUID()}`, source: 'track', trackId: track.id,fields: { title: String(track.title || project.name || 'Song').slice(0, 80), style: String(track.prompt || '').slice(0, 1000),lyrics: (lyrics.trim() ? lyrics : (project.lyricCues || []).map((c) => c.text).join('\n')).slice(0, 5000), instrumental: false },status: 'selected', songIds: [], candidates: [], createdAt: now, selectedAt: now, ...applied.revision } } };diff --git a/server/services/musicVideo/treatmentDraft.js b/server/services/musicVideo/treatmentDraft.jsindex 2f569148c0..7cec54f6af 100644--- a/server/services/musicVideo/treatmentDraft.js+++ b/server/services/musicVideo/treatmentDraft.js@@ -1,7 +1,7 @@import { musicVideoMediaMode } from '../../lib/musicVideoMediaPolicy.js';import { shotActionContractProblem } from '../../lib/musicVideoActionContract.js';import { musicVideoStyleBasis, musicVideoStylePrompt } from '../../lib/musicVideoConditioning.js';-import { musicVideoCreativeContext } from '../../lib/musicVideoCreativeContext.js';+import { musicVideoCreativeContext, musicVideoSongStyleContext } from '../../lib/musicVideoCreativeContext.js';/*** Music Video — treatment compiler (#8980).*@@ -383,6 +383,7 @@ export function buildTreatmentPrompt(project, draft) {musicVideoCreativeContext(concept),concept.prompt && `Concept: ${quote(concept.prompt, 600)}`,concept.style && `Visual style: ${quote(concept.style)}`,+ musicVideoSongStyleContext(concept),spec.palette?.length && `Palette: ${spec.palette.join(' ')}`,spec.cameraRules && `Camera rules: ${quote(spec.cameraRules)}`,].filter(Boolean);