@litfamily/litopencode 1.0.7 → 1.0.9

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 (723) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README-Ko-KR.md +314 -31
  3. package/README.md +312 -29
  4. package/dist/activation-primary-prompts.d.ts +1 -0
  5. package/dist/activation-primary-prompts.js +16 -0
  6. package/dist/activation-probe.js +4 -1
  7. package/dist/activation-prompt-utils.d.ts +1 -1
  8. package/dist/activation-routing.d.ts +6 -1
  9. package/dist/activation-routing.js +174 -16
  10. package/dist/activation-workflow-prompts.d.ts +1 -1
  11. package/dist/activation-workflow-prompts.js +18 -17
  12. package/dist/activation.d.ts +3 -2
  13. package/dist/activation.js +6 -6
  14. package/dist/agents/defaults.js +14 -6
  15. package/dist/cli/command-aliases.js +24 -22
  16. package/dist/cli/doctor.js +3 -0
  17. package/dist/cli/install-report.d.ts +1 -0
  18. package/dist/cli/install-report.js +4 -0
  19. package/dist/cli/install.js +7 -4
  20. package/dist/cli/managed-skill-assets.d.ts +1 -1
  21. package/dist/cli/managed-skill-assets.js +15 -5
  22. package/dist/cli/motion-runtime.d.ts +6 -0
  23. package/dist/cli/motion-runtime.js +46 -0
  24. package/dist/cli/native-skill-install.js +32 -9
  25. package/dist/cli/native-skill-integrity.js +1 -0
  26. package/dist/cli/native-skills.d.ts +2 -0
  27. package/dist/cli/native-skills.js +2 -1
  28. package/dist/cli/office-dependencies.d.ts +14 -0
  29. package/dist/cli/office-dependencies.js +24 -0
  30. package/dist/cli.js +13 -3
  31. package/dist/commands.d.ts +2 -11
  32. package/dist/commands.js +9 -17
  33. package/dist/deliverable-hedge-guard.d.ts +20 -21
  34. package/dist/deliverable-hedge-guard.js +234 -275
  35. package/dist/features.d.ts +81 -2
  36. package/dist/features.js +80 -13
  37. package/dist/hooks.d.ts +3 -2
  38. package/dist/hooks.js +4 -4
  39. package/dist/ignition.d.ts +1 -1
  40. package/dist/ignition.js +15 -4
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +1 -1
  43. package/dist/interface-handoff.d.ts +1 -0
  44. package/dist/interface-handoff.js +1 -0
  45. package/dist/motion-image-reads.d.ts +6 -0
  46. package/dist/motion-image-reads.js +46 -0
  47. package/dist/server.js +13 -11
  48. package/dist/skill-renames.d.ts +4 -2
  49. package/dist/skill-renames.js +12 -4
  50. package/dist/skills.d.ts +31 -3
  51. package/dist/skills.js +53 -9
  52. package/dist/tools.js +4 -4
  53. package/docs/ab/S11/baseline-desktop.webp +0 -0
  54. package/docs/ab/S11/baseline-phone.webp +0 -0
  55. package/docs/ab/S11/lit-desktop.webp +0 -0
  56. package/docs/ab/S11/lit-phone.webp +0 -0
  57. package/docs/ab/S3/baseline-desktop.webp +0 -0
  58. package/docs/ab/S3/baseline-phone.webp +0 -0
  59. package/docs/ab/S3/lit-desktop.webp +0 -0
  60. package/docs/ab/S3/lit-phone.webp +0 -0
  61. package/docs/ab/S4/baseline-desktop.webp +0 -0
  62. package/docs/ab/S4/baseline-phone.webp +0 -0
  63. package/docs/ab/S4/lit-desktop.webp +0 -0
  64. package/docs/ab/S4/lit-phone.webp +0 -0
  65. package/docs/ab/S5/lit-slides.webp +0 -0
  66. package/docs/ab/S7/lit-diagram.webp +0 -0
  67. package/docs/ab/S8/baseline-slides.webp +0 -0
  68. package/docs/ab/S8/lit-slides.webp +0 -0
  69. package/docs/ab/S9/lit-pages.webp +0 -0
  70. package/docs/assets/cover-motion-still.webp +0 -0
  71. package/docs/assets/cover-motion.webp +0 -0
  72. package/docs/assets/readme/badge-version.svg +1 -1
  73. package/docs/assets/skills/autoconference.webp +0 -0
  74. package/docs/assets/skills/automatic-guards.webp +0 -0
  75. package/docs/assets/skills/autoresearch.webp +0 -0
  76. package/docs/assets/skills/browser-drive.webp +0 -0
  77. package/docs/assets/skills/debugging.webp +0 -0
  78. package/docs/assets/skills/deep-interview.webp +0 -0
  79. package/docs/assets/skills/doctor-installer.webp +0 -0
  80. package/docs/assets/skills/durable-litgoal.webp +0 -0
  81. package/docs/assets/skills/frontend-ui-ux.webp +0 -0
  82. package/docs/assets/skills/lit-burnoff-file.webp +0 -0
  83. package/docs/assets/skills/lit-burnoff.webp +0 -0
  84. package/docs/assets/skills/lit-code.webp +0 -0
  85. package/docs/assets/skills/lit-commit.webp +0 -0
  86. package/docs/assets/skills/lit-comprehend.webp +0 -0
  87. package/docs/assets/skills/lit-crucible.webp +0 -0
  88. package/docs/assets/skills/lit-diagram-drawer.webp +0 -0
  89. package/docs/assets/skills/lit-docx.webp +0 -0
  90. package/docs/assets/skills/lit-fetch.webp +0 -0
  91. package/docs/assets/skills/lit-handoff.webp +0 -0
  92. package/docs/assets/skills/lit-humanizer.webp +0 -0
  93. package/docs/assets/skills/lit-init.webp +0 -0
  94. package/docs/assets/skills/lit-plan.webp +0 -0
  95. package/docs/assets/skills/lit-pptx.webp +0 -0
  96. package/docs/assets/skills/lit-recap.webp +0 -0
  97. package/docs/assets/skills/lit-scientific-visualization.webp +0 -0
  98. package/docs/assets/skills/lit-typographic-motion.webp +0 -0
  99. package/docs/assets/skills/litresearch.webp +0 -0
  100. package/docs/assets/skills/litwork.webp +0 -0
  101. package/docs/assets/skills/lsp-setup.webp +0 -0
  102. package/docs/assets/skills/lsp.webp +0 -0
  103. package/docs/assets/skills/readme-studio.webp +0 -0
  104. package/docs/assets/skills/refactor.webp +0 -0
  105. package/docs/assets/skills/review-work.webp +0 -0
  106. package/docs/assets/skills/rules.webp +0 -0
  107. package/docs/assets/skills/start-work.webp +0 -0
  108. package/docs/assets/skills/structural-search.webp +0 -0
  109. package/docs/assets/skills/visual-qa.webp +0 -0
  110. package/docs/assets/skills/wikify.webp +0 -0
  111. package/docs/reference-Ko-KR.md +5 -1
  112. package/docs/reference.md +6 -2
  113. package/package.json +1 -1
  114. package/rules/bundled-rules/lit-humanizer.md +12 -0
  115. package/skills/autoconference/SKILL.md +1 -1
  116. package/skills/autoconference/assets/report_template.md +1 -1
  117. package/skills/autoresearch/references/type-checklists.md +1 -1
  118. package/skills/browser-drive/SKILL.md +19 -5
  119. package/skills/browser-drive/scripts/capability-probe.mjs +26 -5
  120. package/skills/frontend-ui-ux/SKILL.md +10 -15
  121. package/skills/frontend-ui-ux/data/THIRD-PARTY-NOTICE.txt +10 -0
  122. package/skills/frontend-ui-ux/references/adaptive-layout.md +3 -11
  123. package/skills/frontend-ui-ux/references/brand-and-imagery.md +6 -11
  124. package/skills/frontend-ui-ux/references/complete-contract.md +10 -3
  125. package/skills/frontend-ui-ux/references/composition.md +1 -7
  126. package/skills/frontend-ui-ux/references/craft-floor.md +94 -0
  127. package/skills/frontend-ui-ux/references/creative-directions.md +1 -7
  128. package/skills/frontend-ui-ux/references/evidence-review.md +2 -12
  129. package/skills/frontend-ui-ux/references/implementation-platforms.md +1 -4
  130. package/skills/frontend-ui-ux/references/inclusive-interface.md +1 -3
  131. package/skills/frontend-ui-ux/references/interaction-motion.md +1 -7
  132. package/skills/frontend-ui-ux/references/motion-guide.md +125 -0
  133. package/skills/frontend-ui-ux/references/operating-lanes.md +2 -8
  134. package/skills/frontend-ui-ux/references/product-direction.md +1 -6
  135. package/skills/frontend-ui-ux/references/production.md +12 -5
  136. package/skills/frontend-ui-ux/references/redesign-playbook.md +1 -7
  137. package/skills/frontend-ui-ux/references/slop-register.md +103 -0
  138. package/skills/frontend-ui-ux/references/system-foundations.md +1 -8
  139. package/skills/frontend-ui-ux/references/taste-direction.md +4 -11
  140. package/skills/frontend-ui-ux/references/visual-language.md +1 -6
  141. package/skills/frontend-ui-ux/references/visual-reconstruction.md +2 -7
  142. package/skills/frontend-ui-ux/scripts/probe-page.mjs +326 -0
  143. package/skills/frontend-ui-ux/scripts/probe-server.mjs +24 -0
  144. package/skills/frontend-ui-ux/scripts/probe-static.mjs +42 -0
  145. package/skills/frontend-ui-ux/scripts/probe-thresholds.json +86 -0
  146. package/skills/frontend-ui-ux/scripts/probe.mjs +183 -0
  147. package/skills/lit-comprehend/SKILL.md +10 -11
  148. package/skills/lit-comprehend/references/artifact-template.md +2 -18
  149. package/skills/lit-comprehend/scripts/verify-explainer.ts +0 -14
  150. package/skills/lit-diagram-drawer/NOTICE.md +33 -0
  151. package/skills/lit-diagram-drawer/SKILL.md +101 -0
  152. package/skills/lit-diagram-drawer/assets/examples/type-architecture-dark.html +1 -0
  153. package/skills/lit-diagram-drawer/assets/examples/type-architecture-full.html +1 -0
  154. package/skills/lit-diagram-drawer/assets/examples/type-architecture-light.html +1 -0
  155. package/skills/lit-diagram-drawer/assets/examples/type-bar-dark.html +1 -0
  156. package/skills/lit-diagram-drawer/assets/examples/type-bar-full.html +1 -0
  157. package/skills/lit-diagram-drawer/assets/examples/type-bar-light.html +1 -0
  158. package/skills/lit-diagram-drawer/assets/examples/type-beeswarm-dark.html +1 -0
  159. package/skills/lit-diagram-drawer/assets/examples/type-beeswarm-full.html +1 -0
  160. package/skills/lit-diagram-drawer/assets/examples/type-beeswarm-light.html +1 -0
  161. package/skills/lit-diagram-drawer/assets/examples/type-bubble-dark.html +1 -0
  162. package/skills/lit-diagram-drawer/assets/examples/type-bubble-full.html +1 -0
  163. package/skills/lit-diagram-drawer/assets/examples/type-bubble-light.html +1 -0
  164. package/skills/lit-diagram-drawer/assets/examples/type-bump-dark.html +1 -0
  165. package/skills/lit-diagram-drawer/assets/examples/type-bump-full.html +1 -0
  166. package/skills/lit-diagram-drawer/assets/examples/type-bump-light.html +1 -0
  167. package/skills/lit-diagram-drawer/assets/examples/type-data-flow-dark.html +1 -0
  168. package/skills/lit-diagram-drawer/assets/examples/type-data-flow-full.html +1 -0
  169. package/skills/lit-diagram-drawer/assets/examples/type-data-flow-light.html +1 -0
  170. package/skills/lit-diagram-drawer/assets/examples/type-datalake-dark.html +1 -0
  171. package/skills/lit-diagram-drawer/assets/examples/type-datalake-full.html +1 -0
  172. package/skills/lit-diagram-drawer/assets/examples/type-datalake-light.html +1 -0
  173. package/skills/lit-diagram-drawer/assets/examples/type-db-schema-dark.html +1 -0
  174. package/skills/lit-diagram-drawer/assets/examples/type-db-schema-full.html +1 -0
  175. package/skills/lit-diagram-drawer/assets/examples/type-db-schema-light.html +1 -0
  176. package/skills/lit-diagram-drawer/assets/examples/type-dependency-dark.html +1 -0
  177. package/skills/lit-diagram-drawer/assets/examples/type-dependency-full.html +1 -0
  178. package/skills/lit-diagram-drawer/assets/examples/type-dependency-light.html +1 -0
  179. package/skills/lit-diagram-drawer/assets/examples/type-deployment-dark.html +1 -0
  180. package/skills/lit-diagram-drawer/assets/examples/type-deployment-full.html +1 -0
  181. package/skills/lit-diagram-drawer/assets/examples/type-deployment-light.html +1 -0
  182. package/skills/lit-diagram-drawer/assets/examples/type-dp-integration-dark.html +1 -0
  183. package/skills/lit-diagram-drawer/assets/examples/type-dp-integration-full.html +1 -0
  184. package/skills/lit-diagram-drawer/assets/examples/type-dp-integration-light.html +1 -0
  185. package/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-dark.html +1 -0
  186. package/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-full.html +1 -0
  187. package/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-light.html +1 -0
  188. package/skills/lit-diagram-drawer/assets/examples/type-er-dark.html +1 -0
  189. package/skills/lit-diagram-drawer/assets/examples/type-er-full.html +1 -0
  190. package/skills/lit-diagram-drawer/assets/examples/type-er-light.html +1 -0
  191. package/skills/lit-diagram-drawer/assets/examples/type-fishbone-dark.html +1 -0
  192. package/skills/lit-diagram-drawer/assets/examples/type-fishbone-full.html +1 -0
  193. package/skills/lit-diagram-drawer/assets/examples/type-fishbone-light.html +1 -0
  194. package/skills/lit-diagram-drawer/assets/examples/type-flowchart-dark.html +1 -0
  195. package/skills/lit-diagram-drawer/assets/examples/type-flowchart-full.html +1 -0
  196. package/skills/lit-diagram-drawer/assets/examples/type-flowchart-light.html +1 -0
  197. package/skills/lit-diagram-drawer/assets/examples/type-gantt-dark.html +1 -0
  198. package/skills/lit-diagram-drawer/assets/examples/type-gantt-full.html +1 -0
  199. package/skills/lit-diagram-drawer/assets/examples/type-gantt-light.html +1 -0
  200. package/skills/lit-diagram-drawer/assets/examples/type-heatmap-dark.html +1 -0
  201. package/skills/lit-diagram-drawer/assets/examples/type-heatmap-full.html +1 -0
  202. package/skills/lit-diagram-drawer/assets/examples/type-heatmap-light.html +1 -0
  203. package/skills/lit-diagram-drawer/assets/examples/type-high-level-dark.html +1 -0
  204. package/skills/lit-diagram-drawer/assets/examples/type-high-level-full.html +1 -0
  205. package/skills/lit-diagram-drawer/assets/examples/type-high-level-light.html +1 -0
  206. package/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-dark.html +1 -0
  207. package/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-full.html +1 -0
  208. package/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-light.html +1 -0
  209. package/skills/lit-diagram-drawer/assets/examples/type-import-drawio-dark.html +1 -0
  210. package/skills/lit-diagram-drawer/assets/examples/type-import-drawio-full.html +1 -0
  211. package/skills/lit-diagram-drawer/assets/examples/type-import-drawio-light.html +1 -0
  212. package/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-dark.html +1 -0
  213. package/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-full.html +1 -0
  214. package/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-light.html +1 -0
  215. package/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-dark.html +1 -0
  216. package/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-full.html +1 -0
  217. package/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-light.html +1 -0
  218. package/skills/lit-diagram-drawer/assets/examples/type-it-state-dark.html +1 -0
  219. package/skills/lit-diagram-drawer/assets/examples/type-it-state-full.html +1 -0
  220. package/skills/lit-diagram-drawer/assets/examples/type-it-state-light.html +1 -0
  221. package/skills/lit-diagram-drawer/assets/examples/type-journey-dark.html +1 -0
  222. package/skills/lit-diagram-drawer/assets/examples/type-journey-full.html +1 -0
  223. package/skills/lit-diagram-drawer/assets/examples/type-journey-light.html +1 -0
  224. package/skills/lit-diagram-drawer/assets/examples/type-kanban-dark.html +1 -0
  225. package/skills/lit-diagram-drawer/assets/examples/type-kanban-full.html +1 -0
  226. package/skills/lit-diagram-drawer/assets/examples/type-kanban-light.html +1 -0
  227. package/skills/lit-diagram-drawer/assets/examples/type-layers-dark.html +1 -0
  228. package/skills/lit-diagram-drawer/assets/examples/type-layers-full.html +1 -0
  229. package/skills/lit-diagram-drawer/assets/examples/type-layers-light.html +1 -0
  230. package/skills/lit-diagram-drawer/assets/examples/type-line-dark.html +1 -0
  231. package/skills/lit-diagram-drawer/assets/examples/type-line-full.html +1 -0
  232. package/skills/lit-diagram-drawer/assets/examples/type-line-light.html +1 -0
  233. package/skills/lit-diagram-drawer/assets/examples/type-loop-dark.html +1 -0
  234. package/skills/lit-diagram-drawer/assets/examples/type-loop-full.html +1 -0
  235. package/skills/lit-diagram-drawer/assets/examples/type-loop-light.html +1 -0
  236. package/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-dark.html +1 -0
  237. package/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-full.html +1 -0
  238. package/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-light.html +1 -0
  239. package/skills/lit-diagram-drawer/assets/examples/type-marimekko-dark.html +1 -0
  240. package/skills/lit-diagram-drawer/assets/examples/type-marimekko-full.html +1 -0
  241. package/skills/lit-diagram-drawer/assets/examples/type-marimekko-light.html +1 -0
  242. package/skills/lit-diagram-drawer/assets/examples/type-medallion-dark.html +1 -0
  243. package/skills/lit-diagram-drawer/assets/examples/type-medallion-full.html +1 -0
  244. package/skills/lit-diagram-drawer/assets/examples/type-medallion-light.html +1 -0
  245. package/skills/lit-diagram-drawer/assets/examples/type-nested-dark.html +1 -0
  246. package/skills/lit-diagram-drawer/assets/examples/type-nested-full.html +1 -0
  247. package/skills/lit-diagram-drawer/assets/examples/type-nested-light.html +1 -0
  248. package/skills/lit-diagram-drawer/assets/examples/type-org-chart-dark.html +1 -0
  249. package/skills/lit-diagram-drawer/assets/examples/type-org-chart-full.html +1 -0
  250. package/skills/lit-diagram-drawer/assets/examples/type-org-chart-light.html +1 -0
  251. package/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-dark.html +1 -0
  252. package/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-full.html +1 -0
  253. package/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-light.html +1 -0
  254. package/skills/lit-diagram-drawer/assets/examples/type-polar-dark.html +1 -0
  255. package/skills/lit-diagram-drawer/assets/examples/type-polar-full.html +1 -0
  256. package/skills/lit-diagram-drawer/assets/examples/type-polar-light.html +1 -0
  257. package/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-dark.html +1 -0
  258. package/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-full.html +1 -0
  259. package/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-light.html +1 -0
  260. package/skills/lit-diagram-drawer/assets/examples/type-process-dark.html +1 -0
  261. package/skills/lit-diagram-drawer/assets/examples/type-process-full.html +1 -0
  262. package/skills/lit-diagram-drawer/assets/examples/type-process-light.html +1 -0
  263. package/skills/lit-diagram-drawer/assets/examples/type-pyramid-dark.html +1 -0
  264. package/skills/lit-diagram-drawer/assets/examples/type-pyramid-full.html +1 -0
  265. package/skills/lit-diagram-drawer/assets/examples/type-pyramid-light.html +1 -0
  266. package/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-dark.html +1 -0
  267. package/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-full.html +1 -0
  268. package/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-light.html +1 -0
  269. package/skills/lit-diagram-drawer/assets/examples/type-quadrant-dark.html +1 -0
  270. package/skills/lit-diagram-drawer/assets/examples/type-quadrant-full.html +1 -0
  271. package/skills/lit-diagram-drawer/assets/examples/type-quadrant-light.html +1 -0
  272. package/skills/lit-diagram-drawer/assets/examples/type-queue-animated-dark.html +1 -0
  273. package/skills/lit-diagram-drawer/assets/examples/type-queue-animated-full.html +1 -0
  274. package/skills/lit-diagram-drawer/assets/examples/type-queue-animated-light.html +1 -0
  275. package/skills/lit-diagram-drawer/assets/examples/type-radar-dark.html +1 -0
  276. package/skills/lit-diagram-drawer/assets/examples/type-radar-full.html +1 -0
  277. package/skills/lit-diagram-drawer/assets/examples/type-radar-light.html +1 -0
  278. package/skills/lit-diagram-drawer/assets/examples/type-ridgeline-dark.html +1 -0
  279. package/skills/lit-diagram-drawer/assets/examples/type-ridgeline-full.html +1 -0
  280. package/skills/lit-diagram-drawer/assets/examples/type-ridgeline-light.html +1 -0
  281. package/skills/lit-diagram-drawer/assets/examples/type-sankey-dark.html +1 -0
  282. package/skills/lit-diagram-drawer/assets/examples/type-sankey-full.html +1 -0
  283. package/skills/lit-diagram-drawer/assets/examples/type-sankey-light.html +1 -0
  284. package/skills/lit-diagram-drawer/assets/examples/type-scatter-dark.html +1 -0
  285. package/skills/lit-diagram-drawer/assets/examples/type-scatter-full.html +1 -0
  286. package/skills/lit-diagram-drawer/assets/examples/type-scatter-light.html +1 -0
  287. package/skills/lit-diagram-drawer/assets/examples/type-sequence-dark.html +1 -0
  288. package/skills/lit-diagram-drawer/assets/examples/type-sequence-full.html +1 -0
  289. package/skills/lit-diagram-drawer/assets/examples/type-sequence-light.html +1 -0
  290. package/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-dark.html +1 -0
  291. package/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-full.html +1 -0
  292. package/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-light.html +1 -0
  293. package/skills/lit-diagram-drawer/assets/examples/type-slopegraph-dark.html +1 -0
  294. package/skills/lit-diagram-drawer/assets/examples/type-slopegraph-full.html +1 -0
  295. package/skills/lit-diagram-drawer/assets/examples/type-slopegraph-light.html +1 -0
  296. package/skills/lit-diagram-drawer/assets/examples/type-state-dark.html +1 -0
  297. package/skills/lit-diagram-drawer/assets/examples/type-state-full.html +1 -0
  298. package/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-dark.html +1 -0
  299. package/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-full.html +1 -0
  300. package/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-light.html +1 -0
  301. package/skills/lit-diagram-drawer/assets/examples/type-state-light.html +1 -0
  302. package/skills/lit-diagram-drawer/assets/examples/type-story-map-dark.html +1 -0
  303. package/skills/lit-diagram-drawer/assets/examples/type-story-map-full.html +1 -0
  304. package/skills/lit-diagram-drawer/assets/examples/type-story-map-light.html +1 -0
  305. package/skills/lit-diagram-drawer/assets/examples/type-streamgraph-dark.html +1 -0
  306. package/skills/lit-diagram-drawer/assets/examples/type-streamgraph-full.html +1 -0
  307. package/skills/lit-diagram-drawer/assets/examples/type-streamgraph-light.html +1 -0
  308. package/skills/lit-diagram-drawer/assets/examples/type-swimlane-dark.html +1 -0
  309. package/skills/lit-diagram-drawer/assets/examples/type-swimlane-full.html +1 -0
  310. package/skills/lit-diagram-drawer/assets/examples/type-swimlane-light.html +1 -0
  311. package/skills/lit-diagram-drawer/assets/examples/type-timeline-dark.html +1 -0
  312. package/skills/lit-diagram-drawer/assets/examples/type-timeline-full.html +1 -0
  313. package/skills/lit-diagram-drawer/assets/examples/type-timeline-light.html +1 -0
  314. package/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-dark.html +1 -0
  315. package/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-full.html +1 -0
  316. package/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-light.html +1 -0
  317. package/skills/lit-diagram-drawer/assets/examples/type-tree-dark.html +1 -0
  318. package/skills/lit-diagram-drawer/assets/examples/type-tree-full.html +1 -0
  319. package/skills/lit-diagram-drawer/assets/examples/type-tree-light.html +1 -0
  320. package/skills/lit-diagram-drawer/assets/examples/type-treemap-dark.html +1 -0
  321. package/skills/lit-diagram-drawer/assets/examples/type-treemap-full.html +1 -0
  322. package/skills/lit-diagram-drawer/assets/examples/type-treemap-light.html +1 -0
  323. package/skills/lit-diagram-drawer/assets/examples/type-uml-class-dark.html +1 -0
  324. package/skills/lit-diagram-drawer/assets/examples/type-uml-class-full.html +1 -0
  325. package/skills/lit-diagram-drawer/assets/examples/type-uml-class-light.html +1 -0
  326. package/skills/lit-diagram-drawer/assets/examples/type-venn-dark.html +1 -0
  327. package/skills/lit-diagram-drawer/assets/examples/type-venn-full.html +1 -0
  328. package/skills/lit-diagram-drawer/assets/examples/type-venn-light.html +1 -0
  329. package/skills/lit-diagram-drawer/assets/examples/type-wardley-dark.html +1 -0
  330. package/skills/lit-diagram-drawer/assets/examples/type-wardley-full.html +1 -0
  331. package/skills/lit-diagram-drawer/assets/examples/type-wardley-light.html +1 -0
  332. package/skills/lit-diagram-drawer/assets/examples/type-waterfall-dark.html +1 -0
  333. package/skills/lit-diagram-drawer/assets/examples/type-waterfall-full.html +1 -0
  334. package/skills/lit-diagram-drawer/assets/examples/type-waterfall-light.html +1 -0
  335. package/skills/lit-diagram-drawer/assets/fonts/OFL.txt +94 -0
  336. package/skills/lit-diagram-drawer/assets/fonts/PretendardVariable.woff2 +0 -0
  337. package/skills/lit-diagram-drawer/assets/fonts/provenance.json +23 -0
  338. package/skills/lit-diagram-drawer/assets/icons.html +231 -0
  339. package/skills/lit-diagram-drawer/assets/licenses/devicon-MIT.txt +20 -0
  340. package/skills/lit-diagram-drawer/assets/licenses/diagram-design-MIT.txt +21 -0
  341. package/skills/lit-diagram-drawer/assets/licenses/log-z-MIT.txt +21 -0
  342. package/skills/lit-diagram-drawer/assets/licenses/simple-icons-CC0.md +30 -0
  343. package/skills/lit-diagram-drawer/assets/licenses/tabler-MIT.txt +21 -0
  344. package/skills/lit-diagram-drawer/examples/01-service-architecture/after.html +1 -0
  345. package/skills/lit-diagram-drawer/examples/01-service-architecture/brief.md +33 -0
  346. package/skills/lit-diagram-drawer/examples/02-release-decision/after.html +1 -0
  347. package/skills/lit-diagram-drawer/examples/02-release-decision/brief.md +18 -0
  348. package/skills/lit-diagram-drawer/examples/03-data-retention/after.html +1 -0
  349. package/skills/lit-diagram-drawer/examples/03-data-retention/brief.md +19 -0
  350. package/skills/lit-diagram-drawer/examples/04-oauth-sequence/after.html +1 -0
  351. package/skills/lit-diagram-drawer/examples/04-oauth-sequence/brief.md +17 -0
  352. package/skills/lit-diagram-drawer/examples/05-review-lanes/after.html +1 -0
  353. package/skills/lit-diagram-drawer/examples/05-review-lanes/brief.md +17 -0
  354. package/skills/lit-diagram-drawer/examples/06-rollout-gates/after.html +1 -0
  355. package/skills/lit-diagram-drawer/examples/06-rollout-gates/brief.md +17 -0
  356. package/skills/lit-diagram-drawer/examples/07-deployment-boundary/after.html +1 -0
  357. package/skills/lit-diagram-drawer/examples/07-deployment-boundary/brief.md +19 -0
  358. package/skills/lit-diagram-drawer/examples/08-policy-traces/after.html +1 -0
  359. package/skills/lit-diagram-drawer/examples/08-policy-traces/brief.md +20 -0
  360. package/skills/lit-diagram-drawer/references/accessibility.md +37 -0
  361. package/skills/lit-diagram-drawer/references/export.md +17 -0
  362. package/skills/lit-diagram-drawer/references/import-drawio.md +13 -0
  363. package/skills/lit-diagram-drawer/references/import-excalidraw.md +11 -0
  364. package/skills/lit-diagram-drawer/references/import-mermaid.md +12 -0
  365. package/skills/lit-diagram-drawer/references/import-schema.md +28 -0
  366. package/skills/lit-diagram-drawer/references/korean-typography.md +34 -0
  367. package/skills/lit-diagram-drawer/references/motion.md +29 -0
  368. package/skills/lit-diagram-drawer/references/office-pptx-docx.md +28 -0
  369. package/skills/lit-diagram-drawer/references/output-spec.md +48 -0
  370. package/skills/lit-diagram-drawer/references/primitive-annotation.md +12 -0
  371. package/skills/lit-diagram-drawer/references/primitive-icons.md +21 -0
  372. package/skills/lit-diagram-drawer/references/primitive-sketchy.md +11 -0
  373. package/skills/lit-diagram-drawer/references/primitive-terminal.md +11 -0
  374. package/skills/lit-diagram-drawer/references/profiles.md +24 -0
  375. package/skills/lit-diagram-drawer/references/semantic-patterns.md +27 -0
  376. package/skills/lit-diagram-drawer/references/style-guide.md +67 -0
  377. package/skills/lit-diagram-drawer/references/type-architecture.md +51 -0
  378. package/skills/lit-diagram-drawer/references/type-bar.md +51 -0
  379. package/skills/lit-diagram-drawer/references/type-beeswarm.md +49 -0
  380. package/skills/lit-diagram-drawer/references/type-bubble.md +49 -0
  381. package/skills/lit-diagram-drawer/references/type-bump.md +49 -0
  382. package/skills/lit-diagram-drawer/references/type-catalog.json +1433 -0
  383. package/skills/lit-diagram-drawer/references/type-data-flow.md +51 -0
  384. package/skills/lit-diagram-drawer/references/type-datalake.md +49 -0
  385. package/skills/lit-diagram-drawer/references/type-db-schema.md +49 -0
  386. package/skills/lit-diagram-drawer/references/type-dependency.md +49 -0
  387. package/skills/lit-diagram-drawer/references/type-deployment.md +49 -0
  388. package/skills/lit-diagram-drawer/references/type-dp-integration.md +49 -0
  389. package/skills/lit-diagram-drawer/references/type-dp-security-matrix.md +49 -0
  390. package/skills/lit-diagram-drawer/references/type-er.md +49 -0
  391. package/skills/lit-diagram-drawer/references/type-fishbone.md +49 -0
  392. package/skills/lit-diagram-drawer/references/type-flowchart.md +49 -0
  393. package/skills/lit-diagram-drawer/references/type-gantt.md +49 -0
  394. package/skills/lit-diagram-drawer/references/type-heatmap.md +53 -0
  395. package/skills/lit-diagram-drawer/references/type-high-level-vertical.md +53 -0
  396. package/skills/lit-diagram-drawer/references/type-high-level.md +53 -0
  397. package/skills/lit-diagram-drawer/references/type-import-drawio.md +53 -0
  398. package/skills/lit-diagram-drawer/references/type-import-excalidraw.md +53 -0
  399. package/skills/lit-diagram-drawer/references/type-import-mermaid.md +53 -0
  400. package/skills/lit-diagram-drawer/references/type-it-state.md +54 -0
  401. package/skills/lit-diagram-drawer/references/type-journey.md +54 -0
  402. package/skills/lit-diagram-drawer/references/type-kanban.md +54 -0
  403. package/skills/lit-diagram-drawer/references/type-layers.md +54 -0
  404. package/skills/lit-diagram-drawer/references/type-line.md +54 -0
  405. package/skills/lit-diagram-drawer/references/type-loop-terminal.md +53 -0
  406. package/skills/lit-diagram-drawer/references/type-loop.md +54 -0
  407. package/skills/lit-diagram-drawer/references/type-marimekko.md +54 -0
  408. package/skills/lit-diagram-drawer/references/type-medallion.md +54 -0
  409. package/skills/lit-diagram-drawer/references/type-nested.md +59 -0
  410. package/skills/lit-diagram-drawer/references/type-org-chart.md +58 -0
  411. package/skills/lit-diagram-drawer/references/type-paved-road-animated.md +72 -0
  412. package/skills/lit-diagram-drawer/references/type-polar.md +67 -0
  413. package/skills/lit-diagram-drawer/references/type-policy-trace-animated.md +69 -0
  414. package/skills/lit-diagram-drawer/references/type-process.md +58 -0
  415. package/skills/lit-diagram-drawer/references/type-pyramid.md +59 -0
  416. package/skills/lit-diagram-drawer/references/type-quadrant-consultant.md +60 -0
  417. package/skills/lit-diagram-drawer/references/type-quadrant.md +57 -0
  418. package/skills/lit-diagram-drawer/references/type-queue-animated.md +63 -0
  419. package/skills/lit-diagram-drawer/references/type-radar.md +57 -0
  420. package/skills/lit-diagram-drawer/references/type-ridgeline.md +63 -0
  421. package/skills/lit-diagram-drawer/references/type-sankey.md +68 -0
  422. package/skills/lit-diagram-drawer/references/type-scatter.md +60 -0
  423. package/skills/lit-diagram-drawer/references/type-sequence-oauth.md +66 -0
  424. package/skills/lit-diagram-drawer/references/type-sequence.md +63 -0
  425. package/skills/lit-diagram-drawer/references/type-slopegraph.md +65 -0
  426. package/skills/lit-diagram-drawer/references/type-state-lifecycle.md +53 -0
  427. package/skills/lit-diagram-drawer/references/type-state.md +59 -0
  428. package/skills/lit-diagram-drawer/references/type-story-map.md +52 -0
  429. package/skills/lit-diagram-drawer/references/type-streamgraph.md +53 -0
  430. package/skills/lit-diagram-drawer/references/type-swimlane.md +52 -0
  431. package/skills/lit-diagram-drawer/references/type-timeline.md +52 -0
  432. package/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +57 -0
  433. package/skills/lit-diagram-drawer/references/type-tree.md +54 -0
  434. package/skills/lit-diagram-drawer/references/type-treemap.md +54 -0
  435. package/skills/lit-diagram-drawer/references/type-uml-class.md +52 -0
  436. package/skills/lit-diagram-drawer/references/type-venn.md +51 -0
  437. package/skills/lit-diagram-drawer/references/type-wardley.md +52 -0
  438. package/skills/lit-diagram-drawer/references/type-waterfall.md +54 -0
  439. package/skills/lit-diagram-drawer/references/verifier-guide.md +59 -0
  440. package/skills/lit-diagram-drawer/scripts/block-registry.mjs +43 -0
  441. package/skills/lit-diagram-drawer/scripts/brief-contract.mjs +94 -0
  442. package/skills/lit-diagram-drawer/scripts/capability-probe.mjs +132 -0
  443. package/skills/lit-diagram-drawer/scripts/check-visible-text.mjs +15 -0
  444. package/skills/lit-diagram-drawer/scripts/craft-thresholds.json +15 -0
  445. package/skills/lit-diagram-drawer/scripts/diagram-metrics.mjs +216 -0
  446. package/skills/lit-diagram-drawer/scripts/doctor.mjs +8 -0
  447. package/skills/lit-diagram-drawer/scripts/drawio-extract.mjs +214 -0
  448. package/skills/lit-diagram-drawer/scripts/excalidraw-extract.mjs +151 -0
  449. package/skills/lit-diagram-drawer/scripts/export.mjs +133 -0
  450. package/skills/lit-diagram-drawer/scripts/import-shared.mjs +130 -0
  451. package/skills/lit-diagram-drawer/scripts/mermaid-extract.mjs +173 -0
  452. package/skills/lit-diagram-drawer/scripts/office-safety.mjs +120 -0
  453. package/skills/lit-diagram-drawer/scripts/renderer-safety.mjs +46 -0
  454. package/skills/lit-diagram-drawer/scripts/test-block-registry.mjs +20 -0
  455. package/skills/lit-diagram-drawer/scripts/test-brief-contract.mjs +27 -0
  456. package/skills/lit-diagram-drawer/scripts/test-importers.mjs +119 -0
  457. package/skills/lit-diagram-drawer/scripts/test-office-safety.mjs +67 -0
  458. package/skills/lit-diagram-drawer/scripts/test-sequence-verifier.mjs +28 -0
  459. package/skills/lit-diagram-drawer/scripts/test-visual-quality.mjs +68 -0
  460. package/skills/lit-diagram-drawer/scripts/verify-all.mjs +74 -0
  461. package/skills/lit-diagram-drawer/scripts/verify-brief.mjs +47 -0
  462. package/skills/lit-diagram-drawer/scripts/verify-coverage.mjs +56 -0
  463. package/skills/lit-diagram-drawer/scripts/verify-diagram.mjs +26 -0
  464. package/skills/lit-diagram-drawer/scripts/verify-motion.mjs +12 -0
  465. package/skills/lit-diagram-drawer/scripts/verify-type.mjs +48 -0
  466. package/skills/lit-diagram-drawer/scripts/visual-quality.mjs +363 -0
  467. package/skills/lit-docx/LICENSE-MIT.txt +21 -0
  468. package/skills/lit-docx/SKILL.md +78 -0
  469. package/skills/lit-docx/references/frontmatter_schema.md +42 -0
  470. package/skills/lit-docx/references/journal_style_spec.md +17 -0
  471. package/skills/lit-docx/references/markdown_quality_checklist.md +37 -0
  472. package/skills/lit-docx/references/slop_phrase_list.yaml +58 -0
  473. package/skills/lit-docx/references/slop_rules.md +35 -0
  474. package/skills/lit-docx/requirements.in +5 -0
  475. package/skills/lit-docx/requirements.lock +289 -0
  476. package/skills/lit-docx/run.py +64 -0
  477. package/skills/lit-docx/scripts/clean_markdown.py +95 -0
  478. package/skills/lit-docx/scripts/convert_md_to_docx.py +1047 -0
  479. package/skills/lit-docx/scripts/convert_md_to_pdf.py +281 -0
  480. package/skills/lit-docx/scripts/convert_pdf.py +130 -0
  481. package/skills/lit-docx/scripts/craft-thresholds.json +11 -0
  482. package/skills/lit-docx/scripts/craft_docx.py +83 -0
  483. package/skills/lit-docx/scripts/edit_docx.py +297 -0
  484. package/skills/lit-docx/scripts/embed_images.py +78 -0
  485. package/skills/lit-docx/scripts/generate_docx_templates.py +491 -0
  486. package/skills/lit-docx/scripts/slop_lint.py +485 -0
  487. package/skills/lit-docx/scripts/visual_audit.py +41 -0
  488. package/skills/lit-docx/templates/docx/acs.docx +0 -0
  489. package/skills/lit-docx/templates/docx/elsevier.docx +0 -0
  490. package/skills/lit-docx/templates/docx/ieee.docx +0 -0
  491. package/skills/lit-docx/templates/docx/korean-generic.docx +0 -0
  492. package/skills/lit-docx/templates/docx/nature.docx +0 -0
  493. package/skills/lit-docx/templates/latex/acs/README.md +5 -0
  494. package/skills/lit-docx/templates/latex/acs/template.tex +37 -0
  495. package/skills/lit-docx/templates/latex/elsevier/README.md +5 -0
  496. package/skills/lit-docx/templates/latex/elsevier/template.tex +38 -0
  497. package/skills/lit-docx/templates/latex/ieee/README.md +5 -0
  498. package/skills/lit-docx/templates/latex/ieee/template.tex +37 -0
  499. package/skills/lit-docx/templates/latex/korean-generic/README.md +5 -0
  500. package/skills/lit-docx/templates/latex/korean-generic/template.tex +37 -0
  501. package/skills/lit-docx/templates/latex/nature/README.md +5 -0
  502. package/skills/lit-docx/templates/latex/nature/template.tex +37 -0
  503. package/skills/lit-docx/templates/registry.yaml +1366 -0
  504. package/skills/lit-humanizer/NOTICE +160 -0
  505. package/skills/lit-humanizer/SKILL.md +122 -0
  506. package/skills/lit-humanizer/assets/always-on-rule.md +9 -0
  507. package/skills/lit-humanizer/assets/report-skeleton.md +25 -0
  508. package/skills/lit-humanizer/assets/slide-text-skeleton.md +28 -0
  509. package/skills/lit-humanizer/examples/accessibility-note/after.md +7 -0
  510. package/skills/lit-humanizer/examples/accessibility-note/before.md +7 -0
  511. package/skills/lit-humanizer/examples/api-reference/after.md +9 -0
  512. package/skills/lit-humanizer/examples/api-reference/before.md +15 -0
  513. package/skills/lit-humanizer/examples/changelog/after.md +5 -0
  514. package/skills/lit-humanizer/examples/changelog/before.md +12 -0
  515. package/skills/lit-humanizer/examples/code-comments/after.md +10 -0
  516. package/skills/lit-humanizer/examples/code-comments/before.md +19 -0
  517. package/skills/lit-humanizer/examples/commit/after.md +5 -0
  518. package/skills/lit-humanizer/examples/commit/before.md +7 -0
  519. package/skills/lit-humanizer/examples/data-release/after.md +7 -0
  520. package/skills/lit-humanizer/examples/data-release/before.md +9 -0
  521. package/skills/lit-humanizer/examples/english-essay/after.md +5 -0
  522. package/skills/lit-humanizer/examples/english-essay/before.md +5 -0
  523. package/skills/lit-humanizer/examples/incident-update/after.md +7 -0
  524. package/skills/lit-humanizer/examples/incident-update/before.md +7 -0
  525. package/skills/lit-humanizer/examples/ko-essay/after.md +7 -0
  526. package/skills/lit-humanizer/examples/ko-essay/before.md +9 -0
  527. package/skills/lit-humanizer/examples/ko-report/after.md +9 -0
  528. package/skills/lit-humanizer/examples/ko-report/before.md +13 -0
  529. package/skills/lit-humanizer/examples/ko-slide/after.md +19 -0
  530. package/skills/lit-humanizer/examples/ko-slide/before.md +21 -0
  531. package/skills/lit-humanizer/examples/meeting-brief/after.md +9 -0
  532. package/skills/lit-humanizer/examples/meeting-brief/before.md +11 -0
  533. package/skills/lit-humanizer/examples/policy-faq/after.md +9 -0
  534. package/skills/lit-humanizer/examples/policy-faq/before.md +9 -0
  535. package/skills/lit-humanizer/examples/pr/after.md +15 -0
  536. package/skills/lit-humanizer/examples/pr/before.md +17 -0
  537. package/skills/lit-humanizer/examples/project-update/after.md +7 -0
  538. package/skills/lit-humanizer/examples/project-update/before.md +9 -0
  539. package/skills/lit-humanizer/examples/readme/after.md +12 -0
  540. package/skills/lit-humanizer/examples/readme/before.md +14 -0
  541. package/skills/lit-humanizer/examples/report/after.md +13 -0
  542. package/skills/lit-humanizer/examples/report/before.md +11 -0
  543. package/skills/lit-humanizer/examples/research-abstract/after.md +5 -0
  544. package/skills/lit-humanizer/examples/research-abstract/before.md +5 -0
  545. package/skills/lit-humanizer/examples/slides/after.md +19 -0
  546. package/skills/lit-humanizer/examples/slides/before.md +19 -0
  547. package/skills/lit-humanizer/examples/troubleshooting/after.md +11 -0
  548. package/skills/lit-humanizer/examples/troubleshooting/before.md +11 -0
  549. package/skills/lit-humanizer/fixtures/ko-metrics-golden.json +49 -0
  550. package/skills/lit-humanizer/fixtures/office/minimal.docx +0 -0
  551. package/skills/lit-humanizer/fixtures/office/minimal.pptx +0 -0
  552. package/skills/lit-humanizer/fixtures/pos-real.txt +26 -0
  553. package/skills/lit-humanizer/fixtures/rule-cases.json +306 -0
  554. package/skills/lit-humanizer/references/code-patterns.md +468 -0
  555. package/skills/lit-humanizer/references/deliverable-channels.md +111 -0
  556. package/skills/lit-humanizer/references/en-patterns-checklist.md +43 -0
  557. package/skills/lit-humanizer/references/en-patterns-content.md +243 -0
  558. package/skills/lit-humanizer/references/en-patterns-structure.md +375 -0
  559. package/skills/lit-humanizer/references/en-patterns.md +57 -0
  560. package/skills/lit-humanizer/references/ko-metrics.md +33 -0
  561. package/skills/lit-humanizer/references/ko-patterns-a-d.md +659 -0
  562. package/skills/lit-humanizer/references/ko-patterns-e-j.md +387 -0
  563. package/skills/lit-humanizer/references/ko-patterns.md +31 -0
  564. package/skills/lit-humanizer/references/rewrite-playbook.md +54 -0
  565. package/skills/lit-humanizer/references/taxonomy.md +153 -0
  566. package/skills/lit-humanizer/rules.json +884 -0
  567. package/skills/lit-humanizer/scripts/core.mjs +208 -0
  568. package/skills/lit-humanizer/scripts/detect.mjs +91 -0
  569. package/skills/lit-humanizer/scripts/extract_office_text.py +89 -0
  570. package/skills/lit-humanizer/scripts/guard-scan.mjs +36 -0
  571. package/skills/lit-humanizer/scripts/ko-metrics.mjs +124 -0
  572. package/skills/lit-humanizer/scripts/test-fixtures.mjs +54 -0
  573. package/skills/lit-humanizer/scripts/test-ko-metrics.mjs +27 -0
  574. package/skills/lit-pptx/FORBIDDEN_TERMS.json +55 -0
  575. package/skills/lit-pptx/NOTICE.md +3 -0
  576. package/skills/lit-pptx/SKILL.md +76 -0
  577. package/skills/lit-pptx/agents/analyst.md +49 -0
  578. package/skills/lit-pptx/agents/antithesis.md +59 -0
  579. package/skills/lit-pptx/agents/architect.md +44 -0
  580. package/skills/lit-pptx/agents/critic.md +42 -0
  581. package/skills/lit-pptx/agents/synthesizer.md +47 -0
  582. package/skills/lit-pptx/agents/thesis.md +33 -0
  583. package/skills/lit-pptx/assets/azure/circle-lg.png +0 -0
  584. package/skills/lit-pptx/assets/azure/circle-md.png +0 -0
  585. package/skills/lit-pptx/assets/azure/circle-sm.png +0 -0
  586. package/skills/lit-pptx/fonts/a2z-font/A2Z-Black.otf +0 -0
  587. package/skills/lit-pptx/fonts/a2z-font/A2Z-Bold.otf +0 -0
  588. package/skills/lit-pptx/fonts/a2z-font/A2Z-Light.otf +0 -0
  589. package/skills/lit-pptx/fonts/a2z-font/A2Z-Medium.otf +0 -0
  590. package/skills/lit-pptx/fonts/a2z-font/A2Z-Regular.otf +0 -0
  591. package/skills/lit-pptx/fonts/a2z-font/OFL.txt +94 -0
  592. package/skills/lit-pptx/fonts/a2z-font/SOURCE.md +29 -0
  593. package/skills/lit-pptx/package-lock.json +747 -0
  594. package/skills/lit-pptx/package.json +13 -0
  595. package/skills/lit-pptx/pretendard-font/LICENSE.txt +94 -0
  596. package/skills/lit-pptx/pretendard-font/public/static/LitOpenCodeSans-Bold.otf +0 -0
  597. package/skills/lit-pptx/pretendard-font/public/static/LitOpenCodeSans-Regular.otf +0 -0
  598. package/skills/lit-pptx/requirements.in +2 -0
  599. package/skills/lit-pptx/requirements.lock +285 -0
  600. package/skills/lit-pptx/run.mjs +71 -0
  601. package/skills/lit-pptx/scripts/check_ooxml.py +47 -0
  602. package/skills/lit-pptx/scripts/compile-deck.js +447 -0
  603. package/skills/lit-pptx/scripts/craft-thresholds.json +26 -0
  604. package/skills/lit-pptx/scripts/craft_extras.py +224 -0
  605. package/skills/lit-pptx/scripts/embed_fonts.py +204 -0
  606. package/skills/lit-pptx/scripts/layout_inventory.py +70 -0
  607. package/skills/lit-pptx/scripts/learn_template.py +433 -0
  608. package/skills/lit-pptx/scripts/lib/derive-palette.js +176 -0
  609. package/skills/lit-pptx/scripts/lib/directive-parser.js +244 -0
  610. package/skills/lit-pptx/scripts/lib/font-map.js +79 -0
  611. package/skills/lit-pptx/scripts/lib/gen-bg.js +85 -0
  612. package/skills/lit-pptx/scripts/lib/gen-gradient-assets.js +36 -0
  613. package/skills/lit-pptx/scripts/lib/layout-resolver.js +737 -0
  614. package/skills/lit-pptx/scripts/lib/markdown-loader.js +136 -0
  615. package/skills/lit-pptx/scripts/lib/render-adapter-html.js +364 -0
  616. package/skills/lit-pptx/scripts/lib/render-adapter-pptx.js +1848 -0
  617. package/skills/lit-pptx/scripts/lib/slide-ast.js +534 -0
  618. package/skills/lit-pptx/scripts/lib/spec-validator.js +94 -0
  619. package/skills/lit-pptx/scripts/lib/template-registry.js +355 -0
  620. package/skills/lit-pptx/scripts/qa_deck.py +773 -0
  621. package/skills/lit-pptx/scripts/validate_pptx.py +206 -0
  622. package/skills/lit-pptx/specs/markdown-slide-spec-v1.md +251 -0
  623. package/skills/lit-pptx/specs/markdown-slide-spec-v2.md +223 -0
  624. package/skills/lit-pptx/specs/slide-ast-v1.schema.json +229 -0
  625. package/skills/lit-pptx/specs/slide-ast-v2.schema.json +144 -0
  626. package/skills/lit-pptx/specs/template-enrollment-contract.md +379 -0
  627. package/skills/lit-pptx/templates/bauhaus_light.css +4 -0
  628. package/skills/lit-pptx/templates/boilerplate_professional.css +508 -0
  629. package/skills/lit-pptx/templates/enrolled/AZURE-A2Z/capabilities.yaml +146 -0
  630. package/skills/lit-pptx/templates/enrolled/AZURE-A2Z/layout-mapping.yaml +454 -0
  631. package/skills/lit-pptx/templates/enrolled/AZURE-A2Z/template.yaml +37 -0
  632. package/skills/lit-pptx/templates/enrolled/AZURE-PRO/capabilities.yaml +154 -0
  633. package/skills/lit-pptx/templates/enrolled/AZURE-PRO/layout-mapping.yaml +483 -0
  634. package/skills/lit-pptx/templates/enrolled/AZURE-PRO/template.yaml +37 -0
  635. package/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/capabilities.yaml +179 -0
  636. package/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/layout-mapping.yaml +299 -0
  637. package/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/template.yaml +45 -0
  638. package/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/capabilities.yaml +181 -0
  639. package/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/layout-mapping.yaml +299 -0
  640. package/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/template.yaml +44 -0
  641. package/skills/lit-scientific-visualization/SKILL.md +2 -0
  642. package/skills/lit-typographic-motion/NOTICE +23 -0
  643. package/skills/lit-typographic-motion/SKILL.md +77 -0
  644. package/skills/lit-typographic-motion/THIRD_PARTY_NOTICES +25 -0
  645. package/skills/lit-typographic-motion/audio-analysis.py +52 -0
  646. package/skills/lit-typographic-motion/engine/browser.mjs +83 -0
  647. package/skills/lit-typographic-motion/engine/constants.mjs +177 -0
  648. package/skills/lit-typographic-motion/engine/contrast.mjs +101 -0
  649. package/skills/lit-typographic-motion/engine/encode.mjs +46 -0
  650. package/skills/lit-typographic-motion/engine/flash.mjs +216 -0
  651. package/skills/lit-typographic-motion/engine/look.mjs +166 -0
  652. package/skills/lit-typographic-motion/engine/page/common.js +105 -0
  653. package/skills/lit-typographic-motion/engine/page/engine.js +451 -0
  654. package/skills/lit-typographic-motion/engine/page/gl.js +213 -0
  655. package/skills/lit-typographic-motion/engine/page/lines.js +88 -0
  656. package/skills/lit-typographic-motion/engine/page/passes.js +144 -0
  657. package/skills/lit-typographic-motion/engine/page/post.js +119 -0
  658. package/skills/lit-typographic-motion/engine/page/scenes.js +187 -0
  659. package/skills/lit-typographic-motion/engine/page/type.js +321 -0
  660. package/skills/lit-typographic-motion/engine/png.mjs +139 -0
  661. package/skills/lit-typographic-motion/engine/sound.mjs +291 -0
  662. package/skills/lit-typographic-motion/engine/stage/capture.mjs +133 -0
  663. package/skills/lit-typographic-motion/engine/stage/clock.js +171 -0
  664. package/skills/lit-typographic-motion/engine/stage/frame-worker.mjs +47 -0
  665. package/skills/lit-typographic-motion/engine/stage/gate.mjs +119 -0
  666. package/skills/lit-typographic-motion/engine/stage/qa-page.js +158 -0
  667. package/skills/lit-typographic-motion/engine/stage/qa.mjs +208 -0
  668. package/skills/lit-typographic-motion/engine/stage/render.mjs +418 -0
  669. package/skills/lit-typographic-motion/engine/stage/scan.mjs +162 -0
  670. package/skills/lit-typographic-motion/engine/stage/stage-kit.js +310 -0
  671. package/skills/lit-typographic-motion/engine/stills.mjs +60 -0
  672. package/skills/lit-typographic-motion/engine/text.mjs +126 -0
  673. package/skills/lit-typographic-motion/engine/timing.mjs +289 -0
  674. package/skills/lit-typographic-motion/engine/treatment.mjs +254 -0
  675. package/skills/lit-typographic-motion/fonts/Archivo-100-400.ttf +0 -0
  676. package/skills/lit-typographic-motion/fonts/Archivo-100-700.ttf +0 -0
  677. package/skills/lit-typographic-motion/fonts/Archivo-100-900.ttf +0 -0
  678. package/skills/lit-typographic-motion/fonts/Archivo-125-400.ttf +0 -0
  679. package/skills/lit-typographic-motion/fonts/Archivo-125-700.ttf +0 -0
  680. package/skills/lit-typographic-motion/fonts/Archivo-125-900.ttf +0 -0
  681. package/skills/lit-typographic-motion/fonts/Archivo-75-400.ttf +0 -0
  682. package/skills/lit-typographic-motion/fonts/Archivo-75-700.ttf +0 -0
  683. package/skills/lit-typographic-motion/fonts/Archivo-75-900.ttf +0 -0
  684. package/skills/lit-typographic-motion/fonts/Archivo-OFL.txt +93 -0
  685. package/skills/lit-typographic-motion/fonts/Silkscreen-Bold.ttf +0 -0
  686. package/skills/lit-typographic-motion/fonts/Silkscreen-OFL.txt +93 -0
  687. package/skills/lit-typographic-motion/fonts/Silkscreen-Regular.ttf +0 -0
  688. package/skills/lit-typographic-motion/fonts/VT323-OFL.txt +93 -0
  689. package/skills/lit-typographic-motion/fonts/VT323-Regular.ttf +0 -0
  690. package/skills/lit-typographic-motion/fonts/pins.json +44 -0
  691. package/skills/lit-typographic-motion/fonts/stroke/CREDITS +52 -0
  692. package/skills/lit-typographic-motion/fonts/stroke/EMSAllure.svg +216 -0
  693. package/skills/lit-typographic-motion/fonts/stroke/EMSFelix.svg +216 -0
  694. package/skills/lit-typographic-motion/fonts/stroke/EMSOsmotron.svg +216 -0
  695. package/skills/lit-typographic-motion/fonts/stroke/EMSReadability.svg +216 -0
  696. package/skills/lit-typographic-motion/fonts/stroke/EMSTech.svg +217 -0
  697. package/skills/lit-typographic-motion/fonts/stroke/OFL.txt +85 -0
  698. package/skills/lit-typographic-motion/gate.mjs +593 -0
  699. package/skills/lit-typographic-motion/package-lock.json +78 -0
  700. package/skills/lit-typographic-motion/package.json +11 -0
  701. package/skills/lit-typographic-motion/probe.mjs +74 -0
  702. package/skills/lit-typographic-motion/references/authoring.md +110 -0
  703. package/skills/lit-typographic-motion/references/craft-loop.md +110 -0
  704. package/skills/lit-typographic-motion/references/runtime.md +88 -0
  705. package/skills/lit-typographic-motion/references/stage.md +164 -0
  706. package/skills/lit-typographic-motion/references/style-bibles.md +88 -0
  707. package/skills/lit-typographic-motion/references/treatment.md +143 -0
  708. package/skills/lit-typographic-motion/references/type-craft.md +55 -0
  709. package/skills/lit-typographic-motion/render.mjs +654 -0
  710. package/skills/lit-typographic-motion/requirements-audio.in +1 -0
  711. package/skills/lit-typographic-motion/requirements-audio.txt +790 -0
  712. package/skills/lit-typographic-motion/runtime.mjs +259 -0
  713. package/skills/lit-typographic-motion/word-timing-models.json +25 -0
  714. package/skills/litresearch/SKILL.md +41 -12
  715. package/skills/managed-skill-manifest.json +2367 -63
  716. package/skills/skill-rename-aliases.json +6 -1
  717. package/tools/check-pack-payload.mjs +22 -1
  718. package/tools/check-payload-substance.mjs +2 -2
  719. package/tools/payload-reference-exemptions.json +4 -0
  720. package/tools/payload-substance-allowlist.json +2 -3
  721. package/tools/payload-substance-parity.json +7 -7
  722. package/tools/version-manifests.json +4 -4
  723. package/skills/lit-korean/SKILL.md +0 -231
