agentvfx 0.0.0-stage → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (483) hide show
  1. package/AGENTS.md +8 -0
  2. package/GEMINI.md +1 -0
  3. package/LICENSE +172 -0
  4. package/README.md +236 -2
  5. package/package.json +35 -4
  6. package/skills/agentvfx/LICENSE +172 -0
  7. package/skills/agentvfx/NOTICE +44 -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 +28 -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 +155 -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 +42 -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 +397 -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,7 @@
1
+ {
2
+ "version": 1,
3
+ "template": "test-gradient",
4
+ "durationSec": 8,
5
+ "seed": 1,
6
+ "out": "bad"
7
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "template": "test-strobe",
4
+ "durationSec": 3,
5
+ "seed": 1,
6
+ "safety": { "mode": "gentle" },
7
+ "out": "bad-safety"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "template": "test-identity",
4
+ "input": { "video": "test-media/clip-01.mp4", "startSec": 0 },
5
+ "durationSec": 5,
6
+ "seed": 1,
7
+ "out": "identity-footage"
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 1,
3
+ "template": "does-not-exist",
4
+ "durationSec": 3,
5
+ "seed": 1,
6
+ "out": "missing"
7
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "template": "test-gradient",
4
+ "preset": "slow",
5
+ "durationSec": 3,
6
+ "seed": 1,
7
+ "out": "test-gradient"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "template": "test-strobe",
4
+ "preset": "fast",
5
+ "durationSec": 3,
6
+ "seed": 3,
7
+ "out": "strobe-12hz"
8
+ }
@@ -0,0 +1 @@
1
+ { "version": 1, "template": "test-text-probe", "durationSec": 3, "seed": 4, "out": "text-probe" }
@@ -0,0 +1,150 @@
1
+ // Flash audit: synthetic sequences built in memory, verdicts per WCAG 2.2 / BT.1702-3 / IRIS rules.
2
+ import test from "node:test";
3
+ import assert from "node:assert/strict";
4
+ import { auditFlash, createFlashAuditor, gridFor, LINEAR_LUT, FlashDetector } from "../engine/core/flash.mjs";
5
+
6
+ const W = 320;
7
+ const H = 180;
8
+ const FPS = 30;
9
+
10
+ /** Frame sequence: `stateAt(i)` says whether frame i is lit; `lit` is its colour, `box` limits the lit area. */
11
+ function sequence(seconds, stateAt, { lit = [255, 255, 255], box = null } = {}) {
12
+ const frames = [];
13
+ for (let i = 0; i < seconds * FPS; i++) {
14
+ const data = new Uint8Array(W * H * 4);
15
+ const on = stateAt(i);
16
+ for (let y = 0; y < H; y++) {
17
+ for (let x = 0; x < W; x++) {
18
+ const inside = !box || (x < box.w && y < box.h);
19
+ const o = (y * W + x) * 4;
20
+ if (on && inside) { data[o] = lit[0]; data[o + 1] = lit[1]; data[o + 2] = lit[2]; }
21
+ data[o + 3] = 255;
22
+ }
23
+ }
24
+ frames.push({ width: W, height: H, data });
25
+ }
26
+ return frames;
27
+ }
28
+
29
+ // Square wave with `transitionsPerSecond` edges per second (30 fps, so 30 / n frames per half period).
30
+ const wave = (transitionsPerSecond) => (i) => Math.floor((i * transitionsPerSecond) / FPS) % 2 === 1;
31
+
32
+ test("Given black/white at 2 flashes/s When audited Then within limits", () => {
33
+ const r = auditFlash(sequence(4, wave(4)), { fps: FPS });
34
+ assert.equal(r.exceeds, false);
35
+ assert.equal(r.redFlashes, 0);
36
+ assert.ok(r.worstWindow.transitions <= 6);
37
+ });
38
+
39
+ test("Given black/white at 4 flashes/s When audited Then exceeds", () => {
40
+ const r = auditFlash(sequence(4, wave(8)), { fps: FPS });
41
+ assert.equal(r.exceeds, true);
42
+ assert.ok(r.worstWindow.transitions > 6);
43
+ assert.ok(r.flashesPerSecondMax >= 3);
44
+ });
45
+
46
+ test("Given saturated red/black at 2 flashes/s When audited Then the red rule makes it exceed", () => {
47
+ const r = auditFlash(sequence(4, wave(4), { lit: [255, 0, 0] }), { fps: FPS });
48
+ assert.equal(r.exceeds, true);
49
+ assert.ok(r.redFlashes > 0);
50
+ });
51
+
52
+ test("Given a 2% white square at 6 flashes/s When audited Then within limits (area under threshold)", () => {
53
+ const r = auditFlash(sequence(4, wave(12), { box: { w: 48, h: 24 } }), { fps: FPS });
54
+ assert.equal(r.exceeds, false);
55
+ assert.equal(r.worstWindow.transitions, 0);
56
+ });
57
+
58
+ test("Given 5 transitions/s for 5 s When audited Then extendedFlashing is set but exceeds is not", () => {
59
+ const r = auditFlash(sequence(5, wave(5)), { fps: FPS });
60
+ assert.equal(r.extendedFlashing, true);
61
+ assert.equal(r.exceeds, false);
62
+ });
63
+
64
+ test("Given 5 transitions/s for 3 s When audited Then extendedFlashing is false", () => {
65
+ assert.equal(auditFlash(sequence(3, wave(5)), { fps: FPS }).extendedFlashing, false);
66
+ });
67
+
68
+ test("Given a static frame sequence When audited Then nothing is reported", () => {
69
+ const r = auditFlash(sequence(2, () => true), { fps: FPS });
70
+ assert.equal(r.exceeds, false);
71
+ assert.equal(r.flashesPerSecondMax, 0);
72
+ assert.equal(r.perSecond.length, 2);
73
+ });
74
+
75
+ test("Given the same frames When pushed one by one Then the streaming result equals auditFlash", () => {
76
+ const frames = sequence(4, wave(8));
77
+ const auditor = createFlashAuditor({ fps: FPS, width: W, height: H });
78
+ for (const f of frames) auditor.push(f);
79
+ assert.deepEqual(auditor.finish(), auditFlash(frames, { fps: FPS }));
80
+ });
81
+
82
+ test("Given frames When audited Then the frame bytes are untouched (report only)", () => {
83
+ const frames = sequence(1, wave(8));
84
+ const before = frames.map((f) => Buffer.from(f.data).toString("base64"));
85
+ auditFlash(frames, { fps: FPS });
86
+ assert.deepEqual(frames.map((f) => Buffer.from(f.data).toString("base64")), before);
87
+ });
88
+
89
+ test("Given the analysis.mjs imports Then LINEAR_LUT, gridFor and FlashDetector keep their contracts", () => {
90
+ assert.equal(LINEAR_LUT.length, 256);
91
+ assert.equal(LINEAR_LUT[0], 0);
92
+ assert.ok(Math.abs(LINEAR_LUT[255] - 1) < 1e-6);
93
+ assert.deepEqual(gridFor(), { gw: 320, gh: 180, ww: 107, wh: 60 });
94
+ assert.deepEqual(gridFor(1080, 1920), { gw: 180, gh: 320, ww: 60, wh: 107 });
95
+ assert.equal(typeof FlashDetector, "function");
96
+ });
97
+
98
+ /** Frame sequence from a per-pixel grey code value: `grey(i, x, y)` in 0..255. */
99
+ function greySequence(seconds, grey) {
100
+ const frames = [];
101
+ for (let i = 0; i < seconds * FPS; i++) {
102
+ const data = new Uint8Array(W * H * 4);
103
+ for (let y = 0; y < H; y++) {
104
+ for (let x = 0; x < W; x++) {
105
+ const o = (y * W + x) * 4;
106
+ const v = grey(i, x, y);
107
+ data[o] = v; data[o + 1] = v; data[o + 2] = v; data[o + 3] = 255;
108
+ }
109
+ }
110
+ frames.push({ width: W, height: H, data });
111
+ }
112
+ return frames;
113
+ }
114
+
115
+ test("Given a hard-edged white bar (1/4 frame wide) sliding at 400 px/s When audited Then motion is not a flash", () => {
116
+ const barW = W / 4;
117
+ const span = W + barW;
118
+ const frames = greySequence(4, (i, x) => {
119
+ const left = ((Math.round((i * 400) / FPS) % span) + span) % span - barW;
120
+ return x >= left && x < left + barW ? 255 : 0;
121
+ });
122
+ const r = auditFlash(frames, { fps: FPS });
123
+ assert.equal(r.exceeds, false);
124
+ assert.equal(r.redFlashes, 0);
125
+ assert.ok(r.flashesPerSecondMax <= 3, `flashesPerSecondMax ${r.flashesPerSecondMax}`);
126
+ });
127
+
128
+ test("Given a high-contrast sine grating (period 40 px) drifting at 60 px/s When audited Then motion is not a flash", () => {
129
+ const frames = greySequence(4, (i, x) => Math.round(127.5 + 127.5 * Math.sin((2 * Math.PI * (x - (60 * i) / FPS)) / 40)));
130
+ const r = auditFlash(frames, { fps: FPS });
131
+ assert.equal(r.exceeds, false);
132
+ assert.equal(r.redFlashes, 0);
133
+ assert.ok(r.flashesPerSecondMax <= 3, `flashesPerSecondMax ${r.flashesPerSecondMax}`);
134
+ });
135
+
136
+ // WCAG: opposing changes count when they happen in the same area. Here each half brightens while the
137
+ // other darkens, alternating every 3 frames, so each half alone makes 10 transitions/s (5 flashes/s)
138
+ // over 50% of any window inside it: that is a genuine failure (exceeds stays true). What must not
139
+ // happen is the two opposite halves being summed into a second, phantom transition per frame.
140
+ test("Given one half brightening while the other darkens, alternating every 3 frames When audited Then it counts only each half's own transitions", () => {
141
+ const frames = greySequence(4, (i, x) => ((Math.floor(i / 3) % 2 === 0) === (x < W / 2) ? 255 : 0));
142
+ const r = auditFlash(frames, { fps: FPS });
143
+ assert.equal(r.exceeds, true);
144
+ assert.ok(r.worstWindow.transitions <= 10, `worst window transitions ${r.worstWindow.transitions}`);
145
+ assert.ok(r.flashesPerSecondMax <= 5, `flashesPerSecondMax ${r.flashesPerSecondMax}`);
146
+ });
147
+
148
+ test("Given an audit with a missing fps When called Then it throws a TypeError", () => {
149
+ assert.throws(() => auditFlash([], {}), TypeError);
150
+ });
@@ -0,0 +1,83 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { spawnSync } from "node:child_process";
4
+ import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
5
+ import { tmpdir } from "node:os";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { loadLibrary } from "../engine/core/templates.mjs";
9
+ import { validateScore } from "../engine/core/validate.mjs";
10
+ import { runJob, FLASH_COMMENT } from "../engine/node/job.mjs";
11
+ import { auditFlash } from "../engine/core/flash.mjs";
12
+
13
+ const lib = loadLibrary({ includeTest: true });
14
+ const FIX = fileURLToPath(new URL("./fixtures/", import.meta.url));
15
+ const W = 320;
16
+ const H = 180;
17
+ const strobe = (extra = {}) => {
18
+ const raw = JSON.parse(readFileSync(path.join(FIX, "score-strobe-12hz.json"), "utf8"));
19
+ const r = validateScore({ ...raw, ...extra }, lib);
20
+ assert.equal(r.ok, true, JSON.stringify(r.errors));
21
+ return r.value;
22
+ };
23
+
24
+ function decode(file) {
25
+ const p = spawnSync("ffmpeg", ["-v", "error", "-i", file, "-f", "rawvideo", "-pix_fmt", "rgba", "pipe:1"], { maxBuffer: 1 << 30 });
26
+ const frames = [];
27
+ for (let o = 0; o + W * H * 4 <= p.stdout.length; o += W * H * 4) frames.push({ width: W, height: H, data: p.stdout.subarray(o, o + W * H * 4) });
28
+ return frames;
29
+ }
30
+ const comment = (file) => spawnSync("ffprobe", ["-v", "error", "-show_entries", "format_tags=comment", "-of", "default=nw=1:nk=1", file], { encoding: "utf8" }).stdout.trim();
31
+ const centreLuma = (f) => f.data[((H >> 1) * W + (W >> 1)) * 4];
32
+
33
+ test("stage mode at 12 flashes/s keeps every flash, writes SAFETY.txt and the MP4 comment", async () => {
34
+ const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-flash-"));
35
+ try {
36
+ const gate = await runJob(strobe(), lib, { outDir: dir, width: W, height: H, replay: false });
37
+ assert.equal(gate.flash.exceeds, true);
38
+ assert.ok(existsSync(path.join(dir, "SAFETY.txt")));
39
+ assert.equal(comment(path.join(dir, "film.mp4")), FLASH_COMMENT);
40
+ const frames = decode(path.join(dir, "film.mp4"));
41
+ assert.equal(frames.length, 90);
42
+ // 12 Hz at 30 fps: on for frames where fract(t*12) < 0.5. Every frame must keep full black or white.
43
+ const expected = frames.map((_, f) => ((f / 30) * 12 + 1e-4) % 1 < 0.5);
44
+ frames.forEach((fr, f) => assert.equal(centreLuma(fr) > 200, expected[f], `frame ${f} luma ${centreLuma(fr)}`));
45
+ for (const k of ["sheet", "poster"]) assert.ok(existsSync(gate.stills[k]), k);
46
+ assert.ok(gate.stills.strips.length >= 1 && gate.stills.strips.every((s) => existsSync(s.file)));
47
+ assert.ok(existsSync(path.join(dir, "gate-report.json")));
48
+ } finally {
49
+ rmSync(dir, { recursive: true, force: true });
50
+ }
51
+ });
52
+
53
+ test("safeVariant adds film.safe.mp4 within limits next to the untouched full-intensity film", async () => {
54
+ const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-flash-"));
55
+ try {
56
+ const gate = await runJob(strobe({ safety: { safeVariant: true } }), lib, { outDir: dir, width: W, height: H, replay: false });
57
+ assert.equal(gate.flash.exceeds, true, "master keeps full intensity");
58
+ assert.ok(existsSync(path.join(dir, "film.mp4")));
59
+ assert.ok(existsSync(path.join(dir, "film.safe.mp4")), JSON.stringify(gate.safeVariant));
60
+ assert.equal(gate.safeVariant.flash.exceeds, false);
61
+ assert.equal(auditFlash(decode(path.join(dir, "film.safe.mp4")), { fps: 30 }).exceeds, false);
62
+ } finally {
63
+ rmSync(dir, { recursive: true, force: true });
64
+ }
65
+ });
66
+
67
+ test("a hit schedule is thinned for broadcast-safe and the substitutions are listed", async () => {
68
+ const hits = Array.from({ length: 10 }, (_, i) => ({ t: 0.5 + i * 0.1, template: "test-strobe", preset: "hold", durationFrames: 1 }));
69
+ const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-flash-"));
70
+ try {
71
+ const gate = await runJob(strobe({ template: "test-gradient", preset: undefined, hits, safety: { safeVariant: true } }), lib, { outDir: dir, width: W, height: H, replay: false });
72
+ assert.ok(gate.safeVariant.substitutions.length >= 6, JSON.stringify(gate.safeVariant.substitutions));
73
+ assert.equal(gate.safeVariant.flash.exceeds, false);
74
+ } finally {
75
+ rmSync(dir, { recursive: true, force: true });
76
+ }
77
+ });
78
+
79
+ test("an unknown safety.mode is rejected naming safety.mode", () => {
80
+ const raw = JSON.parse(readFileSync(path.join(FIX, "score-strobe-12hz.json"), "utf8"));
81
+ const r = validateScore({ ...raw, safety: { mode: "gentle" } }, lib);
82
+ assert.ok(r.errors.some((e) => e.path === "safety.mode"));
83
+ });
@@ -0,0 +1,88 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { spawnSync } from "node:child_process";
4
+ import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
5
+ import { tmpdir } from "node:os";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { loadLibrary } from "../engine/core/templates.mjs";
9
+ import { validateScore } from "../engine/core/validate.mjs";
10
+ import { runJob } from "../engine/node/job.mjs";
11
+
12
+ const lib = loadLibrary({ includeTest: true });
13
+ const ROOT = fileURLToPath(new URL("../", import.meta.url));
14
+ const ff = (args) => {
15
+ const r = spawnSync("ffmpeg", ["-v", "error", "-y", ...args], { encoding: "utf8" });
16
+ assert.equal(r.status, 0, r.stderr);
17
+ };
18
+ const probe = (file, sel) => JSON.parse(spawnSync("ffprobe", ["-v", "error", "-count_frames", "-show_entries", sel, "-of", "json", file], { encoding: "utf8" }).stdout);
19
+ const score = (video, extra = {}) => {
20
+ const r = validateScore({ version: 1, template: "test-identity", input: { video }, durationSec: 3, seed: 1, out: "f", ...extra }, lib);
21
+ assert.equal(r.ok, true, JSON.stringify(r.errors));
22
+ return r.value;
23
+ };
24
+
25
+ test("a 29.97 fps clip renders exactly durationSec*fps frames, with audio within 50 ms of the video", async () => {
26
+ const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-foot-"));
27
+ try {
28
+ const clip = path.join(dir, "src.mp4");
29
+ ff(["-f", "lavfi", "-i", "testsrc2=size=640x360:rate=30000/1001", "-f", "lavfi", "-i", "sine=frequency=330:sample_rate=48000", "-t", "5", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", "-shortest", clip]);
30
+ const out = path.join(dir, "out");
31
+ await runJob(score(clip), lib, { outDir: out, width: 320, height: 180, replay: false });
32
+ const film = path.join(out, "film.mp4");
33
+ const v = probe(film, "stream=codec_type,nb_read_frames,duration");
34
+ const vs = v.streams.find((s) => s.codec_type === "video");
35
+ const as = v.streams.find((s) => s.codec_type === "audio");
36
+ assert.equal(Number(vs.nb_read_frames), 90);
37
+ assert.ok(as, "has an audio stream");
38
+ assert.ok(Math.abs(Number(as.duration) - Number(vs.duration)) <= 0.05, `audio ${as.duration} vs video ${vs.duration}`);
39
+ } finally {
40
+ rmSync(dir, { recursive: true, force: true });
41
+ }
42
+ });
43
+
44
+ test("colour bars through identity keep each bar's mean RGB within 4/255", async () => {
45
+ const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-foot-"));
46
+ try {
47
+ const clip = path.join(dir, "bars.mp4");
48
+ ff(["-f", "lavfi", "-i", "smptehdbars=size=1280x720:rate=30", "-t", "4", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-crf", "4", "-color_primaries", "bt709", "-color_trc", "bt709", "-colorspace", "bt709", clip]);
49
+ const out = path.join(dir, "out");
50
+ await runJob(score(clip), lib, { outDir: out, width: 640, height: 360, replay: false });
51
+ const grab = (file) => {
52
+ const r = spawnSync("ffmpeg", ["-v", "error", "-i", file, "-frames:v", "1", "-vf", "scale=640:360:flags=area:in_color_matrix=bt709,format=rgb24", "-f", "rawvideo", "pipe:1"], { maxBuffer: 1 << 28 });
53
+ return r.stdout;
54
+ };
55
+ const a = grab(clip);
56
+ const b = grab(path.join(out, "film.mp4"));
57
+ // Top band: seven bars across the width; sample the centre of each bar at 1/3 height.
58
+ for (let i = 0; i < 7; i++) {
59
+ const x0 = Math.round(((i + 0.3) / 7) * 640 * 0.75);
60
+ const x1 = Math.round(((i + 0.7) / 7) * 640 * 0.75);
61
+ const mean = (buf) => {
62
+ const s = [0, 0, 0];
63
+ let n = 0;
64
+ for (let y = 100; y < 140; y++) for (let x = x0; x < x1; x++) { const o = (y * 640 + x) * 3; s[0] += buf[o]; s[1] += buf[o + 1]; s[2] += buf[o + 2]; n++; }
65
+ return s.map((v) => v / n);
66
+ };
67
+ const ma = mean(a);
68
+ const mb = mean(b);
69
+ for (let c = 0; c < 3; c++) assert.ok(Math.abs(ma[c] - mb[c]) <= 4, `bar ${i} ch ${c}: ${ma[c].toFixed(1)} vs ${mb[c].toFixed(1)}`);
70
+ }
71
+ } finally {
72
+ rmSync(dir, { recursive: true, force: true });
73
+ }
74
+ });
75
+
76
+ test("a missing video is a named error on input.video", async () => {
77
+ await assert.rejects(runJob(score("nope/missing.mp4"), lib, { outDir: mkdtempSync(path.join(tmpdir(), "agentvfx-foot-")), width: 320, height: 180, replay: false }), /input\.video/u);
78
+ });
79
+
80
+ test("test media is present with a licence for every file", () => {
81
+ const sources = readFileSync(path.join(ROOT, "test-media/SOURCES.md"), "utf8");
82
+ assert.ok(existsSync(path.join(ROOT, "test-media/beat-132.mp3")), "beat-132.mp3");
83
+ for (const f of ["clip-01.mp4", "clip-02.mp4"]) {
84
+ assert.ok(existsSync(path.join(ROOT, "test-media", f)), f);
85
+ const section = sources.split(`## ${f}`)[1] ?? "";
86
+ assert.match(section.split("\n## ")[0], /Licence: /u, `licence for ${f}`);
87
+ }
88
+ });
@@ -0,0 +1,272 @@
1
+ // Task 13: glitch/retro family (rgb-split, block-glitch, vhs, pixel-sort). Render tests run at 320x180.
2
+ import { test } from "node:test";
3
+ import assert from "node:assert/strict";
4
+ import { spawnSync } from "node:child_process";
5
+ import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
6
+ import { tmpdir } from "node:os";
7
+ import path from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ import { loadLibrary } from "../engine/core/templates.mjs";
10
+ import { validateScore, validateTemplate } from "../engine/core/validate.mjs";
11
+ import { renderScore } from "../engine/node/render.mjs";
12
+ import { runJob } from "../engine/node/job.mjs";
13
+ import { analyzeAudio } from "../engine/node/audio.mjs";
14
+ import { openFootage } from "../engine/node/footage.mjs";
15
+
16
+ const lib = loadLibrary();
17
+ const ROOT = fileURLToPath(new URL("../", import.meta.url));
18
+ const IDS = ["rgb-split", "block-glitch", "vhs", "pixel-sort"];
19
+ const W = 320;
20
+ const H = 180;
21
+ const STILL = `testsrc2=size=${W}x${H}:rate=30,trim=end_frame=1,loop=loop=-1:size=1`;
22
+
23
+ function makeClip(dir, lavfi) {
24
+ const clip = path.join(dir, "in.mp4");
25
+ const r = spawnSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", lavfi, "-t", "4", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-crf", "8", clip], { encoding: "utf8" });
26
+ assert.equal(r.status, 0, r.stderr);
27
+ return clip;
28
+ }
29
+ const score = (template, clip, params = {}, extra = {}) => {
30
+ const v = validateScore({ version: 1, template, input: { video: clip }, params, durationSec: 3, seed: 7, out: "t", credit: { overlay: false }, ...extra }, lib);
31
+ assert.equal(v.ok, true, JSON.stringify(v.errors));
32
+ return v.value;
33
+ };
34
+
35
+ /** Render a score at 320x180 and keep the frames asked for. Returns { report, kept, shas, input }. */
36
+ async function render(sc, { frames = [0], features = null, replay = false } = {}) {
37
+ const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-glitch-"));
38
+ const first = openFootage(sc.input.video, { fps: sc.fps, durationSec: sc.durationSec, longEdge: W });
39
+ const input = Buffer.from(await first.frame(0).finally(() => first.close()));
40
+ const footage = openFootage(sc.input.video, { fps: sc.fps, durationSec: sc.durationSec, longEdge: W });
41
+ const kept = new Map();
42
+ const shas = [];
43
+ try {
44
+ const report = await renderScore(sc, lib, { outDir: dir, width: W, height: H, footage, features, replay, onFrame: (f, a) => { shas[f] = a.rgbaSha256; if (frames === "all" || frames.includes(f)) kept.set(f, Buffer.from(a.rgba)); } });
45
+ return { report, kept, shas, input };
46
+ } finally {
47
+ footage.close();
48
+ rmSync(dir, { recursive: true, force: true });
49
+ }
50
+ }
51
+ /** 48 kHz mono 16-bit WAV with a short decaying 2 kHz click at each time (seconds). */
52
+ function clickWav(times, seconds) {
53
+ const sr = 48000;
54
+ const data = Buffer.alloc(Math.floor(seconds * sr) * 2);
55
+ for (const t of times) {
56
+ for (let k = 0; k < 96; k++) data.writeInt16LE(Math.round(Math.sin((2 * Math.PI * 2000 * k) / sr) * Math.exp(-k / 24) * 0.9 * 32767), (Math.floor(t * sr) + k) * 2);
57
+ }
58
+ const head = Buffer.alloc(44);
59
+ head.write("RIFF", 0);
60
+ head.writeUInt32LE(36 + data.length, 4);
61
+ head.write("WAVEfmt ", 8);
62
+ head.writeUInt32LE(16, 16);
63
+ head.writeUInt16LE(1, 20);
64
+ head.writeUInt16LE(1, 22);
65
+ head.writeUInt32LE(sr, 24);
66
+ head.writeUInt32LE(sr * 2, 28);
67
+ head.writeUInt16LE(2, 32);
68
+ head.writeUInt16LE(16, 34);
69
+ head.write("data", 36);
70
+ head.writeUInt32LE(data.length, 40);
71
+ return Buffer.concat([head, data]);
72
+ }
73
+ const px = (buf, x, y, c = 0) => buf[(y * W + x) * 4 + c];
74
+ const lumaByte = (buf, x, y) => (px(buf, x, y, 0) + px(buf, x, y, 1) + px(buf, x, y, 2)) / 3;
75
+
76
+ test("the family ships four validated templates with presets, honest flash flags and a demo each", () => {
77
+ for (const id of IDS) {
78
+ const t = lib.get(id);
79
+ assert.ok(t, `${id} is in the library`);
80
+ assert.equal(t.family, "glitch");
81
+ assert.deepEqual(validateTemplate(t.fx, id).errors, []);
82
+ assert.ok(Object.keys(t.fx.X_AGENTVFX.presets).length >= 3);
83
+ assert.ok(["none", "possible", "strobe"].includes(t.fx.X_AGENTVFX.flash));
84
+ if (t.fx.X_AGENTVFX.flash === "strobe") assert.ok(t.fx.X_AGENTVFX.safeSubstitute, `${id} strobes, so it needs a safeSubstitute`);
85
+ const demos = readdirSync(t.dir).filter((f) => /^demo-.*\.json$/u.test(f));
86
+ assert.ok(demos.length >= 1, `${id} has a demo`);
87
+ for (const d of demos) {
88
+ const s = JSON.parse(readFileSync(path.join(t.dir, d), "utf8"));
89
+ const v = validateScore(s, lib);
90
+ assert.equal(v.ok, true, `${id}/${d}: ${JSON.stringify(v.errors)}`);
91
+ assert.ok(existsSync(path.join(ROOT, s.input.video)), `${id}/${d}: footage exists`);
92
+ assert.equal(s.durationSec, 4);
93
+ }
94
+ }
95
+ });
96
+
97
+ for (const id of IDS) {
98
+ test(`${id}: renders every frame, passes the determinism replay and carries a flash report`, async () => {
99
+ const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-glitch-src-"));
100
+ try {
101
+ const clip = makeClip(tmp, `testsrc2=size=${W}x${H}:rate=30`);
102
+ const out = path.join(tmp, "out");
103
+ const gate = await runJob(score(id, clip), lib, { outDir: out, width: W, height: H, replay: true });
104
+ assert.equal(gate.render.frames, 90);
105
+ assert.equal(gate.determinism.pass, true);
106
+ assert.equal(typeof gate.flash.flashesPerSecondMax, "number");
107
+ assert.equal(typeof gate.flash.exceeds, "boolean");
108
+ } finally {
109
+ rmSync(tmp, { recursive: true, force: true });
110
+ }
111
+ });
112
+ }
113
+
114
+ test("pixel-sort: spans of a luma-threshold window come out monotonic; short spans are exactly sorted", async () => {
115
+ const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-glitch-src-"));
116
+ try {
117
+ // Noise 60..200 with bright walls (255): 30-wide spans left of x=150, one long span 150..299.
118
+ const clip = makeClip(tmp, "color=c=gray:size=320x180:rate=30,format=yuv420p,geq=lum='if(gte(X,300),255,if(lt(X,150),if(lt(mod(X,36),30),60+140*random(1),255),60+140*random(1)))':cb=128:cr=128,trim=end_frame=1,loop=loop=-1:size=1");
119
+ const sc = score("pixel-sort", clip, { cellSize: 1, threshLo: 0.15, threshHi: 0.9, rowVar: 0, rowsFrac: 1, sweep: 0, cutJitter: 0, softness: 0, saturation: 1, punch: 1, stutterHz: 1 });
120
+ const { kept, input } = await render(sc, { frames: [0, 40] });
121
+ const lo = 0.15 * 255;
122
+ const hi = 0.9 * 255;
123
+ let rows = 0;
124
+ let moved = 0;
125
+ let total = 0;
126
+ for (const f of [0, 40]) {
127
+ const out = kept.get(f);
128
+ for (let y = 0; y < H; y++) {
129
+ const lum = Array.from({ length: W }, (_, x) => lumaByte(input, x, y));
130
+ if (lum.some((v) => Math.abs(v - lo) <= 4 || Math.abs(v - hi) <= 4)) continue;
131
+ rows += 1;
132
+ const mask = lum.map((v) => v >= lo && v <= hi);
133
+ for (let x = 0; x < W; ) {
134
+ if (!mask[x]) {
135
+ assert.ok(Math.abs(px(out, x, y) - lum[x]) <= 4, `walls are untouched at ${x},${y}`);
136
+ x += 1;
137
+ continue;
138
+ }
139
+ let e = x;
140
+ while (e + 1 < W && mask[e + 1] && (e + 1) % 256 !== 0) e += 1;
141
+ const span = lum.slice(x, e + 1);
142
+ const got = span.map((_, k) => px(out, x + k, y));
143
+ for (let k = 1; k < got.length; k++) assert.ok(got[k] >= got[k - 1] - 3, `monotonic in span ${x}..${e} row ${y}: ${got[k - 1]} then ${got[k]}`);
144
+ if (span.length <= 32) {
145
+ const sorted = [...span].sort((a, b) => a - b);
146
+ sorted.forEach((v, k) => assert.ok(Math.abs(v - got[k]) <= 4, `short span ${x}..${e} row ${y} is the exact sorted multiset`));
147
+ }
148
+ span.forEach((v, k) => { total += 1; if (Math.abs(v - got[k]) > 8) moved += 1; });
149
+ x = e + 1;
150
+ }
151
+ }
152
+ }
153
+ assert.ok(rows >= 200, `tested ${rows} rows`);
154
+ assert.ok(moved / total > 0.5, `sorting moved ${(100 * moved / total).toFixed(0)}% of span pixels`);
155
+ } finally {
156
+ rmSync(tmp, { recursive: true, force: true });
157
+ }
158
+ });
159
+
160
+ test("pixel-sort: vertical axis with descend sorts columns brightest first", async () => {
161
+ const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-glitch-src-"));
162
+ try {
163
+ const clip = makeClip(tmp, "color=c=gray:size=320x180:rate=30,format=yuv420p,geq=lum='60+140*random(1)':cb=128:cr=128,trim=end_frame=1,loop=loop=-1:size=1");
164
+ const sc = score("pixel-sort", clip, { sortAxis: 1, descend: true, cellSize: 1, threshLo: 0.1, threshHi: 0.95, rowVar: 0, rowsFrac: 1, sweep: 0, cutJitter: 0, softness: 0, saturation: 1, punch: 1 });
165
+ const { kept } = await render(sc);
166
+ const out = kept.get(0);
167
+ for (let x = 0; x < W; x += 7) for (let y = 1; y < H; y++) assert.ok(px(out, x, y) <= px(out, x, y - 1) + 3, `column ${x} descends at row ${y}`);
168
+ } finally {
169
+ rmSync(tmp, { recursive: true, force: true });
170
+ }
171
+ });
172
+
173
+ test("block-glitch: same seed renders byte-identical frames twice; each burst gets its own pattern", async () => {
174
+ const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-glitch-src-"));
175
+ try {
176
+ const clip = makeClip(tmp, STILL);
177
+ const sc = score("block-glitch", clip, { burstProb: 1, burstRate: 2.5, burstFrames: 8, holdFrames: 2, grain: 0 });
178
+ const a = await render(sc, { frames: "all" });
179
+ const b = await render(sc, { frames: "all" });
180
+ assert.deepEqual(a.shas, b.shas, "two renders with one seed are byte-identical");
181
+ const other = await render(score("block-glitch", clip, { burstProb: 1, burstRate: 2.5, burstFrames: 8, holdFrames: 2, grain: 0 }, { seed: 8 }), { frames: [1, 2] });
182
+ // The output dither differs per frame index, so "same pattern" means a tiny mean difference, not equal bytes.
183
+ const diff = (x, y) => x.reduce((s, v, i) => s + Math.abs(v - y[i]), 0) / x.length;
184
+ assert.ok(diff(other.kept.get(1), a.kept.get(1)) > 6, "another seed gives another pattern");
185
+ // burst period 12 frames: bursts start at 0, 12, 24, 36 ...; the first frame of each burst differs
186
+ const firsts = [0, 12, 24, 36, 48].map((f) => a.kept.get(f));
187
+ for (let i = 0; i < firsts.length; i++) for (let j = i + 1; j < firsts.length; j++) assert.ok(diff(firsts[i], firsts[j]) > 6, `burst ${i} and ${j} differ (the seed advances per burst)`);
188
+ assert.ok(diff(a.kept.get(0), a.kept.get(2)) > 6, "the pattern re-seeds inside a burst (holdFrames)");
189
+ assert.ok(diff(a.kept.get(0), a.kept.get(1)) < 2, "and is held between re-seeds");
190
+ } finally {
191
+ rmSync(tmp, { recursive: true, force: true });
192
+ }
193
+ });
194
+
195
+ test("block-glitch: lockMode onset starts a burst on every detected onset and stays clean between them", async () => {
196
+ const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-glitch-src-"));
197
+ try {
198
+ const clip = makeClip(tmp, STILL);
199
+ const music = path.join(tmp, "clicks.wav");
200
+ writeFileSync(music, clickWav([0.4, 1.3, 2.2], 3.2));
201
+ const features = await analyzeAudio(music, { fps: 30 });
202
+ const onsets = features.meta.onsets.filter((f) => f < 85);
203
+ assert.ok(onsets.length >= 2 && onsets.length <= 4, `three clicks give about three onsets (${onsets.length})`);
204
+ const sc = score("block-glitch", clip, { lockMode: 1, burstProb: 1, burstFrames: 7, density: 0.5, idleDensity: 0, grain: 0, fringe: 0, saturation: 1, punch: 1, joltAmt: 0 }, { input: { video: clip, audio: music } });
205
+ const { kept, input } = await render(sc, { frames: "all", features });
206
+ const changed = (f) => {
207
+ let n = 0;
208
+ for (let i = 0; i < W * H; i += 5) if (Math.abs(kept.get(f)[i * 4 + 1] - input[i * 4 + 1]) > 20) n += 1;
209
+ return n / (W * H / 5);
210
+ };
211
+ for (const o of onsets) assert.ok(changed(o + 1) > 0.05, `burst at onset ${o}: ${changed(o + 1).toFixed(3)}`);
212
+ const quiet = [...Array(85).keys()].filter((f) => f < onsets[0] || onsets.every((o) => f > o + 8 || f < o));
213
+ assert.ok(quiet.length > 5);
214
+ for (const f of quiet) assert.ok(changed(f) < 0.01, `frame ${f} between bursts stays clean: ${changed(f).toFixed(3)}`);
215
+ } finally {
216
+ rmSync(tmp, { recursive: true, force: true });
217
+ }
218
+ });
219
+
220
+ const BAR = `color=c=black:size=${W}x${H}:rate=30,format=yuv420p,drawbox=x=158:y=0:w=4:h=${H}:color=white:t=fill,drawbox=x=58:y=0:w=4:h=${H}:color=white:t=fill,drawbox=x=258:y=0:w=4:h=${H}:color=white:t=fill`;
221
+ const centroid = (buf, y, c, x0, x1) => {
222
+ let s = 0;
223
+ let m = 0;
224
+ for (let x = x0; x < x1; x++) {
225
+ s += x * px(buf, x, y, c);
226
+ m += px(buf, x, y, c);
227
+ }
228
+ return s / Math.max(m, 1);
229
+ };
230
+ const calm = { burstProb: 0, jitter: 0, tear: 0, scanlines: 0, grain: 0, punch: 1, saturation: 1, splitAmount: 120, splitTaps: 3 };
231
+
232
+ test("rgb-split: red and blue copies of a white bar sit splitAmount apart; radial mode splits outward", async () => {
233
+ const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-glitch-src-"));
234
+ try {
235
+ const clip = makeClip(tmp, BAR);
236
+ const axis = (await render(score("rgb-split", clip, calm))).kept.get(0);
237
+ const sep = centroid(axis, 90, 0, 120, 200) - centroid(axis, 90, 2, 120, 200);
238
+ assert.ok(Math.abs(Math.abs(sep) - 40) < 6, `axis split ${sep.toFixed(1)} px (expected 40)`);
239
+ const rad = (await render(score("rgb-split", clip, { ...calm, splitMode: 1 }))).kept.get(0);
240
+ const left = centroid(rad, 90, 0, 20, 100) - centroid(rad, 90, 2, 20, 100);
241
+ const right = centroid(rad, 90, 0, 220, 300) - centroid(rad, 90, 2, 220, 300);
242
+ assert.ok(left * right < 0 && Math.abs(left) > 8 && Math.abs(right) > 8, `radial split flips sign across the centre (${left.toFixed(1)} / ${right.toFixed(1)})`);
243
+ } finally {
244
+ rmSync(tmp, { recursive: true, force: true });
245
+ }
246
+ });
247
+
248
+ test("vhs: chroma bleeds past a red box edge, bottom rows skew (head switching), scanlines modulate brightness", async () => {
249
+ const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-glitch-src-"));
250
+ try {
251
+ const clip = makeClip(tmp, `color=c=0x808080:size=${W}x${H}:rate=30,format=yuv420p,drawbox=x=100:y=20:w=60:h=100:color=red:t=fill,drawbox=x=200:y=0:w=6:h=${H}:color=white:t=fill`);
252
+ const base = { trackAmount: 0, wobble: 0, dropouts: 0, tapeNoise: 0, flicker: 0, chromaNoise: 0, lumaBlur: 0.05, ringing: 0, scanlines: 0, headSwitch: 0, saturation: 1 };
253
+ const redness = (buf, x, y) => px(buf, x, y, 0) - px(buf, x, y, 2);
254
+ const sharp = (await render(score("vhs", clip, { ...base, chromaBleed: 0 }))).kept.get(0);
255
+ const bleed = (await render(score("vhs", clip, { ...base, chromaBleed: 80 }))).kept.get(0);
256
+ assert.ok(redness(bleed, 164, 70) > redness(sharp, 164, 70) + 25, `chroma smears right of the box: ${redness(sharp, 164, 70)} -> ${redness(bleed, 164, 70)}`);
257
+ const skew = (await render(score("vhs", clip, { ...base, chromaBleed: 0, headSwitch: 1, headHeight: 0.1 }))).kept.get(0);
258
+ const rowsDiff = (a, b, y0, y1) => {
259
+ let s = 0;
260
+ for (let y = y0; y < y1; y++) for (let x = 0; x < W; x++) s += Math.abs(lumaByte(a, x, y) - lumaByte(b, x, y));
261
+ return s / ((y1 - y0) * W);
262
+ };
263
+ assert.ok(rowsDiff(skew, sharp, H - 8, H) > 20, "the bottom rows are skewed and noisy");
264
+ assert.ok(rowsDiff(skew, sharp, 20, 120) < 3, "and the rest of the frame is untouched");
265
+ const lined = (await render(score("vhs", clip, { ...base, chromaBleed: 0, scanlines: 1 }))).kept.get(0);
266
+ let dark = 0;
267
+ for (let y = 20; y < 120; y++) dark = Math.max(dark, Math.abs(lumaByte(lined, 20, y) - lumaByte(sharp, 20, y)));
268
+ assert.ok(dark > 25, `scanlines darken rows by up to ${dark.toFixed(0)}/255`);
269
+ } finally {
270
+ rmSync(tmp, { recursive: true, force: true });
271
+ }
272
+ });