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
feat(pipeline): design series title/logo + capture author for covers + TV title screens (#272)
[._.]/ Adam Eivy9a664e3d1bfb
diff --git a/client/src/pages/Pipeline.jsx b/client/src/pages/Pipeline.jsxindex 23621d37dd..b486218f9d 100644--- a/client/src/pages/Pipeline.jsx+++ b/client/src/pages/Pipeline.jsx@@ -17,7 +17,9 @@ import {listPipelineSeries,createPipelineSeries,deletePipelineSeries,+ generateSeriesTitleLogo,listUniverses,+ SERIES_AUTHOR_MAX,WORLD_LOGLINE_MAX,WORLD_PREMISE_MAX,WORLD_STYLE_NOTES_MAX,@@ -30,6 +32,7 @@ const emptyForm = () => ({logline: '',premise: '',styleNotes: '',+ author: '',shape: null,issueCountTarget: '',});@@ -95,6 +98,7 @@ export default function Pipeline() {logline: form.logline.trim(),premise: form.premise.trim(),styleNotes: form.styleNotes.trim(),+ author: form.author.trim(),universeId: form.universeId || undefined,issueCountTarget: Number.isFinite(target) && target > 0 ? target : undefined,arc: form.shape ? { shape: form.shape } : undefined,@@ -109,6 +113,16 @@ export default function Pipeline() {setForm(emptyForm());setShowForm(false);toast.success(`Created "${created.name}"`);+ // Fire-and-forget logo design when a universe is linked — the LLM brief+ // needs universe influences + style notes, and gating creation on a multi-+ // second call would feel slow. User can retry from the bible sidebar.+ if (created.universeId && !created.titleLogo) {+ generateSeriesTitleLogo(created.id, {}, { silent: true })+ .then(({ series: updated }) => {+ setSeries((prev) => prev.map((s) => (s.id === updated.id ? updated : s)));+ })+ .catch(() => {});+ }};// Two-click delete: first click "arms" the row, second click fires. Avoids@@ -194,19 +208,35 @@ export default function Pipeline() {</p></div></div>- <div>- <label htmlFor="series-logline" className="block text-xs uppercase tracking-wider text-gray-500 mb-1">- Logline- </label>- <input- id="series-logline"- type="text"- value={form.logline}- onChange={(e) => setForm((f) => ({ ...f, logline: e.target.value }))}- placeholder="A foundry city goes silent — and the only survivor is a child."- className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"- maxLength={WORLD_LOGLINE_MAX}- />+ <div className="grid grid-cols-1 sm:grid-cols-[1fr_240px] gap-3">+ <div>+ <label htmlFor="series-logline" className="block text-xs uppercase tracking-wider text-gray-500 mb-1">+ Logline+ </label>+ <input+ id="series-logline"+ type="text"+ value={form.logline}+ onChange={(e) => setForm((f) => ({ ...f, logline: e.target.value }))}+ placeholder="A foundry city goes silent — and the only survivor is a child."+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"+ maxLength={WORLD_LOGLINE_MAX}+ />+ </div>+ <div>+ <label htmlFor="series-author" className="block text-xs uppercase tracking-wider text-gray-500 mb-1">+ Author (cover byline)+ </label>+ <input+ id="series-author"+ type="text"+ value={form.author}+ onChange={(e) => setForm((f) => ({ ...f, author: e.target.value }))}+ placeholder="Jane Doe"+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"+ maxLength={SERIES_AUTHOR_MAX}+ />+ </div></div><div className="grid grid-cols-1 sm:grid-cols-[1fr_180px] gap-3 items-start"><ArcShapePickerdiff --git a/client/src/pages/PipelineSeries.jsx b/client/src/pages/PipelineSeries.jsxindex 7e50bfbb5f..bb2a9564ab 100644--- a/client/src/pages/PipelineSeries.jsx+++ b/client/src/pages/PipelineSeries.jsx@@ -14,7 +14,7 @@ import { useEffect, useRef, useState } from 'react';import { Link, useParams, useNavigate } from 'react-router-dom';import {ArrowLeft, Save, Loader2, Workflow as WorkflowIcon, Globe, NotebookPen,- PanelLeftClose, PanelLeftOpen,+ PanelLeftClose, PanelLeftOpen, Sparkles,} from 'lucide-react';import toast from '../components/ui/Toast';import ArcCanvas from '../components/pipeline/ArcCanvas';@@ -23,6 +23,8 @@ import {getPipelineSeries, updatePipelineSeries,listPipelineIssues,listUniverses,+ generateSeriesTitleLogo,+ SERIES_TITLE_LOGO_MAX, SERIES_AUTHOR_MAX,} from '../services/api';import { recommendStructure, describeStructure } from '../lib/seasonStructure';import { useLocalStorageBool } from '../hooks/useLocalStorageBool';@@ -90,7 +92,7 @@ export default function PipelineSeries() {const flushPending = async () => {if (!series) return false;const saved = lastSavedRef.current || series;- const fields = ['name', 'logline', 'premise', 'styleNotes', 'stylePromptOverride', 'issueCountTarget', 'universeId'];+ const fields = ['name', 'logline', 'premise', 'styleNotes', 'titleLogo', 'author', 'stylePromptOverride', 'issueCountTarget', 'universeId'];const dirty = fields.some((k) => (series[k] ?? '') !== (saved[k] ?? ''))|| JSON.stringify(series.llm || {}) !== JSON.stringify(saved.llm || {});if (!dirty) return false;@@ -100,6 +102,8 @@ export default function PipelineSeries() {premise: series.premise,universeId: series.universeId || null,styleNotes: series.styleNotes,+ titleLogo: series.titleLogo || '',+ author: series.author || '',stylePromptOverride: series.stylePromptOverride || '',issueCountTarget: series.issueCountTarget,llm: series.llm || { provider: null, model: null },@@ -169,6 +173,8 @@ export default function PipelineSeries() {series={series}universes={universes}patchSeries={patchSeries}+ onSeriesUpdate={updateSeriesFromServer}+ onFlushPending={flushPending}onCollapse={toggleSidebar}/></aside>@@ -214,7 +220,22 @@ export default function PipelineSeries() {);}-function BibleSidebar({ series, universes, patchSeries, onCollapse }) {+function BibleSidebar({ series, universes, patchSeries, onSeriesUpdate, onFlushPending, onCollapse }) {+ const [generatingLogo, setGeneratingLogo] = useState(false);+ const handleGenerateLogo = async () => {+ // Server reads from disk — flush dirty edits so the LLM sees fresh fields.+ if (onFlushPending) await onFlushPending();+ setGeneratingLogo(true);+ const result = await generateSeriesTitleLogo(series.id).catch((err) => {+ toast.error(err.message || 'Failed to design logo');+ return null;+ });+ setGeneratingLogo(false);+ if (!result) return;+ onSeriesUpdate?.(result.series);+ toast.success('Logo concept designed');+ };+return (<section className="px-3 py-3 space-y-4"><div className="flex items-center justify-between">@@ -238,6 +259,15 @@ function BibleSidebar({ series, universes, patchSeries, onCollapse }) {maxLength={200}/></Field>+ <Field label="Author (cover byline + title screen)">+ <input+ value={series.author || ''}+ onChange={(e) => patchSeries({ author: e.target.value })}+ placeholder="Jane Doe"+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"+ maxLength={SERIES_AUTHOR_MAX}+ />+ </Field><Field label="Logline"><inputvalue={series.logline || ''}@@ -283,6 +313,39 @@ function BibleSidebar({ series, universes, patchSeries, onCollapse }) {/></Field>+ <div className="block">+ <div className="flex items-center justify-between mb-1">+ <label+ htmlFor="series-title-logo"+ className="block text-xs uppercase tracking-wider text-gray-500"+ >+ Title / logo design+ </label>+ <button+ type="button"+ onClick={handleGenerateLogo}+ disabled={generatingLogo}+ className="inline-flex items-center gap-1 px-2 py-1 rounded text-[11px] text-port-accent hover:bg-port-bg disabled:opacity-50"+ title="Design the masthead/logo with an LLM, using the series name + logline + style notes + universe influences"+ >+ {generatingLogo ? <Loader2 size={11} className="animate-spin" /> : <Sparkles size={11} />}+ {series.titleLogo ? 'Regenerate' : 'Design'}+ </button>+ </div>+ <textarea+ id="series-title-logo"+ value={series.titleLogo || ''}+ onChange={(e) => patchSeries({ titleLogo: e.target.value })}+ rows={4}+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"+ maxLength={SERIES_TITLE_LOGO_MAX}+ placeholder="A description of the series masthead — letterform, finish, color, motifs. Injected into every cover prompt and TV title screen. Click Design to generate from the bible + universe."+ />+ <p className="text-[11px] text-gray-500 mt-1">+ Generated once on series creation from a universe; edit freely. Used by issue covers, volume covers, and TV title screens.+ </p>+ </div>+<Field label="Visual style preset"><div className="flex items-center gap-2"><VisualStylePickerdiff --git a/client/src/services/apiPipeline.js b/client/src/services/apiPipeline.jsindex bcd06d8f6f..cd6494a536 100644--- a/client/src/services/apiPipeline.js+++ b/client/src/services/apiPipeline.js@@ -92,6 +92,19 @@ export const deletePipelineSeries = (id) => request(`/pipeline/series/${encodeURmethod: 'DELETE',});+// `requestOptions` flows to apiCore.request — pass `{ silent: true }` when the+// caller owns its own error UX (fire-and-forget on post-create).+export const generateSeriesTitleLogo = (id, opts = {}, requestOptions = {}) =>+ request(`/pipeline/series/${encodeURIComponent(id)}/generate-title-logo`, {+ method: 'POST',+ body: JSON.stringify(opts),+ ...requestOptions,+ });++// Mirror server caps in `server/services/pipeline/series.js` — bump both sides.+export const SERIES_TITLE_LOGO_MAX = 2000;+export const SERIES_AUTHOR_MAX = 120;+// ---- Issues ----export const listPipelineIssues = (seriesId) =>request(`/pipeline/series/${encodeURIComponent(seriesId)}/issues`);diff --git a/data.sample/prompts/stage-config.json b/data.sample/prompts/stage-config.jsonindex 634fa5dbdf..e86afe1417 100644--- a/data.sample/prompts/stage-config.json+++ b/data.sample/prompts/stage-config.json@@ -256,6 +256,13 @@"returnsJson": true,"variables": []},+ "pipeline-series-title-logo": {+ "name": "Pipeline — Series Title / Logo Design",+ "description": "Design the series masthead / logo typography from the series name + logline + style notes + universe influences. Returns a {titleLogo} JSON object — a single prose paragraph describing typography treatment, finish, color hints, and motifs to inject into cover prompts and TV title screens. Runs once on series creation from a universe; user can regenerate from the bible sidebar.",+ "model": "default",+ "returnsJson": true,+ "variables": []+ },"pipeline-comic-panel-image-prompt": {"name": "Pipeline — Comic Panel Image Prompt","description": "Refine a single comic panel's description into a richer image-gen-ready prompt. Uses caption / dialogue / sfx context + neighboring-panel continuity to elaborate without re-imagining the scene.",diff --git a/data.sample/prompts/stages/pipeline-series-title-logo.md b/data.sample/prompts/stages/pipeline-series-title-logo.mdnew file mode 100644index 0000000000..e330d49c88--- /dev/null+++ b/data.sample/prompts/stages/pipeline-series-title-logo.md@@ -0,0 +1,45 @@+# Pipeline — Series Title / Logo Design++You are a comic-book logo designer and title-card art director. Design the masthead / logo typography for the series below. Your output is a single prose paragraph injected into cover-art image-gen prompts (issue covers, volume covers) and used as the title-screen reference for TV episodes — describe the **letterform and finish**, not the scene around it.++## Series++- **Title:** {{series.name}}+- **Logline:** {{series.logline}}+- **Tone / style notes:** {{series.styleNotes}}++{{#hasUniverse}}+## Universe context++- **Premise:** {{universe.premise}}+- **Embrace influences (style tokens):** {{universe.embrace}}+- **Avoid influences (negative tokens):** {{universe.avoid}}+{{/hasUniverse}}++## What to write++A single paragraph (~40–90 words) that an image diffusion model can read top-to-bottom while rendering a cover. Cover the following in order:++1. **Letterform** — typeface character (slab serif, brushed sans, condensed gothic, script, hand-drawn, distressed, custom), case, weight, kerning.+2. **Finish + material** — how the title is rendered (gold foil, chrome, ink-stamp, neon glow, embossed, painted, etched). Pick one or two — don't pile on.+3. **Color treatment** — palette, gradient direction, contrast against a typical cover background. Stay consistent with the series style notes / universe embrace tokens.+4. **Motifs (optional, ≤1)** — a single visual hook (a knot in a serif, a sigil in a counter, a hairline crack) that makes this masthead recognizable. Skip if forced.++## Rules++- Describe the **logo only**. Do **not** describe the cover scene, characters, or environment — those are written per-issue.+- Don't repeat the series name back in the prose — the renderer letters it. You're describing how it looks once lettered.+- Keep it concrete and renderable. Avoid abstract adjectives like "iconic," "memorable," "powerful."+- Match the series' tonal register: a noir series wants ink and shadow, not chrome airbrush; a kids' adventure wants playful brush ink, not blackletter.+- One unified design — not a list of three alternatives.++## Output++Return ONLY valid JSON. The `titleLogo` field replaces the series bible's current titleLogo description.++```json+{+ "titleLogo": "<single paragraph describing the title/logo design, ~40–90 words>",+ "rationale": "<one short sentence on why this fits the series — for the user, not the renderer>"+}+```diff --git a/server/routes/pipeline.js b/server/routes/pipeline.jsindex 51bc02d943..9cb23c78bd 100644--- a/server/routes/pipeline.js+++ b/server/routes/pipeline.js@@ -54,6 +54,7 @@ import {import { extractCanonFromProse } from '../services/universeCanon.js';import { getSeriesCanon } from '../services/pipeline/seriesCanon.js';import { startEpisodeVideoForIssue, ERR_NO_STORYBOARDS } from '../services/pipeline/episodeVideo.js';+import { generateSeriesTitleLogo } from '../services/pipeline/seriesTitleLogo.js';import { 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';@@ -179,6 +180,8 @@ const seriesCreateSchema = z.object({seasons: z.array(seasonSchema).max(ARC_LIMITS.SEASONS_PER_SERIES_MAX).optional(),locked: seriesLockedSchema.optional(),styleNotes: z.string().trim().max(seriesSvc.STYLE_NOTES_MAX).optional().default(''),+ 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(),targetFormat: z.enum(seriesSvc.TARGET_FORMATS).optional(),@@ -196,6 +199,8 @@ const seriesPatchSchema = z.object({seasons: z.array(seasonSchema).max(ARC_LIMITS.SEASONS_PER_SERIES_MAX).optional(),locked: seriesLockedSchema.optional(),styleNotes: z.string().trim().max(seriesSvc.STYLE_NOTES_MAX).optional(),+ 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(),targetFormat: z.enum(seriesSvc.TARGET_FORMATS).optional(),@@ -798,6 +803,20 @@ router.delete('/series/:id', asyncHandler(async (req, res) => {res.json(r);}));+// Generate (or regenerate) the series.titleLogo description via the+// `pipeline-series-title-logo` stage. Returns the updated series so the+// client can swap state without a follow-up GET.+const titleLogoGenerateSchema = z.object({+ providerId: z.string().trim().max(80).optional(),+ model: z.string().trim().max(200).optional(),+});+router.post('/series/:id/generate-title-logo', asyncHandler(async (req, res) => {+ const body = validateRequest(titleLogoGenerateSchema, req.body ?? {});+ const result = await generateSeriesTitleLogo(req.params.id, body)+ .catch((err) => { throw mapServiceError(err); });+ res.json(result);+}));+router.get('/series/:id/issues', asyncHandler(async (req, res) => {// Validate the series exists so a typo returns 404 instead of [] (less// confusing for the UI).diff --git a/server/services/pipeline/series.js b/server/services/pipeline/series.jsindex 51d3b29f6f..7424ff35cd 100644--- a/server/services/pipeline/series.js+++ b/server/services/pipeline/series.js@@ -56,6 +56,11 @@ export const LOGLINE_MAX = 500;export const PREMISE_MAX = 8000;export const STYLE_NOTES_MAX = 4000;export const STYLE_PROMPT_OVERRIDE_MAX = 1000;+// 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.+export const TITLE_LOGO_MAX = 2000;+export const AUTHOR_MAX = 120;export const UNIVERSE_ID_MAX = 64;export const WRITERS_ROOM_WORK_ID_MAX = 64;export const TARGET_FORMATS = Object.freeze(['comic', 'tv', 'comic+tv']);@@ -107,6 +112,8 @@ const sanitizeSeries = (raw) => {seasons: sanitizeSeasonList(raw.seasons),locked: sanitizeSeriesLocked(raw.locked),styleNotes: trimTo(raw.styleNotes, STYLE_NOTES_MAX),+ titleLogo: trimTo(raw.titleLogo, TITLE_LOGO_MAX),+ author: trimTo(raw.author, AUTHOR_MAX),// Per-series override that prepends ahead of the linked universe's// stylePrompt during image-gen composition. Lets a single series in a// shared universe deviate slightly (e.g. a noir spin-off) without@@ -168,6 +175,8 @@ export async function createSeries(input = {}) {seasons: input.seasons || [],locked: input.locked || {},styleNotes: input.styleNotes || '',+ titleLogo: input.titleLogo || '',+ author: input.author || '',stylePromptOverride: input.stylePromptOverride || '',targetFormat: input.targetFormat || 'comic+tv',issueCountTarget: input.issueCountTarget || 0,@@ -229,6 +238,8 @@ export async function updateSeries(id, patch = {}) {// Wholesale replace — `locked: {}` clears every lock; omission preserves....('locked' in patch ? { locked: patch.locked } : {}),...('styleNotes' in patch ? { styleNotes: patch.styleNotes } : {}),+ ...('titleLogo' in patch ? { titleLogo: patch.titleLogo } : {}),+ ...('author' in patch ? { author: patch.author } : {}),...('stylePromptOverride' in patch ? { stylePromptOverride: patch.stylePromptOverride } : {}),...('visualStyleDefault' in patch ? { visualStyleDefault: patch.visualStyleDefault } : {}),...('targetFormat' in patch ? { targetFormat: patch.targetFormat } : {}),diff --git a/server/services/pipeline/series.test.js b/server/services/pipeline/series.test.jsindex ba743e0682..33f594684c 100644--- a/server/services/pipeline/series.test.js+++ b/server/services/pipeline/series.test.js@@ -108,6 +108,38 @@ describe('pipeline series service', () => {expect(s.objects).toBeUndefined();});+ describe('titleLogo + author fields', () => {+ it('createSeries persists titleLogo + author when provided', async () => {+ const s = await svc.createSeries({+ name: 'Salt Run',+ titleLogo: 'Hand-lettered slab serif in salt-crusted iron, with a single hairline crack through the O.',+ author: 'A. Foundryworker',+ });+ expect(s.titleLogo).toContain('Hand-lettered slab serif');+ expect(s.author).toBe('A. Foundryworker');+ });++ it('createSeries defaults titleLogo + author to empty strings', async () => {+ const s = await svc.createSeries({ name: 'X' });+ expect(s.titleLogo).toBe('');+ expect(s.author).toBe('');+ });++ it('updateSeries replaces titleLogo + author independently', async () => {+ const s = await svc.createSeries({ name: 'X', titleLogo: 'first', author: 'first' });+ const updated = await svc.updateSeries(s.id, { titleLogo: 'second' });+ expect(updated.titleLogo).toBe('second');+ expect(updated.author).toBe('first'); // omitted keys preserve+ });++ it('updateSeries can clear titleLogo + author to empty', async () => {+ const s = await svc.createSeries({ name: 'X', titleLogo: 'present', author: 'present' });+ const cleared = await svc.updateSeries(s.id, { titleLogo: '', author: '' });+ expect(cleared.titleLogo).toBe('');+ expect(cleared.author).toBe('');+ });+ });+describe('insertSeriesWithId', () => {it('preserves the caller-supplied id', async () => {const s = await svc.insertSeriesWithId({ id: 'ser-fixed-abc', name: 'Imported' });diff --git a/server/services/pipeline/seriesTitleLogo.js b/server/services/pipeline/seriesTitleLogo.jsnew file mode 100644index 0000000000..7707c96524--- /dev/null+++ b/server/services/pipeline/seriesTitleLogo.js@@ -0,0 +1,56 @@+/**+ * Pipeline — Series Title / Logo Designer.+ *+ * Runs the `pipeline-series-title-logo` stage prompt against a series + its+ * linked universe to design the masthead/logo typography for cover art and+ * TV title screens. The result is persisted to `series.titleLogo` and+ * surfaced into `composeComicCoverPrompt` / `composeVolumeCoverPrompt` as the+ * "logo design" cue, replacing the generic "bold comic-book logo typography"+ * fallback when present.+ *+ * Throws ServerError(502, PIPELINE_TITLE_LOGO_EMPTY) on empty LLM output —+ * matches the other refine helpers' error shape so the UI can surface a+ * uniform "try again" toast.+ */++import { getSeries, updateSeries, TITLE_LOGO_MAX } from './series.js';+import { getUniverse, joinInfluenceList } from '../universeBuilder.js';+import { runPromptRefine } from './refineHelpers.js';++function buildContext(series, universe) {+ return {+ series: {+ name: (series.name || '').slice(0, 200),+ logline: (series.logline || '').slice(0, 500),+ styleNotes: (series.styleNotes || '').slice(0, 4000),+ },+ hasUniverse: !!universe,+ universe: {+ premise: (universe?.premise || '').slice(0, 2000),+ embrace: joinInfluenceList(universe?.influences?.embrace) || '(none)',+ avoid: joinInfluenceList(universe?.influences?.avoid) || '(none)',+ },+ };+}++export async function generateSeriesTitleLogo(seriesId, options = {}) {+ const series = await getSeries(seriesId);+ const universe = series.universeId+ ? await getUniverse(series.universeId).catch(() => null)+ : null;+ const { refined, rationale, runId, providerId, model } = await runPromptRefine({+ templateName: 'pipeline-series-title-logo',+ variables: buildContext(series, universe),+ options,+ source: 'pipeline-series-title-logo',+ logTag: `Series title-logo — series=${seriesId.slice(0, 8)}`,+ resultField: 'titleLogo',+ emptyError: {+ code: 'PIPELINE_TITLE_LOGO_EMPTY',+ message: 'LLM returned an empty titleLogo — try again or pick a different provider.',+ },+ });+ const titleLogo = refined.slice(0, TITLE_LOGO_MAX);+ const updated = await updateSeries(seriesId, { titleLogo });+ return { series: updated, titleLogo, rationale, runId, providerId, model };+}diff --git a/server/services/pipeline/visualStages.js b/server/services/pipeline/visualStages.jsindex faa85f6783..1fc61c13c1 100644--- a/server/services/pipeline/visualStages.js+++ b/server/services/pipeline/visualStages.js@@ -246,6 +246,34 @@ function formatBalloon(character, line) {return `Speech balloon reads: "${cleanText}" ${attribution}.`;}+// Build the masthead clause for a front cover. When `series.titleLogo` is set,+// it replaces the generic "bold comic-book logo typography" fallback with the+// LLM-designed (or user-edited) design description so every cover renders a+// consistent logo. The series name is still rendered verbatim — the titleLogo+// describes HOW it looks (letterform, finish, color), not WHAT it says.+function buildMastheadClause(series) {+ const seriesName = (series?.name || '').trim();+ const logoDesign = (series?.titleLogo || '').trim();+ if (!seriesName) {+ return logoDesign+ ? `Render a bold comic-book series masthead near the top of the cover. Logo design: ${logoDesign}`+ : 'Render a bold comic-book series masthead as large logo typography near the top of the cover.';+ }+ return logoDesign+ ? `Render the series masthead "${seriesName}" as large comic-book logo typography near the top of the cover. Logo design: ${logoDesign}`+ : `Render the series masthead "${seriesName}" as bold, large comic-book logo typography near the top of the cover.`;+}++// Optional author byline injected near the bottom of front covers + trade+// paperback fronts. Skipped when the series has no author set so older series+// still render without an empty "By —" caption.+const buildAuthorClause = (series) => {+ const author = (series?.author || '').trim();+ return author+ ? ` Include a small author byline reading "By ${author}" near the bottom of the cover — restrained, lettered in a smaller weight than the masthead.`+ : '';+};+/*** Compose a comic-book front-cover prompt. The cover always renders the* series masthead (logo-style title) and the issue number tag in the@@ -258,7 +286,6 @@ function formatBalloon(character, line) {export function composeComicCoverPrompt({series, world, issue, coverScript = '', extraStyle = '',}) {- const seriesName = (series?.name || '').trim();const issueNumber = Number.isFinite(issue?.number) ? Math.max(1, Math.floor(issue.number)) : 1;const issueTitle = (issue?.title || '').trim();const concept = (coverScript || '').trim();@@ -270,24 +297,59 @@ export function composeComicCoverPrompt({// typography is the part image-gen models get most wrong on the first// pass — without a hard cue the model often emits panels instead of// a cover, or skips the issue-number tag.- const titleBlock = seriesName- ? `Render the series masthead "${seriesName}" as bold, large comic-book logo typography near the top of the cover.`- : 'Render a bold comic-book series masthead as large logo typography near the top of the cover.';+ const titleBlock = buildMastheadClause(series);const numberBlock = `Include a clearly legible issue-number tag reading "#${issueNumber}" in the top-left corner — small but readable.`;const titleLine = issueTitle? ` Include the issue title "${issueTitle}" as a secondary banner below the masthead.`: '';+ const authorLine = buildAuthorClause(series);// Fall back to the issue title so a one-click render against a fresh cover// still produces something thematically on-target instead of a blank canvas.const sceneDescription = concept|| (issueTitle ? `A single dramatic hero image evoking "${issueTitle}".` : 'A single dramatic hero image of the protagonist mid-action.');- const layout = `A single full printable comic-book front cover for a serialized issue. ${titleBlock} ${numberBlock}${titleLine} The rest of the cover is one bold hero image (no panel borders, no multi-panel layout — this is the cover, not an interior page).${styleClause}`;+ const layout = `A single full printable comic-book front cover for a serialized issue. ${titleBlock} ${numberBlock}${titleLine}${authorLine} The rest of the cover is one bold hero image (no panel borders, no multi-panel layout — this is the cover, not an interior page).${styleClause}`;const body = `Cover concept: ${sceneDescription}`;return applyWorldStyle(`${layout}\n\n${body}`, world, series);}+/**+ * Compose a TV episode title-screen prompt. Reuses the same masthead/logo+ * cue the comic covers do — `series.titleLogo` describes the letterform ++ * finish, the series name is lettered verbatim, and `series.author` lands as+ * a small byline. The episode's number + title appear as secondary+ * typography so the screen identifies the specific episode, not just the+ * series. Returns the full prompt with world style baked in when present.+ *+ * Caller decides where to render the result — there is no auto-prepend into+ * the episode video pipeline today. Future title-card stages can call this+ * directly; for now it is the single source of truth for "what should the TV+ * title card for this episode look like."+ */+export function composeTitleScreenPrompt({+ series, world, issue, extraStyle = '',+}) {+ const seriesName = (series?.name || '').trim();+ const issueNumber = Number.isFinite(issue?.number) ? Math.max(1, Math.floor(issue.number)) : null;+ const issueTitle = (issue?.title || '').trim();++ const styleStack = stackStyle(series, extraStyle);+ const styleClause = styleStack ? ` Art style: ${styleStack}.` : '';++ const titleBlock = buildMastheadClause(series);+ const numberLine = issueNumber+ ? ` Render an "EPISODE ${issueNumber}" tag in restrained smaller typography, positioned above the masthead.`+ : '';+ const titleLine = issueTitle+ ? ` Render the episode title "${issueTitle}" as a secondary banner below the masthead in a complementary but lighter weight.`+ : '';+ const authorLine = buildAuthorClause(series);++ const layout = `A single TV episode title screen — a static title card meant to hold on-screen for a few seconds, NOT a story panel. Centered hero typography, generous negative space, cinematic 16:9 framing. ${titleBlock}${numberLine}${titleLine}${authorLine} Subtle background imagery only — atmospheric texture, signature color of the universe, no characters, no narrative scene.${styleClause}`;+ return applyWorldStyle(layout, world, series);+}+/*** Compose a comic-book BACK-cover prompt. Distinguishing constraints vs.* front cover: no masthead, no issue-number tag, no title banner — back@@ -416,7 +478,6 @@ const loadSeasonContext = async (seriesId, seasonId) => {export function composeVolumeCoverPrompt({series, world, season, coverScript = '', extraStyle = '',}) {- const seriesName = (series?.name || '').trim();const volumeNumber = Number.isFinite(season?.number) ? Math.max(1, Math.floor(season.number)) : 1;const volumeTitle = (season?.title || '').trim();const concept = (coverScript || '').trim();@@ -424,20 +485,19 @@ export function composeVolumeCoverPrompt({const styleStack = stackStyle(series, extraStyle);const styleClause = styleStack ? ` Art style: ${styleStack}.` : '';- const titleBlock = seriesName- ? `Render the series masthead "${seriesName}" as bold, large comic-book logo typography near the top of the cover.`- : 'Render a bold comic-book series masthead as large logo typography near the top of the cover.';+ const titleBlock = buildMastheadClause(series);const numberBlock = `Include a clearly legible volume tag reading "VOL. ${volumeNumber}" in the top-left corner — small but readable.`;const titleLine = volumeTitle? ` Include the volume title "${volumeTitle}" as a secondary banner below the masthead.`: '';+ const authorLine = buildAuthorClause(series);const sceneDescription = concept|| (volumeTitle? `A single dramatic hero image evoking the volume "${volumeTitle}" — the collected arc, not any single issue.`: 'A single dramatic hero image of the protagonist that embodies the collected arc.');- const layout = `A single full printable comic-book trade-paperback FRONT cover collecting an entire volume of issues. ${titleBlock} ${numberBlock}${titleLine} The rest of the cover is one bold hero image — bigger and more iconic than any single-issue cover (no panel borders, no multi-panel layout — this is a collected-edition cover).${styleClause}`;+ const layout = `A single full printable comic-book trade-paperback FRONT cover collecting an entire volume of issues. ${titleBlock} ${numberBlock}${titleLine}${authorLine} The rest of the cover is one bold hero image — bigger and more iconic than any single-issue cover (no panel borders, no multi-panel layout — this is a collected-edition cover).${styleClause}`;const body = `Volume cover concept: ${sceneDescription}`;return applyWorldStyle(`${layout}\n\n${body}`, world, series);}diff --git a/server/services/pipeline/visualStages.test.js b/server/services/pipeline/visualStages.test.jsindex 053f23d006..425b8bf79a 100644--- a/server/services/pipeline/visualStages.test.js+++ b/server/services/pipeline/visualStages.test.js@@ -71,6 +71,8 @@ vi.mock('../../lib/mediaModels.js', () => ({const {composeComicPagePrompt,composeComicCoverPrompt,+ composeVolumeCoverPrompt,+ composeTitleScreenPrompt,enqueueComicCover,enqueueStoryboardSceneVideo,enqueueStoryboardShotStartFrame,@@ -547,6 +549,88 @@ describe('composeComicCoverPrompt', () => {});expect(prompt).toMatch(/cinematic ink illustration/);});++ it('injects series.titleLogo as the masthead design cue when present', () => {+ const prompt = composeComicCoverPrompt({+ series: {+ ...SERIES_NAMED,+ titleLogo: 'Hand-lettered slab serif in salt-crusted iron, hairline crack through the O.',+ },+ issue: { number: 1, title: 'X' },+ coverScript: 'something',+ });+ expect(prompt).toMatch(/Logo design: Hand-lettered slab serif in salt-crusted iron/);+ expect(prompt).toMatch(/series masthead "Bone Walker"/);+ });++ it('renders the author byline near the bottom when series.author is set', () => {+ const prompt = composeComicCoverPrompt({+ series: { ...SERIES_NAMED, author: 'A. Foundryworker' },+ issue: { number: 1, title: 'X' },+ coverScript: 'something',+ });+ expect(prompt).toMatch(/author byline reading "By A. Foundryworker"/);+ });++ it('omits the author byline when series.author is empty', () => {+ const prompt = composeComicCoverPrompt({+ series: { ...SERIES_NAMED, author: '' },+ issue: { number: 1, title: 'X' },+ coverScript: 'something',+ });+ expect(prompt).not.toMatch(/author byline/i);+ });+});++describe('composeVolumeCoverPrompt', () => {+ it('integrates titleLogo + author into the volume cover prompt', () => {+ const prompt = composeVolumeCoverPrompt({+ series: { name: 'Salt Run', styleNotes: 's', titleLogo: 'Engraved iron caps', author: 'J. Doe' },+ season: { number: 2, title: 'The Long Sweep' },+ coverScript: 'A wide hero shot of the foundry skyline.',+ });+ expect(prompt).toMatch(/trade-paperback FRONT cover/);+ expect(prompt).toMatch(/series masthead "Salt Run"/);+ expect(prompt).toMatch(/Logo design: Engraved iron caps/);+ expect(prompt).toMatch(/volume tag reading "VOL\. 2"/);+ expect(prompt).toMatch(/volume title "The Long Sweep"/);+ expect(prompt).toMatch(/author byline reading "By J\. Doe"/);+ });+});++describe('composeTitleScreenPrompt', () => {+ it('builds a TV title card prompt that injects titleLogo + author + episode metadata', () => {+ const prompt = composeTitleScreenPrompt({+ series: {+ name: 'Bone Walker',+ styleNotes: 'gritty ink-wash',+ titleLogo: 'Hand-lettered slab serif in salt-crusted iron.',+ author: 'A. Foundryworker',+ },+ issue: { number: 3, title: 'The Long Sweep' },+ });+ expect(prompt).toMatch(/TV episode title screen/);+ expect(prompt).toMatch(/series masthead "Bone Walker"/);+ expect(prompt).toMatch(/Logo design: Hand-lettered slab serif in salt-crusted iron/);+ expect(prompt).toMatch(/EPISODE 3/);+ expect(prompt).toMatch(/episode title "The Long Sweep"/);+ expect(prompt).toMatch(/author byline reading "By A\. Foundryworker"/);+ expect(prompt).toMatch(/Art style: gritty ink-wash/);+ });++ it('falls back gracefully when only a series name is set', () => {+ const prompt = composeTitleScreenPrompt({+ series: { name: 'Bone Walker', styleNotes: '' },+ issue: { number: 1, title: '' },+ });+ expect(prompt).toMatch(/series masthead "Bone Walker"/);+ expect(prompt).toMatch(/EPISODE 1/);+ // No `episode title "<value>"` secondary banner clause is emitted when the+ // issue title is empty — the broader phrase "TV episode title screen" in+ // the layout intro is expected, so scope the assertion to the banner.+ expect(prompt).not.toMatch(/episode title "/);+ expect(prompt).not.toMatch(/author byline/);+ });});describe('enqueueComicCover', () => {