Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): always draft back cover, drop off-panel speakers

[._.]/ Adam Eivy443580c107a1
diff --git a/server/services/pipeline/canonReadiness.js b/server/services/pipeline/canonReadiness.js
index 6e2b4629db..3fc2bae05b 100644
--- a/server/services/pipeline/canonReadiness.js
+++ b/server/services/pipeline/canonReadiness.js
@@ -101,9 +101,23 @@ export function gradeReferencedNouns(text, canon, thinChars = CANON_THIN_CHARS)
// these into the panel `description` rather than a structured dialogue[], so we
// classify them here: the body is spoken/caption text (NOT drawn), the label is
// a potential speaker.
-const PANEL_LABEL_LINE = /^\s*([A-Z][A-Z0-9 .'’_-]{0,30})(?:\s*\([^)]*\))?:\s*\S/;
+// Group 2 captures the parenthetical modifier (if any) so we can tell an
+// on-panel delivery (WHISPERED, CONT'D) from an off-panel one.
+const PANEL_LABEL_LINE = /^\s*([A-Z][A-Z0-9 .'’_-]{0,30})(\s*\([^)]*\))?:\s*\S/;
// Labels that are not characters (their "speaker" must not count as drawn).
const NON_SPEAKER_LABELS = new Set(['CAPTION', 'SFX', 'SOUND', 'NARRATION', 'NARRATOR', 'TITLE', 'NOTE', 'LETTERING', 'TEXT']);
+// A dialogue modifier marking the speaker as NOT in frame — off-panel /
+// off-screen / voice-over. Such a speaker is heard, not drawn, so it must not
+// count as a rendered character.
+const OFF_PANEL_MODIFIER = /\b(?:off[\s-]?panel|off[\s-]?screen|o\.?\s*p\.?|o\.?\s*s\.?|v\.?\s*o\.?|voice[\s-]?over)\b/i;
+
+// Resolve a raw "NAME (MODIFIER)" speaker token to the drawn character name, or
+// null when the modifier marks them off-panel/voice-over (heard, not drawn).
+const drawnSpeakerName = (label, modifier) => {
+ if (OFF_PANEL_MODIFIER.test(modifier || '')) return null;
+ const name = (label || '').trim();
+ return name || null;
+};
/**
* PURE: grade canon nouns that appear where they'd actually be DRAWN in a comic.
@@ -123,7 +137,10 @@ export function gradeComicReferencedNouns(comicScript, canon, thinChars = CANON_
const m = line.match(PANEL_LABEL_LINE);
if (m) {
const label = m[1].trim();
- if (!NON_SPEAKER_LABELS.has(label.toUpperCase())) speakers.push(label);
+ if (!NON_SPEAKER_LABELS.has(label.toUpperCase())) {
+ const name = drawnSpeakerName(label, m[2]); // null if off-panel/V.O.
+ if (name) speakers.push(name);
+ }
// the body of a dialogue/caption line is spoken/overlaid text, not drawn
} else {
actionLines.push(line);
@@ -134,10 +151,11 @@ export function gradeComicReferencedNouns(comicScript, canon, thinChars = CANON_
for (const pa of Array.isArray(pg.panels) ? pg.panels : []) {
consume(pa.description);
for (const d of Array.isArray(pa.dialogue) ? pa.dialogue : []) {
- // Strip a trailing dialogue modifier — `KAI (WHISPERED)` → `KAI` — so
- // the speaker matches its canon name (the description-line path already
- // strips it via PANEL_LABEL_LINE; structured dialogue needs it too).
- const name = d.character && d.character.replace(/\s*\([^)]*\)\s*$/, '').trim();
+ // Split a `KAI (WHISPERED)` / `KAI (OFF-PANEL)` speaker into name +
+ // modifier so the name matches canon and an off-panel speaker (heard,
+ // not drawn) is dropped — same rule as the description-line path.
+ const parts = (d.character || '').match(/^(.*?)(\s*\([^)]*\))?\s*$/);
+ const name = parts && drawnSpeakerName(parts[1], parts[2]);
if (name) speakers.push(name);
}
}
diff --git a/server/services/pipeline/canonReadiness.test.js b/server/services/pipeline/canonReadiness.test.js
index 066c4141a1..d7f08cba79 100644
--- a/server/services/pipeline/canonReadiness.test.js
+++ b/server/services/pipeline/canonReadiness.test.js
@@ -130,6 +130,13 @@ describe('checkIssueCanonReadiness (matches the visual source)', () => {
expect(report.none.map((n) => n.name)).toContain('Kai');
});
+ it('does NOT count an off-panel speaker (KAI (OFF-PANEL): …) as drawn', async () => {
+ canon = { characters: [{ id: 'c1', name: 'Kai', physicalDescription: '' }], places: [], objects: [] };
+ const issueId = await seedIssue({ comicScript: 'PAGE 1\nPANEL 1\nMaggie stares at the screen.\nKAI (OFF-PANEL): I built it.' });
+ const report = await checkIssueCanonReadiness(issueId);
+ expect(report.none.map((n) => n.name)).not.toContain('Kai'); // heard, not drawn
+ });
+
it('does NOT flag an off-page character (in prose only, not in panels)', async () => {
// Aria appears only in prose narration, never in the comic-script panels.
canon = { characters: [{ id: 'c1', name: 'Aria', physicalDescription: '' }], places: [], objects: [] };
diff --git a/server/services/pipeline/seriesAutopilot.js b/server/services/pipeline/seriesAutopilot.js
index 5dd7b9b4d9..4cb3d4cc15 100644
--- a/server/services/pipeline/seriesAutopilot.js
+++ b/server/services/pipeline/seriesAutopilot.js
@@ -197,7 +197,7 @@ export function visualReady(issue) {
const pages = Array.isArray(cp?.pages) ? cp.pages : [];
if (pages.length === 0) return false;
if (!slotEnqueued(cp?.cover)) return false;
- if (cp?.backCover?.script && !slotEnqueued(cp?.backCover)) return false;
+ if (!slotEnqueued(cp?.backCover)) return false; // always drafted (renderer has a fallback)
return pages.every((p) => (Array.isArray(p.panels) && p.panels.length > 0 ? pageEnqueued(p) : true));
}
@@ -698,10 +698,12 @@ async function runVisualDraft(sId, issueId, record) {
const r = await enqueueOne('cover', () => enqueueCoverDraft(issueId, 'cover', enqueueComicCover));
if (r.pause) return r;
}
- // 3. Back cover (only when a concept/script exists to render).
+ // 3. Back cover — always queue it (like the front cover); the back-cover
+ // renderer has a fallback prompt when no concept script is set, so a
+ // "complete" draft shouldn't silently omit it.
issue = await getIssue(issueId);
cp = issue.stages?.comicPages;
- if (cp?.backCover?.script && !slotEnqueued(cp?.backCover)) {
+ if (!slotEnqueued(cp?.backCover)) {
const r = await enqueueOne('backCover', () => enqueueCoverDraft(issueId, 'backCover', enqueueComicBackCover));
if (r.pause) return r;
}
diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.js
index 3579071203..e49d308abb 100644
--- a/server/services/pipeline/seriesAutopilot.test.js
+++ b/server/services/pipeline/seriesAutopilot.test.js
@@ -264,6 +264,7 @@ describe('resolveNextStep (pure)', () => {
comicScript: ready(VALID_SCRIPT),
comicPages: {
cover: { proofImage: { jobId: 'j' } },
+ backCover: { proofImage: { jobId: 'jb' } },
pages: [{ panels: [{ description: 'x' }], proofImage: { jobId: 'p0' } }],
},
};
@@ -303,26 +304,34 @@ describe('requiredScriptStages / scriptStructurallyReady', () => {
});
describe('visualReady', () => {
- it('is false with no pages, true once cover + all paneled pages are enqueued', () => {
+ const cover = { proofImage: { jobId: 'c' } };
+ const backCover = { proofImage: { jobId: 'b' } };
+ it('is false with no pages, true once cover + back + all paneled pages are enqueued', () => {
expect(visualReady({ stages: { comicPages: { pages: [] } } })).toBe(false);
// pages but cover not enqueued
expect(visualReady({ stages: { comicPages: { pages: [{ panels: [{}], proofImage: { jobId: 'p' } }] } } })).toBe(false);
- // cover + page enqueued
+ // cover + back + page enqueued
expect(visualReady({
- stages: { comicPages: { cover: { proofImage: { jobId: 'c' } }, pages: [{ panels: [{}], proofImage: { jobId: 'p' } }] } },
+ stages: { comicPages: { cover, backCover, pages: [{ panels: [{}], proofImage: { jobId: 'p' } }] } },
})).toBe(true);
});
- it('does not block on a page that has no panels', () => {
+ it('requires the back cover to be enqueued (always drafted)', () => {
+ expect(visualReady({
+ stages: { comicPages: { cover, pages: [{ panels: [{}], proofImage: { jobId: 'p' } }] } },
+ })).toBe(false);
+ });
+
+ it('counts a legacy rendered slot (imageJobId/filename) as enqueued', () => {
expect(visualReady({
- stages: { comicPages: { cover: { finalImage: { filename: 'c.png' } }, pages: [{ panels: [] }] } },
+ stages: { comicPages: { cover: { imageJobId: 'legacy' }, backCover: { filename: 'b.png' }, pages: [{ panels: [{}], imageJobId: 'lp' }] } },
})).toBe(true);
});
- it('requires an authored back cover to be enqueued', () => {
+ it('does not block on a page that has no panels', () => {
expect(visualReady({
- stages: { comicPages: { cover: { proofImage: { jobId: 'c' } }, backCover: { script: 'back' }, pages: [{ panels: [{}], proofImage: { jobId: 'p' } }] } },
- })).toBe(false);
+ stages: { comicPages: { cover: { finalImage: { filename: 'c.png' } }, backCover, pages: [{ panels: [] }] } },
+ })).toBe(true);
});
});