@usemosio/cli-linux-x64 1.0.0-next.1 → 1.0.0-next.2

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 (163) hide show
  1. package/THIRD_PARTY_NOTICES.md +22 -0
  2. package/apps/studio/dist/assets/Workspace-DsbQ04kb.js +34 -0
  3. package/apps/studio/dist/assets/{agent-panel-CqJuv5Sn.js → agent-panel-DUWPbpew.js} +5 -5
  4. package/apps/studio/dist/assets/{boundary-bK2S8z05.js → boundary-DuK3AiqM.js} +1 -1
  5. package/apps/studio/dist/assets/{feedback-BqzXUdVd.js → feedback-x6ZumR_x.js} +1 -1
  6. package/apps/studio/dist/assets/index-CjDBKmB_.css +2 -0
  7. package/apps/studio/dist/assets/index-DPLtb0kT.js +1905 -0
  8. package/apps/studio/dist/assets/inspector3d-B8pkZTye.js +1 -0
  9. package/apps/studio/dist/index.html +4 -3
  10. package/apps/studio/dist-host/studio-host.mjs +262 -3
  11. package/bin/mosio +0 -0
  12. package/bin/mosio-agent +0 -0
  13. package/crates/mosio/src/adapters/mosio-three.js +111 -7
  14. package/crates/mosio/src/adapters/room-env-pmrem.json +1 -0
  15. package/crates/mosio/src/runtime.js +126 -6
  16. package/fixtures/camera-inspect/mosio.json +56 -0
  17. package/fixtures/camera-inspect/scenes/behind.html +22 -0
  18. package/fixtures/camera-inspect/scenes/cut.html +18 -0
  19. package/fixtures/camera-inspect/scenes/edges.html +18 -0
  20. package/fixtures/camera-inspect/scenes/good.html +23 -0
  21. package/fixtures/camera-inspect/scenes/read.html +22 -0
  22. package/fixtures/camera-inspect/scenes/shake.html +23 -0
  23. package/fixtures/camera-inspect/scenes/speed.html +18 -0
  24. package/fixtures/camera-inspect-vertical/mosio.json +31 -0
  25. package/fixtures/camera-inspect-vertical/scenes/good.html +20 -0
  26. package/fixtures/camera-inspect-vertical/scenes/safe.html +18 -0
  27. package/fixtures/inspect-physics/expect.json +18 -0
  28. package/fixtures/inspect-physics/mosio.json +29 -0
  29. package/fixtures/inspect-physics/scenes/calm.html +46 -0
  30. package/fixtures/inspect-physics/scenes/physics.html +47 -0
  31. package/package.json +1 -1
  32. package/primitives/README.md +23 -2
  33. package/primitives/example/shared/mosio-prims.js +349 -1
  34. package/primitives/impact-burst/golden/f030.png +0 -0
  35. package/primitives/impact-burst/golden/f032.png +0 -0
  36. package/primitives/impact-burst/golden/f036.png +0 -0
  37. package/primitives/impact-burst/impact-burst.js +51 -0
  38. package/primitives/impact-burst/primitive.json +130 -0
  39. package/primitives/impact-burst/scene.html +24 -0
  40. package/primitives/stick-figure/golden/f030.png +0 -0
  41. package/primitives/stick-figure/golden/f092.png +0 -0
  42. package/primitives/stick-figure/golden/f140.png +0 -0
  43. package/primitives/stick-figure/primitive.json +179 -0
  44. package/primitives/stick-figure/scene.html +40 -0
  45. package/primitives/stick-figure/stick-figure.js +297 -0
  46. package/primitives/zoom-through/primitive.json +7 -2
  47. package/primitives/zoom-through/zoom-through.js +6 -5
  48. package/scripts/3d-acceptance.sh +8 -1
  49. package/scripts/3d-attach-bench.mjs +119 -0
  50. package/scripts/3d-bake-room-env.mjs +74 -0
  51. package/scripts/3d-e2b-job.sh +1 -0
  52. package/scripts/3d-gen-heavy-fixture.py +65 -0
  53. package/scripts/3d-trace-summary.py +14 -0
  54. package/scripts/acceptance/camera-inspect.sh +49 -0
  55. package/scripts/acceptance/export.sh +5 -3
  56. package/scripts/acceptance/hardening.sh +37 -6
  57. package/scripts/acceptance/hub.sh +208 -0
  58. package/scripts/acceptance/inspect.sh +21 -2
  59. package/scripts/acceptance/revisions-git.sh +137 -0
  60. package/scripts/acceptance/revisions-sync.sh +323 -0
  61. package/scripts/acceptance/revisions.sh +118 -4
  62. package/scripts/acceptance/segcache.sh +100 -0
  63. package/scripts/acceptance/split.sh +78 -0
  64. package/scripts/bootstrap.sh +20 -1
  65. package/scripts/check-error-codes.py +8 -0
  66. package/scripts/check-file-size.sh +49 -0
  67. package/scripts/ci.sh +4 -4
  68. package/scripts/dedupe-report.sh +47 -0
  69. package/scripts/e2b/template/provision.sh +1 -1
  70. package/scripts/fastpath/cdp.mjs +25 -0
  71. package/scripts/fastpath/dbg.mjs +11 -0
  72. package/scripts/fastpath/e2b.mjs +40 -0
  73. package/scripts/fastpath/features/gen.py +109 -0
  74. package/scripts/fastpath/features/mosio.json +100 -0
  75. package/scripts/fastpath/features/scenes/backdrop.html +11 -0
  76. package/scripts/fastpath/features/scenes/blend.html +11 -0
  77. package/scripts/fastpath/features/scenes/canvas2d.html +11 -0
  78. package/scripts/fastpath/features/scenes/filter.html +11 -0
  79. package/scripts/fastpath/features/scenes/gradient.html +11 -0
  80. package/scripts/fastpath/features/scenes/iframe.html +11 -0
  81. package/scripts/fastpath/features/scenes/image.html +11 -0
  82. package/scripts/fastpath/features/scenes/svg.html +11 -0
  83. package/scripts/fastpath/features/scenes/text.html +11 -0
  84. package/scripts/fastpath/features/scenes/typo.html +11 -0
  85. package/scripts/fastpath/features/scenes/video.html +11 -0
  86. package/scripts/fastpath/features/scenes/video2.html +11 -0
  87. package/scripts/fastpath/features-xfade/mosio.json +49 -0
  88. package/scripts/fastpath/features-xfade/scenes/image.html +11 -0
  89. package/scripts/fastpath/features-xfade/scenes/video.html +11 -0
  90. package/scripts/fastpath/fixtures/gen_layout.py +80 -0
  91. package/scripts/fastpath/fixtures/l12-no-reset/assets/img/photo-1015.jpg +0 -0
  92. package/scripts/fastpath/fixtures/l12-no-reset/mosio.json +34 -0
  93. package/scripts/fastpath/fixtures/l12-no-reset/scenes/main.html +20 -0
  94. package/scripts/fastpath/fp.mjs +91 -0
  95. package/scripts/fastpath/inpage.js +68 -0
  96. package/scripts/fastpath/recipes.py +49 -0
  97. package/scripts/fastpath/sandbox.sh +68 -0
  98. package/scripts/fastpath/sandbox10.sh +57 -0
  99. package/scripts/fastpath/sandbox11.sh +18 -0
  100. package/scripts/fastpath/sandbox12.sh +30 -0
  101. package/scripts/fastpath/sandbox13.sh +16 -0
  102. package/scripts/fastpath/sandbox14.sh +28 -0
  103. package/scripts/fastpath/sandbox15.sh +36 -0
  104. package/scripts/fastpath/sandbox16.sh +60 -0
  105. package/scripts/fastpath/sandbox17.sh +34 -0
  106. package/scripts/fastpath/sandbox18.sh +59 -0
  107. package/scripts/fastpath/sandbox19.sh +67 -0
  108. package/scripts/fastpath/sandbox2.sh +41 -0
  109. package/scripts/fastpath/sandbox20.sh +34 -0
  110. package/scripts/fastpath/sandbox21.sh +22 -0
  111. package/scripts/fastpath/sandbox22.sh +22 -0
  112. package/scripts/fastpath/sandbox23.sh +21 -0
  113. package/scripts/fastpath/sandbox3.sh +151 -0
  114. package/scripts/fastpath/sandbox4.sh +161 -0
  115. package/scripts/fastpath/sandbox5.sh +69 -0
  116. package/scripts/fastpath/sandbox6.sh +85 -0
  117. package/scripts/fastpath/sandbox7.sh +81 -0
  118. package/scripts/fastpath/sandbox8.sh +62 -0
  119. package/scripts/fastpath/sandbox9.sh +130 -0
  120. package/scripts/fastpath/srv.mjs +15 -0
  121. package/scripts/fastpath/www/probe.html +1 -0
  122. package/scripts/hpbench/make-bench-fixtures.sh +43 -0
  123. package/scripts/hpbench/render-cgroup.sh +56 -0
  124. package/scripts/install.sh +2 -1
  125. package/scripts/npm-clean-install-proof-win.sh +64 -0
  126. package/scripts/platform-smoke.sh +67 -0
  127. package/scripts/prim.mjs +31 -13
  128. package/skills/mosio-3d/SKILL.md +1 -1
  129. package/skills/mosio-brief/SKILL.md +80 -0
  130. package/skills/mosio-brief/references/brief.md +141 -0
  131. package/skills/mosio-brief/references/copy.md +99 -0
  132. package/skills/mosio-brief/references/narration.md +61 -0
  133. package/skills/mosio-brief/references/storyboard.md +98 -0
  134. package/skills/mosio-collab/SKILL.md +104 -0
  135. package/skills/mosio-collab/references/hub.md +62 -0
  136. package/skills/mosio-engine/SKILL.md +44 -13
  137. package/skills/mosio-engine/references/camera.md +12 -2
  138. package/skills/mosio-engine/references/character.md +88 -0
  139. package/skills/mosio-engine/references/checks.md +10 -3
  140. package/skills/mosio-engine/references/delivery.md +29 -2
  141. package/skills/mosio-engine/references/kit-primitives.md +8 -4
  142. package/skills/mosio-engine/references/layout.md +8 -0
  143. package/skills/mosio-engine/references/plan.md +3 -1
  144. package/skills/mosio-engine/references/project.md +3 -3
  145. package/skills/mosio-engine/references/publish.md +79 -0
  146. package/skills/mosio-engine/references/registry.md +27 -15
  147. package/skills/mosio-engine/references/timeline.md +18 -0
  148. package/skills/mosio-engine/references/timing.md +2 -1
  149. package/skills/mosio-import/SKILL.md +1 -1
  150. package/skills/mosio-import/references/from-hyperframes.md +1 -1
  151. package/skills/mosio-import/references/from-remotion.md +1 -1
  152. package/skills/mosio-media/SKILL.md +16 -4
  153. package/skills/mosio-media/references/audio.md +29 -11
  154. package/skills/mosio-media/references/captions.md +22 -4
  155. package/skills/mosio-media/references/editing.md +70 -0
  156. package/skills/mosio-media/references/footage.md +40 -8
  157. package/skills/mosio-media/references/voice.md +52 -7
  158. package/skills/mosio-replicate/references/mosio.md +1 -1
  159. package/toolchain.lock.json +151 -4
  160. package/apps/studio/dist/assets/Workspace-KSOFeEgc.js +0 -32
  161. package/apps/studio/dist/assets/index-B-uuTqe9.js +0 -1785
  162. package/apps/studio/dist/assets/index-CajSh04l.css +0 -2
  163. package/apps/studio/dist/assets/inspector3d-vDz97X99.js +0 -1
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env bash
2
+ # Split render acceptance. Run as root in the sandbox; rendering runs as the `mosio` user.
3
+ # split-1 W3 (6 scenes, 5 transitions, two audio tracks): plan + parts + assemble decodes to the same frames and the
4
+ # same audio as one `mosio render`, and the result passes the container probe
5
+ # split-2 A/V sync (the fixture cut into two scenes at a flash boundary): the split render passes the flash/beep check
6
+ # split-3 refusals: a part of another project state, a missing part, a part given twice, a bad --part index
7
+ # split-4 a part that needs a neighbour's transition edge frames (halo) renders the same frames as the full run
8
+ set -uo pipefail
9
+ REPO="$(cd "$(dirname "$0")/../.." && pwd)"; cd "$REPO"
10
+ W=/home/mosio/acc-split; F="$REPO/fixtures"
11
+ cargo build --release --locked 2>&1 | tail -1
12
+ chmod -R o+rX "$REPO"
13
+ u() { scripts/as-user.sh "$1"; }
14
+ declare -A R
15
+ u "rm -rf $W && mkdir -p $W && cp -r $F/w3-promo $W/w3-promo && cp -r $F/w7-avsync $W/avsync2"
16
+ # the A/V sync fixture as two scenes of 150 frames (the flash and the beep both repeat every 30 frames)
17
+ u "cd $W && python3 -I -c \"
18
+ import json
19
+ j = json.load(open('avsync2/mosio.json'))
20
+ j['scenes'] = [{'id': 'sync-a', 'src': 'scenes/sync.html', 'frames': 150}, {'id': 'sync-b', 'src': 'scenes/sync.html', 'frames': 150}]
21
+ json.dump(j, open('avsync2/mosio.json', 'w'))
22
+ \""
23
+
24
+ # split-1
25
+ u "cd $W && mosio render w3-promo --no-cache -o out/w3-one.mp4 > w3-one.json 2> w3-one.err"
26
+ u "cd $W && mosio render w3-promo --plan --parts 3 -o out/w3.plan.json > w3-plan.json 2> w3-plan.err"
27
+ n=$(jq '.parts|length' "$W/w3-plan.json")
28
+ for ((i = n - 1; i >= 0; i--)); do # reverse order: parts do not depend on each other
29
+ u "cd $W && mosio render w3-promo --part $i --plan out/w3.plan.json --no-cache -o out/w3-part$i.mp4 > w3-part$i.json 2> w3-part$i.err"
30
+ done
31
+ parts=$(for ((i = 0; i < n; i++)); do printf 'out/w3-part%s.mp4 ' "$i"; done)
32
+ u "cd $W && mosio render-assemble w3-promo --plan out/w3.plan.json -o out/w3-split.mp4 $parts > w3-asm.json 2> w3-asm.err"
33
+ u "cd $W && mosio oracle hash out/w3-one.mp4 -o w3-one.decoded.json > /dev/null && mosio oracle hash out/w3-split.mp4 -o w3-split.decoded.json > /dev/null && mosio oracle compare w3-one.decoded.json w3-split.decoded.json > w3.cmp.json; mosio oracle compare out/w3-one.frames.json out/w3-split.frames.json > w3.rawcmp.json"
34
+ u "cd $W && mosio oracle probe out/w3-split.mp4 --fps 30 --frames 1800 > w3-split.probe.json"
35
+ if [ "$n" = 3 ] && jq -e '.equal' "$W/w3.cmp.json" >/dev/null && jq -e '.equal' "$W/w3.rawcmp.json" >/dev/null \
36
+ && jq -e '.ok and .problems==[]' "$W/w3-split.probe.json" >/dev/null && jq -e '.ok' "$W/w3-asm.json" >/dev/null; then R[split-1]=PASS; else R[split-1]=FAIL; fi
37
+ echo " W3 split: parts=$n cmp=$(jq -c '{equal,mismatched_frames}' $W/w3.cmp.json) raw=$(jq -c '{equal}' $W/w3.rawcmp.json) probe=$(jq -c '{frames,max_pts_drift_frames,problems}' $W/w3-split.probe.json) cost=$(jq -c '.estimate.speedup' $W/w3-plan.json)"
38
+ echo " plan: $(jq -c '[.parts[]|{i:.index,frames,units:(.units|length),halo}]' $W/w3-plan.json)"
39
+ echo " one-process $(jq -r '.profile.wall_ms|floor' $W/w3-one.json) ms; parts $(for ((i = 0; i < n; i++)); do jq -r '.profile.wall_ms|floor' $W/w3-part$i.json; done | tr '\n' ' ') ms; assemble $(jq -r '.profile.wall_ms|floor' $W/w3-asm.json) ms"
40
+
41
+ # split-2
42
+ u "cd $W && mosio render avsync2 --no-cache -o out/av-one.mp4 > av-one.json 2> av-one.err"
43
+ u "cd $W && mosio render avsync2 --plan --parts 2 -o out/av.plan.json > av-plan.json 2> av-plan.err"
44
+ for i in 0 1; do u "cd $W && mosio render avsync2 --part $i --plan out/av.plan.json -o out/av-part$i.mp4 > av-part$i.json 2> av-part$i.err"; done
45
+ u "cd $W && mosio render-assemble avsync2 --plan out/av.plan.json -o out/av-split.mp4 out/av-part0.mp4 out/av-part1.mp4 > av-asm.json 2> av-asm.err"
46
+ u "cd $W && python3 -I $REPO/scripts/check-media.py avsync out/av-split.mp4 30 > av-split.check.json; mosio oracle hash out/av-one.mp4 -o av-one.decoded.json >/dev/null; mosio oracle hash out/av-split.mp4 -o av-split.decoded.json >/dev/null; mosio oracle compare av-one.decoded.json av-split.decoded.json > av.cmp.json"
47
+ if jq -e .ok "$W/av-split.check.json" >/dev/null && jq -e .equal "$W/av.cmp.json" >/dev/null; then R[split-2]=PASS; else R[split-2]=FAIL; fi
48
+ echo " avsync split: $(head -c 300 $W/av-split.check.json) cmp=$(jq -c '{equal}' $W/av.cmp.json)"
49
+
50
+ # split-3 refusals
51
+ code() { jq -r '(.error // .code // "")' "$1" 2>/dev/null | cut -d: -f1; }
52
+ cp -r "$W/w3-promo" "$W/w3-edited"; chown -R mosio "$W/w3-edited" 2>/dev/null || true
53
+ u "cd $W && sed -i 's/\"frames\": 300/\"frames\": 301/' w3-edited/mosio.json"
54
+ u "cd $W && mosio render w3-edited --part 0 --plan out/w3.plan.json -o out/x.mp4 > bad-mismatch.json 2> bad-mismatch.err; echo \$? > bad-mismatch.rc"
55
+ u "cd $W && mosio render-assemble w3-promo --plan out/w3.plan.json -o out/x.mp4 out/w3-part0.mp4 out/w3-part1.mp4 > bad-missing.json 2> bad-missing.err"
56
+ u "cd $W && mosio render-assemble w3-promo --plan out/w3.plan.json -o out/x.mp4 out/w3-part0.mp4 out/w3-part0.mp4 out/w3-part1.mp4 out/w3-part2.mp4 > bad-dup.json 2> bad-dup.err"
57
+ u "cd $W && mosio render w3-promo --part 9 --plan out/w3.plan.json -o out/x.mp4 > bad-index.json 2> bad-index.err"
58
+ u "cd $W && mosio render w3-promo --part 0 -o out/x.mp4 > bad-noplan.json 2> bad-noplan.err"
59
+ ok=1
60
+ for pair in "bad-mismatch:E_SPLIT_MISMATCH" "bad-missing:E_SPLIT_PART" "bad-dup:E_SPLIT_PART" "bad-index:E_SPLIT_ARGS" "bad-noplan:E_SPLIT_ARGS"; do
61
+ f=${pair%%:*}; want=${pair##*:}
62
+ if ! grep -q "$want" "$W/$f.json" "$W/$f.err" 2>/dev/null; then ok=0; echo " expected $want from $f: $(head -c 200 $W/$f.json) $(head -c 200 $W/$f.err)"; fi
63
+ done
64
+ [ "$ok" = 1 ] && R[split-3]=PASS || R[split-3]=FAIL
65
+ [ ! -e "$W/out/x.mp4" ] || R[split-3]=FAIL
66
+
67
+ # split-4: one part per unit, so every transition's neighbours are another part's: the halo path
68
+ u "cd $W && mosio render w3-promo --plan --max-frames 330 -o out/w3.fine.plan.json > w3-fine.json 2> w3-fine.err"
69
+ m=$(jq '.parts|length' "$W/w3-fine.json")
70
+ for ((i = 0; i < m; i++)); do u "cd $W && mosio render w3-promo --part $i --plan out/w3.fine.plan.json --no-cache -o out/f-part$i.mp4 > f-part$i.json 2> f-part$i.err"; done
71
+ fparts=$(for ((i = 0; i < m; i++)); do printf 'out/f-part%s.mp4 ' "$i"; done)
72
+ u "cd $W && mosio render-assemble w3-promo --plan out/w3.fine.plan.json -o out/w3-fine.mp4 $fparts > f-asm.json 2> f-asm.err; mosio oracle hash out/w3-fine.mp4 -o w3-fine.decoded.json >/dev/null; mosio oracle compare w3-one.decoded.json w3-fine.decoded.json > w3-fine.cmp.json"
73
+ if [ "$m" -ge 6 ] && jq -e '[.parts[].halo|length]|add > 0' "$W/w3-fine.json" >/dev/null && jq -e .equal "$W/w3-fine.cmp.json" >/dev/null; then R[split-4]=PASS; else R[split-4]=FAIL; fi
74
+ echo " fine split: parts=$m halo=$(jq -c '[.parts[].halo]' $W/w3-fine.json) cmp=$(jq -c '{equal}' $W/w3-fine.cmp.json)"
75
+
76
+ for k in split-1 split-2 split-3 split-4; do echo "== $k ${R[$k]}"; done
77
+ jq -n '$ARGS.named' --arg split1 "${R[split-1]}" --arg split2 "${R[split-2]}" --arg split3 "${R[split-3]}" --arg split4 "${R[split-4]}" > $W/summary.json
78
+ ! grep -q FAIL $W/summary.json
@@ -5,6 +5,9 @@
5
5
  # scripts/bootstrap.sh # apt packages + browser + optional libs + rust toolchain
6
6
  # APT_ONLY=1 scripts/bootstrap.sh # only the apt packages (needs root or sudo); the rest then needs no privileges
7
7
  # SKIP_APT=1 scripts/bootstrap.sh # only browser + libs (host already has the packages)
8
+ # STATIC_FALLBACK=1 scripts/bootstrap.sh # non-Debian-13 host (e.g. Ubuntu 24.04): when the pinned apt versions are
9
+ # # missing, install unversioned apt packages + the pinned static FFmpeg and Inter
10
+ # # into $MOSIO_HOME (needs node); then export MOSIO_HOME
8
11
  # scripts/bootstrap.sh --cutout # also the ONNX Runtime and the MODNet model for `mosio media cutout`
9
12
  # # (--cutout-objects adds BiRefNet_lite, 224 MB, for single images)
10
13
  #
@@ -37,9 +40,25 @@ if [ "${SKIP_APT:-0}" != "1" ]; then
37
40
  log "apt: ${pkgs[*]}"
38
41
  $SUDO apt-get update -qq
39
42
  if ! $SUDO apt-get install -y -qq --no-install-recommends "${pkgs[@]}" >/dev/null; then
40
- die "pinned package versions unavailable. Point apt at $(jq -r .os.apt_snapshot_fallback "$LOCK") and retry."
43
+ # Not Debian 13 (Ubuntu, another release): the pinned Debian FFmpeg and Inter are not in this host's apt.
44
+ # STATIC_FALLBACK=1 installs the unversioned packages from this host and the pinned static FFmpeg and Inter (the
45
+ # npm install's toolchain, SHA-256 checked, accepted by `mosio doctor`) into $MOSIO_HOME instead.
46
+ [ "${STATIC_FALLBACK:-0}" = "1" ] || die "pinned package versions unavailable. Point apt at $(jq -r .os.apt_snapshot_fallback "$LOCK") and retry, or rerun with STATIC_FALLBACK=1 to use the pinned static FFmpeg and Inter (renders are then not byte-comparable with a Debian 13 host)."
47
+ unpinned=(); for p in "${pkgs[@]}"; do case "$p" in *=*) ;; *) unpinned+=("$p") ;; esac; done
48
+ $SUDO apt-get install -y -qq --no-install-recommends "${unpinned[@]}" >/dev/null || die "apt-get install failed for: ${unpinned[*]}"
49
+ STATIC_TOOLCHAIN=1
41
50
  fi
