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

address review: route composeVisualPrompt setting map through canon

[._.]/ Adam Eivya31b92e274d2
diff --git a/server/services/pipeline/episodeVideo.js b/server/services/pipeline/episodeVideo.js
index 202ac70ea0..ddf60ce8f7 100644
--- a/server/services/pipeline/episodeVideo.js
+++ b/server/services/pipeline/episodeVideo.js
@@ -16,6 +16,7 @@
import { composeVisualPrompt } from './visualStages.js';
import { getIssue, updateStage } from './issues.js';
import { getSeries } from './series.js';
+import { getSeriesCanon } from './seriesCanon.js';
import { createProject as createCDProject, setTreatment as setCDTreatment } from '../creativeDirector/local.js';
import { startCreativeDirectorProject } from '../creativeDirector/completionHook.js';
import { getDefaultVideoModelId } from '../../lib/mediaModels.js';
@@ -78,7 +79,7 @@ function expandShotsToCdScenes(scene, sceneIdx, shortIssueId, baselinePrompt) {
* MAX_SCENES caps the flattened CD scene count so an issue with deep shot
* decomposition can't push the CD render queue past its single-issue budget.
*/
-export function buildTreatmentFromStoryboards({ issue, series }) {
+export function buildTreatmentFromStoryboards({ issue, series, canon = null }) {
const storyboards = issue.stages?.storyboards;
const rawScenes = Array.isArray(storyboards?.scenes) ? storyboards.scenes : [];
const usable = rawScenes.filter((s) => (s?.description || '').trim().length > 0);
@@ -89,7 +90,10 @@ export function buildTreatmentFromStoryboards({ issue, series }) {
);
}
const shortIssueId = issue.id.slice(-8);
- const settingByKey = buildSettingByKey(series?.settings);
+ // Canon settings live on the linked universe (Phase B.4). Build the
+ // settingByKey once and reuse across every scene's composeVisualPrompt
+ // call rather than rebuilding per-call.
+ const settingByKey = buildSettingByKey(canon?.settings);
const baselinePrompt = (description, slugline) =>
composeVisualPrompt({ series, description, slugline: slugline || '', settingByKey });
@@ -134,7 +138,12 @@ export async function startEpisodeVideoForIssue(issueId, options = {}) {
const existing = issue.stages?.episodeVideo?.cdProjectId;
const series = await getSeries(issue.seriesId);
- const treatment = buildTreatmentFromStoryboards({ issue, series });
+ // Canon (characters / settings / objects) lives on the linked universe
+ // — load it so the per-scene baseline prompt can inject setting baseline
+ // context (INT/EXT, timeOfDay, palette, recurring details) for matched
+ // sluglines. Orphan series render with empty canon.
+ const canon = await getSeriesCanon(series);
+ const treatment = buildTreatmentFromStoryboards({ issue, series, canon });
if (existing && !options.force) {
// SSE / UI status messaging stays consistent between fresh-start and
// reuse paths by reusing the treatment builder for the scene count —
diff --git a/server/services/pipeline/visualStages.js b/server/services/pipeline/visualStages.js
index a6eda591dc..362dfd4999 100644
--- a/server/services/pipeline/visualStages.js
+++ b/server/services/pipeline/visualStages.js
@@ -187,8 +187,13 @@ const enqueueImageJob = ({ prompt, world, settings, options, mode, owner, logLin
return jobId;
};
-export function composeVisualPrompt({ series, description, slugline = '', extraStyle = '', settingByKey = null, matchedCharacters = [], world = null }) {
- const map = settingByKey || buildSettingByKey(series?.settings);
+// Canon settings now live on the linked universe (Phase B.4). Callers can
+// either pass a pre-built `settingByKey` (when they've already computed it
+// for reuse across many scenes — see episodeVideo) or pass `canon` and let
+// us build the map here. `series?.settings` is no longer read — that field
+// was retired with the series-side canon teardown.
+export function composeVisualPrompt({ series, description, slugline = '', extraStyle = '', settingByKey = null, matchedCharacters = [], world = null, canon = null }) {
+ const map = settingByKey || buildSettingByKey(canon?.settings);
const scenePrompt = buildScenePrompt(
series?.name || '',
{ visualPrompt: description || '', slugline },
@@ -724,6 +729,7 @@ export async function enqueueVisualImage(issueId, stageId, options = {}) {
extraStyle: composeExtraStyle(series, issue, stageId, options.extraStyle),
matchedCharacters,
world,
+ canon,
});
if (!prompt) {
throw new ServerError('visual prompt is empty (no description, no style)', {
@@ -791,6 +797,7 @@ export async function enqueueStoryboardSceneVideo(issueId, sceneIndex, options =
extraStyle: composeExtraStyle(series, issue, 'storyboards', options.extraStyle),
matchedCharacters,
world,
+ canon,
});
const aspectRatio = ASPECT_PRESETS[options.aspectRatio] ? options.aspectRatio : '16:9';
@@ -886,6 +893,7 @@ export async function enqueueStoryboardShotStartFrame(issueId, sceneIndex, shotI
extraStyle: composeExtraStyle(series, issue, 'storyboards', options.extraStyle),
matchedCharacters,
world,
+ canon,
});
const jobId = enqueueImageJob({