thursday-agent 0.28.0 → 0.30.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 (528) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +1 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +6 -0
  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 +3 -3
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  17. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  18. package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
  19. package/.next/server/app/api/artifact/route.js +13 -14
  20. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  21. package/.next/server/app/api/bot/memory/files/route.js +11 -6
  22. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  23. package/.next/server/app/api/bot/memory/route.js +11 -11
  24. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  25. package/.next/server/app/api/bot/route.js +11 -11
  26. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  27. package/.next/server/app/api/bot/thread/file/route.js +19 -19
  28. package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
  29. package/.next/server/app/api/bot/thread/lessons/route/app-paths-manifest.json +3 -0
  30. package/.next/server/app/api/bot/thread/lessons/route/build-manifest.json +12 -0
  31. package/.next/server/app/api/bot/thread/lessons/route/server-reference-manifest.json +4 -0
  32. package/.next/server/app/api/bot/thread/lessons/route.js +18 -0
  33. package/.next/server/app/api/bot/thread/lessons/route.js.map +5 -0
  34. package/.next/server/app/api/bot/thread/lessons/route.js.nft.json +1 -0
  35. package/.next/server/app/api/bot/thread/lessons/route_client-reference-manifest.js +3 -0
  36. package/.next/server/app/api/bot/thread/route.js +8 -9
  37. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  38. package/.next/server/app/api/bot/tool-result/[id]/route.js +10 -11
  39. package/.next/server/app/api/bot/tool-result/[id]/route.js.nft.json +1 -1
  40. package/.next/server/app/api/config/route.js +6 -7
  41. package/.next/server/app/api/config/route.js.nft.json +1 -1
  42. package/.next/server/app/api/events/route.js +4 -4
  43. package/.next/server/app/api/events/route.js.nft.json +1 -1
  44. package/.next/server/app/api/favicon/[host]/route.js +3 -3
  45. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  46. package/.next/server/app/api/file/[...path]/route.js +11 -6
  47. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  48. package/.next/server/app/api/llm-model/automatic/route.js +10 -11
  49. package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
  50. package/.next/server/app/api/llm-model/catalog/[provider]/route.js +10 -11
  51. package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -1
  52. package/.next/server/app/api/llm-model/credits/[provider]/route.js +10 -11
  53. package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -1
  54. package/.next/server/app/api/llm-model/route.js +8 -9
  55. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  56. package/.next/server/app/api/llm-model/subscription/route.js +8 -9
  57. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  58. package/.next/server/app/api/mcp/[name]/route.js +8 -9
  59. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  60. package/.next/server/app/api/mcp/oauth/callback/route.js +10 -11
  61. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  62. package/.next/server/app/api/mcp/route.js +8 -9
  63. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  64. package/.next/server/app/api/mcp/tools/route.js +8 -9
  65. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  66. package/.next/server/app/api/memory/edit/route.js +19 -19
  67. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  68. package/.next/server/app/api/memory/route.js +6 -7
  69. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  70. package/.next/server/app/api/reach/route.js +20 -20
  71. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  72. package/.next/server/app/api/routine/route.js +12 -12
  73. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  74. package/.next/server/app/api/running/route.js +3 -3
  75. package/.next/server/app/api/running/route.js.nft.json +1 -1
  76. package/.next/server/app/api/signins/route.js +11 -7
  77. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  78. package/.next/server/app/api/skills/[source]/[name]/route.js +14 -14
  79. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  80. package/.next/server/app/api/skills/route.js +14 -14
  81. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  82. package/.next/server/app/api/thursday/call/end/route.js +19 -19
  83. package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
  84. package/.next/server/app/api/thursday/call/plan/route.js +19 -19
  85. package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
  86. package/.next/server/app/api/thursday/call/route.js +11 -12
  87. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  88. package/.next/server/app/api/thursday/settings/route.js +11 -12
  89. package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
  90. package/.next/server/app/api/thursday/text/route.js +20 -20
  91. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  92. package/.next/server/app/api/thursday/tool-call/route.js +20 -20
  93. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  94. package/.next/server/app/api/update/route.js +10 -11
  95. package/.next/server/app/api/update/route.js.nft.json +1 -1
  96. package/.next/server/app/api/workspace/files/route.js +13 -13
  97. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  98. package/.next/server/app/api/workspace/route.js +13 -13
  99. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  100. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
  101. package/.next/server/app/artifact/[...path]/page.js +11 -11
  102. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  103. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  104. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  105. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  106. package/.next/server/app/page/server-reference-manifest.json +101 -68
  107. package/.next/server/app/page.js +10 -10
  108. package/.next/server/app/page.js.nft.json +1 -1
  109. package/.next/server/app/page_client-reference-manifest.js +1 -1
  110. package/.next/server/app-paths-manifest.json +1 -0
  111. package/.next/server/chunks/[root-of-the-server]__0-xeb9k._.js +3 -0
  112. package/.next/server/chunks/{[root-of-the-server]__0qkh140._.js → [root-of-the-server]__01lftiq._.js} +1 -1
  113. package/.next/server/chunks/[root-of-the-server]__022hmm4._.js +1 -1
  114. package/.next/server/chunks/{[root-of-the-server]__1im7w7z._.js → [root-of-the-server]__02td13j._.js} +1 -1
  115. package/.next/server/chunks/[root-of-the-server]__03bjojd._.js +2 -2
  116. package/.next/server/chunks/[root-of-the-server]__03jn6g5._.js +3 -0
  117. package/.next/server/chunks/[root-of-the-server]__05wauq3._.js +12 -0
  118. package/.next/server/chunks/[root-of-the-server]__06eoz24._.js +5 -0
  119. package/.next/server/chunks/{[root-of-the-server]__0sfx6id._.js → [root-of-the-server]__0_jtzqu._.js} +2 -2
  120. package/.next/server/chunks/[root-of-the-server]__0_k10q9._.js +3 -0
  121. package/.next/server/chunks/{[root-of-the-server]__1l4feoc._.js → [root-of-the-server]__0cmzvf7._.js} +1 -1
  122. package/.next/server/chunks/[root-of-the-server]__0cq8fp4._.js +3 -0
  123. package/.next/server/chunks/[root-of-the-server]__0cyki0f._.js +8 -0
  124. package/.next/server/chunks/[root-of-the-server]__0fvz6w5._.js +6 -0
  125. package/.next/server/chunks/[root-of-the-server]__0kj7-jk._.js +3 -0
  126. package/.next/server/chunks/{[root-of-the-server]__1p1ww2o._.js → [root-of-the-server]__0mq_mis._.js} +1 -1
  127. package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +1 -1
  128. package/.next/server/chunks/{[root-of-the-server]__00dtf7h._.js → [root-of-the-server]__0o6p3jk._.js} +2 -2
  129. package/.next/server/chunks/[root-of-the-server]__0opzn4f._.js +3 -0
  130. package/.next/server/chunks/{[root-of-the-server]__0ags3y9._.js → [root-of-the-server]__0puaol7._.js} +2 -2
  131. package/.next/server/chunks/[root-of-the-server]__0qhf60h._.js +1 -1
  132. package/.next/server/chunks/{[root-of-the-server]__0ah_uba._.js → [root-of-the-server]__0s6-921._.js} +1 -1
  133. package/.next/server/chunks/{[root-of-the-server]__0n4xgfd._.js → [root-of-the-server]__0sg3_9d._.js} +2 -2
  134. package/.next/server/chunks/[root-of-the-server]__0t9e405._.js +3 -0
  135. package/.next/server/chunks/{[root-of-the-server]__20zucml._.js → [root-of-the-server]__0ubu0sh._.js} +1 -1
  136. package/.next/server/chunks/[root-of-the-server]__0ucigrb._.js +3 -0
  137. package/.next/server/chunks/{[root-of-the-server]__0_qe8iq._.js → [root-of-the-server]__0wnd1ac._.js} +2 -2
  138. package/.next/server/chunks/[root-of-the-server]__1-ga0kh._.js +5 -0
  139. package/.next/server/chunks/[root-of-the-server]__10x2qg8._.js +5 -0
  140. package/.next/server/chunks/{[root-of-the-server]__0fo9gc5._.js → [root-of-the-server]__114bnf1._.js} +1 -1
  141. package/.next/server/chunks/[root-of-the-server]__1343ru3._.js +3 -0
  142. package/.next/server/chunks/{[root-of-the-server]__1g6_6it._.js → [root-of-the-server]__16682o8._.js} +1 -1
  143. package/.next/server/chunks/[root-of-the-server]__16bbvlw._.js +7 -0
  144. package/.next/server/chunks/{[root-of-the-server]__1ui547o._.js → [root-of-the-server]__16cwbuc._.js} +1 -1
  145. package/.next/server/chunks/{[root-of-the-server]__05fq824._.js → [root-of-the-server]__17luxss._.js} +2 -2
  146. package/.next/server/chunks/[root-of-the-server]__17ses32._.js +3 -0
  147. package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +1 -1
  148. package/.next/server/chunks/{[root-of-the-server]__1m9dh1w._.js → [root-of-the-server]__1ahc9c9._.js} +1 -1
  149. package/.next/server/chunks/[root-of-the-server]__1bewni6._.js +8 -0
  150. package/.next/server/chunks/{[root-of-the-server]__0lg1fok._.js → [root-of-the-server]__1bk734v._.js} +1 -1
  151. package/.next/server/chunks/{[root-of-the-server]__0atf1-_._.js → [root-of-the-server]__1btmuni._.js} +5 -5
  152. package/.next/server/chunks/[root-of-the-server]__1e2aiae._.js +3 -0
  153. package/.next/server/chunks/[root-of-the-server]__1fjmju_._.js +3 -0
  154. package/.next/server/chunks/[root-of-the-server]__1j-6f71._.js +3 -0
  155. package/.next/server/chunks/{[root-of-the-server]__0btxiu1._.js → [root-of-the-server]__1ltmy5k._.js} +2 -2
  156. package/.next/server/chunks/[root-of-the-server]__1mf425m._.js +8 -0
  157. package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
  158. package/.next/server/chunks/[root-of-the-server]__1o7z93z._.js +1 -1
  159. package/.next/server/chunks/[root-of-the-server]__1orn-5b._.js +11 -0
  160. package/.next/server/chunks/[root-of-the-server]__1pho9cl._.js +3 -0
  161. package/.next/server/chunks/[root-of-the-server]__1q2jauq._.js +3 -0
  162. package/.next/server/chunks/[root-of-the-server]__1rs2v4h._.js +5 -0
  163. package/.next/server/chunks/{[root-of-the-server]__1ivv7te._.js → [root-of-the-server]__1rso8xj._.js} +2 -2
  164. package/.next/server/chunks/[root-of-the-server]__1xr0wxp._.js +3 -0
  165. package/.next/server/chunks/[root-of-the-server]__1yiazek._.js +3 -0
  166. package/.next/server/chunks/{[root-of-the-server]__0a2v56f._.js → [root-of-the-server]__20_po2e._.js} +2 -2
  167. package/.next/server/chunks/{[root-of-the-server]__0gmxpev._.js → [root-of-the-server]__20v-jxs._.js} +2 -2
  168. package/.next/server/chunks/[root-of-the-server]__212_w8j._.js +5 -0
  169. package/.next/server/chunks/_0-g8m2a._.js +72 -0
  170. package/.next/server/chunks/_0-qt5if._.js +1 -1
  171. package/.next/server/chunks/_00uhvhe._.js +12 -12
  172. package/.next/server/chunks/_02tecta._.js +5 -0
  173. package/.next/server/chunks/_04862qx._.js +3 -0
  174. package/.next/server/chunks/_05p90of._.js +3 -0
  175. package/.next/server/chunks/{_1_30lb4._.js → _06tj0ik._.js} +2 -2
  176. package/.next/server/chunks/_06u9yo-._.js +1 -1
  177. package/.next/server/chunks/_07mczew._.js +1 -1
  178. package/.next/server/chunks/_07pkeds._.js +2 -2
  179. package/.next/server/chunks/_08-mlqd._.js +1 -1
  180. package/.next/server/chunks/_08354bn._.js +12 -12
  181. package/.next/server/chunks/_08bp8w1._.js +3 -0
  182. package/.next/server/chunks/_0adsimt._.js +3 -0
  183. package/.next/server/chunks/_0bcx24d._.js +8 -0
  184. package/.next/server/chunks/{_0e8ks1n._.js → _0chqx-h._.js} +16 -12
  185. package/.next/server/chunks/_0d4f7pc._.js +5 -0
  186. package/.next/server/chunks/_0d9208_._.js +6 -0
  187. package/.next/server/chunks/{_0lip2ae._.js → _0ejet8x._.js} +16 -12
  188. package/.next/server/chunks/_0eowjm_._.js +72 -0
  189. package/.next/server/chunks/_0gxz_1b._.js +1 -1
  190. package/.next/server/chunks/_0iy3dus._.js +1 -1
  191. package/.next/server/chunks/_0jzv71c._.js +5 -0
  192. package/.next/server/chunks/{_0hin38_._.js → _0khihjk._.js} +6 -6
  193. package/.next/server/chunks/_0lrns0i._.js +3 -0
  194. package/.next/server/chunks/_0nbkv9k._.js +7 -0
  195. package/.next/server/chunks/_0p94gu0._.js +57 -0
  196. package/.next/server/chunks/_0pzqm_r._.js +3 -3
  197. package/.next/server/chunks/_0s515yz._.js +57 -0
  198. package/.next/server/chunks/_0supk_r._.js +5 -0
  199. package/.next/server/chunks/_0sxwm3y._.js +3 -0
  200. package/.next/server/chunks/_0tkzlv1._.js +11 -9
  201. package/.next/server/chunks/{_02o3ay7._.js → _0tzxrjg._.js} +2 -2
  202. package/.next/server/chunks/_0u0pa-b._.js +72 -0
  203. package/.next/server/chunks/_0umx0sn._.js +3 -0
  204. package/.next/server/chunks/_0vojr2u._.js +3 -0
  205. package/.next/server/chunks/_0wyh244._.js +12 -12
  206. package/.next/server/chunks/_0xlv72v._.js +57 -0
  207. package/.next/server/chunks/{_0a9x0xp._.js → _0y-5vzm._.js} +2 -2
  208. package/.next/server/chunks/{_0xt812m._.js → _0z06xn0._.js} +16 -12
  209. package/.next/server/chunks/_0zwjr-g._.js +1 -1
  210. package/.next/server/chunks/_1002x_9._.js +72 -0
  211. package/.next/server/chunks/{_0cdeabn._.js → _1299dpz._.js} +2 -2
  212. package/.next/server/chunks/_12htlm_._.js +9 -0
  213. package/.next/server/chunks/_13tat6z._.js +1 -1
  214. package/.next/server/chunks/_143moy6._.js +5 -0
  215. package/.next/server/chunks/_186uku9._.js +1 -1
  216. package/.next/server/chunks/_190pdee._.js +3 -0
  217. package/.next/server/chunks/_1951_6o._.js +3 -0
  218. package/.next/server/chunks/_19h6ag7._.js +3 -0
  219. package/.next/server/chunks/_1_0gehg._.js +11 -9
  220. package/.next/server/chunks/_1be0yao._.js +12 -12
  221. package/.next/server/chunks/_1dtm9bs._.js +1 -1
  222. package/.next/server/chunks/_1e1t6tm._.js +57 -0
  223. package/.next/server/chunks/_1e1yip3._.js +3 -0
  224. package/.next/server/chunks/{_0uet1h6._.js → _1e48czp._.js} +6 -6
  225. package/.next/server/chunks/_1fqa4ax._.js +72 -0
  226. package/.next/server/chunks/_1gb0_wm._.js +3 -0
  227. package/.next/server/chunks/_1i6626u._.js +3 -0
  228. package/.next/server/chunks/_1jca8ws._.js +3 -0
  229. package/.next/server/chunks/_1k6bmez._.js +1 -1
  230. package/.next/server/chunks/{_10qam6o._.js → _1kg70wc._.js} +6 -6
  231. package/.next/server/chunks/_1ko5shz._.js +1 -1
  232. package/.next/server/chunks/{_12a_gfz._.js → _1kqgeww._.js} +16 -12
  233. package/.next/server/chunks/_1kwmzab._.js +1 -1
  234. package/.next/server/chunks/_1l5qbki._.js +6 -0
  235. package/.next/server/chunks/_1mlsbwy._.js +3 -0
  236. package/.next/server/chunks/_1nej_f5._.js +72 -0
  237. package/.next/server/chunks/_1o15f0b._.js +3 -0
  238. package/.next/server/chunks/_1omiszv._.js +57 -0
  239. package/.next/server/chunks/_1otx63k._.js +3 -0
  240. package/.next/server/chunks/_1pwai-w._.js +72 -0
  241. package/.next/server/chunks/_1qdqpgf._.js +3 -0
  242. package/.next/server/chunks/_1qo2kxe._.js +3 -0
  243. package/.next/server/chunks/_1qoa_n_._.js +3 -0
  244. package/.next/server/chunks/_1qwi06-._.js +5 -0
  245. package/.next/server/chunks/_1qxheoa._.js +1 -1
  246. package/.next/server/chunks/{_1skgy7b._.js → _1ry6afh._.js} +6 -6
  247. package/.next/server/chunks/_1u9tb9z._.js +57 -0
  248. package/.next/server/chunks/_1v7z66t._.js +5 -0
  249. package/.next/server/chunks/_1vdlc8g._.js +5 -0
  250. package/.next/server/chunks/_1x2xiyw._.js +1 -1
  251. package/.next/server/chunks/_1y-e2mk._.js +79 -0
  252. package/.next/server/chunks/_1yx285_._.js +1 -1
  253. package/.next/server/chunks/_1za6dtx._.js +72 -0
  254. package/.next/server/chunks/_1zsrejy._.js +3 -0
  255. package/.next/server/chunks/_1zvhk_m._.js +1 -1
  256. package/.next/server/chunks/{_0m3sdq8._.js → _20sfopz._.js} +16 -12
  257. package/.next/server/chunks/_next-internal_server_app_api_bot_thread_lessons_route_actions_0zt-nr6.js +3 -0
  258. package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
  259. package/.next/server/chunks/features_0-728_-._.js +1 -1
  260. package/.next/server/chunks/features_0uy40ze._.js +1 -1
  261. package/.next/server/chunks/features_0vyrnq0._.js +3 -0
  262. package/.next/server/chunks/features_116bwtn._.js +1 -1
  263. package/.next/server/chunks/features_14kex_m._.js +6 -4
  264. package/.next/server/chunks/features_1cb9luv._.js +1 -1
  265. package/.next/server/chunks/features_1jd2zjm._.js +8 -8
  266. package/.next/server/chunks/features_1xn6un-._.js +6 -4
  267. package/.next/server/chunks/features_bot_1d6ghh5._.js +1 -1
  268. package/.next/server/chunks/features_bot_1dfrdsb._.js +1 -1
  269. package/.next/server/chunks/ssr/{[root-of-the-server]__1j2x83w._.js → [root-of-the-server]__0ama9d0._.js} +2 -2
  270. package/.next/server/chunks/ssr/[root-of-the-server]__0auk-ke._.js +13 -8
  271. package/.next/server/chunks/ssr/{[root-of-the-server]__02-kwsg._.js → [root-of-the-server]__0p0cgo1._.js} +2 -2
  272. package/.next/server/chunks/ssr/{[root-of-the-server]__1ngprpi._.js → [root-of-the-server]__0rpm20m._.js} +2 -2
  273. package/.next/server/chunks/ssr/[root-of-the-server]__0vcuiyu._.js +3 -0
  274. package/.next/server/chunks/ssr/{[root-of-the-server]__13xx3dr._.js → [root-of-the-server]__0x2--_p._.js} +2 -2
  275. package/.next/server/chunks/ssr/{[root-of-the-server]__1qiq402._.js → [root-of-the-server]__145268e._.js} +2 -2
  276. package/.next/server/chunks/ssr/{[root-of-the-server]__11_ws3y._.js → [root-of-the-server]__153-ebp._.js} +2 -2
  277. package/.next/server/chunks/ssr/[root-of-the-server]__16jc196._.js +1 -1
  278. package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
  279. package/.next/server/chunks/ssr/[root-of-the-server]__1hqly37._.js +3 -0
  280. package/.next/server/chunks/ssr/[root-of-the-server]__1j-bkt7._.js +3 -0
  281. package/.next/server/chunks/ssr/[root-of-the-server]__1nb9kc9._.js +3 -0
  282. package/.next/server/chunks/ssr/_0692i-a._.js +1 -1
  283. package/.next/server/chunks/ssr/{_0ldpw1q._.js → _0732nef._.js} +2 -2
  284. package/.next/server/chunks/ssr/_0cu8_pz._.js +3 -0
  285. package/.next/server/chunks/ssr/_0gk_72-._.js +3 -0
  286. package/.next/server/chunks/ssr/_0jvrmoz._.js +9 -0
  287. package/.next/server/chunks/ssr/_0k06tdw._.js +6 -0
  288. package/.next/server/chunks/ssr/{_1tc_gbg._.js → _0l_qakv._.js} +2 -2
  289. package/.next/server/chunks/ssr/_0lqzdd0._.js +3 -0
  290. package/.next/server/chunks/ssr/{_19g10gj._.js → _0p18b0z._.js} +2 -2
  291. package/.next/server/chunks/ssr/{_04f6fil._.js → _0pg2mgq._.js} +3 -3
  292. package/.next/server/chunks/ssr/{_1nnl9sj._.js → _0rm-9aj._.js} +2 -2
  293. package/.next/server/chunks/ssr/_128r03g._.js +13 -11
  294. package/.next/server/chunks/ssr/_17fa2ns._.js +12 -12
  295. package/.next/server/chunks/ssr/_18cjc9o._.js +3 -0
  296. package/.next/server/chunks/ssr/_1_px1o-._.js +1 -1
  297. package/.next/server/chunks/ssr/_1a_w_du._.js +1 -1
  298. package/.next/server/chunks/ssr/_1crszf7._.js +2 -2
  299. package/.next/server/chunks/ssr/_1e_9qjr._.js +1 -1
  300. package/.next/server/chunks/ssr/_1ehd80b._.js +3 -0
  301. package/.next/server/chunks/ssr/{_0a31ywo._.js → _1fua8fv._.js} +2 -2
  302. package/.next/server/chunks/ssr/_1m290ru._.js +3 -0
  303. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  304. package/.next/server/chunks/ssr/{_0nans9v._.js → _1q30h74._.js} +2 -2
  305. package/.next/server/chunks/ssr/_1q9r6u6._.js +1 -1
  306. package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
  307. package/.next/server/chunks/ssr/{_079xt7h._.js → _1v_5j9l._.js} +23 -19
  308. package/.next/server/chunks/ssr/_1x_6jyh._.js +3 -0
  309. package/.next/server/chunks/ssr/{components_ui_markdown-body_tsx_13aa4_2._.js → components_ui_markdown-body_tsx_0ywzjrl._.js} +2 -2
  310. package/.next/server/chunks/ssr/features_0rrgq_t._.js +1 -1
  311. package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
  312. package/.next/server/chunks/ssr/features_bot_1stfytf._.js +1 -1
  313. package/.next/server/chunks/ssr/features_bot_components_01ye2wp._.js +1 -1
  314. package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +2 -2
  315. package/.next/server/chunks/ssr/features_bot_components_thread-setting_tsx_0yae7zy._.js +1 -1
  316. package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +1 -1
  317. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  318. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  319. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  320. package/.next/server/chunks/ssr/features_skills_components_skills-setting_tsx_1wtuuip._.js +1 -1
  321. package/.next/server/chunks/ssr/features_thursday_components_thursday-setting_tsx_1_6ydrc._.js +1 -1
  322. package/.next/server/chunks/ssr/{node_modules_1k0ygyl._.js → node_modules_0-s3xam._.js} +1 -1
  323. package/.next/server/chunks/ssr/{node_modules_0jrjbfv._.js → node_modules_02p2t58._.js} +1 -1
  324. package/.next/server/chunks/ssr/{node_modules_1si826e._.js → node_modules_03gt5eg._.js} +1 -1
  325. package/.next/server/chunks/ssr/{node_modules_0jqaiyb._.js → node_modules_03ytewb._.js} +1 -1
  326. package/.next/server/chunks/ssr/{node_modules_19acw__._.js → node_modules_05yikon._.js} +1 -1
  327. package/.next/server/chunks/ssr/{node_modules_0gb732y._.js → node_modules_060s01j._.js} +2 -2
  328. package/.next/server/chunks/ssr/{node_modules_0wsygp2._.js → node_modules_07k-xj6._.js} +1 -1
  329. package/.next/server/chunks/ssr/{node_modules_1fa_3_c._.js → node_modules_08xo4p2._.js} +2 -2
  330. package/.next/server/chunks/ssr/{node_modules_05fihwh._.js → node_modules_09e0lw8._.js} +1 -1
  331. package/.next/server/chunks/ssr/{node_modules_0kdc_b7._.js → node_modules_0a1kt26._.js} +1 -1
  332. package/.next/server/chunks/ssr/{node_modules_050v667._.js → node_modules_0ahwwc6._.js} +2 -2
  333. package/.next/server/chunks/ssr/{node_modules_0ou72wu._.js → node_modules_0c2vpni._.js} +2 -2
  334. package/.next/server/chunks/ssr/{node_modules_1n5ds4a._.js → node_modules_0e7nwfw._.js} +1 -1
  335. package/.next/server/chunks/ssr/{node_modules_04qcy8e._.js → node_modules_0er1nmg._.js} +2 -2
  336. package/.next/server/chunks/ssr/{node_modules_1misalx._.js → node_modules_0f3769j._.js} +1 -1
  337. package/.next/server/chunks/ssr/{node_modules_0ljjw5o._.js → node_modules_0fi5we8._.js} +1 -1
  338. package/.next/server/chunks/ssr/{node_modules_1-vdt7b._.js → node_modules_0i2j6g6._.js} +1 -1
  339. package/.next/server/chunks/ssr/{node_modules_1861d28._.js → node_modules_0ka66-h._.js} +1 -1
  340. package/.next/server/chunks/ssr/{node_modules_140qn14._.js → node_modules_0keiwh2._.js} +2 -2
  341. package/.next/server/chunks/ssr/{node_modules_06p_ayw._.js → node_modules_0mihldg._.js} +1 -1
  342. package/.next/server/chunks/ssr/{node_modules_107hxun._.js → node_modules_0mujceo._.js} +1 -1
  343. package/.next/server/chunks/ssr/{node_modules_06b7g0r._.js → node_modules_0ntw_qg._.js} +1 -1
  344. package/.next/server/chunks/ssr/{node_modules_0jaxs1q._.js → node_modules_0py4_6y._.js} +1 -1
  345. package/.next/server/chunks/ssr/{node_modules_0y_dhgi._.js → node_modules_0qu8a5o._.js} +1 -1
  346. package/.next/server/chunks/ssr/{node_modules_1vh6nr-._.js → node_modules_0sk7kv9._.js} +1 -1
  347. package/.next/server/chunks/ssr/{node_modules_2045nus._.js → node_modules_0ted14c._.js} +2 -2
  348. package/.next/server/chunks/ssr/{node_modules_0z8o0-n._.js → node_modules_0u78wn3._.js} +1 -1
  349. package/.next/server/chunks/ssr/{node_modules_0skzy7i._.js → node_modules_0umtxxj._.js} +1 -1
  350. package/.next/server/chunks/ssr/{node_modules_1o1ud40._.js → node_modules_0ze7604._.js} +1 -1
  351. package/.next/server/chunks/ssr/{node_modules_152bm83._.js → node_modules_116k0n3._.js} +1 -1
  352. package/.next/server/chunks/ssr/{node_modules_0-zy1_5._.js → node_modules_15_65ve._.js} +1 -1
  353. package/.next/server/chunks/ssr/{node_modules_12409ud._.js → node_modules_16hmz5b._.js} +1 -1
  354. package/.next/server/chunks/ssr/{node_modules_069gsbk._.js → node_modules_16ki2uq._.js} +1 -1
  355. package/.next/server/chunks/ssr/{node_modules_0ia9-w8._.js → node_modules_19xrd6b._.js} +2 -2
  356. package/.next/server/chunks/ssr/{node_modules_1pt7o47._.js → node_modules_1_c3zat._.js} +2 -2
  357. package/.next/server/chunks/ssr/{node_modules_19gok-9._.js → node_modules_1axn4aw._.js} +2 -2
  358. package/.next/server/chunks/ssr/{node_modules_1jrlct1._.js → node_modules_1bjctcm._.js} +1 -1
  359. package/.next/server/chunks/ssr/{node_modules_1jt8w7f._.js → node_modules_1cxx8tm._.js} +1 -1
  360. package/.next/server/chunks/ssr/{node_modules_1v-un0n._.js → node_modules_1d7evv9._.js} +1 -1
  361. package/.next/server/chunks/ssr/{node_modules_13ccsqp._.js → node_modules_1depc7o._.js} +1 -1
  362. package/.next/server/chunks/ssr/{node_modules_1b45v66._.js → node_modules_1dm5c-u._.js} +1 -1
  363. package/.next/server/chunks/ssr/{node_modules_1uyu3cc._.js → node_modules_1fdivhl._.js} +1 -1
  364. package/.next/server/chunks/ssr/{node_modules_0ob-uxg._.js → node_modules_1gxpcyd._.js} +1 -1
  365. package/.next/server/chunks/ssr/{node_modules_0wa05ay._.js → node_modules_1ih7lxu._.js} +2 -2
  366. package/.next/server/chunks/ssr/{node_modules_18uwehg._.js → node_modules_1k-0av-._.js} +1 -1
  367. package/.next/server/chunks/ssr/{node_modules_0zi89fj._.js → node_modules_1kpg87p._.js} +1 -1
  368. package/.next/server/chunks/ssr/{node_modules_0q8xm6u._.js → node_modules_1le-lim._.js} +2 -2
  369. package/.next/server/chunks/ssr/{node_modules_17-v4n4._.js → node_modules_1lnx_h4._.js} +1 -1
  370. package/.next/server/chunks/ssr/{node_modules_0v0l095._.js → node_modules_1mwxdhp._.js} +1 -1
  371. package/.next/server/chunks/ssr/{node_modules_1x7napn._.js → node_modules_1q2a30m._.js} +2 -2
  372. package/.next/server/chunks/ssr/{node_modules_0walxvo._.js → node_modules_1soi3y1._.js} +2 -2
  373. package/.next/server/chunks/ssr/{node_modules_1xtd9ml._.js → node_modules_1sphzx9._.js} +1 -1
  374. package/.next/server/chunks/ssr/{node_modules_150qjpq._.js → node_modules_1tfn213._.js} +2 -2
  375. package/.next/server/chunks/ssr/{node_modules_20llbw8._.js → node_modules_1vmqt-a._.js} +1 -1
  376. package/.next/server/chunks/ssr/{node_modules_0xetrwd._.js → node_modules_1w8ljz0._.js} +2 -2
  377. package/.next/server/chunks/ssr/{node_modules_0_uhcxd._.js → node_modules_208s6_i._.js} +1 -1
  378. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_1bf0rdx._.js → node_modules_katex_dist_katex_mjs_0jhievg._.js} +1 -1
  379. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0-moq-r._.js → node_modules_katex_dist_katex_mjs_1zcod1m._.js} +1 -1
  380. package/.next/server/middleware-build-manifest.js +3 -3
  381. package/.next/server/pages/404.html +1 -1
  382. package/.next/server/pages/500.html +1 -1
  383. package/.next/server/server-reference-manifest.js +1 -1
  384. package/.next/server/server-reference-manifest.json +102 -69
  385. package/.next/static/chunks/{0lc_77uhatqgd.js → 078xraafllix3.js} +1 -1
  386. package/.next/static/chunks/{2njcedjozdqm7.js → 0nev6q2iq077s.js} +1 -1
  387. package/.next/static/chunks/{06ymo4xf31ggh.js → 0ocx6nt76fc71.js} +1 -1
  388. package/.next/static/chunks/0oo3vqzbrckzw.js +1 -0
  389. package/.next/static/chunks/{1ki7x6-ehua0u.js → 0piazplcpaho6.js} +1 -1
  390. package/.next/static/chunks/{25tttxgpn-fdl.js → 0totfwrzgu9zy.js} +2 -2
  391. package/.next/static/chunks/{1s5t41jiomssd.css → 0tpwm72wdln0d.css} +1 -1
  392. package/.next/static/chunks/{1o4z63f94c3r-.js → 0u_wx1-lmoae2.js} +1 -1
  393. package/.next/static/chunks/{2tlvu360xbisx.js → 0wwq57j09skhy.js} +1 -1
  394. package/.next/static/chunks/152u4p6c_6spk.js +1 -0
  395. package/.next/static/chunks/{3f4aku2z0zdxp.js → 1fignuuc030t2.js} +1 -1
  396. package/.next/static/chunks/{29fpns41ml485.js → 1n3a07w81jbc-.js} +1 -1
  397. package/.next/static/chunks/2-zfbypxf0agx.js +1 -0
  398. package/.next/static/chunks/{277zw6dp5yzks.js → 21wm184xoke98.js} +9 -9
  399. package/.next/static/chunks/{1vxq-0uxcm5yl.js → 25-zh-0nfxqyg.js} +1 -1
  400. package/.next/static/chunks/{1gca5ia-a-3e2.js → 29p2mdrn-z1oz.js} +1 -1
  401. package/.next/static/chunks/{2jn9y4sol_low.js → 2biit-egkb-xl.js} +2 -2
  402. package/.next/static/chunks/{1zwj72bhapocl.js → 2cciu1ow-svbf.js} +1 -1
  403. package/.next/static/chunks/{0i4df8t5_6a-g.js → 2gl-fo_rmmmq0.js} +1 -1
  404. package/.next/static/chunks/2kt0nc5m372ie.js +4 -0
  405. package/.next/static/chunks/2v486bh_6kl11.js +1 -0
  406. package/.next/static/chunks/33_a4j5altfr5.js +1 -0
  407. package/.next/static/chunks/37pwubc1t0jyy.js +1 -0
  408. package/.next/static/chunks/{0km5rjf8k0gst.js → 38rbtwatw658l.js} +1 -1
  409. package/.next/static/chunks/{233p45nuh4m5b.css → 3d-1vk5hzu5rq.css} +2 -2
  410. package/.next/static/chunks/{3ymtwwxmbactm.js → 3da8rr3q6pt0b.js} +1 -1
  411. package/.next/static/chunks/3i12sqqp1v8a8.js +1 -0
  412. package/.next/static/chunks/{1e3karuzhh7ik.js → 3iwdx3_gikxbg.js} +1 -1
  413. package/.next/static/chunks/{17ow2tmvy65in.js → 3k_xm_e4grb9u.js} +1 -1
  414. package/.next/static/chunks/{0_o7o4-itqsz7.js → 3odtl00mfb4u7.js} +1 -1
  415. package/.next/static/chunks/3wblbyhomh9va.js +1 -0
  416. package/.next/static/chunks/{1vwqvgit8a1vm.js → 3x2goglbfw5t7.js} +1 -1
  417. package/database/migrations/20261006014533_first_mercury/migration.sql +16 -0
  418. package/database/migrations/20261006014533_first_mercury/snapshot.json +2134 -0
  419. package/database/migrations/20261006022849_purple_young_avengers/migration.sql +1 -0
  420. package/database/migrations/20261006022849_purple_young_avengers/snapshot.json +2144 -0
  421. package/database/migrations/20261006040316_lazy_ogun/migration.sql +3 -0
  422. package/database/migrations/20261006040316_lazy_ogun/snapshot.json +2174 -0
  423. package/database/migrations/20261006043313_modern_goliath/migration.sql +1 -0
  424. package/database/migrations/20261006043313_modern_goliath/snapshot.json +2184 -0
  425. package/guide/bots.md +29 -0
  426. package/guide/calls.md +3 -1
  427. package/guide/phone.md +3 -1
  428. package/package.json +1 -1
  429. package/.next/server/chunks/[root-of-the-server]__00qilm2._.js +0 -3
  430. package/.next/server/chunks/[root-of-the-server]__01jpmcj._.js +0 -11
  431. package/.next/server/chunks/[root-of-the-server]__0bzz4u5._.js +0 -8
  432. package/.next/server/chunks/[root-of-the-server]__0d-dfqm._.js +0 -5
  433. package/.next/server/chunks/[root-of-the-server]__0elyqrt._.js +0 -3
  434. package/.next/server/chunks/[root-of-the-server]__0jqidnu._.js +0 -8
  435. package/.next/server/chunks/[root-of-the-server]__0mmynvy._.js +0 -5
  436. package/.next/server/chunks/[root-of-the-server]__0mzzwmt._.js +0 -8
  437. package/.next/server/chunks/[root-of-the-server]__0qo3zap._.js +0 -8
  438. package/.next/server/chunks/[root-of-the-server]__0rqmdxt._.js +0 -6
  439. package/.next/server/chunks/[root-of-the-server]__0sea36s._.js +0 -10
  440. package/.next/server/chunks/[root-of-the-server]__0unmyur._.js +0 -6
  441. package/.next/server/chunks/[root-of-the-server]__0wimh1u._.js +0 -8
  442. package/.next/server/chunks/[root-of-the-server]__0zezbds._.js +0 -5
  443. package/.next/server/chunks/[root-of-the-server]__12hkdpz._.js +0 -8
  444. package/.next/server/chunks/[root-of-the-server]__13dy1f5._.js +0 -5
  445. package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +0 -3
  446. package/.next/server/chunks/[root-of-the-server]__14inehv._.js +0 -3
  447. package/.next/server/chunks/[root-of-the-server]__17kdjf6._.js +0 -5
  448. package/.next/server/chunks/[root-of-the-server]__17yv6lg._.js +0 -5
  449. package/.next/server/chunks/[root-of-the-server]__1ac25yp._.js +0 -12
  450. package/.next/server/chunks/[root-of-the-server]__1hjb8wf._.js +0 -3
  451. package/.next/server/chunks/[root-of-the-server]__1jcu_e9._.js +0 -5
  452. package/.next/server/chunks/[root-of-the-server]__1jmr2ed._.js +0 -8
  453. package/.next/server/chunks/[root-of-the-server]__1onvx8x._.js +0 -5
  454. package/.next/server/chunks/[root-of-the-server]__1r2kimd._.js +0 -3
  455. package/.next/server/chunks/[root-of-the-server]__1rjj4i4._.js +0 -3
  456. package/.next/server/chunks/[root-of-the-server]__1s3umyw._.js +0 -3
  457. package/.next/server/chunks/[root-of-the-server]__212tz6e._.js +0 -8
  458. package/.next/server/chunks/_0-mqt2w._.js +0 -3
  459. package/.next/server/chunks/_0bcg3vg._.js +0 -6
  460. package/.next/server/chunks/_0cm67bo._.js +0 -6
  461. package/.next/server/chunks/_0gifi_2._.js +0 -7
  462. package/.next/server/chunks/_0li046e._.js +0 -3
  463. package/.next/server/chunks/_0mirg2-._.js +0 -3
  464. package/.next/server/chunks/_0oj2slk._.js +0 -5
  465. package/.next/server/chunks/_0oyz9x0._.js +0 -3
  466. package/.next/server/chunks/_0pljp-1._.js +0 -3
  467. package/.next/server/chunks/_0rdxqrk._.js +0 -5
  468. package/.next/server/chunks/_0sxih1y._.js +0 -3
  469. package/.next/server/chunks/_0u-96in._.js +0 -9
  470. package/.next/server/chunks/_0wjia9n._.js +0 -5
  471. package/.next/server/chunks/_0x2mdif._.js +0 -5
  472. package/.next/server/chunks/_0xa89lt._.js +0 -3
  473. package/.next/server/chunks/_0y2a-fg._.js +0 -3
  474. package/.next/server/chunks/_0ynjnhl._.js +0 -5
  475. package/.next/server/chunks/_1-sk_q4._.js +0 -3
  476. package/.next/server/chunks/_1355-km._.js +0 -3
  477. package/.next/server/chunks/_14-kmob._.js +0 -5
  478. package/.next/server/chunks/_1d7gbgb._.js +0 -3
  479. package/.next/server/chunks/_1d_enhu._.js +0 -3
  480. package/.next/server/chunks/_1evvnbp._.js +0 -18
  481. package/.next/server/chunks/_1g10pf5._.js +0 -3
  482. package/.next/server/chunks/_1icgbi8._.js +0 -18
  483. package/.next/server/chunks/_1ihge52._.js +0 -6
  484. package/.next/server/chunks/_1k92b3d._.js +0 -3
  485. package/.next/server/chunks/_1nfr-75._.js +0 -3
  486. package/.next/server/chunks/_1o2r4ja._.js +0 -5
  487. package/.next/server/chunks/_1pv6xbq._.js +0 -5
  488. package/.next/server/chunks/_1qgix-j._.js +0 -3
  489. package/.next/server/chunks/_1sd6nev._.js +0 -3
  490. package/.next/server/chunks/_1t8fv7b._.js +0 -18
  491. package/.next/server/chunks/_1ufbxe1._.js +0 -5
  492. package/.next/server/chunks/features_workspace_workspace_ts_13h82gv._.js +0 -3
  493. package/.next/server/chunks/features_workspace_workspace_ts_1iyjroj._.js +0 -8
  494. package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0omj5b1._.js +0 -3
  495. package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0s2o664._.js +0 -3
  496. package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0ufuc3s._.js +0 -3
  497. package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1cvpr1j._.js +0 -3
  498. package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1y49572._.js +0 -3
  499. package/.next/server/chunks/node_modules_zod_v4_03dw6sa._.js +0 -57
  500. package/.next/server/chunks/node_modules_zod_v4_0h0-drr._.js +0 -57
  501. package/.next/server/chunks/node_modules_zod_v4_0uctlhw._.js +0 -57
  502. package/.next/server/chunks/node_modules_zod_v4_13mu186._.js +0 -57
  503. package/.next/server/chunks/node_modules_zod_v4_17gxt3_._.js +0 -57
  504. package/.next/server/chunks/node_modules_zod_v4_1mygyfn._.js +0 -3
  505. package/.next/server/chunks/node_modules_zod_v4_1u-rl3b._.js +0 -57
  506. package/.next/server/chunks/ssr/[root-of-the-server]__0lv-wr_._.js +0 -3
  507. package/.next/server/chunks/ssr/[root-of-the-server]__0utwbb5._.js +0 -3
  508. package/.next/server/chunks/ssr/[root-of-the-server]__1fvh0zn._.js +0 -3
  509. package/.next/server/chunks/ssr/[root-of-the-server]__1ynag_l._.js +0 -3
  510. package/.next/server/chunks/ssr/_0f3t9pm._.js +0 -9
  511. package/.next/server/chunks/ssr/_131wmbl._.js +0 -6
  512. package/.next/server/chunks/ssr/_15zznka._.js +0 -3
  513. package/.next/server/chunks/ssr/_183f3bo._.js +0 -3
  514. package/.next/server/chunks/ssr/_1e1qe7w._.js +0 -3
  515. package/.next/server/chunks/ssr/_1kj3d2q._.js +0 -3
  516. package/.next/server/chunks/ssr/_1qtcl42._.js +0 -3
  517. package/.next/server/chunks/ssr/lib_utils_ts_0_f1xvm._.js +0 -3
  518. package/.next/static/chunks/051z85h3ofmif.js +0 -1
  519. package/.next/static/chunks/1hwehpk3kk-pc.js +0 -1
  520. package/.next/static/chunks/1pxe_gpjic1_h.js +0 -1
  521. package/.next/static/chunks/2zvo7b47hhxi5.js +0 -1
  522. package/.next/static/chunks/3k7fum0yljmyr.js +0 -1
  523. package/.next/static/chunks/3qhhs3dk6cdbq.js +0 -4
  524. package/.next/static/chunks/3sawwm4vucnzn.js +0 -1
  525. package/.next/static/chunks/3ul6m16ba_i3u.js +0 -1
  526. /package/.next/static/{pekZvsOZ3_8_ohluwgZtY → nXUvWsiGKRvNRk8kqeJ-u}/_buildManifest.js +0 -0
  527. /package/.next/static/{pekZvsOZ3_8_ohluwgZtY → nXUvWsiGKRvNRk8kqeJ-u}/_clientMiddlewareManifest.js +0 -0
  528. /package/.next/static/{pekZvsOZ3_8_ohluwgZtY → nXUvWsiGKRvNRk8kqeJ-u}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[70398,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__11_ws3y._.js","server/chunks/ssr/node_modules_14gkv49._.js","server/chunks/ssr/node_modules_1c0h-_d._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-OSK3NFVY_mjs_0x5leh1._.js","server/chunks/ssr/node_modules_1bmqmso._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-75Z2AOVW_mjs_051rute._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-2E4U76K2_mjs_20f4_iz._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-LNGE3PJU_mjs_15ujw6f._.js","server/chunks/ssr/[root-of-the-server]__0t_oz3-._.js","server/chunks/ssr/node_modules_katex_dist_katex_mjs_1oxucd3._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-DU6HZSFF_mjs_20hsuk9._.js","server/chunks/ssr/node_modules_0nvqvnw._.js","server/chunks/ssr/node_modules_1vbiuwu._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-4HAMMTFA_mjs_1cfif1_._.js","server/chunks/ssr/node_modules_roughjs_bundled_rough_esm_15c9pcx.js","server/chunks/ssr/node_modules_0rb-_la._.js"].map(b=>a.l(b))).then(()=>b(132378)))},436788,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1e_9qjr._.js"].map(b=>a.l(b))).then(()=>b(964665)))},348436,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_19g10gj._.js","server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js"].map(b=>a.l(b))).then(()=>b(581662)))},315458,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1v93o68._.js","server/chunks/ssr/features_bot_components_thread-setting_tsx_0yae7zy._.js"].map(b=>a.l(b))).then(()=>b(82951)))},228887,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_02uubus._.js","server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js"].map(b=>a.l(b))).then(()=>b(405593)))},930209,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1whffg_._.js","server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js"].map(b=>a.l(b))).then(()=>b(26444)))},277297,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1tih-7v._.js","server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js"].map(b=>a.l(b))).then(()=>b(857022)))},553433,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0kzgugm._.js","server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js"].map(b=>a.l(b))).then(()=>b(41014)))},15022,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1neoj22._.js"].map(b=>a.l(b))).then(()=>b(109788)))},479648,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1scosxl._.js","server/chunks/ssr/features_skills_components_skills-setting_tsx_1wtuuip._.js"].map(b=>a.l(b))).then(()=>b(703228)))},372511,a=>{a.v(b=>Promise.all(["server/chunks/ssr/features_thursday_components_here-globe_tsx_055duhw._.js"].map(b=>a.l(b))).then(()=>b(307181)))},502073,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1j5ohq5._.js","server/chunks/ssr/features_thursday_components_thursday-setting_tsx_1_6ydrc._.js"].map(b=>a.l(b))).then(()=>b(922056)))},895186,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_15zznka._.js"].map(b=>a.l(b))).then(()=>b(901729)))},72597,a=>{a.v(a=>Promise.resolve().then(()=>a(809750)))},628472,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_@vercel_oidc_dist_token_1mnivwk.js"].map(b=>a.l(b))).then(()=>b(779476)))},715837,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]_node_readline_1u65a-m._.js","server/chunks/ssr/node_modules_consola_dist_chunks_prompt_mjs_05cwqv2._.js"].map(b=>a.l(b))).then(()=>b(270101)))}];
