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

Keep outside mood board images out of image generation

atomantice81a8727e88d
diff --git a/client/src/components/musicVideo/CastAndSetsCheckin.test.jsx b/client/src/components/musicVideo/CastAndSetsCheckin.test.jsx
index 642de151d9..0162ca005e 100644
--- a/client/src/components/musicVideo/CastAndSetsCheckin.test.jsx
+++ b/client/src/components/musicVideo/CastAndSetsCheckin.test.jsx
@@ -28,11 +28,11 @@ const DRAFTS = { conceptDraft: { value: '', onChange: () => {}, onBlur: () => {}
const emit = async (event, data) => act(async () => { for (const fn of listeners.get(event) || []) fn(data); });
const plan = {
- character: { key: 'character', label: 'Keeper', prompt: 'Planned keeper portrait', deps: [], refKeys: [], moodRefs: true },
+ character: { key: 'character', label: 'Keeper', prompt: 'Planned keeper portrait', deps: [], refKeys: [] },
set: { key: 'set', label: 'Lamp room', prompt: 'Planned lamp room', deps: ['character'], refKeys: ['character'] },
looks: { key: 'looks', label: 'Wardrobe', prompt: 'Planned wardrobe', deps: ['character'], refKeys: ['character'] },
};
-const project = (images = {}, extra = {}) => ({ id: 'example-project', castAndSets: { revision: 1, status: 'imaging', plan, images, moodImages: [{ kind: 'image-ref', filename: 'mood.png' }], ...extra } });
+const project = (images = {}, extra = {}) => ({ id: 'example-project', castAndSets: { revision: 1, status: 'imaging', plan, images, ...extra } });
const done = (filename, prompt) => ({ status: 'done', jobId: `job-${filename}`, imageId: filename, submittedPrompt: prompt, submittedRevision: 1, submittedReferences: [{ kind: 'image-ref', filename: 'mood.png' }] });
let selectProject;
function Harness({ initial, locked = true, openPreview = vi.fn() }) {
diff --git a/client/src/components/musicVideo/CastAndSetsReferenceProgress.jsx b/client/src/components/musicVideo/CastAndSetsReferenceProgress.jsx
index 8341c341cc..0e9cbec995 100644
--- a/client/src/components/musicVideo/CastAndSetsReferenceProgress.jsx
+++ b/client/src/components/musicVideo/CastAndSetsReferenceProgress.jsx
@@ -16,11 +16,8 @@ function previewItem(ref, prompt) {
function cardReferences(item, stage) {
const image = stage.images?.[item.key] || {};
if (typeof image.submittedPrompt === 'string') return image.submittedReferences || [];
- return [
- ...(item.refKeys || []).flatMap((key) => stage.images?.[key]?.imageId
- ? [{ kind: 'image', filename: stage.images[key].imageId }] : []),
- ...(item.moodRefs ? stage.moodImages || [] : []),
- ];
+ return (item.refKeys || []).flatMap((key) => stage.images?.[key]?.imageId
+ ? [{ kind: 'image', filename: stage.images[key].imageId }] : []);
}
/**
diff --git a/client/src/components/musicVideo/LookReferencesPanel.jsx b/client/src/components/musicVideo/LookReferencesPanel.jsx
index 9b20cd5d56..951d0a9283 100644
--- a/client/src/components/musicVideo/LookReferencesPanel.jsx
+++ b/client/src/components/musicVideo/LookReferencesPanel.jsx
@@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import { ImagePlus, Trash2, Sparkles, Download } from 'lucide-react';
import useMounted from '../../hooks/useMounted.js';
-import { MAX_CONDITIONING_REFERENCES } from '../../hooks/useMusicVideoSceneMedia.js';
+import { isOutsideReference, MAX_CONDITIONING_REFERENCES } from '../../hooks/useMusicVideoSceneMedia.js';
import { getMoodBoard } from '../../services/apiMoodBoard.js';
import { getUniverse } from '../../services/apiUniverseBuilder.js';
import { uploadGalleryImage } from '../../services/apiSystem.js';
@@ -47,7 +47,7 @@ export default function LookReferencesPanel({ project, onSave, onSaveSpec, onAdd
const [dirty, setDirty] = useState(false);
const [working, setWorking] = useState(false); // a board import / universe pull is reading
const idFor = (suffix) => `mv-look-${project.id}-${suffix}`;
- const flagged = references.filter((r) => r.condition).length;
+ const flagged = references.filter((r) => r.condition && !isOutsideReference(r)).length;
const full = references.length >= MUSIC_VIDEO_MAX_REFERENCES;
useEffect(() => {
@@ -188,12 +188,16 @@ export default function LookReferencesPanel({ project, onSave, onSaveSpec, onAdd
<input id={idFor(`label-${ref.id}`)} defaultValue={ref.label || ''} maxLength={120} placeholder="Label (e.g. lead singer)"
onBlur={(e) => { if (e.target.value !== (ref.label || '')) updateRef(ref.id, { label: e.target.value }); }}
className={`w-full ${selectCls}`} />
- <label className="flex items-center gap-1 text-[11px] min-h-[44px] sm:min-h-0">
- <input type="checkbox" checked={!!ref.condition}
- disabled={!ref.condition && flagged >= MAX_CONDITIONING_REFERENCES}
- onChange={(e) => updateRef(ref.id, { condition: e.target.checked })} />
- Condition frames
- </label>
+ {isOutsideReference(ref) ? (
+ <p className="text-[11px] text-port-text-muted">Mood board image: shapes the look as text, never sent to the generator</p>
+ ) : (
+ <label className="flex items-center gap-1 text-[11px] min-h-[44px] sm:min-h-0">
+ <input type="checkbox" checked={!!ref.condition}
+ disabled={!ref.condition && flagged >= MAX_CONDITIONING_REFERENCES}
+ onChange={(e) => updateRef(ref.id, { condition: e.target.checked })} />
+ Condition frames
+ </label>
+ )}
</div>
</li>
))}
diff --git a/client/src/components/musicVideo/LookReferencesPanel.test.jsx b/client/src/components/musicVideo/LookReferencesPanel.test.jsx
index 3a180f4641..6ce1cb498a 100644
--- a/client/src/components/musicVideo/LookReferencesPanel.test.jsx
+++ b/client/src/components/musicVideo/LookReferencesPanel.test.jsx
@@ -35,6 +35,15 @@ describe('look references', () => {
expect(onSaveSpec).toHaveBeenCalledWith({ references: [{ id: 'r1', imageId: 'face.png', role: 'character', label: 'Singer', condition: true }] });
});
+ it('offers no condition toggle for a mood board import or a Pinterest pin', () => {
+ mount({ visualSpec: { references: [
+ { id: 'mvr-board-1', imageId: 'board.png', role: 'mood', condition: false },
+ { id: 'r2', imageId: 'pinterest-0123456789abcdef.jpg', role: 'mood', condition: false },
+ ] } });
+ expect(screen.queryByLabelText('Condition frames')).toBeNull();
+ expect(screen.getAllByText(/never sent to the generator/)).toHaveLength(2);
+ });
+
it('imports the linked mood board gallery images once, skipping text, remote pins and duplicates', async () => {
getMoodBoard.mockResolvedValue({ id: 'b1', name: 'Example Board', items: [
{ id: 'i1', type: 'image', mediaKey: 'image:pin.png' },
diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.js
index b976d0ef63..fbc3e3ff80 100644
--- a/client/src/hooks/useMusicVideoSceneMedia.js
+++ b/client/src/hooks/useMusicVideoSceneMedia.js
@@ -1,6 +1,6 @@
import { shotActionContractProblem, shotActionPrompt } from '../../../server/lib/musicVideoActionContract.js';
import { shotCameraPrompt } from '../../../server/lib/cameraMovements.js';
-import { musicVideoConditioningReferences, MUSIC_VIDEO_MAX_CONDITIONING_REFERENCES } from '../../../server/lib/musicVideoConditioning.js';
+import { isOutsideMusicVideoReference, musicVideoConditioningReferences, MUSIC_VIDEO_MAX_CONDITIONING_REFERENCES } from '../../../server/lib/musicVideoConditioning.js';
import { musicVideoCreativeContext } from '../../../server/lib/musicVideoCreativeContext.js';
import { useEffect, useRef } from 'react';
import socket from '../services/socket';
@@ -61,6 +61,8 @@ export function visualDirection(spec) {
/** Shared scene-aware frame conditioning, with the legacy capped fallback. */
export const conditioningReferences = musicVideoConditioningReferences;
+/** A mood board / Pinterest reference: look text only, never a conditioning image. */
+export const isOutsideReference = isOutsideMusicVideoReference;
// A scene's authored span on the song, or null while it is untimed.
const sceneSpanSec = (scene) => (typeof scene.startSec === 'number' && typeof scene.endSec === 'number' && scene.endSec > scene.startSec
diff --git a/server/lib/musicVideoConditioning.js b/server/lib/musicVideoConditioning.js
index d0371dccb5..f53b8154c8 100644
--- a/server/lib/musicVideoConditioning.js
+++ b/server/lib/musicVideoConditioning.js
@@ -4,6 +4,14 @@ import { RUNNER_FAMILIES } from './runners.js';
/** Browser-safe reference selection shared by the board and production lanes. */
export const MUSIC_VIDEO_MAX_CONDITIONING_REFERENCES = 4;
+/**
+ * A reference pulled in from outside inspiration: imported from a mood board
+ * ("Import board images") or a synced Pinterest pin. Outside images inform the
+ * look as text and are never sent to a generator as a conditioning image.
+ */
+export const isOutsideMusicVideoReference = (ref) => String(ref?.id || '').startsWith('mvr-board-')
+ || String(ref?.imageId || '').startsWith('pinterest-');
+
export function musicVideoConditioningReferences(project, scene) {
const references = project?.visualSpec?.references || [];
const stage = project?.castAndSets;
@@ -16,7 +24,7 @@ export function musicVideoConditioningReferences(project, scene) {
if (character && plate) return [character, plate];
}
// Legacy projects and incomplete check-ins retain the authored reference set.
- return references.filter((ref) => ref?.condition && ref.imageId)
+ return references.filter((ref) => ref?.condition && ref.imageId && !isOutsideMusicVideoReference(ref))
.slice(0, MUSIC_VIDEO_MAX_CONDITIONING_REFERENCES);
}
diff --git a/server/services/musicVideo/castAndSets.js b/server/services/musicVideo/castAndSets.js
index 4fb52264fa..70b7efcb6d 100644
--- a/server/services/musicVideo/castAndSets.js
+++ b/server/services/musicVideo/castAndSets.js
@@ -14,8 +14,7 @@
* productionRunId, // the production run that started it, if any
* route: { mode, model },
* direction, // castAndSetsDirection.js shape (`medium`: absent = photographic)
- * moodImages: [{ kind, filename }],
- * plan: { [key]: { key, kind, label, prompt, deps, refKeys, moodRefs?, setId?, testIndex? } },
+ * plan: { [key]: { key, kind, label, prompt, deps, refKeys, setId?, testIndex? } },
* images: { [key]: { status, jobId, imageId, history, failures, error, updatedAt,
* submittedPrompt?, submittedPromptTruncated?, submittedReferences?, submittedRevision? } },
* artifactId, artifactVersion, notesApplied,
@@ -96,7 +95,6 @@ export function startCastAndSetsOnProject(project, { processId, productionRunId
productionRunId,
route: current?.route || null,
direction: current?.direction || null,
- moodImages: current?.moodImages || [],
plan: current?.plan || {},
images: current?.images || {},
artifactId: current?.artifactId || null,
@@ -151,8 +149,10 @@ export function resumeCastAndSetsOnProject(project, { processId }, now = new Dat
* (re)render; every other key keeps its image. Keys no longer in the plan are
* dropped. Returns `{ project, stage }`.
*/
-export function setCastAndSetsDirection(project, { direction, plan, moodImages, route, renderKeys }, now = new Date().toISOString()) {
- const stage = requireStage(project);
+export function setCastAndSetsDirection(project, { direction, plan, route, renderKeys }, now = new Date().toISOString()) {
+ // `moodImages` (mood board images once sent as references) is dropped from a
+ // pre-fix stage: outside images never condition generation.
+ const { moodImages: _legacyMoodImages, ...stage } = requireStage(project);
const rerender = new Set(renderKeys);
const images = {};
for (const key of Object.keys(plan)) {
@@ -166,7 +166,6 @@ export function setCastAndSetsDirection(project, { direction, plan, moodImages,
status: 'imaging',
direction,
plan,
- moodImages: moodImages ?? stage.moodImages ?? [],
route: route ?? stage.route ?? null,
images,
}, now);
diff --git a/server/services/musicVideo/castAndSetsDirection.js b/server/services/musicVideo/castAndSetsDirection.js
index 439ed4d6c9..68d16c952f 100644
--- a/server/services/musicVideo/castAndSetsDirection.js
+++ b/server/services/musicVideo/castAndSetsDirection.js
@@ -38,11 +38,14 @@ import { musicVideoBriefTools as briefTools } from '../../lib/musicVideoMediumPl
import { trimTo } from '../../lib/textUtils.js';
import { CAST_SETS_DEFINITION_LIMITS, normalizeDefinitions } from './castAndSetsDefinitions.js';
+// Mood board images are outside inspiration (Pinterest pins, uploads): they
+// shape the direction as words and are never image-generation inputs.
+const MOOD_BOARD_TEXT_ONLY = 'The image generator never sees the mood board: carry what you take from it (light, color, texture, grain, wardrobe feel) into your own words in the descriptions, lighting and looks.';
+
export const CAST_SETS_LIMITS = Object.freeze({
looks: { min: 1, max: 4 },
sets: { min: 3, max: 8 },
tests: { min: 2, max: 4 },
- moodRefs: { min: 2, max: 4 },
rules: 6,
expressions: 8,
questions: 4,
@@ -146,7 +149,6 @@ const OUTPUT_SHAPE = `{
"songMap": [{ "section": 0, "setId": "<short-slug>" }],
"tests": [{ "setId": "<short-slug>", "look": "<SHORT NAME>", "action": "<what the protagonist does in this frame>", "caption": "<the lyric or beat it serves>" }],
"overlayConcept": { "summary": "<one persistent graphic layer that ties every shot together>", "elements": [{ "name": "<element>", "description": "<what it shows and when it changes>" }] },
- "moodRefs": [0, 1],
"questions": ["<a question for the director>"]
}`;
@@ -189,7 +191,6 @@ const PROCEDURAL_OUTPUT_SHAPE = `{
"motion": [{ "name": "<motion name>", "target": "<part-slug or all>", "property": "rotate | scale | translateX | translateY | opacity", "amplitude": 4, "periodBeats": 1, "easing": "linear | ease-in-out | ease-out | bounce | step", "trigger": "idle | beat | downbeat | lyric | section" }]
}]
},
- "moodRefs": [0, 1],
"questions": ["<a question for the director>"]
}`;
@@ -221,10 +222,12 @@ export function buildCastAndSetsPrompt(project, { moodImages = [], board = null,
'Read the lyrics as a story. Interpret the song: its references, themes and subtext. The world of the video (who the protagonist is, where it happens, what the sets are) must come from that interpretation.',
'Design the protagonist as a reusable construction: parts, shape language, materials, a fixed palette, a few named expressions and motion rules that every scene will reuse. Design the world as layered environments with a camera and transition language.',
'The mood board is reference for LOOK, LIGHTING, COLOR and TEXTURE only. Never copy its literal locations, rooms or props into the sets.',
+ MOOD_BOARD_TEXT_ONLY,
].join('\n') : [
`You are the creative director preparing the CAST & SETS check-in for a music video of "${project?.name || 'Untitled'}".`,
'Read the lyrics as a story. Interpret the song: its references, themes and subtext, including any real events, ideas or cultural touchstones the words point at. The world of the video (who the protagonist is, where it happens, what the sets are) must come from that interpretation.',
'The mood board is reference for LOOK, LIGHTING, COLOR and TEXTURE only. Never copy its literal locations, rooms or props into the sets: a kitchen photo on the board does not put the video in a kitchen.',
+ MOOD_BOARD_TEXT_ONLY,
].join('\n');
const facts = [
@@ -256,7 +259,6 @@ export function buildCastAndSetsPrompt(project, { moodImages = [], board = null,
'- Give every set ONE dominant light color or quality so a cut tells the viewer where we are.',
'- songMap: one entry per song section index listed above, naming the set that section plays in.',
`- definitions: one reusable code definition per recurring character (at most ${CAST_SETS_DEFINITION_LIMITS.characters}). Draw it in a 200×200 box (origin top-left, y down) from at most ${CAST_SETS_DEFINITION_LIMITS.parts} simple parts; fills and strokes name a palette entry or a #hex. Expressions and poses are per-part overrides of the base parts; motion rules say what moves, by how much, over how many beats. Keep the definition consistent with the prose above.`,
- `- moodRefs: the ${CAST_SETS_LIMITS.moodRefs.min}–${CAST_SETS_LIMITS.moodRefs.max} mood board image indices that best show the look${moodImages.length ? '' : ' (empty: there are none)'}.`,
'- questions: up to three things you need the director to decide.',
].join('\n');
const photographicRules = [
@@ -264,7 +266,6 @@ export function buildCastAndSetsPrompt(project, { moodImages = [], board = null,
'- Give every set ONE dominant light color or quality so a cut tells the viewer where we are.',
'- songMap: one entry per song section index listed above, naming the set that section plays in.',
'- tests: in-set frames of the protagonist that prove the cast works in the world; each names a set id and a look name.',
- `- moodRefs: the ${CAST_SETS_LIMITS.moodRefs.min}–${CAST_SETS_LIMITS.moodRefs.max} mood board image indices that best show the look for the character sheet${moodImages.length ? '' : ' (empty: there are none)'}.`,
'- Wet or revealing looks use opaque fabric so the video stays safe to post.',
'- questions: up to three things you need the director to decide.',
].join('\n');
@@ -376,7 +377,6 @@ const FIELD_PARSERS = {
songMap: z.array(songMapSchema),
tests: z.array(testSchema),
overlayConcept: overlaySchema,
- moodRefs: z.array(z.number().int().min(0)),
questions: z.array(text(400)),
};
@@ -467,7 +467,7 @@ function normalizeTests(tests, sets, looks) {
* `{ direction, missing }` — `missing` lists the required parts still absent,
* so a first pass with an unusable answer can be refused.
*/
-export function mergeCastAndSetsDirection(previous, parsed, { sections = [], moodImageCount = 0, medium = null } = {}) {
+export function mergeCastAndSetsDirection(previous, parsed, { sections = [], medium = null } = {}) {
const base = previous || {};
const procedural = (medium || base.medium) === 'procedural';
const pick = (key, fallback) => (hasOwn(parsed, key) ? parsed[key] : (hasOwn(base, key) ? base[key] : fallback));
@@ -506,7 +506,6 @@ export function mergeCastAndSetsDirection(previous, parsed, { sections = [], moo
elements: (overlayRaw.elements || []).filter((e) => e.name && e.description).slice(0, CAST_SETS_LIMITS.overlayElements)
.map((e) => ({ name: e.name, description: e.description })),
};
- const moodRefs = [...new Set(pick('moodRefs', []))].filter((i) => i < moodImageCount).slice(0, CAST_SETS_LIMITS.moodRefs.max);
const definitions = hasOwn(parsed, 'definitions') ? parsed.definitions : (base.definitions || { characters: [] });
const direction = {
...(procedural ? { medium: 'procedural', world, definitions } : {}),
@@ -518,7 +517,6 @@ export function mergeCastAndSetsDirection(previous, parsed, { sections = [], moo
songMap,
tests,
overlayConcept,
- moodRefs,
questions: (pick('questions', [])).filter(Boolean).slice(0, CAST_SETS_LIMITS.questions),
};
const missing = [
@@ -573,8 +571,7 @@ export function applyCastAndSetsDirectionEdits(previous, edits, { sections = []
if (unknown.length) throw new ServerError(`Unknown set: ${unknown.join(', ')}`, { status: 422, code: 'CAST_SETS_UNKNOWN_SET' });
parsed.sets = previous.sets.map((s) => (roles.has(s.id) ? { ...s, imageRole: roles.get(s.id) } : s));
}
- // The mood-board indices were validated against the board when it was directed.
- const { direction, missing } = mergeCastAndSetsDirection(previous, parsed, { sections, moodImageCount: Number.POSITIVE_INFINITY, medium: 'procedural' });
+ const { direction, missing } = mergeCastAndSetsDirection(previous, parsed, { sections, medium: 'procedural' });
if (missing.length) throw new ServerError(`That edit would leave the direction without: ${missing.join(', ')}`, { status: 422, code: 'CAST_SETS_EDIT_INVALID' });
const differs = (a, b) => JSON.stringify(a ?? '') !== JSON.stringify(b ?? '');
const changed = [
diff --git a/server/services/musicVideo/castAndSetsDirection.test.js b/server/services/musicVideo/castAndSetsDirection.test.js
index 32faf0e632..ec53d456d4 100644
--- a/server/services/musicVideo/castAndSetsDirection.test.js
+++ b/server/services/musicVideo/castAndSetsDirection.test.js
@@ -48,6 +48,8 @@ describe('Cast & Sets direction', () => {
expect(prompt).toContain('Interpret the song');
expect(prompt).toMatch(/LOOK, LIGHTING, COLOR and TEXTURE only/);
expect(prompt).toContain('0. a kitchen — steam and brass');
+ expect(prompt).toContain('The image generator never sees the mood board');
+ expect(prompt).not.toContain('moodRefs');
expect(prompt).toContain('Director guidance: keep it night-lit');
expect(prompt).toContain('1. Chorus 0:20–1:00');
expect(prompt).not.toContain('This is a REVISION');
@@ -78,7 +80,7 @@ describe('Cast & Sets direction', () => {
const echoed = buildCastAndSetsPrompt(project).split('no other text:\n')[1];
const parsed = parseCastAndSetsResponse(`${echoed}\n\nSure:\n\`\`\`json\n${JSON.stringify(ANSWER)}\n\`\`\``);
expect(parsed.logline).toBe('She escapes.');
- const { direction, missing } = mergeCastAndSetsDirection(null, parsed, { sections, moodImageCount: 4 });
+ const { direction, missing } = mergeCastAndSetsDirection(null, parsed, { sections });
expect(missing).toEqual([]);
expect(direction.sets.map((s) => s.id)).toEqual(['lab-room', 'harbor', 'roof']);
expect(direction.sets[0].sections).toEqual(['Intro']);
@@ -86,7 +88,8 @@ describe('Cast & Sets direction', () => {
expect(direction.songMap).toEqual([{ section: 0, setId: 'harbor' }, { section: 1, setId: 'roof' }]);
expect(direction.tests).toEqual([{ setId: 'lab-room', look: 'Lab', action: 'climbing', caption: '' }]);
expect(direction.overlayConcept).toEqual({ summary: 'A falling meter.', elements: [] });
- expect(direction.moodRefs).toEqual([2]);
+ // Mood board images are never image references, so a stray pick is dropped.
+ expect(direction).not.toHaveProperty('moodRefs');
});
it('refuses a first pass missing the protagonist or enough sets', () => {
@@ -122,15 +125,15 @@ describe('Cast & Sets direction', () => {
it('treats a null field in a revision as no change, and an empty one as a clear', () => {
const { direction: previous } = mergeCastAndSetsDirection(null, parseCastAndSetsResponse(JSON.stringify({ ...ANSWER,
- protagonist: { ...ANSWER.protagonist, gesture: 'wave', rules: ['r1'] }, world: { camera: 'slow dolly' } })), { sections, moodImageCount: 4, medium: 'procedural' });
+ protagonist: { ...ANSWER.protagonist, gesture: 'wave', rules: ['r1'] }, world: { camera: 'slow dolly' } })), { sections, medium: 'procedural' });
const revision = parseCastAndSetsResponse(JSON.stringify({ protagonist: { hair: 'red', gesture: null, rules: null }, world: { camera: null, layout: '' } }));
- const { direction } = mergeCastAndSetsDirection(previous, revision, { sections, moodImageCount: 4, medium: 'procedural' });
+ const { direction } = mergeCastAndSetsDirection(previous, revision, { sections, medium: 'procedural' });
expect(direction.protagonist).toMatchObject({ hair: 'red', gesture: 'wave', rules: ['r1'] });
expect(direction.world).toMatchObject({ camera: 'slow dolly', layout: '' });
});
it('on a revision keeps absent keys, applies present ones, and treats an empty value as a clear', () => {
- const { direction: previous } = mergeCastAndSetsDirection(null, parseCastAndSetsResponse(JSON.stringify({ ...ANSWER, questions: ['Is she right?'], interpretation: 'agents' })), { sections, moodImageCount: 4 });
+ const { direction: previous } = mergeCastAndSetsDirection(null, parseCastAndSetsResponse(JSON.stringify({ ...ANSWER, questions: ['Is she right?'], interpretation: 'agents' })), { sections });
const revision = parseCastAndSetsResponse(JSON.stringify({
protagonist: { hair: 'silver crop' },
questions: [],
@@ -139,7 +142,7 @@ describe('Cast & Sets direction', () => {
looks: 'not a list',
}));
expect(revision).not.toHaveProperty('looks');
- const { direction, missing } = mergeCastAndSetsDirection(previous, revision, { sections, moodImageCount: 4 });
+ const { direction, missing } = mergeCastAndSetsDirection(previous, revision, { sections });
expect(missing).toEqual([]);
expect(direction.protagonist).toMatchObject({ name: 'Nova', hair: 'silver crop', face: 'weathered', rules: ['No hats'] });
expect(direction.looks).toEqual(previous.looks);
@@ -247,7 +250,7 @@ describe('Cast & Sets reusable definitions', () => {
describe('Cast & Sets direct edits', () => {
const saved = mergeCastAndSetsDirection(null, parseCastAndSetsResponse(JSON.stringify(PROCEDURAL_ANSWER)), { sections, medium: 'procedural' }).direction;
- const direction = { ...saved, look: 'flat fills', moodRefs: [0, 2] };
+ const direction = { ...saved, look: 'flat fills' };
it('replaces present fields, keeps absent ones, clears on empty, and reports what changed', () => {
const edited = applyCastAndSetsDirectionEdits(direction, {
@@ -259,8 +262,8 @@ describe('Cast & Sets direct edits', () => {
expect(edited.direction.world).toMatchObject({ camera: 'locked off', layout: direction.world.layout });
expect(edited.direction.sets[0].imageRole).toBe('texture');
expect(edited.direction.sets.slice(1)).toEqual(direction.sets.slice(1));
- // The mood-board picks and photographic look are not touched by an edit.
- expect(edited.direction).toMatchObject({ look: 'flat fills', moodRefs: [0, 2], songMap: direction.songMap });
+ // The photographic look and song map are not touched by an edit.
+ expect(edited.direction).toMatchObject({ look: 'flat fills', songMap: direction.songMap });
expect(edited.changed).toEqual(['palette', 'movement', 'expressions', 'world camera', `${direction.sets[0].name} image role`]);
// Re-saving the same values is no change at all.
expect(applyCastAndSetsDirectionEdits(direction, { world: { camera: direction.world.camera } }, { sections }).changed).toEqual([]);
diff --git a/server/services/musicVideo/castAndSetsPlan.js b/server/services/musicVideo/castAndSetsPlan.js
index 807425858f..8464bdf04f 100644
--- a/server/services/musicVideo/castAndSetsPlan.js
+++ b/server/services/musicVideo/castAndSetsPlan.js
@@ -102,7 +102,6 @@ function buildProceduralImagePlan(direction, { revisionNotes = {} } = {}) {
setId: set.id,
deps: [],
refKeys: [],
- moodRefs: true,
prompt: join(
(PROCEDURAL_ROLE_PROMPTS[role] || PROCEDURAL_ROLE_PROMPTS.background)(set),
set.lighting && `Lighting: ${set.lighting}`,
@@ -118,8 +117,9 @@ function buildProceduralImagePlan(direction, { revisionNotes = {} } = {}) {
/**
* Build the full image plan for a direction: `{ [key]: { key, kind, label,
* prompt, deps, refKeys, setId?, testIndex? } }`. `refKeys` name other plan
- * keys whose image is passed as a reference (in order); `moodRefs` adds the
- * chosen mood-board images. A revision note for a key is appended to its prompt.
+ * keys whose image is passed as a reference (in order): only this project's
+ * own generated images, never mood board images. A revision note for a key is
+ * appended to its prompt.
*/
export function buildCastAndSetsImagePlan(project, direction, { revisionNotes = {} } = {}) {
if (direction.medium === 'procedural') return buildProceduralImagePlan(direction, { revisionNotes });
@@ -137,7 +137,6 @@ export function buildCastAndSetsImagePlan(project, direction, { revisionNotes =
label: 'Character sheet',
deps: [],
refKeys: [],
- moodRefs: true,
prompt: join(
`Photographic character reference sheet of ONE consistent person, ${p.name || 'the protagonist'}: ${p.description || ''}`,
identity(p),
@@ -196,7 +195,6 @@ export function buildCastAndSetsImagePlan(project, direction, { revisionNotes =
setId: set.id,
deps: [],
refKeys: [],
- moodRefs: true,
prompt: join(
'Empty set plate, no people',
set.description,
diff --git a/server/services/musicVideo/castAndSetsService.js b/server/services/musicVideo/castAndSetsService.js
index 55ac20f5fc..ca1e942e66 100644
--- a/server/services/musicVideo/castAndSetsService.js
+++ b/server/services/musicVideo/castAndSetsService.js
@@ -202,20 +202,17 @@ async function runDirection(projectId, { providerId, model, effort, notes = [],
const parsed = parseCastAndSetsResponse(text);
if (!parsed) return fail(projectId, 'The creative direction answer had no usable JSON');
const sections = songSections(project);
- const { direction, missing } = mergeCastAndSetsDirection(notes.length ? previous : null, parsed, { sections, moodImageCount: moodImages.length, medium });
+ const { direction, missing } = mergeCastAndSetsDirection(notes.length ? previous : null, parsed, { sections, medium });
if (missing.length) return fail(projectId, `The creative direction answer is missing: ${missing.join(', ')}`);
// The photographic look every image prompt carries: the mood board's composed
// style, else the project's visual style (never the board's literal places).
direction.look = trimTo(board?.style?.prompt, 500) || trimTo(project.concept?.style, 500) || previous?.look || '';
- // The model picks the mood-board references; with none picked, the first
- // images of the board stand in so the character sheet still has a look.
- const picked = direction.moodRefs.length ? direction.moodRefs : moodImages.map((_, i) => i).slice(0, 3);
- const chosen = picked.map((i) => moodImages[i]).filter(Boolean).map(({ kind, filename }) => ({ kind, filename }));
- return writePlan(projectId, { direction, moodImages: chosen, forceKeys });
+ // Mood board images inform the direction as text only, never as image references.
+ return writePlan(projectId, { direction, forceKeys });
}
/** (Re)build the plan from the stage's direction + accumulated per-image notes, then dispatch. */
-async function writePlan(projectId, { direction = null, moodImages = null, forceKeys = [] } = {}) {
+async function writePlan(projectId, { direction = null, forceKeys = [] } = {}) {
const project = await requireProject(projectId);
const stage = project.castAndSets;
const nextDirection = direction || stage.direction;
@@ -230,7 +227,7 @@ async function writePlan(projectId, { direction = null, moodImages = null, force
const route = codeOnly ? (stage.route || null) : await chooseCastAndSetsRoute(project, { preferred, settings });
if (!route && !codeOnly) return fail(projectId, 'No enabled image backend is allowed for the Cast & Sets images — enable Codex (or another image tool in the brief) and resume');
const out = await mutateProjectRecord(projectId, (current) => setCastAndSetsDirection(current, {
- direction: nextDirection, plan, moodImages, route, renderKeys,
+ direction: nextDirection, plan, route, renderKeys,
}));
console.log(`🎭 Music Video Cast & Sets ${short(projectId)} r${out.stage.revision}: ${renderKeys.length} image(s) to render${route ? ` on ${route.mode}` : ' (code-only, no image backend)'}`);
publish(projectId, out.project);
@@ -248,13 +245,6 @@ function referencePaths(stage, item) {
const path = id ? resolveGalleryImage(id, { mustExist: false }) : null;
if (path) paths.push(path);
}
- if (item.moodRefs) {
- for (const ref of stage.moodImages || []) {
- if (paths.length >= 4) break;
- const path = ref.kind === 'image-ref' ? resolveImageRef(ref.filename, { mustExist: false }) : resolveGalleryImage(ref.filename, { mustExist: false });
- if (path) paths.push(path);
- }
- }
return paths.slice(0, 4);
}
diff --git a/server/services/musicVideo/castAndSetsService.test.js b/server/services/musicVideo/castAndSetsService.test.js
index 60298cdbd2..500ad475a1 100644
--- a/server/services/musicVideo/castAndSetsService.test.js
+++ b/server/services/musicVideo/castAndSetsService.test.js
@@ -319,11 +319,12 @@ describe('Cast & Sets check-in', () => {
expect(prompt).toContain('0. a steamy kitchen — flash photo, brass and steam');
expect(runPrompt.mock.calls[0][0].source).toBe('music-video-cast-sets');
- // First pass: the character sheet (conditioned on the mood image the
- // direction picked) and the empty plates, which depend on nothing.
+ // First pass: the character sheet and the empty plates, which depend on
+ // nothing. Mood board images are outside inspiration: the direction reads
+ // them as text, and no image job is ever conditioned on one.
expect(jobs.map(keyOf).sort()).toEqual(['character', 'set:harbor', 'set:lab', 'set:roof']);
const character = jobs.find((j) => keyOf(j) === 'character');
- expect(character.params.referenceImagePaths.map((p) => p.split(/[\\/]/).pop())).toEqual(['board-b.jpg']);
+ for (const job of jobs) expect(job.params.referenceImagePaths).toBeUndefined();
expect(character.params).toMatchObject({ width: 1536, height: 1024, mode: 'codex', musicVideo: { projectId: project.id } });
expect(character.params.prompt).toMatch(/FRONT, 3\/4, PROFILE, BACK/);
diff --git a/server/services/musicVideo/handoff.js b/server/services/musicVideo/handoff.js
index 490b42c2e0..3d165f3236 100644
--- a/server/services/musicVideo/handoff.js
+++ b/server/services/musicVideo/handoff.js
@@ -2,6 +2,7 @@ import { shotActionPrompt } from '../../lib/musicVideoActionContract.js';
import { shotCameraPrompt } from '../../lib/cameraMovements.js';
import { musicVideoCreativeContext } from '../../lib/musicVideoCreativeContext.js';
import { MOTION_CONTINUITY_CLAUSE } from '../../lib/musicVideoMotion.js';
+import { isOutsideMusicVideoReference } from '../../lib/musicVideoConditioning.js';
/**
* Music Video external-asset handoff (#8965) — provider-neutral export/import
* for tools PortOS does not drive, such as Midjourney.
@@ -117,7 +118,8 @@ export function buildHandoffManifest(project, { now = new Date().toISOString() }
role: ref.role,
label: ref.label,
note: ref.note,
- condition: ref.condition === true,
+ // Outside (mood board / Pinterest) images never condition generation.
+ condition: ref.condition === true && !isOutsideMusicVideoReference(ref),
use: ref.use || 'reference',
filename: ref.imageId,
url: `/data/images/${encodeURIComponent(ref.imageId)}`,
diff --git a/server/services/musicVideo/productionDispatch.test.js b/server/services/musicVideo/productionDispatch.test.js
index 1fc44f5b49..f702c2262c 100644
--- a/server/services/musicVideo/productionDispatch.test.js
+++ b/server/services/musicVideo/productionDispatch.test.js
@@ -48,6 +48,16 @@ describe('production scene dispatch (#9066)', () => {
expect(params.referenceImagePaths[0]).toMatch(/ref-example\.png$/);
});
+ it('never conditions a frame on a mood board import or a Pinterest pin, even when flagged', async () => {
+ const outside = { ...project, visualSpec: { references: [
+ { id: 'mvr-board-1', imageId: 'board-still.png', condition: true },
+ { id: 'picked', imageId: 'pinterest-0123456789abcdef.jpg', condition: true },
+ { id: 'own', imageId: 'ref-example.png', condition: true },
+ ] } };
+ await dispatchProductionStep({ stepKind: 'frame', project: outside, scene, route: { kind: 'image', mode: 'codex', model: null }, tag, settings });
+ expect(enqueueJob.mock.calls[0][0].params.referenceImagePaths.map((path) => basename(path))).toEqual(['ref-example.png']);
+ });
+
it('conditions an approved check-in frame on its character and mapped plate, even beyond the global cap', async () => {
const checkedIn = { ...project,
castAndSets: { status: 'approved', direction: { songMap: [{ section: 0, setId: 'harbor' }, { section: 1, setId: 'roof' }] } },