42
51
  fi
52
+ if [ "${STATIC_TOOLCHAIN:-0}" = "1" ] || [ "${STATIC_FALLBACK:-0}" = "1" ] && [ "${APT_ONLY:-0}" != "1" ]; then
53
+ command -v node >/dev/null 2>&1 || die "STATIC_FALLBACK needs node (22.12+) to fetch the static FFmpeg and Inter"
54
+ log "static FFmpeg, Inter and Noto Color Emoji (toolchain.lock.json ffmpeg.static, fonts.download, fonts.emoji) into $MOSIO_HOME"
55
+ MOSIO_HOME="$MOSIO_HOME" node --input-type=module -e '
56
+ const { loadLock, ensure } = await import(process.argv[1] + "/packaging/npm/cli/lib/toolchain.mjs");
57
+ const lock = await loadLock(process.argv[1]);
58
+ await ensure(process.env.MOSIO_HOME, lock, { chromium: false, ffmpeg: true, fonts: true }, { log: (m) => console.error(m) });
59
+ ' "$REPO" || die "static FFmpeg/Inter download failed"
60
+ log "set MOSIO_HOME=$MOSIO_HOME in your shell so mosio uses them (mosio reads ffmpeg/bin and fontconfig from \$MOSIO_HOME)"
61
+ fi
43
62
  command -v jq >/dev/null 2>&1 || die "jq is required"
