agentvfx 0.0.0-stage → 0.3.5

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 (483) hide show
  1. package/AGENTS.md +8 -0
  2. package/GEMINI.md +1 -0
  3. package/LICENSE +202 -0
  4. package/README.md +228 -2
  5. package/package.json +35 -4
  6. package/skills/agentvfx/LICENSE +202 -0
  7. package/skills/agentvfx/NOTICE +50 -0
  8. package/skills/agentvfx/SKILL.md +90 -0
  9. package/skills/agentvfx/engine/core/constants.mjs +84 -0
  10. package/skills/agentvfx/engine/core/flash-constants.mjs +23 -0
  11. package/skills/agentvfx/engine/core/flash.mjs +240 -0
  12. package/skills/agentvfx/engine/core/mark.mjs +25 -0
  13. package/skills/agentvfx/engine/core/palettes.mjs +36 -0
  14. package/skills/agentvfx/engine/core/schedule.mjs +85 -0
  15. package/skills/agentvfx/engine/core/templates.mjs +43 -0
  16. package/skills/agentvfx/engine/core/util.mjs +167 -0
  17. package/skills/agentvfx/engine/core/validate.mjs +334 -0
  18. package/skills/agentvfx/engine/node/analysis.mjs +172 -0
  19. package/skills/agentvfx/engine/node/audio.mjs +621 -0
  20. package/skills/agentvfx/engine/node/board.mjs +24 -0
  21. package/skills/agentvfx/engine/node/chrome.mjs +349 -0
  22. package/skills/agentvfx/engine/node/encode.mjs +110 -0
  23. package/skills/agentvfx/engine/node/eye.mjs +77 -0
  24. package/skills/agentvfx/engine/node/footage.mjs +129 -0
  25. package/skills/agentvfx/engine/node/frame-worker.mjs +39 -0
  26. package/skills/agentvfx/engine/node/host.mjs +31 -0
  27. package/skills/agentvfx/engine/node/job.mjs +181 -0
  28. package/skills/agentvfx/engine/node/png.mjs +112 -0
  29. package/skills/agentvfx/engine/node/render.mjs +161 -0
  30. package/skills/agentvfx/engine/node/stage-capture.mjs +187 -0
  31. package/skills/agentvfx/engine/node/stage-serve.mjs +72 -0
  32. package/skills/agentvfx/engine/node/stills.mjs +100 -0
  33. package/skills/agentvfx/engine/node/ws-server.mjs +132 -0
  34. package/skills/agentvfx/engine/web/gl.mjs +319 -0
  35. package/skills/agentvfx/engine/web/glsl-common.mjs +78 -0
  36. package/skills/agentvfx/engine/web/init.js +23 -0
  37. package/skills/agentvfx/engine/web/prelude.mjs +150 -0
  38. package/skills/agentvfx/engine/web/render.html +11 -0
  39. package/skills/agentvfx/engine/web/render.mjs +388 -0
  40. package/skills/agentvfx/engine/web/scale.mjs +15 -0
  41. package/skills/agentvfx/engine/web/text.mjs +158 -0
  42. package/skills/agentvfx/plates/terminalcore/README.md +61 -0
  43. package/skills/agentvfx/plates/terminalcore/__pycache__/crt.cpython-313.pyc +0 -0
  44. package/skills/agentvfx/plates/terminalcore/__pycache__/font.cpython-313.pyc +0 -0
  45. package/skills/agentvfx/plates/terminalcore/__pycache__/gallery.cpython-313.pyc +0 -0
  46. package/skills/agentvfx/plates/terminalcore/__pycache__/gallery_mats.cpython-313.pyc +0 -0
  47. package/skills/agentvfx/plates/terminalcore/__pycache__/gallery_room.cpython-313.pyc +0 -0
  48. package/skills/agentvfx/plates/terminalcore/__pycache__/materials.cpython-313.pyc +0 -0
  49. package/skills/agentvfx/plates/terminalcore/__pycache__/nodekit.cpython-313.pyc +0 -0
  50. package/skills/agentvfx/plates/terminalcore/__pycache__/room.cpython-313.pyc +0 -0
  51. package/skills/agentvfx/plates/terminalcore/__pycache__/shots.cpython-313.pyc +0 -0
  52. package/skills/agentvfx/plates/terminalcore/__pycache__/textures.cpython-313.pyc +0 -0
  53. package/skills/agentvfx/plates/terminalcore/__pycache__/wall.cpython-313.pyc +0 -0
  54. package/skills/agentvfx/plates/terminalcore/crt.py +143 -0
  55. package/skills/agentvfx/plates/terminalcore/font.py +80 -0
  56. package/skills/agentvfx/plates/terminalcore/gallery.py +61 -0
  57. package/skills/agentvfx/plates/terminalcore/gallery_mats.py +144 -0
  58. package/skills/agentvfx/plates/terminalcore/gallery_room.py +126 -0
  59. package/skills/agentvfx/plates/terminalcore/materials.py +170 -0
  60. package/skills/agentvfx/plates/terminalcore/nodekit.py +87 -0
  61. package/skills/agentvfx/plates/terminalcore/room.py +82 -0
  62. package/skills/agentvfx/plates/terminalcore/scene.py +219 -0
  63. package/skills/agentvfx/plates/terminalcore/shots.py +48 -0
  64. package/skills/agentvfx/plates/terminalcore/textures.py +79 -0
  65. package/skills/agentvfx/plates/terminalcore/wall.py +103 -0
  66. package/skills/agentvfx/references/plates.md +22 -0
  67. package/skills/agentvfx/references/template-format.md +149 -0
  68. package/skills/agentvfx/references/web.md +63 -0
  69. package/skills/agentvfx/runtime/agentvfx.js +708 -0
  70. package/skills/agentvfx/schemas/fx-score.schema.json +98 -0
  71. package/skills/agentvfx/scripts/export-web.mjs +157 -0
  72. package/skills/agentvfx/scripts/loop.mjs +129 -0
  73. package/skills/agentvfx/scripts/make-beat.mjs +133 -0
  74. package/skills/agentvfx/scripts/plate.mjs +82 -0
  75. package/skills/agentvfx/scripts/vfx.mjs +173 -0
  76. package/skills/agentvfx/templates/_test/feedback-counter/fx.json +11 -0
  77. package/skills/agentvfx/templates/_test/feedback-counter/main.frag +4 -0
  78. package/skills/agentvfx/templates/_test/feedback-counter/pass0.frag +4 -0
  79. package/skills/agentvfx/templates/_test/gradient/fx.json +23 -0
  80. package/skills/agentvfx/templates/_test/gradient/main.frag +5 -0
  81. package/skills/agentvfx/templates/_test/identity/fx.json +10 -0
  82. package/skills/agentvfx/templates/_test/identity/main.frag +4 -0
  83. package/skills/agentvfx/templates/_test/strobe/fx.json +14 -0
  84. package/skills/agentvfx/templates/_test/strobe/main.frag +6 -0
  85. package/skills/agentvfx/templates/_test/text-probe/fx.json +15 -0
  86. package/skills/agentvfx/templates/_test/text-probe/main.frag +6 -0
  87. package/skills/agentvfx/templates/brutal/NOTES.md +14 -0
  88. package/skills/agentvfx/templates/brutal/_src/boot-log/def.mjs +57 -0
  89. package/skills/agentvfx/templates/brutal/_src/boot-log/main.src.frag +129 -0
  90. package/skills/agentvfx/templates/brutal/_src/build.mjs +33 -0
  91. package/skills/agentvfx/templates/brutal/_src/halftone-field/def.mjs +72 -0
  92. package/skills/agentvfx/templates/brutal/_src/halftone-field/main.src.frag +94 -0
  93. package/skills/agentvfx/templates/brutal/_src/hud-deck/deck-left.src.glsl +100 -0
  94. package/skills/agentvfx/templates/brutal/_src/hud-deck/deck-right.src.glsl +61 -0
  95. package/skills/agentvfx/templates/brutal/_src/hud-deck/deck-tiles.src.glsl +153 -0
  96. package/skills/agentvfx/templates/brutal/_src/hud-deck/def.mjs +82 -0
  97. package/skills/agentvfx/templates/brutal/_src/hud-deck/main.src.frag +110 -0
  98. package/skills/agentvfx/templates/brutal/_src/hud-deck/pass0.src.frag +38 -0
  99. package/skills/agentvfx/templates/brutal/_src/shared/defs.mjs +28 -0
  100. package/skills/agentvfx/templates/brutal/_src/shared/icons.glsl +72 -0
  101. package/skills/agentvfx/templates/brutal/_src/shared/lib.glsl +115 -0
  102. package/skills/agentvfx/templates/brutal/_src/shared/screen.glsl +43 -0
  103. package/skills/agentvfx/templates/brutal/boot-log/demo-acid.json +1 -0
  104. package/skills/agentvfx/templates/brutal/boot-log/demo-phosphor.json +1 -0
  105. package/skills/agentvfx/templates/brutal/boot-log/demo-ultramarine.json +1 -0
  106. package/skills/agentvfx/templates/brutal/boot-log/fx.json +257 -0
  107. package/skills/agentvfx/templates/brutal/boot-log/main.frag +242 -0
  108. package/skills/agentvfx/templates/brutal/collage/_src/00-lib.glsl +73 -0
  109. package/skills/agentvfx/templates/brutal/collage/_src/10-spectrum-scope.glsl +73 -0
  110. package/skills/agentvfx/templates/brutal/collage/_src/20-meter-readout-cross.glsl +87 -0
  111. package/skills/agentvfx/templates/brutal/collage/_src/30-footage-fillers.glsl +92 -0
  112. package/skills/agentvfx/templates/brutal/collage/_src/40-editorial.glsl +232 -0
  113. package/skills/agentvfx/templates/brutal/collage/_src/50-typefx.glsl +163 -0
  114. package/skills/agentvfx/templates/brutal/collage/_src/60-scene-lib.glsl +104 -0
  115. package/skills/agentvfx/templates/brutal/collage/_src/61-scene-specimen.glsl +71 -0
  116. package/skills/agentvfx/templates/brutal/collage/_src/62-scene-wiring.glsl +96 -0
  117. package/skills/agentvfx/templates/brutal/collage/_src/63-scene-fieldcut.glsl +119 -0
  118. package/skills/agentvfx/templates/brutal/collage/_src/64-scene-pattern.glsl +64 -0
  119. package/skills/agentvfx/templates/brutal/collage/_src/641-scene-anatomy.glsl +49 -0
  120. package/skills/agentvfx/templates/brutal/collage/_src/642-scene-deck.glsl +78 -0
  121. package/skills/agentvfx/templates/brutal/collage/_src/643-scene-bootlog.glsl +60 -0
  122. package/skills/agentvfx/templates/brutal/collage/_src/644-scene-tunnel.glsl +48 -0
  123. package/skills/agentvfx/templates/brutal/collage/_src/645-scene-runner.glsl +42 -0
  124. package/skills/agentvfx/templates/brutal/collage/_src/646-scene-ascii.glsl +66 -0
  125. package/skills/agentvfx/templates/brutal/collage/_src/647-scene-cubewall.glsl +80 -0
  126. package/skills/agentvfx/templates/brutal/collage/_src/648-scene-vortex.glsl +46 -0
  127. package/skills/agentvfx/templates/brutal/collage/_src/649-scene-sticker.glsl +72 -0
  128. package/skills/agentvfx/templates/brutal/collage/_src/65-scene-main.glsl +1 -0
  129. package/skills/agentvfx/templates/brutal/collage/_src/650-scene-ribbon.glsl +55 -0
  130. package/skills/agentvfx/templates/brutal/collage/_src/651-scene-slab.glsl +38 -0
  131. package/skills/agentvfx/templates/brutal/collage/_src/652-scene-framedial.glsl +79 -0
  132. package/skills/agentvfx/templates/brutal/collage/_src/653-scene-tilt.glsl +40 -0
  133. package/skills/agentvfx/templates/brutal/collage/_src/654-scene-marquee.glsl +45 -0
  134. package/skills/agentvfx/templates/brutal/collage/_src/655-scene-lens.glsl +57 -0
  135. package/skills/agentvfx/templates/brutal/collage/_src/656-scene-liquid.glsl +35 -0
  136. package/skills/agentvfx/templates/brutal/collage/_src/657-scene-panelgrid.glsl +75 -0
  137. package/skills/agentvfx/templates/brutal/collage/_src/658-scene-mirror.glsl +49 -0
  138. package/skills/agentvfx/templates/brutal/collage/_src/66-scene-main.glsl +27 -0
  139. package/skills/agentvfx/templates/brutal/collage/_src/90-main.glsl +120 -0
  140. package/skills/agentvfx/templates/brutal/collage/_src/build.mjs +24 -0
  141. package/skills/agentvfx/templates/brutal/collage/_src/sync-presets.mjs +16 -0
  142. package/skills/agentvfx/templates/brutal/collage/demo-bone-lime.json +1 -0
  143. package/skills/agentvfx/templates/brutal/collage/demo-lime-sparse.json +1 -0
  144. package/skills/agentvfx/templates/brutal/collage/demo-orange-dense.json +1 -0
  145. package/skills/agentvfx/templates/brutal/collage/demo-ultra-slow.json +1 -0
  146. package/skills/agentvfx/templates/brutal/collage/fx.json +4882 -0
  147. package/skills/agentvfx/templates/brutal/collage/layout.mjs +97 -0
  148. package/skills/agentvfx/templates/brutal/collage/layouts.json +366 -0
  149. package/skills/agentvfx/templates/brutal/collage/main.frag +2367 -0
  150. package/skills/agentvfx/templates/brutal/collage/pass0.frag +265 -0
  151. package/skills/agentvfx/templates/brutal/halftone-field/demo-acid.json +1 -0
  152. package/skills/agentvfx/templates/brutal/halftone-field/demo-ascii.json +1 -0
  153. package/skills/agentvfx/templates/brutal/halftone-field/demo-dither.json +1 -0
  154. package/skills/agentvfx/templates/brutal/halftone-field/demo-orange.json +1 -0
  155. package/skills/agentvfx/templates/brutal/halftone-field/demo-phosphor.json +1 -0
  156. package/skills/agentvfx/templates/brutal/halftone-field/demo-ultramarine.json +1 -0
  157. package/skills/agentvfx/templates/brutal/halftone-field/fx.json +474 -0
  158. package/skills/agentvfx/templates/brutal/halftone-field/main.frag +248 -0
  159. package/skills/agentvfx/templates/brutal/hud-deck/demo-acid.json +1 -0
  160. package/skills/agentvfx/templates/brutal/hud-deck/demo-night.json +1 -0
  161. package/skills/agentvfx/templates/brutal/hud-deck/demo-octagon.json +1 -0
  162. package/skills/agentvfx/templates/brutal/hud-deck/demo-ultramarine.json +1 -0
  163. package/skills/agentvfx/templates/brutal/hud-deck/fx.json +601 -0
  164. package/skills/agentvfx/templates/brutal/hud-deck/main.frag +645 -0
  165. package/skills/agentvfx/templates/brutal/hud-deck/pass0.frag +38 -0
  166. package/skills/agentvfx/templates/brutal/lattice/demo-cobalt-fine.json +1 -0
  167. package/skills/agentvfx/templates/brutal/lattice/demo-ink-yellow.json +1 -0
  168. package/skills/agentvfx/templates/brutal/lattice/demo-vermilion.json +1 -0
  169. package/skills/agentvfx/templates/brutal/lattice/demo-violet-slow.json +1 -0
  170. package/skills/agentvfx/templates/brutal/lattice/fx.json +130 -0
  171. package/skills/agentvfx/templates/brutal/lattice/main.frag +175 -0
  172. package/skills/agentvfx/templates/brutal/lattice/pass0.frag +29 -0
  173. package/skills/agentvfx/templates/glitch/block-glitch/demo-mosaic.json +1 -0
  174. package/skills/agentvfx/templates/glitch/block-glitch/demo-onset.json +1 -0
  175. package/skills/agentvfx/templates/glitch/block-glitch/demo-static.json +1 -0
  176. package/skills/agentvfx/templates/glitch/block-glitch/demo-tear.json +1 -0
  177. package/skills/agentvfx/templates/glitch/block-glitch/fx.json +54 -0
  178. package/skills/agentvfx/templates/glitch/block-glitch/main.frag +132 -0
  179. package/skills/agentvfx/templates/glitch/block-glitch/pass0.frag +12 -0
  180. package/skills/agentvfx/templates/glitch/pixel-sort/NOTES.md +13 -0
  181. package/skills/agentvfx/templates/glitch/pixel-sort/build-passes.mjs +162 -0
  182. package/skills/agentvfx/templates/glitch/pixel-sort/demo-chunk.json +1 -0
  183. package/skills/agentvfx/templates/glitch/pixel-sort/demo-hue.json +1 -0
  184. package/skills/agentvfx/templates/glitch/pixel-sort/demo-kick.json +1 -0
  185. package/skills/agentvfx/templates/glitch/pixel-sort/demo-streak.json +1 -0
  186. package/skills/agentvfx/templates/glitch/pixel-sort/demo-vertical.json +1 -0
  187. package/skills/agentvfx/templates/glitch/pixel-sort/fx.json +60 -0
  188. package/skills/agentvfx/templates/glitch/pixel-sort/main.frag +83 -0
  189. package/skills/agentvfx/templates/glitch/pixel-sort/pass0.frag +64 -0
  190. package/skills/agentvfx/templates/glitch/pixel-sort/pass1.frag +66 -0
  191. package/skills/agentvfx/templates/glitch/pixel-sort/pass2.frag +66 -0
  192. package/skills/agentvfx/templates/glitch/pixel-sort/pass3.frag +66 -0
  193. package/skills/agentvfx/templates/glitch/pixel-sort/pass4.frag +66 -0
  194. package/skills/agentvfx/templates/glitch/pixel-sort/pass5.frag +66 -0
  195. package/skills/agentvfx/templates/glitch/pixel-sort/pass6.frag +66 -0
  196. package/skills/agentvfx/templates/glitch/pixel-sort/pass7.frag +66 -0
  197. package/skills/agentvfx/templates/glitch/pixel-sort/pass8.frag +66 -0
  198. package/skills/agentvfx/templates/glitch/rgb-split/demo-diagonal-stutter.json +1 -0
  199. package/skills/agentvfx/templates/glitch/rgb-split/demo-hard.json +1 -0
  200. package/skills/agentvfx/templates/glitch/rgb-split/demo-kick.json +1 -0
  201. package/skills/agentvfx/templates/glitch/rgb-split/demo-radial.json +1 -0
  202. package/skills/agentvfx/templates/glitch/rgb-split/fx.json +46 -0
  203. package/skills/agentvfx/templates/glitch/rgb-split/main.frag +76 -0
  204. package/skills/agentvfx/templates/glitch/vhs/demo-clean.json +1 -0
  205. package/skills/agentvfx/templates/glitch/vhs/demo-crash.json +1 -0
  206. package/skills/agentvfx/templates/glitch/vhs/demo-tape.json +1 -0
  207. package/skills/agentvfx/templates/glitch/vhs/demo-worn.json +1 -0
  208. package/skills/agentvfx/templates/glitch/vhs/fx.json +46 -0
  209. package/skills/agentvfx/templates/glitch/vhs/main.frag +96 -0
  210. package/skills/agentvfx/templates/impact/impact-1bit/demo-onebit-bayer.json +1 -0
  211. package/skills/agentvfx/templates/impact/impact-1bit/fx.json +45 -0
  212. package/skills/agentvfx/templates/impact/impact-1bit/main.frag +64 -0
  213. package/skills/agentvfx/templates/impact/impact-invert/demo-invert-snap.json +1 -0
  214. package/skills/agentvfx/templates/impact/impact-invert/fx.json +37 -0
  215. package/skills/agentvfx/templates/impact/impact-invert/main.frag +44 -0
  216. package/skills/agentvfx/templates/impact/punch-shake/demo-punch-hard.json +1 -0
  217. package/skills/agentvfx/templates/impact/punch-shake/fx.json +36 -0
  218. package/skills/agentvfx/templates/impact/punch-shake/main.frag +62 -0
  219. package/skills/agentvfx/templates/impact/rgb-hit/demo-rgb-slam.json +1 -0
  220. package/skills/agentvfx/templates/impact/rgb-hit/fx.json +39 -0
  221. package/skills/agentvfx/templates/impact/rgb-hit/main.frag +62 -0
  222. package/skills/agentvfx/templates/impact/signal-cut/demo-lime-hold.json +1 -0
  223. package/skills/agentvfx/templates/impact/signal-cut/demo-lime.json +1 -0
  224. package/skills/agentvfx/templates/impact/signal-cut/demo-orange.json +1 -0
  225. package/skills/agentvfx/templates/impact/signal-cut/demo-ultramarine.json +1 -0
  226. package/skills/agentvfx/templates/impact/signal-cut/fx.json +83 -0
  227. package/skills/agentvfx/templates/impact/signal-cut/main.frag +101 -0
  228. package/skills/agentvfx/templates/impact/signal-cut/pass0.frag +68 -0
  229. package/skills/agentvfx/templates/impact/speedline-burst/demo-speed-white.json +1 -0
  230. package/skills/agentvfx/templates/impact/speedline-burst/fx.json +44 -0
  231. package/skills/agentvfx/templates/impact/speedline-burst/main.frag +68 -0
  232. package/skills/agentvfx/templates/impact/strobe-burst/demo-strobe-white-16.json +1 -0
  233. package/skills/agentvfx/templates/impact/strobe-burst/fx.json +42 -0
  234. package/skills/agentvfx/templates/impact/strobe-burst/main.frag +43 -0
  235. package/skills/agentvfx/templates/light/anamorphic-streak/demo-anamorphic-cinema.json +10 -0
  236. package/skills/agentvfx/templates/light/anamorphic-streak/demo-data.json +10 -0
  237. package/skills/agentvfx/templates/light/anamorphic-streak/fx.json +47 -0
  238. package/skills/agentvfx/templates/light/anamorphic-streak/main.frag +45 -0
  239. package/skills/agentvfx/templates/light/anamorphic-streak/pass0.frag +22 -0
  240. package/skills/agentvfx/templates/light/anamorphic-streak/pass1.frag +16 -0
  241. package/skills/agentvfx/templates/light/anamorphic-streak/pass2.frag +16 -0
  242. package/skills/agentvfx/templates/light/anamorphic-streak/pass3.frag +16 -0
  243. package/skills/agentvfx/templates/light/bloom-glow/demo-clip01-low.json +11 -0
  244. package/skills/agentvfx/templates/light/bloom-glow/demo-neon-night.json +10 -0
  245. package/skills/agentvfx/templates/light/bloom-glow/demo-phosphor.json +11 -0
  246. package/skills/agentvfx/templates/light/bloom-glow/fx.json +53 -0
  247. package/skills/agentvfx/templates/light/bloom-glow/main.frag +85 -0
  248. package/skills/agentvfx/templates/light/bloom-glow/pass0.frag +21 -0
  249. package/skills/agentvfx/templates/light/bloom-glow/pass1.frag +50 -0
  250. package/skills/agentvfx/templates/light/bloom-glow/pass2.frag +44 -0
  251. package/skills/agentvfx/templates/light/bloom-glow/pass3.frag +32 -0
  252. package/skills/agentvfx/templates/light/bloom-glow/pass4.frag +48 -0
  253. package/skills/agentvfx/templates/light/bloom-glow/pass5.frag +46 -0
  254. package/skills/agentvfx/templates/light/god-rays/demo-golden-hour.json +10 -0
  255. package/skills/agentvfx/templates/light/god-rays/demo-point-lamp.json +10 -0
  256. package/skills/agentvfx/templates/light/god-rays/fx.json +39 -0
  257. package/skills/agentvfx/templates/light/god-rays/main.frag +54 -0
  258. package/skills/agentvfx/templates/light/lens-flare/demo-clip01-bar.json +11 -0
  259. package/skills/agentvfx/templates/light/lens-flare/demo-eye-bar.json +10 -0
  260. package/skills/agentvfx/templates/light/lens-flare/demo-sun-ghosts.json +10 -0
  261. package/skills/agentvfx/templates/light/lens-flare/fx.json +49 -0
  262. package/skills/agentvfx/templates/light/lens-flare/main.frag +86 -0
  263. package/skills/agentvfx/templates/light/lens-flare/pass0.frag +24 -0
  264. package/skills/agentvfx/templates/light/light-leak/demo-slit.json +10 -0
  265. package/skills/agentvfx/templates/light/light-leak/demo-vintage-burn.json +10 -0
  266. package/skills/agentvfx/templates/light/light-leak/fx.json +40 -0
  267. package/skills/agentvfx/templates/light/light-leak/main.frag +46 -0
  268. package/skills/agentvfx/templates/light/light-stage/fx.json +29 -0
  269. package/skills/agentvfx/templates/light/light-stage/main.frag +56 -0
  270. package/skills/agentvfx/templates/light/light-sweep/demo-hard-bar.json +12 -0
  271. package/skills/agentvfx/templates/light/light-sweep/demo-logo-sweep.json +10 -0
  272. package/skills/agentvfx/templates/light/light-sweep/demo-onset.json +11 -0
  273. package/skills/agentvfx/templates/light/light-sweep/fx.json +45 -0
  274. package/skills/agentvfx/templates/light/light-sweep/main.frag +29 -0
  275. package/skills/agentvfx/templates/light/light-sweep/pass0.frag +17 -0
  276. package/skills/agentvfx/templates/light/light-sweep/pass1.frag +15 -0
  277. package/skills/agentvfx/templates/light/neon-saber/demo-hairline.json +10 -0
  278. package/skills/agentvfx/templates/light/neon-saber/demo-saber-laser.json +10 -0
  279. package/skills/agentvfx/templates/light/neon-saber/fx.json +48 -0
  280. package/skills/agentvfx/templates/light/neon-saber/main.frag +27 -0
  281. package/skills/agentvfx/templates/light/neon-saber/pass0.frag +46 -0
  282. package/skills/agentvfx/templates/light/neon-saber/pass1.frag +15 -0
  283. package/skills/agentvfx/templates/psychedelic/echo-flow/demo-trail.json +1 -0
  284. package/skills/agentvfx/templates/psychedelic/echo-flow/fx.json +38 -0
  285. package/skills/agentvfx/templates/psychedelic/echo-flow/main.frag +19 -0
  286. package/skills/agentvfx/templates/psychedelic/echo-flow/pass0.frag +16 -0
  287. package/skills/agentvfx/templates/psychedelic/echo-flow/pass1.frag +20 -0
  288. package/skills/agentvfx/templates/psychedelic/echo-flow/pass2.frag +11 -0
  289. package/skills/agentvfx/templates/psychedelic/echo-flow/pass3.frag +4 -0
  290. package/skills/agentvfx/templates/psychedelic/hologram-scan/demo-cyan.json +1 -0
  291. package/skills/agentvfx/templates/psychedelic/hologram-scan/fx.json +36 -0
  292. package/skills/agentvfx/templates/psychedelic/hologram-scan/main.frag +30 -0
  293. package/skills/agentvfx/templates/psychedelic/kaleido-fold/demo-six.json +1 -0
  294. package/skills/agentvfx/templates/psychedelic/kaleido-fold/fx.json +37 -0
  295. package/skills/agentvfx/templates/psychedelic/kaleido-fold/main.frag +10 -0
  296. package/skills/agentvfx/templates/psychedelic/kaleido-fold/pass0.frag +34 -0
  297. package/skills/agentvfx/templates/psychedelic/mosh-melt/demo-classic.json +1 -0
  298. package/skills/agentvfx/templates/psychedelic/mosh-melt/fx.json +38 -0
  299. package/skills/agentvfx/templates/psychedelic/mosh-melt/main.frag +20 -0
  300. package/skills/agentvfx/templates/psychedelic/mosh-melt/pass0.frag +22 -0
  301. package/skills/agentvfx/templates/psychedelic/sacred/NOTES.md +13 -0
  302. package/skills/agentvfx/templates/psychedelic/sacred/demo-classic.json +1 -0
  303. package/skills/agentvfx/templates/psychedelic/sacred/demo-halo.json +1 -0
  304. package/skills/agentvfx/templates/psychedelic/sacred/demo-slow-tide.json +1 -0
  305. package/skills/agentvfx/templates/psychedelic/sacred/demo-thermal.json +1 -0
  306. package/skills/agentvfx/templates/psychedelic/sacred/fx.json +263 -0
  307. package/skills/agentvfx/templates/psychedelic/sacred/main.frag +109 -0
  308. package/skills/agentvfx/templates/psychedelic/sacred/pass0.frag +25 -0
  309. package/skills/agentvfx/templates/psychedelic/sacred/pass1.frag +23 -0
  310. package/skills/agentvfx/templates/psychedelic/tidal-bands/demo-classic.json +1 -0
  311. package/skills/agentvfx/templates/psychedelic/tidal-bands/fx.json +37 -0
  312. package/skills/agentvfx/templates/psychedelic/tidal-bands/main.frag +54 -0
  313. package/skills/agentvfx/templates/scope/_chrome.glsl +242 -0
  314. package/skills/agentvfx/templates/scope/goniometer/demo-boot-green.json +1 -0
  315. package/skills/agentvfx/templates/scope/goniometer/demo-field-lime.json +1 -0
  316. package/skills/agentvfx/templates/scope/goniometer/demo-field-ultramarine.json +1 -0
  317. package/skills/agentvfx/templates/scope/goniometer/demo-glow-phosphor.json +1 -0
  318. package/skills/agentvfx/templates/scope/goniometer/demo-hud-black.json +1 -0
  319. package/skills/agentvfx/templates/scope/goniometer/fx.json +635 -0
  320. package/skills/agentvfx/templates/scope/goniometer/main.frag +33 -0
  321. package/skills/agentvfx/templates/scope/goniometer/pass0.frag +58 -0
  322. package/skills/agentvfx/templates/scope/goniometer/pass1.frag +43 -0
  323. package/skills/agentvfx/templates/scope/goniometer/pass2.frag +12 -0
  324. package/skills/agentvfx/templates/scope/goniometer/pass3.frag +12 -0
  325. package/skills/agentvfx/templates/scope/goniometer/pass4.frag +12 -0
  326. package/skills/agentvfx/templates/scope/goniometer/pass5.frag +12 -0
  327. package/skills/agentvfx/templates/scope/goniometer/pass6.frag +251 -0
  328. package/skills/agentvfx/templates/scope/scope-polar/demo-boot-green.json +1 -0
  329. package/skills/agentvfx/templates/scope/scope-polar/demo-field-lime.json +1 -0
  330. package/skills/agentvfx/templates/scope/scope-polar/demo-field-ultramarine.json +1 -0
  331. package/skills/agentvfx/templates/scope/scope-polar/demo-glow-phosphor.json +1 -0
  332. package/skills/agentvfx/templates/scope/scope-polar/demo-hud-black.json +1 -0
  333. package/skills/agentvfx/templates/scope/scope-polar/fx.json +686 -0
  334. package/skills/agentvfx/templates/scope/scope-polar/main.frag +39 -0
  335. package/skills/agentvfx/templates/scope/scope-polar/pass0.frag +84 -0
  336. package/skills/agentvfx/templates/scope/scope-polar/pass1.frag +49 -0
  337. package/skills/agentvfx/templates/scope/scope-polar/pass2.frag +12 -0
  338. package/skills/agentvfx/templates/scope/scope-polar/pass3.frag +12 -0
  339. package/skills/agentvfx/templates/scope/scope-polar/pass4.frag +12 -0
  340. package/skills/agentvfx/templates/scope/scope-polar/pass5.frag +12 -0
  341. package/skills/agentvfx/templates/scope/scope-polar/pass6.frag +251 -0
  342. package/skills/agentvfx/templates/scope/scope-triggered/demo-boot-green.json +1 -0
  343. package/skills/agentvfx/templates/scope/scope-triggered/demo-field-lime.json +1 -0
  344. package/skills/agentvfx/templates/scope/scope-triggered/demo-field-ultramarine.json +1 -0
  345. package/skills/agentvfx/templates/scope/scope-triggered/demo-glow-phosphor.json +1 -0
  346. package/skills/agentvfx/templates/scope/scope-triggered/demo-hud-black.json +1 -0
  347. package/skills/agentvfx/templates/scope/scope-triggered/fx.json +712 -0
  348. package/skills/agentvfx/templates/scope/scope-triggered/main.frag +36 -0
  349. package/skills/agentvfx/templates/scope/scope-triggered/pass0.frag +78 -0
  350. package/skills/agentvfx/templates/scope/scope-triggered/pass1.frag +50 -0
  351. package/skills/agentvfx/templates/scope/scope-triggered/pass2.frag +12 -0
  352. package/skills/agentvfx/templates/scope/scope-triggered/pass3.frag +12 -0
  353. package/skills/agentvfx/templates/scope/scope-triggered/pass4.frag +12 -0
  354. package/skills/agentvfx/templates/scope/scope-triggered/pass5.frag +12 -0
  355. package/skills/agentvfx/templates/scope/scope-triggered/pass6.frag +251 -0
  356. package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-boot-green.json +1 -0
  357. package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-field-lime.json +1 -0
  358. package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-field-ultramarine.json +1 -0
  359. package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-glow-phosphor.json +1 -0
  360. package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-hud-black.json +1 -0
  361. package/skills/agentvfx/templates/scope/spectrogram-scroll/fx.json +595 -0
  362. package/skills/agentvfx/templates/scope/spectrogram-scroll/main.frag +83 -0
  363. package/skills/agentvfx/templates/scope/spectrogram-scroll/pass0.frag +52 -0
  364. package/skills/agentvfx/templates/scope/spectrogram-scroll/pass1.frag +251 -0
  365. package/skills/agentvfx/templates/scope/xy-phosphor/demo-boot-green.json +1 -0
  366. package/skills/agentvfx/templates/scope/xy-phosphor/demo-field-lime.json +1 -0
  367. package/skills/agentvfx/templates/scope/xy-phosphor/demo-field-ultramarine.json +1 -0
  368. package/skills/agentvfx/templates/scope/xy-phosphor/demo-glow-phosphor.json +1 -0
  369. package/skills/agentvfx/templates/scope/xy-phosphor/demo-hud-black.json +1 -0
  370. package/skills/agentvfx/templates/scope/xy-phosphor/fx.json +642 -0
  371. package/skills/agentvfx/templates/scope/xy-phosphor/main.frag +33 -0
  372. package/skills/agentvfx/templates/scope/xy-phosphor/pass0.frag +56 -0
  373. package/skills/agentvfx/templates/scope/xy-phosphor/pass1.frag +44 -0
  374. package/skills/agentvfx/templates/scope/xy-phosphor/pass2.frag +12 -0
  375. package/skills/agentvfx/templates/scope/xy-phosphor/pass3.frag +12 -0
  376. package/skills/agentvfx/templates/scope/xy-phosphor/pass4.frag +12 -0
  377. package/skills/agentvfx/templates/scope/xy-phosphor/pass5.frag +12 -0
  378. package/skills/agentvfx/templates/scope/xy-phosphor/pass6.frag +251 -0
  379. package/skills/agentvfx/templates/spectrum/_src/bars-linear/fx.src.json +61 -0
  380. package/skills/agentvfx/templates/spectrum/_src/bars-linear/main.src.frag +112 -0
  381. package/skills/agentvfx/templates/spectrum/_src/bars-linear/pass0.src.frag +2 -0
  382. package/skills/agentvfx/templates/spectrum/_src/bars-mirror/fx.src.json +51 -0
  383. package/skills/agentvfx/templates/spectrum/_src/bars-mirror/main.src.frag +72 -0
  384. package/skills/agentvfx/templates/spectrum/_src/bars-mirror/pass0.src.frag +2 -0
  385. package/skills/agentvfx/templates/spectrum/_src/bass-circle/fx.src.json +56 -0
  386. package/skills/agentvfx/templates/spectrum/_src/bass-circle/main.src.frag +136 -0
  387. package/skills/agentvfx/templates/spectrum/_src/bass-circle/pass0.src.frag +2 -0
  388. package/skills/agentvfx/templates/spectrum/_src/build.mjs +68 -0
  389. package/skills/agentvfx/templates/spectrum/_src/label-bars/fx.src.json +54 -0
  390. package/skills/agentvfx/templates/spectrum/_src/label-bars/main.src.frag +102 -0
  391. package/skills/agentvfx/templates/spectrum/_src/label-bars/pass0.src.frag +2 -0
  392. package/skills/agentvfx/templates/spectrum/_src/shared/bars-fn.glsl +64 -0
  393. package/skills/agentvfx/templates/spectrum/_src/shared/bars-pass.glsl +22 -0
  394. package/skills/agentvfx/templates/spectrum/_src/shared/clock.glsl +7 -0
  395. package/skills/agentvfx/templates/spectrum/_src/shared/hud.glsl +50 -0
  396. package/skills/agentvfx/templates/spectrum/_src/shared/stage.glsl +74 -0
  397. package/skills/agentvfx/templates/spectrum/_src/spectrum-particles/fx.src.json +58 -0
  398. package/skills/agentvfx/templates/spectrum/_src/spectrum-particles/main.src.frag +119 -0
  399. package/skills/agentvfx/templates/spectrum/_src/spectrum-particles/pass0.src.frag +33 -0
  400. package/skills/agentvfx/templates/spectrum/_src/spectrum-radial/fx.src.json +56 -0
  401. package/skills/agentvfx/templates/spectrum/_src/spectrum-radial/main.src.frag +95 -0
  402. package/skills/agentvfx/templates/spectrum/_src/spectrum-radial/pass0.src.frag +2 -0
  403. package/skills/agentvfx/templates/spectrum/_src/waveform-line/fx.src.json +60 -0
  404. package/skills/agentvfx/templates/spectrum/_src/waveform-line/main.src.frag +98 -0
  405. package/skills/agentvfx/templates/spectrum/_src/waveform-line/pass0.src.frag +43 -0
  406. package/skills/agentvfx/templates/spectrum/bars-linear/demo-graph-acid.json +1 -0
  407. package/skills/agentvfx/templates/spectrum/bars-linear/demo-graph-black.json +1 -0
  408. package/skills/agentvfx/templates/spectrum/bars-linear/fx.json +632 -0
  409. package/skills/agentvfx/templates/spectrum/bars-linear/main.frag +233 -0
  410. package/skills/agentvfx/templates/spectrum/bars-linear/pass0.frag +91 -0
  411. package/skills/agentvfx/templates/spectrum/bars-mirror/demo-field-acid.json +1 -0
  412. package/skills/agentvfx/templates/spectrum/bars-mirror/demo-field-ultramarine.json +1 -0
  413. package/skills/agentvfx/templates/spectrum/bars-mirror/fx.json +539 -0
  414. package/skills/agentvfx/templates/spectrum/bars-mirror/main.frag +193 -0
  415. package/skills/agentvfx/templates/spectrum/bars-mirror/pass0.frag +91 -0
  416. package/skills/agentvfx/templates/spectrum/bass-circle/demo-bracket-black.json +1 -0
  417. package/skills/agentvfx/templates/spectrum/bass-circle/demo-bracket-ultramarine.json +1 -0
  418. package/skills/agentvfx/templates/spectrum/bass-circle/fx.json +552 -0
  419. package/skills/agentvfx/templates/spectrum/bass-circle/main.frag +258 -0
  420. package/skills/agentvfx/templates/spectrum/bass-circle/pass0.frag +91 -0
  421. package/skills/agentvfx/templates/spectrum/label-bars/demo-deck-black.json +1 -0
  422. package/skills/agentvfx/templates/spectrum/label-bars/demo-deck-ultramarine.json +1 -0
  423. package/skills/agentvfx/templates/spectrum/label-bars/fx.json +552 -0
  424. package/skills/agentvfx/templates/spectrum/label-bars/main.frag +223 -0
  425. package/skills/agentvfx/templates/spectrum/label-bars/pass0.frag +91 -0
  426. package/skills/agentvfx/templates/spectrum/spectrum-particles/demo-cloud-black.json +1 -0
  427. package/skills/agentvfx/templates/spectrum/spectrum-particles/demo-cloud-ultramarine.json +1 -0
  428. package/skills/agentvfx/templates/spectrum/spectrum-particles/fx.json +584 -0
  429. package/skills/agentvfx/templates/spectrum/spectrum-particles/main.frag +240 -0
  430. package/skills/agentvfx/templates/spectrum/spectrum-particles/pass0.frag +101 -0
  431. package/skills/agentvfx/templates/spectrum/spectrum-radial/demo-starburst-black.json +1 -0
  432. package/skills/agentvfx/templates/spectrum/spectrum-radial/demo-starburst-ultramarine.json +1 -0
  433. package/skills/agentvfx/templates/spectrum/spectrum-radial/fx.json +566 -0
  434. package/skills/agentvfx/templates/spectrum/spectrum-radial/main.frag +217 -0
  435. package/skills/agentvfx/templates/spectrum/spectrum-radial/pass0.frag +91 -0
  436. package/skills/agentvfx/templates/spectrum/waveform-line/demo-strip-acid.json +1 -0
  437. package/skills/agentvfx/templates/spectrum/waveform-line/demo-strip-black.json +1 -0
  438. package/skills/agentvfx/templates/spectrum/waveform-line/fx.json +481 -0
  439. package/skills/agentvfx/templates/spectrum/waveform-line/main.frag +219 -0
  440. package/skills/agentvfx/templates/spectrum/waveform-line/pass0.frag +48 -0
  441. package/skills/agentvfx/templates/spectrum/waveform-line/pass1.frag +86 -0
  442. package/skills/agentvfx/test/_render_light.mjs +38 -0
  443. package/skills/agentvfx/test/audio-stereo.test.mjs +45 -0
  444. package/skills/agentvfx/test/audio.test.mjs +257 -0
  445. package/skills/agentvfx/test/brutal.test.mjs +190 -0
  446. package/skills/agentvfx/test/concept-collage-layout.test.mjs +236 -0
  447. package/skills/agentvfx/test/concept-collage-scenes.test.mjs +305 -0
  448. package/skills/agentvfx/test/concept-collage-typefx.test.mjs +153 -0
  449. package/skills/agentvfx/test/concept-collage.test.mjs +84 -0
  450. package/skills/agentvfx/test/concept-lattice.test.mjs +133 -0
  451. package/skills/agentvfx/test/concept-signal-cut.test.mjs +172 -0
  452. package/skills/agentvfx/test/credit-overlay.test.mjs +58 -0
  453. package/skills/agentvfx/test/credit.test.mjs +54 -0
  454. package/skills/agentvfx/test/doctor.test.mjs +31 -0
  455. package/skills/agentvfx/test/encode.test.mjs +22 -0
  456. package/skills/agentvfx/test/fixtures/r7-collage-LAYOUTS.json +5780 -0
  457. package/skills/agentvfx/test/fixtures/score-bad-duration.json +7 -0
  458. package/skills/agentvfx/test/fixtures/score-bad-safety.json +8 -0
  459. package/skills/agentvfx/test/fixtures/score-identity-footage.json +8 -0
  460. package/skills/agentvfx/test/fixtures/score-missing-template.json +7 -0
  461. package/skills/agentvfx/test/fixtures/score-ok.json +8 -0
  462. package/skills/agentvfx/test/fixtures/score-strobe-12hz.json +8 -0
  463. package/skills/agentvfx/test/fixtures/score-text-probe.json +1 -0
  464. package/skills/agentvfx/test/flash-audit.test.mjs +150 -0
  465. package/skills/agentvfx/test/flash.test.mjs +83 -0
  466. package/skills/agentvfx/test/footage.test.mjs +88 -0
  467. package/skills/agentvfx/test/glitch.test.mjs +272 -0
  468. package/skills/agentvfx/test/impact.test.mjs +231 -0
  469. package/skills/agentvfx/test/imports.test.mjs +39 -0
  470. package/skills/agentvfx/test/light.test.mjs +200 -0
  471. package/skills/agentvfx/test/loop.test.mjs +80 -0
  472. package/skills/agentvfx/test/psychedelic.test.mjs +99 -0
  473. package/skills/agentvfx/test/render.test.mjs +73 -0
  474. package/skills/agentvfx/test/sacred.test.mjs +175 -0
  475. package/skills/agentvfx/test/schema.test.mjs +103 -0
  476. package/skills/agentvfx/test/scope.test.mjs +306 -0
  477. package/skills/agentvfx/test/spectrum.test.mjs +165 -0
  478. package/skills/agentvfx/test/text.test.mjs +142 -0
  479. package/skills/agentvfx/test/web.test.mjs +400 -0
  480. package/skills/agentvfx/test-media/SOURCES.md +39 -0
  481. package/skills/agentvfx/test-media/beat-132.mp3 +0 -0
  482. package/skills/agentvfx/test-media/clip-01.mp4 +0 -0
  483. package/skills/agentvfx/test-media/clip-02.mp4 +0 -0
