thursday-agent 0.21.0 → 0.22.0

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 (397) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/_not-found.html +1 -1
  13. package/.next/server/app/_not-found.rsc +12 -12
  14. package/.next/server/app/_not-found.segments/_full.segment.rsc +12 -12
  15. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +11 -11
  16. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  17. package/.next/server/app/api/artifact/route.js +9 -8
  18. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  19. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  20. package/.next/server/app/api/bot/memory/route.js +9 -8
  21. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  22. package/.next/server/app/api/bot/route.js +9 -8
  23. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  24. package/.next/server/app/api/bot/thread/[id]/route.js +7 -6
  25. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  26. package/.next/server/app/api/bot/thread/file/route.js +17 -16
  27. package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
  28. package/.next/server/app/api/bot/thread/route.js +8 -7
  29. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  30. package/.next/server/app/api/config/route.js +5 -4
  31. package/.next/server/app/api/config/route.js.nft.json +1 -1
  32. package/.next/server/app/api/events/route.js.nft.json +1 -1
  33. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  34. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  35. package/.next/server/app/api/llm-model/automatic/route.js +8 -7
  36. package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
  37. package/.next/server/app/api/llm-model/catalog/[provider]/route.js +8 -7
  38. package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -1
  39. package/.next/server/app/api/llm-model/credits/[provider]/route.js +8 -7
  40. package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -1
  41. package/.next/server/app/api/llm-model/route.js +9 -8
  42. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  43. package/.next/server/app/api/llm-model/subscription/route.js +9 -8
  44. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  45. package/.next/server/app/api/mcp/[name]/route.js +6 -5
  46. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  47. package/.next/server/app/api/mcp/oauth/callback/route.js +6 -5
  48. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  49. package/.next/server/app/api/mcp/route.js +6 -5
  50. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  51. package/.next/server/app/api/mcp/tools/route.js +6 -5
  52. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  53. package/.next/server/app/api/memory/edit/route.js +13 -12
  54. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  55. package/.next/server/app/api/memory/route.js +6 -5
  56. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  57. package/.next/server/app/api/reach/route.js +19 -18
  58. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  59. package/.next/server/app/api/routine/route.js +9 -8
  60. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  61. package/.next/server/app/api/running/route.js.nft.json +1 -1
  62. package/.next/server/app/api/signins/route.js +5 -4
  63. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  64. package/.next/server/app/api/skills/[source]/[name]/route.js +9 -8
  65. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  66. package/.next/server/app/api/skills/route.js +9 -8
  67. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  68. package/.next/server/app/api/thursday/call/end/route.js +6 -5
  69. package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
  70. package/.next/server/app/api/thursday/call/plan/route.js +15 -14
  71. package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
  72. package/.next/server/app/api/thursday/call/route.js +7 -6
  73. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  74. package/.next/server/app/api/thursday/settings/route.js +6 -5
  75. package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
  76. package/.next/server/app/api/thursday/text/route.js +17 -16
  77. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  78. package/.next/server/app/api/thursday/tool-call/route.js +15 -14
  79. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  80. package/.next/server/app/api/workspace/files/route.js +8 -7
  81. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  82. package/.next/server/app/api/workspace/route.js +9 -8
  83. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  84. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
  85. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  86. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  88. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  89. package/.next/server/app/page/react-loadable-manifest.json +15 -1
  90. package/.next/server/app/page/server-reference-manifest.json +63 -63
  91. package/.next/server/app/page.js.nft.json +1 -1
  92. package/.next/server/app/page_client-reference-manifest.js +1 -1
  93. package/.next/server/chunks/[root-of-the-server]__0-5d50l._.js +3 -0
  94. package/.next/server/chunks/[root-of-the-server]__005onk_._.js +3 -0
  95. package/.next/server/chunks/[root-of-the-server]__00dtf7h._.js +3 -0
  96. package/.next/server/chunks/[root-of-the-server]__00f051a._.js +7 -0
  97. package/.next/server/chunks/[root-of-the-server]__019e1fy._.js +2 -2
  98. package/.next/server/chunks/[root-of-the-server]__01jpmcj._.js +1 -1
  99. package/.next/server/chunks/[root-of-the-server]__0340k46._.js +7 -0
  100. package/.next/server/chunks/[root-of-the-server]__03bjojd._.js +1 -1
  101. package/.next/server/chunks/[root-of-the-server]__03vunn6._.js +1 -1
  102. package/.next/server/chunks/[root-of-the-server]__05fq824._.js +3 -0
  103. package/.next/server/chunks/[root-of-the-server]__06kxzw-._.js +1 -1
  104. package/.next/server/chunks/[root-of-the-server]__08922kg._.js +3 -0
  105. package/.next/server/chunks/[root-of-the-server]__0atwstu._.js +1 -1
  106. package/.next/server/chunks/[root-of-the-server]__0btxiu1._.js +3 -0
  107. package/.next/server/chunks/[root-of-the-server]__0d-dfqm._.js +1 -1
  108. package/.next/server/chunks/[root-of-the-server]__0gmxpev._.js +3 -0
  109. package/.next/server/chunks/[root-of-the-server]__0itmdqy._.js +3 -0
  110. package/.next/server/chunks/[root-of-the-server]__0m0qglo._.js +5 -0
  111. package/.next/server/chunks/[root-of-the-server]__0mh1tgg._.js +1 -1
  112. package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +1 -1
  113. package/.next/server/chunks/[root-of-the-server]__0ndw2yj._.js +1 -1
  114. package/.next/server/chunks/[root-of-the-server]__0sfx6id._.js +3 -0
  115. package/.next/server/chunks/[root-of-the-server]__0xn7a8p._.js +3 -0
  116. package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
  117. package/.next/server/chunks/[root-of-the-server]__1478lu3._.js +1 -1
  118. package/.next/server/chunks/[root-of-the-server]__16y0k92._.js +3 -0
  119. package/.next/server/chunks/[root-of-the-server]__17kdjf6._.js +1 -1
  120. package/.next/server/chunks/[root-of-the-server]__17m7ag9._.js +1 -1
  121. package/.next/server/chunks/[root-of-the-server]__19aqyg-._.js +1 -1
  122. package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +1 -1
  123. package/.next/server/chunks/[root-of-the-server]__1a0xgyh._.js +1 -1
  124. package/.next/server/chunks/[root-of-the-server]__1ceammd._.js +1 -1
  125. package/.next/server/chunks/{[root-of-the-server]__01y-8gg._.js → [root-of-the-server]__1clkgmj._.js} +3 -3
  126. package/.next/server/chunks/[root-of-the-server]__1dth047._.js +1 -1
  127. package/.next/server/chunks/[root-of-the-server]__1g08s7l._.js +5 -0
  128. package/.next/server/chunks/[root-of-the-server]__1huywqp._.js +1 -1
  129. package/.next/server/chunks/[root-of-the-server]__1ij4h2a._.js +3 -0
  130. package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
  131. package/.next/server/chunks/[root-of-the-server]__1o7z93z._.js +1 -1
  132. package/.next/server/chunks/[root-of-the-server]__1onvx8x._.js +1 -1
  133. package/.next/server/chunks/[root-of-the-server]__1q1s4ls._.js +3 -0
  134. package/.next/server/chunks/[root-of-the-server]__1qa67zs._.js +3 -0
  135. package/.next/server/chunks/[root-of-the-server]__1t-mfa4._.js +5 -0
  136. package/.next/server/chunks/[root-of-the-server]__20ofm9t._.js +3 -0
  137. package/.next/server/chunks/_0-qt5if._.js +1 -1
  138. package/.next/server/chunks/_02mn8d7._.js +1 -1
  139. package/.next/server/chunks/_03p6r2-._.js +1 -1
  140. package/.next/server/chunks/_0483t_f._.js +1 -1
  141. package/.next/server/chunks/_06b5b4-._.js +1 -1
  142. package/.next/server/chunks/_06u9yo-._.js +1 -1
  143. package/.next/server/chunks/_07pkeds._.js +1 -1
  144. package/.next/server/chunks/_08354bn._.js +21 -19
  145. package/.next/server/chunks/_09rtyfn._.js +93 -91
  146. package/.next/server/chunks/_0cq69mm._.js +1 -1
  147. package/.next/server/chunks/_0fau3ya._.js +1 -1
  148. package/.next/server/chunks/_0ggqpiz._.js +1 -1
  149. package/.next/server/chunks/_0gxz_1b._.js +1 -1
  150. package/.next/server/chunks/_0lcthk8._.js +1 -1
  151. package/.next/server/chunks/_0p27in2._.js +1 -1
  152. package/.next/server/chunks/_0ue8nq-._.js +1 -1
  153. package/.next/server/chunks/_0uv1gs1._.js +1 -1
  154. package/.next/server/chunks/_0wyh244._.js +21 -19
  155. package/.next/server/chunks/_0zwjr-g._.js +1 -1
  156. package/.next/server/chunks/_1-wp0r0._.js +1 -1
  157. package/.next/server/chunks/_11y8h29._.js +1 -1
  158. package/.next/server/chunks/_14xuq46._.js +93 -91
  159. package/.next/server/chunks/_17fjc-7._.js +5 -0
  160. package/.next/server/chunks/_1823_7a._.js +4 -4
  161. package/.next/server/chunks/_18z965x._.js +1 -1
  162. package/.next/server/chunks/_1ac33qw._.js +1 -1
  163. package/.next/server/chunks/_1cw6-rv._.js +3 -0
  164. package/.next/server/chunks/_1dcbwn-._.js +1 -1
  165. package/.next/server/chunks/_1evvnbp._.js +18 -0
  166. package/.next/server/chunks/_1gn2r2q._.js +15 -15
  167. package/.next/server/chunks/{_00lwnht._.js → _1hw1ujv._.js} +2 -2
  168. package/.next/server/chunks/_1icgbi8._.js +18 -0
  169. package/.next/server/chunks/{_0txk_9z._.js → _1jtvbp9._.js} +2 -2
  170. package/.next/server/chunks/_1ko5shz._.js +1 -1
  171. package/.next/server/chunks/_1ksyu6r._.js +1 -1
  172. package/.next/server/chunks/{_1ntwp1s._.js → _1mgzs18._.js} +1 -1
  173. package/.next/server/chunks/_1q42187._.js +4 -4
  174. package/.next/server/chunks/_1q6e56i._.js +15 -15
  175. package/.next/server/chunks/_1t43w6q._.js +1 -1
  176. package/.next/server/chunks/_1t8fv7b._.js +18 -0
  177. package/.next/server/chunks/_1tjwvoz._.js +1 -1
  178. package/.next/server/chunks/_1ufbxe1._.js +1 -1
  179. package/.next/server/chunks/_1uu4wjr._.js +1 -1
  180. package/.next/server/chunks/{_0q6gng9._.js → _1v4id5q._.js} +2 -2
  181. package/.next/server/chunks/{_07vwkt7._.js → _1v5qol2._.js} +2 -2
  182. package/.next/server/chunks/_1wg0cqo._.js +1 -1
  183. package/.next/server/chunks/_1wgae1c._.js +3 -0
  184. package/.next/server/chunks/_1x2xiyw._.js +1 -1
  185. package/.next/server/chunks/_1xps4ob._.js +3 -0
  186. package/.next/server/chunks/_201k0ah._.js +1 -1
  187. package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
  188. package/.next/server/chunks/features_bot_08z387_._.js +4 -4
  189. package/.next/server/chunks/node_modules_zod_v4_01bha1c._.js +60 -0
  190. package/.next/server/chunks/node_modules_zod_v4_0b99z6a._.js +60 -0
  191. package/.next/server/chunks/node_modules_zod_v4_0r3ybe4._.js +60 -0
  192. package/.next/server/chunks/node_modules_zod_v4_1t1yj1u._.js +60 -0
  193. package/.next/server/chunks/node_modules_zod_v4_1zz6lo1._.js +60 -0
  194. package/.next/server/chunks/ssr/[root-of-the-server]__0eloa6y._.js +5 -5
  195. package/.next/server/chunks/ssr/[root-of-the-server]__0jjj49d._.js +3 -0
  196. package/.next/server/chunks/ssr/[root-of-the-server]__0yyxgt2._.js +3 -0
  197. package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
  198. package/.next/server/chunks/ssr/[root-of-the-server]__203utm3._.js +3 -0
  199. package/.next/server/chunks/ssr/[root-of-the-server]__20t_4l2._.js +1 -1
  200. package/.next/server/chunks/ssr/_0-y08rv._.js +3 -0
  201. package/.next/server/chunks/ssr/_00buy3i._.js +162 -0
  202. package/.next/server/chunks/ssr/_014_wjp._.js +3 -0
  203. package/.next/server/chunks/ssr/_07m4ii5._.js +3 -0
  204. package/.next/server/chunks/ssr/_09a6bpd._.js +1 -1
  205. package/.next/server/chunks/ssr/{_1569s5b._.js → _0gn_i4s._.js} +2 -2
  206. package/.next/server/chunks/ssr/_0iuvjnw._.js +3 -0
  207. package/.next/server/chunks/ssr/_0j6rtjm._.js +6 -0
  208. package/.next/server/chunks/ssr/{_19u7y57._.js → _0ntol64._.js} +2 -2
  209. package/.next/server/chunks/ssr/_0ogkeu-._.js +3 -0
  210. package/.next/server/chunks/ssr/{_1h0hk_h._.js → _0t_e9rd._.js} +2 -2
  211. package/.next/server/chunks/ssr/{_1-zhg63._.js → _0u43zjx._.js} +2 -2
  212. package/.next/server/chunks/ssr/_0ux4i2m._.js +1 -1
  213. package/.next/server/chunks/ssr/{_1iix_k_._.js → _0xurp8n._.js} +2 -2
  214. package/.next/server/chunks/ssr/_10sc7ab._.js +3 -0
  215. package/.next/server/chunks/ssr/_12hdw8x._.js +22 -20
  216. package/.next/server/chunks/ssr/{_02ybodf._.js → _14nwim3._.js} +2 -2
  217. package/.next/server/chunks/ssr/{_2024r5e._.js → _16o81mn._.js} +2 -2
  218. package/.next/server/chunks/ssr/_1bfrntd._.js +2 -2
  219. package/.next/server/chunks/ssr/_1crszf7._.js +1 -1
  220. package/.next/server/chunks/ssr/_1e01b-_._.js +3 -0
  221. package/.next/server/chunks/ssr/{_0y0qnim._.js → _1gz4ov7._.js} +3 -3
  222. package/.next/server/chunks/ssr/_1neoj22._.js +2 -1
  223. package/.next/server/chunks/ssr/{_04ik9s8._.js → _1nfv27b._.js} +2 -2
  224. package/.next/server/chunks/ssr/_1nwey7a._.js +3 -0
  225. package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
  226. package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
  227. package/.next/server/chunks/ssr/features_bot_06n7hmd._.js +3 -0
  228. package/.next/server/chunks/ssr/features_bot_0tb4ui-._.js +1 -1
  229. package/.next/server/chunks/ssr/{_07nmtxo._.js → features_bot_1knyan7._.js} +2 -2
  230. package/.next/server/chunks/ssr/{features_config_1l7bn84._.js → features_config_09wq1s9._.js} +3 -3
  231. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  232. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  233. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  234. package/.next/server/chunks/ssr/features_thursday_0cf9y0b._.js +3 -0
  235. package/.next/server/chunks/ssr/features_thursday_components_ascii-orb_tsx_1yug8cw._.js +3 -0
  236. package/.next/server/chunks/ssr/features_thursday_components_here-globe_tsx_055duhw._.js +3 -0
  237. package/.next/server/chunks/ssr/{node_modules_1bj1zfp._.js → node_modules_01fukqn._.js} +1 -1
  238. package/.next/server/chunks/ssr/{node_modules_1r-1n7c._.js → node_modules_01v7ybp._.js} +1 -1
  239. package/.next/server/chunks/ssr/{node_modules_0f0lohc._.js → node_modules_0536cp2._.js} +1 -1
  240. package/.next/server/chunks/ssr/{node_modules_13iz-t6._.js → node_modules_056xgci._.js} +1 -1
  241. package/.next/server/chunks/ssr/{node_modules_1rnfv0r._.js → node_modules_06n6ruk._.js} +1 -1
  242. package/.next/server/chunks/ssr/{node_modules_1d5j3h5._.js → node_modules_08m1gvh._.js} +1 -1
  243. package/.next/server/chunks/ssr/{node_modules_1_j-et6._.js → node_modules_0_zk6yd._.js} +1 -1
  244. package/.next/server/chunks/ssr/{node_modules_0c1grmu._.js → node_modules_0cpegwf._.js} +1 -1
  245. package/.next/server/chunks/ssr/{node_modules_107249-._.js → node_modules_0e398ts._.js} +1 -1
  246. package/.next/server/chunks/ssr/{node_modules_0ja2eo8._.js → node_modules_0ie8g6a._.js} +2 -2
  247. package/.next/server/chunks/ssr/{node_modules_074pspl._.js → node_modules_0ksqeyy._.js} +1 -1
  248. package/.next/server/chunks/ssr/{node_modules_0ydatn4._.js → node_modules_0m-dnm-._.js} +1 -1
  249. package/.next/server/chunks/ssr/{node_modules_0eoqrzb._.js → node_modules_0m2oth3._.js} +1 -1
  250. package/.next/server/chunks/ssr/{node_modules_1b6sm1g._.js → node_modules_0yn2z6s._.js} +1 -1
  251. package/.next/server/chunks/ssr/{node_modules_0uuobx8._.js → node_modules_12hh0bx._.js} +1 -1
  252. package/.next/server/chunks/ssr/{node_modules_0q-53p6._.js → node_modules_13dwal5._.js} +1 -1
  253. package/.next/server/chunks/ssr/{node_modules_0efmaot._.js → node_modules_16tn8xu._.js} +1 -1
  254. package/.next/server/chunks/ssr/{node_modules_0x4geuk._.js → node_modules_19r9vjv._.js} +1 -1
  255. package/.next/server/chunks/ssr/{node_modules_0k9lm-f._.js → node_modules_1bvw77g._.js} +1 -1
  256. package/.next/server/chunks/ssr/{node_modules_1dgdpcc._.js → node_modules_1ctm_ju._.js} +1 -1
  257. package/.next/server/chunks/ssr/{node_modules_1oo6jfv._.js → node_modules_1dlue-g._.js} +1 -1
  258. package/.next/server/chunks/ssr/{node_modules_1sbozb5._.js → node_modules_1fqgrh0._.js} +1 -1
  259. package/.next/server/chunks/ssr/{node_modules_17eaxbw._.js → node_modules_1i-g3bz._.js} +1 -1
  260. package/.next/server/chunks/ssr/{node_modules_1b_78mo._.js → node_modules_1jf8aik._.js} +1 -1
  261. package/.next/server/chunks/ssr/{node_modules_0vva828._.js → node_modules_1kfbdfo._.js} +1 -1
  262. package/.next/server/chunks/ssr/{node_modules_0lu90ps._.js → node_modules_1zalmtr._.js} +1 -1
  263. package/.next/server/chunks/ssr/{node_modules_1qgte25._.js → node_modules_1zdz2zf._.js} +1 -1
  264. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0obor-y._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0nj1l8f._.js} +1 -1
  265. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0oip1-o._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_17ok98u._.js} +1 -1
  266. package/.next/server/middleware-build-manifest.js +3 -3
  267. package/.next/server/pages/404.html +1 -1
  268. package/.next/server/pages/500.html +1 -1
  269. package/.next/server/server-reference-manifest.js +1 -1
  270. package/.next/server/server-reference-manifest.json +64 -64
  271. package/.next/static/chunks/01r1uco3ikisc.js +2 -0
  272. package/.next/static/chunks/{33s9l7hkzyylm.js → 052u13mcoxt87.js} +1 -1
  273. package/.next/static/chunks/{023rfhzsxzhh1.js → 05blzta_1i7c2.js} +1 -1
  274. package/.next/static/chunks/09kwsjbmr_z1w.js +1 -0
  275. package/.next/static/chunks/0go5_9zqag7l0.js +1 -0
  276. package/.next/static/chunks/0hpx0--bh7vld.js +1 -0
  277. package/.next/static/chunks/0o0vshni5ny91.js +1 -0
  278. package/.next/static/chunks/0ynv7zu_bguve.js +1 -0
  279. package/.next/static/chunks/0zi59tghmg1lu.js +18 -0
  280. package/.next/static/chunks/1_ftsgxa-sia_.js +1 -0
  281. package/.next/static/chunks/1cg3torc90q5t.js +1 -0
  282. package/.next/static/chunks/{3zhqveam0_kub.js → 1dy5xaxjdsy11.js} +1 -1
  283. package/.next/static/chunks/1qnx1h5c8f93b.js +1 -0
  284. package/.next/static/chunks/1rwn3d9ji5w35.js +1 -0
  285. package/.next/static/chunks/{1tyxz6thgf2w6.js → 1so3f5fi7e5g9.js} +1 -1
  286. package/.next/static/chunks/1ya41wxfmp4s8.js +1 -0
  287. package/.next/static/chunks/27rwkfu7_xvs1.js +4 -0
  288. package/.next/static/chunks/2hueh8masqd91.js +15 -0
  289. package/.next/static/chunks/2jrt_752fqz2f.js +1 -0
  290. package/.next/static/chunks/{3fcnfq383hu-y.js → 2nbj2t9yp8ke9.js} +1 -1
  291. package/.next/static/chunks/2ogme4qydxnaq.js +3 -0
  292. package/.next/static/chunks/2r2tocw2rpvm2.js +1 -0
  293. package/.next/static/chunks/2t4kimg1lt-p7.js +2 -0
  294. package/.next/static/chunks/2w6y71o27my_z.js +1 -0
  295. package/.next/static/chunks/{2-2ts24vi9ete.js → 3146sccz1j76i.js} +1 -1
  296. package/.next/static/chunks/31_am8rtmk_tv.css +1 -0
  297. package/.next/static/chunks/{41iv7b8_3z92h.js → 35ehi-okrfot5.js} +1 -1
  298. package/.next/static/chunks/3866u-edsoyj3.js +1 -0
  299. package/.next/static/chunks/3drvp6w6dqzqg.js +1 -0
  300. package/.next/static/chunks/3qfhjwd9yuijo.js +1 -0
  301. package/.next/static/chunks/{3axovmkkuh1us.js → 3tyacy8fh5_18.js} +2 -2
  302. package/.next/static/chunks/3zv4wiqjl5kex.js +1 -0
  303. package/guide/bots.md +25 -5
  304. package/guide/calls.md +18 -9
  305. package/guide/setup.md +15 -4
  306. package/guide/trouble.md +2 -3
  307. package/package.json +1 -1
  308. package/public/here/NOTICE +43 -0
  309. package/public/here/world.json +1 -0
  310. package/skills/README.md +4 -0
  311. package/skills/artifact/SKILL.md +7 -6
  312. package/skills/artifact/references/motion.md +150 -0
  313. package/skills/artifact/runtime/motion/film.js +866 -0
  314. package/skills/artifact/runtime/motion/fonts/Gaegu-Bold.woff2 +0 -0
  315. package/skills/artifact/runtime/motion/fonts/OFL.txt +92 -0
  316. package/skills/artifact/runtime/motion/kit-core.js +699 -0
  317. package/skills/artifact/runtime/motion/kit-people.js +1305 -0
  318. package/skills/artifact/runtime/motion/kit-places.js +854 -0
  319. package/skills/artifact/runtime/motion/kit-things.js +903 -0
  320. package/skills/artifact/runtime/motion/motion.html +108 -0
  321. package/skills/artifact/runtime/motion/page.mjs +54 -0
  322. package/skills/artifact/runtime/motion/score.js +625 -0
  323. package/skills/artifact/scripts/book-video.mjs +1 -46
  324. package/skills/artifact/scripts/media.mjs +74 -0
  325. package/skills/artifact/scripts/motion.mjs +605 -0
  326. package/skills/artifact/templates/motion/birthday.js +182 -0
  327. package/skills/browser/SKILL.md +4 -1
  328. package/skills/browser/scripts/serve.mjs +26 -3
  329. package/skills/browser/scripts/session.mjs +12 -3
  330. package/.next/server/chunks/[root-of-the-server]__0-fn06g._.js +0 -3
  331. package/.next/server/chunks/[root-of-the-server]__03lc17t._.js +0 -3
  332. package/.next/server/chunks/[root-of-the-server]__06nspyt._.js +0 -3
  333. package/.next/server/chunks/[root-of-the-server]__09c88lb._.js +0 -3
  334. package/.next/server/chunks/[root-of-the-server]__09dxfp5._.js +0 -3
  335. package/.next/server/chunks/[root-of-the-server]__0_0w3ug._.js +0 -3
  336. package/.next/server/chunks/[root-of-the-server]__0ap1nbu._.js +0 -5
  337. package/.next/server/chunks/[root-of-the-server]__0bmtib_._.js +0 -7
  338. package/.next/server/chunks/[root-of-the-server]__0im1m7z._.js +0 -3
  339. package/.next/server/chunks/[root-of-the-server]__0mt72qk._.js +0 -7
  340. package/.next/server/chunks/[root-of-the-server]__0uj9rm-._.js +0 -3
  341. package/.next/server/chunks/[root-of-the-server]__0z5n9xz._.js +0 -5
  342. package/.next/server/chunks/[root-of-the-server]__16e_e0e._.js +0 -5
  343. package/.next/server/chunks/[root-of-the-server]__16gn7zn._.js +0 -3
  344. package/.next/server/chunks/[root-of-the-server]__18k8s-z._.js +0 -3
  345. package/.next/server/chunks/[root-of-the-server]__1aw-1kd._.js +0 -3
  346. package/.next/server/chunks/[root-of-the-server]__1kmnkbk._.js +0 -3
  347. package/.next/server/chunks/[root-of-the-server]__1op8qe5._.js +0 -3
  348. package/.next/server/chunks/[root-of-the-server]__1pkq_1z._.js +0 -3
  349. package/.next/server/chunks/[root-of-the-server]__20w_g71._.js +0 -3
  350. package/.next/server/chunks/_01c32w9._.js +0 -75
  351. package/.next/server/chunks/_02bov6_._.js +0 -75
  352. package/.next/server/chunks/_053bi70._.js +0 -60
  353. package/.next/server/chunks/_08s4vft._.js +0 -75
  354. package/.next/server/chunks/_0fb6dvr._.js +0 -75
  355. package/.next/server/chunks/_0iw19ig._.js +0 -75
  356. package/.next/server/chunks/_0mo_6or._.js +0 -5
  357. package/.next/server/chunks/_0poi1t2._.js +0 -75
  358. package/.next/server/chunks/_1d7og_q._.js +0 -75
  359. package/.next/server/chunks/_1o3fc2d._.js +0 -60
  360. package/.next/server/chunks/_20zp65o._.js +0 -60
  361. package/.next/server/chunks/ssr/[root-of-the-server]__03e9zqg._.js +0 -3
  362. package/.next/server/chunks/ssr/[root-of-the-server]__1hbvuqr._.js +0 -3
  363. package/.next/server/chunks/ssr/[root-of-the-server]__1y8_-v1._.js +0 -3
  364. package/.next/server/chunks/ssr/_00_9573._.js +0 -3
  365. package/.next/server/chunks/ssr/_03vw3u5._.js +0 -3
  366. package/.next/server/chunks/ssr/_0iwsdp7._.js +0 -3
  367. package/.next/server/chunks/ssr/_0llhg-6._.js +0 -3
  368. package/.next/server/chunks/ssr/_0o__2ss._.js +0 -3
  369. package/.next/server/chunks/ssr/_0pbav_w._.js +0 -3
  370. package/.next/server/chunks/ssr/_0yjn4jm._.js +0 -162
  371. package/.next/server/chunks/ssr/_186ifln._.js +0 -3
  372. package/.next/server/chunks/ssr/_1x4lhpf._.js +0 -3
  373. package/.next/server/chunks/ssr/_1xfiate._.js +0 -5
  374. package/.next/server/chunks/ssr/features_bot_1dvvmo3._.js +0 -3
  375. package/.next/server/chunks/ssr/features_thursday_0gbh5j_._.js +0 -3
  376. package/.next/static/chunks/06k2o5zxc3xhv.js +0 -1
  377. package/.next/static/chunks/0_s4z70lx1tgs.js +0 -1
  378. package/.next/static/chunks/0cbitatnyjhz7.js +0 -1
  379. package/.next/static/chunks/0m5-0kx85axzv.js +0 -18
  380. package/.next/static/chunks/0non225e2mzp-.js +0 -1
  381. package/.next/static/chunks/0q9b2n6l4flqb.js +0 -1
  382. package/.next/static/chunks/0uhddock-ik4v.js +0 -1
  383. package/.next/static/chunks/14y1gqfplan8a.js +0 -1
  384. package/.next/static/chunks/1pidafhkyxhqw.js +0 -1
  385. package/.next/static/chunks/1sy7zm5dplzym.css +0 -1
  386. package/.next/static/chunks/1t7u4xfljptkv.js +0 -1
  387. package/.next/static/chunks/2nf3mskfp9cyc.js +0 -15
  388. package/.next/static/chunks/2uraofiaoy32s.js +0 -1
  389. package/.next/static/chunks/2vw9_trh_ntv6.js +0 -2
  390. package/.next/static/chunks/2x6-fpctvucte.js +0 -1
  391. package/.next/static/chunks/33lm6ytc816te.js +0 -1
  392. package/.next/static/chunks/3p5q6rj40jmcy.js +0 -1
  393. package/.next/static/chunks/3p80hsvcabgw_.js +0 -3
  394. package/.next/static/chunks/3qez_j23ikyar.js +0 -1
  395. /package/.next/static/{gx61wKkj9_eBGMdyfbBlr → 8exfHAtcoebYtxjUC4ugl}/_buildManifest.js +0 -0
  396. /package/.next/static/{gx61wKkj9_eBGMdyfbBlr → 8exfHAtcoebYtxjUC4ugl}/_clientMiddlewareManifest.js +0 -0
  397. /package/.next/static/{gx61wKkj9_eBGMdyfbBlr → 8exfHAtcoebYtxjUC4ugl}/_ssgManifest.js +0 -0
