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

FableLoom scene renders list the canon PortOS adds to the scene's prompt

Claudedf2be2934c78
diff --git a/client/src/components/fableloom/sceneMediaRequests.js b/client/src/components/fableloom/sceneMediaRequests.js
index 6ef49c29fe..5add491ac0 100644
--- a/client/src/components/fableloom/sceneMediaRequests.js
+++ b/client/src/components/fableloom/sceneMediaRequests.js
@@ -9,35 +9,38 @@
* continuity. These builders send authored intent plus the destination tag;
* they never pre-flatten canon into an untyped browser reference list.
*
- * The preset is applied here as well as server-side on purpose: an unlinked
- * loom (no universe reachable from the loom or its series) gets no compiled
- * request back, and the browser preset is the only style it would ever see.
- * The compiler drops style tokens the authored prompt already carries
- * (`stripStyleClause` matched against the same `universeStylePreset` clause,
- * both in server/lib/universeVisualStyle.js), so the linked path does not
- * emit the token list twice — do not fix the overlap by deleting either side.
+ * The browser sends the scene's own text, the loom's style notes and the
+ * camera direction, each listed as a labeled addition (#11317). A linked loom's
+ * universe and series style is the compiler's to add (server-side, from the
+ * same `universeStylePreset`), so it is not prefixed here; an unlinked loom has
+ * no universe style to add.
*/
-import { composeStyledPrompt } from '../../lib/composeStyledPrompt';
import { FABLELOOM_CAMERA_MOVEMENTS } from '../../../../server/lib/fableLoomCameraMovements.js';
import {
asFableLoomRenderPreferences,
asFableLoomRenderSettings,
} from '../../../../server/lib/fableLoomProduction.js';
-const withLoomStyle = (prompt, styleNotes) => {
- const notes = typeof styleNotes === 'string' ? styleNotes.trim() : '';
- return notes ? `${prompt}\n\nStyle: ${notes}` : prompt;
+// The scene's text plus each addition after it, as `{ prompt, promptAdditions }`.
+const withAdditions = (authored, additions) => {
+ const listed = additions.filter((item) => item.text);
+ return {
+ prompt: [authored, ...listed.map((item) => item.text)].filter(Boolean).join('\n\n'),
+ ...(listed.length ? { promptAdditions: listed } : {}),
+ };
+};
+const loomStyle = (loom) => {
+ const notes = typeof loom?.styleNotes === 'string' ? loom.styleNotes.trim() : '';
+ return { id: 'loom-style', label: 'Loom style', text: notes ? `Style: ${notes}` : '' };
};
-export function buildFableLoomImageRequest({ loom, episodeId, node, stylePreset = null }) {
- const authoredPrompt = withLoomStyle((node?.imagePrompt || '').trim(), loom?.styleNotes);
- const styled = composeStyledPrompt(authoredPrompt, '', stylePreset);
+export function buildFableLoomImageRequest({ loom, episodeId, node }) {
+ const composed = withAdditions((node?.imagePrompt || '').trim(), [loomStyle(loom)]);
const render = asFableLoomRenderSettings(loom?.renderSettings);
const preferences = asFableLoomRenderPreferences(loom?.renderSettings);
return {
- prompt: styled.prompt,
- ...(styled.negativePrompt ? { negativePrompt: styled.negativePrompt } : {}),
+ ...composed,
...((preferences.imageMode || preferences.imageModel)
? { mode: preferences.imageMode || 'local' }
: {}),
@@ -49,19 +52,18 @@ export function buildFableLoomImageRequest({ loom, episodeId, node, stylePreset
};
}
-export function buildFableLoomVideoRequest({ loom, episodeId, node, stylePreset = null }) {
+export function buildFableLoomVideoRequest({ loom, episodeId, node }) {
const authoredPrompt = (node?.videoPrompt || '').trim() || (node?.prose || '').trim();
const movement = FABLELOOM_CAMERA_MOVEMENTS.find((move) => move.value === node?.cameraMovement);
const direction = movement?.prompt || (node?.cameraMovement || '').trim();
- const directedPrompt = direction
- ? `${authoredPrompt}\n\nCamera direction: ${direction}`
- : authoredPrompt;
- const styled = composeStyledPrompt(withLoomStyle(directedPrompt, loom?.styleNotes), '', stylePreset);
+ const composed = withAdditions(authoredPrompt, [
+ { id: 'camera-direction', label: 'Camera direction', text: direction ? `Camera direction: ${direction}` : '' },
+ loomStyle(loom),
+ ]);
const render = asFableLoomRenderSettings(loom?.renderSettings);
const preferences = asFableLoomRenderPreferences(loom?.renderSettings);
return {
- prompt: styled.prompt,
- ...(styled.negativePrompt ? { negativePrompt: styled.negativePrompt } : {}),
+ ...composed,
backend: preferences.videoMode || 'local',
...(preferences.videoModel ? { modelId: preferences.videoModel } : {}),
mode: node?.image ? 'image' : 'text',
diff --git a/client/src/components/fableloom/sceneMediaRequests.test.js b/client/src/components/fableloom/sceneMediaRequests.test.js
index 916a47273a..1f5746059e 100644
--- a/client/src/components/fableloom/sceneMediaRequests.test.js
+++ b/client/src/components/fableloom/sceneMediaRequests.test.js
@@ -4,15 +4,16 @@ import { buildFableLoomImageRequest, buildFableLoomVideoRequest } from './sceneM
const loom = { id: 'loom-1', styleNotes: 'cool rim light' };
describe('FableLoom scene media request composition', () => {
- it('prefixes the canonical universe style and carries its avoid list into image generation', () => {
+ // Uniquely catches the browser copying canon style into the scene's prompt again, or
+ // adding the loom's style without listing it (#11317): the compiler adds universe style.
+ it('sends the scene\'s text and lists the loom style it adds', () => {
expect(buildFableLoomImageRequest({
loom,
episodeId: 'ep-1',
node: { id: 'node-1', imagePrompt: 'a scout wakes in alien grass' },
- stylePreset: { prompt: 'painted graphic novel', negativePrompt: 'photorealism' },
})).toEqual({
- prompt: 'painted graphic novel. a scout wakes in alien grass\n\nStyle: cool rim light',
- negativePrompt: 'photorealism',
+ prompt: 'a scout wakes in alien grass\n\nStyle: cool rim light',
+ promptAdditions: [{ id: 'loom-style', label: 'Loom style', text: 'Style: cool rim light' }],
width: 1024,
height: 576,
fableLoom: { loomId: 'loom-1', episodeId: 'ep-1', nodeId: 'node-1' },
@@ -67,10 +68,12 @@ describe('FableLoom scene media request composition', () => {
cameraMovement: 'slow-dolly-in',
image: 'scene.png',
},
- stylePreset: { prompt: 'painted graphic novel', negativePrompt: 'photorealism' },
})).toEqual({
- prompt: 'painted graphic novel. One continuous reveal.\n\nCamera direction: Camera slowly moves forward toward the subject.\n\nStyle: cool rim light',
- negativePrompt: 'photorealism',
+ prompt: 'One continuous reveal.\n\nCamera direction: Camera slowly moves forward toward the subject.\n\nStyle: cool rim light',
+ promptAdditions: [
+ { id: 'camera-direction', label: 'Camera direction', text: 'Camera direction: Camera slowly moves forward toward the subject.' },
+ { id: 'loom-style', label: 'Loom style', text: 'Style: cool rim light' },
+ ],
backend: 'local',
mode: 'image',
sourceImageFile: 'scene.png',
diff --git a/client/src/pages/FableLoomStory.jsx b/client/src/pages/FableLoomStory.jsx
index 0827363052..299f4d73ac 100644
--- a/client/src/pages/FableLoomStory.jsx
+++ b/client/src/pages/FableLoomStory.jsx
@@ -47,7 +47,6 @@ import { fieldClass, labelClass } from '../components/fableloom/fieldStyles';
import {
buildFableLoomImageRequest, buildFableLoomVideoRequest,
} from '../components/fableloom/sceneMediaRequests';
-import { universeStylePreset } from '../lib/universeStylePreset';
import { fableLoomMediaReadiness } from '../lib/fableLoomReadiness';
import { buildFalH3MaxPrompt } from '../lib/falVideoHandoff';
import { LOOM_ORIENTATION, LOOM_STACK_WIDTH } from '../lib/loomLayout';
@@ -170,10 +169,6 @@ export default function FableLoomStory({ view = 'graph' }) {
: styleContextUnavailable
? 'Linked universe style is unavailable'
: '';
- const sceneStylePreset = useMemo(
- () => universeStylePreset(linkedUniverse, linkedSeries),
- [linkedSeries, linkedUniverse],
- );
const episode = seriesPlanOpen ? null : loom?.episodes.find((e) => e.id === episodeId) || null;
const node = episode?.nodes.find((n) => n.id === nodeId) || null;
@@ -269,7 +264,6 @@ export default function FableLoomStory({ view = 'graph' }) {
loom,
episodeId,
node: targetNode,
- stylePreset: sceneStylePreset,
});
const queued = await generateImage(imageRequest, { silent: true })
.catch((err) => {
@@ -308,7 +302,7 @@ export default function FableLoomStory({ view = 'graph' }) {
});
toast.success('Scene image queued');
return queued;
- }, [applySceneMedia, episode, episodeId, generationDisabledReason, loom, mediaReadiness.reason, mediaWorkflowBlocked, sceneStylePreset, setSceneMediaJob, styleContextLoading, styleContextUnavailable]);
+ }, [applySceneMedia, episode, episodeId, generationDisabledReason, loom, mediaReadiness.reason, mediaWorkflowBlocked, setSceneMediaJob, styleContextLoading, styleContextUnavailable]);
const queueSceneVideo = useCallback(async (targetNode) => {
const prompt = (targetNode?.videoPrompt || '').trim() || (targetNode?.prose || '').trim();
@@ -327,7 +321,7 @@ export default function FableLoomStory({ view = 'graph' }) {
setSceneMediaJob(targetNode.id, 'video', { jobId: null, status: 'submitting', progress: 0 });
const queued = await generateVideo(buildFableLoomVideoRequest({
- loom, episodeId, node: targetNode, stylePreset: sceneStylePreset,
+ loom, episodeId, node: targetNode,
})).catch((err) => {
setSceneMediaJob(targetNode.id, 'video', {
jobId: null, status: 'failed', progress: 0, error: err.message || 'Could not start the render',
@@ -348,7 +342,7 @@ export default function FableLoomStory({ view = 'graph' }) {
});
toast.success('Scene video queued');
return queued;
- }, [episodeId, generationDisabledReason, loom, mediaReadiness.reason, mediaWorkflowBlocked, sceneStylePreset, setSceneMediaJob, styleContextLoading, styleContextUnavailable]);
+ }, [episodeId, generationDisabledReason, loom, mediaReadiness.reason, mediaWorkflowBlocked, setSceneMediaJob, styleContextLoading, styleContextUnavailable]);
const automateFalSceneVideo = useCallback(async (targetNode) => {
const prompt = (targetNode?.videoPrompt || '').trim() || (targetNode?.prose || '').trim();
@@ -369,7 +363,7 @@ export default function FableLoomStory({ view = 'graph' }) {
return null;
}
const request = buildFableLoomVideoRequest({
- loom, episodeId, node: targetNode, stylePreset: sceneStylePreset,
+ loom, episodeId, node: targetNode,
});
const fullPrompt = buildFalH3MaxPrompt(request.prompt, request.negativePrompt);
const render = asFableLoomRenderSettings(loom?.renderSettings);
@@ -399,7 +393,7 @@ export default function FableLoomStory({ view = 'graph' }) {
setSceneMediaJob(targetNode.id, 'video', { ...queued, jobId: queued.id });
toast.success(queued.status === 'queued' ? 'fal.ai scene video queued' : 'fal.ai scene video already running');
return queued;
- }, [episodeId, generationDisabledReason, loom, mediaReadiness.reason, mediaWorkflowBlocked, sceneStylePreset, setSceneMediaJob, styleContextLoading, styleContextUnavailable]);
+ }, [episodeId, generationDisabledReason, loom, mediaReadiness.reason, mediaWorkflowBlocked, setSceneMediaJob, styleContextLoading, styleContextUnavailable]);
const basePath = `/fableloom/${loomId}`;
const episodePath = useCallback(
diff --git a/client/src/pages/FableLoomStory.test.jsx b/client/src/pages/FableLoomStory.test.jsx
index f0d1a4008a..a73f47534c 100644
--- a/client/src/pages/FableLoomStory.test.jsx
+++ b/client/src/pages/FableLoomStory.test.jsx
@@ -386,7 +386,7 @@ describe('FableLoomStory scene media lifecycle', () => {
expect(await screen.findByRole('button', { name: 'Canvas generate image' })).toBeDisabled();
});
- it('queues with canonical universe style and notifies when the render later fails', async () => {
+ it('queues a linked scene for the compiler to style and notifies when the render later fails', async () => {
const user = userEvent.setup();
api.getLoom.mockResolvedValue(loom({
universeId: 'universe-1',
@@ -413,8 +413,9 @@ describe('FableLoomStory scene media lifecycle', () => {
await waitFor(() => expect(api.generateImage).toHaveBeenCalledTimes(1));
expect(api.generateImage).toHaveBeenCalledWith({
- prompt: 'painted ink. an ancient gate in alien grass\n\nStyle: blue dusk lighting',
- negativePrompt: 'photorealism',
+ // The server's compiler adds the universe style ("painted ink") and its avoid list.
+ prompt: 'an ancient gate in alien grass\n\nStyle: blue dusk lighting',
+ promptAdditions: [{ id: 'loom-style', label: 'Loom style', text: 'Style: blue dusk lighting' }],
width: 1024,
height: 576,
fableLoom: { loomId: 'loom-1', episodeId: 'ep-1', nodeId: 'node-1' },
diff --git a/server/lib/fableLoomVisualPrompts.js b/server/lib/fableLoomVisualPrompts.js
index feb017367d..b6d09ddcd9 100644
--- a/server/lib/fableLoomVisualPrompts.js
+++ b/server/lib/fableLoomVisualPrompts.js
@@ -5,6 +5,7 @@
*/
import { ServerError } from './errorHandler.js';
+import { promptAddition } from './modelInput.js';
import { REACTOR_MAX_PROMPT_LENGTH } from './reactorVideoClip.js';
import {
mergeNegativePromptTokens, stripStyleClause, universeStylePreset, universeVisualStyleTokens,
@@ -25,7 +26,15 @@ const visualPromptForCharacter = (character, appearance, triggerWords) => {
]).join('. ');
};
-/** Compose prompts from already resolved bindings and allocated references, without I/O or mutation. */
+// One labeled block of the composed prompt (#11317), or null when it adds nothing.
+const block = (id, label, value) => promptAddition(id, label, value || '');
+const joinBlocks = (blocks, separator) => blocks.filter(Boolean).map((item) => item.text).join(separator);
+
+/**
+ * Compose prompts from already resolved bindings and allocated references, without I/O or mutation.
+ * Returns `{ prompt, negativePrompt, promptAdditions }`: the scene's own text plus each
+ * block the compiler adds around it, listed so the render shows what was added (#11317).
+ */
export function buildFableLoomVisualPrompts({
node, universe, series, bindings, references, temporalSourceNode,
adapterTriggerWords, kind, capability, authoredPrompt, authoredNegativePrompt,
@@ -41,17 +50,12 @@ export function buildFableLoomVisualPrompts({
`Object: ${object.name}`, object.description, object.significance,
]).join('. '));
// Curated visual tokens only — `universe.styleNotes` is writing-stage
- // direction (see lib/universeVisualStyle.js). The browser composes this same
- // preset (universe embrace tokens PLUS the series style override, in
- // whichever mode the series is set to) onto the scene prompt before
- // POSTing, so build the identical clause here and strip ITS copy rather
- // than emitting the tokens again: the clause below leads the prompt, and
- // only a leading copy gets the early-token weighting a diffusion model
- // gives style. Using the shared `universeStylePreset` (not just the raw
- // embrace tokens) is what keeps a series override — prepend, append, or
- // override — in sync between the FableLoom preview and the actual render
- // (#8442); the plain embrace-only clause never matched an authored prompt
- // that led with an override.
+ // direction (see lib/universeVisualStyle.js). The shared `universeStylePreset`
+ // keeps a series override (prepend, append or override) the same here and in
+ // the browser's preview (#8442). The browser no longer prefixes this clause
+ // to the scene's text (#11317); a request from a client before that, or a
+ // production asset saved with it, still leads with the same clause, and only
+ // that exact leading copy is dropped so the style is not sent twice.
const universeStyle = universeStylePreset(universe, series)?.prompt || '';
const authoredBody = stripStyleClause(authoredPrompt, universeStyle);
const protagonistName = (universe.characters || []).find((character) => character.id === bindings.protagonistId)?.name || 'the canonical protagonist';
@@ -61,44 +65,61 @@ export function buildFableLoomVisualPrompts({
? `Framing constraint: keep ${protagonistName} off-screen. Show the explicitly bound cast (${visibleCast.join(', ')}) in the authored composition. Their close-ups remain visible even while the protagonist speaks off-screen; do not replace them with an empty environment. Do not show ${protagonistName} or a standalone communicator.`
: `Framing constraint: ${protagonistName}, the canonical protagonist, is speaking through the communicator off-screen. The camera is the remote witness: show the obstacle or environment the protagonist cannot see around a corner, beyond a bend, at a distance, or otherwise outside their sightline. The communicator stays on the protagonist's person and completely out of frame; never use a standalone comms device as the subject. Do not show their face, body, silhouette, or duplicate presence in this storyboard image.`
: '';
- let positive = compact([
- universeStyle && `Universe style: ${universeStyle}`,
- placePrompt, ...characterPrompts, ...objectPrompts,
- protagonistFraming,
- 'Presentation: no subtitles, captions, dialogue lettering, speech balloons, or text overlays. Dialogue is spoken audio only; never draw the script into the image.',
- node.shot?.framing && `Current camera framing: ${node.shot.framing}`,
- kind === 'image' && references.some((asset) => asset.role === 'temporal-predecessor') && (
+ const authored = text(authoredBody) || text(kind === 'video' ? node.videoPrompt || node.prose : node.imagePrompt);
+ let blocks = [
+ block('universe-style', 'Universe style', universeStyle && `Universe style: ${universeStyle}`),
+ block('environment', 'Environment', placePrompt),
+ ...characterPrompts.map((value, index) => block(`character-${index + 1}`, `Character: ${bindings.boundCharacters[index].character.name}`, value)),
+ ...objectPrompts.map((value, index) => block(`object-${index + 1}`, `Object: ${bindings.boundObjects[index].name}`, value)),
+ block('framing-constraint', 'Off-screen protagonist', protagonistFraming),
+ block('presentation', 'No on-screen text', 'Presentation: no subtitles, captions, dialogue lettering, speech balloons, or text overlays. Dialogue is spoken audio only; never draw the script into the image.'),
+ block('camera-framing', 'Camera framing', node.shot?.framing && `Current camera framing: ${node.shot.framing}`),
+ block('continuity-reference', 'Previous image continuity', kind === 'image' && references.some((asset) => asset.role === 'temporal-predecessor') && (
node.shot?.dramaticSceneId && node.shot.dramaticSceneId === temporalSourceNode?.shot?.dramaticSceneId
? `Same dramatic scene: use the preceding image as the set continuity reference. Preserve room geometry, window and doorway positions, furniture, props, lighting, wardrobe, character positions and screen direction. Apply the current camera framing with physically plausible parallax; do not redesign the room or copy the previous composition when a new angle is specified. Previous framing: ${temporalSourceNode.shot.framing || 'see reference'}.`
: 'The preceding image is temporal context. Preserve recurring identities and props, but follow the current authored location and camera framing; do not copy the previous location across an intentional scene change.'
- ),
- references.filter((asset) => asset.role === 'character-draft-reference').map((asset) => {
+ )),
+ block('character-references', 'Character references', references.filter((asset) => asset.role === 'character-draft-reference').map((asset) => {
const character = bindings.boundCharacters.find((binding) => binding.character.id === asset.bindingId)?.character;
return `Character reference ${asset.filename}: preserve ${character?.name || 'the bound character'} identity, face, hair or fur, clothing and accessories. Use the authored shot for staging; do not copy reference scene events or other figures.`;
- }).join('\n'),
- authoredBody || (kind === 'video' ? node.videoPrompt || node.prose : node.imagePrompt),
- kind === 'video' && node.shot && `Shot duration: ${node.shot.durationSeconds} seconds. Play only this shot's current script, preserving each named speaker's voice: ${node.prose}`,
- node.visualCanon?.shotNotes && `Shot continuity: ${node.visualCanon.shotNotes}`,
- ]).join('\n\n').slice(0, 8000);
+ }).join('\n')),
+ authored ? { authored: true, text: authored } : null,
+ block('shot-script', 'Shot length and script', kind === 'video' && node.shot && `Shot duration: ${node.shot.durationSeconds} seconds. Play only this shot's current script, preserving each named speaker's voice: ${node.prose}`),
+ block('shot-continuity', 'Shot continuity', node.visualCanon?.shotNotes && `Shot continuity: ${node.visualCanon.shotNotes}`),
+ ];
+ let separator = '\n\n';
if (kind === 'video' && capability.backend === 'reactor') {
if (!references.some((asset) => asset.role === 'storyboard-first-frame')) throw new ServerError('Review and approve the current storyboard reference before rendering with Reactor.', { status: 422, code: 'FABLELOOM_REACTOR_REFERENCE_REQUIRED' });
- positive = compact([
- 'Animate this reference as one continuous shot. Preserve its cast, room, props, lighting and screen direction. No subtitles, captions, speech balloons or text overlays. Dialogue is audio only.',
- node.shot?.framing,
- authoredBody || node.videoPrompt,
- node.prose && `Script: ${node.prose}`,
- node.visualCanon?.shotNotes,
- bindings.protagonistPresence === 'offscreen' && `Keep ${protagonistName} off-screen.`,
- ]).join('\n');
- if (positive.length > REACTOR_MAX_PROMPT_LENGTH) throw new ServerError(`Reactor requires a complete shot prompt within ${REACTOR_MAX_PROMPT_LENGTH} characters. Shorten the shot direction or split the dialogue; no render was queued.`, { status: 422, code: 'FABLELOOM_REACTOR_PROMPT_TOO_LONG' });
+ const reactorAuthored = text(authoredBody) || text(node.videoPrompt);
+ blocks = [
+ block('reactor-animate', 'Animate the storyboard', 'Animate this reference as one continuous shot. Preserve its cast, room, props, lighting and screen direction. No subtitles, captions, speech balloons or text overlays. Dialogue is audio only.'),
+ block('camera-framing', 'Camera framing', node.shot?.framing),
+ reactorAuthored ? { authored: true, text: reactorAuthored } : null,
+ block('shot-script', 'Script', node.prose && `Script: ${node.prose}`),
+ block('shot-continuity', 'Shot continuity', node.visualCanon?.shotNotes),
+ block('framing-constraint', 'Off-screen protagonist', bindings.protagonistPresence === 'offscreen' && `Keep ${protagonistName} off-screen.`),
+ ];
+ separator = '\n';
+ }
+ const positive = joinBlocks(blocks, separator);
+ // The model's own limit: refused with the count, never cut (#11317).
+ if (kind === 'video' && capability.backend === 'reactor' && positive.length > REACTOR_MAX_PROMPT_LENGTH) {
+ throw new ServerError(`Reactor requires a complete shot prompt within ${REACTOR_MAX_PROMPT_LENGTH} characters (this one is ${positive.length}). Shorten the shot direction or split the dialogue; no render was queued.`, { status: 422, code: 'FABLELOOM_REACTOR_PROMPT_TOO_LONG' });
}
const identityAvoid = bindings.boundCharacters.flatMap(({ character }) => character.identityPack?.avoid || []);
- const negativePrompt = mergeNegativePromptTokens([
- authoredNegativePrompt,
+ const addedAvoid = [
'subtitles, captions, dialogue lettering, speech balloons, text overlays',
bindings.protagonistPresence === 'offscreen' ? `visible ${protagonistName}, ${protagonistName} face, ${protagonistName} body, ${protagonistName} silhouette, standalone communicator, comms device close-up, radio prop hero shot` : '',
universeVisualStyleTokens(universe).avoid,
identityAvoid,
- ]).join(', ').slice(0, 8000);
- return { prompt: positive, negativePrompt };
+ ];
+ const merged = mergeNegativePromptTokens([authoredNegativePrompt, ...addedAvoid]);
+ const negativePrompt = merged.join(', ');
+ // The authored negative leads the merge, so what follows it is what the compiler added.
+ const avoid = merged.slice(mergeNegativePromptTokens([authoredNegativePrompt]).length).join(', ');
+ return {
+ prompt: positive,
+ negativePrompt,
+ promptAdditions: [...blocks.filter((item) => item && !item.authored), block('canon-avoid', 'Added to the negative prompt', avoid)].filter(Boolean),
+ };
}
diff --git a/server/routes/imageGen.js b/server/routes/imageGen.js
index f21c5f3cc5..18fe0a54e6 100644
--- a/server/routes/imageGen.js
+++ b/server/routes/imageGen.js
@@ -533,6 +533,8 @@ router.post('/generate', imageGenUploads, asyncHandler(async (req, res) => {
if (compiled) {
params.prompt = compiled.prompt;
params.negativePrompt = compiled.negativePrompt;
+ // The compiler's canon blocks, listed beside what the scene's own request listed (#11317).
+ if (compiled.promptAdditions?.length) params.promptAdditions = [...(params.promptAdditions || []), ...compiled.promptAdditions];
params.referenceImagePaths = compiled.referenceImagePaths;
params.referenceImageStrengths = compiled.referenceImageStrengths;
params.loraFilenames = compiled.loraFilenames;
diff --git a/server/services/fableLoom/production.js b/server/services/fableLoom/production.js
index e5090793e1..6ec29cefff 100644
--- a/server/services/fableLoom/production.js
+++ b/server/services/fableLoom/production.js
@@ -541,6 +541,7 @@ async function prepareImageJob(run, asset) {
params: {
pythonPath: local.pythonPath,
prompt: conditioned?.prompt || asset.prompt,
+ ...(conditioned?.promptAdditions?.length ? { promptAdditions: conditioned.promptAdditions } : {}),
negativePrompt: conditioned?.negativePrompt || '',
modelId: local.selectedModel.id,
width: geometry.width,
@@ -583,6 +584,7 @@ async function prepareImageJob(run, asset) {
mode,
...providerParams,
prompt: conditioned?.prompt || asset.prompt,
+ ...(conditioned?.promptAdditions?.length ? { promptAdditions: conditioned.promptAdditions } : {}),
negativePrompt: conditioned?.negativePrompt || '',
width: geometry.width,
height: geometry.height,
@@ -648,6 +650,7 @@ async function prepareVideoJob(run, asset) {
params: {
pythonPath: settings.imageGen?.local?.pythonPath || null,
prompt: conditioned?.prompt || asset.prompt,
+ ...(conditioned?.promptAdditions?.length ? { promptAdditions: conditioned.promptAdditions } : {}),
negativePrompt: conditioned?.negativePrompt || '',
modelId: model.id,
width: geometry.width,
@@ -675,6 +678,7 @@ async function prepareVideoJob(run, asset) {
// The compiler owns prompt compaction; never truncate dialogue at this boundary.
const request = validateReactorRequest({
prompt: conditioned?.prompt || asset.prompt,
+ ...(conditioned?.promptAdditions?.length ? { promptAdditions: conditioned.promptAdditions } : {}),
seconds: replayParameters.seconds ?? node?.shot?.durationSeconds ?? 6,
seed: replayParameters.seed,
});
@@ -700,6 +704,7 @@ async function prepareVideoJob(run, asset) {
mode: VIDEO_GEN_MODE.FAL,
videoMode: sourceImagePath ? 'image' : 'text',
prompt: conditioned?.prompt || asset.prompt,
+ ...(conditioned?.promptAdditions?.length ? { promptAdditions: conditioned.promptAdditions } : {}),
negativePrompt: conditioned?.negativePrompt || '',
...replayParameters,
sourceImagePath,
@@ -729,6 +734,7 @@ async function prepareVideoJob(run, asset) {
videoMode: sourceImagePath ? 'image' : 'text',
...cloud.providerParams,
prompt: conditioned?.prompt || asset.prompt,
+ ...(conditioned?.promptAdditions?.length ? { promptAdditions: conditioned.promptAdditions } : {}),
negativePrompt: conditioned?.negativePrompt || '',
width: geometry.width,
height: geometry.height,
diff --git a/server/services/fableLoom/visualConditioning.js b/server/services/fableLoom/visualConditioning.js
index cfa3bc1fd9..ba085467ba 100644
--- a/server/services/fableLoom/visualConditioning.js
+++ b/server/services/fableLoom/visualConditioning.js
@@ -330,7 +330,7 @@ export async function compileFableLoomVisualRequest({
failures.push('required canon assets exceed or are unsupported by the backend capability manifest');
}
- const { prompt: positive, negativePrompt } = buildFableLoomVisualPrompts({
+ const { prompt: positive, negativePrompt, promptAdditions } = buildFableLoomVisualPrompts({
node, universe, series, bindings, references: allocation.accepted, temporalSourceNode: temporal.node,
adapterTriggerWords, kind, capability, authoredPrompt, authoredNegativePrompt,
});
@@ -370,6 +370,7 @@ export async function compileFableLoomVisualRequest({
return {
prompt: positive,
negativePrompt,
+ promptAdditions,
referenceImagePaths: allocation.accepted.map((asset) => asset.path),
referenceImageStrengths: allocation.accepted.map((asset) => asset.role === 'temporal-predecessor' ? 0.4 : 1),
loraFilenames: adapters.map((adapter) => adapter.filename),
diff --git a/server/services/fableLoom/visualConditioning.test.js b/server/services/fableLoom/visualConditioning.test.js
index 91836156fe..7d84a6cbdb 100644
--- a/server/services/fableLoom/visualConditioning.test.js
+++ b/server/services/fableLoom/visualConditioning.test.js
@@ -98,6 +98,12 @@ describe('FableLoom visual conditioning compiler', () => {
'A cautious arrival',
].join('\n\n'));
expect(result.negativePrompt).toBe('subtitles, captions, dialogue lettering, speech balloons, text overlays, photoreal, gore, wrong aria face');
+ // Every block around the scene's text is listed for the render's chips (#11317).
+ expect(result.promptAdditions.map((item) => item.label)).toEqual([
+ 'Universe style', 'Environment', 'Character: Aria', 'Object: Compass', 'No on-screen text',
+ 'Previous image continuity', 'Added to the negative prompt',
+ ]);
+ expect(result.promptAdditions.at(-1).text).toBe(result.negativePrompt);
expect(result.visualConditioning.compiledPrompt).toBe(result.prompt);
expect(result.visualConditioning.compiledNegativePrompt).toBe(result.negativePrompt);
expect(result.visualConditioning).toMatchObject({
@@ -111,6 +117,18 @@ describe('FableLoom visual conditioning compiler', () => {
expect(JSON.stringify(result.visualConditioning)).not.toContain('/approved/');
});
+ // Uniquely catches the compiler cutting a long scene prompt instead of sending it whole (#11317).
+ it('sends a long scene prompt whole', async () => {
+ const loom = loomWith(lockedBinding);
+ const authoredPrompt = 'a long careful shot description. '.repeat(400);
+ const result = await compileFableLoomVisualRequest({
+ tag: { loomId: loom.id, episodeId: 'episode-1', nodeId: 'shot' }, kind: 'image',
+ capability: fableLoomImageCapabilities({ mode: 'codex', inputBudget: 6 }), authoredPrompt, ...deps(loom),
+ });
+ expect(result.prompt.length).toBeGreaterThan(8000);
+ expect(result.prompt.endsWith(authoredPrompt.trim())).toBe(true);
+ });
+
it('keeps a shared set across camera cuts without carrying that room into another scene', async () => {
const loom = loomWith(lockedBinding);
const [previous, current] = loom.episodes[0].nodes;
diff --git a/server/services/videoGen/submitJob.js b/server/services/videoGen/submitJob.js
index 6d73fe5413..2a18889fa9 100644
--- a/server/services/videoGen/submitJob.js
+++ b/server/services/videoGen/submitJob.js
@@ -199,6 +199,7 @@ const submitValidatedVideoGenJob = async (body, uploads) => {
if (compiled) {
body.prompt = compiled.prompt;
body.negativePrompt = compiled.negativePrompt;
+ if (compiled.promptAdditions?.length) body.promptAdditions = [...(body.promptAdditions || []), ...compiled.promptAdditions];
if (prepared.sourceImagePath && !compiled.sourceImagePath) {
await prepared.discardSourceImage();
prepared.uploadedTempPath = null;