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(v3.8.3): the install that hung Pinokio before it ever started

mrbizarro3ca9df61f013
diff --git a/README.md b/README.md
index 9f85f58..c527a9c 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Key differences from the standard A2V path:
</p>
-> **Current release: v3.8.2 — update to it if you are on v3.8.1.** On v3.8.1 the Update run could end several steps early without saying so, and the step it skipped was the one that patches the video encoder. The result had no visible symptom: renders completed normally but were encoded 4:2:0 `yuv420p`, which shows up as blocky compression on faces and skin. v3.8.2 runs that patch immediately after the engine reinstall, removes what was ending the run early, and makes the patch verify its own work and fail loudly instead of quietly. v3.8.1 fixed an Update that could abort at the video-engine pin (`your local changes … would be overwritten by checkout: … video_vae.py`) and could never be retried; v3.8.0 brought Storyboard — describe a film in a sentence, get a shot list you can edit before anything renders — plus the fix for the install failure that had been breaking every fresh install since hatchling 1.32.0 shipped. Full notes on the [releases page](https://github.com/mrbizarro/phosphene/releases).
+> **Current release: v3.8.3 — the fix for an install that hung Pinokio before it started.** On Pinokio 8.0.x a fresh install could freeze at 100% CPU right after `git rev-parse --short HEAD`, with no child process and no error, until you force-quit. v3.6.2 shortened the shell lines for this and it was not enough: what Pinokio writes to its shell is the whole joined step, and the LTX venv step handed it 1,417 characters in one go. Those payloads now live in `scripts/pinokio/*.sh` and each step dispatches one short line, with a gate that measures what is actually dispatched. Also: installing Hailuo H3 no longer tells you to look for an "Engine row" in the Video tab — the engine switcher is in the top right of the header. v3.8.2 fixed an update that silently skipped the video-encoder patch and encoded every render 4:2:0; v3.8.1 fixed an Update that could abort at the video-engine pin and never be retried; v3.8.0 brought Storyboard plus the fix for the install failure that had been breaking every fresh install since hatchling 1.32.0 shipped. Full notes on the [releases page](https://github.com/mrbizarro/phosphene/releases).
## Overview
diff --git a/VERSION b/VERSION
index a08ffae..269aa9c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.8.2
+3.8.3
diff --git a/docs/H3_ENGINE.md b/docs/H3_ENGINE.md
index bb0c9a6..b6803f6 100644
--- a/docs/H3_ENGINE.md
+++ b/docs/H3_ENGINE.md
@@ -326,9 +326,14 @@ restart. `GET /status` → `.h3` tells you what resolved:
## Troubleshooting
+> **Where the control is.** The engine switcher lives in the **top right of the
+> header**, beside the memory / models pills — not in the Video tab. The
+> "Engine row" that older copy pointed at has not existed since the engine
+> table landed (#58 is a user who installed H3 fine and went looking there).
+
| Symptom | Cause |
|---|---|
-| Engine row not visible at all | `h3.capable` false — under the 60 GB floor (a 64 GB Mac reports ~63.x after firmware reservations) |
+| Engine switcher not visible at all | `h3.capable` false, so H3 isn't renderable and there is only one engine left to choose between — the switcher and its divider both hide. Either under the 46 GB floor, or a 48 GB-class Mac whose reduced-RAM **Q8 DiT pack is not on disk**: `h3_capable()` requires `_h3_q8_dit_dir()` below 60 GB. Check `dit_choice.q8_available` in `/status`. |
| H3 pill dashed, "not installed" | `h3.missing` lists exactly which component didn't resolve |
| Image mode snaps back to LTX | `h3.first_frame` false — the installed runner has no `--first-frame` |
| `ffmpeg not found on PATH` | the runner pipes raw RGB into `ffmpeg`; the panel prepends `FFMPEG_BIN` to the subprocess PATH, so this means the bundled binary is missing |
diff --git a/docs/STATE.md b/docs/STATE.md
index 72ca9e0..4f694cd 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -1,6 +1,6 @@
# Phosphene — project state, history, open work
-**Public release: `v3.8.2`** (see the v3.8.2 + v3.8.1 + v3.8.0 CHANGELOG entries below; the narrative in this paragraph stops at v3.1.1 and is kept as history). The entire v3.0 line shipped — v3.0.0 (Characters / Voice / Image Studio / A2V, May 23) → v3.0.1 (FFLF crash fix) → v3.0.2 (Boost/Turbo accel restored after a 2-month silent regression) → v3.0.3 (HiDream hidden, #15) → v3.0.4 (CivitAI SSL) → v3.0.5 (A2V kwarg signature shim, #5) → v3.0.6 (deep-review hardening) → v3.0.7 (GPU-race fix + /status version surfacing) → **v3.0.8 (ltx-2-mlx v0.14.8 catch-up — codec-only patches, I2V "mosaic"/Metal-watchdog fix #17, ASCII version-skew handshake fix)** → **v3.0.9 (custom I2V Width×height inputs restored for power users; Train-tab dev-transformer Download "unknown install key" fix — form-encoding, reported by @cocktailpeanut)** → **v3.0.10 (model-integrity self-heal — boot scan + `/status.model_integrity` + a one-click Repair banner for corrupt/partial weights, the leading *non-Metal* "mosaic" garbage-decode cause; safetensors header+size check)** → **v3.0.11 (latent helper-handshake hang fixed: `_read_until` mixed `select()` on the raw fd with a buffered `readline()`, so any event the helper emitted *right before* `ready` — a version-skew line, the new runtime fingerprint — got stranded in the TextIOWrapper buffer and the panel hung 120 s → "helper failed to start: None". This is the true root cause behind the mislabeled "⚠️-emoji" handshake break. Now reads the raw fd via `os.read()` into a carry buffer and drains every complete line before re-`select()`-ing. PLUS: every render log self-documents its runtime — mlx/mlx-metal version + Apple chip + macOS — surfaced in `/status`, the `helper ready ·` line, and a standalone `runtime |` line, the exact data needed to triangulate the remaining MLX-numerical "mosaic")** → **v3.0.12 (the REAL mosaic fix + 3 more. The mosaic is NOT a code bug or the missing-upscaler theory (both disproved by local repro — the bare 6-file Q4 set renders byte-identical-clean on M4 Max); it's stale/corrupt weight *content* — right size, wrong bytes — that v3.0.10's header+size check can't see (confirmed: ronyeoh/#18 + claude3d/#5 fixed it only by a fresh full re-download). Added **deep checksum verify vs upstream**: Settings → Model files → "Verify model files (checksum)" / `/models/verify-deep` hashes every weight + compares to HuggingFace's published SHA-256 (proven to match local), mismatches feed the existing one-click Repair re-download. Validated: flipped 16 bytes mid-file → header+size passed, deep-verify caught it. ALSO in v3.0.12: character-LoRA-shows-as-"style-only" fix (#5 — `list_user_loras` recovers trigger+kind from the `_v2` filename when the sidecar is missing); `cgi`→`email` multipart migration (Python-3.13-ready, removes the boot DeprecationWarning, adopted from @ssfeather's PR #22); dynamic 3–8 multi-keyframe UI (adopted from @youngbee12's PR #20, ported clean with the integrity feature preserved + a JS ReferenceError fixed). Folds in v3.0.11's handshake fix + runtime fingerprint.)** → **v3.0.13 (character LoRA fixes, #5 @claude3d: a multi-word/spaced character filename no longer mislabels as style-only — the id regex gated out spaces before the sidecar was read; and the Character tab no longer silently falls back to plain T2V — a UI desync left the avatar's selection ring lit after `character_id` was cleared. Plus an `enhancePrompt` element-id fix. Cherry-picked to prod `ce03139`, release `814dc2d`.)** → **v3.1.0 (Ideogram 4 — open-weight 9.3B text-rendering image model + a visual text-placement canvas that places exact text via normalized-bbox captions. mflux 0.18 `mflux-generate-ideogram4`; gated `ideogram-ai/ideogram-4-fp8` ~26 GB, needs a HF Read token + license. Fixed the gated-download 401 that would have hit EVERY user — the panel now exports its configured token to subprocess env via `_sync_hf_token_to_env` so a stale `hf auth login` cache can't shadow it; proven clean-room. Validated end-to-end: 8-text-element field-guide poster rendered clean, every label placed per its bbox.)** → **v3.1.1 (Ideogram output-card buttons hotfix, reported by Mr Bizarro: an Ideogram image's prompt is a caption JSON, which broke every output surface that fed it into a plain box / inline onclick — the Recent-list Animate button was worked-but-dead because apostrophes/&/< in the caption terminated the single-quoted onclick. Display-layer fix: `_displayPromptFor` derives `high_level_description`, `escapeHtml` the onclick args, friendly `_imgEngineLabel`, and `loadParams` restores an Ideogram image into the visual canvas instead of dumping JSON. `params.prompt` stays the caption JSON; renders unaffected. Validated live.)** All validated end-to-end on the dev panel (deep-verify corrupt-detect + repair, /loras, byte-identical upload, multi-keyframe render, FFLF regression). See §4 for the full version history. The May-17 Codex C+ UI restructure (capability tiers, Q4 surface, Character as 5th mode pill, accel kill, HQ-speed move) and the Train-tab / LoRA-chrome work that followed are all baseline now, folded into v3.0.x. There is no `v2.0.6` tag.
+**Public release: `v3.8.3`** (see the v3.8.3 + v3.8.2 + v3.8.1 + v3.8.0 CHANGELOG entries below; the narrative in this paragraph stops at v3.1.1 and is kept as history). The entire v3.0 line shipped — v3.0.0 (Characters / Voice / Image Studio / A2V, May 23) → v3.0.1 (FFLF crash fix) → v3.0.2 (Boost/Turbo accel restored after a 2-month silent regression) → v3.0.3 (HiDream hidden, #15) → v3.0.4 (CivitAI SSL) → v3.0.5 (A2V kwarg signature shim, #5) → v3.0.6 (deep-review hardening) → v3.0.7 (GPU-race fix + /status version surfacing) → **v3.0.8 (ltx-2-mlx v0.14.8 catch-up — codec-only patches, I2V "mosaic"/Metal-watchdog fix #17, ASCII version-skew handshake fix)** → **v3.0.9 (custom I2V Width×height inputs restored for power users; Train-tab dev-transformer Download "unknown install key" fix — form-encoding, reported by @cocktailpeanut)** → **v3.0.10 (model-integrity self-heal — boot scan + `/status.model_integrity` + a one-click Repair banner for corrupt/partial weights, the leading *non-Metal* "mosaic" garbage-decode cause; safetensors header+size check)** → **v3.0.11 (latent helper-handshake hang fixed: `_read_until` mixed `select()` on the raw fd with a buffered `readline()`, so any event the helper emitted *right before* `ready` — a version-skew line, the new runtime fingerprint — got stranded in the TextIOWrapper buffer and the panel hung 120 s → "helper failed to start: None". This is the true root cause behind the mislabeled "⚠️-emoji" handshake break. Now reads the raw fd via `os.read()` into a carry buffer and drains every complete line before re-`select()`-ing. PLUS: every render log self-documents its runtime — mlx/mlx-metal version + Apple chip + macOS — surfaced in `/status`, the `helper ready ·` line, and a standalone `runtime |` line, the exact data needed to triangulate the remaining MLX-numerical "mosaic")** → **v3.0.12 (the REAL mosaic fix + 3 more. The mosaic is NOT a code bug or the missing-upscaler theory (both disproved by local repro — the bare 6-file Q4 set renders byte-identical-clean on M4 Max); it's stale/corrupt weight *content* — right size, wrong bytes — that v3.0.10's header+size check can't see (confirmed: ronyeoh/#18 + claude3d/#5 fixed it only by a fresh full re-download). Added **deep checksum verify vs upstream**: Settings → Model files → "Verify model files (checksum)" / `/models/verify-deep` hashes every weight + compares to HuggingFace's published SHA-256 (proven to match local), mismatches feed the existing one-click Repair re-download. Validated: flipped 16 bytes mid-file → header+size passed, deep-verify caught it. ALSO in v3.0.12: character-LoRA-shows-as-"style-only" fix (#5 — `list_user_loras` recovers trigger+kind from the `_v2` filename when the sidecar is missing); `cgi`→`email` multipart migration (Python-3.13-ready, removes the boot DeprecationWarning, adopted from @ssfeather's PR #22); dynamic 3–8 multi-keyframe UI (adopted from @youngbee12's PR #20, ported clean with the integrity feature preserved + a JS ReferenceError fixed). Folds in v3.0.11's handshake fix + runtime fingerprint.)** → **v3.0.13 (character LoRA fixes, #5 @claude3d: a multi-word/spaced character filename no longer mislabels as style-only — the id regex gated out spaces before the sidecar was read; and the Character tab no longer silently falls back to plain T2V — a UI desync left the avatar's selection ring lit after `character_id` was cleared. Plus an `enhancePrompt` element-id fix. Cherry-picked to prod `ce03139`, release `814dc2d`.)** → **v3.1.0 (Ideogram 4 — open-weight 9.3B text-rendering image model + a visual text-placement canvas that places exact text via normalized-bbox captions. mflux 0.18 `mflux-generate-ideogram4`; gated `ideogram-ai/ideogram-4-fp8` ~26 GB, needs a HF Read token + license. Fixed the gated-download 401 that would have hit EVERY user — the panel now exports its configured token to subprocess env via `_sync_hf_token_to_env` so a stale `hf auth login` cache can't shadow it; proven clean-room. Validated end-to-end: 8-text-element field-guide poster rendered clean, every label placed per its bbox.)** → **v3.1.1 (Ideogram output-card buttons hotfix, reported by Mr Bizarro: an Ideogram image's prompt is a caption JSON, which broke every output surface that fed it into a plain box / inline onclick — the Recent-list Animate button was worked-but-dead because apostrophes/&/< in the caption terminated the single-quoted onclick. Display-layer fix: `_displayPromptFor` derives `high_level_description`, `escapeHtml` the onclick args, friendly `_imgEngineLabel`, and `loadParams` restores an Ideogram image into the visual canvas instead of dumping JSON. `params.prompt` stays the caption JSON; renders unaffected. Validated live.)** All validated end-to-end on the dev panel (deep-verify corrupt-detect + repair, /loras, byte-identical upload, multi-keyframe render, FFLF regression). See §4 for the full version history. The May-17 Codex C+ UI restructure (capability tiers, Q4 surface, Character as 5th mode pill, accel kill, HQ-speed move) and the Train-tab / LoRA-chrome work that followed are all baseline now, folded into v3.0.x. There is no `v2.0.6` tag.
> **🌍 2026-08-12 — THE GEOIP KILL (analytics schema-v2 Phase 1): every event now tells PostHog not to locate it.** The panel has never sent a location field. It didn't have to: PostHog derives country, city, subdivision, timezone and the city's coordinates from the connecting IP by **default**, and the previous posture — in `_analytics_post`'s own docstring — was *"we neither add to nor suppress that."* Now suppressed, on every event, via `_ANALYTICS_RECEIVER_DIRECTIVES` spread **last** into the properties block so no call site can override it.
>
@@ -742,6 +742,54 @@ Reconciled against the deep review (2026-05-31). Everything that was a recent fi
> handoff, not a user changelog. v3.8.0 is written up here as well because a release that
> changes the install path deserves a line somebody can find with grep.
+#### v3.8.3 — the install that hung Pinokio before it ever started
+- **Symptom.** On Pinokio 8.0.40 a fresh install freezes at ~100% CPU immediately after
+ `git rev-parse --short HEAD`. No child process spawns, nothing is logged, and the only way
+ out is force-quitting Pinokio. Reported by **@davidaircloud** on a completely clean
+ Pinokio 8.0.40 + Phosphene 3.8.0 (#50, reopened after the v3.6.2 fix) and independently by
+ **@itrejomx** (#56), who saw the same stall before `uv venv` and fixed it locally by
+ splitting the payload into smaller steps.
+- **Cause — the rule was right and the measurement was wrong.** @Morac2 bisected the ceiling
+ in #50: a 764-char command hangs, ~373 passes. v3.6.2 adopted *"no generated shell line over
+ 350"* and the issue was closed. But what Pinokio writes to the pty is not a line of our
+ source. `pinokiod/kernel/shells.js` `launch()` dispatches an **array** message one element
+ per shell, and a **string** message in ONE unchunked write (`shell.js:1911`) — and every
+ long payload in this repo is `[ ... ].join("\n")`, deliberately, so an `if/else` runs in a
+ single shell. Those were exactly the dispatches nobody was counting. The LTX venv step's
+ source lines were all under 110 chars and it handed Pinokio **1,417** characters in one go —
+ the exact number @davidaircloud measured himself, and the exact thing he fixed by moving the
+ body into a `.sh`.
+- **Corroboration from Pinokio's own source.** `Shell.emit()` (shell.js:665-711) chunks
+ anything over 1024 chars into 256-byte pieces with a 10 ms gap, so the kernel already treats
+ large pty writes as unsafe; the `shell.run` dispatch path simply does not do it. A local pty
+ probe using Pinokio's own shell and args (`bash --noprofile --norc`, one unchunked write)
+ completes a 1,475-byte payload fine — so this is **not** a kernel tty limit, and dispatch
+ size is the only lever available from this side.
+- **The fix.** Four oversized dispatches move into `scripts/pinokio/`, each step becoming one
+ short `bash …` line: the LTX venv check (1,417), the mflux image-engine pack (529), the H3
+ memory preflight (845) and the H3 Q8 engine build (595). Worst dispatch in the tree is now
+ **498**. Every script is a verbatim lift, run as `bash <path>` so no execute bit is involved,
+ keeping the `\n`-joined steps' no-`set -e` semantics. The vendored engine pin is unchanged
+ and still lives in the `.js` beside the notes that document it.
+- **Proof.** Each old inline payload and its new script were run in byte-identical sandboxes
+ across every branch — healthy venv, broken venv, macOS 13 abort, mflux, H3 preflight at
+ 32 / 48 / 64 GB, Q8 already-built / build / skip — and compared on stdout and exit code.
+ 10/10 identical; the only difference is that bash's own diagnostic now names the script
+ instead of saying `bash`.
+- **The gate.** `scripts/check_pinokio_scripts.js` loads each launcher module and models
+ `launch()` to find the real dispatches, failing anything over 500 chars. 500 sits above the
+ largest dispatch that has demonstrably shipped and worked (498) and well under the smallest
+ that has demonstrably hung (764). Six dispatches sit in the 352-498 band; they work today and
+ tightening toward 350 belongs in a feature release, not a hotfix.
+- **Also — the H3 install pointed at a control that had moved (#58).** After a 75 GB download,
+ `install_h3.js` said *"the Video tab now has an Engine row"*. The engine control has been the
+ switcher in the **top right of the header** since the engine table landed; there is no Engine
+ row in the Video tab to find, and #58 is a user who installed H3 successfully and went
+ looking there. The notification and `docs/H3_ENGINE.md` now say where it is, and name the one
+ condition that genuinely hides it: the switcher only appears when more than one engine is
+ renderable, and on a sub-60 GB Mac `h3_capable()` stays false until the reduced-RAM Q8 pack
+ exists on disk (`dit_choice.q8_available` in `/status`).
+
#### v3.8.2 — the codec patch never ran, and nothing noticed
- **Symptom: none.** That is what made it dangerous. After updating to v3.8.1 the app reported
a finished update, the engine pin had moved, the version handshake was green — and
diff --git a/install.js b/install.js
index 3747ced..b685af8 100644
--- a/install.js
+++ b/install.js
@@ -192,105 +192,27 @@ module.exports = {
},
// ---- Force Python 3.11 venv (SHIP-BLOCKER fix) ------------------------
- // Pinokio's `venv: "env"` shortcut creates a venv using whatever python
- // is on `conda activate base` — on machines where conda's base env is
- // Python 3.10 (the current macOS bundle reality), that venv has no
- // python3.11 and the MLX packages refuse to install:
- // "ltx-core-mlx==0.2.0 depends on Python>=3.11"
+ // Pinokio's `venv: "env"` shortcut creates a venv using whatever python is
+ // on `conda activate base` — on machines where conda's base env is Python
+ // 3.10 (the current macOS bundle reality), that venv has no python3.11 and
+ // the MLX packages refuse to install ("ltx-core-mlx depends on
+ // Python>=3.11"). Worse, that error doesn't abort the install — Pinokio
+ // happily downloads 35 GB of weights into a broken venv. So we create the
+ // venv with `uv venv --python 3.11` before any pip step.
//
- // Worse, that error doesn't abort the install — Pinokio happily moves on
- // to download 35 GB of weights into a broken venv. So we explicitly
- // create the venv with `uv venv --python 3.11` before any pip step.
- //
- // SELF-HEALING, and deliberately NOT gated on `when: !exists(...)` —
- // the same latent bug fixed for Hailuo H3 in v3.4.0's "installed other
- // packs and H3 vanished" regression (install_h3.js, 3c9bdf6). `uv venv`
- // creates the interpreter as a symlink chain into Pinokio's SHARED
- // managed Python (verified — this venv has the identical chain):
- // env/bin/python3.11 -> python
- // env/bin/python -> <pinokio>/cache/XDG_DATA_HOME/uv/python/
- // cpython-3.11-macos-aarch64-none/bin/python3.11
- // That target is Pinokio's, not ours. Any other pack install — or any
- // other Pinokio app — that makes uv re-resolve, bump or prune the
- // managed interpreter leaves the chain DANGLING while env/ still
- // exists. A path-existence guard cannot handle that state: depending on
- // whether the check stats the link or its target, a dangling chain
- // reads as either present (rebuild silently skipped → a broken venv
- // that re-running Install can never fix) or absent. So we ask the only
- // question that matters — does the interpreter RUN? — inside the
- // shell, and rebuild only when it doesn't. python3.11 specifically
- // (not python): a legacy conda-3.10 venv (the failure mode above) has
- // a working `python` but no `python3.11`, so probing python3.11 keeps
- // that rebuild path too — and it is the exact interpreter every later
- // step invokes. Healthy installs pay ~50 ms; broken ones rebuild in
- // ~5 min with zero re-downloads. (Unlike H3, Reset+Install could
- // already recover this venv — reset.js deletes ltx-2-mlx/ wholesale —
- // but a user should never need Reset for it; env/ holds no user data.)
- //
- // One joined multi-line message (the mflux-step idiom below), so the
- // whole if/else runs as a single shell compound.
+ // 3.8.3 — THIS IS THE STEP THAT HUNG PINOKIO (#56, and #50 reopened).
+ // It was a "\n"-joined STRING, which kernel/shells.js launch() dispatches
+ // as ONE write to the pty: 1,417 chars, the exact number @davidaircloud
+ // measured on 3.8.0. Its source lines were all under 110 chars, so v3.6.2's
+ // per-line rule reported it clean — the rule was right, the measurement was
+ // wrong. The body (self-healing venv probe, macOS preflight, diagnostics,
+ // rebuild) now lives in scripts/pinokio/ltx_venv.sh with its full
+ // rationale. Gate: scripts/check_pinokio_scripts.js.
{
method: "shell.run",
params: {
path: "ltx-2-mlx",
- message: [
- "echo '=== LTX venv check ==='",
- "if env/bin/python3.11 -c 'import sys' >/dev/null 2>&1; then",
- "echo 'venv healthy - reusing it'",
- "else",
- "echo 'venv missing or broken (wrong Python or dangling interpreter) - rebuilding, no models are re-downloaded'",
- // v2.0.3: log the toolchain BEFORE creating the venv so the
- // install log self-documents which Python uv landed on. A user
- // (KTDS) hit a silent "ModuleNotFoundError: ltx_pipelines_mlx"
- // after a green install — the most likely cause was uv falling
- // back to a Python that couldn't install mlx wheels, and we
- // had no log evidence to confirm. These echoes change nothing
- // operationally; they just leave a trail.
- "echo '=== install diagnostics: venv create ==='",
- // SHIP-BLOCKER GUARD (2026-07-23, from @hottboytank's Pinokio report):
- // mlx 0.31.1 publishes NO macOS-13 wheel — its builds start at
- // macosx_14_0_arm64. On Ventura the mlx step dies deep inside uv's
- // resolver ("No solution found ... no wheels with a matching platform
- // tag"), ltx_core_mlx never installs, and the user only sees a cryptic
- // ModuleNotFoundError at the very end — under an auto-generated title
- // about python3.11 that points at completely the wrong thing.
- // Fail fast, up front, with the actual fix.
- // FAIL-OPEN BY DESIGN: only block when we positively identify a
- // macOS major < 14. If sw_vers is missing, unparseable, or non-numeric
- // for any reason, we PROCEED — a preflight that can't read the version
- // must never be the thing that bricks an otherwise-fine install.
- // Pinokio 8.0.x wedges its shell on very long single lines (#50: 764
- // chars hangs, ~373 passes — bisected by @Morac2). Every line below
- // stays well under that; they run in ONE shell invocation joined by
- // \n, so the if/else and variables still span lines.
- [
- "MACOS_VER=$(sw_vers -productVersion 2>/dev/null)",
- "MACOS_MAJOR=$(echo \"$MACOS_VER\" | cut -d. -f1)",
- "if echo \"$MACOS_MAJOR\" | grep -qE '^[0-9]+$' && [ \"$MACOS_MAJOR\" -lt 14 ]; then",
- " echo '=================================================================='",
- " echo \"PHOSPHENE CANNOT INSTALL ON macOS $MACOS_VER\"",
- " echo 'Phosphene needs macOS 14 (Sonoma) or newer.'",
- " echo 'Why: mlx 0.31.1 ships no macOS 13 build, so the engine cannot install'",
- " echo 'and every generation would fail.'",
- " echo 'Fix: System Settings > General > Software Update -> macOS 14 or 15,'",
- " echo 'then reinstall Phosphene.'",
- " echo '=================================================================='",
- " exit 1",
- "else",
- " echo \"macOS preflight OK (detected '$MACOS_VER', needs >= 14)\"",
- "fi",
- ].join("\n"),
- "which uv && uv --version || echo 'uv NOT FOUND'",
- "which python3.11 && python3.11 --version || echo 'system python3.11 NOT FOUND (uv will try to fetch)'",
- "uname -a",
- "echo '=== /diagnostics ==='",
- "rm -rf env",
- "uv venv --python 3.11 --seed env",
- "echo '=== venv created ==='",
- "ls -la env/bin/python* 2>&1 || echo 'venv create FAILED'",
- "env/bin/python --version || echo 'venv python NOT executable'",
- "fi"
- ].join("\n")
+ message: "bash ../scripts/pinokio/ltx_venv.sh"
}
},
@@ -515,23 +437,14 @@ module.exports = {
// one-click "Reinstall image engines" path if it didn't land. Two-step
// (with-deps then --no-deps) mirrors install_qwen.js so transitive deps
// resolve, then the version is locked + the FBCache patch applied.
+ //
+ // 3.8.3: body moved to scripts/pinokio/mflux_pack.sh (529-char dispatch).
+ // update.js keeps its own near-identical copy inline at 498 — under the
+ // ceiling, and deliberately left alone rather than merged here in a hotfix.
{
method: "shell.run",
params: {
- message: [
- "echo 'Installing the mflux image-engine pack (Ideogram 4 + Qwen-Edit)…' && \\",
- // uv, NOT plain pip: mlx-vlm is installed --no-deps (to dodge its
- // PIL>=10/av pins), which leaves its declared extras unsatisfied. Plain
- // `pip install` then dumps a scary "ERROR: pip's dependency resolver…"
- // block about mlx-vlm on EVERY later install — verified, and it made
- // cocktailpeanut's update look broken. uv installs the same packages
- // with zero such noise (same reason the base deps above use uv).
- "( uv pip install --python ./ltx-2-mlx/env/bin/python 'mflux==0.18.0' && \\",
- " uv pip install --python ./ltx-2-mlx/env/bin/python --reinstall --no-deps 'mflux==0.18.0' && \\",
- " uv pip install --python ./ltx-2-mlx/env/bin/python 'mlx-teacache==0.4.1' && \\",
- " ./ltx-2-mlx/env/bin/python3.11 patch_mflux_fbcache.py ) \\",
- "|| echo 'WARN: mflux image-engine install hit an error — video still works; use the Reinstall image engines action to retry image generation.'"
- ].join("\n")
+ message: "bash scripts/pinokio/mflux_pack.sh"
}
},
diff --git a/install_h3.js b/install_h3.js
index 5e39538..183a2df 100644
--- a/install_h3.js
+++ b/install_h3.js
@@ -60,26 +60,11 @@ module.exports = {
method: "shell.run",
params: {
message: [
- // Split across short lines: Pinokio 8.0.x hangs its shell on very long
- // single lines (#50). One shell invocation — the if/else spans lines.
- [
- "MEM_BYTES=$(sysctl -n hw.memsize 2>/dev/null)",
- "if echo \"$MEM_BYTES\" | grep -qE '^[0-9]+$' && [ \"$MEM_BYTES\" -lt 46000000000 ]; then",
- " MEM_GB=$((MEM_BYTES / 1000000000))",
- " echo '=================================================================='",
- " echo \"HAILUO H3 NEEDS AT LEAST A 48 GB MAC (this Mac has ${MEM_GB} GB)\"",
- " echo 'Even the reduced-RAM Q8 engine peaks around 27 GiB while rendering;'",
- " echo 'below 48 GB it swaps and a 3-second clip takes hours.'",
- " echo 'Nothing was downloaded. Keep using the built-in LTX-2.3 engine.'",
- " echo '=================================================================='",
- " exit 1",
- "elif [ \"$MEM_BYTES\" -lt 60000000000 ]; then",
- " echo 'H3 memory preflight OK - 48 GB class: the reduced-RAM Q8 engine'",
- " echo 'will be built locally after the weights download (adds ~5 min).'",
- "else",
- " echo 'H3 memory preflight OK'",
- "fi",
- ].join("\n"),
+ // 3.8.3: the if/else was a "\n"-joined STRING, so Pinokio wrote all
+ // 845 chars to the pty in one go (#56 / #50). Body — with the
+ // fail-open rationale and the 46e9 floor — now in
+ // scripts/pinokio/h3_preflight.sh. Gate: scripts/check_pinokio_scripts.js.
+ "bash scripts/pinokio/h3_preflight.sh",
"echo 'free disk space:'",
"df -h ."
]
@@ -241,20 +226,11 @@ module.exports = {
method: "shell.run",
params: {
path: "minimax-h3-mlx",
+ // 3.8.3: body moved to scripts/pinokio/h3_build_q8.sh (595-char
+ // dispatch). {{cwd}} is substituted in the MESSAGE, so the app root
+ // is passed as $1 rather than written into the script.
message: [
- [
- "MEM_BYTES=$(sysctl -n hw.memsize 2>/dev/null)",
- "PACK='{{cwd}}/mlx_models/hailuo-h3/models/h3-dit-q8'",
- "SRC='{{cwd}}/mlx_models/hailuo-h3/models/deepbeep-pruned-bf16/MiniMax-H3-FL2VA-pruned_bf16.safetensors'",
- "if [ -f \"$PACK/quant_config.json\" ]; then",
- " echo 'Q8 engine already built - skipping'",
- "elif echo \"$MEM_BYTES\" | grep -qE '^[0-9]+$' && [ \"$MEM_BYTES\" -lt 60000000000 ]; then",
- " echo '=== Building the reduced-RAM Q8 engine (~5 min, one time) ==='",
- " .venv/bin/python scripts/quantize_stream.py --src \"$SRC\" --out \"$PACK\"",
- "else",
- " echo '64 GB-class Mac - bf16 engine is the default, Q8 not built'",
- "fi",
- ].join("\n")
+ "bash ../scripts/pinokio/h3_build_q8.sh '{{cwd}}'"
]
}
},
@@ -262,7 +238,17 @@ module.exports = {
{
method: "notify",
params: {
- html: "<b>Hailuo H3 ready.</b><br>Open the panel — the Video tab now has an <b>Engine</b> row: LTX-2.3 | Hailuo H3. H3 serves Text and Image, and generates dialogue + sound from the same prompt, so write them into it."
+ // 3.8.3: this used to say "the Video tab now has an Engine row". The
+ // engine control has been the switcher in the TOP RIGHT of the header
+ // since the engine table landed — there is no Engine row in the Video
+ // tab any more, and #58 ("[bug] Engine Picker not showing") is a user
+ // who installed H3 successfully and then went looking in the place this
+ // sentence sent him. Say where the control actually is, and name the
+ // one thing that can still hide it: the switcher only appears when
+ // there is more than one engine this Mac can render with, and on a
+ // 48 GB-class Mac that means the reduced-RAM Q8 pack built by the step
+ // above must be on disk.
+ html: "<b>Hailuo H3 ready.</b><br>Open the panel — the engine switcher is in the <b>top right of the header</b>, next to the memory and models pills: <b>LTX-2.3 | Hailuo H3</b>. (Not in the Video tab.) Restart the panel if it was already running. H3 serves Text and Image, and generates dialogue + sound from the same prompt, so write them into it."
}
}
]
diff --git a/scripts/check_pinokio_scripts.js b/scripts/check_pinokio_scripts.js
new file mode 100644
index 0000000..5683033
--- /dev/null
+++ b/scripts/check_pinokio_scripts.js
@@ -0,0 +1,164 @@
+#!/usr/bin/env node
+/*
+ * Gate for the Pinokio launcher scripts: no single DISPATCH may be long enough
+ * to wedge Pinokio's shell.
+ *
+ * ---------------------------------------------------------------------------
+ * WHY
+ * ---------------------------------------------------------------------------
+ * Pinokio 8.0.x hangs — one CPU core at 100%, no child process ever spawns,
+ * the install dead until a force-quit — when a single command written to its
+ * pty is too long. @Morac2 bisected the ceiling in #50: a 764-char command
+ * hangs, ~373 passes. v3.6.2 adopted "no generated shell line over 350" from
+ * that, and the issue was closed.
+ *
+ * It came back twice, from two different people:
+ * #50 @davidaircloud "The individual lines are now short, but the joined
+ * message generated by install.js is still 1,417
+ * characters." Moving that body into a .sh and
+ * dispatching `bash ../x.sh` fixed his install.
+ * #56 @itrejomx same stall before `uv venv`; fixed by splitting the
+ * payload into smaller shell.run steps.
+ *
+ * The rule was right and the MEASUREMENT was wrong. What Pinokio dispatches
+ * is not "a line of the source" — it is one string per shell:
+ *
+ * pinokiod/kernel/shells.js launch()
+ * message is an ARRAY and no `chain` param -> each element is launched
+ * in its OWN shell (so an
+ * array is already safe;
+ * element size is what
+ * counts)
+ * message is an ARRAY and `chain` is set -> Shell.build() joins them
+ * into ONE dispatch
+ * message is a STRING -> ONE dispatch, as-is
+ *
+ * pinokiod/kernel/shell.js:1911
+ * this.ptyProcess.write(`${this.exec_cmd || this.cmd}${this.EOL}`)
+ * — one unchunked write, however big it is. The same file's
+ * Shell.emit() (shell.js:665-711) chunks anything over 1024 chars into
+ * 256-byte pieces with a 10 ms gap, so the kernel already knows large
+ * pty writes are unsafe; the shell.run path just doesn't do it.
+ *
+ * Every long payload in this repo is written `[ ... ].join("\n")` — a STRING,
+ * deliberately, so an if/else runs in one shell. Those are exactly the
+ * dispatches nobody was measuring: the venv step's source lines were all under
+ * 110 chars and it dispatched 1,417 in one go.
+ *
+ * A local pty probe (bash --noprofile --norc, Pinokio's own shell/args, one
+ * unchunked os.write) completes a 1,475-byte payload fine, so this is not a
+ * kernel tty limit — it is Pinokio's terminal layer, and dispatch size is the
+ * only lever we have from this side.
+ *
+ * ---------------------------------------------------------------------------
+ * THE RULE
+ * ---------------------------------------------------------------------------
+ * Every dispatch <= 500 chars, measured the way @Morac2 measured it: the
+ * message content, before Pinokio prepends its conda activation. Anything
+ * bigger belongs in scripts/pinokio/ and becomes one short `bash ...` line.
+ *
+ * Run: node scripts/check_pinokio_scripts.js exit 0 = PASS
+ */
+const path = require("path")
+
+// The evidence, and nothing beyond it:
+// proven to HANG 764 (@Morac2, #50) and 1,417 (@davidaircloud, #50 / #56)
+// proven to WORK ~373 (@Morac2's own bisection) and every dispatch this
+// repo has shipped, the largest of which is 498 (update.js
+// step 11, in every release since it landed)
+// 500 sits just above the proven-working band and well under the proven-hanging
+// one. 350 would be the ideal target but would fail six dispatches that
+// demonstrably work for everyone today, and churning those in a hotfix buys
+// risk, not safety. Tighten toward 350 in a feature release, not here.
+const MAX_DISPATCH = 500
+
+const SCRIPTS = [
+ "install.js", "update.js", "install_h3.js", "install_qwen.js",
+ "install_sharp.js", "download_q8.js", "download_upscaler.js",
+ "start.js", "reset.js", "pinokio.js",
+]
+
+// Shell.build()'s array delimiters (kernel/shell.js:932), used only when a
+// `chain` param is present — which is what makes an array ONE dispatch.
+function chainDelimiter(chain) {
+ if (chain === "*") return " ; "
+ if (chain === "|") return " || "
+ return " && "
+}
+
+// What kernel/shells.js launch() actually writes to the pty, as a list.
+function dispatches(params) {
+ const m = params.message
+ if (!m) return []
+ if (typeof m === "string") return [m]
+ if (Array.isArray(m)) {
+ if (params.chain) {
+ return [m.filter((x) => x && !/^\s+$/.test(x))
+ .map(String).join(chainDelimiter(params.chain))]
+ }
+ return m.filter(Boolean).map(String) // one shell per element
+ }
+ return [String(m)]
+}
+
+function* walk(node, trail) {
+ if (Array.isArray(node)) {
+ for (let i = 0; i < node.length; i++) yield* walk(node[i], trail.concat(i))
+ return
+ }
+ if (!node || typeof node !== "object") return
+ if (node.method === "shell.run" && node.params) yield { step: node, trail }
+ for (const k of Object.keys(node)) {
+ if (k === "method" || k === "params") continue
+ yield* walk(node[k], trail.concat(k))
+ }
+}
+
+const root = path.resolve(__dirname, "..")
+const failures = []
+let steps = 0
+let count = 0
+let worst = 0
+let worstWhere = ""
+
+for (const name of SCRIPTS) {
+ let mod
+ try {
+ mod = require(path.join(root, name))
+ } catch (e) {
+ failures.push(`${name}: FAILED TO LOAD — ${e.message}`)
+ continue
+ }
+ // pinokio.js exports an ASYNC menu() that needs a live kernel + info object,
+ // and its entries only reference the other scripts — it dispatches nothing
+ // itself. Loading it (above) is the check that applies to it.
+ const trees = []
+ if (mod && mod.run) trees.push(mod.run)
+ for (const tree of trees) {
+ for (const { step, trail } of walk(tree, [])) {
+ steps++
+ const list = dispatches(step.params)
+ list.forEach((cmd, k) => {
+ count++
+ const where = `${name} [${trail.join(".")}]` +
+ (list.length > 1 ? ` element ${k}` : "")
+ if (cmd.length > worst) { worst = cmd.length; worstWhere = where }
+ if (cmd.length > MAX_DISPATCH) {
+ failures.push(`${where}: DISPATCH ${cmd.length} > ${MAX_DISPATCH}` +
+ ` — move it into scripts/pinokio/ and dispatch one short line` +
+ `\n starts: ${cmd.slice(0, 72).replace(/\n/g, "\\n")}`)
+ }
+ })
+ }
+ }
+}
+
+console.log(`${count} dispatches across ${steps} shell.run steps in ${SCRIPTS.length} scripts`)
+console.log(`worst dispatch: ${worst} chars (limit ${MAX_DISPATCH}) ${worstWhere}`)
+if (failures.length) {
+ console.log("")
+ for (const f of failures) console.log("FAIL " + f)
+ console.log(`\nRESULT: FAIL (${failures.length})`)
+ process.exit(1)
+}
+console.log("\nRESULT: PASS")
diff --git a/scripts/pinokio/README.md b/scripts/pinokio/README.md
new file mode 100644
index 0000000..1f2a6e4
--- /dev/null
+++ b/scripts/pinokio/README.md
@@ -0,0 +1,72 @@
+# `scripts/pinokio/` — payloads too big to hand Pinokio directly
+
+Every file here is a step body lifted out of `install.js` / `install_h3.js`
+because **Pinokio 8.0.x wedges when a single dispatch is large** — one CPU core
+at 100%, no child process ever spawns, and the install is dead until the user
+force-quits.
+
+## What Pinokio actually dispatches
+
+`pinokiod/kernel/shells.js` `launch()`:
+
+| `message` | what happens |
+|---|---|
+| an **array**, no `chain` param | each element is launched in its **own shell** — so an array is already safe and the *element* is the unit |
+| an **array** with `chain` | `Shell.build()` joins them into **one** dispatch |
+| a **string** | **one** dispatch, as-is |
+
+and `shell.js:1911` writes whichever it is in a single unchunked call:
+
+```js
+this.ptyProcess.write(`${this.exec_cmd || this.cmd}${this.EOL}`)
+```
+
+The same file's `Shell.emit()` (shell.js:665-711) chunks anything over **1024**
+chars into 256-byte pieces with a 10 ms gap — so the kernel already knows large
+pty writes are unsafe. The `shell.run` path just doesn't do it.
+
+## Why v3.6.2's fix wasn't enough
+
+@Morac2 bisected the ceiling in #50: **764 chars hangs, ~373 passes**. v3.6.2
+adopted "no generated shell line over 350" and the issue was closed. The rule
+was right; the *measurement* was wrong. Every long payload in this repo is
+written `[ ... ].join("\n")` — deliberately a **string**, so an `if/else` runs
+in one shell — and those are exactly the dispatches nobody counted. The venv
+step's source lines were all under 110 chars and it dispatched **1,417** in one
+go:
+
+| report | finding | their fix |
+|---|---|---|
+| #50 @Morac2 | 764-char line hangs, ~373 passes | shortened the line (v3.6.2) |
+| #50 @davidaircloud | lines short, joined message still **1,417** — still hangs | moved the body to a `.sh`, dispatched `bash ../x.sh` |
+| #56 @itrejomx | same stall before `uv venv` | split the payload into smaller steps |
+
+A local pty probe (bash `--noprofile --norc` — Pinokio's own shell and args —
+with one unchunked `os.write`) completes a 1,475-byte payload fine, so this is
+**not** a kernel tty limit. It is Pinokio's terminal layer above the pty, and
+dispatch size is the only lever we have from this side.
+
+## The rule
+
+`scripts/check_pinokio_scripts.js` enforces it against the **loaded modules**,
+modelling `launch()` exactly:
+
+> **no single dispatch over 500 chars**
+
+500 sits above the largest dispatch that has demonstrably shipped and worked in
+the field (498) and well under the smallest that has demonstrably hung (764).
+Anything bigger belongs here, behind one short `bash …` line.
+
+## House rules for files here
+
+- Dispatched as `bash <path>` — **never** `./<path>`, so no execute bit is
+ needed and nothing depends on git preserving the mode.
+- Preserve the semantics the inline payload had. These were all `"\n"`-joined
+ strings, which ran **without** `set -e`: the step's exit code was the last
+ command's, and an intermediate failure did not stop the step. Keep it that
+ way unless you mean to change it, and say so if you do.
+- Values that belong to the release — the vendored pin SHA above all — stay in
+ the `.js` beside the comment block that documents them and arrive here as
+ arguments. Never inline a SHA in this directory.
+- `{{cwd}}` is substituted by Pinokio in the *message*, so anything path-shaped
+ must be passed in as an argument rather than written here.
diff --git a/scripts/pinokio/h3_build_q8.sh b/scripts/pinokio/h3_build_q8.sh
new file mode 100644
index 0000000..9fe8382
--- /dev/null
+++ b/scripts/pinokio/h3_build_q8.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+# Build the reduced-RAM Q8 DiT locally, on the 48 GB-class Macs that need it.
+#
+# Lifted out of install_h3.js (595-char dispatch). See
+# scripts/pinokio/README.md.
+#
+# cwd : minimax-h3-mlx
+# $1 : the app root. `{{cwd}}` is substituted by Pinokio in the MESSAGE, so
+# it cannot appear in this file — it arrives as an argument.
+#
+# SEMANTICS: unchanged — one shell, no `set -e`, exit code from the last
+# command. Idempotent: the pack's own quant_config.json gates the re-run.
+#
+# WHY IT MATTERS: the Q8 pack halves the render peak (27.3 vs 42.8 GiB
+# measured), which is what makes H3 possible on this class of machine at all —
+# and the panel's `h3_capable()` returns False on a sub-60 GB Mac until this
+# pack EXISTS ON DISK, so a 48 GB Mac with no pack gets no Engine switcher.
+# quantize_stream.py never holds more than one tensor (CPU stream,
+# deterministic), so the build runs fine on the same 48 GB machine that could
+# never load the model whole. ~22 GB on disk, ~5 min.
+#
+# 64 GB+ Macs skip it: bf16 is the quality default there, and the panel can
+# build the pack later from Settings if the user wants the low-RAM mode.
+
+APP_ROOT="$1"
+if [ -z "$APP_ROOT" ]; then
+ echo 'h3_build_q8.sh: no app root passed - skipping the Q8 build'
+ exit 2
+fi
+
+MEM_BYTES=$(sysctl -n hw.memsize 2>/dev/null)
+PACK="$APP_ROOT/mlx_models/hailuo-h3/models/h3-dit-q8"
+SRC="$APP_ROOT/mlx_models/hailuo-h3/models/deepbeep-pruned-bf16/MiniMax-H3-FL2VA-pruned_bf16.safetensors"
+if [ -f "$PACK/quant_config.json" ]; then
+ echo 'Q8 engine already built - skipping'
+elif echo "$MEM_BYTES" | grep -qE '^[0-9]+$' && [ "$MEM_BYTES" -lt 60000000000 ]; then
+ echo '=== Building the reduced-RAM Q8 engine (~5 min, one time) ==='
+ .venv/bin/python scripts/quantize_stream.py --src "$SRC" --out "$PACK"
+else
+ echo '64 GB-class Mac - bf16 engine is the default, Q8 not built'
+fi
diff --git a/scripts/pinokio/h3_preflight.sh b/scripts/pinokio/h3_preflight.sh
new file mode 100644
index 0000000..42d5239
--- /dev/null
+++ b/scripts/pinokio/h3_preflight.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+# Hailuo H3 memory preflight — refuse the 75 GB download on a Mac that can
+# never render with it.
+#
+# Lifted out of install_h3.js (845-char dispatch — the whole if/else is one
+# "\n"-joined string, so it was one write to the pty). See
+# scripts/pinokio/README.md.
+#
+# cwd : the app root
+#
+# SEMANTICS: unchanged — one shell, no `set -e`, one deliberate `exit 1`.
+# The `echo 'free disk space:' && df -h .` that followed it stays in
+# install_h3.js as its own array element (its own shell, ~25 chars).
+#
+# FAIL-OPEN BY DESIGN: if sysctl is missing or unparseable we PROCEED. A
+# preflight that can't read the hardware must never be the thing that blocks an
+# otherwise-fine install. The floor is 46e9 bytes, not 48 — a 48 GB Mac reports
+# ~47.x GB after firmware reservations. Keep this number in sync with
+# `H3_MIN_BYTES` in pinokio.js and `H3_MIN_RAM_GB_Q8` in mlx_ltx_panel.py.
+
+MEM_BYTES=$(sysctl -n hw.memsize 2>/dev/null)
+if echo "$MEM_BYTES" | grep -qE '^[0-9]+$' && [ "$MEM_BYTES" -lt 46000000000 ]; then
+ MEM_GB=$((MEM_BYTES / 1000000000))
+ echo '=================================================================='
+ echo "HAILUO H3 NEEDS AT LEAST A 48 GB MAC (this Mac has ${MEM_GB} GB)"
+ echo 'Even the reduced-RAM Q8 engine peaks around 27 GiB while rendering;'
+ echo 'below 48 GB it swaps and a 3-second clip takes hours.'
+ echo 'Nothing was downloaded. Keep using the built-in LTX-2.3 engine.'
+ echo '=================================================================='
+ exit 1
+elif [ "$MEM_BYTES" -lt 60000000000 ]; then
+ echo 'H3 memory preflight OK - 48 GB class: the reduced-RAM Q8 engine'
+ echo 'will be built locally after the weights download (adds ~5 min).'
+else
+ echo 'H3 memory preflight OK'
+fi
diff --git a/scripts/pinokio/ltx_venv.sh b/scripts/pinokio/ltx_venv.sh
new file mode 100644
index 0000000..507c4a4
--- /dev/null
+++ b/scripts/pinokio/ltx_venv.sh
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+# Force a Python 3.11 venv for the LTX engine, self-healing.
+#
+# THIS IS THE STEP THAT HUNG PINOKIO (#50 reopened by @davidaircloud, #56 by
+# @itrejomx). Its joined dispatch was 1,417 chars — @davidaircloud measured
+# exactly that number on 3.8.0 and fixed his own install by doing precisely
+# what this file does. Every individual line was already short; that was never
+# what mattered. See scripts/pinokio/README.md.
+#
+# cwd : ltx-2-mlx
+#
+# SEMANTICS: the original was a "\n"-joined string message, so it ran WITHOUT
+# `set -e` and the step's exit code was the LAST command's. Preserved here —
+# no `set -e`, same line order, same final command. The only intentional exit
+# is the macOS preflight's `exit 1`.
+#
+# WHY IT IS NOT GATED ON `when: !exists(env)`. `uv venv` builds the interpreter
+# as a symlink chain into Pinokio's SHARED managed Python:
+# env/bin/python3.11 -> python
+# env/bin/python -> <pinokio>/cache/XDG_DATA_HOME/uv/python/
+# cpython-3.11-macos-aarch64-none/bin/python3.11
+# That target is Pinokio's, not ours. Any other pack install — or any other
+# Pinokio app — that makes uv re-resolve, bump or prune the managed interpreter
+# leaves the chain DANGLING while env/ still exists. A path-existence guard
+# cannot handle that state: depending on whether it stats the link or its
+# target, a dangling chain reads as present (rebuild silently skipped, broken
+# venv that re-running Install can never fix) or absent. So we ask the only
+# question that matters — does the interpreter RUN? — and rebuild when it
+# doesn't. `python3.11` specifically, not `python`: a legacy conda-3.10 venv
+# has a working `python` and no `python3.11`, and 3.11 is the exact interpreter
+# every later step invokes. Healthy installs pay ~50 ms; broken ones rebuild in
+# ~5 min with zero re-downloads.
+
+echo '=== LTX venv check ==='
+if env/bin/python3.11 -c 'import sys' >/dev/null 2>&1; then
+echo 'venv healthy - reusing it'
+else
+echo 'venv missing or broken (wrong Python or dangling interpreter) - rebuilding, no models are re-downloaded'
+echo '=== install diagnostics: venv create ==='
+# SHIP-BLOCKER GUARD (2026-07-23, from @hottboytank's Pinokio report): mlx
+# 0.31.1 publishes NO macOS-13 wheel — its builds start at macosx_14_0_arm64.
+# On Ventura the mlx step dies deep inside uv's resolver and the user only sees
+# a cryptic ModuleNotFoundError at the very end. Fail fast, with the real fix.
+# FAIL-OPEN BY DESIGN: only block when we positively identify a macOS major
+# < 14. If sw_vers is missing, unparseable or non-numeric, we PROCEED — a
+# preflight that can't read the version must never brick an otherwise-fine
+# install.
+MACOS_VER=$(sw_vers -productVersion 2>/dev/null)
+MACOS_MAJOR=$(echo "$MACOS_VER" | cut -d. -f1)
+if echo "$MACOS_MAJOR" | grep -qE '^[0-9]+$' && [ "$MACOS_MAJOR" -lt 14 ]; then
+ echo '=================================================================='
+ echo "PHOSPHENE CANNOT INSTALL ON macOS $MACOS_VER"
+ echo 'Phosphene needs macOS 14 (Sonoma) or newer.'
+ echo 'Why: mlx 0.31.1 ships no macOS 13 build, so the engine cannot install'
+ echo 'and every generation would fail.'
+ echo 'Fix: System Settings > General > Software Update -> macOS 14 or 15,'
+ echo 'then reinstall Phosphene.'
+ echo '=================================================================='
+ exit 1
+else
+ echo "macOS preflight OK (detected '$MACOS_VER', needs >= 14)"
+fi
+which uv && uv --version || echo 'uv NOT FOUND'
+which python3.11 && python3.11 --version || echo 'system python3.11 NOT FOUND (uv will try to fetch)'
+uname -a
+echo '=== /diagnostics ==='
+rm -rf env
+uv venv --python 3.11 --seed env
+echo '=== venv created ==='
+ls -la env/bin/python* 2>&1 || echo 'venv create FAILED'
+env/bin/python --version || echo 'venv python NOT executable'
+fi
diff --git a/scripts/pinokio/mflux_pack.sh b/scripts/pinokio/mflux_pack.sh
new file mode 100644
index 0000000..00c6227
--- /dev/null
+++ b/scripts/pinokio/mflux_pack.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+# Install the mflux image-engine pack (Ideogram 4 + Qwen-Edit).
+#
+# Lifted out of install.js (529-char dispatch). See scripts/pinokio/README.md.
+# update.js keeps its own slightly different copy inline — that one is 498 and
+# under the ceiling; do not "tidy" it into this file without re-reading both.
+#
+# cwd : the app root
+#
+# SEMANTICS: was a "\n"-joined string carrying its own `\` continuations, i.e.
+# ONE compound command with a trailing `|| echo WARN`. BEST-EFFORT by design —
+# a pip hiccup must not fail the core video install; the panel surfaces a
+# one-click "Reinstall image engines" path if this didn't land. Preserved
+# exactly: same subshell, same `||`, no `set -e`.
+#
+# uv, NOT plain pip: mlx-vlm is installed --no-deps (to dodge its PIL>=10 / av
+# pins), which leaves its declared extras permanently unsatisfied. Plain
+# `pip install` then dumps a scary "ERROR: pip's dependency resolver…" block
+# about mlx-vlm on EVERY later install — verified, and it made cocktailpeanut's
+# update look broken. Worse, on v3.8.1 that block ENDED the Pinokio run early
+# and silently skipped every remaining step (the v3.8.2 truncation bug).
+#
+# Two-step (with-deps, then --reinstall --no-deps) mirrors install_qwen.js so
+# transitive deps resolve first and the version is then locked, after which the
+# FBCache patch is applied.
+
+echo 'Installing the mflux image-engine pack (Ideogram 4 + Qwen-Edit)…' && \
+( uv pip install --python ./ltx-2-mlx/env/bin/python 'mflux==0.18.0' && \
+ uv pip install --python ./ltx-2-mlx/env/bin/python --reinstall --no-deps 'mflux==0.18.0' && \
+ uv pip install --python ./ltx-2-mlx/env/bin/python 'mlx-teacache==0.4.1' && \
+ ./ltx-2-mlx/env/bin/python3.11 patch_mflux_fbcache.py ) \
+|| echo 'WARN: mflux image-engine install hit an error — video still works; use the Reinstall image engines action to retry image generation.'