@@ -0,0 +1,625 @@
1
+ // The film's music and its little sounds, made from nothing: a tune on the film's beat in the
2
+ // mood it asks for, chords under it, and a pop, a pen's scratch or a sparkle wherever its
3
+ // scenes asked for one. The same seed makes the same music, in the page's player and in the
4
+ // mp4 alike: `composeScore(film, rate)` gives { rate, left, right }.
5
+
6
+ function composeScore(film, rate = 48000) {
7
+ const SR = rate;
8
+ const spb = 60 / film.bpm;
9
+ const dur = film.duration + 0.05;
10
+ const N = Math.ceil(dur * SR);
11
+ const L = new Float32Array(N);
12
+ const R = new Float32Array(N);
13
+ let s0 = (film.seed * 2654435761) >>> 0 || 1;
14
+ const rnd = () => {
15
+ s0 = (s0 + 0x6d2b79f5) >>> 0;
16
+ let t = s0;
17
+ t = Math.imul(t ^ (t >>> 15), t | 1);
18
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
19
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
20
+ };
21
+ const pick = (a) => a[Math.floor(rnd() * a.length)];
22
+ const hz = (m) => 440 * 2 ** ((m - 69) / 12);
23
+ const TWO_PI = Math.PI * 2;
24
+
25
+ /** A sound laid in at `t` seconds, `pan` -1 left to 1 right. */
26
+ const put = (sig, t, pan = 0, gain = 1) => {
27
+ const i0 = Math.round(t * SR);
28
+ const gl = Math.cos(((pan + 1) * Math.PI) / 4) * gain;
29
+ const gr = Math.sin(((pan + 1) * Math.PI) / 4) * gain;
30
+ for (let i = 0; i < sig.length; i++) {
31
+ const k = i0 + i;
32
+ if (k < 0) continue;
33
+ if (k >= N) break;
34
+ L[k] += sig[i] * gl;
35
+ R[k] += sig[i] * gr;
36
+ }
37
+ };
38
+ const noise = (n) => {
39
+ const out = new Float32Array(n);
40
+ for (let i = 0; i < n; i++) out[i] = rnd() * 2 - 1;
41
+ return out;
42
+ };
43
+ /** A band of a sound kept, through a two-pole filter: the shape of a hiss. */
44
+ const band = (x, lo, hi) => {
45
+ // Kept under the rate's limit, where the filter would run away
46
+ hi = Math.min(hi, SR * 0.45);
47
+ lo = Math.min(lo, hi * 0.8);
48
+ const f0 = Math.sqrt(lo * hi);
49
+ const q = f0 / Math.max(1, hi - lo);
50
+ const w = (TWO_PI * f0) / SR;
51
+ const al = Math.sin(w) / (2 * q);
52
+ const b0 = al;
53
+ const a0 = 1 + al;
54
+ const a1 = -2 * Math.cos(w);
55
+ const a2 = 1 - al;
56
+ const out = new Float32Array(x.length);
57
+ let x1 = 0;
58
+ let x2 = 0;
59
+ let y1 = 0;
60
+ let y2 = 0;
61
+ for (let i = 0; i < x.length; i++) {
62
+ const y = (b0 * x[i] - b0 * x2 - a1 * y1 - a2 * y2) / a0;
63
+ x2 = x1;
64
+ x1 = x[i];
65
+ y2 = y1;
66
+ y1 = y;
67
+ out[i] = y;
68
+ }
69
+ return out;
70
+ };
71
+
72
+ // ---------------------------------------------------------------- instruments
73
+ // Each voice is a few sine partials, each dying away at its own rate: a sine made by
74
+ // turning a point around a circle (one multiply a sample), its decay by one more.
75
+ const osc = (out, f, amp, decay, phase = 0) => {
76
+ if (f >= SR / 2 || amp === 0) return;
77
+ const w = (TWO_PI * f) / SR;
78
+ const c = 2 * Math.cos(w);
79
+ let s1 = Math.sin(phase - w);
80
+ let s2 = Math.sin(phase - 2 * w);
81
+ const dk = Math.exp(-decay / SR);
82
+ let e = amp;
83
+ // Where it has died below hearing, it stops
84
+ const end =
85
+ decay > 0
86
+ ? Math.min(
87
+ out.length,
88
+ Math.ceil((Math.log(Math.abs(amp) / 1e-4) / decay) * SR),
89
+ )
90
+ : out.length;
91
+ for (let i = 0; i < end; i++) {
92
+ const v = c * s1 - s2;
93
+ s2 = s1;
94
+ s1 = v;
95
+ out[i] += v * e;
96
+ e *= dk;
97
+ }
98
+ };
99
+ /** How a note starts and stops: up in `attack` seconds, down over `release` after `len`. */
100
+ const shape = (out, attack, len, release, vel) => {
101
+ const a = Math.max(1, Math.round(attack * SR));
102
+ const r0 = Math.round(len * SR);
103
+ const r = Math.max(1, Math.round(release * SR));
104
+ const n = out.length;
105
+ for (let i = 0; i < n; i++) {
106
+ if (i < a) out[i] *= (i / a) * vel;
107
+ else if (i <= r0) out[i] *= vel;
108
+ else if (i < r0 + r) out[i] *= (1 - (i - r0) / r) * vel;
109
+ else out[i] = 0;
110
+ }
111
+ return out;
112
+ };
113
+ const voice = (secs, f, partials) => {
114
+ const out = new Float32Array(Math.ceil(secs * SR));
115
+ for (const [ratio, amp, decay, ph] of partials)
116
+ osc(out, f * ratio, amp, decay, ph ?? 0);
117
+ return out;
118
+ };
119
+ const musicbox = (m, len, vel) =>
120
+ shape(
121
+ voice(len + 1.5, hz(m), [
122
+ [1, 1, 2.6],
123
+ [2, 0.18, 5],
124
+ [2.76, 0.22, 7],
125
+ [5.4, 0.08, 11],
126
+ ]),
127
+ 0.002,
128
+ len + 1.5,
129
+ 0.01,
130
+ vel * 0.22,
131
+ );
132
+ const piano = (m, len, vel) => {
133
+ const ps = [[1.0015, 0.5, 1.1]];
134
+ for (let k = 1; k < 7; k++)
135
+ ps.push([k * (1 + 0.0004 * k * k), 1 / k ** 1.6, 0.9 + 0.55 * k, k]);
136
+ return shape(voice(len + 1.1, hz(m), ps), 0.006, len, 0.35, vel * 0.15);
137
+ };
138
+ const pluck = (m, len, vel) =>
139
+ shape(
140
+ voice(Math.min(len, 0.6) + 0.5, hz(m), [
141
+ [1, 1, 7],
142
+ [4, 0.4, 16],
143
+ [10, 0.2, 30],
144
+ ]),
145
+ 0.002,
146
+ 1,
147
+ 0.01,
148
+ vel * 0.22,
149
+ );
150
+ const bell = (m, len, vel) =>
151
+ shape(
152
+ voice(len + 1.4, hz(m), [
153
+ [1, 1, 3],
154
+ [2.76, 0.35, 6],
155
+ [5.4, 0.15, 10],
156
+ ]),
157
+ 0.002,
158
+ len + 1.4,
159
+ 0.01,
160
+ vel * 0.13,
161
+ );
162
+ const pad = (m, len, vel) => {
163
+ const ps = [];
164
+ for (const cents of [-6, 6])
165
+ for (let k = 1; k < 5; k++)
166
+ ps.push([k * 2 ** (cents / 1200), 1.4 / k ** 1.5, 0, cents + k]);
167
+ const out = voice(len + 0.9, hz(m), ps);
168
+ // A slow swell rather than a strike
169
+ const a = Math.min(Math.round(0.5 * SR), out.length);
170
+ for (let i = 0; i < a; i++) {
171
+ const q = i / a;
172
+ out[i] *= q * Math.sqrt(q);
173
+ }
174
+ return shape(out, 0.001, len, 0.85, vel * 0.026);
175
+ };
176
+ const bass = (m, len, vel) =>
177
+ shape(
178
+ voice(len + 0.5, hz(m), [
179
+ [1, 1, 1.3],
180
+ [2, 0.25, 1.3],
181
+ ]),
182
+ 0.01,
183
+ len,
184
+ 0.4,
185
+ vel * 0.16,
186
+ );
187
+ const kick = (vel) => {
188
+ const n = Math.ceil(0.35 * SR);
189
+ const out = new Float32Array(n);
190
+ let ph = 0;
191
+ for (let i = 0; i < n; i++) {
192
+ const t = i / SR;
193
+ ph += (TWO_PI * 55 * (1 + 0.8 * Math.exp(-t * 40))) / SR;
194
+ out[i] = Math.sin(ph) * Math.exp(-t * 14) * vel * 0.5;
195
+ }
196
+ return out;
197
+ };
198
+ const hiss = (len, lo, hi, decay, vel) => {
199
+ const n = Math.ceil(len * SR);
200
+ const x = band(noise(n), lo, hi);
201
+ for (let i = 0; i < n; i++)
202
+ x[i] *= Math.exp((-i / SR) * decay) * Math.min(1, i / (0.002 * SR)) * vel;
203
+ return x;
204
+ };
205
+
206
+ // ---------------------------------------------------------------- the moods
207
+ const MOODS = {
208
+ tender: {
209
+ key: 65,
210
+ lead: musicbox,
211
+ chord: piano,
212
+ arp: true,
213
+ padV: 0.8,
214
+ drums: false,
215
+ per: 2,
216
+ progs: [
217
+ [1, 5, 6, 4],
218
+ [1, 3, 4, 5],
219
+ [4, 5, 3, 6],
220
+ [1, 6, 4, 5],
221
+ ],
222
+ rhythm: [
223
+ [1, 0.5, 0.5, 1, 1],
224
+ [0.5, 0.5, 1, 2],
225
+ [1, 1, 1, 1],
226
+ [1.5, 0.5, 2],
227
+ ],
228
+ },
229
+ warm: {
230
+ key: 62,
231
+ lead: piano,
232
+ chord: piano,
233
+ arp: true,
234
+ padV: 1,
235
+ drums: false,
236
+ per: 2,
237
+ progs: [
238
+ [1, 5, 6, 4],
239
+ [1, 4, 6, 5],
240
+ [6, 4, 1, 5],
241
+ ],
242
+ rhythm: [
243
+ [1, 1, 2],
244
+ [0.5, 0.5, 1, 1, 1],
245
+ [1.5, 0.5, 1, 1],
246
+ ],
247
+ },
248
+ playful: {
249
+ key: 60,
250
+ lead: pluck,
251
+ chord: pluck,
252
+ arp: false,
253
+ padV: 0.35,
254
+ drums: "light",
255
+ per: 4,
256
+ progs: [
257
+ [1, 4, 5, 1],
258
+ [1, 6, 2, 5],
259
+ [4, 5, 1, 6],
260
+ ],
261
+ rhythm: [
262
+ [0.5, 0.5, 0.5, 0.5, 1, 1],
263
+ [1, 0.5, 0.5, 1, 1],
264
+ [0.5, 0.5, 1, 0.5, 0.5, 1],
265
+ ],
266
+ },
267
+ nostalgic: {
268
+ key: 57,
269
+ lead: piano,
270
+ chord: piano,
271
+ arp: true,
272
+ padV: 1,
273
+ drums: false,
274
+ per: 2,
275
+ progs: [
276
+ [6, 4, 1, 5],
277
+ [6, 5, 4, 5],
278
+ [4, 1, 5, 6],
279
+ ],
280
+ rhythm: [
281
+ [2, 1, 1],
282
+ [1, 1, 2],
283
+ [1.5, 0.5, 1, 1],
284
+ ],
285
+ second: musicbox,
286
+ },
287
+ celebratory: {
288
+ key: 67,
289
+ lead: bell,
290
+ chord: piano,
291
+ arp: false,
292
+ padV: 0.7,
293
+ drums: "full",
294
+ per: 4,
295
+ progs: [
296
+ [1, 5, 6, 4],
297
+ [4, 5, 1, 1],
298
+ [1, 4, 5, 5],
299
+ ],
300
+ rhythm: [
301
+ [0.5, 0.5, 1, 0.5, 0.5, 1],
302
+ [1, 1, 0.5, 0.5, 1],
303
+ [0.5, 0.5, 0.5, 0.5, 2],
304
+ ],
305
+ },
306
+ };
307
+ const M = MOODS[film.mood] ?? MOODS.warm;
308
+ const key = M.key + pick([0, 0, 2, -2, 3]);
309
+ const SCALE = [0, 2, 4, 5, 7, 9, 11];
310
+ const deg = (d, oct = 0) =>
311
+ key + SCALE[(d - 1) % 7] + 12 * (oct + Math.floor((d - 1) / 7));
312
+ const triad = (d) => [deg(d), deg(d + 2), deg(d + 4)];
313
+ const prog = pick(M.progs);
314
+ const total = film.totalBeats;
315
+ // The last chord lands two beats before the end of the scenes and rings through the hold
316
+ const endBeat = Math.max(0, total - 4);
317
+ const bigs = film.scenes.filter((s) => s.big).map((s) => s.b0);
318
+ const fullness = (b) => {
319
+ const k = b / Math.max(1, endBeat);
320
+ const lift = bigs.some((x) => b >= x && b < x + 8) ? 0.25 : 0;
321
+ return Math.min(1, 0.45 + 0.55 * k + lift);
322
+ };
323
+
324
+ // Chords, their bass, and the pad
325
+ let ci = 0;
326
+ for (let b = 0; b < endBeat; b += M.per, ci++) {
327
+ const d = prog[ci % prog.length];
328
+ const len = Math.min(M.per, endBeat - b);
329
+ const t = b * spb;
330
+ const tones = triad(d);
331
+ const v = fullness(b);
332
+ put(bass(deg(d) - 24, len * spb, 0.9), t, -0.1);
333
+ tones.forEach((m, i) =>
334
+ put(pad(m - 12, len * spb, M.padV * (0.4 + 0.6 * v)), t, -0.5 + i * 0.5),
335
+ );
336
+ if (M.arp) {
337
+ const seq = [tones[0] - 12, tones[1] - 12, tones[2] - 12, tones[1]];
338
+ for (let k = 0; k < len * 2; k++)
339
+ put(M.chord(seq[k % 4], spb * 0.9, 0.45 * v), t + (k * spb) / 2, 0.3);
340
+ } else {
341
+ for (let k = 0; k < len; k++)
342
+ tones.forEach((m, i) =>
343
+ put(
344
+ M.chord(m - 12, spb * 0.8, (k % 2 ? 0.35 : 0.5) * v),
345
+ t + k * spb + i * 0.01,
346
+ -0.2 + i * 0.2,
347
+ ),
348
+ );
349
+ }
350
+ if (M.drums)
351
+ for (let k = 0; k < len; k++) {
352
+ const tb = t + k * spb;
353
+ if (M.drums === "full" || k % 2 === 0) put(kick(0.8 * v), tb, 0);
354
+ if (k % 2 === 1) put(hiss(0.18, 900, 5000, 30, 0.35 * v), tb, 0.1);
355
+ if (M.drums === "full")
356
+ put(hiss(0.06, 5000, 12000, 60, 0.12 * v), tb + spb / 2, 0.3);
357
+ }
358
+ }
359
+ // The last chord, long
360
+ {
361
+ const t = endBeat * spb;
362
+ const len = (total - endBeat) * spb;
363
+ put(bass(deg(1) - 24, len, 0.9), t, -0.1);
364
+ triad(1).forEach((m, i) => {
365
+ put(pad(m - 12, len, M.padV), t, -0.5 + i * 0.5);
366
+ put(M.chord(m - 12, len, 0.5), t + i * 0.06, -0.2 + i * 0.2);
367
+ });
368
+ put(M.lead(deg(1, 1), len, 0.9), t + 0.18, 0.1);
369
+ }
370
+
371
+ // The tune, in steps of the scale: each chord's first note one of its own, the notes after
372
+ // it walking toward the next chord's, phrases of two chords that come back A A B A
373
+ const CELLS =
374
+ M.per === 2
375
+ ? [
376
+ [1, 1],
377
+ [0.5, 0.5, 1],
378
+ [1.5, 0.5],
379
+ [1, 0.5, 0.5],
380
+ ]
381
+ : [
382
+ [1, 1, 1, 1],
383
+ [0.5, 0.5, 1, 2],
384
+ [1, 0.5, 0.5, 2],
385
+ [2, 1, 1],
386
+ [1.5, 0.5, 1, 1],
387
+ ];
388
+ const midiOf = (d) => key + SCALE[((d % 7) + 7) % 7] + 12 * Math.floor(d / 7);
389
+ const tonesOf = (chordDeg) => [0, 2, 4].map((k) => chordDeg - 1 + k);
390
+ const nearest = (from, chordDeg) => {
391
+ let best = null;
392
+ for (const t of tonesOf(chordDeg))
393
+ for (const o of [-7, 0, 7, 14]) {
394
+ const c = t + o;
395
+ if (c < 5 || c > 16) continue;
396
+ const cost = Math.abs(c - from) + (c === from ? 1.5 : 0) + rnd() * 0.8;
397
+ if (!best || cost < best.cost) best = { c, cost };
398
+ }
399
+ return best?.c ?? 9;
400
+ };
401
+ const makePhrase = (chordAt, last) => {
402
+ const notes = [];
403
+ let d = nearest(9, chordAt(0));
404
+ const cells = [pick(CELLS), pick(CELLS)];
405
+ let b = 0;
406
+ cells.forEach((cell, ci) => {
407
+ const target = nearest(d, chordAt(ci));
408
+ cell.forEach((len, k) => {
409
+ if (k === 0) d = target;
410
+ else {
411
+ const next = ci === 0 ? nearest(d, chordAt(1)) : target;
412
+ const dir = Math.sign(next - d) || pick([-1, 1]);
413
+ d += dir * (rnd() < 0.8 ? 1 : 2);
414
+ }
415
+ d = Math.max(5, Math.min(16, d));
416
+ notes.push([b, midiOf(d), len]);
417
+ b += len;
418
+ });
419
+ });
420
+ if (last) {
421
+ // A phrase that closes rests on a long note of its chord
422
+ const end = notes[notes.length - 1];
423
+ end[2] += 0.5;
424
+ }
425
+ return notes;
426
+ };
427
+ const phraseBeats = M.per * 2;
428
+ const chordOfBeat = (b) => prog[Math.floor(b / M.per) % prog.length];
429
+ let A = null;
430
+ const form = ["A", "A", "B", "A"];
431
+ for (
432
+ let b = M.per, p = 0;
433
+ b + phraseBeats <= endBeat;
434
+ b += phraseBeats, p++
435
+ ) {
436
+ const kind = form[p % 4];
437
+ const chordAt = (ci) => chordOfBeat(b + ci * M.per);
438
+ // A comes back only where its chords are the same as when it was made
439
+ const same = A && A.chords.every((c, ci) => c === chordAt(ci));
440
+ const notes =
441
+ kind === "A" && same ? A.notes : makePhrase(chordAt, p % 4 === 3);
442
+ if (kind === "A" && !A) A = { notes, chords: [chordAt(0), chordAt(1)] };
443
+ const v = fullness(b);
444
+ for (const [nb, m, len] of notes) {
445
+ put(M.lead(m, len * spb, 0.9 * (0.6 + 0.4 * v)), (b + nb) * spb, 0.12);
446
+ if (M.second && v > 0.7)
447
+ put(M.second(m + 12, len * spb, 0.35), (b + nb) * spb, -0.2);
448
+ }
449
+ }
450
+ // A lift where a big moment starts
451
+ for (const b of bigs) {
452
+ put(hiss(1.6, 3000, 12000, 2.5, 0.08), b * spb - 0.02, 0);
453
+ for (const [i, m] of [1, 3, 5, 8].entries())
454
+ put(bell(deg(m, 2), 1, 0.5), b * spb + i * 0.06, -0.4 + i * 0.25);
455
+ }
456
+
457
+ // ---------------------------------------------------------------- the sounds scenes asked for
458
+ const SOUNDS = {
459
+ pop(t) {
460
+ const n = Math.ceil(0.16 * SR);
461
+ const out = new Float32Array(n);
462
+ let ph = 0;
463
+ for (let i = 0; i < n; i++) {
464
+ const tt = i / SR;
465
+ ph += (TWO_PI * 330 * (1 + 2.2 * Math.min(1, tt / 0.07))) / SR;
466
+ out[i] =
467
+ Math.sin(ph) * Math.exp(-tt * 28) * Math.min(1, tt / 0.002) * 0.3;
468
+ }
469
+ put(out, t, -0.1);
470
+ },
471
+ write(t, len) {
472
+ const n = Math.ceil(Math.max(0.2, len) * SR);
473
+ const x = band(noise(n), 2500, 7500);
474
+ for (let i = 0; i < n; i++) {
475
+ const tt = i / SR;
476
+ const mod =
477
+ (0.5 +
478
+ 0.5 *
479
+ Math.sin(TWO_PI * 7.5 * tt + 2 * Math.sin(TWO_PI * 2.3 * tt))) *
480
+ (0.6 + 0.4 * Math.sin(TWO_PI * 3.1 * tt + 1));
481
+ x[i] *=
482
+ mod *
483
+ Math.min(1, tt / 0.05) *
484
+ Math.min(1, Math.max(0, (n / SR - tt) / 0.08)) *
485
+ 0.1;
486
+ }
487
+ put(x, t, 0.15);
488
+ },
489
+ sparkle(t) {
490
+ [89, 91, 93, 96, 98, 101, 103].forEach((m, i) =>
491
+ put(
492
+ bell(m - 12, 0.6, 0.35 * (1 - i * 0.06)),
493
+ t + i * 0.045,
494
+ -0.6 + i * 0.2,
495
+ ),
496
+ );
497
+ },
498
+ chime(t) {
499
+ [1, 5, 8].forEach((d, i) =>
500
+ put(bell(deg(d, 2), 1.2, 0.6), t + i * 0.09, -0.3 + i * 0.3),
501
+ );
502
+ },
503
+ whoosh(t) {
504
+ const n = Math.ceil(0.8 * SR);
505
+ const lo = band(noise(n), 300, 1200);
506
+ const hi = band(noise(n), 1200, 5000);
507
+ const out = new Float32Array(n);
508
+ for (let i = 0; i < n; i++) {
509
+ const tt = i / SR;
510
+ const mix = Math.min(1, tt / 0.6);
511
+ out[i] =
512
+ (lo[i] * (1 - mix) + hi[i] * mix) *
513
+ Math.sin(Math.PI * Math.min(1, tt / 0.8)) ** 2 *
514
+ 0.25;
515
+ }
516
+ put(out, t - 0.25, -0.3);
517
+ },
518
+ thump(t) {
519
+ put(kick(0.5), t, 0);
520
+ put(hiss(0.12, 150, 2500, 40, 0.5), t, 0);
521
+ },
522
+ clap(t) {
523
+ for (const [k, d] of [0, 0.006, 0.013].entries())
524
+ put(hiss(0.1, 800, 5000, 60, 0.9 - k * 0.2), t + d, 0);
525
+ },
526
+ boing(t) {
527
+ const n = Math.ceil(0.35 * SR);
528
+ const out = new Float32Array(n);
529
+ let ph = 0;
530
+ for (let i = 0; i < n; i++) {
531
+ const tt = i / SR;
532
+ ph +=
533
+ (TWO_PI *
534
+ 330 *
535
+ (1 + 0.8 * Math.exp(-tt * 18)) *
536
+ (1 + 0.03 * Math.sin(TWO_PI * 14 * tt))) /
537
+ SR;
538
+ out[i] =
539
+ Math.sin(ph) * Math.exp(-tt * 9) * Math.min(1, tt / 0.003) * 0.25;
540
+ }
541
+ put(out, t, 0.2);
542
+ },
543
+ rustle(t) {
544
+ const n = Math.ceil(0.6 * SR);
545
+ const x = band(noise(n), 1500, 8000);
546
+ const am = band(noise(n), 5, 40);
547
+ let peak = 1e-9;
548
+ for (let i = 0; i < n; i++) peak = Math.max(peak, Math.abs(am[i]));
549
+ for (let i = 0; i < n; i++)
550
+ x[i] *= (Math.abs(am[i]) / peak) * Math.sin((Math.PI * i) / n) * 0.35;
551
+ put(x, t - 0.1, 0.1);
552
+ },
553
+ blow(t) {
554
+ const n = Math.ceil(0.9 * SR);
555
+ const x = band(noise(n), 300, 2400);
556
+ for (let i = 0; i < n; i++)
557
+ x[i] *= Math.sin((Math.PI * i) / n) ** 1.5 * 0.4;
558
+ put(x, t, 0);
559
+ },
560
+ shutter(t) {
561
+ put(hiss(0.05, 2000, 8000, 80, 0.8), t, 0);
562
+ put(hiss(0.06, 1000, 6000, 70, 0.6), t + 0.08, 0);
563
+ },
564
+ };
565
+ for (const c of film.cues ?? []) SOUNDS[c.kind]?.(c.at, c.len);
566
+
567
+ // ---------------------------------------------------------------- a room for it all
568
+ // A small hall: eight combs and four all-passes per side, the classic reverb
569
+ const hall = (x, spread) => {
570
+ const out = new Float32Array(x.length);
571
+ const combs = [1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617].map((d) => ({
572
+ buf: new Float32Array(Math.round(((d + spread) * SR) / 44100)),
573
+ i: 0,
574
+ store: 0,
575
+ }));
576
+ const alls = [556, 441, 341, 225].map((d) => ({
577
+ buf: new Float32Array(Math.round(((d + spread) * SR) / 44100)),
578
+ i: 0,
579
+ }));
580
+ for (let n = 0; n < x.length; n++) {
581
+ const inp = x[n] * 0.015;
582
+ let s = 0;
583
+ for (const c of combs) {
584
+ const y = c.buf[c.i];
585
+ c.store = y * 0.8 + c.store * 0.2;
586
+ c.buf[c.i] = inp + c.store * 0.84;
587
+ if (++c.i === c.buf.length) c.i = 0;
588
+ s += y;
589
+ }
590
+ for (const a of alls) {
591
+ const y = a.buf[a.i];
592
+ a.buf[a.i] = s + y * 0.5;
593
+ if (++a.i === a.buf.length) a.i = 0;
594
+ s = y - s;
595
+ }
596
+ out[n] = s;
597
+ }
598
+ return out;
599
+ };
600
+ const wl = hall(L, 0);
601
+ const wr = hall(R, 23);
602
+ let peak = 1e-9;
603
+ const fadeFrom = N - Math.round(0.6 * SR);
604
+ for (let i = 0; i < N; i++) {
605
+ let l = L[i] + wl[i] * 1.1;
606
+ let r = R[i] + wr[i] * 1.1;
607
+ if (i > fadeFrom) {
608
+ const fade = (N - i) / (N - fadeFrom);
609
+ l *= fade;
610
+ r *= fade;
611
+ }
612
+ L[i] = l;
613
+ R[i] = r;
614
+ if (l > peak) peak = l;
615
+ else if (-l > peak) peak = -l;
616
+ if (r > peak) peak = r;
617
+ else if (-r > peak) peak = -r;
618
+ }
619
+ const gain = 0.72 / peak;
620
+ for (let i = 0; i < N; i++) {
621
+ L[i] *= gain;
622
+ R[i] *= gain;
623
+ }
624
+ return { rate: SR, left: L, right: R };
625
+ }
@@ -4,7 +4,6 @@
4
4
  import { spawnSync } from "node:child_process";
