@usemosio/cli-win32-x64 1.0.0-next.2 → 1.0.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/apps/studio/dist/assets/{Workspace-DsbQ04kb.js → Workspace-Dr-hVeFd.js} +1 -1
  2. package/apps/studio/dist/assets/{agent-panel-DUWPbpew.js → agent-panel-DMrVed-J.js} +1 -1
  3. package/apps/studio/dist/assets/{boundary-DuK3AiqM.js → boundary-DL9veUlN.js} +1 -1
  4. package/apps/studio/dist/assets/{index-DPLtb0kT.js → index-C6juWzGV.js} +82 -3
  5. package/apps/studio/dist/assets/{inspector3d-B8pkZTye.js → inspector3d-sqergHSP.js} +1 -1
  6. package/apps/studio/dist/index.html +1 -1
  7. package/bin/mosio-agent.exe +0 -0
  8. package/bin/mosio.exe +0 -0
  9. package/crates/mosio/src/adapters/mosio-three.js +1 -1
  10. package/crates/mosio/src/runtime.js +79 -0
  11. package/fixtures/cloudrun-gpu/audio/music.wav +0 -0
  12. package/fixtures/cloudrun-gpu/audio/vo.wav +0 -0
  13. package/fixtures/cloudrun-gpu/mosio.json +18 -0
  14. package/fixtures/cloudrun-gpu/scenes/cube.html +25 -0
  15. package/fixtures/direct-seek/mosio.json +4 -0
  16. package/fixtures/direct-seek/scenes/clock.html +9 -0
  17. package/fixtures/direct-seek/scenes/meta.html +11 -0
  18. package/fixtures/direct-seek/scenes/pure.html +11 -0
  19. package/fixtures/direct-seek/scenes/slow.html +11 -0
  20. package/fixtures/direct-seek-media/mosio.json +6 -0
  21. package/fixtures/direct-seek-media/scenes/pure.html +11 -0
  22. package/fixtures/gl-readback/mosio.json +16 -0
  23. package/fixtures/gl-readback/scenes/compositor.html +23 -0
  24. package/fixtures/gl-readback/scenes/readback.html +23 -0
  25. package/package.json +1 -1
  26. package/scripts/acceptance/direct-seek.sh +68 -0
  27. package/scripts/acceptance/frames.sh +7 -2
  28. package/scripts/check-error-codes.py +1 -1
  29. package/scripts/check-file-size.sh +0 -4
  30. package/scripts/gen-media-fixtures.sh +1 -0
  31. package/scripts/gl-readback-check.sh +26 -0
  32. package/scripts/platform-smoke.sh +16 -3
  33. package/scripts/user-journey.sh +68 -0
  34. package/skills/mosio-3d/SKILL.md +30 -2
  35. package/skills/mosio-engine/references/checks.md +1 -1
  36. package/skills/mosio-engine/references/project.md +12 -0
  37. package/skills/mosio-engine/references/timeline.md +1 -1
  38. package/skills/mosio-media/references/captions.md +4 -1
@@ -6,7 +6,8 @@
6
6
  #
7
7
  # <fonts-dir> holds Inter-ExtraBold.otf and Inter-Medium.otf; both platforms use the same files, so a difference in
8
8
  # the frames comes from the platform (rasteriser, encoder), not from the fonts. Projects: fixtures/w1-kinetic and the
9
- # two speed projects tests/bench/p1 ("titles", 10 s) and tests/bench/p2 ("dense", 30 s), all 1080x1920 at 30 fps.
9
+ # two speed projects tests/bench/p1 ("titles", 10 s) and tests/bench/p2 ("dense", 30 s), all 1080x1920 at 30 fps, and
10
+ # tests/platform/captions (SRT captions through libass with a declared font; no fc-scan or fontconfig needed).
10
11
  # Each capture mode given (default: the screenshot path only; "canvas" adds `--capture canvas` when this build has it)
11
12
  # renders every project once, with --no-cache. Writes <out>/<project>-<capture>.mp4 and <out>/timings.tsv.
12
13
  set -euo pipefail
@@ -24,9 +25,9 @@ PY=$(command -v python3 || command -v python)
24
25
  trap 'rm -rf "$WORK"' EXIT
25
26
 
26
27
  printf 'project\tcapture\tframes\tseconds\n' > "$OUT/timings.tsv"
27
- for proj in fixtures/w1-kinetic tests/bench/p1 tests/bench/p2; do
28
+ for proj in fixtures/w1-kinetic tests/bench/p1 tests/bench/p2 tests/platform/captions; do
28
29
  name=$(basename "$proj")
