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
fix(pipeline): comic page lightbox reads prompt from render slot (#300)
[._.]/ Adam Eivyf8e7e26060fa
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 46c5b8a6e2..57d6beadbb 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -30,6 +30,10 @@- **Universe Builder — starter idea is no longer capped at 4000 chars.** The starter idea is whatever the user wants to type, from a one-line pitch to a full treatment. The Zod-backed `STARTER_PROMPT_MAX` is raised to 200,000 chars (a sanity ceiling, not an artificial brevity constraint) and the textarea's `maxLength={4000}` attribute is removed.- **Sidebar + ⌘K label shortened to "Universe".** The Create sidebar link and palette manifest entry for `/universe-builder` now read "Universe" instead of "Universe Builder"; voice/palette aliases still include `universe-builder` so old phrasings keep resolving.+## Fixes++- **Pipeline — comic page lightbox now shows the real generation prompt.** The `Image settings` panel for a rendered series comic page previously displayed `Page 1` (the bare page-index label) instead of the prompt that was actually sent to the image-gen backend. The render slot (`page.proofImage` / `page.finalImage`) always carried `prompt`, but `ComicScriptStage.buildPageItem` was reading `page.prompt` from the page root, which is never populated. Now reads from the slot, and `openPreview` matches the clicked filename against the proof/final slots so the panel surfaces the prompt that produced *this* image (proof and final can diverge when re-rendered independently). `Refine Prompt` now has something real to refine. (`client/src/components/pipeline/stages/ComicScriptStage.jsx`)+## Refactors- **`canonPrompt` shared helper (`server/lib/canonPrompt.js` + `client/src/lib/canonPrompt.js` mirror).** Single source of truth for per-kind canon descriptor field precedence. Exports `shortCanonDescriptorFragments` (UI-summary scope), `richCanonDescriptorFragments` (render-prompt scope), `descriptorForCanonEntry` (flattened short string), and `hasCanonDescriptorContent` (rich-field union for "has anything to render?" gates). Migrated four call sites: `synthesizeCanonPrompt` in `server/services/universeBuilder.js`, `KINDS[].descFor` in `client/src/components/universe/UniverseCanonSection.jsx`, `canonEntryHasContent` in `client/src/pages/UniverseBuilder.jsx`, and `settingFrags` in `server/lib/scenePrompt.js` + client mirror. Minor cosmetic uniformity: lowercase `palette:`/`era:`/`weather:`/`significance:` prefixes in canon render prompts are now capitalized to match the UI descriptor format — case-only change, no functional impact on diffusion models. 29 new tests in `server/lib/canonPrompt.test.js`.diff --git a/client/src/components/pipeline/stages/ComicScriptStage.jsx b/client/src/components/pipeline/stages/ComicScriptStage.jsxindex c86a0a6e0c..da3257adf8 100644--- a/client/src/components/pipeline/stages/ComicScriptStage.jsx+++ b/client/src/components/pipeline/stages/ComicScriptStage.jsx@@ -41,12 +41,22 @@ import {// Legacy records (pre-proof/final split) carry `imageJobId`/`filename` at// the record root; surface those as the proof slot so the UI keeps showing-// the old render until the user re-renders into the new shape.+// the old render until the user re-renders into the new shape. Carry+// `rec.prompt` onto the synthesized slot so the lightbox prompt (and any+// downstream slot.prompt readers) still see the original generation prompt+// before the server migrates the record into the new shape on the next+// render — `comicPagesFilenameHook` propagates `record.prompt` /+// `page.prompt` into the new slot via `legacySlotRecord` for the persisted+// migration; this mirror keeps the unmigrated client view consistent.const getProofSlot = (rec) => {if (!rec) return null;if (rec.proofImage?.jobId || rec.proofImage?.filename) return rec.proofImage;if (rec.imageJobId || rec.filename) {- return { jobId: rec.imageJobId || null, filename: rec.filename || null };+ return {+ jobId: rec.imageJobId || null,+ filename: rec.filename || null,+ prompt: rec.prompt || null,+ };}return null;};@@ -177,13 +187,17 @@ export default function ComicScriptStage({ issue, series, onStageUpdate, actionsif (!jobId || !filename) return;setFilenameByJobId((prev) => prev[jobId] === filename ? prev : { ...prev, [jobId]: filename });}, []);- const buildPageItem = useCallback((pageIndex, page, filename) => ({+ // Prompt lives on the render slot (proofImage/finalImage), not at the page+ // root — the server stamps the prompt it sent to the image-gen backend on+ // each slot as it's enqueued. Read from there so the lightbox surfaces the+ // actual generation prompt (and "Refine Prompt" has something to refine).+ const buildPageItem = useCallback((pageIndex, slot, filename) => ({key: `comic-page:${filename}`,kind: 'image',filename,previewUrl: `/data/images/${filename}`,downloadUrl: `/data/images/${filename}`,- prompt: page?.prompt || `Page ${pageIndex + 1}`,+ prompt: slot?.prompt || `Page ${pageIndex + 1}`,}), []);const previewItems = useMemo(() => {const pageList = Array.isArray(comicPages.pages) ? comicPages.pages : [];@@ -196,14 +210,25 @@ export default function ComicScriptStage({ issue, series, onStageUpdate, actionsif (!slot?.jobId) return null;const filename = slot.filename || filenameByJobId[slot.jobId];if (!filename) return null;- return buildPageItem(idx, p, filename);+ return buildPageItem(idx, slot, filename);}).filter(Boolean);}, [comicPages.pages, filenameByJobId, buildPageItem]);const openPreview = useCallback((pageIndex, filename, page) => {if (!filename) return;- setPreview(buildPageItem(pageIndex, page, filename));- }, [buildPageItem]);+ // Proof and final renders carry their own prompts (the user can re-render+ // one without the other), so match the clicked filename against each slot+ // to surface the prompt that produced *this* image. A slot's filename can+ // still be null while the job is in-flight, so also consult the+ // jobId→filename map the thumbs report up via onFilenameKnown.+ const finalSlot = getFinalSlot(page);+ const proofSlot = getProofSlot(page);+ const matches = (slot) => !!slot && (+ slot.filename === filename || (slot.jobId && filenameByJobId[slot.jobId] === filename)+ );+ const slot = [finalSlot, proofSlot].find(matches) || getPreferredSlot(page);+ setPreview(buildPageItem(pageIndex, slot, filename));+ }, [buildPageItem, filenameByJobId]);const availableBackends = useMemo(() => deriveAvailableBackends(sysSettings, { excludeExternal: true }),[sysSettings],