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

36.0 KB
Raw Blame

Release v2.12.0

Released: 2026-05-29

Overview

A "big local models" + storytelling release. The image and video stacks open up to 64+ GB unified-memory Apple Silicon hardware: FLUX.2 Klein 9B bf16, HiDream-I1 Full/Fast, Qwen-Image / Qwen-Image-Edit, Wan 2.2 T2V/I2V, and HunyuanVideo land as first-class entries, sharing a single diffusers runner where they can and getting dedicated BYOV runtime installers where they can't. A new Memory Management panel (Settings → Local LLMs) surfaces what's resident and lets you evict Ollama models / Whisper / Kokoro before a render. FLUX.2 multi-reference editing on Apple Silicon is wired through diffusers' KV-cache pipeline, with per-reference strengths actually honored end-to-end via a runtime patch.

On the authoring side, a new Unified Story Builder (/story-builder) walks a story from idea → universe aesthetic → plot arc → reader map → characters → issues → production as one guided flow — including an importer that reverse-engineers a finished work (comic script / screenplay / novel) back into the same wizard. Universes get a base style probe image (canonical render of the embrace/avoid influences) shared between the Universe Builder and Story Builder. A series arc now has a Reader Map distinct from the protagonist arc.

Brain → Links picks up buckets (drag-to-organize bookmark groups, federated across peers), keyword search, optional title/tags on quick-add, an editable URL on existing links, and a fixed Other-Links filter. Image / Video Gen surfaces inline model download status + SSE progress so users see a multi-GB pull coming before hitting Render; the live preview matches the configured aspect ratio and shows a step counter; hi-res presets open to HiDream + Qwen; Qwen gets a comic-page draft preset and a stepwise preview decoder. Ollama auto-upgrades in place when a pull hits a 412-newer-version error (macOS .app replace, brew on headless, install.sh on Linux), with a prominent progress banner.

Rounding it out: scheduled reference-watch can actually write to PLAN.md again (the cron default had drifted to read-only), Vite dev allows *.ts.net hosts for Tailscale MagicDNS, the Apple-Silicon local-Python detector skips x86_64 candidates, and a multi-agent review pass cleaned up eight cross-file regressions in the big-local-models branch (HiDream/Qwen route gate, Wan 2.2 i2v --image plumbing, Ollama unload as JSON, FLUX.2 9B license URL, schema parity on /local-llm/unload + /voice/whisper, etc.).