44
63
  # APT_ONLY=1: system packages only (the root step of scripts/install.sh); the browser and Rust are installed afterwards as the user
45
64
  [ "${APT_ONLY:-0}" != "1" ] || { log "done (apt only)"; exit 0; }
@@ -18,6 +18,14 @@ CODE = re.compile(r"\bE_[A-Z0-9]+(?:_[A-Z0-9]+)*\b")
18
18
  RESERVED = {
19
19
  "E_CODE": "placeholder in an error-handling comparison, not a real code",
20
20
  "E_CLIP_STATE": "thrown by the t3-clip-tweak fixture scene (fixtures/3d) to fail a frame that depends on earlier frames; not emitted by the engine",
21
+ "E_HUB_CONFLICT": "proposed in docs/design/HUB.md; the Hub is not implemented yet",
22
+ "E_HUB_DEVICE_EXPIRED": "proposed in docs/design/HUB.md; the Hub is not implemented yet",
23
+ "E_HUB_EXISTS": "proposed in docs/design/HUB.md; the Hub is not implemented yet",
24
+ "E_HUB_PROTECTED": "proposed in docs/design/HUB.md; the Hub is not implemented yet",
25
+ "E_HUB_STATE": "proposed in docs/design/HUB.md; the Hub is not implemented yet",
26
+ "E_HUB_UNAVAILABLE": "proposed in docs/design/HUB.md; the Hub is not implemented yet",
27
+ "E_REGISTRY_PUBLISH_VERSION_EXISTS": "returned by the cloud registry when a version is published twice; the CLI passes the server's code through",
28
+ "E_RENDER_QUEUE_TIMEOUT": "proposed in docs/design/HUB.md; the Hub is not implemented yet",
21
29
  }