@@ -0,0 +1,98 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "agentvfx/fx-score.schema.json",
4
+ "title": "agentvfx FX score",
5
+ "description": "What the model writes to render one 3-5 s clip. Enforced by engine/core/validate.mjs (vfx.mjs validate), which also checks template ids, presets, parameter ranges and bindings against the library.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["version", "template", "durationSec", "seed"],
9
+ "$defs": {
10
+ "layer": {
11
+ "oneOf": [
12
+ { "type": "string", "description": "template id" },
13
+ {
14
+ "type": "object", "additionalProperties": false, "required": ["template"],
15
+ "properties": { "template": { "type": "string" }, "preset": { "type": "string" }, "params": { "type": "object" } }
16
+ }
17
+ ]
18
+ },
19
+ "hex": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }
20
+ },
21
+ "properties": {
22
+ "version": { "const": 1 },
23
+ "template": { "type": "string", "description": "base layer template id (vfx.mjs list)" },
24
+ "preset": { "type": "string" },
25
+ "params": { "type": "object", "description": "input name -> value; overrides the preset" },
26
+ "stack": { "type": "array", "maxItems": 2, "items": { "$ref": "#/$defs/layer" }, "description": "layers drawn on top of the base, each fed the previous layer as inputImage" },
27
+ "input": {
28
+ "type": "object", "additionalProperties": false,
29
+ "properties": { "video": { "type": "string" }, "audio": { "type": "string" }, "startSec": { "type": "number", "minimum": 0 } }
30
+ },
31
+ "durationSec": { "type": "number", "minimum": 3, "maximum": 5 },
32
+ "fps": { "enum": [24, 25, 30, 50, 60], "description": "default: the template's X_AGENTVFX.fps, else 30" },
33
+ "seed": { "type": "integer", "minimum": 0, "maximum": 4294967295 },
34
+ "bindings": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "object", "additionalProperties": false, "required": ["param", "feature", "gain", "offset"],
38
+ "properties": {
39
+ "param": { "type": "string" },
40
+ "feature": { "type": "string", "description": "rms, peak, rmsDb, bass, mid, treb, bass_att, mid_att, treb_att, flux, onset, beat, beatPhase, bpm, corr, width, balance, or bands.0..bands.31" },
41
+ "gain": { "type": "number" }, "offset": { "type": "number" },
42
+ "attackMs": { "type": "number", "minimum": 0 }, "releaseMs": { "type": "number", "minimum": 0 }
43
+ }
44
+ }
45
+ },
46
+ "hits": {
47
+ "type": "array",
48
+ "items": {
49
+ "type": "object", "required": ["template", "durationFrames"],
50
+ "description": "exactly one of t (seconds), onset (onset index), beat (beat index)",
51
+ "properties": {
52
+ "t": { "type": "number", "minimum": 0 }, "onset": { "type": "integer", "minimum": 0 }, "beat": { "type": "integer", "minimum": 0 },
53
+ "template": { "type": "string" }, "preset": { "type": "string" }, "params": { "type": "object" },
54
+ "durationFrames": { "type": "integer", "minimum": 1 }
55
+ }
56
+ }
57
+ },
58
+ "cuts": {
59
+ "type": "array",
60
+ "items": {
61
+ "type": "object", "required": ["layers"],
62
+ "description": "hard cut: exactly one of t (seconds) or beat (beat index); the layers replace the base stack from that frame",
63
+ "properties": {
64
+ "t": { "type": "number", "minimum": 0 }, "beat": { "type": "integer", "minimum": 0 },
65
+ "layers": { "type": "array", "minItems": 1, "maxItems": 3, "items": { "$ref": "#/$defs/layer" } }
66
+ }
67
+ }
68
+ },
69
+ "palette": {
70
+ "oneOf": [
71
+ { "enum": ["brutal-acid", "brutal-red", "mono", "rainbow", "thermal", "paper-grey", "acid-data", "hazard-orange", "flesh-pink", "lilac-terminal", "blood-red", "clinic-mint"] },
72
+ { "type": "array", "minItems": 2, "maxItems": 8, "items": { "$ref": "#/$defs/hex" } }
73
+ ]
74
+ },
75
+ "safety": {
76
+ "type": "object", "additionalProperties": false,
77
+ "description": "default { mode: stage }: full intensity, flash audit written as a report and SAFETY.txt. broadcast-safe enforces limits; safeVariant adds film.safe.mp4 next to the full-intensity film.mp4.",
78
+ "properties": { "mode": { "enum": ["stage", "broadcast-safe"] }, "safeVariant": { "type": "boolean" } }
79
+ },
80
+ "out": { "type": "string", "description": "output folder name" },
81
+ "labels": { "type": "object", "additionalProperties": { "type": "string" }, "description": "text item key -> string, overriding the template's default text" },
82
+ "textStyle": {
83
+ "type": "object",
84
+ "description": "text item key -> look override merged over the template's text item (see references/template-format.md, Text layer)",
85
+ "additionalProperties": {
86
+ "type": "object", "additionalProperties": false,
87
+ "properties": {
88
+ "font": { "enum": ["display", "tall", "grotesk", "mono", "serif"] },
89
+ "size": { "type": "number", "exclusiveMinimum": 0, "maximum": 1 },
90
+ "x": { "type": "number", "minimum": -0.5, "maximum": 1.5 }, "y": { "type": "number", "minimum": -0.5, "maximum": 1.5 },
91
+ "tracking": { "type": "number", "minimum": -0.2, "maximum": 2 },
92
+ "align": { "enum": ["left", "center", "right"] },
93
+ "weight": { "type": "number", "minimum": 100, "maximum": 900 }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,157 @@
1
+ // agentvfx (Apache-2.0, see LICENSE). Bundle selected templates and the live runtime into a folder a page
2
+ // can open with no network and no build. The GLSL prelude is imported here and inlined verbatim.
3
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { PALETTES, hexToRgb } from "../engine/core/palettes.mjs";
7
+ import { resolveParams } from "../engine/core/templates.mjs";
8
+ import { loadLibrary } from "../engine/core/templates.mjs";
9
+ import { templatePasses } from "../engine/node/render.mjs";
10
+
11
+ const here = path.dirname(fileURLToPath(import.meta.url));
12
+ const runtimePath = path.join(here, "../runtime/agentvfx.js");
13
+ const preludePath = path.join(here, "../engine/web/prelude.mjs");
14
+ const licensePath = path.join(here, "../LICENSE");
15
+ const noticePath = path.join(here, "../NOTICE");
16
+ // The licence notice is added after stripUrls runs, so it survives; it names the repository without a scheme because the
17
+ // bundle must hold no fetchable URL. LICENSE and NOTICE, with their URLs, are written beside it.
18
+ const LICENSE_NOTICE = [
19
+ "agentvfx is licensed under the Apache License 2.0; see LICENSE and NOTICE in this folder. Keep them with these files.",
20
+ "Copyright 2026 Woojin Go (github.com/wjgoarxiv/agentvfx)",
21
+ ];
22
+ const flashPaths = ["../engine/core/flash-constants.mjs", "../engine/core/flash.mjs"].map((p) => path.join(here, p));
23
+
24
+ function parseArgs(argv) {
25
+ const ids = [];
26
+ let out = null;
27
+ for (let i = 0; i < argv.length; i++) {
28
+ if (argv[i] === "--out") out = argv[++i];
29
+ else ids.push(argv[i]);
30
+ }
31
+ return { ids, out };
32
+ }
33
+
34
+ function stripUrls(source) {
35
+ return source.split("\n").filter((line) => !/https?:\/\//u.test(line)).join("\n");
36
+ }
37
+
38
+ // Shader credits cite their sources as links inside comments. The bundle keeps each credit and drops only the
39
+ // scheme, so the folder still holds no fetchable URL.
40
+ function delink(source) {
41
+ return source.replace(/https?:\/\//gu, "");
42
+ }
43
+
44
+ function bundleRuntime() {
45
+ const prelude = stripUrls(readFileSync(preludePath, "utf8"));
46
+ const runtime = readFileSync(runtimePath, "utf8")
47
+ .split("\n")
48
+ .filter((line) => !line.startsWith("import "))
49
+ .join("\n");
50
+ const glue = `const PALETTES = Object.freeze(${JSON.stringify(PALETTES)});\n${hexToRgb.toString()}\n${resolveParams.toString()}\n`;
51
+ // The live flash guard runs the audit's own detector, inlined module by module without its import/export syntax.
52
+ const flash = flashPaths.map((p) => readFileSync(p, "utf8").split("\n")
53
+ .filter((line) => !line.startsWith("import ") && !line.startsWith("export {"))
54
+ .map((line) => line.replace(/^export /u, ""))
55
+ .join("\n")).join("\n");
56
+ return `${LICENSE_NOTICE.map((line) => `// ${line}`).join("\n")}\n${prelude}\n${glue}\n${flash}\n${runtime}`;
57
+ }
58
+
59
+ function bundleTemplates(lib, ids) {
60
+ const out = {};
61
+ for (const id of ids) {
62
+ const tpl = lib.get(id);
63
+ const fx = structuredClone(tpl.fx);
64
+ if (fx.X_AGENTVFX) delete fx.X_AGENTVFX.credits;
65
+ out[id] = {
66
+ fx,
67
+ passes: templatePasses(tpl).map((pass) => ({
68
+ target: pass.target,
69
+ persistent: pass.persistent,
70
+ file: pass.file,
71
+ src: delink(readFileSync(path.join(tpl.dir, pass.file), "utf8")),
72
+ })),
73
+ };
74
+ }
75
+ return `export default ${JSON.stringify(out)};\n`;
76
+ }
77
+
78
+ function demoHtml(ids) {
79
+ const hero = ids[0];
80
+ const hit = ids.includes("test-strobe") ? "test-strobe" : ids[0];
81
+ const head = ids.includes("sacred") ? "sacred" : ids[0];
82
+ return `<!DOCTYPE html>
83
+ <html lang="en">
84
+ <head>
85
+ <meta charset="utf-8">
86
+ <!-- ${LICENSE_NOTICE.join(" ")} -->
87
+ <title>agentvfx</title>
88
+ <style>
89
+ html, body { margin: 0; background: #000; color: #fff; font: 16px sans-serif; }
90
+ #hero { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
91
+ #head { position: fixed; left: 24px; top: 24px; width: min(70vw, 640px); height: 96px; pointer-events: none; }
92
+ #hit, label { position: fixed; z-index: 2; background: #111; color: #fff; border: 1px solid #fff; padding: 8px 14px; font: 16px sans-serif; }
93
+ #hit { left: 24px; bottom: 24px; }
94
+ label { right: 24px; bottom: 24px; }
95
+ audio { position: fixed; left: 24px; bottom: 72px; width: min(70vw, 360px); }
96
+ </style>
97
+ </head>
98
+ <body>
99
+ <canvas id="hero"></canvas>
100
+ <canvas id="head"></canvas>
101
+ <button id="hit" type="button">Hit</button>
102
+ <audio id="player" controls></audio>
103
+ <label>Audio <input id="file" type="file" accept="audio/*"></label>
104
+ <script type="module">
105
+ import { AgentVfx } from "./agentvfx.js";
106
+ import templates from "./templates.js";
107
+ const hero = document.getElementById("hero");
108
+ const head = document.getElementById("head");
109
+ const fx = await AgentVfx.mount(hero, { templates, template: ${JSON.stringify(hero)} });
110
+ const label = AgentVfx.textSource({ text: "AGENTVFX", font: "700 64px sans-serif", color: "#ffffff", background: "#000000", width: 960, height: 180 });
111
+ await AgentVfx.mount(head, { templates, template: ${JSON.stringify(head)}, source: label });
112
+ const fire = () => fx.trigger(${JSON.stringify(hit)}, { preset: "hold", durationMs: 2000 });
113
+ document.getElementById("hit").addEventListener("pointerenter", fire);
114
+ document.getElementById("hit").addEventListener("click", fire);
115
+ document.getElementById("file").addEventListener("change", (event) => {
116
+ const file = event.target.files && event.target.files[0];
117
+ if (!file) return;
118
+ const player = document.getElementById("player");
119
+ player.src = URL.createObjectURL(file);
120
+ player.play();
121
+ fx.audio(player);
122
+ });
123
+ window.__hit = fire;
124
+ window.__litReady = true;
125
+ </script>
126
+ </body>
127
+ </html>
128
+ `;
129
+ }
130
+
131
+ const { ids, out } = parseArgs(process.argv.slice(2));
132
+ if (!out || ids.length === 0) {
133
+ console.error("usage: node scripts/export-web.mjs <templateId...> --out <dir>");
134
+ process.exit(1);
135
+ }
136
+ const lib = loadLibrary({ includeTest: true });
137
+ const missing = ids.filter((id) => !lib.has(id));
138
+ if (missing.length) {
139
+ for (const id of missing) console.error(`unknown template id ${id}`);
140
+ process.exit(1);
141
+ }
142
+ mkdirSync(out, { recursive: true });
143
+ const files = {
144
+ "agentvfx.js": bundleRuntime(),
145
+ "templates.js": bundleTemplates(lib, ids),
146
+ "demo.html": demoHtml(ids),
147
+ };
148
+ for (const [name, body] of Object.entries(files)) {
149
+ if (/https?:\/\//u.test(body)) {
150
+ console.error(`${name} still contains an external URL`);
151
+ process.exit(1);
152
+ }
153
+ writeFileSync(path.join(out, name), body);
154
+ }
155
+ // The licence and notice carry URLs by design, so they are copied verbatim after the no-URL check above.
156
+ writeFileSync(path.join(out, "LICENSE"), readFileSync(licensePath));
157
+ writeFileSync(path.join(out, "NOTICE"), readFileSync(noticePath));
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+ // Turn a rendered clip into a silent seamless loop: play forward, then backward (2N-2 frames, no held frame at either turn),
3
+ // optionally write a small looping WebP preview, and flash-audit the loop played twice so the wrap point is checked too.
4
+ // node loop.mjs <in.mp4> <out.mp4> [--preview out.webp|out.gif] [--audit out.json] [--crf 23] [--maxrate 3500] [--hold 0]
5
+ import { spawn, spawnSync } from "node:child_process";
6
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
7
+ import { tmpdir } from "node:os";
8
+ import path from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+ import { createFlashAuditor } from "../engine/core/flash.mjs";
11
+ import { encodePreview, findFfmpeg, findImg2webp, previewRungs, probeVideo } from "../engine/node/encode.mjs";
12
+
13
+ function ffmpegOrThrow() {
14
+ const ffmpeg = findFfmpeg();
15
+ if (!ffmpeg) throw new Error("BLOCKED_NO_FFMPEG_FOR_VIDEO: ffmpeg not found (set FFMPEG_PATH or install ffmpeg)");
16
+ return ffmpeg;
17
+ }
18
+
19
+ function run(ffmpeg, args) {
20
+ const r = spawnSync(ffmpeg, ["-y", "-hide_banner", "-loglevel", "error", ...args], { encoding: "utf8" });
21
+ if (r.status !== 0) throw new Error(`ffmpeg failed: ${r.stderr}`);
22
+ }
23
+
24
+ /** Write the forward+backward loop of `src` to `out` with no audio stream. Returns { frames, fps }. */
25
+ export function pingpong(src, out, { crf = 23, maxrateKbps = 3500, hold = 0 } = {}) {
26
+ if (!Number.isInteger(hold) || hold < 0) throw new Error(`pingpong: hold must be a whole number of frames >= 0, got ${hold}`);
27
+ if (path.resolve(src) === path.resolve(out)) throw new Error("pingpong: output must differ from input");
28
+ const ffmpeg = ffmpegOrThrow();
29
+ const info = probeVideo(src);
30
+ if (!info?.frames || info.frames < 3) throw new Error(`pingpong: cannot read frames of ${src}`);
31
+ const n = info.frames;
32
+ mkdirSync(path.dirname(path.resolve(out)), { recursive: true });
33
+ // hold > 0 freezes each turn for `hold` extra frames, which spreads the doubled-back transitions across a wider window.
34
+ const pad = hold > 0 ? `,tpad=stop_mode=clone:stop=${hold}` : "";
35
+ run(ffmpeg, ["-i", src, "-filter_complex",
36
+ `[0:v]split[a][b];[a]setpts=PTS-STARTPTS${pad}[f];[b]reverse,trim=start_frame=1:end_frame=${n - 1},setpts=PTS-STARTPTS${pad}[r];[f][r]concat=n=2:v=1:a=0[v]`,
37
+ "-map", "[v]", "-an", "-c:v", "libx264", "-preset", "slow", "-crf", String(crf),
38
+ "-maxrate", `${maxrateKbps}k`, "-bufsize", `${maxrateKbps * 2}k`, "-pix_fmt", "yuv420p", "-movflags", "+faststart", out]);
39
+ return { frames: 2 * n - 2 + 2 * hold, fps: info.fps };
40
+ }
41
+
42
+ /** Small looping animated preview (README use): WebP through the engine's preview ladder (ffmpeg libwebp_anim, img2webp), GIF as the last rung. */
43
+ export function preview(src, out, { width = 400, fps = 12 } = {}) {
44
+ const ffmpeg = ffmpegOrThrow();
45
+ mkdirSync(path.dirname(path.resolve(out)), { recursive: true });
46
+ const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-preview-"));
47
+ try {
48
+ run(ffmpeg, ["-i", src, "-vf", `fps=${fps},scale=${width}:-2:flags=lanczos`, "-an", "-start_number", "0", path.join(dir, "%05d.png")]);
49
+ const rungs = previewRungs(ffmpeg).filter((r) => (out.endsWith(".gif") ? r === "gif" : r !== "gif"));
50
+ if (!rungs.length) throw new Error(`preview: no encoder for ${path.extname(out)} (install img2webp, or ffmpeg with libwebp)`);
51
+ const r = encodePreview({ encoder: rungs[0], ffmpeg, img2webp: findImg2webp(), dir, fps, out });
52
+ if (r.code !== 0) throw new Error(`preview (${rungs[0]}) failed: ${r.stderr}`);
53
+ return rungs[0];
54
+ } finally {
55
+ rmSync(dir, { recursive: true, force: true });
56
+ }
57
+ }
58
+
59
+ /** Decode a whole (small) clip to RGBA frames. Meant for tests and short clips. */
60
+ export function readFrames(file) {
61
+ const ffmpeg = ffmpegOrThrow();
62
+ const { width, height } = probeVideo(file);
63
+ const r = spawnSync(ffmpeg, ["-v", "error", "-i", file, "-f", "rawvideo", "-pix_fmt", "rgba", "-"], { maxBuffer: 1 << 30 });
64
+ if (r.status !== 0) throw new Error(`readFrames: ${r.stderr}`);
65
+ const size = width * height * 4;
66
+ const frames = [];
67
+ for (let o = 0; o + size <= r.stdout.length; o += size) frames.push({ width, height, data: r.stdout.subarray(o, o + size) });
68
+ return frames;
69
+ }
70
+
71
+ /** Flash-audit the clip played `plays` times back to back (streams frames; never holds the clip in memory). */
72
+ export function auditLoop(file, { plays = 2 } = {}) {
73
+ const ffmpeg = ffmpegOrThrow();
74
+ const info = probeVideo(file);
75
+ if (!info) throw new Error(`auditLoop: cannot probe ${file}`);
76
+ const { width, height, fps } = info;
77
+ const auditor = createFlashAuditor({ fps, width, height });
78
+ const size = width * height * 4;
79
+ return new Promise((resolve, reject) => {
80
+ const p = spawn(ffmpeg, ["-v", "error", "-stream_loop", String(plays - 1), "-i", file, "-f", "rawvideo", "-pix_fmt", "rgba", "-"]);
81
+ let pending = Buffer.alloc(0);
82
+ let err = "";
83
+ p.stderr.on("data", (d) => { err += d; });
84
+ let failed = null;
85
+ p.stdout.on("data", (chunk) => {
86
+ if (failed) return;
87
+ try {
88
+ pending = pending.length ? Buffer.concat([pending, chunk]) : chunk;
89
+ while (pending.length >= size) {
90
+ auditor.push({ width, height, data: pending.subarray(0, size) });
91
+ pending = pending.subarray(size);
92
+ }
93
+ } catch (e) {
94
+ failed = e;
95
+ p.kill();
96
+ }
97
+ });
98
+ p.on("error", reject);
99
+ p.on("close", (code) => {
100
+ if (failed) return reject(failed);
101
+ if (code !== 0) return reject(new Error(`auditLoop: ffmpeg exit ${code} ${err}`));
102
+ const report = auditor.finish();
103
+ resolve({ pass: !report.exceeds, plays, ...report });
104
+ });
105
+ });
106
+ }
107
+
108
+ async function main(argv) {
109
+ const [src, out, ...rest] = argv;
110
+ if (!src || !out) {
111
+ console.error("usage: loop.mjs <in.mp4> <out.mp4> [--preview out.webp|out.gif] [--audit out.json] [--crf 23] [--maxrate 3500] [--hold 0]");
112
+ return 2;
113
+ }
114
+ const opt = {};
115
+ for (let i = 0; i < rest.length; i += 2) opt[rest[i].replace(/^--/, "")] = rest[i + 1];
116
+ const res = pingpong(src, out, { crf: Number(opt.crf ?? 23), maxrateKbps: Number(opt.maxrate ?? 3500), hold: Number(opt.hold ?? 0) });
117
+ if (opt.preview) preview(out, opt.preview);
118
+ const audit = await auditLoop(out);
119
+ if (opt.audit) {
120
+ mkdirSync(path.dirname(path.resolve(opt.audit)), { recursive: true });
121
+ writeFileSync(opt.audit, `${JSON.stringify(audit, null, 2)}\n`);
122
+ }
123
+ console.log(JSON.stringify({ out, frames: res.frames, fps: res.fps, flashPass: audit.pass, worstWindow: audit.worstWindow, redFlashes: audit.redFlashes }));
124
+ return audit.pass ? 0 : 3;
125
+ }
126
+
127
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
128
+ main(process.argv.slice(2)).then((code) => process.exit(code), (e) => { console.error(e.message); process.exit(1); });
129
+ }
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env node
2
+ // agentvfx (Apache-2.0, see LICENSE). Generates the original 10 s, 132 BPM demo drum loop (test-media/beat-132.mp3).
3
+ // Everything is synthesised here from sines and seeded noise: a kick on every beat, a snare on
4
+ // beats 2 and 4, closed hats on the 8ths, starting a quarter beat in, over a faint noise bed so the
5
+ // waveform never goes flat between hits. Nothing is sampled or downloaded.
6
+ // usage: node scripts/make-beat.mjs [out.mp3]
7
+ import { spawnSync } from "node:child_process";
8
+ import { mkdirSync } from "node:fs";
9
+ import path from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+ import { findFfmpeg } from "../engine/node/encode.mjs";
12
+
13
+ const SR = 48000;
14
+ const BPM = 132;
15
+ const SECONDS = 10;
16
+ const BEAT = (60 / BPM) * SR;
17
+ const N = SR * SECONDS;
18
+ const LEAD_BEATS = 0.26;
19
+ const AIR = 0.06;
20
+ const TAU = Math.PI * 2;
21
+
22
+ function mulberry32(seed) {
23
+ let a = seed >>> 0;
24
+ return () => {
25
+ a = (a + 0x6d2b79f5) >>> 0;
26
+ let t = a;
27
+ t = Math.imul(t ^ (t >>> 15), t | 1);
28
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
29
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
30
+ };
31
+ }
32
+
33
+ /** Stereo float mix. L and R draw their own noise so the hats and snare are not mono. */
34
+ export function renderBeat() {
35
+ const rand = mulberry32(132);
36
+ const L = new Float32Array(N);
37
+ const R = new Float32Array(N);
38
+ const add = (start, len, fn) => {
39
+ for (let i = 0; i < len && start + i < N; i++) {
40
+ const [l, r] = fn(i / SR, i);
41
+ L[start + i] += l;
42
+ R[start + i] += r;
43
+ }
44
+ };
45
+ const noise = () => rand() * 2 - 1;
46
+
47
+ const kick = (start) => {
48
+ let phase = 0;
49
+ add(start, Math.floor(0.25 * SR), (t) => {
50
+ phase += (TAU * (45 + 110 * Math.exp(-t * 28))) / SR;
51
+ const body = Math.sin(phase) * Math.exp(-t * 18) * 0.95;
52
+ const click = Math.exp(-t * 250) * 0.5 * noise();
53
+ return [body + click, body + click];
54
+ });
55
+ };
56
+ const snare = (start) => {
57
+ add(start, Math.floor(0.25 * SR), (t) => {
58
+ const tone = Math.sin(TAU * 190 * t) * Math.exp(-t * 28) * 0.25;
59
+ const env = Math.exp(-t * 17) * 0.22;
60
+ return [tone + noise() * env, tone + noise() * env];
61
+ });
62
+ };
63
+ const hat = (start, accent) => {
64
+ let pl = 0;
65
+ let pr = 0;
66
+ add(start, Math.floor(0.06 * SR), (t) => {
67
+ const nl = noise();
68
+ const nr = noise();
69
+ const env = Math.exp(-t * 90) * (accent ? 0.07 : 0.04);
70
+ const out = [(nl - pl) * env, (nr - pr) * env];
71
+ pl = nl;
72
+ pr = nr;
73
+ return out;
74
+ });
75
+ };
76
+
77
+ for (let b = 0; (b + LEAD_BEATS) * BEAT < N; b++) {
78
+ const at = Math.round((b + LEAD_BEATS) * BEAT);
79
+ kick(at);
80
+ if (b % 4 === 1 || b % 4 === 3) snare(at);
81
+ hat(at, false);
82
+ hat(Math.round((b + LEAD_BEATS + 0.5) * BEAT), true);
83
+ }
84
+ let lo = 0;
85
+ let ro = 0;
86
+ for (let i = 0; i < N; i++) {
87
+ lo += (noise() - lo) * 0.35;
88
+ ro += (noise() - ro) * 0.35;
89
+ L[i] += lo * AIR;
90
+ R[i] += ro * AIR;
91
+ }
92
+ return [L, R];
93
+ }
94
+
95
+ /** 16-bit stereo WAV bytes, soft-limited so the loudest hit sits near -1 dBFS. */
96
+ export function toWav([L, R]) {
97
+ const data = Buffer.alloc(N * 4);
98
+ for (let i = 0; i < N; i++) {
99
+ data.writeInt16LE(Math.round(Math.tanh(L[i] * 1.1) * 0.89 * 32767), i * 4);
100
+ data.writeInt16LE(Math.round(Math.tanh(R[i] * 1.1) * 0.89 * 32767), i * 4 + 2);
101
+ }
102
+ const head = Buffer.alloc(44);
103
+ head.write("RIFF", 0);
104
+ head.writeUInt32LE(36 + data.length, 4);
105
+ head.write("WAVEfmt ", 8);
106
+ head.writeUInt32LE(16, 16);
107
+ head.writeUInt16LE(1, 20);
108
+ head.writeUInt16LE(2, 22);
109
+ head.writeUInt32LE(SR, 24);
110
+ head.writeUInt32LE(SR * 4, 28);
111
+ head.writeUInt16LE(4, 32);
112
+ head.writeUInt16LE(16, 34);
113
+ head.write("data", 36);
114
+ head.writeUInt32LE(data.length, 40);
115
+ return Buffer.concat([head, data]);
116
+ }
117
+
118
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
119
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
120
+ const out = path.resolve(process.argv[2] ?? path.join(root, "test-media", "beat-132.mp3"));
121
+ const ffmpeg = findFfmpeg();
122
+ if (!ffmpeg) {
123
+ console.error("make-beat: ffmpeg not found (set FFMPEG_PATH or put it on PATH)");
124
+ process.exit(1);
125
+ }
126
+ mkdirSync(path.dirname(out), { recursive: true });
127
+ const r = spawnSync(ffmpeg, ["-v", "error", "-y", "-f", "wav", "-i", "pipe:0", "-map_metadata", "-1", "-fflags", "+bitexact", "-flags:a", "+bitexact", "-c:a", "libmp3lame", "-b:a", "192k", out], { input: toWav(renderBeat()), encoding: "utf8", maxBuffer: 1 << 26 });
128
+ if (r.status !== 0) {
129
+ console.error(`make-beat: ffmpeg failed: ${r.stderr}`);
130
+ process.exit(1);
131
+ }
132
+ console.log(`wrote ${out} (${SECONDS} s, ${BPM} BPM)`);
133
+ }
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ // Render a procedural Blender "plate" (background footage for agentvfx templates) and encode it to H.264 film.mp4.
3
+ // node plate.mjs --scene terminalcore --shot wall --out gallery/plates/terminalcore-wall --width 640 --height 360 --seconds 4 --fps 30 --samples 48
4
+ // Extra: --quality preview|final (final: 256 samples, accurate denoise, camera motion blur), --frame N (single test still, no video),
5
+ // --exposure EV, --bloom X, --key X, --haze X, --keep-frames, --no-post
6
+ import { spawnSync } from "node:child_process";
7
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
8
+ import path from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+ import { findFfmpeg, which } from "../engine/node/encode.mjs";
11
+
12
+ const here = path.dirname(fileURLToPath(import.meta.url));
13
+ const FLAGS = new Set(["keep-frames", "no-post"]);
14
+
15
+ function parseArgs(argv) {
16
+ const o = {};
17
+ for (let i = 0; i < argv.length; i++) {
18
+ const k = argv[i].replace(/^--/, "");
19
+ if (FLAGS.has(k)) o[k] = true;
20
+ else o[k] = argv[++i];
21
+ }
22
+ return o;
23
+ }
24
+
25
+ function findBlender(env = process.env) {
26
+ const mac = "/Applications/Blender.app/Contents/MacOS/Blender";
27
+ const found = [env.BLENDER_PATH, which("blender", env), mac].find((p) => p && existsSync(p));
28
+ if (!found) throw new Error("BLOCKED_NO_BLENDER: set BLENDER_PATH or install Blender 5.x");
29
+ return found;
30
+ }
31
+
32
+ const o = parseArgs(process.argv.slice(2));
33
+ const scene = o.scene ?? "terminalcore";
34
+ const shot = o.shot ?? "wall";
35
+ const out = path.resolve(o.out ?? `gallery/plates/${scene}-${shot}`);
36
+ const width = Number(o.width ?? 640);
37
+ const height = Number(o.height ?? 360);
38
+ const seconds = Number(o.seconds ?? 4);
39
+ const fps = Number(o.fps ?? 30);
40
+ const quality = o.quality ?? "preview";
41
+ if (!["preview", "final"].includes(quality)) throw new Error(`--quality must be preview or final, got "${quality}"`);
42
+ const samples = Number(o.samples ?? (quality === "final" ? 256 : 40));
43
+ const script = path.join(here, "..", "plates", scene, "scene.py");
44
+ if (!existsSync(script)) throw new Error(`unknown plate scene "${scene}" (no ${script})`);
45
+
46
+ mkdirSync(out, { recursive: true });
47
+ const frames = path.join(out, "frames");
48
+ rmSync(frames, { recursive: true, force: true });
49
+ const args = ["-b", "--factory-startup", "--python-exit-code", "1", "--python", script, "--", "--shot", shot, "--out", out, "--width", width, "--height", height, "--seconds", seconds, "--fps", fps, "--samples", samples, "--quality", quality];
50
+ for (const k of ["frame", "exposure", "bloom", "key", "haze"]) if (o[k] !== undefined) args.push(`--${k}`, o[k]);
51
+
52
+ const t0 = Date.now();
53
+ const bl = spawnSync(findBlender(), args.map(String), { encoding: "utf8", maxBuffer: 1 << 29 });
54
+ const renderSec = (Date.now() - t0) / 1000;
55
+ const log = (bl.stdout ?? "") + (bl.stderr ?? "");
56
+ writeFileSync(path.join(out, "blender.log"), log);
57
+ if (bl.status !== 0 || log.includes("Traceback")) {
58
+ console.error(log.split("\n").slice(-40).join("\n"));
59
+ process.exit(bl.status || 1);
60
+ }
61
+
62
+ for (const line of log.split("\n")) if (line.startsWith("TIMING")) console.log(line);
63
+ if (o.frame) {
64
+ console.log(`still ${path.join(out, `still_${String(o.frame).padStart(3, "0")}.png`)} ${renderSec.toFixed(1)}s`);
65
+ process.exit(0);
66
+ }
67
+
68
+ const ffmpeg = findFfmpeg();
69
+ if (!ffmpeg) throw new Error("BLOCKED_NO_FFMPEG: set FFMPEG_PATH or install ffmpeg");
70
+ const pngs = readdirSync(frames).filter((f) => f.endsWith(".png")).sort();
71
+ const grade = shot === "gallery" ? "vignette=PI/7,noise=alls=3:allf=t" : "vignette=PI/5.5,noise=alls=7:allf=t";
72
+ const post = o["no-post"] ? "format=yuv420p" : `${grade},format=yuv420p`;
73
+ const enc = spawnSync(ffmpeg, ["-v", "error", "-y", "-framerate", String(fps), "-start_number", "1", "-i", path.join(frames, "f_%04d.png"), "-vf", post, "-c:v", "libx264", "-crf", quality === "final" ? "14" : "17", "-preset", "slow", "-movflags", "+faststart", path.join(out, "film.mp4")], { encoding: "utf8" });
74
+ if (enc.status !== 0) {
75
+ console.error(enc.stderr);
76
+ process.exit(enc.status ?? 1);
77
+ }
78
+ for (const [label, idx] of [["first", 0], ["mid", Math.floor(pngs.length / 2)], ["last", pngs.length - 1]]) copyFileSync(path.join(frames, pngs[idx]), path.join(out, `still_${label}.png`));
79
+ if (!o["keep-frames"]) rmSync(frames, { recursive: true, force: true });
80
+ const report = { scene, shot, quality, width, height, fps, seconds, samples, frames: pngs.length, renderSeconds: renderSec, secondsPerFrame: renderSec / pngs.length };
81
+ writeFileSync(path.join(out, "plate.json"), JSON.stringify(report, null, 2));
82
+ console.log(JSON.stringify(report));