sera-code 0.1.3 → 0.1.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 (332) hide show
  1. package/README.md +9 -1
  2. package/bin/sera.mjs +31 -0
  3. package/dist/bundle/chunks/{chunk-OXMPCU7P.js → chunk-DFRGGJWV.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-KO3Z5BTR.js → chunk-EMXTNOOJ.js} +5 -5
  5. package/dist/bundle/chunks/{chunk-KXU77PUU.js → chunk-ET2ARYK4.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-ZNCN2NGY.js → chunk-G5BGS7HZ.js} +2 -2
  7. package/dist/bundle/chunks/{chunk-HODJBMOY.js → chunk-GSGPISRE.js} +3 -4
  8. package/dist/bundle/chunks/{chunk-46WGNYIE.js → chunk-NMUS7OCP.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-HQBQWHLD.js → chunk-RCQXVPCE.js} +1 -1
  10. package/dist/bundle/chunks/{cli-MML2DU4A.js → cli-NOCFT7AL.js} +1 -1
  11. package/dist/bundle/chunks/{execute-HXDNZ26B.js → execute-S2O3RL6V.js} +1 -1
  12. package/dist/bundle/chunks/github-copilot.js +1 -1
  13. package/dist/bundle/chunks/{runtime-JAH75CB5.js → runtime-BRT7AUXY.js} +1 -1
  14. package/dist/bundle/chunks/{virtual-modules-OE2CSJ4W.js → virtual-modules-QR2XYBMY.js} +1 -1
  15. package/dist/bundle/cli-runtime.js +1 -1
  16. package/dist/bundle/index.js +1 -1
  17. package/dist/bundle/rpc-entry.js +1 -1
  18. package/lib/postinstall.js +16 -0
  19. package/lib/update.js +85 -0
  20. package/lib/win-setup.js +96 -0
  21. package/package.json +4 -1
  22. package/sera-core/skills/ambalaj-tasarim/NOTICE +1 -0
  23. package/sera-core/skills/ambalaj-tasarim/SKILL.md +34 -0
  24. package/sera-core/skills/ambalaj-tasarim/dieline.mjs +17 -0
  25. package/sera-core/skills/ambalaj-tasarim/sera-pack.js +535 -0
  26. package/sera-core/skills/animasyonlu-site/NOTICE +1 -0
  27. package/sera-core/skills/animasyonlu-site/SKILL.md +26 -0
  28. package/sera-core/skills/animasyonlu-site/sera-motion.js +310 -0
  29. package/sera-core/skills/animate/LICENSE +21 -0
  30. package/sera-core/skills/animate/NOTICE +2 -0
  31. package/sera-core/skills/animate/RECIPES.md +324 -0
  32. package/sera-core/skills/animate/SKILL.md +209 -0
  33. package/sera-core/skills/astryx-ui/SKILL.md +37 -0
  34. package/sera-core/skills/awwwards/LICENSE +21 -0
  35. package/sera-core/skills/awwwards/NOTICE +5 -0
  36. package/sera-core/skills/awwwards/SKILL.md +357 -0
  37. package/sera-core/skills/awwwards/references/anatomy.md +103 -0
  38. package/sera-core/skills/awwwards/references/art-direction.md +114 -0
  39. package/sera-core/skills/awwwards/references/astro.md +235 -0
  40. package/sera-core/skills/awwwards/references/concepts.md +110 -0
  41. package/sera-core/skills/awwwards/references/content.md +88 -0
  42. package/sera-core/skills/awwwards/references/engine.md +751 -0
  43. package/sera-core/skills/awwwards/references/layout.md +81 -0
  44. package/sera-core/skills/awwwards/references/motion.md +463 -0
  45. package/sera-core/skills/awwwards/references/nextjs.md +386 -0
  46. package/sera-core/skills/awwwards/references/patterns.md +123 -0
  47. package/sera-core/skills/awwwards/references/quality-bar.md +151 -0
  48. package/sera-core/skills/awwwards/references/quality.md +91 -0
  49. package/sera-core/skills/awwwards/references/ship.md +36 -0
  50. package/sera-core/skills/awwwards/references/typography.md +135 -0
  51. package/sera-core/skills/awwwards/references/webgl.md +430 -0
  52. package/sera-core/skills/awwwards/scripts/audit.mjs +243 -0
  53. package/sera-core/skills/awwwards/scripts/browser.mjs +54 -0
  54. package/sera-core/skills/awwwards/scripts/font.mjs +87 -0
  55. package/sera-core/skills/awwwards/scripts/og.mjs +20 -0
  56. package/sera-core/skills/awwwards/scripts/photos.mjs +65 -0
  57. package/sera-core/skills/awwwards/scripts/serve.mjs +48 -0
  58. package/sera-core/skills/awwwards/scripts/shoot.mjs +675 -0
  59. package/sera-core/skills/beceri-yaz/SKILL.md +39 -0
  60. package/sera-core/skills/brag-slim/LICENSE +21 -0
  61. package/sera-core/skills/brag-slim/NOTICE +2 -0
  62. package/sera-core/skills/brag-slim/SKILL.md +108 -0
  63. package/sera-core/skills/brainstorming/LICENSE +21 -0
  64. package/sera-core/skills/brainstorming/NOTICE +5 -0
  65. package/sera-core/skills/brainstorming/SKILL.md +298 -0
  66. package/sera-core/skills/brainstorming/builder-check-prompt.md +23 -0
  67. package/sera-core/skills/copywriting/LICENSE +21 -0
  68. package/sera-core/skills/copywriting/NOTICE +5 -0
  69. package/sera-core/skills/copywriting/SKILL.md +343 -0
  70. package/sera-core/skills/copywriting/references/ai-tells.md +309 -0
  71. package/sera-core/skills/copywriting/references/copy-frameworks.md +432 -0
  72. package/sera-core/skills/copywriting/references/natural-transitions.md +256 -0
  73. package/sera-core/skills/cro/LICENSE +21 -0
  74. package/sera-core/skills/cro/NOTICE +5 -0
  75. package/sera-core/skills/cro/SKILL.md +198 -0
  76. package/sera-core/skills/cro/references/experiments.md +248 -0
  77. package/sera-core/skills/cro/references/form.md +422 -0
  78. package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +11 -0
  79. package/sera-core/skills/emil-design-eng/LICENSE +21 -0
  80. package/sera-core/skills/emil-design-eng/NOTICE +2 -0
  81. package/sera-core/skills/emil-design-eng/SKILL.md +684 -0
  82. package/sera-core/skills/frontend-design/LICENSE.txt +177 -0
  83. package/sera-core/skills/frontend-design/NOTICE +2 -0
  84. package/sera-core/skills/frontend-design/SKILL.md +71 -0
  85. package/sera-core/skills/gorsel-denetim/SKILL.md +30 -0
  86. package/sera-core/skills/hallmark/LICENSE +21 -0
  87. package/sera-core/skills/hallmark/NOTICE +5 -0
  88. package/sera-core/skills/hallmark/SKILL.md +154 -0
  89. package/sera-core/skills/hallmark/references/anatomy.md +71 -0
  90. package/sera-core/skills/hallmark/references/brand-truth.md +40 -0
  91. package/sera-core/skills/hallmark/references/comp.md +104 -0
  92. package/sera-core/skills/hallmark/references/craft.md +116 -0
  93. package/sera-core/skills/hallmark/references/dark-mode.md +49 -0
  94. package/sera-core/skills/hallmark/references/data-viz.md +48 -0
  95. package/sera-core/skills/hallmark/references/design-md.md +53 -0
  96. package/sera-core/skills/hallmark/references/direction.md +52 -0
  97. package/sera-core/skills/hallmark/references/export-formats.md +80 -0
  98. package/sera-core/skills/hallmark/references/flow.md +131 -0
  99. package/sera-core/skills/hallmark/references/fonts.md +58 -0
  100. package/sera-core/skills/hallmark/references/gates.md +243 -0
  101. package/sera-core/skills/hallmark/references/genres/atmospheric.md +24 -0
  102. package/sera-core/skills/hallmark/references/genres/editorial.md +24 -0
  103. package/sera-core/skills/hallmark/references/genres/modern-minimal.md +24 -0
  104. package/sera-core/skills/hallmark/references/genres/playful.md +24 -0
  105. package/sera-core/skills/hallmark/references/imagery.md +99 -0
  106. package/sera-core/skills/hallmark/references/interaction-and-states.md +89 -0
  107. package/sera-core/skills/hallmark/references/layout.md +104 -0
  108. package/sera-core/skills/hallmark/references/macrostructures/01-bento-grid.md +21 -0
  109. package/sera-core/skills/hallmark/references/macrostructures/02-long-document.md +35 -0
  110. package/sera-core/skills/hallmark/references/macrostructures/03-marquee-hero.md +21 -0
  111. package/sera-core/skills/hallmark/references/macrostructures/04-stat-led.md +21 -0
  112. package/sera-core/skills/hallmark/references/macrostructures/05-workbench.md +21 -0
  113. package/sera-core/skills/hallmark/references/macrostructures/06-conversational-faq.md +28 -0
  114. package/sera-core/skills/hallmark/references/macrostructures/07-manifesto.md +28 -0
  115. package/sera-core/skills/hallmark/references/macrostructures/08-photographic.md +21 -0
  116. package/sera-core/skills/hallmark/references/macrostructures/09-quote-led.md +21 -0
  117. package/sera-core/skills/hallmark/references/macrostructures/10-specimen.md +21 -0
  118. package/sera-core/skills/hallmark/references/macrostructures/11-catalogue.md +21 -0
  119. package/sera-core/skills/hallmark/references/macrostructures/12-letter.md +21 -0
  120. package/sera-core/skills/hallmark/references/macrostructures/13-index-first.md +21 -0
  121. package/sera-core/skills/hallmark/references/macrostructures/14-narrative-workflow.md +21 -0
  122. package/sera-core/skills/hallmark/references/macrostructures/15-split-studio.md +21 -0
  123. package/sera-core/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
  124. package/sera-core/skills/hallmark/references/macrostructures/17-type-specimen.md +19 -0
  125. package/sera-core/skills/hallmark/references/macrostructures/18-portfolio-grid.md +21 -0
  126. package/sera-core/skills/hallmark/references/macrostructures/19-map-diagram.md +21 -0
  127. package/sera-core/skills/hallmark/references/macrostructures/20-ecosystem-index.md +19 -0
  128. package/sera-core/skills/hallmark/references/macrostructures/21-component-playground.md +21 -0
  129. package/sera-core/skills/hallmark/references/macrostructures.md +119 -0
  130. package/sera-core/skills/hallmark/references/microinteractions.md +80 -0
  131. package/sera-core/skills/hallmark/references/patterns.md +202 -0
  132. package/sera-core/skills/hallmark/references/redesign.md +88 -0
  133. package/sera-core/skills/hallmark/references/responsive.md +46 -0
  134. package/sera-core/skills/hallmark/references/review-finish.md +19 -0
  135. package/sera-core/skills/hallmark/references/review-hero.md +20 -0
  136. package/sera-core/skills/hallmark/references/scroll-choreography.md +110 -0
  137. package/sera-core/skills/hallmark/references/texture.md +90 -0
  138. package/sera-core/skills/hallmark/references/themes/README.md +58 -0
  139. package/sera-core/skills/hallmark/references/themes/almanac.md +103 -0
  140. package/sera-core/skills/hallmark/references/themes/arcade.md +102 -0
  141. package/sera-core/skills/hallmark/references/themes/atelier.md +98 -0
  142. package/sera-core/skills/hallmark/references/themes/bloom.md +102 -0
  143. package/sera-core/skills/hallmark/references/themes/blueprint.md +103 -0
  144. package/sera-core/skills/hallmark/references/themes/broadside.md +108 -0
  145. package/sera-core/skills/hallmark/references/themes/brutal.md +95 -0
  146. package/sera-core/skills/hallmark/references/themes/carnival.md +104 -0
  147. package/sera-core/skills/hallmark/references/themes/cobalt.md +101 -0
  148. package/sera-core/skills/hallmark/references/themes/console.md +99 -0
  149. package/sera-core/skills/hallmark/references/themes/coral.md +102 -0
  150. package/sera-core/skills/hallmark/references/themes/darkroom.md +99 -0
  151. package/sera-core/skills/hallmark/references/themes/dose.md +98 -0
  152. package/sera-core/skills/hallmark/references/themes/dusk.md +105 -0
  153. package/sera-core/skills/hallmark/references/themes/editorial.md +97 -0
  154. package/sera-core/skills/hallmark/references/themes/formwork.md +107 -0
  155. package/sera-core/skills/hallmark/references/themes/furrow.md +98 -0
  156. package/sera-core/skills/hallmark/references/themes/garden.md +97 -0
  157. package/sera-core/skills/hallmark/references/themes/grid.md +101 -0
  158. package/sera-core/skills/hallmark/references/themes/halftone.md +106 -0
  159. package/sera-core/skills/hallmark/references/themes/hedgerow.md +104 -0
  160. package/sera-core/skills/hallmark/references/themes/hum.md +99 -0
  161. package/sera-core/skills/hallmark/references/themes/ink.md +106 -0
  162. package/sera-core/skills/hallmark/references/themes/kiln.md +108 -0
  163. package/sera-core/skills/hallmark/references/themes/loom.md +106 -0
  164. package/sera-core/skills/hallmark/references/themes/lumen.md +103 -0
  165. package/sera-core/skills/hallmark/references/themes/manifesto.md +101 -0
  166. package/sera-core/skills/hallmark/references/themes/midnight.md +97 -0
  167. package/sera-core/skills/hallmark/references/themes/newsprint.md +102 -0
  168. package/sera-core/skills/hallmark/references/themes/overprint.md +101 -0
  169. package/sera-core/skills/hallmark/references/themes/pasteup.md +100 -0
  170. package/sera-core/skills/hallmark/references/themes/piste.md +99 -0
  171. package/sera-core/skills/hallmark/references/themes/refract.md +101 -0
  172. package/sera-core/skills/hallmark/references/themes/ribbon.md +106 -0
  173. package/sera-core/skills/hallmark/references/themes/rim.md +96 -0
  174. package/sera-core/skills/hallmark/references/themes/riso.md +98 -0
  175. package/sera-core/skills/hallmark/references/themes/solstice.md +104 -0
  176. package/sera-core/skills/hallmark/references/themes/specimen.md +100 -0
  177. package/sera-core/skills/hallmark/references/themes/spore.md +104 -0
  178. package/sera-core/skills/hallmark/references/themes/sport.md +101 -0
  179. package/sera-core/skills/hallmark/references/themes/squeeze.md +99 -0
  180. package/sera-core/skills/hallmark/references/themes/sticker.md +106 -0
  181. package/sera-core/skills/hallmark/references/themes/studio.md +99 -0
  182. package/sera-core/skills/hallmark/references/themes/terminal.md +96 -0
  183. package/sera-core/skills/hallmark/references/themes/terrazzo.md +106 -0
  184. package/sera-core/skills/hallmark/references/themes/ultraviolet.md +106 -0
  185. package/sera-core/skills/hallmark/references/themes/vantage.md +99 -0
  186. package/sera-core/skills/hallmark/references/themes/vellum.md +105 -0
  187. package/sera-core/skills/hallmark/references/themes/wayfind.md +105 -0
  188. package/sera-core/skills/hallmark/references/themes/werkstatt.md +105 -0
  189. package/sera-core/skills/hallmark/scripts/capture.mjs +132 -0
  190. package/sera-core/skills/hallmark/scripts/refcheck.mjs +405 -0
  191. package/sera-core/skills/hallmark/scripts/sloplint-render.mjs +1283 -0
  192. package/sera-core/skills/hallmark/scripts/sloplint.mjs +4426 -0
  193. package/sera-core/skills/hallmark/scripts/theme.mjs +660 -0
  194. package/sera-core/skills/kurum-ici-iletisim/SKILL.md +40 -0
  195. package/sera-core/skills/launch/LICENSE +21 -0
  196. package/sera-core/skills/launch/NOTICE +5 -0
  197. package/sera-core/skills/launch/SKILL.md +385 -0
  198. package/sera-core/skills/launch/references/shipped-changes.md +84 -0
  199. package/sera-core/skills/launch/references/site-launch-qa.md +57 -0
  200. package/sera-core/skills/marka-kimligi/SKILL.md +30 -0
  201. package/sera-core/skills/mcp-yaz/SKILL.md +41 -0
  202. package/sera-core/skills/mobil-arayuz/SKILL.md +12 -0
  203. package/sera-core/skills/mvp-scoping/LICENSE +21 -0
  204. package/sera-core/skills/mvp-scoping/NOTICE +5 -0
  205. package/sera-core/skills/mvp-scoping/SKILL.md +95 -0
  206. package/sera-core/skills/ortak-yazarlik/SKILL.md +32 -0
  207. package/sera-core/skills/oyun-turleri/SKILL.md +176 -0
  208. package/sera-core/skills/paralel-sadelestirme/SKILL.md +33 -0
  209. package/sera-core/skills/phaser-core/LICENSE +201 -0
  210. package/sera-core/skills/phaser-core/NOTICE +5 -0
  211. package/sera-core/skills/phaser-core/NOTICE-UPSTREAM +15 -0
  212. package/sera-core/skills/phaser-core/SKILL.md +245 -0
  213. package/sera-core/skills/phaser-core/references/scene-flow.md +177 -0
  214. package/sera-core/skills/pitch-deck/LICENSE +21 -0
  215. package/sera-core/skills/pitch-deck/NOTICE +5 -0
  216. package/sera-core/skills/pitch-deck/SKILL.md +103 -0
  217. package/sera-core/skills/sera-3d-oyun/NOTICE +1 -0
  218. package/sera-core/skills/sera-3d-oyun/SKILL.md +12 -0
  219. package/sera-core/skills/sera-3d-oyun/sera-3d.js +3697 -0
  220. package/sera-core/skills/sera-diyagram/SKILL.md +43 -0
  221. package/sera-core/skills/sera-ofis-dosya/SKILL.md +3 -0
  222. package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-ileri.md +46 -0
  223. package/sera-core/skills/sera-ui-site/NOTICE +1 -0
  224. package/sera-core/skills/sera-ui-site/SKILL.md +10 -0
  225. package/sera-core/skills/sera-ui-site/sera-ui.js +83 -0
  226. package/sera-core/skills/sera-veri-gorsel/SKILL.md +3 -0
  227. package/sera-core/skills/sera-veri-gorsel/referanslar/palet-dogrula.mjs +80 -0
  228. package/sera-core/skills/sistem-tarama/SKILL.md +49 -0
  229. package/sera-core/skills/sistem-tarama/referanslar/komutlar.md +78 -0
  230. package/sera-core/skills/tasarim-stilleri/SKILL.md +113 -0
  231. package/sera-core/skills/teardown/LICENSE +22 -0
  232. package/sera-core/skills/teardown/NOTICE +3 -0
  233. package/sera-core/skills/teardown/SKILL.md +144 -0
  234. package/sera-core/skills/teardown/package-lock.json +545 -0
  235. package/sera-core/skills/teardown/package.json +18 -0
  236. package/sera-core/skills/teardown/paths.mjs +30 -0
  237. package/sera-core/skills/teardown/run_sfx.py +10 -0
  238. package/sera-core/skills/teardown/sfx/__init__.py +10 -0
  239. package/sera-core/skills/teardown/sfx/__main__.py +64 -0
  240. package/sera-core/skills/teardown/sfx/dsp.py +453 -0
  241. package/sera-core/skills/teardown/sfx/loudness.py +72 -0
  242. package/sera-core/skills/teardown/sfx/mix.py +111 -0
  243. package/sera-core/skills/teardown/sfx/samples/SOURCES.md +23 -0
  244. package/sera-core/skills/teardown/sfx/samples/fs-258269-mouth-pop.ogg +0 -0
  245. package/sera-core/skills/teardown/sfx/samples/fs-323432-typing.ogg +0 -0
  246. package/sera-core/skills/teardown/sfx/samples/fs-329533-room-tone-in-an-apartment-livi.ogg +0 -0
  247. package/sera-core/skills/teardown/sfx/samples/fs-329569-roomtone-bedroom-yew.ogg +0 -0
  248. package/sera-core/skills/teardown/sfx/samples/fs-339521-vhs-rewind-forward-and-eject.ogg +0 -0
  249. package/sera-core/skills/teardown/sfx/samples/fs-349504-triangle-open-04.ogg +0 -0
  250. package/sera-core/skills/teardown/sfx/samples/fs-416777-digital-typing-wav.ogg +0 -0
  251. package/sera-core/skills/teardown/sfx/samples/fs-426767-apartment-room-tone-wav.ogg +0 -0
  252. package/sera-core/skills/teardown/sfx/samples/fs-447909-keyboard-typing.ogg +0 -0
  253. package/sera-core/skills/teardown/sfx/samples/fs-447910-plop.ogg +0 -0
  254. package/sera-core/skills/teardown/sfx/samples/fs-79388-keyboard-typing-wav.ogg +0 -0
  255. package/sera-core/skills/teardown/sfx/samples/fs-824189-pop-in-sfx.ogg +0 -0
  256. package/sera-core/skills/teardown/sfx/score_kit.py +206 -0
  257. package/sera-core/skills/teardown/sfx/synth.py +294 -0
  258. package/sera-core/skills/teardown/sheet.mjs +127 -0
  259. package/sera-core/skills/teardown/sims/beats.py +212 -0
  260. package/sera-core/skills/teardown/sims/build.mjs +141 -0
  261. package/sera-core/skills/teardown/sims/capture.mjs +211 -0
  262. package/sera-core/skills/teardown/sims/cessna-film/main.js +4 -0
  263. package/sera-core/skills/teardown/sims/cessna-film/timeline.json +1 -0
  264. package/sera-core/skills/teardown/sims/cessna-live/main.js +5 -0
  265. package/sera-core/skills/teardown/sims/cessna-shared/console.js +288 -0
  266. package/sera-core/skills/teardown/sims/cessna-shared/film.js +254 -0
  267. package/sera-core/skills/teardown/sims/cessna-shared/flight.js +53 -0
  268. package/sera-core/skills/teardown/sims/cessna-shared/gear.js +364 -0
  269. package/sera-core/skills/teardown/sims/cessna-shared/live.js +351 -0
  270. package/sera-core/skills/teardown/sims/cessna-shared/score.py +41 -0
  271. package/sera-core/skills/teardown/sims/cessna-shared/stage.js +248 -0
  272. package/sera-core/skills/teardown/sims/kit/director.js +300 -0
  273. package/sera-core/skills/teardown/sims/kit/hud.js +194 -0
  274. package/sera-core/skills/teardown/sims/kit/runtime.js +168 -0
  275. package/sera-core/skills/teardown/sims/kit/stage3d.js +114 -0
  276. package/sera-core/skills/teardown/sims/kit/style.css +137 -0
  277. package/sera-core/skills/teardown/sims/kit/util.js +79 -0
  278. package/sera-core/skills/teardown/sims/kit/warm.js +66 -0
  279. package/sera-core/skills/teardown/sims/strandbeest-film/main.js +4 -0
  280. package/sera-core/skills/teardown/sims/strandbeest-film/timeline.json +1 -0
  281. package/sera-core/skills/teardown/sims/strandbeest-live/main.js +5 -0
  282. package/sera-core/skills/teardown/sims/strandbeest-shared/beast.js +419 -0
  283. package/sera-core/skills/teardown/sims/strandbeest-shared/console.js +375 -0
  284. package/sera-core/skills/teardown/sims/strandbeest-shared/film.js +352 -0
  285. package/sera-core/skills/teardown/sims/strandbeest-shared/jansen.js +67 -0
  286. package/sera-core/skills/teardown/sims/strandbeest-shared/live.js +420 -0
  287. package/sera-core/skills/teardown/sims/strandbeest-shared/score.py +85 -0
  288. package/sera-core/skills/teardown/sims/strandbeest-shared/stage.js +463 -0
  289. package/sera-core/skills/teardown/sims/v8-film/main.js +4 -0
  290. package/sera-core/skills/teardown/sims/v8-film/timeline.json +1 -0
  291. package/sera-core/skills/teardown/sims/v8-live/main.js +5 -0
  292. package/sera-core/skills/teardown/sims/v8-shared/console.js +339 -0
  293. package/sera-core/skills/teardown/sims/v8-shared/engine.js +624 -0
  294. package/sera-core/skills/teardown/sims/v8-shared/film.js +239 -0
  295. package/sera-core/skills/teardown/sims/v8-shared/kin.js +86 -0
  296. package/sera-core/skills/teardown/sims/v8-shared/live.js +374 -0
  297. package/sera-core/skills/teardown/sims/v8-shared/score.py +60 -0
  298. package/sera-core/skills/teardown/sims/v8-shared/stage.js +173 -0
  299. package/sera-core/skills/teardown/wave.mjs +67 -0
  300. package/sera-core/skills/toplu-degisiklik/SKILL.md +39 -0
  301. package/sera-core/skills/ui-ux-pro-max/LICENSE +21 -0
  302. package/sera-core/skills/ui-ux-pro-max/NOTICE +5 -0
  303. package/sera-core/skills/ui-ux-pro-max/SKILL.md +13 -0
  304. package/sera-core/skills/ui-ux-pro-max/references/pro-rules.md +117 -0
  305. package/sera-core/skills/ui-ux-pro-max/references/quick-reference.md +266 -0
  306. package/sera-core/skills/unslop/LICENSE.md +410 -0
  307. package/sera-core/skills/unslop/SKILL.md +217 -0
  308. package/sera-core/skills/unslop/references/effects.md +113 -0
  309. package/sera-core/skills/unslop/references/refs/unslop-dashboard-after.webp +0 -0
  310. package/sera-core/skills/unslop/references/refs/unslop-hero-after.webp +0 -0
  311. package/sera-core/skills/unslop/references/refs.md +16 -0
  312. package/sera-core/skills/unslop/references/rtl.md +72 -0
  313. package/sera-core/skills/unslop/references/signs.md +125 -0
  314. package/sera-core/skills/unslop/references/tokens.md +137 -0
  315. package/sera-core/skills/unslop/references/visuals.md +84 -0
  316. package/sera-core/skills/unslop/scripts/snapshot.mjs +197 -0
  317. package/sera-core/skills/uretken-sanat/SKILL.md +42 -0
  318. package/sera-core/skills/verification-before-completion/LICENSE +21 -0
  319. package/sera-core/skills/verification-before-completion/NOTICE +5 -0
  320. package/sera-core/skills/verification-before-completion/SKILL.md +120 -0
  321. package/sera-core/skills/web-yayin-listesi/SKILL.md +3 -0
  322. package/sera-core/src/app-master.ts +2 -2
  323. package/sera-core/src/app-verify.ts +33 -0
  324. package/sera-core/src/extension.ts +16 -2
  325. package/sera-core/src/generated/build-rules.ts +81 -17
  326. package/sera-core/src/generated/quality-probe.ts +2 -0
  327. package/sera-core/src/generated/zero-knowledge.ts +36 -9
  328. package/sera-core/src/image-tool.ts +12 -2
  329. package/sera-core/src/link-data-tools.ts +411 -0
  330. package/sera-core/src/skills.ts +54 -18
  331. package/sera-core/src/video-tool.ts +51 -0
  332. package/sera-core/src/zk.ts +7 -3