@@ -0,0 +1,291 @@
1
+ // Sound for both render paths. A generated bed is written from the treatment in pure code (no network,
2
+ // no model weights): tempo, a pulse and a chord pad in the treatment's key and timbre palette, plus the
3
+ // accents each beat's `sound` field asks for (a hit on its cut, a rise into the next beat, a closing
4
+ // cadence, a thin stretch that pares the bed back). It is 48 kHz 16-bit stereo, exactly as long as the film, peaks
5
+ // at most -2 dBFS and is normalized to -16 LUFS by an ITU-R BS.1770-4 meter implemented here. Every
6
+ // track, generated, supplied or authored, is muxed, padded or trimmed to the film with a 50 ms fade.
7
+ import { spawnSync } from "node:child_process";
8
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
9
+ import path from "node:path";
10
+ import { mulberry32, fnv1a32 } from "./text.mjs";
11
+
12
+ export const SOUND_EXIT = 20;
13
+ export const RATE = 48000;
14
+ const TARGET_LUFS = -16;
15
+ const PEAK_CEILING_DBFS = -2;
16
+ const fadeSec = 0.05;
17
+
18
+ // ---- ITU-R BS.1770-4: K-weighting at 48 kHz, 400 ms blocks with 75 % overlap, -70 LUFS absolute and
19
+ // -10 LU relative gates ----
20
+ const shelf = { b: [1.53512485958697, -2.69169618940638, 1.19839281085285], a: [1, -1.69065929318241, 0.73248077421585] };
21
+ const highPass = { b: [1, -2, 1], a: [1, -1.99004745483398, 0.99007225036621] };
22
+ function biquad(input, { b, a }) {
23
+ const out = new Float64Array(input.length);
24
+ let x1 = 0, x2 = 0, y1 = 0, y2 = 0;
25
+ for (let i = 0; i < input.length; i++) {
26
+ const x = input[i];
27
+ const y = b[0] * x + b[1] * x1 + b[2] * x2 - a[1] * y1 - a[2] * y2;
28
+ x2 = x1; x1 = x; y2 = y1; y1 = y;
29
+ out[i] = y;
30
+ }
31
+ return out;
32
+ }
33
+ export function integratedLoudness(channels, rate = RATE) {
34
+ if (rate !== RATE) throw new Error("the loudness meter's K-weighting coefficients are for 48 kHz");
35
+ const weighted = channels.map((channel) => biquad(biquad(channel, shelf), highPass));
36
+ const block = Math.round(0.4 * rate), hop = Math.round(0.1 * rate);
37
+ const blocks = [];
38
+ for (let start = 0; start + block <= weighted[0].length; start += hop) {
39
+ let sum = 0;
40
+ for (const channel of weighted) { let s = 0; for (let i = start; i < start + block; i++) s += channel[i] * channel[i]; sum += s / block; }
41
+ blocks.push(sum);
42
+ }
43
+ const loudness = (z) => -0.691 + 10 * Math.log10(z);
44
+ const absolute = blocks.filter((z) => loudness(z) > -70);
45
+ if (absolute.length === 0) return -Infinity;
46
+ const relativeGate = loudness(absolute.reduce((s, z) => s + z, 0) / absolute.length) - 10;
47
+ const gated = absolute.filter((z) => loudness(z) > relativeGate);
48
+ return loudness(gated.reduce((s, z) => s + z, 0) / gated.length);
49
+ }
50
+
51
+ const dbfs = (value) => (value > 0 ? 20 * Math.log10(value) : -Infinity);
52
+ export function samplePeakDbfs(channels) {
53
+ let peak = 0;
54
+ for (const channel of channels) for (const v of channel) peak = Math.max(peak, Math.abs(v));
55
+ return dbfs(peak);
56
+ }
57
+ // The longest run of 50 ms windows under `floorDb` RMS inside [0, untilSec).
58
+ export function quietestStretchSec(channels, rate, untilSec = 3, floorDb = -50) {
59
+ const win = Math.round(0.05 * rate), end = Math.min(channels[0].length, Math.round(untilSec * rate));
60
+ let run = 0, longest = 0;
61
+ for (let start = 0; start + win <= end; start += win) {
62
+ let sum = 0;
63
+ for (const channel of channels) for (let i = start; i < start + win; i++) sum += channel[i] * channel[i];
64
+ const rms = Math.sqrt(sum / (win * channels.length));
65
+ run = dbfs(rms) < floorDb ? run + 1 : 0;
66
+ longest = Math.max(longest, run);
67
+ }
68
+ return (longest * win) / rate;
69
+ }
70
+
71
+ // ---- music ----
72
+ const noteIndex = { C: 0, "C#": 1, Db: 1, D: 2, "D#": 3, Eb: 3, E: 4, F: 5, "F#": 6, Gb: 6, G: 7, "G#": 8, Ab: 8, A: 9, "A#": 10, Bb: 10, B: 11 };
73
+ const hz = (midi) => 440 * 2 ** ((midi - 69) / 12);
74
+ function progression(key) {
75
+ const [, name, mode] = key.match(/^([A-G][#b]?) (major|minor)$/u);
76
+ const root = 48 + noteIndex[name];
77
+ const scale = mode === "major" ? [0, 2, 4, 5, 7, 9, 11] : [0, 2, 3, 5, 7, 8, 10];
78
+ const degrees = mode === "major" ? [0, 4, 5, 3] : [0, 5, 2, 6];
79
+ const triad = (degree) => [0, 2, 4].map((step) => { const d = degree + step; return root + scale[d % 7] + 12 * Math.floor(d / 7); });
80
+ return { root, chords: degrees.map(triad), tonic: triad(0) };
81
+ }
82
+
83
+ // Timbre palettes: `pad(f, t)` is one voice at `f` Hz and film time `t`; the flags add a sub, bells, an
84
+ // arpeggio or breath noise.
85
+ const palettes = {
86
+ glass: { pad: (f, t) => 0.55 * Math.sin(2 * Math.PI * f * t) + 0.18 * Math.sin(2 * Math.PI * 2 * f * t), bell: true, pulse: 0.35, noise: 0 },
87
+ warm: { pad: (f, t) => { let v = 0; for (let h = 1; h <= 6; h++) v += Math.sin(2 * Math.PI * f * h * t + h) / h; return 0.42 * v; }, sub: true, pulse: 0.45, noise: 0 },
88
+ pulse: { pad: (f, t) => 0.35 * Math.sin(2 * Math.PI * f * t), arp: true, pulse: 0.6, noise: 0 },
89
+ air: { pad: (f, t) => 0.5 * Math.sin(2 * Math.PI * f * t) + 0.12 * Math.sin(2 * Math.PI * 1.5 * f * t), pulse: 0.25, noise: 0.08 }
90
+ };
91
+
92
+ // Accent words a beat's `sound` field may carry.
93
+ export function accentsFor(beat) {
94
+ const text = String(beat.sound ?? "").toLowerCase();
95
+ return { hit: /\bhits?\b|\bimpact\b|\bboom\b|\bstab\b/u.test(text), rise: /\brise\b|\briser\b|\bswell\b|\bbuild\b/u.test(text), cadence: /\bcadence\b|\bresolve\b|\bfinal chord\b/u.test(text), thin: /\bthin(?:s|ned)?\b|\bsparse\b|\bpared back\b/u.test(text) };
96
+ }
97
+
98
+ // cuts[i] is the film time where beat i starts on screen (the render's own cut times).
99
+ export function buildBed(treatment, { frameCount, fps, cuts }) {
100
+ const sound = treatment.sound;
101
+ const length = Math.round((frameCount * RATE) / fps);
102
+ const duration = length / RATE;
103
+ const palette = palettes[sound.palette];
104
+ const random = mulberry32(fnv1a32(`${treatment.seed ?? ""}:${treatment.idea}:${sound.palette}:${sound.key}:${sound.tempo}`));
105
+ const { chords, tonic, root } = progression(sound.key);
106
+ const beatSec = 60 / sound.tempo;
107
+ const chordSec = beatSec * 8;
108
+ const L = new Float64Array(length), R = new Float64Array(length);
109
+ const beats = treatment.beats;
110
+ const beatAt = (t) => { let k = 0; while (k + 1 < cuts.length && cuts[k + 1] <= t) k++; return k; };
111
+ const accents = beats.map(accentsFor);
112
+ const cadenceStart = accents.at(-1)?.cadence ? Math.max(0, duration - 1.6) : Infinity;
113
+ // Pad: the chord of the moment, three voices spread across the stereo field.
114
+ const noiseState = { l: 0, r: 0 };
115
+ for (let i = 0; i < length; i++) {
116
+ const t = i / RATE;
117
+ const chord = t >= cadenceStart ? tonic : chords[Math.floor(t / chordSec) % chords.length];
118
+ const thinGain = accents[beatAt(t)]?.thin ? 0.4 : 1;
119
+ const swell = 0.75 + 0.25 * Math.sin((2 * Math.PI * t) / (chordSec * 2));
120
+ let l = 0, r = 0;
121
+ chord.forEach((note, v) => {
122
+ const s = palette.pad(hz(note + 12), t) * (0.33 - 0.04 * v);
123
+ const pan = 0.5 + (v - 1) * 0.3;
124
+ l += s * (1 - pan); r += s * pan;
125
+ });
126
+ if (palette.sub) { const s = 0.25 * Math.sin(2 * Math.PI * hz(chord[0] - 12) * t); l += s; r += s; }
127
+ if (palette.noise) {
128
+ noiseState.l += 0.02 * ((random() * 2 - 1) - noiseState.l); noiseState.r += 0.02 * ((random() * 2 - 1) - noiseState.r);
129
+ l += palette.noise * 6 * noiseState.l; r += palette.noise * 6 * noiseState.r;
130
+ }
131
+ L[i] = l * thinGain * swell; R[i] = r * thinGain * swell;
132
+ }
133
+ // Pulse: a soft tuned knock on every tempo beat; arpeggio or bell notes on the off-beats.
134
+ const addNote = (start, f, amp, decay, pan = 0.5, shape = "sine") => {
135
+ const s0 = Math.round(start * RATE), n = Math.min(length - s0, Math.round(decay * 6 * RATE));
136
+ for (let k = 0; k < n; k++) {
137
+ const age = k / RATE;
138
+ const env = Math.exp(-age / decay) * Math.min(1, age / 0.004);
139
+ let v = Math.sin(2 * Math.PI * f * age);
140
+ if (shape === "square") v = Math.sign(v) * 0.6 + 0.4 * v;
141
+ if (shape === "bell") v = Math.sin(2 * Math.PI * f * age + 2.2 * Math.exp(-age / 0.3) * Math.sin(2 * Math.PI * f * 3.5 * age));
142
+ L[s0 + k] += amp * env * v * (1 - pan); R[s0 + k] += amp * env * v * pan;
143
+ }
144
+ };
145
+ for (let b = 0; b * beatSec < duration; b++) {
146
+ const t = b * beatSec;
147
+ const knock = hz(root - 12);
148
+ const s0 = Math.round(t * RATE), n = Math.min(length - s0, Math.round(0.25 * RATE));
149
+ for (let k = 0; k < n; k++) {
150
+ const age = k / RATE, f = knock * (1 + 1.5 * Math.exp(-age / 0.03));
151
+ const v = palette.pulse * 0.5 * Math.exp(-age / 0.09) * Math.sin(2 * Math.PI * f * age);
152
+ L[s0 + k] += v; R[s0 + k] += v;
153
+ }
154
+ const chord = t >= cadenceStart ? tonic : chords[Math.floor(t / chordSec) % chords.length];
155
+ if (palette.arp) for (let e = 0; e < 2; e++) addNote(t + e * beatSec / 2, hz(chord[(b * 2 + e) % 3] + 24), 0.16, 0.12, 0.3 + 0.4 * random(), "square");
156
+ if (palette.bell && b % 2 === 1) addNote(t, hz(chord[b % 3] + 24), 0.12, 0.5, 0.2 + 0.6 * random(), "bell");
157
+ }
158
+ // Accents against the cut times.
159
+ const cues = [];
160
+ accents.forEach((accent, index) => {
161
+ const cut = cuts[index] ?? beats[index].t0;
162
+ const next = cuts[index + 1] ?? duration;
163
+ if (accent.hit && cut < duration) {
164
+ const s0 = Math.round(cut * RATE), n = Math.min(length - s0, Math.round(0.6 * RATE));
165
+ for (let k = 0; k < n; k++) {
166
+ const age = k / RATE, f = 55 * (1 + 2 * Math.exp(-age / 0.04));
167
+ const v = 0.9 * Math.exp(-age / 0.18) * Math.sin(2 * Math.PI * f * age) + 0.25 * Math.exp(-age / 0.02) * (random() * 2 - 1);
168
+ L[s0 + k] += v; R[s0 + k] += v;
169
+ }
170
+ cues.push({ kind: "hit", beat: index, time: s0 / RATE, cutTime: cut, deltaMs: Number(((s0 / RATE - cut) * 1000).toFixed(3)) });
171
+ }
172
+ if (accent.rise && next <= duration + 1e-9) {
173
+ const span = Math.min(1.2, next - cut), s0 = Math.round((next - span) * RATE), s1 = Math.round(next * RATE);
174
+ let lp = 0;
175
+ for (let k = s0; k < Math.min(length, s1); k++) {
176
+ const p = (k - s0) / Math.max(1, s1 - s0);
177
+ lp += 0.05 * ((random() * 2 - 1) - lp);
178
+ const v = 0.5 * p * p * (lp * 3 + 0.4 * Math.sin(2 * Math.PI * (220 + 660 * p) * (k / RATE)));
179
+ L[k] += v; R[k] += v;
180
+ }
181
+ cues.push({ kind: "rise", beat: index, time: s1 / RATE, cutTime: next, deltaMs: Number(((s1 / RATE - next) * 1000).toFixed(3)) });
182
+ }
183
+ if (accent.thin) cues.push({ kind: "thin", beat: index, time: Math.round(cut * RATE) / RATE, cutTime: cut, deltaMs: Number(((Math.round(cut * RATE) / RATE - cut) * 1000).toFixed(3)) });
184
+ });
185
+ if (Number.isFinite(cadenceStart)) {
186
+ for (const note of tonic) addNote(cadenceStart, hz(note + 12), 0.22, 0.9, 0.5);
187
+ cues.push({ kind: "cadence", beat: beats.length - 1, time: cadenceStart, cutTime: duration, deltaMs: Number(((cadenceStart - (duration - 1.6)) * 1000).toFixed(3)) });
188
+ }
189
+ // Every cut also gets a cue line for the look's sound question, accented or not.
190
+ cuts.forEach((cut, index) => { if (index > 0 && !cues.some((cue) => cue.beat === index && cue.kind === "hit")) cues.push({ kind: "cut", beat: index, time: cut, cutTime: cut, deltaMs: 0 }); });
191
+ // 50 ms fades at both ends, then loudness to -16 LUFS under a -2 dBFS soft ceiling.
192
+ const fadeN = Math.round(fadeSec * RATE);
193
+ for (let k = 0; k < fadeN; k++) { const g = k / fadeN; L[k] *= g; R[k] *= g; L[length - 1 - k] *= g; R[length - 1 - k] *= g; }
194
+ const ceiling = 10 ** (PEAK_CEILING_DBFS / 20) * 0.995;
195
+ let gain = 1, lufs = integratedLoudness([L, R]), outL = L, outR = R;
196
+ for (let pass = 0; pass < 6 && Number.isFinite(lufs); pass++) {
197
+ gain *= 10 ** ((TARGET_LUFS - lufs) / 20);
198
+ outL = L.map((v) => ceiling * Math.tanh((v * gain) / ceiling));
199
+ outR = R.map((v) => ceiling * Math.tanh((v * gain) / ceiling));
200
+ lufs = integratedLoudness([outL, outR]);
201
+ if (Math.abs(lufs - TARGET_LUFS) < 0.1) break;
202
+ }
203
+ const pcm = new Int16Array(length * 2);
204
+ for (let i = 0; i < length; i++) { pcm[2 * i] = Math.round(outL[i] * 32767); pcm[2 * i + 1] = Math.round(outR[i] * 32767); }
205
+ const decoded = [Float64Array.from({ length }, (_, i) => pcm[2 * i] / 32768), Float64Array.from({ length }, (_, i) => pcm[2 * i + 1] / 32768)];
206
+ cues.sort((a, b) => a.time - b.time || a.beat - b.beat);
207
+ return { pcm, cues, stats: { samples: length, durationSec: duration, lufs: Number(integratedLoudness(decoded).toFixed(2)), peakDbfs: Number(samplePeakDbfs(decoded).toFixed(2)), palette: sound.palette, key: sound.key, tempo: sound.tempo } };
208
+ }
209
+
210
+ export function wavBytes(pcm, rate = RATE, channels = 2) {
211
+ const data = Buffer.from(pcm.buffer, pcm.byteOffset, pcm.byteLength);
212
+ const header = Buffer.alloc(44);
213
+ header.write("RIFF", 0); header.writeUInt32LE(36 + data.length, 4); header.write("WAVEfmt ", 8);
214
+ header.writeUInt32LE(16, 16); header.writeUInt16LE(1, 20); header.writeUInt16LE(channels, 22); header.writeUInt32LE(rate, 24);
215
+ header.writeUInt32LE(rate * channels * 2, 28); header.writeUInt16LE(channels * 2, 32); header.writeUInt16LE(16, 34); header.write("data", 36); header.writeUInt32LE(data.length, 40);
216
+ return Buffer.concat([header, data]);
217
+ }
218
+
219
+ // Writes <out>/sound.wav and <out>/sound-cues.json for a generated bed; returns the stats.
220
+ export function writeBed(out, treatment, timing) {
221
+ const bed = buildBed(treatment, timing);
222
+ const wav = path.join(out, "sound.wav");
223
+ writeFileSync(wav, wavBytes(bed.pcm));
224
+ writeFileSync(path.join(out, "sound-cues.json"), JSON.stringify({ mode: "generated", palette: bed.stats.palette, key: bed.stats.key, tempo: bed.stats.tempo, cuts: timing.cuts, cues: bed.cues }, null, 2) + "\n");
225
+ return { file: wav, ...bed.stats };
226
+ }
227
+
228
+ // The track a render muxes: generated (built here), supplied or authored (a file), or none.
229
+ export function resolveTrack(out, treatment, timing, briefAudio) {
230
+ const mode = treatment.sound.mode;
231
+ if (mode === "none") return { mode };
232
+ if (mode === "generated") return { mode, ...writeBed(out, treatment, timing), label: "generated" };
233
+ const named = treatment.sound.file ?? briefAudio;
234
+ const file = named ? path.resolve(out, named) : null;
235
+ if (!file || !existsSync(file)) throw Object.assign(new Error(`SOUND_INVALID (20): the ${mode} track ${named ?? "(none named)"} is missing`), { exitCode: SOUND_EXIT });
236
+ writeFileSync(path.join(out, "sound-cues.json"), JSON.stringify({ mode, file: path.relative(out, file), cuts: timing.cuts, cues: timing.cuts.map((cut, beat) => ({ kind: "cut", beat, time: cut, cutTime: cut, deltaMs: 0 })) }, null, 2) + "\n");
237
+ return { mode, file, label: mode };
238
+ }
239
+
240
+ // Muxes any track into the video: pad or trim to the video's length with 50 ms fades, AAC 256k.
241
+ export function muxTrack(videoFile, track, durationSec, target) {
242
+ const fadeOut = Math.max(0, durationSec - fadeSec).toFixed(6);
243
+ const result = spawnSync("ffmpeg", ["-y", "-loglevel", "error", "-i", videoFile, "-i", track.file, "-map", "0:v:0", "-map", "1:a:0", "-c:v", "copy",
244
+ "-af", `aresample=${RATE},apad,atrim=0:${durationSec.toFixed(6)},afade=t=in:d=${fadeSec},afade=t=out:st=${fadeOut}:d=${fadeSec}`,
245
+ "-ac", "2", "-c:a", "aac", "-b:a", "256k", "-movflags", "+faststart", target], { encoding: "utf8", timeout: 300000 });
246
+ if (result.status !== 0) throw Object.assign(new Error(`SOUND_INVALID (20): the ${track.mode} track could not be muxed: ${(result.stderr || "").trim().split("\n").at(-1)}`), { exitCode: SOUND_EXIT });
247
+ }
248
+
249
+ // Decodes a film's audio stream (48 kHz stereo float) for the gate; null when there is none.
250
+ export function decodeFilmAudio(file) {
251
+ const probe = spawnSync("ffprobe", ["-v", "error", "-select_streams", "a", "-show_entries", "stream=codec_name", "-of", "csv=p=0", file], { encoding: "utf8" });
252
+ if (probe.status !== 0 || !probe.stdout.trim()) return null;
253
+ const result = spawnSync("ffmpeg", ["-v", "error", "-i", file, "-map", "0:a:0", "-f", "f32le", "-ac", "2", "-ar", String(RATE), "pipe:1"], { maxBuffer: 1024 * 1024 * 1024 });
254
+ if (result.status !== 0) return null;
255
+ const floats = new Float32Array(result.stdout.buffer, result.stdout.byteOffset, result.stdout.byteLength / 4);
256
+ const n = floats.length / 2;
257
+ const L = new Float64Array(n), R = new Float64Array(n);
258
+ for (let i = 0; i < n; i++) { L[i] = floats[2 * i]; R[i] = floats[2 * i + 1]; }
259
+ return [L, R];
260
+ }
261
+
262
+ // Section 7's gate on the decoded muxed stream. Returns check rows; `silenceFails` is true for a
263
+ // generated bed (exit 20) and false for a supplied or authored track (WARN).
264
+ export function soundChecks(filmFile, videoDurationSec, mode) {
265
+ if (mode === "none") return { SOUND: { pass: true, detail: "silent by the treatment's request" } };
266
+ const channels = filmFile && existsSync(filmFile) ? decodeFilmAudio(filmFile) : null;
267
+ if (!channels) return { "SOUND-stream": { pass: false, detail: `the treatment plans ${mode} sound but the film has no audio stream` } };
268
+ const duration = channels[0].length / RATE;
269
+ const peak = samplePeakDbfs(channels);
270
+ const quiet = quietestStretchSec(channels, RATE);
271
+ const lufs = integratedLoudness(channels);
272
+ return {
273
+ "SOUND-stream": { pass: true, detail: `${mode} track present (${lufs.toFixed(1)} LUFS integrated)` },
274
+ "SOUND-duration": Math.abs(duration - videoDurationSec) <= 0.1 ? { pass: true, detail: `${duration.toFixed(3)} s against the video's ${videoDurationSec.toFixed(3)} s` } : { pass: false, detail: `${duration.toFixed(3)} s against the video's ${videoDurationSec.toFixed(3)} s (more than 0.1 s off)` },
275
+ "SOUND-peak": peak <= -0.5 ? { pass: true, detail: `sample peak ${peak.toFixed(2)} dBFS` } : { pass: false, detail: `sample peak ${peak.toFixed(2)} dBFS is over -0.5 dBFS` },
276
+ "SOUND-start": quiet <= 1.5 ? { pass: true, detail: `longest stretch under -50 dBFS in the first 3 s: ${quiet.toFixed(2)} s` }
277
+ : mode === "generated" ? { pass: false, detail: `the bed sits under -50 dBFS for ${quiet.toFixed(2)} s in the first 3 s` } : { pass: false, warn: true, detail: `the ${mode} track sits under -50 dBFS for ${quiet.toFixed(2)} s in the first 3 s` }
278
+ };
279
+ }
280
+
281
+ export function readWavStereo(file) {
282
+ const bytes = readFileSync(file);
283
+ const channels = bytes.readUInt16LE(22), bits = bytes.readUInt16LE(34);
284
+ if (bits !== 16) throw new Error("only 16-bit PCM WAV is read here");
285
+ let offset = 12;
286
+ while (offset + 8 <= bytes.length && bytes.toString("ascii", offset, offset + 4) !== "data") offset += 8 + bytes.readUInt32LE(offset + 4);
287
+ const size = bytes.readUInt32LE(offset + 4), start = offset + 8, frames = size / (2 * channels);
288
+ const L = new Float64Array(frames), R = new Float64Array(frames);
289
+ for (let i = 0; i < frames; i++) { L[i] = bytes.readInt16LE(start + i * 2 * channels) / 32768; R[i] = bytes.readInt16LE(start + (i * channels + (channels > 1 ? 1 : 0)) * 2) / 32768; }
290
+ return { rate: bytes.readUInt32LE(24), channels: [L, R] };
291
+ }
@@ -0,0 +1,133 @@
1
+ // One stage browser: the software rung plus the stage flags, the page served from a synthetic origin
2
+ // through request interception (no listening socket), the virtual clock injected before any page
3
+ // script, and CDP screenshots of exactly the format's viewport. The master capture, the determinism
4
+ // replay and the QA replay each launch their own with this module.
5
+ import { existsSync, mkdirSync, readFileSync, realpathSync, rmSync } from "node:fs";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { chromeFlagRungs } from "../constants.mjs";
9
+ import { StageError, contentTypes, insideDir } from "./scan.mjs";
10
+
11
+ export const stageHost = "lit.stage";
12
+ export const stageOrigin = `http://${stageHost}`;
13
+ const here = path.dirname(fileURLToPath(import.meta.url));
14
+ const kitSource = () => readFileSync(path.join(here, "stage-kit.js"), "utf8");
15
+ const clockSource = () => readFileSync(path.join(here, "clock.js"), "utf8");
16
+
17
+ // The Wave 1 software rung (SwiftShader, CPU raster; keychain flags included) plus the stage flags.
18
+ export function stageChromeFlags(width, height) {
19
+ const software = chromeFlagRungs().find((rung) => rung.name === "swiftshader").flags;
20
+ return [...software,
21
+ "--run-all-compositor-stages-before-draw", "--disable-checker-imaging", "--disable-new-content-rendering-timeout",
22
+ "--disable-threaded-animation", "--disable-threaded-scrolling", "--disable-image-animation-resync", "--disable-lcd-text",
23
+ "--force-color-profile=srgb", "--hide-scrollbars", "--mute-audio", "--force-device-scale-factor=1", `--window-size=${width},${height}`,
24
+ "--disable-background-networking", "--disable-component-update", "--disable-sync", "--no-pings", "--metrics-recording-only",
25
+ `--host-resolver-rules=MAP * ~NOTFOUND , EXCLUDE ${stageHost}`];
26
+ }
27
+
28
+ // The product's own faces, served under /lit/fonts/ and declared in /lit/fonts.css.
29
+ export function stageFonts(skillRoot, state, pins) {
30
+ const faces = [];
31
+ for (const [stretch, width] of [[75, "75%"], [100, "100%"], [125, "125%"]]) for (const weight of [400, 700, 900]) faces.push({ family: "Archivo", weight, stretch: width, file: path.join(skillRoot, "fonts", `Archivo-${stretch}-${weight}.ttf`) });
32
+ if (state.hangul === "lit-pptx") {
33
+ faces.push({ family: "LitOpenCode Sans", weight: 400, file: path.resolve(skillRoot, pins.litPptxPair.Regular.path) }, { family: "LitOpenCode Sans", weight: 700, file: path.resolve(skillRoot, pins.litPptxPair.Bold.path) });
34
+ } else faces.push({ family: "LitOpenCode Sans", weight: 400, file: path.join(state.fontDir, "Pretendard-Regular.otf") }, { family: "LitOpenCode Sans", weight: 700, file: path.join(state.fontDir, "Pretendard-Regular.otf") });
35
+ faces.push({ family: "VT323", weight: 400, file: path.join(skillRoot, "fonts", "VT323-Regular.ttf") });
36
+ faces.push({ family: "Silkscreen", weight: 400, file: path.join(skillRoot, "fonts", "Silkscreen-Regular.ttf") }, { family: "Silkscreen", weight: 700, file: path.join(skillRoot, "fonts", "Silkscreen-Bold.ttf") });
37
+ faces.push({ family: "MesloLGS NF", weight: 400, file: path.join(state.fontDir, "MesloLGS-NF-Regular.ttf") });
38
+ faces.push({ family: "Galmuri9", weight: 400, file: path.join(state.fontDir, "Galmuri9.ttf") });
39
+ const files = new Map();
40
+ const css = faces.map((face) => {
41
+ const name = path.basename(face.file);
42
+ files.set(name, face.file);
43
+ const format = name.endsWith(".otf") ? "opentype" : "truetype";
44
+ return `@font-face { font-family: "${face.family}"; src: url("/lit/fonts/${encodeURIComponent(name)}") format("${format}"); font-weight: ${face.weight}; font-style: normal;${face.stretch ? ` font-stretch: ${face.stretch};` : ""} font-display: block; }`;
45
+ }).join("\n") + "\n";
46
+ return { css, files, families: [...new Set(faces.map((face) => face.family))] };
47
+ }
48
+
49
+ // Launch one stage browser. `profile` is a short directory under the run's .run/, removed on close.
50
+ export async function openStage(chromium, { chromePath, profile, stageDir, width, height, fps, seed, fonts, extraInit }) {
51
+ rmSync(profile, { recursive: true, force: true });
52
+ mkdirSync(profile, { recursive: true });
53
+ const flags = stageChromeFlags(width, height);
54
+ let context;
55
+ try {
56
+ context = await chromium.launchPersistentContext(profile, {
57
+ executablePath: chromePath, headless: true, args: flags, chromiumSandbox: true, timeout: 30000,
58
+ viewport: { width, height }, deviceScaleFactor: 1, serviceWorkers: "block"
59
+ });
60
+ } catch (error) {
61
+ rmSync(profile, { recursive: true, force: true });
62
+ const line = String(error?.message ?? error).split("\n").find((part) => part.trim()) ?? String(error);
63
+ throw Object.assign(new Error(`BLOCKED_NO_CHROME (10): Chrome failed to launch headless: ${line}; fix: check that Chrome can start headless in this sandbox`), { exitCode: 10 });
64
+ }
65
+ const blocked = [];
66
+ const refused = [];
67
+ const missing = [];
68
+ const root = realpathSync(stageDir);
69
+ const kit = kitSource();
70
+ await context.route("**/*", async (route) => {
71
+ const url = new URL(route.request().url());
72
+ if (url.origin !== stageOrigin) { blocked.push(url.href); return route.abort("blockedbyclient"); }
73
+ const pathname = decodeURIComponent(url.pathname);
74
+ if (pathname === "/lit/stage-kit.js") return route.fulfill({ status: 200, contentType: contentTypes[".js"], body: kit });
75
+ if (pathname === "/lit/fonts.css") return route.fulfill({ status: 200, contentType: contentTypes[".css"], body: fonts.css });
76
+ if (pathname.startsWith("/lit/fonts/")) {
77
+ const file = fonts.files.get(pathname.slice("/lit/fonts/".length));
78
+ return file && existsSync(file) ? route.fulfill({ status: 200, contentType: contentTypes[path.extname(file)], body: readFileSync(file) }) : route.fulfill({ status: 404, body: "" });
79
+ }
80
+ const rel = pathname.replace(/^\/+/u, "") || "index.html";
81
+ if (rel.split("/").includes("..")) { refused.push(rel); return route.fulfill({ status: 404, body: "" }); }
82
+ const full = path.join(root, rel);
83
+ if (!existsSync(full)) { missing.push(rel); return route.fulfill({ status: 404, body: "" }); }
84
+ const real = realpathSync(full);
85
+ if (!insideDir(root, real)) { refused.push(rel); return route.fulfill({ status: 404, body: "" }); }
86
+ const type = contentTypes[path.extname(real).toLowerCase()];
87
+ if (!type) { refused.push(rel); return route.fulfill({ status: 404, body: "" }); }
88
+ return route.fulfill({ status: 200, contentType: type, body: readFileSync(real) });
89
+ });
90
+ await context.addInitScript({ content: `window.__litStageConfig = ${JSON.stringify({ seed: seed >>> 0, fps })};\n${clockSource()}` });
91
+ if (extraInit) await context.addInitScript({ content: extraInit });
92
+ const page = context.pages()[0] ?? await context.newPage();
93
+ const errors = [];
94
+ page.on("pageerror", (error) => errors.push(String(error?.message ?? error)));
95
+ const cdp = await context.newCDPSession(page);
96
+ // The capture session owns the viewport: a screenshot restores the metrics of the session that took
97
+ // it, so the size is pinned here rather than only through the driver's own emulation.
98
+ await cdp.send("Emulation.setDeviceMetricsOverride", { width, height, deviceScaleFactor: 1, mobile: false, screenWidth: width, screenHeight: height });
99
+ const close = async () => {
100
+ await context.close().catch(() => {});
101
+ rmSync(profile, { recursive: true, force: true });
102
+ };
103
+ const check = async () => {
104
+ if (blocked.length) throw new StageError(19, "STAGE_NETWORK_REQUEST", `the page requested ${blocked[0]}${blocked.length > 1 ? ` and ${blocked.length - 1} more` : ""}`);
105
+ if (refused.length) throw new StageError(17, "STAGE_CONTRACT_ERROR", `the page asked for ${refused[0]}, which is outside the stage directory or not a stage file type`);
106
+ const violations = await page.evaluate(() => window.__litStage.violations.map((v) => ({ ...v })));
107
+ const first = violations.find((v) => v.code === 19) ?? violations.find((v) => v.code === 17);
108
+ if (first) throw new StageError(first.code, first.code === 19 ? "STAGE_NETWORK_REQUEST" : "STAGE_CONTRACT_ERROR", `the page used ${first.what} at ${first.t.toFixed(2)} s`);
109
+ };
110
+ return {
111
+ context, page, cdp, flags, blocked, missing, errors, close, check,
112
+ async load(rasterUrls) {
113
+ try { await page.goto(`${stageOrigin}/index.html`, { waitUntil: "load", timeout: 60000 }); }
114
+ catch (error) { await check(); throw new StageError(17, "STAGE_CONTRACT_ERROR", `the page did not load: ${String(error?.message ?? error).split("\n")[0]}`); }
115
+ const definition = await page.evaluate((urls) => window.__litStage.prepare(urls), rasterUrls);
116
+ await check();
117
+ const webgl = await page.evaluate(() => ({ ...window.__litStage.webgl }));
118
+ return { definition, webgl };
119
+ },
120
+ // Advance the virtual clock to `frame`. `settle` waits two native frames so the compositor has
121
+ // drawn it; frames that are not captured skip that wait.
122
+ async step(frame, settle = true) {
123
+ await page.evaluate(({ f, settle: wait }) => window.__litStage.step(f, wait), { f: frame, settle });
124
+ },
125
+ async stepRange(from, to) {
126
+ await page.evaluate(({ a, b }) => window.__litStage.stepRange(a, b), { a: from, b: to });
127
+ },
128
+ async capture() {
129
+ const shot = await cdp.send("Page.captureScreenshot", { format: "png", optimizeForSpeed: true, captureBeyondViewport: false, fromSurface: true, clip: { x: 0, y: 0, width, height, scale: 1 } });
130
+ return Buffer.from(shot.data, "base64");
131
+ }
132
+ };
133
+ }
@@ -0,0 +1,171 @@
1
+ // Stage init script: runs before any page script (Playwright addInitScript) in every stage browser
2
+ // (master, determinism replay and QA replay alike). It puts the page on a virtual clock the renderer
3
+ // steps one frame at a time, seeds Math.random from the treatment, and stubs every API the stage may
4
+ // not use so a violation is recorded instead of silently leaking wall time, sound or the network.
5
+ (() => {
6
+ "use strict";
7
+ const config = window.__litStageConfig ?? { seed: 1, fps: 60 };
8
+ const NativeDate = Date;
9
+ const nativeRaf = window.requestAnimationFrame.bind(window);
10
+ const epoch = 1767225600000; // a fixed wall-clock origin; the film never reads the real date
11
+ let now = 0; // virtual milliseconds since frame 0
12
+ const violations = [];
13
+ const record = (code, what) => { if (!violations.some((v) => v.what === what)) violations.push({ code, what, t: now / 1000 }); };
14
+
15
+ // ---- time sources ----
16
+ const VirtualDate = function (...args) {
17
+ if (!new.target) return new NativeDate(epoch + now).toString();
18
+ return Reflect.construct(NativeDate, args.length ? args : [epoch + now], new.target);
19
+ };
20
+ VirtualDate.prototype = NativeDate.prototype;
21
+ Object.setPrototypeOf(VirtualDate, NativeDate);
22
+ VirtualDate.now = () => epoch + now;
23
+ window.Date = VirtualDate;
24
+ Object.defineProperty(performance, "now", { value: () => now, configurable: true, writable: true });
25
+ try { Object.defineProperty(document.timeline, "currentTime", { get: () => now, configurable: true }); } catch { /* not configurable in this build */ }
26
+
27
+ const timers = new Map();
28
+ let timerSeq = 1;
29
+ window.setTimeout = (fn, ms, ...args) => { const id = timerSeq++; timers.set(id, { due: now + Math.max(0, Number(ms) || 0), fn, args, every: 0, id }); return id; };
30
+ window.setInterval = (fn, ms, ...args) => { const id = timerSeq++; const every = Math.max(1, Number(ms) || 0); timers.set(id, { due: now + every, fn, args, every, id }); return id; };
31
+ window.clearTimeout = (id) => { timers.delete(id); };
32
+ window.clearInterval = (id) => { timers.delete(id); };
33
+ let rafs = new Map();
34
+ let rafSeq = 1;
35
+ window.requestAnimationFrame = (cb) => { const id = rafSeq++; rafs.set(id, cb); return id; };
36
+ window.cancelAnimationFrame = (id) => { rafs.delete(id); };
37
+ window.requestIdleCallback = (cb) => window.setTimeout(() => cb({ didTimeout: false, timeRemaining: () => 0 }), 1);
38
+ window.cancelIdleCallback = (id) => window.clearTimeout(id);
39
+
40
+ // ---- seeded randomness (mulberry32) ----
41
+ let state = config.seed >>> 0;
42
+ Math.random = () => {
43
+ state = (state + 0x6d2b79f5) >>> 0;
44
+ let t = state;
45
+ t = Math.imul(t ^ (t >>> 15), t | 1);
46
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
47
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
48
+ };
49
+
50
+ // ---- forbidden APIs: 17 for sound and workers, 19 for network channels ----
51
+ const forbid = (name, code) => function forbidden() { record(code, name); throw new Error(`${name} is not allowed on the stage`); };
52
+ for (const [name, code] of [["Audio", 17], ["AudioContext", 17], ["webkitAudioContext", 17], ["OfflineAudioContext", 17], ["Worker", 17], ["SharedWorker", 17],
53
+ ["WebSocket", 19], ["WebTransport", 19], ["RTCPeerConnection", 19], ["webkitRTCPeerConnection", 19]]) {
54
+ try { Object.defineProperty(window, name, { value: forbid(name, code), configurable: true, writable: true }); } catch { /* keep going */ }
55
+ }
56
+ if (navigator.serviceWorker) {
57
+ try { Object.defineProperty(navigator.serviceWorker, "register", { value: () => { record(17, "serviceWorker.register"); return Promise.reject(new Error("service workers are not allowed on the stage")); } }); } catch { /* keep going */ }
58
+ }
59
+ const forbiddenTags = new Set(["VIDEO", "AUDIO", "IFRAME", "OBJECT", "EMBED", "FRAME"]);
60
+ const inspect = (node) => {
61
+ if (node.nodeType !== 1) return;
62
+ if (forbiddenTags.has(node.tagName)) record(17, `<${node.tagName.toLowerCase()}>`);
63
+ for (const child of node.querySelectorAll?.("video,audio,iframe,object,embed,frame") ?? []) record(17, `<${child.tagName.toLowerCase()}>`);
64
+ };
65
+ new MutationObserver((list) => { for (const m of list) for (const node of m.addedNodes) inspect(node); }).observe(document, { childList: true, subtree: true });
66
+
67
+ // ---- canvas: WebGL keeps its drawing buffer for capture; 2D text calls are listed for the QA ----
68
+ const webgl = { requested: false, failed: false };
69
+ const nativeGetContext = HTMLCanvasElement.prototype.getContext;
70
+ HTMLCanvasElement.prototype.getContext = function (type, attributes, ...rest) {
71
+ const isGl = /webgl/iu.test(String(type));
72
+ const ctx = nativeGetContext.call(this, type, isGl ? { ...(attributes ?? {}), preserveDrawingBuffer: true } : attributes, ...rest);
73
+ if (isGl) { webgl.requested = true; if (!ctx) webgl.failed = true; }
74
+ return ctx;
75
+ };
76
+ const canvasTexts = new Set();
77
+ for (const method of ["fillText", "strokeText"]) {
78
+ const native = CanvasRenderingContext2D.prototype[method];
79
+ CanvasRenderingContext2D.prototype[method] = function (text, ...rest) { canvasTexts.add(String(text)); return native.call(this, text, ...rest); };
80
+ }
81
+
82
+ // ---- the per-frame step (the renderer's algorithm, steps 1-7) ----
83
+ const tracked = new Map();
84
+ const svgRoots = new Map();
85
+ const pump = async () => { for (let i = 0; i < 12; i++) await Promise.resolve(); };
86
+ const contract = () => window.LitStage?.definition ?? window.litStage ?? null;
87
+
88
+ function runTimers() {
89
+ for (let guard = 0; guard < 100000; guard++) {
90
+ let next = null;
91
+ for (const timer of timers.values()) if (timer.due <= now && (!next || timer.due < next.due || (timer.due === next.due && timer.id < next.id))) next = timer;
92
+ if (!next) return;
93
+ if (next.every) next.due += next.every; else timers.delete(next.id);
94
+ try { if (typeof next.fn === "function") next.fn(...next.args); } catch (error) { record(0, `timer error: ${error?.message ?? error}`); }
95
+ }
96
+ }
97
+ function runRaf() {
98
+ const batch = rafs;
99
+ rafs = new Map();
100
+ for (const cb of batch.values()) { try { cb(now); } catch (error) { record(0, `animation-frame error: ${error?.message ?? error}`); } }
101
+ }
102
+
103
+ async function step(frame, settle = true) {
104
+ const fps = config.fps;
105
+ const t = frame / fps;
106
+ now = (frame * 1000) / fps;
107
+ window.LitStage?._beginFrame?.();
108
+ canvasTexts.clear();
109
+ const live = new Set(document.getAnimations());
110
+ for (const [animation, info] of tracked) {
111
+ if (!live.has(animation)) { tracked.delete(animation); continue; }
112
+ if (info.finished) continue;
113
+ const local = (t - info.birth) * 1000;
114
+ const end = animation.effect?.getComputedTiming().endTime;
115
+ if (Number.isFinite(end) && local >= end) { animation.currentTime = end; animation.finish(); info.finished = true; await pump(); }
116
+ else animation.currentTime = local;
117
+ }
118
+ for (const [svg, birth] of svgRoots) { svg.pauseAnimations(); svg.setCurrentTime(Math.max(0, t - birth)); }
119
+ runTimers();
120
+ await pump();
121
+ runRaf();
122
+ await pump();
123
+ const def = contract();
124
+ if (def && typeof def.render === "function") def.render(t);
125
+ await pump();
126
+ getComputedStyle(document.documentElement).opacity;
127
+ for (const animation of document.getAnimations()) {
128
+ if (tracked.has(animation)) continue;
129
+ animation.pause();
130
+ tracked.set(animation, { birth: t, finished: false });
131
+ animation.currentTime = 0;
132
+ }
133
+ for (const svg of document.querySelectorAll("svg")) {
134
+ if (svg.ownerSVGElement || svgRoots.has(svg)) continue;
135
+ svgRoots.set(svg, t);
136
+ svg.pauseAnimations();
137
+ svg.setCurrentTime(0);
138
+ }
139
+ document.documentElement.getBoundingClientRect();
140
+ await document.fonts.ready;
141
+ await Promise.all([...document.images].filter((img) => !img.complete).map((img) => img.decode().catch(() => {})));
142
+ if (settle) await new Promise((resolve) => nativeRaf(() => nativeRaf(resolve)));
143
+ return violations.length;
144
+ }
145
+ // Frames that are not captured still run every step in order; only the compositor wait is skipped.
146
+ async function stepRange(from, to) {
147
+ for (let frame = from; frame <= to; frame++) await step(frame, false);
148
+ return violations.length;
149
+ }
150
+
151
+ // Before frame 0: load every face, decode every raster, make every img eager.
152
+ async function prepare(rasterUrls) {
153
+ await document.fonts.ready;
154
+ await Promise.all([...document.fonts].map((face) => face.load().catch(() => null)));
155
+ for (const img of document.images) img.loading = "eager";
156
+ await Promise.all([...document.images].map((img) => img.decode().catch(() => {})));
157
+ await Promise.all(rasterUrls.map((url) => { const img = new Image(); img.src = url; return img.decode().catch(() => {}); }));
158
+ for (const node of document.querySelectorAll("video,audio,iframe,object,embed,frame")) inspect(node);
159
+ const def = contract();
160
+ return def ? { width: def.width, height: def.height, fps: def.fps, duration: def.duration, render: typeof def.render === "function" } : null;
161
+ }
162
+
163
+ Object.defineProperty(window, "__litStage", {
164
+ value: Object.freeze({
165
+ seed: config.seed >>> 0, step, stepRange, prepare, violations, webgl,
166
+ canvasTexts: () => [...canvasTexts], registered: () => (window.LitStage?.registeredText ?? []).map((entry) => ({ ...entry })),
167
+ nativeRaf
168
+ }),
169
+ configurable: false, enumerable: false, writable: false
170
+ });
171
+ })();
@@ -0,0 +1,47 @@
1
+ // Worker thread for the stage capture: decodes one screenshot PNG to exact RGBA, hashes it, computes
2
+ // the flash-audit cells and the near-black statistic, and makes the preview-sized copy when asked, so
3
+ // the browser can step the next frame while this one is analysed.
4
+ import { createHash } from "node:crypto";
5
+ import { parentPort } from "node:worker_threads";
6
+ import { auditCells, flashGeometryFor, linearLut } from "../flash.mjs";
7
+ import { areaResize, decodePng, encodePng } from "../png.mjs";
8
+
9
+ function toRgba(image) {
10
+ if (image.channels === 4) return image.pixels;
11
+ const out = Buffer.alloc(image.width * image.height * 4);
12
+ for (let i = 0, j = 0; i < image.pixels.length; i += image.channels, j += 4) {
13
+ const g = image.channels === 1;
14
+ out[j] = image.pixels[i]; out[j + 1] = g ? image.pixels[i] : image.pixels[i + 1]; out[j + 2] = g ? image.pixels[i] : image.pixels[i + 2]; out[j + 3] = 255;
15
+ }
16
+ return out;
17
+ }
18
+
19
+ // p99.5 of linear luminance, the near-black statistic MO-D-03 reads.
20
+ function p995(rgba) {
21
+ const bins = new Uint32Array(1024);
22
+ for (let i = 0; i < rgba.length; i += 4) bins[Math.min(1023, Math.floor((0.2126 * linearLut[rgba[i]] + 0.7152 * linearLut[rgba[i + 1]] + 0.0722 * linearLut[rgba[i + 2]]) * 1024))]++;
23
+ const target = (rgba.length / 4) * 0.995;
24
+ let acc = 0;
25
+ for (let b = 0; b < 1024; b++) { acc += bins[b]; if (acc >= target) return (b + 1) / 1024; }
26
+ return 1;
27
+ }
28
+
29
+ parentPort.on("message", ({ id, png, width, height, preview }) => {
30
+ try {
31
+ const image = decodePng(Buffer.from(png));
32
+ if (image.width !== width || image.height !== height) {
33
+ parentPort.postMessage({ id, error: `the capture is ${image.width}x${image.height}, not ${width}x${height}` });
34
+ return;
35
+ }
36
+ const rgba = toRgba(image);
37
+ const cells = auditCells(rgba, width, height, flashGeometryFor(width, height));
38
+ const hash = createHash("sha256").update(rgba).digest("hex");
39
+ const out = { id, hash, p995L: Number(p995(rgba).toFixed(5)), cells };
40
+ if (preview) out.previewPng = encodePng(preview.width, preview.height, areaResize(rgba, width, height, preview.width, preview.height, 4), 4, 1);
41
+ const copy = rgba.byteOffset === 0 && rgba.byteLength === rgba.buffer.byteLength ? new Uint8Array(rgba.buffer) : Uint8Array.from(rgba);
42
+ out.rgba = copy;
43
+ parentPort.postMessage(out, [copy.buffer, cells.R.buffer, cells.G.buffer, cells.B.buffer, cells.L.buffer]);
44
+ } catch (error) {
45
+ parentPort.postMessage({ id, error: String(error?.message ?? error) });
46
+ }
47
+ });