22
30
  BEGIN, END = "<!-- codes:begin -->", "<!-- codes:end -->"
23
31
 
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+ # Fails when a tracked .rs/.ts/.tsx file is longer than MAX lines, so files stay
3
+ # one responsibility each. Data, vendor and generated files are exempt by pattern;
4
+ # files still waiting to be split sit in ALLOWLIST (remove the line when you split
5
+ # one, never add to it).
6
+ set -euo pipefail
7
+ cd "$(git rev-parse --show-toplevel)"
8
+ MAX="${MAX_LINES:-800}"
9
+
10
+ EXEMPT='(^|/)shared/src/recipes[^/]*$|(^|/)shared/src/sfx-bank[^/]*$|(^|/)components/reui/|(^|/)generated/|\.generated\.|\.gen\.|(^|/)node_modules/|(^|/)target/'
11
+
12
+ ALLOWLIST=(
13
+ # temporary: not yet split (remove a line when you split the file, never add)
14
+ crates/mosio-agent/src/direct.rs
15
+ crates/mosio-agent/src/proposals.rs
16
+ crates/mosio-agent/src/tools.rs
17
+ crates/mosio/src/artifact.rs
18
+ crates/mosio/src/beats.rs
19
+ crates/mosio/src/blender.rs
20
+ crates/mosio/src/camera_inspect.rs
21
+ crates/mosio/src/captions.rs
22
+ crates/mosio/src/cutout.rs
23
+ crates/mosio/src/encode.rs
24
+ crates/mosio/src/hub_serve.rs
25
+ crates/mosio/src/inspect.rs
26
+ crates/mosio/src/media.rs
27
+ crates/mosio/src/media_edit.rs
28
+ crates/mosio/src/merge/html.rs
29
+ crates/mosio/src/regbuild.rs
30
+ crates/mosio/src/registry.rs
31
+ crates/mosio/src/regpublish.rs
32
+ crates/mosio/src/remote.rs
33
+ crates/mosio/tests/registry_ns_cli.rs
34
+ crates/mosio/tests/registry_publish_cli.rs
35
+ packages/player/src/player.ts
36
+ packages/runtime/src/node/local-engine.ts
37
+ )
38
+
39
+ fail=0
40
+ while IFS= read -r f; do
41
+ [[ -f "$f" ]] || continue
42
+ [[ "$f" =~ $EXEMPT ]] && continue
43
+ n=$(wc -l <"$f")
44
+ (( n > MAX )) || continue
45
+ for a in "${ALLOWLIST[@]}"; do [[ "$a" == "$f" ]] && continue 2; done
46
+ echo "too long: $f has $n lines (max $MAX); split it by responsibility" >&2
47
+ fail=1
48
+ done < <(git ls-files '*.rs' '*.ts' '*.tsx')
49
+ exit $fail
package/scripts/ci.sh CHANGED
@@ -5,7 +5,7 @@
5
5
  # scripts/ci.sh all # + toolchain project incremental inspect hardening
6
6
  # scripts/ci.sh build test ... # chosen stages, in the given order
7
7
  #
8
- # Stages: bootstrap (scripts/bootstrap.sh, idempotent re-check of the pinned toolchain), camera (scripts/acceptance/camera.sh), build (cargo build --release
8
+ # Stages: bootstrap (scripts/bootstrap.sh, idempotent re-check of the pinned toolchain), camera (scripts/acceptance/camera.sh), camera-inspect (scripts/acceptance/camera-inspect.sh), build (cargo build --release
9
9
  # --locked), test (cargo test --workspace --locked), assets (scripts/gen-assets.sh: fixture bytes vs fixtures/assets.lock),
10
10
  # doctor (mosio doctor as the unprivileged user), and the acceptance suites under scripts/acceptance/.
11
11
  # Every stage runs even if an earlier one failed. Evidence: out/ci/{stages.tsv,env.txt,<stage>.log,evidence/}.
@@ -16,7 +16,7 @@ REPO="$(cd "$(dirname "$0")/.." && pwd)"; cd "$REPO"
16
16
  OUT="$REPO/out/ci"; rm -rf "$OUT"; mkdir -p "$OUT/evidence"
17
17
 
18
18
  stages=("$@"); [ ${#stages[@]} -eq 0 ] && stages=(bootstrap build test assets doctor frames export)
19
- [ "${stages[*]}" = all ] && stages=(bootstrap build lint test assets doctor toolchain fixtures frames camera stills export project incremental inspect hardening revisions contracts notes review-sheet videos)
19
+ [ "${stages[*]}" = all ] && stages=(bootstrap build lint test assets doctor toolchain fixtures frames camera camera-inspect stills export project incremental inspect hardening revisions revisions-git revisions-sync hub contracts notes review-sheet videos split segcache)
20
20
 
21
21
  {
22
22
  # which commit this is: scripts/e2b.sh writes .mosio-provenance.json (commit, tree, archive sha256) next to the
@@ -49,9 +49,9 @@ cmd_for() {
49
49
  test) echo "cargo test --workspace --locked" ;;
50
50
  assets) echo "scripts/gen-assets.sh" ;;
51
51
  doctor) echo "cargo build --release --locked -q && chmod -R o+rX '$REPO' && scripts/as-user.sh 'mosio doctor' | tee '$OUT/evidence/doctor.json'" ;;
52
- lint) echo "cargo fmt --all --check && cargo clippy --workspace --all-targets --release --locked -- -D warnings && python3 scripts/check-error-codes.py" ;;
52
+ lint) echo "cargo fmt --all --check && cargo clippy --workspace --all-targets --release --locked -- -D warnings && python3 scripts/check-error-codes.py && python3 deploy/cloudrun/test_entrypoint.py" ;;
53
53
  bootstrap-regress) echo "scripts/acceptance/bootstrap.sh" ;;
54
- toolchain|fixtures|frames|stills|export|project|incremental|inspect|hardening|revisions|contracts|notes|review-sheet|videos|camera) echo "scripts/acceptance/$1.sh" ;;
54
+ toolchain|fixtures|frames|stills|export|project|incremental|inspect|hardening|revisions|revisions-git|revisions-sync|hub|contracts|notes|review-sheet|videos|split|segcache|camera|camera-inspect) echo "scripts/acceptance/$1.sh" ;;
55
55
  *) return 1 ;;
56
56
  esac
