Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

release(v4.2.0): updates announce themselves

mrbizarroaa51d4613adc
diff --git a/README.md b/README.md
index fe8e6e7..4a31926 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
</p>
-> **Current release: v4.0.4.** **The live preview plays on the main stage.** A render you start takes the big player full-size — a calm `Finding the shot…` while the model warms, then the forming take with a `LIVE` badge, step count, ETA and Stop early. A clip you are already watching keeps the stage, and when the render finishes it cross-fades into the finished video with no empty-player flash. Also: the Spicy option follows the Settings switch on both engines instead of only one, and H3's draft adapter moved to the LightX2V v1.0 768p selection. Carries v4.0.3's picker-LoRA crash fix and all of v4.0.2. Full notes on the [releases page](https://github.com/mrbizarro/phosphene/releases).
+> **Current release: v4.1.1.** **The forming take loops, and a render-killing crash is fixed.** The live preview already decoded a window of frames on every publish and kept only one of them; it keeps them all now and plays an animated loop, so a forming render moves instead of standing still — same decode, same cost. v4.1.1 fixes the `SIGABRT` crash that killed every render on some Apple silicon: the automatic Metal-watchdog retry existed and was correct, but macOS names that kill differently by chip, and we matched only one of the names ([#59](https://github.com/mrbizarro/phosphene/issues/59), root-caused by @ybekocak). Recent releases also brought H3 portrait/vertical renders, the H3 live preview, Anchor/Inspire reference modes on LTX-2.5, and per-machine analytics. Full notes on the [releases page](https://github.com/mrbizarro/phosphene/releases).
## Overview
diff --git a/VERSION b/VERSION
index 627a3f4..6aba2b2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.1.1
+4.2.0
diff --git a/docs/STATE.md b/docs/STATE.md
index a46fbef..8548a39 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -1,5 +1,17 @@
# Phosphene — project state, history, open work
+> **⭐ 2026-08-15 — v4.2.0: updates announce themselves, and the star ask is a local flag rather than a tracking problem.** Finding out you were behind required clicking the header pill, which is a check nobody performs.
+>
+> - **A banner, deliberately not a modal.** An update is not an emergency, and a dialog that blocks a running render is worse than being out of date. It states the available version and the one you are on, offers Update now (reusing the pill's existing pull path — one implementation, not two) and Later. `update_banner_dismissed` stores a **VERSION string, not a boolean**, so dismissing 4.1.1 cannot silence 4.2.0.
+> - **The star ask rides the update moment and appears at most once per install.** It is the one point where the user is already waiting on us. Clicking through, or saying "already did", writes `star_prompt_done` and the row never returns — *including* on every future update, which the tests pin explicitly.
+> - **Not an analytics lookup, on purpose.** GitHub can only answer "did THIS AUTHENTICATED USER star it", so suppressing the prompt for people who already starred would mean asking them to sign into GitHub inside a local video panel. A local flag answers the same question with no accounts and no privacy story to defend. `/star-click` records one **anonymous count** with a `via` of `link` or `already` (junk normalises to `link`) and carries no identity, matching every other event we send.
+> - **Two live bugs found by testing it rather than reading it.** `/settings` is form-encoded: a JSON body parses to nothing and returns a cheerful `ok:true` having saved nothing, so the banner dismissed itself on screen and returned on the next boot. And form values arrive as strings, where `bool("false")` is True — which would have made "don't ask again" impossible to clear. Both pinned by `test_update_banner.py` (6). A third, the panel's global `button { width: 100% }`, turned every banner button into a full-width bar until the classes opted out explicitly.
+> - **Verified in a browser, not asserted:** banner shows while behind → both clicks persist (`star_prompt_done: true`, `update_banner_dismissed: "4.1.1"`) → the same version stays hidden → a NEW version brings the banner back with the star row still gone.
+>
+> **Also:** the README's "Current release" line said **v4.0.4** while 4.1.1 was out — the first thing anyone landing on the repo read was a five-release-stale project. Updated, along with the repo description (which never mentioned Hailuo or H3) and ten new topics.
+>
+> **Gates:** `check_ltx_pin` PASS (pin unmoved) · all 12 panel suites green · `check_output_codec` PASS · `py_compile`.
+
> **🩹 2026-08-15 — v4.1.1: the Metal-watchdog retry finally arms on the machines that needed it.** Every render dying with `helper exited from SIGABRT` on an M2 Max, and the error text inviting the user to file an issue about a retry that could not fire.
>
> - **The mitigation was right and never ran.** `_METAL_TIMEOUT_RX` matched `kIOGPUCommandBufferCallbackErrorTimeout` and `Caused GPU Timeout Error`. macOS names the watchdog kill by how it decided to kill you, and an M2 Max on macOS 26.5.2 kills a long prompt-encode command buffer as **`ImpactingInteractivity`** instead. Same kill, different word, so the Gemma-encode fallback (truncate `LTX2_GEMMA_MAX_LENGTH`, retry once) sat armed-but-unreachable while the render aborted at `[Encoding prompt]`.
@@ -31,7 +43,7 @@
> **🔧 2026-08-14 night — v4.0.5 ASSEMBLED on dev/beta (`65880b3` + version `66f0dbd`), HELD for the owner's word.** The two recovered audits' punch-list, closed in one campaign. (1) **H3 Turbo install is LIVE again**: the v1.0 runner-layout repack is a published release asset on `weights-ltx25-v1` (sha256 `d51d626f…`, verified byte-identical against the local repack the selection was graded on); `/h3/turbo/install` streams it partial→verify→atomic-rename, `install_h3.js` fetches the same asset best-effort via `scripts/fetch_h3_turbo.py` (resumable, digest-checked, short Pinokio-safe lines), and the retired **ckpt500-EMA is accepted again as the LAST fallback** — dropping it in 4.0.4 un-Turboed installs that rendered fine on it. Raw v0.1 stays refused by name. Turbo gate 5→11 tests incl. script↔panel pin parity. (2) **The dead HQ Speed control is gone** (skip-step fields were dropped at the engine boundary; both pills ran identical settings under a "~12% faster" claim), and the collapsed summary stops printing "exact speed" from the retired accel input. (3) **The real speed control**: the engine's 2.5-only `fast` schedule preset (F6S2, 5+2 forwards, owner-graded, **a different take**) wired end to end — Speed pills → `schedule_preset` → make_job (lane-gated: dropped with a sentence on 2.3/HQ/H3) → helper → `generate_two_stage`; tier cells carry `fast_eta` (cost-model 5+2/8+2 ratio, so fixed costs aren't discounted), chips re-price while Fast is armed, and Load Params round-trips it from day one (`test_schedule_preset.py`, 8). (4) **Geometry truth**: make_job floors LTX canvases to the two-stage engine's /64 grid and frames to 8k+1 (floored, never raised) and pushes a sentence when it does; dims inputs step by 64; warnings state what WILL render; H3 tier-cell geometry untouched (`test_geometry_grid.py`, 6). (5) **Load Params restores the cast** (owner-reported): the fire-and-forget IIFE is replaced by an awaited restore through `applyCharacterSelection()` — the new non-toggling hydrator — with visible failure when the character left the library; quality chip by the sidecar's own token, explicit `no_voice` with touched provenance, Extend's four fields, STG (absence = Off), and the Length chip repaints after programmatic frame assignment. A hidden checked No-voice can no longer rewrite a plain render (submit gated on a cast; every hide path clears the box). (6) **One health cluster**: the six machine-state pills live in a single bordered container that is the header's only shrinkable region — narrow windows degrade it to colored state dots, then collapse it; the creator avatar is never clipped again. (7) **Stale-process pill**: `/version` compares HEAD-on-disk to HEAD-at-boot each poll; a promote landing under a running panel renders "Restart to finish update" — **validated live**: the dev panel booted at `90b8a6e` reported `stale_process: true` the moment `65880b3` landed. (8) Keyframe sidecars stamp the resolved q8 pack, not the 2.3-defaulting `MODEL_ID_HQ`. **Gates all green at the tree** (pinokio scripts 377/500 worst · ltx pin unmoved at `v0.14.19+ltx25.4` · post_update · registry 169 · schedules 45 · character round-trip 35 · lora_compat · stage_live_preview · spicy · turbo 11 · schedule_preset 8 · geometry 6 · storyboard suites · py_compile · page parse). **Known-remaining / descoped**: the owner's "stray −1 bar" did not reproduce in either live panel's idle state (needs a screenshot the moment it appears); HDR Load-Params restore is moot while the HDR pill ships commented out (roadmap-parked); render validation of the fast preset + Turbo v1.0 timing run deferred until the GPU frees (the eltrumpo retrain holds both locks overnight). **Audit sources**: `~/AI/projects/phosphene/notes/customize_audit_2026-08-14.md` + `journey_audit_2026-08-14.md` (recovered from the sandboxed sessions' stdout; the FIELD REGISTRY campaign spec in the journey audit is the post-4.0.5 systemic fix).
-**Public release: `v4.1.1`** (2026-08-14 — the live preview leaves the postage stamp and plays full-size on the main stage; the Spicy option follows the Settings switch on both engines; H3's Turbo adapter selection moves to LightX2V v1.0 768p and its automatic install is paused until the repack is published. Carries v4.0.3's picker-LoRA crash fix and the v4.0.2 content: the 720p High tier, i2v that animates the image you gave it, characters on the engine's native runtime-LoRA route, and the vendored pin at `v0.14.19+ltx25.4`; see the entries below. The narrative in this paragraph stops at v3.1.1 and is kept as history). **The 2.3/2.5 divergence that ran through the v3.8.x line was closed by v4.0.0** — LTX-2.5 is the registered default and the vendored port is pinned at the tag `v0.14.19+ltx25.4`. v3.8.x registered 2.3 only and pinned `871694d`, because the 2.5 packs were not publicly downloadable at cut time; they are now. See `CLAUDE.md`'s pin table. The entire v3.0 line shipped — v3.0.0 (Characters / Voice / Image Studio / A2V, May 23) → v3.0.1 (FFLF crash fix) → v3.0.2 (Boost/Turbo accel restored after a 2-month silent regression) → v3.0.3 (HiDream hidden, #15) → v3.0.4 (CivitAI SSL) → v3.0.5 (A2V kwarg signature shim, #5) → v3.0.6 (deep-review hardening) → v3.0.7 (GPU-race fix + /status version surfacing) → **v3.0.8 (ltx-2-mlx v0.14.8 catch-up — codec-only patches, I2V "mosaic"/Metal-watchdog fix #17, ASCII version-skew handshake fix)** → **v3.0.9 (custom I2V Width×height inputs restored for power users; Train-tab dev-transformer Download "unknown install key" fix — form-encoding, reported by @cocktailpeanut)** → **v3.0.10 (model-integrity self-heal — boot scan + `/status.model_integrity` + a one-click Repair banner for corrupt/partial weights, the leading *non-Metal* "mosaic" garbage-decode cause; safetensors header+size check)** → **v3.0.11 (latent helper-handshake hang fixed: `_read_until` mixed `select()` on the raw fd with a buffered `readline()`, so any event the helper emitted *right before* `ready` — a version-skew line, the new runtime fingerprint — got stranded in the TextIOWrapper buffer and the panel hung 120 s → "helper failed to start: None". This is the true root cause behind the mislabeled "⚠️-emoji" handshake break. Now reads the raw fd via `os.read()` into a carry buffer and drains every complete line before re-`select()`-ing. PLUS: every render log self-documents its runtime — mlx/mlx-metal version + Apple chip + macOS — surfaced in `/status`, the `helper ready ·` line, and a standalone `runtime |` line, the exact data needed to triangulate the remaining MLX-numerical "mosaic")** → **v3.0.12 (the REAL mosaic fix + 3 more. The mosaic is NOT a code bug or the missing-upscaler theory (both disproved by local repro — the bare 6-file Q4 set renders byte-identical-clean on M4 Max); it's stale/corrupt weight *content* — right size, wrong bytes — that v3.0.10's header+size check can't see (confirmed: ronyeoh/#18 + claude3d/#5 fixed it only by a fresh full re-download). Added **deep checksum verify vs upstream**: Settings → Model files → "Verify model files (checksum)" / `/models/verify-deep` hashes every weight + compares to HuggingFace's published SHA-256 (proven to match local), mismatches feed the existing one-click Repair re-download. Validated: flipped 16 bytes mid-file → header+size passed, deep-verify caught it. ALSO in v3.0.12: character-LoRA-shows-as-"style-only" fix (#5 — `list_user_loras` recovers trigger+kind from the `_v2` filename when the sidecar is missing); `cgi`→`email` multipart migration (Python-3.13-ready, removes the boot DeprecationWarning, adopted from @ssfeather's PR #22); dynamic 3–8 multi-keyframe UI (adopted from @youngbee12's PR #20, ported clean with the integrity feature preserved + a JS ReferenceError fixed). Folds in v3.0.11's handshake fix + runtime fingerprint.)** → **v3.0.13 (character LoRA fixes, #5 @claude3d: a multi-word/spaced character filename no longer mislabels as style-only — the id regex gated out spaces before the sidecar was read; and the Character tab no longer silently falls back to plain T2V — a UI desync left the avatar's selection ring lit after `character_id` was cleared. Plus an `enhancePrompt` element-id fix. Cherry-picked to prod `ce03139`, release `814dc2d`.)** → **v3.1.0 (Ideogram 4 — open-weight 9.3B text-rendering image model + a visual text-placement canvas that places exact text via normalized-bbox captions. mflux 0.18 `mflux-generate-ideogram4`; gated `ideogram-ai/ideogram-4-fp8` ~26 GB, needs a HF Read token + license. Fixed the gated-download 401 that would have hit EVERY user — the panel now exports its configured token to subprocess env via `_sync_hf_token_to_env` so a stale `hf auth login` cache can't shadow it; proven clean-room. Validated end-to-end: 8-text-element field-guide poster rendered clean, every label placed per its bbox.)** → **v3.1.1 (Ideogram output-card buttons hotfix, reported by Mr Bizarro: an Ideogram image's prompt is a caption JSON, which broke every output surface that fed it into a plain box / inline onclick — the Recent-list Animate button was worked-but-dead because apostrophes/&/< in the caption terminated the single-quoted onclick. Display-layer fix: `_displayPromptFor` derives `high_level_description`, `escapeHtml` the onclick args, friendly `_imgEngineLabel`, and `loadParams` restores an Ideogram image into the visual canvas instead of dumping JSON. `params.prompt` stays the caption JSON; renders unaffected. Validated live.)** All validated end-to-end on the dev panel (deep-verify corrupt-detect + repair, /loras, byte-identical upload, multi-keyframe render, FFLF regression). See §4 for the full version history. The May-17 Codex C+ UI restructure (capability tiers, Q4 surface, Character as 5th mode pill, accel kill, HQ-speed move) and the Train-tab / LoRA-chrome work that followed are all baseline now, folded into v3.0.x. There is no `v2.0.6` tag.
+**Public release: `v4.2.0`** (2026-08-14 — the live preview leaves the postage stamp and plays full-size on the main stage; the Spicy option follows the Settings switch on both engines; H3's Turbo adapter selection moves to LightX2V v1.0 768p and its automatic install is paused until the repack is published. Carries v4.0.3's picker-LoRA crash fix and the v4.0.2 content: the 720p High tier, i2v that animates the image you gave it, characters on the engine's native runtime-LoRA route, and the vendored pin at `v0.14.19+ltx25.4`; see the entries below. The narrative in this paragraph stops at v3.1.1 and is kept as history). **The 2.3/2.5 divergence that ran through the v3.8.x line was closed by v4.0.0** — LTX-2.5 is the registered default and the vendored port is pinned at the tag `v0.14.19+ltx25.4`. v3.8.x registered 2.3 only and pinned `871694d`, because the 2.5 packs were not publicly downloadable at cut time; they are now. See `CLAUDE.md`'s pin table. The entire v3.0 line shipped — v3.0.0 (Characters / Voice / Image Studio / A2V, May 23) → v3.0.1 (FFLF crash fix) → v3.0.2 (Boost/Turbo accel restored after a 2-month silent regression) → v3.0.3 (HiDream hidden, #15) → v3.0.4 (CivitAI SSL) → v3.0.5 (A2V kwarg signature shim, #5) → v3.0.6 (deep-review hardening) → v3.0.7 (GPU-race fix + /status version surfacing) → **v3.0.8 (ltx-2-mlx v0.14.8 catch-up — codec-only patches, I2V "mosaic"/Metal-watchdog fix #17, ASCII version-skew handshake fix)** → **v3.0.9 (custom I2V Width×height inputs restored for power users; Train-tab dev-transformer Download "unknown install key" fix — form-encoding, reported by @cocktailpeanut)** → **v3.0.10 (model-integrity self-heal — boot scan + `/status.model_integrity` + a one-click Repair banner for corrupt/partial weights, the leading *non-Metal* "mosaic" garbage-decode cause; safetensors header+size check)** → **v3.0.11 (latent helper-handshake hang fixed: `_read_until` mixed `select()` on the raw fd with a buffered `readline()`, so any event the helper emitted *right before* `ready` — a version-skew line, the new runtime fingerprint — got stranded in the TextIOWrapper buffer and the panel hung 120 s → "helper failed to start: None". This is the true root cause behind the mislabeled "⚠️-emoji" handshake break. Now reads the raw fd via `os.read()` into a carry buffer and drains every complete line before re-`select()`-ing. PLUS: every render log self-documents its runtime — mlx/mlx-metal version + Apple chip + macOS — surfaced in `/status`, the `helper ready ·` line, and a standalone `runtime |` line, the exact data needed to triangulate the remaining MLX-numerical "mosaic")** → **v3.0.12 (the REAL mosaic fix + 3 more. The mosaic is NOT a code bug or the missing-upscaler theory (both disproved by local repro — the bare 6-file Q4 set renders byte-identical-clean on M4 Max); it's stale/corrupt weight *content* — right size, wrong bytes — that v3.0.10's header+size check can't see (confirmed: ronyeoh/#18 + claude3d/#5 fixed it only by a fresh full re-download). Added **deep checksum verify vs upstream**: Settings → Model files → "Verify model files (checksum)" / `/models/verify-deep` hashes every weight + compares to HuggingFace's published SHA-256 (proven to match local), mismatches feed the existing one-click Repair re-download. Validated: flipped 16 bytes mid-file → header+size passed, deep-verify caught it. ALSO in v3.0.12: character-LoRA-shows-as-"style-only" fix (#5 — `list_user_loras` recovers trigger+kind from the `_v2` filename when the sidecar is missing); `cgi`→`email` multipart migration (Python-3.13-ready, removes the boot DeprecationWarning, adopted from @ssfeather's PR #22); dynamic 3–8 multi-keyframe UI (adopted from @youngbee12's PR #20, ported clean with the integrity feature preserved + a JS ReferenceError fixed). Folds in v3.0.11's handshake fix + runtime fingerprint.)** → **v3.0.13 (character LoRA fixes, #5 @claude3d: a multi-word/spaced character filename no longer mislabels as style-only — the id regex gated out spaces before the sidecar was read; and the Character tab no longer silently falls back to plain T2V — a UI desync left the avatar's selection ring lit after `character_id` was cleared. Plus an `enhancePrompt` element-id fix. Cherry-picked to prod `ce03139`, release `814dc2d`.)** → **v3.1.0 (Ideogram 4 — open-weight 9.3B text-rendering image model + a visual text-placement canvas that places exact text via normalized-bbox captions. mflux 0.18 `mflux-generate-ideogram4`; gated `ideogram-ai/ideogram-4-fp8` ~26 GB, needs a HF Read token + license. Fixed the gated-download 401 that would have hit EVERY user — the panel now exports its configured token to subprocess env via `_sync_hf_token_to_env` so a stale `hf auth login` cache can't shadow it; proven clean-room. Validated end-to-end: 8-text-element field-guide poster rendered clean, every label placed per its bbox.)** → **v3.1.1 (Ideogram output-card buttons hotfix, reported by Mr Bizarro: an Ideogram image's prompt is a caption JSON, which broke every output surface that fed it into a plain box / inline onclick — the Recent-list Animate button was worked-but-dead because apostrophes/&/< in the caption terminated the single-quoted onclick. Display-layer fix: `_displayPromptFor` derives `high_level_description`, `escapeHtml` the onclick args, friendly `_imgEngineLabel`, and `loadParams` restores an Ideogram image into the visual canvas instead of dumping JSON. `params.prompt` stays the caption JSON; renders unaffected. Validated live.)** All validated end-to-end on the dev panel (deep-verify corrupt-detect + repair, /loras, byte-identical upload, multi-keyframe render, FFLF regression). See §4 for the full version history. The May-17 Codex C+ UI restructure (capability tiers, Q4 surface, Character as 5th mode pill, accel kill, HQ-speed move) and the Train-tab / LoRA-chrome work that followed are all baseline now, folded into v3.0.x. There is no `v2.0.6` tag.
> **🎬 2026-08-14 — v4.0.4: the forming take plays on the MAIN STAGE.** The live preview existed since v3.7 and lived in a postage stamp next to the queue, which is not where anyone looks while they wait. It now takes the big player.
>
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 1600621..14b2d41 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -761,6 +761,16 @@ def _settings_defaults() -> dict:
# never changes the result, and it is what makes Stop early
# possible at all.
"live_preview": "on",
+ # ---- Update banner + the one-time star ask -------------------------
+ # `update_banner_dismissed` holds the VERSION the user dismissed, not a
+ # boolean: dismissing 4.1.1 must not silence the banner for 4.2.0. The
+ # star ask is a LOCAL flag and deliberately not an analytics lookup —
+ # GitHub can only answer "did this authenticated user star it", which
+ # would mean asking someone to log into GitHub inside a local video
+ # panel to suppress a prompt. Clicking through, or saying you already
+ # starred, sets this once and the ask never returns on this install.
+ "update_banner_dismissed": "",
+ "star_prompt_done": False,
# ---- Anonymous usage analytics -----------------------------------
# Full contract in the "Anonymous usage analytics" section further
# down this file, and the event-by-event schema in docs/ANALYTICS.md.
@@ -1022,6 +1032,20 @@ def _validate_settings_patch(patch: dict) -> tuple[dict, str | None]:
return {}, f"live_preview must be on or off, got: {lp}"
out["live_preview"] = lp
+ if "update_banner_dismissed" in patch:
+ # A version string, or "" to re-arm. Bounded so a malformed client
+ # cannot write an unbounded blob into settings.json.
+ out["update_banner_dismissed"] = str(patch["update_banner_dismissed"]).strip()[:32]
+
+ if "star_prompt_done" in patch:
+ # Form values arrive as strings, and bool("false") is True — the exact
+ # trap that would have made "don't ask again" unclearable.
+ _v = patch["star_prompt_done"]
+ if isinstance(_v, str):
+ out["star_prompt_done"] = _v.strip().lower() in ("1", "true", "yes", "on")
+ else:
+ out["star_prompt_done"] = bool(_v)
+
# ---- H3 DiT precision --------------------------------------------------
# auto (RAM decides — the default), q8 (force the low-RAM pack: ~15 GiB
# back for the OS on any machine), bf16 (force max quality where it fits).
@@ -1139,6 +1163,8 @@ def get_settings_public() -> dict:
"spicy_mode": bool(s.get("spicy_mode", False)),
"memory_policy": s.get("memory_policy", DEFAULT_MEMORY_POLICY),
"live_preview": str(s.get("live_preview", "on")),
+ "update_banner_dismissed": str(s.get("update_banner_dismissed", "") or ""),
+ "star_prompt_done": bool(s.get("star_prompt_done", False)),
# Analytics. Same has_X-boolean treatment as the other secrets —
# the keys themselves never come back over the wire. The install id
# DOES come back: it's a random UUID with no meaning off this
@@ -23322,6 +23348,25 @@ class Handler(BaseHTTPRequestHandler):
persist_queue()
self._json({"cleared": count}); return
+ if path == "/star-click":
+ # One anonymous count, no identity, no repeat — the client also
+ # writes a local flag so the ask never returns on this install.
+ # `via` separates "opened the link" from "said they already had",
+ # because only the first is a click we caused.
+ # `body` is the raw request string here (the handler form-parses
+ # it into `form`); this route speaks JSON, so read it directly and
+ # fall back to the form field rather than trusting either alone.
+ try:
+ _payload = json.loads(body) if body.strip().startswith("{") else {}
+ except (ValueError, TypeError):
+ _payload = {}
+ _via = str(_payload.get("via")
+ or (form.get("via", ["link"])[0] if form else "link")).strip().lower()
+ if _via not in ("link", "already"):
+ _via = "link"
+ _analytics_capture("star_prompt", {"via": _via})
+ self._json({"ok": True}); return
+
if path == "/queue/pause":
with QUEUE_COND:
STATE["paused"] = True
@@ -25408,6 +25453,45 @@ HTML = r"""<!doctype html>
/* Version pill states. Always rendered so the spot is part of the
user's mental map — when state changes, the colour shift draws
the eye. Only `pill-update` glows; the other states are quiet. */
+ /* ---- Update banner ------------------------------------------------ */
+ #updateBanner {
+ background: linear-gradient(180deg, rgba(240,185,64,0.14), rgba(240,185,64,0.07));
+ border-bottom: 1px solid rgba(240,185,64,0.34);
+ padding: 10px 16px; font-size: 13px;
+ }
+ #updateBanner[hidden] { display: none; }
+ .ub-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
+ .ub-icon { width: 16px; height: 16px; color: #f0b940; flex: 0 0 auto; }
+ /* flex-basis 240px, not auto: with auto this row's text claimed the whole
+ line and shoved both buttons onto lines of their own. */
+ .ub-text { display: flex; gap: 8px; align-items: baseline;
+ flex-wrap: wrap; min-width: 0; flex: 1 1 240px; }
+ .ub-text strong { color: var(--ink, #e8eaf0); font-weight: 600; }
+ .ub-sub { color: var(--ink-500, #98a0b3); }
+ .ub-go {
+ background: #f0b940; color: #1a1408; border: 0; border-radius: 8px;
+ padding: 6px 14px; font-weight: 650; font-size: 13px; cursor: pointer;
+ flex: 0 0 auto; width: auto; white-space: nowrap;
+ }
+ .ub-go:hover { filter: brightness(1.08); }
+ .ub-go[disabled] { opacity: .6; cursor: default; }
+ .ub-dismiss, .ub-already {
+ background: transparent; color: var(--ink-500, #98a0b3);
+ border: 1px solid var(--line, #262a33); border-radius: 8px;
+ padding: 5px 10px; font-size: 12px; cursor: pointer; flex: 0 0 auto;
+ width: auto; white-space: nowrap;
+ }
+ .ub-dismiss:hover, .ub-already:hover { color: var(--ink, #e8eaf0); }
+ /* The star line is its own row so it can never squeeze the update action,
+ which is the thing the user actually came to this banner for. */
+ .ub-star {
+ margin-top: 8px; padding-top: 8px;
+ border-top: 1px solid rgba(240,185,64,0.18);
+ color: var(--ink-500, #98a0b3); display: flex; align-items: center;
+ gap: 10px; flex-wrap: wrap;
+ }
+ .ub-star[hidden] { display: none; }
+ .ub-star a { color: #f0b940; font-weight: 600; }
.pill-update {
color: var(--warning, #f0b940);
border-color: rgba(240,185,64,0.55);
@@ -32974,6 +33058,27 @@ HTML = r"""<!doctype html>
</defs>
</svg>
+<!-- Update banner. Deliberately a BANNER and not a modal: an update is not an
+ emergency and a dialog that blocks a running render is worse than being
+ out of date. Shown only when the version check says we are behind AND the
+ user has not dismissed THIS version — dismissing 4.1.1 must not silence
+ 4.2.0, which is why the setting stores a version string, not a boolean. -->
+<div id="updateBanner" hidden>
+ <div class="ub-main">
+ <svg class="ph ub-icon" aria-hidden="true"><use href="#ph-arrow-up"/></svg>
+ <div class="ub-text">
+ <strong id="ubTitle">A new version is available</strong>
+ <span id="ubSub" class="ub-sub"></span>
+ </div>
+ <button type="button" class="ub-go" id="ubUpdate">Update now</button>
+ <button type="button" class="ub-dismiss" id="ubLater" title="Hide until the next version">Later</button>
+ </div>
+ <div class="ub-star" id="ubStar" hidden>
+ Updating takes a minute — <a href="https://github.com/mrbizarro/phosphene" id="ubStarLink" target="_blank" rel="noopener">a star on GitHub</a> while you wait means the world.
+ <button type="button" class="ub-already" id="ubStarDone">Already did</button>
+ </div>
+</div>
+
<header>
<a href="/" class="brand"><img src="/assets/phosphene_cycle_word_transparent.png" alt="Phosphene"></a>
<span class="version-badge" title="Phosphene __PANEL_VERSION__">__PANEL_VERSION__</span>
@@ -51678,6 +51783,7 @@ async function refreshVersionPill() {
return; // network blip; don't blow away last good state
}
renderVersionPill();
+ try { _ubRender(_versionState); } catch (e) {}
}
function _versionDisplayLabel(s) {
@@ -51779,6 +51885,107 @@ function renderVersionPill() {
pill.title = 'Checking for updates…';
}
+// ---- Update banner -------------------------------------------------------
+//
+// The pill has always known we were behind; it just said so quietly, in the
+// header, and required a click to even check. This says it once, loudly, and
+// then gets out of the way permanently for that version.
+//
+// The star ask rides HERE and nowhere else on purpose: it is the one moment
+// the user is already waiting on us, and it appears at most once per install.
+// Clicking through or saying "already did" writes a local flag — there is no
+// way to ask GitHub whether a given person starred the repo without making
+// them log into GitHub inside a local video panel, and that trade is not worth
+// a prompt. The analytics side is a COUNT of clicks and carries no identity,
+// which is the same contract as every other event we send.
+window._ubStarSettings = null;
+
+function _ubRender(s) {
+ const el = document.getElementById('updateBanner');
+ if (!el) return;
+ const behind = (s && !s.error && s.checked_ts && (s.behind_by | 0) > 0);
+ const remote = (s && (s.remote_version || s.remote_short)) || '';
+ // A pull already happened this session — the banner's job is done, the
+ // restart pill takes over from here.
+ if (!behind || _versionRestartPending) { el.hidden = true; return; }
+ const cfg = window._ubStarSettings || {};
+ if (String(cfg.update_banner_dismissed || '') === String(remote) && remote) {
+ el.hidden = true; return;
+ }
+ const local = (s.local_version || s.local_short || 'your build');
+ document.getElementById('ubTitle').textContent =
+ `Phosphene ${remote} is available`;
+ document.getElementById('ubSub').textContent =
+ `You are on ${local}.` + (s.behind_more_than ? ' 30+ commits behind.' : '');
+ const star = document.getElementById('ubStar');
+ if (star) star.hidden = !!cfg.star_prompt_done;
+ el.hidden = false;
+}
+
+async function _ubSaveSetting(patch) {
+ Object.assign(window._ubStarSettings || (window._ubStarSettings = {}), patch);
+ try {
+ // /settings is form-encoded — a JSON body parses to nothing and returns
+ // a cheerful ok:true while saving absolutely nothing.
+ const form = new URLSearchParams();
+ for (const [k, v] of Object.entries(patch)) form.set(k, String(v));
+ await fetch('/settings', {
+ method: 'POST',
+ headers: {'Content-Type': 'application/x-www-form-urlencoded'},
+ body: form.toString(),
+ });
+ } catch (e) { /* a failed write just means we ask again next boot */ }
+}
+
+function _ubWire() {
+ const go = document.getElementById('ubUpdate');
+ if (go) go.onclick = () => {
+ go.disabled = true;
+ go.textContent = 'Updating…';
+ // Reuse the pill's existing pull path — one implementation, not two.
+ versionPillClick();
+ };
+ const later = document.getElementById('ubLater');
+ if (later) later.onclick = () => {
+ const s = _versionState || {};
+ _ubSaveSetting({update_banner_dismissed: String(s.remote_version || s.remote_short || '')});
+ const el = document.getElementById('updateBanner');
+ if (el) el.hidden = true;
+ };
+ const link = document.getElementById('ubStarLink');
+ if (link) link.onclick = () => {
+ _ubSaveSetting({star_prompt_done: true});
+ const el = document.getElementById('ubStar');
+ if (el) el.hidden = true;
+ // Anonymous count, no identity — same contract as every other event.
+ try { fetch('/star-click', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({via: 'link'})}); } catch (e) {}
+ };
+ const done = document.getElementById('ubStarDone');
+ if (done) done.onclick = () => {
+ _ubSaveSetting({star_prompt_done: true});
+ const el = document.getElementById('ubStar');
+ if (el) el.hidden = true;
+ try { fetch('/star-click', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({via: 'already'})}); } catch (e) {}
+ };
+}
+document.addEventListener('DOMContentLoaded', () => {
+ _ubWire();
+ // The banner needs two settings before it can decide anything, and the
+ // Settings modal may never be opened — so read them here rather than
+ // relying on _settingsCache, which is only populated when that opens.
+ fetch('/settings')
+ .then(r => r.json())
+ .then(d => {
+ const st = (d && (d.settings || d)) || {};
+ window._ubStarSettings = {
+ update_banner_dismissed: st.update_banner_dismissed || '',
+ star_prompt_done: !!st.star_prompt_done,
+ };
+ if (_versionState) { try { _ubRender(_versionState); } catch (e) {} }
+ })
+ .catch(() => {});
+});
+
// One click — does the right thing for the current state. Magic button.
async function versionPillClick() {
if (_versionRestartPending) {
diff --git a/test_update_banner.py b/test_update_banner.py
new file mode 100644
index 0000000..1562433
--- /dev/null
+++ b/test_update_banner.py
@@ -0,0 +1,57 @@
+"""The update banner's server half: the two settings and the star-click count.
+
+Design notes worth keeping, because both were live bugs during the build:
+
+1. `/settings` is FORM-ENCODED. A JSON body parses to nothing and the endpoint
+ cheerfully returns ok:true having saved absolutely nothing — the banner
+ dismissed itself on screen and came back on the next boot.
+2. Form values arrive as STRINGS, and `bool("false")` is True. Parsing the flag
+ with a bare bool() makes "don't ask me again" impossible to clear.
+
+`update_banner_dismissed` stores a VERSION, not a boolean, so dismissing 4.1.1
+does not silence the banner for 4.2.0. The star ask is a local flag and not an
+analytics lookup: GitHub can only answer "did this authenticated user star it",
+which would mean asking someone to sign into GitHub inside a local video panel
+to suppress a prompt.
+"""
+
+import unittest
+
+import mlx_ltx_panel as panel
+
+
+class SettingsPatch(unittest.TestCase):
+ def _patch(self, **kw):
+ out, err = panel._validate_settings_patch(kw)
+ self.assertIsNone(err, err)
+ return out
+
+ def test_dismissed_stores_the_version_string(self):
+ self.assertEqual(self._patch(update_banner_dismissed="4.1.1")["update_banner_dismissed"], "4.1.1")
+
+ def test_dismissed_can_be_cleared(self):
+ self.assertEqual(self._patch(update_banner_dismissed="")["update_banner_dismissed"], "")
+
+ def test_dismissed_is_length_bounded(self):
+ got = self._patch(update_banner_dismissed="x" * 500)["update_banner_dismissed"]
+ self.assertLessEqual(len(got), 32)
+
+ def test_star_flag_from_form_strings(self):
+ """The bool("false") trap — every one of these arrives as a string."""
+ for raw, want in (("true", True), ("1", True), ("on", True), ("yes", True),
+ ("false", False), ("0", False), ("", False), ("off", False)):
+ self.assertIs(self._patch(star_prompt_done=raw)["star_prompt_done"], want, raw)
+
+ def test_star_flag_from_real_bools(self):
+ self.assertIs(self._patch(star_prompt_done=True)["star_prompt_done"], True)
+ self.assertIs(self._patch(star_prompt_done=False)["star_prompt_done"], False)
+
+ def test_both_keys_are_public(self):
+ """The banner reads these from /settings before Settings is ever opened."""
+ pub = panel.get_settings_public()
+ self.assertIn("update_banner_dismissed", pub)
+ self.assertIn("star_prompt_done", pub)
+
+
+if __name__ == "__main__":
+ unittest.main()