@litfamily/litcodex 1.0.29 → 1.0.31

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 (388) hide show
  1. package/README-Ko-KR.md +11 -11
  2. package/README.md +11 -11
  3. package/dist/install/generated-skill-payload-hashes.d.ts +191 -85
  4. package/dist/install/generated-skill-payload-hashes.js +191 -85
  5. package/dist/install/marketplace.js +10 -1
  6. package/dist/install/skill-catalog.d.ts +1 -1
  7. package/dist/install/skill-catalog.js +12 -1
  8. package/dist/install/skill-resource-hashes.d.ts +1 -1
  9. package/dist/install/skill-resource-hashes.js +1 -1
  10. package/marketplace/.agents/plugins/marketplace.json +4 -1
  11. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +14 -2
  12. package/marketplace/plugins/litcodex/assets/screenshot-lit-ignited.png +0 -0
  13. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  14. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  15. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  16. package/marketplace/plugins/litcodex/components/lit-loop/directive.md +10 -4
  17. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-adhd.md +191 -0
  18. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-handoff.md +2 -0
  19. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-hijack.md +219 -0
  20. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-recap.md +2 -0
  21. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-schematic.md +199 -0
  22. package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +2 -1
  23. package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.d.ts +10 -0
  24. package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.js +67 -0
  25. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.d.ts +1 -1
  26. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.js +128 -8
  27. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.d.ts +19 -0
  28. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.js +58 -0
  29. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +27 -0
  30. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +94 -7
  31. package/marketplace/plugins/litcodex/components/lit-loop/dist/cli.js +13 -3
  32. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +2 -0
  33. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +8 -9
  34. package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.d.ts +5 -0
  35. package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.js +23 -0
  36. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +8 -0
  37. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +118 -11
  38. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.d.ts +1 -1
  39. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.js +29 -13
  40. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.d.ts +13 -0
  41. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.js +85 -0
  42. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.d.ts +55 -0
  43. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.js +227 -0
  44. package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.d.ts +5 -1
  45. package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.js +17 -1
  46. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.d.ts +6 -0
  47. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.js +6 -0
  48. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.d.ts +1 -1
  49. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.js +25 -1
  50. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.d.ts +79 -0
  51. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.js +310 -0
  52. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +5 -1
  53. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +10 -0
  54. package/marketplace/plugins/litcodex/components/lit-loop/dist/redaction.js +18 -0
  55. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.d.ts +15 -0
  56. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.js +46 -9
  57. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.d.ts +10 -0
  58. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.js +88 -0
  59. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.d.ts +20 -0
  60. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.js +84 -0
  61. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.d.ts +6 -0
  62. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.js +41 -0
  63. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.d.ts +3 -0
  64. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.js +40 -0
  65. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.d.ts +48 -0
  66. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.js +292 -0
  67. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.d.ts +162 -0
  68. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.js +773 -0
  69. package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +44 -2
  70. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.js +1 -0
  71. package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.d.ts +6 -0
  72. package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.js +35 -0
  73. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.d.ts +3 -0
  74. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.js +15 -5
  75. package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.js +6 -0
  76. package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.d.ts +8 -0
  77. package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.js +57 -0
  78. package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.js +8 -3
  79. package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.d.ts +50 -0
  80. package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.js +178 -0
  81. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +1 -1
  82. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +31 -6
  83. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +10 -0
  84. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +11 -1
  85. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.d.ts +132 -0
  86. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.js +488 -0
  87. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  88. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  89. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/README.md +15 -21
  90. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/parse.js +49 -10
  91. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/picomatch.js +14 -2
  92. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/scan.js +30 -18
  93. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/package.json +3 -2
  94. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  95. package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.d.ts +6 -0
  96. package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.js +65 -0
  97. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  98. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  99. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  100. package/marketplace/plugins/litcodex/hooks/hooks.json +24 -0
  101. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +6 -0
  102. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/components.css +414 -0
  103. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/fonts.json +22 -0
  104. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
  105. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
  106. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
  107. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
  108. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
  109. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
  110. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
  111. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
  112. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/ui.js +228 -0
  113. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
  114. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +1 -0
  115. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/craft-floor.md +2 -2
  116. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/default-editorial-pixel.json +15 -8
  117. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/design-choice.md +19 -0
  118. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/house-styles.md +235 -0
  119. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/motion-guide.md +2 -2
  120. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/probe-and-review.md +6 -0
  121. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +2 -0
  122. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/slop-register.md +4 -4
  123. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
  124. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/lock-probe.mjs +196 -0
  125. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/page-probe.mjs +22 -4
  126. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
  127. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/probe.mjs +59 -13
  128. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/rule-data.mjs +38 -4
  129. package/marketplace/plugins/litcodex/skills/lit-adhd/SKILL.md +181 -0
  130. package/marketplace/plugins/litcodex/skills/lit-adhd/agents/openai.yaml +6 -0
  131. package/marketplace/plugins/litcodex/skills/lit-adhd/references/card-examples.md +147 -0
  132. package/marketplace/plugins/litcodex/skills/lit-adhd/references/status-taxonomy.md +37 -0
  133. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +18 -7
  134. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/style-guide.md +20 -11
  135. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
  136. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
  137. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-swimlane.md +1 -1
  138. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +1 -1
  139. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree.md +3 -3
  140. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
  141. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/verifier-guide.md +1 -0
  142. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
  143. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
  144. package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +12 -3
  145. package/marketplace/plugins/litcodex/skills/lit-docx/references/direction-step.md +6 -3
  146. package/marketplace/plugins/litcodex/skills/lit-hijack/SKILL.md +449 -0
  147. package/marketplace/plugins/litcodex/skills/lit-hijack/agents/openai.yaml +6 -0
  148. package/marketplace/plugins/litcodex/skills/lit-hijack/references/capture-and-provenance.md +100 -0
  149. package/marketplace/plugins/litcodex/skills/lit-hijack/references/clean-room-build.md +111 -0
  150. package/marketplace/plugins/litcodex/skills/lit-hijack/references/distil-and-licence.md +102 -0
  151. package/marketplace/plugins/litcodex/skills/lit-hijack/references/gap-and-port-design.md +125 -0
  152. package/marketplace/plugins/litcodex/skills/lit-hijack/references/parity-and-report.md +108 -0
  153. package/marketplace/plugins/litcodex/skills/lit-hijack/scripts/hijack.mjs +1050 -0
  154. package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +13 -4
  155. package/marketplace/plugins/litcodex/skills/lit-plan/SKILL.md +6 -0
  156. package/marketplace/plugins/litcodex/skills/lit-pptx/NOTICE +1 -0
  157. package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +35 -8
  158. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
  159. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
  160. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
  161. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/SOURCE.md +21 -0
  162. package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +5 -2
  163. package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +3 -4
  164. package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +20 -6
  165. package/marketplace/plugins/litcodex/skills/lit-pptx/references/direction-step.md +26 -8
  166. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/14-engineering-review-computational-brutalism-ko.md +173 -0
  167. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/15-launch-pitch-neo-brutalism-ko.md +154 -0
  168. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/16-design-lecture-bauhaus-ko.md +139 -0
  169. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/17-community-programme-riso-ko.md +158 -0
  170. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/18-public-data-briefing-newsroom-ko.md +179 -0
  171. package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +42 -27
  172. package/marketplace/plugins/litcodex/skills/lit-pptx/references/title-treatments.md +31 -27
  173. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/bauhaus.md +136 -0
  174. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/chalk.md +1 -1
  175. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/computational-brutalism.md +145 -0
  176. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/neo-brutalism.md +155 -0
  177. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/newsroom.md +141 -0
  178. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/riso.md +133 -0
  179. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/signal.md +1 -1
  180. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/studio.md +1 -1
  181. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +1 -1
  182. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +136 -94
  183. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +13 -1
  184. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
  185. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
  186. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-pack.js +386 -579
  187. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
  188. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
  189. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +2 -1
  190. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +7 -13
  191. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/render_pages.py +124 -0
  192. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
  193. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
  194. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
  195. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +100 -0
  196. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
  197. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
  198. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
  199. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
  200. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
  201. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
  202. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
  203. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
  204. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
  205. package/marketplace/plugins/litcodex/skills/lit-recap/SKILL.md +2 -0
  206. package/marketplace/plugins/litcodex/skills/lit-schematic/SKILL.md +198 -0
  207. package/marketplace/plugins/litcodex/skills/lit-schematic/agents/openai.yaml +6 -0
  208. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
  209. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
  210. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
  211. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
  212. package/marketplace/plugins/litcodex/skills/lit-schematic/references/cutaway-outputs.md +70 -0
  213. package/marketplace/plugins/litcodex/skills/lit-schematic/references/isometric-craft.md +101 -0
  214. package/marketplace/plugins/litcodex/skills/lit-schematic/references/journal-figures.md +72 -0
  215. package/marketplace/plugins/litcodex/skills/lit-schematic/references/kit-api.md +134 -0
  216. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pfd-and-layout.md +53 -0
  217. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-drafting.md +103 -0
  218. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-symbols.md +163 -0
  219. package/marketplace/plugins/litcodex/skills/lit-schematic/references/verification.md +100 -0
  220. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/doctor.mjs +57 -0
  221. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
  222. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/fonts.mjs +28 -0
  223. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
  224. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
  225. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
  226. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
  227. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
  228. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
  229. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/png.mjs +132 -0
  230. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
  231. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/route.mjs +218 -0
  232. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
  233. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
  234. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
  235. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/motion.mjs +129 -0
  236. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/qa.mjs +92 -0
  237. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/render.mjs +233 -0
  238. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/scaffold.mjs +60 -0
  239. package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +34 -8
  240. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +18 -14
  241. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +12 -0
  242. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/assets.mjs +388 -0
  243. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender/runner.py +221 -0
  244. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender.mjs +132 -0
  245. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/board.mjs +142 -0
  246. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +6 -0
  247. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-assets.mjs +7 -4
  248. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-capture.mjs +8 -7
  249. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-init.js +14 -2
  250. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs +38 -3
  251. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover.mjs +19 -4
  252. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +8 -8
  253. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gallery.mjs +147 -0
  254. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/house.mjs +45 -0
  255. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/image.mjs +89 -0
  256. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +58 -25
  257. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +59 -14
  258. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/safe-read.mjs +32 -0
  259. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scaffold.mjs +208 -0
  260. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/score.mjs +668 -0
  261. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/sound.mjs +174 -31
  262. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-gate.mjs +45 -3
  263. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-kit.js +99 -1
  264. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.js +8 -1
  265. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +180 -11
  266. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-render.mjs +42 -12
  267. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-worker.mjs +7 -4
  268. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +96 -10
  269. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/styles.mjs +233 -0
  270. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +291 -14
  271. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
  272. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
  273. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
  274. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
  275. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/expected.json +33 -0
  276. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
  277. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/cover.md +44 -7
  278. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/depth.md +156 -0
  279. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/design-choice.md +22 -0
  280. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +29 -7
  281. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +1 -1
  282. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/sound.md +87 -0
  283. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +19 -7
  284. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/studio.md +246 -0
  285. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +2 -2
  286. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +41 -21
  287. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/requirements-audio.txt +3 -3
  288. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +51 -4
  289. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/paper.json +185 -0
  290. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/swiss-signal.json +188 -0
  291. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/terminalcore.json +182 -0
  292. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/tidal.json +187 -0
  293. package/marketplace/plugins/litcodex/skills/litresearch/SKILL.md +7 -0
  294. package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +2 -1
  295. package/marketplace/plugins/litcodex/skills/lsp-setup/SKILL.md +2 -1
  296. package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +10 -0
  297. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/package-lock.json +3 -3
  298. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/package-lock.json +3 -3
  299. package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +7 -1
  300. package/marketplace/plugins/litcodex/skills/start-work/SKILL.md +10 -0
  301. package/node_modules/@litcodex/lit-loop/directive.md +10 -4
  302. package/node_modules/@litcodex/lit-loop/directives/lit-adhd.md +191 -0
  303. package/node_modules/@litcodex/lit-loop/directives/lit-handoff.md +2 -0
  304. package/node_modules/@litcodex/lit-loop/directives/lit-hijack.md +219 -0
  305. package/node_modules/@litcodex/lit-loop/directives/lit-recap.md +2 -0
  306. package/node_modules/@litcodex/lit-loop/directives/lit-schematic.md +199 -0
  307. package/node_modules/@litcodex/lit-loop/directives/litwork.md +2 -1
  308. package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.d.ts +10 -0
  309. package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.js +67 -0
  310. package/node_modules/@litcodex/lit-loop/dist/card-html.d.ts +1 -1
  311. package/node_modules/@litcodex/lit-loop/dist/card-html.js +128 -8
  312. package/node_modules/@litcodex/lit-loop/dist/card-looks.d.ts +19 -0
  313. package/node_modules/@litcodex/lit-loop/dist/card-looks.js +58 -0
  314. package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +27 -0
  315. package/node_modules/@litcodex/lit-loop/dist/card-status.js +94 -7
  316. package/node_modules/@litcodex/lit-loop/dist/cli.js +13 -3
  317. package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +2 -0
  318. package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +8 -9
  319. package/node_modules/@litcodex/lit-loop/dist/control-chars.d.ts +5 -0
  320. package/node_modules/@litcodex/lit-loop/dist/control-chars.js +23 -0
  321. package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +8 -0
  322. package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +118 -11
  323. package/node_modules/@litcodex/lit-loop/dist/hud.d.ts +1 -1
  324. package/node_modules/@litcodex/lit-loop/dist/hud.js +29 -13
  325. package/node_modules/@litcodex/lit-loop/dist/lane-events.d.ts +13 -0
  326. package/node_modules/@litcodex/lit-loop/dist/lane-events.js +85 -0
  327. package/node_modules/@litcodex/lit-loop/dist/lane-state.d.ts +55 -0
  328. package/node_modules/@litcodex/lit-loop/dist/lane-state.js +227 -0
  329. package/node_modules/@litcodex/lit-loop/dist/live-step.d.ts +5 -1
  330. package/node_modules/@litcodex/lit-loop/dist/live-step.js +17 -1
  331. package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +6 -0
  332. package/node_modules/@litcodex/lit-loop/dist/markers.js +6 -0
  333. package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +1 -1
  334. package/node_modules/@litcodex/lit-loop/dist/modes.js +25 -1
  335. package/node_modules/@litcodex/lit-loop/dist/motion-gate.d.ts +79 -0
  336. package/node_modules/@litcodex/lit-loop/dist/motion-gate.js +310 -0
  337. package/node_modules/@litcodex/lit-loop/dist/motion-route.js +5 -1
  338. package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +10 -0
  339. package/node_modules/@litcodex/lit-loop/dist/redaction.js +18 -0
  340. package/node_modules/@litcodex/lit-loop/dist/reentry.d.ts +15 -0
  341. package/node_modules/@litcodex/lit-loop/dist/reentry.js +46 -9
  342. package/node_modules/@litcodex/lit-loop/dist/rewind-cli.d.ts +10 -0
  343. package/node_modules/@litcodex/lit-loop/dist/rewind-cli.js +88 -0
  344. package/node_modules/@litcodex/lit-loop/dist/rewind-go.d.ts +20 -0
  345. package/node_modules/@litcodex/lit-loop/dist/rewind-go.js +84 -0
  346. package/node_modules/@litcodex/lit-loop/dist/rewind-look.d.ts +6 -0
  347. package/node_modules/@litcodex/lit-loop/dist/rewind-look.js +41 -0
  348. package/node_modules/@litcodex/lit-loop/dist/rewind-redact.d.ts +3 -0
  349. package/node_modules/@litcodex/lit-loop/dist/rewind-redact.js +40 -0
  350. package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.d.ts +48 -0
  351. package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.js +292 -0
  352. package/node_modules/@litcodex/lit-loop/dist/rewind.d.ts +162 -0
  353. package/node_modules/@litcodex/lit-loop/dist/rewind.js +773 -0
  354. package/node_modules/@litcodex/lit-loop/dist/route-heads.js +44 -2
  355. package/node_modules/@litcodex/lit-loop/dist/run-panel.js +1 -0
  356. package/node_modules/@litcodex/lit-loop/dist/schematic-route.d.ts +6 -0
  357. package/node_modules/@litcodex/lit-loop/dist/schematic-route.js +35 -0
  358. package/node_modules/@litcodex/lit-loop/dist/screen-card.d.ts +3 -0
  359. package/node_modules/@litcodex/lit-loop/dist/screen-card.js +15 -5
  360. package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +6 -0
  361. package/node_modules/@litcodex/lit-loop/dist/stack-hook.d.ts +8 -0
  362. package/node_modules/@litcodex/lit-loop/dist/stack-hook.js +57 -0
  363. package/node_modules/@litcodex/lit-loop/dist/statusline.js +8 -3
  364. package/node_modules/@litcodex/lit-loop/dist/threads.d.ts +50 -0
  365. package/node_modules/@litcodex/lit-loop/dist/threads.js +178 -0
  366. package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +1 -1
  367. package/node_modules/@litcodex/lit-loop/dist/trigger.js +31 -6
  368. package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +10 -0
  369. package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +11 -1
  370. package/node_modules/@litcodex/lit-loop/dist/workflow-stack.d.ts +132 -0
  371. package/node_modules/@litcodex/lit-loop/dist/workflow-stack.js +488 -0
  372. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  373. package/node_modules/@litcodex/lit-loop/skills/lit-adhd/SKILL.md +181 -0
  374. package/node_modules/@litcodex/lit-loop/skills/lit-hijack/SKILL.md +449 -0
  375. package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +13 -4
  376. package/node_modules/@litcodex/lit-loop/skills/lit-plan/SKILL.md +6 -0
  377. package/node_modules/@litcodex/lit-loop/skills/lit-recap/SKILL.md +2 -0
  378. package/node_modules/@litcodex/lit-loop/skills/lit-schematic/SKILL.md +198 -0
  379. package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +34 -8
  380. package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +7 -0
  381. package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +2 -1
  382. package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +7 -1
  383. package/node_modules/@litcodex/lit-loop/skills/start-work/SKILL.md +10 -0
  384. package/package.json +2 -2
  385. package/readme-assets/badge-version.svg +1 -1
  386. package/readme-assets/skills/lit-adhd.webp +0 -0
  387. package/readme-assets/skills/lit-hijack.webp +0 -0
  388. package/readme-assets/skills/lit-schematic.webp +0 -0
