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
Replace Series Bible visual-style preset with universe-style override toggle
[._.]/ Adam Eivy954dd5b39fc3
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex ae1cd2f455..4dd5b351f1 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -30,3 +30,9 @@- **NAV_COMMANDS manifest** registers `/city/settings` and `/ambient` so they are reachable from `⌘K` and voice.## Removed++- **Series Bible "Visual style preset" + per-stage style override.** The curated catalog (`server/lib/visualStyles.js`: graphic-novel / cinematic / anime / etc.) and the `series.visualStyleDefault` + `issue.stages.*.visualStyleOverride` plumbing have been retired. Style now flows from a single source — the linked universe's `stylePrompt` plus the series-level `stylePromptOverride` with a new `stylePromptOverrideMode` toggle (`prepend` | `append` | `override`). The `VisualStylePicker` component, the three stage-component pickers, the `/api/pipeline/visual-styles` route, and `listPipelineVisualStyles` / `updateIssueStageVisualStyle` API helpers all gone. Migration `026-remove-visual-style-fields.js` strips the dead fields from `pipeline-series.json` + `pipeline-issues.json`.++## Changed (continued)++- **Series creation requires a universe in the UI.** The `New Series` form's universe picker is now required (submit disabled until one is picked); the bible's "Linked World" picker drops the `— None —` option. Server-side stays permissive so the importer / share-bucket sync can still land legacy orphan records — the UI is the gate, matching PortOS's single-user model.diff --git a/client/src/components/pipeline/VisualStylePicker.jsx b/client/src/components/pipeline/VisualStylePicker.jsxdeleted file mode 100644index 4f8a76acc6..0000000000--- a/client/src/components/pipeline/VisualStylePicker.jsx+++ /dev/null@@ -1,251 +0,0 @@-/**- * Drives both series-level default (`series.visualStyleDefault`) and per-stage- * overrides (`issue.stages.<stageId>.visualStyleOverride`). Symmetric contract:- * value: { id, customPrompt } | null- * onChange(next | null)- *- * Menu is portalled to <body> with fixed positioning so it escapes- * `overflow:auto` ancestors — z-index alone can't break out of an overflow clip.- */--import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';-import { createPortal } from 'react-dom';-import { ChevronDown, Palette, X } from 'lucide-react';-import { listPipelineVisualStyles } from '../../services/apiPipeline';--const MENU_WIDTH = 320;-const MENU_MIN_WIDTH = 220;-const MENU_GAP = 4;-const VIEWPORT_PADDING = 8;--export default function VisualStylePicker({- value,- onChange,- disabled = false,- // Pass from per-stage callers; series-level callers leave undefined.- inheritedLabel = null,- // Compact shrinks the chip — used in stage headers where vertical space is tight.- compact = false,-}) {- const [styles, setStyles] = useState([]);- const [open, setOpen] = useState(false);- const triggerRef = useRef(null);- const menuRef = useRef(null);- const [menuStyle, setMenuStyle] = useState(null);- // Draft is only seeded when the menu opens — otherwise a parent re-render- // that re-passes the same value reference would wipe in-progress typing.- const [customDraft, setCustomDraft] = useState('');-- useEffect(() => {- let cancelled = false;- listPipelineVisualStyles()- .then((res) => { if (!cancelled) setStyles(Array.isArray(res?.styles) ? res.styles : []); })- .catch(() => { /* picker degrades to "no styles" rather than throwing */ });- return () => { cancelled = true; };- }, []);-- useEffect(() => {- if (disabled && open) setOpen(false);- }, [disabled, open]);-- const updateMenuPosition = useCallback(() => {- const trigger = triggerRef.current;- const menu = menuRef.current;- if (!trigger || !menu) return;-- const viewportWidth = window.innerWidth;- const viewportHeight = window.innerHeight;- const width = Math.min(MENU_WIDTH, Math.max(MENU_MIN_WIDTH, viewportWidth - VIEWPORT_PADDING * 2));- // Apply width imperatively before measuring height: on narrow viewports- // the clamp differs from the JSX fallback, and React's batched commit- // wouldn't reflect the right width by the time getBoundingClientRect runs.- menu.style.width = `${width}px`;-- const triggerRect = trigger.getBoundingClientRect();- const menuRect = menu.getBoundingClientRect();-- const maxLeft = viewportWidth - width - VIEWPORT_PADDING;- const left = Math.min(- Math.max(triggerRect.right - width, VIEWPORT_PADDING),- Math.max(VIEWPORT_PADDING, maxLeft),- );-- const belowTop = triggerRect.bottom + MENU_GAP;- const aboveTop = triggerRect.top - menuRect.height - MENU_GAP;- const wouldOverflowBottom = belowTop + menuRect.height + VIEWPORT_PADDING > viewportHeight;- const canFitAbove = aboveTop >= VIEWPORT_PADDING;- let top = wouldOverflowBottom && canFitAbove ? aboveTop : belowTop;- const maxTop = Math.max(VIEWPORT_PADDING, viewportHeight - menuRect.height - VIEWPORT_PADDING);- top = Math.min(Math.max(top, VIEWPORT_PADDING), maxTop);-- setMenuStyle((prev) => {- const next = { left: `${left}px`, top: `${top}px`, width: `${width}px` };- if (prev && prev.left === next.left && prev.top === next.top && prev.width === next.width) return prev;- return next;- });- }, []);-- useEffect(() => {- if (!open) return undefined;- setCustomDraft(value?.customPrompt || '');- const onDoc = (e) => {- const onTrigger = triggerRef.current?.contains(e.target);- const onMenu = menuRef.current?.contains(e.target);- if (!onTrigger && !onMenu) setOpen(false);- };- const onKey = (e) => { if (e.key === 'Escape') setOpen(false); };- let rafId = null;- const onReposition = () => {- if (rafId !== null) return;- rafId = requestAnimationFrame(() => {- rafId = null;- updateMenuPosition();- });- };- document.addEventListener('mousedown', onDoc);- document.addEventListener('keydown', onKey);- window.addEventListener('resize', onReposition);- window.addEventListener('scroll', onReposition, true);- return () => {- if (rafId !== null) cancelAnimationFrame(rafId);- document.removeEventListener('mousedown', onDoc);- document.removeEventListener('keydown', onKey);- window.removeEventListener('resize', onReposition);- window.removeEventListener('scroll', onReposition, true);- };- // value?.customPrompt intentionally omitted — see comment on customDraft.- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [open, updateMenuPosition]);-- useLayoutEffect(() => {- if (!open) {- setMenuStyle(null);- return;- }- updateMenuPosition();- }, [open, updateMenuPosition, styles.length]);-- const activeId = value?.id || null;- const activeStyle = activeId ? styles.find((s) => s.id === activeId) : null;- const hasValue = !!(value?.id || value?.customPrompt);-- const triggerLabel = hasValue- ? (activeStyle?.name || 'Custom')- : (inheritedLabel || 'Pick style');-- const choose = (id) => {- onChange?.({ id, customPrompt: value?.customPrompt || null });- setOpen(false);- };-- const clear = () => {- onChange?.(null);- setOpen(false);- };-- const applyCustom = () => {- const trimmed = (customDraft || '').trim();- if (!trimmed && !value?.id) {- onChange?.(null);- } else {- onChange?.({ id: value?.id || null, customPrompt: trimmed || null });- }- setOpen(false);- };-- return (- <>- <button- ref={triggerRef}- type="button"- onClick={() => setOpen((v) => !v)}- disabled={disabled}- className={`inline-flex items-center gap-1.5 rounded-md border bg-port-card text-xs disabled:opacity-50 disabled:cursor-not-allowed ${- compact ? 'px-2 py-1' : 'px-2.5 py-1.5'- } ${- hasValue- ? 'border-port-accent/50 text-white'- : 'border-port-border text-gray-300 hover:text-white hover:border-port-accent/50'- }`}- title={hasValue- ? `Visual style: ${triggerLabel}${value?.customPrompt ? ' (+ custom)' : ''}`- : 'Pick a visual style preset for downstream image generation'}- aria-expanded={open}- aria-haspopup="menu"- >- <Palette size={12} className="text-gray-500" />- <span className="font-medium">{triggerLabel}</span>- {value?.customPrompt && <span className="text-[10px] text-gray-500">+ custom</span>}- <ChevronDown size={12} className="text-gray-500" />- </button>-- {open && createPortal(- <div- ref={menuRef}- role="menu"- className="fixed bg-port-card border border-port-border rounded-lg shadow-xl z-[100] p-1 overflow-y-auto"- style={{- left: menuStyle?.left ?? `${VIEWPORT_PADDING}px`,- top: menuStyle?.top ?? `${VIEWPORT_PADDING}px`,- width: menuStyle?.width ?? `${MENU_WIDTH}px`,- maxHeight: `min(70vh, calc(100vh - ${VIEWPORT_PADDING * 2}px))`,- visibility: menuStyle ? 'visible' : 'hidden',- }}- >- {hasValue && (- <button- type="button"- onClick={clear}- className="w-full flex items-center gap-1.5 px-2 py-1.5 rounded text-xs text-gray-400 hover:bg-port-bg hover:text-white"- >- <X size={12} />- <span>{inheritedLabel ? 'Reset to series default' : 'Clear style'}</span>- </button>- )}-- {styles.length === 0 && (- <div className="px-2 py-1.5 text-xs text-gray-500">Loading styles…</div>- )}-- {styles.map((s) => {- const active = activeId === s.id;- return (- <button- key={s.id}- type="button"- onClick={() => choose(s.id)}- className={`w-full text-left px-2 py-1.5 rounded text-xs ${- active ? 'bg-port-accent/15 text-white' : 'text-gray-300 hover:bg-port-bg hover:text-white'- }`}- >- <div className="font-medium">{s.name}</div>- <div className="text-[10px] text-gray-500 mt-0.5">{s.description}</div>- </button>- );- })}-- <div className="mt-1 pt-1 px-2 py-1.5 border-t border-port-border">- <div className="text-[10px] text-gray-500 mb-1">- Custom additions (appended to the preset fragment)- </div>- <textarea- value={customDraft}- onChange={(e) => setCustomDraft(e.target.value)}- placeholder="e.g. heavier ink weight, muted earth palette"- rows={2}- className="block w-full px-2 py-1 bg-port-bg border border-port-border rounded text-white text-xs resize-y"- />- <button- type="button"- onClick={applyCustom}- className="mt-1.5 w-full px-2 py-1 rounded bg-port-accent text-white text-xs font-medium hover:bg-port-accent/90"- >- Apply custom additions- </button>- </div>- </div>,- document.body,- )}- </>- );-}diff --git a/client/src/components/pipeline/stages/ComicScriptStage.jsx b/client/src/components/pipeline/stages/ComicScriptStage.jsxindex 20259dda3c..9a0cf2d3f0 100644--- a/client/src/components/pipeline/stages/ComicScriptStage.jsx+++ b/client/src/components/pipeline/stages/ComicScriptStage.jsx@@ -20,7 +20,6 @@ import {generatePipelineComicCoverConcepts,updatePipelineComicPage,updatePipelineIssue,- updateIssueStageVisualStyle,PIPELINE_STAGE_LABELS,PIPELINE_STAGE_STATUS_LABEL as STATUS_LABEL,PIPELINE_STAGE_STATUS_COLOR as STATUS_COLOR,@@ -29,7 +28,6 @@ import { getSettings, updateSettings } from '../../../services/apiSystem';import { listImageModels } from '../../../services/apiImageVideo';import MediaJobThumb from '../MediaJobThumb';import MediaPreview from '../../media/MediaPreview';-import VisualStylePicker from '../VisualStylePicker';import Drawer from '../../Drawer';import ImageGenSettingsForm from '../../imageGen/ImageGenSettingsForm';import ExtractCanonButton from './ExtractCanonButton';@@ -474,16 +472,6 @@ export default function ComicScriptStage({ issue, series, onStageUpdate, actions) : null}</div><div className="flex items-center gap-2">- <VisualStylePicker- compact- value={comicPages.visualStyleOverride || null}- inheritedLabel={series?.visualStyleDefault?.id ? 'Series default' : 'Pick style'}- onChange={async (next) => {- const updated = await updateIssueStageVisualStyle(issue.id, 'comicPages', next)- .catch((err) => { toast.error(err.message || 'Save failed'); return null; });- if (updated) onStageUpdate?.('comicPages', updated.stages.comicPages, updated);- }}- /><buttontype="button"onClick={openImageSettings}diff --git a/client/src/components/pipeline/stages/EpisodeVideoStage.jsx b/client/src/components/pipeline/stages/EpisodeVideoStage.jsxindex 6bccd57ab3..083ad0d381 100644--- a/client/src/components/pipeline/stages/EpisodeVideoStage.jsx+++ b/client/src/components/pipeline/stages/EpisodeVideoStage.jsx@@ -2,8 +2,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';import { Link } from 'react-router-dom';import { Film, ExternalLink, Loader2, Sparkles, AlertCircle, CheckCircle2 } from 'lucide-react';import toast from '../../ui/Toast';-import { generatePipelineVisualImage, updateIssueStageVisualStyle } from '../../../services/api';-import VisualStylePicker from '../VisualStylePicker';+import { generatePipelineVisualImage } from '../../../services/api';import { getCreativeDirectorProject } from '../../../services/apiCreativeDirector';import { getSceneStatusBadge, PROJECT_STATUS_LABEL } from '../../creative-director/sceneStatus';import ScenePreview from '../../creative-director/ScenePreview';@@ -146,16 +145,6 @@ export default function EpisodeVideoStage({ issue, series, onStageUpdate }) {</div>{!cdProjectId ? (<div className="flex items-center gap-2 flex-wrap">- <VisualStylePicker- compact- value={stage.visualStyleOverride || null}- inheritedLabel={series?.visualStyleDefault?.id ? 'Series default' : 'Pick style'}- onChange={async (next) => {- const updated = await updateIssueStageVisualStyle(issue.id, 'episodeVideo', next)- .catch((err) => { toast.error(err.message || 'Save failed'); return null; });- if (updated) onStageUpdate?.('episodeVideo', updated.stages.episodeVideo, updated);- }}- /><selectvalue={aspectRatio}onChange={(e) => setAspectRatio(e.target.value)}diff --git a/client/src/components/pipeline/stages/StoryboardsStage.jsx b/client/src/components/pipeline/stages/StoryboardsStage.jsxindex cb6e66f588..b536024095 100644--- a/client/src/components/pipeline/stages/StoryboardsStage.jsx+++ b/client/src/components/pipeline/stages/StoryboardsStage.jsx@@ -25,11 +25,9 @@ import {generatePipelineShotStartFrame,refinePipelineSceneImagePrompt,updatePipelineIssue,- updateIssueStageVisualStyle,extractPipelineStoryboardScenes,} from '../../../services/api';import MediaJobThumb from '../MediaJobThumb';-import VisualStylePicker from '../VisualStylePicker';import { genConfigToImageOptions, genConfigToRefineOptions } from './VisualGenSettings';export default function StoryboardsStage({ issue, series, onStageUpdate, actionsGated = false }) {@@ -263,16 +261,6 @@ export default function StoryboardsStage({ issue, series, onStageUpdate, actions</p></div><div className="flex items-center gap-2 flex-wrap">- <VisualStylePicker- compact- value={issue.stages?.storyboards?.visualStyleOverride || null}- inheritedLabel={series?.visualStyleDefault?.id ? 'Series default' : 'Pick style'}- onChange={async (next) => {- const updated = await updateIssueStageVisualStyle(issue.id, 'storyboards', next)- .catch((err) => { toast.error(err.message || 'Save failed'); return null; });- if (updated) onStageUpdate?.('storyboards', updated.stages.storyboards, updated);- }}- /><buttontype="button"onClick={() => onExtractClick('teleplay')}diff --git a/client/src/pages/Pipeline.jsx b/client/src/pages/Pipeline.jsxindex b486218f9d..39136ab189 100644--- a/client/src/pages/Pipeline.jsx+++ b/client/src/pages/Pipeline.jsx@@ -91,6 +91,10 @@ export default function Pipeline() {toast.error('Series name is required');return;}+ if (!form.universeId) {+ toast.error('Pick a universe — series must be linked to one');+ return;+ }setCreating(true);const target = parseInt(form.issueCountTarget, 10);const created = await createPipelineSeries({@@ -99,7 +103,7 @@ export default function Pipeline() {premise: form.premise.trim(),styleNotes: form.styleNotes.trim(),author: form.author.trim(),- universeId: form.universeId || undefined,+ universeId: form.universeId,issueCountTarget: Number.isFinite(target) && target > 0 ? target : undefined,arc: form.shape ? { shape: form.shape } : undefined,}).catch((err) => {@@ -186,25 +190,26 @@ export default function Pipeline() {</div><div><label htmlFor="series-world" className="block text-xs uppercase tracking-wider text-gray-500 mb-1">- <span className="inline-flex items-center gap-1"><Globe2 size={12} /> World (optional)</span>+ <span className="inline-flex items-center gap-1"><Globe2 size={12} /> Universe (required)</span></label><selectid="series-world"value={form.universeId}onChange={(e) => handleWorldChange(e.target.value)}+ requiredclassName="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white">- <option value="">— None —</option>+ <option value="">— Pick a universe —</option>{universes.map((w) => (<option key={w.id} value={w.id}>{w.name}</option>))}</select><p className="text-[11px] text-gray-500 mt-1">{form.universeId- ? 'Logline / premise / style notes pulled from the world — edit below.'+ ? 'Logline / premise / style notes pulled from the universe — edit below.': universes.length === 0- ? 'No universes yet. Build one in Media Gen → Universe Builder.'- : 'Pick a world to auto-fill the bible.'}+ ? 'No universes yet. Build one in Media Gen → Universe Builder before creating a series.'+ : 'Series carry style + canon from their universe — pick one to continue.'}</p></div></div>@@ -295,8 +300,9 @@ export default function Pipeline() {<div className="flex gap-2"><buttontype="submit"- disabled={creating}+ disabled={creating || !form.universeId || !form.name.trim()}className="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-port-accent text-white text-sm font-medium disabled:opacity-50"+ title={!form.universeId ? 'Pick a universe to create the series' : undefined}>{creating ? <Loader2 size={14} className="animate-spin" /> : null}Creatediff --git a/client/src/pages/PipelineSeries.jsx b/client/src/pages/PipelineSeries.jsxindex bb2a9564ab..596fa74f65 100644--- a/client/src/pages/PipelineSeries.jsx+++ b/client/src/pages/PipelineSeries.jsx@@ -18,7 +18,7 @@ import {} from 'lucide-react';import toast from '../components/ui/Toast';import ArcCanvas from '../components/pipeline/ArcCanvas';-import VisualStylePicker from '../components/pipeline/VisualStylePicker';+import TabPills from '../components/ui/TabPills';import {getPipelineSeries, updatePipelineSeries,listPipelineIssues,@@ -31,6 +31,15 @@ import { useLocalStorageBool } from '../hooks/useLocalStorageBool';const PIPELINE_SIDEBAR_KEY = 'portos-pipeline-series-sidebar-collapsed';+// Mirrors `STYLE_PROMPT_OVERRIDE_MODES` on the server (series.js). The+// default lives there too — keep this list in sync if a new mode lands.+const STYLE_OVERRIDE_MODE_DEFAULT = 'prepend';+const STYLE_OVERRIDE_MODE_TABS = [+ { id: 'prepend', label: 'Prepend' },+ { id: 'append', label: 'Append' },+ { id: 'override', label: 'Replace' },+];+export default function PipelineSeries() {const { seriesId } = useParams();const navigate = useNavigate();@@ -92,7 +101,7 @@ export default function PipelineSeries() {const flushPending = async () => {if (!series) return false;const saved = lastSavedRef.current || series;- const fields = ['name', 'logline', 'premise', 'styleNotes', 'titleLogo', 'author', 'stylePromptOverride', 'issueCountTarget', 'universeId'];+ const fields = ['name', 'logline', 'premise', 'styleNotes', 'titleLogo', 'author', 'stylePromptOverride', 'stylePromptOverrideMode', 'issueCountTarget', 'universeId'];const dirty = fields.some((k) => (series[k] ?? '') !== (saved[k] ?? ''))|| JSON.stringify(series.llm || {}) !== JSON.stringify(saved.llm || {});if (!dirty) return false;@@ -100,11 +109,12 @@ export default function PipelineSeries() {name: series.name,logline: series.logline,premise: series.premise,- universeId: series.universeId || null,+ universeId: series.universeId,styleNotes: series.styleNotes,titleLogo: series.titleLogo || '',author: series.author || '',stylePromptOverride: series.stylePromptOverride || '',+ stylePromptOverrideMode: series.stylePromptOverrideMode || STYLE_OVERRIDE_MODE_DEFAULT,issueCountTarget: series.issueCountTarget,llm: series.llm || { provider: null, model: null },}).catch((err) => {@@ -346,72 +356,62 @@ function BibleSidebar({ series, universes, patchSeries, onSeriesUpdate, onFlushP</p></div>- <Field label="Visual style preset">- <div className="flex items-center gap-2">- <VisualStylePicker- value={series.visualStyleDefault || null}- onChange={(next) => patchSeries({ visualStyleDefault: next })}- />- <span className="text-xs text-gray-500">- Applied to comic pages, storyboards, and episode video unless a stage overrides it.- </span>- </div>- </Field>-- <Field label="Linked World (from Universe Builder)">+ <Field label="Linked Universe"><div className="flex items-center gap-2"><selectvalue={series.universeId || ''}- onChange={(e) => patchSeries({ universeId: e.target.value || null })}+ onChange={(e) => patchSeries({ universeId: e.target.value })}className="flex-1 px-3 py-2 bg-port-bg border border-port-border rounded text-white">- <option value="">— None —</option>{universes.map((w) => <option key={w.id} value={w.id}>{w.name}</option>)}</select><Link- to={series.universeId ? `/universe-builder` : '/universe-builder'}+ to="/universe-builder"className="inline-flex items-center gap-1 text-xs text-port-accent hover:underline whitespace-nowrap">- <Globe size={12} />- {series.universeId ? 'Open' : 'Create'}+ <Globe size={12} /> Open</Link></div></Field>- {series.universeId ? (- <Field label="Universe style override (this series only)">- <textarea- value={series.stylePromptOverride || ''}- onChange={(e) => patchSeries({ stylePromptOverride: e.target.value })}- rows={2}- className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"- maxLength={1000}- placeholder="moody noir lighting, high contrast monochrome. Prepended ahead of the universe's style so this series can deviate without forking the universe."+ <Field label="Universe style override (this series only)">+ <div className="mb-2">+ <TabPills+ variant="pills"+ size="xs"+ tabs={STYLE_OVERRIDE_MODE_TABS}+ activeTab={series.stylePromptOverrideMode || STYLE_OVERRIDE_MODE_DEFAULT}+ onChange={(id) => {+ if (id === (series.stylePromptOverrideMode || STYLE_OVERRIDE_MODE_DEFAULT)) return;+ patchSeries({ stylePromptOverrideMode: id });+ }}+ ariaLabel="Universe style override mode"/>- <p className="text-[11px] text-gray-500 mt-1">- Prepended ahead of the linked universe's <em>stylePrompt</em> for every image-gen call from this series. Leave blank to use the universe style verbatim.- </p>- </Field>- ) : null}+ </div>+ <textarea+ value={series.stylePromptOverride || ''}+ onChange={(e) => patchSeries({ stylePromptOverride: e.target.value })}+ rows={2}+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"+ maxLength={1000}+ placeholder="moody noir lighting, high contrast monochrome. Composed with the universe's style for every image-gen call from this series."+ />+ <p className="text-[11px] text-gray-500 mt-1">+ <strong>Prepend</strong> (default) puts the override ahead of the universe's <em>stylePrompt</em>; <strong>Append</strong> trails it; <strong>Replace</strong> drops the universe style entirely. Leave the box blank to use the universe style verbatim.+ </p>+ </Field><div><h3 className="text-xs uppercase tracking-wider text-gray-500 mb-2">Canon</h3>- {series.universeId ? (- // `#canon` scrolls to the embedded canon section (id="canon" on- // UniverseCanonSection) so users land on the folded-in canon UI- // instead of the bible at the top of the builder.- <Link- to={`/universe-builder/${encodeURIComponent(series.universeId)}#canon`}- className="block text-xs text-port-accent hover:underline"- >- Manage characters, places, and objects on the linked Universe →- </Link>- ) : (- <p className="text-xs text-gray-600 italic">- Link a universe above to author characters, places, and objects shared- across this series' issues.- </p>- )}+ {/* `#canon` scrolls to the embedded canon section (id="canon" on+ UniverseCanonSection) so users land on the folded-in canon UI+ instead of the bible at the top of the builder. */}+ <Link+ to={`/universe-builder/${encodeURIComponent(series.universeId)}#canon`}+ className="block text-xs text-port-accent hover:underline"+ >+ Manage characters, places, and objects on the linked Universe →+ </Link></div></section>);diff --git a/client/src/services/apiPipeline.js b/client/src/services/apiPipeline.jsindex eb8fd53595..b6bf00ec1c 100644--- a/client/src/services/apiPipeline.js+++ b/client/src/services/apiPipeline.js@@ -58,25 +58,6 @@ export const PIPELINE_STAGE_STATUS_COLOR = Object.freeze({error: 'text-port-error',});-// ---- Visual styles catalog -----// Module-level promise dedup: the catalog is immutable for the life of the-// server, so concurrent mounts share one in-flight fetch and subsequent calls-// resolve from cache. Cleared on rejection so a transient failure can retry.-let _visualStylesPromise = null;-export const listPipelineVisualStyles = () => {- if (!_visualStylesPromise) {- _visualStylesPromise = request('/pipeline/visual-styles')- .catch((err) => { _visualStylesPromise = null; throw err; });- }- return _visualStylesPromise;-};--// Per-stage style override is identical-shaped across every visual stage —-// factor the PATCH shape here so the three stage components don't each-// hand-roll the body.-export const updateIssueStageVisualStyle = (issueId, stageId, next) =>- updatePipelineIssue(issueId, { stages: { [stageId]: { visualStyleOverride: next } } });-// ---- Series ----export const listPipelineSeries = () => request('/pipeline/series');export const getPipelineSeries = (id) => request(`/pipeline/series/${encodeURIComponent(id)}`);diff --git a/scripts/migrations/026-remove-visual-style-fields.js b/scripts/migrations/026-remove-visual-style-fields.jsnew file mode 100644index 0000000000..37570d3576--- /dev/null+++ b/scripts/migrations/026-remove-visual-style-fields.js@@ -0,0 +1,73 @@+/**+ * Strip the retired `series.visualStyleDefault` + stage `visualStyleOverride`+ * fields from persisted JSON. Sanitizers already drop the keys on read; this+ * rewrites the files so share-bucket exports and data-dir diffs stay clean.+ * Idempotent.+ */++import { readFile, writeFile } from 'fs/promises';+import { join } from 'path';++const readJsonOrNull = async (path) => {+ const raw = await readFile(path, 'utf-8').catch((err) => {+ if (err.code === 'ENOENT') return null;+ throw err;+ });+ if (raw == null) return null;+ try {+ return JSON.parse(raw);+ } catch {+ return null;+ }+};++const writeJson = async (path, data) => {+ await writeFile(path, `${JSON.stringify(data, null, 2)}\n`);+};++const stripSeriesState = async (rootDir) => {+ const path = join(rootDir, 'data/pipeline-series.json');+ const state = await readJsonOrNull(path);+ if (!state || !Array.isArray(state.series)) return;+ let touched = 0;+ for (const s of state.series) {+ if ('visualStyleDefault' in s) {+ delete s.visualStyleDefault;+ touched += 1;+ }+ }+ if (touched > 0) {+ await writeJson(path, state);+ console.log(`📝 data/pipeline-series.json: stripped visualStyleDefault from ${touched} series record${touched === 1 ? '' : 's'}`);+ } else {+ console.log(`✅ data/pipeline-series.json: no visualStyleDefault present`);+ }+};++const stripIssuesState = async (rootDir) => {+ const path = join(rootDir, 'data/pipeline-issues.json');+ const state = await readJsonOrNull(path);+ if (!state || !Array.isArray(state.issues)) return;+ let touched = 0;+ for (const issue of state.issues) {+ if (!issue || typeof issue.stages !== 'object' || issue.stages === null) continue;+ for (const stage of Object.values(issue.stages)) {+ if (stage && typeof stage === 'object' && 'visualStyleOverride' in stage) {+ delete stage.visualStyleOverride;+ touched += 1;+ }+ }+ }+ if (touched > 0) {+ await writeJson(path, state);+ console.log(`📝 data/pipeline-issues.json: stripped visualStyleOverride from ${touched} stage record${touched === 1 ? '' : 's'}`);+ } else {+ console.log(`✅ data/pipeline-issues.json: no visualStyleOverride present`);+ }+};++export default {+ async up({ rootDir }) {+ await Promise.all([stripSeriesState(rootDir), stripIssuesState(rootDir)]);+ },+};diff --git a/server/lib/visualStyles.js b/server/lib/visualStyles.jsdeleted file mode 100644index 7dc45a069f..0000000000--- a/server/lib/visualStyles.js+++ /dev/null@@ -1,172 +0,0 @@-/**- * Curated catalog of named visual-style presets injected into every pipeline- * image-gen call. Catalog is additive-only: never renumber existing ids, since- * they are the persisted contract on `series.visualStyleDefault` and- * `issue.stages.<id>.visualStyleOverride`.- */--import { trimTo } from './storyBible.js';--export const CUSTOM_PROMPT_MAX = 2000;--export const VISUAL_STYLES = Object.freeze([- {- id: 'graphic-novel',- name: 'Graphic Novel',- description: 'Bold ink lines, halftone dots, saturated comic-book colors, panel-ready aesthetic.',- promptFragment: 'graphic novel aesthetic, bold ink outlines, halftone shading dots, saturated comic-book color palette, dynamic compositions, clean panel-ready linework',- },- {- id: 'cinematic',- name: 'Cinematic Realism',- description: 'Photorealistic film look, 35mm grain, shallow depth of field, dramatic lighting.',- promptFragment: 'photorealistic, 35mm film, shallow depth of field, dramatic key lighting, soft falloff, cinematic color grade',- },- {- id: 'anime',- name: 'Anime',- description: 'Cel-shaded Japanese animation, bold lines, vivid colors, expressive features.',- promptFragment: 'anime style, Japanese animation, vivid colors, expressive features, cel-shaded, clean line art',- },- {- id: 'film-noir',- name: 'Film Noir',- description: 'High-contrast black and white, deep shadows, hard light sources, chiaroscuro.',- promptFragment: 'film noir, high contrast black and white, deep shadows, dramatic chiaroscuro lighting, hard light sources, venetian-blind shadows',- },- {- id: 'watercolor',- name: 'Watercolor',- description: 'Soft washes, bleeding edges, hand-painted feel, visible paper texture.',- promptFragment: 'watercolor painting style, soft washes, bleeding edges, hand-painted, visible paper texture, organic pigment pooling',- },- {- id: 'oil-painting',- name: 'Oil Painting',- description: 'Classical fine art, rich impasto brushwork, layered glazes.',- promptFragment: 'classical oil painting, rich impasto brushwork, layered glazes, painterly edges, gallery-style finish',- },- {- id: 'pixar-3d',- name: '3D Animation',- description: 'Stylized 3D characters and environments, soft global illumination, family-friendly look.',- promptFragment: 'stylized 3D animation, Pixar-grade rendering, soft global illumination, expressive proportions, polished surface shaders',- },- {- id: 'retro-70s',- name: 'Retro 70s',- description: 'Warm film grain, faded Kodachrome palette, soft vignette, vintage feel.',- promptFragment: 'retro 1970s film, warm grain, faded Kodachrome colors, vintage lens, soft focus vignette, occasional film burn',- },- {- id: 'scifi-neon',- name: 'Sci-Fi Neon',- description: 'Cyberpunk neon glow, holographic UI, dark cityscapes, colored light spill.',- promptFragment: 'sci-fi cyberpunk, neon glow, holographic UI, futuristic, dark atmosphere with colored light spill, rain-slick streets',- },- {- id: 'documentary',- name: 'Documentary',- description: 'Naturalistic handheld feel, available light, real-world textures.',- promptFragment: 'documentary style, naturalistic, handheld camera feel, available light, real-world textures, observational framing',- },- {- id: 'dark-fantasy',- name: 'Dark Fantasy',- description: 'Epic scale, magical lighting, otherworldly atmosphere, ethereal glow.',- promptFragment: 'dark fantasy art, ethereal glow, magical particles, epic landscapes, otherworldly atmosphere, painterly fantasy illustration',- },- {- id: 'minimalist',- name: 'Minimalist',- description: 'Clean lines, muted palette, simple compositions with negative space.',- promptFragment: 'minimalist illustration, clean lines, muted palette, generous negative space, simple geometric compositions',- },- {- id: 'flat-vector',- name: 'Flat Vector Explainer',- description: 'Bold geometric shapes, vivid saturated palette, clean edges, explainer-video style.',- promptFragment: 'flat vector illustration, bold geometric shapes, vivid saturated palette, clean edges, explainer-video aesthetic',- },- {- id: 'lined-illustration',- name: 'Lined Illustration',- description: 'Hand-drawn outlines with textured fills, warm earthy tones, organic feel.',- promptFragment: 'hand-drawn illustration, organic outlines with textured fills, warm earthy tones, sketchy editorial feel',- },- {- id: 'paper-cutout',- name: 'Paper Cut-Out',- description: 'Layered paper craft, torn edges, collage-like compositions, stop-motion feel.',- promptFragment: 'paper cut-out craft style, layered paper depth, torn edges, collage compositions, stop-motion feel',- },-]);--const STYLES_BY_ID = new Map(VISUAL_STYLES.map((s) => [s.id, s]));--export function getVisualStyle(id) {- if (!id || typeof id !== 'string') return null;- return STYLES_BY_ID.get(id) || null;-}--// Catalog default per stage. Comic pages render to a graphic-novel aesthetic-// unless overridden; storyboards/episode videos default to cinematic so shot-// composition reads like film. Series-level default still wins when set.-const STAGE_FALLBACK = Object.freeze({- comicPages: 'graphic-novel',- storyboards: 'cinematic',- episodeVideo: 'cinematic',-});--/**- * Sanitize a visualStyleDefault / visualStyleOverride payload. Returns either- * a valid object or `null` so readers don't have to defensively spread.- *- * Allows `{ id: null, customPrompt: "..." }` so a user can supply a one-off- * custom style without picking a catalog preset.- */-export function sanitizeVisualStyleRef(raw) {- if (raw === null || raw === undefined) return null;- if (typeof raw !== 'object') return null;- const id = typeof raw.id === 'string' && raw.id.trim() ? raw.id.trim() : null;- const validId = id && STYLES_BY_ID.has(id) ? id : null;- const customPrompt = trimTo(raw.customPrompt, CUSTOM_PROMPT_MAX);- if (!validId && !customPrompt) return null;- return { id: validId, customPrompt: customPrompt || null };-}--/**- * Resolve the effective style for a stage. Priority:- * 1. issue.stages[stageId].visualStyleOverride- * 2. series.visualStyleDefault- * 3. STAGE_FALLBACK[stageId]- *- * The persisted refs are re-sanitized on read so hand-edited JSON and- * future catalog deletions degrade gracefully instead of producing a broken- * empty fragment.- */-export function resolveVisualStyle(series, issue, stageId) {- const override = sanitizeVisualStyleRef(issue?.stages?.[stageId]?.visualStyleOverride);- const seriesDefault = sanitizeVisualStyleRef(series?.visualStyleDefault);- const fallbackId = STAGE_FALLBACK[stageId] || null;- const fallback = fallbackId ? { id: fallbackId, customPrompt: null } : null;- const ref = override || seriesDefault || fallback;- if (!ref) return null;- const catalog = ref.id ? getVisualStyle(ref.id) : null;- const fragmentParts = [- catalog?.promptFragment || '',- ref.customPrompt || '',- ].map((p) => p.trim()).filter(Boolean);- if (fragmentParts.length === 0) return null;- return {- id: ref.id,- name: catalog?.name || 'Custom',- promptFragment: fragmentParts.join(', '),- };-}--// Returned as a plain (non-frozen) array so JSON serialization doesn't trip-// over the readonly trap on the catalog reference.-export function listVisualStyles() {- return VISUAL_STYLES.map((s) => ({ ...s }));-}diff --git a/server/lib/visualStyles.test.js b/server/lib/visualStyles.test.jsdeleted file mode 100644index 9c8547f6b4..0000000000--- a/server/lib/visualStyles.test.js+++ /dev/null@@ -1,149 +0,0 @@-import { describe, it, expect } from 'vitest';-import {- VISUAL_STYLES,- getVisualStyle,- sanitizeVisualStyleRef,- resolveVisualStyle,- listVisualStyles,-} from './visualStyles.js';--describe('visualStyles — catalog shape invariants', () => {- it('catalog is a non-empty frozen array', () => {- expect(Array.isArray(VISUAL_STYLES)).toBe(true);- expect(VISUAL_STYLES.length).toBeGreaterThan(0);- expect(Object.isFrozen(VISUAL_STYLES)).toBe(true);- });-- it('every entry has id, name, description, and a non-empty promptFragment', () => {- for (const s of VISUAL_STYLES) {- expect(typeof s.id).toBe('string');- expect(s.id.length).toBeGreaterThan(0);- expect(typeof s.name).toBe('string');- expect(s.name.length).toBeGreaterThan(0);- expect(typeof s.description).toBe('string');- expect(typeof s.promptFragment).toBe('string');- expect(s.promptFragment.trim().length).toBeGreaterThan(0);- }- });-- it('ids are unique', () => {- const ids = VISUAL_STYLES.map((s) => s.id);- expect(new Set(ids).size).toBe(ids.length);- });-- it('exposes a graphic-novel preset for the comic-pages default', () => {- expect(VISUAL_STYLES.some((s) => s.id === 'graphic-novel')).toBe(true);- });-- it('listVisualStyles returns a plain (non-frozen) copy', () => {- const list = listVisualStyles();- expect(Object.isFrozen(list)).toBe(false);- expect(list.length).toBe(VISUAL_STYLES.length);- });-});--describe('visualStyles — getVisualStyle', () => {- it('returns the catalog entry for a known id', () => {- const s = getVisualStyle('graphic-novel');- expect(s).toBeTruthy();- expect(s.id).toBe('graphic-novel');- });-- it('returns null for unknown / empty / non-string ids', () => {- expect(getVisualStyle('does-not-exist')).toBe(null);- expect(getVisualStyle('')).toBe(null);- expect(getVisualStyle(null)).toBe(null);- expect(getVisualStyle(undefined)).toBe(null);- expect(getVisualStyle(42)).toBe(null);- });-});--describe('visualStyles — sanitizeVisualStyleRef', () => {- it('returns null for null / undefined / non-objects', () => {- expect(sanitizeVisualStyleRef(null)).toBe(null);- expect(sanitizeVisualStyleRef(undefined)).toBe(null);- expect(sanitizeVisualStyleRef('graphic-novel')).toBe(null);- expect(sanitizeVisualStyleRef(42)).toBe(null);- });-- it('drops unknown ids but keeps customPrompt', () => {- const out = sanitizeVisualStyleRef({ id: 'does-not-exist', customPrompt: 'foo' });- expect(out).toEqual({ id: null, customPrompt: 'foo' });- });-- it('returns null when both id and customPrompt are empty', () => {- expect(sanitizeVisualStyleRef({ id: '', customPrompt: '' })).toBe(null);- expect(sanitizeVisualStyleRef({ id: 'unknown', customPrompt: ' ' })).toBe(null);- });-- it('keeps a valid id with no customPrompt', () => {- expect(sanitizeVisualStyleRef({ id: 'graphic-novel' })).toEqual({- id: 'graphic-novel', customPrompt: null,- });- });-- it('trims customPrompt and caps at 2000 chars', () => {- const long = 'x'.repeat(3000);- const out = sanitizeVisualStyleRef({ id: 'cinematic', customPrompt: ` ${long} ` });- expect(out.customPrompt.length).toBe(2000);- expect(out.id).toBe('cinematic');- });-});--describe('visualStyles — resolveVisualStyle priority', () => {- const series = { visualStyleDefault: { id: 'cinematic' } };- const issueWithOverride = {- stages: { comicPages: { visualStyleOverride: { id: 'anime' } } },- };- const issueWithoutOverride = { stages: { comicPages: {} } };-- it('uses stage override when present', () => {- const r = resolveVisualStyle(series, issueWithOverride, 'comicPages');- expect(r.id).toBe('anime');- });-- it('falls back to series default when no override', () => {- const r = resolveVisualStyle(series, issueWithoutOverride, 'comicPages');- expect(r.id).toBe('cinematic');- });-- it('falls back to stage catalog default when neither override nor series default', () => {- const r = resolveVisualStyle({}, { stages: { comicPages: {} } }, 'comicPages');- expect(r.id).toBe('graphic-novel');- });-- it('storyboards defaults to cinematic when nothing is set', () => {- const r = resolveVisualStyle({}, {}, 'storyboards');- expect(r.id).toBe('cinematic');- });-- it('episodeVideo defaults to cinematic when nothing is set', () => {- const r = resolveVisualStyle({}, {}, 'episodeVideo');- expect(r.id).toBe('cinematic');- });-- it('returns null when stageId has no fallback and nothing is configured', () => {- expect(resolveVisualStyle({}, {}, 'unknown-stage')).toBe(null);- });-- it('appends customPrompt onto the catalog promptFragment', () => {- const r = resolveVisualStyle(- { visualStyleDefault: { id: 'graphic-novel', customPrompt: 'extra ink weight' } },- {},- 'comicPages',- );- expect(r.promptFragment).toMatch(/halftone/);- expect(r.promptFragment).toMatch(/extra ink weight/);- });-- it('handles customPrompt-only refs (id: null)', () => {- const r = resolveVisualStyle(- { visualStyleDefault: { id: null, customPrompt: 'noir-leaning watercolor' } },- {},- 'comicPages',- );- expect(r.id).toBe(null);- expect(r.name).toBe('Custom');- expect(r.promptFragment).toBe('noir-leaning watercolor');- });-});diff --git a/server/routes/pipeline.js b/server/routes/pipeline.jsindex 0de374b4cc..c11e367ff3 100644--- a/server/routes/pipeline.js+++ b/server/routes/pipeline.js@@ -60,7 +60,6 @@ import { generateSeriesTitleLogo } from '../services/pipeline/seriesTitleLogo.jsimport { COMIC_PAGE_VARIANTS, slotKeyForVariant } from '../services/pipeline/owners.js';import { ASPECT_RATIOS, QUALITIES } from '../lib/creativeDirectorPresets.js';import { extractScenes, SOURCE_KIND } from '../lib/sceneExtractor.js';-import { listVisualStyles } from '../lib/visualStyles.js';import { buildComicPdf, PAGE_SIZES, DEFAULT_PAGE_SIZE, ERR_NO_RENDERED_PAGES } from '../services/pipeline/comicPdf.js';import {buildVolumePdf,@@ -127,16 +126,6 @@ const mapServiceError = (err) => {// Zod shapes (`characterSchema` et al.) and the `BIBLE_KIND` plumbing moved// out of this file when the series-side canon routes were retired.-// Visual style ref — `{ id, customPrompt? }`. The id is validated lazily-// (against the catalog in server/lib/visualStyles.js) by the sanitizer at-// persist time so adding a new style doesn't force a schema bump. `id: null`-// + `customPrompt: "..."` is the valid "custom only" shape — preventing it-// here would force the UI to invent a sentinel id just to clear the picker.-const visualStyleRefSchema = z.object({- id: z.string().trim().max(64).nullable().optional(),- customPrompt: z.string().trim().max(2000).nullable().optional(),-}).nullable();-// Arc + Season — phase 2 of Story Arc Planning. The arc lives on the series// record itself; seasons get their own resource so the route layer can take// per-record CRUD without forcing the caller to PATCH the whole series.@@ -197,6 +186,12 @@ const seriesCreateSchema = z.object({name: z.string().trim().min(1).max(seriesSvc.NAME_MAX),logline: z.string().trim().max(seriesSvc.LOGLINE_MAX).optional().default(''),premise: z.string().trim().max(seriesSvc.PREMISE_MAX).optional().default(''),+ // Series in PortOS are expected to be linked to a universe — canon+ // (characters, places, objects, style) lives on the universe and an+ // orphan series has nothing to render against. The UI's create form+ // enforces this; the route stays permissive so the importer and+ // share-bucket sync paths (which preserve remote data fidelity) can+ // still land legacy orphans.universeId: z.string().trim().max(seriesSvc.UNIVERSE_ID_MAX).nullable().optional(),writersRoomWorkId: z.string().trim().max(seriesSvc.WRITERS_ROOM_WORK_ID_MAX).nullable().optional(),arc: arcSchema.nullable().optional(),@@ -206,7 +201,7 @@ const seriesCreateSchema = z.object({titleLogo: z.string().trim().max(seriesSvc.TITLE_LOGO_MAX).optional().default(''),author: z.string().trim().max(seriesSvc.AUTHOR_MAX).optional().default(''),stylePromptOverride: z.string().trim().max(seriesSvc.STYLE_PROMPT_OVERRIDE_MAX).optional().default(''),- visualStyleDefault: visualStyleRefSchema.optional(),+ stylePromptOverrideMode: z.enum(seriesSvc.STYLE_PROMPT_OVERRIDE_MODES).optional(),targetFormat: z.enum(seriesSvc.TARGET_FORMATS).optional(),issueCountTarget: z.number().int().min(0).max(seriesSvc.ISSUE_COUNT_TARGET_MAX).optional(),llm: llmSchema,@@ -225,7 +220,7 @@ const seriesPatchSchema = z.object({titleLogo: z.string().trim().max(seriesSvc.TITLE_LOGO_MAX).optional(),author: z.string().trim().max(seriesSvc.AUTHOR_MAX).optional(),stylePromptOverride: z.string().trim().max(seriesSvc.STYLE_PROMPT_OVERRIDE_MAX).optional(),- visualStyleDefault: visualStyleRefSchema.optional(),+ stylePromptOverrideMode: z.enum(seriesSvc.STYLE_PROMPT_OVERRIDE_MODES).optional(),targetFormat: z.enum(seriesSvc.TARGET_FORMATS).optional(),issueCountTarget: z.number().int().min(0).max(seriesSvc.ISSUE_COUNT_TARGET_MAX).optional(),llm: llmSchema,@@ -304,10 +299,6 @@ const visualStageInputSchema = stageInputSchema.extend({imageJobId: z.string().trim().max(200).nullable().optional(),prompt: z.string().max(16_000).nullable().optional(),}).nullable().optional(),- // Per-stage visual style override. Validated lazily by the sanitizer- // (unknown catalog ids are dropped) so adding a new style doesn't force- // a schema bump on every client.- visualStyleOverride: visualStyleRefSchema.optional(),});// Audio stage payloads carry lines[] (voice-over per dialogue line) + a@@ -544,12 +535,6 @@ const autoRunSchema = z.object({modelId: z.string().trim().max(64).optional(),});-// Static catalog. Express's default ETag handles re-fetches; clients also-// dedup via the module-level promise cache in apiPipeline.js.-router.get('/visual-styles', asyncHandler(async (_req, res) => {- res.json({ styles: listVisualStyles() });-}));-// Merged voice list across every supported TTS engine (Kokoro + Piper today;// future ElevenLabs/etc. when added). Each voice is namespaced with// `engine:voiceName` so the character voice picker shows a single flat list.diff --git a/server/services/pipeline/comicPdf.js b/server/services/pipeline/comicPdf.jsindex 738c7ab264..d155239c0d 100644--- a/server/services/pipeline/comicPdf.js+++ b/server/services/pipeline/comicPdf.js@@ -11,7 +11,6 @@ import { PDFDocument, rgb, StandardFonts } from 'pdf-lib';import { slugifyForFilename } from '../../lib/civitai.js';import { getIssue } from './issues.js';import { getSeries } from './series.js';-import { resolveVisualStyle } from '../../lib/visualStyles.js';import { pickRenderedFilename } from '../../lib/renderSlot.js';import { readImageFromMedia, embedImageBytes, fitImage } from '../../lib/pdfImageEmbed.js';@@ -116,8 +115,6 @@ export async function buildComicPdf(issueId, opts = {}) {cursor -= 12;if (series.logline) drawLine(`Logline: ${series.logline}`, { size: 10 });drawLine(`Generated: ${new Date().toISOString().slice(0, 19).replace('T', ' ')} UTC`, { size: 10 });- const style = resolveVisualStyle(series, issue, 'comicPages');- if (style?.name) drawLine(`Visual style: ${style.name}`, { size: 10 });drawLine(`Page count (rendered art): ${pageCount}`, { size: 10 });cursor -= 16;drawLine('Generated by PortOS pipeline.', { size: 9, color: rgb(0.45, 0.45, 0.45) });diff --git a/server/services/pipeline/comicPdf.test.js b/server/services/pipeline/comicPdf.test.jsindex cd80fadd6b..5a1127cd25 100644--- a/server/services/pipeline/comicPdf.test.js+++ b/server/services/pipeline/comicPdf.test.js@@ -47,7 +47,6 @@ const mockSeries = {id: 'ser-test',name: 'Bone Walker',logline: 'A cult, a city, a child.',- visualStyleDefault: { id: 'graphic-novel', customPrompt: null },};const getIssueMock = vi.fn(async () => structuredClone(mockIssue));diff --git a/server/services/pipeline/issues.js b/server/services/pipeline/issues.jsindex 86530dbd9b..2726683339 100644--- a/server/services/pipeline/issues.js+++ b/server/services/pipeline/issues.js@@ -27,7 +27,6 @@ import {CUSTOM_PAGE_MIN, CUSTOM_PAGE_MAX, CUSTOM_MINUTE_MIN, CUSTOM_MINUTE_MAX,} from '../../lib/issueLength.js';import { sanitizeOrigin } from '../../lib/sharingOrigin.js';-import { sanitizeVisualStyleRef } from '../../lib/visualStyles.js';import { ServerError } from '../../lib/errorHandler.js';import { ARC_ROLES } from '../../lib/storyArc.js';import { isStr, trimTo } from '../../lib/storyBible.js';@@ -200,9 +199,6 @@ const sanitizeVisualStage = (raw, stageId = null) => {// enforces the rule.cover: stageId === null || stageId === 'comicPages' ? sanitizeCoverLike(raw?.cover) : null,backCover: stageId === null || stageId === 'comicPages' ? sanitizeCoverLike(raw?.backCover) : null,- // Per-stage override so a series can mix aesthetics- // (e.g. graphic-novel panels + cinematic storyboards).- visualStyleOverride: sanitizeVisualStyleRef(raw?.visualStyleOverride),};};diff --git a/server/services/pipeline/series.js b/server/services/pipeline/series.jsindex 2bfb572de2..d0371e85ae 100644--- a/server/services/pipeline/series.js+++ b/server/services/pipeline/series.js@@ -17,7 +17,6 @@ import { PATHS, atomicWrite, readJSONFile, ensureDir } from '../../lib/fileUtilsimport { createFileWriteQueue } from '../../lib/fileWriteQueue.js';import { isStr, trimTo } from '../../lib/storyBible.js';import { sanitizeArc, sanitizeSeasonList } from '../../lib/storyArc.js';-import { sanitizeVisualStyleRef } from '../../lib/visualStyles.js';import { sanitizeOrigin } from '../../lib/sharingOrigin.js';import { emitRecordUpdated, emitRecordDeleted } from '../sharing/recordEvents.js';import { renameCollectionForSeries, unlinkCollectionsForSeries } from '../mediaCollections.js';@@ -47,6 +46,15 @@ export const LOGLINE_MAX = 500;export const PREMISE_MAX = 8000;export const STYLE_NOTES_MAX = 4000;export const STYLE_PROMPT_OVERRIDE_MAX = 1000;+// How `stylePromptOverride` composes with the universe's style influences:+// 'prepend' — override leads, universe trails (the historical default+// — slight deviation, universe still visible)+// 'append' — universe leads, override trails (universe-dominant)+// 'override' — universe style is dropped entirely (full spinoff look)+// Default 'prepend' so existing series migrate forward without a writer+// pass and the field can be absent in JSON.+export const STYLE_PROMPT_OVERRIDE_MODES = Object.freeze(['prepend', 'append', 'override']);+export const STYLE_PROMPT_OVERRIDE_MODE_DEFAULT = 'prepend';// Title/logo design concept — prose description injected into cover + TV// title-screen prompts as the "logo design" cue. Generated from the universe's// style notes on series creation; editable in the bible.@@ -126,11 +134,9 @@ const sanitizeSeries = (raw) => {// forking the universe. Empty string = no override; fall through to// universe-only style.stylePromptOverride: trimTo(raw.stylePromptOverride, STYLE_PROMPT_OVERRIDE_MAX),- // Series-level default visual style (catalog id + optional custom prompt).- // `null` when the user hasn't picked one — stage-level fallbacks in- // resolveVisualStyle() handle that case so legacy series keep rendering- // without a writer pass.- visualStyleDefault: sanitizeVisualStyleRef(raw.visualStyleDefault),+ stylePromptOverrideMode: STYLE_PROMPT_OVERRIDE_MODES.includes(raw.stylePromptOverrideMode)+ ? raw.stylePromptOverrideMode+ : STYLE_PROMPT_OVERRIDE_MODE_DEFAULT,targetFormat,issueCountTarget,llm,@@ -184,6 +190,7 @@ export async function createSeries(input = {}) {titleLogo: input.titleLogo || '',author: input.author || '',stylePromptOverride: input.stylePromptOverride || '',+ stylePromptOverrideMode: input.stylePromptOverrideMode,targetFormat: input.targetFormat || 'comic+tv',issueCountTarget: input.issueCountTarget || 0,llm: input.llm || null,@@ -247,7 +254,7 @@ export async function updateSeries(id, patch = {}) {...('titleLogo' in patch ? { titleLogo: patch.titleLogo } : {}),...('author' in patch ? { author: patch.author } : {}),...('stylePromptOverride' in patch ? { stylePromptOverride: patch.stylePromptOverride } : {}),- ...('visualStyleDefault' in patch ? { visualStyleDefault: patch.visualStyleDefault } : {}),+ ...('stylePromptOverrideMode' in patch ? { stylePromptOverrideMode: patch.stylePromptOverrideMode } : {}),...('targetFormat' in patch ? { targetFormat: patch.targetFormat } : {}),...('issueCountTarget' in patch ? { issueCountTarget: patch.issueCountTarget } : {}),...('origin' in patch ? { origin: patch.origin } : {}),diff --git a/server/services/pipeline/series.test.js b/server/services/pipeline/series.test.jsindex abe68a9d2c..8e622324a5 100644--- a/server/services/pipeline/series.test.js+++ b/server/services/pipeline/series.test.js@@ -92,6 +92,31 @@ describe('pipeline series service', () => {expect(s.targetFormat).toBe('comic+tv');});+ describe('stylePromptOverrideMode', () => {+ it('defaults to "prepend" when not supplied', async () => {+ const s = await svc.createSeries({ name: 'X' });+ expect(s.stylePromptOverrideMode).toBe('prepend');+ });++ it('accepts "append" and "override" on create', async () => {+ const a = await svc.createSeries({ name: 'A', stylePromptOverrideMode: 'append' });+ const b = await svc.createSeries({ name: 'B', stylePromptOverrideMode: 'override' });+ expect(a.stylePromptOverrideMode).toBe('append');+ expect(b.stylePromptOverrideMode).toBe('override');+ });++ it('coerces an unknown value back to "prepend"', async () => {+ const s = await svc.createSeries({ name: 'X', stylePromptOverrideMode: 'nonsense' });+ expect(s.stylePromptOverrideMode).toBe('prepend');+ });++ it('round-trips through updateSeries', async () => {+ const s = await svc.createSeries({ name: 'X' });+ const u = await svc.updateSeries(s.id, { stylePromptOverrideMode: 'override' });+ expect(u.stylePromptOverrideMode).toBe('override');+ });+ });+it('silently drops legacy canon fields on create (Phase B.4: canon moved to universe)', async () => {// A stale client that still sends `characters: [...]` on series create// gets a 200 — the field is dropped server-side instead of 400'ing —diff --git a/server/services/pipeline/visualStages.js b/server/services/pipeline/visualStages.jsindex 68f1c4353e..81e9eac020 100644--- a/server/services/pipeline/visualStages.js+++ b/server/services/pipeline/visualStages.js@@ -38,33 +38,33 @@ import {} from '../../lib/scenePrompt.js';import { richCanonDescriptorFragments } from '../../lib/canonPrompt.js';import { composeStyledPrompt } from '../../lib/composeStyledPrompt.js';-import { resolveVisualStyle } from '../../lib/visualStyles.js';import { getDefaultVideoModelId, getVideoModels } from '../../lib/mediaModels.js';import { runStagedLLM } from '../../lib/stageRunner.js';import { runPromptRefine } from './refineHelpers.js';import { pickCanon } from './seriesCanon.js';+import { STYLE_PROMPT_OVERRIDE_MODE_DEFAULT } from './series.js';import { ASPECT_PRESETS } from '../../lib/creativeDirectorPresets.js';const joinStyleParts = (...parts) =>parts.map((s) => (s || '').trim()).filter(Boolean).join(', ');+const joinStyleSentences = (...parts) =>+ parts.map((s) => (s || '').trim()).filter(Boolean).join('. ');+const stackStyle = (series, extraStyle) => joinStyleParts(series?.styleNotes, extraStyle);-// Resolved fragment leads so the curated aesthetic dominates over the caller's-// free-text additions.-const composeExtraStyle = (series, issue, stageId, callerExtraStyle = '') =>- joinStyleParts(resolveVisualStyle(series, issue, stageId)?.promptFragment, callerExtraStyle);--// Build the style-prompt prefix for a series + universe pair. The per-series-// override prepends ahead of the universe's embrace influences so a single-// series can deviate (e.g. a noir spin-off) without forking the universe;-// the universe's broader aesthetic still trails so it stays visible to the-// diffusion model. Returns '' when neither side has content — caller skips-// the composeStyledPrompt wrap in that case.+// Composes `series.stylePromptOverride` against the universe's embrace+// influences. The mode (prepend/append/override) is documented next to the+// `STYLE_PROMPT_OVERRIDE_MODES` constant in series.js — it's the single+// source of truth.const buildStyleClause = (world, series) => {const override = (series?.stylePromptOverride || '').trim();+ const mode = series?.stylePromptOverrideMode || STYLE_PROMPT_OVERRIDE_MODE_DEFAULT;+ if (override && mode === 'override') return override;const universeStyle = joinInfluenceList(world?.influences?.embrace);- return [override, universeStyle].filter(Boolean).join('. ');+ return mode === 'append'+ ? joinStyleSentences(universeStyle, override)+ : joinStyleSentences(override, universeStyle);};const applyWorldStyle = (prompt, world, series = null) => {@@ -139,10 +139,10 @@ const loadBibleContext = async (issueId) => {const issueChain = (async () => {const issue = await getIssue(issueId);const series = await getSeries(issue.seriesId);- const world = series.universeId ? await getUniverse(series.universeId).catch(() => null) : null;- // Orphan series (no universeId or a dangling reference) render against- // empty canon — the visual prompt still includes scene description,- // just without character/setting/object metadata.+ // `.catch(() => null)` covers a dangling universe reference. Empty+ // canon still lets scene description flow through; downstream stages+ // just lose character / place / object metadata.+ const world = await getUniverse(series.universeId).catch(() => null);return { issue, series, world, canon: pickCanon(world) };})();const [chain, settings] = await Promise.all([issueChain, getSettings()]);@@ -413,7 +413,7 @@ async function enqueueComicCoverLike(issueId, target, options = {}) {const initImageStrength = fromProof? (Number.isFinite(options.initImageStrength) ? options.initImageStrength : PROOF_AS_BASE_DEFAULT_STRENGTH): undefined;- const extraStyle = composeExtraStyle(series, issue, 'comicPages', options.extraStyle);+ const extraStyle = options.extraStyle || '';const prompt = target === 'cover'? composeComicCoverPrompt({ series, world, issue, coverScript: script, extraStyle }): composeComicBackCoverPrompt({ series, world, issue, backCoverScript: script, extraStyle });@@ -465,7 +465,7 @@ export async function enqueueComicBackCover(issueId, options = {}) {const loadSeasonContext = async (seriesId, seasonId) => {const seriesChain = (async () => {const series = await getSeries(seriesId);- const world = series.universeId ? await getUniverse(series.universeId).catch(() => null) : null;+ const world = await getUniverse(series.universeId).catch(() => null);return { series, world };})();const [chain, settings] = await Promise.all([seriesChain, getSettings()]);@@ -552,10 +552,7 @@ async function enqueueVolumeCoverLike(seriesId, seasonId, target, options = {})const initImageStrength = fromProof? (Number.isFinite(options.initImageStrength) ? options.initImageStrength : PROOF_AS_BASE_DEFAULT_STRENGTH): undefined;- // Volume covers use the series-level visual style (no per-issue override,- // since a volume spans many issues that may have different overrides).- const styleFragment = resolveVisualStyle(series, null, 'comicPages')?.promptFragment || '';- const extraStyle = joinStyleParts(styleFragment, options.extraStyle);+ const extraStyle = options.extraStyle || '';const prompt = target === 'cover'? composeVolumeCoverPrompt({ series, world, season, coverScript: script, extraStyle }): composeVolumeBackCoverPrompt({ series, world, season, backCoverScript: script, extraStyle });@@ -755,7 +752,7 @@ export async function enqueueVisualComicPage(issueId, options = {}) {// covers panels with no description, so the prompt is non-empty by here.const prompt = composeComicPagePrompt({series, world, page, pageNumber: pageIndex + 1,- extraStyle: composeExtraStyle(series, issue, 'comicPages', options.extraStyle),+ extraStyle: options.extraStyle || '',matchedCharacters, matchedPlaces, matchedObjects,});@@ -789,7 +786,7 @@ export async function enqueueVisualImage(issueId, stageId, options = {}) {series,description: options.description,slugline: options.slugline,- extraStyle: composeExtraStyle(series, issue, stageId, options.extraStyle),+ extraStyle: options.extraStyle || '',matchedCharacters,world,canon,@@ -858,7 +855,7 @@ export async function enqueueStoryboardSceneVideo(issueId, sceneIndex, options =series,description: scene.description,slugline: scene.slugline || '',- extraStyle: composeExtraStyle(series, issue, 'storyboards', options.extraStyle),+ extraStyle: options.extraStyle || '',matchedCharacters,world,canon,@@ -955,7 +952,7 @@ export async function enqueueStoryboardShotStartFrame(issueId, sceneIndex, shotIseries,description,slugline: scene.slugline || '',- extraStyle: composeExtraStyle(series, issue, 'storyboards', options.extraStyle),+ extraStyle: options.extraStyle || '',matchedCharacters,world,canon,diff --git a/server/services/pipeline/visualStages.test.js b/server/services/pipeline/visualStages.test.jsindex 25873fa1c7..ccb1a2830d 100644--- a/server/services/pipeline/visualStages.test.js+++ b/server/services/pipeline/visualStages.test.js@@ -42,6 +42,7 @@ vi.mock('./issues.js', () => ({vi.mock('./series.js', () => ({getSeries: vi.fn(async () => ({ id: 'ser-test', name: 'Test', styleNotes: 'noir', characters: [], settings: [] })),+ STYLE_PROMPT_OVERRIDE_MODE_DEFAULT: 'prepend',}));vi.mock('../settings.js', () => ({@@ -208,11 +209,11 @@ describe('composeComicPagePrompt', () => {expect(prompt).toMatch(/cinematic ink illustration/);});- it('prepends series.stylePromptOverride ahead of the universe embrace tokens', () => {+ it('mode=prepend (default): override leads, universe embrace tokens trail', () => {// A per-series override lets one series in a shared universe deviate// visually (e.g. a noir spin-off) without forking the universe. The- // override prepends so its tokens land in the heaviest position, with- // the universe style trailing — both must appear, override first.+ // default 'prepend' mode places override first so its tokens land in+ // the heaviest position, with the universe style trailing.const world = {influences: {embrace: ['cinematic ink illustration', 'dramatic lighting'],@@ -228,20 +229,42 @@ describe('composeComicPagePrompt', () => {expect(overrideAt).toBeLessThan(universeAt);});- it('falls through to universe-only style when stylePromptOverride is empty', () => {+ it('mode=append: universe leads, override trails', () => {+ const world = {+ influences: { embrace: ['cinematic ink illustration', 'dramatic lighting'], avoid: [] },+ };+ const series = { ...SERIES, stylePromptOverride: 'moody noir lighting', stylePromptOverrideMode: 'append' };+ const prompt = composeComicPagePrompt({ series, world, page: PAGE, pageNumber: 1 });+ const overrideAt = prompt.indexOf('moody noir lighting');+ const universeAt = prompt.indexOf('cinematic ink illustration');+ expect(overrideAt).toBeGreaterThan(universeAt);+ });++ it('mode=override: drops the universe embrace tokens entirely', () => {+ const world = {+ influences: { embrace: ['cinematic ink illustration', 'dramatic lighting'], avoid: [] },+ };+ const series = { ...SERIES, stylePromptOverride: 'moody noir lighting', stylePromptOverrideMode: 'override' };+ const prompt = composeComicPagePrompt({ series, world, page: PAGE, pageNumber: 1 });+ expect(prompt).toMatch(/moody noir lighting/);+ expect(prompt).not.toMatch(/cinematic ink illustration/);+ });++ it('falls through to universe-only style when stylePromptOverride is empty (any mode)', () => {const world = {influences: { embrace: ['cinematic ink illustration'], avoid: [] },};- const seriesNoOverride = { ...SERIES, stylePromptOverride: '' };- const prompt = composeComicPagePrompt({ series: seriesNoOverride, world, page: PAGE, pageNumber: 1 });- expect(prompt).toMatch(/cinematic ink illustration/);- expect(prompt).not.toMatch(/moody noir/);+ // Mode is ignored when there's no override text — universe always wins.+ for (const mode of ['prepend', 'append', 'override']) {+ const series = { ...SERIES, stylePromptOverride: '', stylePromptOverrideMode: mode };+ const prompt = composeComicPagePrompt({ series, world, page: PAGE, pageNumber: 1 });+ expect(prompt).toMatch(/cinematic ink illustration/);+ }});it('applies stylePromptOverride even without a universe (no embrace tokens)', () => {- // The override is independent of the universe — if the series has an- // override but isn't linked to a universe (or the universe has no- // embrace tokens), the override still prepends to the prompt.+ // The override is independent of the universe — if the universe has no+ // embrace tokens, the override still threads through.const seriesWithOverride = { ...SERIES, stylePromptOverride: 'experimental rotoscope' };const prompt = composeComicPagePrompt({ series: seriesWithOverride, page: PAGE, pageNumber: 1 });expect(prompt).toMatch(/experimental rotoscope/);@@ -332,47 +355,6 @@ describe('composeComicPagePrompt', () => {});});-describe('visual style resolution threads into image prompts', () => {- it('applies series.visualStyleDefault catalog fragment to the cover prompt', async () => {- const seriesMod = await import('./series.js');- seriesMod.getSeries.mockResolvedValueOnce({- id: 'ser-test', name: 'Test', styleNotes: '', characters: [], settings: [],- visualStyleDefault: { id: 'graphic-novel', customPrompt: null },- });- const result = await enqueueComicCover('iss-test', {});- // The graphic-novel preset's promptFragment lands inside the cover prompt's- // `Art style: ...` clause via stackStyle's composition.- expect(result.prompt).toMatch(/Art style:.*halftone/i);- });-- it('stage override beats series default for comic page prompts', async () => {- const seriesMod = await import('./series.js');- seriesMod.getSeries.mockResolvedValueOnce({- id: 'ser-test', name: 'Test', styleNotes: '', characters: [], settings: [],- visualStyleDefault: { id: 'graphic-novel', customPrompt: null },- });- getIssueMock.mockResolvedValueOnce({- ...structuredClone(mockIssue),- stages: {- ...mockIssue.stages,- comicPages: {- ...mockIssue.stages.comicPages,- visualStyleOverride: { id: 'anime', customPrompt: null },- },- },- });- const result = await enqueueComicCover('iss-test', {});- expect(result.prompt).toMatch(/anime|cel-shaded/i);- expect(result.prompt).not.toMatch(/halftone/i);- });-- it('falls back to the storyboards catalog default (cinematic) when nothing is configured', async () => {- const result = await enqueueStoryboardSceneVideo('iss-test', 0, { aspectRatio: '16:9' });- // 'cinematic' fragment includes "photorealistic" and "35mm film".- const params = enqueueJobMock.mock.calls.at(-1)[0].params;- expect(params.prompt).toMatch(/photorealistic|35mm film/i);- });-});describe('per-stage lock enforcement', () => {it('checks the comicPages lock before queueing a cover render', async () => {