thursday-agent 0.9.0 → 0.11.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 (320) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +0 -1
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +0 -6
  6. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/server/app/_global-error.html +1 -1
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  13. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +1 -1
  15. package/.next/server/app/_not-found.rsc +2 -2
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  19. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  20. package/.next/server/app/api/bot/keep-working/route.js.nft.json +1 -1
  21. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  22. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  23. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  24. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  25. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  26. package/.next/server/app/api/config/route.js.nft.json +1 -1
  27. package/.next/server/app/api/events/route.js.nft.json +1 -1
  28. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  29. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  30. package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
  31. package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -1
  32. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  33. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  34. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  35. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  36. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  37. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  38. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  39. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  40. package/.next/server/app/api/reach/route.js +13 -13
  41. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  42. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  43. package/.next/server/app/api/signins/route.js +1 -1
  44. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  45. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  46. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  47. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  48. package/.next/server/app/api/thursday/skills/route.js.nft.json +1 -1
  49. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  50. package/.next/server/app/api/thursday/tool-call/route.js +14 -15
  51. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  52. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  53. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  54. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +1 -1
  55. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  56. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  58. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  59. package/.next/server/app/page/server-reference-manifest.json +56 -56
  60. package/.next/server/app/page.js +4 -4
  61. package/.next/server/app/page.js.nft.json +1 -1
  62. package/.next/server/app/page_client-reference-manifest.js +1 -1
  63. package/.next/server/app-paths-manifest.json +0 -1
  64. package/.next/server/chunks/[root-of-the-server]__014ydvq._.js +2 -2
  65. package/.next/server/chunks/[root-of-the-server]__0209ah4._.js +7 -5
  66. package/.next/server/chunks/[root-of-the-server]__04r4h-2._.js +4 -2
  67. package/.next/server/chunks/[root-of-the-server]__0542v_d._.js +3 -0
  68. package/.next/server/chunks/[root-of-the-server]__0gewdg9._.js +2 -2
  69. package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
  70. package/.next/server/chunks/[root-of-the-server]__1-swlkw._.js +2 -2
  71. package/.next/server/chunks/[root-of-the-server]__12iddfq._.js +1 -1
  72. package/.next/server/chunks/[root-of-the-server]__1ai5lme._.js +3 -3
  73. package/.next/server/chunks/[root-of-the-server]__1cjxw0-._.js +2 -2
  74. package/.next/server/chunks/{[root-of-the-server]__1fy2g82._.js → [root-of-the-server]__1k3j52n._.js} +1 -1
  75. package/.next/server/chunks/[root-of-the-server]__1kyjt5m._.js +3 -3
  76. package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
  77. package/.next/server/chunks/_05v8k21._.js +3 -1
  78. package/.next/server/chunks/_0awtznl._.js +1 -1
  79. package/.next/server/chunks/_0na2fj1._.js +1 -1
  80. package/.next/server/chunks/_0x-ej3f._.js +17 -17
  81. package/.next/server/chunks/_12-amdu._.js +2 -2
  82. package/.next/server/chunks/_15740dw._.js +60 -0
  83. package/.next/server/chunks/_1dc_d1q._.js +3 -3
  84. package/.next/server/chunks/_1i350l5._.js +3 -1
  85. package/.next/server/chunks/_1jc5g4p._.js +2 -2
  86. package/.next/server/chunks/_1jn-aep._.js +4 -4
  87. package/.next/server/chunks/_1m88lkh._.js +11 -11
  88. package/.next/server/chunks/_1ogqovh._.js +4 -4
  89. package/.next/server/chunks/_1uuucy-._.js +1 -1
  90. package/.next/server/chunks/_1zxp-p6._.js +1 -1
  91. package/.next/server/chunks/features_0rfvely._.js +5 -3
  92. package/.next/server/chunks/ssr/{[root-of-the-server]__1se25x0._.js → [root-of-the-server]__0hpp3nw._.js} +29 -13
  93. package/.next/server/chunks/ssr/[root-of-the-server]__0m7u9j-._.js +3 -0
  94. package/.next/server/chunks/ssr/[root-of-the-server]__0tzekbl._.js +24 -60
  95. package/.next/server/chunks/ssr/[root-of-the-server]__1cz2rz5._.js +3 -0
  96. package/.next/server/chunks/ssr/{[root-of-the-server]__0tvavy9._.js → [root-of-the-server]__1iwyp1e._.js} +1 -1
  97. package/.next/server/chunks/ssr/[root-of-the-server]__1w9hqq8._.js +1 -1
  98. package/.next/server/chunks/ssr/_097-ljd._.js +1 -1
  99. package/.next/server/chunks/ssr/{_1tmu8z-._.js → _0btzccu._.js} +2 -2
  100. package/.next/server/chunks/ssr/_0fqhhwi._.js +1 -1
  101. package/.next/server/chunks/ssr/_0hjzb5o._.js +3 -0
  102. package/.next/server/chunks/ssr/_0ld9_qq._.js +1 -1
  103. package/.next/server/chunks/ssr/{_0urj3mc._.js → _0ouzu9f._.js} +2 -2
  104. package/.next/server/chunks/ssr/{_1-zyvdb._.js → _0u7ko71._.js} +2 -2
  105. package/.next/server/chunks/ssr/{_0ltz2q5._.js → _0wd_o8-._.js} +2 -2
  106. package/.next/server/chunks/ssr/_0ya0cb0._.js +3 -0
  107. package/.next/server/chunks/ssr/_10yyqtk._.js +67 -0
  108. package/.next/server/chunks/ssr/{_1uy0xom._.js → _12eyown._.js} +3 -3
  109. package/.next/server/chunks/ssr/_12mijol._.js +11 -11
  110. package/.next/server/chunks/ssr/_132qkfz._.js +1 -1
  111. package/.next/server/chunks/ssr/_184327j._.js +1 -1
  112. package/.next/server/chunks/ssr/{_1z74dmq._.js → _19ps4p3._.js} +7 -7
  113. package/.next/server/chunks/ssr/{_1flbs77._.js → _1bhy4yg._.js} +2 -2
  114. package/.next/server/chunks/ssr/_1d423aj._.js +7 -5
  115. package/.next/server/chunks/ssr/{_1a-nuxx._.js → _1kd843u._.js} +2 -2
  116. package/.next/server/chunks/ssr/{_0ital-2._.js → _1kq2ye_._.js} +2 -2
  117. package/.next/server/chunks/ssr/_1mqn9mc._.js +1 -1
  118. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  119. package/.next/server/chunks/ssr/_1p8xorg._.js +3 -0
  120. package/.next/server/chunks/ssr/{_1x-kojb._.js → _1q683w8._.js} +3 -3
  121. package/.next/server/chunks/ssr/_1tawxu2._.js +3 -0
  122. package/.next/server/chunks/ssr/{_0scf7xy._.js → _1w2oba6._.js} +2 -2
  123. package/.next/server/chunks/ssr/_1xoch6f._.js +1 -1
  124. package/.next/server/chunks/ssr/{_0kjj5ts._.js → _1ybo1hd._.js} +3 -3
  125. package/.next/server/chunks/ssr/features_bot_0s11m4r._.js +3 -0
  126. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  127. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  128. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  129. package/.next/server/chunks/ssr/features_workspace_00jz2hu._.js +1 -1
  130. package/.next/server/chunks/ssr/{node_modules_1af3w91._.js → node_modules_00pocul._.js} +1 -1
  131. package/.next/server/chunks/ssr/{node_modules_0th357h._.js → node_modules_02zt4az._.js} +1 -1
  132. package/.next/server/chunks/ssr/{node_modules_0jljel9._.js → node_modules_05ojmcl._.js} +1 -1
  133. package/.next/server/chunks/ssr/{node_modules_0wnlddw._.js → node_modules_06i6bli._.js} +1 -1
  134. package/.next/server/chunks/ssr/{node_modules_06bb4q8._.js → node_modules_09dj429._.js} +1 -1
  135. package/.next/server/chunks/ssr/{node_modules_068ws5v._.js → node_modules_0auzgvx._.js} +1 -1
  136. package/.next/server/chunks/ssr/{node_modules_1ogczzz._.js → node_modules_0evjwh1._.js} +1 -1
  137. package/.next/server/chunks/ssr/{node_modules_13kwejm._.js → node_modules_0gmdur8._.js} +1 -1
  138. package/.next/server/chunks/ssr/{node_modules_1s-gb-1._.js → node_modules_0j3te-1._.js} +1 -1
  139. package/.next/server/chunks/ssr/{node_modules_1bucjlk._.js → node_modules_0rbaymq._.js} +1 -1
  140. package/.next/server/chunks/ssr/{node_modules_1wbkzl9._.js → node_modules_0tf8_1e._.js} +1 -1
  141. package/.next/server/chunks/ssr/{node_modules_12et8d5._.js → node_modules_0yqy-0b._.js} +1 -1
  142. package/.next/server/chunks/ssr/{node_modules_1lkix61._.js → node_modules_1-53ebx._.js} +1 -1
  143. package/.next/server/chunks/ssr/{node_modules_03d0rfz._.js → node_modules_1-y9aho._.js} +1 -1
  144. package/.next/server/chunks/ssr/{node_modules_0x630an._.js → node_modules_11bltzp._.js} +1 -1
  145. package/.next/server/chunks/ssr/{node_modules_0uyh_vb._.js → node_modules_18jn2qo._.js} +1 -1
  146. package/.next/server/chunks/ssr/{node_modules_0dzm4um._.js → node_modules_1_te3bu._.js} +1 -1
  147. package/.next/server/chunks/ssr/{node_modules_07rs_p2._.js → node_modules_1c0pg3k._.js} +1 -1
  148. package/.next/server/chunks/ssr/{node_modules_0sgy-dc._.js → node_modules_1en2jx5._.js} +1 -1
  149. package/.next/server/chunks/ssr/{node_modules_0ubdtk-._.js → node_modules_1p-c8cr._.js} +1 -1
  150. package/.next/server/chunks/ssr/{node_modules_1z1lrbk._.js → node_modules_1qe-oxg._.js} +1 -1
  151. package/.next/server/chunks/ssr/{node_modules_04_sbbc._.js → node_modules_1rjt833._.js} +1 -1
  152. package/.next/server/chunks/ssr/{node_modules_0yvz9e0._.js → node_modules_1tzw5sn._.js} +1 -1
  153. package/.next/server/chunks/ssr/{node_modules_1uwg-gz._.js → node_modules_1x6uwvn._.js} +1 -1
  154. package/.next/server/chunks/ssr/{node_modules_0t_ez6-._.js → node_modules_1zqddke._.js} +1 -1
  155. package/.next/server/chunks/ssr/{node_modules_05ybmta._.js → node_modules_211zgim._.js} +1 -1
  156. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0r443fh._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0y51bqj._.js} +1 -1
  157. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_10wnlbk._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1sc114e._.js} +1 -1
  158. package/.next/server/middleware-build-manifest.js +3 -3
  159. package/.next/server/pages/404.html +1 -1
  160. package/.next/server/pages/500.html +1 -1
  161. package/.next/server/server-reference-manifest.js +1 -1
  162. package/.next/server/server-reference-manifest.json +57 -57
  163. package/.next/static/chunks/{13ixzheqw7o-w.js → 03-724sj0nk_z.js} +2 -2
  164. package/.next/static/chunks/03bhu4mk8en2q.js +1 -0
  165. package/.next/static/chunks/{3h2e-xv1zxh_f.js → 04imzjhvzw65d.js} +2 -2
  166. package/.next/static/chunks/{27tvv1i-smrck.js → 0gljzv9fz1g7d.js} +1 -1
  167. package/.next/static/chunks/{37j27b3e1gt7r.js → 0h0lythv1ql93.js} +1 -1
  168. package/.next/static/chunks/{2o4dndk0d68do.js → 0hzbj7f48cmx0.js} +1 -1
  169. package/.next/static/chunks/0lwunwbl7u7pt.js +1 -0
  170. package/.next/static/chunks/{0u9ae9k_2g7k3.js → 0r6nwxg4dv83t.js} +1 -1
  171. package/.next/static/chunks/0rn9nbg6aif9f.js +17 -0
  172. package/.next/static/chunks/{3bbzsitgiltnt.js → 0x_w4shtvrrfg.js} +1 -1
  173. package/.next/static/chunks/{2sdwbfs1x5skp.js → 0ympuji_ufypd.js} +1 -1
  174. package/.next/static/chunks/{3t9huugh-5_ps.js → 0zmrz4zfzm4dt.js} +1 -1
  175. package/.next/static/chunks/{0qmd8n52hp-6v.js → 11tlxkr7a_rpc.js} +1 -1
  176. package/.next/static/chunks/{2c64drdevdla3.js → 12scesro428m7.js} +2 -2
  177. package/.next/static/chunks/16s2fx3890_jd.js +65 -0
  178. package/.next/static/chunks/{0oyz95sujd2c7.js → 1qzfgplyo18tc.js} +1 -1
  179. package/.next/static/chunks/{04e-e--5lk26x.js → 1r4zajz14jp9-.js} +1 -1
  180. package/.next/static/chunks/1s6m4cmbn7htf.js +1 -0
  181. package/.next/static/chunks/1wl9t1-3i-q8p.css +1 -0
  182. package/.next/static/chunks/2-asot3p1j3yg.js +1 -0
  183. package/.next/static/chunks/{0u3ktztrzu1fa.js → 2-jn4xscbm-i2.js} +1 -1
  184. package/.next/static/chunks/22h9gvclqtx_2.js +1 -0
  185. package/.next/static/chunks/{337g9g_ux2gj-.js → 26-eblxwnykck.js} +1 -1
  186. package/.next/static/chunks/{43q9cgbuw8krx.js → 2kzwhbuobpkw3.js} +2 -2
  187. package/.next/static/chunks/2m6jd3586ijb-.js +1 -0
  188. package/.next/static/chunks/{0_awn8tucznxc.js → 304q9p54tcgm1.js} +1 -1
  189. package/.next/static/chunks/{1u5i-jti87jbo.js → 35wdx3wt7cg4a.js} +1 -1
  190. package/.next/static/chunks/37unh9460im7v.js +18 -0
  191. package/.next/static/chunks/{01xjer0i_e5z5.js → 39gj5vxz1zpm_.js} +1 -1
  192. package/.next/static/chunks/{427qsc6kahxyo.js → 39vrqy1r_00jc.js} +1 -1
  193. package/.next/static/chunks/{245hb85nsy6j4.js → 3dipmu0mptqum.js} +1 -1
  194. package/.next/static/chunks/3gki-squw28yu.js +1 -0
  195. package/.next/static/chunks/{3obf9n3cxj99k.js → 3jvldk2wvwbge.js} +1 -1
  196. package/.next/static/chunks/{38301ji-85i30.js → 3nnzdl_te20hv.js} +1 -1
  197. package/.next/static/chunks/{2m267diam_vib.js → 3tz4dr0_8pq1-.js} +1 -1
  198. package/.next/static/chunks/{2gocl3dq0_h1s.js → 3x6pggb-2kyrk.js} +1 -1
  199. package/.next/static/chunks/{025bmrgeukcb2.js → 4440mws9jz3mt.js} +1 -1
  200. package/README.md +4 -0
  201. package/app/api/thursday/tool-call/route.ts +1 -15
  202. package/components/ui/radio-group.tsx +2 -2
  203. package/docs/images/demo-still.jpg +0 -0
  204. package/docs/live-calls.md +19 -11
  205. package/features/ai/prompts/live.prompt.ts +51 -26
  206. package/features/ai/prompts/prompt-helper.ts +1 -9
  207. package/features/ai/prompts/thursday.prompt.ts +8 -2
  208. package/features/bot/bot.run.ts +9 -3
  209. package/features/bot/bot.seed.ts +35 -91
  210. package/features/bot/components/bot-room.tsx +0 -6
  211. package/features/bot/components/bot-setting.tsx +4 -4
  212. package/features/bot/components/room-pill.tsx +4 -2
  213. package/features/bot/seed-bots.ts +2 -2
  214. package/features/intro/components/intro.tsx +2 -3
  215. package/features/reach/reach.ts +2 -2
  216. package/features/routine/components/routine-setting.tsx +1 -1
  217. package/features/signins/signins.query.ts +66 -1
  218. package/features/thursday/components/side-captions.tsx +31 -8
  219. package/features/thursday/components/thursday-setting.tsx +5 -5
  220. package/features/thursday/components/thursday.tsx +97 -39
  221. package/features/thursday/components/write-line.tsx +28 -17
  222. package/features/thursday/thursday.action.ts +4 -20
  223. package/features/thursday/thursday.schema.ts +0 -9
  224. package/features/thursday/thursday.store.ts +11 -15
  225. package/features/thursday/thursday.text.ts +10 -8
  226. package/features/thursday/tool-line.ts +17 -6
  227. package/features/thursday/use-call-ring.ts +1 -5
  228. package/features/thursday/use-text-call.ts +37 -21
  229. package/features/thursday/use-thursday.ts +14 -44
  230. package/features/workspace/workspace.ts +4 -2
  231. package/guide/bots.md +13 -3
  232. package/guide/calls.md +7 -5
  233. package/knip.json +1 -0
  234. package/lib/live/live.session.ts +0 -39
  235. package/package.json +1 -1
  236. package/scripts/live-session.test.mts +19 -26
  237. package/seed-skills/analyst/README.md +18 -0
  238. package/seed-skills/analyst/data-report/SKILL.md +60 -0
  239. package/seed-skills/analyst/data-report/references/brief.md +31 -0
  240. package/seed-skills/analyst/data-report/references/company.md +41 -0
  241. package/seed-skills/analyst/data-report/references/comparison.md +42 -0
  242. package/seed-skills/analyst/data-report/references/decision.md +28 -0
  243. package/seed-skills/analyst/data-report/references/market-size.md +49 -0
  244. package/seed-skills/analyst/data-report/references/price-check.md +33 -0
  245. package/seed-skills/analyst/data-report/references/sources.md +51 -0
  246. package/seed-skills/analyst/data-report/references/trend.md +39 -0
  247. package/seed-skills/analyst/data-report/scripts/fetch.mjs +521 -0
  248. package/seed-skills/insta/instagram/SKILL.md +36 -0
  249. package/seed-skills/insta/instagram/references/dm.md +49 -0
  250. package/seed-skills/insta/instagram/references/post.md +74 -0
  251. package/seed-skills/insta/instagram/scripts/compose.mjs +333 -0
  252. package/seed-skills/insta/instagram/scripts/inbox.mjs +163 -0
  253. package/seed-skills/insta/instagram/scripts/lib.mjs +33 -0
  254. package/seed-skills/insta/instagram/scripts/media.mjs +104 -0
  255. package/seed-skills/insta/instagram/scripts/profile.mjs +143 -0
  256. package/seed-skills/insta/instagram/scripts/read.mjs +244 -0
  257. package/seed-skills/insta/instagram/scripts/search.mjs +137 -0
  258. package/seed-skills/insta/instagram/scripts/selectors.mjs +56 -0
  259. package/seed-skills/insta/instagram/scripts/sheet.mjs +43 -0
  260. package/seed-skills/insta/instagram/templates/carousel.html +62 -0
  261. package/seed-skills/marketer/README.md +6 -4
  262. package/seed-skills/marketer/copywriting/SKILL.md +1 -1
  263. package/seed-skills/marketer/emails/SKILL.md +1 -1
  264. package/seed-skills/marketer/launch/SKILL.md +1 -1
  265. package/seed-skills/marketer/product-marketing/SKILL.md +5 -5
  266. package/seed-skills/marketer/seo-audit/SKILL.md +1 -1
  267. package/seed-skills/marketer/social/SKILL.md +1 -1
  268. package/seed-skills/tutor/picture-book/SKILL.md +16 -0
  269. package/seed-skills/tutor/picture-book/book/book.css +181 -0
  270. package/seed-skills/tutor/picture-book/book/book.html +33 -0
  271. package/seed-skills/tutor/picture-book/book/book.js +60 -0
  272. package/seed-skills/tutor/picture-book/references/picture-book.md +104 -0
  273. package/seed-skills/tutor/picture-book/scripts/book-video.mjs +177 -0
  274. package/seed-skills/tutor/picture-book/scripts/book.mjs +98 -0
  275. package/skills/browser/SKILL.md +13 -4
  276. package/skills/browser/references/scripts.md +55 -0
  277. package/skills/browser/scripts/image-size.mjs +30 -0
  278. package/skills/browser/scripts/render.mjs +126 -0
  279. package/skills/browser/scripts/session.mjs +105 -0
  280. package/skills/browser/scripts/sheet.mjs +97 -0
  281. package/skills/browser/scripts/webimage.mjs +105 -0
  282. package/skills/interactive-page/SKILL.md +4 -3
  283. package/skills/interactive-page/scripts/chart.mjs +679 -0
  284. package/skills/interactive-page/scripts/page.mjs +1 -0
  285. package/.next/server/app/api/probe/route/app-paths-manifest.json +0 -3
  286. package/.next/server/app/api/probe/route/build-manifest.json +0 -12
  287. package/.next/server/app/api/probe/route/server-reference-manifest.json +0 -4
  288. package/.next/server/app/api/probe/route.js +0 -10
  289. package/.next/server/app/api/probe/route.js.map +0 -5
  290. package/.next/server/app/api/probe/route.js.nft.json +0 -1
  291. package/.next/server/app/api/probe/route_client-reference-manifest.js +0 -3
  292. package/.next/server/chunks/[root-of-the-server]__012s2o8._.js +0 -3
  293. package/.next/server/chunks/[root-of-the-server]__0z0hc1f._.js +0 -4
  294. package/.next/server/chunks/[root-of-the-server]__1v7-zke._.js +0 -5
  295. package/.next/server/chunks/_0whlpyi._.js +0 -4
  296. package/.next/server/chunks/_next-internal_server_app_api_probe_route_actions_0cqd30j.js +0 -3
  297. package/.next/server/chunks/ssr/[root-of-the-server]__0oo-wlv._.js +0 -103
  298. package/.next/server/chunks/ssr/[root-of-the-server]__0zuns7e._.js +0 -3
  299. package/.next/server/chunks/ssr/_070nv1_._.js +0 -3
  300. package/.next/server/chunks/ssr/_0dshsh4._.js +0 -3
  301. package/.next/server/chunks/ssr/_0l_mcfz._.js +0 -3
  302. package/.next/server/chunks/ssr/_0u5xv6g._.js +0 -3
  303. package/.next/server/chunks/ssr/_157yfrk._.js +0 -3
  304. package/.next/server/chunks/ssr/features_bot_1nr94ks._.js +0 -3
  305. package/.next/static/chunks/06nt9tatr-dug.js +0 -1
  306. package/.next/static/chunks/0ge-hx0ed83a1.js +0 -1
  307. package/.next/static/chunks/0pda_vf-abwvx.js +0 -1
  308. package/.next/static/chunks/0rowp9rx3qbxu.js +0 -18
  309. package/.next/static/chunks/1grkt5gr8pbg1.js +0 -17
  310. package/.next/static/chunks/1yugpvvi8qrbu.js +0 -101
  311. package/.next/static/chunks/27lkanxvtdn09.js +0 -1
  312. package/.next/static/chunks/3fec-aeteddr-.js +0 -1
  313. package/.next/static/chunks/3go3hwp1z2_h2.css +0 -1
  314. package/.next/static/chunks/3h2bun3hcggg8.js +0 -1
  315. package/.next/static/chunks/3j1y335o95mj7.js +0 -1
  316. package/lib/probe.server.ts +0 -17
  317. package/lib/probe.ts +0 -55
  318. /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_buildManifest.js +0 -0
  319. /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_clientMiddlewareManifest.js +0 -0
  320. /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_ssgManifest.js +0 -0