@@ -0,0 +1,221 @@
1
+ # lit-typographic-motion, the offline Blender rung. Blender runs this headless:
2
+ # blender -b --factory-startup -P runner.py -- --scene scene.py --out DIR --width W --height H
3
+ # --percent P --samples S --device METAL --fps F --seed N (--stills t,t,... | --frames 1-N)
4
+ # It sets Cycles up on the GPU (Metal on Apple silicon, else whatever GPU backend Blender finds, else
5
+ # the CPU; the receipt says which), runs the film's scene.py with the `lit` helpers in scope, then renders
6
+ # either one still per listed time (still-01.png ...) or the frame sequence (000001.png ...) and writes
7
+ # receipt.json: the Blender version, engine, device, samples, size and the files written.
8
+ import argparse
9
+ import json
10
+ import math
11
+ import os
12
+ import sys
13
+
14
+ import bpy
15
+ from mathutils import Vector
16
+
17
+ GPU_BACKENDS = ["METAL", "OPTIX", "CUDA", "HIP", "ONEAPI"]
18
+
19
+
20
+ def parse():
21
+ argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
22
+ parser = argparse.ArgumentParser(prog="runner.py")
23
+ parser.add_argument("--scene", required=True)
24
+ parser.add_argument("--out", required=True)
25
+ parser.add_argument("--width", type=int, required=True)
26
+ parser.add_argument("--height", type=int, required=True)
27
+ parser.add_argument("--percent", type=int, default=100)
28
+ parser.add_argument("--samples", type=int, default=128)
29
+ parser.add_argument("--device", default="METAL")
30
+ parser.add_argument("--fps", type=int, default=30)
31
+ parser.add_argument("--seed", type=int, default=0)
32
+ parser.add_argument("--stills")
33
+ parser.add_argument("--frames")
34
+ return parser.parse_args(argv)
35
+
36
+
37
+ def use_gpu(scene, wanted):
38
+ """Cycles on the wanted GPU backend when it has a device, another GPU backend next, the CPU last."""
39
+ prefs = bpy.context.preferences.addons["cycles"].preferences
40
+ for backend in [wanted] + [b for b in GPU_BACKENDS if b != wanted]:
41
+ try:
42
+ prefs.compute_device_type = backend
43
+ except TypeError:
44
+ continue
45
+ prefs.get_devices()
46
+ found = [d for d in prefs.devices if d.type == backend]
47
+ if found:
48
+ for d in prefs.devices:
49
+ d.use = d.type == backend
50
+ scene.cycles.device = "GPU"
51
+ return backend
52
+ scene.cycles.device = "CPU"
53
+ return "CPU"
54
+
55
+
56
+ class Lit:
57
+ """Helpers the scene script may use. Times are film seconds; the plate starts at frame 1."""
58
+
59
+ def __init__(self, fps):
60
+ self.fps = fps
61
+
62
+ def frame(self, t):
63
+ return int(round(t * self.fps)) + 1
64
+
65
+ def key(self, obj, prop, t, value=None, index=-1):
66
+ """Set obj.<prop> when a value is given, then keyframe it at film time t."""
67
+ if value is not None:
68
+ setattr(obj, prop, value)
69
+ obj.keyframe_insert(data_path=prop, frame=self.frame(t), index=index)
70
+
71
+ def look_at(self, obj, target):
72
+ direction = Vector(target) - obj.location
73
+ obj.rotation_euler = direction.to_track_quat("-Z", "Y").to_euler()
74
+
75
+ def rgb(self, color):
76
+ """A #RRGGBB colour in Blender's linear space; a tuple passes through."""
77
+ if not isinstance(color, str):
78
+ return tuple(color)[:3]
79
+ h = color.lstrip("#")
80
+ srgb = [int(h[i:i + 2], 16) / 255 for i in (0, 2, 4)]
81
+ return tuple(c / 12.92 if c <= 0.04045 else ((c + 0.055) / 1.055) ** 2.4 for c in srgb)
82
+
83
+ def material(self, name, color, roughness=0.4, metallic=0.0, emission=None, strength=0.0):
84
+ mat = bpy.data.materials.new(name)
85
+ mat.use_nodes = True
86
+ bsdf = mat.node_tree.nodes["Principled BSDF"]
87
+ bsdf.inputs["Base Color"].default_value = (*self.rgb(color), 1.0)
88
+ bsdf.inputs["Roughness"].default_value = roughness
89
+ bsdf.inputs["Metallic"].default_value = metallic
90
+ if emission is not None:
91
+ bsdf.inputs["Emission Color"].default_value = (*self.rgb(emission), 1.0)
92
+ bsdf.inputs["Emission Strength"].default_value = strength
93
+ return mat
94
+
95
+ def rounded_box(self, name, size, radius=0.08, segments=6, material=None, location=(0, 0, 0)):
96
+ """A box with bevelled edges that catch the light."""
97
+ bpy.ops.mesh.primitive_cube_add(size=1, location=location)
98
+ obj = bpy.context.active_object
99
+ obj.name = name
100
+ obj.scale = size
101
+ bpy.ops.object.transform_apply(scale=True)
102
+ bevel = obj.modifiers.new("bevel", "BEVEL")
103
+ bevel.width = radius
104
+ bevel.segments = segments
105
+ bevel.limit_method = "ANGLE"
106
+ bpy.ops.object.shade_smooth()
107
+ if material is not None:
108
+ obj.data.materials.append(material)
109
+ return obj
110
+
111
+ def image_card(self, name, image_path, width=1.0, location=(0, 0, 0), emission=1.0):
112
+ """A flat card that shows an image file (a fetched product asset) at its own aspect ratio."""
113
+ img = bpy.data.images.load(os.path.abspath(image_path))
114
+ w, h = img.size
115
+ bpy.ops.mesh.primitive_plane_add(size=1, location=location)
116
+ obj = bpy.context.active_object
117
+ obj.name = name
118
+ obj.scale = (width, width * h / max(w, 1), 1)
119
+ mat = bpy.data.materials.new(name)
120
+ mat.use_nodes = True
121
+ nodes = mat.node_tree.nodes
122
+ tex = nodes.new("ShaderNodeTexImage")
123
+ tex.image = img
124
+ bsdf = nodes["Principled BSDF"]
125
+ links = mat.node_tree.links
126
+ links.new(tex.outputs["Color"], bsdf.inputs["Base Color"])
127
+ links.new(tex.outputs["Color"], bsdf.inputs["Emission Color"])
128
+ links.new(tex.outputs["Alpha"], bsdf.inputs["Alpha"])
129
+ bsdf.inputs["Emission Strength"].default_value = emission
130
+ obj.data.materials.append(mat)
131
+ return obj
132
+
133
+ def area_light(self, name, location, target=(0, 0, 0), power=400.0, size=2.0, color="#FFFFFF"):
134
+ data = bpy.data.lights.new(name, "AREA")
135
+ data.energy = power
136
+ data.size = size
137
+ data.color = self.rgb(color)
138
+ obj = bpy.data.objects.new(name, data)
139
+ bpy.context.scene.collection.objects.link(obj)
140
+ obj.location = location
141
+ self.look_at(obj, target)
142
+ return obj
143
+
144
+ def camera(self, location, target=(0, 0, 0), lens=50.0, dof=None):
145
+ """The scene camera aimed at target; dof=(focus_distance, f_stop) turns depth of field on."""
146
+ data = bpy.data.cameras.new("camera")
147
+ data.lens = lens
148
+ if dof is not None:
149
+ data.dof.use_dof = True
150
+ data.dof.focus_distance, data.dof.aperture_fstop = dof
151
+ obj = bpy.data.objects.new("camera", data)
152
+ bpy.context.scene.collection.objects.link(obj)
153
+ obj.location = location
154
+ self.look_at(obj, target)
155
+ bpy.context.scene.camera = obj
156
+ return obj
157
+
158
+ def world(self, color, strength=1.0):
159
+ world = bpy.context.scene.world or bpy.data.worlds.new("world")
160
+ bpy.context.scene.world = world
161
+ world.use_nodes = True
162
+ bg = world.node_tree.nodes["Background"]
163
+ bg.inputs["Color"].default_value = (*self.rgb(color), 1.0)
164
+ bg.inputs["Strength"].default_value = strength
165
+ return world
166
+
167
+
168
+ def main():
169
+ a = parse()
170
+ os.makedirs(a.out, exist_ok=True)
171
+ bpy.ops.wm.read_factory_settings(use_empty=True)
172
+ scene = bpy.context.scene
173
+ scene.render.engine = "CYCLES"
174
+ device = use_gpu(scene, a.device)
175
+ scene.cycles.samples = a.samples
176
+ scene.cycles.seed = a.seed
177
+ scene.cycles.use_denoising = True
178
+ scene.render.resolution_x = a.width
179
+ scene.render.resolution_y = a.height
180
+ scene.render.resolution_percentage = a.percent
181
+ scene.render.fps = a.fps
182
+ scene.render.use_motion_blur = True
183
+ scene.render.image_settings.file_format = "PNG"
184
+ scene.render.image_settings.color_mode = "RGB"
185
+ scene.render.image_settings.color_depth = "8"
186
+
187
+ lit = Lit(a.fps)
188
+ with open(a.scene, encoding="utf-8") as fh:
189
+ code = compile(fh.read(), a.scene, "exec")
190
+ exec(code, {"bpy": bpy, "lit": lit, "math": math, "Vector": Vector, "__name__": "__main__", "__file__": a.scene})
191
+ if scene.camera is None:
192
+ raise SystemExit("scene.py made no camera: call lit.camera(...) or set bpy.context.scene.camera")
193
+ # The scene may raise its own settings; the command line has the last word on size and samples.
194
+ scene.cycles.samples = a.samples
195
+ scene.render.resolution_percentage = a.percent
196
+
197
+ files = []
198
+ if a.stills:
199
+ for i, t in enumerate(float(x) for x in a.stills.split(",")):
200
+ scene.frame_set(lit.frame(t))
201
+ name = "still-%02d.png" % (i + 1)
202
+ scene.render.filepath = os.path.join(a.out, name)
203
+ bpy.ops.render.render(write_still=True)
204
+ files.append(name)
205
+ else:
206
+ first, last = (int(x) for x in a.frames.split("-"))
207
+ scene.frame_start, scene.frame_end = first, last
208
+ scene.render.filepath = os.path.join(a.out, "######")
209
+ bpy.ops.render.render(animation=True)
210
+ files = ["%06d.png" % f for f in range(first, last + 1)]
211
+
212
+ receipt = {
213
+ "blender": bpy.app.version_string, "engine": "CYCLES", "device": device, "samples": a.samples,
214
+ "percent": a.percent, "width": a.width * a.percent // 100, "height": a.height * a.percent // 100,
215
+ "fps": a.fps, "files": [f for f in files if os.path.exists(os.path.join(a.out, f))],
216
+ }
217
+ with open(os.path.join(a.out, "receipt.json"), "w", encoding="utf-8") as fh:
218
+ json.dump(receipt, fh)
219
+
220
+
221
+ main()
@@ -0,0 +1,132 @@
1
+ // The offline Blender rung. A 3D film with `render3d: "blender"` writes its world as a Blender Python
2
+ // scene (<out>/stage/scene.py); `render.mjs blender` renders it headless with Cycles through the bundled
3
+ // runner: first preview stills at the beat midpoints (half size, few samples) to look at, then with
4
+ // --final the whole plate sequence in <out>/stage/plate/ with plate.json, the receipt the stage trusts.
5
+ // The stage page shows the plate through LitStage.plate() and draws its type and labels over it, so the
6
+ // page itself stays on the software rung. Without Blender the command renders nothing and names the
7
+ // fallback: the three.js world on the GPU rung (references/depth.md).
8
+ import { spawn } from "node:child_process";
9
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
10
+ import { delimiter, join } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+ import { EXIT, Exit, STAGE_FORMATS } from "./constants.mjs";
13
+ import { fnv1a32 } from "./util.mjs";
14
+
15
+ export const BLENDER = Object.freeze({
16
+ macApp: "/Applications/Blender.app/Contents/MacOS/Blender",
17
+ runner: fileURLToPath(new URL("./blender/runner.py", import.meta.url)),
18
+ plateFps: 30,
19
+ device: "METAL",
20
+ preview: Object.freeze({ percent: 50, samples: 40 }),
21
+ final: Object.freeze({ percent: 100, samples: 160 }),
22
+ });
23
+
24
+ /**
25
+ * Where Blender is: an explicit LITCODEX_BLENDER path (used only if it exists, never second-guessed),
26
+ * then the macOS app, then `blender` on PATH. Returns { path, source } or null. Nothing is assumed.
27
+ */
28
+ export function findBlender({ env = process.env, exists = existsSync, platform = process.platform } = {}) {
29
+ if (env.LITCODEX_BLENDER) return exists(env.LITCODEX_BLENDER) ? { path: env.LITCODEX_BLENDER, source: "LITCODEX_BLENDER" } : null;
30
+ if (platform === "darwin" && exists(BLENDER.macApp)) return { path: BLENDER.macApp, source: "app" };
31
+ for (const dir of String(env.PATH ?? "").split(delimiter).filter(Boolean)) {
32
+ const file = join(dir, platform === "win32" ? "blender.exe" : "blender");
33
+ if (exists(file)) return { path: file, source: "PATH" };
34
+ }
35
+ return null;
36
+ }
37
+
38
+ export const plateFrameCount = (treatment) => Math.round(treatment.durationSec * BLENDER.plateFps);
39
+
40
+ /** The film's Cycles seed: the treatment's seed (or the same derivation the stage uses), below 2^31. */
41
+ export const cyclesSeed = (treatment) => (treatment.seed ?? fnv1a32(`${treatment.request}\u0000${treatment.idea}`)) % 2147483648;
42
+
43
+ /** The headless command line: factory settings, the runner, and the runner's own arguments after `--`. */
44
+ export function blenderArgs({ treatment, scene, out, quality }) {
45
+ const q = BLENDER[quality];
46
+ if (quality !== "preview" && quality !== "final") throw new Error(`blenderArgs: quality is preview or final (got ${quality})`);
47
+ const { width, height } = STAGE_FORMATS[treatment.format];
48
+ const args = ["-b", "--factory-startup", "-P", BLENDER.runner, "--", "--scene", scene, "--out", out, "--width", String(width), "--height", String(height), "--percent", String(q.percent), "--samples", String(q.samples), "--device", BLENDER.device, "--fps", String(BLENDER.plateFps), "--seed", String(cyclesSeed(treatment))];
49
+ if (quality === "preview") args.push("--stills", treatment.beats.map((b) => +((b.t0 + b.t1) / 2).toFixed(3)).join(","));
50
+ else args.push("--frames", `1-${plateFrameCount(treatment)}`);
51
+ return args;
52
+ }
53
+
54
+ export const blenderFallback = (out) =>
55
+ [
56
+ "FALLBACK: no Blender found (LITCODEX_BLENDER, /Applications/Blender.app, blender on PATH), so nothing was rendered.",
57
+ `Set render3d to "three" in ${join(out, "treatment.json")} and build the world in three.js on the GPU rung (references/depth.md),`,
58
+ "and say in the reply that the film used the GPU rung because Blender is not installed.",
59
+ ].join("\n");
60
+
61
+ const listPngs = (dir) => (existsSync(dir) ? readdirSync(dir).filter((n) => n.endsWith(".png")).sort() : []);
62
+
63
+ function runBlender({ bin, args, dir, expected, progress }) {
64
+ return new Promise((resolve) => {
65
+ const child = spawn(bin, args, { stdio: ["ignore", "pipe", "pipe"] });
66
+ let tail = "";
67
+ const keep = (chunk) => {
68
+ tail = (tail + chunk).slice(-4000);
69
+ };
70
+ child.stdout.on("data", keep);
71
+ child.stderr.on("data", keep);
72
+ const timer = progress ? setInterval(() => progress(listPngs(dir).length, expected), 2000) : null;
73
+ child.on("close", (code) => {
74
+ if (timer) clearInterval(timer);
75
+ resolve({ code, tail });
76
+ });
77
+ child.on("error", (error) => {
78
+ if (timer) clearInterval(timer);
79
+ resolve({ code: -1, tail: error.message });
80
+ });
81
+ });
82
+ }
83
+
84
+ /**
85
+ * `render.mjs blender --out <dir> [--final]`. Preview: stills in stage/plate-preview/. Final: the plate
86
+ * sequence in stage/plate/ and plate.json listing every frame by name and size, with the device,
87
+ * samples and Blender version from the runner's receipt. Returns { code, message }.
88
+ */
89
+ export async function blenderCommand({ out, treatment, final = false, env = process.env, log = () => {}, progress = null }) {
90
+ if (treatment.render3d !== "blender") throw new Exit(EXIT.USAGE, `blender renders a treatment with render3d "blender" (this one is ${treatment.render3d ?? "three"})`);
91
+ const stageDir = join(out, "stage");
92
+ const scene = join(stageDir, "scene.py");
93
+ if (!existsSync(scene)) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${scene} is missing; write the Blender scene first (references/depth.md, the Blender rung)`);
94
+ const found = findBlender({ env });
95
+ if (!found) return { code: EXIT.OK, fallback: true, message: blenderFallback(out) };
96
+ const quality = final ? "final" : "preview";
97
+ const dir = join(stageDir, final ? "plate" : "plate-preview");
98
+ rmSync(dir, { recursive: true, force: true });
99
+ mkdirSync(dir, { recursive: true });
100
+ const args = blenderArgs({ treatment, scene, out: dir, quality });
101
+ const expected = final ? plateFrameCount(treatment) : treatment.beats.length;
102
+ log(`blender ${quality}: ${found.path} (${found.source}), ${expected} ${final ? "frames" : "stills"}`);
103
+ const run = await runBlender({ bin: found.path, args, dir, expected, progress });
104
+ const receiptFile = join(dir, "receipt.json");
105
+ if (run.code !== 0 || !existsSync(receiptFile)) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: Blender ${quality} failed (exit ${run.code}); fix stage/scene.py and run it again. Last output: ${run.tail.trim().split("\n").slice(-8).join(" | ")}`);
106
+ const receipt = JSON.parse(readFileSync(receiptFile, "utf8"));
107
+ const frames = receipt.files.map((name) => ({ name, bytes: statSync(join(dir, name)).size }));
108
+ if (frames.length !== expected) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: Blender wrote ${frames.length} of ${expected} ${final ? "frames" : "stills"}`);
109
+ const plate = { kind: quality, blender: receipt.blender, engine: receipt.engine, device: receipt.device, samples: receipt.samples, percent: receipt.percent, fps: BLENDER.plateFps, frames };
110
+ writeFileSync(join(dir, "plate.json"), `${JSON.stringify(plate, null, 1)}\n`);
111
+ const label = `Blender ${receipt.blender}, ${receipt.engine} ${receipt.device}, ${receipt.samples} spp at ${receipt.percent} %`;
112
+ if (!final) return { code: EXIT.OK, message: `BLENDER preview: ${frames.length} stills at the beat midpoints in ${dir} (${label}). Open them, fix scene.py, then render the plate: blender --out ${out} --final` };
113
+ return { code: EXIT.OK, message: `BLENDER plate: ${frames.length} frames at ${BLENDER.plateFps} fps in ${dir} (${label}). Show it with LitStage.plate() under the type, then render the stage: stage --out ${out} --round N` };
114
+ }
115
+
116
+ /** The plate a stage dir carries: { dir, frames, device, ... } when plate.json lists frames that are all there as listed, else null. */
117
+ export function readPlate(stageDir, sub = "plate") {
118
+ const file = join(stageDir, sub, "plate.json");
119
+ if (!existsSync(file)) return null;
120
+ let plate;
121
+ try {
122
+ plate = JSON.parse(readFileSync(file, "utf8"));
123
+ } catch {
124
+ return null;
125
+ }
126
+ if (!Array.isArray(plate.frames)) return null;
127
+ const ok = plate.frames.every((f) => {
128
+ const p = join(stageDir, sub, String(f.name));
129
+ return /^[A-Za-z0-9._-]+$/u.test(String(f.name)) && existsSync(p) && statSync(p).size === f.bytes;
130
+ });
131
+ return ok ? { ...plate, dir: sub } : null;
132
+ }
@@ -0,0 +1,142 @@
1
+ // The storyboard: `stills/board.png`, one page a person can read before the full render. One keyframe
2
+ // per shot (the beat still), with the shot's number, time, layout, hand-off and hero move under it and
3
+ // the shot's type zone outlined on the frame; a header with the house style (name, palette, type) and the
4
+ // film's format, length and sound; a footer with the layout check. It is drawn as a page in the same
5
+ // headless Chrome the stage uses, so its type is the product's own faces.
6
+ import { createHash } from "node:crypto";
7
+ import { copyFileSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ import { capture, closeStage, openStage, stepFrame } from "./stage.mjs";
10
+ import { LAYOUTS, readStyle } from "./styles.mjs";
11
+
12
+ export const BOARD = Object.freeze({ width: 1920, height: 1080, margin: 48, gap: 20, header: 150, footer: 56, caption: 104 });
13
+
14
+ const esc = (text) => String(text ?? "").replace(/[&<>"]/gu, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]);
15
+ const secs = (v) => `${Number(v).toFixed(1)}`;
16
+ const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
17
+
18
+ /** Tile geometry: columns, thumbnail size, for n shots of a film of size width x height. */
19
+ export function boardGrid(n, width, height) {
20
+ const usableW = BOARD.width - 2 * BOARD.margin;
21
+ const usableH = BOARD.height - BOARD.header - BOARD.footer - BOARD.margin;
22
+ const aspect = width / height;
23
+ const options = [];
24
+ for (let cols = 1; cols <= Math.max(1, n); cols++) {
25
+ const rows = Math.ceil(n / cols);
26
+ const tw = Math.floor((usableW - (cols - 1) * BOARD.gap) / cols);
27
+ const byHeight = Math.floor((usableH - (rows - 1) * BOARD.gap) / rows) - BOARD.caption;
28
+ const th = Math.min(Math.round(tw / aspect), byHeight);
29
+ if (th <= 0) continue;
30
+ options.push({ cols, rows, tw: Math.round(th * aspect), th, empty: rows * cols - n });
31
+ }
32
+ // The largest tiles, unless a grid with fewer empty slots keeps 85 % of their area.
33
+ const largest = Math.max(...options.map((o) => o.tw * o.th));
34
+ return options.filter((o) => o.tw * o.th >= 0.85 * largest).sort((a, b) => a.empty - b.empty || b.tw * b.th - a.tw * a.th)[0];
35
+ }
36
+
37
+ /** The board page's HTML for a treatment and its beat stills (file names relative to the page). */
38
+ export function boardHtml({ treatment, stills, check = null }) {
39
+ const style = treatment.style ? readStyle(treatment.style) : null;
40
+ const [width, height] = treatment.format === "9:16" ? [1080, 1920] : [1920, 1080];
41
+ const grid = boardGrid(stills.length, width, height);
42
+ const zones = LAYOUTS[treatment.format === "9:16" ? "9:16" : "16:9"];
43
+ const pal = style?.palette ?? {};
44
+ const chips = Object.entries(pal)
45
+ .filter(([k]) => ["ground", "ink", "muted", "signal", "accent"].includes(k))
46
+ .map(([k, v]) => `<span class="chip"><i style="background:${esc(v)}"></i>${esc(k)} ${esc(v)}</span>`)
47
+ .join("");
48
+ const tiles = stills
49
+ .map((file, i) => {
50
+ const b = treatment.beats[i] ?? {};
51
+ const z = b.layout && zones[b.layout]?.type;
52
+ const guide = z ? `<b class="zone" style="left:${(z[0] * 100).toFixed(2)}%;top:${(z[1] * 100).toFixed(2)}%;width:${(z[2] * 100).toFixed(2)}%;height:${(z[3] * 100).toFixed(2)}%"></b>` : "";
53
+ const meta = [String(i + 1).padStart(2, "0"), `${secs(b.t0)}–${secs(b.t1)} s`, b.layout, b.transition && b.transition !== "end" ? `→ ${b.transition}` : b.transition]
54
+ .filter(Boolean)
55
+ .map(esc)
56
+ .join(" · ");
57
+ return `<figure style="width:${grid.tw}px"><div class="frame" style="width:${grid.tw}px;height:${grid.th}px"><img src="${esc(file)}">${guide}</div><figcaption><span class="meta">${meta}</span><span class="hero">${esc(b.hero ?? b.onScreen ?? "")}</span></figcaption></figure>`;
58
+ })
59
+ .join("");
60
+ const failed = (check?.rules ?? []).filter((x) => x.status === "FAIL");
61
+ const verdict = !check ? "layout check: not run on this render" : failed.length ? `layout check: FAIL — ${failed.map((x) => x.id).join(", ")}` : "layout check: PASS";
62
+ const sound =
63
+ treatment.sound?.mode === "generated" && treatment.sound.palette
64
+ ? `${treatment.sound.palette}, ${treatment.sound.key}, ${treatment.sound.tempo} BPM`
65
+ : treatment.sound?.mode === "score"
66
+ ? `score (${treatment.sound.genre ?? (style ? style.score.genre : "house")})`
67
+ : (treatment.sound?.mode ?? "none");
68
+ const ground = pal.ground ?? "#101216";
69
+ return `<!doctype html>
70
+ <meta charset="utf-8">
71
+ <link rel="stylesheet" href="/lit/fonts.css">
72
+ <script src="/lit/stage-kit.js"></script>
73
+ <style>
74
+ html, body { margin: 0; width: ${BOARD.width}px; height: ${BOARD.height}px; overflow: hidden; background: #15171b; color: #e8e9e6; font-family: "Pretendard"; }
75
+ header { position: absolute; left: ${BOARD.margin}px; right: ${BOARD.margin}px; top: 36px; height: ${BOARD.header - 48}px; display: flex; justify-content: space-between; align-items: flex-start; }
76
+ h1 { margin: 0; font: 700 40px/1.1 "Pretendard"; }
77
+ .sub { margin-top: 10px; font: 400 20px/1.3 "JetBrains Mono"; color: #a8aba6; }
78
+ .style { text-align: right; }
79
+ .specimen { display: inline-block; padding: 6px 14px; margin-bottom: 10px; background: ${esc(ground)}; color: ${esc(pal.ink ?? "#fff")}; font: ${style?.faces.display.weight ?? 700} 34px/1.1 "${esc(style?.faces.display.family ?? "Pretendard")}", "Pretendard"; }
80
+ .chips { display: flex; gap: 14px; justify-content: flex-end; font: 400 16px/1 "JetBrains Mono"; color: #a8aba6; }
81
+ .chip i { display: inline-block; width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; border: 1px solid #555; }
82
+ main { position: absolute; left: ${BOARD.margin}px; right: ${BOARD.margin}px; top: ${BOARD.header}px; display: flex; flex-wrap: wrap; gap: ${BOARD.gap}px; }
83
+ figure { margin: 0; }
84
+ .frame { position: relative; overflow: hidden; background: #000; }
85
+ .frame img { display: block; width: 100%; height: 100%; }
86
+ .zone { position: absolute; box-sizing: border-box; border: 2px dashed rgba(255, 196, 0, 0.75); }
87
+ figcaption { display: block; height: ${BOARD.caption - 8}px; padding-top: 8px; overflow: hidden; }
88
+ .meta { display: block; font: 400 16px/1.3 "JetBrains Mono"; color: #c9cbc6; }
89
+ .hero { display: block; margin-top: 4px; font: 400 18px/1.35 "Pretendard"; color: #e8e9e6; }
90
+ footer { position: absolute; left: ${BOARD.margin}px; right: ${BOARD.margin}px; bottom: 18px; font: 400 18px/1.2 "JetBrains Mono"; color: ${failed.length ? "#ff8a7a" : "#9fd3a4"}; }
91
+ </style>
92
+ <body>
93
+ <header>
94
+ <div><h1>Storyboard · ${esc(treatment.subject?.name ?? "")}</h1>
95
+ <div class="sub">${esc(treatment.format)} · ${esc(treatment.durationSec)} s · ${treatment.beats.length} shots · ${esc(treatment.path)} path · sound: ${esc(sound)}</div></div>
96
+ <div class="style"><div class="specimen">${esc(style?.name ?? treatment.style ?? "")} Aa 가</div><div class="chips">${chips}</div></div>
97
+ </header>
98
+ <main>${tiles}</main>
99
+ <footer>${esc(verdict)} · dashed box: the shot's type zone</footer>
100
+ <script>LitStage.define({ width: ${BOARD.width}, height: ${BOARD.height}, fps: 30, duration: 1, render() {} });</script>
101
+ </body>
102
+ `;
103
+ }
104
+
105
+ /**
106
+ * Render `<out>/stills/board.png` from the beat stills already written and list it in the stills
107
+ * manifest. `check` is the layout check ({ rules }) when one ran. Returns { file, manifestSha256 }.
108
+ */
109
+ export async function writeBoard({ outDir, treatment, beatFiles, check = null, runtime, fonts }) {
110
+ const dir = join(outDir, ".run", "board");
111
+ rmSync(dir, { recursive: true, force: true });
112
+ mkdirSync(dir, { recursive: true });
113
+ const names = beatFiles.map((f, i) => {
114
+ const name = `s${String(i + 1).padStart(2, "0")}.png`;
115
+ copyFileSync(f, join(dir, name));
116
+ return name;
117
+ });
118
+ writeFileSync(join(dir, "index.html"), boardHtml({ treatment, stills: names, check }));
119
+ const scan = { root: dir, files: [], rasters: names.map((n) => `/${n}`), plate: null };
120
+ const session = await openStage({ runtime, outDir, scan, fonts, width: BOARD.width, height: BOARD.height, fps: 30, seed: 1 });
121
+ try {
122
+ await stepFrame(session, 0, true);
123
+ const png = await capture(session, BOARD.width, BOARD.height);
124
+ const file = join(outDir, "stills", "board.png");
125
+ writeFileSync(file, png);
126
+ return { file, manifestSha256: addToManifest(outDir, { file: "board.png", kind: "board" }) };
127
+ } finally {
128
+ await closeStage(session);
129
+ rmSync(dir, { recursive: true, force: true });
130
+ }
131
+ }
132
+
133
+ /** List a file the renderer wrote after the stills set in `stills/manifest.json`; returns the new manifest SHA-256. */
134
+ export function addToManifest(outDir, entry) {
135
+ const manifestFile = join(outDir, "stills", "manifest.json");
136
+ const manifest = JSON.parse(readFileSync(manifestFile, "utf8"));
137
+ const bytes = readFileSync(join(outDir, "stills", entry.file));
138
+ manifest.files = [...manifest.files.filter((f) => f.file !== entry.file), { ...entry, sha256: sha256(bytes) }];
139
+ const text = `${JSON.stringify(manifest, null, 2)}\n`;
140
+ writeFileSync(manifestFile, text);
141
+ return sha256(text);
142
+ }
@@ -300,3 +300,9 @@ export const COVER = Object.freeze({
300
300
  }),
301
301
  encode: Object.freeze({ q: 86, edgeQ: 97, edgeFrames: 15, method: 4 }),
302
302
  });
303
+
304
+ // The studio layer (references/studio.md): the genres a film's own score can take, and the sounds an
305
+ // on-screen event can make (treatment `sound.events`). One list each, read by the treatment validator,
306
+ // the score and the sound builder.
307
+ export const SCORE_GENRES = Object.freeze(["house", "tech-house", "deep-house", "garage"]);
308
+ export const EVENT_SOUNDS = Object.freeze(["tap", "hit", "whoosh", "chime"]);
@@ -1,5 +1,5 @@
1
1
  // Cover assets. Every raster a cover page can load (base art, logo, wordmark, texture) is listed in
2
- // `<out>/assets.json` with its path, role, source (user or generated) and SHA-256, and the renderer
2
+ // `<out>/assets.json` with its path, role, source (user, fetched or generated) and SHA-256, and the renderer
3
3
  // checks the list before the first capture. A listed file that is missing stops the run as
4
4
  // BLOCKED_ASSET_MISSING (exit 22): the art is supplied or generated, never replaced by a drawn
5
5
  // stand-in, and the painted-light recipe cannot run without its base art. After the render, frame 0
@@ -13,6 +13,7 @@ import { COVER, EXIT, Exit } from "./constants.mjs";
13
13
  import { readPngRgba } from "./cover-gate.mjs";
14
14
  import { crop, lanczosResize, ssim } from "./cover-image.mjs";
15
15
  import { which } from "./runtime.mjs";
16
+ import { readBoundedText } from "./safe-read.mjs";
16
17
  import { rasterInfo } from "./stage.mjs";
17
18
 
18
19
  export const ASSETS_FILE = "assets.json";
@@ -29,7 +30,7 @@ function entry(raw, i, coverDir) {
29
30
  if (!raw || typeof raw !== "object") throw invalid(at, "must be an object");
30
31
  if (typeof raw.path !== "string" || !raw.path.startsWith(`${coverDir}/`) || raw.path.split("/").includes("..")) throw invalid(`${at}.path`, `must be a path inside ${coverDir}/, relative to the output directory`);
31
32
  if (!ASSET_ROLES.includes(raw.role)) throw invalid(`${at}.role`, `must be one of ${ASSET_ROLES.join(", ")}`);
32
- if (!["user", "generated"].includes(raw.source)) throw invalid(`${at}.source`, "must be user (supplied) or generated (made for this cover)");
33
+ if (!["user", "fetched", "generated"].includes(raw.source)) throw invalid(`${at}.source`, "must be user (supplied), fetched (by `render.mjs assets --cover`) or generated (made for this cover)");
33
34
  if (!/^[0-9a-f]{64}$/u.test(raw.sha256 ?? "")) throw invalid(`${at}.sha256`, "must be the file's SHA-256 (64 hex digits)");
34
35
  if ("box" in raw && !isBox(raw.box)) throw invalid(`${at}.box`, "must be [x, y, w, h] as fractions of the cover, inside it");
35
36
  if (raw.role === "base-art" && !raw.box) throw invalid(`${at}.box`, "base art needs the box it fills on the cover");
@@ -66,7 +67,9 @@ export function checkAssets({ outDir, treatment, files, coverDir = "cover" }) {
66
67
  if (sha256(readFileSync(path)) !== asset.sha256) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${asset.path} no longer matches its sha256 in assets.json; list it again after changing it`);
67
68
  }
68
69
  }
69
- if (treatment.recipe === "painted-light" && !assets.some((a) => a.role === "base-art")) throw new Exit(EXIT.BLOCKED_ASSET_MISSING, "BLOCKED_ASSET_MISSING: the painted-light recipe needs its base art listed in assets.json ({ path, role: base-art, source, sha256, box }); supply or generate the painting, never draw a stand-in");
70
+ // The painted recipe relights a painting the user supplied. Without one the cover takes hero-3d (or
71
+ // weight-tide, orbit-loop) instead of a stand-in painting drawn for the occasion.
72
+ if (treatment.recipe === "painted-light" && !assets.some((a) => a.role === "base-art" && a.source === "user")) throw new Exit(EXIT.BLOCKED_ASSET_MISSING, "BLOCKED_ASSET_MISSING: the painted-light recipe needs its base art listed in assets.json ({ path, role: base-art, source: user, sha256, box }): a painting the user supplied; without one, take hero-3d (or weight-tide, orbit-loop), never draw or generate a stand-in");
70
73
  const listed = new Set(assets.map((a) => a.path));
71
74
  for (const f of files.filter((f) => RASTERS.has(extname(f.rel).toLowerCase()))) {
72
75
  const rel = `${coverDir}/${f.rel.split(sep).join("/")}`;
@@ -105,7 +108,7 @@ export function artCheck({ frame0, width, height, art, box, checkBox = null }) {
105
108
  /** The reply labels a generated asset needs; `completion` prints them for the finished cover. */
106
109
  export function generatedLabels(outDir) {
107
110
  try {
108
- const doc = JSON.parse(readFileSync(join(outDir, ASSETS_FILE), "utf8"));
111
+ const doc = JSON.parse(readBoundedText(join(outDir, ASSETS_FILE)));
109
112
  return (doc.assets ?? []).filter((a) => a?.source === "generated" && typeof a.path === "string").map((a) => `the ${String(a.role ?? "asset").replace("-", " ")} ${a.path} is generated, not supplied: label it as generated in the reply`);
110
113
  } catch {
111
114
  return [];
@@ -1,4 +1,4 @@
1
- // Cover capture, the browser side. One headless Chrome per pass on the stage path's software rung, its
1
+ // Cover capture, the browser side. One headless Chrome per pass on the stage path's software rung (the GPU rung for a 3D hero), its
2
2
  // viewport the cover page's CSS size at device scale 2, the cover folder served on the synthetic
3
3
  // stage origin (kit, loop kit, faces, nothing else), and the cover init script injected before any page
4
4
  // script. The renderer SEEKS: it calls window.renderFrame(t, { mask }) for any t in [0, 1) in any
@@ -12,17 +12,18 @@ import { EXIT, Exit, STAGE_ORIGIN } from "./constants.mjs";
12
12
  import { launchCover } from "./driver.mjs";
13
13
  import { SKILL_ROOT } from "./fonts.mjs";
14
14
  import { firstLine } from "./runtime.mjs";
15
- import { stageRouter } from "./stage.mjs";
15
+ import { probeGpu, stageRouter } from "./stage.mjs";
16
16
 
17
17
  const COVER_INIT = () => readFileSync(join(SKILL_ROOT, "engine", "cover-init.js"), "utf8");
18
18
  const pause = (ms) => new Promise((done) => setTimeout(done, ms));
19
19
 
20
20
  export class CoverSession {
21
21
  /** Open the cover page and wait until it sets window.ready and defines window.renderFrame. */
22
- static async open({ runtime, scan, fonts, width, height, scale, profileDir, env = process.env }) {
23
- const { context, page } = await launchCover({ runtime, width, height, scale, profileDir, env });
24
- const session = new CoverSession({ context, page, width, height, scale, profileDir });
22
+ static async open({ runtime, scan, fonts, width, height, scale, profileDir, rung = "software", env = process.env }) {
23
+ const { context, page } = await launchCover({ runtime, width, height, scale, profileDir, rung, env });
24
+ const session = new CoverSession({ context, page, width, height, scale, profileDir, rung });
25
25
  try {
26
+ if (rung === "gpu") await probeGpu(session);
26
27
  await context.route("**/*", stageRouter({ root: scan.root, fonts, record: session.record }));
27
28
  await context.addInitScript({ content: COVER_INIT() });
28
29
  page.on("pageerror", (error) => session.record.pageErrors.push(firstLine(error.message)));
@@ -36,8 +37,8 @@ export class CoverSession {
36
37
  }
37
38
  }
38
39
 
39
- constructor({ context, page, width, height, scale, profileDir }) {
40
- Object.assign(this, { context, page, width, height, scale, profileDir });
40
+ constructor({ context, page, width, height, scale, profileDir, rung = "software" }) {
41
+ Object.assign(this, { context, page, width, height, scale, profileDir, rung });
41
42
  this.record = { blocked: [], rejected: [], missing: [], pageErrors: [] };
42
43
  }
43
44
 
@@ -1,6 +1,7 @@
1
1
  // Cover init script. Injected before any page script in every cover document. A cover frame is a pure
2
2
  // function of loop time t, and the renderer seeks frames in any order and in fresh browsers, so every
3
- // clock and every unseeded entropy source a page could read throws instead of answering. Each call is
3
+ // clock and every unseeded entropy source a page could read throws instead of answering (Math.random
4
+ // answers from a fixed seed only while the page builds, before window.ready). Each call is
4
5
  // recorded by name, so the renderer can name it (exit 18) even when the page swallowed the error. CSS
5
6
  // animations and transitions would run on the browser's own clock, so they are switched off.
6
7
  (function litCoverInit() {
@@ -15,7 +16,18 @@
15
16
  const fromT = "draw every frame from t";
16
17
  const ownLoop = "the renderer calls renderFrame(t); never run your own loop";
17
18
 
18
- w.Math.random = refuse("Math.random", "use LitLoop.rng(seed) for layout and t for motion");
19
+ // Building a scene before window.ready may draw ids from Math.random (three.js names every object it
20
+ // makes): that phase gets a fixed-seed sequence, the same in every browser. Once the page is ready,
21
+ // frames are drawn in any order, so a call then is misuse.
22
+ const refusedRandom = refuse("Math.random", "use LitLoop.rng(seed) for layout and t for motion");
23
+ let seed = 0x9e3779b9;
24
+ w.Math.random = function random() {
25
+ if (w.ready === true) return refusedRandom();
26
+ seed = (seed + 0x6d2b79f5) | 0;
27
+ let x = Math.imul(seed ^ (seed >>> 15), 1 | seed);
28
+ x = (x + Math.imul(x ^ (x >>> 7), 61 | x)) ^ x;
29
+ return ((x ^ (x >>> 14)) >>> 0) / 4294967296;
30
+ };
19
31
  const NativeDate = w.Date;
20
32
  function CoverDate(...args) {
21
33
  if (!new.target || args.length === 0) return refuse("Date", fromT)();