Added

  • Brain → Links buckets (bookmark groups): the Links tab now has a bucket board above the searchable list, so links can be organized into arbitrary groups (e.g. a "Reading list" or "Work tools" bucket of quick-launch buttons). Each bucket is a colored card whose links render as compact favicon + title chips that open in a new tab; buckets have an inline "add a URL" field (auto-titled from the hostname), inline rename/recolor/icon edit, and can be reordered by dragging. Links can be filed into a bucket by dragging a chip between buckets or via a per-row "+ Bucket…" dropdown in the list; an "Ungrouped" filter tab surfaces links not yet in any bucket. Buckets reuse the existing link records (a new bucketId/bucketOrder on each link) — single source of truth — and are a new federated brain collection (buckets) that syncs across peers. Deleting a bucket keeps its links (they fall back to ungrouped).
  • Big local diffusion + video models for 64+ GB unified-memory hardware. New entries in the image registry: Flux 2 Klein 9B native bf16 (flux2-klein-9b-bf16, 36 GB) loads the gated black-forest-labs/FLUX.2-klein-9B repo directly without SDNQ or Int8; HiDream-I1 Full + Fast (hidream-i1-full, hidream-i1-fast) — 17B MoE DiT, needs meta-llama/Meta-Llama-3.1-8B-Instruct as text_encoder_4; Qwen-Image and Qwen-Image-Edit (qwen-image, qwen-image-edit) — 20B MMDiT, Apache 2.0, strong English + Chinese text rendering. New video entries: LTX-2.3 Unified Beta bf16 un-deprecated (now practical on 128 GB hardware as the quality ceiling for the mlx_video runtime); Wan 2.2 T2V + I2V A14B (28 GB) via osama-ata/Wan2.2-mlx; HunyuanVideo (~60 GB) via gaurav-nelson/HunyuanVideo_MLX. The HiDream / Qwen / ERNIE / Z-Image dispatch in server/services/imageGen/local.js collapsed to a single usesDiffusersRunner(model) predicate; all four reuse the FLUX.2 venv with their pipeline-class + (HiDream only) text_encoder_4 flags passed through to the shared scripts/z_image_turbo.py runner. Wan 2.2 and HunyuanVideo land as new runtime: 'wan22' | 'hunyuan' paths in videoGen/local.js, each backed by a thin subprocess wrapper (scripts/generate_wan22.py, scripts/generate_hunyuan.py) over upstream's generate.py — provisioned via INSTALL_WAN22=1 / INSTALL_HUNYUAN=1 bash scripts/setup-image-video.sh. Upstream CLI surfaces for Wan and Hunyuan aren't pinned across releases — flagged experimental; if upstream renames args, mark the corresponding entries broken: true in data/media-models.json until the helper script is updated to match.
  • Memory Management panel (Settings → Local LLMs). Surfaces what's currently resident in unified memory and lets you evict it before kicking off a big diffusion render: each loaded Ollama model with per-row Unload, Whisper STT (Stop/Start), Kokoro TTS (Unload), plus a "Free everything" fan-out. Ollama eviction uses the documented keep_alive: 0 trick on /api/generate with an empty prompt — no tokens generated, immediate evict — exposed via POST /api/local-llm/unload. Voice paths add GET /api/voice/tts/status, POST /api/voice/tts/unload, and POST /api/voice/whisper (action: start|stop). The panel polls every 5s, errors surface via useAsyncAction's single-layer toast (each memory-mgmt API helper accepts { silent: true } so the panel owns the toast layer per CLAUDE.md's "custom catch ⇒ silent: true" rule), and "Free everything" fans out in parallel via Promise.allSettled so individual failures don't block the rest.
  • Brain → Links search: a keyword search box on the Links tab filters the saved links list in real time across title, URL, description, and tags (case-insensitive). It composes with the existing GitHub/Other category tabs, includes a clear (×) affordance, and shows a distinct "no links match" empty state separate from the "no links saved yet" state. Filtering is client-side over the already-loaded list, so there are no extra round-trips and no server changes.
  • 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.
  • Brain → Links: optional title & tags on quick-add: the Links tab quick-add form now has a collapsible "Add title & tags (optional)" section so a link can be saved with a custom title and tags up front, instead of only being editable after the fact. Collapsed by default to keep the paste-and-go flow clean.
  • Brain → Links: edit a link's URL: the per-link edit form now exposes the URL alongside the title (each with a visible label so they're unambiguous even when the title defaults to the URL). Changing the URL re-derives the GitHub repo metadata, guards against duplicate URLs (409), and resets stale clone state so a cloned repo's local path can't point at the wrong target.
  • 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).
  • Image + Video Gen: inline model download status. The model picker on both pages now shows whether the selected model's weights are already in the local HuggingFace cache. Available models get a green "Available · 7.8 GB" badge; missing ones get a "Download (~est)" button that pre-fetches the repo over SSE with a live progress bar (so users learn about a multi-GB pull before hitting Render instead of being surprised by a silent lazy download mid-generation). Hitting Render without pre-downloading still works — the existing lazy-download path is the fallback. The video form also surfaces the active text encoder (a separate ~7–25 GB Gemma pull) with its own button. New endpoints: GET /api/image-gen/models/status, GET /api/image-gen/models/:id/download (SSE), GET /api/video-gen/models/status, GET /api/video-gen/models/:id/download (SSE), GET /api/video-gen/text-encoder/download (SSE). Cache detection lives in server/lib/hfCache.js (inspectModelCache); download orchestration in server/lib/hfDownload.js and the new scripts/hf_download_repo.py helper (runs in the FLUX.2 venv, falls back to the mflux pythonPath). Mflux legacy dev / schnell map to their canonical black-forest-labs/FLUX.1-* repos so they get the same badge as every other entry.
  • 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.

