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

fix(universe): drop styleNotes from style-probe prompt, add regenerate, fix lightbox prompt

[._.]/ Adam Eivy42e5e38f2582
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 47962bedac..a728474504 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -9,7 +9,7 @@ TBD
## Added
- **Unified Story Builder** (`/story-builder`): a new guided page that walks a story from idea → universe aesthetic → plot arc → reader map → characters → issues → production as one linear flow. Each step is LLM-assisted with an AI-refinement affordance and ends with an explicit lock before the next unlocks; going back to revise an earlier step soft-flags the downstream locked steps as "stale" (integrity gate) so nothing silently drifts — without destroying their content. The builder is a thin conductor over the existing Universe / Series / Issue records (no data duplication); heavy per-issue production hands off to the existing Pipeline issue page. Reachable from the sidebar (Create → Story Builder), ⌘K, and voice. The intro screen supports two intake modes: **start from a seed idea**, or **import a finished work** (comic script / screenplay / novel / short story) — the importer reverse-engineers it into a universe, arc, characters, and issues, then drops you into the wizard to review and lock each stage. An **AI provider/model picker** at the top of the builder (and the import tab) drives every operation — idea expand, aesthetic, arc, reader map, character refine, and the import analysis — persisted on the session so one selection applies throughout. The **characters step generates a styled preview image per character** (world style fused with the character descriptor, via the same render path as the Universe Builder) and shows it alongside each character so you can eyeball that the world and character styles read correctly together.
-- **Base style image (style probe)** on a universe: generate a canonical image from the raw style guide alone — style notes + the embrace/avoid influences as the positive/negative prompt, with no character or subject — to preview the world's base visual emphasis. Triggerable from both the Universe Builder (under the style/influences editor) and the Story Builder's Universe Aesthetic step; the result persists on the universe (`styleImageRefs`) so both surfaces share it.
+- **Base style image (style probe)** on a universe: generate a canonical image from the universe's embrace/avoid influences as the positive/negative prompt, with no character or subject — to preview the world's base visual emphasis. `styleNotes` is intentionally NOT mixed into the probe prompt because it never reaches the image model on any downstream prompt (canon refs, variations, sheets, comic pages) — including it would misrepresent what those renders will look like. Triggerable from both the Universe Builder (under the style/influences editor) and the Story Builder's Universe Aesthetic step; the result persists on the universe (`styleImageRefs`) so both surfaces share it. Includes a "Regenerate" affordance to re-roll the probe once an image already exists (new filenames append to `styleImageRefs[]` so prior renders survive as walk-back fallbacks).
- **Reader Map** on a series arc (`series.arc.readerMap`): a distinct audience-experience roadmap — hooks, payoffs, emotional beats, and cliffhangers across the arc — built on top of the Vonnegut story shape, separate from the protagonist arc. Generated and refined via the new Story Builder reader-map step (also preserved by arc regeneration).
- Local LLMs: when an Ollama model pull fails with `412: requires a newer version of Ollama`, PortOS now auto-upgrades Ollama in place and retries the install — no confirm click. On macOS with `/Applications/Ollama.app` present, this downloads the latest `Ollama-darwin.zip` directly from GitHub releases, force-kills the running Ollama, replaces the `.app` bundle, strips quarantine, relaunches, and polls `/api/version` until the new binary is serving. (The old brew-only path silently left the old binary running, because `/usr/local/bin/ollama` symlinks into the `.app` bundle — even a successful `brew upgrade` doesn't change which binary is on disk inside the `.app`.) On Linux it still re-runs the official Ollama install script; for headless macOS installs (brew formula only, no `.app`), it still runs `brew upgrade ollama`. The UI now shows a prominent yellow warning banner with live step-by-step progress for the whole upgrade flow, instead of a quiet inline confirm row. Failed `brew` runs now also surface the actual stderr (e.g. `Error: ollama not installed`) instead of just an exit code.
@@ -30,5 +30,6 @@ TBD
- Series detail page: when the Story Bible drawer is open, the Series Arc + Editorial Roadmap split and the inner text + 260px Themes panel split now respond to the actual content-area width instead of viewport width. Switched to Tailwind v4 container queries — Roadmap drops below Arc when the content area is < 1024px, and Themes stacks below the logline/summary column when the Arc card is < 672px, preventing the text column from being squeezed into an unreadable strip.
- Vite dev server: allow `*.ts.net` hosts so `npm run dev` works when launched via Tailscale MagicDNS (previously rejected with `Blocked request. This host ("…ts.net") is not allowed`).
+- Universe Builder base style image lightbox: clicking the rendered probe thumb opened the preview modal with `"Base style"` in the prompt field instead of the actual prompt sent to the renderer. The Universe Builder hydrates each preview item from `galleryByFilename` (built from `listImageGallery()`) so the modal sees the real sidecar prompt/seed/model; that map only refreshes on `runs.length` change or an explicit `bumpGalleryRefresh()` call, and the style-probe path never called the refresh, so its entry fell through to the row label. `StyleProbeImage` now fires an `onRenderComplete` callback after the new filename persists, and `UniverseBuilder` wires it to `bumpGalleryRefresh`.
## Removed
diff --git a/client/src/components/universe/StyleProbeImage.jsx b/client/src/components/universe/StyleProbeImage.jsx
index 8d5045614f..0580c42b7c 100644
--- a/client/src/components/universe/StyleProbeImage.jsx
+++ b/client/src/components/universe/StyleProbeImage.jsx
@@ -1,27 +1,32 @@
/**
* Base "style probe" image for a universe.
*
- * Generates a canonical image from the RAW style guide — `styleNotes` + the
- * influences embrace list (positive) and avoid list (negative) — with NO
- * character/subject, so the user can see the world's base visual emphasis on
- * its own. Reuses the same render path as canon renders (generateImage +
- * EntryThumbSlot spinner/display) and persists the resulting filename onto the
- * universe's `styleImageRefs[]` so it survives reload and shows in both the
- * Universe Builder and the Story Builder aesthetic step.
+ * Generates a canonical image from the same style preset every other image
+ * prompt in the universe layers on (influences embrace = positive, avoid =
+ * negative) with NO character/subject, so the user can see the world's base
+ * visual emphasis on its own. `styleNotes` is intentionally NOT mixed in here
+ * — that field is prose for writers + creative directors and never reaches
+ * the image model, so including it in the probe would misrepresent what
+ * downstream renders will look like. Reuses the same render path as canon
+ * renders (generateImage + EntryThumbSlot spinner/display) and persists the
+ * resulting filename onto the universe's `styleImageRefs[]` so it survives
+ * reload and shows in both the Universe Builder and the Story Builder
+ * aesthetic step.
*/
import { useState, useEffect, useRef } from 'react';
+import { Sparkles } from 'lucide-react';
import { generateImage, getSettings, updateUniverse } from '../../services/api';
import { universeStylePreset } from '../../lib/universeStylePreset';
import { pipelineImageCfgToRenderOpts, readPipelineImageSettings, PIPELINE_IMAGE_DEFAULTS } from '../../lib/pipelineImageDefaults';
import EntryThumbSlot from './EntryThumbSlot';
import toast from '../ui/Toast';
-// Build the subject-less probe prompt from the universe's raw style guide.
-// Positive = styleNotes prose + embrace tokens; negative = avoid tokens.
+// Build the subject-less probe prompt from the universe's influences. Mirrors
+// the same preset every other image prompt uses, so the probe is an accurate
+// preview of what downstream canon/sheet/comic renders will look like.
export function buildStyleProbePrompt(universe) {
const preset = (universe && universeStylePreset(universe)) || { prompt: '', negativePrompt: '' };
- const positive = [universe?.styleNotes?.trim(), preset.prompt].filter(Boolean).join('. ');
- return { prompt: positive, negativePrompt: preset.negativePrompt || '' };
+ return { prompt: preset.prompt || '', negativePrompt: preset.negativePrompt || '' };
}
// True when there's enough style to make a meaningful probe.
@@ -30,7 +35,7 @@ export function hasStyleForProbe(universe) {
return Boolean(prompt.trim());
}
-export default function StyleProbeImage({ universe, onUniverseChange, canRender = true, onPreview = null }) {
+export default function StyleProbeImage({ universe, onUniverseChange, canRender = true, onPreview = null, onRenderComplete = null }) {
const [imageCfg, setImageCfg] = useState(PIPELINE_IMAGE_DEFAULTS);
const [jobId, setJobId] = useState(null);
// MediaJobThumb's onFilename effect can fire more than once — process each
@@ -46,7 +51,7 @@ export default function StyleProbeImage({ universe, onUniverseChange, canRender
const styleReady = hasStyleForProbe(universe);
const render = async () => {
- if (!styleReady) { toast.error('Add style notes or influences before probing the base style'); return; }
+ if (!styleReady) { toast.error('Add embrace influences before probing the base style'); return; }
const baseOpts = pipelineImageCfgToRenderOpts(imageCfg);
const probe = buildStyleProbePrompt(universe);
const queued = await generateImage(
@@ -69,9 +74,18 @@ export default function StyleProbeImage({ universe, onUniverseChange, canRender
.catch(() => null);
// Only reflect the new ref when the save actually succeeded — otherwise the
// draft would show an image the server never persisted.
- if (updated) onUniverseChange?.(updated);
+ if (updated) {
+ onUniverseChange?.(updated);
+ // The render's sidecar exists now — let the parent refresh whatever
+ // gallery-metadata map drives the lightbox so the preview opens with
+ // the real prompt/settings instead of falling back to the row label.
+ onRenderComplete?.(filename);
+ }
};
+ const hasExistingImage = Array.isArray(universe?.styleImageRefs) && universe.styleImageRefs.length > 0;
+ const regenerateEnabled = canRender && Boolean(universe?.id) && styleReady && !jobId;
+
return (
<div className="flex items-start gap-3">
<EntryThumbSlot
@@ -86,8 +100,23 @@ export default function StyleProbeImage({ universe, onUniverseChange, canRender
/>
<div className="text-xs text-gray-500 max-w-sm">
<div className="text-gray-300 font-medium mb-0.5">Base style image</div>
- Rendered from the raw style guide + positive/negative influences with no subject — a quick read on the
- world's base visual emphasis. {!styleReady && <span className="text-port-warning">Add style notes or influences first.</span>}
+ Rendered from the positive/negative influences with no subject — a quick read on the world's base visual
+ emphasis. Style notes are excluded so this matches what downstream image prompts will actually use.
+ {!styleReady && <span className="text-port-warning"> Add embrace influences first.</span>}
+ {hasExistingImage ? (
+ <div className="mt-2">
+ <button
+ type="button"
+ onClick={render}
+ disabled={!regenerateEnabled}
+ title={regenerateEnabled ? 'Render a new base style image' : 'Add embrace influences or save the universe first'}
+ className="inline-flex items-center gap-1 px-2 py-1 rounded border border-port-border bg-port-bg/40 text-gray-300 hover:border-port-accent/50 hover:text-port-accent hover:bg-port-accent/5 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:border-port-border disabled:hover:text-gray-300 disabled:hover:bg-port-bg/40 transition-colors"
+ >
+ <Sparkles size={12} />
+ Regenerate
+ </button>
+ </div>
+ ) : null}
</div>
</div>
);
diff --git a/client/src/components/universe/StyleProbeImage.test.jsx b/client/src/components/universe/StyleProbeImage.test.jsx
index 4e02d0ef6e..10fa15fea2 100644
--- a/client/src/components/universe/StyleProbeImage.test.jsx
+++ b/client/src/components/universe/StyleProbeImage.test.jsx
@@ -2,22 +2,29 @@ import { describe, it, expect } from 'vitest';
import { buildStyleProbePrompt, hasStyleForProbe } from './StyleProbeImage';
describe('StyleProbeImage — buildStyleProbePrompt', () => {
- it('fuses styleNotes (style guide) + embrace into positive, avoid into negative', () => {
+ it('uses embrace tokens as positive and avoid tokens as negative', () => {
const u = {
styleNotes: 'inky noir, heavy rain',
influences: { embrace: ['high contrast', 'cinematic'], avoid: ['bright', 'pastel'] },
};
const { prompt, negativePrompt } = buildStyleProbePrompt(u);
- expect(prompt).toContain('inky noir');
expect(prompt).toContain('high contrast');
expect(prompt).toContain('cinematic');
expect(negativePrompt).toContain('bright');
expect(negativePrompt).toContain('pastel');
});
- it('works with only influences (no styleNotes) and only styleNotes (no influences)', () => {
- expect(buildStyleProbePrompt({ influences: { embrace: ['noir'], avoid: [] } }).prompt).toContain('noir');
- expect(buildStyleProbePrompt({ styleNotes: 'watercolor' }).prompt).toContain('watercolor');
+ it('omits styleNotes — downstream image prompts do not include them, so the probe must not either', () => {
+ const u = {
+ styleNotes: 'inky noir, heavy rain',
+ influences: { embrace: ['high contrast'], avoid: [] },
+ };
+ expect(buildStyleProbePrompt(u).prompt).not.toContain('inky noir');
+ expect(buildStyleProbePrompt(u).prompt).not.toContain('heavy rain');
+ });
+
+ it('produces an empty prompt when only styleNotes is present (no embrace influences)', () => {
+ expect(buildStyleProbePrompt({ styleNotes: 'watercolor' }).prompt).toBe('');
});
it('returns empty for a null / style-less universe', () => {
@@ -27,10 +34,12 @@ describe('StyleProbeImage — buildStyleProbePrompt', () => {
});
describe('StyleProbeImage — hasStyleForProbe', () => {
- it('is true when there is any style guide or embrace influence', () => {
- expect(hasStyleForProbe({ styleNotes: 'x' })).toBe(true);
+ it('is true when there is any embrace influence', () => {
expect(hasStyleForProbe({ influences: { embrace: ['noir'] } })).toBe(true);
});
+ it('is false with only styleNotes — those do not reach the image model', () => {
+ expect(hasStyleForProbe({ styleNotes: 'x' })).toBe(false);
+ });
it('is false with no style at all', () => {
expect(hasStyleForProbe(null)).toBe(false);
expect(hasStyleForProbe({ influences: { embrace: [], avoid: ['bright'] } })).toBe(false);
diff --git a/client/src/pages/UniverseBuilder.jsx b/client/src/pages/UniverseBuilder.jsx
index 066a25d892..2ec9fd47b3 100644
--- a/client/src/pages/UniverseBuilder.jsx
+++ b/client/src/pages/UniverseBuilder.jsx
@@ -1850,6 +1850,7 @@ export default function UniverseBuilder() {
categoryKeyCount={categoryKeys.length}
totalSheets={totalSheets}
onPreview={openPreviewByFilename}
+ onStyleProbeRenderComplete={bumpGalleryRefresh}
/>
)}
@@ -2948,6 +2949,7 @@ function BibleTab({
refine,
totalVariations, categoryKeyCount, totalSheets,
onPreview,
+ onStyleProbeRenderComplete = null,
}) {
const { providers, providerModels, providerLabel, activeProviderId } = llm;
const {
@@ -3144,6 +3146,7 @@ function BibleTab({
universe={draft}
onUniverseChange={(updated) => updateDraft({ styleImageRefs: updated?.styleImageRefs || [] })}
onPreview={onPreview}
+ onRenderComplete={() => onStyleProbeRenderComplete?.()}
/>
</div>
</section>