29
- [ "$name" = w1-kinetic ] || name=bench-$name
30
+ case $proj in tests/bench/*) name=bench-$name ;; tests/platform/*) name=platform-$name ;; esac
30
31
  d="$WORK/$name"
31
32
  cp -R "$REPO/$proj" "$d"
32
33
  mkdir -p "$d/assets/fonts"
@@ -54,6 +55,18 @@ for proj in fixtures/w1-kinetic tests/bench/p1 tests/bench/p2; do
54
55
  done
55
56
  done
56
57
 
58
+ # One composited frame of the captions project through `mosio media frame` (the command that stopped on Windows with
59
+ # "spawning fc-scan: program not found"): the caption must be drawn in its band.
60
+ d="$WORK/platform-captions"
61
+ "$MOSIO" media frame "$d" --frame 20 -o "$OUT/platform-captions-f20.png" > "$WORK/frame.json" || { cat "$WORK/frame.json" >&2; exit 1; }
62
+ # the background is a dark gradient (luma under 110); white caption text in the band above the bottom margin is not
63
+ ymax=$(ffmpeg -hide_banner -nostdin -i "$OUT/platform-captions-f20.png" -vf "crop=1080:400:0:1300,format=yuv444p,signalstats,metadata=print:key=lavfi.signalstats.YMAX" -f null - 2>&1 | grep -o 'YMAX=[0-9]*' | tail -1 | cut -d= -f2)
64
+ if [ "${ymax:-0}" -lt 200 ]; then
65
+ echo "[smoke] captions: media frame 20 has no caption in the caption band (max luma ${ymax:-none})" >&2
66
+ exit 1
67
+ fi
68
+ echo "[smoke] captions: media frame 20 draws the caption"
69
+
57
70
  # The render daemon (MOSIO_DAEMON=1, opt-in): two renders of bench-p1 through it must give the same bytes as the
58
71
  # in-process render above. The first starts the daemon, the second reuses its warm browser; it quits after 20 s idle.
59
72
  d="$WORK/bench-p1"
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env bash
2
+ # A user's first hour on a Mac or Windows PC (run by .github/workflows/mac-test.yml; Windows in Git Bash): install the CLI from npm, set it up, check the
3
+ # machine, make and render a project twice, then a plain three.js scene (a WebGLRenderer drawn from __mosio.onSeek, as
4
+ # users write it) on the CPU and on the GPU. Each step's output and time go to $1/out/journey.md; the videos too. Every
5
+ # step runs even when one before it failed; the script fails at the end when any did.
6
+ set -u
7
+ ROOT=${1:?work dir}; OUT=$ROOT/out; mkdir -p "$OUT"; REPORT=$OUT/journey.md; FAILED=0
8
+ CLI=${CLI:-@usemosio/cli@next}
9
+ OSV=$( (sw_vers -productVersion 2>/dev/null && echo macOS) || (cmd //c ver 2>/dev/null | tr -d "\r" | grep -o "Version.*") || uname -sr)
10
+ echo "# User journey ($(uname -m), $OSV, $CLI)" > "$REPORT"
11
+
12
+ step() { # step <name> <command...>
13
+ local name=$1; shift; local t0=$(date +%s); local log=$OUT/$name.log
14
+ "$@" > "$log" 2>&1; local rc=$?; local dt=$(( $(date +%s) - t0 ))
15
+ [ $rc -eq 0 ] && s=ok || { s="FAILED ($rc)"; FAILED=1; }
16
+ printf '\n## %s: %s, %ss\n\n```\n%s\n```\n' "$name" "$s" "$dt" "$(tail -40 "$log")" >> "$REPORT"
17
+ echo "$name: $s ${dt}s"
18
+ }
19
+
20
+ step install npm i -g "$CLI"
21
+ step version mosio --version
22
+ step setup mosio setup
23
+ step doctor mosio doctor
24
+ step caps mosio caps
25
+
26
+ P=$ROOT/promo; mkdir -p "$P"
27
+ step init bash -c "cd '$P' && mosio init ."
28
+ step check bash -c "cd '$P' && mosio check ."
29
+ step render bash -c "cd '$P' && mosio render . -o out/promo.mp4"
30
+ step render-again bash -c "cd '$P' && mosio render . -o out/promo-again.mp4"
31
+ cp "$P"/out/*.mp4 "$OUT/" 2>/dev/null
32
+
33
+ # three.js the way users write it (plain WebGLRenderer, preserveDrawingBuffer), first on the CPU, then on the GPU
34
+ T=$ROOT/three; mkdir -p "$T/scenes"
35
+ cat > "$T/scenes/cube.html" <<'HTML'
36
+ <!doctype html>
37
+ <html><head><meta charset="utf-8"><style>html,body{margin:0;width:1280px;height:720px;overflow:hidden;background:#0b0d12}</style>
38
+ <script type="importmap">{"imports":{"three":"/_lib/three@0.187.0/build/three.module.js"}}</script></head>
39
+ <body><canvas id="c" width="1280" height="720"></canvas>
40
+ <script type="module">
41
+ import * as THREE from "three";
42
+ const renderer = new THREE.WebGLRenderer({ canvas: document.getElementById("c"), antialias: true, preserveDrawingBuffer: true });
43
+ const scene = new THREE.Scene(); scene.background = new THREE.Color("#0b0d12");
44
+ const camera = new THREE.PerspectiveCamera(45, 1280 / 720, 0.1, 100); camera.position.set(0, 1.2, 5); camera.lookAt(0, 0, 0);
45
+ scene.add(new THREE.HemisphereLight("#ffffff", "#334155", 1.2));
46
+ const sun = new THREE.DirectionalLight("#ffffff", 2); sun.position.set(3, 4, 5); scene.add(sun);
47
+ const cube = new THREE.Mesh(new THREE.BoxGeometry(1.6, 1.6, 1.6), new THREE.MeshStandardMaterial({ color: "#38bdf8", metalness: .3, roughness: .4 }));
48
+ scene.add(cube);
49
+ __mosio.onSeek(t => { cube.rotation.set(t * 0.6, t * 1.1, 0); renderer.render(scene, camera); });
50
+ </script></body></html>
51
+ HTML
52
+ mk() { # mk <webgl>
53
+ cat > "$T/mosio.json" <<JSON
54
+ { "mosio": 0, "name": "three-$1", "width": 1280, "height": 720, "fps": 30, "seed": 1, "background": "#0b0d12",
55
+ "libraries": ["three@0.187.0"], "renderer": { "webgl": "$1" },
56
+ "scenes": [ { "id": "cube", "src": "scenes/cube.html", "frames": 90 } ] }
57
+ JSON
58
+ }
59
+ mk swiftshader
60
+ step three-check bash -c "cd '$T' && mosio check ."
61
+ step three-render-cpu bash -c "cd '$T' && mosio render . -o out/three-cpu.mp4"
62
+ mk gpu
63
+ step three-render-gpu bash -c "cd '$T' && mosio render . -o out/three-gpu.mp4"
64
+ step three-still-gpu bash -c "cd '$T' && mosio media frame . --frame 75 -o out/three-gpu-f75.png"
65
+ cp "$T"/out/*.mp4 "$T"/out/*.png "$OUT/" 2>/dev/null
66
+
67
+ echo; cat "$REPORT"
68
+ exit $FAILED
@@ -26,11 +26,34 @@ actions, lip-sync from word timings, a toon look, cameras): `references/blender-
26
26
  | an animator's `.blend` with actions | Blender with the `.blend` as the scene |
27
27
  | a card tilt or parallax that only looks 3D | neither: CSS transforms in a normal scene |
28
28
 
29
+ A plain three.js `WebGLRenderer` (or raw WebGL) drawn from `__mosio.onSeek` needs no capture workaround on a GPU
30
+ profile: Mosio reads every WebGL canvas back after each seek and shows it through a 2D canvas over it (no
31
+ `preserveDrawingBuffer`, `gl.finish()` or `readPixels` → `putImageData` in the scene). `data-mosio-present="compositor"`
32
+ on a canvas turns that off.
33
+
29
34
  Run `mosio caps --project P` before committing to a route: it reports whether this machine can render `webgl2`,
30
35
  `blender-eevee` or `blender-cycles`, and whether a GPU is there.
31
36
 
37
+ ### WebGL on the GPU (`renderer.webgl`)
38
+
39
+ Without a `renderer` entry WebGL renders on the CPU (SwiftShader): bit-exact on every machine, but a heavy three.js
40
+ scene takes minutes per frame. On a machine with a GPU (`mosio caps` says `"gpu_present": true`) add
41
+
42
+ ```json
43
+ "renderer": { "webgl": "gpu" }
44
+ ```
45
+
46
+ to `mosio.json`: frames take seconds. `mosio check` and `mosio caps --project P` suggest it (`W_WEBGL_ON_CPU`) when a
47
+ three.js project would render on the CPU on a machine with a GPU. The profile uses ANGLE on Direct3D 11 on Windows and
48
+ on EGL on Linux; `mosio caps` probes it as `chromium["webgl-gpu"]`, whose `software.webgl` must be `false` (`true`
49
+ means the browser fell back to a software rasteriser such as WARP, "Microsoft Basic Render Driver"). Values: `webgl`
50
+ `"swiftshader"` (default) | `"gpu"`; `webgpu` `"off"` (default) | `"swiftshader"` | `"gpu"`. A GPU render repeats
51
+ exactly only on the same GPU and driver; render the final on the machine (or the Hub) that will render it again.
52
+
32
53
  On a GPU profile the determinism canary (one frame rendered twice) may accept two GPU frames that differ within a small
33
- tolerance; the render report then says "within tolerance". Set `"renderer": { "canary": "exact" }` when the output must
54
+ tolerance; the render report then says "within tolerance" and the render's `warnings` carry
55
+ `W_CANARY_WITHIN_TOLERANCE` with the numbers (a few pixels 1/255 apart is GPU noise, not a scene bug; no
56
+ `--no-canary` needed). Set `"renderer": { "canary": "exact" }` when the output must
34
57
  repeat bit for bit. When the canary fails (`E_NONDETERMINISTIC`), the frames and their difference are in
35
58
  `<output>.canary/` (for `out.mp4`, `out.mp4.canary/`).
36
59
 
@@ -59,7 +82,12 @@ Starting points; adjust timing with `mosio-engine` `references/timing.md`.
59
82
  3. **Check:** `mosio check P`; Blender scene files are validated too (errors name the field and, for materials, the real
60
83
  names in the GLB).
61
84
  4. **Look:** `mosio stills P --at` at the start, middle and end of every camera move and at the hold. Look for parts
62
- through the floor, clipping at the frame edge, a dark side, labels drifting off their part.
85
+ through the floor, clipping at the frame edge, a dark side, labels drifting off their part. A still replays its
86
+ scene from frame 0, so a heavy frame late in a long scene costs every frame before it. When the scene draws each
87
+ frame from the frame number alone (the kit scenes do; no state carried between `onSeek` calls), add
88
+ `"seek": "direct"` to the scene in `mosio.json` (or pass `--direct`) and stills, frames and `media frame` seek
89
+ straight to the frame. Renders always replay. Check it once: `mosio frames P --scene S --frames 90,10,60 --direct`
90
+ gives the same hashes as the same frames of `mosio frames P --scene S`.
63
91
  5. **Render:** Blender is slow, Cycles slower; render one shot at a time and keep samples low until the look is settled.
64
92
 
65
93
  ## Commands
@@ -30,7 +30,7 @@ hand-off record. Clear errors before warnings, and warnings before polish.
30
30
  | `W_MOTION_SCALE_FROM_ZERO` | an entrance starts at scale 0 | start at 0.05 (rule or bar) or 0.85 with opacity 0 |
31
31
  | `W_MOTION_OVERSHOOT_TEXT` | `back` or `elastic` on text | `power3.out` on text |
32
32
  | `W_LINT_SKIPPED` | scene too big for the lint | split it; nothing was linted |
33
- | `W_OPAQUE_SCENE` | the scene reads something untracked, so every edit re-renders it | literal URLs, declared assets |
33
+ | `W_OPAQUE_SCENE` | the scene reads something untracked (eval, computed `fetch()`/`import()`, a computed `src`/`href` given to an element by property or `setAttribute`), so every edit re-renders it; a data object's `src` field and `import("/shared/x.js")` with a literal are tracked | literal URLs, declared assets |
34
34
  | `E_UNDECLARED_READ`, `E_REMOTE_URL`, `E_UNDECLARED_LIBRARY` | undeclared file, remote URL, undeclared library | declare or remove |
35
35
  | `E_ASSET_MISSING`, `E_SYMLINK`, `E_TRANSITION_*`, `E_MANIFEST` | manifest or files wrong | see `docs/TROUBLESHOOTING.md` |
36
36
 
@@ -39,6 +39,18 @@ Project files must be regular files (a symlink is `E_SYMLINK`). Never touch `.mo
39
39
  network for anything else.
40
40
  - `background` is `#RRGGBB[AA]` or `transparent` (overlay work). Set the scene's own `body` background as well.
41
41
  - Scene ids are unique, short and stable; they prefix the semantic ids.
42
+ - `renderer` picks the Chromium profile; leave it out for 2D work. `"renderer": { "webgl": "gpu" }` renders WebGL
43
+ (three.js) on the machine's GPU: seconds per frame where the CPU baseline (`"swiftshader"`, the default) takes
44
+ minutes for a heavy 3D scene. `webgl` is `"swiftshader"` or `"gpu"`, `webgpu` is `"off"` (default), `"swiftshader"`
45
+ or `"gpu"`, `canary` is `"auto"` (default), `"exact"` or `"tolerance"`. A GPU profile needs a GPU (`mosio caps`
46
+ reports `gpu_present`; otherwise `E_CAPABILITY_UNAVAILABLE`) and is exact only on the same GPU and driver.
47
+ `mosio check` and `mosio caps --project P` say `W_WEBGL_ON_CPU` when a three.js project would render on the CPU on
48
+ a machine that has a GPU. Details: the `mosio-3d` skill and `docs/3d/RENDERERS.md`.
49
+ - A scene may say `"seek": "direct"`: single frames (`stills`, `preview`, `frames`, `media frame`) then seek straight
50
+ to the frame instead of replaying the scene from frame 0. Only for a scene whose picture is a pure function of the
51
+ frame number (heavy 3D or canvas scenes drawn in `onSeek`); a scene that uses the clock, rAF, timers or RNG after
52
+ load is replayed anyway. Renders always replay, and the field is never part of a cache key. `--direct` on those
53
+ commands does the same for one call.
42
54
 
43
55
  ## Frame math
44
56
 
@@ -27,7 +27,7 @@ the timeline position. The rules below keep it that way; the lint codes (`W_GSAP
27
27
  |---|---|---|
28
28
  | `repeat: -1` (`W_GSAP_REPEAT_INFINITE`) | infinite duration | a finite `repeat` that fits the scene, or one longer tween |
29
29
  | `gsap.utils.random`, `"random(...)"`, `Math.random` driving layout (`W_GSAP_RANDOM`) | values shift when tweens are added | literals; or `__mosio.random()` (seeded per scene) computed once into constants |
30
- | `Date.now()`, `performance.now()`, `setTimeout` for visuals | wall-clock thinking | timeline positions |
30
+ | `Date.now()`, `performance.now()`, `setTimeout` for visuals | wall-clock thinking; in a render they are the frame time and stand still within a frame (timing code measures 0 ms: profile in a normal browser or read `<output>.trace.json`) | timeline positions |
31
31
  | function-valued properties (`x: () => ...`, `W_GSAP_FUNCTION_VALUE`) | run at first render and can read layout | compute numbers first, pass literals |
32
32
  | building the timeline after `await`/`.then`/timer (`W_GSAP_LATE_TIMELINE`) | early frames render before tweens exist | build synchronously; if you must wait, hold the frame with `const h = __mosio.delayFrame('data'); ... h.done()` before registering |
33
33
  | `gsap.from()` or `from` on an element that is already hidden (`W_GSAP_FROM_HIDDEN`) | animates 0 to 0, never appears | `fromTo` with explicit start and end |
@@ -21,7 +21,10 @@ Subtitles and spoken-word highlighting are native. Reach for HTML only for a loo
21
21
  ```
22
22
 
23
23
  - Every font must be listed (`fonts` and `assets`): libass sees only declared files, never system fonts. `style.font` is the
24
- font's internal family name (see `references/project.md` in the `mosio-engine` skill). Sizes and margins are output pixels; colours `#RRGGBB`.
24
+ font's internal family name (see `references/project.md` in the `mosio-engine` skill): the family (name ID 1, `Lilita One`)
25
+ or the typographic family that groups the weights (`Inter` for `Inter-ExtraBold.otf`; the declared weight nearest to
26
+ `bold` is used). Mosio reads the names from the files itself (no fc-scan), the same on Linux, macOS and Windows; an
27
+ unknown name is `E_CAPTION_FONT` with the names the files provide. Sizes and margins are output pixels; colours `#RRGGBB`.
25
28
  - A project with `captions` or `tracks` takes the hybrid path; `mosio media frame P --frame N -o out.png` renders one exact
26
29
  composited frame to look at, and `mosio media edit P caption-text cc INDEX "text"` fixes one cue's text.
27
30
  - Errors: `E_CAPTION_FORMAT` (also a `.json` word list on a track without the preset), `E_CAPTION_PARSE`,