Changed

  • [flux2-multi-reference-python-runner] FLUX.2 multi-reference editing on Apple Silicon. Uploading 2–4 reference images alongside a prompt on a FLUX.2 Klein 9B render now actually conditions the output on those references instead of silently ignoring them — Image Gen routes the request through the diffusers KV-cache multi-reference pipeline. The first time you run a multi-reference render after this update, you'll be asked to accept the FLUX.2-klein-9B-kv license on Hugging Face (one click; the runner surfaces a direct link if the license is missing).

  • FLUX.2 multi-reference: per-reference strengths are now honored end-to-end. Each reference image's strength slider (0.0–1.0) actually controls that reference's contribution instead of being advisory — scripts/flux2_macos.py installs a runtime patch on diffusers' Flux2KVLayerCache.store (steps 1+) and _flux2_kv_causal_attention (step 0 extract path) that scales the per-reference V slice by its strength while leaving K and the softmax allocation intact, matching IP-Adapter-style "ref scale" semantics. 1.0 reproduces the upstream baseline, 0.0 fully ignores that reference, intermediate values attenuate proportionally. The misleading "Per-reference strengths not honored yet" warning in the Image Gen UI is gone, and the sidecar field renamed from referenceImageStrengthsRequested → referenceImageStrengths (Python sidecar referenceStrengthsRequested → referenceStrengths) since the values reflect what was actually applied. SDNQ-gate on flux2-klein-4b / flux2-klein-9b unchanged; the bf16/int8 multi-reference gate (PLAN [flux2-bf16-kv-multi-reference-support]) is orthogonal.

  • [test-route-suites-peer-fanout-mock-noise] Quieter test logs. Two heavily-mocked route test suites stop printing ~128 misleading warnings per run that suggested peer-sync was failing.

  • Image Gen: hi-res presets opened to HiDream + Qwen-Image, plus a Qwen comic-page draft preset. client/src/lib/imageGenResolutions.js's compatibilityKey previously fell through to flux1 for HIDREAM/QWEN, silently denying their natural 1024×1536 / 1536×1024 / 1536² hi-res variants. Both runners now return their own keys, the three hi-res entries advertise compatibility for FLUX2 + QWEN + HIDREAM, and the Flux portrait/landscape entries (832×1216, 1216×832) also open to them. Added a Qwen-only 1328×2048 (Qwen comic draft — experimental) preset for US-comic-trim-aspect draft renders — past Qwen's documented ~1664 long-edge support window but coherent in practice on the 20B MMDiT; pair with a 1.5× upscale for final 1988×3056 output. Partial fix for [hidream-qwen-client-runner-consumers]; LoRA-picker side still pending.

  • Image Gen preview: step counter under the preview. The live diffusion preview now shows a step 32/50 · 64% row below the image while a render is in flight. The progress payload already carried step/totalSteps from imageGen/local.js; just rendered them. Hidden for Codex / external paths that don't emit per-step events.

  • Qwen-Image stepwise preview decode. scripts/z_image_turbo.py gained a Qwen-aware preview-decoder branch: Qwen-Image (and Img2Img / Edit siblings) packs latents to 3D (B, num_patches, C*4) like Flux, then unpacks to a 5-D video-VAE layout and unnormalizes with per-channel latents_mean/latents_std lists from vae.config before decoding. The generic latents/scaling + shift path matched neither step. New unpack helper (3D→5D) + Qwen-specific decoder; per-channel norm tensors are built CPU-side once and lazily migrated to (device, dtype) per call so the diffusion loop's ~30–50 fires don't rebuild from a list every step.

  • [ref-watch-phosphene-pin-mlx-lazy-eval-cadence-envs] Faster LTX-2 video renders on Apple Silicon. Tuned the MLX lazy-eval cadence the LTX-2 helper uses so denoise steps run at the cadence phosphene's published M-series perf matrix shows is fastest — also avoids a known post-decode hang the prior setting could exhibit. No UI change; renders just finish sooner.

  • Suppress cosmetic CLIP-truncation warning on multi-encoder pipelines. The "input was truncated because CLIP can only handle N tokens" warning from diffusers was bleeding red into PortOS server logs on long prompts with HiDream, Qwen-Image, FLUX.2, Z-Image, and ERNIE — but on every one of these pipelines CLIP only contributes pooled style vectors derived from the first ~77 tokens while a high-context encoder (T5 / Llama-3.1-8B / Qwen2-VL) reads the full prompt. New suppress_cosmetic_clip_truncation() helper in scripts/_runner_common.py attaches an idempotent logging filter to the diffusers and transformers handlers (filter is on handlers, not loggers, because logger-level filters don't apply to propagated child records). Called from scripts/z_image_turbo.py after import diffusers and from scripts/flux2_macos.py after the pipeline-load dispatcher.

Fixed

  • Wan 2.2 / HunyuanVideo: detect missing Python modules and surface an actionable install prompt. Wan 2.2's import probe was checking import torch, transformers, huggingface_hub — which passed even though einops (imported transitively by wan/modules/vae2_1.py but absent from upstream's pyproject.toml) was never installed. The install banner stayed hidden and renders failed with an opaque Exit code 1 over a deep ModuleNotFoundError in the server log. Two fixes: the probes now exercise the real import chain (import wan for Wan 2.2; sys.path.insert + import hyvideo.inference for HunyuanVideo) so any transitive dep missing trips the probe and re-surfaces the install banner; and the stderr handler in server/services/videoGen/local.js now scans for ModuleNotFoundError: No module named 'X', swapping the generic Exit code 1 for a runtime-specific message naming the module and the re-install command (INSTALL_WAN22=1 bash scripts/setup-image-video.sh). The ready cache is also invalidated on detection so the next status poll re-probes and the install banner re-appears immediately.

  • Video Gen preview matches the configured render aspect ratio. The preview pane was hardcoded aspect-video (16:9), so a portrait 576×1024 request previewed in a 16:9 letterbox. The container now computes explicit pixel dimensions from the configured width × height fit inside a 420×420 budget — landscape, portrait, and square renders all preview in their true ratio.

  • HunyuanVideo: pin to fp32 + mark deprecated; fix invisible per-step progress on all BYOV video runtimes. The hunyuan runner previously defaulted to fp16, which trips an MPS matmul assertion (MPSNDArrayMatrixMultiplication.mm:5799 failed assertion: Destination NDArray and Accumulator NDArray cannot have different datatype) within ~2s of predict(). Verified bf16 hits the same assertion — only fp32 across DiT + VAE + both text encoders works on Apple Silicon, because MPS matmul kernels always use an fp32 accumulator internally and assert when the output dtype differs. At 576×1024×121 frames × 30 steps fp32 is a 4-8 hr render, so the entry is also flagged deprecated: true (lands in the "Legacy" optgroup). Migration 044-hunyuan-fp32-deprecated.js patches the precision/deprecated/name fields onto existing installs' data/media-models.json; fresh installs pick up the shape via the updated data.reference/media-models.json and DEFAULT_REGISTRY seed. Two adjacent ergonomic fixes also landed in server/services/videoGen/local.js that apply to every BYOV video runtime (HunyuanVideo + Wan 2.2 + LTX-2): PYTHONUNBUFFERED=1 on the spawn env so tqdm + loguru + STAGE: prints flush per-line (previously the UI saw no progress for the entire run because child stdio was line-buffered against a pipe), and caffeinate -dis (was -i) so display + idle + system sleep are all blocked — fixes a regression where a laptop on battery would sleep mid-render and leave the Python child in uninterruptible-wait until a hard kill. For HunyuanVideo specifically, scripts/generate_hunyuan.py monkey-patches tqdm.tqdm / tqdm.auto.tqdm so each diffusion step emits a STAGE:inference:step:N:30: line that local.js#handleLine parses into an SSE progress event — without this, even with unbuffered stdio, the pipeline's tqdm against a pipe was too sparse for the UI to render a step count. Set hv.text_encoder_precision_2 alongside hv.text_encoder_precision so CLIP-L follows the same dtype as Llama — otherwise CLIP silently loaded at fp16 against an fp32 Llama and tripped the assertion via mixed-dtype embeddings.

  • Scheduled reference-watch was silently read-only, breaking weekly PLAN.md updates. DEFAULT_TASK_INTERVALS['reference-watch'] in server/services/taskSchedule.js carried taskMetadata: { readOnly: true }, which agentPromptBuilder.js translated into a "## Read-Only Task — Do NOT commit, push, or modify any files" guard at the bottom of the prompt. But the v2 reference-watch prompt (PROMPT_VERSIONS['reference-watch'] = 2) explicitly instructs the agent to APPEND slug-tagged [ref-watch-…] checklist items to PLAN.md and commit them — the agent (correctly) refused to write any files, defeating the whole flow on every weekly cron firing. The on-commit trigger path in referenceRepos.js#triggerReferenceAnalysis was already correct (readOnly: false, with an inline comment documenting exactly this pitfall); the scheduled-cron default drifted. Flipped the default to readOnly: false, updated the stale comment, and pinned the contract via tests in taskSchedule.test.js (default-interval contract) and referenceRepos.test.js (trigger-path contract).

  • Big-local-models PR review pass. Multi-agent review of the big-local-models branch surfaced eight cross-file regressions that landed alongside the Memory Management + new-runtime work:

    • HiDream / Qwen image renders were rejected with "Local image generation is not configured" at the route gate before reaching the worker.** server/routes/imageGen.jsandserver/routes/universeBuilder.jsstill ran the legacy!isFlux2 && !isZImage && !isErnie && !pypredicate chain — adding HiDream + Qwen via theusesDiffusersRunner(model)helper (already exported fromserver/lib/runners.js) in both routes lets the new families through without requiring a settings.imageGen.local.pythonPath` they don't need.
    • Wan 2.2 i2v never received the --imagearg.**buildWan22Argsgated--imageon the *request*mode === 'i2v'whilevideoGen.js's request schema doesn't have an 'i2v'enum value — so the i2v model was dispatched with--task i2v-A14Bbut no source image, and upstreamgenerate.pyerrored. Now gates onmodel.mode === 'i2v'` (registry source of truth) and hard-fails when an i2v model is invoked without a source image rather than silently degrading.
    • Ollama "Unload" was a no-op.** ollamaManager.unloadModelpassed the request body as a JavaScript object tofetchWithTimeout(which does not JSON.stringify) — native fetch sent[object Object]and Ollama rejected the request, so clicking Unload appeared to succeed but never evicted the model. Body is nowJSON.stringify-ed at the call site (mirrors deleteModel`).
    • Unload of a non-resident Ollama model would *load* it from disk first.** /api/generatewithkeep_alive: 0against a model that isn't currently resident triggers Ollama to pull the multi-GB weights into VRAM solely to mark them for eviction. NowunloadModelcallsgetLoadedModels()first and returns{ unloaded: false, reason: 'not loaded' }when the model isn't resident — closes a LAN-reachable thrash-amplification footgun viaPOST /api/local-llm/unload`.
    • FLUX.2 9B (bf16) license-acceptance banner pointed users at the 4B repo.** /api/image-gen/setup/flux2-statusreturned a hardcodedhttps://huggingface.co/black-forest-labs/FLUX.2-klein-4B` regardless of the active model — clicking the link from flux2-klein-9b-bf16 accepted the wrong license. The route now reads licenseUrl from the active model when the client passes ?modelId=, falling back to the 4B URL for legacy callers; the ImageGen page passes the current model id.
    • voice.test.js bootstrap mock missing startWhisper/stopWhisper.** routes/voice.jsnow destructures those names at module load; the mock factory didn't export them, so the first test ever added forPOST /api/voice/whisperwould TypeError at request time. Mock factory updated; the new entries are no-ops because no existing test exercises the route yet (covered separately by[memory-mgmt-new-endpoint-tests]` in PLAN.md).
    • /api/local-llm/unload, /api/voice/whisper bypassed Zod validation despite every other route in their respective files using validateRequest. Added localLlmUnloadSchema (reusing localLlmModelIdSchema's no-leading-dash / no-control-chars rules so log-injection via console.log(\🧹 ollama: unloaded ${name}`)is rejected at the boundary) and an inlinewhisperActionSchema (z.enum(['start', 'stop'])`) — closes the schema-parity drift CLAUDE.md flags as a finding.
    • Memory Management panel "Errors surface via single layer" claim was false.** The top-of-file comment promised default-apiCore-toast-only, but the body wired every API call through useAsyncActionAND non-silentapiCore.request— double toasts on every action failure, plus a toast every 5s of poll failure during an Ollama outage. TheapiLocalLlm/apiVoicememory-mgmt helpers now accept{ silent: true }and the panel passes it through, souseAsyncActionowns the toast layer (andrefresh()'s catch handlers stay silent). Same pass: Whisper start/stop now invalidateHealthCache()so the panel doesn't see 3s of staleservices.whisper.okafter the action; the Whisper start banner is gated onvoice.sttEngine === 'whisper'so web-speech users don't get an unwanted PM2 process;freeAllre-polls before the fan-out so a model that idle-evicted between the 5s poll and the click isn't re-requested; and amountedRefgates the polledsetStatecalls so a late/voice/status` response can't write to an unmounted tree.
    • videoGen child env didn't merge HF_TOKEN.** imageGen/local.jsalready mergeshfTokenEnv()for gated repos;videoGen/local.jsdid not, so the Wan 2.2 / HunyuanVideo helpers couldn't authenticatesnapshot_download()` against gated upstream repos. Same merge added to the video spawn path.

    Test count delta: server 363 files / 8086 tests pass (+0 files / +24 vs. PR baseline; deltas come from sibling branches' tests that re-merge into the worktree). Client 61 files / 608 tests pass.

  • Brain → Links "Other Links" filter showed GitHub repos: the filter sent isGitHubRepo=false as a query string, but the route schema used z.coerce.boolean() — and Boolean("false") is true, so "Other Links" behaved identically to "GitHub Repos". The schema now parses the string explicitly so "false" → false.

  • Story Builder data-loss fixes surfaced by the local-review pass on the unified-story-builder branch:

    • generateStep('plotArc') was wholesale-replacing series.arc and series.seasons via a plain updateSeries({ arc, seasons }), which silently dropped per-field arc locks, locked seasons, and orphaned every child issue attached to a renamed/removed season. Route through commitSeasonsWithRemap (same helper the Arc Canvas regenerator uses) so locks are honored and orphaned issues are remapped via normalized title → number → positional fallback.
    • resolveVerifyIssues (the auto-resolve path off the Arc Canvas verify panel) was silently wiping series.arc.readerMap: the LLM payload doesn't author the reader map, so omitting it from the sanitizeArc call defaulted the field to null and commitSeasonsWithRemap's mergeArcWithLocks only restores fields when their per-field lock is true. A user who'd generated a reader map without locking it lost the entire map the first time they auto-resolved a finding. The sibling generateArcOverview already had this fix; resolveVerifyIssues drifted from it despite the "Mirrors resolveVerifyIssues" comment.
    • Reader-map prompt JSON example used a pipe-separated enum string for kind ("hook|reveal|payoff|emotional|cliffhanger"), which LLMs reproduced literally; sanitizeReaderBeat then dropped every beat because the joined string isn't in READER_MAP_BEAT_KINDS, leaving beats: [] and tripping the empty-payload check. Replaced with a single valid example ("hook"); the earlier {{beatKindsCsv}} line still enumerates the controlled vocabulary.
    • Story Builder currentStep PATCH schema was z.string().max(40) and the sanitizer silently coerced unknown values to STEP_IDS[0] — a stale client that posted a removed step id would land on the first step with no error. Now z.enum(STEP_IDS); the sanitizer's coerce-on-load fallback stays for resilience against pre-existing corrupted files.
    • styleImageRefs route caps (.max(50) on POST and PATCH) were 4× the sanitizer cap (IMAGE_REFS_PER_ENTRY_MAX = 12), so a 40-entry POST silently 200'd with 28 entries dropped. Aligned to the shared entryImageRefsField so over-the-cap requests get a loud 400.
    • Boot-time verifyCollectionVersions array didn't include the Story Builder store; type-level schema drift would have gone unnoticed.
    • "Lock the earlier steps first" toast misfired when the step was blocked by upstream-staleness (every earlier step IS locked, but one is stale). Discriminated reachable() → 'unlocked' | 'stale' | true so the toast says "Re-review the stale earlier step first" in that case.

    Dev machines that already ran migration 043 with the buggy reader-map prompts keep the bad copies in data/prompts/stages/ — delete story-builder-reader-map.md and story-builder-reader-map-refine.md from that directory, then restart, and migration 043 will re-copy the fixed versions from data.reference/. Fresh installs are unaffected.

  • 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.

  • Video Gen "Local Python not configured" warning now exposes the Detect / install / Create-venv flow inline on the page instead of linking out to the settings drawer — LocalSetupPanel renders directly below the disconnected status pill, wired to the same settings PATCH the drawer uses. Saving a new pythonPath re-polls status so the pill flips green without a manual refresh.

  • Local video gen on macOS was installing the wrong mlx_video PyPI package. The plain mlx_video package is unrelated (video classification/captioning) and lacks the mlx_video.generate_av CLI that the LTX renderer shells into — both packages publish an import mlx_video namespace so the missing-package check passed, but the spawn died with No module named mlx_video.generate_av. Fixed: pipNameFor('mlx_video') now returns mlx-video-with-audio>=0.1.35 on macOS; the import probe now checks import mlx_video.generate_av instead of import mlx_video so the wrong package fails fast and the UI surfaces an install button; installPackages() gained a pre-uninstall step driven by a PIP_PRE_UNINSTALL map so the conflicting plain mlx_video is removed before pip refuses to "downgrade" across the name collision. Mirrors the same conflict-resolution flow scripts/setup-image-video.sh already used out-of-band.

  • Media job worker now re-resolves imageGen.local.pythonPath from live settings at run time for every video job (and every non-codex image job), instead of using the snapshot captured at enqueue time. Symptom this fixes: user switches their Python in the UI, clicks Generate, and the worker still shells out to the previous (broken) interpreter — because both the in-memory queue and the on-disk media-jobs.json carried the old path. Now the persisted snapshot is irrelevant; live settings always win. Codex image jobs are unaffected (they don't run a local Python).

  • isExternallyManaged() no longer false-positives on PortOS-owned venvs created from a PEP 668 base (e.g. Homebrew Python). Inside a venv, sysconfig.get_path("stdlib") resolves to the base interpreter's stdlib, so a venv created from Homebrew inherited the EXTERNALLY-MANAGED marker even though pip-in-venv ignores PEP 668 entirely. The check now also reads sys.prefix and sys.base_prefix and short-circuits to false when they differ (the canonical "am I in a venv?" test). Symptom this fixes: after switching from Anaconda to Homebrew and clicking "Create PortOS venv", the panel showed the new venv path but still asked to create a venv — because the new venv looked externally-managed too, hiding the regular "Install N missing packages" button.

  • Video Gen status pill no longer lies when the saved Python is missing required packages. Previously /api/video-gen/status returned connected: true whenever any pythonPath was stored, so a Python with no mflux / mlx / mlx_video installed showed a green pill until the user clicked Generate and the renderer crashed. /status now probes the imports via checkPackages() and returns connected: false + a missingPackages list when anything is absent, which triggers the same inline LocalSetupPanel. The panel's header copy adapts: "Set up Local Python" when no path is selected, "Install missing Python packages" (with the count) when the path is valid but packages are missing.

  • Local Python auto-detection on Apple Silicon Macs now skips x86_64 candidates: a default Anaconda install (/opt/anaconda3/bin/python3) was winning over /opt/homebrew/bin/python3 and then failing at install time with No matching distribution found for mlx because mlx ships arm64-only wheels. detectPython() now probes platform.machine() of each candidate on darwin/arm64 and prefers a matching interpreter. The /api/image-gen/setup/check response also gains interpreterArch, hostArch, archMismatch, and suggestedArm64Python fields; LocalSetupPanel surfaces a warning and a one-click "Switch to detected arm64 Python" button when the user's saved path is x86_64 on an Apple Silicon host.

  • [triage-gemini-pr515-out-of-scope-findings] Sub-agent index and metadata writes are now crash-safe, and the in-app shell honors quoted arguments. A mid-write crash during sub-agent completion or pruning no longer leaves a half-written metadata.json / agent index on disk — both go through the shared atomic-write helper that swaps via temp file. Quick-commands run from PortOS (git commit -m "msg with spaces", etc.) now keep the quoted argument as a single token instead of splitting on every space and passing the broken tokens to the child process. Same atomic guarantee was added to the small JSON caches used by various settings stores, so a crash mid-save no longer truncates them.

Full Changelog

Full Diff: https://github.com/atomantic/PortOS/compare/v2.11.0...v2.12.0