Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: correct the H3 CUDA runner's ffmpeg gate, offload profile and install banner
[._.]/ Adam Eivya0212db55584
diff --git a/.changelog/next/added-agent-2b7be877.md b/.changelog/next/added-agent-2b7be877.mdindex a4d1cb58d9..798d64ea2b 100644--- a/.changelog/next/added-agent-2b7be877.md+++ b/.changelog/next/added-agent-2b7be877.md@@ -1 +1 @@-- MiniMax H3 video generation now runs on Windows/Linux with an NVIDIA GPU, through diffusers' MiniMaxH3ModularPipeline. The macOS list has had H3 since #242, but it runs on PipeNetwork's Apple-Silicon MLX port, so an NVIDIA box had no H3 path at all — the Windows video catalog held exactly one model (LTX-Video 0.9.5). A new `minimax_h3_cuda` BYOV runtime (`~/.portos/minimax-h3-cuda`, installed from Video Gen or `INSTALL_MINIMAX_H3_CUDA=1 bash scripts/setup-image-video.sh`) plus a `MiniMax H3 CUDA int8` model entry bring the same joint video+audio model, the same 768px 32-aligned canvas, the same fl2va first/last keyframe anchoring and the same license gate to the Windows list. Weights are ~144 GB, rendering needs ~24 GB VRAM and ~75 GB of system RAM for offloaded weights, and the runner picks its offload recipe from the card's own VRAM (bf16 auto-offload at 60 GB+, int8 + streamed block offload at 20 GB+, int8 + leaf-level below).+- MiniMax H3 video generation now runs on Windows with an NVIDIA GPU, through diffusers' MiniMaxH3ModularPipeline. The macOS list has had H3 since #242, but it runs on PipeNetwork's Apple-Silicon MLX port, so an NVIDIA box had no H3 path at all — the Windows video catalog held exactly one model (LTX-Video 0.9.5). A new `minimax_h3_cuda` BYOV runtime (`~/.portos/minimax-h3-cuda`, installed from Video Gen or `INSTALL_MINIMAX_H3_CUDA=1 bash scripts/setup-image-video.sh`) plus a `MiniMax H3 CUDA int8` model entry bring the same joint video+audio model, the same 768px 32-aligned canvas, the same fl2va first/last keyframe anchoring and the same license gate to the Windows list. Weights are ~144 GB, rendering needs ~24 GB VRAM and a 96 GB-RAM host (~75 GB of the weights stay resident off-GPU for the whole render), and the runner picks its offload recipe from the card's own VRAM (bf16 auto-offload at 60 GB+, int8 + streamed block offload at 20 GB+, int8 + leaf-level below).diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsxindex 915567a49f..b3cbe2a6cb 100644--- a/client/src/pages/VideoGen.jsx+++ b/client/src/pages/VideoGen.jsx@@ -820,7 +820,7 @@ export default function VideoGen() {<div className="rounded-lg border border-port-warning/40 bg-port-warning/10 px-3 py-3 text-xs text-port-warning flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2"><div><strong className="font-semibold">{byovStatus.label}</strong> {byovStatus.upgradeAvailable ? 'has an update available.' : "isn't installed yet."}- {' '}PortOS can {byovStatus.upgradeAvailable ? 'upgrade' : 'fetch and install'} it from {byovStatus.repoUrl?.replace('https://', '')} on demand.+ {' '}PortOS can {byovStatus.upgradeAvailable ? 'upgrade' : 'fetch and install'} it from {byovStatus.installSourceLabel || byovStatus.repoUrl?.replace('https://', '')} on demand.</div><buttontype="button"diff --git a/scripts/generate_minimax_h3.py b/scripts/generate_minimax_h3.pyindex 84e9134b9d..9ce2966400 100644--- a/scripts/generate_minimax_h3.py+++ b/scripts/generate_minimax_h3.py@@ -17,6 +17,7 @@ import argparseimport jsonimport osimport re+import shutilimport subprocessimport sysfrom contextlib import redirect_stdoutdiff --git a/scripts/generate_minimax_h3.test.js b/scripts/generate_minimax_h3.test.jsindex c6fe23ca2a..69008aaf9b 100644--- a/scripts/generate_minimax_h3.test.js+++ b/scripts/generate_minimax_h3.test.js@@ -94,21 +94,18 @@ describe.skipIf(!pyBin)('generate_minimax_h3.py', () => {// takes H3's full documented 4-15s range, where the diffusers CUDA runner is// narrower. Everything else on the grid (fps, the 32px canvas, the 17n+5 step,// anchoring) is shared, and asserted once in _minimax_h3_common.test.js.- it.each([107, 124, 362])('accepts the MLX window's %i-frame grid point', (frames) => {- const output = runPython(`${importRunner}-${[+ it.each([107, 124, 362])('accepts the %i-frame grid point inside the MLX window', (frames) => {+ const output = runPython(`${importRunner}\n${['from types import SimpleNamespace',argsExpr({ width: 1536, height: 672, num_frames: frames }),'runner.validate_args(args)','print("ok")',- ].join('-')}`);+ ].join('\n')}`);expect(output.trim()).toBe('ok');});it('rejects a frame count outside the MLX window', () => {- const output = runPython(`${importRunner}-${[+ const output = runPython(`${importRunner}\n${['from types import SimpleNamespace',argsExpr({ width: 1536, height: 672, num_frames: 90 }),'try:',@@ -117,8 +114,7 @@ ${[' print(str(exc))','else:',' raise SystemExit("an out-of-window frame count was accepted")',- ].join('-')}`);+ ].join('\n')}`);expect(output).toMatch(/approximately 4-15 seconds \(107-362 aligned frames\)/i);});diff --git a/scripts/generate_minimax_h3_cuda.py b/scripts/generate_minimax_h3_cuda.pyindex cba144bdcc..94b780933e 100644--- a/scripts/generate_minimax_h3_cuda.py+++ b/scripts/generate_minimax_h3_cuda.py@@ -33,7 +33,7 @@ from pathlib import Pathsys.path.insert(0, str(Path(__file__).resolve().parent))from _runner_common import emit_runtime_fingerprint, heartbeat # noqa: E402from _minimax_h3_common import ( # noqa: E402- FPS, emit_result, load_keyframes, require_ffmpeg, resolve_cached_snapshot,+ FPS, emit_result, load_keyframes, resolve_cached_snapshot,validate_h3_output_args,)@@ -41,8 +41,8 @@ from _minimax_h3_common import ( # noqa: E402# The diffusers integration snaps `num_frames` up to the next 17n+5 the video# VAE can decode and then requires the RESULTING duration to land in 5-15 s.# That is narrower than the MLX port's 4-15 s at both ends, so these bounds are-# deliberately not shared with generate_minimax_h3.py — see the frameOptions-# note on MINIMAX_H3_CUDA_PROFILE in server/lib/mediaModels.js.+# deliberately not shared with generate_minimax_h3.py — the matching list is+# MINIMAX_H3_CUDA_FRAME_OPTIONS in server/lib/mediaModels.js.MIN_FRAMES = 124 # first 17n+5 grid point at or above 5 secondsMAX_FRAMES = 345 # last 17n+5 grid point at or below 15 secondsOFFLOAD_PROFILES = ("auto", "bf16", "int8-stream", "int8-lean")@@ -229,7 +229,12 @@ def main() -> int:except OSError:pass- require_ffmpeg()+ # No ffmpeg preflight here, unlike the MLX runner: that one shells out to the+ # binary to mux, while this one muxes in-process through diffusers'+ # encode_video(), which is backed by the pinned PyAV wheel. Gating on+ # `shutil.which("ffmpeg")` would fail every render on a box where PortOS+ # itself is happy — server/lib/ffmpeg.js deliberately falls back to+ # C:\ffmpeg\bin and Program Files rather than requiring it on PATH.# Resolve the cache BEFORE importing torch. The lookups are pure# huggingface_hub path arithmetic against a pinned commit — no network, nodiff --git a/server/lib/mediaModels.js b/server/lib/mediaModels.jsindex a030b6d78b..98e074369a 100644--- a/server/lib/mediaModels.js+++ b/server/lib/mediaModels.js@@ -22,6 +22,12 @@* integrity-verify and repair paths all fan out from the same* `modelDownloadTargets()` in routes/videoGen.js and would otherwise pull* and checksum the lot.+ * `offloadProfile` (optional, `minimax_h3_cuda` only) pins the weight+ * offload recipe to one of `auto` / `bf16` / `int8-stream` / `int8-lean`+ * instead of letting the runner size one from the card's own VRAM. Left+ * absent on the shipped entry deliberately: the registry syncs between+ * peers and cannot know what GPU is on the other end. Validated in+ * services/videoGen/local.js against MINIMAX_H3_CUDA_OFFLOAD_PROFILES.* `disclosure` is optional provenance/licensing metadata (issue #3674):* { modelCardUrl?, weightsLicense?: { name, url }, runtimeLicense?: { name, url },* estimatedDownloadGb?, reviewedAt? }. Every key is optional and andiff --git a/server/routes/videoGen.js b/server/routes/videoGen.jsindex 2d855a5619..2b4e7b2b4a 100644--- a/server/routes/videoGen.js+++ b/server/routes/videoGen.js@@ -431,6 +431,7 @@ router.get('/setup/runtime-status', asyncHandler(async (req, res) => {venvPath: info.venvPython,repoDir: info.repoDir,repoUrl: info.repoUrl,+ installSourceLabel: info.installSourceLabel,installEnvVar: info.installEnvVar,});}));diff --git a/server/routes/videoGen.test.js b/server/routes/videoGen.test.jsindex 91ded86239..1b86a2b8c8 100644--- a/server/routes/videoGen.test.js+++ b/server/routes/videoGen.test.js@@ -96,6 +96,13 @@ vi.mock('../services/videoGen/local.js', () => ({expectedRevision: 'fcd9e9b79a1d6018d91ac477c0968de1fa067e49',repoUrl: 'x', repoDir: '/tmp',},+ // No `expectedRevision`: this runtime is installed wheels, not a checkout,+ // which is why it carries an installSourceLabel instead of a clone URL.+ minimax_h3_cuda: {+ id: 'minimax_h3_cuda', label: 'MiniMax H3 CUDA', venvPython: '/tmp/minimax-h3-cuda.py',+ installEnvVar: 'INSTALL_MINIMAX_H3_CUDA', repoUrl: 'x', repoDir: '/tmp',+ installSourceLabel: 'pinned PyPI wheels',+ },ltx2: { id: 'ltx2', label: 'LTX-2 MLX', venvPython: '/tmp/ltx2.py', installEnvVar: 'INSTALL_LTX2', repoUrl: 'x', repoDir: '/tmp' },wan22: {id: 'wan22', label: 'Wan 2.2 MLX', venvPython: '/tmp/wan22.py',@@ -389,6 +396,20 @@ describe('videoGen routes', () => {});expect(videoGenService.isByovRuntimeReady).not.toHaveBeenCalled();});++ // The install banner renders "PortOS can fetch and install it from X". For a+ // runtime that clones its repoUrl, X is that URL; for minimax_h3_cuda the+ // repoUrl is DOCUMENTATION (there is no checkout, only a venv), so the label+ // has to reach the client or the banner tells the user PortOS downloads the+ // runtime from a docs page.+ it.each([+ ['wan22', undefined],+ ['minimax_h3_cuda', 'pinned PyPI wheels'],+ ])('surfaces the install source label for %s', async (runtime, expected) => {+ const r = await request(app).get(`/api/video-gen/setup/runtime-status?runtime=${runtime}`);+ expect(r.status).toBe(200);+ expect(r.body.installSourceLabel).toBe(expected);+ });});describe('GET /setup/runtime-install', () => {diff --git a/server/services/videoGen/local.js b/server/services/videoGen/local.jsindex 91aa4999b1..f1ee22b96e 100644--- a/server/services/videoGen/local.js+++ b/server/services/videoGen/local.js@@ -64,6 +64,7 @@ import {MINIMAX_H3_EXPECTED_REVISION,MINIMAX_H3_CUDA_VENV_PYTHON,MINIMAX_H3_CUDA_HELPER_SCRIPT,+ MINIMAX_H3_CUDA_OFFLOAD_PROFILES,HUNYUAN_VENV_PYTHON,HUNYUAN_HELPER_SCRIPT,HUNYUAN_REPO_DIR,@@ -776,8 +777,19 @@ const buildMiniMaxH3CudaArgs = ({ model, prompt, negativePrompt, width, height,// A user-pinned offload recipe from data/media-models.json. Omitted, the// helper sizes one from the card's own VRAM — the right default, since the// registry entry is shared across every install that syncs it and can't know- // what GPU is on the other end.- if (model.offloadProfile) args.push('--offload-profile', String(model.offloadProfile));+ // what GPU is on the other end. Validated here rather than left to the+ // helper's `choices=`: argparse would reject a typo as an opaque non-zero+ // child exit, well after the render was queued.+ if (model.offloadProfile !== undefined && model.offloadProfile !== null && model.offloadProfile !== '') {+ if (!MINIMAX_H3_CUDA_OFFLOAD_PROFILES.includes(model.offloadProfile)) {+ throw new ServerError(+ `MiniMax H3 model "${model.id}" declares an unknown offloadProfile "${model.offloadProfile}"; `+ + `expected one of ${MINIMAX_H3_CUDA_OFFLOAD_PROFILES.join(', ')}.`,+ { status: 500, code: 'VIDEO_MODEL_MISCONFIGURED' },+ );+ }+ args.push('--offload-profile', model.offloadProfile);+ }// Anchor order is packed order, same as the MLX lane: diffusers takes the// first keyframe as `image` (which sets the canvas) and the last as// `last_image`, so a first-frame image must lead.diff --git a/server/services/videoGen/local.test.js b/server/services/videoGen/local.test.jsindex 4919312435..f8f6481cba 100644--- a/server/services/videoGen/local.test.js+++ b/server/services/videoGen/local.test.js@@ -3579,6 +3579,63 @@ describe('generateVideo — MiniMax H3 CUDA contract', () => {expect(spawnDetached).not.toHaveBeenCalled();});+ // `offloadProfile` is an optional per-install override in data/media-models.json,+ // so it arrives unvalidated. The helper's argparse `choices=` would catch a typo+ // too, but only as an opaque non-zero child exit after the render was queued.+ it.each([+ ['int8-lean', true],+ ['bf16', true],+ ['int8-leaan', false],+ ])('validates a declared offloadProfile %j before spawning', async (profile, legal) => {+ const mediaModels = await import('../../lib/mediaModels.js');+ const { spawnDetached } = await import('../../lib/detachedSpawn.js');+ const getVideoModelsMock = vi.mocked(mediaModels.getVideoModels);+ const catalog = getVideoModelsMock();+ const spawnMock = vi.mocked(spawnDetached);+ spawnMock.mockClear();+ getVideoModelsMock.mockReturnValue(catalog.map((model) => (+ model.id === 'minimax_h3_cuda' ? { ...model, offloadProfile: profile } : model+ )));++ const render = () => generateVideo({+ jobId: `h3-cuda-offload-${profile}`,+ modelId: 'minimax_h3_cuda',+ prompt: 'a fox watches the rain',+ width: 1344, height: 768, numFrames: 141, fps: 24, mode: 'text',+ });++ try {+ if (!legal) {+ await expect(render()).rejects.toMatchObject({ code: 'VIDEO_MODEL_MISCONFIGURED' });+ expect(spawnDetached).not.toHaveBeenCalled();+ return;+ }+ await render();+ const [, args] = cudaCall(spawnMock);+ expect(args[args.indexOf('--offload-profile') + 1]).toBe(profile);+ } finally {+ getVideoModelsMock.mockReturnValue(catalog);+ }+ });++ // Absent is the shipped state: the registry syncs between peers and cannot+ // know what GPU is on the other end, so the helper sizes the recipe itself.+ it('omits --offload-profile entirely when the entry declares none', async () => {+ const { spawnDetached } = await import('../../lib/detachedSpawn.js');+ const spawnMock = vi.mocked(spawnDetached);+ spawnMock.mockClear();++ await generateVideo({+ jobId: 'h3-cuda-offload-default',+ modelId: 'minimax_h3_cuda',+ prompt: 'a fox watches the rain',+ width: 1344, height: 768, numFrames: 141, fps: 24, mode: 'text',+ });++ const [, args] = cudaCall(spawnMock);+ expect(args).not.toContain('--offload-profile');+ });+it('rejects the license gate from the install record, same as the MLX entry', async () => {const { spawnDetached } = await import('../../lib/detachedSpawn.js');vi.mocked(spawnDetached).mockClear();diff --git a/server/services/videoGen/runtimes.js b/server/services/videoGen/runtimes.jsindex 2c9f68bd18..b2d5294a35 100644--- a/server/services/videoGen/runtimes.js+++ b/server/services/videoGen/runtimes.js@@ -66,6 +66,12 @@ export const MINIMAX_H3_CUDA_VENV_PYTHON = process.platform === 'win32'? join(MINIMAX_H3_CUDA_REPO_DIR, '.venv', 'Scripts', 'python.exe'): join(MINIMAX_H3_CUDA_REPO_DIR, '.venv', 'bin', 'python3');export const MINIMAX_H3_CUDA_HELPER_SCRIPT = join(PATHS.root, 'scripts', 'generate_minimax_h3_cuda.py');+// Mirrors OFFLOAD_PROFILES in scripts/generate_minimax_h3_cuda.py. Kept in sync+// by hand — the helper's argparse `choices=` is the enforcement, this list is+// what lets the server reject a bad `offloadProfile` before queueing a render.+export const MINIMAX_H3_CUDA_OFFLOAD_PROFILES = Object.freeze([+ 'auto', 'bf16', 'int8-stream', 'int8-lean',+]);// HunyuanVideo MLX runtime — gaurav-nelson/HunyuanVideo_MLX cloned at// ~/.portos/hunyuan-video-mlx/. ~60 GB resident at bf16 so practical only@@ -136,6 +142,11 @@ export const BYOV_RUNTIME_INFO = Object.freeze({// is therefore the integration's documentation rather than a clone source —// there is no checkout under repoDir, only the venv.repoUrl: 'https://huggingface.co/docs/diffusers/main/en/api/pipelines/minimax_h3',+ // Because `repoUrl` is documentation here, the install banner must not say+ // PortOS fetches the runtime "from" it — this names what is actually+ // installed. Optional: a runtime that clones its repoUrl leaves it unset and+ // the banner falls back to the URL, which is accurate for those.+ installSourceLabel: 'pinned PyPI wheels',// Three things must hold before a render is even attempted, and each fails// as an unusable install rather than as a bad render: diffusers must carry// the H3 modular integration (merged to main after v0.39.0 and in no tagged