5
5
  import {
6
6
  existsSync,
7
- mkdirSync,
8
7
  mkdtempSync,
9
8
  readdirSync,
10
9
  renameSync,
@@ -12,6 +11,7 @@ import {
12
11
  statSync,
13
12
  } from "node:fs";
14
13
  import { basename, dirname, extname, join } from "node:path";
14
+ import { duration, findFfmpeg } from "./media.mjs";
15
15
 
16
16
  // The artifact skill's camera, reached the way every kit script reaches it
17
17
  const RENDER = join(
@@ -24,51 +24,6 @@ const RENDER = join(
24
24
  const PAUSE_S = 0.6;
25
25
  const FPS = 30;
26
26
 
27
- /** ffmpeg on the machine, or a portable build installed once into the workspace. */
28
- function findFfmpeg(workspace, Stop) {
29
- if (spawnSync("ffmpeg", ["-version"]).status === 0) return "ffmpeg";
30
- const dir = join(workspace, "projects", ".ffmpeg");
31
- const bin = join(
32
- dir,
33
- "node_modules",
34
- "ffmpeg-static",
35
- process.platform === "win32" ? "ffmpeg.exe" : "ffmpeg",
36
- );
37
- if (existsSync(bin)) return bin;
38
- console.error(
39
- "No ffmpeg on this machine: installing a portable one into projects/.ffmpeg, once…",
40
- );
41
- mkdirSync(dir, { recursive: true });
42
- spawnSync(
43
- "npm",
44
- [
45
- "install",
46
- "--prefix",
47
- dir,
48
- "ffmpeg-static",
49
- "--no-audit",
50
- "--no-fund",
51
- "--loglevel=error",
52
- ],
53
- { stdio: "inherit", shell: process.platform === "win32" },
54
- );
55
- if (!existsSync(bin))
56
- throw new Stop(
57
- "Installing a portable ffmpeg failed; npm's output above says why.",
58
- );
59
- return bin;
60
- }
61
-
62
- /** Seconds, read off the file itself: a scene's length is never guessed. */
63
- function duration(ffmpeg, file, Stop) {
64
- const probe = spawnSync(ffmpeg, ["-hide_banner", "-i", file], {
65
- encoding: "utf8",
66
- });
67
- const hms = /Duration: (\d+):(\d+):(\d+(?:\.\d+)?)/.exec(probe.stderr ?? "");
68
- if (!hms) throw new Stop(`${file} is not audio ffmpeg can read.`);
69
- return Number(hms[1]) * 3600 + Number(hms[2]) * 60 + Number(hms[3]);
70
- }
71
-
72
27
  /**
73
28
  * Renders `book` (an .html picture book) at `size` and joins its pages with
74
29
  * `voices`, one audio file per page in page order, into `<book>.mp4`.