57
57
  }
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env bash
2
+ # Dedupe ratios of the chunked blob store for the edits users make, on material you give it (or, with no argument,
3
+ # public-domain NASA footage fetched from the NASA image library, which is U.S. government work).
4
+ # scripts/dedupe-report.sh [VIDEO.mp4] [OUT.jsonl] run in the sandbox: needs ffmpeg, python3, curl, jq and cargo
5
+ # Cases (each a pair of trees stored one after the other): trim-copy (ffmpeg -c copy of a window), remux (mp4 -> mov
6
+ # -c copy), reencode (x264 crf 23 of the same footage), png-swap (a project with a clip and 20 stills, one still replaced),
7
+ # glb-edit (a glTF binary with one material colour changed).
8
+ # TODO: the ratios must be re-measured on real phone recordings before docs/adr is amended; this is public footage.
9
+ set -euo pipefail
10
+ REPO="$(cd "$(dirname "$0")/.." && pwd)"; cd "$REPO"
11
+ W="${DEDUPE_WORK:-/tmp/mosio-dedupe}"; SRC="${1:-}"; OUT="${2:-$W/report.jsonl}"
12
+ rm -rf "$W/cases"; mkdir -p "$W/cases"/{trim-copy,remux,reencode,png-swap,glb-edit}/{a,b} "$W/dl"
13
+ if [ -z "$SRC" ]; then
14
+ SRC="$W/dl/source.mp4"
15
+ if [ ! -s "$SRC" ]; then
16
+ enc() { sed 's/ /%20/g; s/^http:/https:/'; }
17
+ url=$(set +o pipefail; curl -fsS 'https://images-api.nasa.gov/search?q=earth%20from%20space&media_type=video' | jq -r '.collection.items[0:12][].href' | enc | while read -r h; do
18
+ curl -fsSg "$h" | jq -r '.[]' | grep -E '~large\.mp4$' | enc | head -1; done | head -1)
19
+ echo "source: $url" >&2; curl -fsSLg "$url" -o "$SRC"
20
+ fi
21
+ fi
22
+ ffprobe -v error -show_entries format=duration,size,bit_rate -of default=nw=1 "$SRC" >&2
23
+ DUR=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$SRC" | cut -d. -f1)
24
+ C="$W/cases"; FF="ffmpeg -hide_banner -loglevel error -nostdin -y"
25
+ cp "$SRC" "$C/trim-copy/a/clip.mp4"; $FF -ss 2 -t $((DUR - 5)) -i "$SRC" -c copy "$C/trim-copy/b/clip.mp4"
26
+ cp "$SRC" "$C/remux/a/clip.mp4"; $FF -i "$SRC" -c copy "$C/remux/b/clip.mov"
27
+ cp "$SRC" "$C/reencode/a/clip.mp4"; $FF -i "$SRC" -c:v libx264 -crf 23 -preset medium -c:a aac "$C/reencode/b/clip.mp4"
28
+ cp "$SRC" "$C/png-swap/a/clip.mp4"; cp "$SRC" "$C/png-swap/b/clip.mp4"
29
+ for i in $(seq 1 20); do $FF -ss $((i % (DUR - 1))) -i "$SRC" -frames:v 1 "$C/png-swap/a/still$(printf %02d $i).png"; done
30
+ cp "$C"/png-swap/a/still*.png "$C/png-swap/b/"; $FF -ss $((DUR / 2)) -i "$SRC" -frames:v 1 -vf negate "$C/png-swap/b/still07.png"
31
+ cmp -s "$C/png-swap/a/still07.png" "$C/png-swap/b/still07.png" && { echo "png swap produced an identical file" >&2; exit 1; }
32
+ G="$W/dl/model.glb"
33
+ [ -s "$G" ] || curl -fsSL https://github.com/KhronosGroup/glTF-Sample-Assets/raw/main/Models/BoomBox/glTF-Binary/BoomBox.glb -o "$G"
34
+ cp "$G" "$C/glb-edit/a/model.glb"
35
+ python3 -I - "$G" "$C/glb-edit/b/model.glb" <<'PY'
36
+ import json, struct, sys
37
+ d = open(sys.argv[1], 'rb').read()
38
+ jl, _ = struct.unpack_from('<II', d, 12); j = json.loads(d[20:20 + jl]); rest = d[20 + jl:]
39
+ j['materials'][0]['name'] = 'edited material with a longer name than before'
40
+ j['materials'][0].setdefault('pbrMetallicRoughness', {})['baseColorFactor'] = [1, 0.2, 0.2, 1]
41
+ b = json.dumps(j, separators=(',', ':')).encode(); b += b' ' * (-len(b) % 4)
42
+ body = struct.pack('<II', len(b), 0x4E4F534A) + b + rest
43
+ open(sys.argv[2], 'wb').write(b'glTF' + struct.pack('<II', 2, 12 + len(body)) + body)
44
+ PY
45
+ ls -l "$C"/*/a "$C"/*/b | sed 's/^/ /' >&2
46
+ MOSIO_DEDUPE_DIR="$C" MOSIO_DEDUPE_OUT="$OUT" cargo test -p mosio --release dedupe_report -- --ignored --nocapture 2>&1 | grep -E '^\{|test result' >&2
47
+ echo "report: $OUT" >&2; cat "$OUT"
@@ -30,7 +30,7 @@ export PATH="/usr/local/cargo/bin:/usr/local/bin:$PATH"
30
30
  # ---------- base tools ----------
31
31
  apt-get update -qq
32
32
  apt-get install -y -qq --no-install-recommends \
33
- build-essential pkg-config git curl ca-certificates jq xz-utils unzip procps time sudo less bubblewrap >/dev/null
33
+ build-essential cmake clang libclang-dev pkg-config git git-lfs curl ca-certificates jq xz-utils unzip procps time sudo less bubblewrap >/dev/null
34
34
  log "base packages installed"
35
35
 
36
36
  # ---------- unprivileged user (Chromium keeps its sandbox on only when not root) ----------