1
+ module.exports=[70398,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__153-ebp._.js","server/chunks/ssr/node_modules_14gkv49._.js","server/chunks/ssr/node_modules_1c0h-_d._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-OSK3NFVY_mjs_0x5leh1._.js","server/chunks/ssr/node_modules_1bmqmso._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-75Z2AOVW_mjs_051rute._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-2E4U76K2_mjs_20f4_iz._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-LNGE3PJU_mjs_15ujw6f._.js","server/chunks/ssr/[root-of-the-server]__0t_oz3-._.js","server/chunks/ssr/node_modules_katex_dist_katex_mjs_1oxucd3._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-DU6HZSFF_mjs_20hsuk9._.js","server/chunks/ssr/node_modules_0nvqvnw._.js","server/chunks/ssr/node_modules_1vbiuwu._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-4HAMMTFA_mjs_1cfif1_._.js","server/chunks/ssr/node_modules_roughjs_bundled_rough_esm_15c9pcx.js","server/chunks/ssr/node_modules_0rb-_la._.js"].map(b=>a.l(b))).then(()=>b(132378)))},436788,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1e_9qjr._.js"].map(b=>a.l(b))).then(()=>b(964665)))},348436,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_0p18b0z._.js","server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js"].map(b=>a.l(b))).then(()=>b(581662)))},315458,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1v93o68._.js","server/chunks/ssr/features_bot_components_thread-setting_tsx_0yae7zy._.js"].map(b=>a.l(b))).then(()=>b(82951)))},228887,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_02uubus._.js","server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js"].map(b=>a.l(b))).then(()=>b(405593)))},930209,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1whffg_._.js","server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js"].map(b=>a.l(b))).then(()=>b(26444)))},277297,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1tih-7v._.js","server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js"].map(b=>a.l(b))).then(()=>b(857022)))},553433,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0kzgugm._.js","server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js"].map(b=>a.l(b))).then(()=>b(41014)))},15022,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1neoj22._.js"].map(b=>a.l(b))).then(()=>b(109788)))},479648,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1scosxl._.js","server/chunks/ssr/features_skills_components_skills-setting_tsx_1wtuuip._.js"].map(b=>a.l(b))).then(()=>b(703228)))},372511,a=>{a.v(b=>Promise.all(["server/chunks/ssr/features_thursday_components_here-globe_tsx_055duhw._.js"].map(b=>a.l(b))).then(()=>b(307181)))},502073,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1j5ohq5._.js","server/chunks/ssr/features_thursday_components_thursday-setting_tsx_1_6ydrc._.js"].map(b=>a.l(b))).then(()=>b(922056)))},895186,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_0lqzdd0._.js"].map(b=>a.l(b))).then(()=>b(901729)))},72597,a=>{a.v(a=>Promise.resolve().then(()=>a(809750)))},628472,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_@vercel_oidc_dist_token_1mnivwk.js"].map(b=>a.l(b))).then(()=>b(779476)))},715837,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]_node_readline_1u65a-m._.js","server/chunks/ssr/node_modules_consola_dist_chunks_prompt_mjs_05cwqv2._.js"].map(b=>a.l(b))).then(()=>b(270101)))}];
2
2
 
