SolarRenderer: Few-Step Generative Reference Rendering
Python
Add a four-GPU Reactor Runtime integration and browser demo (#2)
Ruixing Zhang59ff5407ab5a
diff --git a/README.md b/README.mdindex efc287d..69f89b8 100644--- a/README.md+++ b/README.md@@ -80,6 +80,24 @@ Add `--causal` with the two causal LoRAs to stream the clip block by block- 🏋️ **Training** on one 8-GPU node ([guide](docs/training.md)).- 📊 **Benchmark scoring** ([guide](eval/README.md)).+## Inference with Reactor Runtime++The [Reactor integration](reactor/README.md) provides a streaming inference service+and a browser demo for a structure video, optional appearance reference, and prompt.+The guide includes four-B200 validation results and deployment limitations.+After preparing the licensed weights as described in that guide:++```bash+cd reactor+reactor build+reactor run --gpus device=0,1,2,3 --shm-size 8g --port 8080 --weights ./weights+```++Check `http://localhost:8080/health`, then run `cd reactor/demo && npm ci && npm run dev`+from another terminal at the repository root. Open http://localhost:5173, click+**Connect**, select your inputs, and click **Start new video**. See the integration+guide for SSH/WebRTC networking and the fixed-prompt, finite-video behavior.+## CitationIf you use SolarRenderer in your research, please cite SolarRenderer and SolarWM, the framework on which it is built.diff --git a/reactor/.dockerignore b/reactor/.dockerignorenew file mode 100644index 0000000..f5c8981--- /dev/null+++ b/reactor/.dockerignore@@ -0,0 +1,11 @@+__pycache__+.pytest_cache+.ruff_cache+tests+demo+assets+*.mp4+*.safetensors+*.pt+*.log+.venvdiff --git a/reactor/.gitignore b/reactor/.gitignorenew file mode 100644index 0000000..ab99dc9--- /dev/null+++ b/reactor/.gitignore@@ -0,0 +1,9 @@+__pycache__/+.pytest_cache/+.ruff_cache/+demo/node_modules/+demo/dist/+demo/.env.local+.venv/+weights/+schema.jsondiff --git a/reactor/NOTICE b/reactor/NOTICEnew file mode 100644index 0000000..b6eab81--- /dev/null+++ b/reactor/NOTICE@@ -0,0 +1,32 @@+SolarRenderer+Copyright 2026 SolarRenderer authors++The code in this repository is licensed under the Apache License, Version 2.0 (see LICENSE). It builds on the SolarWM+training framework (https://github.com/Junchao-cs/SolarWM, Apache-2.0).++--------------------------------------------------------------------------------+MiniMax-H3+--------------------------------------------------------------------------------++MiniMax H3 is licensed under the MiniMax H3 Community License Agreement, Copyright © 2026 MiniMax. All Rights Reserved.++SolarRenderer runs on MiniMax-H3, which is not distributed here; obtain it from its publisher+(https://huggingface.co/MiniMaxAI/MiniMax-H3) under its own license and Acceptable Use Policy.++--------------------------------------------------------------------------------+Third-party source included in this repository+--------------------------------------------------------------------------------++ PRoPE: Projective Positional Encoding for Multiview Transformers, MIT+ Copyright (c) the PRoPE authors.+ Adapted as src/solarwm/backends/minimax_h3/torch_prope.py.++Each adapted file keeps its upstream copyright header and states that it was modified.++--------------------------------------------------------------------------------+Evaluation dependencies (not included; fetched by eval/setup.sh)+--------------------------------------------------------------------------------++ DOVER (github.com/VQAssessment/DOVER), CoTracker3 (github.com/facebookresearch/co-tracker), the LAION aesthetic+ predictor (github.com/christophschuhmann/improved-aesthetic-predictor) and VideoScore2 (TIGER-Lab/VideoScore2) keep+ their own licenses; DOVER's is non-commercial.diff --git a/reactor/README.md b/reactor/README.mdnew file mode 100644index 0000000..03219a3--- /dev/null+++ b/reactor/README.md@@ -0,0 +1,181 @@+# SolarRenderer on Reactor++Render a recorded structure video with [SolarRenderer](https://github.com/Enderfga/SolarRenderer),+served through [Reactor Runtime](https://github.com/reactor-team/reactor-runtime).+Select a structure video, optionally supply an aligned appearance image, describe the scene,+and receive the rendered video in a small browser demo.++++**Validation status:** this four-B200 integration is a development preview.+The browser has completed ten generation blocks (158 frames) with and without+an appearance reference, including a forced TURN/TCP media path.+Observed steady blocks take about 1.8–2.1 seconds for 17 frames; preparing a new+video can take over a minute. This is below the native 24 FPS timeline.+Docker image execution remains unvalidated. FA4 and static-prefix caching change+floating-point results; the accelerated version is not bitwise identical to native inference.++## What the integration adds++- A Reactor service with explicit input selection, Start, Pause and Resume.+- Streaming output as completed video segments become available.+- A browser client using the official Reactor JavaScript SDK.+- Four-GPU sequence parallelism, FA4, modulation/text/static-prefix caching and parallel VAE decoding.+- Clickable example inputs and a side-by-side structure/render view.++The service uses the released causal four-step model. Each video contains 158 frames+and ends after ten generation blocks. Its native timeline is 24 FPS (about 6.58 seconds).+Runtime adapts playback to generation time. The measured generation rate+is substantially below the native 24 FPS timeline.++## What you need++- A license and deployment location permitted by the model's weight terms.+- A Linux GPU machine with Docker and NVIDIA Container Toolkit. The recipe was+ tested on four B200 GPUs on one host, with shared weights/scratch storage.+- The prepared MiniMax-H3 base and the two **causal** SolarRenderer LoRA files.+- Node.js 22.12+ and npm for the demo.++## 1. Install the Reactor CLI++Install the CLI using the [Reactor documentation](https://docs.reactor.inc/deploy).+Use a current CLI that supports `reactor run --shm-size`; older releases forward+unknown flags to Runtime. Check `reactor version` and `reactor run --help`.+Run the following commands from this directory.++## 2. Get the weights++Read the [weight license](https://huggingface.co/Enderfga/SolarRenderer/blob/main/LICENSE)+before downloading. Follow the authors' [setup and causal inference instructions](https://github.com/Enderfga/SolarRenderer/blob/main/docs/inference.md).+Use their `scripts/prepare_h3.py` to prepare the base and localize its component index.+Arrange the files under one directory:++```text+weights/+ MiniMax-H3/+ modular_model_index.json+ transformer_ref/+ text_encoder/+ processor/+ tokenizer/+ vae/+ ...+ solarrenderer_causal_control_lora.safetensors+ solarrenderer_causal_4step_lora.safetensors+```++Keep the prepared base at the same absolute path when mounting it into the container:+the localized component index refers to that path. The CLI's filesystem `--weights`+mount does this. The service does not automatically download or substitute checkpoints.++## 3. Start the model++```sh+reactor build+reactor run --gpus device=0,1,2,3 --shm-size 8g --port 8080 --weights ./weights+```++Select four available GPUs on a shared machine. In another terminal, check+`curl http://localhost:8080/health`. The service validates asset paths at startup;+the first **Start new video** performs encoding and loads the renderer. The original+text encoder and renderer use the GPU in sequence, so starting a new video has a+substantial preparation phase. Do not interpret HTTP readiness as first-frame readiness.++The manifest builds from YAML; no Dockerfile is needed. Rebuild after changing the+adapter. `Ctrl+C` stops the service started by this command.++## 4. Open the client++```sh+cd demo+npm ci+npm run dev -- --host 127.0.0.1+```++Vite reads the example inputs directly from this repository's+`examples/sem-highway_synthwave/` directory and includes them in production builds.+No sample path configuration is needed.++Open http://localhost:5173. The default Runtime address is http://localhost:8080;+set `VITE_RUNTIME_URL` before starting the demo to use another local endpoint.+Click **Connect**, choose **Synthwave Highway** to fill the official video, image+and prompt, then click **Start new video**. **Structure only** uses the same scene+without an appearance image and adjusts the prompt accordingly. You can also upload+your own inputs. File or example selection alone+does not run the model. No example or reference image is selected automatically.++The authors provide a matched [structure video, image and prompt](https://github.com/Enderfga/SolarRenderer/tree/main/examples/sem-highway_synthwave).+Use that complete set for the first comparison. Structure videos must cover at least+158 frames after native 24 FPS resampling; longer videos use the opening segment.+Landscape input produces 1344×768 output and portrait input 768×1344. The original+preprocessing center-fits the optional image to the selected canvas.++### Remote machines and SSH++Forward the HTTP and demo ports if running both on a remote machine:++```sh+ssh -L 8080:127.0.0.1:8080 -L 5173:127.0.0.1:5173 user@gpu-host+```++HTTP forwarding alone does not carry WebRTC media. Configure a supported TURN-over-TCP+relay and forward its TCP port as well, or use a network route that carries WebRTC.+Docker host networking alone does not make SSH forward UDP. Keep relay credentials+in deployment configuration; never put them in this repository. SSH/TURN media+connectivity has been exercised in a relay-only local browser. Validate your own+SSH tunnel and relay configuration before sharing the service.++## Controls++| Control | Effect |+| --- | --- |+| Structure video | Select the recorded motion and layout for the next video. |+| Appearance reference | Optionally constrain the opening appearance. |+| Rendering prompt / Seed | Captured when Start is pressed. |+| Start new video | Start a fresh finite video, replacing any current render. |+| Pause / Resume | Stop or continue at a generation boundary; buffered video may still play. |+| Disconnect | Close the demo's connection through the SDK. |++Commands take effect after the current generation block. The demo allows up to+180 seconds for their replies; a Pause during generation can take about 35 seconds,+and initial preparation can take longer. This changes the client wait limit, not+the model's generation speed.++Prompt edits apply to the **next video**. This first integration preserves the original+fixed text conditioning throughout each render; it does not advertise live prompt changes.+There are no driving keys or game-engine controls: motion is supplied by the uploaded video.+The decoder waits for the necessary temporal overlap before showing its first frames.++## Validation and code map++Run CPU application tests with `PYTHONPATH=. python -m pytest tests/ -q` and export+the client contract with `python -m reactor_runtime.schema --path . --out schema.json`.+`reactor validate` checks the manifest; `npm run build` in `demo/` checks the frontend.++`solarrenderer.py` owns client commands and output, `solarrenderer_types.py` defines+the public state, and `solarrenderer_model.py` owns the Runtime-independent step contract.+The backend reuses the pinned native encoder and LoRA loader. Sampling and decoder+helpers retain per-video state between calls. The build uses upstream revision+`a2371eaecff9a8ab378b5ec36199c5863d138074` and Reactor Runtime 3.8.3.++The CPU comparison exercises the original causal loop with small substitute computation:+four seed/reference combinations each run ten consecutive blocks with identical latent+values, random-generator state and final KV contents. Decoder-window tests cover five+lengths. The unaccelerated real-weight comparison uses the official example with a shared+native-encoded input and seed 0: all ten blocks have zero latent and decoded-RGB+difference before compression. This does not apply to the accelerated four-GPU+configuration: FA4 and static-prefix reuse produce numerical and local appearance+differences. Four denoising evaluations, the native history window and horizon+remain unchanged. Both input modes completed 158-frame browser runs.+The current file-based native encoder also re-reads validated uploads; moving preprocessing+fully into the application requires its own native-input equivalence check.++## Credits and licence++Thanks to [Rising0321](https://github.com/Rising0321) for the Reactor integration.+SolarRenderer and SolarWM remain the work of their original authors. The sampling and+decoder helpers derive from SolarRenderer's Apache-2.0 code; retain its attribution and+[NOTICE](https://github.com/Enderfga/SolarRenderer/blob/main/NOTICE).+Weights remain subject to the MiniMax H3 Community License, including territorial+restrictions. Please contact [[email protected]](mailto:[email protected]) with integration+feedback or collaboration ideas.diff --git a/reactor/assets/demo.png b/reactor/assets/demo.pngnew file mode 100644index 0000000..3e10fd5Binary files /dev/null and b/reactor/assets/demo.png differdiff --git a/reactor/demo/index.html b/reactor/demo/index.htmlnew file mode 100644index 0000000..08ff588--- /dev/null+++ b/reactor/demo/index.html@@ -0,0 +1,2 @@+<!doctype html>+<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>SolarRenderer on Reactor</title></head><body><div id="root"></div><script type="module" src="/src/main.tsx"></script></body></html>diff --git a/reactor/demo/package-lock.json b/reactor/demo/package-lock.jsonnew file mode 100644index 0000000..7471583--- /dev/null+++ b/reactor/demo/package-lock.json@@ -0,0 +1,975 @@+{+ "name": "solarrenderer-reactor-demo",+ "version": "0.1.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "solarrenderer-reactor-demo",+ "version": "0.1.0",+ "dependencies": {+ "@reactor-team/js-sdk": "3.2.0",+ "@reactor-team/ui": "1.4.1",+ "hls.js": "^1.6.15",+ "react": "19.1.0",+ "react-dom": "19.1.0"+ },+ "devDependencies": {+ "@types/node": "^22",+ "@types/react": "^19.1.0",+ "@types/react-dom": "^19.1.0",+ "typescript": "^5.9.3",+ "vite": "8.3.4"+ }+ },+ "node_modules/@oxc-project/types": {+ "version": "0.154.0",+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.154.0.tgz",+ "integrity": "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==",+ "dev": true,+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/oxc-project"+ }+ },+ "node_modules/@reactor-team/js-sdk": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/@reactor-team/js-sdk/-/js-sdk-3.2.0.tgz",+ "integrity": "sha512-ar7QJf50ChIO6I4VZqKtCuB7Ksu7/H1dq2HGKB5KE70q6rUOxVa4jzg2jJjPJUmUP/qjk0Hme8YL0RSfbNIvxw==",+ "license": "Apache-2.0",+ "dependencies": {+ "awaitqueue": "^3.3.1",+ "hls.js": "^1.6.0",+ "mp4box": "^2.4.1"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "react": "^18.0.0 || ^19.0.0"+ }+ },+ "node_modules/@reactor-team/ui": {+ "version": "1.4.1",+ "resolved": "https://registry.npmjs.org/@reactor-team/ui/-/ui-1.4.1.tgz",+ "integrity": "sha512-/05IYSlCqbvA+cj+Boz8/lQkeXpnMFKWvfxZeBvVxU2ePI8eCZ5Ey+1EKbUyuGiWPZ7QT7QeKtHcsrN1LN9hkQ==",+ "license": "MIT",+ "peerDependencies": {+ "react": ">=18.0.0",+ "react-dom": ">=18.0.0"+ }+ },+ "node_modules/@rolldown/binding-android-arm-eabi": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.14.tgz",+ "integrity": "sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-android-arm64": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.14.tgz",+ "integrity": "sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-darwin-arm64": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.14.tgz",+ "integrity": "sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-darwin-x64": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.14.tgz",+ "integrity": "sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-freebsd-x64": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.14.tgz",+ "integrity": "sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-arm-gnueabihf": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.14.tgz",+ "integrity": "sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-arm64-gnu": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.14.tgz",+ "integrity": "sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-arm64-musl": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.14.tgz",+ "integrity": "sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-ppc64-gnu": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.14.tgz",+ "integrity": "sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-s390x-gnu": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.14.tgz",+ "integrity": "sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-x64-gnu": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.14.tgz",+ "integrity": "sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-x64-musl": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.14.tgz",+ "integrity": "sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-openharmony-arm64": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.14.tgz",+ "integrity": "sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-win32-arm64-msvc": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.14.tgz",+ "integrity": "sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-win32-x64-msvc": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.14.tgz",+ "integrity": "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/pluginutils": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",+ "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/node": {+ "version": "22.20.5",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz",+ "integrity": "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "undici-types": "~6.21.0"+ }+ },+ "node_modules/@types/react": {+ "version": "19.3.0",+ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",+ "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "csstype": "^3.2.2"+ }+ },+ "node_modules/@types/react-dom": {+ "version": "19.3.0",+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz",+ "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==",+ "dev": true,+ "license": "MIT",+ "peerDependencies": {+ "@types/react": "^19.3.0"+ }+ },+ "node_modules/awaitqueue": {+ "version": "3.3.1",+ "resolved": "https://registry.npmjs.org/awaitqueue/-/awaitqueue-3.3.1.tgz",+ "integrity": "sha512-kzMN6Bdfalok/JWZvwDfI704cIyCvHDi6Ez/bApGzNPjGHQhwJ07DzGd3DDzeXH2fjr9P5g8paESFUvYnbs7rA==",+ "license": "ISC",+ "dependencies": {+ "debug": "^4.4.3"+ },+ "engines": {+ "node": ">=22"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mediasoup"+ }+ },+ "node_modules/csstype": {+ "version": "3.2.3",+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/detect-libc": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/fdir": {+ "version": "6.5.0",+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12.0.0"+ },+ "peerDependencies": {+ "picomatch": "^3 || ^4"+ },+ "peerDependenciesMeta": {+ "picomatch": {+ "optional": true+ }+ }+ },+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },+ "node_modules/hls.js": {+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.7.3.tgz",+ "integrity": "sha512-MsPlx6yVW4Qv4C7mEVou4/gk/5cN2dVxOTnrNjPSmyH2f0Ln+/UkG10Ax1PE6OvrmTVPKgQYozTtBaPOuCzq7A==",+ "license": "Apache-2.0"+ },+ "node_modules/lightningcss": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",+ "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",+ "dev": true,+ "license": "MPL-2.0",+ "dependencies": {+ "detect-libc": "^2.0.3"+ },+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ },+ "optionalDependencies": {+ "lightningcss-android-arm64": "1.33.0",+ "lightningcss-darwin-arm64": "1.33.0",+ "lightningcss-darwin-x64": "1.33.0",+ "lightningcss-freebsd-x64": "1.33.0",+ "lightningcss-linux-arm-gnueabihf": "1.33.0",+ "lightningcss-linux-arm64-gnu": "1.33.0",+ "lightningcss-linux-arm64-musl": "1.33.0",+ "lightningcss-linux-x64-gnu": "1.33.0",+ "lightningcss-linux-x64-musl": "1.33.0",+ "lightningcss-win32-arm64-msvc": "1.33.0",+ "lightningcss-win32-x64-msvc": "1.33.0"+ }+ },+ "node_modules/lightningcss-android-arm64": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",+ "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-darwin-arm64": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",+ "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-darwin-x64": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",+ "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-freebsd-x64": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",+ "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-arm-gnueabihf": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",+ "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-arm64-gnu": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",+ "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-arm64-musl": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",+ "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-x64-gnu": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",+ "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-x64-musl": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",+ "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-win32-arm64-msvc": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",+ "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-win32-x64-msvc": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",+ "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/mp4box": {+ "version": "2.4.1",+ "resolved": "https://registry.npmjs.org/mp4box/-/mp4box-2.4.1.tgz",+ "integrity": "sha512-0HGX7nXoDIX6FKLVl4a3wtYjBlwqsN3xuQC3GXzNtKp98FXUOhDSq623azsz8DG5ptd9ZXcXodDkgbdMZOjWvw==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=20.8.1"+ }+ },+ "node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/nanoid": {+ "version": "3.3.20",+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "bin": {+ "nanoid": "bin/nanoid.cjs"+ },+ "engines": {+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"+ }+ },+ "node_modules/picocolors": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/picomatch": {+ "version": "4.0.7",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/postcss": {+ "version": "8.5.30",+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.30.tgz",+ "integrity": "sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "nanoid": "^3.3.20",+ "picocolors": "^1.1.1",+ "source-map-js": "^1.2.2"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },+ "node_modules/react": {+ "version": "19.1.0",+ "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz",+ "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/react-dom": {+ "version": "19.1.0",+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz",+ "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==",+ "license": "MIT",+ "dependencies": {+ "scheduler": "^0.26.0"+ },+ "peerDependencies": {+ "react": "^19.1.0"+ }+ },+ "node_modules/rolldown": {+ "version": "1.2.14",+ "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.14.tgz",+ "integrity": "sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@oxc-project/types": "=0.154.0",+ "@rolldown/pluginutils": "^1.0.0"+ },+ "bin": {+ "rolldown": "bin/cli.mjs"+ },+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ },+ "optionalDependencies": {+ "@rolldown/binding-android-arm-eabi": "1.2.14",+ "@rolldown/binding-android-arm64": "1.2.14",+ "@rolldown/binding-darwin-arm64": "1.2.14",+ "@rolldown/binding-darwin-x64": "1.2.14",+ "@rolldown/binding-freebsd-x64": "1.2.14",+ "@rolldown/binding-linux-arm-gnueabihf": "1.2.14",+ "@rolldown/binding-linux-arm64-gnu": "1.2.14",+ "@rolldown/binding-linux-arm64-musl": "1.2.14",+ "@rolldown/binding-linux-ppc64-gnu": "1.2.14",+ "@rolldown/binding-linux-s390x-gnu": "1.2.14",+ "@rolldown/binding-linux-x64-gnu": "1.2.14",+ "@rolldown/binding-linux-x64-musl": "1.2.14",+ "@rolldown/binding-openharmony-arm64": "1.2.14",+ "@rolldown/binding-win32-arm64-msvc": "1.2.14",+ "@rolldown/binding-win32-x64-msvc": "1.2.14"+ }+ },+ "node_modules/scheduler": {+ "version": "0.26.0",+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz",+ "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==",+ "license": "MIT"+ },+ "node_modules/source-map-js": {+ "version": "1.2.2",+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",+ "dev": true,+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/tinyglobby": {+ "version": "0.2.17",+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fdir": "^6.5.0",+ "picomatch": "^4.0.4"+ },+ "engines": {+ "node": ">=12.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/SuperchupuDev"+ }+ },+ "node_modules/typescript": {+ "version": "5.9.3",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "tsc": "bin/tsc",+ "tsserver": "bin/tsserver"+ },+ "engines": {+ "node": ">=14.17"+ }+ },+ "node_modules/undici-types": {+ "version": "6.21.0",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/vite": {+ "version": "8.3.4",+ "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.4.tgz",+ "integrity": "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "lightningcss": "^1.33.0",+ "picomatch": "^4.0.7",+ "postcss": "^8.5.29",+ "rolldown": "~1.2.12",+ "tinyglobby": "^0.2.17"+ },+ "bin": {+ "vite": "bin/vite.js"+ },+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ },+ "funding": {+ "url": "https://github.com/vitejs/vite?sponsor=1"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.3"+ },+ "peerDependencies": {+ "@types/node": "^20.19.0 || >=22.12.0",+ "@vitejs/devtools": "^0.7.1",+ "esbuild": "^0.27.0 || ^0.28.0",+ "jiti": ">=1.21.0",+ "less": "^4.0.0",+ "sass": "^1.70.0",+ "sass-embedded": "^1.70.0",+ "stylus": ">=0.54.8",+ "sugarss": "^5.0.0",+ "terser": "^5.16.0",+ "tsx": "^4.8.1",+ "yaml": "^2.4.2"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ },+ "@vitejs/devtools": {+ "optional": true+ },+ "esbuild": {+ "optional": true+ },+ "jiti": {+ "optional": true+ },+ "less": {+ "optional": true+ },+ "sass": {+ "optional": true+ },+ "sass-embedded": {+ "optional": true+ },+ "stylus": {+ "optional": true+ },+ "sugarss": {+ "optional": true+ },+ "terser": {+ "optional": true+ },+ "tsx": {+ "optional": true+ },+ "yaml": {+ "optional": true+ }+ }+ }+ }+}diff --git a/reactor/demo/package.json b/reactor/demo/package.jsonnew file mode 100644index 0000000..3c73705--- /dev/null+++ b/reactor/demo/package.json@@ -0,0 +1,9 @@+{+ "name": "solarrenderer-reactor-demo",+ "version": "0.1.0",+ "private": true,+ "type": "module",+ "scripts": {"dev": "vite", "build": "tsc --noEmit && vite build"},+ "dependencies": {"@reactor-team/js-sdk": "3.2.0", "@reactor-team/ui": "1.4.1", "react": "19.1.0", "react-dom": "19.1.0", "hls.js": "^1.6.15"},+ "devDependencies": {"@types/node": "^22", "@types/react": "^19.1.0", "@types/react-dom": "^19.1.0", "typescript": "^5.9.3", "vite": "8.3.4"}+}diff --git a/reactor/demo/public/examples/highway/LICENSE b/reactor/demo/public/examples/highway/LICENSEnew file mode 100644index 0000000..261eeb9--- /dev/null+++ b/reactor/demo/public/examples/highway/LICENSE@@ -0,0 +1,201 @@+ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.diff --git a/reactor/demo/public/examples/highway/NOTICE b/reactor/demo/public/examples/highway/NOTICEnew file mode 100644index 0000000..b6eab81--- /dev/null+++ b/reactor/demo/public/examples/highway/NOTICE@@ -0,0 +1,32 @@+SolarRenderer+Copyright 2026 SolarRenderer authors++The code in this repository is licensed under the Apache License, Version 2.0 (see LICENSE). It builds on the SolarWM+training framework (https://github.com/Junchao-cs/SolarWM, Apache-2.0).++--------------------------------------------------------------------------------+MiniMax-H3+--------------------------------------------------------------------------------++MiniMax H3 is licensed under the MiniMax H3 Community License Agreement, Copyright © 2026 MiniMax. All Rights Reserved.++SolarRenderer runs on MiniMax-H3, which is not distributed here; obtain it from its publisher+(https://huggingface.co/MiniMaxAI/MiniMax-H3) under its own license and Acceptable Use Policy.++--------------------------------------------------------------------------------+Third-party source included in this repository+--------------------------------------------------------------------------------++ PRoPE: Projective Positional Encoding for Multiview Transformers, MIT+ Copyright (c) the PRoPE authors.+ Adapted as src/solarwm/backends/minimax_h3/torch_prope.py.++Each adapted file keeps its upstream copyright header and states that it was modified.++--------------------------------------------------------------------------------+Evaluation dependencies (not included; fetched by eval/setup.sh)+--------------------------------------------------------------------------------++ DOVER (github.com/VQAssessment/DOVER), CoTracker3 (github.com/facebookresearch/co-tracker), the LAION aesthetic+ predictor (github.com/christophschuhmann/improved-aesthetic-predictor) and VideoScore2 (TIGER-Lab/VideoScore2) keep+ their own licenses; DOVER's is non-commercial.diff --git a/reactor/demo/public/examples/highway/README.md b/reactor/demo/public/examples/highway/README.mdnew file mode 100644index 0000000..f5f914d--- /dev/null+++ b/reactor/demo/public/examples/highway/README.md@@ -0,0 +1,16 @@+# Synthwave Highway example++The demo imports `structure.mp4`, `first.png` and `prompt.txt` from SolarRenderer's+`examples/sem-highway_synthwave` directory. It uses the existing upstream checkout,+or automatically caches the three official files from upstream commit+a2371eaecff9a8ab378b5ec36199c5863d138074 when no checkout is available.+Vite serves these files during development and includes them in production builds.+Source: https://github.com/Enderfga/SolarRenderer/tree/a2371eaecff9a8ab378b5ec36199c5863d138074/examples/sem-highway_synthwave++`structure.png` is the first structure frame, used as a thumbnail.+It is the only media asset stored in this directory.+The structure-only UI option uses the same video without an appearance image+and removes Video 2 references from the prompt; it is an adapter-provided input+variant, not a second upstream scene. Example selection never starts inference.++The upstream Apache-2.0 license is included as LICENSE.diff --git a/reactor/demo/public/examples/highway/structure.png b/reactor/demo/public/examples/highway/structure.pngnew file mode 100644index 0000000..26a2e53Binary files /dev/null and b/reactor/demo/public/examples/highway/structure.png differdiff --git a/reactor/demo/src/comparison.ts b/reactor/demo/src/comparison.tsnew file mode 100644index 0000000..78b1ecd--- /dev/null+++ b/reactor/demo/src/comparison.ts@@ -0,0 +1,14 @@+// Native source sampling is 24 FPS; this does not pin Runtime playout FPS.+export class ComparisonClock {+ private previous: number | null = null;+ private frame = -1;+ reset() { this.previous = null; this.frame = -1; }+ observe(presented: number, width: number, height: number): number | null {+ // Exclude Runtime's initial placeholder, including when it arrives late.+ if (!((width === 1344 && height === 768) || (width === 768 && height === 1344))) return null;+ const advance = this.previous === null ? 1 : Math.max(0, presented - this.previous);+ this.previous = presented;+ this.frame = Math.min(157, this.frame + advance);+ return Math.max(0, this.frame) / 24;+ }+}diff --git a/reactor/demo/src/examples.css b/reactor/demo/src/examples.cssnew file mode 100644index 0000000..844046e--- /dev/null+++ b/reactor/demo/src/examples.css@@ -0,0 +1 @@+.example-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.example-grid .example-card{margin:0;padding:0 0 12px;overflow:hidden;text-align:left;background:#1d1b16;border:1px solid #38352c;border-radius:10px}.example-card img{display:block;width:100%;aspect-ratio:16/9;object-fit:cover}.example-card strong,.example-card small{display:block;padding:0 10px}.example-card strong{font-size:12px;margin-top:10px}.example-card small{font-size:10px;line-height:1.5;margin-top:5px}.example-card.selected{border-color:#c2a16a;box-shadow:0 0 0 1px #c2a16a}.example-card[aria-pressed=true] strong{color:#d8bd8b}.example-note{font-size:11px;line-height:1.6}.loaded-file{display:block;font-size:11px;color:#c8b98c;overflow-wrap:anywhere;margin:6px 0}aside>.eyebrow:not(:first-child){margin-top:26px}diff --git a/reactor/demo/src/examples.ts b/reactor/demo/src/examples.tsnew file mode 100644index 0000000..ae62d3b--- /dev/null+++ b/reactor/demo/src/examples.ts@@ -0,0 +1,32 @@+import structureUrl from "@solarrenderer-example/structure.mp4?url&no-inline";+import referenceUrl from "@solarrenderer-example/first.png?url&no-inline";+import promptUrl from "@solarrenderer-example/prompt.txt?url&no-inline";++export const examples = [+ {id:"highway-reference", title:"Synthwave Highway", detail:"Official video + appearance + prompt", reference:true, thumbnail:referenceUrl},+ {id:"highway-structure", title:"Structure only", detail:"Same drive · no appearance image", reference:false, thumbnail:`${import.meta.env.BASE_URL}examples/highway/structure.png`},+] as const;++export async function loadExample(id:string) {+ const example=examples.find(item=>item.id===id);+ if(!example) throw new Error("Unknown example.");+ async function fetchAsset(url:string) {+ const response=await fetch(url);+ if(!response.ok) throw new Error(`Could not load example (HTTP ${response.status}). Please try again.`);+ return response;+ }+ const [video,image,text]=await Promise.all([+ fetchAsset(structureUrl).then(r=>r.blob()),+ example.reference ? fetchAsset(referenceUrl).then(r=>r.blob()) : Promise.resolve(null),+ fetchAsset(promptUrl).then(r=>r.text()),+ ]);+ // Match the tested reference-free mode; never leave an absent Video 2 in the prompt.+ const prompt=example.reference ? text : text.split("\n").filter(line=>!line.startsWith("<Video 2>")).join("\n")+ .replace("[keyframe completion + reference generation] The target video begins from <Video 2> and follows", "[reference generation] The target video follows")+ .replace("The shot begins from <Video 2>. ", "");+ return {+ structure:new File([video],"highway-structure.mp4",{type:"video/mp4"}),+ reference:image ? new File([image],"highway-first.png",{type:"image/png"}) : null,+ prompt, seed:0,+ };+}diff --git a/reactor/demo/src/main.tsx b/reactor/demo/src/main.tsxnew file mode 100644index 0000000..34a242d--- /dev/null+++ b/reactor/demo/src/main.tsx@@ -0,0 +1,185 @@+import {useEffect, useMemo, useRef, useState} from "react";+import {createRoot} from "react-dom/client";+import {Reactor, type ReactorStatus} from "@reactor-team/js-sdk";+import "./style.css";+import "./examples.css";+import {ComparisonClock} from "./comparison";+import {Logo} from "@reactor-team/ui";+import {examples,loadExample} from "./examples";++type Status = {world_id:number; chunks:number; frames:number; complete:boolean; paused:boolean; active:boolean; elapsed:number|null};+function useFileUrl(file:File|null) {+ const [url,setUrl] = useState("");+ useEffect(()=>{+ if(!file) {setUrl(""); return;}+ const next=URL.createObjectURL(file); setUrl(next);+ return ()=>URL.revokeObjectURL(next);+ },[file]);+ return url;+}+function Workspace() {+ const [endpoint,setEndpoint] = useState(import.meta.env.VITE_RUNTIME_URL || "http://localhost:8080");+ const [activeEndpoint,setActiveEndpoint] = useState(endpoint);+ const client = useMemo(()=>new Reactor({+ modelName:"solarrenderer", local:true,+ apiUrl:activeEndpoint,+ modelTracks:[{name:"main_video",kind:"video",direction:"recvonly"}],+ // Commands run between model blocks; cold preparation can exceed a minute.+ controlRequestTimeoutMs:180_000,+ }),[activeEndpoint]);+ const actionLock = useRef(false);+ const [displayedTime,setDisplayedTime] = useState<number|null>(null);+ const video = useRef<HTMLVideoElement>(null);+ const sourceVideo = useRef<HTMLVideoElement>(null);+ const clock = useRef(new ComparisonClock());+ const latestStatus = useRef<Status|null>(null);+ const pendingPair = useRef<{structure:File; reference:File|null}|null>(null);+ const pairedWorld = useRef<number|null>(null);+ const sourceTime = useRef(0);+ const [pair,setPair] = useState<{structure:File; reference:File|null}|null>(null);+ const [connection, setConnection] = useState<ReactorStatus>("disconnected");+ const [prompt, setPrompt] = useState("");+ const [seed, setSeed] = useState(0);+ const [structure, setStructure] = useState<File|null>(null);+ const [reference, setReference] = useState<File|null>(null);+ const [status, setStatus] = useState<Status|null>(null);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState("");+ const [selectedExample,setSelectedExample] = useState("");+ const [fileRevision,setFileRevision] = useState(0);+ const sourceUrl=useFileUrl(pair?.structure ?? structure);+ const referenceUrl=useFileUrl(pair ? pair.reference : reference);+ function seekSource() {+ const source=sourceVideo.current;+ if(source && source.readyState>=1 && !source.seeking && Math.abs(source.currentTime-sourceTime.current)>0.001)+ source.currentTime=Math.min(sourceTime.current, Math.max(0,source.duration-0.001));+ }+ useEffect(()=>{+ client.on("statusChanged", value=>{+ setConnection(value);+ if(value === "disconnected") {+ pairedWorld.current=null; clock.current.reset(); sourceTime.current=0;+ latestStatus.current=null; setStatus(null); setDisplayedTime(null);+ if(video.current) video.current.srcObject=null;+ seekSource();+ }+ });+ client.on("message", message => {+ if(message.type !== "state_update") return;+ const next=message.data as Status;+ if(next.world_id !== latestStatus.current?.world_id) {+ clock.current.reset(); sourceTime.current=0; setDisplayedTime(null);+ pairedWorld.current=pendingPair.current ? next.world_id : null;+ setPair(pendingPair.current); pendingPair.current=null;+ seekSource();+ }+ latestStatus.current=next; setStatus(next);+ });+ client.on("error", error => setError(String(error)));+ client.on("trackReceived", (name, _track, stream)=>{+ if(name === "main_video" && video.current) video.current.srcObject = stream;+ });+ return ()=>{void client.disconnect();};+ }, [client]);+ useEffect(()=>{+ const output=video.current;+ if(!output || !output.requestVideoFrameCallback) return;+ let callback:number;+ const frame:VideoFrameRequestCallback=(_now,metadata)=>{+ const current=latestStatus.current;+ if(current && current.frames>0 && pairedWorld.current===current.world_id) {+ const time=clock.current.observe(metadata.presentedFrames,metadata.width,metadata.height);+ if(time!==null) {sourceTime.current=time; setDisplayedTime(time); seekSource();}+ }+ callback=output.requestVideoFrameCallback(frame);+ };+ callback=output.requestVideoFrameCallback(frame);+ return ()=>output.cancelVideoFrameCallback(callback);+ },[]);+ async function perform(action:()=>Promise<unknown>) {+ if(actionLock.current) return;+ actionLock.current=true;+ setBusy(true); setError("");+ try {await action();} catch(e) {setError(e instanceof Error ? e.message : String(e));}+ finally {setBusy(false); actionLock.current=false;}+ }+ async function command(name:string, data:Record<string,unknown>) {+ const result = await client.sendCommand(name, data);+ if(result === undefined) throw new Error(`The server refused ${name}. See the command error below.`);+ return result;+ }+ async function start() {+ if(!structure) return;+ await command("set_structure", {video: await client.uploadFile(structure)});+ if(reference) await command("set_reference", {image: await client.uploadFile(reference)});+ else await command("clear_reference", {});+ await command("set_prompt", {prompt});+ await command("set_seed", {seed});+ pendingPair.current={structure,reference};+ try {await command("start", {});} finally {pendingPair.current=null;}+ }+ async function selectExample(id:string) {+ const input=await loadExample(id);+ setStructure(input.structure); setReference(input.reference);+ setPrompt(input.prompt); setSeed(input.seed);+ setSelectedExample(id); setFileRevision(value=>value+1);+ }+ const ready = connection === "ready";+ return <main>+ <header><a className="brand" href="https://reactor.inc" target="_blank" rel="noreferrer"><Logo variant="symbol" width={24} height={24}/><strong>SolarRenderer</strong><span>on Reactor</span></a>+ <div className="connection-bar"><label className="endpoint">Endpoint<input aria-label="Endpoint" type="url" value={endpoint} disabled={busy || connection!=="disconnected"} onChange={e=>{setEndpoint(e.target.value);setActiveEndpoint(e.target.value.trim().replace(/\/$/,""));}}/></label>+ <span className={`connection ${ready ? "live" : ""}`}>{connection}</span>+ <button disabled={busy || !["ready","disconnected"].includes(connection) || activeEndpoint!==endpoint.trim().replace(/\/$/,"")}+ onClick={()=>void perform(async()=>{+ if(ready) {+ await client.disconnect();+ const deadline=Date.now()+30000;+ while(Date.now()<deadline) {+ const response=await fetch(`${activeEndpoint}/health`,{signal:AbortSignal.timeout(3000)});+ if(response.ok && (await response.json()).state==="available") return;+ await new Promise(resolve=>setTimeout(resolve,300));+ }+ throw new Error("Disconnected. The server is still cleaning up; wait before reconnecting.");+ } else await client.connect();+ })}>+ {ready ? "Disconnect" : "Connect"}</button></div></header>+ <div className="workspace"><aside>+ <p className="eyebrow">STRUCTURE IN. VIDEO OUT.</p><h1>Give structure<br/>a new look.</h1>+ <p>Choose a recorded structure video, an optional aligned appearance image, and the six-part rendering prompt.</p>+ <p className="eyebrow">01 / TRY AN EXAMPLE</p>+ <div className="example-grid" role="group" aria-label="Example inputs">{examples.map(example=><button key={example.id} className={`example-card ${selectedExample===example.id ? "selected" : ""}`} aria-label={`Select ${example.title}`} aria-pressed={selectedExample===example.id} disabled={busy || Boolean(status?.active)} onClick={()=>void perform(()=>selectExample(example.id))}>+ <img src={example.thumbnail} alt=""/><strong>{example.title}</strong><small>{example.detail}</small>+ </button>)}</div>+ <p className="example-note">One official scene, two tested input modes. Click to fill the inputs, then press Start. Nothing starts automatically.</p>+ <p className="eyebrow">02 / INPUTS · EDIT OR UPLOAD YOUR OWN</p>+ <label>Structure video<input key={`video-${fileRevision}`} disabled={busy} type="file" accept="video/*" onChange={e=>{setStructure(e.target.files?.[0]??null);setSelectedExample("");}}/></label>+ {structure && <small className="loaded-file" data-testid="structure-name">Loaded: {structure.name}</small>}+ <small>At least 158 frames at 24 FPS. Longer videos use the native opening segment.</small>+ <label>Appearance reference · optional<input key={`image-${fileRevision}`} disabled={busy} type="file" accept="image/png,image/jpeg,image/webp" onChange={e=>{setReference(e.target.files?.[0]??null);setSelectedExample("");}}/></label>+ <small className="loaded-file" data-testid="reference-name">{reference ? `Loaded: ${reference.name}` : "No appearance image selected"}</small>+ {reference && <button disabled={busy} onClick={()=>{setReference(null);setSelectedExample("");setFileRevision(value=>value+1);}}>Clear appearance image</button>}+ <label>Rendering prompt<textarea aria-label="Rendering prompt" disabled={busy} rows={9} maxLength={16000} value={prompt} onChange={e=>{setPrompt(e.target.value);setSelectedExample("");}} placeholder="Select an example above, or paste your six-part rendering prompt…"/></label>+ <label>Seed<input disabled={busy} type="number" min={0} max={4294967295} value={seed} onChange={e=>{setSeed(Number(e.target.value));setSelectedExample("");}}/></label>+ <button className="primary" disabled={!ready || busy || !structure || !prompt.trim()} onClick={()=>void perform(start)}>{busy ? "Preparing…" : "Start new video"}</button>+ <button disabled={!ready || busy || !status?.active} onClick={()=>void perform(()=>command("set_paused",{paused:!status?.paused}))}>{status?.paused ? "Resume" : "Pause"}</button>+ <p>Files wait until Start. Prompt edits apply to the next video; the current render keeps its original prompt.</p>+ <p>Pause and other commands wait for the current block to finish. Preparing each new video can take over a minute.</p>+ <p role="status">{status ? `${status.chunks}/10 blocks · ${status.frames} frames${status.elapsed == null ? "" : ` · ${status.elapsed.toFixed(2)} s/block`}${status.complete ? " · complete" : ""}` : "Connect to begin"}</p>+ {error && <p role="alert">{error}</p>}+ </aside><section className="comparison">+ <div className="comparison-heading"><div><p className="eyebrow">ONE SEQUENCE · TWO VIEWS</p><h2>Structure → Render</h2><p>The source follows displayed output frames, not generation progress.</p></div><output className="playback-clock" aria-label="Displayed video time">{displayedTime===null ? "Waiting for video" : `${displayedTime.toFixed(2)} / ${(157/24).toFixed(2)} s`}</output></div>+ <div className="comparison-grid"><figure><figcaption>Input structure <span>Recorded conditioning video</span></figcaption>+ <div className="stage"><video ref={sourceVideo} src={sourceUrl || undefined} muted playsInline preload="auto" className="video" onLoadedMetadata={seekSource} onSeeked={seekSource} onError={()=>setError("This browser cannot preview the structure video. Try an MP4 with H.264 video.")}/>+ {!sourceUrl && <div className="placeholder">Choose a structure video</div>}</div>+ </figure><figure><figcaption>Live render <span>Reactor output</span></figcaption>+ <div className="stage"><video ref={video} autoPlay playsInline muted className={`video ${displayedTime===null ? "awaiting-output" : ""}`}/>+ {displayedTime===null && <div className="placeholder">{status?.active ? "Preparing your video… Encoding inputs and loading the renderer can take over a minute." : "Connect, choose your inputs, then Start new video"}</div>}+ </div></figure></div>+ <p className="sync-note">Playback-aligned preview · The source waits when output stalls. Buffered output may continue after Pause. Browser-dropped frames can affect alignment; reconnecting requires Start new video to align again.</p>+ {referenceUrl && <div className="appearance"><img src={referenceUrl} alt="Appearance reference for this comparison"/><div><strong>Appearance reference</strong><p>Guides the look; the structure video supplies motion and layout.</p></div></div>}+ {pair && <p>Comparison uses the inputs captured at Start. Newly selected files apply to the next video.</p>}+ </section></div>+ <footer>SolarRenderer by its original authors · Served with <a href="https://reactor.inc">Reactor</a></footer>+ </main>;+}+createRoot(document.getElementById("root")!).render(<Workspace/>);diff --git a/reactor/demo/src/style.css b/reactor/demo/src/style.cssnew file mode 100644index 0000000..80d4bc3--- /dev/null+++ b/reactor/demo/src/style.css@@ -0,0 +1,3 @@+:root{font-family:Inter,ui-sans-serif,system-ui,sans-serif;color:#eeece6;background:#141310;font-synthesis:none}*{box-sizing:border-box}body{margin:0}header{height:78px;display:flex;align-items:center;gap:20px;padding:0 32px;border-bottom:1px solid #333129}header strong{font-size:24px;margin-right:auto}header strong span,small,footer{font-size:14px;color:#aaa799}.workspace{display:grid;grid-template-columns:350px minmax(0,1fr);min-height:calc(100vh - 130px)}aside{padding:28px;border-right:1px solid #333129}h1{font-size:29px;letter-spacing:-1px;margin-top:0}p,small{line-height:1.6;color:#aaa799;font-size:14px}label{display:block;margin:20px 0 8px;font-size:14px;font-weight:600}input,textarea,button{font:inherit;color:inherit;border:1px solid #444035;border-radius:8px;background:#24221c;padding:12px}input,textarea{display:block;width:100%;margin-top:8px}input[type=file]{font-size:12px}textarea{resize:vertical;line-height:1.5}button{cursor:pointer}button:disabled{opacity:.4;cursor:default}aside button{width:100%;margin-top:12px}.primary{background:#b89559;color:#17130d;font-weight:700;border:0}.stage{position:relative;min-height:420px;margin:28px;border:1px solid #333129;border-radius:16px;overflow:hidden;background:#0c0c0b;display:flex;align-items:center}.video{width:100%;height:100%;min-height:420px}.placeholder{position:absolute;inset:0;display:grid;place-items:center;padding:30px;text-align:center;color:#8c897f;pointer-events:none}[role=alert]{color:#ffb5ac;overflow-wrap:anywhere}footer{padding:16px 32px}a{color:#c9ac78}@media(max-width:850px){.workspace{grid-template-columns:1fr}aside{border-right:0}.stage{grid-row:1;min-height:280px}.video{min-height:280px}header{padding:0 16px}header strong{font-size:18px}}+:root .comparison{padding:28px;min-width:0}.comparison-heading h2{margin:0;font-size:24px}.comparison-heading p{margin:8px 0 24px}.comparison-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}.comparison-grid figure{margin:0;min-width:0}.comparison-grid figcaption{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px;font-size:14px;margin-bottom:12px}.comparison-grid figcaption span{color:#aaa799;font-size:12px}.comparison-grid .stage{margin:0;min-height:0;aspect-ratio:16/9;border-radius:12px}.comparison-grid .video{min-height:0;object-fit:contain}.appearance{display:flex;gap:20px;align-items:center;margin-top:28px;padding-top:24px;border-top:1px solid #333129}.appearance img{width:160px;max-height:130px;object-fit:contain;border-radius:8px}.sync-note{font-size:12px}@media(max-width:1100px){.comparison-grid{grid-template-columns:1fr}}@media(max-width:850px){.comparison{grid-row:1}.comparison-grid .stage{min-height:0}.appearance img{width:110px}}+.brand{display:flex;align-items:center;gap:10px;color:inherit;text-decoration:none;margin-right:auto;white-space:nowrap}.brand svg{width:24px;height:24px;flex:none}.brand strong{font-size:20px;margin:0}.brand span{font-size:13px;color:#aaa799}.connection-bar{display:flex;align-items:center;gap:14px}.endpoint{display:flex;align-items:center;gap:10px;margin:0;color:#aaa799;font-size:12px}.endpoint input{width:240px;margin:0;padding:10px;font-size:13px}.connection{font-size:12px;color:#aaa799}.connection.live{color:#bccea2}.eyebrow{font-size:10px!important;letter-spacing:2px;font-weight:700;color:#bba982!important}.comparison-heading{display:flex;justify-content:space-between;align-items:center;gap:16px}.playback-clock{font-variant-numeric:tabular-nums;font-size:12px;color:#c5bba7;white-space:nowrap;padding:10px 14px;border:1px solid #38352c;border-radius:8px}.awaiting-output{opacity:0}.comparison{background:radial-gradient(#4d473326 .7px,transparent .7px);background-size:14px 14px}button:hover:enabled{border-color:#b89559}input:focus,textarea:focus{outline:1px solid #b89559}header{height:auto;min-height:78px;padding:18px 28px;flex-wrap:wrap}.comparison-heading .eyebrow{margin-bottom:10px}h1{line-height:1.1;font-size:33px}@media(min-width:1101px){.comparison-grid{gap:20px}}@media(max-width:1100px){.brand{width:100%}.connection-bar{width:100%}.endpoint{flex:1}.endpoint input{width:100%}}@media(max-width:600px){.brand span{display:none}.endpoint{gap:6px}.endpoint input{min-width:80px}.connection-bar{gap:8px}.connection{display:none}.comparison-heading{align-items:flex-start;flex-direction:column}.playback-clock{margin-bottom:16px}}diff --git a/reactor/demo/src/vite-env.d.ts b/reactor/demo/src/vite-env.d.tsnew file mode 100644index 0000000..11f02fe--- /dev/null+++ b/reactor/demo/src/vite-env.d.ts@@ -0,0 +1 @@+/// <reference types="vite/client" />diff --git a/reactor/demo/tsconfig.json b/reactor/demo/tsconfig.jsonnew file mode 100644index 0000000..38b55d7--- /dev/null+++ b/reactor/demo/tsconfig.json@@ -0,0 +1 @@+{"compilerOptions":{"target":"ES2022","lib":["ES2022","DOM"],"module":"ESNext","moduleResolution":"bundler","jsx":"react-jsx","strict":true,"skipLibCheck":true,"noEmit":true,"allowSyntheticDefaultImports":true},"include":["src","vite.config.ts"]}diff --git a/reactor/demo/vite.config.ts b/reactor/demo/vite.config.tsnew file mode 100644index 0000000..26e217e--- /dev/null+++ b/reactor/demo/vite.config.ts@@ -0,0 +1,50 @@+import { createHash } from "node:crypto";+import { existsSync } from "node:fs";+import { mkdir, readFile, writeFile } from "node:fs/promises";+import { resolve } from "node:path";+import { fileURLToPath } from "node:url";+import { defineConfig } from "vite";++const demoRoot = fileURLToPath(new URL(".", import.meta.url));+const revision = "a2371eaecff9a8ab378b5ec36199c5863d138074";+const examplePath = "examples/sem-highway_synthwave";+const samples = {+ "structure.mp4": "8a4c9cbae6538dc2132a2d0353ac9b2f4e124fe6ae301bfe5017371370fea9aa",+ "first.png": "94d8a101299ce65b7c8747dc34118090163e8202ceef06ea4aaefe270a1d1082",+ "prompt.txt": "3530bebe667fd889e116604197701bb86b0cc3bdc25d83e626c399e6f2e983b9",+};++async function resolveExamples() {+ // Source-repository demo, or a checkout beside reactor-cookbook.+ for (const relativeRoot of ["../..", "../../../../source", "../../../../SolarRenderer"]) {+ const root = resolve(demoRoot, relativeRoot, examplePath);+ if (Object.keys(samples).every(name => existsSync(resolve(root, name)))) return root;+ }++ const cache = resolve(demoRoot, "node_modules/.cache/solarrenderer", revision, examplePath);+ await mkdir(cache, { recursive: true });+ for (const [name, sha256] of Object.entries(samples)) {+ const path = resolve(cache, name);+ const cached = existsSync(path) ? await readFile(path) : null;+ if (cached && createHash("sha256").update(cached).digest("hex") === sha256) continue;+ const response = await fetch(+ `https://raw.githubusercontent.com/Enderfga/SolarRenderer/${revision}/${examplePath}/${name}`,+ { signal: AbortSignal.timeout(30_000) },+ );+ if (!response.ok) throw new Error(`Could not download upstream sample ${name}: HTTP ${response.status}`);+ const data = Buffer.from(await response.arrayBuffer());+ if (createHash("sha256").update(data).digest("hex") !== sha256) {+ throw new Error(`Upstream sample checksum mismatch: ${name}`);+ }+ await writeFile(path, data);+ }+ return cache;+}++export default defineConfig(async () => {+ const exampleRoot = await resolveExamples();+ return {+ resolve: { alias: { "@solarrenderer-example": exampleRoot } },+ server: { fs: { allow: [demoRoot, exampleRoot] } },+ };+});diff --git a/reactor/reactor.yaml b/reactor/reactor.yamlnew file mode 100644index 0000000..fb0d7bd--- /dev/null+++ b/reactor/reactor.yaml@@ -0,0 +1,38 @@+$schema: reactor/v2++model:+ name: solarrenderer+ version: v0.1.1+ description: Render a structure video with an optional appearance reference and a six-part prompt.+ resources:+ gpu:+ type: NVIDIA_B200+ count: 4+ cpu:+ request: "4"+ limit: "16"+ memory:+ request: 64Gi+ limit: 192Gi++runtime:+ import: solarrenderer:SolarRenderer+ config: solarrenderer.yaml+ weights_path: ~/.cache/reactor_registry/solarrenderer++build:+ runtime_version: "3.8.3"+ python_requirements: requirements.txt+ cuda_version: "12.8.1"+ python_version: "3.12"+ system_packages:+ - build-essential+ - git+ - libgl1+ - libglib2.0-0+ run:+ - git clone https://github.com/Enderfga/SolarRenderer.git /opt/solarrenderer && git -C /opt/solarrenderer checkout a2371eaecff9a8ab378b5ec36199c5863d138074+ - pip install --no-build-isolation flash-attn==2.8.3+ runtime_env:+ TOKENIZERS_PARALLELISM: "false"+ PYTORCH_ALLOC_CONF: "expandable_segments:True"diff --git a/reactor/requirements.txt b/reactor/requirements.txtnew file mode 100644index 0000000..f72a304--- /dev/null+++ b/reactor/requirements.txt@@ -0,0 +1,32 @@+# Model dependencies resolved with Reactor Runtime during `reactor build`.+# `build.runtime_version` in reactor.yaml selects the Runtime release.++# Native H3 encoder, transformer and causal LoRA loader.+torch==2.8.0+torchvision==0.23.0+diffusers==0.40.0+transformers==5.14.1+peft==0.20.0+accelerate>=1.14+safetensors>=0.8+huggingface-hub>=1.25+fsspec>=2024.6+einops>=0.8+imageio==2.37.4+imageio-ffmpeg==0.6.0++# Four-GPU causal attention. CUTLASS 4.8 lifts the protobuf <7 constraint.+flash-attn-4==4.0.0b34+nvidia-cutlass-dsl==4.8.1+quack-kernels==0.6.5++# CPU media validation and configuration; Runtime shares these dependencies.+numpy>=2+PyYAML>=6+Pillow>=11+av>=18++# Flash Attention builds after torch is available.+ninja+packaging+wheeldiff --git a/reactor/solarrenderer.py b/reactor/solarrenderer.pynew file mode 100644index 0000000..041420b--- /dev/null+++ b/reactor/solarrenderer.py@@ -0,0 +1,211 @@+"""Render structure videos with SolarRenderer's released causal LoRA pair."""++from __future__ import annotations++import asyncio+from pathlib import Path++import av+from PIL import Image+from reactor_runtime import (+ ApplicationError,+ ClientInfo,+ CommandError,+ InputField,+ ReactorApp,+ StepOutcome,+ UploadedFile,+ connected,+ event,+ get_weights_path,+ session_ended,+)+from reactor_runtime.distributed import DistributedRunner+from solarrenderer_assets import read_settings+from solarrenderer_distributed import FourModel+from solarrenderer_media import validate_reference, validate_structure+from solarrenderer_model import SolarAnchor, SolarInput, SolarResult+from solarrenderer_types import SolarOutput, SolarState+from solarrenderer_types import StateUpdate as SolarStatus+++class SolarRenderer(ReactorApp):+ """Turn an uploaded structure video, optional reference and prompt into a finite rendered video."""++ state: SolarState++ def load(self, config_path: Path | None) -> None:+ if config_path is None:+ raise ValueError("SolarRenderer requires solarrenderer.yaml.")+ settings = read_settings(config_path, Path(get_weights_path()))+ self.engine = DistributedRunner(+ FourModel,+ world_size=4,+ load_kwargs={"settings": settings},+ init_process_group=True,+ call_timeout=1800,+ )+ self.engine.start()++ def _status(self, elapsed: float | None = None) -> SolarStatus:+ s = self.state+ return SolarStatus(+ prompt=s.prompt,+ seed=s.seed,+ paused=s.paused,+ has_structure=s._structure is not None,+ has_reference=s._reference is not None,+ world_id=s._world_id,+ chunks=s._chunks,+ frames=s._frames,+ active=s._active,+ complete=s._complete,+ elapsed=elapsed,+ )++ @connected+ async def on_connected(self, client: ClientInfo) -> None:+ await self.send(self._status())++ @session_ended+ def on_session_ended(self) -> None:+ self.engine.reset()+ self.output.flush()++ @event(+ name="set_structure",+ description="Select a structure video for the next Start. Fails with invalid_video for corrupt, oversized or too-short input.",+ )+ async def set_structure(+ self,+ video: UploadedFile = InputField( # noqa: B008 - Runtime schema declaration+ moderate=True,+ description="Structure video covering at least 158 frames at 24 FPS.",+ ),+ ) -> SolarStatus:+ try:+ await asyncio.to_thread(validate_structure, video.data)+ except (ValueError, av.error.FFmpegError) as exc:+ raise CommandError("invalid_video", str(exc)) from exc+ self.state._structure = video.data+ status = self._status()+ await self.send(status)+ return status++ @event(+ name="set_reference",+ description="Select an optional aligned appearance image for the next Start. Fails with invalid_image for unsupported, oversized or corrupt images.",+ )+ async def set_reference(+ self,+ image: UploadedFile = InputField( # noqa: B008 - Runtime schema declaration+ moderate=True,+ description="PNG, JPEG or WebP aligned with the structure video's first frame.",+ ),+ ) -> SolarStatus:+ try:+ await asyncio.to_thread(validate_reference, image.data)+ except (ValueError, OSError, Image.DecompressionBombError) as exc:+ raise CommandError("invalid_image", str(exc)) from exc+ self.state._reference = image.data+ status = self._status()+ await self.send(status)+ return status++ @event(+ name="clear_reference",+ description="Omit the optional appearance reference from the next video.",+ )+ async def clear_reference(self) -> SolarStatus:+ self.state._reference = None+ status = self._status()+ await self.send(status)+ return status++ @event(+ name="set_prompt",+ description="Stage the six-part rendering prompt for the next Start. The current video keeps its original prompt.",+ )+ async def set_prompt(+ self,+ prompt: str = InputField(+ moderate=True,+ max_length=16000,+ description="Rendering prompt for the next video.",+ ),+ ) -> SolarStatus:+ self.state.prompt = prompt+ status = self._status()+ await self.send(status)+ return status++ @event(name="set_seed", description="Stage the random seed for the next Start.")+ async def set_seed(+ self,+ seed: int = InputField(+ ge=0, le=2**32 - 1, description="Random seed for the next video."+ ),+ ) -> SolarStatus:+ self.state.seed = seed+ status = self._status()+ await self.send(status)+ return status++ @event(+ name="set_paused",+ description="Pause or resume generation. Already buffered video may still play.",+ )+ async def set_paused(+ self, paused: bool = InputField(description="Whether to pause generation.")+ ) -> SolarStatus:+ self.state.paused = paused+ status = self._status()+ await self.send(status)+ return status++ @event(+ name="start",+ description="Begin a new finite video from selected inputs. Fails with missing_video or missing_prompt until both are supplied. Replaces the current video.",+ )+ async def start(self) -> SolarStatus:+ s = self.state+ if s._structure is None:+ raise CommandError("missing_video", "Select a structure video first.")+ if not s.prompt.strip():+ raise CommandError("missing_prompt", "Supply a rendering prompt first.")+ s._anchor = SolarAnchor(+ structure=s._structure, reference=s._reference, prompt=s.prompt, seed=s.seed+ )+ s._world_id += 1+ s._chunks = s._frames = 0+ s._active, s._complete, s.paused = True, False, False+ self.output.flush()+ status = self._status()+ await self.send(status)+ return status++ async def process_input(self) -> SolarInput:+ s = self.state+ if not s._active:+ raise ApplicationError("Select inputs and press Start to render a video.")+ if s.paused:+ raise ApplicationError("paused")+ return SolarInput(+ world_id=s._world_id,+ anchor=s._anchor if s._applied_id != s._world_id else None,+ )++ def generate(self, input: SolarInput) -> SolarResult:+ return self.engine.generate(input)++ async def process_output(self, outcome: StepOutcome) -> SolarOutput | None:+ if outcome.error is not None:+ # Unexpected model/driver failures must end the session, never count as a successful block.+ raise outcome.error+ result: SolarResult = outcome.result+ s = self.state+ s._applied_id, s._chunks = result.world_id, result.chunk_index+ s._frames += 0 if result.frames is None else len(result.frames)+ s._complete, s._active = result.complete, not result.complete+ await self.send(self._status(outcome.elapsed))+ return None if result.frames is None else SolarOutput(main_video=result.frames)diff --git a/reactor/solarrenderer.yaml b/reactor/solarrenderer.yamlnew file mode 100644index 0000000..a33ca53--- /dev/null+++ b/reactor/solarrenderer.yaml@@ -0,0 +1,2 @@+# The build installs the pinned native source here.+source: /opt/solarrendererdiff --git a/reactor/solarrenderer_assets.py b/reactor/solarrenderer_assets.pynew file mode 100644index 0000000..80a2e28--- /dev/null+++ b/reactor/solarrenderer_assets.py@@ -0,0 +1,33 @@+"""Resolve deployment paths once, before starting the model worker."""++import subprocess+from pathlib import Path++import yaml+from solarrenderer_model import SolarSettings++SOURCE_REVISION = "a2371eaecff9a8ab378b5ec36199c5863d138074"+++def read_settings(config_path: Path, weights_root: Path) -> SolarSettings:+ config = yaml.safe_load(config_path.read_text())+ source = Path(config["source"])+ if not source.is_absolute():+ source = (config_path.parent / source).resolve()+ revision = subprocess.check_output(+ ["git", "-C", str(source), "rev-parse", "HEAD"], text=True+ ).strip()+ if revision != SOURCE_REVISION:+ raise ValueError(+ f"Expected upstream source {SOURCE_REVISION}; found {revision}."+ )+ root = weights_root.resolve()+ scratch = root / "scratch"+ scratch.mkdir(parents=True, exist_ok=True)+ return SolarSettings(+ source=source,+ h3=root / "MiniMax-H3",+ control=root / "solarrenderer_causal_control_lora.safetensors",+ fewstep=root / "solarrenderer_causal_4step_lora.safetensors",+ scratch=scratch,+ )diff --git a/reactor/solarrenderer_backend.py b/reactor/solarrenderer_backend.pynew file mode 100644index 0000000..535fd8f--- /dev/null+++ b/reactor/solarrenderer_backend.py@@ -0,0 +1,107 @@+"""Reuse the pinned upstream encoder and renderer inside an isolated model process."""++from __future__ import annotations++import importlib.util+import sys+import tempfile+from pathlib import Path++from solarrenderer_model import SolarAnchor, SolarSettings+++class SolarBackend:+ def __init__(self, settings: SolarSettings):+ self.settings = settings+ for path in (+ settings.source / "scripts/render.py",+ settings.h3 / "modular_model_index.json",+ settings.control,+ settings.fewstep,+ ):+ if not path.is_file():+ raise FileNotFoundError(f"Missing SolarRenderer asset: {path}")+ sys.path[:0] = [str(settings.source / "src"), str(settings.source / "tools")]+ spec = importlib.util.spec_from_file_location(+ "solarrenderer_native_render", settings.source / "scripts/render.py"+ )+ self.native = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(self.native)+ self.renderer = self.run = self.decoder = None+ self.device = "cuda:0"++ def reset(self):+ self.run = self.decoder = None++ def begin(self, anchor: SolarAnchor):+ import torch+ from solarrenderer_decode import SolarDecoder+ from solarrenderer_sampling import SolarCausalRun+ from solarwm.backends.minimax_h3.omni_data import H3OmniStream++ self.reset()+ # The native entrypoint never holds Qwen and the transformer on the card together.+ self.renderer = None+ self.native.free_cuda()+ with tempfile.TemporaryDirectory(+ prefix="solar-", dir=self.settings.scratch+ ) as directory:+ directory = Path(directory)+ structure = directory / "structure.mp4"+ structure.write_bytes(anchor.structure)+ first = directory / "first.png"+ if anchor.reference is not None:+ first.write_bytes(anchor.reference)+ member = directory / "member.safetensors"+ encoder = self.native.load_encoder(str(self.settings.h3), self.device)+ sample = self.native.sample_of(+ "reactor",+ anchor.prompt,+ str(structure),+ str(first) if anchor.reference is not None else None,+ )+ self.native.encode_sample(encoder, sample, str(member))+ del encoder+ self.native.free_cuda()+ self.renderer = self.native.load_renderer(+ str(self.settings.h3),+ str(self.settings.control),+ str(self.settings.fewstep),+ self.device,+ causal=True,+ )+ stream = object.__new__(H3OmniStream)+ stream.root, stream.current_plan_fingerprint, stream.aligned_control = (+ "/",+ "render",+ False,+ )+ batch = stream.read({"id": "reactor", "member": str(member)})+ core, conditioners, device = self.renderer+ torch.manual_seed(anchor.seed)+ with torch.no_grad():+ self.run = SolarCausalRun(+ core, batch, torch.Generator(device=device).manual_seed(anchor.seed)+ )+ self.decoder = SolarDecoder(conditioners.video_vae, self.run.frames, device)++ def step(self):+ import torch++ block = self.run.step()+ decoded = self.decoder.push(block)+ frames = None+ if decoded is not None:+ mean = torch.tensor((0.485, 0.456, 0.406)).view(1, 3, 1, 1, 1)+ std = torch.tensor((0.229, 0.224, 0.225)).view(1, 3, 1, 1, 1)+ pixels = (decoded.float() * std + mean).clamp(0, 1)+ frames = (+ pixels[0]+ .permute(1, 2, 3, 0)+ .mul(255)+ .round()+ .clamp(0, 255)+ .to(torch.uint8)+ .numpy()+ )+ return frames, self.run.completediff --git a/reactor/solarrenderer_decode.py b/reactor/solarrenderer_decode.pynew file mode 100644index 0000000..56ed959--- /dev/null+++ b/reactor/solarrenderer_decode.py@@ -0,0 +1,112 @@+"""Feed causal blocks into the native H3 temporal decoder without speculative frames.++The overlap and padding arithmetic follows SolarRenderer's Apache-2.0+stream_decode.py. Wait for a complete decoder window before emitting it.+"""++from __future__ import annotations++import torch+++class SolarDecoder:+ def __init__(self, vae, latent_frames, device):+ self.vae, self.device = vae, device+ self.total = latent_frames+ self.size = vae.tokens_chunk_size+ self.drop = vae.config.token_drop+ self.ratio = vae.temporal_compression_ratio+ self.padding = (-(latent_frames + self.drop)) % self.size+ self.count = (latent_frames + self.drop + self.padding) // self.size - int(+ self.drop > 0+ )+ if self.count < 1:+ raise ValueError(+ "The rollout is too short for the native temporal decoder."+ )+ tail = vae.config.clip_length % self.ratio+ self.trim = sum(+ tail if tail and (latent_frames + k) % self.size == 0 else self.ratio+ for k in range(self.padding)+ )+ self.mean = torch.tensor(vae.config.latents_mean, device=device).view(+ 1, -1, 1, 1, 1+ )+ self.std = torch.tensor(vae.config.latents_std, device=device).view(+ 1, -1, 1, 1, 1+ )+ self.latents = None+ self.overlap = None+ self.pending = None+ self.index = 0+ self.finished = False++ def _completed(self, chunk):+ chunk = chunk.cpu()+ if self.pending is not None:+ chunk = torch.cat((self.pending, chunk), dim=2)+ keep = min(self.trim, chunk.shape[2])+ ready = chunk[:, :, :-keep] if keep else chunk+ self.pending = chunk[:, :, -keep:] if keep else None+ return ready++ @torch.no_grad()+ def push(self, block):+ if self.finished:+ raise RuntimeError("The decoder has already completed this run.")+ # Only the small normalized latent clip is retained, never the whole pixel video.+ block = block.detach().cpu()+ self.latents = (+ block if self.latents is None else torch.cat((self.latents, block), dim=2)+ )+ known = self.latents.shape[2]+ if known > self.total:+ raise ValueError("Latent input exceeds the native horizon.")+ ready = []+ while self.index < self.count:+ start = self.index * self.size+ stop = min(+ start + self.size + self.vae.token_overlap, self.total + self.padding+ )+ if known < min(stop, self.total):+ break+ part = (+ self.latents[:, :, start : min(stop, self.total)]+ .to(self.device)+ .float()+ )+ if stop > self.total:+ part = torch.cat(+ (part, part[:, :, -1:].repeat(1, 1, stop - self.total, 1, 1)), dim=2+ )+ with torch.autocast(+ device_type=str(self.device).split(":")[0],+ dtype=torch.float16,+ enabled=str(self.device).startswith("cuda"),+ ):+ clip = self.vae._decode_clip(part * self.std + self.mean)+ for j in range(int(self.drop > 0) + 1):+ chunk = clip[+ :,+ :,+ j * self.size * self.ratio : (j + 1) * self.size * self.ratio,+ ]+ chunk = chunk[:, :, self.vae.frame_pre_padding :]+ if j == 0:+ if self.overlap is not None:+ chunk = self.vae._blend(+ self.overlap, chunk, self.vae.frame_overlap, dim=-3+ )+ ready.append(self._completed(chunk))+ else:+ self.overlap = chunk+ self.index += 1+ if known == self.total:+ if self.index != self.count:+ raise RuntimeError("Final decoder window was not consumed.")+ if self.overlap is not None:+ ready.append(self._completed(self.overlap))+ self.finished = True+ self.pending = self.overlap = self.latents = None+ ready = [chunk for chunk in ready if chunk.shape[2]]+ return torch.cat(ready, dim=2) if ready else Nonediff --git a/reactor/solarrenderer_distributed.py b/reactor/solarrenderer_distributed.pynew file mode 100644index 0000000..004af4e--- /dev/null+++ b/reactor/solarrenderer_distributed.py@@ -0,0 +1,114 @@+"""Four-GPU sequence parallelism with native conditioning and incremental decoding."""++import tempfile+from pathlib import Path++from solarrenderer_backend import SolarBackend+from solarrenderer_model import SolarModel+++class FourBackend(SolarBackend):+ def __init__(self, settings, device, rank, world_size):+ super().__init__(settings)+ from solarwm.backends.minimax_h3.distributed import init_sequence_parallel++ self.device, self.rank = device, rank+ init_sequence_parallel(world_size)++ def begin(self, anchor):+ import torch+ import torch.distributed as dist+ from solarrenderer_decode import SolarDecoder+ from solarrenderer_optimizations import (+ StaticPrefixRun,+ cache_text_refiner,+ install_fa4,+ precompute_adaln,+ )+ from solarwm.backends.minimax_h3.omni_data import H3OmniStream++ self.reset()+ self.renderer = None+ self.native.free_cuda()+ directory = None+ result = [None]+ if self.rank == 0:+ try:+ directory = tempfile.TemporaryDirectory(+ prefix="solar-sp4-", dir=self.settings.scratch+ )+ root = Path(directory.name)+ structure, reference, member = (+ root / "structure.mp4",+ root / "first.png",+ root / "member.safetensors",+ )+ structure.write_bytes(anchor.structure)+ if anchor.reference is not None:+ reference.write_bytes(anchor.reference)+ encoder = self.native.load_encoder(str(self.settings.h3), self.device)+ sample = self.native.sample_of(+ "reactor",+ anchor.prompt,+ str(structure),+ str(reference) if anchor.reference is not None else None,+ )+ self.native.encode_sample(encoder, sample, str(member))+ del encoder+ self.native.free_cuda()+ result[0] = {"member": str(member)}+ except Exception as exc: # noqa: BLE001 - propagate preparation failures to every rank+ result[0] = {"error": f"{type(exc).__name__}: {exc}"}+ dist.broadcast_object_list(result, src=0)+ if "error" in result[0]:+ if directory is not None:+ directory.cleanup()+ raise RuntimeError(result[0]["error"])+ stream = object.__new__(H3OmniStream)+ stream.root, stream.current_plan_fingerprint, stream.aligned_control = (+ "/",+ "render",+ False,+ )+ batch = None+ read_error = None+ try:+ batch = stream.read({"id": "reactor", "member": result[0]["member"]})+ except Exception as exc: # noqa: BLE001 - every rank must reach the failure exchange+ read_error = f"Rank {self.rank}: {type(exc).__name__}: {exc}"+ errors = [None] * dist.get_world_size()+ dist.all_gather_object(errors, read_error)+ if directory is not None:+ directory.cleanup()+ if any(error is not None for error in errors):+ raise RuntimeError(+ "; ".join(error for error in errors if error is not None)+ )+ self.renderer = self.native.load_renderer(+ str(self.settings.h3),+ str(self.settings.control),+ str(self.settings.fewstep),+ self.device,+ causal=True,+ )+ core, conditioners, device = self.renderer+ precompute_adaln(core)+ cache_text_refiner(core)+ install_fa4()+ from solarrenderer_vae import install++ install(conditioners.video_vae, batched=True, compile_mode=None)+ torch.manual_seed(anchor.seed)+ with torch.no_grad():+ self.run = StaticPrefixRun(+ core,+ batch,+ torch.Generator(device=device).manual_seed(anchor.seed),+ cache_structure=True,+ )+ self.decoder = SolarDecoder(conditioners.video_vae, self.run.frames, device)+++class FourModel(SolarModel):+ def load(self, settings):+ self._backend = FourBackend(settings, self.device, self.rank, self.world_size)diff --git a/reactor/solarrenderer_media.py b/reactor/solarrenderer_media.pynew file mode 100644index 0000000..ed66e3c--- /dev/null+++ b/reactor/solarrenderer_media.py@@ -0,0 +1,45 @@+"""Bounded CPU validation; preserve uploaded bytes for native preprocessing."""++import io+import math++import av+from PIL import Image+++def validate_structure(data: bytes) -> None:+ if not data or len(data) > 256 * 1024 * 1024:+ raise ValueError("Upload a structure video smaller than 256 MiB.")+ with av.open(io.BytesIO(data)) as container:+ if not container.streams.video:+ raise ValueError("The upload has no video track.")+ stream = container.streams.video[0]+ rate = float(stream.average_rate or 0)+ if not math.isfinite(rate) or not 1 <= rate <= 120:+ raise ValueError(+ "The video must declare a frame rate between 1 and 120 FPS."+ )+ if not 0 < stream.width * stream.height <= 4096 * 4096:+ raise ValueError(+ "The video frame dimensions exceed the 16-megapixel limit."+ )+ needed = math.floor(157 * rate / 24 + 0.5) + 1+ for count, frame in enumerate(container.decode(stream), start=1):+ if frame.width * frame.height > 4096 * 4096:+ raise ValueError("Decoded video exceeds the dimension limit.")+ if count >= needed:+ return+ raise ValueError(+ "The video must provide at least 158 frames after native 24 FPS resampling."+ )+++def validate_reference(data: bytes) -> None:+ if not data or len(data) > 25 * 1024 * 1024:+ raise ValueError("Upload a reference image smaller than 25 MiB.")+ with Image.open(io.BytesIO(data)) as image:+ if image.format not in {"PNG", "JPEG", "WEBP"}:+ raise ValueError("Use a PNG, JPEG or WebP reference image.")+ if image.width * image.height > 4096 * 4096:+ raise ValueError("The reference exceeds the 16-megapixel limit.")+ image.load()diff --git a/reactor/solarrenderer_model.py b/reactor/solarrenderer_model.pynew file mode 100644index 0000000..35c8ec6--- /dev/null+++ b/reactor/solarrenderer_model.py@@ -0,0 +1,89 @@+"""Runtime-independent contracts and ownership of one SolarRenderer rollout."""++from __future__ import annotations++from dataclasses import dataclass+from pathlib import Path++import numpy as np+++@dataclass(frozen=True)+class SolarSettings:+ source: Path+ h3: Path+ control: Path+ fewstep: Path+ scratch: Path+++@dataclass(frozen=True)+class SolarAnchor:+ """Validated original media bytes; native preprocessing happens in the model."""++ structure: bytes+ reference: bytes | None+ prompt: str+ seed: int+++@dataclass(frozen=True)+class SolarInput:+ """Request a block from world_id; carry its anchor only until acknowledged."""++ world_id: int+ anchor: SolarAnchor | None = None+++@dataclass(frozen=True)+class SolarResult:+ """Completed block facts, with RGB uint8 [T,H,W,3] media when available."""++ world_id: int+ chunk_index: int+ frames: np.ndarray | None+ complete: bool+++class SolarModel:+ """Hold a finite video and advance only after a successful backend step.++ New world IDs require an anchor. Completed worlds require a new Start.+ Reset forgets the current world without changing the next caller's inputs.+ """++ def __init__(self):+ self._backend = None+ self._world_id = None+ self._chunk = 0+ self._complete = False++ def load(self, settings: SolarSettings) -> None:+ from solarrenderer_backend import SolarBackend++ self._backend = SolarBackend(settings)++ def generate(self, input: SolarInput) -> SolarResult:+ if self._backend is None:+ raise RuntimeError("Load the model before generating.")+ if input.world_id != self._world_id:+ if input.anchor is None:+ raise ValueError("A new world requires its structure, prompt and seed.")+ self._backend.begin(input.anchor)+ self._world_id, self._chunk, self._complete = input.world_id, 0, False+ if self._complete:+ raise RuntimeError("The video is complete; start a new world.")+ frames, complete = self._backend.step()+ self._chunk += 1+ self._complete = complete+ return SolarResult(+ world_id=self._world_id,+ chunk_index=self._chunk,+ frames=frames,+ complete=complete,+ )++ def reset(self) -> None:+ if self._backend is not None:+ self._backend.reset()+ self._world_id, self._chunk, self._complete = None, 0, Falsediff --git a/reactor/solarrenderer_optimizations.py b/reactor/solarrenderer_optimizations.pynew file mode 100644index 0000000..02142e1--- /dev/null+++ b/reactor/solarrenderer_optimizations.py@@ -0,0 +1,203 @@+"""Inference-only caches and FA4 for the native four-step causal schedule."""++import numpy as np+import torch+from torch import nn+++class ExactInputCache(nn.Module):+ """One-entry cache, invalidated whenever the actual input changes."""++ def __init__(self, module):+ super().__init__()+ self.module = module+ self.saved_input = None+ self.saved_output = None++ def forward(self, value):+ if value.shape[1] == 0:+ return value+ if torch.is_grad_enabled():+ return self.module(value)+ if self.saved_input is None or not torch.equal(value, self.saved_input):+ self.saved_output = self.module(value)+ self.saved_input = value.detach().clone()+ return self.saved_output+++def cache_text_refiner(core):+ model = core.model.get_base_model()+ model.token_refiner = ExactInputCache(model.token_refiner)+++class ModulationTable(nn.Module):+ def __init__(self, tables, cursor):+ super().__init__()+ self.tables = tables+ self.cursor = cursor++ def forward(self, temb):+ if torch.is_grad_enabled():+ raise RuntimeError("Precomputed modulation is inference-only")+ return self.tables[self.cursor[0]]++[email protected]_grad()+def precompute_adaln(core):+ from solarwm.backends.minimax_h3.flow import make_shifted_schedule+ from solarwm.backends.minimax_h3.model import get_parameter_dtype+ from solarwm.backends.minimax_h3.omni_causal import CLEAN_LEVEL, STATIC_TIME++ model = core.model.get_base_model()+ schedule = make_shifted_schedule(5, shift=12.0)+ # A reference-free static prefill contains text rows only (all STATIC_TIME).+ keys = [(float(np.float32(STATIC_TIME)),)]+ for level in [CLEAN_LEVEL, *(1 - float(s) for s in schedule.sigmas[:4])]:+ key = tuple(+ np.unique(+ np.asarray([STATIC_TIME, CLEAN_LEVEL, level], dtype=np.float32)+ ).tolist()+ )+ if key not in keys:+ keys.append(key)+ # Static-prefix reuse removes text rows from later forwards.+ key = tuple(+ np.unique(np.asarray([CLEAN_LEVEL, level], dtype=np.float32)).tolist()+ )+ if key not in keys:+ keys.append(key)+ embeddings = [+ model._time_condition(+ torch.tensor(k, device=core.device, dtype=torch.float32),+ None,+ parameter_dtype=get_parameter_dtype,+ )+ for k in keys+ ]+ cursor = [0]+ freed = 0+ for block in model.transformer_blocks:+ projection = block.adaln_proj+ # Each call has the native shape and preserves the original precision boundaries.+ tables = [tuple(x.detach().clone() for x in projection(e)) for e in embeddings]+ freed += sum(p.numel() * p.element_size() for p in projection.parameters())+ block.adaln_proj = ModulationTable(tables, cursor)+ original = core._run++ def run(**kw):+ key = tuple(np.unique(kw["times"]).tolist())+ if key not in keys:+ raise ValueError("Unprepared timestep set; refuse stale modulation")+ cursor[0] = keys.index(key)+ return original(**kw)++ core._run = run+ del projection, embeddings+ torch.cuda.empty_cache()+ return {"adaln_weight_bytes_removed": freed, "time_sets": keys}+++def install_fa4():+ """Swap only the causal segmented attention kernel; keep original plan/cache."""+ from flash_attn.cute.interface import flash_attn_func+ from solarwm.backends.minimax_h3 import omni_causal++ def attention(query, key, value, plan, layer):+ if int(query.shape[1]) != plan.sequence_length:+ raise ValueError("Segment sequence length mismatch")+ outputs = []+ for start, stop, spans, cached, commit in plan.segments:+ keys = [key[:, a:b] for a, b in spans]+ values = [value[:, a:b] for a, b in spans]+ for chunk in cached:+ k, v = plan.cache.get(layer, chunk)+ if chunk[0] == "prefix":+ keys.insert(0, k)+ values.insert(0, v)+ else:+ keys.append(k)+ values.append(v)+ output = flash_attn_func(+ query[:, start:stop].contiguous(),+ torch.cat(keys, dim=1).contiguous(),+ torch.cat(values, dim=1).contiguous(),+ causal=False,+ num_splits=1,+ )+ outputs.append(output[0] if isinstance(output, tuple) else output)+ if commit is not None:+ plan.cache.put(layer, commit, key[:, start:stop], value[:, start:stop])+ return torch.cat(outputs, dim=1)++ omni_causal.segment_attention = attention+++from solarrenderer_sampling import SolarCausalRun+from solarwm.backends.minimax_h3.omni_causal import (+ CLEAN_LEVEL,+ STATIC_TIME,+ H3SegmentPlan,+ _merge,+ _remap,+ select_rows,+)+++class StaticPrefixRun(SolarCausalRun):+ """Cache text/reference KV once; they attend only to each other in native plan."""++ @torch.no_grad()+ def __init__(self, core, batch, generator, **kwargs):+ super().__init__(core, batch, generator, **kwargs)+ keep = np.concatenate([np.arange(a, b) for a, b in sorted(self.rows.static)])+ arrays = select_rows(self.layout, keep)+ cond_rows = self.layout.source.video_indices[+ : int(self.layout.source.num_condition_video_rows)+ ]+ kept = cond_rows[np.isin(cond_rows, keep)]+ pick = torch.from_numpy(np.searchsorted(cond_rows, kept)).to(core.device)+ times = np.full(len(keep), CLEAN_LEVEL, dtype=np.float32)+ times[: self.rows.text[1] - self.rows.text[0]] = STATIC_TIME+ plan = H3SegmentPlan(+ ((0, len(keep), ((0, len(keep)),), (), ("prefix", 0)),),+ len(keep),+ self.cache,+ )+ core._run(+ video_rows=self.observations.index_select(1, pick),+ audio_rows=self.audio[:, :0],+ prompt=self.prompt,+ arrays=arrays,+ times=times,+ plan=plan,+ model=None,+ )+ self.prompt = self.prompt[:, :0]++ def _document(self, target, extra):+ keep = np.concatenate(+ [np.arange(a, b) for a, b in sorted([self.rows.audio, *extra, target])]+ )+ where = np.full(self.rows.sequence_length, -1, dtype=np.int64)+ where[keep] = np.arange(len(keep))+ source = self.layout.source+ video_rows = source.video_indices[: int(source.num_condition_video_rows)]+ kept = video_rows[where[video_rows] >= 0]+ pick = torch.from_numpy(np.searchsorted(video_rows, kept)).to(self.core.device)+ times = np.full(len(keep), CLEAN_LEVEL, dtype=np.float32)+ return select_rows(self.layout, keep), where, pick, _remap(target, where), times++ def _plan(self, where, mine, size, keys, cached, commit, extra):+ audio = _remap(self.rows.audio, where)+ pieces = [(audio, [audio])] + [+ (_remap(e, where), [_remap(e, where)]) for e in extra+ ]+ segments = [+ (a, b, _merge(k), (("prefix", 0),), None)+ for (a, b), k in sorted(pieces)+ if b > a+ ]+ segments.append(+ (mine[0], mine[1], _merge([*keys, mine]), (("prefix", 0), *cached), commit)+ )+ return H3SegmentPlan(tuple(sorted(segments)), size, self.cache)diff --git a/reactor/solarrenderer_sampling.py b/reactor/solarrenderer_sampling.pynew file mode 100644index 0000000..f28422a--- /dev/null+++ b/reactor/solarrenderer_sampling.py@@ -0,0 +1,182 @@+"""Incremental form of SolarRenderer's released four-evaluation causal sampler.++Adapted from Enderfga/SolarRenderer, Apache-2.0, omni_causal.py at+a2371eaecff9a8ab378b5ec36199c5863d138074. Keep the native random draws,+six-block structure window and five-block clean history unchanged.+"""++from __future__ import annotations++import numpy as np+import torch+from solarwm.backends.minimax_h3.flow import make_shifted_schedule+from solarwm.backends.minimax_h3.layout import patchify_video, unpatchify_video+from solarwm.backends.minimax_h3.omni_causal import (+ CLEAN_LEVEL,+ STATIC_TIME,+ H3ChunkKVCache,+ H3SegmentPlan,+ _merge,+ _remap,+ _window,+ select_rows,+)+++class SolarCausalRun:+ """One finite native rollout; each step samples and commits one latent block."""++ def __init__(self, core, batch, generator, *, cache_structure=False):+ self.core = core+ self.generator = generator+ self.cache_structure = cache_structure+ self.schedule = make_shifted_schedule(5, shift=12.0)+ self.window = int(core.causal.get("window", 6))+ (+ self.prompt,+ self.layout,+ self.observations,+ self.rows,+ (self.frames, self.grid),+ ) = core._document(batch, generator)+ self.audio = core._audio(self.frames, generator)+ self.cache = H3ChunkKVCache(window=self.window)+ self.index = 0++ @property+ def complete(self):+ return self.index == len(self.rows.frames)++ def _draw(self, shape):+ value = torch.randn(+ shape,+ generator=self.generator,+ device=self.core.device,+ dtype=torch.float32,+ )+ self.core._broadcast_logical_sample(value)+ return value++ def _document(self, target, extra):+ rows = self.rows+ source = self.layout.source+ video_rows = source.video_indices[: int(source.num_condition_video_rows)]+ keep = np.concatenate(+ [+ np.arange(a, b)+ for a, b in sorted([*rows.static, rows.audio, *extra, target])+ ]+ )+ where = np.full(rows.sequence_length, -1, dtype=np.int64)+ where[keep] = np.arange(keep.size)+ kept_video = np.asarray(+ [r for r in video_rows if where[r] >= 0], dtype=np.int64+ )+ pick = torch.from_numpy(np.searchsorted(video_rows, kept_video)).to(+ self.core.device+ )+ times = np.full(int(keep.size), CLEAN_LEVEL, dtype=np.float32)+ text = _remap(rows.text, where)+ times[text[0] : text[1]] = STATIC_TIME+ return select_rows(self.layout, keep), where, pick, _remap(target, where), times++ def _plan(self, where, mine, size, keys, cached, commit, extra):+ static = [_remap(s, where) for s in self.rows.static]+ audio = _remap(self.rows.audio, where)+ pieces = [(span, static) for span in static] + [(audio, [*static, audio])]+ pieces += [(_remap(e, where), [*static, _remap(e, where)]) for e in extra]+ segments = [+ (a, b, _merge(k), (), None) for (a, b), k in sorted(pieces) if b > a+ ]+ segments.append(+ (mine[0], mine[1], _merge([*static, *keys, mine]), cached, commit)+ )+ segments.sort()+ return H3SegmentPlan(tuple(segments), size, self.cache)++ @torch.no_grad()+ def step(self):+ if self.complete:+ raise RuntimeError("The native rollout is complete; start a new run.")+ c = self.index+ f0, f1 = self.rows.frames[c]+ history = tuple(+ ("structure", j)+ for j in _window(c, self.window)+ if self.rows.structure and self.cache_structure+ ) + tuple(("clean", j) for j in _window(c, self.window) if j < c)+ extra = (+ [self.rows.structure[j] for j in _window(c, self.window)]+ if self.rows.structure and not self.cache_structure+ else []+ )+ if self.rows.structure and self.cache_structure:+ # Native structure rows attend only to static rows and themselves.+ # Commit once without changing the six-block window or RNG draws.+ arrays, where, pick, mine, times = self._document(+ self.rows.structure[c], []+ )+ self.core._run(+ video_rows=self.observations.index_select(1, pick),+ audio_rows=self.audio,+ prompt=self.prompt,+ arrays=arrays,+ times=times,+ plan=self._plan(where, mine, len(times), [], (), ("structure", c), []),+ model=None,+ )+ arrays, where, pick, mine, times = self._document(self.rows.target[c], extra)+ condition = self.observations.index_select(1, pick)+ audio_span = [+ _remap(self.rows.audio, where),+ *(_remap(e, where) for e in extra),+ ]+ shape = (1, 24, f1 - f0, *self.grid)+ current = self._draw(shape)+ for index in range(4):+ sigma, sigma_next = (+ float(self.schedule.sigmas[index]),+ float(self.schedule.sigmas[index + 1]),+ )+ times[mine[0] : mine[1]] = 1.0 - sigma+ output = self.core._run(+ video_rows=torch.cat((condition, patchify_video(current)), dim=1),+ audio_rows=self.audio,+ prompt=self.prompt,+ arrays=arrays,+ times=times.copy(),+ plan=self._plan(+ where, mine, len(times), audio_span, history, None, extra+ ),+ model=None,+ )+ velocity = unpatchify_video(+ output[:, int(condition.shape[1]) :], f1 - f0, *self.grid, channels=24+ ).float()+ if index == 3:+ current = current + sigma * velocity+ break+ current = (1.0 - sigma_next) * (+ current + sigma * velocity+ ) + sigma_next * self._draw(shape)+ jitter = self._draw(shape)+ times[mine[0] : mine[1]] = CLEAN_LEVEL+ self.core._run(+ video_rows=torch.cat(+ (+ condition,+ patchify_video(CLEAN_LEVEL * current + (1 - CLEAN_LEVEL) * jitter),+ ),+ dim=1,+ ),+ audio_rows=self.audio,+ prompt=self.prompt,+ arrays=arrays,+ times=times.copy(),+ plan=self._plan(+ where, mine, len(times), audio_span, history, ("clean", c), extra+ ),+ model=None,+ )+ self.index += 1+ return currentdiff --git a/reactor/solarrenderer_types.py b/reactor/solarrenderer_types.pynew file mode 100644index 0000000..c9877db--- /dev/null+++ b/reactor/solarrenderer_types.py@@ -0,0 +1,66 @@+"""Client state, generated video and explicit progress broadcasts."""++from reactor_runtime import (+ InputField,+ InputState,+ MessageField,+ ModelMessage,+ Output,+ Video,+)+from solarrenderer_model import SolarAnchor+++class SolarState(InputState):+ prompt: str = InputField(+ default="",+ moderate=True,+ max_length=16000,+ description="Six-part rendering prompt, captured when Start is pressed. Changes apply to the next video.",+ )+ seed: int = InputField(+ default=0, ge=0, le=2**32 - 1, description="Random seed captured at Start."+ )+ paused: bool = InputField(+ default=False,+ description="Pause at the next block boundary; already buffered frames may still play.",+ )+ _structure: bytes | None = None+ _reference: bytes | None = None+ _anchor: SolarAnchor | None = None+ _world_id: int = 0+ _applied_id: int | None = None+ _chunks: int = 0+ _frames: int = 0+ _active: bool = False+ _complete: bool = False+++class SolarOutput(Output):+ main_video: Video+++class StateUpdate(ModelMessage):+ """Full shared state after a command, connection or generated block."""++ prompt: str = MessageField(description="Prompt staged for the next Start.")+ seed: int = MessageField(description="Seed staged for the next Start.")+ paused: bool = MessageField(description="Whether generation is paused.")+ has_structure: bool = MessageField(+ description="Whether a valid structure video has been selected."+ )+ has_reference: bool = MessageField(+ description="Whether an appearance reference has been selected."+ )+ world_id: int = MessageField(+ description="ID of the current video, zero before Start."+ )+ chunks: int = MessageField(+ description="Completed generation blocks in the current video."+ )+ frames: int = MessageField(description="RGB frames emitted in the current video.")+ active: bool = MessageField(description="Whether a video is being generated.")+ complete: bool = MessageField(description="Whether the finite video has completed.")+ elapsed: float | None = MessageField(+ description="Runtime-measured seconds for the last block; null on state transitions."+ )diff --git a/reactor/solarrenderer_vae.py b/reactor/solarrenderer_vae.pynew file mode 100644index 0000000..5e78d9b--- /dev/null+++ b/reactor/solarrenderer_vae.py@@ -0,0 +1,118 @@+"""Shard independent native VAE spatial tiles across ranks and stitch in native order.++The tested profile batches equally shaped tiles and leaves compilation disabled.+Adapted from the Reactor H3 infrastructure tutorial implementation.+"""++from __future__ import annotations++import torch+import torch.distributed as dist+++def _undo_only(undo):+ """Uninstall for the paths that never patched `_decode_clip` (single rank, or no distributed)."""++ def uninstall():+ for u in reversed(undo):+ u()++ return uninstall+++def install(+ vae, group=None, batched: bool | None = None, compile_mode: str | None = None+):+ """Install spatial tile sharding and return its uninstall function."""+ if batched is None:+ batched = True++ undo = []+ if compile_mode:+ eager_decoder = vae.decoder+ vae.decoder = torch.compile(eager_decoder, mode=compile_mode, dynamic=False)++ def _restore_decoder():+ vae.decoder = eager_decoder+ torch._dynamo.reset()++ undo.append(_restore_decoder)++ if not (dist.is_available() and dist.is_initialized()):+ return _undo_only(undo)++ group = group or dist.group.WORLD+ world = dist.get_world_size(group)+ rank = dist.get_rank(group)+ if world == 1:+ return _undo_only(undo)++ original = vae._decode_clip++ def sharded_decode_clip(z: torch.Tensor) -> torch.Tensor:+ if not vae.use_tiling:+ return original(z)++ height = z.shape[-2] * vae.spatial_compression_ratio+ width = z.shape[-1] * vae.spatial_compression_ratio+ y_indices, y_lengths, y_overlaps = vae._split_tiles(+ height, vae.tile_sample_min_height, vae.tile_sample_min_overlap_height+ )+ x_indices, x_lengths, x_overlaps = vae._split_tiles(+ width, vae.tile_sample_min_width, vae.tile_sample_min_overlap_width+ )+ ratio = vae.spatial_compression_ratio++ coords = [+ (y_indices[i], y_lengths[i], x_indices[j], x_lengths[j])+ for i in range(len(y_indices))+ for j in range(len(x_indices))+ ]+ # Contiguous blocks, not round-robin: `all_gather` concatenates rank 0's block, then rank+ # 1's, and so on, so contiguous assignment is what puts the tiles back in tile order for+ # free. The list is padded up to an equal count per rank so the gather stays a plain+ # fixed-size one; the padding entries are recomputed duplicates of the last tile, at most+ # world-1 of them, and are dropped after the gather.+ per_rank = (len(coords) + world - 1) // world+ padded = coords + [coords[-1]] * (per_rank * world - len(coords))+ mine = padded[rank * per_rank : (rank + 1) * per_rank]++ slices = [+ z[+ ...,+ y // ratio : y // ratio + y_len // ratio,+ x // ratio : x // ratio + x_len // ratio,+ ]+ for y, y_len, x, x_len in mine+ ]+ if batched:+ local_stack = vae.decoder(vae.post_quant_conv(torch.cat(slices, dim=0)))+ else:+ local_stack = torch.stack(+ [vae.decoder(vae.post_quant_conv(s)) for s in slices], dim=0+ ).squeeze(1)++ gathered = [torch.empty_like(local_stack) for _ in range(world)]+ dist.all_gather(gathered, local_stack, group=group)+ flat = torch.cat(gathered, dim=0)[: len(coords)]++ # `_stitch_tiles` only touches dims -2/-1, so a missing batch axis would not raise — it+ # would return `(3, T, H, W)` and `_decode` would then slice the height axis where it means+ # to slice frames. Restore the axis explicitly.+ rows, index = [], 0+ for _ in range(len(y_indices)):+ row = []+ for _ in range(len(x_indices)):+ row.append(flat[index].unsqueeze(0))+ index += 1+ rows.append(row)+ return vae._stitch_tiles(rows, y_overlaps, x_overlaps)++ vae._decode_clip = sharded_decode_clip++ def uninstall():+ vae._decode_clip = original+ for u in reversed(undo):+ u()++ return uninstalldiff --git a/reactor/tests/test_solarrenderer.py b/reactor/tests/test_solarrenderer.pynew file mode 100644index 0000000..5e93ed6--- /dev/null+++ b/reactor/tests/test_solarrenderer.py@@ -0,0 +1,257 @@+"""Exercise the real application hooks and model bookkeeping without a GPU."""++import asyncio+import io+import subprocess+import sys+from types import SimpleNamespace++import av+import numpy as np+import pytest+from PIL import Image+from reactor_runtime import ApplicationError, CommandError, StepOutcome, UploadedFile+from solarrenderer import SolarRenderer+from solarrenderer_media import validate_reference, validate_structure+from solarrenderer_model import SolarAnchor, SolarInput, SolarModel, SolarResult+from solarrenderer_types import SolarState+++def app():+ model = SolarRenderer()+ model.state = SolarState()+ messages = []++ async def send(message):+ messages.append(message)++ model.send = send+ model.output = SimpleNamespace(flush=lambda: None)+ return model, messages+++def test_refusal_prevents_model_call():+ model, _ = app()+ model.engine = SimpleNamespace(+ generate=lambda _: pytest.fail("refused step reached model")+ )+ with pytest.raises(ApplicationError):+ asyncio.run(model.process_input())+ with pytest.raises(CommandError, match="structure"):+ asyncio.run(model.start())+++def test_anchor_acknowledgment_and_fixed_prompt():+ model, messages = app()+ model.state._structure = b"validated video"+ with pytest.raises(CommandError):+ asyncio.run(model.start())+ asyncio.run(model.set_prompt("first prompt"))+ asyncio.run(model.start())+ first = asyncio.run(model.process_input())+ assert first.anchor.prompt == "first prompt"+ assert asyncio.run(model.process_input()).anchor is first.anchor+ asyncio.run(model.set_prompt("next video"))+ assert asyncio.run(model.process_input()).anchor.prompt == "first prompt"+ result = SolarResult(+ world_id=first.world_id, chunk_index=1, frames=None, complete=False+ )+ asyncio.run(model.process_output(StepOutcome(result=result, elapsed=0.5)))+ assert asyncio.run(model.process_input()).anchor is None+ assert messages[-1].chunks == 1 and messages[-1].elapsed == 0.5+ asyncio.run(model.start())+ next_input = asyncio.run(model.process_input())+ assert next_input.world_id == first.world_id + 1+ assert next_input.anchor.prompt == "next video"+++def test_generate_reads_only_input():+ model, _ = app()+ supplied = SolarInput(world_id=11)+ result = SolarResult(world_id=11, chunk_index=1, frames=None, complete=False)++ def generate(value):+ assert value is supplied+ return result++ model.engine = SimpleNamespace(generate=generate)+ model.state = None+ assert model.generate(supplied) is result+++def test_failure_does_not_acknowledge_or_complete():+ model, messages = app()+ error = RuntimeError("compute failed")+ with pytest.raises(RuntimeError, match="compute failed"):+ asyncio.run(model.process_output(StepOutcome(error=error, elapsed=0.1)))+ assert model.state._applied_id is None and model.state._chunks == 0+ assert not messages+++def test_pause_completion_and_session_reset():+ model, _ = app()+ model.state._structure = b"video"+ model.state.prompt = "scene"+ asyncio.run(model.start())+ asyncio.run(model.set_paused(True))+ with pytest.raises(ApplicationError):+ asyncio.run(model.process_input())+ asyncio.run(model.set_paused(False))+ result = SolarResult(+ world_id=1,+ chunk_index=10,+ frames=np.zeros((5, 2, 2, 3), np.uint8),+ complete=True,+ )+ output = asyncio.run(model.process_output(StepOutcome(result=result, elapsed=0.2)))+ assert output.main_video.shape == (5, 2, 2, 3)+ with pytest.raises(ApplicationError):+ asyncio.run(model.process_input())+ calls = []+ model.engine = SimpleNamespace(reset=lambda: calls.append("reset"))+ model.on_session_ended()+ assert calls == ["reset"]+ assert not hasattr(SolarRenderer, "on_disconnected")+ assert SolarState().seed == 0 and SolarState()._anchor is None+++ "command,mime", [("set_structure", "video/mp4"), ("set_reference", "image/png")]+)+def test_bad_upload_refused(command, mime):+ model, messages = app()+ with pytest.raises(CommandError):+ asyncio.run(+ getattr(model, command)(+ UploadedFile(name="bad", mime_type=mime, data=b"bad")+ )+ )+ assert model.state._structure is None and model.state._reference is None+ assert not messages+++def test_model_bookkeeping_and_failure():+ backend = SimpleNamespace(+ begin=lambda _: None, reset=lambda: None, step=lambda: (None, False)+ )+ model = SolarModel()+ model._backend = backend+ with pytest.raises(ValueError):+ model.generate(SolarInput(world_id=1))+ anchor = SolarAnchor(structure=b"video", reference=None, prompt="scene", seed=7)+ assert model.generate(SolarInput(world_id=1, anchor=anchor)).chunk_index == 1++ def fail():+ raise RuntimeError("failed")++ backend.step = fail+ with pytest.raises(RuntimeError):+ model.generate(SolarInput(world_id=1))+ backend.step = lambda: (None, True)+ assert model.generate(SolarInput(world_id=1)).chunk_index == 2+ with pytest.raises(RuntimeError, match="complete"):+ model.generate(SolarInput(world_id=1))+ model.reset()+ assert model.generate(SolarInput(world_id=2, anchor=anchor)).chunk_index == 1+++def test_model_imports_without_runtime():+ script = """+import sys+class BlockRuntime:+ def find_spec(self, fullname, path=None, target=None):+ if fullname.startswith("reactor_runtime"):+ raise RuntimeError("model imported Runtime")+sys.meta_path.insert(0, BlockRuntime())+import solarrenderer_model+import solarrenderer_backend+import solarrenderer_distributed+"""+ subprocess.run([sys.executable, "-c", script], check=True)+++def test_four_gpu_runner_configuration(monkeypatch, tmp_path):+ import solarrenderer+ from solarrenderer_distributed import FourModel++ calls = {}+ settings = object()+ monkeypatch.setattr(solarrenderer, "get_weights_path", lambda: str(tmp_path))+ monkeypatch.setattr(solarrenderer, "read_settings", lambda *_: settings)++ class Runner:+ def __init__(self, model, **kwargs):+ calls.update(model=model, **kwargs)++ def start(self):+ calls["started"] = True++ monkeypatch.setattr(solarrenderer, "DistributedRunner", Runner)+ SolarRenderer().load(tmp_path / "solarrenderer.yaml")+ assert calls["model"] is FourModel+ assert calls["world_size"] == 4+ assert calls["init_process_group"] is True+ assert calls["load_kwargs"] == {"settings": settings}+ assert calls["started"]+++def test_four_model_uses_runner_rank_context(monkeypatch):+ import solarrenderer_distributed as distributed++ calls = []+ monkeypatch.setattr(+ distributed,+ "FourBackend",+ lambda *args: calls.append(args) or SimpleNamespace(reset=lambda: None),+ )+ model = distributed.FourModel()+ model.device, model.rank, model.world_size = "cuda:2", 2, 4+ settings = object()+ model.load(settings)+ assert calls == [(settings, "cuda:2", 2, 4)]+ model.reset()+++def test_validated_reference_is_only_staged():+ buffer = io.BytesIO()+ Image.new("RGB", (16, 16), "red").save(buffer, format="PNG")+ data = buffer.getvalue()+ model, _ = app()+ asyncio.run(+ model.set_reference(+ UploadedFile(name="red.png", mime_type="image/png", data=data)+ )+ )+ assert model.state._reference == data+ assert not model.state._active+ asyncio.run(model.clear_reference())+ assert model.state._reference is None++[email protected]("frames,valid", [(5, False), (158, True), (170, True)])+def test_video_minimum_and_bounded_decode(frames, valid):+ buffer = io.BytesIO()+ with av.open(buffer, "w", format="mp4") as container:+ stream = container.add_stream("libx264", rate=24)+ stream.width = stream.height = 16+ stream.pix_fmt = "yuv420p"+ for _ in range(frames):+ frame = av.VideoFrame.from_ndarray(+ np.zeros((16, 16, 3), np.uint8), format="rgb24"+ )+ for packet in stream.encode(frame):+ container.mux(packet)+ for packet in stream.encode():+ container.mux(packet)+ if valid:+ validate_structure(buffer.getvalue())+ else:+ with pytest.raises(ValueError, match="158"):+ validate_structure(buffer.getvalue())+++def test_image_pixel_limit():+ buffer = io.BytesIO()+ Image.new("1", (4097, 4096)).save(buffer, format="PNG")+ with pytest.raises(ValueError, match="megapixel"):+ validate_reference(buffer.getvalue())