@@ -0,0 +1,300 @@
1
+ import {clamp01, easeOutExpo, fmt, hash, smooth} from './util.js';
2
+
3
+ /**
4
+ * The director edits a sim to the music: hard cuts between wide and tight
5
+ * shots on bar lines, punch-ins on kicks, a shake and flash on the drop,
6
+ * glitches on stage changes, and big readable story captions on the beat.
7
+ *
8
+ * Beats come from cfg.beats (sims/beats.py output, injected by capture.mjs).
9
+ * Without music it runs on a synthetic grid (cfg.director.bpm) so live pages
10
+ * still feel edited.
11
+ *
12
+ * Shots crop the 3D render (crisp re-render of a sub-rectangle) when the sim
13
+ * uses kit/stage3d; otherwise they scale the target element with CSS.
14
+ * Sims can return `foci: [{x, y}]` (screen px) in their render info: tight
15
+ * shots frame those points.
16
+ *
17
+ * Story: cfg.story = [{at | bar | drop, text, sub, kind: 'hero'|'num', hold,
18
+ * from, to, prefix, suffix, tag}]. `drop` is in bars relative to the drop,
19
+ * `bar` counts bars from the clip start, `hold` is in beats. *word* gets the
20
+ * accent box.
21
+ */
22
+ export const DIRECTOR = {
23
+ enabled: true,
24
+ bpm: 128,
25
+ drop: null,
26
+ hero: null,
27
+ // cut every N beats before / after the drop
28
+ cutBeats: [4, 2],
29
+ shots: [
30
+ {z: 1},
31
+ {z: 1.75, f: 0},
32
+ {z: 1.3, f: 1},
33
+ {z: 2.2, f: 2},
34
+ {z: 1.12, f: 0},
35
+ {z: 1.6, f: 1},
36
+ ],
37
+ punch: [0.03, 0.07],
38
+ shake: 1,
39
+ flash: 1,
40
+ glitch: 1,
41
+ target: '#gl',
42
+ };
43
+
44
+ const before = (arr, t) => {
45
+ let lo = 0;
46
+ let hi = arr.length;
47
+ while (lo < hi) {
48
+ const m = (lo + hi) >> 1;
49
+ if (arr[m] <= t) lo = m + 1;
50
+ else hi = m;
51
+ }
52
+ return lo - 1;
53
+ };
54
+
55
+ export function createDirector(app, cfg) {
56
+ const d = {...DIRECTOR, ...(cfg.director || {})};
57
+ const D = cfg.duration;
58
+ const music = cfg.beats && cfg.beats.beats && cfg.beats.beats.length > 4;
59
+ const spb = music ? 60 / cfg.beats.bpm : 60 / d.bpm;
60
+ const beats = music ? cfg.beats.beats : Array.from({length: Math.ceil(D / spb) + 8}, (_, i) => i * spb);
61
+ // pad the grid past both ends so lookups never fall off
62
+ while (beats[0] > 0) beats.unshift(beats[0] - spb);
63
+ while (beats[beats.length - 1] < D + 4 * spb) beats.push(beats[beats.length - 1] + spb);
64
+ let downs = music && cfg.beats.downbeats.length ? cfg.beats.downbeats.slice() : beats.filter((_, i) => i % 4 === 0);
65
+ while (downs[0] > 0) downs.unshift(downs[0] - 4 * spb);
66
+ while (downs[downs.length - 1] < D + 8 * spb) downs.push(downs[downs.length - 1] + 4 * spb);
67
+ const kicks = music ? cfg.beats.kicks : beats.map((b) => [b, 0.8]);
68
+ const kickT = kicks.map((k) => k[0]);
69
+ const energy = music ? cfg.beats.barEnergy : null;
70
+ const drop = (music && cfg.beats.drop) ?? d.drop ?? Math.round((0.4 * D) / (4 * spb)) * 4 * spb;
71
+ const dropBar = before(downs, drop + 0.01);
72
+
73
+ const barTime = (b) => downs[Math.max(0, Math.min(downs.length - 1, b))];
74
+
75
+ // ---- time warp: the sim's hero moment lands on the drop
76
+ const warp = (t) => {
77
+ if (d.hero == null || !d.enabled) return t;
78
+ const h = d.hero;
79
+ if (t <= drop) return (t / drop) * h;
80
+ return h + ((t - drop) / (D - drop)) * (D - h);
81
+ };
82
+
83
+ const beat = (t) => {
84
+ const sh = shotAt(t);
85
+ const bi = before(beats, t);
86
+ const b0 = beats[Math.max(0, bi)];
87
+ const b1 = beats[bi + 1] ?? b0 + spb;
88
+ const ri = before(downs, t);
89
+ const r0 = downs[Math.max(0, ri)];
90
+ const r1 = downs[ri + 1] ?? r0 + 4 * spb;
91
+ const ki = before(kickT, t);
92
+ const kick = ki >= 0 ? kicks[ki][1] * Math.exp(-(t - kicks[ki][0]) / 0.11) : 0;
93
+ const down = Math.exp(-(t - r0) / 0.18);
94
+ return {
95
+ music,
96
+ bpm: 60 / spb,
97
+ beat: bi,
98
+ beatPhase: clamp01((t - b0) / (b1 - b0)),
99
+ bar: ri,
100
+ barPhase: clamp01((t - r0) / (r1 - r0)),
101
+ kick,
102
+ down,
103
+ energy: energy ? energy[Math.max(0, Math.min(energy.length - 1, ri))] ?? 1 : 1,
104
+ drop,
105
+ sinceDrop: t - drop,
106
+ isDrop: t >= drop,
107
+ // current shot: sims may change camera angle per shot index
108
+ shot: sh.k,
109
+ shotZ: sh.shot.z || 1,
110
+ };
111
+ };
112
+
113
+ // ---- story timing
114
+ const story = (cfg.story || []).map((s, i) => {
115
+ const start = s.at ?? (s.bar != null ? barTime(s.bar) : s.drop != null ? barTime(dropBar + s.drop) : 0);
116
+ const b0 = before(beats, start + 0.02);
117
+ const hold = s.hold ?? 8;
118
+ const end = s.end ?? beats[Math.min(beats.length - 1, b0 + hold)] ?? start + hold * spb;
119
+ return {...s, i, start, end, b0};
120
+ });
121
+
122
+ // ---- DOM layers
123
+ app.insertAdjacentHTML(
124
+ 'beforeend',
125
+ `<canvas class="dir-glitch"></canvas><div class="dir-flash"></div><div class="dir-story"></div>`,
126
+ );
127
+ const gcv = app.querySelector('.dir-glitch');
128
+ const gctx = gcv.getContext('2d');
129
+ const flash = app.querySelector('.dir-flash');
130
+ const storyEl = app.querySelector('.dir-story');
131
+
132
+ let foci = [];
133
+ let crop = {z: 1, x0: 0, y0: 0};
134
+ let built = -1;
135
+ let parts = null;
136
+
137
+ const stageCuts = (cfg.stages || []).map((s) => s.at).filter((a) => a > 0.2);
138
+
139
+ const dropBeat = before(beats, drop + 0.01);
140
+ function shotAt(t) {
141
+ const bi = before(beats, t);
142
+ const isDrop = t >= drop;
143
+ const every = isDrop ? d.cutBeats[1] : d.cutBeats[0];
144
+ // the first beats of the drop always open wide
145
+ if (isDrop && bi - dropBeat < every) return {shot: d.shots[0], k: 0};
146
+ const rel = isDrop ? bi - dropBeat : bi - before(beats, 0.01);
147
+ const k = Math.floor(rel / every) + (isDrop ? 1000 : 0);
148
+ return {shot: d.shots[((k % d.shots.length) + d.shots.length) % d.shots.length], k};
149
+ }
150
+
151
+ const target = () => document.querySelector(d.target);
152
+
153
+ return {
154
+ warp,
155
+ beat,
156
+ /** Before the sim renders: set this frame's crop. */
157
+ pre(t) {
158
+ if (!d.enabled) return;
159
+ const {shot} = shotAt(t);
160
+ const b = beat(t);
161
+ const punch = 1 + (b.isDrop ? d.punch[1] : d.punch[0]) * b.kick;
162
+ const drift = 1 + 0.035 * b.barPhase;
163
+ let z = (shot.z || 1) * punch * (shot.z > 1 ? drift : 1);
164
+ const vw = innerWidth;
165
+ const vh = innerHeight;
166
+ let f = {x: vw / 2, y: vh / 2};
167
+ if (shot.z > 1 && foci.length) f = foci[(shot.f ?? 0) % foci.length];
168
+ else if (window.__STAGE) {
169
+ const vp = window.__STAGE.hudViewport();
170
+ f = {x: vw / 2, y: (vp.top + vh - vp.bottom) / 2};
171
+ }
172
+ // drop shake (decays over ~0.6 s)
173
+ const sk = d.shake * (b.sinceDrop >= 0 ? Math.exp(-b.sinceDrop / 0.25) : 0);
174
+ const sx = sk * (hash(t * 91.7) - 0.5) * 26;
175
+ const sy = sk * (hash(t * 53.3 + 7) - 0.5) * 26;
176
+ const st = window.__STAGE;
177
+ if (st) {
178
+ crop = st.setCrop(z, f.x + sx, f.y + sy);
179
+ } else {
180
+ const el = target();
181
+ if (el) {
182
+ el.style.transformOrigin = `${f.x}px ${f.y}px`;
183
+ el.style.transform = `translate(${sx}px, ${sy}px) scale(${z})`;
184
+ }
185
+ crop = {z: 1, x0: 0, y0: 0};
186
+ }
187
+ },
188
+ /** After the sim renders: remember its foci, draw overlays and the story. */
189
+ post(t, info = {}) {
190
+ if (!d.enabled) return;
191
+ if (info.foci && info.foci.length) {
192
+ // convert from this frame's cropped screen back to base screen coords
193
+ foci = info.foci.map((p) => ({x: crop.x0 + p.x / crop.z, y: crop.y0 + p.y / crop.z}));
194
+ }
195
+ const b = beat(t);
196
+ const vw = innerWidth;
197
+ const vh = innerHeight;
198
+
199
+ // flash: accent bloom on downbeats after the drop, white hit on the drop
200
+ const dropHit = b.sinceDrop >= 0 ? Math.exp(-b.sinceDrop / 0.22) : 0;
201
+ const onBar = b.isDrop ? 0.16 * b.down * b.energy : 0;
202
+ flash.style.opacity = String(d.flash * Math.min(0.85, dropHit * 0.7 + onBar));
203
+
204
+ // glitch: 3 frames around each stage change and the drop
205
+ const gl = [...stageCuts, b.drop].some((c) => t >= c - 0.03 && t < c + 0.1);
206
+ if (gcv.width !== vw || gcv.height !== vh) {
207
+ gcv.width = vw;
208
+ gcv.height = vh;
209
+ }
210
+ gctx.clearRect(0, 0, vw, vh);
211
+ const src = document.getElementById('gl');
212
+ if (gl && d.glitch && src && src.width) {
213
+ const n = 7;
214
+ for (let i = 0; i < n; i++) {
215
+ const y = Math.floor(hash(t * 13 + i) * vh);
216
+ const h = 6 + Math.floor(hash(t * 7 + i * 3) * 60);
217
+ const dx = (hash(t * 31 + i * 5) - 0.5) * 120;
218
+ const sx = src.width / vw;
219
+ gctx.globalAlpha = 0.9;
220
+ gctx.drawImage(src, 0, y * sx, src.width, h * sx, dx, y, vw, h);
221
+ }
222
+ gctx.globalAlpha = 0.25;
223
+ gctx.fillStyle = cfg.accent;
224
+ gctx.fillRect(0, Math.floor(hash(t * 3.3) * vh), vw, 3 + hash(t) * 10);
225
+ gctx.globalAlpha = 1;
226
+ }
227
+
228
+ // ---- story
229
+ const cur = story.find((s) => t >= s.start && t < s.end);
230
+ if (!cur) {
231
+ storyEl.style.opacity = '0';
232
+ return;
233
+ }
234
+ if (built !== cur.i) {
235
+ built = cur.i;
236
+ const words = (cur.text || '').split(/\s+/).filter(Boolean);
237
+ storyEl.innerHTML = `<div class="cap ${cur.kind || 'hero'}">
238
+ ${cur.tag ? `<div class="cap-tag">${cur.tag}</div>` : ''}
239
+ <div class="cap-main">${
240
+ cur.kind === 'num'
241
+ ? `<span class="w"><span class="n"></span></span>`
242
+ : (() => {
243
+ // *several words* → each word gets the accent box
244
+ let on = false;
245
+ return words
246
+ .map((w) => {
247
+ const open = w.startsWith('*');
248
+ const close = w.endsWith('*') && (w.length > 1 || on);
249
+ if (open) on = true;
250
+ const hl = on;
251
+ if (close) on = false;
252
+ return `<span class="w${hl ? ' hl' : ''}">${w.replace(/^\*|\*$/g, '')}</span>`;
253
+ })
254
+ .join(' ');
255
+ })()
256
+ }</div>
257
+ ${cur.sub ? `<div class="cap-sub"></div>` : ''}
258
+ </div>`;
259
+ parts = {
260
+ words: [...storyEl.querySelectorAll('.w')],
261
+ num: storyEl.querySelector('.n'),
262
+ sub: storyEl.querySelector('.cap-sub'),
263
+ main: storyEl.querySelector('.cap-main'),
264
+ };
265
+ }
266
+ const vp = window.__HUDVP ? window.__HUDVP() : {top: 0, bottom: 0};
267
+ storyEl.style.top = `${vp.top}px`;
268
+ storyEl.style.bottom = `${vp.bottom}px`;
269
+ storyEl.style.opacity = '1';
270
+ const ex = clamp01((t - (cur.end - 0.18)) / 0.18);
271
+ // words slam in on successive beats (half-beats if the text is long)
272
+ const step = parts.words.length > 4 ? 0.5 : 1;
273
+ let lastIn = cur.start;
274
+ parts.words.forEach((w, i) => {
275
+ const bi = cur.b0 + i * step;
276
+ const wt = Math.floor(bi) === bi ? beats[bi] : (beats[Math.floor(bi)] + beats[Math.ceil(bi)]) / 2;
277
+ const k = cur.start <= 0.001 ? 1 : clamp01((t - wt) / 0.12);
278
+ lastIn = Math.max(lastIn, wt);
279
+ const s = 1 + 0.35 * (1 - easeOutExpo(k)) + 0.03 * b.kick;
280
+ w.style.opacity = String(k > 0 ? 1 : 0);
281
+ w.style.transform = `scale(${s}) translateY(${ex * -0.25}em)`;
282
+ w.style.filter = k < 1 ? `blur(${(1 - k) * 8}px)` : 'none';
283
+ });
284
+ if (cur.kind === 'num' && parts.num) {
285
+ const roll = cur.roll ?? 6;
286
+ const k = easeOutExpo(clamp01((t - cur.start) / (roll * spb)));
287
+ const v = cur.from + (cur.to - cur.from) * k;
288
+ parts.num.textContent = `${cur.prefix ?? ''}${fmt(v, cur.decimals ?? 0)}${cur.suffix ?? ''}`;
289
+ lastIn = cur.start + roll * spb * 0.6;
290
+ }
291
+ if (parts.sub) {
292
+ const n = Math.floor(Math.max(0, t - lastIn - 0.15) / 0.022);
293
+ parts.sub.textContent = cur.sub.slice(0, n);
294
+ }
295
+ parts.main.style.opacity = String(1 - ex);
296
+ if (parts.sub) parts.sub.style.opacity = String(1 - ex);
297
+ storyEl.firstElementChild.style.transform = `translateX(${ex * (hash(t * 41) - 0.5) * 40}px)`;
298
+ },
299
+ };
300
+ }
@@ -0,0 +1,194 @@
1
+ import {clamp01, pad} from './util.js';
2
+
3
+ /**
4
+ * Instrument-style HUD: header with stage/command/clock, annotations over the
5
+ * viewport, a terminal log and a side panel (minimap + stats) at the bottom.
6
+ * Everything is derived from `t` and the config's stages, so it's deterministic.
7
+ *
8
+ * cfg.stages: [{at, name, cmd, logs: [string]}]. A log line starting with "!"
9
+ * is highlighted in the accent. {key} tokens are replaced from `facts`.
10
+ */
11
+ export function createHud(root, cfg) {
12
+ const h = cfg.hud;
13
+ root.insertAdjacentHTML(
14
+ 'beforeend',
15
+ `<div class="hud">
16
+ <div class="ann"></div>
17
+ <div class="wm"></div>
18
+ <div class="hdr">
19
+ <div class="row row1">
20
+ <div class="title"><i class="bar"></i><span class="t"></span></div>
21
+ <div class="sub"></div>
22
+ <div class="right"></div>
23
+ </div>
24
+ <div class="row row2">
25
+ <div class="stage accent"></div>
26
+ <div class="cmd"></div>
27
+ <div class="time accent"></div>
28
+ </div>
29
+ <div class="prog"><i></i></div>
30
+ </div>
31
+ <div class="bot">
32
+ <div class="term">
33
+ <div class="thead">
34
+ <span class="host accent"></span><span class="path"></span>
35
+ <span class="status accent"><i></i><span></span></span>
36
+ </div>
37
+ <div class="prompt"></div>
38
+ <div class="logs"></div>
39
+ <div class="tfoot"></div>
40
+ </div>
41
+ <div class="side">
42
+ <div class="shead accent"></div>
43
+ <canvas class="mini"></canvas>
44
+ <div class="stats"></div>
45
+ <div class="sfoot"></div>
46
+ </div>
47
+ <div class="baseline"><i></i></div>
48
+ </div>
49
+ </div>`,
50
+ );
51
+ const $ = (s) => root.querySelector(s);
52
+ const el = {
53
+ hud: $('.hud'),
54
+ ann: $('.ann'),
55
+ stage: $('.row2 .stage'),
56
+ cmd: $('.row2 .cmd'),
57
+ time: $('.row2 .time'),
58
+ prog: $('.prog i'),
59
+ prompt: $('.prompt'),
60
+ logs: $('.logs'),
61
+ tfoot: $('.tfoot'),
62
+ status: $('.thead .status span'),
63
+ stats: $('.stats'),
64
+ sfoot: $('.sfoot'),
65
+ base: $('.baseline i'),
66
+ mini: $('.mini'),
67
+ };
68
+ $('.title .t').textContent = h.title;
69
+ $('.sub').textContent = h.subtitle;
70
+ $('.right').textContent = h.right;
71
+ $('.wm').textContent = cfg.watermark;
72
+ $('.thead .host').textContent = h.host;
73
+ $('.thead .path').textContent = h.path;
74
+ $('.shead').textContent = h.sideTitle;
75
+
76
+ const stages = cfg.stages;
77
+ const D = cfg.duration;
78
+ const TYPE_CMD = 0.028;
79
+ const TYPE_LOG = 0.011;
80
+
81
+ // Log line schedule: each stage types its command, then its lines spread
82
+ // over the stage.
83
+ const lines = [];
84
+ stages.forEach((s, i) => {
85
+ const end = i + 1 < stages.length ? stages[i + 1].at : D;
86
+ const t0 = s.at + 0.25 + s.cmd.length * TYPE_CMD + 0.2;
87
+ const n = s.logs.length;
88
+ const gap = Math.min(0.8, Math.max(0.22, (end - t0 - 0.4) / Math.max(1, n)));
89
+ s.logs.forEach((text, j) => lines.push({at: t0 + j * gap, text, stage: i}));
90
+ });
91
+
92
+ const stageAt = (t) => {
93
+ let i = 0;
94
+ while (i + 1 < stages.length && stages[i + 1].at <= t) i++;
95
+ return i;
96
+ };
97
+ const fill = (text, facts) => text.replace(/\{(\w+)\}/g, (m, k) => (k in facts ? facts[k] : m));
98
+ const esc = (s) => s.replace(/&/g, '&amp;').replace(/</g, '&lt;');
99
+
100
+ let lastStats = '';
101
+ let lastLogs = '';
102
+ const annPool = [];
103
+
104
+ return {
105
+ minimap: el.mini,
106
+ stageAt,
107
+ setVisible(v) {
108
+ el.hud.classList.toggle('hidden', !v);
109
+ },
110
+ /** Viewport between header and bottom panel, in CSS px. */
111
+ viewport() {
112
+ const fs = parseFloat(getComputedStyle(document.documentElement).fontSize);
113
+ return {top: 13.4 * fs, bottom: 30.5 * fs};
114
+ },
115
+ render(t, frame, info = {}) {
116
+ const facts = {...cfg.facts, ...(info.facts || {})};
117
+ const si = stageAt(t);
118
+ const s = stages[si];
119
+ const dt = t - s.at;
120
+ const typed = Math.floor(Math.max(0, dt - 0.15) / TYPE_CMD);
121
+ const cmd = fill(s.cmd, facts);
122
+ const typing = typed < cmd.length;
123
+ const caretOn = typing || Math.floor(t * 2.4) % 2 === 0;
124
+
125
+ el.stage.textContent = `${pad(si + 1, 2)} / ${s.name}`;
126
+ el.cmd.textContent = cmd.slice(0, typed);
127
+ el.time.textContent = `${t.toFixed(2).padStart(5, '0')} / ${D}`;
128
+ el.prog.style.width = `${(clamp01(t / D) * 100).toFixed(2)}%`;
129
+ el.base.style.width = `${(clamp01(dt / ((stages[si + 1]?.at ?? D) - s.at)) * 100).toFixed(2)}%`;
130
+ el.prompt.innerHTML = `<span class="accent">&gt;</span> ${esc(cmd.slice(0, typed))}${
131
+ caretOn ? '<i class="caret"></i>' : ''
132
+ }`;
133
+
134
+ const shown = lines.filter((l) => l.at <= t);
135
+ const rows = shown.slice(-h.logRows);
136
+ const offset = shown.length - rows.length;
137
+ const html = rows
138
+ .map((l, j) => {
139
+ const full = fill(l.text, facts);
140
+ const hl = full.startsWith('!');
141
+ const text = hl ? full.slice(1) : full;
142
+ const n = Math.floor((t - l.at) / TYPE_LOG);
143
+ const isLast = j === rows.length - 1 && n < text.length;
144
+ return `<div><span class="ln">${pad(offset + j, 3)}</span><span class="${hl ? 'hl' : ''}">${esc(
145
+ text.slice(0, n),
146
+ )}</span>${isLast ? '<i class="caret"></i>' : ''}</div>`;
147
+ })
148
+ .join('');
149
+ if (html !== lastLogs) {
150
+ el.logs.innerHTML = html;
151
+ lastLogs = html;
152
+ }
153
+
154
+ el.tfoot.textContent = `frame ${pad(frame, 4)} delta ${pad((dt * 7.3) % 100, 2)} / ${s.name.toLowerCase()}`;
155
+ el.status.textContent = info.status ?? (t >= D - 0.05 ? 'DONE' : 'RUNNING');
156
+ el.sfoot.textContent = `view ${pad(si + 1, 2)} / ${pad(h.views, 2)} seed ${cfg.seed} · t+${dt.toFixed(2)}s`;
157
+
158
+ const stats = (info.stats || []).map((x) => `<div>${esc(x.label)}<b>${esc(String(x.value))}</b></div>`).join('');
159
+ if (stats !== lastStats) {
160
+ el.stats.innerHTML = stats;
161
+ lastStats = stats;
162
+ }
163
+
164
+ const anns = info.annotations || [];
165
+ while (annPool.length < anns.length) {
166
+ const d = document.createElement('div');
167
+ el.ann.appendChild(d);
168
+ annPool.push(d);
169
+ }
170
+ annPool.forEach((d, i) => {
171
+ const a = anns[i];
172
+ if (!a) {
173
+ d.style.display = 'none';
174
+ return;
175
+ }
176
+ d.style.display = '';
177
+ d.className = a.cls || '';
178
+ d.style.left = `${a.x}px`;
179
+ d.style.top = `${a.y}px`;
180
+ d.style.opacity = a.opacity ?? 1;
181
+ if (a.html !== undefined) d.innerHTML = a.html;
182
+ else d.textContent = a.text;
183
+ // keep labels inside the viewport (between header and bottom panel)
184
+ const vp = this.viewport();
185
+ const w = d.offsetWidth;
186
+ const hh = d.offsetHeight;
187
+ const x = Math.min(Math.max(a.x, 8), innerWidth - w - 40);
188
+ const y = Math.min(Math.max(a.y, vp.top + hh / 2 + 8), innerHeight - vp.bottom - hh / 2 - 8);
189
+ d.style.left = `${x}px`;
190
+ d.style.top = `${y}px`;
191
+ });
192
+ },
193
+ };
194
+ }
@@ -0,0 +1,168 @@
1
+ import {createDirector, DIRECTOR} from './director.js';
2
+ import {createHud} from './hud.js';
3
+ import {merge} from './util.js';
4
+
5
+ /** Config every sim starts from; a sim's defaults and the post config merge over it. */
6
+ export const BASE = {
7
+ duration: 30,
8
+ fps: 30,
9
+ seed: 746337560,
10
+ theme: 'dark',
11
+ accent: '#f2b632',
12
+ watermark: '',
13
+ hud: {
14
+ title: 'AGENT MESH',
15
+ subtitle: '/ SIMULATION',
16
+ right: 'VISUAL SIMULATION',
17
+ host: 'agent@local',
18
+ path: '~/session-01',
19
+ sideTitle: 'LOCAL VIEW',
20
+ logRows: 5,
21
+ views: 10,
22
+ },
23
+ stages: [{at: 0, name: 'RUN', cmd: 'run', logs: []}],
24
+ facts: {},
25
+ director: DIRECTOR,
26
+ story: [],
27
+ beats: null,
28
+ };
29
+
30
+ const fromBase64 = (s) => decodeURIComponent(escape(atob(s.replace(/-/g, '+').replace(/_/g, '/'))));
31
+
32
+ /**
33
+ * Config sources, later wins: BASE, the sim's defaults, window.__SIM_CONFIG
34
+ * (injected by the capture script), ?config=<base64 json>, and a few plain
35
+ * query params (?title= ?accent= ?seed= ?theme= ?duration=).
36
+ */
37
+ export function loadConfig(defaults) {
38
+ let cfg = merge(BASE, defaults);
39
+ if (window.__SIM_CONFIG) cfg = merge(cfg, window.__SIM_CONFIG);
40
+ const q = new URLSearchParams(location.search);
41
+ if (q.get('config')) {
42
+ try {
43
+ cfg = merge(cfg, JSON.parse(fromBase64(q.get('config'))));
44
+ } catch (e) {
45
+ console.warn('bad ?config', e);
46
+ }
47
+ }
48
+ if (q.get('title')) cfg = merge(cfg, {hud: {title: q.get('title')}});
49
+ if (q.get('accent')) cfg.accent = '#' + q.get('accent').replace('#', '');
50
+ if (q.get('seed')) cfg.seed = Number(q.get('seed'));
51
+ if (q.get('theme')) cfg.theme = q.get('theme');
52
+ if (q.get('duration')) cfg.duration = Number(q.get('duration'));
53
+ if (q.has('nodirector')) cfg.director = {...cfg.director, enabled: false};
54
+ return cfg;
55
+ }
56
+
57
+ /**
58
+ * Boots a sim. `setup({cfg, canvas, hud, capture})` returns (or resolves to)
59
+ * `{render(t) -> hudInfo, resize()}`. render must be a pure function of t.
60
+ *
61
+ * Live mode loops in real time. Keys: space pause, h hide HUD, f fullscreen,
62
+ * r restart, ←/→ seek 2 s, 1–9 jump to a stage.
63
+ * Capture mode (?capture or window.__CAPTURE) exposes window.SIM.render(t).
64
+ */
65
+ export async function runSim(defaults, setup) {
66
+ const cfg = loadConfig(defaults);
67
+ const q = new URLSearchParams(location.search);
68
+ const capture = !!window.__CAPTURE || q.has('capture');
69
+ const root = document.documentElement;
70
+ root.dataset.theme = cfg.theme;
71
+ root.style.setProperty('--accent', cfg.accent);
72
+ document.title = `${cfg.hud.title} ${cfg.hud.subtitle}`.trim();
73
+
74
+ const scale = () => {
75
+ root.style.fontSize = `${10 * Math.min(innerWidth / 1080, innerHeight / 1350)}px`;
76
+ };
77
+ scale();
78
+
79
+ const app = document.getElementById('app');
80
+ const canvas = document.createElement('canvas');
81
+ canvas.id = 'gl';
82
+ app.appendChild(canvas);
83
+ // cfg.hud.enabled === false: no instrument chrome (UI demos, infographics).
84
+ const hud =
85
+ cfg.hud.enabled === false
86
+ ? {minimap: null, stageAt: () => 0, setVisible() {}, viewport: () => ({top: 0, bottom: 0}), render() {}}
87
+ : createHud(app, cfg);
88
+
89
+ await Promise.all([
90
+ document.fonts.load('400 20px "JetBrains Mono"'),
91
+ document.fonts.load('600 20px "JetBrains Mono"'),
92
+ document.fonts.load('800 20px "Inter"'),
93
+ ]).catch(() => {});
94
+
95
+ window.__HUDVP = () => hud.viewport();
96
+ const sim = await setup({cfg, canvas, hud, capture});
97
+ if (!capture && sim.warm) await sim.warm();
98
+ const dir = createDirector(app, cfg);
99
+ // The sim and HUD run on warped time (hero lands on the drop); the
100
+ // director's cuts, punches and story run on real (music) time.
101
+ const draw = (t) => {
102
+ const tw = dir.warp(t);
103
+ dir.pre(t);
104
+ const info = sim.render(tw, dir.beat(t)) || {};
105
+ hud.render(tw, Math.round(t * cfg.fps), info);
106
+ dir.post(t, info);
107
+ };
108
+
109
+ let cur = 0;
110
+ let paused = false;
111
+ const resize = () => {
112
+ scale();
113
+ sim.resize?.();
114
+ if (paused || capture) draw(cur);
115
+ };
116
+ addEventListener('resize', resize);
117
+ resize();
118
+
119
+ window.SIM = {
120
+ cfg,
121
+ duration: cfg.duration,
122
+ fps: cfg.fps,
123
+ ready: true,
124
+ render: (t) => {
125
+ cur = t;
126
+ draw(t);
127
+ },
128
+ };
129
+ if (capture) {
130
+ draw(0);
131
+ return;
132
+ }
133
+
134
+ let start = performance.now();
135
+ const seek = (t) => {
136
+ cur = ((t % cfg.duration) + cfg.duration) % cfg.duration;
137
+ start = performance.now() - cur * 1000;
138
+ };
139
+ let hudOn = true;
140
+ addEventListener('keydown', (e) => {
141
+ if (e.key === ' ') {
142
+ paused = !paused;
143
+ if (!paused) seek(cur);
144
+ } else if (e.key === 'h') {
145
+ hudOn = !hudOn;
146
+ hud.setVisible(hudOn);
147
+ } else if (e.key === 'f') {
148
+ if (document.fullscreenElement) document.exitFullscreen();
149
+ else document.documentElement.requestFullscreen();
150
+ } else if (e.key === 'r') seek(0);
151
+ else if (e.key === 'ArrowRight') seek(cur + 2);
152
+ else if (e.key === 'ArrowLeft') seek(cur - 2);
153
+ else if (/^[1-9]$/.test(e.key) && cfg.stages[+e.key - 1]) seek(Math.max(0, cfg.stages[+e.key - 1].at));
154
+ else return;
155
+ e.preventDefault();
156
+ });
157
+ const loop = (now) => {
158
+ if (!paused) cur = Math.max(0, (now - start) / 1000) % cfg.duration;
159
+ draw(cur);
160
+ // the site page swaps its poster for the canvas on this
161
+ if (!window.SIM_SHOWN) {
162
+ window.SIM_SHOWN = true;
163
+ dispatchEvent(new Event('simframe'));
164
+ }
165
+ requestAnimationFrame(loop);
166
+ };
167
+ requestAnimationFrame(loop);
168
+ }