@@ -1,12 +1,12 @@
1
- module.exports=[539470,e=>e.a(async(t,a)=>{try{var n=e.i(588762),s=e.i(333925),i=e.i(5509),o=e.i(900533),r=e.i(64774),l=t([i]);async function c(){let e=await (0,i.listThreadOverview)();if(!e.length)return null;let t=e.map(e=>{let t=(0,n.formatDistanceToNowStrict)((0,o.toDate)(e.updatedAt),{addSuffix:!0}),a=e.room.questions[0],i="waiting"===e.status&&a?`waiting on the user since ${t} — ${a.bot} asked: ${(0,r.clip)(a.text,s.PROMPT_LINE.jobOutcome)}`:"waiting"===e.status?`stopped ${t}, not finished`:"running"===e.status?`running, last moved ${t}`:`${e.status} ${t}`;return`- "${e.label}" (${e.id}) — ${e.bot} — ${i}`});return`[The threads as this call opened, open work first. They move while you talk.]
2
- ${t.join("\n")}`}[i]=l.then?(await l)():l,e.s(["loadCallStanding",0,c]),a()}catch(e){a(e)}},!1),79290,e=>e.a(async(t,a)=>{try{var n=e.i(333925),s=e.i(973589),i=e.i(51083),o=e.i(799791),r=e.i(5509),l=e.i(1363),c=e.i(232549),h=e.i(343229),d=e.i(520401),u=e.i(871096),m=e.i(340697),f=e.i(636608),p=t([o,r,l,d,m]);async function w(e,t=!1){var a,p,g,k,b,$,v;let _,S=await (0,u.openWorkspace)(),[E,T,O,A,x,C,I,L,N]=await Promise.all([(0,h.loadSkills)(S),(0,l.listNoteIndex)(),(0,l.listAlwaysLoaded)(),(0,l.readNotes)(c.MEMORY_ALWAYS_LISTED,{touch:!1}),(0,m.listConnectedToolNames)(),(0,o.listJobBots)(),(0,d.listRecentTurns)(n.RECENT_CALL.rows),(0,d.readCallSkillsOn)(),(0,o.readBotMemoryOn)()]),M=await (0,r.listCallJobs)(I.map(e=>e.callId)),R=[(0,f.thursdayIdentity)(),t?"":(0,f.callEnding)(),function(e,t,a){let{crowded:n,heavy:s}=(0,f.tidying)(e),o=[...s].sort((e,t)=>t.factCount-e.factCount).slice(0,3).map(e=>e.path),r=n||s.length?`
1
+ module.exports=[539470,e=>e.a(async(t,a)=>{try{var n=e.i(588762),s=e.i(333925),i=e.i(5509),o=e.i(900533),r=e.i(64774),l=t([i]);async function h(){let e=await (0,i.listThreadOverview)();if(!e.length)return null;let t=e.map(e=>{let t=(0,n.formatDistanceToNowStrict)((0,o.toDate)(e.updatedAt),{addSuffix:!0}),a=e.room.questions[0],i="waiting"===e.status&&a?`waiting on the user since ${t} — ${a.bot} asked: ${(0,r.clip)(a.text,s.PROMPT_LINE.jobOutcome)}`:"waiting"===e.status?`stopped ${t}, not finished`:"running"===e.status?`running, last moved ${t}`:`${e.status} ${t}`;return`- "${e.label}" (${e.id}) — ${e.bot} — ${i}`});return`[The threads as this call opened, open work first. They move while you talk.]
2
+ ${t.join("\n")}`}[i]=l.then?(await l)():l,e.s(["loadCallStanding",0,h]),a()}catch(e){a(e)}},!1),79290,e=>e.a(async(t,a)=>{try{var n=e.i(333925),s=e.i(973589),i=e.i(51083),o=e.i(799791),r=e.i(5509),l=e.i(1363),h=e.i(232549),c=e.i(343229),d=e.i(520401),u=e.i(871096),m=e.i(340697),f=e.i(636608),p=t([o,r,l,d,m]);async function w(e,t=!1){var a,p,k,b,$,v,_;let S,E=await (0,u.openWorkspace)(),[T,O,A,x,C,L,I,N,M]=await Promise.all([(0,c.loadSkills)(E),(0,l.listNoteIndex)(),(0,l.listAlwaysLoaded)(),(0,l.readNotes)(h.MEMORY_ALWAYS_LISTED,{touch:!1}),(0,m.listConnectedToolNames)(),(0,o.listJobBots)(),(0,d.listRecentTurns)(n.RECENT_CALL.rows),(0,d.readCallSkillsOn)(),(0,o.readBotMemoryOn)()]),R=await (0,r.listCallJobs)(I.map(e=>e.callId)),P=[(0,f.thursdayIdentity)(),t?"":y(),function(e,t,a){let{crowded:n,heavy:s}=(0,f.tidying)(e),o=[...s].sort((e,t)=>t.factCount-e.factCount).slice(0,3).map(e=>e.path),r=n||s.length?`
3
3
 
4
- Saved memory has grown past what it holds well${o.length?` (${o.join(", ")})`:""}: say so once in what you return, go through what looks out of date with the user, and forget only what they name.`:"",l=new Set(a.map(e=>e.path)),h=new Set(t.map(e=>e.id)),d=`## Memory
4
+ Saved memory has grown past what it holds well${o.length?` (${o.join(", ")})`:""}: say so once in what you return, go through what looks out of date with the user, and forget only what they name.`:"",l=new Set(a.map(e=>e.path)),c=new Set(t.map(e=>e.id)),d=`## Memory
5
5
 
6
6
  What you have kept from talking with this user — the only thing that survives a call, and what lets you know them.`,u=`Who they are, and how they want things done and said — follow what is under preferences. The #id is what \`replaces\` and \`${i.TOOL_NAMES.memory_forget}\` take:
7
7
 
8
8
  ${a.map(e=>(function(e,t){let{shown:a,hidden:n}=(0,f.expandedFacts)(e.facts,t),s=a.map(e=>`- ${e.text} #${e.id}`);return n&&s.push(`- … ${n} older not shown — \`${i.TOOL_NAMES.memory_recall}\` ${e.path} opens the whole note`),`${e.path} — ${e.description}
9
- ${s.length?s.join("\n"):"- (nothing yet)"}`})(e,h)).join("\n\n")}`,m=t.filter(e=>!l.has(e.path)),p=m.length?`Already known — carried into every call:
9
+ ${s.length?s.join("\n"):"- (nothing yet)"}`})(e,c)).join("\n\n")}`,m=t.filter(e=>!l.has(e.path)),p=m.length?`Already known — carried into every call:
10
10
 
11
11
  ${(0,f.carriedLines)(m)}`:"",w=`Every other note — path — what is under it (facts) "what the user calls it":
12
12
 
@@ -18,7 +18,7 @@ Keep what the user tells you as it comes up, with \`${i.TOOL_NAMES.memory_rememb
18
18
 
19
19
  **Keep memory clean as you write.** A fact that repeats, narrows or changes one already in the note replaces it, merged into one line, rather than sitting beside it. A later call finds a note only by its path, its line and the names in quotes: keep the line true, and give something new its own path below.
20
20
 
21
- ${c.MEMORY_PATHS.map(e=>`- ${e.path} — ${e.of}`).join("\n")}`;return[d,u,p,w].filter(Boolean).join("\n\n")}(T,O,A.notes),(a=C,p=(0,f.reachNames)(L?[]:E,x),g=N,0===a.length?"":`## Background work
21
+ ${h.MEMORY_PATHS.map(e=>`- ${e.path} — ${e.of}`).join("\n")}`;return[d,u,p,w].filter(Boolean).join("\n\n")}(O,A,x.notes),(a=L,p=(0,f.reachNames)(N?[]:T,C),k=M,0===a.length?"":`## Background work
22
22
 
23
23
  Who you hand work to — the names \`${i.TOOL_NAMES.thread_start}\` takes.
24
24
 
@@ -26,43 +26,43 @@ ${a.map(e=>`- **${e.name}** — ${e.description}`).join("\n")}${p?`
26
26
 
27
27
  What bots can reach for: ${p}.`:""}
28
28
 
29
- **A bot can take on almost anything, and anything that takes more than a few seconds is a bot's**; a note, a look at a file or one command is yours. A bot has this computer, a real browser, the web, a shell to build what is missing and far more time than a call; it signs in where it has to and carries work to the end, so something you do not know how to do is work for a bot, not a no. Bots bring each other in, so work that spans several things is still one thread.${g?" Each bot keeps its own memory from thread to thread: when the user says how a bot should work from now on, pass it to that bot to remember.":""}
29
+ **A bot can take on almost anything, and anything that takes more than a few seconds is a bot's**; a note, a look at a file or one command is yours. A bot has this computer, a real browser, the web, a shell to build what is missing and far more time than a call; it signs in where it has to and carries work to the end, so something you do not know how to do is work for a bot, not a no. Bots bring each other in, so work that spans several things is still one thread.${k?" Each bot keeps its own memory from thread to thread: when the user says how a bot should work from now on, pass it to that bot to remember.":""}
30
30
 
31
31
  **Work lives in threads.** A thread's bot remembers that thread and nothing else, so the same bot started on a new one begins from nothing. More about work already handed over — a correction, the next step once it finished, going on after it stopped — is said to that thread (\`${i.TOOL_NAMES.thread_tell}\`); only a request that stands on its own starts a new one (\`${i.TOOL_NAMES.thread_start}\`). The threads open as this call started come into the conversation at the start, and they move while you talk: \`${i.TOOL_NAMES.thread_status}\` reads them as they are now, before you answer about one or hand anything over. Ask the user which it is only when the request could be either. Write the request in the user's own words, with what it stands on — including how they told you they want work done — and nothing they did not say.
32
32
 
33
33
  **Work that should start by itself — every morning, every few hours — is a routine.** \`${i.TOOL_NAMES.routine}\` makes one from a bot, the work in the user's own words, and when; from then on it starts a thread for it each time without being asked, and the result reaches the user like any thread's. Ask once for whichever of those they left out, and read the ones that exist before making, changing or deleting one.
34
34
 
35
- Updates and questions from threads reach the conversation by themselves, naming their thread and the bot that asks; they come from bots, not the user, and a question is answered with \`${i.TOOL_NAMES.thread_answer}\`. When the user wants to see what a thread made, \`${i.TOOL_NAMES.thread_show}\` puts it on their screen. Once you have explained enough of how a thread ended, mark it with \`${i.TOOL_NAMES.thread_seen}\`, or leave it for the user to open; never mention seen to them.`),(k=S.cwd,b=L?E:[],_=`## This computer
35
+ Updates and questions from threads reach the conversation by themselves, naming their thread and the bot that asks; they come from bots, not the user, and a question is answered with \`${i.TOOL_NAMES.thread_answer}\`. When the user wants to see what a thread made, \`${i.TOOL_NAMES.thread_show}\` puts it on their screen. Once you have explained enough of how a thread ended, mark it with \`${i.TOOL_NAMES.thread_seen}\`, or leave it for the user to open; never mention seen to them.`),(b=E.cwd,$=N?T:[],S=`## This computer
36
36
 
37
- Current Cwd: ${k}
37
+ Current Cwd: ${b}
38
38
  Platform: ${process.platform}
39
39
 
40
40
  Where \`${i.TOOL_NAMES.bash}\` runs, and what the paths you get back are relative to. Each command is cut off after ${Math.round(n.CALL_EXEC_TIMEOUT_MS/1e3)} seconds; anything longer is a bot's.
41
41
 
42
- ${(0,s.guideLine)()}`,0===b.length?_:`${_}
42
+ ${(0,s.guideLine)()}`,0===$.length?S:`${S}
43
43
 
44
44
  Skills are written-down ways of doing things here. \`${i.TOOL_NAMES.load_skill}\` opens one, and what it says goes for you too: read one when it covers what was asked and the doing is a glance. Anything longer it describes is still work to hand over, with what the skill said.
45
45
 
46
- ${(0,f.skillLines)(b,{short:!0})}`),t?`## Answer in writing
46
+ ${(0,f.skillLines)($,{short:!0})}`),t?`## Answer in writing
47
47
 
48
48
  This call is in writing: there is no voice, and what you write is what the user reads, so answer them directly, in their language. Say the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question they have to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. Keep it short and plain.`:`## Return the result
49
49
 
50
- Return the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question the user has to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. What you return is said aloud: keep it short and plain.`,($=I,v=M,$.some(e=>e.turns.length>0)?`## Earlier calls
50
+ Return the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question the user has to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. What you return is said aloud: keep it short and plain.`,(v=I,_=R,v.some(e=>e.turns.length>0)?`## Earlier calls
51
51
 
52
52
  What was said on the last calls, verbatim, newest last. It is the past: pick it up when the user does, and never answer it as a new request.
53
53
 
54
54
  A \`${i.TOOL_NAMES.thread_start}\` line carries the thread's handle and how it ended; the handle is for the thread tools, never said aloud. What they ask for now is often one of these carried further.
55
55
 
56
- ${(0,f.recentCallLines)($.map(e=>({...e,jobs:v.filter(t=>t.callId===e.callId)})),n.RECENT_CALL.tokens)}`:""),y(e)].filter(Boolean).join("\n\n");return(0,f.logPromptSize)("thursday",R),R}[o,r,l,d,m]=p.then?(await p)():p;let y=e=>e?.trim()?`## Additional instructions
56
+ ${(0,f.recentCallLines)(v.map(e=>({...e,jobs:_.filter(t=>t.callId===e.callId)})),n.RECENT_CALL.tokens)}`:""),g(e)].filter(Boolean).join("\n\n");return(0,f.logPromptSize)("thursday",P),P}[o,r,l,d,m]=p.then?(await p)():p;let y=()=>`IMPORTANT — always follow this: when the user wants the call to end, however they say it, forget every other task, answer yes in one word of their language, then immediately, without thinking, use the ${i.TOOL_NAMES.end_call} tool.`,g=e=>e?.trim()?`## Additional instructions
57
57
 
58
58
  Written by the user. Follow them together with everything above.
59
59
 
60
- ${e.trim()}`:"";e.s(["loadThursdayPrompt",0,w]),a()}catch(e){a(e)}},!1),480791,e=>{"use strict";var t=e.i(417043),a=e.i(903438);let n="https://slack.com/api",s=new Set(["invalid_auth","not_authed","account_inactive","token_revoked","not_allowed_token_type","missing_scope"]);e.s(["createSlack",0,function(e,i){async function o(e,a,r=i){let l=await fetch(`${n}/${e}`,{method:"POST",headers:{authorization:`Bearer ${r}`,"content-type":"application/json; charset=utf-8"},body:JSON.stringify(a)}),c=await l.json().catch(()=>null);if(c?.ok)return c;let h=c?.error??`http_${l.status}`,d="missing_scope"===h?`Slack says the app lacks a permission (${c?.needed??"a scope"}) — make it from the manifest in the guide.`:`Slack answered ${h} to ${e}`;throw s.has(h)?new t.ChannelRefusal(d):Error(d)}let r=new Map;async function l(e){let t=r.get(e);if(t)return t;let a=await o("users.info",{user:e}).then(t=>t.user?.real_name||t.user?.name||e).catch(()=>e);return r.set(e,a),a}async function c(e,t){if("events_api"===e){let e=t.event??{},a=!e.subtype||"file_share"===e.subtype;return"message"===e.type&&"im"===e.channel_type&&a&&!e.bot_id&&e.user&&e.channel?{kind:"message",chat:e.channel,name:await l(e.user),words:(e.text??"").trim(),files:(e.files??[]).flatMap(e=>{let t=e.url_private_download;if(!t)return[];let a=e.name??"file";return[{name:a,fetch:async()=>{let n=await fetch(t,{headers:{authorization:`Bearer ${i}`}});if(!n.ok)throw Error(`Slack answered ${n.status} for the file`);return new File([await n.arrayBuffer()],a,{type:e.mimetype??""})}}]}),unreadable:!1}:null}return"interactive"===e&&"block_actions"===t.type?t.channel?.id?{kind:"press",chat:t.channel.id,data:t.actions?.[0]?.value??"",under:t.message?.ts&&t.message.text?{id:t.message.ts,text:t.message.text}:null}:null:null}return{async listen(t,n){let s=await o("auth.test",{}),{url:i}=await o("apps.connections.open",{},e);t.ready(s.user?`@${s.user}`:"the app");let r=await (0,a.runSocket)(i,{message(e,a){let{type:n,envelope_id:s,payload:i}=e;s&&a({envelope_id:s}),n&&i&&c(n,i).then(e=>{e&&t.incoming(e)})}},n);if(!n.aborted)throw Error(`Slack closed the connection (${r.code})`)},async say(e,t,n){let s=(0,a.inPieces)(t,2900);for(let[t,a]of s.entries()){let i=n?.length&&t===s.length-1;await o("chat.postMessage",{channel:e,text:a,unfurl_links:!1,...i?{blocks:[{type:"section",text:{type:"plain_text",text:a}},{type:"actions",elements:n.slice(0,25).map((e,t)=>({type:"button",action_id:`choice_${t}`,text:{type:"plain_text",text:e.text.slice(0,75)},value:e.data}))}]}:{}})}},async typing(){},async settle(e,t,a){await o("chat.update",{channel:e,ts:t,text:a.slice(0,2900),blocks:[]}).catch(()=>{})},async sendFile(e,t,a){let s=new URLSearchParams({filename:a,length:String(t.byteLength)}),r=await fetch(`${n}/files.getUploadURLExternal`,{method:"POST",headers:{authorization:`Bearer ${i}`},body:s}),l=await r.json();if(!l.ok||!l.upload_url||!l.file_id)throw Error(`Slack answered ${l.error??r.status} to the upload`);await fetch(l.upload_url,{method:"POST",body:new Blob([t])}),await o("files.completeUploadExternal",{files:[{id:l.file_id,title:a}],channel_id:e})}}}])},644301,e=>{"use strict";var t=e.i(333925),a=e.i(417043);let n="https://api.telegram.org";e.s(["createTelegram",0,function(e){async function s(t,s,i){let o=s instanceof FormData,r=await fetch(`${n}/bot${e}/${t}`,{method:"POST",signal:i,...o?{body:s}:{headers:{"content-type":"application/json"},body:JSON.stringify(s??{})}}),l=await r.json().catch(()=>null);if(l?.ok)return l.result;let c=l?.description??`Telegram answered ${r.status}`;throw 401===r.status?new a.ChannelRefusal(c):Error(c)}async function i(t,a,i){let{file_path:o}=await s("getFile",{file_id:t});if(!o)throw Error("Telegram did not say where the file is");let r=await fetch(`${n}/file/bot${e}/${o}`);if(!r.ok)throw Error(`Telegram answered ${r.status} for the file`);let l=o.includes(".")?o.slice(o.lastIndexOf(".")):"";return new File([await r.arrayBuffer()],a.includes(".")?a:`${a}${l}`,i?{type:i}:void 0)}return{async listen(e,a){let n=await s("getMe",void 0,a);e.ready(n.username?`@${n.username}`:n.first_name??"the bot");let o=0;for(;!a.aborted;)for(let n of(await s("getUpdates",{offset:o,timeout:t.REACH.pollSeconds,allowed_updates:["message","callback_query"]},AbortSignal.any([a,AbortSignal.timeout((t.REACH.pollSeconds+15)*1e3)])))){o=n.update_id+1;let t=function(e){let t,a=e.callback_query;if(a)return s("answerCallbackQuery",{callback_query_id:a.id}).catch(()=>{}),{kind:"press",chat:String(a.from.id),data:a.data??"",under:a.message?.text?{id:String(a.message.message_id),text:a.message.text}:null};let n=e.message;if(!n?.from||"private"!==n.chat.type)return null;let o=n.photo?.at(-1),r=n.document?{id:n.document.file_id,name:n.document.file_name??"file",type:n.document.mime_type}:o?{id:o.file_id,name:`photo-${n.message_id}`,type:""}:null;return{kind:"message",chat:String(n.chat.id),name:(t=n.from,[t?.first_name,t?.last_name].filter(Boolean).join(" ")||(t?.username?`@${t.username}`:"Someone")),words:(n.text??n.caption??"").trim(),files:r?[{name:r.name,fetch:()=>i(r.id,r.name,r.type)}]:[],unreadable:!!(n.voice||n.audio||n.video)}}(n);t&&e.incoming(t)}},async say(e,t,a){await s("sendMessage",{chat_id:e,text:t,link_preview_options:{is_disabled:!0},...a?.length?{reply_markup:{inline_keyboard:a.map(e=>[{text:e.text,callback_data:e.data}])}}:{}})},async typing(e){await s("sendChatAction",{chat_id:e,action:"typing"}).catch(()=>{})},async settle(e,t,a){await s("editMessageText",{chat_id:e,message_id:Number(t),text:a,link_preview_options:{is_disabled:!0}}).catch(()=>{})},async sendFile(e,t,a,n){let i=new FormData;i.set("chat_id",e),i.set(n?"photo":"document",new Blob([t]),a),await s(n?"sendPhoto":"sendDocument",i)}}}])},312485,e=>e.a(async(t,a)=>{try{var n=e.i(912714),s=e.i(232347),i=e.i(333925),o=e.i(986507),r=e.i(49002),l=e.i(811592),c=e.i(5509),h=e.i(724185),d=e.i(822931),u=e.i(520401),m=e.i(933395),f=e.i(181300),p=e.i(375814),w=e.i(871096),y=e.i(317613),g=e.i(938281),k=e.i(212389),b=e.i(64774),$=e.i(417043),v=e.i(854455),_=e.i(735186),S=e.i(480791),E=e.i(644301),T=t([o,r,l,c,h,u,f]);[o,r,l,c,h,u,f]=T.then?(await T)():T;let W={telegram:e=>(0,E.createTelegram)(e),discord:e=>(0,v.createDiscord)(e),slack:(e,t)=>(0,S.createSlack)(e,t)},D=globalThis,B=D.__reach??={live:new Map,last:null,told:new Set,due:new Map,choices:new Map,listening:null,looking:null},F=()=>s.appEvents.emit({type:"reach"});async function O(e){let t=await (0,h.readConfig)((0,_.reachPersonKey)(e));if(!t)return null;try{let e=JSON.parse(t);return"string"==typeof e.chat&&"string"==typeof e.name?{chat:e.chat,name:e.name}:null}catch{return null}}async function A(e){for(let t of e?[e]:_.REACH_CHANNELS){let a=B.live.get(t);a?.stop.abort(),B.live.delete(t),e&&(await (0,h.removeConfig)((0,_.reachPersonKey)(t)),a?.line&&await (0,u.endCall)(a.line.callId).catch(()=>{}));let n=await Promise.all(_.REACH_KEYS[t].map(h.readConfig));if(!n.every(e=>!!e))continue;let s={name:t,channel:W[t](...n),stop:new AbortController,bot:null,problem:null,asking:null,line:null,turn:Promise.resolve()};B.live.set(t,s),x(s)}B.live.size&&(B.listening??=s.appEvents.subscribe(e=>{"threads"!==e.type||B.looking||(B.looking=setTimeout(()=>{B.looking=null,P().catch(e=>g.logger.error("reach: open work",e))},2e3))})),F()}async function x(e){let{signal:t}=e.stop,a=t=>{e.problem!==t&&(e.problem=t,F())};for(;!t.aborted;){try{await e.channel.listen({ready:t=>{e.bot=t,e.problem=null,F()},incoming:t=>void C(e,t).catch(t=>g.logger.error(`reach ${e.name}: what arrived`,t))},t)}catch(s){if(t.aborted)return;let n=s instanceof Error?s.message:String(s);if(s instanceof $.ChannelRefusal)return g.logger.warn(`reach ${e.name}: ${n}`),a(n);a(n)}await new Promise(e=>setTimeout(e,i.REACH.retryMs))}}async function C(e,t){let{channel:a}=e,n=await O(e.name);if("press"===t.kind){if(n?.chat!==t.chat)return;return q(e,n,t.data,t.under)}if(n?.chat!==t.chat)return n?void await a.say(t.chat,"This Thursday already answers someone else."):(e.asking={chat:t.chat,name:t.name},F(),void await a.say(t.chat,"Almost there. Open Thursday on your computer and press Allow, then write again."));B.last=e.name;let s=t.files.length?await (0,y.keepGivenFiles)(await Promise.all(t.files.map(e=>e.fetch()))):[],i=[t.words,...s].filter(Boolean).join("\n");if(!i){t.unreadable&&await a.say(t.chat,"I can read words, pictures and files here — not voice or video yet. Write it instead.");return}L(e,n,i,i)}async function I(e){let t=e.line;e.line=null,t&&await (0,u.endCall)(t.callId).catch(()=>{})}function L(e,t,a,n,s){let i=e.turn.then(()=>N(e,t,a,n,s));return e.turn=i.then(()=>{},()=>{}),i}async function N(e,t,a,n,s){let{channel:r}=e;r.typing(t.chat).catch(()=>{});let l=setInterval(()=>void r.typing(t.chat).catch(()=>{}),4e3);try{let o=m.ThursdaySettingsSchema.parse({}),l=e.line;(!l||Date.now()-l.lastAt>i.REACH.idleMs||!await (0,u.isCallOpen)(l.callId))&&(await I(e),e.line={...await (0,f.openTextCall)(o),messages:[],lastAt:0});let c=e.line,h=await (0,f.answerInWriting)({callId:c.callId,settings:o,standing:c.standing,messages:[...c.messages,{role:"user",content:a}],said:n});c.messages=h.messages,c.lastAt=Date.now();let d=(0,b.plainText)(h.text)||h.did.join("\n"),p=function(e){let t=[],a=e;for(;a.length>i.REACH.chars;){let e=a.slice(0,i.REACH.chars),n=Math.max(e.lastIndexOf("\n\n"),e.lastIndexOf("\n")),s=n>i.REACH.chars/2?n:i.REACH.chars;t.push(a.slice(0,s).trim()),a=a.slice(s).trim()}return a&&t.push(a),t}(d||"…");for(let[e,a]of p.entries())await r.say(t.chat,a,e===p.length-1?s:void 0);return await M(e,t,h.text),!0}catch(n){let a=(0,k.isPublicError)(n)?n.message:(0,o.modelErrorToString)(n);return g.logger.warn(`reach ${e.name}: ${a}`),await r.say(t.chat,a).catch(()=>{}),!1}finally{clearInterval(l)}}async function M(e,t,a){for(let s of(await (0,w.filesOnDisk)((0,p.pathsIn)(a),null)).slice(-i.REACH.files)){let a=await (0,w.insideWorkspace)(s),o=a?await (0,n.stat)(a).catch(()=>null):null;a&&o&&!(o.size>i.REACH.fileBytes)&&await e.channel.sendFile(t.chat,await (0,n.readFile)(a),s.split("/").pop()??"file","image"===(0,p.viewKindOf)(s)).catch(t=>g.logger.warn(`reach ${e.name}: could not send ${s}`,t))}}async function R(){for(let e of[...B.last?[B.last]:[],..._.REACH_CHANNELS.filter(e=>e!==B.last)]){let t=B.live.get(e),a=t?await O(e):null;if(t&&a)return{live:t,person:a}}return null}async function P(){if(!await R())return;let e=z(await (0,c.listInboxThreads)()),t=new Set(e.map(e=>e.key));for(let[e,a]of B.due)t.has(e)||(clearTimeout(a),B.due.delete(e));for(let t of e)B.told.has(t.key)||B.due.has(t.key)||B.due.set(t.key,setTimeout(()=>void j(t.key),i.REACH.notifyAfterMs))}let z=e=>(0,d.openWork)(e).filter(e=>"progress"!==e.kind);async function j(e){B.due.delete(e);let t=await R();if(!t||B.told.has(e))return;let a=await (0,c.listInboxThreads)(),n=z(a).find(t=>t.key===e);if(!n)return;let s=a.find(t=>t.room.questions.some(t=>`question:${t.id}`===e)),i=s?.room.questions.find(t=>`question:${t.id}`===e),o=(i?.options??[]).map((e,t)=>{let a=`${i?.id.slice(0,40)}:${t}`;return B.choices.set(a,{threadId:s?.id??"",bot:i?.bot??"",question:i?.id??"",answer:e}),{text:e,data:a}});B.told.add(e),await L(t.live,t.person,n.line,null,o)?await (0,l.acceptRoomRelays)(n.relayIds):B.told.delete(e)}async function q(e,t,a,n){let s=B.choices.get(a);if(!s)return void await e.channel.say(t.chat,"That question is no longer open here. Write your answer instead.");for(let[e,t]of B.choices)t.question===s.question&&B.choices.delete(e);try{await (0,r.answerThread)(s.threadId,s.answer,"user",s.bot),n&&await e.channel.settle(t.chat,n.id,`${n.text}
60
+ ${e.trim()}`:"";e.s(["loadThursdayPrompt",0,w]),a()}catch(e){a(e)}},!1),480791,e=>{"use strict";var t=e.i(417043),a=e.i(903438);let n="https://slack.com/api",s=new Set(["invalid_auth","not_authed","account_inactive","token_revoked","not_allowed_token_type","missing_scope"]);e.s(["createSlack",0,function(e,i){async function o(e,a,r=i){let l=await fetch(`${n}/${e}`,{method:"POST",headers:{authorization:`Bearer ${r}`,"content-type":"application/json; charset=utf-8"},body:JSON.stringify(a)}),h=await l.json().catch(()=>null);if(h?.ok)return h;let c=h?.error??`http_${l.status}`,d="missing_scope"===c?`Slack says the app lacks a permission (${h?.needed??"a scope"}) — make it from the manifest in the guide.`:`Slack answered ${c} to ${e}`;throw s.has(c)?new t.ChannelRefusal(d):Error(d)}let r=new Map;async function l(e){let t=r.get(e);if(t)return t;let a=await o("users.info",{user:e}).then(t=>t.user?.real_name||t.user?.name||e).catch(()=>e);return r.set(e,a),a}async function h(e,t){if("events_api"===e){let e=t.event??{},a=!e.subtype||"file_share"===e.subtype;return"message"===e.type&&"im"===e.channel_type&&a&&!e.bot_id&&e.user&&e.channel?{kind:"message",chat:e.channel,name:await l(e.user),words:(e.text??"").trim(),files:(e.files??[]).flatMap(e=>{let t=e.url_private_download;if(!t)return[];let a=e.name??"file";return[{name:a,fetch:async()=>{let n=await fetch(t,{headers:{authorization:`Bearer ${i}`}});if(!n.ok)throw Error(`Slack answered ${n.status} for the file`);return new File([await n.arrayBuffer()],a,{type:e.mimetype??""})}}]}),unreadable:!1}:null}return"interactive"===e&&"block_actions"===t.type?t.channel?.id?{kind:"press",chat:t.channel.id,data:t.actions?.[0]?.value??"",under:t.message?.ts&&t.message.text?{id:t.message.ts,text:t.message.text}:null}:null:null}return{async listen(t,n){let s=await o("auth.test",{}),{url:i}=await o("apps.connections.open",{},e);t.ready(s.user?`@${s.user}`:"the app");let r=await (0,a.runSocket)(i,{message(e,a){let{type:n,envelope_id:s,payload:i}=e;s&&a({envelope_id:s}),n&&i&&h(n,i).then(e=>{e&&t.incoming(e)})}},n);if(!n.aborted)throw Error(`Slack closed the connection (${r.code})`)},async say(e,t,n){let s=(0,a.inPieces)(t,2900);for(let[t,a]of s.entries()){let i=n?.length&&t===s.length-1;await o("chat.postMessage",{channel:e,text:a,unfurl_links:!1,...i?{blocks:[{type:"section",text:{type:"plain_text",text:a}},{type:"actions",elements:n.slice(0,25).map((e,t)=>({type:"button",action_id:`choice_${t}`,text:{type:"plain_text",text:e.text.slice(0,75)},value:e.data}))}]}:{}})}},async typing(){},async settle(e,t,a){await o("chat.update",{channel:e,ts:t,text:a.slice(0,2900),blocks:[]}).catch(()=>{})},async sendFile(e,t,a){let s=new URLSearchParams({filename:a,length:String(t.byteLength)}),r=await fetch(`${n}/files.getUploadURLExternal`,{method:"POST",headers:{authorization:`Bearer ${i}`},body:s}),l=await r.json();if(!l.ok||!l.upload_url||!l.file_id)throw Error(`Slack answered ${l.error??r.status} to the upload`);await fetch(l.upload_url,{method:"POST",body:new Blob([t])}),await o("files.completeUploadExternal",{files:[{id:l.file_id,title:a}],channel_id:e})}}}])},644301,e=>{"use strict";var t=e.i(333925),a=e.i(417043);let n="https://api.telegram.org";e.s(["createTelegram",0,function(e){async function s(t,s,i){let o=s instanceof FormData,r=await fetch(`${n}/bot${e}/${t}`,{method:"POST",signal:i,...o?{body:s}:{headers:{"content-type":"application/json"},body:JSON.stringify(s??{})}}),l=await r.json().catch(()=>null);if(l?.ok)return l.result;let h=l?.description??`Telegram answered ${r.status}`;throw 401===r.status?new a.ChannelRefusal(h):Error(h)}async function i(t,a,i){let{file_path:o}=await s("getFile",{file_id:t});if(!o)throw Error("Telegram did not say where the file is");let r=await fetch(`${n}/file/bot${e}/${o}`);if(!r.ok)throw Error(`Telegram answered ${r.status} for the file`);let l=o.includes(".")?o.slice(o.lastIndexOf(".")):"";return new File([await r.arrayBuffer()],a.includes(".")?a:`${a}${l}`,i?{type:i}:void 0)}return{async listen(e,a){let n=await s("getMe",void 0,a);e.ready(n.username?`@${n.username}`:n.first_name??"the bot");let o=0;for(;!a.aborted;)for(let n of(await s("getUpdates",{offset:o,timeout:t.REACH.pollSeconds,allowed_updates:["message","callback_query"]},AbortSignal.any([a,AbortSignal.timeout((t.REACH.pollSeconds+15)*1e3)])))){o=n.update_id+1;let t=function(e){let t,a=e.callback_query;if(a)return s("answerCallbackQuery",{callback_query_id:a.id}).catch(()=>{}),{kind:"press",chat:String(a.from.id),data:a.data??"",under:a.message?.text?{id:String(a.message.message_id),text:a.message.text}:null};let n=e.message;if(!n?.from||"private"!==n.chat.type)return null;let o=n.photo?.at(-1),r=n.document?{id:n.document.file_id,name:n.document.file_name??"file",type:n.document.mime_type}:o?{id:o.file_id,name:`photo-${n.message_id}`,type:""}:null;return{kind:"message",chat:String(n.chat.id),name:(t=n.from,[t?.first_name,t?.last_name].filter(Boolean).join(" ")||(t?.username?`@${t.username}`:"Someone")),words:(n.text??n.caption??"").trim(),files:r?[{name:r.name,fetch:()=>i(r.id,r.name,r.type)}]:[],unreadable:!!(n.voice||n.audio||n.video)}}(n);t&&e.incoming(t)}},async say(e,t,a){await s("sendMessage",{chat_id:e,text:t,link_preview_options:{is_disabled:!0},...a?.length?{reply_markup:{inline_keyboard:a.map(e=>[{text:e.text,callback_data:e.data}])}}:{}})},async typing(e){await s("sendChatAction",{chat_id:e,action:"typing"}).catch(()=>{})},async settle(e,t,a){await s("editMessageText",{chat_id:e,message_id:Number(t),text:a,link_preview_options:{is_disabled:!0}}).catch(()=>{})},async sendFile(e,t,a,n){let i=new FormData;i.set("chat_id",e),i.set(n?"photo":"document",new Blob([t]),a),await s(n?"sendPhoto":"sendDocument",i)}}}])},312485,e=>e.a(async(t,a)=>{try{var n=e.i(912714),s=e.i(232347),i=e.i(333925),o=e.i(247839),r=e.i(986507),l=e.i(49002),h=e.i(811592),c=e.i(5509),d=e.i(724185),u=e.i(822931),m=e.i(520401),f=e.i(181300),p=e.i(375814),w=e.i(871096),y=e.i(317613),g=e.i(938281),k=e.i(212389),b=e.i(64774),$=e.i(417043),v=e.i(854455),_=e.i(735186),S=e.i(480791),E=e.i(644301),T=t([r,l,h,c,d,m,f]);[r,l,h,c,d,m,f]=T.then?(await T)():T;let W={telegram:e=>(0,E.createTelegram)(e),discord:e=>(0,v.createDiscord)(e),slack:(e,t)=>(0,S.createSlack)(e,t)},D=globalThis,B=D.__reach??={live:new Map,last:null,told:new Set,due:new Map,choices:new Map,listening:null,looking:null},F=()=>s.appEvents.emit({type:"reach"});async function O(e){let t=await (0,d.readConfig)((0,_.reachPersonKey)(e));if(!t)return null;try{let e=JSON.parse(t);return"string"==typeof e.chat&&"string"==typeof e.name?{chat:e.chat,name:e.name}:null}catch{return null}}async function A(e){for(let t of e?[e]:_.REACH_CHANNELS){let a=B.live.get(t);a?.stop.abort(),B.live.delete(t),e&&(await (0,d.removeConfig)((0,_.reachPersonKey)(t)),a?.line&&await (0,m.endCall)(a.line.callId).catch(()=>{}));let n=await Promise.all(_.REACH_KEYS[t].map(d.readConfig));if(!n.every(e=>!!e))continue;let s={name:t,channel:W[t](...n),stop:new AbortController,bot:null,problem:null,asking:null,line:null,turn:Promise.resolve()};B.live.set(t,s),x(s)}B.live.size&&(B.listening??=s.appEvents.subscribe(e=>{"threads"!==e.type||B.looking||(B.looking=setTimeout(()=>{B.looking=null,P().catch(e=>g.logger.error("reach: open work",e))},2e3))})),F()}async function x(e){let{signal:t}=e.stop,a=t=>{e.problem!==t&&(e.problem=t,F())};for(;!t.aborted;){try{await e.channel.listen({ready:t=>{e.bot=t,e.problem=null,F()},incoming:t=>void C(e,t).catch(t=>g.logger.error(`reach ${e.name}: what arrived`,t))},t)}catch(s){if(t.aborted)return;let n=s instanceof Error?s.message:String(s);if(s instanceof $.ChannelRefusal)return g.logger.warn(`reach ${e.name}: ${n}`),a(n);a(n)}await new Promise(e=>setTimeout(e,i.REACH.retryMs))}}async function C(e,t){let{channel:a}=e,n=await O(e.name);if("press"===t.kind){if(n?.chat!==t.chat)return;return q(e,n,t.data,t.under)}if(n?.chat!==t.chat)return n?void await a.say(t.chat,"This Thursday already answers someone else."):(e.asking={chat:t.chat,name:t.name},F(),void await a.say(t.chat,"Almost there. Open Thursday on your computer and press Allow, then write again."));B.last=e.name;let s=t.files.length?await (0,y.keepGivenFiles)(await Promise.all(t.files.map(e=>e.fetch()))):[],i=[t.words,...s].filter(Boolean).join("\n");if(!i){t.unreadable&&await a.say(t.chat,"I can read words, pictures and files here — not voice or video yet. Write it instead.");return}I(e,n,i,i)}async function L(e){let t=e.line;e.line=null,t&&await (0,m.endCall)(t.callId).catch(()=>{})}function I(e,t,a,n,s){let i=e.turn.then(()=>N(e,t,a,n,s));return e.turn=i.then(()=>{},()=>{}),i}async function N(e,t,a,n,s){let{channel:l}=e;l.typing(t.chat).catch(()=>{});let h=setInterval(()=>void l.typing(t.chat).catch(()=>{}),4e3);try{let r=o.LiveSettingsSchema.parse({}),h=e.line;(!h||Date.now()-h.lastAt>i.REACH.idleMs||!await (0,m.isCallOpen)(h.callId))&&(await L(e),e.line={...await (0,f.openTextCall)(r),messages:[],lastAt:0});let c=e.line,d=await (0,f.answerInWriting)({callId:c.callId,settings:r,standing:c.standing,messages:[...c.messages,{role:"user",content:a}],said:n});c.messages=d.messages,c.lastAt=Date.now();let u=(0,b.plainText)(d.text)||d.did.join("\n"),p=function(e){let t=[],a=e;for(;a.length>i.REACH.chars;){let e=a.slice(0,i.REACH.chars),n=Math.max(e.lastIndexOf("\n\n"),e.lastIndexOf("\n")),s=n>i.REACH.chars/2?n:i.REACH.chars;t.push(a.slice(0,s).trim()),a=a.slice(s).trim()}return a&&t.push(a),t}(u||"…");for(let[e,a]of p.entries())await l.say(t.chat,a,e===p.length-1?s:void 0);return await M(e,t,d.text),!0}catch(n){let a=(0,k.isPublicError)(n)?n.message:(0,r.modelErrorToString)(n);return g.logger.warn(`reach ${e.name}: ${a}`),await l.say(t.chat,a).catch(()=>{}),!1}finally{clearInterval(h)}}async function M(e,t,a){for(let s of(await (0,w.filesOnDisk)((0,p.pathsIn)(a),null)).slice(-i.REACH.files)){let a=await (0,w.insideWorkspace)(s),o=a?await (0,n.stat)(a).catch(()=>null):null;a&&o&&!(o.size>i.REACH.fileBytes)&&await e.channel.sendFile(t.chat,await (0,n.readFile)(a),s.split("/").pop()??"file","image"===(0,p.viewKindOf)(s)).catch(t=>g.logger.warn(`reach ${e.name}: could not send ${s}`,t))}}async function R(){for(let e of[...B.last?[B.last]:[],..._.REACH_CHANNELS.filter(e=>e!==B.last)]){let t=B.live.get(e),a=t?await O(e):null;if(t&&a)return{live:t,person:a}}return null}async function P(){if(!await R())return;let e=z(await (0,c.listInboxThreads)()),t=new Set(e.map(e=>e.key));for(let[e,a]of B.due)t.has(e)||(clearTimeout(a),B.due.delete(e));for(let t of e)B.told.has(t.key)||B.due.has(t.key)||B.due.set(t.key,setTimeout(()=>void j(t.key),i.REACH.notifyAfterMs))}let z=e=>(0,u.openWork)(e).filter(e=>"progress"!==e.kind);async function j(e){B.due.delete(e);let t=await R();if(!t||B.told.has(e))return;let a=await (0,c.listInboxThreads)(),n=z(a).find(t=>t.key===e);if(!n)return;let s=a.find(t=>t.room.questions.some(t=>`question:${t.id}`===e)),i=s?.room.questions.find(t=>`question:${t.id}`===e),o=(i?.options??[]).map((e,t)=>{let a=`${i?.id.slice(0,40)}:${t}`;return B.choices.set(a,{threadId:s?.id??"",bot:i?.bot??"",question:i?.id??"",answer:e}),{text:e,data:a}});B.told.add(e),await I(t.live,t.person,n.line,null,o)?await (0,h.acceptRoomRelays)(n.relayIds):B.told.delete(e)}async function q(e,t,a,n){let s=B.choices.get(a);if(!s)return void await e.channel.say(t.chat,"That question is no longer open here. Write your answer instead.");for(let[e,t]of B.choices)t.question===s.question&&B.choices.delete(e);try{await (0,l.answerThread)(s.threadId,s.answer,"user",s.bot),n&&await e.channel.settle(t.chat,n.id,`${n.text}
61
61
 
62
62
  → ${s.answer}`),e.line?.messages.push({role:"user",content:`[The user answered ${s.bot}'s question from their phone: ${s.answer}. It has reached ${s.bot}.]`})}catch(a){await e.channel.say(t.chat,(0,k.isPublicError)(a)?a.message:"That answer did not get through.")}}e.s(["startReach",0,A]),a()}catch(e){a(e)}},!1),822931,e=>{"use strict";var t=e.i(333925),a=e.i(951056),n=e.i(900533);let s={message:"says",question:"asks",report:"reports",interrupted:"was cut off"},i={question:0,stopped:1,done:2,progress:3};function o(e){let a=e.trim();if(a.length<=t.CALL_RELAY.chars)return a;let n=a.slice(0,t.CALL_RELAY.chars),s=Math.max(n.lastIndexOf("\n\n"),n.lastIndexOf(". "),n.lastIndexOf(".\n"),n.lastIndexOf("。")),i=(s>t.CALL_RELAY.chars/3?n.slice(0,s+1):n).trim();return`${i}
63
- [The message goes on; the rest is in its thread on screen.]`}e.s(["openWork",0,function(e){let t=[];for(let r of e){let{relays:e,questions:l}=r.room,c=(0,n.toDate)(r.updatedAt).getTime(),h=(e,t)=>`[${e} → Thursday, thread "${r.label}" (${r.id}), ${t}.]`,d=(e,t)=>({kind:"relay",name:r.label,line:t,done:!0,bot:e});for(let a of l){let n=a.options?.length?` Options: ${a.options.join(" / ")}.`:"";t.push({rank:i.question,key:`question:${a.id}`,kind:"question",line:`${h(a.bot,"question")}
64
- ${o(a.text)}${n}`,relayIds:e.filter(e=>e.messageId===a.id).map(e=>e.id),show:d(a.bot,`${a.bot} asks`)})}let u=e.filter(e=>!l.some(t=>t.id===e.messageId)),m="done"===r.status,f="waiting"===r.status&&(0,a.isAppStop)(r.ask)&&!r.ask?.auto;if(m||f){if(r.seen)continue;let e=f?"stopped":"done",a="stopped"===e?`It stopped before finishing. Where it got to: ${o(r.ask?.question??r.outcome??"")}`:`Done. Its answer: ${o(r.outcome??"")}`;t.push({rank:i[e],key:`${e}:${r.id}@${c}`,kind:"ending",line:`${h(r.bot,e)}
65
- ${a}`,relayIds:u.map(e=>e.id),show:d(r.bot,"stopped"===e?`${r.bot} stopped`:`${r.bot} finished`)});continue}for(let e of u)t.push({rank:i.progress,key:`progress:${e.id}`,kind:"progress",line:`${h(e.bot,e.kind)}
66
- ${o(e.text)}`,relayIds:[e.id],show:d(e.bot,`${e.bot} ${s[e.kind]}`)})}return t.sort((e,t)=>e.rank-t.rank)}])},181300,e=>e.a(async(t,a)=>{try{var n=e.i(734732),s=e.i(853205),i=e.i(333925),o=e.i(247839),r=e.i(113022),l=e.i(986507),c=e.i(864328),h=e.i(539470),d=e.i(79290),u=e.i(51083),m=e.i(656719),f=e.i(724185),p=e.i(426455);e.i(938281);var w=e.i(212389),y=e.i(520401),g=e.i(933395),k=e.i(293822),b=t([r,l,h,d,f,y]);async function $(){let e=await Promise.all(g.TEXT_CALL_PROVIDERS.map(async e=>await (0,f.readConfig)(e.apiKeyName)?e.apiKeyName:null));return(0,g.textCallRunsOn)(t=>e.includes(t))}async function v(e,t){if(t)return t;let a=await $();return a||(0,w.publicError)(O),{provider:a,model:e.backendModel}}async function _(e,t){let a=await v(e,t),[n,s]=await Promise.all([(0,y.insertCall)({provider:a.provider,model:i.TEXT_CALL.model,backendModel:a.model}),(0,h.loadCallStanding)()]);return{callId:n,standing:s}}async function S(e){var t;let a,{callId:s,settings:o,standing:r,messages:l,said:c,signal:h}=e,[d,m]=await Promise.all([E(s,o),(0,y.nextTurnSeq)(s)]);null!==c&&await (0,y.saveTurns)(s,[{id:crypto.randomUUID(),role:"user",text:c,seq:m}]);let f=await (0,n.generateText)({model:d.model,instructions:d.system,messages:[...T(r),...l],allowSystemInMessages:!0,tools:d.tools,providerOptions:d.providerOptions,stopWhen:(0,n.stepCountIs)(i.TEXT_CALL.maxSteps),abortSignal:h,onStepEnd:(t=s,a=null===c?m:m+1,async e=>{for(let n of e.content)if("tool-call"===n.type){let s=e.content.find(e=>"tool-result"===e.type&&e.toolCallId===n.toolCallId);await (0,y.saveTurns)(t,[{id:n.toolCallId,role:"tool",tool:n.toolName,text:n.toolName===u.TOOL_NAMES.web_search?function(e,t){let a=t??{},n=[(e??{}).query,a.action?.query].find(e=>"string"==typeof e&&!!e.trim()),s=Array.isArray(a.sources)?a.sources.flatMap(e=>e&&"object"==typeof e&&"url"in e&&"string"==typeof e.url?[{url:e.url,..."title"in e&&"string"==typeof e.title?{title:e.title}:{}}]:[]):[];return JSON.stringify({query:n??null,sources:s})}(n.input,s?.type==="tool-result"?s.output:null):JSON.stringify(n.input??{}),seq:a++}])}else"text"===n.type&&n.text.trim()?await (0,y.saveTurns)(t,[{id:crypto.randomUUID(),role:"assistant",text:n.text.trim(),seq:a++}]):"reasoning"===n.type&&n.text.trim()&&await (0,y.saveThought)(t,{id:crypto.randomUUID(),text:n.text.trim(),seq:a})})});return{text:f.text.trim(),did:f.steps.flatMap(e=>e.toolCalls.map(e=>(0,k.toolLine)(e.toolName,JSON.stringify(e.input??{}))??e.toolName)),messages:[...l,...f.response.messages]}}[r,l,h,d,f,y]=b.then?(await b)():b,s.z.object({callId:s.z.string().min(1),settings:g.ThursdaySettingsSchema,standing:s.z.string().nullish(),runsOn:c.textModelRefSchema.nullish(),messages:s.z.array(s.z.unknown()).min(1)});let T=e=>e?[{role:"system",content:e}]:[];async function E(e,t,a){let n=await v(t,a),s="openai"===n.provider||"chatgpt"===n.provider,[i,c,h,w,y]=await Promise.all([(0,l.getTextModel)(n),(0,d.loadThursdayPrompt)(t.backendPrompt,!0),(0,r.loadTools)({target:"thursday",callId:e,webSearch:t.webSearch,written:!0}),(0,f.readConfig)(m.EXA_API_KEY),(0,f.readConfig)(o.LIVE_PROVIDER.apiKeyName)]),g=i.searchTools&&Object.values(i.searchTools)[0],k={...h,...t.webSearch&&!w&&g?{[u.TOOL_NAMES.web_search]:g}:{}},b=s?y?await (0,p.acceptedReasoning)({apiKey:y,model:n.model,effort:t.reasoningEffort}):"none"===t.reasoningEffort?{effort:"none"}:{effort:t.reasoningEffort??void 0,summary:"auto"}:null;return{model:i.model,system:c,tools:k,providerOptions:{openai:{...b?.effort?{reasoningEffort:b.effort}:{},...b&&"summary"in b&&b.summary?{reasoningSummary:b.summary}:{}}}}}let O="Writing to Thursday needs a GPT subscription sign-in or an OpenAI key — Settings › API keys.";e.s(["answerInWriting",0,S,"openTextCall",0,_]),a()}catch(e){a(e)}},!1),317613,e=>{"use strict";var t=e.i(912714),a=e.i(750227),n=e.i(333925);e.i(375814);var s=e.i(871096);async function i(e){let i=await (0,s.openWorkspace)(),o=new Set(await (0,t.readdir)((0,a.join)(s.WORKSPACE,n.GIVEN_FILES.dir)).catch(()=>[])),r=[];for(let t of e){let e=t.name.normalize("NFC").replace(/[^\p{L}\p{N}._-]+/gu,"-").replace(/^[-.]+|-+$/g,"")||"file",a=e.lastIndexOf("."),s=a>0?e.slice(0,a):e,l=a>0?e.slice(a):"",c=e;for(let e=2;o.has(c);e++)c=`${s}-${e}${l}`;o.add(c);let h=`${n.GIVEN_FILES.dir}/${c}`;await i.writeFile(h,Buffer.from(await t.arrayBuffer())),r.push(h)}return r}e.s(["keepGivenFiles",0,i])},417043,e=>{"use strict";e.s(["ChannelRefusal",0,class extends Error{}])},903438,e=>{"use strict";e.s(["inPieces",0,function(e,t){let a=[],n=e;for(;n.length>t;){let e=n.slice(0,t),s=Math.max(e.lastIndexOf("\n\n"),e.lastIndexOf("\n")),i=s>t/2?s:t;a.push(n.slice(0,i).trim()),n=n.slice(i).trim()}return n&&a.push(n),a},"runSocket",0,function(e,t,a){return new Promise((n,s)=>{let i=new WebSocket(e),o=e=>{i.readyState===WebSocket.OPEN&&i.send(JSON.stringify(e))},r=()=>i.close(1e3);a.addEventListener("abort",r,{once:!0}),i.addEventListener("message",e=>{try{t.message(JSON.parse(String(e.data)),o)}catch{}}),i.addEventListener("error",()=>{i.readyState!==WebSocket.OPEN&&s(Error(`Could not connect to ${new URL(e).host}`))}),i.addEventListener("close",e=>{a.removeEventListener("abort",r),n({code:e.code,reason:e.reason})})})}])},854455,e=>{"use strict";var t=e.i(417043),a=e.i(903438);let n={4004:"Discord did not take the bot token.",4013:"Discord refused the intents this bot asked for.",4014:"Discord refused an intent this bot is not allowed — check the bot's page."};e.s(["createDiscord",0,function(e){async function s(a,n,s){let i=s instanceof FormData,o=await fetch(`https://discord.com/api/v10${n}`,{method:a,headers:{authorization:`Bot ${e}`,...i||!s?{}:{"content-type":"application/json"}},body:i?s:s?JSON.stringify(s):void 0});if(o.ok)return 204===o.status?null:await o.json();let r=await o.json().catch(()=>null),l=r?.message??`Discord answered ${o.status}`;throw 401===o.status?new t.ChannelRefusal(l):Error(l)}let i=e=>{let t=e.length<=5?1:5,a=[];for(let n=0;n<e.length&&a.length<5;n+=t)a.push({type:1,components:e.slice(n,n+t).map(e=>({type:2,style:2,label:e.text.slice(0,80),custom_id:e.data}))});return a};return{async listen(i,o){let r,l=null;try{let c=await (0,a.runSocket)("wss://gateway.discord.gg/?v=10&encoding=json",{message(t,a){let{op:n,d:o,s:c,t:h}=t;if(null!==c&&(l=c),10===n){let t=o.heartbeat_interval;r=setInterval(()=>a({op:1,d:l}),t),a({op:2,d:{token:e,intents:4096,properties:{os:process.platform,browser:"thursday",device:"thursday"}}})}else if(1===n)a({op:1,d:l});else if(0===n&&"READY"===h)i.ready(o.user.username);else if(0===n&&h){var d,u;let e=(d=h,u=o,"MESSAGE_CREATE"===d?u.guild_id||u.author.bot?null:{kind:"message",chat:u.channel_id,name:u.author.global_name||u.author.username,words:u.content.trim(),files:(u.attachments??[]).map(e=>({name:e.filename,fetch:async()=>{let t=await fetch(e.url);if(!t.ok)throw Error(`Discord answered ${t.status} for the file`);return new File([await t.arrayBuffer()],e.filename,{type:e.content_type??""})}})),unreadable:!1}:"INTERACTION_CREATE"===d?3!==u.type||u.guild_id?null:(s("POST",`/interactions/${u.id}/${u.token}/callback`,{type:6}).catch(()=>{}),{kind:"press",chat:u.channel_id,data:u.data?.custom_id??"",under:u.message?{id:u.message.id,text:u.message.content}:null}):null);e&&i.incoming(e)}}},o),h=n[c.code];if(h)throw new t.ChannelRefusal(h);if(!o.aborted)throw Error(`Discord closed the connection (${c.code})`)}finally{clearInterval(r)}},async say(e,t,n){let o=(0,a.inPieces)(t,1900);for(let[t,a]of o.entries())await s("POST",`/channels/${e}/messages`,{content:a,...n?.length&&t===o.length-1?{components:i(n)}:{}})},async typing(e){await s("POST",`/channels/${e}/typing`).catch(()=>{})},async settle(e,t,a){await s("PATCH",`/channels/${e}/messages/${t}`,{content:a.slice(0,1900),components:[]}).catch(()=>{})},async sendFile(e,t,a){let n=new FormData;n.set("payload_json",JSON.stringify({attachments:[{id:0,filename:a}]})),n.set("files[0]",new Blob([t]),a),await s("POST",`/channels/${e}/messages`,n)}}}])},426455,e=>{"use strict";var t=e.i(853205),a=e.i(333925),n=e.i(938281);e.i(556325),t.z.object({session:t.z.object({id:t.z.string().min(1)}),transport:t.z.object({type:t.z.literal("webrtc"),sdp:t.z.string().min(1)})});let s=new Map;async function i(e){let{apiKey:t,model:i,effort:o}=e,r=`${i} ${o??"auto"}`,l=s.get(r);if(void 0!==l)return l;let c="none"===o?{effort:o}:{...o?{effort:o}:{},summary:"auto"};for(;;){let e=await fetch("https://api.openai.com/v1/responses/input_tokens",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(a.LIVE_CALL.reasoningCheckMs),body:JSON.stringify({model:i,input:".",reasoning:c})}).catch(()=>null);if(!e)return c;let o=Object.keys(c).length?c:null;if(e.ok)return s.set(r,o),o;let l=await e.json().catch(()=>null),h=l?.error?.param?.replace(/^reasoning\./,"");if("effort"!==h&&"summary"!==h||!(h in c))return c;if(n.logger.warn(`${i} takes no reasoning ${h}; calls omit it`),delete c[h],!Object.keys(c).length)return s.set(r,null),null}}e.s(["acceptedReasoning",0,i])}];
63
+ [The message goes on; the rest is in its thread on screen.]`}e.s(["openWork",0,function(e){let t=[];for(let r of e){let{relays:e,questions:l}=r.room,h=(0,n.toDate)(r.updatedAt).getTime(),c=(e,t)=>`[${e} → Thursday, thread "${r.label}" (${r.id}), ${t}.]`,d=(e,t)=>({kind:"relay",name:r.label,line:t,done:!0,bot:e});for(let a of l){let n=a.options?.length?` Options: ${a.options.join(" / ")}.`:"";t.push({rank:i.question,key:`question:${a.id}`,kind:"question",line:`${c(a.bot,"question")}
64
+ ${o(a.text)}${n}`,relayIds:e.filter(e=>e.messageId===a.id).map(e=>e.id),show:d(a.bot,`${a.bot} asks`)})}let u=e.filter(e=>!l.some(t=>t.id===e.messageId)),m="done"===r.status,f="waiting"===r.status&&(0,a.isAppStop)(r.ask)&&!r.ask?.auto;if(m||f){if(r.seen)continue;let e=f?"stopped":"done",a="stopped"===e?`It stopped before finishing. Where it got to: ${o(r.ask?.question??r.outcome??"")}`:`Done. Its answer: ${o(r.outcome??"")}`;t.push({rank:i[e],key:`${e}:${r.id}@${h}`,kind:"ending",line:`${c(r.bot,e)}
65
+ ${a}`,relayIds:u.map(e=>e.id),show:d(r.bot,"stopped"===e?`${r.bot} stopped`:`${r.bot} finished`)});continue}for(let e of u)t.push({rank:i.progress,key:`progress:${e.id}`,kind:"progress",line:`${c(e.bot,e.kind)}
66
+ ${o(e.text)}`,relayIds:[e.id],show:d(e.bot,`${e.bot} ${s[e.kind]}`)})}return t.sort((e,t)=>e.rank-t.rank)}])},181300,e=>e.a(async(t,a)=>{try{var n=e.i(734732),s=e.i(853205),i=e.i(333925),o=e.i(247839),r=e.i(113022),l=e.i(986507),h=e.i(864328),c=e.i(539470),d=e.i(79290),u=e.i(51083),m=e.i(656719),f=e.i(724185),p=e.i(426455);e.i(938281);var w=e.i(212389),y=e.i(520401),g=e.i(933395),k=e.i(293822),b=t([r,l,c,d,f,y]);async function $(){let e=await Promise.all(g.TEXT_CALL_PROVIDERS.map(async e=>await (0,f.readConfig)(e.apiKeyName)?e.apiKeyName:null));return(0,g.textCallRunsOn)(t=>e.includes(t))}async function v(e,t){if(t)return t;let a=await $();return a||(0,w.publicError)(O),{provider:a,model:e.backendModel}}async function _(e,t){let a=await v(e,t),[n,s]=await Promise.all([(0,y.insertCall)({provider:a.provider,model:i.TEXT_CALL.model,backendModel:a.model}),(0,c.loadCallStanding)()]);return{callId:n,standing:s}}async function S(e){var t;let a,{callId:s,settings:o,standing:r,messages:l,said:h,signal:c}=e,[d,m]=await Promise.all([E(s,o),(0,y.nextTurnSeq)(s)]);null!==h&&await (0,y.saveTurns)(s,[{id:crypto.randomUUID(),role:"user",text:h,seq:m}]);let f=await (0,n.generateText)({model:d.model,instructions:d.system,messages:[...T(r),...l],allowSystemInMessages:!0,tools:d.tools,providerOptions:d.providerOptions,stopWhen:(0,n.stepCountIs)(i.TEXT_CALL.maxSteps),abortSignal:c,onStepEnd:(t=s,a=null===h?m:m+1,async e=>{for(let n of e.content)if("tool-call"===n.type){let s=e.content.find(e=>"tool-result"===e.type&&e.toolCallId===n.toolCallId);await (0,y.saveTurns)(t,[{id:n.toolCallId,role:"tool",tool:n.toolName,text:n.toolName===u.TOOL_NAMES.web_search?function(e,t){let a=t??{},n=[(e??{}).query,a.action?.query].find(e=>"string"==typeof e&&!!e.trim()),s=Array.isArray(a.sources)?a.sources.flatMap(e=>e&&"object"==typeof e&&"url"in e&&"string"==typeof e.url?[{url:e.url,..."title"in e&&"string"==typeof e.title?{title:e.title}:{}}]:[]):[];return JSON.stringify({query:n??null,sources:s})}(n.input,s?.type==="tool-result"?s.output:null):JSON.stringify(n.input??{}),seq:a++}])}else"text"===n.type&&n.text.trim()?await (0,y.saveTurns)(t,[{id:crypto.randomUUID(),role:"assistant",text:n.text.trim(),seq:a++}]):"reasoning"===n.type&&n.text.trim()&&await (0,y.saveThought)(t,{id:crypto.randomUUID(),text:n.text.trim(),seq:a})})});return{text:f.text.trim(),did:f.steps.flatMap(e=>e.toolCalls.map(e=>(0,k.toolLine)(e.toolName,JSON.stringify(e.input??{}))??e.toolName)),messages:[...l,...f.response.messages]}}[r,l,c,d,f,y]=b.then?(await b)():b,s.z.object({callId:s.z.string().min(1),settings:o.LiveSettingsSchema,standing:s.z.string().nullish(),runsOn:h.textModelRefSchema.nullish(),messages:s.z.array(s.z.unknown()).min(1)});let T=e=>e?[{role:"system",content:e}]:[];async function E(e,t,a){let n=await v(t,a),s="openai"===n.provider||"chatgpt"===n.provider,[i,h,c,w,y]=await Promise.all([(0,l.getTextModel)(n),(0,d.loadThursdayPrompt)(t.backendPrompt,!0),(0,r.loadTools)({target:"thursday",callId:e,webSearch:t.webSearch,written:!0}),(0,f.readConfig)(m.EXA_API_KEY),(0,f.readConfig)(o.LIVE_PROVIDER.apiKeyName)]),g=i.searchTools&&Object.values(i.searchTools)[0],k={...c,...t.webSearch&&!w&&g?{[u.TOOL_NAMES.web_search]:g}:{}},b=s?y?await (0,p.acceptedReasoning)({apiKey:y,model:n.model,effort:t.reasoningEffort}):"none"===t.reasoningEffort?{effort:"none"}:{effort:t.reasoningEffort??void 0,summary:"auto"}:null;return{model:i.model,system:h,tools:k,providerOptions:{openai:{...b?.effort?{reasoningEffort:b.effort}:{},...b&&"summary"in b&&b.summary?{reasoningSummary:b.summary}:{}}}}}let O="Writing to Thursday needs a GPT subscription sign-in or an OpenAI key — Settings › API keys.";e.s(["answerInWriting",0,S,"openTextCall",0,_]),a()}catch(e){a(e)}},!1),317613,e=>{"use strict";var t=e.i(912714),a=e.i(750227),n=e.i(333925);e.i(375814);var s=e.i(871096);async function i(e){let i=await (0,s.openWorkspace)(),o=new Set(await (0,t.readdir)((0,a.join)(s.WORKSPACE,n.GIVEN_FILES.dir)).catch(()=>[])),r=[];for(let t of e){let e=t.name.normalize("NFC").replace(/[^\p{L}\p{N}._-]+/gu,"-").replace(/^[-.]+|-+$/g,"")||"file",a=e.lastIndexOf("."),s=a>0?e.slice(0,a):e,l=a>0?e.slice(a):"",h=e;for(let e=2;o.has(h);e++)h=`${s}-${e}${l}`;o.add(h);let c=`${n.GIVEN_FILES.dir}/${h}`;await i.writeFile(c,Buffer.from(await t.arrayBuffer())),r.push(c)}return r}e.s(["keepGivenFiles",0,i])},417043,e=>{"use strict";e.s(["ChannelRefusal",0,class extends Error{}])},903438,e=>{"use strict";e.s(["inPieces",0,function(e,t){let a=[],n=e;for(;n.length>t;){let e=n.slice(0,t),s=Math.max(e.lastIndexOf("\n\n"),e.lastIndexOf("\n")),i=s>t/2?s:t;a.push(n.slice(0,i).trim()),n=n.slice(i).trim()}return n&&a.push(n),a},"runSocket",0,function(e,t,a){return new Promise((n,s)=>{let i=new WebSocket(e),o=e=>{i.readyState===WebSocket.OPEN&&i.send(JSON.stringify(e))},r=()=>i.close(1e3);a.addEventListener("abort",r,{once:!0}),i.addEventListener("message",e=>{try{t.message(JSON.parse(String(e.data)),o)}catch{}}),i.addEventListener("error",()=>{i.readyState!==WebSocket.OPEN&&s(Error(`Could not connect to ${new URL(e).host}`))}),i.addEventListener("close",e=>{a.removeEventListener("abort",r),n({code:e.code,reason:e.reason})})})}])},854455,e=>{"use strict";var t=e.i(417043),a=e.i(903438);let n={4004:"Discord did not take the bot token.",4013:"Discord refused the intents this bot asked for.",4014:"Discord refused an intent this bot is not allowed — check the bot's page."};e.s(["createDiscord",0,function(e){async function s(a,n,s){let i=s instanceof FormData,o=await fetch(`https://discord.com/api/v10${n}`,{method:a,headers:{authorization:`Bot ${e}`,...i||!s?{}:{"content-type":"application/json"}},body:i?s:s?JSON.stringify(s):void 0});if(o.ok)return 204===o.status?null:await o.json();let r=await o.json().catch(()=>null),l=r?.message??`Discord answered ${o.status}`;throw 401===o.status?new t.ChannelRefusal(l):Error(l)}let i=e=>{let t=e.length<=5?1:5,a=[];for(let n=0;n<e.length&&a.length<5;n+=t)a.push({type:1,components:e.slice(n,n+t).map(e=>({type:2,style:2,label:e.text.slice(0,80),custom_id:e.data}))});return a};return{async listen(i,o){let r,l=null;try{let h=await (0,a.runSocket)("wss://gateway.discord.gg/?v=10&encoding=json",{message(t,a){let{op:n,d:o,s:h,t:c}=t;if(null!==h&&(l=h),10===n){let t=o.heartbeat_interval;r=setInterval(()=>a({op:1,d:l}),t),a({op:2,d:{token:e,intents:4096,properties:{os:process.platform,browser:"thursday",device:"thursday"}}})}else if(1===n)a({op:1,d:l});else if(0===n&&"READY"===c)i.ready(o.user.username);else if(0===n&&c){var d,u;let e=(d=c,u=o,"MESSAGE_CREATE"===d?u.guild_id||u.author.bot?null:{kind:"message",chat:u.channel_id,name:u.author.global_name||u.author.username,words:u.content.trim(),files:(u.attachments??[]).map(e=>({name:e.filename,fetch:async()=>{let t=await fetch(e.url);if(!t.ok)throw Error(`Discord answered ${t.status} for the file`);return new File([await t.arrayBuffer()],e.filename,{type:e.content_type??""})}})),unreadable:!1}:"INTERACTION_CREATE"===d?3!==u.type||u.guild_id?null:(s("POST",`/interactions/${u.id}/${u.token}/callback`,{type:6}).catch(()=>{}),{kind:"press",chat:u.channel_id,data:u.data?.custom_id??"",under:u.message?{id:u.message.id,text:u.message.content}:null}):null);e&&i.incoming(e)}}},o),c=n[h.code];if(c)throw new t.ChannelRefusal(c);if(!o.aborted)throw Error(`Discord closed the connection (${h.code})`)}finally{clearInterval(r)}},async say(e,t,n){let o=(0,a.inPieces)(t,1900);for(let[t,a]of o.entries())await s("POST",`/channels/${e}/messages`,{content:a,...n?.length&&t===o.length-1?{components:i(n)}:{}})},async typing(e){await s("POST",`/channels/${e}/typing`).catch(()=>{})},async settle(e,t,a){await s("PATCH",`/channels/${e}/messages/${t}`,{content:a.slice(0,1900),components:[]}).catch(()=>{})},async sendFile(e,t,a){let n=new FormData;n.set("payload_json",JSON.stringify({attachments:[{id:0,filename:a}]})),n.set("files[0]",new Blob([t]),a),await s("POST",`/channels/${e}/messages`,n)}}}])},426455,e=>{"use strict";var t=e.i(853205),a=e.i(333925),n=e.i(938281);e.i(556325),t.z.object({session:t.z.object({id:t.z.string().min(1)}),transport:t.z.object({type:t.z.literal("webrtc"),sdp:t.z.string().min(1)})});let s=new Map;async function i(e){let{apiKey:t,model:i,effort:o}=e,r=`${i} ${o??"auto"}`,l=s.get(r);if(void 0!==l)return l;let h="none"===o?{effort:o}:{...o?{effort:o}:{},summary:"auto"};for(;;){let e=await fetch("https://api.openai.com/v1/responses/input_tokens",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(a.LIVE_CALL.reasoningCheckMs),body:JSON.stringify({model:i,input:".",reasoning:h})}).catch(()=>null);if(!e)return h;let o=Object.keys(h).length?h:null;if(e.ok)return s.set(r,o),o;let l=await e.json().catch(()=>null),c=l?.error?.param?.replace(/^reasoning\./,"");if("effort"!==c&&"summary"!==c||!(c in h))return h;if(n.logger.warn(`${i} takes no reasoning ${c}; calls omit it`),delete h[c],!Object.keys(h).length)return s.set(r,null),null}}e.s(["acceptedReasoning",0,i])}];
67
67
 
68
68
  //# sourceMappingURL=_0x-ej3f._.js.map
@@ -1,5 +1,5 @@
1
- module.exports=[380690,e=>{"use strict";let a,l,t,s,n,r;var c,i=e.i(687388),o=e.i(640911);let d={threads:!0,routines:!0,memory:!0,mcp:!0,config:!0,reach:!0,signins:!0},u=globalThis,b=u.__appEvents??=(a=new Set,{emit(e){for(let l of[...a])try{l(e)}catch(e){console.error("event listener failed",e)}},subscribe:e=>(a.add(e),()=>{a.delete(e)})}),f=u.__presence??=(c=i.BROWSER_GONE_MS,l=!1,t=null,s=new Set,n=new Set,r=e=>{for(let a of[...e])try{a()}catch(e){console.error("presence listener failed",e)}},{get watching(){return l},track(e){if(e>0){t&&clearTimeout(t),t=null,l||(l=!0,r(n));return}!t&&l&&(t=setTimeout(()=>{t=null,l=!1,r(s)},c))},onGone:e=>(s.add(e),()=>s.delete(e)),onBack:e=>(n.add(e),()=>n.delete(e))}),m=u.__appEventStream??=function(e,a={}){let l=new TextEncoder,t=a.heartbeatMs??2e4,s=0;return{respond:(n,r)=>{let c=()=>{};return new Response(new ReadableStream({async start(i){let d=!1,u=new Map,b=[],f=e=>{if(!d)try{i.enqueue(l.encode(e))}catch{c()}},m=e=>f(`data: ${JSON.stringify(e)}
1
+ module.exports=[380690,e=>{"use strict";let a,l,t,s,n,r;var c,i=e.i(687388),o=e.i(640911);let d={threads:!0,routines:!0,memory:!0,mcp:!0,config:!0,reach:!0,signins:!0},u=globalThis,b=u.__appEvents??=(a=new Set,{emit(e){for(let l of[...a])try{l(e)}catch(e){console.error("event listener failed",e)}},subscribe:e=>(a.add(e),()=>{a.delete(e)})}),f=u.__presence??=(c=i.BROWSER_GONE_MS,l=!1,t=null,s=new Set,n=new Set,r=e=>{for(let a of[...e])try{a()}catch(e){console.error("presence listener failed",e)}},{get watching(){return l},track(e){if(e>0){t&&clearTimeout(t),t=null,l||(l=!0,r(n));return}!t&&l&&(t=setTimeout(()=>{t=null,l=!1,r(s)},c))},onGone:e=>(s.add(e),()=>s.delete(e)),onBack:e=>(n.add(e),()=>n.delete(e))}),T=u.__appEventStream??=function(e,a={}){let l=new TextEncoder,t=a.heartbeatMs??2e4,s=0;return{respond:(n,r)=>{let c=()=>{};return new Response(new ReadableStream({async start(i){let d=!1,u=new Map,b=[],f=e=>{if(!d)try{i.enqueue(l.encode(e))}catch{c()}},T=e=>f(`data: ${JSON.stringify(e)}
2
2
 
3
- `),T=e=>{let l=a.coalesce?.keyOf(e)??null;if(null===l)return m(e);let t=u.get(l);t&&clearTimeout(t),u.set(l,setTimeout(()=>{u.delete(l),m(e)},a.coalesce?.ms))},g=e.subscribe(e=>b?b.push(e):T(e)),h=setInterval(()=>f(": ping\n\n"),t);s+=1,a.onWatchers?.(s),c=()=>{if(!d){for(let e of(d=!0,s-=1,a.onWatchers?.(s),g(),clearInterval(h),u.values()))clearTimeout(e);try{i.close()}catch{}}},n.addEventListener("abort",c);try{for(let e of await r?.()??[])m(e)}catch(e){o.logger.error("event stream opening failed",e),c();return}let M=b;for(let e of(b=null,M))T(e)},cancel(){c()}}),{headers:{"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-store","X-Accel-Buffering":"no"}})},get watchers(){return s}}}(b,{coalesce:{ms:150,keyOf:e=>e.type in d?e.type:null},onWatchers:f.track}),T=u.__bootId??=crypto.randomUUID();e.s(["BOOT_ID",0,T,"appEventStream",0,m,"appEvents",0,b,"presence",0,f],380690)},22676,e=>e.a(async(a,l)=>{try{var t=e.i(349129),s=e.i(875225),n=e.i(518899),r=e.i(687388),c=e.i(528790),i=e.i(613240),o=e.i(378884),d=e.i(340698),u=e.i(134344),b=a([c,o,d]);async function f(){return(0,u.isSkillsOn)(await (0,d.readConfig)(u.THURSDAY_KEYS.skills))}async function m(e,a){for(let l of a)await c.database.insert(i.callMessageTable).values({callId:e,...l,fragments:l.fragments??null}).onConflictDoUpdate({target:[i.callMessageTable.callId,i.callMessageTable.id],set:{text:l.text,role:l.role,tool:l.tool??null,fragments:l.fragments??null}})}async function T(e){let[a]=await c.database.select({seq:n.sql`max(${i.callMessageTable.seq})`}).from(i.callMessageTable).where((0,s.eq)(i.callMessageTable.callId,e));return a?.seq==null?0:Number(a.seq)+1}async function g(e,a){await c.database.insert(i.callThoughtTable).values({callId:e,...a}).onConflictDoNothing()}async function h(e){let a=await c.database.select({callId:i.callMessageTable.callId,startedAt:i.callTable.startedAt,role:i.callMessageTable.role,tool:i.callMessageTable.tool,text:i.callMessageTable.text,seq:i.callMessageTable.seq}).from(i.callMessageTable).innerJoin(i.callTable,(0,s.eq)(i.callMessageTable.callId,i.callTable.id)).orderBy((0,t.desc)(i.callTable.startedAt),(0,t.desc)(i.callMessageTable.seq)).limit(e),l=new Map;for(let e of a){let a=l.get(e.callId)??{callId:e.callId,startedAt:e.startedAt,turns:[]};a.turns.push({role:e.role,tool:e.tool,text:e.text,seq:e.seq}),l.set(e.callId,a)}return[...l.values()].reverse().map(e=>({...e,turns:e.turns.reverse()}))}async function M(e,a,l){let[r]=await c.database.select({startedAt:i.callTable.startedAt}).from(i.callTable).where((0,s.eq)(i.callTable.id,e));if(!r)return null;let[o]=await c.database.select({total:n.sql`count(*)`}).from(i.callMessageTable).where((0,s.eq)(i.callMessageTable.callId,e)),d=await c.database.select({role:i.callMessageTable.role,tool:i.callMessageTable.tool,text:i.callMessageTable.text}).from(i.callMessageTable).where((0,s.eq)(i.callMessageTable.callId,e)).orderBy((0,t.asc)(i.callMessageTable.seq)).limit(l).offset((a-1)*l);return{startedAt:r.startedAt,total:Number(o?.total??0),turns:d}}async function p(){return(await c.database.select({id:i.callTable.id}).from(i.callTable).where((0,s.isNull)(i.callTable.endedAt)).limit(1)).length>0}async function y(e){let a=e.limit??r.CALL_HISTORY_PAGE,l=await c.database.select({id:i.callTable.id,provider:i.callTable.provider,model:i.callTable.model,backendModel:i.callTable.backendModel,startedAt:i.callTable.startedAt,endedAt:i.callTable.endedAt,endedReason:i.callTable.endedReason,seconds:i.callTable.seconds}).from(i.callTable).innerJoin(i.callMessageTable,(0,s.eq)(i.callMessageTable.callId,i.callTable.id)).where(e.before?(0,s.lt)(i.callTable.startedAt,e.before):void 0).groupBy(i.callTable.id).orderBy((0,t.desc)(i.callTable.startedAt)).limit(a);if(0===l.length)return[];let n=await c.database.select({callId:i.callMessageTable.callId,id:i.callMessageTable.id,role:i.callMessageTable.role,tool:i.callMessageTable.tool,text:i.callMessageTable.text,seq:i.callMessageTable.seq,fragments:i.callMessageTable.fragments,at:i.callMessageTable.at}).from(i.callMessageTable).where((0,s.inArray)(i.callMessageTable.callId,l.map(e=>e.id))).orderBy((0,t.asc)(i.callMessageTable.callId),(0,t.asc)(i.callMessageTable.seq)),d=new Map;for(let e of n){let{callId:a,...l}=e,t=d.get(a);t?t.push(l):d.set(a,[l])}let u=await (0,o.listCallJobs)(l.map(e=>e.id));return l.map(e=>({...e,turns:d.get(e.id)??[],jobs:u.filter(a=>a.callId===e.id).map(e=>({id:e.id,label:e.label,status:e.status,outcome:e.outcome}))}))}[c,o,d]=b.then?(await b)():b,e.s(["isAnyCallLive",0,p,"listCallHistory",0,y,"listRecentTurns",0,h,"nextTurnSeq",0,T,"readCallConversation",0,M,"readCallSkillsOn",0,f,"saveThought",0,g,"saveTurns",0,m]),l()}catch(e){l(e)}},!1),134344,e=>{"use strict";var a=e.i(105249),l=e.i(687388),t=e.i(911757),s=e.i(264079),n=e.i(904309);let r=t.LiveSettingsSchema.extend({locale:a.default.string().max(35).nullish()}),c=[{id:"chatgpt",...s.TEXT_MODEL_PROVIDERS.chatgpt},{id:"openai",...s.TEXT_MODEL_PROVIDERS.openai}];a.default.object({charset:a.default.enum(["ascii","emoji","emojiOnly"]).default(l.ASCII_FACE.charset),fontSize:a.default.number().min(l.ASCII_FACE.fontSize.min).max(l.ASCII_FACE.fontSize.max).default(l.ASCII_FACE.fontSize.default),density:a.default.number().min(l.ASCII_FACE.density.min).max(l.ASCII_FACE.density.max).default(l.ASCII_FACE.density.default)}).parse({});a.default.object({enabled:a.default.boolean(),phrase:a.default.string().trim().min(3).max(32)}),a.default.object({enabled:a.default.boolean(),combo:a.default.string().trim().min(1).max(64)}),a.default.enum(["off","waiting","any"]),a.default.enum(["center","sides"]),a.default.object({id:a.default.string().min(1),role:a.default.enum(["user","assistant","tool"]),tool:a.default.string().nullish(),text:a.default.string(),seq:a.default.number().int().min(0),fragments:a.default.array(n.LiveFragmentSchema).nullish()}),a.default.object({id:a.default.string().min(1),text:a.default.string(),seq:a.default.number().int().min(0)}),e.s(["TEXT_CALL_PROVIDERS",0,c,"THURSDAY_KEYS",0,{skills:"THURSDAY_SKILLS"},"ThursdaySettingsSchema",0,r,"isSkillsOn",0,e=>e?.trim()==="on","textCallRunsOn",0,e=>c.find(a=>e(a.apiKeyName))?.id??null],134344)}];
3
+ `),m=e=>{let l=a.coalesce?.keyOf(e)??null;if(null===l)return T(e);let t=u.get(l);t&&clearTimeout(t),u.set(l,setTimeout(()=>{u.delete(l),T(e)},a.coalesce?.ms))},g=e.subscribe(e=>b?b.push(e):m(e)),M=setInterval(()=>f(": ping\n\n"),t);s+=1,a.onWatchers?.(s),c=()=>{if(!d){for(let e of(d=!0,s-=1,a.onWatchers?.(s),g(),clearInterval(M),u.values()))clearTimeout(e);try{i.close()}catch{}}},n.addEventListener("abort",c);try{for(let e of await r?.()??[])T(e)}catch(e){o.logger.error("event stream opening failed",e),c();return}let h=b;for(let e of(b=null,h))m(e)},cancel(){c()}}),{headers:{"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-store","X-Accel-Buffering":"no"}})},get watchers(){return s}}}(b,{coalesce:{ms:150,keyOf:e=>e.type in d?e.type:null},onWatchers:f.track}),m=u.__bootId??=crypto.randomUUID();e.s(["BOOT_ID",0,m,"appEventStream",0,T,"appEvents",0,b,"presence",0,f],380690)},22676,e=>e.a(async(a,l)=>{try{var t=e.i(349129),s=e.i(875225),n=e.i(518899),r=e.i(687388),c=e.i(528790),i=e.i(613240),o=e.i(378884),d=e.i(340698),u=e.i(134344),b=a([c,o,d]);async function f(){return(0,u.isSkillsOn)(await (0,d.readConfig)(u.THURSDAY_KEYS.skills))}async function T(e,a){for(let l of a)await c.database.insert(i.callMessageTable).values({callId:e,...l,fragments:l.fragments??null}).onConflictDoUpdate({target:[i.callMessageTable.callId,i.callMessageTable.id],set:{text:l.text,role:l.role,tool:l.tool??null,fragments:l.fragments??null}})}async function m(e){let[a]=await c.database.select({seq:n.sql`max(${i.callMessageTable.seq})`}).from(i.callMessageTable).where((0,s.eq)(i.callMessageTable.callId,e));return a?.seq==null?0:Number(a.seq)+1}async function g(e,a){await c.database.insert(i.callThoughtTable).values({callId:e,...a}).onConflictDoNothing()}async function M(e){let a=await c.database.select({callId:i.callMessageTable.callId,startedAt:i.callTable.startedAt,role:i.callMessageTable.role,tool:i.callMessageTable.tool,text:i.callMessageTable.text,seq:i.callMessageTable.seq}).from(i.callMessageTable).innerJoin(i.callTable,(0,s.eq)(i.callMessageTable.callId,i.callTable.id)).orderBy((0,t.desc)(i.callTable.startedAt),(0,t.desc)(i.callMessageTable.seq)).limit(e),l=new Map;for(let e of a){let a=l.get(e.callId)??{callId:e.callId,startedAt:e.startedAt,turns:[]};a.turns.push({role:e.role,tool:e.tool,text:e.text,seq:e.seq}),l.set(e.callId,a)}return[...l.values()].reverse().map(e=>({...e,turns:e.turns.reverse()}))}async function h(e,a,l){let[r]=await c.database.select({startedAt:i.callTable.startedAt}).from(i.callTable).where((0,s.eq)(i.callTable.id,e));if(!r)return null;let[o]=await c.database.select({total:n.sql`count(*)`}).from(i.callMessageTable).where((0,s.eq)(i.callMessageTable.callId,e)),d=await c.database.select({role:i.callMessageTable.role,tool:i.callMessageTable.tool,text:i.callMessageTable.text}).from(i.callMessageTable).where((0,s.eq)(i.callMessageTable.callId,e)).orderBy((0,t.asc)(i.callMessageTable.seq)).limit(l).offset((a-1)*l);return{startedAt:r.startedAt,total:Number(o?.total??0),turns:d}}async function p(){return(await c.database.select({id:i.callTable.id}).from(i.callTable).where((0,s.isNull)(i.callTable.endedAt)).limit(1)).length>0}async function I(e){let a=e.limit??r.CALL_HISTORY_PAGE,l=await c.database.select({id:i.callTable.id,provider:i.callTable.provider,model:i.callTable.model,backendModel:i.callTable.backendModel,startedAt:i.callTable.startedAt,endedAt:i.callTable.endedAt,endedReason:i.callTable.endedReason,seconds:i.callTable.seconds}).from(i.callTable).innerJoin(i.callMessageTable,(0,s.eq)(i.callMessageTable.callId,i.callTable.id)).where(e.before?(0,s.lt)(i.callTable.startedAt,e.before):void 0).groupBy(i.callTable.id).orderBy((0,t.desc)(i.callTable.startedAt)).limit(a);if(0===l.length)return[];let n=await c.database.select({callId:i.callMessageTable.callId,id:i.callMessageTable.id,role:i.callMessageTable.role,tool:i.callMessageTable.tool,text:i.callMessageTable.text,seq:i.callMessageTable.seq,fragments:i.callMessageTable.fragments,at:i.callMessageTable.at}).from(i.callMessageTable).where((0,s.inArray)(i.callMessageTable.callId,l.map(e=>e.id))).orderBy((0,t.asc)(i.callMessageTable.callId),(0,t.asc)(i.callMessageTable.seq)),d=new Map;for(let e of n){let{callId:a,...l}=e,t=d.get(a);t?t.push(l):d.set(a,[l])}let u=await (0,o.listCallJobs)(l.map(e=>e.id));return l.map(e=>({...e,turns:d.get(e.id)??[],jobs:u.filter(a=>a.callId===e.id).map(e=>({id:e.id,label:e.label,status:e.status,outcome:e.outcome}))}))}[c,o,d]=b.then?(await b)():b,e.s(["isAnyCallLive",0,p,"listCallHistory",0,I,"listRecentTurns",0,M,"nextTurnSeq",0,m,"readCallConversation",0,h,"readCallSkillsOn",0,f,"saveThought",0,g,"saveTurns",0,T]),l()}catch(e){l(e)}},!1),134344,e=>{"use strict";var a=e.i(105249),l=e.i(687388),t=e.i(264079),s=e.i(904309);let n=[{id:"chatgpt",...t.TEXT_MODEL_PROVIDERS.chatgpt},{id:"openai",...t.TEXT_MODEL_PROVIDERS.openai}];a.default.object({charset:a.default.enum(["ascii","emoji","emojiOnly"]).default(l.ASCII_FACE.charset),fontSize:a.default.number().min(l.ASCII_FACE.fontSize.min).max(l.ASCII_FACE.fontSize.max).default(l.ASCII_FACE.fontSize.default),density:a.default.number().min(l.ASCII_FACE.density.min).max(l.ASCII_FACE.density.max).default(l.ASCII_FACE.density.default)}).parse({});a.default.object({enabled:a.default.boolean(),phrase:a.default.string().trim().min(3).max(32)}),a.default.object({enabled:a.default.boolean(),combo:a.default.string().trim().min(1).max(64)}),a.default.enum(["off","waiting","any"]),a.default.enum(["center","sides"]),a.default.object({id:a.default.string().min(1),role:a.default.enum(["user","assistant","tool"]),tool:a.default.string().nullish(),text:a.default.string(),seq:a.default.number().int().min(0),fragments:a.default.array(s.LiveFragmentSchema).nullish()}),a.default.object({id:a.default.string().min(1),text:a.default.string(),seq:a.default.number().int().min(0)}),e.s(["TEXT_CALL_PROVIDERS",0,n,"THURSDAY_KEYS",0,{skills:"THURSDAY_SKILLS"},"isSkillsOn",0,e=>e?.trim()==="on","textCallRunsOn",0,e=>n.find(a=>e(a.apiKeyName))?.id??null],134344)}];
4
4
 
5
5
  //# sourceMappingURL=_12-amdu._.js.map