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.19.11): LightX2V on Mac - H3 Best at High about 2.3x faster

mrbizarroeafb06866bdb
diff --git a/README.md b/README.md
index 08ae4ad..f8f0b97 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ AI video with sound, songs and images, made locally on your Mac.
[Website](https://phosphene.video) · [Docs](https://phosphene.video/docs/) · [Benchmarks](https://phosphene.video/benchmarks/) · [Changelog](https://phosphene.video/changelog/) · [@PhospheneAI](https://x.com/PhospheneAI)
-**Current release: v4.19.10.** See what's new in the [changelog](https://phosphene.video/changelog/).
+**Current release: v4.19.11.** See what's new in the [changelog](https://phosphene.video/changelog/).
Phosphene is a free, open-source app for Apple Silicon Macs, built on Apple's MLX by Mr Bizarro.
Renders run offline, and your prompts, pictures and videos stay on your Mac.
@@ -113,6 +113,7 @@ Contributors are credited in the [release notes](https://github.com/mrbizarro/ph
- Lightricks for LTX-Video 2.x, and @dgrauet for ltx-2-mlx, the MLX port Phosphene builds on.
- MiniMax for Hailuo H3, and Apple ML research for MLX.
+- LightX2V for lightx2v v1.3, the adapter for Best on High; TaoLive (TaoMate-H3) and @kijai for the 3-step Fast adapter.
- @filipstrand for mflux; Multimodal Art Projection for YuE2 and @vanch007 for its MLX port.
- mlx-community for Gemma on MLX, and @cocktailpeanut for Pinokio.
diff --git a/VERSION b/VERSION
index bf323df..0ca0cba 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.19.10
+4.19.11
diff --git a/assets/phosphene_wordtext.png b/assets/phosphene_wordtext.png
new file mode 100644
index 0000000..90de5c0
Binary files /dev/null and b/assets/phosphene_wordtext.png differ
diff --git a/docs/ANALYTICS.md b/docs/ANALYTICS.md
index 977c8dc..4ad1321 100644
--- a/docs/ANALYTICS.md
+++ b/docs/ANALYTICS.md
@@ -223,6 +223,7 @@ including image and training jobs.
| `lora_kinds` | string | `"style"` | Closed vocabulary: `none` / `style` / `character` / `mixed` |
| `character_used` | bool | `true` | A cast character drove this render |
| `audio_mode` | string | `"joint"` | `joint` / `none` (external audio replaces the generated track) / `a2v_dub` / `h3_native` |
+| `h3_sampler` | string | `"v13"` | 4.19.11 — H3 renders only: which sampler ran. **Closed vocabulary**: `best` (the full sampler), `fast`, `turbo`, `v13` (lightx2v v1.3 on Best at High). Keeps the timing lanes apart, which `steps` alone cannot |
| `first_render` | bool | `true` | Present once per install, on its first successful render ever — the activation funnel without a join |
| `gpu_steps` | string | `"short"` | 4.17.5 — present only when the render ran in **short GPU steps** (one Metal op per command buffer), the path a macOS GPU-watchdog kill switches a setting to. Closed vocabulary: `short`. Absent = default steps. Answers "does the short path stop the watchdog loop" |
| `watchdog_retry` | bool | `true` | 4.17.5 — present only when a GPU-watchdog kill was re-run inside the same job (once, on short steps). On `render_completed` it means the retry saved the render |
diff --git a/docs/H3_ENGINE.md b/docs/H3_ENGINE.md
index f55c6af..5bc3be5 100644
--- a/docs/H3_ENGINE.md
+++ b/docs/H3_ENGINE.md
@@ -357,6 +357,83 @@ says so under itself when one of them is picked.
sigma subset, decode; plus `h3.schedule` (the sigmas the runner ran) and
`h3.lora_accounting`. The ⓘ modal prints a Speed row.
+### Speed adapters run a per-head copy (2026-10-22)
+
+H3's DiT stores the fused `attn.qkv_proj` rows **per head**, `(heads, 3,
+head_dim)`. Every speed adapter Phosphene resolves — Kijai's TaoMate r19, the
+official TaoMate r128, larryvrh's v4-600 EMA, the LightX2V v1.x repack — has
+its `lora_B` rows **contiguous**, `(3, heads, head_dim)`: the layout of the
+ComfyUI/diffusers definition it was trained or converted through. (One-way
+ANOVA on row norms, q/k/v as groups: base blocks.49 per-head F 5006 vs
+contiguous 43; the adapters' B·A deltas at blocks.49 read the other way,
+TaoMate 11 vs 1897, v4 0 vs 1038.) The runner only re-orders rows under
+`--lora-qkv-permute`, which has been OFF by default since 2026-08-15 and is
+global to a run, so it would also re-order a stacked user LoRA that lora-lab
+trained in the native layout.
+
+So the panel re-orders the speed adapter itself: `h3_bake_runner_layout()`
+writes `turbo-lora/runner-layout/<same name>` with each qkv `lora_B`'s 168
+blocks of 128 rows moved into per-head order. It is a byte move of whole rows
+(dtype-agnostic, no arithmetic), byte-identical to the runner's
+`_permute_qkv_rows` on all 52 modules of the real TaoMate file, stamped in the
+file's metadata with the source's size and mtime and re-made when either
+changes, and written through a `.partial` + rename. It runs right after a Fast
+or Turbo download and, for installs that already have the file, on the first
+render (0.25 s for the 182 MB TaoMate file on an M4 Max). The downloaded, digest-pinned file is never touched.
+A runner without `--lora-qkv-permute` predates 2026-08-15 and re-orders every
+`--lora` itself, so it is handed the source file. User LoRAs never go through
+this. Provenance: `h3.tristep` / `h3.turbo` carry `lora` (the file the runner
+read), `source` and `qkv_rows` (`per-head` or `runner`).
+
+### Best on High: lightx2v v1.3 (2026-10-22)
+
+LightX2V's v1.3 768p H3 adapter (`lightx2v/Minimax-h3-Turbo` @ `30f485ed`,
+`minimax_h3_fl2v_turbo_4step_v1.3_768p_bf16.safetensors`, released 2026-10-20)
+is what Best renders on High once it is built:
+
+| High 1024×576, 124 frames, M4 Max 64 GB | forwards | wall | process peak |
+|---|---:|---:|---:|
+| Best, full sampler (shift 12) | 15 | 1950 s | 28.9 GiB |
+| Best, lightx2v v1.3 (shift 6) | 6 | 870 s | 32.8 GiB |
+
+Runner argv: `--steps 7 --lora <adapter>:1.0`, plus `--video-shift 6` on a
+runner that takes it. Shift 6 is the shift LightX2V trained its 768p adapters
+at; `--video-shift` (a runner commit not pinned yet) moves the video schedule
+only. The pinned runner (3f6c75c, any stacking runner) has no such flag and
+renders v1.3 at the default shift 12, and logs it: on the two-person dialogue
+test, shift 12 and shift 6 gave matching faces, mouths and timing (931.8 vs
+937.6 s), so an install gets v1.3 from the panel Update alone. 4.19.11 ships on
+the 3f6c75c pin; shift 6 follows if a later release moves the pin. A forward costs ~3% more
+with the runtime adapter, which the cell prices carry (`H3_V13_FORWARD_COST`).
+
+Where it runs (`h3_cell_takes_v13`, `make_job`): Best on the High canvas, Text
+and Image, every 5 s-window length. Never with Fast or Turbo, never under a
+Steps pin (the pin is the way back to the full sampler), never on Draft,
+Standard, Native, the dense pass or the media modes, none of which were
+rendered on v1.3. `h3_v13=0` on the API keeps the full sampler.
+
+**The file.** Not hosted by Phosphene (an H3 Model Derivative; MiniMax H3
+Community License on the weights, Apache-2.0 on LightX2V's code).
+`scripts/fetch_h3_v13.py` (install_h3.js, best-effort; `POST /h3/v13/install`
+from the Speed row) downloads the pinned source (sha256 `97b77570…`,
+1,383,677,808 B), then builds `lightx2v_v1.3_768p_phosphene.safetensors`
+(sha256 `45ee324a…`, 1,956,165,376 B) with the standard library only:
+
+- q/k/v fused into one block-diagonal adapter whose B rows are written in the
+ DiT's own per-head order `(heads, 3, head_dim)`. LightX2V trained against the
+ contiguous `(3, heads, head_dim)` split (row-norm grouping of the delta), and
+ the base checkpoint is per-head (row-norm ANOVA on `qkv_proj`: F 1362 vs 84 on
+ block 0). Baking the move in keeps `--lora-qkv-permute` off, so a user LoRA
+ stacked after it is applied as trained. Tensor for tensor this equals the
+ file the validation renders loaded with `--lora-qkv-permute`.
+- `ff.net.0.proj` B halves swapped to `[gate; value]`.
+- alpha/rank = 8/128 = 2^-4 folded into B as an exponent shift (exact); a
+ value that would leave bf16's normal range is refused, not rounded.
+
+Both digests are checked; a corrupt or partial build is deleted, never
+renamed into place. `test_h3_v13.py` pins script↔panel parity, the re-layout
+against an independent reference, the job rules, the argv and the prices.
+
### Chained windows (v3.4.1)
Window *N*'s **last decoded frame** becomes window *N+1*'s first-frame keyframe
diff --git a/install_h3.js b/install_h3.js
index f224c88..ce8a871 100644
--- a/install_h3.js
+++ b/install_h3.js
@@ -312,6 +312,24 @@ module.exports = {
}
},
+ // ---- lightx2v v1.3 (Best on High): fetched from UPSTREAM, built here ----
+ // Target: lightx2v_v1.3_768p_phosphene.safetensors (SHA-256
+ // 45ee324a31beacef7a2fbef019b99e16b35d80586dc4e0d60fecf6ca679751d8),
+ // built by scripts/fetch_h3_v13.py from LightX2V's original
+ // minimax_h3_fl2v_turbo_4step_v1.3_768p_bf16.safetensors (pinned commit,
+ // source SHA-256 97b775707bb5732e01dba0cf3833d3fe2947c953859d4d05ea3bd74894c43d2b).
+ // Never hosted by Phosphene: an H3 Model Derivative (MiniMax H3 Community
+ // License; LightX2V's code is Apache-2.0). BEST-EFFORT, like Turbo: the
+ // Speed row's "Get it" button runs the same script on demand.
+ {
+ method: "shell.run",
+ params: {
+ message: [
+ RH3 + ".venv/bin/python \"$APP_ROOT/scripts/fetch_h3_v13.py\" --dir \"$H3_LAYOUT/turbo-lora\" --licence-state \"${LTX_STATE_DIR:-$APP_ROOT/state}\" || echo 'V13 FETCH FAILED - the Speed row offers a retry'"
+ ]
+ }
+ },
+
// ---- TAE: the fast draft decoder (~23 MB) ------------------------------
// H3's video decoder is a 36-layer ViT and it is the biggest FIXED cost in
// a render — 88 s of a 501 s clip, 77% of everything that isn't denoising.
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 131e907..7d22228 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -3818,6 +3818,12 @@ def _h3_turbo_download_bg(target_dir, push_log, asset: dict | None = None) -> No
"please retry")
tmp.replace(target)
push_log(f"[h3:turbo] adapter installed → {target}")
+ try:
+ # Same as Fast's: the runner's per-head copy, retried by the
+ # first Turbo render if this fails.
+ h3_bake_runner_layout(target, push_log)
+ except Exception as e: # noqa: BLE001
+ push_log(f"[h3:turbo] qkv re-order deferred to the first render: {e}")
_h3_turbo_fetch_embedder(target_dir, push_log, force=True)
_set_h3_turbo_dl(status="done", mb=total_mb, total_mb=total_mb,
error=None)
@@ -9223,6 +9229,59 @@ H3_TRISTEP_MEASURED_ETA: dict[tuple[str, str, str], tuple[float, str]] = {
("high", "5s", "i2v"): (9.0, "~9 min"),
("high", "5s", "t2v"): (8.4, "~8 min"),
}
+
+# ---- lightx2v v1.3: Best at High on LightX2V's few-step adapter ---------------
+# LightX2V's v1.3 768p distillation of H3 (lightx2v/Minimax-h3-Turbo, released
+# 2026-10-20) at 7 sigma points = 6 forwards, video shift 6 (the shift its
+# author trained the 768p adapters on). Measured on the M4 Max 64 GB at High
+# 1024x576, 124 frames, same seed: today's Best 15 forwards 1950 s end to end,
+# v1.3 6 forwards 870 s (-55%); the owner's read of the side-by-side: the fast
+# clip looks better, richer, higher quality. More prompts (two-person
+# dialogue, fast body motion, typography) in the PM hub's speed/ folder.
+#
+# Where it runs: Best on the High canvas, Text and Image, every 5 s-window
+# length. A Steps pin keeps the full sampler (that is the opt-out), Fast and
+# Turbo never stack with it, Native / dense / the media modes keep their own
+# samplers. Free for everyone.
+#
+# THE FILE. Phosphene does not host it (an H3 Model Derivative, MiniMax H3
+# Community License; LightX2V's code is Apache-2.0). scripts/fetch_h3_v13.py
+# fetches the original from LightX2V's repo at a pinned commit + digest and
+# re-lays it out on this Mac, with the qkv rows already in the DiT's per-head
+# order (so no runner flag, and a user LoRA stacked on top is untouched) and
+# alpha/rank (8/128) folded into B exactly. The pins below MUST match that
+# script; test_h3_v13.py holds them together.
+H3_V13_REPO = "lightx2v/Minimax-h3-Turbo"
+H3_V13_SOURCE_REVISION = "30f485ed874aa44c8183348ad361c5eabad318da"
+H3_V13_SOURCE_FILE = "minimax_h3_fl2v_turbo_4step_v1.3_768p_bf16.safetensors"
+H3_V13_SOURCE_URL = ("https://huggingface.co/" + H3_V13_REPO + "/resolve/"
+ + H3_V13_SOURCE_REVISION + "/" + H3_V13_SOURCE_FILE)
+H3_V13_SOURCE_SHA256 = "97b775707bb5732e01dba0cf3833d3fe2947c953859d4d05ea3bd74894c43d2b"
+H3_V13_SOURCE_BYTES = 1383677808
+H3_V13_FILE = "lightx2v_v1.3_768p_phosphene.safetensors"
+H3_V13_SHA256 = "45ee324a31beacef7a2fbef019b99e16b35d80586dc4e0d60fecf6ca679751d8"
+H3_V13_BYTES = 1956165376
+H3_V13_STEPS = 7 # sigma POINTS -> 6 forwards
+H3_V13_FORWARDS = H3_V13_STEPS - 1
+H3_V13_VIDEO_SHIFT = "6" # the runner's --video-shift (default 12)
+# A forward with the runtime adapter costs ~3% more (126.5 vs 122.6 s/forward).
+H3_V13_FORWARD_COST = 1.03
+H3_V13_QUALITIES = ("high",)
+H3_V13_MODES = ("t2v", "i2v")
+H3_V13_DOWNLOAD_GB = 1.4
+# Free disk the build needs: the 1.4 GB source plus the 2.0 GB result, while
+# both exist, plus a margin so a render's swap never meets a full disk.
+H3_V13_DISK_NEED_GB = 5.0
+H3_V13_LICENSE = "MiniMax H3 Community License"
+H3_V13_CODE_LICENSE = "Apache-2.0"
+H3_V13_NAME = "lightx2v v1.3"
+H3_V13_LABEL = "High: faster Best (lightx2v v1.3)"
+H3_V13_CREDIT = ("lightx2v v1.3 by LightX2V (ModelTC). Code: Apache-2.0; "
+ "weights: MiniMax H3 Community License.")
+# End-to-end wall clocks, M4 Max 64 GB, keyed (quality, length, mode).
+H3_V13_MEASURED_ETA: dict[tuple[str, str, str], tuple[float, str]] = {
+ ("high", "5s", "t2v"): (14.5, "~15 min"),
+}
# Upscale & Face Fix (1 refine step from the clip, ×2) after a 5 s render, by
# source canvas. 640×384 → 1280×768 measured 2.5–2.8 min; 1024×576 measured
# 8.2–9.9 min (panel history, 2026-09-16/17); 768×448 is interpolated between
@@ -9846,8 +9905,12 @@ def _job_fleet_baseline_min(job: dict) -> tuple[str, float] | None:
if not cell or not cell.get("frames"):
return None
fast = bool(p.get("h3_tristep") or p.get("h3_turbo"))
+ # 4.19.11 review: a lightx2v v1.3 render is measured against the v1.3
+ # lane's own fleet median (none yet = no fleet sample), never against
+ # the full sampler's, or its ~2.3x speed would read as a fast Mac.
hit = fleet_estimate_range("h3", "t2v", key, cell["frames"],
- speed="fast" if fast else "best")
+ speed="fast" if fast else
+ "v13" if p.get("h3_v13") else "best")
else:
if str(p.get("schedule_preset") or "").strip().lower() == "fast":
return None
@@ -11090,6 +11153,21 @@ def _build_h3_tiers() -> dict[str, dict]:
# recipe, so the cell's own price is Fast + the fix.
eta_min = tristep["tristep_min"] + tristep.get("facefix_min", 0.0)
eta, eta_measured = _fmt_eta(eta_min), False
+ # lightx2v v1.3 prices only the cells where Best runs it
+ # (h3_cell_takes_v13): 6 forwards at ~3% more per forward.
+ v13 = {}
+ if (q["key"] in H3_V13_QUALITIES and not ln["dense"]
+ and not q.get("fast_hd")):
+ v_min = min(eta_min, h3_estimate_minutes(
+ w, h, window_frames, windows, H3_V13_FORWARDS) * H3_V13_FORWARD_COST)
+ v_eta, v_meas = _fmt_eta(v_min), False
+ hit = H3_V13_MEASURED_ETA.get((q["key"], ln["key"], "t2v"))
+ if hit:
+ v_min, v_meas = hit[0] * hw, True
+ v_eta = hit[1] if hw == 1.0 else _fmt_eta(v_min)
+ v13 = {"v13_min": round(v_min, 2), "v13_eta": v_eta,
+ "v13_measured": v_meas, "v13_steps": H3_V13_STEPS,
+ "v13_forwards": windows * H3_V13_FORWARDS}
spec = f"{w}×{h} · {frames}f"
if windows > 1:
spec += f" · {windows}×5s"
@@ -11142,6 +11220,7 @@ def _build_h3_tiers() -> dict[str, dict]:
"dense": bool(ln["dense"]),
"offered": bool(q["offered"] and ln["offered"]),
**tristep,
+ **v13,
}
# Owner ruling (2026-09-29): real fleet ranges where there are
# enough of them, one per speed this cell actually offers (H3's
@@ -11150,6 +11229,10 @@ def _build_h3_tiers() -> dict[str, dict]:
fleet_best = fleet_calibrated_range("h3", "t2v", key, frames, speed="best")
if fleet_best:
tiers[key]["fleet_range"] = fleet_best
+ if tiers[key].get("v13_min") is not None:
+ fleet_v13 = fleet_calibrated_range("h3", "t2v", key, frames, speed="v13")
+ if fleet_v13:
+ tiers[key]["fleet_range_v13"] = fleet_v13
if tiers[key].get("tristep_min") is not None:
fleet_fast = fleet_calibrated_range("h3", "t2v", key, frames, speed="fast")
if fleet_fast:
@@ -12520,6 +12603,10 @@ def job_recipe_minutes(params: dict, *, calibration: bool = False) -> tuple[str,
else cell.get("tristep_min"))
elif p.get("h3_turbo"):
minutes = cell.get("turbo_min")
+ elif p.get("h3_v13") and cell.get("v13_min") is not None:
+ # lightx2v v1.3 on Best at High: its own measured number, so a
+ # 15-minute recipe never calibrates against the 33-minute one.
+ minutes = cell.get("v13_min")
elif pinned:
if calibration:
return None # a workload no cell prices (Codex H3-4)
@@ -14118,6 +14205,169 @@ def h3_turbo_argv(paths: dict | None = None) -> list[str]:
return argv
+# ---- Speed adapters: fused qkv rows in THIS checkpoint's order -------------
+# H3's DiT stores `attn.qkv_proj` rows PER HEAD, (heads, 3, head_dim): a
+# one-way ANOVA on the Q8 DiT's row norms separates the q/k/v groups at
+# F 1362 (blocks.0) / 5006 (blocks.49) read that way, against 83 / 43 read
+# contiguously. Every speed adapter we resolve was trained or converted
+# through the ComfyUI/diffusers definition, whose rows are CONTIGUOUS,
+# (3, heads, head_dim): the same test on their B·A deltas reads contiguous at
+# blocks.49 for Kijai's TaoMate r19 (1897 vs 11), the official TaoMate r128
+# (1931 vs 10), larryvrh's v4-600 EMA (1038 vs 0) and LightX2V's v1.x
+# conversions (fetch_h3_turbo.py says so in its own docstring). The runner
+# re-orders those rows only under `--lora-qkv-permute`, OFF by default since
+# 2026-08-15 — so Fast and Turbo were writing the q update onto the first
+# 18.7 heads' q/k/v triplets, k onto the next, v onto the rest. That flag is
+# global to the run and would also hit a user LoRA stacked on top (one
+# lora-lab trains natively is already per-head), so the panel re-orders the
+# speed adapter's rows ITSELF, once, into a sibling file the runner reads
+# verbatim: `<adapter dir>/runner-layout/<same name>`. Pure byte moves of
+# whole rows — dtype-agnostic, no float maths, no new dependency — and the
+# source file (digest-pinned) is never touched.
+H3_RUNNER_LAYOUT_DIRNAME = "runner-layout"
+H3_QKV_HEADS = 56
+H3_QKV_HEAD_DIM = 128
+H3_QKV_LORA_B_SUFFIX = ".attn.qkv_proj.lora_B.weight"
+H3_RUNNER_LAYOUT_KEY = "phosphene_qkv_rows"
+H3_RUNNER_LAYOUT_VALUE = "per-head (heads, 3, head_dim), re-ordered from (3, heads, head_dim)"
+
+
+def _st_header(path: Path) -> tuple[int, dict]:
+ """A safetensors file's (header length, header) — the JSON only."""
+ with open(path, "rb") as fh:
+ size = int.from_bytes(fh.read(8), "little")
+ if not 0 < size <= 100 * 1024 * 1024:
+ raise ValueError(f"{path.name}: not a safetensors file")
+ header = json.loads(fh.read(size))
+ if not isinstance(header, dict):
+ raise ValueError(f"{path.name}: not a safetensors file")
+ return size, header
+
+
+def h3_runner_layout_file(src: Path | str) -> Path:
+ src = Path(src)
+ return src.parent / H3_RUNNER_LAYOUT_DIRNAME / src.name
+
+
+def _h3_runner_layout_current(src: Path, dst: Path) -> bool:
+ """The re-ordered copy exists and was made from THIS source file."""
+ try:
+ meta = _st_header(dst)[1].get("__metadata__") or {}
+ st = src.stat()
+ except (OSError, ValueError, UnicodeDecodeError):
+ return False
+ return (meta.get(H3_RUNNER_LAYOUT_KEY) == H3_RUNNER_LAYOUT_VALUE
+ and meta.get("phosphene_source_bytes") == str(st.st_size)
+ and meta.get("phosphene_source_mtime_ns") == str(st.st_mtime_ns))
+
+
+def _h3_qkv_rows_per_head(blob: bytes, rows: int) -> bytes:
+ """`lora_B` rows (3, heads, head_dim) -> (heads, 3, head_dim), as bytes.
+ Row-major storage keeps each row's bytes contiguous, so this moves 168
+ blocks of 128 rows and never reads a value."""
+ heads, head_dim = H3_QKV_HEADS, H3_QKV_HEAD_DIM
+ if rows != 3 * heads * head_dim or len(blob) % rows:
+ raise ValueError(f"qkv lora_B has {rows} rows, expected {3 * heads * head_dim}")
+ block = (len(blob) // rows) * head_dim
+ return b"".join(blob[(j * heads + h) * block:(j * heads + h + 1) * block]
+ for h in range(heads) for j in range(3))
+
+
+_h3_bake_locks: dict[str, threading.Lock] = {}
+_h3_bake_locks_guard = threading.Lock()
+
+
+def h3_bake_runner_layout(src: Path | str, push=None) -> Path:
+ """Write (once) and return the per-head copy of a speed adapter.
+
+ Re-made whenever the source's size or mtime changes; written to a
+ `.partial` and renamed, so a killed bake never leaves a file the runner
+ would read. Raises with a plain reason (disk, unreadable file).
+
+ One bake per destination at a time (4.19.11 review): the Fast/Turbo
+ download thread and the first render can both reach a newly downloaded
+ adapter; without the lock both wrote the same `.partial` and the loser's
+ rename raised FileNotFoundError, failing that render. The second caller
+ now waits and finds the copy current."""
+ src = Path(src)
+ dst = h3_runner_layout_file(src)
+ if _h3_runner_layout_current(src, dst):
+ return dst
+ with _h3_bake_locks_guard:
+ lock = _h3_bake_locks.setdefault(str(dst), threading.Lock())
+ with lock:
+ if _h3_runner_layout_current(src, dst):
+ return dst
+ return _h3_bake_runner_layout_locked(src, dst, push)
+
+
+def _h3_bake_runner_layout_locked(src: Path, dst: Path, push=None) -> Path:
+ """h3_bake_runner_layout's body; the caller holds dst's lock."""
+ hlen, header = _st_header(src)
+ st = src.stat()
+ dst.parent.mkdir(parents=True, exist_ok=True)
+ free = shutil.disk_usage(dst.parent).free
+ if free < st.st_size + 512 * 1024 * 1024:
+ raise RuntimeError(
+ f"not enough free disk to prepare {src.name} for H3 "
+ f"({st.st_size / 1e9:.1f} GB needed, {free / 1e9:.1f} GB free) — "
+ "free some space and render again")
+ meta = dict(header.get("__metadata__") or {})
+ meta.update({H3_RUNNER_LAYOUT_KEY: H3_RUNNER_LAYOUT_VALUE,
+ "phosphene_source": src.name,
+ "phosphene_source_bytes": str(st.st_size),
+ "phosphene_source_mtime_ns": str(st.st_mtime_ns)})
+ out_header = {**header, "__metadata__": meta}
+ raw = json.dumps(out_header, separators=(",", ":")).encode("utf-8")
+ raw += b" " * (-len(raw) % 8) # the format's 8-byte alignment pad
+ tensors = sorted(((k, v) for k, v in header.items() if k != "__metadata__"),
+ key=lambda kv: kv[1]["data_offsets"][0])
+ moved = 0
+ tmp = dst.with_name(f"{dst.name}.{os.getpid()}.partial")
+ try:
+ with open(src, "rb") as fin, open(tmp, "wb") as fout:
+ fout.write(len(raw).to_bytes(8, "little"))
+ fout.write(raw)
+ pos = 0
+ for name, info in tensors:
+ start, end = info["data_offsets"]
+ if start != pos:
+ raise ValueError(f"{src.name}: tensor data is not contiguous at {name}")
+ fin.seek(8 + hlen + start)
+ blob = fin.read(end - start)
+ if len(blob) != end - start:
+ raise ValueError(f"{src.name}: truncated at {name}")
+ if name.endswith(H3_QKV_LORA_B_SUFFIX):
+ blob = _h3_qkv_rows_per_head(blob, int(info["shape"][0]))
+ moved += 1
+ fout.write(blob)
+ pos = end
+ if not moved:
+ raise ValueError(f"{src.name}: no attn.qkv_proj lora_B tensors found")
+ tmp.replace(dst)
+ except BaseException:
+ tmp.unlink(missing_ok=True)
+ raise
+ if push:
+ push(f"[h3] {src.name}: {moved} qkv row-blocks re-ordered to the "
+ f"checkpoint's per-head layout → {dst}")
+ return dst
+
+
+def h3_speed_adapter_for_runner(resolved: dict, push=None) -> dict:
+ """The resolved Fast/Turbo paths with `lora` pointing at the file the
+ runner should read; the downloaded file moves to `lora_source`.
+
+ A runner without `--lora-qkv-permute` predates 2026-08-15 and re-orders
+ the rows of every `--lora` itself, so it gets the source file as-is —
+ re-ordering twice would put the rows back in the wrong order."""
+ src = resolved.get("lora")
+ if src is None or not _h3_runner_has_flag("--lora-qkv-permute"):
+ return {**resolved, "lora_source": src, "qkv_rows": "runner"}
+ return {**resolved, "lora": h3_bake_runner_layout(src, push),
+ "lora_source": src, "qkv_rows": "per-head"}
+
+
def h3_turbo_status() -> dict:
"""Turbo's own availability block for /status + the page bootstrap.
@@ -14350,6 +14600,12 @@ def _h3_tristep_download_bg(target_dir, push_log, asset: dict | None = None,
raise RuntimeError("checksum mismatch (download corrupt) — please retry")
tmp.replace(target)
push_log(f"[h3:tristep] adapter installed → {target}")
+ try:
+ # The runner's per-head copy now, so the first Fast render does
+ # not pay for it; a failure here is retried by that render.
+ h3_bake_runner_layout(target, push_log)
+ except Exception as e: # noqa: BLE001
+ push_log(f"[h3:tristep] qkv re-order deferred to the first render: {e}")
_set_h3_tristep_dl(status="done", mb=total_mb, total_mb=total_mb,
error=None)
except Exception as e: # noqa: BLE001
@@ -14397,6 +14653,208 @@ def _h3_install_tristep(push_log, download_fn=None) -> dict:
"bytes": H3_TRISTEP_BYTES, "license": H3_TRISTEP_LICENSE}
+# ---- lightx2v v1.3 (Best at High) — resolver, argv, status, fetch ------------
+def h3_supports_video_shift() -> bool:
+ """Whether the INSTALLED runner takes `--video-shift` (v1.3's own shift 6;
+ the runner's default is 12)."""
+ return h3_supports_lora_stack() and _h3_runner_has_flag("--video-shift")
+
+
+def h3_supports_v13() -> bool:
+ """v1.3 rides as one more `--lora` beside the user's: the stacking runner
+ is all it needs. A runner without `--video-shift` renders it at the
+ default shift 12 - side by side with shift 6 on the two-person dialogue
+ test the faces, mouths and timing matched (2026-10-22), so an install
+ gets v1.3 from the panel Update alone and shift 6 once its runner moves.
+
+ The built file's qkv rows are already per head, so the runner must NOT
+ re-order them: a runner without `--lora-qkv-permute` predates 2026-08-15
+ and re-orders every `--lora` itself (see h3_bake_runner_layout)."""
+ return h3_supports_lora_stack() and _h3_runner_has_flag("--lora-qkv-permute")
+
+
+def h3_cell_takes_v13(cell: dict) -> bool:
+ """Best on the High canvas at a 5 s-window length (single or chained).
+ Fast HD is the Fast pass by definition; the dense single pass and the
+ other canvases were never rendered on v1.3."""
+ return (cell.get("quality") in H3_V13_QUALITIES
+ and not bool(cell.get("dense")) and not bool(cell.get("fast_hd")))
+
+
+def h3_v13_paths() -> dict:
+ """The v1.3 adapter, if it is on disk at its exact size. No glob: the
+ upstream source file (whose alpha/rank is NOT folded) must never be read
+ as the adapter."""
+ directory = _h3_turbo_dir()
+ candidate = directory / H3_V13_FILE
+ try:
+ ok = candidate.is_file() and candidate.stat().st_size == H3_V13_BYTES
+ except OSError:
+ ok = False
+ if ok:
+ return {"dir": directory, "lora": candidate, "files_ok": True, "missing": []}
+ return {"dir": directory, "lora": None, "files_ok": False,
+ "missing": [f"adapter ({H3_V13_FILE}, built from a "
+ f"~{H3_V13_DOWNLOAD_GB} GB download)"]}
+
+
+def h3_v13_argv(paths: dict | None = None, shift: bool | None = None) -> list[str]:
+ """The runner argv fragment: shift 6 where the runner takes it, and the
+ adapter at 1.0 (its alpha is folded in). `--steps` is stamped by the
+ caller (H3_V13_STEPS)."""
+ resolved = paths or h3_v13_paths()
+ if not resolved.get("files_ok") or resolved.get("lora") is None:
+ raise RuntimeError("the lightx2v v1.3 adapter is not available")
+ if shift is None:
+ shift = h3_supports_video_shift()
+ return ((["--video-shift", H3_V13_VIDEO_SHIFT] if shift else [])
+ + ["--lora", f"{resolved['lora']}:1.0"])
+
+
+_h3_v13_dl_lock = threading.Lock()
+_h3_v13_dl_state: dict = {"status": "idle", "mb": 0, "total_mb": 0, "error": None}
+
+
+def _set_h3_v13_dl(**kw) -> None:
+ with _h3_v13_dl_lock:
+ _h3_v13_dl_state.clear()
+ _h3_v13_dl_state.update(kw)
+
+
+def h3_v13_status() -> dict:
+ """/status + BOOT block for v1.3: can the runner take it, is the file here."""
+ supported = h3_supports_v13()
+ paths = h3_v13_paths()
+ downloaded = bool(paths["files_ok"])
+ return {
+ "available": bool(supported and downloaded),
+ "supported": supported,
+ "downloaded": downloaded,
+ "reason": ("runner_too_old" if not supported
+ else "not_downloaded" if not downloaded else "ok"),
+ "steps": H3_V13_STEPS,
+ "forwards": H3_V13_FORWARDS,
+ "video_shift": float(H3_V13_VIDEO_SHIFT) if h3_supports_video_shift() else 12.0,
+ "qualities": list(H3_V13_QUALITIES),
+ "modes": list(H3_V13_MODES),
+ "download_gb": H3_V13_DOWNLOAD_GB,
+ "disk_need_gb": H3_V13_DISK_NEED_GB,
+ "repo": H3_V13_REPO,
+ "license": H3_V13_LICENSE,
+ "code_license": H3_V13_CODE_LICENSE,
+ "name": H3_V13_NAME,
+ "label": H3_V13_LABEL,
+ "credit": H3_V13_CREDIT,
+ "adapter": str(paths["lora"]) if paths["lora"] else None,
+ "install_available": bool(supported),
+ "installing": _h3_v13_dl_state.get("status") in ("downloading", "building"),
+ "download": dict(_h3_v13_dl_state),
+ "dir": str(paths["dir"]),
+ "missing": paths["missing"],
+ }
+
+
+def _h3_v13_fetch_bg(target_dir, push_log, runner=None) -> None:
+ """Run scripts/fetch_h3_v13.py (download from LightX2V's repo, verify,
+ re-lay out, verify, rename). The script owns every digest and the
+ resume; this only relays its progress. Standard library only, so the
+ panel's own interpreter runs it."""
+ total_mb = H3_V13_SOURCE_BYTES // (1 << 20)
+ cmd = [sys.executable, str(ROOT / "scripts" / "fetch_h3_v13.py"),
+ "--dir", str(target_dir)]
+ try:
+ push_log(f"[h3:v13] fetching {H3_V13_SOURCE_FILE} from {H3_V13_REPO} @ "
+ f"{H3_V13_SOURCE_REVISION[:7]} (~{total_mb} MB, {H3_V13_LICENSE})")
+ proc = (runner or subprocess.Popen)(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,
+ errors="replace", env=_h3_v13_fetch_env())
+ tail: list[str] = []
+ for line in proc.stdout:
+ line = line.rstrip()
+ if line.startswith("PROGRESS "):
+ try:
+ done = int(line.split()[1])
+ except (IndexError, ValueError):
+ continue
+ _set_h3_v13_dl(status="downloading", mb=done // (1 << 20),
+ total_mb=total_mb, error=None)
+ continue
+ if line.startswith("building "):
+ _set_h3_v13_dl(status="building", mb=total_mb, total_mb=total_mb,
+ error=None)
+ if line:
+ tail = (tail + [line])[-4:]
+ push_log(f"[h3:v13] {line}")
+ rc = proc.wait()
+ if rc != 0 or not h3_v13_paths()["files_ok"]:
+ raise RuntimeError(" / ".join(tail[-2:]) or f"exit {rc}")
+ push_log(f"[h3:v13] adapter installed -> {Path(target_dir) / H3_V13_FILE}")
+ _set_h3_v13_dl(status="done", mb=total_mb, total_mb=total_mb, error=None)
+ except Exception as e: # noqa: BLE001
+ _set_h3_v13_dl(status="error", mb=0, total_mb=total_mb, error=str(e)[:200])
+ push_log(f"[h3:v13] FAILED: {e}")
+
+
+def _h3_v13_fetch_env() -> dict:
+ """The fetch is plain urllib: give it the certificate bundle Pinokio
+ strips (SSL_*), and nothing that changes Python's own behaviour."""
+ env = {k: v for k, v in os.environ.items()
+ if k not in ("PYTHONPATH", "PYTHONHOME", "PYTHONSTARTUP")}
+ env["PYTHONUNBUFFERED"] = "1"
+ try:
+ import certifi # noqa: PLC0415
+ env.setdefault("SSL_CERT_FILE", certifi.where())
+ except Exception: # noqa: BLE001
+ pass
+ return env
+
+
+def _h3_install_v13(push_log, fetch_fn=None) -> dict:
+ """On-demand fetch + local build of the v1.3 adapter (one at a time)."""
+ paths = h3_paths()
+ if paths["missing"]:
+ return {"ok": False,
+ "error": "lightx2v v1.3 is an add-on to the Hailuo H3 pack, and "
+ "H3 isn't fully installed yet: " + "; ".join(paths["missing"])}
+ if not h3_supports_v13():
+ return {"ok": False,
+ "error": _dist.say(
+ "This Hailuo H3 runner predates lightx2v v1.3 (it takes one "
+ "adapter only). Run 'Update Hailuo H3 runner' from the "
+ "Phosphene sidebar in Pinokio - your weights stay.",
+ "This Hailuo H3 runner predates lightx2v v1.3. Updating "
+ "the runner isn't available in the Mac app yet.")}
+ resolved = h3_v13_paths()
+ target = resolved["dir"]
+ if resolved["files_ok"]:
+ return {"ok": True, "started": False, "already_installed": True,
+ "dir": str(target)}
+ try:
+ target.mkdir(parents=True, exist_ok=True)
+ free_gb = shutil.disk_usage(target).free / 1e9
+ except OSError:
+ free_gb = None
+ if free_gb is not None and free_gb < H3_V13_DISK_NEED_GB:
+ return {"ok": False,
+ "error": f"lightx2v v1.3 needs about {H3_V13_DISK_NEED_GB:g} GB free "
+ f"to prepare (1.4 GB download, 2 GB when ready). This "
+ f"disk has {free_gb:.1f} GB free."}
+ with _h3_v13_dl_lock:
+ if _h3_v13_dl_state.get("status") in ("downloading", "building"):
+ return {"ok": False,
+ "error": "a lightx2v v1.3 download is already active"}
+ _h3_v13_dl_state.clear()
+ _h3_v13_dl_state.update(status="downloading", mb=0,
+ total_mb=H3_V13_SOURCE_BYTES // (1 << 20), error=None)
+ fn = fetch_fn or _h3_v13_fetch_bg
+ threading.Thread(target=fn, args=(target, push_log), daemon=True,
+ name="h3-v13-fetch").start()
+ return {"ok": True, "started": True, "dir": str(target),
+ "source": H3_V13_SOURCE_URL, "sha256": H3_V13_SOURCE_SHA256,
+ "bytes": H3_V13_SOURCE_BYTES, "license": H3_V13_LICENSE,
+ "credit": H3_V13_CREDIT}
+
+
# ============================================================================
# H3 USER LoRAs — CivitAI adapters for the MiniMax H3 lane
# ============================================================================
@@ -16271,6 +16729,17 @@ def h3_status() -> dict:
"installing": False, "download": {}, "dir": str(_h3_turbo_dir()),
"missing": [], "note": H3_TRISTEP_NOTE,
"label": H3_TRISTEP_LABEL}),
+ # lightx2v v1.3 — Best at High. Same three-cause shape as Fast.
+ "v13": (h3_v13_status() if available else
+ {"available": False, "supported": False, "downloaded": False,
+ "reason": "h3_" + paths["reason"], "steps": H3_V13_STEPS,
+ "forwards": H3_V13_FORWARDS, "qualities": list(H3_V13_QUALITIES),
+ "modes": list(H3_V13_MODES), "download_gb": H3_V13_DOWNLOAD_GB,
+ "disk_need_gb": H3_V13_DISK_NEED_GB, "repo": H3_V13_REPO,
+ "license": H3_V13_LICENSE, "code_license": H3_V13_CODE_LICENSE,
+ "name": H3_V13_NAME, "label": H3_V13_LABEL, "credit": H3_V13_CREDIT,
+ "adapter": None, "install_available": False, "installing": False,
+ "download": {}, "dir": str(_h3_turbo_dir()), "missing": []}),
# User LoRAs — the CivitAI lane. A separate block from `turbo` for the
# same reason turbo is separate from `first_frame`: "you can't pick a
# LoRA" has three unrelated causes (H3 absent / runner predates --lora
@@ -19291,6 +19760,13 @@ def _analytics_render_event(job: dict) -> None:
"source": _analytics_source(p, job),
"audio_mode": _analytics_audio_mode(p, engine, mode),
}
+ # 4.19.11: which H3 sampler ran, so the fleet's timing lanes never
+ # infer it from `steps` (7 points is lightx2v v1.3, Turbo AND a Best
+ # pinned to 7). Closed vocabulary; H3 renders only.
+ if engine == "h3":
+ props["h3_sampler"] = ("fast" if p.get("h3_tristep") else
+ "turbo" if p.get("h3_turbo") else
+ "v13" if p.get("h3_v13") else "best")
# 4.17.5: did this render run in short GPU steps (the Metal watchdog
# path), and did a watchdog kill get re-run inside the same job?
if job.get("gpu_steps") == "short":
@@ -24792,6 +25268,13 @@ def _sb_h3_cost(quality_key: str, length_key: str):
except Exception:
turbo = False
minutes = cell.get("turbo_min") if turbo else cell.get("eta_min")
+ # Best on High renders lightx2v v1.3 once it is built (make_job).
+ if not turbo and cell.get("v13_min"):
+ try:
+ if h3_v13_status().get("available"):
+ minutes = cell["v13_min"]
+ except Exception:
+ pass
# A Draft/Standard/High cell renders Fast when it is installed
# (make_job's default), whatever Turbo says.
if cell.get("tristep_min") and cell.get("tristep_default"): # Fast by default
@@ -32443,6 +32926,11 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
else False if _h3_tristep_raw in ("0", "false", "off", "no")
else None)
_h3_tristep = False
+ # lightx2v v1.3 on Best at High: on by default wherever it can run (the
+ # resolution is below, after Fast); "0" from the API keeps the full
+ # sampler, as a Steps pin does.
+ _h3_v13_off = (f("h3_v13", "") or "").strip().lower() in ("0", "false", "off", "no")
+ _h3_v13 = False
# Which of the runner's ONE adapter slots this render spends. H3's
# `--lora` is a single path (`default=None`, not `action="append"` — see
# scripts/generate_staged.py), so a user LoRA and Turbo are mutually
@@ -32558,6 +33046,15 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
_h3_turbo = False
_h3_steps = 0
_h3_upscale = "ltx_x2"
+ # lightx2v v1.3: what Best renders on High (Text and Image) once its
+ # adapter is built. Never with Fast or Turbo, never under a Steps pin
+ # (the pin IS the way to ask for the full sampler), never where it
+ # was not validated (other canvases, the dense pass, media modes).
+ if (not _h3_v13_off and not _h3_tristep and not _h3_turbo and not _h3_steps
+ and mode_in in H3_V13_MODES and h3_available()
+ and h3_cell_takes_v13(H3_TIERS[_h3_tier])
+ and h3_v13_status()["available"]):
+ _h3_v13 = True
# Per-window prompts, matched to the cell that will ACTUALLY render.
# Normalising after the fallback above is the whole point: a 15 s
# request that degraded to 5 s has one window, and three prompts on a
@@ -32693,6 +33190,9 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# resolved above. SAME allowlist trap: leave it out and the switch
# silently renders Best.
"h3_tristep": _h3_tristep,
+ # lightx2v v1.3 on Best at High, resolved above. SAME allowlist
+ # trap: leave it out and Best silently renders the full sampler.
+ "h3_v13": _h3_v13,
# Which of H3's ONE adapter slots this render spends: "turbo"
# (default) or "user". SAME allowlist trap as every key in this
# dict — leave `h3_lora_slot` out and the Turbo-vs-LoRA control
@@ -32989,6 +33489,7 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# branches on WHY the count is what it is).
job["params"]["steps"] = int(
H3_TRISTEP_STEPS if _h3_tristep else
+ H3_V13_STEPS if _h3_v13 else
h3_turbo_steps() if _h3_turbo else (_h3_steps or _tier_cfg["steps"]))
job["params"]["h3_chain_windows"] = int(_tier_cfg.get("chain_windows") or 1)
job["params"]["h3_window_frames"] = int(
@@ -35992,6 +36493,46 @@ def run_h3_job_inner(job: dict) -> None:
+ f". Expected under {tristep_paths['dir']} — pick Best under "
f"Speed, or click Fast to install it (180 MB).")
steps = H3_TRISTEP_STEPS
+ # Both speed adapters store their qkv rows in the ComfyUI order; the runner
+ # gets the per-head copy (h3_speed_adapter_for_runner). User LoRAs never
+ # pass through here.
+ if turbo:
+ turbo_paths = h3_speed_adapter_for_runner(turbo_paths, push)
+ if tristep:
+ tristep_paths = h3_speed_adapter_for_runner(tristep_paths, push)
+
+ # ---- Best at High: lightx2v v1.3 (6 forwards, video shift 6) ----------
+ # make_job resolved it; re-check here (a queued job outlives the file, a
+ # hand-edited queue entry can carry anything) and never stack it.
+ v13 = bool(p.get("h3_v13"))
+ v13_paths: dict = {}
+ if v13 and (tristep or turbo or not h3_cell_takes_v13(tier)
+ or mode not in H3_V13_MODES):
+ v13 = False
+ p["h3_v13"] = False
+ if not (tristep or turbo):
+ steps = int(p.get("h3_steps") or tier["steps"])
+ push(f"[h3] {H3_V13_NAME} runs on Best at High (Text and Image) - "
+ f"this render keeps its own sampler.")
+ v13_shift = False
+ if v13:
+ if not h3_supports_v13():
+ raise RuntimeError(
+ f"{H3_V13_NAME} needs a runner that stacks adapters: "
+ + _h3_runner_behind(H3_LORA_STACK_MARKER, paths["runner"],
+ "Or pin a Steps count under Best."))
+ v13_shift = h3_supports_video_shift()
+ if not v13_shift:
+ push(f"[h3] {H3_V13_NAME} at video shift 12 - this runner has no "
+ f"--video-shift yet (shift {H3_V13_VIDEO_SHIFT} after an H3 runner update).")
+ v13_paths = h3_v13_paths()
+ if not v13_paths["files_ok"]:
+ raise RuntimeError(
+ f"The {H3_V13_NAME} adapter isn't on disk: "
+ + "; ".join(v13_paths["missing"])
+ + f". Expected under {v13_paths['dir']} - pin a Steps count "
+ f"under Best, or get it from the Speed row.")
+ steps = H3_V13_STEPS
# First-frame conditioning (Image mode). The flag landed on the runner
# after the first public branch, so probe the INSTALLED script rather than
@@ -36307,6 +36848,11 @@ def run_h3_job_inner(job: dict) -> None:
# delta on the same base layers (416 wrapped, 0 unaccounted measured
# with a character + a style LoRA on top).
cmd += h3_tristep_argv(tristep_paths)
+ if v13:
+ # Shift 6 + the adapter at 1.0 (alpha folded, qkv rows already in the
+ # DiT's order: no --lora-qkv-permute, so a user LoRA after it is
+ # applied exactly as trained).
+ cmd += h3_v13_argv(v13_paths, shift=v13_shift)
if user_lora is not None and (not turbo or h3_supports_lora_stack()):
# The SAME flag Turbo rides. On a stacking runner every `--lora` is one
# more adapter on the same base layers, Turbo first; on the single-slot
@@ -36431,8 +36977,11 @@ def run_h3_job_inner(job: dict) -> None:
# promised (Fast's tristep_min when this render is running Fast, else
# the cell's own eta_min), so the number on screen before the first
# denoise step matches the number the user picked the render on.
+ # 4.19.11 review: a lightx2v v1.3 render seeds from the cell's v13_min
+ # (the ~15 min the chip showed), not the full sampler's eta_min (~34).
_load_eta_seed_min = (
(tier.get("tristep_min") if tristep and tier.get("tristep_min") is not None
+ else tier.get("v13_min") if v13 and tier.get("v13_min") is not None
else tier.get("eta_min")) or 0.0)
_load_eta_seed = max(0.0, float(_load_eta_seed_min)) * 60.0
# H3-04: what one denoise forward SHOULD cost on this Mac, at this
@@ -36930,6 +37479,8 @@ def run_h3_job_inner(job: dict) -> None:
"h3_turbo": turbo,
# Same rule for the fast 3-step sampler (False = the shape's own).
"h3_tristep": tristep,
+ # And for lightx2v v1.3 on Best at High.
+ "h3_v13": v13,
"width": width, "height": height, "frames": frames, "steps": steps,
"seed_used": seed,
# The user's OWN reference, not the canvas crop made from it: the
@@ -36984,6 +37535,8 @@ def run_h3_job_inner(job: dict) -> None:
"first_frame_source": ((p.get("image") or "").strip() or None)
if first_frame else None,
"turbo": ({"lora": str(turbo_paths["lora"]),
+ "source": str(turbo_paths.get("lora_source") or ""),
+ "qkv_rows": turbo_paths.get("qkv_rows"),
"adapter_version": turbo_paths["version"],
"fallback": turbo_paths["fallback"],
"scale": 1.0,
@@ -36998,9 +37551,26 @@ def run_h3_job_inner(job: dict) -> None:
"accounting": (metrics.get("lora_accounting")
or metrics.get("w1_lora_accounting"))}
if turbo else None),
+ # lightx2v v1.3's provenance: the file, its source and licence,
+ # and the schedule that ran.
+ "v13": ({"lora": str(v13_paths["lora"]),
+ "name": H3_V13_NAME,
+ "repo": H3_V13_REPO,
+ "revision": H3_V13_SOURCE_REVISION,
+ "source_file": H3_V13_SOURCE_FILE,
+ "source_sha256": H3_V13_SOURCE_SHA256,
+ "sha256": H3_V13_SHA256,
+ "license": H3_V13_LICENSE,
+ "code_license": H3_V13_CODE_LICENSE,
+ "scale": 1.0, "steps": steps,
+ "forwards": H3_V13_FORWARDS,
+ "video_shift": float(H3_V13_VIDEO_SHIFT) if v13_shift else 12.0}
+ if v13 else None),
# The fast 3-step sampler's provenance: which file, where it came from,
# under what license, and the schedule the runner actually ran.
"tristep": ({"lora": str(tristep_paths["lora"]),
+ "source": str(tristep_paths.get("lora_source") or ""),
+ "qkv_rows": tristep_paths.get("qkv_rows"),
"adapter_version": tristep_paths["version"],
"repo": H3_TRISTEP_REPO,
"revision": H3_TRISTEP_REVISION,
@@ -42076,7 +42646,16 @@ class Handler(BaseHTTPRequestHandler):
else:
start = int(start_s) if start_s else 0
end = int(end_s) if end_s else size - 1
- if start < 0 or end >= size or start > end:
+ # RFC 7233 § 2.1: a last-byte-pos at or past the end means
+ # "to the end", it is not an error. WebKit's media loader
+ # (Safari, the Mac app's WKWebView) asks for whole chunks
+ # and for the length it remembers from an earlier response,
+ # so a clip that got shorter under the same URL, or a chunk
+ # that runs past the tail, used to get 416 here and the
+ # <video> stopped loading or seeking. Chrome happened not
+ # to ask that way. A START past the end is still 416.
+ end = min(end, size - 1)
+ if start < 0 or start >= size or start > end:
raise ValueError("range out of bounds")
except (ValueError, IndexError):
# Malformed range header → 416 per RFC 7233.
@@ -44804,6 +45383,16 @@ def _parse_progress_signals(log_lines: list[str]) -> dict:
"""
stage1_step = stage1_total = None # latest seen for stage 1
stage2_step = stage2_total = None # latest seen for stage 2
+ # Unsuffixed bars, newest first, one (step, total) per bar. The HQ lane
+ # labels stage 1 "(res2s guided)", so there an unsuffixed bar IS stage 2.
+ # The distilled lane labels NEITHER stage: its stage 1 (8 steps) and stage
+ # 2 (2 steps) are both a bare "Denoising:" bar. Reading every bare bar as
+ # stage 2 made a Balanced render at stage-1 step 4/8 say "step 12 / 16"
+ # (8 + 4 of 8 + 8) and then drop to "step 2 / 4" in stage 2 - the counter
+ # claimed 75% while the live preview was honestly still two estimates
+ # from its first meaningful frame (owner report, 2026-10-22).
+ bare_bars: list[tuple[int, int]] = []
+ _bare_prev: tuple[int, int] | None = None
image_step = image_total = None # latest seen for an mflux image job
download_seen = False # a first-run model download is in flight
download_files = download_total = None
@@ -44830,6 +45419,12 @@ def _parse_progress_signals(log_lines: list[str]) -> dict:
if pit:
last_per_it = float(pit.group(1))
else:
+ # Walking newest -> oldest, a bar's steps only go DOWN; a step
+ # that goes up, or a different total, is the bar before it.
+ if (_bare_prev is None or total != _bare_prev[1]
+ or step > _bare_prev[0]):
+ bare_bars.append((step, total))
+ _bare_prev = (step, total)
if stage2_step is None:
stage2_step, stage2_total = step, total
if last_per_it is None:
@@ -44869,6 +45464,17 @@ def _parse_progress_signals(log_lines: list[str]) -> dict:
if not pipe_loaded and "step:get_pipe done" in ln:
pipe_loaded = True
+ if stage1_step is None and bare_bars:
+ # No labelled stage 1 anywhere: the bare bars are the distilled lane's
+ # stages in order. One bar so far = stage 1 still running; two = the
+ # older one was stage 1, the newest is stage 2.
+ if len(bare_bars) == 1:
+ stage1_step, stage1_total = bare_bars[0]
+ stage2_step = stage2_total = None
+ else:
+ stage1_step, stage1_total = bare_bars[1][1], bare_bars[1][1]
+ stage2_step, stage2_total = bare_bars[0]
+
# Combine stage 1 + stage 2 into a single monotonic denoise counter.
# If we've seen stage 2 emit a step, stage 1 is implicitly complete
# (helper runs them in strict sequence) — so use stage1_total or
@@ -44985,6 +45591,20 @@ def _compute_progress(current: dict | None, log_lines: list[str]) -> dict | None
elapsed = max(0.0, time.time() - started)
eta = _bucket_eta(p)
signals = _parse_progress_signals(log_lines[-200:] if log_lines else [])
+ # Distilled lane, still in stage 1: the bar only knows its own 8 steps, so
+ # the counter would jump 8 -> 10 when stage 2 starts. The live preview's
+ # status.json carries the whole denoise (one forward per step on this
+ # lane), so count to that from the start.
+ if (signals["denoise_step"] is not None and signals["stage2_step"] is None
+ and (LTX_QUALITIES.get(p.get("quality") or "") or {}).get("pipeline") == "distilled"):
+ try:
+ _st = json.loads((live_preview_dir(live_preview_job_id(current))
+ / "status.json").read_text())
+ _tf = int(_st.get("total_forwards") or 0)
+ except (OSError, ValueError, TypeError):
+ _tf = 0
+ if _tf > (signals["denoise_total"] or 0):
+ signals["denoise_total"] = _tf
weights = _phase_weights(p)
download_frac = 0.0
diff --git a/panel/routes_image.py b/panel/routes_image.py
index f277f86..1a73fb1 100644
--- a/panel/routes_image.py
+++ b/panel/routes_image.py
@@ -448,6 +448,22 @@ def post_h3_tristep_install(h, path, qs, ctype) -> None:
h._json(result, 202)
+# ====== Hailuo H3 · lightx2v v1.3 (Best at High) — fetch LightX2V's original
+# file (pinned revision + sha256) and build the runner layout locally.
+@post("/h3/v13/install")
+def post_h3_v13_install(h, path, qs, ctype) -> None:
+ P.h3_status_invalidate()
+ # An H3 Model Derivative: the same licence screen as H3 itself.
+ _lic = P.licence_refusal_for("h3")
+ if _lic:
+ h._json(_lic, 451); return
+ result = P._h3_install_v13(P.push)
+ if not result.get("ok"):
+ h._json(result, 409 if "active" in result.get("error", "") else 400)
+ return
+ h._json(result, 202)
+
+
# Image-engine config (pluggable: mock | bfl).
@post("/agent/image/config")
def post_agent_image_config(h, path, qs, ctype) -> None:
diff --git a/scripts/fetch_h3_turbo.py b/scripts/fetch_h3_turbo.py
index c02f232..80e83ff 100644
--- a/scripts/fetch_h3_turbo.py
+++ b/scripts/fetch_h3_turbo.py
@@ -9,8 +9,11 @@ LightX2V Hugging Face repo, pinned to a commit and its SHA-256, and re-lays it
out locally into the layout the H3 runner's `--lora` loader reads:
* the split diffusers q/k/v adapters become ONE block-diagonal adapter whose
- output rows stay contiguous [q_all; k_all; v_all] (the loader interleaves
- them into the checkpoint's own order exactly once);
+ output rows stay contiguous [q_all; k_all; v_all]. The checkpoint stores
+ them per head, and the runner stopped interleaving them by default on
+ 2026-08-15, so the panel hands the runner a per-head copy
+ (`h3_bake_runner_layout` in mlx_ltx_panel.py); this file stays as built,
+ so its digest still matches ASSET_SHA256;
* diffusers' `ff.net.0.proj` rows are [value; gate]; the runner's fc1 wants
[gate; value], so the two halves of B swap;
* PEFT's alpha/rank scale is folded into B. For this file alpha == rank
diff --git a/scripts/fetch_h3_v13.py b/scripts/fetch_h3_v13.py
new file mode 100644
index 0000000..ff776b5
--- /dev/null
+++ b/scripts/fetch_h3_v13.py
@@ -0,0 +1,412 @@
+#!/usr/bin/env python3
+"""Build LightX2V's v1.3 H3 adapter ("High · lightx2v v1.3") on THIS Mac, from its source.
+
+Phosphene does not host this file. It is a MiniMax H3 "Model Derivative"
+(LightX2V's few-step distillation of H3, Apache-2.0 code, MiniMax H3 Community
+License on the weights), so - exactly like fetch_h3_turbo.py - the panel fetches
+the ORIGINAL file from the LightX2V Hugging Face repo, pinned to a commit and its
+SHA-256, and re-lays it out locally into the layout the H3 runner's `--lora`
+loader applies as-is (no runner flags):
+
+ * the split diffusers q/k/v adapters become ONE block-diagonal adapter, and
+ its B rows are written in the DiT's own fused-qkv order, per head
+ (heads, 3, head_dim) - the base checkpoint stores qkv_proj that way. The
+ upstream file is trained against the contiguous (3, heads, head_dim) split,
+ so this is the same row move the runner's `--lora-qkv-permute` makes;
+ doing it here keeps the flag off, so a user LoRA stacked on top is never
+ permuted with it;
+ * diffusers' `ff.net.0.proj` rows are [value; gate]; the runner's fc1 wants
+ [gate; value], so the two halves of B swap;
+ * PEFT's alpha/rank scale is folded into B. The source declares alpha 8 at
+ rank 128, a scale of 1/16 = 2^-4: every bf16 value's exponent drops by 4,
+ which is exact. The build refuses any value that would leave the normal
+ range rather than round it.
+
+All of it is byte moves on bf16 rows plus that exponent shift, standard library
+only. The result is checked against ASSET_SHA256 / ASSET_BYTES before it is
+renamed into place, so every Mac builds the same bytes - the bytes whose renders
+were validated (2026-10-22: identical, tensor for tensor, to the file the
+validation runs loaded with --lora-qkv-permute).
+
+Resumes a partial source download with an HTTP Range request, verifies the
+source digest before converting, writes `<name>.partial` and renames it only
+after both digests pass. The source is deleted after a good build (~1.4 GB).
+
+The pins below MUST match mlx_ltx_panel.py (H3_V13_*); test_h3_v13.py holds
+them together.
+"""
+from __future__ import annotations
+
+import argparse
+import fcntl
+import hashlib
+import json
+import os
+import re
+import struct
+import sys
+import urllib.request
+from pathlib import Path
+
+# ---- the upstream source (fetched, never re-hosted) -------------------------
+SOURCE_REPO = "lightx2v/Minimax-h3-Turbo"
+SOURCE_REVISION = "30f485ed874aa44c8183348ad361c5eabad318da"
+SOURCE_FILE = "minimax_h3_fl2v_turbo_4step_v1.3_768p_bf16.safetensors"
+SOURCE_URL = ("https://huggingface.co/" + SOURCE_REPO + "/resolve/"
+ + SOURCE_REVISION + "/" + SOURCE_FILE)
+SOURCE_SHA256 = "97b775707bb5732e01dba0cf3833d3fe2947c953859d4d05ea3bd74894c43d2b"
+SOURCE_BYTES = 1383677808
+
+# ---- the result, built locally ------------------------------------------------
+ASSET_NAME = "lightx2v_v1.3_768p_phosphene.safetensors"
+ASSET_SHA256 = "45ee324a31beacef7a2fbef019b99e16b35d80586dc4e0d60fecf6ca679751d8"
+ASSET_BYTES = 1956165376
+
+# The DiT's attention shape (H3 pruned FL2VA: 56 heads x 128).
+HEADS = 56
+HEAD_DIM = 128
+RANK = 128
+ALPHA = 8 # from the source's own metadata; checked, never assumed
+EXP_SHIFT = 4 # alpha / rank = 8 / 128 = 2^-4
+
+METADATA = {
+ "converted_from": SOURCE_FILE,
+ "source_repo": SOURCE_REPO,
+ "license": "MiniMax H3 Community License (H3 Model Derivative); LightX2V code Apache-2.0",
+ "fc1_layout": "[gate;value]",
+ "qkv_layout": "per-head (heads,3,head_dim), the DiT's own order; apply with no permute",
+ "lora_alpha": str(ALPHA),
+ "source_rank": str(RANK),
+ "peft_scale_folded_into_B": "0.0625",
+ "qkv_fused_rank": str(3 * RANK),
+}
+
+_SRC_A = ".lora_A.default.weight"
+_SRC_B = ".lora_B.default.weight"
+_BF16 = 2
+
+
+def _plain(text) -> str:
+ """An exception's text with Pinokio's two stop words defused (optional step)."""
+ return re.sub(r"(?i)errno ", "errno-", re.sub(r"(?i)error:", "problem -", str(text)))
+
+
+def file_sha256(path: Path) -> str:
+ h = hashlib.sha256()
+ with open(path, "rb") as fh:
+ for chunk in iter(lambda: fh.read(1 << 20), b""):
+ h.update(chunk)
+ return h.hexdigest()
+
+
+def _prefixes() -> list[tuple[str, str]]:
+ return ([(f"transformer_blocks.{i}", f"blocks.{i}") for i in range(50)]
+ + [(f"token_refiner.refiner_blocks.{i}", f"token_refiner.blocks.{i}")
+ for i in range(2)])
+
+
+class Source:
+ """Random access to the bf16 matrices of a safetensors file."""
+
+ def __init__(self, fh):
+ self.fh = fh
+ fh.seek(0)
+ (n,) = struct.unpack("<Q", fh.read(8))
+ header = json.loads(fh.read(n))
+ self.meta = header.pop("__metadata__", {}) or {}
+ self.base = 8 + n
+ self.tensors = header
+
+ def shape(self, key: str) -> list[int]:
+ return list(self.tensors[key]["shape"])
+
+ def read(self, key: str) -> bytes:
+ t = self.tensors[key]
+ if t["dtype"] != "BF16" or len(t["shape"]) != 2:
+ raise ValueError(f"{key}: expected a 2-D BF16 matrix, got {t['dtype']} {t['shape']}")
+ a, b = t["data_offsets"]
+ self.fh.seek(self.base + a)
+ data = self.fh.read(b - a)
+ if len(data) != b - a:
+ raise ValueError(f"{key}: source is truncated")
+ return data
+
+
+# bf16 is little-endian: the HIGH byte (sign + 7 exponent bits) is every second
+# byte. Exponent - 4 is (high & 0x7f) - 2 with the sign kept; it is exact while
+# the result stays normal. Values whose high byte is 0x00/0x80/0x01/0x81/0x02/
+# 0x82 are checked one by one: only exact zeros (left alone) are accepted.
+_SHIFT = bytes(h if (h & 0x7F) < 2 else (h & 0x80) | ((h & 0x7F) - 2) for h in range(256))
+_RISKY = bytes(1 if (h & 0x7F) <= 2 or (h & 0x7F) == 0x7F else 0 for h in range(256))
+
+
+def scale_b(data: bytes, key: str) -> bytes:
+ """Multiply every bf16 value by 2^-EXP_SHIFT exactly (EXP_SHIFT == 4)."""
+ buf = bytearray(data)
+ hi = bytes(buf[1::2])
+ flags = hi.translate(_RISKY)
+ i = flags.find(1)
+ while i != -1:
+ h, lo = hi[i], buf[2 * i]
+ e = ((h & 0x7F) << 1) | (lo >> 7)
+ if e == 0xFF:
+ raise ValueError(f"{key}: inf/NaN in the source")
+ if not (e == 0 and (lo & 0x7F) == 0) and e - EXP_SHIFT < 1:
+ raise ValueError(f"{key}: a value would leave bf16's normal range "
+ "under the 1/16 fold; refusing to round it")
+ i = flags.find(1, i + 1)
+ buf[1::2] = hi.translate(_SHIFT)
+ return bytes(buf)
+
+
+def _rows(data: bytes, cols: int) -> list[bytes]:
+ w = cols * _BF16
+ return [data[i:i + w] for i in range(0, len(data), w)]
+
+
+def plan_tensors(src: Source) -> dict:
+ """{output key: (shape, make_bytes)}; one tensor (<= ~16 MB) in memory at a time."""
+ if str(src.meta.get("alpha", "")) != str(ALPHA):
+ raise ValueError(f"source alpha is {src.meta.get('alpha')!r}, expected '{ALPHA}'")
+ plan: dict = {}
+ used: set = set()
+
+ def pair(prefix: str) -> tuple[list[int], list[int]]:
+ sa, sb = src.shape(prefix + _SRC_A), src.shape(prefix + _SRC_B)
+ if sa[0] != RANK or sb[1] != RANK:
+ raise ValueError(f"{prefix}: expected rank {RANK}, got A{sa} B{sb}")
+ used.update((prefix + _SRC_A, prefix + _SRC_B))
+ return sa, sb
+
+ for s, d in _prefixes():
+ qkv = [f"{s}.attn.{p}" for p in ("to_q", "to_k", "to_v")]
+ shapes = [pair(p) for p in qkv]
+ if len({(tuple(a), tuple(b)) for a, b in shapes}) != 1:
+ raise ValueError(f"{s}.attn: q/k/v shapes disagree: {shapes}")
+ (_rank, in_cols), (out_rows, _r) = shapes[0]
+ if out_rows != HEADS * HEAD_DIM:
+ raise ValueError(f"{s}.attn: q rows {out_rows} != {HEADS} heads x {HEAD_DIM}")
+
+ def qkv_a(qkv=qkv):
+ return b"".join(src.read(p + _SRC_A) for p in qkv)
+
+ def qkv_b(qkv=qkv):
+ # Rows in the DiT's order: head h -> its q rows, k rows, v rows;
+ # each row padded to the block-diagonal width 3 * RANK.
+ zero = bytes(RANK * _BF16)
+ parts = [_rows(scale_b(src.read(p + _SRC_B), p + _SRC_B), RANK) for p in qkv]
+ out = []
+ for h in range(HEADS):
+ for j in range(3):
+ left, right = zero * j, zero * (2 - j)
+ out.extend(left + r + right
+ for r in parts[j][h * HEAD_DIM:(h + 1) * HEAD_DIM])
+ return b"".join(out)
+
+ plan[f"{d}.attn.qkv_proj.lora_A.weight"] = ([3 * RANK, in_cols], qkv_a)
+ plan[f"{d}.attn.qkv_proj.lora_B.weight"] = ([3 * out_rows, 3 * RANK], qkv_b)
+
+ for sp, dp in (("attn.to_out.0", "attn.out_proj"),
+ ("ff.net.0.proj", "mlp.fc1"),
+ ("ff.net.2", "mlp.fc2")):
+ p = f"{s}.{sp}"
+ sa, sb = pair(p)
+ if dp == "mlp.fc1" and sb[0] % 2:
+ raise ValueError(f"{p}: SwiGLU B has an odd row count {sb}")
+
+ def a_bytes(p=p):
+ return src.read(p + _SRC_A)
+
+ def b_bytes(p=p, swap=(dp == "mlp.fc1")):
+ b = scale_b(src.read(p + _SRC_B), p + _SRC_B)
+ if not swap:
+ return b
+ half = len(b) // 2
+ return b[half:] + b[:half]
+
+ plan[f"{d}.{dp}.lora_A.weight"] = (sa, a_bytes)
+ plan[f"{d}.{dp}.lora_B.weight"] = (sb, b_bytes)
+ unused = sorted(set(src.tensors) - used)
+ if unused:
+ raise ValueError(f"source has {len(unused)} tensors this layout does not use, e.g. {unused[:3]}")
+ return plan
+
+
+def convert(src_fh, write) -> None:
+ """Re-lay the source out, calling write(bytes) in order. Tensors are stored
+ in sorted-name order so the bytes never depend on a hash-map order."""
+ plan = plan_tensors(Source(src_fh))
+ keys = sorted(plan)
+ header: dict = {"__metadata__": METADATA}
+ off = 0
+ for k in keys:
+ shape = plan[k][0]
+ n = shape[0] * shape[1] * _BF16
+ header[k] = {"data_offsets": [off, off + n], "dtype": "BF16", "shape": shape}
+ off += n
+ blob = json.dumps(header, separators=(",", ":"), sort_keys=True).encode()
+ blob += b" " * (-len(blob) % 8) # 8-byte aligned tensor data
+ write(struct.pack("<Q", len(blob)))
+ write(blob)
+ for k in keys:
+ shape, make = plan[k]
+ data = make()
+ if len(data) != shape[0] * shape[1] * _BF16:
+ raise ValueError(f"internal: {k} has {len(data)} bytes for shape {shape}")
+ write(data)
+
+
+def download_source(dest: Path) -> int:
+ """Fetch the pinned upstream file to `dest` (resuming); 0 when verified."""
+ have = dest.stat().st_size if dest.is_file() else 0
+ if have > SOURCE_BYTES:
+ dest.unlink()
+ have = 0
+ if have < SOURCE_BYTES:
+ headers = {"User-Agent": "Phosphene"}
+ token = (os.environ.get("HF_TOKEN") or "").strip()
+ if token:
+ headers["Authorization"] = f"Bearer {token}"
+ if have:
+ headers["Range"] = f"bytes={have}-"
+ print(f"resuming the download at {have // (1 << 20)} MB", flush=True)
+ else:
+ print(f"downloading {SOURCE_FILE} from {SOURCE_REPO} "
+ f"(~{SOURCE_BYTES // (1 << 20)} MB)", flush=True)
+ req = urllib.request.Request(SOURCE_URL, headers=headers)
+ written = have
+ try:
+ with urllib.request.urlopen(req, timeout=60) as resp, \
+ open(dest, "ab" if have else "wb") as fh:
+ if have and resp.status != 206:
+ fh.seek(0)
+ fh.truncate()
+ written = 0
+ step = 64 << 20
+ mark = written + step
+ while True:
+ chunk = resp.read(1 << 20)
+ if not chunk:
+ break
+ fh.write(chunk)
+ written += len(chunk)
+ if written >= mark:
+ print(f"PROGRESS {written} {SOURCE_BYTES}", flush=True)
+ mark += step
+ except Exception as exc: # noqa: BLE001
+ print(f"V13 FETCH FAILED at {written // (1 << 20)} MB: {_plain(exc)} "
+ "(partial kept for resume; the panel offers a retry)", file=sys.stderr)
+ return 1
+ if written != SOURCE_BYTES:
+ print(f"V13 FETCH INCOMPLETE: {written} of {SOURCE_BYTES} bytes "
+ "(partial kept for resume)", file=sys.stderr)
+ return 1
+ if file_sha256(dest) != SOURCE_SHA256:
+ dest.unlink()
+ print("V13 SOURCE DIGEST MISMATCH - download discarded; the panel offers a retry",
+ file=sys.stderr)
+ return 1
+ return 0
+
+
+def build(source: Path, target: Path) -> int:
+ partial = target.with_suffix(target.suffix + ".partial")
+ print(f"building {ASSET_NAME} on this Mac (re-layout + exact 1/16 fold)", flush=True)
+ h = hashlib.sha256()
+ try:
+ with open(source, "rb") as src_fh, open(partial, "wb") as out:
+ def write(b: bytes) -> None:
+ out.write(b)
+ h.update(b)
+ convert(src_fh, write)
+ except Exception as exc: # noqa: BLE001
+ try:
+ partial.unlink(missing_ok=True)
+ except OSError:
+ pass
+ print(f"V13 BUILD FAILED: {_plain(exc)} (the panel offers a retry)", file=sys.stderr)
+ return 1
+ size = partial.stat().st_size
+ if size != ASSET_BYTES or h.hexdigest() != ASSET_SHA256:
+ partial.unlink(missing_ok=True)
+ print(f"V13 BUILD MISMATCH: {size} bytes, sha256 {h.hexdigest()[:12]} "
+ f"(want {ASSET_BYTES}, {ASSET_SHA256[:12]}) - nothing installed", file=sys.stderr)
+ return 1
+ partial.replace(target)
+ return 0
+
+
+def licence_accepted(state_dir: Path) -> bool:
+ """Whether the MiniMax H3 licence is accepted in Phosphene (the marker
+ scripts/pinokio/h3_licence_gate.sh and the panel both read)."""
+ gate = Path(__file__).resolve().parent / "pinokio" / "h3_licence_gate.sh"
+ m = re.search(r'^H3_LICENCE_VERSION="([^"]+)"', gate.read_text(), re.M) if gate.is_file() else None
+ if not m:
+ return any(state_dir.glob("licence-h3-*.accepted"))
+ return (state_dir / f"licence-h3-{m.group(1)}.accepted").is_file()
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
+ ap.add_argument("--dir", required=True, help="target directory (the H3 pack's turbo-lora/)")
+ ap.add_argument("--source", default=None,
+ help="use this already-downloaded upstream file instead of fetching it")
+ ap.add_argument("--licence-state", default=None,
+ help="Phosphene's state dir: skip (exit 0) unless the H3 licence is accepted there")
+ args = ap.parse_args()
+
+ if args.licence_state and not licence_accepted(Path(args.licence_state)):
+ print("lightx2v v1.3 skipped: accept the MiniMax H3 licence in Phosphene first; "
+ "the Speed row offers it afterwards.")
+ return 0
+ target_dir = Path(args.dir)
+ target_dir.mkdir(parents=True, exist_ok=True)
+ # One build at a time per folder, across processes (Pinokio's installer
+ # and a panel's button can both start one; two panels can share weights).
+ lock_fh = open(target_dir / ".lightx2v_v1.3.lock", "w")
+ try:
+ fcntl.flock(lock_fh, fcntl.LOCK_EX | fcntl.LOCK_NB)
+ except OSError:
+ print("V13 FETCH BUSY: another lightx2v v1.3 download is running for this folder",
+ file=sys.stderr)
+ return 1
+ target = target_dir / ASSET_NAME
+ if target.is_file():
+ if target.stat().st_size == ASSET_BYTES:
+ print(f"lightx2v v1.3 adapter already present: {target}")
+ return 0
+ print(f"REFUSING: {target} exists with unexpected size {target.stat().st_size} "
+ f"(want {ASSET_BYTES}). Move it aside and re-run.", file=sys.stderr)
+ return 1
+
+ if args.source:
+ source = Path(args.source)
+ if not source.is_file() or file_sha256(source) != SOURCE_SHA256:
+ print(f"REFUSING: {source} is not the pinned upstream {SOURCE_FILE}", file=sys.stderr)
+ return 1
+ own_source = False
+ else:
+ source = target_dir / (SOURCE_FILE + ".download")
+ rc = download_source(source)
+ if rc:
+ return rc
+ own_source = True
+
+ rc = build(source, target)
+ if rc:
+ return rc
+ if own_source:
+ source.unlink(missing_ok=True)
+ print(f"lightx2v v1.3 adapter ready: {target}")
+ return 0
+
+
+if __name__ == "__main__":
+ try:
+ sys.exit(main())
+ except SystemExit:
+ raise
+ except BaseException as exc: # noqa: BLE001
+ print(f"V13 FETCH FAILED: {_plain(type(exc).__name__)} {_plain(exc)} "
+ "(the panel offers a retry)", file=sys.stderr)
+ sys.exit(1)
diff --git a/scripts/fleet_timings_build.py b/scripts/fleet_timings_build.py
index e240de1..c05cc79 100644
--- a/scripts/fleet_timings_build.py
+++ b/scripts/fleet_timings_build.py
@@ -118,9 +118,19 @@ def _sql_literal(s: str) -> str:
return "'" + s.replace("'", "''") + "'"
+# lightx2v v1.3 on Best at High is its own lane, so its ~15 min renders never
+# pull the full sampler's Best range down. 4.19.11 renders say which sampler
+# ran (`h3_sampler`); `steps` cannot (7 points is v1.3, Turbo AND a Best
+# pinned to 7), so an event without it - every version before 4.19.11, none of
+# which ran v1.3 - falls back to the old rule: <= 5 points Fast, else Best.
+# Turbo gets a lane of its own that no price reads.
_SPEED_EXPR = (
- "multiIf(properties.engine = 'h3' AND toFloat64OrNull(toString(properties.steps)) <= 5, "
- "'fast', properties.engine = 'h3', 'best', '')"
+ "multiIf(properties.engine != 'h3', '', "
+ "properties.h3_sampler = 'v13', 'v13', "
+ "properties.h3_sampler = 'fast', 'fast', "
+ "properties.h3_sampler = 'turbo', 'turbo', "
+ "properties.h3_sampler = 'best', 'best', "
+ "toFloat64OrNull(toString(properties.steps)) <= 5, 'fast', 'best')"
)
_MODE_LIST = "(" + ",".join(_sql_literal(m) for m in PRICED_MODES) + ")"
diff --git a/scripts/measure_health_chip.py b/scripts/measure_health_chip.py
new file mode 100644
index 0000000..3ddf51e
--- /dev/null
+++ b/scripts/measure_health_chip.py
@@ -0,0 +1,336 @@
+#!/usr/bin/env python3.11
+"""A REAL browser gate: the header's health chip (the memory readout) is on
+screen after boot, in both distributions, at every width it was designed for.
+
+WHY THIS EXISTS (4.19.11). From v4.17.0 to v4.19.10 the chip was gone from
+every install, Pinokio and the Mac app alike. `#healthCluster` carried a
+stray `hidden` attribute, left over from the duplicate v4.5.0 build
+(989aaf1f kept this markup but not that build's intent) and cleared by no
+code at all. It only ever showed because `body > header #healthCluster
+{ display: flex }` outranked the UA's `[hidden] { display: none }`. The
+global `[hidden] { display: none !important }` rule (VC-07, 048464f) made
+`hidden` win, as it should, and the chip vanished. Every static test still
+passed: the markup, the CSS and `updateHealthChip()` were all intact, and
+`#memPill` was still updated on every poll. Only a browser could tell that
+nobody could see it.
+
+What it asserts, per distribution (`PHOSPHENE_DISTRIBUTION` unset = Pinokio,
+`mac-app` = the Mac app) and per width (1300 = Pinokio's window, 1440 = a
+14-inch laptop, 1500, 1920):
+ * `#healthCluster` and `#healthChip` do not compute `display: none`, have a
+ real box, and sit inside the header and the viewport;
+ * the chip is not clipped by the cluster's own `overflow: hidden` and is
+ the element actually hit at its centre (nothing covers it);
+ * the face shows the memory reading once /status has answered: the full
+ "used/total GB · N%" text above 1400 px, the percentage below it, and
+ it is PAINTED (a real width; not ellipsized from 1440 px up);
+ * one click opens the popover, and its Memory row is visible.
+
+`--url` measures a panel that is already running instead of booting one
+(read-only: it only loads the page and clicks the chip). `--shots DIR`
+saves a PNG of the header at each width.
+
+Exit codes: 0 pass, 1 a measurement FAILED, 3 no browser (unittest skips),
+4 the harness could not get far enough to measure.
+
+ ./ltx-2-mlx/env/bin/python3.11 scripts/measure_health_chip.py -v
+"""
+
+from __future__ import annotations
+
+import argparse
+import base64
+import importlib.util
+import json
+import os
+import shutil
+import sys
+import tempfile
+import time
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+
+FORBIDDEN_PORTS = {8199}
+WIDTHS = (1300, 1440, 1500, 1920)
+NARROW = 1400 # panel.css: below this the face shows data-short
+DISTRIBUTIONS = ("pinokio", "mac-app")
+
+
+def _load_editor_gate():
+ p = ROOT / "scripts" / "measure_editor_layout.py"
+ spec = importlib.util.spec_from_file_location("_phos_editor_gate", p)
+ if spec is None or spec.loader is None:
+ raise RuntimeError(f"cannot load {p}")
+ mod = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(mod)
+ return mod
+
+
+G = _load_editor_gate()
+HarnessError = G.HarnessError
+NoBrowser = G.NoBrowser
+
+JS_READY = """
+(() => {
+ if (typeof updateHealthChip !== 'function') return 'app not booted';
+ const f = document.getElementById('hcFace');
+ if (!f) return 'no #hcFace';
+ const t = (f.textContent || '').trim();
+ return (t && t !== 'checking…') ? 'ok' : 'face still ' + JSON.stringify(t);
+})()
+"""
+
+JS_MEASURE = r"""
+(() => {
+ const box = el => { if (!el) return null; const r = el.getBoundingClientRect();
+ return {x: r.left, y: r.top, r: r.right, b: r.bottom, w: r.width, h: r.height}; };
+ const header = document.querySelector('body > header');
+ const cl = document.getElementById('healthCluster');
+ const chip = document.getElementById('healthChip');
+ const face = document.getElementById('hcFace');
+ const mem = document.getElementById('memPill');
+ const cb = box(chip);
+ let hit = null;
+ if (cb && cb.w > 0 && cb.h > 0) {
+ const el = document.elementFromPoint(cb.x + cb.w / 2, cb.y + cb.h / 2);
+ hit = el ? (chip.contains(el) ? 'chip' : (el.id || el.tagName)) : 'nothing';
+ }
+ let shown = '';
+ if (face) {
+ const after = getComputedStyle(face, '::after').content;
+ shown = (after && after !== 'none' && after !== 'normal')
+ ? after.replace(/^"|"$/g, '') : (face.textContent || '').trim();
+ }
+ return {
+ vw: innerWidth,
+ clusterHiddenAttr: cl ? cl.hasAttribute('hidden') : null,
+ clusterDisplay: cl ? getComputedStyle(cl).display : null,
+ chipDisplay: chip ? getComputedStyle(chip).display : null,
+ chipVisibility: chip ? getComputedStyle(chip).visibility : null,
+ header: box(header), cluster: box(cl), chip: cb, hit,
+ faceText: face ? (face.textContent || '').trim() : null,
+ faceShort: face ? (face.dataset.short || '') : null,
+ shown,
+ // What is PAINTED, not what the text says: a face squeezed to 0 px
+ // still has its text (that was the narrow-width bug).
+ faceBox: box(face),
+ faceClipped: face ? face.scrollWidth > face.clientWidth + 1 : null,
+ memText: mem ? (mem.textContent || '').trim() : null,
+ };
+})()
+"""
+
+JS_OPEN_POP = r"""
+(() => {
+ const chip = document.getElementById('healthChip');
+ if (!chip) return {error: 'no chip'};
+ chip.click();
+ const pop = document.getElementById('healthPop');
+ const row = pop && pop.querySelector('.hc-row[data-pill="memPill"]');
+ const mem = document.getElementById('memPill');
+ const r = row ? row.getBoundingClientRect() : null;
+ const out = {
+ popOpen: !!(pop && !pop.hidden && getComputedStyle(pop).display !== 'none'),
+ expanded: chip.getAttribute('aria-expanded'),
+ memRowVisible: !!(r && r.width > 0 && r.height > 0),
+ memInRow: !!(row && mem && row.contains(mem)),
+ memText: mem ? (mem.textContent || '').trim() : null,
+ };
+ if (typeof closeHealthPop === 'function') closeHealthPop();
+ return out;
+})()
+"""
+
+
+def check(dist: str, width: int, m: dict) -> list[str]:
+ tag = f"{dist}@{width}"
+ out: list[str] = []
+ if m.get("clusterHiddenAttr"):
+ out.append(f"{tag}: #healthCluster still carries the `hidden` attribute")
+ if m.get("clusterDisplay") in (None, "none"):
+ out.append(f"{tag}: #healthCluster computes display:{m.get('clusterDisplay')}")
+ if m.get("chipDisplay") in (None, "none") or m.get("chipVisibility") == "hidden":
+ out.append(f"{tag}: #healthChip computes display:{m.get('chipDisplay')} "
+ f"visibility:{m.get('chipVisibility')}")
+ return out
+ hb, cl, ch = m.get("header"), m.get("cluster"), m.get("chip")
+ if not ch or ch["w"] < 24 or ch["h"] < 12:
+ out.append(f"{tag}: the chip has no real box: {ch}")
+ return out
+ if ch["x"] < 0 or ch["r"] > m["vw"] + 0.5:
+ out.append(f"{tag}: the chip runs off the viewport: {ch}")
+ if hb and (ch["y"] < hb["y"] - 0.5 or ch["b"] > hb["b"] + 0.5):
+ out.append(f"{tag}: the chip is outside the header: chip {ch} header {hb}")
+ # #healthCluster is overflow:hidden - a chip wider than it is sliced.
+ if cl and (ch["x"] < cl["x"] - 0.5 or ch["r"] > cl["r"] + 0.5):
+ out.append(f"{tag}: the cluster clips the chip: chip {ch} cluster {cl}")
+ if m.get("hit") != "chip":
+ out.append(f"{tag}: something covers the chip's centre: {m.get('hit')}")
+ fb = m.get("faceBox") or {}
+ if (fb.get("w") or 0) < 14:
+ out.append(f"{tag}: the face paints {fb.get('w')} px wide - the reading "
+ f"is there but nobody can see it")
+ # 1440 is the 14-inch laptop the CSS was tuned for: the whole reading fits.
+ if width >= 1440 and m.get("faceClipped"):
+ out.append(f"{tag}: the face is ellipsized at {width} px")
+ shown = m.get("shown") or ""
+ if width < NARROW:
+ if not shown.endswith("%"):
+ out.append(f"{tag}: narrow face should be the percentage, shows {shown!r}")
+ else:
+ if "GB" not in shown or "%" not in shown:
+ out.append(f"{tag}: the face should carry the memory reading, shows {shown!r}")
+ return out
+
+
+def _wait_ready(cdp) -> None:
+ deadline = time.monotonic() + 45.0
+ while cdp.evaluate("document.readyState") != "complete":
+ if time.monotonic() > deadline:
+ raise HarnessError("the panel page never finished loading")
+ time.sleep(0.2)
+ deadline = time.monotonic() + 40.0
+ why = "never checked"
+ while time.monotonic() < deadline:
+ why = cdp.evaluate(JS_READY)
+ if why == "ok":
+ return
+ time.sleep(0.3)
+ # Not a harness error: a chip that never fills IS the bug.
+ raise HarnessError(f"the health chip never filled in: {why}")
+
+
+def _shot(cdp, path: Path, width: int, header: dict | None) -> None:
+ h = int((header or {}).get("b") or 64) + 6
+ r = cdp.call("Page.captureScreenshot",
+ {"format": "png", "captureBeyondViewport": False,
+ "clip": {"x": 0, "y": 0, "width": width, "height": h,
+ "scale": 1}})
+ path.write_bytes(base64.b64decode(r["data"]))
+
+
+def measure_base(cdp, base: str, dist: str, shots: Path | None,
+ verbose: bool) -> tuple[list[str], list[dict]]:
+ failures: list[str] = []
+ rows: list[dict] = []
+ for width in WIDTHS:
+ cdp.call("Emulation.setDeviceMetricsOverride",
+ {"width": width, "height": 900, "deviceScaleFactor": 1,
+ "mobile": False})
+ cdp.call("Page.navigate", {"url": base + "/"})
+ try:
+ _wait_ready(cdp)
+ except HarnessError as exc:
+ if "never filled" not in str(exc):
+ raise
+ failures.append(f"{dist}@{width}: {exc}")
+ # The TEST PANEL badge (mlx_ltx_panel.py page(): any panel whose state
+ # dir is not the install's own) is ~90 px that no user ever sees, and
+ # the cluster is the header's one shrinkable region, so leaving it in
+ # would measure a header nobody has. Only the throwaway panel this
+ # gate boots carries it; a --url run against a real install has none.
+ cdp.evaluate("document.querySelectorAll('body > header .test-badge')"
+ ".forEach(e => e.remove())")
+ time.sleep(0.4) # one layout after the face text
+ m = cdp.evaluate(JS_MEASURE, timeout=15.0)
+ if not isinstance(m, dict):
+ failures.append(f"{dist}@{width}: the page returned {m!r}")
+ continue
+ f = check(dist, width, m)
+ if not f:
+ p = cdp.evaluate(JS_OPEN_POP, timeout=15.0) or {}
+ if not (p.get("popOpen") and p.get("memRowVisible") and p.get("memInRow")):
+ f.append(f"{dist}@{width}: clicking the chip did not show the "
+ f"Memory row: {p}")
+ failures += f
+ rows.append({"dist": dist, "width": width, "shown": m.get("shown"),
+ "chip": m.get("chip"), "ok": not f})
+ if verbose:
+ print(f"{dist}@{width}: shows {m.get('shown')!r} "
+ f"chip={m.get('chip')} {'OK' if not f else 'FAIL'}",
+ file=sys.stderr)
+ if shots is not None:
+ _shot(cdp, shots / f"chrome_{dist}_{width}.png", width, m.get("header"))
+ return failures, rows
+
+
+def run(verbose: bool, url: str | None, label: str | None,
+ shots: Path | None) -> tuple[dict, int]:
+ binary = G.find_browser()
+ work = Path(tempfile.mkdtemp(prefix="phos-healthchip-gate-"))
+ failures: list[str] = []
+ rows: list[dict] = []
+ targets = [(label or "url", url)] if url else list(DISTRIBUTIONS)
+ try:
+ for target in targets:
+ dist, fixed = (target if isinstance(target, tuple) else (target, None))
+ panel = chrome = ws = None
+ old = os.environ.get("PHOSPHENE_DISTRIBUTION")
+ sub = work / dist
+ (sub / "chrome").mkdir(parents=True)
+ try:
+ if fixed:
+ base = fixed.rstrip("/")
+ else:
+ if dist == "mac-app":
+ os.environ["PHOSPHENE_DISTRIBUTION"] = "mac-app"
+ else:
+ os.environ.pop("PHOSPHENE_DISTRIBUTION", None)
+ panel, base = G.start_panel(sub, sub / "panel.log", verbose)
+ if base.rsplit(":", 1)[-1] in {str(p) for p in FORBIDDEN_PORTS}:
+ raise HarnessError("refusing to measure on a forbidden port")
+ chrome, devtools = G.start_chrome(binary, sub / "chrome", verbose)
+ ws = G.WebSocket(G.page_socket(devtools))
+ cdp = G.CDP(ws)
+ cdp.call("Page.enable")
+ cdp.call("Runtime.enable")
+ f, r = measure_base(cdp, base, dist, shots, verbose)
+ if not fixed:
+ served = cdp.evaluate(
+ "(typeof BOOT === 'object' && BOOT) ? BOOT.distribution : null")
+ if served != dist:
+ f.append(f"{dist}: the panel booted as {served!r}, "
+ f"not {dist!r}")
+ failures += f
+ rows += r
+ finally:
+ if old is None:
+ os.environ.pop("PHOSPHENE_DISTRIBUTION", None)
+ else:
+ os.environ["PHOSPHENE_DISTRIBUTION"] = old
+ if ws is not None:
+ ws.close()
+ G.kill(chrome)
+ G.kill(panel)
+ return ({"ok": not failures, "failures": failures, "rows": rows},
+ 1 if failures else 0)
+ finally:
+ shutil.rmtree(work, ignore_errors=True)
+
+
+def main(argv: list[str]) -> int:
+ ap = argparse.ArgumentParser(description=__doc__ and __doc__.splitlines()[0])
+ ap.add_argument("-v", "--verbose", action="store_true")
+ ap.add_argument("--url", help="measure this running panel instead of booting one")
+ ap.add_argument("--label", help="name for --url in the report and shot names")
+ ap.add_argument("--shots", help="save a header PNG per width into this dir")
+ args = ap.parse_args(argv)
+ shots = Path(args.shots) if args.shots else None
+ if shots is not None:
+ shots.mkdir(parents=True, exist_ok=True)
+ try:
+ doc, code = run(args.verbose, args.url, args.label, shots)
+ except NoBrowser as exc:
+ print(f"no browser: {exc}", file=sys.stderr)
+ return 3
+ except HarnessError as exc:
+ print(json.dumps({"ok": False, "failures": [f"harness: {exc}"]}))
+ print(f"harness: {exc}", file=sys.stderr)
+ return 4
+ print(json.dumps(doc, indent=2))
+ return code
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1:]))
diff --git a/webapp/docs/hailuo-h3.md b/webapp/docs/hailuo-h3.md
index 32ce133..49ce428 100644
--- a/webapp/docs/hailuo-h3.md
+++ b/webapp/docs/hailuo-h3.md
@@ -98,6 +98,15 @@ Use the **Speed** switch above the quality options.
Fast runs on Draft, Fast HD, Standard and High. Native and 10s single pass always render on Best.
+### Best on High: lightx2v v1.3 {#v13}
+
+On **High**, **Best** can use **lightx2v v1.3**, an adapter by LightX2V. In our test on an M4 Max with 64 GB of memory, a 5-second High clip took about 15 minutes, down from 33: 55% less time. In our side-by-side tests, it looks richer and more detailed.
+
+- **Get it:** click **Get it · 1.4 GB** under Speed. Phosphene downloads LightX2V's original file directly from Hugging Face, verifies it and prepares it on your Mac. You'll need about 5 GB free during setup, 2 GB when done. New H3 installs get it automatically.
+- **When it runs:** Best on High, in Text and Image modes, at any length. Draft, Standard, Native and Fast are unchanged.
+- **Use the old Best:** choose a **Steps** count under Best to use the full sampler.
+- **Credit and licence:** lightx2v v1.3 is by [LightX2V](https://huggingface.co/lightx2v/Minimax-h3-Turbo). Code: Apache-2.0. Weights: MiniMax H3 Community License, the same as H3.
+
## How long it takes {#times}
Each quality and length option shows an estimated time for your Mac, based on completed videos from similar Macs. The table shows median times from Phosphene's anonymous usage counts: half finished sooner and half took longer. A dash means there are too few completed videos to give a time.
diff --git a/webapp/index.html b/webapp/index.html
index 341002a..eab82fb 100644
--- a/webapp/index.html
+++ b/webapp/index.html
@@ -147,7 +147,28 @@
</div>
<header>
- <a href="/" class="brand"><img src="/assets/phosphene_cycle_word_transparent.png" alt="Phosphene"></a>
+ <!-- THE MARK TURNS, SLOWLY (phosphene.video's header + footer mark). Six
+ rings of radial dashes, each its OWN <svg> so each ring is an HTML box
+ the browser can hand to the compositor: the spin and the breathe are
+ transform-only CSS animations on those boxes (panel.css, .ph-mark), so
+ a frame of the animation is a GPU re-composite of six textures, never a
+ repaint, a style recalc or main-thread work while a render runs. Drawn
+ inline (not an <img>) on purpose: one SVG with animated children would
+ be repainted on every frame. Geometry = the site's Footer.astro rings;
+ the wordmark is the old banner PNG's right-hand part. -->
+ <a href="/" class="brand">
+ <span class="ph-mark" aria-hidden="true">
+ <span class="ph-mark-halo"></span>
+ <span class="ph-mk-morph ph-mk-m0"><svg class="ph-mk-spin ph-mk-s0" viewBox="-114 -114 228 228"><path d="M19 0L29 0M18.4 4.9L28 7.5M16.5 9.5L25.1 14.5M13.4 13.4L20.5 20.5M9.5 16.5L14.5 25.1M4.9 18.4L7.5 28M0 19L0 29M-4.9 18.4L-7.5 28M-9.5 16.5L-14.5 25.1M-13.4 13.4L-20.5 20.5M-16.5 9.5L-25.1 14.5M-18.4 4.9L-28 7.5M-19 0L-29 0M-18.4 -4.9L-28 -7.5M-16.5 -9.5L-25.1 -14.5M-13.4 -13.4L-20.5 -20.5M-9.5 -16.5L-14.5 -25.1M-4.9 -18.4L-7.5 -28M0 -19L0 -29M4.9 -18.4L7.5 -28M9.5 -16.5L14.5 -25.1M13.4 -13.4L20.5 -20.5M16.5 -9.5L25.1 -14.5M18.4 -4.9L28 -7.5" stroke="#ff3d86"/></svg></span>
+ <span class="ph-mk-morph ph-mk-m1"><svg class="ph-mk-spin ph-mk-s1" viewBox="-114 -114 228 228"><path d="M36 0L46 0M35.5 6.3L45.3 8M33.8 12.3L43.2 15.7M31.2 18L39.8 23M27.6 23.1L35.2 29.6M23.1 27.6L29.6 35.2M18 31.2L23 39.8M12.3 33.8L15.7 43.2M6.3 35.5L8 45.3M0 36L0 46M-6.3 35.5L-8 45.3M-12.3 33.8L-15.7 43.2M-18 31.2L-23 39.8M-23.1 27.6L-29.6 35.2M-27.6 23.1L-35.2 29.6M-31.2 18L-39.8 23M-33.8 12.3L-43.2 15.7M-35.5 6.3L-45.3 8M-36 0L-46 0M-35.5 -6.3L-45.3 -8M-33.8 -12.3L-43.2 -15.7M-31.2 -18L-39.8 -23M-27.6 -23.1L-35.2 -29.6M-23.1 -27.6L-29.6 -35.2M-18 -31.2L-23 -39.8M-12.3 -33.8L-15.7 -43.2M-6.3 -35.5L-8 -45.3M0 -36L0 -46M6.3 -35.5L8 -45.3M12.3 -33.8L15.7 -43.2M18 -31.2L23 -39.8M23.1 -27.6L29.6 -35.2M27.6 -23.1L35.2 -29.6M31.2 -18L39.8 -23M33.8 -12.3L43.2 -15.7M35.5 -6.3L45.3 -8" stroke="#e2369a"/></svg></span>
+ <span class="ph-mk-morph ph-mk-m2"><svg class="ph-mk-spin ph-mk-s2" viewBox="-114 -114 228 228"><path d="M54 0L62 0M53.5 7.7L61.4 8.8M51.8 15.2L59.5 17.5M49.1 22.4L56.4 25.8M45.4 29.2L52.2 33.5M40.8 35.4L46.9 40.6M35.4 40.8L40.6 46.9M29.2 45.4L33.5 52.2M22.4 49.1L25.8 56.4M15.2 51.8L17.5 59.5M7.7 53.5L8.8 61.4M0 54L0 62M-7.7 53.5L-8.8 61.4M-15.2 51.8L-17.5 59.5M-22.4 49.1L-25.8 56.4M-29.2 45.4L-33.5 52.2M-35.4 40.8L-40.6 46.9M-40.8 35.4L-46.9 40.6M-45.4 29.2L-52.2 33.5M-49.1 22.4L-56.4 25.8M-51.8 15.2L-59.5 17.5M-53.5 7.7L-61.4 8.8M-54 0L-62 0M-53.5 -7.7L-61.4 -8.8M-51.8 -15.2L-59.5 -17.5M-49.1 -22.4L-56.4 -25.8M-45.4 -29.2L-52.2 -33.5M-40.8 -35.4L-46.9 -40.6M-35.4 -40.8L-40.6 -46.9M-29.2 -45.4L-33.5 -52.2M-22.4 -49.1L-25.8 -56.4M-15.2 -51.8L-17.5 -59.5M-7.7 -53.5L-8.8 -61.4M0 -54L0 -62M7.7 -53.5L8.8 -61.4M15.2 -51.8L17.5 -59.5M22.4 -49.1L25.8 -56.4M29.2 -45.4L33.5 -52.2M35.4 -40.8L40.6 -46.9M40.8 -35.4L46.9 -40.6M45.4 -29.2L52.2 -33.5M49.1 -22.4L56.4 -25.8M51.8 -15.2L59.5 -17.5M53.5 -7.7L61.4 -8.8" stroke="#ba5ce4"/></svg></span>
+ <span class="ph-mk-morph ph-mk-m3"><svg class="ph-mk-spin ph-mk-s3" viewBox="-114 -114 228 228"><path d="M71 0L80 0M70.6 7.9L79.5 9M69.2 15.8L78 17.8M67 23.4L75.5 26.4M64 30.8L72.1 34.7M60.1 37.8L67.7 42.6M55.5 44.3L62.5 49.9M50.2 50.2L56.6 56.6M44.3 55.5L49.9 62.5M37.8 60.1L42.6 67.7M30.8 64L34.7 72.1M23.4 67L26.4 75.5M15.8 69.2L17.8 78M7.9 70.6L9 79.5M0 71L0 80M-7.9 70.6L-9 79.5M-15.8 69.2L-17.8 78M-23.4 67L-26.4 75.5M-30.8 64L-34.7 72.1M-37.8 60.1L-42.6 67.7M-44.3 55.5L-49.9 62.5M-50.2 50.2L-56.6 56.6M-55.5 44.3L-62.5 49.9M-60.1 37.8L-67.7 42.6M-64 30.8L-72.1 34.7M-67 23.4L-75.5 26.4M-69.2 15.8L-78 17.8M-70.6 7.9L-79.5 9M-71 0L-80 0M-70.6 -7.9L-79.5 -9M-69.2 -15.8L-78 -17.8M-67 -23.4L-75.5 -26.4M-64 -30.8L-72.1 -34.7M-60.1 -37.8L-67.7 -42.6M-55.5 -44.3L-62.5 -49.9M-50.2 -50.2L-56.6 -56.6M-44.3 -55.5L-49.9 -62.5M-37.8 -60.1L-42.6 -67.7M-30.8 -64L-34.7 -72.1M-23.4 -67L-26.4 -75.5M-15.8 -69.2L-17.8 -78M-7.9 -70.6L-9 -79.5M0 -71L0 -80M7.9 -70.6L9 -79.5M15.8 -69.2L17.8 -78M23.4 -67L26.4 -75.5M30.8 -64L34.7 -72.1M37.8 -60.1L42.6 -67.7M44.3 -55.5L49.9 -62.5M50.2 -50.2L56.6 -56.6M55.5 -44.3L62.5 -49.9M60.1 -37.8L67.7 -42.6M64 -30.8L72.1 -34.7M67 -23.4L75.5 -26.4M69.2 -15.8L78 -17.8M70.6 -7.9L79.5 -9" stroke="#8e4ddf"/></svg></span>
+ <span class="ph-mk-morph ph-mk-m4"><svg class="ph-mk-spin ph-mk-s4" viewBox="-114 -114 228 228"><path d="M87 0L95 0M86.6 8.3L94.6 9M85.4 16.5L93.3 18M83.5 24.5L91.2 26.8M80.8 32.3L88.2 35.3M77.3 39.9L84.4 43.5M73.2 47L79.9 51.4M68.4 53.8L74.7 58.7M63 60L68.8 65.6M57 65.8L62.2 71.8M50.5 70.9L55.1 77.4M43.5 75.3L47.5 82.3M36.1 79.1L39.5 86.4M28.5 82.2L31.1 89.8M20.5 84.5L22.4 92.3M12.4 86.1L13.5 94M4.1 86.9L4.5 94.9M-4.1 86.9L-4.5 94.9M-12.4 86.1L-13.5 94M-20.5 84.5L-22.4 92.3M-28.5 82.2L-31.1 89.8M-36.1 79.1L-39.5 86.4M-43.5 75.3L-47.5 82.3M-50.5 70.9L-55.1 77.4M-57 65.8L-62.2 71.8M-63 60L-68.8 65.6M-68.4 53.8L-74.7 58.7M-73.2 47L-79.9 51.4M-77.3 39.9L-84.4 43.5M-80.8 32.3L-88.2 35.3M-83.5 24.5L-91.2 26.8M-85.4 16.5L-93.3 18M-86.6 8.3L-94.6 9M-87 0L-95 0M-86.6 -8.3L-94.6 -9M-85.4 -16.5L-93.3 -18M-83.5 -24.5L-91.2 -26.8M-80.8 -32.3L-88.2 -35.3M-77.3 -39.9L-84.4 -43.5M-73.2 -47L-79.9 -51.4M-68.4 -53.8L-74.7 -58.7M-63 -60L-68.8 -65.6M-57 -65.8L-62.2 -71.8M-50.5 -70.9L-55.1 -77.4M-43.5 -75.3L-47.5 -82.3M-36.1 -79.1L-39.5 -86.4M-28.5 -82.2L-31.1 -89.8M-20.5 -84.5L-22.4 -92.3M-12.4 -86.1L-13.5 -94M-4.1 -86.9L-4.5 -94.9M4.1 -86.9L4.5 -94.9M12.4 -86.1L13.5 -94M20.5 -84.5L22.4 -92.3M28.5 -82.2L31.1 -89.8M36.1 -79.1L39.5 -86.4M43.5 -75.3L47.5 -82.3M50.5 -70.9L55.1 -77.4M57 -65.8L62.2 -71.8M63 -60L68.8 -65.6M68.4 -53.8L74.7 -58.7M73.2 -47L79.9 -51.4M77.3 -39.9L84.4 -43.5M80.8 -32.3L88.2 -35.3M83.5 -24.5L91.2 -26.8M85.4 -16.5L93.3 -18M86.6 -8.3L94.6 -9" stroke="#6f7cf0"/></svg></span>
+ <span class="ph-mk-morph ph-mk-m5"><svg class="ph-mk-spin ph-mk-s5" viewBox="-114 -114 228 228"><path d="M103 0L111 0M102.7 8.1L110.7 8.7M101.7 16.1L109.6 17.4M100.2 24L107.9 25.9M98 31.8L105.6 34.3M95.2 39.4L102.6 42.5M91.8 46.8L98.9 50.4M87.8 53.8L94.6 58M83.3 60.5L89.8 65.2M78.3 66.9L84.4 72.1M72.8 72.8L78.5 78.5M66.9 78.3L72.1 84.4M60.5 83.3L65.2 89.8M53.8 87.8L58 94.6M46.8 91.8L50.4 98.9M39.4 95.2L42.5 102.6M31.8 98L34.3 105.6M24 100.2L25.9 107.9M16.1 101.7L17.4 109.6M8.1 102.7L8.7 110.7M0 103L0 111M-8.1 102.7L-8.7 110.7M-16.1 101.7L-17.4 109.6M-24 100.2L-25.9 107.9M-31.8 98L-34.3 105.6M-39.4 95.2L-42.5 102.6M-46.8 91.8L-50.4 98.9M-53.8 87.8L-58 94.6M-60.5 83.3L-65.2 89.8M-66.9 78.3L-72.1 84.4M-72.8 72.8L-78.5 78.5M-78.3 66.9L-84.4 72.1M-83.3 60.5L-89.8 65.2M-87.8 53.8L-94.6 58M-91.8 46.8L-98.9 50.4M-95.2 39.4L-102.6 42.5M-98 31.8L-105.6 34.3M-100.2 24L-107.9 25.9M-101.7 16.1L-109.6 17.4M-102.7 8.1L-110.7 8.7M-103 0L-111 0M-102.7 -8.1L-110.7 -8.7M-101.7 -16.1L-109.6 -17.4M-100.2 -24L-107.9 -25.9M-98 -31.8L-105.6 -34.3M-95.2 -39.4L-102.6 -42.5M-91.8 -46.8L-98.9 -50.4M-87.8 -53.8L-94.6 -58M-83.3 -60.5L-89.8 -65.2M-78.3 -66.9L-84.4 -72.1M-72.8 -72.8L-78.5 -78.5M-66.9 -78.3L-72.1 -84.4M-60.5 -83.3L-65.2 -89.8M-53.8 -87.8L-58 -94.6M-46.8 -91.8L-50.4 -98.9M-39.4 -95.2L-42.5 -102.6M-31.8 -98L-34.3 -105.6M-24 -100.2L-25.9 -107.9M-16.1 -101.7L-17.4 -109.6M-8.1 -102.7L-8.7 -110.7M0 -103L0 -111M8.1 -102.7L8.7 -110.7M16.1 -101.7L17.4 -109.6M24 -100.2L25.9 -107.9M31.8 -98L34.3 -105.6M39.4 -95.2L42.5 -102.6M46.8 -91.8L50.4 -98.9M53.8 -87.8L58 -94.6M60.5 -83.3L65.2 -89.8M66.9 -78.3L72.1 -84.4M72.8 -72.8L78.5 -78.5M78.3 -66.9L84.4 -72.1M83.3 -60.5L89.8 -65.2M87.8 -53.8L94.6 -58M91.8 -46.8L98.9 -50.4M95.2 -39.4L102.6 -42.5M98 -31.8L105.6 -34.3M100.2 -24L107.9 -25.9M101.7 -16.1L109.6 -17.4M102.7 -8.1L110.7 -8.7" stroke="#37cfe3"/></svg></span>
+ <span class="ph-mark-core"></span>
+ </span>
+ <img class="brand-word" src="/assets/phosphene_wordtext.png" alt="Phosphene">
+ </a>
<!-- The standalone version badge is gone: #versionPill already carries the
version in EVERY state it can be in — "Up to date · 4.2.0",
"Update to 4.3.0", "Checking · 4.2.0", "4.2.0 · dev · <sha>",
@@ -184,8 +205,15 @@
The chip SUMMARISES them: worst state wins the colour, and memory stays
on the face because it is the one number worth a glance.
PORTALED to <body>: <header> is overflow:hidden and would slice it —
- the same clipping that once cut off the avatar. -->
- <div id="healthCluster" role="group" aria-label="System health" hidden>
+ the same clipping that once cut off the avatar.
+ NO `hidden` on this div (4.19.11). It carried a stray one from the
+ duplicate v4.5.0 build (989aaf1f kept this markup, not that build's
+ intent), and nothing ever cleared it: the cluster only showed because
+ `body > header #healthCluster { display: flex }` outranked the UA's
+ [hidden] rule. When the global `[hidden] { display: none !important }`
+ landed (VC-07, v4.17.0) it won, and the memory chip vanished from every
+ install for five releases. test_health_chip_visible.py pins it. -->
+ <div id="healthCluster" role="group" aria-label="System health">
<button type="button" id="healthChip" aria-haspopup="dialog"
aria-expanded="false" aria-controls="healthPop"
title="System health — click for detail">
@@ -1354,6 +1382,12 @@
</button>
</div>
<div class="h3-turbo-note" id="h3SpeedNote" hidden></div>
+ <!-- lightx2v v1.3 on Best at High: credit once it is in, the
+ one click that gets it before then (_h3RenderV13Note). -->
+ <div class="h3-turbo-note h3-v13-note" id="h3V13Note" hidden>
+ <span id="h3V13NoteText"></span>
+ <button type="button" class="ghost-btn h3-v13-get" id="h3V13Get" hidden></button>
+ </div>
</div>
<!-- Speed — the LTX-2.5 distilled lane's REAL speed control
(v4.0.5), replacing the dead one above. "Fast draft" selects
diff --git a/webapp/js/engines.js b/webapp/js/engines.js
index b10b8b1..ba3b42f 100644
--- a/webapp/js/engines.js
+++ b/webapp/js/engines.js
@@ -372,6 +372,28 @@ function h3TurboState() {
function h3TriStepState() {
return (H3 && H3.tristep) || { available: false, supported: false, downloaded: false };
}
+// lightx2v v1.3: what Best renders on the High canvas once its adapter is
+// built (server: h3_cell_takes_v13 / make_job). Text and Image only; a pinned
+// Steps count keeps the full sampler.
+function h3V13State() {
+ return (H3 && H3.v13) || { available: false, supported: false, downloaded: false };
+}
+function _h3V13Mode() {
+ const m = (document.getElementById('mode') || {}).value || 't2v';
+ return m === 't2v' || m === 'i2v';
+}
+// Would THIS cell's Best render on v1.3, as things stand?
+function h3V13On(cell, opts) {
+ cell = cell || h3CurrentCell();
+ if (!cell || cell.v13_min == null) return false;
+ opts = opts || {};
+ const fast = (opts.fast != null) ? opts.fast : h3TriStepOn(cell);
+ if (fast) return false;
+ const ov = (opts.steps != null) ? String(opts.steps)
+ : ((document.getElementById('h3_steps') || {}).value || 'auto');
+ if (ov !== 'auto') return false;
+ return _h3V13Mode() && !!h3V13State().available;
+}
function h3SpeedPref() {
let v = null;
try { v = localStorage.getItem('phos_h3_speed'); } catch (e) {}
@@ -420,6 +442,7 @@ function h3CellEtaMin(cell, opts) {
const fast = (opts.fast != null) ? opts.fast : h3TriStepOn(cell);
if (fast && cell.tristep_min != null) return _h3TriStepMin(cell);
if (opts.turbo) return cell.turbo_min;
+ if (h3V13On(cell, { fast: false, steps: opts.steps })) return cell.v13_min;
const ov = (opts.steps != null) ? String(opts.steps)
: ((document.getElementById('h3_steps') || {}).value || 'auto');
if (ov !== 'auto' && /^\d+$/.test(ov)) {
@@ -435,7 +458,9 @@ function h3CellEtaBasis(cell, opts) {
if (!cell) return '';
opts = opts || {};
const fast = (opts.fast != null) ? opts.fast : h3TriStepOn(cell);
- const fr = fast ? cell.fleet_range_fast : cell.fleet_range;
+ const fr = fast ? cell.fleet_range_fast
+ : (h3V13On(cell, { fast: false }) ? cell.fleet_range_v13 : cell.fleet_range);
+ if (!fr && !fast && h3V13On(cell, { fast: false }) && cell.v13_measured) return 'measured on an M4 Max';
return fr ? fr.basis : 'estimated — few renders on this Mac class yet';
}
function h3FmtEtaMin(m) {
@@ -456,6 +481,9 @@ function h3CellEta(cell, opts) {
if (opts.turbo) return cell.turbo_eta;
const ov = (document.getElementById('h3_steps') || {}).value || 'auto';
if (ov === 'auto' || !/^\d+$/.test(ov)) {
+ if (h3V13On(cell, { fast: false })) {
+ return (!_h3IsI2V() && cell.fleet_range_v13) ? cell.fleet_range_v13.eta_range : cell.v13_eta;
+ }
// Owner ruling (2026-09-29): Best's own real fleet range, same idea as
// Fast's above — never for i2v, which the server prices separately and
// this fleet cell (mode "t2v") does not cover.
@@ -492,8 +520,11 @@ function _h3SyncSamplerTitles() {
const pts = (cell && cell.steps) || 9;
const fwd = Math.max(1, pts - 1);
const best = document.querySelector('#h3SpeedGroup [data-h3-speed="best"]');
- if (best) best.title = "Best: this shape's full sampler — " + fwd + ' steps per window. '
- + 'The slower, most careful render.';
+ if (best) best.title = h3V13On(cell, { fast: false })
+ ? 'Best on High: ' + (h3V13State().name || 'lightx2v v1.3') + ', ' + (h3V13State().forwards || 6)
+ + ' steps per window. Takes about half the time. Choose a Steps count to use the old Best sampler.'
+ : "Best: this shape's full sampler — " + fwd + ' steps per window. '
+ + 'The slower, most careful render.';
const auto = document.querySelector('#h3StepsGroup [data-h3-steps="auto"]');
if (auto) auto.title = "This shape's tuned count — " + pts + ' sigma points ('
+ fwd + ' forwards per window) at this canvas.';
@@ -544,9 +575,77 @@ function renderH3Turbo() {
}
_h3SyncSamplerTitles();
_h3ApplySpeed();
+ _h3RenderV13Note();
_h3SyncFaceFixEta();
}
+// The line under the switch for lightx2v v1.3 on High: what it is and who
+// made it once it is in, the one click that gets it before then.
+function _h3RenderV13Note() {
+ const box = document.getElementById('h3V13Note');
+ if (!box) return;
+ const cell = h3CurrentCell();
+ const v = h3V13State();
+ const text = document.getElementById('h3V13NoteText');
+ const btn = document.getElementById('h3V13Get');
+ const show = !!(cell && cell.v13_min != null && _h3V13Mode() && !h3TriStepOn(cell));
+ box.hidden = !show;
+ if (!show || !text) return;
+ const name = v.name || 'lightx2v v1.3';
+ const credit = 'By LightX2V (Apache-2.0 code; ' + (v.license || 'MiniMax H3 Community License') + ' weights).';
+ let msg = '';
+ let canGet = false;
+ if (!v.supported) {
+ msg = 'Best on High takes about half the time with ' + name + '. ' + distText(
+ 'Update H3: click "Update Hailuo H3 runner" in the Pinokio sidebar. Your weights stay.',
+ 'It needs a newer H3 runner, but the Mac app can\u2019t update the runner yet.');
+ } else if (v.installing) {
+ const d = v.download || {};
+ msg = d.status === 'building' ? 'Preparing ' + name + ' on your Mac…'
+ : 'Downloading ' + name + ': ' + (d.mb || 0) + ' / ' + (d.total_mb || 1320) + ' MB';
+ } else if (!v.downloaded) {
+ const e = (v.download || {}).error;
+ // "about half the time", not "down from <Best>": the Best half of the
+ // switch may show a fleet range, and two different "before" numbers on
+ // one screen would contradict each other.
+ msg = 'New: ' + name + ' runs Best on High in about ' + _h3EtaPlain(cell.v13_eta)
+ + ', about half the time. Richer detail in our side-by-side tests. ' + credit
+ + (e ? ' Last try failed: ' + e : '');
+ canGet = true;
+ } else if (h3V13On(cell, { fast: false })) {
+ msg = 'Best on High uses ' + name + ' (' + (v.forwards || 6) + ' steps). ' + credit
+ + ' Choose a Steps count to use the old Best sampler.';
+ } else {
+ msg = 'Steps set: Best uses the old sampler instead of ' + name + '.';
+ }
+ text.textContent = msg;
+ if (btn) {
+ btn.hidden = !canGet;
+ btn.textContent = 'Get it · ' + (v.download_gb || 1.4) + ' GB';
+ }
+}
+async function h3V13Install() {
+ const toast = (m, kind) => { if (typeof phosToast === 'function') phosToast(m, { kind }); };
+ const btn = document.getElementById('h3V13Get');
+ if (btn) btn.disabled = true;
+ try {
+ const r = await fetch('/h3/v13/install', { method: 'POST' });
+ const j = await r.json().catch(() => ({}));
+ if (!r.ok) throw new Error(j.error || ('HTTP ' + r.status));
+ toast(j.already_installed ? 'lightx2v v1.3 is already installed.'
+ : "Downloading LightX2V's lightx2v v1.3 (1.4 GB), then preparing it on your Mac. "
+ + 'Best on High will use it automatically when ready.', 'ok');
+ } catch (e) {
+ toast('lightx2v v1.3: ' + (e.message || 'failed'), 'danger');
+ } finally {
+ if (btn) btn.disabled = false;
+ }
+}
+{
+ const _v13Btn = document.getElementById('h3V13Get');
+ if (_v13Btn) _v13Btn.onclick = (ev) => { ev.preventDefault(); h3V13Install(); };
+}
+
// ONE writer for what this render does: both hidden inputs, the lit half, the
// Steps row, the note. Guarded: setH3Steps re-enters through renderH3Turbo.
let _h3SpeedBusy = false;
@@ -602,7 +701,8 @@ function _h3ApplySpeed() {
? cell.tristep_forwards : (tri.steps ? tri.steps - 1 : 3);
} else if (s && cell) {
const ov = (stIn || {}).value || 'auto';
- s.value = (ov !== 'auto' && /^\d+$/.test(ov)) ? parseInt(ov, 10) : cell.steps;
+ s.value = (ov !== 'auto' && /^\d+$/.test(ov)) ? parseInt(ov, 10)
+ : (h3V13On(cell, { fast: false }) ? cell.v13_steps : cell.steps);
}
// Steps is a Best control: it only shows while Best is what renders.
const stepsRow = document.getElementById('h3StepsRow');
@@ -638,7 +738,8 @@ function h3SpeedOfParams(p) {
// function so all three read the same label from the same field.
function h3JobSpeedLabel(p) {
if (!p || p.engine !== 'h3') return '';
- return h3SpeedOfParams(p) === 'fast' ? 'Fast' : 'Best';
+ if (h3SpeedOfParams(p) === 'fast') return 'Fast';
+ return p.h3_v13 ? 'Best · lightx2v v1.3' : 'Best';
}
// "Hailuo H3 · Standard 10s" — the shape a submitted H3 job asked for,
// looked up from its own h3_tier (never re-derived from the CURRENT form
@@ -2025,6 +2126,7 @@ Object.assign(globalThis, {
engineById, defaultEngine, engineStatus, engineServesMode,
h3ResolveTierKey, h3TierByKey, h3CellFor, h3CurrentCell,
setH3Upscale, setH3FaceFixAfter, setH3Orientation, setH3Steps, h3TurboPillSub,
+ h3V13State, h3V13On,
renderH3Turbo, setH3Turbo, syncModeStripToEngine, renderEngineSwitch,
setH3Speed, h3SpeedOfParams, h3EstimateLine, setH3TriStep, h3TriStepOn, h3TriStepState,
h3JobSpeedLabel, h3JobShapeLabel, ltxCellEtaBasis, h3CellEtaBasis,
diff --git a/webapp/js/preview.js b/webapp/js/preview.js
index 68b32c7..e367467 100644
--- a/webapp/js/preview.js
+++ b/webapp/js/preview.js
@@ -203,7 +203,15 @@ function _renderLiveStageFrame(s, preview) {
const stopping = window._stopEarlyRequested === cur.id;
wrap.classList.toggle('is-aborting', stopping);
- if (!preview.meaningful || !preview.url) {
+ // THE FIRST ESTIMATE IS SHOWN, SOFTENED, AS SOON AS IT EXISTS. Only Stop
+ // early waits for `meaningful` (a stop over an unsettled take is the trap
+ // that rule exists for). The picture used to wait too, and on the distilled
+ // lane estimate 6 is ~2/3 of the way through the denoise: 129 s of a
+ // Balanced render on an M4 Max with nothing but this placeholder, while the
+ // engine had published five estimates whose layout (light, smoke, the
+ // subject's place) already matched the take (owner, 2026-10-22: "it just
+ // takes a shitload of time, and only near the end does it show").
+ if (!preview.url) {
if (wrap.dataset.liveState !== 'warming') {
wrap.innerHTML = `<div class="live-stage-warming">
<svg class="live-stage-warming-mark" viewBox="0 0 24 16" fill="none" aria-hidden="true">
@@ -222,7 +230,10 @@ function _renderLiveStageFrame(s, preview) {
img = wrap.querySelector('.live-stage-image');
}
if (img.getAttribute('src') !== preview.url) img.setAttribute('src', preview.url);
- wrap.dataset.liveState = 'meaningful';
+ // Rough until the server calls it meaningful: blurred, so nobody judges a
+ // face or a detail the next estimates are still deciding.
+ img.classList.toggle('is-forming', !preview.meaningful);
+ wrap.dataset.liveState = preview.meaningful ? 'meaningful' : 'forming';
}
const badge = document.getElementById('liveStageBadge');
@@ -237,7 +248,8 @@ function _renderLiveStageFrame(s, preview) {
const step = preview.estimate != null && preview.total != null
? ` · step ${preview.estimate}/${preview.total}` : '';
if (title) title.textContent = preview.meaningful
- ? `forming take${step}` : 'forming take · warming';
+ ? `forming take${step}`
+ : (preview.url ? `forming take${step} · rough` : 'forming take · warming');
if (eta) {
eta.textContent = stopping ? 'Finishing the current step, then stopping.'
: (preview.remaining_sec != null && preview.remaining_sec > 0
@@ -510,11 +522,13 @@ function renderNowPreview(s, prog, previewData) {
const note = document.getElementById('nowThumbHelpNote');
if (note && note.textContent !== prev.help) note.textContent = prev.help;
}
- if (!prev.meaningful) {
+ if (!prev.url) {
box.className = 'now-thumb is-warming';
box.innerHTML = '';
} else {
- box.className = 'now-thumb' + (stopping ? ' is-aborting' : '');
+ // The rough estimates show too (see _renderLiveStageFrame); `is-forming`
+ // softens them until the server calls the take meaningful.
+ box.className = 'now-thumb' + (prev.meaningful ? '' : ' is-forming') + (stopping ? ' is-aborting' : '');
// Replace the src in place rather than the node, so the browser does not
// flash white between estimates.
let img = box.querySelector('img');
@@ -530,7 +544,7 @@ function renderNowPreview(s, prog, previewData) {
? 'Finishing the current step, then stopping.'
: (prev.meaningful
? `This is the shot it's making. Stop now if it's wrong${saves}.`
- : 'Finding the shot…');
+ : (prev.url ? 'The shot is forming. It sharpens as the render settles.' : 'Finding the shot…'));
meta.innerHTML += `<br><span style="color:var(--muted)">${escapeHtml(line)}</span>`;
}
if (actions && prev.abortable) {
diff --git a/webapp/js/queue.js b/webapp/js/queue.js
index a408705..c5b0474 100644
--- a/webapp/js/queue.js
+++ b/webapp/js/queue.js
@@ -951,12 +951,17 @@ function updateH3Availability(s) {
// Same for the Draft's fast 3-step adapter.
|| (((next.tristep || {}).available) !== ((H3.tristep || {}).available))
|| (((next.tristep || {}).supported) !== ((H3.tristep || {}).supported))
+ // And for lightx2v v1.3 (Best on High): built from inside the panel.
+ || (((next.v13 || {}).available) !== ((H3.v13 || {}).available))
+ || (((next.v13 || {}).supported) !== ((H3.v13 || {}).supported))
+ || (((next.v13 || {}).download || {}).status !== ((H3.v13 || {}).download || {}).status)
|| ((next.tiers || []).length !== (H3.tiers || []).length);
// BOTH bindings, and they must stay the same object: the H3-specific code
// reads `H3` on nearly every line, the registry reads the probe map. A
// divergence here is a switcher showing "not installed" over a working
// engine (or worse, the reverse).
- const _triDl = !!((next.tristep || {}).installing || (H3.tristep || {}).installing);
+ const _triDl = !!((next.tristep || {}).installing || (H3.tristep || {}).installing
+ || (next.v13 || {}).installing || (H3.v13 || {}).installing);
H3 = next;
window._ENGINE_PROBES.h3 = next;
// A running 3-step download prints its progress on the pill.
@@ -7584,7 +7589,15 @@ async function loadParams(recipe) {
try { setH3Speed(h3SpeedOfParams(p)); } catch (e) {}
}
if (typeof setH3Steps === 'function') {
- try { setH3Steps(Number(p.h3_steps || 0) > 0 ? String(p.h3_steps) : 'auto'); } catch (e) {}
+ // A Best clip made on the full sampler, where Best would now run
+ // lightx2v v1.3 (High, Text/Image): pin the count it ran, so Load
+ // Params reproduces the same sampler instead of quietly switching it.
+ const _fullBestOnV13Cell = !p.h3_v13 && h3SpeedOfParams(p) === 'best'
+ && p.h3_quality === 'high' && (p.mode === 't2v' || p.mode === 'i2v')
+ && Number(p.steps || 0) > 0 && typeof h3V13State === 'function' && h3V13State().available;
+ const _pin = Number(p.h3_steps || 0) > 0 ? String(p.h3_steps)
+ : (_fullBestOnV13Cell ? String(p.steps) : 'auto');
+ try { setH3Steps(_pin); } catch (e) {}
}
// The render shape. Prefer the two axes when the sidecar carries them; fall
// back to the composite key, which every sidecar has always carried and
diff --git a/webapp/js/storyboard.js b/webapp/js/storyboard.js
index 07b29d9..1ecd6d4 100644
--- a/webapp/js/storyboard.js
+++ b/webapp/js/storyboard.js
@@ -1478,8 +1478,13 @@ function sbShotGridTile(s) {
const gradeDot = s.grade
? `<span class="sb-grid-grade sb-grid-grade-${escapeHtml(s.grade)}">${{ keep: 'K', reroll: 'R', cut: 'C' }[s.grade] || ''}</span>`
: '';
+ // `#t=0.1` on every thumbnail <video preload="metadata">: WebKit (Safari and
+ // the Mac app's WKWebView) stops at the metadata and paints NOTHING until a
+ // frame is asked for; Chrome happens to decode the first one anyway. The
+ // Editor's media pool learned this first (edPoolPaint); these three tiles
+ // were the ones still blank in the app.
const thumb = clip
- ? `<video class="sb-grid-thumb" preload="metadata" muted playsinline src="/file?path=${encodeURIComponent(clip)}"></video>`
+ ? `<video class="sb-grid-thumb" preload="metadata" muted playsinline src="/file?path=${encodeURIComponent(clip)}#t=0.1"></video>`
: `<div class="sb-grid-thumb sb-grid-thumb-empty" aria-hidden="true"></div>`;
return `<li class="sb-grid-tile" data-n="${n}" onclick="sbGridTileOpen(${n})" role="button" tabindex="0"
title="${escapeHtml((s.title || s.prompt || '').slice(0, 140))}">
@@ -1635,7 +1640,7 @@ function sbShotCard(s, r, errs) {
<div class="sb-shot-out car-card is-stale">
<div class="car-thumb-wrap" onclick="selectOutput('${escapeHtml(stale)}')">
<video class="car-thumb" preload="metadata" muted playsinline
- src="/file?path=${encodeURIComponent(stale)}"></video>
+ src="/file?path=${encodeURIComponent(stale)}#t=0.1"></video>
</div>
<div class="info"><span class="name">${escapeHtml(stale.split('/').pop())}</span>
<span class="sub"><span class="sb-stale-tag">old take</span> · rewritten, not rendered yet</span></div>
@@ -1643,7 +1648,7 @@ function sbShotCard(s, r, errs) {
<div class="sb-shot-out car-card">
<div class="car-thumb-wrap" onclick="sbOpenShotClip(${n})">
<video class="car-thumb" preload="metadata" muted playsinline
- src="/file?path=${encodeURIComponent(clip)}"
+ src="/file?path=${encodeURIComponent(clip)}#t=0.1"
onmouseenter="this.currentTime=0;this.playbackRate=0.6;this.play().catch(()=>{})"
onmouseleave="this.pause();this.currentTime=2.5"></video>
</div>
@@ -2553,7 +2558,7 @@ function sbBoardRowMenu(b, where) {
// The FULL board-list screen's row: thumbnail, date, rename, duplicate.
function sbBoardRow(b) {
const thumb = b.thumb
- ? `<video class="sb-board-thumb" preload="metadata" muted playsinline src="/file?path=${encodeURIComponent(b.thumb)}"></video>`
+ ? `<video class="sb-board-thumb" preload="metadata" muted playsinline src="/file?path=${encodeURIComponent(b.thumb)}#t=0.1"></video>`
: `<span class="sb-board-thumb sb-board-thumb-empty" aria-hidden="true"></span>`;
const when = sbFmtAgo(b.updated_at || b.created_at);
return `
diff --git a/webapp/style/panel.css b/webapp/style/panel.css
index a89a77d..c688ab6 100644
--- a/webapp/style/panel.css
+++ b/webapp/style/panel.css
@@ -409,9 +409,19 @@
overflow:hidden — the compaction rule above still targeted the
retired span.pill markup. Show the percentage alone; the full text
stays in the title and the pop-over (review 2026-09-02). */
+ /* max-width: none (4.19.11): the 22ch cap above is measured in the
+ face's OWN font, and font-size 0 makes 22ch = 0 px, so the ::after
+ percentage was clipped to nothing and the chip showed a bare dot.
+ It landed (664f714) 45 minutes after the chip vanished behind its
+ stray `hidden` (048464f), so nobody ever saw it. The short text is
+ a few characters; it needs no cap.
+ font-variant-numeric: normal on the face: WebKit (Safari, the Mac
+ app) does not scale TABULAR digits by font-size 0, so the hidden
+ "49/64 GB · 77%" still took ~50 px and pushed the percentage right.
+ The ::after gets tabular-nums back for itself. */
@media (max-width: 1400px) {
- #healthChip .hc-face { font-size: 0; }
- #healthChip .hc-face::after { content: attr(data-short); font-size: 11.5px; }
+ #healthChip .hc-face { font-size: 0; max-width: none; font-variant-numeric: normal; }
+ #healthChip .hc-face::after { content: attr(data-short); font-size: 11.5px; font-variant-numeric: tabular-nums; }
}
/* SYS-38: the branch + short SHA + commit date ("HEAD · 70665d3
(2026-09-28)") is developer build detail — useful for self-
@@ -7279,9 +7289,11 @@
.player-wrap .live-stage-image {
position: absolute; inset: 0;
width: 100%; height: 100%; object-fit: contain;
- transition: opacity 180ms ease;
+ transition: opacity 180ms ease, filter .6s ease;
}
.player-wrap.live-stage.is-aborting .live-stage-image { opacity: .58; }
+ /* A rough estimate (before the server's `meaningful`): shown, softened. */
+ .player-wrap .live-stage-image.is-forming { filter: blur(6px) saturate(.85); opacity: .82; }
.live-stage-warming {
position: absolute; inset: 0;
display: flex; flex-direction: column;
@@ -8458,6 +8470,7 @@
}
.now-thumb[hidden] { display: none; }
.now-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
+ .now-thumb.is-forming img { filter: blur(3px) saturate(.85); opacity: .82; }
/* WARMING — the estimates so far are still essentially noise, so there is
nothing worth showing and nothing worth judging. A placeholder that
breathes, flattened by the global prefers-reduced-motion rule. */
@@ -10590,7 +10603,9 @@
body > header #healthCluster > span.pill svg { width: 12px; height: 12px; }
}
body > header .brand img {
- /* Phosphene brand mark — the rings + wordmark composed as ONE wide
+ /* (4.19.11: this img is now the WORDMARK only, 825x228; the rings are
+ .ph-mark below. The history of the banner it replaced:)
+ Phosphene brand mark — the rings + wordmark composed as ONE wide
banner (1291×392, transparent bg). Replaces the previous setup
where the small ring mark (`phosphene_brand.png`) was injected
via `content: url()` and the wordmark text was added via
@@ -10611,6 +10626,119 @@
drop-shadow(0 0 14px rgba(255, 95, 168, 0.55))
drop-shadow(0 0 6px rgba(79, 214, 255, 0.35));
}
+ /* THE MARK TURNS, SLOWLY (4.19.11) — phosphene.video's mark, in the app.
+ The banner PNG used to carry the rings; now the rings are six layered
+ <svg> boxes (index.html) and the img above is only the wordmark.
+ Each ring turns the opposite way from its neighbour (40-140 s a turn,
+ inner rings a little faster, so every rim moves at about the same
+ ~1.7 px/s), each breathes into a slight oval, the hue drifts, the
+ centre glows.
+
+ WHAT IT COSTS, MEASURED (Chrome 1600x900 @2x, CDP trace + ps, only
+ the mark animating; docs/STATE.md 2026-10-22 has the table):
+ - Only transform, opacity and one hue filter animate, all on HTML
+ boxes, so no frame repaints or re-lays-out anything: the trace's
+ Paint count is the page's own idle number. Do not animate anything
+ INSIDE the <svg>s, and put no filter/shadow on a ring: either turns
+ every frame into a repaint. The glow is a static gradient
+ (.ph-mark-halo) for the same reason.
+ - Even compositor-only, a 60 fps animation keeps Chrome's GPU and
+ browser processes at ~+9% of a core. The motion is so slow (a rim
+ moves ~0.17 px per 0.1 s) that 10 updates a second look identical,
+ so every animation is STEPPED on one shared 0.1 s grid: durations
+ are whole multiples of 0.1 s per keyframe segment, delays are whole
+ seconds, and steps(N) per segment = segment seconds x 10. Off-grid
+ values would make the six rings tick at different moments and
+ bring the frame rate back up. Cost: ~+3% of a core, no paint.
+ - It turns ALL the time, renders included (owner, 2026-10-22: the
+ mark must never look stopped). Do not add a pause-while-rendering
+ rule back: the step grid is what keeps it cheap.
+ - A hidden tab / hidden app window stops the animation on its own.
+ test_logo_mark_motion.py pins all of this. */
+ body > header .ph-mark {
+ position: relative;
+ display: block;
+ flex: none;
+ width: 78px;
+ height: 78px;
+ animation: ph-mk-hue 48s steps(120) infinite alternate;
+ }
+ .ph-mark > span { position: absolute; inset: 0; display: block; }
+ .ph-mark .ph-mark-halo {
+ inset: -12px;
+ border-radius: 50%;
+ background: radial-gradient(circle closest-side,
+ rgba(255, 95, 168, 0.13) 0%, rgba(177, 74, 255, 0.06) 55%,
+ rgba(79, 214, 255, 0.035) 80%, rgba(79, 214, 255, 0) 100%);
+ }
+ .ph-mk-spin {
+ display: block;
+ width: 100%;
+ height: 100%;
+ overflow: visible;
+ fill: none;
+ stroke-width: 2.1;
+ stroke-linecap: round;
+ animation: ph-mk-turn var(--t) steps(var(--n)) infinite var(--dir);
+ }
+ /* --n = --t x 10 (one step per 0.1 s). */
+ .ph-mk-s0 { --t: 40s; --n: 400; --dir: normal; }
+ .ph-mk-s1 { --t: 52s; --n: 520; --dir: reverse; }
+ .ph-mk-s2 { --t: 66s; --n: 660; --dir: normal; }
+ .ph-mk-s3 { --t: 84s; --n: 840; --dir: reverse; }
+ .ph-mk-s4 { --t: 108s; --n: 1080; --dir: normal; }
+ .ph-mk-s5 { --t: 140s; --n: 1400; --dir: reverse; }
+ /* Breathe: 4 equal segments, so --b is a multiple of 0.4 s and
+ --n = --b / 4 x 10 (steps per segment); --bd whole seconds. */
+ .ph-mk-morph { animation: ph-mk-breathe var(--b) steps(var(--n)) var(--bd) infinite alternate; }
+ .ph-mk-m0 { --b: 8.8s; --n: 22; --bd: 0s; }
+ .ph-mk-m1 { --b: 10.8s; --n: 27; --bd: -3s; }
+ .ph-mk-m2 { --b: 12.8s; --n: 32; --bd: -7s; }
+ .ph-mk-m3 { --b: 10s; --n: 25; --bd: -2s; }
+ .ph-mk-m4 { --b: 14s; --n: 35; --bd: -9s; }
+ .ph-mk-m5 { --b: 12s; --n: 30; --bd: -5s; }
+ .ph-mark .ph-mark-core {
+ inset: auto;
+ left: calc(50% - 4px);
+ top: calc(50% - 4px);
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: radial-gradient(circle closest-side,
+ #f8e24e 0%, #f8e24e 42%, rgba(248, 226, 78, 0.35) 62%, rgba(248, 226, 78, 0) 100%);
+ animation: ph-mk-glow 6s steps(15) infinite alternate;
+ }
+ @keyframes ph-mk-turn { to { transform: rotate(360deg); } }
+ /* The site's breathe (wide, then tall, then round), as 4 equal
+ segments; the glow and hue follow an eased (cosine) curve the same
+ way, since a stepped segment is linear. */
+ @keyframes ph-mk-breathe {
+ 0% { transform: scale(1, 1); }
+ 25% { transform: scale(1.03, 0.978) rotate(3.5deg); }
+ 50% { transform: scale(1.002, 1.004) rotate(0.5deg); }
+ 75% { transform: scale(0.976, 1.03) rotate(-3deg); }
+ 100% { transform: scale(1.015, 1.015); }
+ }
+ @keyframes ph-mk-glow {
+ 0% { transform: scale(0.85); opacity: 0.85; }
+ 25% { transform: scale(0.894); opacity: 0.872; }
+ 50% { transform: scale(1); opacity: 0.925; }
+ 75% { transform: scale(1.106); opacity: 0.978; }
+ 100% { transform: scale(1.15); opacity: 1; }
+ }
+ @keyframes ph-mk-hue {
+ 0% { filter: hue-rotate(-14deg) saturate(1); }
+ 25% { filter: hue-rotate(-9.3deg) saturate(1.022); }
+ 50% { filter: hue-rotate(2deg) saturate(1.075); }
+ 75% { filter: hue-rotate(13.3deg) saturate(1.128); }
+ 100% { filter: hue-rotate(18deg) saturate(1.15); }
+ }
+ @media (prefers-reduced-motion: reduce) {
+ body > header .ph-mark,
+ .ph-mark .ph-mk-morph,
+ .ph-mark .ph-mk-spin,
+ .ph-mark .ph-mark-core { animation: none !important; }
+ }
/* (previous `.brand::after { content: 'Phosphene' }` removed
2026-05-19 — wordmark text is now baked into the banner PNG so
the panel doesn't need to re-render it via CSS gradient. Kept
@@ -12815,3 +12943,8 @@ body[data-engine="h3"][data-vmode="v2a"] #h3LengthLabel { display: none !importa
.engine-credit { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
[data-licence-status] { color: var(--muted); }
[data-licence-status].ok { color: rgba(63,185,80,0.9); }
+
+/* lightx2v v1.3 note under the H3 Speed switch (engines.js _h3RenderV13Note). */
+.h3-speed .h3-v13-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
+.h3-speed .h3-v13-note .h3-v13-get { padding: 2px 10px; font-size: 12px; }
+.h3-speed .h3-v13-note .h3-v13-get[hidden] { display: none !important; }