3
- //# sourceMappingURL=_1nnl9sj._.js.map
3
+ //# sourceMappingURL=_0rm-9aj._.js.map
@@ -1,5 +1,5 @@
1
1
  module.exports=[61514,a=>a.a(async(b,c)=>{try{var d=a.i(868468),e=a.i(569572),f=a.i(344853),g=a.i(706210),h=a.i(182248),i=b([f]);async function j(){let a=await (0,f.listThreadOverview)();if(!a.length)return null;let b=a.map(a=>{let b=(0,d.formatDistanceToNowStrict)((0,g.toDate)(a.updatedAt),{addSuffix:!0}),c=a.room.questions[0],f="waiting"===a.status&&c?`waiting on the user since ${b} — ${c.bot} asked: ${(0,h.clip)(c.text,e.PROMPT_LINE.jobOutcome)}`:"waiting"===a.status?`stopped ${b}, not finished`:"running"===a.status?`running, last moved ${b}`:`${a.status} ${b}`;return`- "${a.label}" (${a.id}) — ${a.bot} — ${f}`});return`[The threads as this call opened, open work first. They move while you talk.]
2
- ${b.join("\n")}`}[f]=i.then?(await i)():i,a.s(["loadCallStanding",0,j]),c()}catch(a){c(a)}},!1),614747,a=>a.a(async(b,c)=>{try{var d=a.i(569572),e=a.i(884780),f=a.i(762008),g=a.i(221214),h=a.i(446957),i=a.i(344853),j=a.i(986743),k=a.i(661210),l=a.i(138100),m=a.i(569549),n=a.i(821415),o=a.i(644468),p=a.i(269353),q=a.i(938934),r=b([g,i,j,l,m,o]);async function s(a){var b,c,r,s,u,w,x,y;let z,{backendPrompt:A,written:B=!1,phone:C=!1,readSkills:D}=a,E=await (0,n.openWorkspace)(),[F,G,H,I,J,K,L]=await Promise.all([(0,l.loadSkills)(E),(0,j.listNoteIndex)(),(0,j.readNotes)(k.MEMORY_ALWAYS_LISTED,{touch:!1}),(0,o.listConnectedToolNames)(),(0,g.listJobBots)(),(0,m.listRecentTurns)(d.RECENT_CALL.rows,a.callId),(0,g.readBotMemoryOn)()]),M=await (0,i.listCallJobs)(K.map(a=>a.callId)),N=[(0,q.thursdayIdentity)(new Date,a.where),B?(0,p.personaLines)(a.persona):"",B?(0,q.styleLines)(a.stylePrompt):"",t(G,H.notes),(b=J,c=(0,q.reachNames)(D?[]:F,I),r=L,s=C,0===b.length?"":`## Background work
2
+ ${b.join("\n")}`}[f]=i.then?(await i)():i,a.s(["loadCallStanding",0,j]),c()}catch(a){c(a)}},!1),614747,a=>a.a(async(b,c)=>{try{var d=a.i(569572),e=a.i(884780),f=a.i(762008),g=a.i(221214),h=a.i(446957),i=a.i(344853),j=a.i(986743),k=a.i(661210),l=a.i(138100),m=a.i(569549),n=a.i(821415),o=a.i(644468),p=a.i(269353),q=a.i(938934),r=b([g,i,j,l,m,n,o]);async function s(a){var b,c,r,s,u,w,x,y;let z,{backendPrompt:A,written:B=!1,phone:C=!1,readSkills:D}=a,E=await (0,n.openWorkspace)(),[F,G,H,I,J,K,L]=await Promise.all([(0,l.loadSkills)(E),(0,j.listNoteIndex)(),(0,j.readNotes)(k.MEMORY_ALWAYS_LISTED,{touch:!1}),(0,o.listConnectedToolNames)(),(0,g.listJobBots)(),(0,m.listRecentTurns)(d.RECENT_CALL.rows,a.callId),(0,g.readBotMemoryOn)()]),M=await (0,i.listCallJobs)(K.map(a=>a.callId)),N=[(0,q.thursdayIdentity)(new Date,a.where),B?(0,p.personaLines)(a.persona):"",B?(0,q.styleLines)(a.stylePrompt):"",t(G,H.notes),(b=J,c=(0,q.reachNames)(D?[]:F,I),r=L,s=C,0===b.length?"":`## Background work
3
3
 
4
4
  Who you hand work to — the names \`${f.TOOL_NAMES.thread_start}\` takes.
5
5
 
@@ -9,7 +9,9 @@ What bots can reach for: ${c}.`:""}
9
9
 
10
10
  **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.${r?" 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.":""}
11
11
 
12
- **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 (\`${f.TOOL_NAMES.thread_tell}\`); only a request that stands on its own starts a new one (\`${f.TOOL_NAMES.thread_start}\`). The threads open as this call started come into the conversation at the start, and they move while you talk: \`${f.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. When something the work needs is still missing, either ask the user yourself before handing it over or let the bot ask them — never both.
12
+ **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 (\`${f.TOOL_NAMES.thread_tell}\`); only a request that stands on its own starts a new one (\`${f.TOOL_NAMES.thread_start}\`). The threads open as this call started come into the conversation at the start, and they move while you talk: \`${f.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.
13
+
14
+ **Ask before you start a thread.** Propose it first, even when they named the bot — which bot, and the request in a sentence — with what it needs from them that they have not said, and start it only on their yes to that proposal: a reply that goes on talking about the work is not a yes. Their answers go in the request, so the bot does not ask them again.
13
15
 
14
16
  **Work that should start by itself — every morning, every few hours — is a routine.** \`${f.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.
15
17
 
@@ -34,7 +36,7 @@ What was said on the last calls, verbatim, newest last. It is the past: pick it
34
36
 
35
37
  A \`${f.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.
36
38
 
37
- ${(0,q.recentCallLines)(x.map(a=>({...a,jobs:y.filter(b=>b.callId===a.callId)})),d.RECENT_CALL.tokens)}`:""),v(A)].filter(Boolean).join("\n\n");return(0,q.logPromptSize)("thursday",N),N}[g,i,j,l,m,o]=r.then?(await r)():r;let v=a=>a?.trim()?`## Additional instructions
39
+ ${(0,q.recentCallLines)(x.map(a=>({...a,jobs:y.filter(b=>b.callId===a.callId)})),d.RECENT_CALL.tokens)}`:""),v(A)].filter(Boolean).join("\n\n");return(0,q.logPromptSize)("thursday",N),N}[g,i,j,l,m,n,o]=r.then?(await r)():r;let v=a=>a?.trim()?`## Additional instructions
38
40
 
39
41
  Written by the user. Follow them together with everything above.
40
42
 
@@ -55,23 +57,23 @@ ${m}What tells you most about them comes first: what they loved or could not sta
55
57
  **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 and its line: give something new its own path below, and when a line no longer says what its note is about, \`${f.TOOL_NAMES.memory_describe}\` puts it right.
56
58
 
57
59
  ${k.MEMORY_PATHS.map(a=>`- ${a.path} — ${a.of}`).join("\n")}`;return[j,l,n].join("\n\n")}function u(a){let b=a.facts.map(a=>`- ${a.text} #${a.id}`);return`${a.path} — ${a.description}
58
- ${b.length?b.join("\n"):"- (nothing yet)"}`}a.s(["loadThursdayPrompt",0,s,"memoryChapter",0,t]),c()}catch(a){c(a)}},!1),225310,a=>{"use strict";var b=a.i(912714),c=a.i(660526),d=a.i(750227),e=a.i(569572),f=a.i(684321),g=a.i(821415),h=a.i(176668),i=a.i(182248);let j=(0,d.join)(e.APP_DIR,e.PATHS.skills.default,"artifact","runtime","render.mjs"),k={viewport:{width:412,height:839},deviceScaleFactor:2},l=(0,i.PromiseChain)(),m=a=>["html","htm"].includes((0,f.extensionOf)(a));async function n(a){let c=await (0,b.open)(a);try{let a=Buffer.alloc(4096),{bytesRead:b}=await c.read(a,0,a.length,0),d=/<meta name="print" content="pdf(?: (\d+x\d+))?">/.exec(a.subarray(0,b).toString("utf8"));return d?{size:d[1]??""}:null}finally{await c.close()}}async function o(a,f,{failed:h,take:i}){let l=await (0,b.mkdtemp)((0,d.join)((0,c.tmpdir)(),"thursday-pictures-")),m=(0,d.join)(l,"browser.json");await (0,b.writeFile)(m,JSON.stringify({browser:{contextOptions:k}}));let n={PLAYWRIGHT_CLI_SESSION:"reach-pictures",PLAYWRIGHT_MCP_BROWSER:"chromium",PLAYWRIGHT_MCP_ISOLATED:"true",PLAYWRIGHT_MCP_CONFIG:m,RENDER:j,PAGE:a,OUT:l,NAME:(0,d.basename)(a,(0,d.extname)(a))},p=await (0,g.openWorkspace)();try{let a=await p.exec(`node "$RENDER" "$PAGE" --shot ${f}`,{env:n,timeoutMs:e.REACH.drawMs});if(0!==a.exitCode)throw Error(a.stderr.trim().split("\n").at(-1)||h);return await i(l)}finally{await p.exec("playwright-cli close",{env:n,timeoutMs:15e3}).catch(()=>{}),await (0,b.rm)(l,{recursive:!0,force:!0})}}a.s(["pdfOf",0,function(a){return m(a)?l(async()=>{let c=await n(a);if(!c)return null;let e=c.size?` --size ${c.size}`:"";return o(a,`--pdf "$OUT/$NAME.pdf"${e}`,{failed:"not printed",take:async c=>({bytes:await (0,b.readFile)((0,d.join)(c,`${(0,d.basename)(a,(0,d.extname)(a))}.pdf`)),name:`${(0,d.basename)(a,(0,d.extname)(a))}.pdf`,picture:!1})})}).catch(b=>(h.logger.warn(`reach: no PDF of ${(0,d.basename)(a)}`,b),null)):Promise.resolve(null)},"picturesOf",0,function(a){return m(a)?l(()=>o(a,`--out "$OUT" --name "$NAME" --most ${e.REACH.pictures}`,{failed:"no pictures",take:async a=>Promise.all((await (0,b.readdir)(a)).filter(a=>a.endsWith(".png")).sort().map(async c=>({bytes:await (0,b.readFile)((0,d.join)(a,c)),name:c,picture:!0})))})).catch(b=>(h.logger.warn(`reach: no pictures of ${(0,d.basename)(a)}`,b),[])):Promise.resolve([])}])},129167,a=>{"use strict";var b=a.i(936292),c=a.i(465584),d=a.i(242104);let e="https://slack.com/api",f=new Set(["invalid_auth","not_authed","account_inactive","token_revoked","not_allowed_token_type","missing_scope"]);a.s(["createSlack",0,function(a,g){async function h(c,d,i=g){for(let g=0;;g++){let h=await fetch(`${e}/${c}`,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json; charset=utf-8"},body:JSON.stringify(d)}).catch(a=>{throw Error(`Could not reach ${new URL(e).host}`,{cause:a})}),j=h.headers.get("retry-after");if(429===h.status&&await (0,b.waitOut)(null===j?null:Number(j),g))continue;let k=await h.json().catch(()=>null);if(k?.ok)return k;let l=k?.error??`http_${h.status}`;if(!f.has(l))throw Error(`Slack answered ${l} to ${c}`);let m=i===a,n=k?.needed??"a scope";throw new b.ChannelRefusal("missing_scope"===l?m?`Slack says this app-level token lacks ${n} — generate one with it under Basic Information › App-Level Tokens and paste it here.`:`Slack says the app lacks a permission (${n}) — make it from the manifest in the guide.`:m?`Slack turned the app-level token away (${l}). Generate a new one under Basic Information › App-Level Tokens and paste it here.`:`Slack turned the bot token away (${l}). Copy the Bot User OAuth Token again from Install App and paste it here.`,+!m)}}let i=new Map;async function j(a){let b=i.get(a);if(b)return b;let c=await h("users.info",{user:a}).then(b=>({name:b.user?.real_name||b.user?.name||a,handle:b.user?.name?`@${b.user.name}`:null})).catch(()=>({name:a,handle:null}));return i.set(a,c),c}async function k(a,b){if("events_api"===a){let a=b.event??{},c=!a.subtype||"file_share"===a.subtype;if("message"!==a.type||"im"!==a.channel_type||!c||a.bot_id||!a.user||!a.channel)return null;let d=await j(a.user);return{kind:"message",chat:a.channel,name:d.name,handle:d.handle,words:(a.text??"").trim(),files:(a.files??[]).flatMap(a=>{let b=a.url_private_download;if(!b)return[];let c=a.name??"file";return[{name:c,size:a.size,fetch:async()=>{let d=await fetch(b,{headers:{authorization:`Bearer ${g}`}});if(!d.ok)throw Error(`Slack answered ${d.status} for the file`);return new File([await d.arrayBuffer()],c,{type:a.mimetype??""})}}]}),unreadable:!1}}return"interactive"===a&&"block_actions"===b.type?b.channel?.id?{kind:"press",chat:b.channel.id,data:b.actions?.[0]?.value??"",under:b.message?.ts&&b.message.text?{id:b.message.ts,text:b.message.text}:null}:null:null}return{limits:{take:1/0,file:0x40000000,picture:0x40000000},async listen(b,c){let e=await h("auth.test",{}),{url:f}=await h("apps.connections.open",{},a);b.ready(e.user?`@${e.user}`:"the app",null,e.bot_id??e.user_id??"");let g=await (0,d.runSocket)(f,{message(a,c){let{type:d,envelope_id:e,payload:f}=a;e&&c({envelope_id:e}),d&&f&&k(d,f).then(a=>{a&&b.incoming(a)})}},c);if(!c.aborted)throw Error(`Slack closed the connection (${g.code})`)},async say(a,b,d){let e=(0,c.chatPieces)(b,"slack",2900);for(let[b,c]of e.entries()){let f=d?.length&&b===e.length-1;await h("chat.postMessage",{channel:a,text:c,unfurl_links:!1,unfurl_media:!1,...f?{blocks:[{type:"section",text:{type:"mrkdwn",text:c}},{type:"actions",elements:d.slice(0,25).map((a,b)=>({type:"button",action_id:`choice_${b}`,text:{type:"plain_text",text:a.text.slice(0,75)},value:a.data}))}]}:{}})}},async typing(){},async settle(a,b,d){let e=`
60
+ ${b.length?b.join("\n"):"- (nothing yet)"}`}a.s(["loadThursdayPrompt",0,s,"memoryChapter",0,t]),c()}catch(a){c(a)}},!1),225310,a=>a.a(async(b,c)=>{try{var d=a.i(912714),e=a.i(660526),f=a.i(750227),g=a.i(569572),h=a.i(684321),i=a.i(821415),j=a.i(176668),k=a.i(182248),l=b([i]);[i]=l.then?(await l)():l;let o=(0,f.join)(g.APP_DIR,g.PATHS.skills.default,"artifact","runtime","render.mjs"),p={viewport:{width:412,height:839},deviceScaleFactor:2},q=(0,k.PromiseChain)(),r=a=>["html","htm"].includes((0,h.extensionOf)(a));async function m(a){let b=await (0,d.open)(a);try{let a=Buffer.alloc(4096),{bytesRead:c}=await b.read(a,0,a.length,0),d=/<meta name="print" content="pdf(?: (\d+x\d+))?">/.exec(a.subarray(0,c).toString("utf8"));return d?{size:d[1]??""}:null}finally{await b.close()}}async function n(a,b,{failed:c,take:h}){let j=await (0,d.mkdtemp)((0,f.join)((0,e.tmpdir)(),"thursday-pictures-")),k=(0,f.join)(j,"browser.json");await (0,d.writeFile)(k,JSON.stringify({browser:{contextOptions:p}}));let l={PLAYWRIGHT_CLI_SESSION:"reach-pictures",PLAYWRIGHT_MCP_BROWSER:"chromium",PLAYWRIGHT_MCP_ISOLATED:"true",PLAYWRIGHT_MCP_CONFIG:k,RENDER:o,PAGE:a,OUT:j,NAME:(0,f.basename)(a,(0,f.extname)(a))},m=await (0,i.openWorkspace)();try{let a=await m.exec(`node "$RENDER" "$PAGE" --shot ${b}`,{env:l,timeoutMs:g.REACH.drawMs});if(0!==a.exitCode)throw Error(a.stderr.trim().split("\n").at(-1)||c);return await h(j)}finally{await m.exec("playwright-cli close",{env:l,timeoutMs:15e3}).catch(()=>{}),await (0,d.rm)(j,{recursive:!0,force:!0})}}a.s(["pdfOf",0,function(a){return r(a)?q(async()=>{let b=await m(a);if(!b)return null;let c=b.size?` --size ${b.size}`:"";return n(a,`--pdf "$OUT/$NAME.pdf"${c}`,{failed:"not printed",take:async b=>({bytes:await (0,d.readFile)((0,f.join)(b,`${(0,f.basename)(a,(0,f.extname)(a))}.pdf`)),name:`${(0,f.basename)(a,(0,f.extname)(a))}.pdf`,picture:!1})})}).catch(b=>(j.logger.warn(`reach: no PDF of ${(0,f.basename)(a)}`,b),null)):Promise.resolve(null)},"picturesOf",0,function(a){return r(a)?q(()=>n(a,`--out "$OUT" --name "$NAME" --most ${g.REACH.pictures}`,{failed:"no pictures",take:async a=>{let b=(await (0,d.readdir)(a)).filter(a=>a.endsWith(".png")).sort();return Promise.all(b.map(async b=>({bytes:await (0,d.readFile)((0,f.join)(a,b)),name:b,picture:!0})))}})).catch(b=>(j.logger.warn(`reach: no pictures of ${(0,f.basename)(a)}`,b),[])):Promise.resolve([])}]),c()}catch(a){c(a)}},!1),129167,a=>{"use strict";var b=a.i(936292),c=a.i(465584),d=a.i(242104);let e="https://slack.com/api",f=new Set(["invalid_auth","not_authed","account_inactive","token_revoked","not_allowed_token_type","missing_scope"]);a.s(["createSlack",0,function(a,g){async function h(c,d,i=g){for(let g=0;;g++){let h=await fetch(`${e}/${c}`,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json; charset=utf-8"},body:JSON.stringify(d)}).catch(a=>{throw Error(`Could not reach ${new URL(e).host}`,{cause:a})}),j=h.headers.get("retry-after");if(429===h.status&&await (0,b.waitOut)(null===j?null:Number(j),g))continue;let k=await h.json().catch(()=>null);if(k?.ok)return k;let l=k?.error??`http_${h.status}`;if(!f.has(l))throw Error(`Slack answered ${l} to ${c}`);let m=i===a,n=k?.needed??"a scope";throw new b.ChannelRefusal("missing_scope"===l?m?`Slack says this app-level token lacks ${n} — generate one with it under Basic Information › App-Level Tokens and paste it here.`:`Slack says the app lacks a permission (${n}) — make it from the manifest in the guide.`:m?`Slack turned the app-level token away (${l}). Generate a new one under Basic Information › App-Level Tokens and paste it here.`:`Slack turned the bot token away (${l}). Copy the Bot User OAuth Token again from Install App and paste it here.`,+!m)}}let i=new Map;async function j(a){let b=i.get(a);if(b)return b;let c=await h("users.info",{user:a}).then(b=>({name:b.user?.real_name||b.user?.name||a,handle:b.user?.name?`@${b.user.name}`:null})).catch(()=>({name:a,handle:null}));return i.set(a,c),c}async function k(a,b){if("events_api"===a){let a=b.event??{},c=!a.subtype||"file_share"===a.subtype;if("message"!==a.type||"im"!==a.channel_type||!c||a.bot_id||!a.user||!a.channel)return null;let d=await j(a.user);return{kind:"message",chat:a.channel,name:d.name,handle:d.handle,words:(a.text??"").trim(),files:(a.files??[]).flatMap(a=>{let b=a.url_private_download;if(!b)return[];let c=a.name??"file";return[{name:c,size:a.size,fetch:async()=>{let d=await fetch(b,{headers:{authorization:`Bearer ${g}`}});if(!d.ok)throw Error(`Slack answered ${d.status} for the file`);return new File([await d.arrayBuffer()],c,{type:a.mimetype??""})}}]}),voice:null,unreadable:!1}}return"interactive"===a&&"block_actions"===b.type?b.channel?.id?{kind:"press",chat:b.channel.id,data:b.actions?.[0]?.value??"",under:b.message?.ts&&b.message.text?{id:b.message.ts,text:b.message.text}:null}:null:null}return{limits:{take:1/0,file:0x40000000,picture:0x40000000},async listen(b,c){let e=await h("auth.test",{}),{url:f}=await h("apps.connections.open",{},a);b.ready(e.user?`@${e.user}`:"the app",null,e.bot_id??e.user_id??"");let g=await (0,d.runSocket)(f,{message(a,c){let{type:d,envelope_id:e,payload:f}=a;e&&c({envelope_id:e}),d&&f&&k(d,f).then(a=>{a&&b.incoming(a)})}},c);if(!c.aborted)throw Error(`Slack closed the connection (${g.code})`)},async say(a,b,d){let e=(0,c.chatPieces)(b,"slack",2900);for(let[b,c]of e.entries()){let f=d?.length&&b===e.length-1;await h("chat.postMessage",{channel:a,text:c,unfurl_links:!1,unfurl_media:!1,...f?{blocks:[{type:"section",text:{type:"mrkdwn",text:c}},{type:"actions",elements:d.slice(0,25).map((a,b)=>({type:"button",action_id:`choice_${b}`,text:{type:"plain_text",text:a.text.slice(0,75)},value:a.data}))}]}:{}})}},async typing(){},async settle(a,b,d){let e=`
59
61
 
60
- → ${(0,c.chatPieces)({plain:d},"slack",2900)[0]}`;await h("chat.update",{channel:a,ts:b.id,text:`${b.text.slice(0,2900-e.length)}${e}`,blocks:[]}).catch(()=>{})},async sendFiles(a,b){let c=[];for(let{bytes:a,name:d}of b){let b=new URLSearchParams({filename:d,length:String(a.byteLength)}),f=await fetch(`${e}/files.getUploadURLExternal`,{method:"POST",headers:{authorization:`Bearer ${g}`},body:b}),h=await f.json();if(!h.ok||!h.upload_url||!h.file_id)throw Error(`Slack answered ${h.error??f.status} to the upload`);let i=await fetch(h.upload_url,{method:"POST",body:new Blob([a])});if(!i.ok)throw Error(`Slack answered ${i.status} to the upload`);c.push({id:h.file_id,title:d})}c.length&&await h("files.completeUploadExternal",{files:c,channel_id:a})}}}])},319261,a=>{"use strict";var b=a.i(569572),c=a.i(936292),d=a.i(465584);let e="https://api.telegram.org",f={take:0x1400000,file:0x3200000,picture:0xa00000};class g extends Error{status;constructor(a,b){super(a),this.status=b}}a.s(["createTelegram",0,function(a){async function h(b,d,f){let h=d instanceof FormData;for(let i=0;;i++){let j=await fetch(`${e}/bot${a}/${b}`,{method:"POST",signal:f,...h?{body:d}:{headers:{"content-type":"application/json"},body:JSON.stringify(d??{})}}).catch(a=>{throw Error(`Could not reach ${new URL(e).host}`,{cause:a})}),k=await j.json().catch(()=>null);if(k?.ok)return k.result;if(429===j.status&&await (0,c.waitOut)(k?.parameters?.retry_after,i))continue;let l=k?.description??`Telegram answered ${j.status}`;if(401===j.status)throw new c.ChannelRefusal(`Telegram said “${l}”: this token was revoked or mistyped. Get it again from @BotFather and paste it here.`);throw new g(l,j.status)}}async function i(b,c,d){let{file_path:f}=await h("getFile",{file_id:b});if(!f)throw Error("Telegram did not say where the file is");let g=await fetch(`${e}/file/bot${a}/${f}`);if(!g.ok)throw Error(`Telegram answered ${g.status} for the file`);let i=f.includes(".")?f.slice(f.lastIndexOf(".")):"";return new File([await g.arrayBuffer()],c.includes(".")?c:`${c}${i}`,d?{type:d}:void 0)}let j=0;async function k(a,b){let c=new FormData;if(c.set("chat_id",a),1===b.length){c.set("photo",new Blob([b[0].bytes]),b[0].name),await h("sendPhoto",c);return}for(let[a,d]of(c.set("media",JSON.stringify(b.map((a,b)=>({type:"photo",media:`attach://p${b}`})))),b.entries()))c.set(`p${a}`,new Blob([d.bytes]),d.name);await h("sendMediaGroup",c)}return{limits:f,async listen(a,c){let d=await h("getMe",void 0,c);for(a.ready(d.username?`@${d.username}`:d.first_name??"the bot",d.username?`https://t.me/${d.username}`:null,String(d.id));!c.aborted;)for(let d of(await h("getUpdates",{offset:j,timeout:b.REACH.pollSeconds,allowed_updates:["message","callback_query"]},AbortSignal.any([c,AbortSignal.timeout((b.REACH.pollSeconds+15)*1e3)])))){j=d.update_id+1;let b=function(a){let b,c=a.callback_query;if(c)return h("answerCallbackQuery",{callback_query_id:c.id}).catch(()=>{}),{kind:"press",chat:String(c.from.id),data:c.data??"",under:c.message?.text?{id:String(c.message.message_id),text:c.message.text,keep:c.message.entities}:null};let d=a.message;if(!d?.from||"private"!==d.chat.type)return null;let e=d.photo?.at(-1),f=d.document?{id:d.document.file_id,name:d.document.file_name??"file",type:d.document.mime_type,size:d.document.file_size}:e?{id:e.file_id,name:`photo-${d.message_id}`,type:"",size:e.file_size}:null;return{kind:"message",chat:String(d.chat.id),name:(b=d.from,[b?.first_name,b?.last_name].filter(Boolean).join(" ")||(b?.username?`@${b.username}`:"Someone")),handle:d.from.username?`@${d.from.username}`:null,words:(d.text??d.caption??"").trim(),files:f?[{name:f.name,size:f.size,fetch:()=>i(f.id,f.name,f.type)}]:[],unreadable:!!(d.voice||d.audio||d.video)}}(d);b&&a.incoming(b)}},async say(a,b,c){let e=(0,d.chatPieces)(b,"telegram",4e3);for(let[b,d]of e.entries())await h("sendMessage",{chat_id:a,text:d,parse_mode:"HTML",link_preview_options:{is_disabled:!0},...c?.length&&b===e.length-1?{reply_markup:{inline_keyboard:c.map(a=>[{text:a.text,callback_data:a.data}])}}:{}})},async typing(a){await h("sendChatAction",{chat_id:a,action:"typing"}).catch(()=>{})},async settle(a,b,c){await h("editMessageText",{chat_id:a,message_id:Number(b.id),text:`${b.text}
62
+ → ${(0,c.chatPieces)({plain:d},"slack",2900)[0]}`;await h("chat.update",{channel:a,ts:b.id,text:`${b.text.slice(0,2900-e.length)}${e}`,blocks:[]}).catch(()=>{})},async sendFiles(a,b){let c=[];for(let{bytes:a,name:d}of b){let b=new URLSearchParams({filename:d,length:String(a.byteLength)}),f=await fetch(`${e}/files.getUploadURLExternal`,{method:"POST",headers:{authorization:`Bearer ${g}`},body:b}),h=await f.json();if(!h.ok||!h.upload_url||!h.file_id)throw Error(`Slack answered ${h.error??f.status} to the upload`);let i=await fetch(h.upload_url,{method:"POST",body:new Blob([a])});if(!i.ok)throw Error(`Slack answered ${i.status} to the upload`);c.push({id:h.file_id,title:d})}c.length&&await h("files.completeUploadExternal",{files:c,channel_id:a})}}}])},319261,a=>{"use strict";var b=a.i(569572),c=a.i(936292),d=a.i(465584);let e="https://api.telegram.org",f={take:0x1400000,file:0x3200000,picture:0xa00000};class g extends Error{status;constructor(a,b){super(a),this.status=b}}a.s(["createTelegram",0,function(a){async function h(b,d,f){let h=d instanceof FormData;for(let i=0;;i++){let j=await fetch(`${e}/bot${a}/${b}`,{method:"POST",signal:f,...h?{body:d}:{headers:{"content-type":"application/json"},body:JSON.stringify(d??{})}}).catch(a=>{throw Error(`Could not reach ${new URL(e).host}`,{cause:a})}),k=await j.json().catch(()=>null);if(k?.ok)return k.result;if(429===j.status&&await (0,c.waitOut)(k?.parameters?.retry_after,i))continue;let l=k?.description??`Telegram answered ${j.status}`;if(401===j.status)throw new c.ChannelRefusal(`Telegram said “${l}”: this token was revoked or mistyped. Get it again from @BotFather and paste it here.`);throw new g(l,j.status)}}async function i(b,c,d){let{file_path:f}=await h("getFile",{file_id:b});if(!f)throw Error("Telegram did not say where the file is");let g=await fetch(`${e}/file/bot${a}/${f}`);if(!g.ok)throw Error(`Telegram answered ${g.status} for the file`);let i=f.includes(".")?f.slice(f.lastIndexOf(".")):"";return new File([await g.arrayBuffer()],c.includes(".")?c:`${c}${i}`,d?{type:d}:void 0)}let j=0;async function k(a,b){let c=new FormData;if(c.set("chat_id",a),1===b.length){c.set("photo",new Blob([b[0].bytes]),b[0].name),await h("sendPhoto",c);return}for(let[a,d]of(c.set("media",JSON.stringify(b.map((a,b)=>({type:"photo",media:`attach://p${b}`})))),b.entries()))c.set(`p${a}`,new Blob([d.bytes]),d.name);await h("sendMediaGroup",c)}return{limits:f,async listen(a,c){let d=await h("getMe",void 0,c);for(a.ready(d.username?`@${d.username}`:d.first_name??"the bot",d.username?`https://t.me/${d.username}`:null,String(d.id));!c.aborted;)for(let d of(await h("getUpdates",{offset:j,timeout:b.REACH.pollSeconds,allowed_updates:["message","callback_query"]},AbortSignal.any([c,AbortSignal.timeout((b.REACH.pollSeconds+15)*1e3)])))){j=d.update_id+1;let b=function(a){let b,c=a.callback_query;if(c)return h("answerCallbackQuery",{callback_query_id:c.id}).catch(()=>{}),{kind:"press",chat:String(c.from.id),data:c.data??"",under:c.message?.text?{id:String(c.message.message_id),text:c.message.text,keep:c.message.entities}:null};let d=a.message;if(!d?.from||"private"!==d.chat.type)return null;let e=d.photo?.at(-1),f=d.voice,g=d.document?{id:d.document.file_id,name:d.document.file_name??"file",type:d.document.mime_type,size:d.document.file_size}:e?{id:e.file_id,name:`photo-${d.message_id}`,type:"",size:e.file_size}:d.audio?{id:d.audio.file_id,name:d.audio.file_name??`audio-${d.message_id}`,type:d.audio.mime_type??"",size:d.audio.file_size}:null;return{kind:"message",chat:String(d.chat.id),name:(b=d.from,[b?.first_name,b?.last_name].filter(Boolean).join(" ")||(b?.username?`@${b.username}`:"Someone")),handle:d.from.username?`@${d.from.username}`:null,words:(d.text??d.caption??"").trim(),files:g?[{name:g.name,size:g.size,fetch:()=>i(g.id,g.name,g.type)}]:[],voice:f?{name:`voice-${d.message_id}.ogg`,size:f.file_size,fetch:()=>i(f.file_id,`voice-${d.message_id}.ogg`,f.mime_type??"audio/ogg")}:null,unreadable:!!d.video}}(d);b&&a.incoming(b)}},async say(a,b,c){let e=(0,d.chatPieces)(b,"telegram",4e3);for(let[b,d]of e.entries())await h("sendMessage",{chat_id:a,text:d,parse_mode:"HTML",link_preview_options:{is_disabled:!0},...c?.length&&b===e.length-1?{reply_markup:{inline_keyboard:c.map(a=>[{text:a.text,callback_data:a.data}])}}:{}})},async typing(a){await h("sendChatAction",{chat_id:a,action:"typing"}).catch(()=>{})},async settle(a,b,c){await h("editMessageText",{chat_id:a,message_id:Number(b.id),text:`${b.text}
61
63
 
62
- → ${c}`,entities:b.keep,link_preview_options:{is_disabled:!0}}).catch(()=>{})},async sendFiles(a,b){let c=b.filter(a=>a.picture),d=b.filter(a=>!a.picture);for(let b=0;b<c.length;b+=10){let e=c.slice(b,b+10);await k(a,e).catch(a=>{if(!(a instanceof g&&400===a.status))throw a;d.unshift(...e)})}for(let b of d){let c=new FormData;c.set("chat_id",a),c.set("document",new Blob([b.bytes]),b.name),await h("sendDocument",c)}}}}])},233398,a=>a.a(async(b,c)=>{try{var d=a.i(666680),e=a.i(912714),f=a.i(203469),g=a.i(569572),h=a.i(875931),i=a.i(938934),j=a.i(346580),k=a.i(674986),l=a.i(839430),m=a.i(344853),n=a.i(725466),o=a.i(92706),p=a.i(569549),q=a.i(143699),r=a.i(626550),s=a.i(684321),t=a.i(821415),u=a.i(941981),v=a.i(706210),w=a.i(176668),x=a.i(293480),y=a.i(936292),z=a.i(465584),A=a.i(479286),B=a.i(773351),C=a.i(225310),D=a.i(558067),E=a.i(129167),F=a.i(319261),G=b([h,k,l,m,n,p,q,u,B]);[h,k,l,m,n,p,q,u,B]=G.then?(await G)():G;let ak={telegram:a=>(0,F.createTelegram)(a),discord:a=>(0,A.createDiscord)(a),slack:(a,b)=>(0,E.createSlack)(a,b),email:(a,b,c,d)=>(0,B.createEmail)(a,b,c,d)},al=globalThis,am=al.__reach??={live:new Map,last:null,told:new Map,choices:new Map,listening:null,gone:null,looking:null,idle:null},an=()=>f.appEvents.emit({type:"reach"});async function H(a){return await am.live.get(a)?.settled,I(a)}async function I(a){let b=await (0,n.readConfig)((0,D.reachPersonKey)(a));if(!b)return null;try{let a=JSON.parse(b);return"string"==typeof a.chat&&"string"==typeof a.name?{chat:a.chat,name:a.name,bot:"string"==typeof a.bot?a.bot:null}:null}catch{return null}}let ao=(a,b)=>(0,n.writeConfig)((0,D.reachPersonKey)(a),JSON.stringify(b));async function J(a){for(let b of a?[a]:D.REACH_CHANNELS){let c=am.live.get(b);if(c?.stop.abort(),am.live.delete(b),a&&c?.line&&await (0,p.endCall)(c.line.callId).catch(()=>{}),(await Promise.all(D.REACH_KEYS[b].map(n.configState))).includes("unreadable"))continue;let d=await Promise.all(D.REACH_KEYS[b].map(n.readConfig));if(!d.every(a=>!!a)){a&&await (0,n.removeConfig)((0,D.reachPersonKey)(b));continue}let e=a&&c?.id?await I(b):null;e&&null===e.bot&&c?.id&&await ao(b,{...e,bot:c.id});let f={name:b,channel:ak[b](...d),stop:new AbortController,bot:null,link:null,problem:null,holding:null,refused:null,id:null,adopt:!a,settled:Promise.resolve(),asking:null,held:[],line:null,calls:new Set,busy:!1,notes:[]};am.live.set(b,f),K(f)}am.live.size&&(am.listening??=f.appEvents.subscribe(a=>{"threads"===a.type&&ad()}),am.gone??=f.presence.onGone(ag),ad(),am.idle??=setInterval(()=>{U().catch(a=>w.logger.error("reach: idle lines",a))},g.REACH.idleMs).unref()),an()}async function K(a){let{signal:b}=a.stop,c=b=>{a.problem!==b&&(a.problem=b,an())};for(;!b.aborted;){try{await a.channel.listen({ready:(b,c,d)=>{a.bot=b,a.link=c,a.problem=null,a.holding=null,a.id=d,a.settled=L(a,d).catch(b=>w.logger.error(`reach ${a.name}: who is let in`,b)),an()},incoming:b=>void M(a,b).catch(b=>w.logger.error(`reach ${a.name}: what arrived`,b)),holding:b=>{a.holding!==b&&(a.holding=b,an())},wanted:async b=>!a.channel.named||(await H(a.name))?.chat===b},b)}catch(e){if(b.aborted)return;let d=e instanceof Error?e.message:String(e);if(e instanceof y.ChannelRefusal){w.logger.warn(`reach ${a.name}: ${d}`);let b=D.REACH_KEYS[a.name];return a.refused=b[e.token]??b[0],a.problem=d,an()}c(d)}await new Promise(a=>setTimeout(a,g.REACH.retryMs))}}async function L(a,b){let c=await I(a.name);if(c&&c.bot!==b){if(null===c.bot&&a.adopt)return ao(a.name,{...c,bot:b});await (0,n.removeConfig)((0,D.reachPersonKey)(a.name)),an()}}async function M(a,b){let c=await H(a.name);if("message"===b.kind&&void 0!==b.unproven){c?.chat===b.chat&&await a.channel.say(b.chat,{plain:b.unproven});return}if("press"===b.kind){if(c?.chat!==b.chat)return;return aj(a,c,b.data,b.under)}return c?.chat===b.chat?O(a,c,b):a.channel.named?void 0:c?a.channel.say(b.chat,{plain:"This Thursday already answers someone else."}):N(a,b)}async function N(a,b){if(a.asking&&a.asking.chat!==b.chat)return a.channel.say(b.chat,{plain:"Someone else is already waiting to be let in here. If that is not you, press Not them on the computer, then write again."});a.held.length<g.REACH.held&&a.held.push(b),a.asking||(a.asking={chat:b.chat,name:b.name,handle:b.handle,said:b.words,code:(0,d.randomInt)(10**g.REACH.codeDigits).toString().padStart(g.REACH.codeDigits,"0")},an(),await a.channel.say(b.chat,{plain:`Almost there. Thursday is asking on your computer whether to let you in. Press Allow there only if it shows ${a.asking.code}, and she answers what you wrote.`}))}async function O(a,b,c){let d=await P(a,c);d&&X(a,b,d)}async function P(a,b){let{channel:c}=a;am.last=a.name;let{kept:d,lost:e}=await Q(a,b.files);e.length&&await c.say(b.chat,{plain:e.map(({name:a,why:b})=>`${a} did not come through: ${b}.`).join("\n")}).catch(b=>w.logger.warn(`reach ${a.name}: could not say so`,b));let f=[b.words,...d].filter(Boolean).join("\n");return f?(e.length&&a.notes.push({text:`[Sent from their phone with what follows, and lost on the way: ${e.map(({name:a,why:b})=>`${a} (${b})`).join("; ")}. They have been told.]`,said:!1}),{words:f,pictures:d.filter(s.isPicture)}):(b.unreadable&&!e.length&&await c.say(b.chat,{plain:"I can read words, pictures and files here — not voice or video yet. Write it instead."}),null)}async function Q(a,b){let c=Math.min(a.channel.limits.take,g.REACH.fileBytes),d=[],e=b.filter(b=>!b.size||b.size<=c||(d.push({name:b.name,why:`it is ${aq(b.size)}, and the most taken from ${D.REACH_LABEL[a.name]} is ${aq(c)}`}),!1)),f=await Promise.allSettled(e.map(a=>a.fetch())),h=[];for(let[a,b]of f.entries())"fulfilled"===b.status?h.push(b.value):d.push({name:e[a].name,why:ap(b.reason)});if(!h.length)return{kept:[],lost:d};try{return{kept:await (0,u.keepGivenFiles)(h),lost:d}}catch(b){let a=ap(b);return{kept:[],lost:[...d,...h.map(b=>({name:b.name,why:a}))]}}}let ap=a=>a instanceof Error?a.message:String(a),aq=a=>`${Math.ceil(a/1048576)} MB`;async function R(a,b,c){let d=am.live.get(a),e=ar(d,b,c);if(!d||!e)return;let f={chat:e.chat,name:e.name,bot:d.id};await ao(a,f),d.asking=null,an();let g=d.held.splice(0);await d.channel.say(b,{plain:g.length?"You are in. Thursday answers what you wrote.":"You are in. Write here and Thursday answers."}).catch(b=>w.logger.warn(`reach ${a}: could not say so`,b));let h=[];for(let b of g){let c=await P(d,b).catch(b=>(w.logger.warn(`reach ${a}: what they wrote while waiting`,b),null));c&&h.push(c)}h.length&&X(d,f,{words:h.map(a=>a.words).join("\n"),pictures:h.flatMap(a=>a.pictures)})}let ar=(a,b,c)=>a?.asking?.chat===b&&a.asking.code===c?a.asking:null;async function S(a,b){let c=(await (0,n.readConfig)(D.EMAIL_ADDRESS_KEY))?.toLowerCase();c||(0,x.publicError)("Save her mailbox first.");let d=b.trim().toLowerCase();d===c&&(0,x.publicError)("That is her own address. Name the address you will write to her from.");let e=am.live.get(a);e&&(e.turn?.abort(),e.notes=[],e.calls.clear(),await W(e)),await ao(a,{chat:d,name:b.trim(),bot:c}),an()}async function T(a){await (0,n.removeConfig)((0,D.reachPersonKey)(a));let b=am.live.get(a);b&&(b.turn?.abort(),b.notes=[],b.calls.clear(),await W(b)),an()}async function U(){for(let a of am.live.values())a.line&&!a.busy&&await V(a.line)&&await W(a)}async function V(a){return!(Date.now()-a.lastAt<=g.REACH.idleMs)&&!(await (0,m.listCallJobs)([a.callId])).some(a=>"running"===a.status)}async function W(a){let b=a.line;a.line=null,b&&await (0,p.endCall)(b.callId).catch(()=>{})}function X(a,b,c){a.busy?a.notes.push({text:c.words,said:!0,pictures:c.pictures}):(a.busy=!0,(async()=>{try{for(let d=c;null!==d;){await Y(a,b,d);let c=a.notes.filter(a=>a.said);a.notes=a.notes.filter(a=>!a.said),d=c.length?{words:c.map(a=>a.text).join("\n"),pictures:c.flatMap(a=>a.pictures??[])}:null}}finally{a.busy=!1}})())}async function Y(a,b,{words:c,pictures:d}){let{channel:e}=a;e.typing(b.chat).catch(()=>{});let f=setInterval(()=>void e.typing(b.chat).catch(()=>{}),4e3),i=a.notes.filter(a=>!a.said);a.notes=a.notes.filter(a=>a.said);let k=new AbortController;a.turn=k;let l=()=>k.signal.aborted||a.stop.signal.aborted;try{let f=a.line;(!f||!await (0,p.isCallOpen)(f.callId)||await V(f))&&(await W(a),a.line={...await (0,q.openTextCall)(),messages:[],lastAt:0},a.calls.add(a.line.callId));let h=a.line,m=await (0,q.answerInWriting)({callId:h.callId,standing:h.standing,messages:[...h.messages,...i.map(a=>({role:"user",content:a.text})),{role:"user",content:c}],said:c,pictures:d,notes:()=>a.notes.splice(0),signal:AbortSignal.any([k.signal,a.stop.signal])});if(l())return;h.messages=function(a){let b=Math.max(a.findLastIndex(a=>"user"===a.role),0),c=a.findIndex((a,c)=>c<b&&("tool"===a.role||"assistant"===a.role&&"string"!=typeof a.content)),d=c<0?b:c,e=[...a.slice(0,d),...(0,j.asWords)(a.slice(d,b),(a,b)=>(0,r.toolLine)(a,JSON.stringify(b??{}))??a,a=>a.length>g.REACH.oldChars?`${a.slice(0,g.REACH.oldChars)}…`:a),...a.slice(b)];if(e.length<=g.REACH.messages)return e;let f=e.findIndex((a,b)=>b>=e.length-g.REACH.trimTo&&"user"===a.role);return f>0?e.slice(f):e}(m.messages),h.lastAt=Date.now(),m.moved&&!h.moved&&(h.moved=!0,await e.say(b.chat,{plain:m.moved}));let n=[...new Set(m.did)].join(" · "),o={markdown:m.text?.trim()||(n?`— ${(0,z.literal)(n)}`:"…")};e.attaches?await $(a,b,o,m.text):(await e.say(b.chat,o),await Z(a,b,m.text))}catch(d){if(l())return;a.notes.unshift(...i),a.line&&!a.line.lastAt&&await W(a);let c=(0,x.isPublicError)(d)?d.message:(0,h.modelErrorToString)(d);w.logger.warn(`reach ${a.name}: ${c}`),await e.say(b.chat,{plain:c}).catch(()=>{})}finally{clearInterval(f),a.turn===k&&(a.turn=null)}}async function Z(a,b,c){let{named:d,left:e}=await _(c);for(let c of d)try{let d=await aa(a,c);if(!d)continue;d.files.length&&await a.channel.sendFiles(b.chat,d.files),d.left&&e.push(d.left)}catch(b){w.logger.warn(`reach ${a.name}: could not send ${c}`,b),e.push({name:c,why:ap(b)})}e.length&&(await a.channel.say(b.chat,{plain:as(e)}).catch(b=>w.logger.warn(`reach ${a.name}: could not say so`,b)),ab(a,e))}async function $(a,b,c,d,e){let{named:f,left:h}=await _(d),i=Math.min(a.channel.limits.file,g.REACH.fileBytes),j=[],k=[],l=0;for(let b of f)try{let c=await aa(a,b);if(!c)continue;let d=c.files.reduce((a,b)=>a+b.bytes.length,0);if(d&&l+d>i){h.push({name:b,why:`with the files before it, it passes the ${aq(i)} one ${D.REACH_LABEL[a.name]} message takes`});continue}d&&k.push(b),j.push(...c.files),l+=d,c.left&&h.push(c.left)}catch(c){w.logger.warn(`reach ${a.name}: could not send ${b}`,c),h.push({name:b,why:ap(c)})}let m=a=>a.length?"plain"in c?{plain:`${c.plain}
64
+ → ${c}`,entities:b.keep,link_preview_options:{is_disabled:!0}}).catch(()=>{})},async sendFiles(a,b){let c=b.filter(a=>a.picture),d=b.filter(a=>!a.picture);for(let b=0;b<c.length;b+=10){let e=c.slice(b,b+10);await k(a,e).catch(a=>{if(!(a instanceof g&&400===a.status))throw a;d.unshift(...e)})}for(let b of d){let c=new FormData;c.set("chat_id",a),c.set("document",new Blob([b.bytes]),b.name),await h("sendDocument",c)}}}}])},233398,a=>a.a(async(b,c)=>{try{var d=a.i(666680),e=a.i(912714),f=a.i(47919),g=a.i(203469),h=a.i(569572),i=a.i(875931),j=a.i(938934),k=a.i(346580),l=a.i(674986),m=a.i(839430),n=a.i(344853),o=a.i(725466),p=a.i(92706),q=a.i(569549),r=a.i(143699),s=a.i(626550),t=a.i(684321),u=a.i(821415),v=a.i(941981),w=a.i(706210),x=a.i(176668),y=a.i(293480),z=a.i(936292),A=a.i(465584),B=a.i(479286),C=a.i(773351),D=a.i(225310),E=a.i(558067),F=a.i(129167),G=a.i(319261),H=b([i,l,m,n,o,q,r,u,v,C,D]);[i,l,m,n,o,q,r,u,v,C,D]=H.then?(await H)():H;let am={telegram:a=>(0,G.createTelegram)(a),discord:a=>(0,B.createDiscord)(a),slack:(a,b)=>(0,F.createSlack)(a,b),email:(a,b,c,d)=>(0,C.createEmail)(a,b,c,d)},an=globalThis,ao=an.__reach??={live:new Map,last:null,told:new Map,choices:new Map,listening:null,gone:null,looking:null,idle:null},ap=()=>g.appEvents.emit({type:"reach"});async function I(a){return await ao.live.get(a)?.settled,J(a)}async function J(a){let b=await (0,o.readConfig)((0,E.reachPersonKey)(a));if(!b)return null;try{let a=JSON.parse(b);return"string"==typeof a.chat&&"string"==typeof a.name?{chat:a.chat,name:a.name,bot:"string"==typeof a.bot?a.bot:null}:null}catch{return null}}let aq=(a,b)=>(0,o.writeConfig)((0,E.reachPersonKey)(a),JSON.stringify(b));async function K(a){for(let b of a?[a]:E.REACH_CHANNELS){let c=ao.live.get(b);if(c?.stop.abort(),ao.live.delete(b),a&&c?.line&&await (0,q.endCall)(c.line.callId).catch(()=>{}),(await Promise.all(E.REACH_KEYS[b].map(o.configState))).includes("unreadable"))continue;let d=await Promise.all(E.REACH_KEYS[b].map(o.readConfig));if(!d.every(a=>!!a)){a&&await (0,o.removeConfig)((0,E.reachPersonKey)(b));continue}let e=a&&c?.id?await J(b):null;e&&null===e.bot&&c?.id&&await aq(b,{...e,bot:c.id});let f={name:b,channel:am[b](...d),stop:new AbortController,bot:null,link:null,problem:null,holding:null,refused:null,id:null,adopt:!a,settled:Promise.resolve(),asking:null,held:[],line:null,calls:new Set,busy:!1,notes:[]};ao.live.set(b,f),L(f)}ao.live.size&&(ao.listening??=g.appEvents.subscribe(a=>{"threads"===a.type&&af()}),ao.gone??=g.presence.onGone(ai),af(),ao.idle??=setInterval(()=>{W().catch(a=>x.logger.error("reach: idle lines",a))},h.REACH.idleMs).unref()),ap()}async function L(a){let{signal:b}=a.stop,c=b=>{a.problem!==b&&(a.problem=b,ap())};for(;!b.aborted;){try{await a.channel.listen({ready:(b,c,d)=>{a.bot=b,a.link=c,a.problem=null,a.holding=null,a.id=d,a.settled=M(a,d).catch(b=>x.logger.error(`reach ${a.name}: who is let in`,b)),ap()},incoming:b=>void N(a,b).catch(b=>x.logger.error(`reach ${a.name}: what arrived`,b)),holding:b=>{a.holding!==b&&(a.holding=b,ap())},wanted:async b=>!a.channel.named||(await I(a.name))?.chat===b},b)}catch(e){if(b.aborted)return;let d=e instanceof Error?e.message:String(e);if(e instanceof z.ChannelRefusal){x.logger.warn(`reach ${a.name}: ${d}`);let b=E.REACH_KEYS[a.name];return a.refused=b[e.token]??b[0],a.problem=d,ap()}c(d)}await new Promise(a=>setTimeout(a,h.REACH.retryMs))}}async function M(a,b){let c=await J(a.name);if(c&&c.bot!==b){if(null===c.bot&&a.adopt)return aq(a.name,{...c,bot:b});await (0,o.removeConfig)((0,E.reachPersonKey)(a.name)),ap()}}async function N(a,b){let c=await I(a.name);if("message"===b.kind&&void 0!==b.unproven){c?.chat===b.chat&&await a.channel.say(b.chat,{plain:b.unproven});return}if("press"===b.kind){if(c?.chat!==b.chat)return;return al(a,c,b.data,b.under)}return c?.chat===b.chat?P(a,c,b):a.channel.named?void 0:c?a.channel.say(b.chat,{plain:"This Thursday already answers someone else."}):O(a,b)}async function O(a,b){if(a.asking&&a.asking.chat!==b.chat)return a.channel.say(b.chat,{plain:"Someone else is already waiting to be let in here. If that is not you, press Not them on the computer, then write again."});a.held.length<h.REACH.held&&a.held.push(b),a.asking||(a.asking={chat:b.chat,name:b.name,handle:b.handle,said:b.words,code:(0,d.randomInt)(10**h.REACH.codeDigits).toString().padStart(h.REACH.codeDigits,"0")},ap(),await a.channel.say(b.chat,{plain:`Almost there. Thursday is asking on your computer whether to let you in. Press Allow there only if it shows ${a.asking.code}, and she answers what you wrote.`}))}async function P(a,b,c){let d=await Q(a,c);d&&Z(a,b,d)}async function Q(a,b){let{channel:c}=a;ao.last=a.name;let{kept:d,lost:e}=await S(a,b.files),f=b.voice?await R(a,b.voice):null;f&&"why"in f&&e.push({name:"Your voice message",why:f.why}),e.length&&await c.say(b.chat,{plain:e.map(({name:a,why:b})=>`${a} did not come through: ${b}.`).join("\n")}).catch(b=>x.logger.warn(`reach ${a.name}: could not say so`,b));let g=f&&"words"in f?`[A voice message, as a transcription model heard it:] ${f.words}`:"",h=[b.words,g,...d].filter(Boolean).join("\n");return h?(e.length&&a.notes.push({text:`[Sent from their phone with what follows, and lost on the way: ${e.map(({name:a,why:b})=>`${a} (${b})`).join("; ")}. They have been told.]`,said:!1}),{words:h,pictures:d.filter(t.isPicture)}):(b.unreadable&&!e.length&&await c.say(b.chat,{plain:"I can read words, voice messages, pictures and files here — not video yet. Write it instead."}),null)}async function R(a,b){let c=await (0,i.resolveMediaRef)("transcription");if(!c)return{why:"voice messages are read once a transcription model is picked in Settings › Models"};let d=Math.min(a.channel.limits.take,h.REACH.fileBytes);if(b.size&&b.size>d)return{why:`it is ${as(b.size)}, and the most taken from ${E.REACH_LABEL[a.name]} is ${as(d)}`};try{let a=new Uint8Array(await (await b.fetch()).arrayBuffer()),{text:d}=await (0,f.transcribe)({model:(0,i.buildTranscriptionModel)(c.ref,c.apiKey),audio:a});return d.trim()?{words:d.trim()}:{why:"the transcription model heard no words in it"}}catch(a){return{why:(0,i.modelErrorToString)(a)}}}async function S(a,b){let c=Math.min(a.channel.limits.take,h.REACH.fileBytes),d=[],e=b.filter(b=>!b.size||b.size<=c||(d.push({name:b.name,why:`it is ${as(b.size)}, and the most taken from ${E.REACH_LABEL[a.name]} is ${as(c)}`}),!1)),f=await Promise.allSettled(e.map(a=>a.fetch())),g=[];for(let[a,b]of f.entries())"fulfilled"===b.status?g.push(b.value):d.push({name:e[a].name,why:ar(b.reason)});if(!g.length)return{kept:[],lost:d};try{return{kept:await (0,v.keepGivenFiles)(g),lost:d}}catch(b){let a=ar(b);return{kept:[],lost:[...d,...g.map(b=>({name:b.name,why:a}))]}}}let ar=a=>a instanceof Error?a.message:String(a),as=a=>`${Math.ceil(a/1048576)} MB`;async function T(a,b,c){let d=ao.live.get(a),e=at(d,b,c);if(!d||!e)return;let f={chat:e.chat,name:e.name,bot:d.id};await aq(a,f),d.asking=null,ap();let g=d.held.splice(0);await d.channel.say(b,{plain:g.length?"You are in. Thursday answers what you wrote.":"You are in. Write here and Thursday answers."}).catch(b=>x.logger.warn(`reach ${a}: could not say so`,b));let h=[];for(let b of g){let c=await Q(d,b).catch(b=>(x.logger.warn(`reach ${a}: what they wrote while waiting`,b),null));c&&h.push(c)}h.length&&Z(d,f,{words:h.map(a=>a.words).join("\n"),pictures:h.flatMap(a=>a.pictures)})}let at=(a,b,c)=>a?.asking?.chat===b&&a.asking.code===c?a.asking:null;async function U(a,b){let c=(await (0,o.readConfig)(E.EMAIL_ADDRESS_KEY))?.toLowerCase();c||(0,y.publicError)("Save her mailbox first.");let d=b.trim().toLowerCase();d===c&&(0,y.publicError)("That is her own address. Name the address you will write to her from.");let e=ao.live.get(a);e&&(e.turn?.abort(),e.notes=[],e.calls.clear(),await Y(e)),await aq(a,{chat:d,name:b.trim(),bot:c}),ap()}async function V(a){await (0,o.removeConfig)((0,E.reachPersonKey)(a));let b=ao.live.get(a);b&&(b.turn?.abort(),b.notes=[],b.calls.clear(),await Y(b)),ap()}async function W(){for(let a of ao.live.values())a.line&&!a.busy&&await X(a.line)&&await Y(a)}async function X(a){return!(Date.now()-a.lastAt<=h.REACH.idleMs)&&!(await (0,n.listCallJobs)([a.callId])).some(a=>"running"===a.status)}async function Y(a){let b=a.line;a.line=null,b&&await (0,q.endCall)(b.callId).catch(()=>{})}function Z(a,b,c){a.busy?a.notes.push({text:c.words,said:!0,pictures:c.pictures}):(a.busy=!0,(async()=>{try{for(let d=c;null!==d;){await $(a,b,d);let c=a.notes.filter(a=>a.said);a.notes=a.notes.filter(a=>!a.said),d=c.length?{words:c.map(a=>a.text).join("\n"),pictures:c.flatMap(a=>a.pictures??[])}:null}}finally{a.busy=!1}})())}async function $(a,b,{words:c,pictures:d}){let{channel:e}=a;e.typing(b.chat).catch(()=>{});let f=setInterval(()=>void e.typing(b.chat).catch(()=>{}),4e3),g=a.notes.filter(a=>!a.said);a.notes=a.notes.filter(a=>a.said);let j=new AbortController;a.turn=j;let l=()=>j.signal.aborted||a.stop.signal.aborted;try{let f=a.line;(!f||!await (0,q.isCallOpen)(f.callId)||await X(f))&&(await Y(a),a.line={...await (0,r.openTextCall)(),messages:[],lastAt:0},a.calls.add(a.line.callId));let i=a.line,m=await (0,r.answerInWriting)({callId:i.callId,standing:i.standing,messages:[...i.messages,...g.map(a=>({role:"user",content:a.text})),{role:"user",content:c}],said:c,pictures:d,notes:()=>a.notes.splice(0),signal:AbortSignal.any([j.signal,a.stop.signal])});if(l())return;i.messages=function(a){let b=Math.max(a.findLastIndex(a=>"user"===a.role),0),c=a.findIndex((a,c)=>c<b&&("tool"===a.role||"assistant"===a.role&&"string"!=typeof a.content)),d=c<0?b:c,e=[...a.slice(0,d),...(0,k.asWords)(a.slice(d,b),(a,b)=>(0,s.toolLine)(a,JSON.stringify(b??{}))??a,a=>a.length>h.REACH.oldChars?`${a.slice(0,h.REACH.oldChars)}…`:a),...a.slice(b)];if(e.length<=h.REACH.messages)return e;let f=e.findIndex((a,b)=>b>=e.length-h.REACH.trimTo&&"user"===a.role);return f>0?e.slice(f):e}(m.messages),i.lastAt=Date.now(),m.moved&&!i.moved&&(i.moved=!0,await e.say(b.chat,{plain:m.moved}));let n=[...new Set(m.did)].join(" · "),o={markdown:m.text?.trim()||(n?`— ${(0,A.literal)(n)}`:"…")};e.attaches?await aa(a,b,o,m.text):(await e.say(b.chat,o),await _(a,b,m.text))}catch(d){if(l())return;a.notes.unshift(...g),a.line&&!a.line.lastAt&&await Y(a);let c=(0,y.isPublicError)(d)?d.message:(0,i.modelErrorToString)(d);x.logger.warn(`reach ${a.name}: ${c}`),await e.say(b.chat,{plain:c}).catch(()=>{})}finally{clearInterval(f),a.turn===j&&(a.turn=null)}}async function _(a,b,c){let{named:d,left:e}=await ab(c);for(let c of d)try{let d=await ac(a,c);if(!d)continue;d.files.length&&await a.channel.sendFiles(b.chat,d.files),d.left&&e.push(d.left)}catch(b){x.logger.warn(`reach ${a.name}: could not send ${c}`,b),e.push({name:c,why:ar(b)})}e.length&&(await a.channel.say(b.chat,{plain:au(e)}).catch(b=>x.logger.warn(`reach ${a.name}: could not say so`,b)),ad(a,e))}async function aa(a,b,c,d,e){let{named:f,left:g}=await ab(d),i=Math.min(a.channel.limits.file,h.REACH.fileBytes),j=[],k=[],l=0;for(let b of f)try{let c=await ac(a,b);if(!c)continue;let d=c.files.reduce((a,b)=>a+b.bytes.length,0);if(d&&l+d>i){g.push({name:b,why:`with the files before it, it passes the ${as(i)} one ${E.REACH_LABEL[a.name]} message takes`});continue}d&&k.push(b),j.push(...c.files),l+=d,c.left&&g.push(c.left)}catch(c){x.logger.warn(`reach ${a.name}: could not send ${b}`,c),g.push({name:b,why:ar(c)})}let m=a=>a.length?"plain"in c?{plain:`${c.plain}
63
65
 
64
- ${as(a)}`}:{markdown:`${c.markdown}
66
+ ${au(a)}`}:{markdown:`${c.markdown}
65
67
 
66
- ${(0,z.literal)(as(a))}`}:c;try{await a.channel.say(b.chat,m(h),e,j)}catch(c){if(!j.length)throw c;w.logger.warn(`reach ${a.name}: could not send with its files`,c),h.push(...k.map(a=>({name:a,why:ap(c)}))),await a.channel.say(b.chat,m(h),e)}h.length&&ab(a,h)}async function _(a){let b=await (0,t.filesOnDisk)((0,s.pathsIn)(a),null);return{named:b.slice(-g.REACH.files),left:b.slice(0,Math.max(b.length-g.REACH.files,0)).map(a=>({name:a,why:`only ${g.REACH.files} files go with one answer`}))}}async function aa(a,b){let c=await (0,t.insideWorkspace)(b),d=c?await (0,e.stat)(c).catch(()=>null):null;if(!c||!d)return null;let{limits:f}=a.channel,h=Math.min(f.file,g.REACH.fileBytes),i=D.REACH_LABEL[a.name],j=await (0,C.picturesOf)(c);if(j.length){let d=await (0,C.pdfOf)(c),e=d&&d.bytes.length<=h,f=a.channel.attaches?"sent as pictures":"sent as pictures above";return{files:e?[...j,d]:j,left:e?null:{name:b,why:d?`${f}; as a PDF it is ${aq(d.bytes.length)}, and the most that goes to ${i} is ${aq(h)}`:`${f}; the page itself opens on the computer`}}}return d.size>h?{files:[],left:{name:b,why:`it is ${aq(d.size)}, and the most that goes to ${i} is ${aq(h)}`}}:{files:[{bytes:await (0,e.readFile)(c),name:b.split("/").pop()??"file",picture:"image"===(0,s.viewKindOf)(b)&&d.size<=f.picture}],left:null}}let as=a=>["Not sent — still on this computer:",...a.map(({name:a,why:b})=>`• ${a}: ${b}`)].join("\n");function ab(a,b){a.notes.push({text:`[Named in what went to their phone, and not sent: ${b.map(({name:a,why:b})=>`${a} (${b})`).join("; ")}. They have been told.]`,said:!1})}async function ac(){for(let a of[...am.last?[am.last]:[],...D.REACH_CHANNELS.filter(a=>a!==am.last)]){let b=am.live.get(a),c=b?await H(a):null;if(b&&c)return{live:b,person:c}}return null}let at=Date.now()-1e3*process.uptime();function ad(a=g.REACH.lookMs){am.looking??=setTimeout(()=>{am.looking=null,ae().catch(a=>w.logger.error("reach: open work",a))},a)}async function ae(){if(am.inLook){am.lookAgain=!0;return}am.inLook=!0;try{do am.lookAgain=!1,await af();while(am.lookAgain)}finally{am.inLook=!1}}async function af(){let a=at+g.BROWSER_GONE_MS-Date.now();if(a>0)return ad(a);let b=await ac();if(!b)return;let c=await (0,m.listInboxThreads)(),d=(0,o.openWork)(c).filter(a=>"progress"!==a.kind),e=new Set(d.map(a=>a.key));for(let a of am.told.keys())e.has(a)||am.told.delete(a);for(let[a,b]of am.choices)e.has((0,o.questionKey)(b.question))||am.choices.delete(a);let h=d.filter(a=>!am.told.has(a.key));if(!h.length)return;let i=await ah();for(let a of h){let d=c.find(b=>b.id===a.threadId);if(!d)continue;let e=i.get(a.threadId),g=e?await H(e.name):null,h=e&&g?{live:e,person:g}:!f.presence.watching&&(0,v.toDate)(d.updatedAt).getTime()>=at?b:null;am.told.set(a.key,{kind:a.kind,phone:!!h}),h&&await ai(h,a,d)}}function ag(){for(let[a,b]of am.told)"question"!==b.kind||b.phone||am.told.delete(a);ad(0)}async function ah(){let a=[...am.live.values()],b=await (0,m.listCallJobs)(a.flatMap(a=>[...a.calls]));return new Map(b.flatMap(b=>{let c=a.find(a=>a.calls.has(b.callId??""));return c?[[b.id,c]]:[]}))}async function ai(a,b,c){let{live:d,person:e}=a,f=c.room.questions.find(a=>(0,o.questionKey)(a.id)===b.key),g=(f?.options??[]).map((a,b)=>{let d=`${f?.id.slice(0,40)}:${b}`;return am.choices.set(d,{threadId:c.id,bot:f?.bot??"",question:f?.id??"",answer:a}),{text:a,data:d}}),h={markdown:`${(0,z.literal)(`${b.show.line} \xb7 ${b.show.name}`)}
68
+ ${(0,A.literal)(au(a))}`}:c;try{await a.channel.say(b.chat,m(g),e,j)}catch(c){if(!j.length)throw c;x.logger.warn(`reach ${a.name}: could not send with its files`,c),g.push(...k.map(a=>({name:a,why:ar(c)}))),await a.channel.say(b.chat,m(g),e)}g.length&&ad(a,g)}async function ab(a){let b=await (0,u.filesOnDisk)((0,t.pathsIn)(a),null);return{named:b.slice(-h.REACH.files),left:b.slice(0,Math.max(b.length-h.REACH.files,0)).map(a=>({name:a,why:`only ${h.REACH.files} files go with one answer`}))}}async function ac(a,b){let c=await (0,u.insideWorkspace)(b),d=c?await (0,e.stat)(c).catch(()=>null):null;if(!c||!d)return null;let{limits:f}=a.channel,g=Math.min(f.file,h.REACH.fileBytes),i=E.REACH_LABEL[a.name],j=await (0,D.picturesOf)(c);if(j.length){let d=await (0,D.pdfOf)(c),e=d&&d.bytes.length<=g,f=a.channel.attaches?"sent as pictures":"sent as pictures above";return{files:e?[...j,d]:j,left:e?null:{name:b,why:d?`${f}; as a PDF it is ${as(d.bytes.length)}, and the most that goes to ${i} is ${as(g)}`:`${f}; the page itself opens on the computer`}}}return d.size>g?{files:[],left:{name:b,why:`it is ${as(d.size)}, and the most that goes to ${i} is ${as(g)}`}}:{files:[{bytes:await (0,e.readFile)(c),name:b.split("/").pop()??"file",picture:"image"===(0,t.viewKindOf)(b)&&d.size<=f.picture}],left:null}}let au=a=>["Not sent — still on this computer:",...a.map(({name:a,why:b})=>`• ${a}: ${b}`)].join("\n");function ad(a,b){a.notes.push({text:`[Named in what went to their phone, and not sent: ${b.map(({name:a,why:b})=>`${a} (${b})`).join("; ")}. They have been told.]`,said:!1})}async function ae(){for(let a of[...ao.last?[ao.last]:[],...E.REACH_CHANNELS.filter(a=>a!==ao.last)]){let b=ao.live.get(a),c=b?await I(a):null;if(b&&c)return{live:b,person:c}}return null}let av=Date.now()-1e3*process.uptime();function af(a=h.REACH.lookMs){ao.looking??=setTimeout(()=>{ao.looking=null,ag().catch(a=>x.logger.error("reach: open work",a))},a)}async function ag(){if(ao.inLook){ao.lookAgain=!0;return}ao.inLook=!0;try{do ao.lookAgain=!1,await ah();while(ao.lookAgain)}finally{ao.inLook=!1}}async function ah(){let a=av+h.BROWSER_GONE_MS-Date.now();if(a>0)return af(a);let b=await ae();if(!b)return;let c=await (0,n.listInboxThreads)(),d=(0,p.openWork)(c).filter(a=>"progress"!==a.kind),e=new Set(d.map(a=>a.key));for(let a of ao.told.keys())e.has(a)||ao.told.delete(a);for(let[a,b]of ao.choices)e.has((0,p.questionKey)(b.question))||ao.choices.delete(a);let f=d.filter(a=>!ao.told.has(a.key));if(!f.length)return;let i=await aj();for(let a of f){let d=c.find(b=>b.id===a.threadId);if(!d)continue;let e=i.get(a.threadId),f=e?await I(e.name):null,h=e&&f?{live:e,person:f}:!g.presence.watching&&(0,w.toDate)(d.updatedAt).getTime()>=av?b:null;ao.told.set(a.key,{kind:a.kind,phone:!!h}),h&&await ak(h,a,d)}}function ai(){for(let[a,b]of ao.told)"question"!==b.kind||b.phone||ao.told.delete(a);af(0)}async function aj(){let a=[...ao.live.values()],b=await (0,n.listCallJobs)(a.flatMap(a=>[...a.calls]));return new Map(b.flatMap(b=>{let c=a.find(a=>a.calls.has(b.callId??""));return c?[[b.id,c]]:[]}))}async function ak(a,b,c){let{live:d,person:e}=a,f=c.room.questions.find(a=>(0,p.questionKey)(a.id)===b.key),g=(f?.options??[]).map((a,b)=>{let d=`${f?.id.slice(0,40)}:${b}`;return ao.choices.set(d,{threadId:c.id,bot:f?.bot??"",question:f?.id??"",answer:a}),{text:a,data:d}}),h={markdown:`${(0,A.literal)(`${b.show.line} \xb7 ${b.show.name}`)}
67
69
 
68
- ${b.text||"…"}`};try{d.channel.attaches?await $(d,e,h,b.text,g):await d.channel.say(e.chat,h,g)}catch(a){w.logger.warn(`reach ${d.name}: could not tell ${b.key}`,a),am.told.delete(b.key);return}d.channel.attaches||await Z(d,e,b.text),d.notes.push({text:`${b.line}
69
- [The user has had this on their phone, as ${b.show.bot} wrote it, since ${(0,i.clockNow)()}.]`,said:!1}),"ending"===b.kind?await (0,m.markSeen)([b.threadId]):await (0,l.acceptRoomRelays)(b.relayIds)}async function aj(a,b,c,d){let e=am.choices.get(c);if(!e)return void await a.channel.say(b.chat,{plain:"That question is no longer open here. Write your answer instead."});for(let[a,b]of am.choices)b.question===e.question&&am.choices.delete(a);try{await (0,k.answerThread)(e.threadId,e.answer,"user",e.bot,e.question||void 0),d&&await a.channel.settle(b.chat,d,e.answer),a.notes.push({text:`[The user answered ${e.bot}'s question from their phone at ${(0,i.clockNow)()}: ${e.answer}. It has reached ${e.bot}.]`,said:!1})}catch(c){await a.channel.say(b.chat,{plain:(0,x.isPublicError)(c)?c.message:"That answer did not get through."})}}a.s(["allowReach",0,R,"declineReach",0,function(a,b,c){let d=am.live.get(a);d&&ar(d,b,c)&&(d.asking=null,d.held=[],an())},"forgetReach",0,T,"nameReach",0,S,"reachChannelOf",0,a=>D.REACH_CHANNELS.find(b=>D.REACH_KEYS[b].includes(a))??null,"startReach",0,J]),c()}catch(a){c(a)}},!1),242104,a=>{"use strict";a.s(["runSocket",0,function(a,b,c){return new Promise((d,e)=>{let f=new WebSocket(a),g=a=>{f.readyState===WebSocket.OPEN&&f.send(JSON.stringify(a))},h=!1,i=a=>{h||(h=!0,c.removeEventListener("abort",k),d(a))},j=(a,b)=>{i({code:a,reason:b}),f.close(a,b)},k=()=>j(1e3,"");c.addEventListener("abort",k,{once:!0}),f.addEventListener("message",a=>{try{b.message(JSON.parse(String(a.data)),g,j)}catch{}}),f.addEventListener("error",()=>{f.readyState===WebSocket.OPEN||h||(h=!0,c.removeEventListener("abort",k),e(Error(`Could not connect to ${new URL(a).host}`)))}),f.addEventListener("close",a=>i({code:a.code,reason:a.reason}))})}])},479286,a=>{"use strict";var b=a.i(936292),c=a.i(465584),d=a.i(242104);let e="https://discord.com/api/v10",f={4004:"Discord did not take the bot token: it was reset or mistyped. Reset it on the application's Bot page and paste the new one here.",4013:"Discord refused the intents this bot asked for.",4014:"Discord refused an intent this bot is not allowed — check the bot's page."};a.s(["createDiscord",0,function(a){async function g(c,d,f){let g=f instanceof FormData;for(let h=0;;h++){let i=await fetch(`${e}${d}`,{method:c,headers:{authorization:`Bot ${a}`,...g||!f?{}:{"content-type":"application/json"}},body:g?f:f?JSON.stringify(f):void 0}).catch(a=>{throw Error(`Could not reach ${new URL(e).host}`,{cause:a})});if(i.ok)return 204===i.status?null:await i.json();let j=await i.json().catch(()=>null);if(429===i.status&&await (0,b.waitOut)(j?.retry_after,h))continue;let k=j?.message??`Discord answered ${i.status}`;throw 401===i.status?new b.ChannelRefusal(k):Error(k)}}let h=a=>{let b=a.length<=5?1:5,c=[];for(let d=0;d<a.length&&c.length<5;d+=b)c.push({type:1,components:a.slice(d,d+b).map(a=>({type:2,style:2,label:a.text.slice(0,80),custom_id:a.data}))});return c};return{limits:{take:1/0,file:0x1400000,picture:0x1400000},async listen(c,e){let h,i=null,j=!0;try{let k=await (0,d.runSocket)("wss://gateway.discord.gg/?v=10&encoding=json",{message(b,d,e){let{op:f,d:k,s:l,t:m}=b;if(null!==l&&(i=l),10===f){let b=k.heartbeat_interval;h=setInterval(()=>{if(!j)return e(4e3,"Discord stopped answering");j=!1,d({op:1,d:i})},b),d({op:2,d:{token:a,intents:4096,properties:{os:process.platform,browser:"thursday",device:"thursday"}}})}else if(1===f)d({op:1,d:i});else if(11===f)j=!0;else if(7===f||9===f)e(4e3,"Discord asked for a new connection");else if(0===f&&"READY"===m){let a;c.ready(k.user.username,(a=k.application?.id)?`https://discord.com/oauth2/authorize?client_id=${a}&scope=bot&permissions=0`:null,k.user.id)}else if(0===f&&m){var n,o;let a=(n=m,o=k,"MESSAGE_CREATE"===n?o.guild_id||o.author.bot?null:{kind:"message",chat:o.channel_id,name:o.author.global_name||o.author.username,handle:`@${o.author.username}`,words:o.content.trim(),files:(o.attachments??[]).map(a=>({name:a.filename,size:a.size,fetch:async()=>{let b=await fetch(a.url);if(!b.ok)throw Error(`Discord answered ${b.status} for the file`);return new File([await b.arrayBuffer()],a.filename,{type:a.content_type??""})}})),unreadable:!1}:"INTERACTION_CREATE"===n?3!==o.type||o.guild_id?null:(g("POST",`/interactions/${o.id}/${o.token}/callback`,{type:6}).catch(()=>{}),{kind:"press",chat:o.channel_id,data:o.data?.custom_id??"",under:o.message?{id:o.message.id,text:o.message.content}:null}):null);a&&c.incoming(a)}}},e),l=f[k.code];if(l)throw new b.ChannelRefusal(l);if(!e.aborted)throw Error(k.reason||`Discord closed the connection (${k.code})`)}finally{clearInterval(h)}},async say(a,b,d){let e=(0,c.chatPieces)(b,"discord",1900);for(let[b,c]of e.entries())await g("POST",`/channels/${a}/messages`,{content:c,flags:4,allowed_mentions:{parse:[]},...d?.length&&b===e.length-1?{components:h(d)}:{}})},async typing(a){await g("POST",`/channels/${a}/typing`).catch(()=>{})},async settle(a,b,d){let e=`
70
+ ${b.text||"…"}`};try{d.channel.attaches?await aa(d,e,h,b.text,g):await d.channel.say(e.chat,h,g)}catch(a){x.logger.warn(`reach ${d.name}: could not tell ${b.key}`,a),ao.told.delete(b.key);return}d.channel.attaches||await _(d,e,b.text),d.notes.push({text:`${b.line}
71
+ [The user has had this on their phone, as ${b.show.bot} wrote it, since ${(0,j.clockNow)()}.]`,said:!1}),"ending"===b.kind?await (0,n.markSeen)([b.threadId]):await (0,m.acceptRoomRelays)(b.relayIds)}async function al(a,b,c,d){let e=ao.choices.get(c);if(!e)return void await a.channel.say(b.chat,{plain:"That question is no longer open here. Write your answer instead."});for(let[a,b]of ao.choices)b.question===e.question&&ao.choices.delete(a);try{await (0,l.answerThread)(e.threadId,e.answer,"user",e.bot,e.question||void 0),d&&await a.channel.settle(b.chat,d,e.answer),a.notes.push({text:`[The user answered ${e.bot}'s question from their phone at ${(0,j.clockNow)()}: ${e.answer}. It has reached ${e.bot}.]`,said:!1})}catch(c){await a.channel.say(b.chat,{plain:(0,y.isPublicError)(c)?c.message:"That answer did not get through."})}}a.s(["allowReach",0,T,"declineReach",0,function(a,b,c){let d=ao.live.get(a);d&&at(d,b,c)&&(d.asking=null,d.held=[],ap())},"forgetReach",0,V,"nameReach",0,U,"reachChannelOf",0,a=>E.REACH_CHANNELS.find(b=>E.REACH_KEYS[b].includes(a))??null,"startReach",0,K]),c()}catch(a){c(a)}},!1),242104,a=>{"use strict";a.s(["runSocket",0,function(a,b,c){return new Promise((d,e)=>{let f=new WebSocket(a),g=a=>{f.readyState===WebSocket.OPEN&&f.send(JSON.stringify(a))},h=!1,i=a=>{h||(h=!0,c.removeEventListener("abort",k),d(a))},j=(a,b)=>{i({code:a,reason:b}),f.close(a,b)},k=()=>j(1e3,"");c.addEventListener("abort",k,{once:!0}),f.addEventListener("message",a=>{try{b.message(JSON.parse(String(a.data)),g,j)}catch{}}),f.addEventListener("error",()=>{f.readyState===WebSocket.OPEN||h||(h=!0,c.removeEventListener("abort",k),e(Error(`Could not connect to ${new URL(a).host}`)))}),f.addEventListener("close",a=>i({code:a.code,reason:a.reason}))})}])},479286,a=>{"use strict";var b=a.i(936292),c=a.i(465584),d=a.i(242104);let e="https://discord.com/api/v10",f={4004:"Discord did not take the bot token: it was reset or mistyped. Reset it on the application's Bot page and paste the new one here.",4013:"Discord refused the intents this bot asked for.",4014:"Discord refused an intent this bot is not allowed — check the bot's page."};a.s(["createDiscord",0,function(a){async function g(c,d,f){let g=f instanceof FormData;for(let h=0;;h++){let i=await fetch(`${e}${d}`,{method:c,headers:{authorization:`Bot ${a}`,...g||!f?{}:{"content-type":"application/json"}},body:g?f:f?JSON.stringify(f):void 0}).catch(a=>{throw Error(`Could not reach ${new URL(e).host}`,{cause:a})});if(i.ok)return 204===i.status?null:await i.json();let j=await i.json().catch(()=>null);if(429===i.status&&await (0,b.waitOut)(j?.retry_after,h))continue;let k=j?.message??`Discord answered ${i.status}`;throw 401===i.status?new b.ChannelRefusal(k):Error(k)}}let h=a=>{let b=a.length<=5?1:5,c=[];for(let d=0;d<a.length&&c.length<5;d+=b)c.push({type:1,components:a.slice(d,d+b).map(a=>({type:2,style:2,label:a.text.slice(0,80),custom_id:a.data}))});return c};return{limits:{take:1/0,file:0x1400000,picture:0x1400000},async listen(c,e){let h,i=null,j=!0;try{let k=await (0,d.runSocket)("wss://gateway.discord.gg/?v=10&encoding=json",{message(b,d,e){let{op:f,d:k,s:l,t:m}=b;if(null!==l&&(i=l),10===f){let b=k.heartbeat_interval;h=setInterval(()=>{if(!j)return e(4e3,"Discord stopped answering");j=!1,d({op:1,d:i})},b),d({op:2,d:{token:a,intents:4096,properties:{os:process.platform,browser:"thursday",device:"thursday"}}})}else if(1===f)d({op:1,d:i});else if(11===f)j=!0;else if(7===f||9===f)e(4e3,"Discord asked for a new connection");else if(0===f&&"READY"===m){let a;c.ready(k.user.username,(a=k.application?.id)?`https://discord.com/oauth2/authorize?client_id=${a}&scope=bot&permissions=0`:null,k.user.id)}else if(0===f&&m){let a=function(a,b){if("MESSAGE_CREATE"===a){if(b.guild_id||b.author.bot)return null;let a=(b.attachments??[]).map(a=>({name:a.filename,size:a.size,fetch:async()=>{let b=await fetch(a.url);if(!b.ok)throw Error(`Discord answered ${b.status} for the file`);return new File([await b.arrayBuffer()],a.filename,{type:a.content_type??""})}})),c=!!((b.flags??0)&8192);return{kind:"message",chat:b.channel_id,name:b.author.global_name||b.author.username,handle:`@${b.author.username}`,words:b.content.trim(),...c?{files:[],voice:a[0]??null}:{files:a,voice:null},unreadable:!1}}return"INTERACTION_CREATE"===a?3!==b.type||b.guild_id?null:(g("POST",`/interactions/${b.id}/${b.token}/callback`,{type:6}).catch(()=>{}),{kind:"press",chat:b.channel_id,data:b.data?.custom_id??"",under:b.message?{id:b.message.id,text:b.message.content}:null}):null}(m,k);a&&c.incoming(a)}}},e),l=f[k.code];if(l)throw new b.ChannelRefusal(l);if(!e.aborted)throw Error(k.reason||`Discord closed the connection (${k.code})`)}finally{clearInterval(h)}},async say(a,b,d){let e=(0,c.chatPieces)(b,"discord",1900);for(let[b,c]of e.entries())await g("POST",`/channels/${a}/messages`,{content:c,flags:4,allowed_mentions:{parse:[]},...d?.length&&b===e.length-1?{components:h(d)}:{}})},async typing(a){await g("POST",`/channels/${a}/typing`).catch(()=>{})},async settle(a,b,d){let e=`
70
72
 
71
73
  → ${(0,c.chatPieces)({plain:d},"discord",1900)[0]}`;await g("PATCH",`/channels/${a}/messages/${b.id}`,{content:`${b.text.slice(0,1900-e.length)}${e}`,components:[]}).catch(()=>{})},async sendFiles(a,b){for(let c=0;c<b.length;c+=10){let d=b.slice(c,c+10),e=new FormData;for(let[a,b]of(e.set("payload_json",JSON.stringify({attachments:d.map((a,b)=>({id:b,filename:a.name}))})),d.entries()))e.set(`files[${a}]`,new Blob([b.bytes]),b.name);await g("POST",`/channels/${a}/messages`,e)}}}}])},92706,a=>{"use strict";var b=a.i(569572),c=a.i(446957),d=a.i(706210),e=a.i(182248);let f={message:"says",question:"asks",report:"reports",interrupted:"was cut off"},g={question:0,stopped:1,done:2,progress:3};function h(a){let c=(0,e.captionText)(a.replace(/!\[[^\]]*\]\([^)]*\)/g," ")).replace(e.MARKDOWN_LINK,"$1").replace(/^• /gm,"").trim();if(c.length<=b.CALL_RELAY.chars)return c;let d=c.slice(0,b.CALL_RELAY.chars),f=Math.max(d.lastIndexOf("\n\n"),d.lastIndexOf(". "),d.lastIndexOf(".\n"),d.lastIndexOf("。")),g=(f>b.CALL_RELAY.chars/3?d.slice(0,f+1):d).trim();return`${g}
72
74
  [The message goes on; the rest is in its thread on screen.]`}let i=a=>`question:${a}`;a.s(["openWork",0,function(a){let b=[];for(let e of a){let{relays:a,questions:j}=e.room,k=(0,d.toDate)(e.updatedAt).getTime(),l=(a,b)=>`[${a} → Thursday, thread "${e.label}" (${e.id}), ${b}.]`,m=(a,b)=>({kind:"relay",name:e.label,line:b,done:!0,bot:a});for(let c of j){let d=c.options?.length?` Options: ${c.options.join(" / ")}.`:"";b.push({rank:g.question,key:i(c.id),kind:"question",line:`${l(c.bot,"question")}
73
75
  ${h(c.text)}${d}`,relayIds:a.filter(a=>a.messageId===c.id).map(a=>a.id),threadId:e.id,text:c.text,show:m(c.bot,`${c.bot} asks`)})}let n=a.filter(a=>!j.some(b=>b.id===a.messageId)),o="done"===e.status,p="waiting"===e.status&&(0,c.isAppStop)(e.ask);if(o||p){if(e.seen)continue;let a=p?"stopped":"done",c=(p?e.ask?.question:null)??e.outcome??"",d="stopped"===a?`It stopped before finishing. Where it got to: ${h(c)}`:`Done. Its answer: ${h(c)}`;b.push({rank:g[a],key:`${a}:${e.id}@${k}`,kind:"ending",line:`${l(e.bot,a)}
74
76
  ${d}`,relayIds:n.map(a=>a.id),threadId:e.id,text:c,show:m(e.bot,"stopped"===a?`${e.bot} stopped`:`${e.bot} finished`)});continue}for(let a of n)b.push({rank:g.progress,key:`progress:${a.id}`,kind:"progress",line:`${l(a.bot,a.kind)}
75
- ${h(a.text)}`,relayIds:[a.id],threadId:e.id,text:a.text,show:m(a.bot,`${a.bot} ${f[a.kind]}`)})}return b.sort((a,b)=>a.rank-b.rank)},"questionKey",0,i])},143699,a=>a.a(async(b,c)=>{try{var d=a.i(912714),e=a.i(47919),f=a.i(794219),g=a.i(148016),h=a.i(569572),i=a.i(552556),j=a.i(738131),k=a.i(875931),l=a.i(689656),m=a.i(61514),n=a.i(614747),o=a.i(467650),p=a.i(762008),q=a.i(688034),r=a.i(725466),s=a.i(684321),t=a.i(69721),u=a.i(176668);a.i(422842);var v=a.i(293480),w=a.i(182248),x=a.i(569549),y=a.i(3894),z=a.i(626550),A=b([j,k,m,n,r,x]);async function B(){let a=await Promise.all(y.TEXT_CALL_PROVIDERS.map(async a=>await (0,r.readConfig)(a.apiKeyName)?a.apiKeyName:null));return(0,y.textCallRunsOn)(b=>a.includes(b))}async function C(a,b){if(b)return b;let c=await B();return c||(0,v.publicError)(S),{provider:c,model:a.backendModel}}async function D(a,b){if("chatgpt"!==a.provider||!(0,k.isPlanSpent)(b)||!await (0,r.readConfig)(i.LIVE_PROVIDER.apiKeyName))return null;let c=(await (0,x.readLiveSettings)()).backendModel,d=l.TEXT_MODEL_PROVIDERS.openai.suggestModels.find(a=>a.id===c)?.label??c,e=b instanceof Error?b.message:String(b);return{ref:{provider:"openai",model:c},why:e,line:`${e} Answering on your OpenAI key (${d}) until it resets.`}}async function E(a){if(!(0,k.isPlanSpent)(a))return a;let b=a instanceof Error?a.message:String(a);return new v.PublicError(await (0,r.readConfig)(i.LIVE_PROVIDER.apiKeyName)?`${b} Write again and she answers on your OpenAI key.`:`${b} With an OpenAI key in Settings › API keys, she answers on it until then.`)}async function F(a){let b=await C(await (0,x.readLiveSettings)(),a),[c,d]=await Promise.all([(0,x.insertCall)({provider:b.provider,model:h.TEXT_CALL.model,backendModel:b.model}),(0,m.loadCallStanding)()]);return{callId:c,standing:d}}[j,k,m,n,r,x]=A.then?(await A)():A,f.object({callId:f.string().min(1),standing:f.string().nullish(),runsOn:l.textModelRefSchema.nullish(),turn:f.string().min(1),messages:f.array(f.unknown()).min(1),where:f.unknown().optional()});let K=globalThis.__textCallTurns??=new Map,L="workspace:",M=a=>({type:"file",mediaType:(0,s.mimeOf)(a),filename:a,data:{type:"url",url:new URL(`${L}${encodeURIComponent(a)}`)}}),N=a=>{let b=a.data,c=b instanceof URL?b:b?.type==="url"?b.url:null;return c instanceof URL&&c.protocol===L?decodeURIComponent(c.pathname):null},O=(a,b)=>b?.length?[{type:"text",text:a},...b.map(M)]:a;g.queryKey.file("");let P=new WeakMap,Q=a=>a.map(a=>P.get(a)??a);async function G(a,b,c){if(b)return{missed:`${a} is a picture, and ${b} cannot see pictures, so it was not sent to you.`};let e=await (0,o.checkPicture)(a);if("missing"in e)return{missed:`There is no file at ${a} in the workspace, so no picture was sent to you.`};if("notPicture"in e)return{missed:`${a} is not a png, jpg, webp or gif, so it was not sent to you as a picture.`};if("tooBig"in e)return{missed:`${(0,o.tooBigToSee)(a,e.tooBig)} It was not sent to you.`};if(e.bytes>c)return{missed:`${a} is a picture not sent with this message: the pictures after it fill the ${(0,w.formatBytes)(h.LOOK.perRequest)} one message to you carries. Look at it with look_at to see it.`};let f=await (0,d.readFile)(e.full).catch(()=>null);return f?{data:f.toString("base64"),mediaType:e.mediaType,bytes:f.length}:{missed:`${a} could not be read, so no picture was sent to you.`}}async function H(a,b){let c=(0,k.seesToolImages)(b)?null:b.model,d=h.LOOK.perRequest-a.reduce((a,b)=>a+function(a){if("user"!==a.role||"string"==typeof a.content)return 0;let b=0;for(let c of a.content){if("file"!==c.type)continue;let a=c.data,d=a?.type==="data"?a.data:a;"string"==typeof d?b+=Math.floor(3*d.length/4):(d instanceof Uint8Array||d instanceof ArrayBuffer)&&(b+=d.byteLength)}return b}(b),0),e=[...a];for(let a=e.length-1;a>=0;a-=1){let b=e[a];if("user"!==b.role||"string"==typeof b.content||!b.content.some(a=>"file"===a.type&&null!==N(a)))continue;let f=[];for(let a of[...b.content].reverse()){let b="file"===a.type?N(a):null;if(!b){f.unshift(a);continue}let e=await G(b,c,d);if("missed"in e){f.unshift({type:"text",text:e.missed});continue}d-=e.bytes,f.unshift({type:"text",text:`${b}, as an image:`},{type:"file",mediaType:e.mediaType,data:{type:"data",data:e.data}})}let g={role:"user",content:f};P.set(g,b),e[a]=g}return e}async function I(a){var b;let c,d,{callId:f,standing:g,messages:i,said:j,signal:k}=a,[l,m]=await Promise.all([J(f,null,!0),(0,x.nextTurnSeq)(f)]);null!==j&&await (0,x.saveTurns)(f,[{id:crypto.randomUUID(),role:"user",text:j,seq:m}]);let n=(b=f,c=null===j?m:m+1,{step:async a=>{for(let d of a.content)if("tool-call"===d.type){let e=a.content.find(a=>"tool-result"===a.type&&a.toolCallId===d.toolCallId);await (0,x.saveTurns)(b,[{id:d.toolCallId,role:"tool",tool:d.toolName,text:d.toolName===p.TOOL_NAMES.web_search?function(a,b){let c=b??{},d=[(a??{}).query,c.action?.query].find(a=>"string"==typeof a&&!!a.trim()),e=Array.isArray(c.sources)?c.sources.flatMap(a=>a&&"object"==typeof a&&"url"in a&&"string"==typeof a.url?[{url:a.url,..."title"in a&&"string"==typeof a.title?{title:a.title}:{}}]:[]):[];return JSON.stringify({query:d??null,sources:e})}(d.input,e?.type==="tool-result"?e.output:null):JSON.stringify(d.input??{}),seq:c++}])}else"text"===d.type&&d.text.trim()?await (0,x.saveTurns)(b,[{id:crypto.randomUUID(),role:"assistant",text:d.text.trim(),seq:c++}]):"reasoning"===d.type&&d.text.trim()&&await (0,x.saveThought)(b,{id:crypto.randomUUID(),text:d.text.trim(),seq:c})},said:(a,d=crypto.randomUUID())=>(0,x.saveTurns)(b,[{id:d,role:"user",text:a,seq:c++}])}),o=R(g),q=i.at(-1),r=a.pictures?.length&&q?.role==="user"&&"string"==typeof q.content?[...i.slice(0,-1),{role:"user",content:O(q.content,a.pictures)}]:i,s=[...o,...r],t=0,v=async b=>(0,e.generateText)({model:b.model,instructions:b.system,messages:await H(Q(s),b.ref),allowSystemInMessages:!0,tools:b.tools,providerOptions:b.providerOptions,stopWhen:(0,e.stepCountIs)(h.TEXT_CALL.maxSteps),abortSignal:k,prepareStep:async({stepNumber:c,messages:d})=>{let e=c>0?a.notes?.()??[]:[];for(let a of(s=[...d,...e.map(a=>({role:"user",content:O(a.text,a.pictures)}))],e))a.said&&await n.said(a.text);return e.length?{messages:await H(s,b.ref)}:void 0},onStepEnd:async a=>{t+=1,await n.step(a)}}),w=null;try{d=await v(l)}catch(b){let a=t?null:await D(l.ref,b);if(!a)throw await E(b);u.logger.info(`text call ${f}: ${a.line}`),w=a.line;try{d=await v(await J(f,a.ref,!0))}catch(a){throw await E(a)}}return{text:d.text.trim(),did:d.steps.flatMap(a=>a.toolCalls.map(a=>(0,z.toolLine)(a.toolName,JSON.stringify(a.input??{}))??a.toolName)),messages:Q([...s.slice(o.length),...d.steps.at(-1)?.response.messages??[]]),moved:w}}let R=a=>a?[{role:"system",content:a}]:[];async function J(a,b,c=!1,d){let e=await (0,x.readLiveSettings)(),f=await C(e,b),g="openai"===f.provider||"chatgpt"===f.provider,[h,l,m,o,s]=await Promise.all([(0,k.getTextModel)(f),(0,n.loadThursdayPrompt)({backendPrompt:e.backendPrompt,written:!0,callId:a,phone:c,persona:e.persona,stylePrompt:e.stylePrompt,readSkills:e.readSkills,where:d}),(0,j.loadTools)({target:"thursday",callId:a,webSearch:e.webSearch,readSkills:e.readSkills,written:!0,model:f,phone:c}),(0,r.readConfig)(q.EXA_API_KEY),(0,r.readConfig)(i.LIVE_PROVIDER.apiKeyName)]),u=h.searchTools&&Object.values(h.searchTools)[0],v={...m,...e.webSearch&&!o&&u?{[p.TOOL_NAMES.web_search]:u}:{}},w=g?s?await (0,t.acceptedReasoning)({apiKey:s,model:f.model,effort:e.reasoningEffort}):(0,t.wantedReasoning)(e.reasoningEffort):null;return{ref:f,model:h.model,system:l,tools:v,providerOptions:{openai:{...w?.effort?{reasoningEffort:w.effort}:{},...w&&"summary"in w&&w.summary?{reasoningSummary:w.summary}:{}}}}}let S="Writing to Thursday needs a GPT subscription sign-in or an OpenAI key — Settings › API keys.";a.s(["answerInWriting",0,I,"openTextCall",0,F,"readTextCallProvider",0,B,"readWhere",0,function(a){if(null==a)return null;let b=y.WhereSchema.safeParse(a);return b.success?b.data:(u.logger.warn(`The call goes on without where the user is: ${b.error.issues[0]?.message}`),null)},"tellTextCall",0,function(a,b,c){let d=K.get(b);return!!d&&d.callId===a&&(d.notes.push(c),!0)}]),c()}catch(a){c(a)}},!1),69721,a=>{"use strict";var b=a.i(794219),c=a.i(569572),d=a.i(176668),e=a.i(293480),f=a.i(746609);let g=b.object({session:b.object({id:b.string().min(1)}),transport:b.object({type:b.literal("webrtc"),sdp:b.string().min(1)})}),h=new Map;function i(a){return"none"===a?{effort:a}:{...a?{effort:a}:{},summary:"auto"}}async function j(a){let{apiKey:b,model:e,effort:f}=a,g=`${e} ${f??"auto"}`,j=h.get(g);if(void 0!==j)return j;let k=i(f);for(;;){let a=await fetch("https://api.openai.com/v1/responses/input_tokens",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(c.LIVE_CALL.reasoningCheckMs),body:JSON.stringify({model:e,input:".",reasoning:k})}).catch(()=>null);if(!a)return k;let f=Object.keys(k).length?k:null;if(a.ok)return h.set(g,f),f;let i=await a.json().catch(()=>null),j=i?.error?.param?.replace(/^reasoning\./,"");if("effort"!==j&&"summary"!==j||!(j in k))return k;if(d.logger.warn(`${e} takes no reasoning ${j}; calls omit it`),delete k[j],!Object.keys(k).length)return h.set(g,null),null}}async function k(a){let b=await fetch("https://api.openai.com/v1/models",{headers:{Authorization:`Bearer ${a}`},signal:AbortSignal.timeout(c.LIVE_CALL.keyCheckMs)}).catch(()=>null);if(!b||401!==b.status&&403!==b.status)return null;let d=await b.json().catch(()=>null);return d?.error?.message?.trim()||`It answered ${b.status}.`}async function l(a){let b,h=await fetch("https://api.openai.com/v1/live/sessions",{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(c.LIVE_CALL.startupMs),body:JSON.stringify({session:{model:f.LIVE_MODEL,instructions:a.instructions,audio:{output:{voice:a.voice}},store:!1,delegation:{type:"responses",responses:{model:a.backend.model,instructions:a.backend.instructions,tools:[...a.backend.tools.map(a=>({type:"function",...a})),...a.backend.hosted.map(a=>f.LIVE_HOSTED_TOOLS[a].declare)],tool_choice:"auto",parallel_tool_calls:!0,max_output_tokens:c.LIVE_CALL.backendOutputTokens,...a.backend.reasoning?{reasoning:a.backend.reasoning}:{}}}},transport:{type:"webrtc",sdp:a.sdp}})}).catch(a=>{d.logger.warn("OpenAI Live unreachable",a),(0,e.publicError)("Could not reach OpenAI Live.")}),i=await h.text();try{b=JSON.parse(i)}catch{b=null}if(!h.ok){let a=b;(0,e.publicError)(a?.error?.message||i||`OpenAI Live refused the call (${h.status}).`)}let j=g.safeParse(b);return j.success||(0,e.publicError)("OpenAI Live returned an invalid session connection."),j.data}a.s(["acceptedReasoning",0,j,"createLiveCall",0,l,"keyRefusal",0,k,"wantedReasoning",0,i])}];
77
+ ${h(a.text)}`,relayIds:[a.id],threadId:e.id,text:a.text,show:m(a.bot,`${a.bot} ${f[a.kind]}`)})}return b.sort((a,b)=>a.rank-b.rank)},"questionKey",0,i])},143699,a=>a.a(async(b,c)=>{try{var d=a.i(912714),e=a.i(47919),f=a.i(794219),g=a.i(148016),h=a.i(569572),i=a.i(552556),j=a.i(738131),k=a.i(875931),l=a.i(689656),m=a.i(61514),n=a.i(614747),o=a.i(467650),p=a.i(762008),q=a.i(688034),r=a.i(725466),s=a.i(684321),t=a.i(69721),u=a.i(176668);a.i(422842);var v=a.i(293480),w=a.i(182248),x=a.i(569549),y=a.i(3894),z=a.i(626550),A=b([j,k,m,n,o,r,x]);async function B(){let a=await Promise.all(y.TEXT_CALL_PROVIDERS.map(async a=>await (0,r.readConfig)(a.apiKeyName)?a.apiKeyName:null));return(0,y.textCallRunsOn)(b=>a.includes(b))}async function C(a,b){if(b)return b;let c=await B();return c||(0,v.publicError)(S),{provider:c,model:a.backendModel}}async function D(a,b){if("chatgpt"!==a.provider||!(0,k.isPlanSpent)(b)||!await (0,r.readConfig)(i.LIVE_PROVIDER.apiKeyName))return null;let c=(await (0,x.readLiveSettings)()).backendModel,d=l.TEXT_MODEL_PROVIDERS.openai.suggestModels.find(a=>a.id===c)?.label??c,e=b instanceof Error?b.message:String(b);return{ref:{provider:"openai",model:c},why:e,line:`${e} Answering on your OpenAI key (${d}) until it resets.`}}async function E(a){if(!(0,k.isPlanSpent)(a))return a;let b=a instanceof Error?a.message:String(a);return new v.PublicError(await (0,r.readConfig)(i.LIVE_PROVIDER.apiKeyName)?`${b} Write again and she answers on your OpenAI key.`:`${b} With an OpenAI key in Settings › API keys, she answers on it until then.`)}async function F(a){let b=await C(await (0,x.readLiveSettings)(),a),[c,d]=await Promise.all([(0,x.insertCall)({provider:b.provider,model:h.TEXT_CALL.model,backendModel:b.model}),(0,m.loadCallStanding)()]);return{callId:c,standing:d}}[j,k,m,n,o,r,x]=A.then?(await A)():A,f.object({callId:f.string().min(1),standing:f.string().nullish(),runsOn:l.textModelRefSchema.nullish(),turn:f.string().min(1),messages:f.array(f.unknown()).min(1),where:f.unknown().optional()});let K=globalThis.__textCallTurns??=new Map,L="workspace:",M=a=>({type:"file",mediaType:(0,s.mimeOf)(a),filename:a,data:{type:"url",url:new URL(`${L}${encodeURIComponent(a)}`)}}),N=a=>{let b=a.data,c=b instanceof URL?b:b?.type==="url"?b.url:null;return c instanceof URL&&c.protocol===L?decodeURIComponent(c.pathname):null},O=(a,b)=>b?.length?[{type:"text",text:a},...b.map(M)]:a;g.queryKey.file("");let P=new WeakMap,Q=a=>a.map(a=>P.get(a)??a);async function G(a,b,c){if(b)return{missed:`${a} is a picture, and ${b} cannot see pictures, so it was not sent to you.`};let e=await (0,o.checkPicture)(a);if("missing"in e)return{missed:`There is no file at ${a} in the workspace, so no picture was sent to you.`};if("notPicture"in e)return{missed:`${a} is not a png, jpg, webp or gif, so it was not sent to you as a picture.`};if("tooBig"in e)return{missed:`${(0,o.tooBigToSee)(a,e.tooBig)} It was not sent to you.`};if(e.bytes>c)return{missed:`${a} is a picture not sent with this message: the pictures after it fill the ${(0,w.formatBytes)(h.LOOK.perRequest)} one message to you carries. Look at it with look_at to see it.`};let f=await (0,d.readFile)(e.full).catch(()=>null);return f?{data:f.toString("base64"),mediaType:e.mediaType,bytes:f.length}:{missed:`${a} could not be read, so no picture was sent to you.`}}async function H(a,b){let c=(0,k.seesToolImages)(b)?null:b.model,d=h.LOOK.perRequest-a.reduce((a,b)=>a+function(a){if("user"!==a.role||"string"==typeof a.content)return 0;let b=0;for(let c of a.content){if("file"!==c.type)continue;let a=c.data,d=a?.type==="data"?a.data:a;"string"==typeof d?b+=Math.floor(3*d.length/4):(d instanceof Uint8Array||d instanceof ArrayBuffer)&&(b+=d.byteLength)}return b}(b),0),e=[...a];for(let a=e.length-1;a>=0;a-=1){let b=e[a];if("user"!==b.role||"string"==typeof b.content||!b.content.some(a=>"file"===a.type&&null!==N(a)))continue;let f=[];for(let a of[...b.content].reverse()){let b="file"===a.type?N(a):null;if(!b){f.unshift(a);continue}let e=await G(b,c,d);if("missed"in e){f.unshift({type:"text",text:e.missed});continue}d-=e.bytes,f.unshift({type:"text",text:`${b}, as an image:`},{type:"file",mediaType:e.mediaType,data:{type:"data",data:e.data}})}let g={role:"user",content:f};P.set(g,b),e[a]=g}return e}async function I(a){var b;let c,d,{callId:f,standing:g,messages:i,said:j,signal:k}=a,[l,m]=await Promise.all([J(f,null,!0),(0,x.nextTurnSeq)(f)]);null!==j&&await (0,x.saveTurns)(f,[{id:crypto.randomUUID(),role:"user",text:j,seq:m}]);let n=(b=f,c=null===j?m:m+1,{step:async a=>{for(let d of a.content)if("tool-call"===d.type){let e=a.content.find(a=>"tool-result"===a.type&&a.toolCallId===d.toolCallId);await (0,x.saveTurns)(b,[{id:d.toolCallId,role:"tool",tool:d.toolName,text:d.toolName===p.TOOL_NAMES.web_search?function(a,b){let c=b??{},d=[(a??{}).query,c.action?.query].find(a=>"string"==typeof a&&!!a.trim()),e=Array.isArray(c.sources)?c.sources.flatMap(a=>a&&"object"==typeof a&&"url"in a&&"string"==typeof a.url?[{url:a.url,..."title"in a&&"string"==typeof a.title?{title:a.title}:{}}]:[]):[];return JSON.stringify({query:d??null,sources:e})}(d.input,e?.type==="tool-result"?e.output:null):JSON.stringify(d.input??{}),seq:c++}])}else"text"===d.type&&d.text.trim()?await (0,x.saveTurns)(b,[{id:crypto.randomUUID(),role:"assistant",text:d.text.trim(),seq:c++}]):"reasoning"===d.type&&d.text.trim()&&await (0,x.saveThought)(b,{id:crypto.randomUUID(),text:d.text.trim(),seq:c})},said:(a,d=crypto.randomUUID())=>(0,x.saveTurns)(b,[{id:d,role:"user",text:a,seq:c++}])}),o=R(g),q=i.at(-1),r=a.pictures?.length&&q?.role==="user"&&"string"==typeof q.content?[...i.slice(0,-1),{role:"user",content:O(q.content,a.pictures)}]:i,s=[...o,...r],t=0,v=async b=>(0,e.generateText)({model:b.model,instructions:b.system,messages:await H(Q(s),b.ref),allowSystemInMessages:!0,tools:b.tools,providerOptions:b.providerOptions,stopWhen:(0,e.stepCountIs)(h.TEXT_CALL.maxSteps),abortSignal:k,prepareStep:async({stepNumber:c,messages:d})=>{let e=c>0?a.notes?.()??[]:[];for(let a of(s=[...d,...e.map(a=>({role:"user",content:O(a.text,a.pictures)}))],e))a.said&&await n.said(a.text);return e.length?{messages:await H(s,b.ref)}:void 0},onStepEnd:async a=>{t+=1,await n.step(a)}}),w=null;try{d=await v(l)}catch(b){let a=t?null:await D(l.ref,b);if(!a)throw await E(b);u.logger.info(`text call ${f}: ${a.line}`),w=a.line;try{d=await v(await J(f,a.ref,!0))}catch(a){throw await E(a)}}return{text:d.text.trim(),did:d.steps.flatMap(a=>a.toolCalls.map(a=>(0,z.toolLine)(a.toolName,JSON.stringify(a.input??{}))??a.toolName)),messages:Q([...s.slice(o.length),...d.steps.at(-1)?.response.messages??[]]),moved:w}}let R=a=>a?[{role:"system",content:a}]:[];async function J(a,b,c=!1,d){let e=await (0,x.readLiveSettings)(),f=await C(e,b),g="openai"===f.provider||"chatgpt"===f.provider,[h,l,m,o,s]=await Promise.all([(0,k.getTextModel)(f),(0,n.loadThursdayPrompt)({backendPrompt:e.backendPrompt,written:!0,callId:a,phone:c,persona:e.persona,stylePrompt:e.stylePrompt,readSkills:e.readSkills,where:d}),(0,j.loadTools)({target:"thursday",callId:a,webSearch:e.webSearch,readSkills:e.readSkills,written:!0,model:f,phone:c}),(0,r.readConfig)(q.EXA_API_KEY),(0,r.readConfig)(i.LIVE_PROVIDER.apiKeyName)]),u=h.searchTools&&Object.values(h.searchTools)[0],v={...m,...e.webSearch&&!o&&u?{[p.TOOL_NAMES.web_search]:u}:{}},w=g?s?await (0,t.acceptedReasoning)({apiKey:s,model:f.model,effort:e.reasoningEffort}):(0,t.wantedReasoning)(e.reasoningEffort):null;return{ref:f,model:h.model,system:l,tools:v,providerOptions:{openai:{...w?.effort?{reasoningEffort:w.effort}:{},...w&&"summary"in w&&w.summary?{reasoningSummary:w.summary}:{}}}}}let S="Writing to Thursday needs a GPT subscription sign-in or an OpenAI key — Settings › API keys.";a.s(["answerInWriting",0,I,"openTextCall",0,F,"readTextCallProvider",0,B,"readWhere",0,function(a){if(null==a)return null;let b=y.WhereSchema.safeParse(a);return b.success?b.data:(u.logger.warn(`The call goes on without where the user is: ${b.error.issues[0]?.message}`),null)},"tellTextCall",0,function(a,b,c){let d=K.get(b);return!!d&&d.callId===a&&(d.notes.push(c),!0)}]),c()}catch(a){c(a)}},!1),69721,a=>{"use strict";var b=a.i(794219),c=a.i(569572),d=a.i(176668),e=a.i(293480),f=a.i(746609);let g=b.object({session:b.object({id:b.string().min(1)}),transport:b.object({type:b.literal("webrtc"),sdp:b.string().min(1)})}),h=new Map;function i(a){return"none"===a?{effort:a}:{...a?{effort:a}:{},summary:"auto"}}async function j(a){let{apiKey:b,model:e,effort:f}=a,g=`${e} ${f??"auto"}`,j=h.get(g);if(void 0!==j)return j;let k=i(f);for(;;){let a=await fetch("https://api.openai.com/v1/responses/input_tokens",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(c.LIVE_CALL.reasoningCheckMs),body:JSON.stringify({model:e,input:".",reasoning:k})}).catch(()=>null);if(!a)return k;let f=Object.keys(k).length?k:null;if(a.ok)return h.set(g,f),f;let i=await a.json().catch(()=>null),j=i?.error?.param?.replace(/^reasoning\./,"");if("effort"!==j&&"summary"!==j||!(j in k))return k;if(d.logger.warn(`${e} takes no reasoning ${j}; calls omit it`),delete k[j],!Object.keys(k).length)return h.set(g,null),null}}async function k(a){let b=await fetch("https://api.openai.com/v1/models",{headers:{Authorization:`Bearer ${a}`},signal:AbortSignal.timeout(c.LIVE_CALL.keyCheckMs)}).catch(()=>null);if(!b||401!==b.status&&403!==b.status)return null;let d=await b.json().catch(()=>null);return d?.error?.message?.trim()||`It answered ${b.status}.`}async function l(a){let b,h=await fetch("https://api.openai.com/v1/live/sessions",{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(c.LIVE_CALL.startupMs),body:JSON.stringify({session:{model:f.LIVE_MODEL,instructions:a.instructions,audio:{output:{voice:a.voice}},store:!1,delegation:{type:"responses",responses:{model:a.backend.model,instructions:a.backend.instructions,tools:[...a.backend.tools.map(a=>({type:"function",...a})),...a.backend.hosted.map(a=>f.LIVE_HOSTED_TOOLS[a].declare)],tool_choice:"auto",parallel_tool_calls:!0,max_output_tokens:c.LIVE_CALL.backendOutputTokens,...a.backend.reasoning?{reasoning:a.backend.reasoning}:{}}}},transport:{type:"webrtc",sdp:a.sdp}})}).catch(a=>{d.logger.warn("OpenAI Live unreachable",a),(0,e.publicError)("Could not reach OpenAI Live.")}),i=await h.text();try{b=JSON.parse(i)}catch{b=null}if(!h.ok){let a=b;(0,e.publicError)(a?.error?.message||i||`OpenAI Live refused the call (${h.status}).`)}let j=g.safeParse(b);return j.success||(0,e.publicError)("OpenAI Live returned an invalid session connection."),j.data}a.s(["acceptedReasoning",0,j,"createLiveCall",0,l,"keyRefusal",0,k,"wantedReasoning",0,i])}];
76
78
 
77
79
  //# sourceMappingURL=_128r03g._.js.map