@@ -0,0 +1,25 @@
1
+ // minimal CDP client over --remote-debugging-pipe? use port + global WebSocket
2
+ import { spawn } from 'node:child_process'
3
+ export async function launch(bin, flags) {
4
+ const port = 9300 + Math.floor(Math.random() * 500)
5
+ const p = spawn(bin, ['--headless', `--remote-debugging-port=${port}`, '--no-first-run', '--user-data-dir=/tmp/fp-prof-' + port, ...flags, 'about:blank'], { stdio: ['ignore', 'ignore', 'pipe'] })
6
+ let err = ''; p.stderr.on('data', d => err += d)
7
+ let ver
8
+ for (let i = 0; i < 100; i++) { try { ver = await (await fetch(`http://127.0.0.1:${port}/json/version`)).json(); break } catch { await new Promise(r => setTimeout(r, 100)) } }
9
+ if (!ver) throw new Error('chrome did not start: ' + err)
10
+ const ws = new WebSocket(ver.webSocketDebuggerUrl)
11
+ await new Promise((r, j) => { ws.onopen = r; ws.onerror = j })
12
+ let id = 0; const pending = new Map(); const listeners = []
13
+ ws.onmessage = ev => { const m = JSON.parse(ev.data); if (m.id && pending.has(m.id)) { const { r, j } = pending.get(m.id); pending.delete(m.id); m.error ? j(new Error(JSON.stringify(m.error))) : r(m.result) } else listeners.forEach(l => l(m)) }
14
+ const send = (method, params = {}, sessionId) => new Promise((r, j) => { const i = ++id; pending.set(i, { r, j }); ws.send(JSON.stringify({ id: i, method, params, sessionId })) })
15
+ return { send, on: l => listeners.push(l), close: () => { ws.close(); p.kill('SIGKILL') }, version: ver.Browser, proc: p, err: () => err }
16
+ }
17
+ export async function newPage(b, w, h, { beginFrame = true } = {}) {
18
+ const { targetId } = await b.send('Target.createTarget', { url: 'about:blank', width: w, height: h, enableBeginFrameControl: beginFrame })
19
+ const { sessionId } = await b.send('Target.attachToTarget', { targetId, flatten: true })
20
+ const s = (m, p) => b.send(m, p, sessionId)
21
+ await s('Page.enable'); await s('Runtime.enable')
22
+ await s('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: 1, mobile: false })
23
+ const ev = async (expr, awaitPromise = true) => { const r = await s('Runtime.evaluate', { expression: expr, awaitPromise, returnByValue: true }); if (r.exceptionDetails) throw new Error(JSON.stringify(r.exceptionDetails).slice(0, 800)); return r.result.value }
24
+ return { s, ev, sessionId }
25
+ }
@@ -0,0 +1,11 @@
1
+ // Feature probe: does requestPaint/paint fire and does drawElementImage draw? node dbg.mjs <chrome> ["flags"]
2
+ import { launch, newPage } from './cdp.mjs'
3
+ import { serve } from './srv.mjs'
4
+ const srv = await serve([['/', new URL('./www', import.meta.url).pathname]])
5
+ const b = await launch(process.argv[2], ['--disable-gpu', '--use-angle=swiftshader', '--enable-unsafe-swiftshader', ...(process.argv[3] || '').split(' ').filter(Boolean)])
6
+ const pg = await newPage(b, 400, 300, { beginFrame: false })
7
+ await pg.s('Page.navigate', { url: srv.url + '/probe.html' })
8
+ await new Promise(r => setTimeout(r, 500))
9
+ console.log('raf', await pg.ev(`Promise.race([new Promise(r=>requestAnimationFrame(()=>r('ok'))), new Promise(r=>setTimeout(()=>r('raf timeout'),2000))])`))
10
+ console.log('paint', await pg.ev(`(()=>{const c=document.getElementById('c'); return Promise.race([new Promise(r=>{c.onpaint=e=>{try{c.getContext('2d').drawElementImage(document.getElementById('d'),0,0); r('drew '+c.getContext('2d').getImageData(10,10,1,1).data.join(','))}catch(e){r('err '+e.message)}}; c.requestPaint()}), new Promise(r=>setTimeout(()=>r('paint timeout'),2000))])})()`))
11
+ b.close(); srv.close()
@@ -0,0 +1,40 @@
1
+ // Run scripts/fastpath/sandbox.sh in a fresh render-bench E2B sandbox (8 vCPU), with this directory and the
2
+ // render-bench projects uploaded, then bring /home/user/out back as a tarball.
3
+ // doppler run -p mosio -c dev -- node e2b.mjs <render-bench dir> <outdir> (env passed through: FP_*)
4
+ // FP_ATTACH=<sandbox id>: reconnect to a sandbox already running a round (this machine restarted) and collect it.
5
+ import { createRequire } from 'node:module'
6
+ import { execFileSync } from 'node:child_process'
7
+ import fs from 'node:fs'; import path from 'node:path'
8
+ const [bench, outDir] = process.argv.slice(2).map(p => path.resolve(p))
9
+ const { Sandbox } = createRequire(path.join(bench, 'e2b/package.json'))('e2b')
10
+ const here = path.dirname(new URL(import.meta.url).pathname)
11
+ const log = (...a) => console.log(new Date().toISOString().slice(11, 19), ...a)
12
+ fs.mkdirSync(outDir, { recursive: true })
13
+ const attach = process.env.FP_ATTACH
14
+ const sbx = attach ? await Sandbox.connect(attach) : await Sandbox.create(process.env.E2B_TEMPLATE || 'render-bench', { timeoutMs: 3600_000 })
15
+ log('sandbox', sbx.sandboxId)
16
+ const put = async (dst, buf) => sbx.files.write(dst, buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength))
17
+ try {
18
+ if (!attach) {
19
+ await put('/home/user/bench.tgz', execFileSync('tar', ['czf', '-', '--exclude=node_modules', '-C', bench, 'engines/mosio', 'assets', 'vendor'], { maxBuffer: 1 << 30 }))
20
+ await put('/home/user/fp.tgz', execFileSync('tar', ['czf', '-', '-C', here, '.'], { maxBuffer: 1 << 30 }))
21
+ if (process.env.MOSIO_BIN_FILE) await put('/home/user/mosio-custom', fs.readFileSync(process.env.MOSIO_BIN_FILE))
22
+ await sbx.commands.run('mkdir -p /home/user/bench /home/user/fp /home/user/out && tar xzf /home/user/bench.tgz -C /home/user/bench && tar xzf /home/user/fp.tgz -C /home/user/fp && chmod +x /home/user/mosio-custom 2>/dev/null; true')
23
+ const envs = Object.fromEntries(Object.entries(process.env).filter(([k]) => k.startsWith('FP_')))
24
+ const cmd = await sbx.commands.run(`bash /home/user/fp/${process.env.FP_SCRIPT || 'sandbox.sh'} > /home/user/out/log.txt 2>&1; touch /home/user/DONE`, { background: true, envs, timeoutMs: 0 })
25
+ }
26
+ let seen = 0
27
+ for (;;) {
28
+ await new Promise(r => setTimeout(r, 15_000))
29
+ const p = await sbx.commands.run('cat /home/user/out/log.txt; test -f /home/user/DONE && echo __DONE__; true', { timeoutMs: 60_000 }).catch(() => ({ stdout: '' }))
30
+ const lines = p.stdout.split('\n')
31
+ for (const l of lines.slice(seen)) if (l && l !== '__DONE__') log(l)
32
+ seen = Math.max(seen, lines.length - 1)
33
+ if (lines.includes('__DONE__')) break
34
+ }
35
+ await sbx.commands.run('tar czf /home/user/out.tgz -C /home/user/out .')
36
+ const tgz = await sbx.files.read('/home/user/out.tgz', { format: 'bytes' })
37
+ fs.writeFileSync(path.join(outDir, 'out.tgz'), Buffer.from(tgz))
38
+ execFileSync('tar', ['xzf', 'out.tgz'], { cwd: outDir })
39
+ log('results in', outDir)
40
+ } finally { await sbx.kill() }
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env python3
2
+ """Generate the feature-coverage projects for the fast-path comparison (docs/design/fast-path.md).
3
+ features/ one scene per feature, 60 frames each, a music bed with clicks on every second (audio sync)
4
+ features-xfade/ two scenes joined by a crossfade transition (the canvas path must fall back to screenshots)
5
+ Run from this directory: python3 gen.py"""
6
+ import html, json, os, struct, wave, math
7
+
8
+ HEAD = '''<!doctype html><html lang="id"><head><meta charset="utf-8">
9
+ <script src="/_lib/gsap@3.15.1/gsap.min.js"></script>
10
+ <style>@font-face{font-family:"Inter";font-weight:800;src:url("/assets/fonts/Inter-ExtraBold.ttf") format("truetype")}
11
+ @font-face{font-family:"Inter";font-weight:500;src:url("/assets/fonts/Inter-Medium.ttf") format("truetype")}
12
+ *{margin:0;padding:0;box-sizing:border-box}html,body{width:1080px;height:1920px;overflow:hidden;background:#0f172a;font-family:"Inter",sans-serif;color:#fff}
13
+ .lbl{position:absolute;left:40px;top:40px;font-weight:800;font-size:48px}
14
+ %s</style></head><body><div class="lbl">%s</div>
15
+ %s
16
+ <script>
17
+ %s
18
+ </script></body></html>'''
19
+
20
+ TL = 'const tl=gsap.timeline({paused:true});%s;__mosio.timeline(tl);'
21
+
22
+ SCENES = {
23
+ "text": ("#t{position:absolute;left:0;top:800px;width:1080px;text-align:center;font-weight:800;font-size:140px;animation:pop 2s ease-in-out infinite alternate}"
24
+ "@keyframes pop{from{transform:scale(.6) rotate(-6deg);opacity:.2}to{transform:scale(1.1) rotate(4deg);opacity:1}}",
25
+ "text + CSS @keyframes", '<div id="t">Wobble Ag</div>', ""),
26
+ "typo": (".r{position:absolute;left:40px;white-space:nowrap}",
27
+ "typography",
28
+ '<div class="r" style="top:140px;font-weight:800;font-size:200px;letter-spacing:-6px">Besar</div>'
29
+ '<div class="r" style="top:400px;font-weight:500;font-size:64px">Medium 500: Selamat pagi, Indonesia!</div>'
30
+ '<div class="r" style="top:500px;font-weight:800;font-size:64px">ExtraBold 800: Rp 1.250.000,-</div>'
31
+ '<div class="r" style="top:600px;font-weight:500;font-size:56px;letter-spacing:12px">TRACKING +12px</div>'
32
+ '<div class="r" style="top:700px;font-weight:800;font-size:56px;letter-spacing:-3px">Kerning AV To Wa Ty</div>'
33
+ '<div class="r" style="top:800px;font-weight:500;font-size:64px">Emoji: 🎬✨🚀🇮🇩😀</div>'
34
+ '<div class="r" style="top:920px;font-weight:500;font-size:14px;width:1000px;white-space:normal">Teks kecil 14px: Pemerintah menetapkan bahwa setiap warga negara berhak atas pendidikan yang layak, dan negara wajib membiayainya sesuai undang-undang yang berlaku.</div>'
35
+ '<div class="r" style="top:980px;font-weight:500;font-size:22px;width:1000px;white-space:normal;color:#cbd5e1">Teks 22px abu-abu di atas latar gelap: anti-aliasing tepi huruf dibandingkan langsung.</div>'
36
+ '<div class="r" id="mv" style="top:1100px;font-weight:800;font-size:96px">Gerak halus →</div>'
37
+ '<div class="r" id="cnt" style="top:1300px;font-weight:800;font-size:160px;font-variant-numeric:tabular-nums">0</div>',
38
+ TL % 'tl.fromTo("#mv",{x:0},{x:180,duration:2,ease:"none"},0);const o={v:0};tl.to(o,{v:9999,duration:2,ease:"none",onUpdate:()=>{document.getElementById("cnt").textContent=Math.round(o.v).toLocaleString("id-ID")}},0)'),
39
+ "image": ("#i{position:absolute;left:140px;top:500px;width:800px;height:800px;border-radius:48px}", "img + WAAPI",
40
+ '<img id="i" src="/assets/image.png">',
41
+ 'document.getElementById("i").animate([{transform:"rotate(0deg) scale(.7)"},{transform:"rotate(30deg) scale(1)"}],{duration:2000,iterations:Infinity,direction:"alternate",easing:"ease-in-out"});'),
42
+ "video": ("#v{position:absolute;left:90px;top:300px;width:900px;height:1600px;object-fit:cover;border-radius:32px}", "<video> clip A",
43
+ '<video id="v" src="/assets/clip.mp4" muted playsinline preload="auto"></video>', ""),
44
+ "video2": ("#v{position:absolute;left:0;top:0;width:1080px;height:1920px;object-fit:fill}.lbl{display:none}", "<video> clip B (cut, full frame: compared with the decoded clip)",
45
+ '<video id="v" src="/assets/clip.mp4" muted playsinline preload="auto"></video>', ""),
46
+ "svg": ("svg{position:absolute;left:90px;top:400px}", "inline SVG + SVG filter",
47
+ '<svg width="900" height="900" viewBox="0 0 900 900"><defs><filter id="g"><feGaussianBlur stdDeviation="6"/></filter><linearGradient id="lg"><stop offset="0" stop-color="#f59e0b"/><stop offset="1" stop-color="#ef4444"/></linearGradient></defs><circle id="c" cx="450" cy="450" r="200" fill="url(#lg)" filter="url(#g)"/><path id="p" d="M100 800 Q450 100 800 800" stroke="#22d3ee" stroke-width="18" fill="none" stroke-dasharray="1200" stroke-dashoffset="1200"/></svg>',
48
+ TL % 'tl.to("#c",{attr:{r:380},duration:2,ease:"sine.inOut"},0).to("#p",{attr:{"stroke-dashoffset":0},duration:2},0)'),
49
+ "filter": ("#b{position:absolute;left:240px;top:700px;width:600px;height:600px;border-radius:50%;background:radial-gradient(#a78bfa,#4c1d95)}", "CSS filter blur + drop-shadow",
50
+ '<div id="b"></div>', TL % 'tl.fromTo("#b",{filter:"blur(0px) drop-shadow(0 0 0 #f0f)"},{filter:"blur(24px) drop-shadow(40px 40px 0 #f0f)",duration:2},0)'),
51
+ "blend": ("#bg{position:absolute;inset:0;background:linear-gradient(135deg,#f59e0b,#3b82f6)}"
52
+ ".c{position:absolute;width:520px;height:520px;border-radius:50%}"
53
+ "#m1{left:80px;top:300px;background:#ef4444;mix-blend-mode:multiply}#m2{left:480px;top:300px;background:#22c55e;mix-blend-mode:screen}"
54
+ "#mask{position:absolute;left:140px;top:950px;width:800px;height:420px;background:url(/assets/image.png) center/cover;-webkit-mask-image:linear-gradient(90deg,#000,transparent);mask-image:linear-gradient(90deg,#000,transparent)}"
55
+ "#sh{position:absolute;left:140px;top:1480px;width:800px;height:240px;border-radius:32px;background:#fff;box-shadow:0 30px 60px rgba(0,0,0,.55),0 0 0 8px #0ea5e9;color:#0f172a;font-weight:800;font-size:72px;line-height:240px;text-align:center;text-shadow:4px 4px 0 #f472b6;clip-path:inset(0 0 0 0 round 32px)}",
56
+ "blend mode, mask, shadow, clip-path",
57
+ '<div id="bg"></div><div class="c" id="m1"></div><div class="c" id="m2"></div><div id="mask"></div><div id="sh">Bayangan</div>',
58
+ TL % 'tl.fromTo("#m1",{x:0},{x:120,duration:2},0).fromTo("#sh",{y:0},{y:-60,duration:2},0)'),
59
+ "backdrop": ("#bg{position:absolute;inset:0;background:repeating-linear-gradient(45deg,#ef4444 0 60px,#3b82f6 60px 120px)}#g{position:absolute;left:140px;top:600px;width:800px;height:700px;border-radius:40px;background:rgba(255,255,255,.15);backdrop-filter:blur(20px) saturate(1.6)}",
60
+ "backdrop-filter", '<div id="bg"></div><div id="g"></div>', TL % 'tl.fromTo("#g",{y:-300},{y:300,duration:2,ease:"none"},0)'),
61
+ "gradient": ("#a{position:absolute;left:0;top:0;width:1080px;height:960px;background:linear-gradient(#101014,#1c1c24)}#b{position:absolute;left:0;top:960px;width:1080px;height:960px;background:radial-gradient(circle at 50% 40%,#ff6b6b,#5f27cd 60%,#0b0b1a)}",
62
+ "gradients (banding)", '<div id="a"></div><div id="b"></div>', TL % 'tl.fromTo("#b",{opacity:.6},{opacity:1,duration:2},0)'),
63
+ "iframe": ("iframe{position:absolute;left:90px;top:400px;width:900px;height:1200px;border:0;background:#fff}", "iframe (same origin)",
64
+ '<iframe id="f" srcdoc="<body style=&quot;margin:0;background:#fde68a;font:80px sans-serif&quot;><div style=&quot;padding:80px&quot;>inside iframe</div></body>"></iframe>',
65
+ TL % 'tl.fromTo("#f",{rotation:-8},{rotation:8,duration:2},0)'),
66
+ "canvas2d": ("#cv{position:absolute;left:90px;top:400px}", "<canvas> 2D drawn per seek",
67
+ '<canvas id="cv" width="900" height="900"></canvas>',
68
+ 'const cx=document.getElementById("cv").getContext("2d");__mosio.onSeek(t=>{cx.fillStyle="#1e293b";cx.fillRect(0,0,900,900);for(let i=0;i<24;i++){cx.fillStyle=`hsl(${i*15+t*90},80%,60%)`;const a=t*2+i*0.26;cx.beginPath();cx.arc(450+Math.cos(a)*(120+i*12),450+Math.sin(a)*(120+i*12),26,0,7);cx.fill();}});'),
69
+ }
70
+
71
+ ASSETS = ["assets/fonts/Inter-ExtraBold.ttf", "assets/fonts/Inter-Medium.ttf", "assets/image.png", "assets/clip.mp4"]
72
+ OUT = {"default": {"codec": "h264", "crf": 18, "preset": "medium", "pix_fmt": "yuv420p", "gop_frames": 30}}
73
+
74
+
75
+ def clicks(path, seconds):
76
+ """A 220 Hz bed with a 20 ms 2 kHz click at every whole second: a shifted mux shows up as a moved click."""
77
+ sr = 48000
78
+ with wave.open(path, "wb") as w:
79
+ w.setnchannels(2); w.setsampwidth(2); w.setframerate(sr)
80
+ data = bytearray()
81
+ for i in range(int(sr * seconds)):
82
+ t = i / sr
83
+ v = 0.15 * math.sin(2 * math.pi * 220 * t)
84
+ if (t % 1.0) < 0.02:
85
+ v += 0.6 * math.sin(2 * math.pi * 2000 * t)
86
+ s = int(max(-1, min(1, v)) * 32767)
87
+ data += struct.pack("<hh", s, s)
88
+ w.writeframes(bytes(data))
89
+
90
+
91
+ def project(d, scenes, transitions, audio):
92
+ os.makedirs(f"{d}/scenes", exist_ok=True)
93
+ os.makedirs(f"{d}/audio", exist_ok=True)
94
+ for k in scenes:
95
+ css, lbl, body, js = SCENES[k]
96
+ open(f"{d}/scenes/{k}.html", "w").write(HEAD % (css, html.escape(lbl), body, js))
97
+ m = {"mosio": 1, "name": os.path.basename(d), "width": 1080, "height": 1920, "fps": 30, "seed": 1, "background": "#000000",
98
+ "libraries": ["gsap@3.15.1"], "shared": [], "assets": ASSETS + (["audio/clicks.wav"] if audio else []),
99
+ "scenes": [{"id": k, "src": f"scenes/{k}.html", "frames": 60} for k in scenes],
100
+ "transitions": transitions, "audio": [{"id": "clicks", "src": "audio/clicks.wav", "start_frame": 0, "gain_db": 0}] if audio else [], "output": OUT}
101
+ if audio:
102
+ clicks(f"{d}/audio/clicks.wav", len(scenes) * 2)
103
+ json.dump(m, open(f"{d}/mosio.json", "w"), indent=2)
104
+
105
+
106
+ here = os.path.dirname(os.path.abspath(__file__))
107
+ os.chdir(here)
108
+ project(".", list(SCENES), [], True)
109
+ project("../features-xfade", ["video", "image"], [{"from": "video", "to": "image", "kind": "crossfade", "frames": 15}], False)
@@ -0,0 +1,100 @@
1
+ {
2
+ "mosio": 1,
3
+ "name": ".",
4
+ "width": 1080,
5
+ "height": 1920,
6
+ "fps": 30,
7
+ "seed": 1,
8
+ "background": "#000000",
9
+ "libraries": [
10
+ "gsap@3.15.1"
11
+ ],
12
+ "shared": [],
13
+ "assets": [
14
+ "assets/fonts/Inter-ExtraBold.ttf",
15
+ "assets/fonts/Inter-Medium.ttf",
16
+ "assets/image.png",
17
+ "assets/clip.mp4",
18
+ "audio/clicks.wav"
19
+ ],
20
+ "scenes": [
21
+ {
22
+ "id": "text",
23
+ "src": "scenes/text.html",
24
+ "frames": 60
25
+ },
26
+ {
27
+ "id": "typo",
28
+ "src": "scenes/typo.html",
29
+ "frames": 60
30
+ },
31
+ {
32
+ "id": "image",
33
+ "src": "scenes/image.html",
34
+ "frames": 60
35
+ },
36
+ {
37
+ "id": "video",
38
+ "src": "scenes/video.html",
39
+ "frames": 60
40
+ },
41
+ {
42
+ "id": "video2",
43
+ "src": "scenes/video2.html",
44
+ "frames": 60
45
+ },
46
+ {
47
+ "id": "svg",
48
+ "src": "scenes/svg.html",
49
+ "frames": 60
50
+ },
51
+ {
52
+ "id": "filter",
53
+ "src": "scenes/filter.html",
54
+ "frames": 60
55
+ },
56
+ {
57
+ "id": "blend",
58
+ "src": "scenes/blend.html",
59
+ "frames": 60
60
+ },
61
+ {
62
+ "id": "backdrop",
63
+ "src": "scenes/backdrop.html",
64
+ "frames": 60
65
+ },
66
+ {
67
+ "id": "gradient",
68
+ "src": "scenes/gradient.html",
69
+ "frames": 60
70
+ },
71
+ {
72
+ "id": "iframe",
73
+ "src": "scenes/iframe.html",
74
+ "frames": 60
75
+ },
76
+ {
77
+ "id": "canvas2d",
78
+ "src": "scenes/canvas2d.html",
79
+ "frames": 60
80
+ }
81
+ ],
82
+ "transitions": [],
83
+ "audio": [
84
+ {
85
+ "id": "clicks",
86
+ "src": "audio/clicks.wav",
87
+ "start_frame": 0,
88
+ "gain_db": 0
89
+ }
90
+ ],
91
+ "output": {
92
+ "default": {
93
+ "codec": "h264",
94
+ "crf": 18,
95
+ "preset": "medium",
96
+ "pix_fmt": "yuv420p",
97
+ "gop_frames": 30
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,11 @@
1
+ <!doctype html><html lang="id"><head><meta charset="utf-8">
2
+ <script src="/_lib/gsap@3.15.1/gsap.min.js"></script>
3
+ <style>@font-face{font-family:"Inter";font-weight:800;src:url("/assets/fonts/Inter-ExtraBold.ttf") format("truetype")}
4
+ @font-face{font-family:"Inter";font-weight:500;src:url("/assets/fonts/Inter-Medium.ttf") format("truetype")}
5
+ *{margin:0;padding:0;box-sizing:border-box}html,body{width:1080px;height:1920px;overflow:hidden;background:#0f172a;font-family:"Inter",sans-serif;color:#fff}
6
+ .lbl{position:absolute;left:40px;top:40px;font-weight:800;font-size:48px}
7
+ #bg{position:absolute;inset:0;background:repeating-linear-gradient(45deg,#ef4444 0 60px,#3b82f6 60px 120px)}#g{position:absolute;left:140px;top:600px;width:800px;height:700px;border-radius:40px;background:rgba(255,255,255,.15);backdrop-filter:blur(20px) saturate(1.6)}</style></head><body><div class="lbl">backdrop-filter</div>
8
+ <div id="bg"></div><div id="g"></div>
9
+ <script>
10
+ const tl=gsap.timeline({paused:true});tl.fromTo("#g",{y:-300},{y:300,duration:2,ease:"none"},0);__mosio.timeline(tl);
11
+ </script></body></html>
@@ -0,0 +1,11 @@
1
+ <!doctype html><html lang="id"><head><meta charset="utf-8">
2
+ <script src="/_lib/gsap@3.15.1/gsap.min.js"></script>
3
+ <style>@font-face{font-family:"Inter";font-weight:800;src:url("/assets/fonts/Inter-ExtraBold.ttf") format("truetype")}
4
+ @font-face{font-family:"Inter";font-weight:500;src:url("/assets/fonts/Inter-Medium.ttf") format("truetype")}
5
+ *{margin:0;padding:0;box-sizing:border-box}html,body{width:1080px;height:1920px;overflow:hidden;background:#0f172a;font-family:"Inter",sans-serif;color:#fff}
6
+ .lbl{position:absolute;left:40px;top:40px;font-weight:800;font-size:48px}
7
+ #bg{position:absolute;inset:0;background:linear-gradient(135deg,#f59e0b,#3b82f6)}.c{position:absolute;width:520px;height:520px;border-radius:50%}#m1{left:80px;top:300px;background:#ef4444;mix-blend-mode:multiply}#m2{left:480px;top:300px;background:#22c55e;mix-blend-mode:screen}#mask{position:absolute;left:140px;top:950px;width:800px;height:420px;background:url(/assets/image.png) center/cover;-webkit-mask-image:linear-gradient(90deg,#000,transparent);mask-image:linear-gradient(90deg,#000,transparent)}#sh{position:absolute;left:140px;top:1480px;width:800px;height:240px;border-radius:32px;background:#fff;box-shadow:0 30px 60px rgba(0,0,0,.55),0 0 0 8px #0ea5e9;color:#0f172a;font-weight:800;font-size:72px;line-height:240px;text-align:center;text-shadow:4px 4px 0 #f472b6;clip-path:inset(0 0 0 0 round 32px)}</style></head><body><div class="lbl">blend mode, mask, shadow, clip-path</div>
8
+ <div id="bg"></div><div class="c" id="m1"></div><div class="c" id="m2"></div><div id="mask"></div><div id="sh">Bayangan</div>
9
+ <script>
10
+ const tl=gsap.timeline({paused:true});tl.fromTo("#m1",{x:0},{x:120,duration:2},0).fromTo("#sh",{y:0},{y:-60,duration:2},0);__mosio.timeline(tl);
11
+ </script></body></html>
@@ -0,0 +1,11 @@
1
+ <!doctype html><html lang="id"><head><meta charset="utf-8">
2
+ <script src="/_lib/gsap@3.15.1/gsap.min.js"></script>
3
+ <style>@font-face{font-family:"Inter";font-weight:800;src:url("/assets/fonts/Inter-ExtraBold.ttf") format("truetype")}
4
+ @font-face{font-family:"Inter";font-weight:500;src:url("/assets/fonts/Inter-Medium.ttf") format("truetype")}
5
+ *{margin:0;padding:0;box-sizing:border-box}html,body{width:1080px;height:1920px;overflow:hidden;background:#0f172a;font-family:"Inter",sans-serif;color:#fff}
6
+ .lbl{position:absolute;left:40px;top:40px;font-weight:800;font-size:48px}
7
+ #cv{position:absolute;left:90px;top:400px}</style></head><body><div class="lbl">&lt;canvas&gt; 2D drawn per seek</div>
8
+ <canvas id="cv" width="900" height="900"></canvas>
9
+ <script>
10
+ const cx=document.getElementById("cv").getContext("2d");__mosio.onSeek(t=>{cx.fillStyle="#1e293b";cx.fillRect(0,0,900,900);for(let i=0;i<24;i++){cx.fillStyle=`hsl(${i*15+t*90},80%,60%)`;const a=t*2+i*0.26;cx.beginPath();cx.arc(450+Math.cos(a)*(120+i*12),450+Math.sin(a)*(120+i*12),26,0,7);cx.fill();}});
11
+ </script></body></html>