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

List the style blocks mood board, universe, pipeline, deck and character sheet renders add

Claude7469fb087f36
diff --git a/server/lib/deckTemplates.js b/server/lib/deckTemplates.js
index 503e2ed43c..6e1b04b0bd 100644
--- a/server/lib/deckTemplates.js
+++ b/server/lib/deckTemplates.js
@@ -371,7 +371,18 @@ export function composeCardRenderPrompt(deck, card) {
const identityNegative = identity ? 'wrong card rank, wrong card suit, incorrect pip count, missing pips, extra pips, extra suit symbols, suit symbols in the border or background, pips disguised as scene objects' : '';
const cardNegative = [trimmed(card?.negativePrompt), orientationNegative, identityNegative].filter(Boolean).join(', ');
const composed = composeStyledPrompt(body, cardNegative, { prompt: style, negativePrompt: avoid });
- return { ...composed, parts: { style, layout, orientation, subject } };
+ // The deck's blocks around the card's own words, for the render's sent-prompt
+ // record (#11317). The card's own negative is the user's text, so it is not one.
+ const promptAdditions = [
+ ['deck-style', 'Deck style', style],
+ ['deck-layout', 'Deck layout', layout],
+ ['card-orientation', 'Card orientation', orientation],
+ ['card-identity', 'Card identity', identity],
+ ['deck-avoid', 'Deck avoid (negative prompt)', avoid],
+ ['card-orientation-negatives', 'Card orientation negatives', orientationNegative],
+ ['card-identity-negatives', 'Card identity negatives', identityNegative],
+ ].filter(([, , text]) => text).map(([id, label, text]) => ({ id, label, text }));
+ return { ...composed, promptAdditions, parts: { style, layout, orientation, subject } };
}
const IN_FLIGHT_RENDER = new Set(['queued', 'running']);
diff --git a/server/lib/deckTemplates.test.js b/server/lib/deckTemplates.test.js
index f453b55671..a1dd3a9087 100644
--- a/server/lib/deckTemplates.test.js
+++ b/server/lib/deckTemplates.test.js
@@ -57,6 +57,12 @@ describe('composeCardRenderPrompt', () => {
orientation: '',
subject: 'XVII · The Star: a kneeling figure',
});
+ // The queued render lists the deck's blocks, never the card's own negative (#11317).
+ expect(out.promptAdditions).toEqual([
+ { id: 'deck-style', label: 'Deck style', text: 'copperplate engraving, aged paper' },
+ { id: 'deck-layout', label: 'Deck layout', text: 'Full tarot card, framed border' },
+ { id: 'deck-avoid', label: 'Deck avoid (negative prompt)', text: 'blurry' },
+ ]);
});
it('spells out the standard two-way rotation so a six cannot become a nine', () => {
diff --git a/server/services/deckRender.js b/server/services/deckRender.js
index 760aebec73..eeba813f1a 100644
--- a/server/services/deckRender.js
+++ b/server/services/deckRender.js
@@ -81,10 +81,11 @@ export async function renderDeckCards(deckId, { cardIds, onlyMissing = false, mo
const jobs = [];
const stamps = [];
for (const card of targets) {
- const { prompt, negativePrompt } = composeCardRenderPrompt(deck, card);
+ const { prompt, negativePrompt, promptAdditions } = composeCardRenderPrompt(deck, card);
const base = {
prompt,
negativePrompt: negativePrompt || undefined,
+ ...(promptAdditions.length ? { promptAdditions } : {}),
width: deck.cardSize.width,
height: deck.cardSize.height,
...(seed != null ? { seed } : {}),
diff --git a/server/services/moodBoard/renderItem.js b/server/services/moodBoard/renderItem.js
index d432247a21..a2f55dba5a 100644
--- a/server/services/moodBoard/renderItem.js
+++ b/server/services/moodBoard/renderItem.js
@@ -14,12 +14,12 @@
import { ServerError } from '../../lib/errorHandler.js';
import { QUEUEABLE_IMAGE_MODES } from '../../lib/generationModes.js';
import { isNonBlankStr } from '../../lib/textUtils.js';
+import { promptAddition } from '../../lib/modelInput.js';
import { emitRecordUpdated } from '../sharing/recordEvents.js';
import * as store from './db.js';
export const MOOD_BOARD_RENDER_TAG = 'moodBoardRender';
const RENDER_SIZE = Object.freeze({ width: 1024, height: 1024 });
-const PROMPT_MAX = 8000;
// Overridable for tests (queue, settings and socket are process singletons).
const deps = {
@@ -33,12 +33,21 @@ const deps = {
};
export const __setDepsForTests = (overrides) => Object.assign(deps, overrides);
-/** The image prompt for a note: its words, then the board's composed look. */
+/**
+ * The image prompt for a note: its words, then the board's composed look, sent
+ * whole, with each block PortOS adds listed as a labeled addition (#11317).
+ */
function buildItemRenderPrompt(board, item) {
const text = String(item?.text || '').trim();
const style = isNonBlankStr(board?.style?.prompt) ? board.style.prompt.trim() : '';
const subject = `Mood board reference image: ${text}`;
- return (style ? `${subject}\n\nVisual style: ${style}` : subject).slice(0, PROMPT_MAX);
+ return {
+ prompt: style ? `${subject}\n\nVisual style: ${style}` : subject,
+ promptAdditions: [
+ promptAddition('mood-board-note', 'Mood board reference', 'Mood board reference image: [note]'),
+ promptAddition('board-style', 'Board style', style && `Visual style: ${style}`),
+ ].filter(Boolean),
+ };
}
/** Job params for the chosen backend: a cloud provider bag, or the local model. */
@@ -96,12 +105,13 @@ export async function renderBoardItem(boardId, itemId, route = {}) {
options: route,
});
- const prompt = buildItemRenderPrompt(board, claimed);
+ const { prompt, promptAdditions } = buildItemRenderPrompt(board, claimed);
const negativePrompt = isNonBlankStr(board.style?.negativePrompt) ? board.style.negativePrompt.trim() : undefined;
let jobId;
try {
const params = await prepareBoardRenderParams(route, {
prompt,
+ promptAdditions,
...(negativePrompt ? { negativePrompt } : {}),
width: route.width ?? RENDER_SIZE.width,
height: route.height ?? RENDER_SIZE.height,
diff --git a/server/services/moodBoard/renderItem.test.js b/server/services/moodBoard/renderItem.test.js
index e1c7e871f1..ccbd958d1e 100644
--- a/server/services/moodBoard/renderItem.test.js
+++ b/server/services/moodBoard/renderItem.test.js
@@ -55,6 +55,17 @@ describe('renderBoardItem', () => {
expect(emit).toHaveBeenCalledWith({ boardId: 'mb-1', itemId: 'n1', status: 'queued' });
});
+ // Uniquely catches the board look reaching the model unlisted, or a long note cut (#11317).
+ it('sends a long note whole and lists the blocks PortOS adds', async () => {
+ const long = 'x'.repeat(9000);
+ store.claimBoardItemRender.mockImplementationOnce(async () => ({ ...note, text: long, render: { status: 'queued', jobId: null } }));
+ enqueue.mockResolvedValueOnce({ jobId: 'job-2' });
+ await renderBoardItem('mb-1', 'n1');
+ const { params } = enqueue.mock.calls[0][0];
+ expect(params.prompt).toBe(`Mood board reference image: ${long}\n\nVisual style: neon chiaroscuro`);
+ expect(params.promptAdditions.map((item) => item.label)).toEqual(['Mood board reference', 'Board style']);
+ });
+
it('marks the note failed instead of leaving it rendering when the backend refuses', async () => {
imageParams.mockRejectedValueOnce(new Error('The external image backend cannot render board notes'));
await expect(renderBoardItem('mb-1', 'n1')).rejects.toThrow('cannot render board notes');
diff --git a/server/services/pipeline/visualStageHelpers.js b/server/services/pipeline/visualStageHelpers.js
index 290283a2dc..0df828da3d 100644
--- a/server/services/pipeline/visualStageHelpers.js
+++ b/server/services/pipeline/visualStageHelpers.js
@@ -19,6 +19,7 @@ import { buildScenePrompt, buildPlaceByKey, matchScenePlace } from '../../lib/sc
import { composeStyledPrompt } from '../../lib/composeStyledPrompt.js';
import { buildVisualStyleClause, mergeNegativePromptTokens } from '../../lib/universeVisualStyle.js';
import { loraCompatKey } from '../../lib/runners.js';
+import { promptAddition } from '../../lib/modelInput.js';
import { resolveCharacterLoras } from '../characterLoraResolver.js';
import { pickCanon } from './seriesCanon.js';
import { IMAGE_GEN_MODE } from '../imageGen/modes.js';
@@ -229,13 +230,26 @@ const enqueueImageJob = async ({ prompt, world, settings, options, mode, owner,
// negative handling so the world's global negative-prompt terms stay in
// effect even when the caller supplies their own additions. Deduplicated
// by token so a user repeating a world negative doesn't double-weight it.
- const negativePrompt = mergeNegativePromptTokens([
+ const negativeTokens = mergeNegativePromptTokens([
options.negativePrompt,
world?.influences?.avoid,
- ]).join(', ') || undefined;
+ ]);
+ const negativePrompt = negativeTokens.join(', ') || undefined;
+ // The universe and series blocks the stage composers fold into the prompt,
+ // listed for the render's sent-prompt record (#11317). Each is listed only
+ // when the text actually went out, so a chip never names a block a composer
+ // left off.
+ const worldAvoid = negativeTokens.slice(mergeNegativePromptTokens([options.negativePrompt]).length).join(', ');
+ const promptAdditions = [
+ promptAddition('universe-style', 'Universe style', buildStyleClause(world, series)),
+ promptAddition('series-style', 'Series style notes', series?.styleNotes),
+ ].filter((item) => item && prompt.includes(item.text));
+ const avoidAddition = promptAddition('universe-avoid', 'Universe avoid (negative prompt)', worldAvoid);
+ if (avoidAddition) promptAdditions.push(avoidAddition);
const baseParams = {
prompt,
negativePrompt,
+ ...(promptAdditions.length ? { promptAdditions } : {}),
width: options.width,
height: options.height,
steps: options.steps,
diff --git a/server/services/pipeline/visualStages.test.js b/server/services/pipeline/visualStages.test.js
index 812cf54e9f..2891f09241 100644
--- a/server/services/pipeline/visualStages.test.js
+++ b/server/services/pipeline/visualStages.test.js
@@ -666,6 +666,18 @@ describe('enqueueStoryboardShotStartFrame', () => {
expect(result.stage.status).toBe('edited');
});
+ // Uniquely catches a pipeline render's universe / series blocks reaching the
+ // model without being listed on its sent-prompt record (#11317).
+ it('lists the universe and series blocks folded into the frame prompt', async () => {
+ useStoryboardScenes([{ description: 'wide', shots: [{ id: 's1', description: 'close on the lock' }] }]);
+ getUniverse.mockResolvedValueOnce({ id: 'u1', influences: { embrace: ['ink wash'], avoid: ['photo'] } });
+ await enqueueStoryboardShotStartFrame('iss-test', 0, 0);
+ const { params } = enqueueJobMock.mock.calls[0][0];
+ expect(params.promptAdditions.map((item) => item.label)).toEqual(['Universe style', 'Series style notes', 'Universe avoid (negative prompt)']);
+ for (const item of params.promptAdditions.slice(0, 2)) expect(params.prompt).toContain(item.text);
+ expect(params.negativePrompt).toContain('photo');
+ });
+
it('falls back to the parent scene description when the shot description is empty', async () => {
useStoryboardScenes([{ description: 'wide shot of the bridge at dawn', shots: [{ id: 's1', description: '' }] }]);
const result = await enqueueStoryboardShotStartFrame('iss-test', 0, 0);
diff --git a/server/services/universeBuilder.test.js b/server/services/universeBuilder.test.js
index cd79e31e4a..050000d69f 100644
--- a/server/services/universeBuilder.test.js
+++ b/server/services/universeBuilder.test.js
@@ -1795,6 +1795,15 @@ describe("universeBuilder service", () => {
expect(compiled[0].negativePrompt).toBe(
"blurry, lowres, color photo, low quality",
);
+ // Each block PortOS folds around the variation is listed; the batch's
+ // own negative is the user's text, so it is not (#11317).
+ expect(compiled[0].promptAdditions).toEqual([
+ { id: "universe-style", label: "Universe style", text: "moebius linework, scavengers reign palette" },
+ { id: "style-preset", label: "Style preset", text: "noir cinematography" },
+ { id: "extra-style", label: "Batch extra style", text: "high contrast" },
+ { id: "universe-avoid", label: "Universe avoid (negative prompt)", text: "blurry, lowres" },
+ { id: "style-preset-negatives", label: "Style preset negatives", text: "color photo" },
+ ]);
});
it("override fields default to baseline influences when omitted", async () => {
diff --git a/server/services/universeBuilder/compile.js b/server/services/universeBuilder/compile.js
index 1d08076d26..3c5972b596 100644
--- a/server/services/universeBuilder/compile.js
+++ b/server/services/universeBuilder/compile.js
@@ -11,6 +11,7 @@
import { composeStyledPrompt } from '../../lib/composeStyledPrompt.js';
import { joinInfluenceList } from '../../lib/universeVisualStyle.js';
+import { promptAddition } from '../../lib/modelInput.js';
import { flattenCanonDescriptorFragments, richCanonDescriptorFragments } from '../../lib/canonPrompt.js';
import { getWorldCategoryKeys, normalizeCategoryKey, ENTRY_REF_KIND } from './sanitize.js';
@@ -157,6 +158,16 @@ export function compilePrompts(universe, options = {}) {
prompt: embraceParts.join(', '),
negativePrompt: avoidParts.join(', '),
};
+ // Each block folded around an entry's own prompt, listed so the render's
+ // sent-prompt record shows what PortOS added (#11317). The batch's own
+ // negative is the user's text, so it is not an addition.
+ const promptAdditions = [
+ promptAddition('universe-style', 'Universe style', baselineEmbrace),
+ promptAddition('style-preset', options.stylePresetLabel ? `Style preset: ${options.stylePresetLabel}` : 'Style preset', options.stylePresetPrompt),
+ promptAddition('extra-style', 'Batch extra style', options.extraStyle),
+ promptAddition('universe-avoid', 'Universe avoid (negative prompt)', baselineAvoid),
+ promptAddition('style-preset-negatives', 'Style preset negatives', options.stylePresetNegative),
+ ].filter(Boolean);
const compiled = [];
if (promptMode === 'variations' || promptMode === 'all') {
@@ -175,6 +186,7 @@ export function compilePrompts(universe, options = {}) {
label: variation.label,
prompt,
negativePrompt,
+ promptAdditions,
batchIndex: i,
// `entryRef` lets the collection hook stamp the rendered filename
// back onto this exact variation regardless of subsequent label
@@ -206,6 +218,7 @@ export function compilePrompts(universe, options = {}) {
label: sheet.label,
prompt,
negativePrompt,
+ promptAdditions,
batchIndex: i,
...(sheet.id ? { entryRef: { kind: ENTRY_REF_KIND.SHEET, id: sheet.id } } : {}),
});
@@ -249,6 +262,7 @@ export function compilePrompts(universe, options = {}) {
label: entry.name || entry.slugline || trunk.key,
prompt,
negativePrompt,
+ promptAdditions,
batchIndex: i,
...(entry.id ? { entryRef: { kind: ENTRY_REF_KIND.CANON, kindKey: trunk.key, id: entry.id } } : {}),
});
diff --git a/server/services/universeBuilderRender.js b/server/services/universeBuilderRender.js
index a072f69b02..513d561dba 100644
--- a/server/services/universeBuilderRender.js
+++ b/server/services/universeBuilderRender.js
@@ -51,6 +51,7 @@ export async function renderUniverseJobs(universeId, body, mapServiceError) {
extraNegative: body.negativePrompt,
stylePresetPrompt: stylePreset?.prompt,
stylePresetNegative: stylePreset?.negativePrompt,
+ stylePresetLabel: stylePreset?.label,
});
if (!compiled.length) {
throw new ServerError('No prompts to render — add canon entries, variations, or composite sheets first', {
@@ -165,6 +166,7 @@ export async function renderUniverseJobs(universeId, body, mapServiceError) {
...baseParams,
prompt: item.prompt,
negativePrompt: item.negativePrompt || undefined,
+ ...(item.promptAdditions?.length ? { promptAdditions: item.promptAdditions } : {}),
// Tag every job so the completion hook can route the result back
// into the run's collection without us having to thread additional
// arguments through the queue. `entryRef` (when present — variations
diff --git a/server/services/universeCharacterSheet.js b/server/services/universeCharacterSheet.js
index 1417374185..a35ee7d102 100644
--- a/server/services/universeCharacterSheet.js
+++ b/server/services/universeCharacterSheet.js
@@ -21,6 +21,7 @@ import { getSettings } from './settings.js';
import { getUniverse, updateUniverse } from './universeBuilder.js';
import { purgeReferenceSheetFromAllUniverses } from './universeCanon.js';
import { universeAestheticLine } from '../lib/universeVisualStyle.js';
+import { promptAddition } from '../lib/modelInput.js';
import { enqueueJob, mediaJobEvents } from './mediaJobQueue/index.js';
import { buildUniverseRunTag } from './universeRunTag.js';
import { IMAGE_GEN_MODE } from './imageGen/modes.js';
@@ -423,10 +424,19 @@ export async function renderCharacterReferenceSheet(universeId, entryId, options
// user zooms. resolveSheetDimensions bumps codex up to 4K landscape while
// local FLUX keeps its memory-tuned 2048×1536 defaults.
const { width, height } = resolveSheetDimensions(activeMode, built.width, built.height);
+ // The sheet template is PortOS's own text around the character's fields; the
+ // universe style and the sheet negatives it carries are listed on the
+ // render's sent-prompt record (#11317). A typed override is sent as written.
+ const styleLine = universeAestheticLine(universe);
+ const promptAdditions = [
+ prompt === built.prompt && styleLine && prompt.includes(styleLine.trim()) ? promptAddition('universe-style', 'Universe style', styleLine) : null,
+ negativePrompt === built.negativePrompt ? promptAddition('sheet-negatives', 'Character sheet negatives', built.negativePrompt) : null,
+ ].filter(Boolean);
const baseParams = {
mode: activeMode,
prompt,
negativePrompt,
+ ...(promptAdditions.length ? { promptAdditions } : {}),
width,
height,
cleanC2PA,
diff --git a/server/services/universeCharacterSheet.modelResolution.test.js b/server/services/universeCharacterSheet.modelResolution.test.js
index fd4201f5b5..53e6c914dc 100644
--- a/server/services/universeCharacterSheet.modelResolution.test.js
+++ b/server/services/universeCharacterSheet.modelResolution.test.js
@@ -71,3 +71,22 @@ describe('renderCharacterReferenceSheet local model selection', () => {
expect(mocks.enqueueJob.mock.calls[0][0].params.modelId).toBe('dev');
});
});
+
+// Uniquely catches the sheet's universe style reaching the model unlisted, or a
+// typed override being labeled with blocks it never carried (#11317).
+describe('renderCharacterReferenceSheet prompt additions', () => {
+ it('lists the universe style and sheet negatives on a template render, and nothing on an override', async () => {
+ mocks.getUniverse.mockResolvedValue({
+ id: 'universe-1', name: 'Example Universe',
+ influences: { embrace: ['ink wash'] },
+ characters: [{ id: 'character-1', name: 'Example Character' }],
+ });
+ await renderCharacterReferenceSheet('universe-1', 'character-1');
+ const { params } = mocks.enqueueJob.mock.calls[0][0];
+ expect(params.promptAdditions.map((item) => item.id)).toEqual(['universe-style', 'sheet-negatives']);
+ expect(params.prompt).toContain(params.promptAdditions[0].text);
+
+ await renderCharacterReferenceSheet('universe-1', 'character-1', { overridePrompt: 'my own sheet', overrideNegativePrompt: 'blur' });
+ expect(mocks.enqueueJob.mock.calls[1][0].params.promptAdditions).toBeUndefined();
+ });
+});