thursday-agent 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/_not-found.html +1 -1
  13. package/.next/server/app/_not-found.rsc +12 -12
  14. package/.next/server/app/_not-found.segments/_full.segment.rsc +12 -12
  15. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +11 -11
  16. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  17. package/.next/server/app/api/artifact/route.js +9 -8
  18. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  19. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  20. package/.next/server/app/api/bot/memory/route.js +9 -8
  21. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  22. package/.next/server/app/api/bot/route.js +9 -8
  23. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  24. package/.next/server/app/api/bot/thread/[id]/route.js +7 -6
  25. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  26. package/.next/server/app/api/bot/thread/file/route.js +17 -16
  27. package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
  28. package/.next/server/app/api/bot/thread/route.js +8 -7
  29. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  30. package/.next/server/app/api/config/route.js +5 -4
  31. package/.next/server/app/api/config/route.js.nft.json +1 -1
  32. package/.next/server/app/api/events/route.js.nft.json +1 -1
  33. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  34. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  35. package/.next/server/app/api/llm-model/automatic/route.js +8 -7
  36. package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
  37. package/.next/server/app/api/llm-model/catalog/[provider]/route.js +8 -7
  38. package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -1
  39. package/.next/server/app/api/llm-model/credits/[provider]/route.js +8 -7
  40. package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -1
  41. package/.next/server/app/api/llm-model/route.js +9 -8
  42. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  43. package/.next/server/app/api/llm-model/subscription/route.js +9 -8
  44. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  45. package/.next/server/app/api/mcp/[name]/route.js +6 -5
  46. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  47. package/.next/server/app/api/mcp/oauth/callback/route.js +6 -5
  48. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  49. package/.next/server/app/api/mcp/route.js +6 -5
  50. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  51. package/.next/server/app/api/mcp/tools/route.js +6 -5
  52. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  53. package/.next/server/app/api/memory/edit/route.js +13 -12
  54. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  55. package/.next/server/app/api/memory/route.js +6 -5
  56. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  57. package/.next/server/app/api/reach/route.js +19 -18
  58. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  59. package/.next/server/app/api/routine/route.js +9 -8
  60. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  61. package/.next/server/app/api/running/route.js.nft.json +1 -1
  62. package/.next/server/app/api/signins/route.js +5 -4
  63. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  64. package/.next/server/app/api/skills/[source]/[name]/route.js +9 -8
  65. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  66. package/.next/server/app/api/skills/route.js +9 -8
  67. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  68. package/.next/server/app/api/thursday/call/end/route.js +6 -5
  69. package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
  70. package/.next/server/app/api/thursday/call/plan/route.js +15 -14
  71. package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
  72. package/.next/server/app/api/thursday/call/route.js +7 -6
  73. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  74. package/.next/server/app/api/thursday/settings/route.js +6 -5
  75. package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
  76. package/.next/server/app/api/thursday/text/route.js +17 -16
  77. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  78. package/.next/server/app/api/thursday/tool-call/route.js +15 -14
  79. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  80. package/.next/server/app/api/workspace/files/route.js +8 -7
  81. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  82. package/.next/server/app/api/workspace/route.js +9 -8
  83. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  84. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
  85. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  86. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  88. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  89. package/.next/server/app/page/react-loadable-manifest.json +15 -1
  90. package/.next/server/app/page/server-reference-manifest.json +63 -63
  91. package/.next/server/app/page.js.nft.json +1 -1
  92. package/.next/server/app/page_client-reference-manifest.js +1 -1
  93. package/.next/server/chunks/[root-of-the-server]__0-5d50l._.js +3 -0
  94. package/.next/server/chunks/[root-of-the-server]__005onk_._.js +3 -0
  95. package/.next/server/chunks/[root-of-the-server]__00dtf7h._.js +3 -0
  96. package/.next/server/chunks/[root-of-the-server]__00f051a._.js +7 -0
  97. package/.next/server/chunks/[root-of-the-server]__019e1fy._.js +2 -2
  98. package/.next/server/chunks/[root-of-the-server]__01jpmcj._.js +1 -1
  99. package/.next/server/chunks/[root-of-the-server]__0340k46._.js +7 -0
  100. package/.next/server/chunks/[root-of-the-server]__03bjojd._.js +1 -1
  101. package/.next/server/chunks/[root-of-the-server]__03vunn6._.js +1 -1
  102. package/.next/server/chunks/[root-of-the-server]__05fq824._.js +3 -0
  103. package/.next/server/chunks/[root-of-the-server]__06kxzw-._.js +1 -1
  104. package/.next/server/chunks/[root-of-the-server]__08922kg._.js +3 -0
  105. package/.next/server/chunks/[root-of-the-server]__0atwstu._.js +1 -1
  106. package/.next/server/chunks/[root-of-the-server]__0btxiu1._.js +3 -0
  107. package/.next/server/chunks/[root-of-the-server]__0d-dfqm._.js +1 -1
  108. package/.next/server/chunks/[root-of-the-server]__0gmxpev._.js +3 -0
  109. package/.next/server/chunks/[root-of-the-server]__0itmdqy._.js +3 -0
  110. package/.next/server/chunks/[root-of-the-server]__0m0qglo._.js +5 -0
  111. package/.next/server/chunks/[root-of-the-server]__0mh1tgg._.js +1 -1
  112. package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +1 -1
  113. package/.next/server/chunks/[root-of-the-server]__0ndw2yj._.js +1 -1
  114. package/.next/server/chunks/[root-of-the-server]__0sfx6id._.js +3 -0
  115. package/.next/server/chunks/[root-of-the-server]__0xn7a8p._.js +3 -0
  116. package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
  117. package/.next/server/chunks/[root-of-the-server]__1478lu3._.js +1 -1
  118. package/.next/server/chunks/[root-of-the-server]__16y0k92._.js +3 -0
  119. package/.next/server/chunks/[root-of-the-server]__17kdjf6._.js +1 -1
  120. package/.next/server/chunks/[root-of-the-server]__17m7ag9._.js +1 -1
  121. package/.next/server/chunks/[root-of-the-server]__19aqyg-._.js +1 -1
  122. package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +1 -1
  123. package/.next/server/chunks/[root-of-the-server]__1a0xgyh._.js +1 -1
  124. package/.next/server/chunks/[root-of-the-server]__1ceammd._.js +1 -1
  125. package/.next/server/chunks/{[root-of-the-server]__01y-8gg._.js → [root-of-the-server]__1clkgmj._.js} +3 -3
  126. package/.next/server/chunks/[root-of-the-server]__1dth047._.js +1 -1
  127. package/.next/server/chunks/[root-of-the-server]__1g08s7l._.js +5 -0
  128. package/.next/server/chunks/[root-of-the-server]__1huywqp._.js +1 -1
  129. package/.next/server/chunks/[root-of-the-server]__1ij4h2a._.js +3 -0
  130. package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
  131. package/.next/server/chunks/[root-of-the-server]__1o7z93z._.js +1 -1
  132. package/.next/server/chunks/[root-of-the-server]__1onvx8x._.js +1 -1
  133. package/.next/server/chunks/[root-of-the-server]__1q1s4ls._.js +3 -0
  134. package/.next/server/chunks/[root-of-the-server]__1qa67zs._.js +3 -0
  135. package/.next/server/chunks/[root-of-the-server]__1t-mfa4._.js +5 -0
  136. package/.next/server/chunks/[root-of-the-server]__20ofm9t._.js +3 -0
  137. package/.next/server/chunks/_0-qt5if._.js +1 -1
  138. package/.next/server/chunks/_02mn8d7._.js +1 -1
  139. package/.next/server/chunks/_03p6r2-._.js +1 -1
  140. package/.next/server/chunks/_0483t_f._.js +1 -1
  141. package/.next/server/chunks/_06b5b4-._.js +1 -1
  142. package/.next/server/chunks/_06u9yo-._.js +1 -1
  143. package/.next/server/chunks/_07pkeds._.js +1 -1
  144. package/.next/server/chunks/_08354bn._.js +21 -19
  145. package/.next/server/chunks/_09rtyfn._.js +93 -91
  146. package/.next/server/chunks/_0cq69mm._.js +1 -1
  147. package/.next/server/chunks/_0fau3ya._.js +1 -1
  148. package/.next/server/chunks/_0ggqpiz._.js +1 -1
  149. package/.next/server/chunks/_0gxz_1b._.js +1 -1
  150. package/.next/server/chunks/_0lcthk8._.js +1 -1
  151. package/.next/server/chunks/_0p27in2._.js +1 -1
  152. package/.next/server/chunks/_0ue8nq-._.js +1 -1
  153. package/.next/server/chunks/_0uv1gs1._.js +1 -1
  154. package/.next/server/chunks/_0wyh244._.js +21 -19
  155. package/.next/server/chunks/_0zwjr-g._.js +1 -1
  156. package/.next/server/chunks/_1-wp0r0._.js +1 -1
  157. package/.next/server/chunks/_11y8h29._.js +1 -1
  158. package/.next/server/chunks/_14xuq46._.js +93 -91
  159. package/.next/server/chunks/_17fjc-7._.js +5 -0
  160. package/.next/server/chunks/_1823_7a._.js +4 -4
  161. package/.next/server/chunks/_18z965x._.js +1 -1
  162. package/.next/server/chunks/_1ac33qw._.js +1 -1
  163. package/.next/server/chunks/_1cw6-rv._.js +3 -0
  164. package/.next/server/chunks/_1dcbwn-._.js +1 -1
  165. package/.next/server/chunks/_1evvnbp._.js +18 -0
  166. package/.next/server/chunks/_1gn2r2q._.js +15 -15
  167. package/.next/server/chunks/{_00lwnht._.js → _1hw1ujv._.js} +2 -2
  168. package/.next/server/chunks/_1icgbi8._.js +18 -0
  169. package/.next/server/chunks/{_0txk_9z._.js → _1jtvbp9._.js} +2 -2
  170. package/.next/server/chunks/_1ko5shz._.js +1 -1
  171. package/.next/server/chunks/_1ksyu6r._.js +1 -1
  172. package/.next/server/chunks/{_1ntwp1s._.js → _1mgzs18._.js} +1 -1
  173. package/.next/server/chunks/_1q42187._.js +4 -4
  174. package/.next/server/chunks/_1q6e56i._.js +15 -15
  175. package/.next/server/chunks/_1t43w6q._.js +1 -1
  176. package/.next/server/chunks/_1t8fv7b._.js +18 -0
  177. package/.next/server/chunks/_1tjwvoz._.js +1 -1
  178. package/.next/server/chunks/_1ufbxe1._.js +1 -1
  179. package/.next/server/chunks/_1uu4wjr._.js +1 -1
  180. package/.next/server/chunks/{_0q6gng9._.js → _1v4id5q._.js} +2 -2
  181. package/.next/server/chunks/{_07vwkt7._.js → _1v5qol2._.js} +2 -2
  182. package/.next/server/chunks/_1wg0cqo._.js +1 -1
  183. package/.next/server/chunks/_1wgae1c._.js +3 -0
  184. package/.next/server/chunks/_1x2xiyw._.js +1 -1
  185. package/.next/server/chunks/_1xps4ob._.js +3 -0
  186. package/.next/server/chunks/_201k0ah._.js +1 -1
  187. package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
  188. package/.next/server/chunks/features_bot_08z387_._.js +4 -4
  189. package/.next/server/chunks/node_modules_zod_v4_01bha1c._.js +60 -0
  190. package/.next/server/chunks/node_modules_zod_v4_0b99z6a._.js +60 -0
  191. package/.next/server/chunks/node_modules_zod_v4_0r3ybe4._.js +60 -0
  192. package/.next/server/chunks/node_modules_zod_v4_1t1yj1u._.js +60 -0
  193. package/.next/server/chunks/node_modules_zod_v4_1zz6lo1._.js +60 -0
  194. package/.next/server/chunks/ssr/[root-of-the-server]__0eloa6y._.js +5 -5
  195. package/.next/server/chunks/ssr/[root-of-the-server]__0jjj49d._.js +3 -0
  196. package/.next/server/chunks/ssr/[root-of-the-server]__0yyxgt2._.js +3 -0
  197. package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
  198. package/.next/server/chunks/ssr/[root-of-the-server]__203utm3._.js +3 -0
  199. package/.next/server/chunks/ssr/[root-of-the-server]__20t_4l2._.js +1 -1
  200. package/.next/server/chunks/ssr/_0-y08rv._.js +3 -0
  201. package/.next/server/chunks/ssr/_00buy3i._.js +162 -0
  202. package/.next/server/chunks/ssr/_014_wjp._.js +3 -0
  203. package/.next/server/chunks/ssr/_07m4ii5._.js +3 -0
  204. package/.next/server/chunks/ssr/_09a6bpd._.js +1 -1
  205. package/.next/server/chunks/ssr/{_1569s5b._.js → _0gn_i4s._.js} +2 -2
  206. package/.next/server/chunks/ssr/_0iuvjnw._.js +3 -0
  207. package/.next/server/chunks/ssr/_0j6rtjm._.js +6 -0
  208. package/.next/server/chunks/ssr/{_19u7y57._.js → _0ntol64._.js} +2 -2
  209. package/.next/server/chunks/ssr/_0ogkeu-._.js +3 -0
  210. package/.next/server/chunks/ssr/{_1h0hk_h._.js → _0t_e9rd._.js} +2 -2
  211. package/.next/server/chunks/ssr/{_1-zhg63._.js → _0u43zjx._.js} +2 -2
  212. package/.next/server/chunks/ssr/_0ux4i2m._.js +1 -1
  213. package/.next/server/chunks/ssr/{_1iix_k_._.js → _0xurp8n._.js} +2 -2
  214. package/.next/server/chunks/ssr/_10sc7ab._.js +3 -0
  215. package/.next/server/chunks/ssr/_12hdw8x._.js +22 -20
  216. package/.next/server/chunks/ssr/{_02ybodf._.js → _14nwim3._.js} +2 -2
  217. package/.next/server/chunks/ssr/{_2024r5e._.js → _16o81mn._.js} +2 -2
  218. package/.next/server/chunks/ssr/_1bfrntd._.js +2 -2
  219. package/.next/server/chunks/ssr/_1crszf7._.js +1 -1
  220. package/.next/server/chunks/ssr/_1e01b-_._.js +3 -0
  221. package/.next/server/chunks/ssr/{_0y0qnim._.js → _1gz4ov7._.js} +3 -3
  222. package/.next/server/chunks/ssr/_1neoj22._.js +2 -1
  223. package/.next/server/chunks/ssr/{_04ik9s8._.js → _1nfv27b._.js} +2 -2
  224. package/.next/server/chunks/ssr/_1nwey7a._.js +3 -0
  225. package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
  226. package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
  227. package/.next/server/chunks/ssr/features_bot_06n7hmd._.js +3 -0
  228. package/.next/server/chunks/ssr/features_bot_0tb4ui-._.js +1 -1
  229. package/.next/server/chunks/ssr/{_07nmtxo._.js → features_bot_1knyan7._.js} +2 -2
  230. package/.next/server/chunks/ssr/{features_config_1l7bn84._.js → features_config_09wq1s9._.js} +3 -3
  231. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  232. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  233. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  234. package/.next/server/chunks/ssr/features_thursday_0cf9y0b._.js +3 -0
  235. package/.next/server/chunks/ssr/features_thursday_components_ascii-orb_tsx_1yug8cw._.js +3 -0
  236. package/.next/server/chunks/ssr/features_thursday_components_here-globe_tsx_055duhw._.js +3 -0
  237. package/.next/server/chunks/ssr/{node_modules_1bj1zfp._.js → node_modules_01fukqn._.js} +1 -1
  238. package/.next/server/chunks/ssr/{node_modules_1r-1n7c._.js → node_modules_01v7ybp._.js} +1 -1
  239. package/.next/server/chunks/ssr/{node_modules_0f0lohc._.js → node_modules_0536cp2._.js} +1 -1
  240. package/.next/server/chunks/ssr/{node_modules_13iz-t6._.js → node_modules_056xgci._.js} +1 -1
  241. package/.next/server/chunks/ssr/{node_modules_1rnfv0r._.js → node_modules_06n6ruk._.js} +1 -1
  242. package/.next/server/chunks/ssr/{node_modules_1d5j3h5._.js → node_modules_08m1gvh._.js} +1 -1
  243. package/.next/server/chunks/ssr/{node_modules_1_j-et6._.js → node_modules_0_zk6yd._.js} +1 -1
  244. package/.next/server/chunks/ssr/{node_modules_0c1grmu._.js → node_modules_0cpegwf._.js} +1 -1
  245. package/.next/server/chunks/ssr/{node_modules_107249-._.js → node_modules_0e398ts._.js} +1 -1
  246. package/.next/server/chunks/ssr/{node_modules_0ja2eo8._.js → node_modules_0ie8g6a._.js} +2 -2
  247. package/.next/server/chunks/ssr/{node_modules_074pspl._.js → node_modules_0ksqeyy._.js} +1 -1
  248. package/.next/server/chunks/ssr/{node_modules_0ydatn4._.js → node_modules_0m-dnm-._.js} +1 -1
  249. package/.next/server/chunks/ssr/{node_modules_0eoqrzb._.js → node_modules_0m2oth3._.js} +1 -1
  250. package/.next/server/chunks/ssr/{node_modules_1b6sm1g._.js → node_modules_0yn2z6s._.js} +1 -1
  251. package/.next/server/chunks/ssr/{node_modules_0uuobx8._.js → node_modules_12hh0bx._.js} +1 -1
  252. package/.next/server/chunks/ssr/{node_modules_0q-53p6._.js → node_modules_13dwal5._.js} +1 -1
  253. package/.next/server/chunks/ssr/{node_modules_0efmaot._.js → node_modules_16tn8xu._.js} +1 -1
  254. package/.next/server/chunks/ssr/{node_modules_0x4geuk._.js → node_modules_19r9vjv._.js} +1 -1
  255. package/.next/server/chunks/ssr/{node_modules_0k9lm-f._.js → node_modules_1bvw77g._.js} +1 -1
  256. package/.next/server/chunks/ssr/{node_modules_1dgdpcc._.js → node_modules_1ctm_ju._.js} +1 -1
  257. package/.next/server/chunks/ssr/{node_modules_1oo6jfv._.js → node_modules_1dlue-g._.js} +1 -1
  258. package/.next/server/chunks/ssr/{node_modules_1sbozb5._.js → node_modules_1fqgrh0._.js} +1 -1
  259. package/.next/server/chunks/ssr/{node_modules_17eaxbw._.js → node_modules_1i-g3bz._.js} +1 -1
  260. package/.next/server/chunks/ssr/{node_modules_1b_78mo._.js → node_modules_1jf8aik._.js} +1 -1
  261. package/.next/server/chunks/ssr/{node_modules_0vva828._.js → node_modules_1kfbdfo._.js} +1 -1
  262. package/.next/server/chunks/ssr/{node_modules_0lu90ps._.js → node_modules_1zalmtr._.js} +1 -1
  263. package/.next/server/chunks/ssr/{node_modules_1qgte25._.js → node_modules_1zdz2zf._.js} +1 -1
  264. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0obor-y._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0nj1l8f._.js} +1 -1
  265. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0oip1-o._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_17ok98u._.js} +1 -1
  266. package/.next/server/middleware-build-manifest.js +3 -3
  267. package/.next/server/pages/404.html +1 -1
  268. package/.next/server/pages/500.html +1 -1
  269. package/.next/server/server-reference-manifest.js +1 -1
  270. package/.next/server/server-reference-manifest.json +64 -64
  271. package/.next/static/chunks/01r1uco3ikisc.js +2 -0
  272. package/.next/static/chunks/{33s9l7hkzyylm.js → 052u13mcoxt87.js} +1 -1
  273. package/.next/static/chunks/{023rfhzsxzhh1.js → 05blzta_1i7c2.js} +1 -1
  274. package/.next/static/chunks/09kwsjbmr_z1w.js +1 -0
  275. package/.next/static/chunks/0go5_9zqag7l0.js +1 -0
  276. package/.next/static/chunks/0hpx0--bh7vld.js +1 -0
  277. package/.next/static/chunks/0o0vshni5ny91.js +1 -0
  278. package/.next/static/chunks/0ynv7zu_bguve.js +1 -0
  279. package/.next/static/chunks/0zi59tghmg1lu.js +18 -0
  280. package/.next/static/chunks/1_ftsgxa-sia_.js +1 -0
  281. package/.next/static/chunks/1cg3torc90q5t.js +1 -0
  282. package/.next/static/chunks/{3zhqveam0_kub.js → 1dy5xaxjdsy11.js} +1 -1
  283. package/.next/static/chunks/1qnx1h5c8f93b.js +1 -0
  284. package/.next/static/chunks/1rwn3d9ji5w35.js +1 -0
  285. package/.next/static/chunks/{1tyxz6thgf2w6.js → 1so3f5fi7e5g9.js} +1 -1
  286. package/.next/static/chunks/1ya41wxfmp4s8.js +1 -0
  287. package/.next/static/chunks/27rwkfu7_xvs1.js +4 -0
  288. package/.next/static/chunks/2hueh8masqd91.js +15 -0
  289. package/.next/static/chunks/2jrt_752fqz2f.js +1 -0
  290. package/.next/static/chunks/{3fcnfq383hu-y.js → 2nbj2t9yp8ke9.js} +1 -1
  291. package/.next/static/chunks/2ogme4qydxnaq.js +3 -0
  292. package/.next/static/chunks/2r2tocw2rpvm2.js +1 -0
  293. package/.next/static/chunks/2t4kimg1lt-p7.js +2 -0
  294. package/.next/static/chunks/2w6y71o27my_z.js +1 -0
  295. package/.next/static/chunks/{2-2ts24vi9ete.js → 3146sccz1j76i.js} +1 -1
  296. package/.next/static/chunks/31_am8rtmk_tv.css +1 -0
  297. package/.next/static/chunks/{41iv7b8_3z92h.js → 35ehi-okrfot5.js} +1 -1
  298. package/.next/static/chunks/3866u-edsoyj3.js +1 -0
  299. package/.next/static/chunks/3drvp6w6dqzqg.js +1 -0
  300. package/.next/static/chunks/3qfhjwd9yuijo.js +1 -0
  301. package/.next/static/chunks/{3axovmkkuh1us.js → 3tyacy8fh5_18.js} +2 -2
  302. package/.next/static/chunks/3zv4wiqjl5kex.js +1 -0
  303. package/guide/bots.md +25 -5
  304. package/guide/calls.md +18 -9
  305. package/guide/setup.md +15 -4
  306. package/guide/trouble.md +2 -3
  307. package/package.json +1 -1
  308. package/public/here/NOTICE +43 -0
  309. package/public/here/world.json +1 -0
  310. package/skills/README.md +4 -0
  311. package/skills/artifact/SKILL.md +7 -6
  312. package/skills/artifact/references/motion.md +150 -0
  313. package/skills/artifact/runtime/motion/film.js +866 -0
  314. package/skills/artifact/runtime/motion/fonts/Gaegu-Bold.woff2 +0 -0
  315. package/skills/artifact/runtime/motion/fonts/OFL.txt +92 -0
  316. package/skills/artifact/runtime/motion/kit-core.js +699 -0
  317. package/skills/artifact/runtime/motion/kit-people.js +1305 -0
  318. package/skills/artifact/runtime/motion/kit-places.js +854 -0
  319. package/skills/artifact/runtime/motion/kit-things.js +903 -0
  320. package/skills/artifact/runtime/motion/motion.html +108 -0
  321. package/skills/artifact/runtime/motion/page.mjs +54 -0
  322. package/skills/artifact/runtime/motion/score.js +625 -0
  323. package/skills/artifact/scripts/book-video.mjs +1 -46
  324. package/skills/artifact/scripts/media.mjs +74 -0
  325. package/skills/artifact/scripts/motion.mjs +605 -0
  326. package/skills/artifact/templates/motion/birthday.js +182 -0
  327. package/skills/browser/SKILL.md +4 -1
  328. package/skills/browser/scripts/serve.mjs +26 -3
  329. package/skills/browser/scripts/session.mjs +12 -3
  330. package/.next/server/chunks/[root-of-the-server]__0-fn06g._.js +0 -3
  331. package/.next/server/chunks/[root-of-the-server]__03lc17t._.js +0 -3
  332. package/.next/server/chunks/[root-of-the-server]__06nspyt._.js +0 -3
  333. package/.next/server/chunks/[root-of-the-server]__09c88lb._.js +0 -3
  334. package/.next/server/chunks/[root-of-the-server]__09dxfp5._.js +0 -3
  335. package/.next/server/chunks/[root-of-the-server]__0_0w3ug._.js +0 -3
  336. package/.next/server/chunks/[root-of-the-server]__0ap1nbu._.js +0 -5
  337. package/.next/server/chunks/[root-of-the-server]__0bmtib_._.js +0 -7
  338. package/.next/server/chunks/[root-of-the-server]__0im1m7z._.js +0 -3
  339. package/.next/server/chunks/[root-of-the-server]__0mt72qk._.js +0 -7
  340. package/.next/server/chunks/[root-of-the-server]__0uj9rm-._.js +0 -3
  341. package/.next/server/chunks/[root-of-the-server]__0z5n9xz._.js +0 -5
  342. package/.next/server/chunks/[root-of-the-server]__16e_e0e._.js +0 -5
  343. package/.next/server/chunks/[root-of-the-server]__16gn7zn._.js +0 -3
  344. package/.next/server/chunks/[root-of-the-server]__18k8s-z._.js +0 -3
  345. package/.next/server/chunks/[root-of-the-server]__1aw-1kd._.js +0 -3
  346. package/.next/server/chunks/[root-of-the-server]__1kmnkbk._.js +0 -3
  347. package/.next/server/chunks/[root-of-the-server]__1op8qe5._.js +0 -3
  348. package/.next/server/chunks/[root-of-the-server]__1pkq_1z._.js +0 -3
  349. package/.next/server/chunks/[root-of-the-server]__20w_g71._.js +0 -3
  350. package/.next/server/chunks/_01c32w9._.js +0 -75
  351. package/.next/server/chunks/_02bov6_._.js +0 -75
  352. package/.next/server/chunks/_053bi70._.js +0 -60
  353. package/.next/server/chunks/_08s4vft._.js +0 -75
  354. package/.next/server/chunks/_0fb6dvr._.js +0 -75
  355. package/.next/server/chunks/_0iw19ig._.js +0 -75
  356. package/.next/server/chunks/_0mo_6or._.js +0 -5
  357. package/.next/server/chunks/_0poi1t2._.js +0 -75
  358. package/.next/server/chunks/_1d7og_q._.js +0 -75
  359. package/.next/server/chunks/_1o3fc2d._.js +0 -60
  360. package/.next/server/chunks/_20zp65o._.js +0 -60
  361. package/.next/server/chunks/ssr/[root-of-the-server]__03e9zqg._.js +0 -3
  362. package/.next/server/chunks/ssr/[root-of-the-server]__1hbvuqr._.js +0 -3
  363. package/.next/server/chunks/ssr/[root-of-the-server]__1y8_-v1._.js +0 -3
  364. package/.next/server/chunks/ssr/_00_9573._.js +0 -3
  365. package/.next/server/chunks/ssr/_03vw3u5._.js +0 -3
  366. package/.next/server/chunks/ssr/_0iwsdp7._.js +0 -3
  367. package/.next/server/chunks/ssr/_0llhg-6._.js +0 -3
  368. package/.next/server/chunks/ssr/_0o__2ss._.js +0 -3
  369. package/.next/server/chunks/ssr/_0pbav_w._.js +0 -3
  370. package/.next/server/chunks/ssr/_0yjn4jm._.js +0 -162
  371. package/.next/server/chunks/ssr/_186ifln._.js +0 -3
  372. package/.next/server/chunks/ssr/_1x4lhpf._.js +0 -3
  373. package/.next/server/chunks/ssr/_1xfiate._.js +0 -5
  374. package/.next/server/chunks/ssr/features_bot_1dvvmo3._.js +0 -3
  375. package/.next/server/chunks/ssr/features_thursday_0gbh5j_._.js +0 -3
  376. package/.next/static/chunks/06k2o5zxc3xhv.js +0 -1
  377. package/.next/static/chunks/0_s4z70lx1tgs.js +0 -1
  378. package/.next/static/chunks/0cbitatnyjhz7.js +0 -1
  379. package/.next/static/chunks/0m5-0kx85axzv.js +0 -18
  380. package/.next/static/chunks/0non225e2mzp-.js +0 -1
  381. package/.next/static/chunks/0q9b2n6l4flqb.js +0 -1
  382. package/.next/static/chunks/0uhddock-ik4v.js +0 -1
  383. package/.next/static/chunks/14y1gqfplan8a.js +0 -1
  384. package/.next/static/chunks/1pidafhkyxhqw.js +0 -1
  385. package/.next/static/chunks/1sy7zm5dplzym.css +0 -1
  386. package/.next/static/chunks/1t7u4xfljptkv.js +0 -1
  387. package/.next/static/chunks/2nf3mskfp9cyc.js +0 -15
  388. package/.next/static/chunks/2uraofiaoy32s.js +0 -1
  389. package/.next/static/chunks/2vw9_trh_ntv6.js +0 -2
  390. package/.next/static/chunks/2x6-fpctvucte.js +0 -1
  391. package/.next/static/chunks/33lm6ytc816te.js +0 -1
  392. package/.next/static/chunks/3p5q6rj40jmcy.js +0 -1
  393. package/.next/static/chunks/3p80hsvcabgw_.js +0 -3
  394. package/.next/static/chunks/3qez_j23ikyar.js +0 -1
  395. /package/.next/static/{gx61wKkj9_eBGMdyfbBlr → 8exfHAtcoebYtxjUC4ugl}/_buildManifest.js +0 -0
  396. /package/.next/static/{gx61wKkj9_eBGMdyfbBlr → 8exfHAtcoebYtxjUC4ugl}/_clientMiddlewareManifest.js +0 -0
  397. /package/.next/static/{gx61wKkj9_eBGMdyfbBlr → 8exfHAtcoebYtxjUC4ugl}/_ssgManifest.js +0 -0
@@ -1,16 +1,16 @@
1
- module.exports=[884780,a=>{"use strict";a.i(902157),a.i(912714);var b=a.i(750227),c=a.i(569572);(0,b.join)(c.APP_DIR,"guide");let d=".guide";a.s(["botGuideLine",0,()=>`How ${c.APP_NAME} itself works for the user — its screens and settings — is written under \`${d}/\` here, \`index.md\` first; read it only when the job is about the app.`,"guideLine",0,()=>`How ${c.APP_NAME} works for the person using it — its screens, its settings, what it connects to, what to do when something stops — is written under \`${d}/\` here, \`index.md\` first. Read it whenever an answer depends on how the app works: what can be asked for, where something is changed, a wish that needs a setting switched on, something that stopped or was refused. Answer from it rather than from what you assume.`])},738131,a=>a.a(async(b,c)=>{try{var d=a.i(527990),e=a.i(868468),f=a.i(569572),g=a.i(875931),h=a.i(938934),i=a.i(978876),j=a.i(375827),k=a.i(127507),l=a.i(467650),m=a.i(138902),n=a.i(345846),o=a.i(617594),p=a.i(622547),q=a.i(128232),r=a.i(382442),s=a.i(451017),t=a.i(762008),u=a.i(547613),v=a.i(446957),w=a.i(138100),x=a.i(821415),y=a.i(706210),z=a.i(176668),A=a.i(293480),B=a.i(987674),C=a.i(182248),D=b([g,i,m,n,o,p,q,s,w]);async function E(b){let{listThreadOverview:c}=await a.A(343064),d=await c();if(!d.length)return"No thread has been started yet.";let e=d.map(a=>`"${a.label}" (${a.bot}, ${a.status})`).join(", ");return`There is no thread called "${b}". The latest are: ${e}. Call again with one of those labels.`}async function F(a,b){let c=[];for(let[a,e]of Object.entries(b)){let b=await (0,d.asSchema)(e.inputSchema).jsonSchema,f="string"==typeof e.description?e.description:"";c.push({name:a,tokens:(0,B.estimateTokens)(f)+(0,B.estimateTokens)(JSON.stringify(b))})}c.sort((a,b)=>b.tokens-a.tokens);let e=c.reduce((a,b)=>a+b.tokens,0);z.logger.debug(`${a} tools ${e} tokens over ${c.length} — ${c.map(a=>`${a.name} ${a.tokens}`).join(", ")}`)}async function G(a){let b=await H(a);return f.IS_DEV&&await F(a.target,b),b}async function H(b){if("memory-edit"===b.target)return(0,n.createMemoryTools)("user",null,{countReads:!1});let c=(0,n.createMemoryTools)("call","thursday"===b.target?b.callId??null:null),z=await (0,x.openWorkspace)();if("thursday"===b.target){var B;let k,m,n=b.readSkills?(0,s.createSkillTools)({sandbox:z,skills:await (0,w.loadSkills)(z)}):{},q=!!(b.written&&b.model&&(0,g.seesToolImages)(b.model));return{...c,...n,...(0,u.createWorkspaceTools)(z,{write:!1,timeoutMs:f.CALL_EXEC_TIMEOUT_MS}),...!1===b.webSearch?{}:await (0,p.createCallSearchTool)(z),...Object.fromEntries(Object.entries((B=b.callId,k=async b=>{let{resolveThread:c}=await a.A(343064);return(b.trim()?await c(b.trim()):null)??await E(b)},m=async(b,c,d)=>{let e=await a.A(763543);try{return await e.answerThread(b,c,"thursday",d)}catch(a){if((0,A.isPublicError)(a))return a.message;throw a}},{[t.TOOL_NAMES.thread_start]:(0,d.tool)({description:i.threadStartSpec.description,inputSchema:i.threadStartSpec.parameters,execute:async({bot:b,request:c,label:d})=>{let{findJobBot:e,listJobBots:f}=await a.A(276307),g=await e(b);if(!g||g.disabled){let a=(await f()).map(a=>a.name);return`There is no bot called "${b}". The bots are: ${a.join(", ")}. Nothing was started — call again with one of those.`}let{startThread:h}=await a.A(763543);return{threadId:await h({bot:g.name,request:c,label:d,callId:B,from:"thursday"}),bot:g.name,label:d,note:`${g.name} has "${d}". Its updates reach the conversation on their own. Anything further about this work — a correction, the next step once it finishes — is \`${t.TOOL_NAMES.thread_tell}\` with "${d}"; a question it asks is answered with \`${t.TOOL_NAMES.thread_answer}\`.`}}}),[t.TOOL_NAMES.thread_tell]:(0,d.tool)({description:i.threadTellSpec.description,inputSchema:i.threadTellSpec.parameters,execute:async({thread:a,words:b})=>{let c=await k(a);if("string"==typeof c)return c;if(!b.trim())return"Say what to pass on.";let d=await m(c.id,b.trim());return"string"==typeof d?d:d?.answered?{label:c.label,answered:d.answered,note:`${d.answered.bot} was waiting on a question, and took this as its answer.`}:{label:c.label,bot:d?.to??c.bot,status:"running",note:"running"===c.status?"The bot reads it before its next step.":"The bot picks the thread back up from there."}}}),[t.TOOL_NAMES.thread_answer]:(0,d.tool)({description:i.threadAnswerSpec.description,inputSchema:i.threadAnswerSpec.parameters,execute:async({thread:b,bot:c,answer:d})=>{let e=await k(b);if("string"==typeof e)return e;if(!d.trim())return"Say what the answer is.";let{findThreadView:f}=await a.A(343064),g=(await f(e.id))?.room.questions??[],h=g.find(a=>a.bot.toLowerCase()===c.trim().toLowerCase());if(!h)return g.length?`${c} is not asking anything in "${e.label}". Waiting there: ${g.map(a=>a.bot).join(", ")}. Call again with that bot.`:`No question is waiting in "${e.label}". To say something else to it, use \`${t.TOOL_NAMES.thread_tell}\`.`;let i=await m(e.id,d.trim(),h.bot);return"string"==typeof i?i:{label:e.label,answered:i?.answered??{bot:h.bot,question:h.text},note:`${h.bot} has the answer to its question and goes on from it.`}}}),[t.TOOL_NAMES.thread_status]:(0,d.tool)({description:i.threadStatusSpec.description,inputSchema:i.threadStatusSpec.parameters,execute:async({thread:b})=>{let{listThreadOverview:c,findThreadView:d}=await a.A(343064),g={now:(0,h.clockNow)()},i=a=>(0,e.formatDistanceToNowStrict)((0,y.toDate)(a),{addSuffix:!0});if(!(!b.trim()||"all"===b.trim().toLowerCase())){let a=await k(b);if("string"==typeof a)return a;let c=(await d(a.id))?.room;return{...g,label:a.label,id:a.id,bot:a.bot,participants:c?.participants??[],questions:c?.questions??[],status:a.status,since:i(a.updatedAt),outcome:a.outcome,..."waiting"===a.status&&a.pending?.options.length?{options:a.pending.options}:{}}}let j=await c();return j.length?{...g,threads:j.map(a=>({id:a.id,label:a.label,bot:a.bot,status:a.status,participants:a.room.participants,questions:a.room.questions.map(a=>({...a,text:(0,C.clip)(a.text,f.PROMPT_LINE.threadStatus)})),since:i(a.updatedAt),...a.ask?{asking:a.ask.question,options:a.ask.options}:{},..."running"===a.status?{now:(0,v.threadActivity)(a.lines)}:{},...a.outcome&&"waiting"!==a.status?{outcome:(0,C.clip)(a.outcome,f.PROMPT_LINE.threadStatus)}:{}}))}:"No thread has been started yet."}}),[t.TOOL_NAMES.thread_cancel]:(0,d.tool)({description:i.threadCancelSpec.description,inputSchema:i.threadCancelSpec.parameters,execute:async({thread:b})=>{let c=await k(b);if("string"==typeof c)return c;let{cancelThread:d}=await a.A(763543);return await d(c.id),{label:c.label,status:"cancelled"}}}),[t.TOOL_NAMES.thread_show]:(0,d.tool)({description:i.threadShowSpec.description,inputSchema:i.threadShowSpec.parameters,execute:async({thread:b})=>{let c=await k(b);if("string"==typeof c)return c;let{appEvents:d}=await a.A(133300),{filesOnDisk:e}=await a.A(122690),{leadFirst:f,pathsIn:g,viewKindOf:h}=await a.A(394298),i=(await e(g(c.outcome??""),null)).filter(a=>"none"!==h(a));if(!i.length)return d.emit({type:"showThread",threadId:c.id}),{label:c.label,showing:"the thread"};let j=f(i);d.emit({type:"showFile",paths:j});let{markSeen:l}=await a.A(343064);return await l([c.id]),{label:c.label,showing:j[0]}}}),[t.TOOL_NAMES.thread_seen]:(0,d.tool)({description:i.threadSeenSpec.description,inputSchema:i.threadSeenSpec.parameters,execute:async({thread:b})=>{let c=await k(b);if("string"==typeof c)return c;let{markSeen:d}=await a.A(343064);return await d([c.id]),{label:c.label,seen:!0}}})})).filter(([a])=>!(b.phone&&a===t.TOOL_NAMES.thread_show))),...(0,o.createRoutineTools)(),...q?(0,l.createLookTool)():{},...b.written?{}:(0,j.callTools)()}}let D=await (0,w.loadSkills)(z,b.bot),F={...(0,x.jobShellEnv)(b.session),...(0,x.botShellEnv)(b.bot,(await (await a.A(276307)).findJobBot(b.bot))?.icon)},G=!!(b.model&&(0,g.seesToolImages)(b.model.ref));return{[t.TOOL_NAMES.memory_recall]:(0,n.createMemoryTools)("call",null,{tidies:!1})[t.TOOL_NAMES.memory_recall],...await (0,p.createSearchTool)(b.model,z),...(0,u.createWorkspaceTools)(z,{write:!0,env:F,guide:!0,bot:b.bot}),...await (0,m.createMcpTools)(b.bot,z),...(0,s.createSkillTools)({sandbox:z,skills:D,bot:b.bot}),...await (0,q.createSelfTools)(b.bot),...(0,k.createDeckTools)(z,b.bot,F,G),...G?(0,l.createLookTool)():{},...(0,r.createSignInTools)(z,b.bot,(0,x.jobShellEnv)(b.session)),...await (0,i.createThreadRecallTool)(b.bot,b.thread??null)}}[g,i,m,n,o,p,q,s,w]=D.then?(await D)():D,a.s(["loadTools",0,G]),c()}catch(a){c(a)}},!1),822164,a=>a.a(async(b,c)=>{try{a.i(569572);var d=a.i(725466),e=a.i(176668),f=a.i(293480),g=a.i(689656),h=b([d]);[d]=h.then?(await h)():h;let k={"x-ai":"spacexai","z-ai":"zai",mistralai:"mistral","meta-llama":"meta",qwen:"alibaba","bytedance-seed":"bytedance"},l=a=>{let b=a.slice(0,a.indexOf("/")).replace(/^~/,"");return k[b]??b};function i(a){if(null==a||""===a)return null;let b=Number(a);return!Number.isFinite(b)||b<0?null:Math.round(1e6*b*1e4)/1e4}async function j(){let a=await fetch("https://openrouter.ai/api/v1/models",{headers:{accept:"application/json"}}).catch(a=>{e.logger.warn({cause:a},"openrouter catalog unreachable"),(0,f.publicError)("Could not reach OpenRouter")});return a.ok||(0,f.publicError)(`OpenRouter answered ${a.status}`),((await a.json()).data??[]).filter(a=>!!a.id).map(a=>{let b,c,d,e;return{id:a.id,label:a.name||a.id,owner:l(a.id),type:(a.architecture?.output_modalities??[]).includes("text")?g.CATALOG_TEXT:null,tags:(a.supported_parameters??[]).includes("tools")?[g.CATALOG_TOOL_USE]:[],price:(b=i(a.pricing?.prompt),c=i(a.pricing?.completion),0===b&&0===c?{in:0,out:0,note:null,free:!0}:{in:b,out:c,note:null===b&&null===c?"per model it picks":null,free:!1}),retiring:!!a.expiration_date,contextWindow:"number"==typeof a.context_length&&a.context_length>0?a.context_length:null,efforts:(d=a.reasoning?.supported_efforts??[],(e=g.EFFORTS.filter(a=>d.includes(a))).length?e:null)}})}a.s(["fetchOpenRouterCatalog",0,j,"vendorOf",0,l]),c()}catch(a){c(a)}},!1),875931,a=>a.a(async(b,c)=>{try{var d=a.i(938537),e=a.i(674861),f=a.i(606016),g=a.i(388319),h=a.i(538177),i=a.i(767071),j=a.i(140358),k=a.i(873739),l=a.i(899042),m=a.i(345364),n=a.i(434451),o=a.i(655819),p=a.i(272380),q=a.i(652685),r=a.i(156956),s=a.i(47919),t=a.i(569572),u=a.i(688034),v=a.i(725466),w=a.i(176668),x=a.i(293480),y=a.i(182248),z=a.i(652619),A=a.i(689656),B=a.i(822164),C=b([v,z,B]);[v,z,B]=C.then?(await C)():C;let Q=/context[ _-]?(length|window)|maximum context|prompt is too long|too many (input )?tokens|input token count|exceeds? the (maximum|model'?s?) (context|input|prompt|number of tokens)|maximum prompt length|request (entity )?too large/i;function D(a){return E(a).some(a=>{let{statusCode:b,message:c,error:d}=a;if(void 0!==b&&400!==b&&413!==b)return!1;let e=q.APICallError.isInstance(a)?a.responseBody:null;return[c,d,e].some(a=>"string"==typeof a&&Q.test(a))})}let R=new Set([408,409,429]);function E(a){let b=[],c=[a];for(;c.length&&b.length<12;){let a=c.shift();!("object"!=typeof a||null===a||b.includes(a))&&(b.push(a),s.RetryError.isInstance(a)&&c.push(...a.errors),"cause"in a&&c.push(a.cause))}return b}let S=(a,b)=>({ref:a,model:b,searchTools:null}),T={};function F(a){if(null==a||""===a)return null;let b=Number(a);return Number.isFinite(b)?Math.round(1e6*b*1e4)/1e4:null}async function G(a){let b=T[a];if(b&&Date.now()-b.at<t.CATALOG_MS)return b.models;let c=("openrouter"===a?await (0,B.fetchOpenRouterCatalog)():await H()).sort((a,b)=>a.id.localeCompare(b.id));return T[a]={at:Date.now(),models:c},c}async function H(){let a=await fetch("https://ai-gateway.vercel.sh/v1/models",{headers:{accept:"application/json"}}).catch(a=>{w.logger.warn({cause:a},"gateway catalog unreachable"),(0,x.publicError)("Could not reach the gateway")});return a.ok||(0,x.publicError)(`The gateway answered ${a.status}`),((await a.json()).data??[]).filter(a=>!!a.id).map(a=>{let b,c;return{id:a.id,label:a.name||a.id,owner:a.owned_by||a.id.slice(0,a.id.indexOf("/")),type:a.type??null,tags:a.tags??[],price:function(a){let b=a.pricing??{},c=F(b.input),d=F(b.output);if((a.tags??[]).includes("free")||0===c)return{in:0,out:0,note:null,free:!0};let e=b.transcription_duration_cost_per_second??b.realtime_session_duration_cost_per_second;if(e)return{in:null,out:null,note:`$${e}/s`,free:!1};if(b.speech_input_character_cost)return{in:null,out:null,note:"per character",free:!1};let f=Array.isArray(b.video_duration_pricing)?b.video_duration_pricing[0]:null;if(f?.cost_per_second)return{in:null,out:null,note:`$${f.cost_per_second}/s ${f.resolution??""}`.trimEnd(),free:!1};let g=b.image?`$${b.image}/image`:b.image_dimension_quality_pricing?"per image, by size":null;return null===c&&null===d?{in:null,out:null,note:g,free:!1}:{in:c,out:d,note:b.input_tiers?"tiered":b.varies_by_provider?"varies":g&&"+ per image",free:!1}}(a),retiring:!!a.deprecated_at,contextWindow:"number"==typeof a.context_window&&a.context_window>0?a.context_window:null,efforts:(b=(a.reasoning_options??[]).find(a=>a?.type==="effort"),(c=A.EFFORTS.filter(a=>b?.values?.includes(a))).length?c:null)}})}async function I(a,b){if(b&&b>0)return b;let c=await J(a);return(0,A.compactAtFor)((0,A.contextWindowOf)(a.provider,a.model,c))}async function J(a){return(0,A.isCatalogProvider)(a.provider)?await G(a.provider).catch(()=>[]):[]}async function K(a,b){let c=b??A.effortSchema.safeParse(await (0,v.readConfig)(u.DEFAULT_EFFORT_KEY)).data;if(!c)return;let d=await J(a);return(0,A.effortsOf)(a.provider,a.model,d)?.includes(c)?c:void 0}async function L(a){return await G(a).then(a=>new Set(a.map(a=>a.id))).catch(()=>null)}async function M(a,b){if(!(0,A.isCatalogProvider)(a))return b;let c=await L(a);if(!c)return b;let d=b.filter(a=>c.has(a.id));return d.length>0?d:b}async function N(a){let{label:b,apiKeyName:c,signIn:q}=A.TEXT_MODEL_PROVIDERS[a.provider],t=await (0,v.readConfig)(c);return t||(0,x.publicError)(await (0,v.missingKeyWords)(c,q?`${b} is not signed in — sign in from Settings › API keys.`:`No ${b} key — add one in Settings › API keys.`)),function(a,b){switch(a.provider){case"openai":{let c=(0,m.createOpenAI)({apiKey:b});return{ref:a,model:c(a.model),searchTools:{search:c.tools.webSearch()}}}case"chatgpt":return{ref:a,model:(0,z.chatGptModel)(a.model),searchTools:{search:(0,z.chatGptSearch)()}};case"anthropic":{let c=(0,d.createAnthropic)({apiKey:b});return{ref:a,model:c(a.model),searchTools:{search:c.tools.webSearch_20260209()}}}case"google":{let c=(0,j.createGoogleGenerativeAI)({apiKey:b});return{ref:a,model:c(a.model),searchTools:{search:c.tools.googleSearch({})}}}case"xai":{let c=(0,o.createXai)({apiKey:b});return{ref:a,model:c(a.model),searchTools:{search:c.tools.webSearch()}}}case"mistral":return S(a,(0,l.createMistral)({apiKey:b})(a.model));case"deepseek":return S(a,(0,h.createDeepSeek)({apiKey:b})(a.model));case"groq":return S(a,(0,k.createGroq)({apiKey:b})(a.model));case"cerebras":return S(a,(0,e.createCerebras)({apiKey:b})(a.model));case"togetherai":return S(a,(0,n.createTogetherAI)({apiKey:b})(a.model));case"fireworks":return S(a,(0,i.createFireworks)({apiKey:b})(a.model));case"deepinfra":return S(a,(0,g.createDeepInfra)({apiKey:b})(a.model));case"cohere":return S(a,(0,f.createCohere)({apiKey:b})(a.model));case"vercel-ai-gateway":{let c=(0,r.createGateway)({apiKey:b});return{ref:a,model:c(a.model),searchTools:null}}case"openrouter":{var c;let d=(0,p.createOpenRouter)({apiKey:b});return{ref:a,model:(c=d(a.model),(0,s.wrapLanguageModel)({model:c,middleware:{specificationVersion:"v4",transformParams:async({params:a})=>a.reasoning&&"provider-default"!==a.reasoning?{...a,providerOptions:{...a.providerOptions,openrouter:{...a.providerOptions?.openrouter,reasoning:{effort:a.reasoning}}}}:a}})),searchTools:{search:d.tools.webSearch({})}}}default:(0,x.publicError)(`Not supported provider: ${String(a.provider)}`)}}(a,t)}async function O(a,{quiet:b=!1}={}){let c=async a=>(0,A.defaultModelOf)({defaultTier:"chatgpt"===a.id&&await (0,z.readChatGptPlan)()==="free"?"small":a.defaultTier,suggestModels:await M(a.id,a.suggestModels)}),d=a?A.TEXT_MODEL_PROVIDER_LIST.find(b=>b.id===a):void 0,e=["chatgpt","openai","xai"].map(a=>({...A.TEXT_MODEL_PROVIDERS[a],id:a}));if(d){let a=await c(d);if(a)return{provider:d.id,model:a}}let f=(0,A.parseTextModel)(await (0,v.readConfig)(u.DEFAULT_MODEL_KEY)??void 0);if(f){let{label:a,apiKeyName:b,signIn:c}=A.TEXT_MODEL_PROVIDERS[f.provider];if(await (0,v.readConfig)(b))return f;(0,x.publicError)(await (0,v.missingKeyWords)(b,c?`The default model is ${f.model} on ${a}, which is signed out — sign in again, or pick another in Settings › Models.`:`The default model is ${f.model}, and there is no ${a} key any more — add it in Settings › API keys, or pick another in Settings › Models.`))}for(let a of[...e,...A.TEXT_MODEL_PROVIDER_LIST]){if(!await (0,v.readConfig)(a.apiKeyName))continue;let d=await c(a);if(d)return b||w.logger.info(`no model set, falling back to ${a.id}/${d}`),{provider:a.id,model:d}}(0,x.publicError)("No model key is set — add one in Settings › API keys.")}async function P(a){let b=(0,A.parseMediaModel)(await (0,v.readConfig)(u.MEDIA_MODEL_KEYS[a]));if(!b){let b=await (0,v.readConfig)(A.MEDIA_MODEL_PROVIDERS.chatgpt.apiKeyName),c=b?(0,A.planMediaOf)(a,{plan:await (0,z.readChatGptPlan)()}):null;return c&&b?{ref:c,apiKey:b}:null}if(!(0,A.canMakeKind)(b.provider,a))return null;let c=await (0,v.readConfig)(A.MEDIA_MODEL_PROVIDERS[b.provider].apiKeyName);return c?{ref:b,apiKey:c}:null}a.s(["buildImageModel",0,function(a,b){switch(a.provider){case"openai":return(0,m.createOpenAI)({apiKey:b}).image(a.model);case"chatgpt":return(0,z.chatGptImageModel)(a.model);case"google":return(0,j.createGoogleGenerativeAI)({apiKey:b}).image(a.model);case"xai":return(0,o.createXai)({apiKey:b}).image(a.model);case"vercel-ai-gateway":return(0,r.createGateway)({apiKey:b}).image(a.model);default:(0,x.publicError)(`Not supported image provider: ${String(a.provider)}`)}},"buildSpeechModel",0,function(a,b){switch(a.provider){case"openai":return(0,m.createOpenAI)({apiKey:b}).speech(a.model);case"google":return(0,j.createGoogleGenerativeAI)({apiKey:b}).speech(a.model);case"xai":return(0,o.createXai)({apiKey:b}).speech();case"vercel-ai-gateway":return(0,r.createGateway)({apiKey:b}).speech(a.model);default:(0,x.publicError)(`Not supported speech provider: ${String(a.provider)}`)}},"buildTranscriptionModel",0,function(a,b){switch(a.provider){case"openai":return(0,m.createOpenAI)({apiKey:b}).transcription(a.model);case"google":return(0,j.createGoogleGenerativeAI)({apiKey:b}).transcription(a.model);case"xai":return(0,o.createXai)({apiKey:b}).transcription();case"vercel-ai-gateway":return(0,r.createGateway)({apiKey:b}).transcription(a.model);default:(0,x.publicError)(`Not supported transcription provider: ${String(a.provider)}`)}},"buildVideoModel",0,function(a,b){switch(a.provider){case"google":return(0,j.createGoogleGenerativeAI)({apiKey:b}).video(a.model);case"xai":return(0,o.createXai)({apiKey:b}).video(a.model);case"vercel-ai-gateway":return(0,r.createGateway)({apiKey:b}).video(a.model);default:(0,x.publicError)(`${a.provider} has no video model`)}},"compactBudget",0,I,"getTextModel",0,N,"isContextOverflow",0,D,"isPlanSpent",0,function(a){return E(a).some(a=>{if(!q.APICallError.isInstance(a)||402!==a.statusCode)return!1;try{let{code:b}=JSON.parse(a.responseBody??"").error??{};return"string"==typeof b&&z.PLAN_SPENT_CODE.test(b)}catch{return!1}})},"isProviderRefusal",0,function(a){return!D(a)&&E(a).some(a=>{let{statusCode:b}=a;return"number"==typeof b&&b>=400&&b<500&&!R.has(b)})},"modelErrorToString",0,function(a){if(!q.APICallError.isInstance(a))return(0,y.errorToString)(a);let b=a.statusCode?`(${a.statusCode})`:"",c=a.responseBody?.trim(),d=c&&!(a.message&&c.includes(a.message))?(0,y.clip)(c,300):"";return[a.message,b,d].filter(Boolean).join(" ")},"promptCacheOptions",0,function(a,b){switch(a.provider){case"openai":case"chatgpt":return b?{openai:{promptCacheKey:b}}:{};case"anthropic":return{anthropic:{cacheControl:{type:"ephemeral"}}};case"vercel-ai-gateway":return{gateway:{caching:"auto"}};case"openrouter":return"anthropic"===(0,B.vendorOf)(a.model)?{openrouter:{cacheControl:{type:"ephemeral"}}}:{};default:return{}}},"resolveDefaultModel",0,O,"resolveMediaRef",0,P,"runEffort",0,K,"seesToolImages",0,function(a){let b="vercel-ai-gateway"===a.provider?A.VENDOR_PROVIDERS[a.model.split("/")[0]]:"openrouter"===a.provider?A.VENDOR_PROVIDERS[(0,B.vendorOf)(a.model)]:a.provider;return void 0!==b&&["openai","chatgpt","anthropic","google","xai"].includes(b)}]),c()}catch(a){c(a)}},!1),735502,a=>a.a(async(b,c)=>{try{var d=a.i(12208),e=a.i(569572),f=a.i(884780),g=a.i(762008),h=a.i(641301),i=a.i(221214),j=a.i(446957),k=a.i(636616),l=a.i(109955),m=a.i(344853),n=a.i(947950),o=a.i(986743),p=a.i(138100),q=a.i(684321),r=a.i(821415),s=a.i(706210),t=a.i(182248),u=a.i(644468),v=a.i(938934),w=b([i,m,n,o,p,u]);async function x(a,b,c,f){var k,l,w,x,B,C,D,E,F;let G,H,I,J,K,L,M,N,O,P=await (0,r.openWorkspace)(),Q=a.trim(),[R,S,T,U,V,W,X,Y,Z]=await Promise.all([(0,p.loadSkills)(P,Q),(0,o.listNoteIndex)(),(0,u.listConnectedToolNames)(),(0,n.findPinnedTools)(Q),(0,i.listJobBots)(),(0,h.listBotMemory)(Q),(0,i.readBotMemoryOn)(),(0,r.readMachineTools)(P),(0,m.listBotWork)(Q,c?.thread??null)]),$=V.filter(a=>a.name!==Q),_=V.find(a=>a.name===Q)??await (0,i.findJobBot)(Q),aa=[(k=Q,l=_,w=c,H=(G=w?.owner??k)===k?"**You** coordinate this thread: its result goes from you to Thursday.":`**${G}** coordinates this thread and brings its result to Thursday.`,I=w?`
1
+ module.exports=[884780,a=>{"use strict";a.i(902157),a.i(912714);var b=a.i(750227),c=a.i(569572);(0,b.join)(c.APP_DIR,"guide");let d=".guide";a.s(["botGuideLine",0,()=>`How ${c.APP_NAME} itself works for the user — its screens and settings — is written under \`${d}/\` here, \`index.md\` first; read it only when the job is about the app.`,"guideLine",0,()=>`How ${c.APP_NAME} works for the person using it — its screens, its settings, what it connects to, what to do when something stops — is written under \`${d}/\` here, \`index.md\` first. Read it whenever an answer depends on how the app works: what can be asked for, where something is changed, a wish that needs a setting switched on, something that stopped or was refused. Answer from it rather than from what you assume.`])},738131,a=>a.a(async(b,c)=>{try{var d=a.i(527990),e=a.i(868468),f=a.i(569572),g=a.i(875931),h=a.i(938934),i=a.i(978876),j=a.i(375827),k=a.i(127507),l=a.i(467650),m=a.i(138902),n=a.i(345846),o=a.i(617594),p=a.i(622547),q=a.i(128232),r=a.i(382442),s=a.i(451017),t=a.i(762008),u=a.i(547613),v=a.i(446957),w=a.i(138100),x=a.i(821415),y=a.i(706210),z=a.i(176668),A=a.i(293480),B=a.i(987674),C=a.i(182248),D=b([g,i,m,n,o,p,q,s,w]);async function E(b){let{listThreadOverview:c}=await a.A(343064),d=await c();if(!d.length)return"No thread has been started yet.";let e=d.map(a=>`"${a.label}" (${a.bot}, ${a.status})`).join(", ");return`There is no thread called "${b}". The latest are: ${e}. Call again with one of those labels.`}async function F(a,b){let c=[];for(let[a,e]of Object.entries(b)){let b=await (0,d.asSchema)(e.inputSchema).jsonSchema,f="string"==typeof e.description?e.description:"";c.push({name:a,tokens:(0,B.estimateTokens)(f)+(0,B.estimateTokens)(JSON.stringify(b))})}c.sort((a,b)=>b.tokens-a.tokens);let e=c.reduce((a,b)=>a+b.tokens,0);z.logger.debug(`${a} tools ${e} tokens over ${c.length} — ${c.map(a=>`${a.name} ${a.tokens}`).join(", ")}`)}async function G(a){let b=await H(a);return f.IS_DEV&&await F(a.target,b),b}async function H(b){if("memory-edit"===b.target)return(0,n.createMemoryTools)("user",null,{countReads:!1});let c=(0,n.createMemoryTools)("call","thursday"===b.target?b.callId??null:null),z=await (0,x.openWorkspace)();if("thursday"===b.target){var B;let k,m,n=b.readSkills?(0,s.createSkillTools)({sandbox:z,skills:await (0,w.loadSkills)(z)}):{},q=!!(b.written&&b.model&&(0,g.seesToolImages)(b.model));return{...c,...n,...(0,u.createWorkspaceTools)(z,{write:!1,timeoutMs:f.CALL_EXEC_TIMEOUT_MS}),...!1===b.webSearch?{}:await (0,p.createCallSearchTool)(z),...Object.fromEntries(Object.entries((B=b.callId,k=async b=>{let{resolveThread:c}=await a.A(343064);return(b.trim()?await c(b.trim()):null)??await E(b)},m=async(b,c,d)=>{let e=await a.A(763543);try{return await e.answerThread(b,c,"thursday",d)}catch(a){if((0,A.isPublicError)(a))return a.message;throw a}},{[t.TOOL_NAMES.thread_start]:(0,d.tool)({description:i.threadStartSpec.description,inputSchema:i.threadStartSpec.parameters,execute:async({bot:b,request:c,label:d})=>{let{findJobBot:e,listJobBots:f}=await a.A(276307),g=await e(b);if(!g||g.disabled){let a=(await f()).map(a=>a.name);return`There is no bot called "${b}". The bots are: ${a.join(", ")}. Nothing was started — call again with one of those.`}let{startThread:h}=await a.A(763543);return{threadId:await h({bot:g.name,request:c,label:d,callId:B,from:"thursday"}),bot:g.name,label:d,note:`${g.name} has "${d}". Its updates reach the conversation on their own. Anything further about this work — a correction, the next step once it finishes — is \`${t.TOOL_NAMES.thread_tell}\` with "${d}"; a question it asks is answered with \`${t.TOOL_NAMES.thread_answer}\`.`}}}),[t.TOOL_NAMES.thread_tell]:(0,d.tool)({description:i.threadTellSpec.description,inputSchema:i.threadTellSpec.parameters,execute:async({thread:a,words:b})=>{let c=await k(a);if("string"==typeof c)return c;if(!b.trim())return"Say what to pass on.";let d=await m(c.id,b.trim());return"string"==typeof d?d:d?.answered?{label:c.label,answered:d.answered,note:`${d.answered.bot} was waiting on a question, and took this as its answer.`}:{label:c.label,bot:d?.to??c.bot,status:"running",note:"running"===c.status?"The bot reads it before its next step.":"The bot picks the thread back up from there."}}}),[t.TOOL_NAMES.thread_answer]:(0,d.tool)({description:i.threadAnswerSpec.description,inputSchema:i.threadAnswerSpec.parameters,execute:async({thread:b,bot:c,answer:d})=>{let e=await k(b);if("string"==typeof e)return e;if(!d.trim())return"Say what the answer is.";let{findThreadView:f}=await a.A(343064),g=(await f(e.id))?.room.questions??[],h=g.find(a=>a.bot.toLowerCase()===c.trim().toLowerCase());if(!h)return g.length?`${c} is not asking anything in "${e.label}". Waiting there: ${g.map(a=>a.bot).join(", ")}. Call again with that bot.`:`No question is waiting in "${e.label}". To say something else to it, use \`${t.TOOL_NAMES.thread_tell}\`.`;let i=await m(e.id,d.trim(),h.bot);return"string"==typeof i?i:{label:e.label,answered:i?.answered??{bot:h.bot,question:h.text},note:`${h.bot} has the answer to its question and goes on from it.`}}}),[t.TOOL_NAMES.thread_status]:(0,d.tool)({description:i.threadStatusSpec.description,inputSchema:i.threadStatusSpec.parameters,execute:async({thread:b})=>{let{listThreadOverview:c,findThreadView:d}=await a.A(343064),g={now:(0,h.clockNow)()},i=a=>(0,e.formatDistanceToNowStrict)((0,y.toDate)(a),{addSuffix:!0});if(!(!b.trim()||"all"===b.trim().toLowerCase())){let a=await k(b);if("string"==typeof a)return a;let c=(await d(a.id))?.room;return{...g,label:a.label,id:a.id,bot:a.bot,participants:c?.participants??[],questions:c?.questions??[],status:a.status,since:i(a.updatedAt),outcome:a.outcome,..."waiting"===a.status&&a.pending?.options.length?{options:a.pending.options}:{}}}let j=await c();return j.length?{...g,threads:j.map(a=>({id:a.id,label:a.label,bot:a.bot,status:a.status,participants:a.room.participants,questions:a.room.questions.map(a=>({...a,text:(0,C.clip)(a.text,f.PROMPT_LINE.threadStatus)})),since:i(a.updatedAt),...a.ask?{asking:a.ask.question,options:a.ask.options}:{},..."running"===a.status?{now:(0,v.threadActivity)(a.lines)}:{},...a.outcome&&"waiting"!==a.status?{outcome:(0,C.clip)(a.outcome,f.PROMPT_LINE.threadStatus)}:{}}))}:"No thread has been started yet."}}),[t.TOOL_NAMES.thread_cancel]:(0,d.tool)({description:i.threadCancelSpec.description,inputSchema:i.threadCancelSpec.parameters,execute:async({thread:b})=>{let c=await k(b);if("string"==typeof c)return c;let{cancelThread:d}=await a.A(763543);return await d(c.id),{label:c.label,status:"cancelled"}}}),[t.TOOL_NAMES.thread_show]:(0,d.tool)({description:i.threadShowSpec.description,inputSchema:i.threadShowSpec.parameters,execute:async({thread:b})=>{let c=await k(b);if("string"==typeof c)return c;let{appEvents:d}=await a.A(133300),{filesOnDisk:e}=await a.A(122690),{leadFirst:f,pathsIn:g,viewKindOf:h}=await a.A(394298),i=(await e(g(c.outcome??""),null)).filter(a=>"none"!==h(a));if(!i.length)return d.emit({type:"showThread",threadId:c.id}),{label:c.label,showing:"the thread"};let j=f(i);d.emit({type:"showFile",paths:j});let{markSeen:l}=await a.A(343064);return await l([c.id]),{label:c.label,showing:j[0]}}}),[t.TOOL_NAMES.thread_seen]:(0,d.tool)({description:i.threadSeenSpec.description,inputSchema:i.threadSeenSpec.parameters,execute:async({thread:b})=>{let c=await k(b);if("string"==typeof c)return c;let{markSeen:d}=await a.A(343064);return await d([c.id]),{label:c.label,seen:!0}}})})).filter(([a])=>!(b.phone&&a===t.TOOL_NAMES.thread_show))),...(0,o.createRoutineTools)(),...q?(0,l.createLookTool)():{},...b.written?{}:(0,j.callTools)()}}let D=await (0,w.loadSkills)(z,b.bot),F={...(0,x.jobShellEnv)(b.session),...(0,x.botShellEnv)(b.bot,(await (await a.A(276307)).findJobBot(b.bot))?.icon)},G=!!(b.model&&(0,g.seesToolImages)(b.model.ref));return{[t.TOOL_NAMES.memory_recall]:(0,n.createMemoryTools)("call",null,{tidies:!1})[t.TOOL_NAMES.memory_recall],...await (0,p.createSearchTool)(b.model,z),...(0,u.createWorkspaceTools)(z,{write:!0,env:F,guide:!0,bot:b.bot}),...await (0,m.createMcpTools)(b.bot,z),...(0,s.createSkillTools)({sandbox:z,skills:D,bot:b.bot}),...await (0,q.createSelfTools)(b.bot),...(0,k.createDeckTools)(z,b.bot,F,G),...G?(0,l.createLookTool)():{},...(0,r.createSignInTools)(z,b.bot,(0,x.jobShellEnv)(b.session)),...await (0,i.createThreadRecallTool)(b.bot,b.thread??null)}}[g,i,m,n,o,p,q,s,w]=D.then?(await D)():D,a.s(["loadTools",0,G]),c()}catch(a){c(a)}},!1),822164,a=>a.a(async(b,c)=>{try{a.i(569572);var d=a.i(725466),e=a.i(176668),f=a.i(293480),g=a.i(689656),h=b([d]);[d]=h.then?(await h)():h;let k={"x-ai":"spacexai","z-ai":"zai",mistralai:"mistral","meta-llama":"meta",qwen:"alibaba","bytedance-seed":"bytedance"},l=a=>{let b=a.slice(0,a.indexOf("/")).replace(/^~/,"");return k[b]??b};function i(a){if(null==a||""===a)return null;let b=Number(a);return!Number.isFinite(b)||b<0?null:Math.round(1e6*b*1e4)/1e4}async function j(){let a=await fetch("https://openrouter.ai/api/v1/models",{headers:{accept:"application/json"}}).catch(a=>{e.logger.warn({cause:a},"openrouter catalog unreachable"),(0,f.publicError)("Could not reach OpenRouter")});return a.ok||(0,f.publicError)(`OpenRouter answered ${a.status}`),((await a.json()).data??[]).filter(a=>!!a.id).map(a=>{let b,c,d,e;return{id:a.id,label:a.name||a.id,owner:l(a.id),type:(a.architecture?.output_modalities??[]).includes("text")?g.CATALOG_TEXT:null,tags:(a.supported_parameters??[]).includes("tools")?[g.CATALOG_TOOL_USE]:[],price:(b=i(a.pricing?.prompt),c=i(a.pricing?.completion),0===b&&0===c?{in:0,out:0,note:null,free:!0}:{in:b,out:c,note:null===b&&null===c?"per model it picks":null,free:!1}),retiring:!!a.expiration_date,contextWindow:"number"==typeof a.context_length&&a.context_length>0?a.context_length:null,efforts:(d=a.reasoning?.supported_efforts??[],(e=g.EFFORTS.filter(a=>d.includes(a))).length?e:null)}})}a.s(["fetchOpenRouterCatalog",0,j,"vendorOf",0,l]),c()}catch(a){c(a)}},!1),875931,a=>a.a(async(b,c)=>{try{var d=a.i(938537),e=a.i(674861),f=a.i(606016),g=a.i(388319),h=a.i(538177),i=a.i(767071),j=a.i(140358),k=a.i(873739),l=a.i(899042),m=a.i(345364),n=a.i(434451),o=a.i(655819),p=a.i(272380),q=a.i(652685),r=a.i(156956),s=a.i(47919),t=a.i(569572),u=a.i(688034),v=a.i(725466),w=a.i(176668),x=a.i(293480),y=a.i(182248),z=a.i(652619),A=a.i(689656),B=a.i(822164),C=b([v,z,B]);[v,z,B]=C.then?(await C)():C;let Q=/context[ _-]?(length|window)|maximum context|prompt is too long|too many (input )?tokens|input token count|exceeds? the (maximum|model'?s?) (context|input|prompt|number of tokens)|maximum prompt length|request (entity )?too large/i;function D(a){return E(a).some(a=>{let{statusCode:b,message:c,error:d}=a;if(void 0!==b&&400!==b&&413!==b)return!1;let e=q.APICallError.isInstance(a)?a.responseBody:null;return[c,d,e].some(a=>"string"==typeof a&&Q.test(a))})}let R=new Set([408,409,429]);function E(a){let b=[],c=[a];for(;c.length&&b.length<12;){let a=c.shift();!("object"!=typeof a||null===a||b.includes(a))&&(b.push(a),s.RetryError.isInstance(a)&&c.push(...a.errors),"cause"in a&&c.push(a.cause))}return b}let S=(a,b)=>({ref:a,model:b,searchTools:null}),T={};function F(a){if(null==a||""===a)return null;let b=Number(a);return Number.isFinite(b)?Math.round(1e6*b*1e4)/1e4:null}async function G(a){let b=T[a];if(b&&Date.now()-b.at<t.CATALOG_MS)return b.models;let c=("openrouter"===a?await (0,B.fetchOpenRouterCatalog)():await H()).sort((a,b)=>a.id.localeCompare(b.id));return T[a]={at:Date.now(),models:c},c}async function H(){let a=await fetch("https://ai-gateway.vercel.sh/v1/models",{headers:{accept:"application/json"}}).catch(a=>{w.logger.warn({cause:a},"gateway catalog unreachable"),(0,x.publicError)("Could not reach the gateway")});return a.ok||(0,x.publicError)(`The gateway answered ${a.status}`),((await a.json()).data??[]).filter(a=>!!a.id).map(a=>{let b,c;return{id:a.id,label:a.name||a.id,owner:a.owned_by||a.id.slice(0,a.id.indexOf("/")),type:a.type??null,tags:a.tags??[],price:function(a){let b=a.pricing??{},c=F(b.input),d=F(b.output);if((a.tags??[]).includes("free")||0===c)return{in:0,out:0,note:null,free:!0};let e=b.transcription_duration_cost_per_second??b.realtime_session_duration_cost_per_second;if(e)return{in:null,out:null,note:`$${e}/s`,free:!1};if(b.speech_input_character_cost)return{in:null,out:null,note:"per character",free:!1};let f=Array.isArray(b.video_duration_pricing)?b.video_duration_pricing[0]:null;if(f?.cost_per_second)return{in:null,out:null,note:`$${f.cost_per_second}/s ${f.resolution??""}`.trimEnd(),free:!1};let g=b.image?`$${b.image}/image`:b.image_dimension_quality_pricing?"per image, by size":null;return null===c&&null===d?{in:null,out:null,note:g,free:!1}:{in:c,out:d,note:b.input_tiers?"tiered":b.varies_by_provider?"varies":g&&"+ per image",free:!1}}(a),retiring:!!a.deprecated_at,contextWindow:"number"==typeof a.context_window&&a.context_window>0?a.context_window:null,efforts:(b=(a.reasoning_options??[]).find(a=>a?.type==="effort"),(c=A.EFFORTS.filter(a=>b?.values?.includes(a))).length?c:null)}})}async function I(a,b){if(b&&b>0)return b;let c=await J(a);return(0,A.compactAtFor)((0,A.contextWindowOf)(a.provider,a.model,c))}async function J(a){return(0,A.isCatalogProvider)(a.provider)?await G(a.provider).catch(()=>[]):[]}async function K(a,b){let c=b??A.effortSchema.safeParse(await (0,v.readConfig)(u.DEFAULT_EFFORT_KEY)).data;if(!c)return;let d=await J(a);return(0,A.effortsOf)(a.provider,a.model,d)?.includes(c)?c:void 0}async function L(a){return await G(a).then(a=>new Set(a.map(a=>a.id))).catch(()=>null)}async function M(a,b){if(!(0,A.isCatalogProvider)(a))return b;let c=await L(a);if(!c)return b;let d=b.filter(a=>c.has(a.id));return d.length>0?d:b}async function N(a){let{label:b,apiKeyName:c,signIn:q}=A.TEXT_MODEL_PROVIDERS[a.provider],t=await (0,v.readConfig)(c);return t||(0,x.publicError)(await (0,v.missingKeyWords)(c,q?`${b} is not signed in — sign in from Settings › API keys.`:`No ${b} key — add one in Settings › API keys.`)),function(a,b){switch(a.provider){case"openai":{let c=(0,m.createOpenAI)({apiKey:b});return{ref:a,model:c(a.model),searchTools:{search:c.tools.webSearch()}}}case"chatgpt":return{ref:a,model:(0,z.chatGptModel)(a.model),searchTools:{search:(0,z.chatGptSearch)()}};case"anthropic":{let c=(0,d.createAnthropic)({apiKey:b});return{ref:a,model:c(a.model),searchTools:{search:c.tools.webSearch_20260209()}}}case"google":{let c=(0,j.createGoogleGenerativeAI)({apiKey:b});return{ref:a,model:c(a.model),searchTools:{search:c.tools.googleSearch({})}}}case"xai":{let c=(0,o.createXai)({apiKey:b});return{ref:a,model:c(a.model),searchTools:{search:c.tools.webSearch()}}}case"mistral":return S(a,(0,l.createMistral)({apiKey:b})(a.model));case"deepseek":return S(a,(0,h.createDeepSeek)({apiKey:b})(a.model));case"groq":return S(a,(0,k.createGroq)({apiKey:b})(a.model));case"cerebras":return S(a,(0,e.createCerebras)({apiKey:b})(a.model));case"togetherai":return S(a,(0,n.createTogetherAI)({apiKey:b})(a.model));case"fireworks":return S(a,(0,i.createFireworks)({apiKey:b})(a.model));case"deepinfra":return S(a,(0,g.createDeepInfra)({apiKey:b})(a.model));case"cohere":return S(a,(0,f.createCohere)({apiKey:b})(a.model));case"vercel-ai-gateway":{let c=(0,r.createGateway)({apiKey:b});return{ref:a,model:c(a.model),searchTools:null}}case"openrouter":{var c;let d=(0,p.createOpenRouter)({apiKey:b});return{ref:a,model:(c=d(a.model),(0,s.wrapLanguageModel)({model:c,middleware:{specificationVersion:"v4",transformParams:async({params:a})=>a.reasoning&&"provider-default"!==a.reasoning?{...a,providerOptions:{...a.providerOptions,openrouter:{...a.providerOptions?.openrouter,reasoning:{effort:a.reasoning}}}}:a}})),searchTools:{search:d.tools.webSearch({})}}}default:(0,x.publicError)(`Not supported provider: ${String(a.provider)}`)}}(a,t)}async function O(a,{quiet:b=!1}={}){let c=async a=>(0,A.defaultModelOf)({defaultTier:"chatgpt"===a.id&&await (0,z.readChatGptPlan)()==="free"?"small":a.defaultTier,suggestModels:await M(a.id,a.suggestModels)}),d=a?A.TEXT_MODEL_PROVIDER_LIST.find(b=>b.id===a):void 0,e=["chatgpt","openai","xai"].map(a=>({...A.TEXT_MODEL_PROVIDERS[a],id:a}));if(d){let a=await c(d);if(a)return{provider:d.id,model:a}}let f=(0,A.parseTextModel)(await (0,v.readConfig)(u.DEFAULT_MODEL_KEY)??void 0);if(f){let{label:a,apiKeyName:b,signIn:c}=A.TEXT_MODEL_PROVIDERS[f.provider];if(await (0,v.readConfig)(b))return f;(0,x.publicError)(await (0,v.missingKeyWords)(b,c?`The default model is ${f.model} on ${a}, which is signed out — sign in again, or pick another in Settings › Models.`:`The default model is ${f.model}, and there is no ${a} key any more — add it in Settings › API keys, or pick another in Settings › Models.`))}for(let a of[...e,...A.TEXT_MODEL_PROVIDER_LIST]){if(!await (0,v.readConfig)(a.apiKeyName))continue;let d=await c(a);if(d)return b||w.logger.info(`no model set, falling back to ${a.id}/${d}`),{provider:a.id,model:d}}(0,x.publicError)("No model key is set — add one in Settings › API keys.")}async function P(a){let b=(0,A.parseMediaModel)(await (0,v.readConfig)(u.MEDIA_MODEL_KEYS[a]));if(!b){let b=await (0,v.readConfig)(A.MEDIA_MODEL_PROVIDERS.chatgpt.apiKeyName),c=b?(0,A.planMediaOf)(a,{plan:await (0,z.readChatGptPlan)()}):null;return c&&b?{ref:c,apiKey:b}:null}if(!(0,A.canMakeKind)(b.provider,a))return null;let c=await (0,v.readConfig)(A.MEDIA_MODEL_PROVIDERS[b.provider].apiKeyName);return c?{ref:b,apiKey:c}:null}a.s(["buildImageModel",0,function(a,b){switch(a.provider){case"openai":return(0,m.createOpenAI)({apiKey:b}).image(a.model);case"chatgpt":return(0,z.chatGptImageModel)(a.model);case"google":return(0,j.createGoogleGenerativeAI)({apiKey:b}).image(a.model);case"xai":return(0,o.createXai)({apiKey:b}).image(a.model);case"vercel-ai-gateway":return(0,r.createGateway)({apiKey:b}).image(a.model);default:(0,x.publicError)(`Not supported image provider: ${String(a.provider)}`)}},"buildSpeechModel",0,function(a,b){switch(a.provider){case"openai":return(0,m.createOpenAI)({apiKey:b}).speech(a.model);case"google":return(0,j.createGoogleGenerativeAI)({apiKey:b}).speech(a.model);case"xai":return(0,o.createXai)({apiKey:b}).speech();case"vercel-ai-gateway":return(0,r.createGateway)({apiKey:b}).speech(a.model);default:(0,x.publicError)(`Not supported speech provider: ${String(a.provider)}`)}},"buildTranscriptionModel",0,function(a,b){switch(a.provider){case"openai":return(0,m.createOpenAI)({apiKey:b}).transcription(a.model);case"google":return(0,j.createGoogleGenerativeAI)({apiKey:b}).transcription(a.model);case"xai":return(0,o.createXai)({apiKey:b}).transcription();case"vercel-ai-gateway":return(0,r.createGateway)({apiKey:b}).transcription(a.model);default:(0,x.publicError)(`Not supported transcription provider: ${String(a.provider)}`)}},"buildVideoModel",0,function(a,b){switch(a.provider){case"google":return(0,j.createGoogleGenerativeAI)({apiKey:b}).video(a.model);case"xai":return(0,o.createXai)({apiKey:b}).video(a.model);case"vercel-ai-gateway":return(0,r.createGateway)({apiKey:b}).video(a.model);default:(0,x.publicError)(`${a.provider} has no video model`)}},"compactBudget",0,I,"getTextModel",0,N,"isContextOverflow",0,D,"isPlanSpent",0,function(a){return E(a).some(a=>{if(!q.APICallError.isInstance(a)||402!==a.statusCode)return!1;try{let{code:b}=JSON.parse(a.responseBody??"").error??{};return"string"==typeof b&&z.PLAN_SPENT_CODE.test(b)}catch{return!1}})},"isProviderRefusal",0,function(a){return!D(a)&&E(a).some(a=>{let{statusCode:b}=a;return"number"==typeof b&&b>=400&&b<500&&!R.has(b)})},"modelErrorToString",0,function(a){if(!q.APICallError.isInstance(a))return(0,y.errorToString)(a);let b=a.statusCode?`(${a.statusCode})`:"",c=a.responseBody?.trim(),d=c&&!(a.message&&c.includes(a.message))?(0,y.clip)(c,300):"";return[a.message,b,d].filter(Boolean).join(" ")},"promptCacheOptions",0,function(a,b){switch(a.provider){case"openai":case"chatgpt":return b?{openai:{promptCacheKey:b}}:{};case"anthropic":return{anthropic:{cacheControl:{type:"ephemeral"}}};case"vercel-ai-gateway":return{gateway:{caching:"auto"}};case"openrouter":return"anthropic"===(0,B.vendorOf)(a.model)?{openrouter:{cacheControl:{type:"ephemeral"}}}:{};default:return{}}},"resolveDefaultModel",0,O,"resolveMediaRef",0,P,"runEffort",0,K,"seesToolImages",0,function(a){let b="vercel-ai-gateway"===a.provider?A.VENDOR_PROVIDERS[a.model.split("/")[0]]:"openrouter"===a.provider?A.VENDOR_PROVIDERS[(0,B.vendorOf)(a.model)]:a.provider;return void 0!==b&&["openai","chatgpt","anthropic","google","xai"].includes(b)}]),c()}catch(a){c(a)}},!1),735502,a=>a.a(async(b,c)=>{try{var d=a.i(12208),e=a.i(569572),f=a.i(884780),g=a.i(762008),h=a.i(641301),i=a.i(221214),j=a.i(446957),k=a.i(636616),l=a.i(109955),m=a.i(344853),n=a.i(947950),o=a.i(986743),p=a.i(138100),q=a.i(684321),r=a.i(821415),s=a.i(706210),t=a.i(182248),u=a.i(644468),v=a.i(938934),w=b([i,m,n,o,p,u]);async function x(a,b,c,f){var k,l,w,x,B,C,D,E,F,G;let H,I,J,K,L,M,N,O,P,Q=await (0,r.openWorkspace)(),R=a.trim(),[S,T,U,V,W,X,Y,Z,$]=await Promise.all([(0,p.loadSkills)(Q,R),(0,o.listNoteIndex)(),(0,u.listConnectedToolNames)(),(0,n.findPinnedTools)(R),(0,i.listJobBots)(),(0,h.listBotMemory)(R),(0,i.readBotMemoryOn)(),(0,r.readMachineTools)(Q),(0,m.listBotWork)(R,c?.thread??null)]),_=W.filter(a=>a.name!==R),aa=W.find(a=>a.name===R)??await (0,i.findJobBot)(R),ab=[(k=R,l=aa,w=c,I=(H=w?.owner??k)===k?"**You** coordinate this thread: its result goes from you to Thursday.":`**${H}** coordinates this thread and brings its result to Thursday.`,J=w?`
2
2
 
3
- Current conversation: ${w.caller} → ${k}. Your final text goes back to ${w.caller}.`:"",J=l?`
4
- Others know you as: ${(0,j.rosterLine)(l)}`:"",K=y(k,w)?"your tools, the other bots, this machine":`your tools, this machine, and the other bots through ${G}`,`You are ${k}, one of the bots in this thread. ${(0,v.todayLine)()}${J}
3
+ Current conversation: ${w.caller} → ${k}. Your final text goes back to ${w.caller}.`:"",K=l?`
4
+ Others know you as: ${(0,j.rosterLine)(l)}`:"",L=y(k,w)?"your tools, the other bots, this machine":`your tools, this machine, and the other bots through ${H}`,`You are ${k}, one of the bots in this thread. ${(0,v.todayLine)()}${K}
5
5
 
6
6
  - **The user** — the one person all of this is for. They talk with Thursday by voice and follow this thread on their screen.
7
7
  - **Thursday** — their personal assistant. She talks with them, hands bots the work that takes time, and tells them what comes back.
8
- - ${H}
9
- - **Everyone on it** keeps their own work and conversation; the others see only the messages sent to them.${I}
8
+ - ${I}
9
+ - **Everyone on it** keeps their own work and conversation; the others see only the messages sent to them.${J}
10
10
 
11
- **The job is done, not described.** You are on the user's own computer, with a shell, files and the web, and how you get there is yours: when one way fails, try another; where no tool exists, write one — \`node\` is always here. Before deciding something cannot be done, look at what you have — ${K}. Bring back the thing itself — their account, their file, the real result — not a smaller, safer stand-in, and not a note on why not.
11
+ **The job is done, not described.** You are on the user's own computer, with a shell, files and the web, and how you get there is yours: when one way fails, try another; where no tool exists, write one — \`node\` is always here. Before deciding something cannot be done, look at what you have — ${L}. Bring back the thing itself — their account, their file, the real result — not a smaller, safer stand-in, and not a note on why not.
12
12
 
13
- **Never present a guess as a result.** Thursday says what you return out loud, as fact: say which part is unverified and why.`),(x=S,`## Thursday's memory of the user
13
+ **Never present a guess as a result.** Thursday says what you return out loud, as fact: say which part is unverified and why.`),(x=T,`## Thursday's memory of the user
14
14
 
15
15
  What Thursday keeps from talking with them. When the job needs something about them, open the note with \`${g.TOOL_NAMES.memory_recall}\`; a fact marked \`said\` came from a call. What you learn about them goes in your answer — Thursday decides what to keep.
16
16
 
@@ -20,26 +20,28 @@ ${(0,v.noteLines)(x)}`),function(a,b){let c=new Set(b.map(a=>`${a.server}/${a.na
20
20
 
21
21
  ${(0,v.mcpToolLines)(d)}
22
22
 
23
- Names only: \`${g.TOOL_NAMES.tool_search}\` returns what each one takes, \`${g.TOOL_NAMES.tool_call}\` runs one.${e}`}(T,U),(B=R,0===B.length?"":`## Skills
23
+ Names only: \`${g.TOOL_NAMES.tool_search}\` returns what each one takes, \`${g.TOOL_NAMES.tool_call}\` runs one.${e}`}(U,V),(B=S,0===B.length?"":`## Skills
24
24
 
25
25
  Written-down ways of doing things. Open one with \`${g.TOOL_NAMES.load_skill}\` before a job it covers, unless its instructions are already in your conversation.
26
26
 
27
- ${(0,v.skillLines)(B)}`),A(P.cwd,Y,f),X?(C=(0,h.botMemoryFolder)(Q),L=(D=W).entries.length?D.entries.map(({file:a,line:b,at:c})=>{let f=b?` — ${(0,t.clip)(b,e.PROMPT_LINE.botMemory)}`:"";return`- ${a}${f} \xb7 ${(0,d.format)((0,s.toDate)(c),"yyyy-MM-dd")}`}).join("\n"):"Empty.",M=D.total>D.entries.length?`
27
+ ${(0,v.skillLines)(B)}`),A(Q.cwd,Z,f),Y?(C=(0,h.botMemoryFolder)(R),M=(D=X).entries.length?D.entries.map(({file:a,line:b,at:c})=>{let f=b?` — ${(0,t.clip)(b,e.PROMPT_LINE.botMemory)}`:"";return`- ${a}${f} \xb7 ${(0,d.format)((0,s.toDate)(c),"yyyy-MM-dd")}`}).join("\n"):"Empty.",N=D.total>D.entries.length?`
28
28
 
29
29
  The newest ${D.entries.length} of ${D.total}; \`ls ${C}\` for the rest.`:"",`## Your memory
30
30
 
31
31
  What you learned on your own earlier jobs, in \`${C}/\`: one topic per file, its first line saying what it holds, read by no other bot, up to ${e.BOT_MEMORY_LIMITS.files} files of ${e.BOT_MEMORY_LIMITS.chars.toLocaleString("en-US")} characters each. It is how you get better at this work. When a job teaches you something a later one would otherwise find out again — how a site signs in, the way through its screens, a command that turned out right — or the user asks you to remember how to work, keep it with the date it was true, and fix or delete what proved wrong. No passwords, keys or codes.
32
32
 
33
- ${L}${M}`):"",function(a,b){if(!b.open.length&&!b.recent.length)return"";let c=b=>{let c=b.said?` — ${(0,t.clip)(b.said,e.BOT_WORK.said)}`:"",d=b.said?(0,q.pathsIn)(b.said).slice(0,e.BOT_WORK.files):[],f=d.length?` \xb7 ${d.map(a=>`\`${a}\``).join(", ")}`:"";return`- ${b.cut?`[${(0,j.workHandle)(b.id)}] `:""}${(0,v.botWorkHead)(b,a)}${c}${f}`},d=(a,b)=>b.length?`${a}
33
+ ${M}${N}`):"",(E=`${(0,r.botFolder)(R)}/${e.PATHS.skills.own}`,`## Your own skills
34
+
35
+ A skill in \`${E}/\` is listed to you alone, and read on every step you take, so keep few. Write one only when the job is a kind that comes again — a routine runs it, or your other threads show the same kind of job — and doing it well took a way of working, not a fact your memory can hold. Before writing one, improve the one of yours that covers the job instead. Write it as the skill-creator skill says; the job you just did is its test, so validate it and run no test prompts. Say in one line of your answer which skill you wrote or changed. Any skill outside that folder changes only when the user asks.`),function(a,b){if(!b.open.length&&!b.recent.length)return"";let c=b=>{let c=b.said?` — ${(0,t.clip)(b.said,e.BOT_WORK.said)}`:"",d=b.said?(0,q.pathsIn)(b.said).slice(0,e.BOT_WORK.files):[],f=d.length?` \xb7 ${d.map(a=>`\`${a}\``).join(", ")}`:"";return`- ${b.cut?`[${(0,j.workHandle)(b.id)}] `:""}${(0,v.botWorkHead)(b,a)}${c}${f}`},d=(a,b)=>b.length?`${a}
34
36
  ${b.map(c).join("\n")}`:"",f=[...b.open,...b.recent].some(a=>a.cut)?` A line with an id in brackets was cut short: \`${g.TOOL_NAMES.thread_recall}\` opens that one whole, for when this job builds on it.`:"";return`## Your other threads
35
37
 
36
38
  Your threads besides this one. You remember none of them here: each line is where it stands, your own last words there, and the files those words name.${f}
37
39
 
38
- ${[d("Open",b.open),d("Ended",b.recent)].filter(Boolean).join("\n")}`}(Q,Z),function(a,b,c){if(0===a.length)return"";let d=y(b,c)?`When part of the job is another bot's strength, bring it in with \`${g.TOOL_NAMES.send_message}\` rather than rebuilding it yourself.`:`When part of the job is another bot's strength, say so in your answer: ${c?.owner??"the coordinator"} brings them in.`;return`## Bots
40
+ ${[d("Open",b.open),d("Ended",b.recent)].filter(Boolean).join("\n")}`}(R,$),function(a,b,c){if(0===a.length)return"";let d=y(b,c)?`When part of the job is another bot's strength, bring it in with \`${g.TOOL_NAMES.send_message}\` rather than rebuilding it yourself.`:`When part of the job is another bot's strength, say so in your answer: ${c?.owner??"the coordinator"} brings them in.`;return`## Bots
39
41
 
40
42
  ${a.map(a=>`- **${a.name}** — ${(0,j.rosterLine)(a)}`).join("\n")}
41
43
 
42
- These lines were written for the user: where one says "you", it means them. ${d}`}($,Q,c),(E=Q,F=c,N=F?.caller??"whoever asked",O=`Write in the user's language, and name the paths of finished work. In Markdown, reference images by absolute route (\`/api/file/${e.PATHS.artifacts}/…\`).`,y(E,F)?`## Working together
44
+ These lines were written for the user: where one says "you", it means them. ${d}`}(_,R,c),(F=R,G=c,O=G?.caller??"whoever asked",P=`Write in the user's language, and name the paths of finished work. In Markdown, reference images by absolute route (\`/api/file/${e.PATHS.artifacts}/…\`).`,y(F,G)?`## Working together
43
45
 
44
46
  Nobody sees your work but you, and you see only what others send you, so whatever crosses between you has to stand on its own. A request says what is wanted, what is already known or done, and where the files are; an answer gives exact values, file paths and what is still unverified. Tell a bot you handed work to when what it depends on changes: it reads that before its next step. End your turn when you have nothing more to do now: answers arrive as new messages and wake you. The bots you bring in answer only to you: when one needs another bot's work or something from the user, it says so in its answer, and you decide.
45
47
 
@@ -47,13 +49,13 @@ Before you hand anything out, check what each part needs that only the user know
47
49
 
48
50
  While work you handed out is still out, your result waits for it: end your turn and each answer wakes you, with a line on what is still out; write the result once everything you asked for is in. Bring what you received together into one result for Thursday: what was done, where it is, what you decided that the request did not say, and what is still open, at the detail the user asked for. Every file you name in it is drawn under your words in the thread and waits in the screen's corner for the user to open, so name each one you want them to see — the page to read first, then the rest.
49
51
 
50
- ${O}`:`## Working together
52
+ ${P}`:`## Working together
51
53
 
52
- Nobody sees your work but you: ${N} sees only your final text, so it has to stand on its own — exact values, file paths and what is still unverified. ${F?.owner??"The coordinator"} brings the other bots in, not you.
54
+ Nobody sees your work but you: ${O} sees only your final text, so it has to stand on its own — exact values, file paths and what is still unverified. ${G?.owner??"The coordinator"} brings the other bots in, not you.
53
55
 
54
- Your final text is your answer to ${N}, and all they see of your work: give them everything they need to carry on. When you cannot go on without something — from them, from another bot, or a fact only the user has, such as a date, a name, a place or an amount — end with that question instead of guessing it or leaving a blank; ${N} gets it for you, and their reply brings you back with all you have done still in front of you.
56
+ Your final text is your answer to ${O}, and all they see of your work: give them everything they need to carry on. When you cannot go on without something — from them, from another bot, or a fact only the user has, such as a date, a name, a place or an amount — end with that question instead of guessing it or leaving a blank; ${O} gets it for you, and their reply brings you back with all you have done still in front of you.
55
57
 
56
- ${O}`),z(Q,b)].filter(Boolean).join("\n\n");return(0,v.logPromptSize)("bot",aa),{text:aa}}[i,m,n,o,p,u]=w.then?(await w)():w;let z=(a,b)=>{let c=b?.trim();return c?(0,k.findBotSeed)(a)?.systemPrompt.trim()===c?`## Your role
58
+ ${P}`),z(R,b)].filter(Boolean).join("\n\n");return(0,v.logPromptSize)("bot",ab),{text:ab}}[i,m,n,o,p,u]=w.then?(await w)():w;let z=(a,b)=>{let c=b?.trim();return c?(0,k.findBotSeed)(a)?.systemPrompt.trim()===c?`## Your role
57
59
 
58
60
  What this bot is for, as the app sets it up. Where it and anything above disagree, it wins.
59
61
 
@@ -86,7 +88,7 @@ ${a.job.text.trim()}`}]},"buildThreadOpening",0,function(a){if(a.routine){let{wh
86
88
 
87
89
  ${a.request.trim()}`}]}let b="user"===a.from?"The user":"Thursday";return[{type:"text",text:`You are ${a.bot}. ${b} hands you this thread${"user"===a.from?" on screen":" during a call"}.`},{type:"text",text:`## ${b} → ${a.bot}: the job
88
90
 
89
- ${a.request.trim()}`}]},"loadBotPrompt",0,x]),c()}catch(a){c(a)}},!1),938934,a=>{"use strict";var b=a.i(12208),c=a.i(868468),d=a.i(569572),e=a.i(762008),f=a.i(951941),g=a.i(626550),h=a.i(706210),i=a.i(176668),j=a.i(987674),k=a.i(182248);let l=(a=new Date)=>`${(0,b.format)(a,"yyyy-MM-dd (EEE) HH:mm")} ${Intl.DateTimeFormat().resolvedOptions().timeZone}`,m=a=>(0,b.format)(a,"yyyy-MM-dd (EEE) a"),n={0:"clear sky",1:"mainly clear",2:"partly cloudy",3:"overcast",45:"fog",48:"depositing rime fog",51:"light drizzle",53:"moderate drizzle",55:"dense drizzle",56:"light freezing drizzle",57:"dense freezing drizzle",61:"slight rain",63:"moderate rain",65:"heavy rain",66:"light freezing rain",67:"heavy freezing rain",71:"slight snow fall",73:"moderate snow fall",75:"heavy snow fall",77:"snow grains",80:"slight rain showers",81:"moderate rain showers",82:"violent rain showers",85:"slight snow showers",86:"heavy snow showers",95:"thunderstorm",96:"thunderstorm with slight hail",99:"thunderstorm with heavy hail"};function o(a){if(!a)return"";let b=a.weather,c=b?`${n[b.code]??`weather code ${b.code}`}, ${Math.round(b.temperature)}\xb0C (today ${Math.round(b.low)}–${Math.round(b.high)}\xb0C), sunrise ${b.sunrise}, sunset ${b.sunset}`:"";return a.place?`**Where they are**: ${a.place}${c?` — ${c}`:""}`:c?`**Weather where they are**: ${c}`:""}let p=a=>`${(0,b.format)(a,"yyyy-MM-dd (EEE) HH:mm")} (${(0,c.formatDistanceToNowStrict)(a,{addSuffix:!0})})`,q={[e.STUDIO_TOOLS.generate_image]:"images",[e.STUDIO_TOOLS.generate_speech]:"speech",[e.STUDIO_TOOLS.transcribe]:"transcription",[e.STUDIO_TOOLS.generate_video]:"video"};a.s(["botWorkHead",0,function(a,c){let d=m(a.updatedAt),e="running"===a.status?`running, last moved ${d}`:a.asking?`waiting on the user's answer since ${d}`:"waiting"===a.status?`stopped ${d}, not finished`:`${"done"===a.status?"ended":"stopped by the user"} ${(0,b.format)(a.updatedAt,"yyyy-MM-dd")}`;return`"${a.label}" — ${a.owner===c?"yours":`${a.owner}'s`} — ${e}`},"clockNow",0,l,"logPromptSize",0,function(a,b){let c=(0,j.sectionTokens)(b),e=c.reduce((a,b)=>a+b.tokens,0);i.logger.debug(`${a} prompt ${e} tokens — ${c.map(a=>`${a.name} ${a.tokens}`).join(", ")}`);let f=c[0];e>d.PROMPT_BUDGET&&f&&i.logger.warn(`${a} prompt is ${e} tokens, over ${d.PROMPT_BUDGET}: ${f.name} carries ${f.tokens} of it. Every call and every job pays this.`)},"mcpToolLines",0,function(a){let b=new Map;for(let c of a){let a=b.get(c.server);a?a.push(c.name):b.set(c.server,[c.name])}return[...b].map(([a,b])=>`- **${a}**: ${b.join(", ")}`).join("\n")},"noteLines",0,function(a,b=!1){return a.length?a.map(a=>{var c;let d,e=b?` \xb7 ${c=a.lastSeenAt,(d=Math.floor((Date.now()-(0,h.toDate)(c).getTime())/864e5))>=365?`${Math.floor(d/365)}y`:d>=30?`${Math.floor(d/30)}mo`:`${Math.max(d,0)}d`}`:"";return`- ${a.path} — ${a.description?.trim()} (${a.factCount})${e}`}).join("\n"):"(nothing saved yet)"},"reachNames",0,function(a,b){let c=b.map(a=>a.server===d.STUDIO_SERVER?q[a.name]??a.name:a.server);return[...new Set([...a.map(a=>a.name),...c])].join(", ")},"recentCallLines",0,function(a,b){let c=[],f=0;a:for(let h=a.length-1;h>=0;h--){let i=a[h];for(let a=i.turns.length-1;a>=0;a--){let h=function(a,b){if("tool"!==a.role)return`${"user"===a.role?"user":"you"}: ${a.text}`;let c=(0,g.searchOf)(a.tool,a.text);if(c){let b=[...new Set(c.sources.flatMap(a=>(0,k.hostOf)(a.url)??[]))];return`you → ${a.tool} "${(0,k.clip)(c.query??"",d.PROMPT_LINE.toolArgs)}"${b.length?` — ${b.join(", ")}`:""}`}let f=`you → ${a.tool??"tool"} ${(0,k.clip)(a.text,d.PROMPT_LINE.toolArgs)}`;if(a.tool!==e.TOOL_NAMES.thread_start)return f;let h=(0,g.startedLabel)(a.tool,a.text),i=h?b.jobs?.find(a=>a.label===h):void 0;if(!i)return f;let j=i.outcome?`: ${(0,k.clip)(i.outcome,d.PROMPT_LINE.jobOutcome)}`:"";return`you → ${a.tool} "${i.label}" (${i.id}) — ${i.status}${j}`}(i.turns[a],i),l=(0,j.estimateTokens)(h)+3;if(f+l>b&&c.length)break a;f+=l,c.push({call:i,line:h})}}c.reverse();let h=[],i=null;for(let{call:a,line:b}of c)a!==i&&(i=a,h.push(`### ${p(a.startedAt)}`)),h.push(b);return h.join("\n")},"saidStamp",0,a=>(0,b.format)(a,"yyyy-MM-dd (EEE) HH:mm"),"skillLines",0,(a,b={})=>a.map(a=>{var c;let e,g;return`- **${a.name}**: ${b.short?(c=a.description,e=d.PROMPT_LINE.skill,(g=(0,f.firstSentence)(c)).length>e?`${g.slice(0,e).trim()}…`:g):a.description}`}).join("\n"),"styleLines",0,a=>a?.trim()?`## Who they want you to be
91
+ ${a.request.trim()}`}]},"loadBotPrompt",0,x]),c()}catch(a){c(a)}},!1),938934,a=>{"use strict";var b=a.i(12208),c=a.i(868468),d=a.i(569572),e=a.i(762008),f=a.i(951941),g=a.i(626550),h=a.i(706210),i=a.i(176668),j=a.i(987674),k=a.i(182248);let l=(a=new Date)=>`${(0,b.format)(a,"yyyy-MM-dd (EEE) HH:mm")} ${Intl.DateTimeFormat().resolvedOptions().timeZone}`,m=a=>(0,b.format)(a,"yyyy-MM-dd (EEE) a"),n={0:"clear sky",1:"mainly clear",2:"partly cloudy",3:"overcast",45:"fog",48:"depositing rime fog",51:"light drizzle",53:"moderate drizzle",55:"dense drizzle",56:"light freezing drizzle",57:"dense freezing drizzle",61:"slight rain",63:"moderate rain",65:"heavy rain",66:"light freezing rain",67:"heavy freezing rain",71:"slight snow fall",73:"moderate snow fall",75:"heavy snow fall",77:"snow grains",80:"slight rain showers",81:"moderate rain showers",82:"violent rain showers",85:"slight snow showers",86:"heavy snow showers",95:"thunderstorm",96:"thunderstorm with slight hail",99:"thunderstorm with heavy hail"};function o(a){if(!a)return"";let b=a.weather,c=b?`${n[b.code]??`weather code ${b.code}`}, ${Math.round(b.temperature)}\xb0C (today ${Math.round(b.low)}–${Math.round(b.high)}\xb0C), sunrise ${b.sunrise}, sunset ${b.sunset}${null==b.gusts?"":`, gusts ${Math.round(b.gusts)} km/h`}`:"";return a.place?`**Where they are**: ${a.place}${c?` — ${c}`:""}`:c?`**Weather where they are**: ${c}`:""}let p=a=>`${(0,b.format)(a,"yyyy-MM-dd (EEE) HH:mm")} (${(0,c.formatDistanceToNowStrict)(a,{addSuffix:!0})})`,q={[e.STUDIO_TOOLS.generate_image]:"images",[e.STUDIO_TOOLS.generate_speech]:"speech",[e.STUDIO_TOOLS.transcribe]:"transcription",[e.STUDIO_TOOLS.generate_video]:"video"};a.s(["botWorkHead",0,function(a,c){let d=m(a.updatedAt),e="running"===a.status?`running, last moved ${d}`:a.asking?`waiting on the user's answer since ${d}`:"waiting"===a.status?`stopped ${d}, not finished`:`${"done"===a.status?"ended":"stopped by the user"} ${(0,b.format)(a.updatedAt,"yyyy-MM-dd")}`;return`"${a.label}" — ${a.owner===c?"yours":`${a.owner}'s`} — ${e}`},"clockNow",0,l,"logPromptSize",0,function(a,b){let c=(0,j.sectionTokens)(b),e=c.reduce((a,b)=>a+b.tokens,0);i.logger.debug(`${a} prompt ${e} tokens — ${c.map(a=>`${a.name} ${a.tokens}`).join(", ")}`);let f=c[0];e>d.PROMPT_BUDGET&&f&&i.logger.warn(`${a} prompt is ${e} tokens, over ${d.PROMPT_BUDGET}: ${f.name} carries ${f.tokens} of it. Every call and every job pays this.`)},"mcpToolLines",0,function(a){let b=new Map;for(let c of a){let a=b.get(c.server);a?a.push(c.name):b.set(c.server,[c.name])}return[...b].map(([a,b])=>`- **${a}**: ${b.join(", ")}`).join("\n")},"noteLines",0,function(a,b=!1){return a.length?a.map(a=>{var c;let d,e=b?` \xb7 ${c=a.lastSeenAt,(d=Math.floor((Date.now()-(0,h.toDate)(c).getTime())/864e5))>=365?`${Math.floor(d/365)}y`:d>=30?`${Math.floor(d/30)}mo`:`${Math.max(d,0)}d`}`:"";return`- ${a.path} — ${a.description?.trim()} (${a.factCount})${e}`}).join("\n"):"(nothing saved yet)"},"reachNames",0,function(a,b){let c=b.map(a=>a.server===d.STUDIO_SERVER?q[a.name]??a.name:a.server);return[...new Set([...a.map(a=>a.name),...c])].join(", ")},"recentCallLines",0,function(a,b){let c=[],f=0;a:for(let h=a.length-1;h>=0;h--){let i=a[h];for(let a=i.turns.length-1;a>=0;a--){let h=function(a,b){if("tool"!==a.role)return`${"user"===a.role?"user":"you"}: ${a.text}`;let c=(0,g.searchOf)(a.tool,a.text);if(c){let b=[...new Set(c.sources.flatMap(a=>(0,k.hostOf)(a.url)??[]))];return`you → ${a.tool} "${(0,k.clip)(c.query??"",d.PROMPT_LINE.toolArgs)}"${b.length?` — ${b.join(", ")}`:""}`}let f=`you → ${a.tool??"tool"} ${(0,k.clip)(a.text,d.PROMPT_LINE.toolArgs)}`;if(a.tool!==e.TOOL_NAMES.thread_start)return f;let h=(0,g.startedLabel)(a.tool,a.text),i=h?b.jobs?.find(a=>a.label===h):void 0;if(!i)return f;let j=i.outcome?`: ${(0,k.clip)(i.outcome,d.PROMPT_LINE.jobOutcome)}`:"";return`you → ${a.tool} "${i.label}" (${i.id}) — ${i.status}${j}`}(i.turns[a],i),l=(0,j.estimateTokens)(h)+3;if(f+l>b&&c.length)break a;f+=l,c.push({call:i,line:h})}}c.reverse();let h=[],i=null;for(let{call:a,line:b}of c)a!==i&&(i=a,h.push(`### ${p(a.startedAt)}`)),h.push(b);return h.join("\n")},"saidStamp",0,a=>(0,b.format)(a,"yyyy-MM-dd (EEE) HH:mm"),"skillLines",0,(a,b={})=>a.map(a=>{var c;let e,g;return`- **${a.name}**: ${b.short?(c=a.description,e=d.PROMPT_LINE.skill,(g=(0,f.firstSentence)(c)).length>e?`${g.slice(0,e).trim()}…`:g):a.description}`}).join("\n"),"styleLines",0,a=>a?.trim()?`## Who they want you to be
90
92
 
91
93
  Their own words, on top of the character above: how you talk to them, how much to say, what to leave out. Where they differ from anything above, theirs wins.
92
94
 
@@ -106,7 +108,7 @@ ${b}, as an image:`},{type:"file",mediaType:"image/png",data:{type:"data",data:e
106
108
  what supports it. Say plainly what you could not find or confirm — do not fill
107
109
  the gap with a guess. Every number carries the date you saw it. Be brief: this
108
110
  is read by another model, not by a person.`,q=f.default.string().describe("What you want to know, as one full question. Put the place and the time in when they matter — the searcher sees nothing but this line.");async function m(a,b,c){let d=await fetch("https://api.exa.ai/search",{method:"POST",signal:c,headers:{"content-type":"application/json","x-api-key":a},body:JSON.stringify({query:b,type:"auto",numResults:g.SEARCH.sources,contents:{text:{maxCharacters:g.SEARCH.excerptChars},livecrawl:"fallback",livecrawlTimeout:5e3}})});if(!d.ok)return{text:`Exa answered ${d.status}: ${(0,k.clip)((await d.text()).trim(),200)}`,sources:[]};let e=(await d.json()).results??[];if(!e.length)return{text:"Nothing came back for that. Try other words, or open the page itself.",sources:[]};let f=e.flatMap(a=>a.url?.trim()?[{url:a.url.trim(),...a.title?.trim()?{title:a.title.trim()}:{}}]:[]);return{text:e.map(a=>{let b=[a.title?.trim(),a.url?.trim()].filter(Boolean).join(" — "),c=a.publishedDate?.slice(0,10);return[c?`${b} \xb7 ${c}`:b,a.text?.trim()].filter(Boolean).join("\n")}).join("\n\n"),sources:f}}async function n(a,b,c){let{text:e,sources:f}=await (0,d.generateText)({model:a.model,tools:a.tools,instructions:p,prompt:b,abortSignal:c}),h=[...new Set(f.flatMap(a=>"url"===a.sourceType?[a.title?`${a.title} — ${a.url}`:a.url]:[]))].slice(0,g.SEARCH.sources);return{text:[e.trim(),h.length?`Sources:
109
- ${h.join("\n")}`:""].filter(Boolean).join("\n\n"),sources:[]}}async function o(a,b,c){let d=AbortSignal.timeout(g.SEARCH.timeoutMs),e=b?AbortSignal.any([b,d]):d;return a(e).catch(a=>{if(b?.aborted)throw a;return{text:d.aborted?`The search did not come back in ${g.SEARCH.timeoutMs/1e3}s. ${c.slow}`:`Search failed: ${(0,k.errorToString)(a)}. ${c.failed}`,sources:[]}})}let r=async(a,b)=>{let c=await (0,j.readConfig)(i.EXA_API_KEY),d=a?.searchTools?{model:a.model,tools:a.searchTools}:null,g=c?(a,b)=>m(c,a,b):d?(a,b)=>n(d,a,b):null;return g?{[h.TOOL_NAMES.web_search]:(0,e.tool)({description:"Search the web and get back what the pages say, with their links. For a fact, a price, a date, what a page says. Not for a page that has to be clicked, filled, or signed into — that is the browser.",inputSchema:f.default.object({query:q}),execute:async({query:a},{abortSignal:c})=>{let d=await o(b=>g(a,b),c,{slow:"Ask something narrower, or open the page in the browser.",failed:"The browser is the other way in."});return b.fold(d.text,"web-search")}})}:{}},s=async a=>{let b=await (0,j.readConfig)(i.EXA_API_KEY);return b?{[h.TOOL_NAMES.web_search]:(0,e.tool)({description:"Search the web and get back what the pages say, with their links. For a fact, a price, a date, what a page says.",inputSchema:f.default.object({query:q}),execute:async({query:c},{abortSignal:d})=>{let e=await o(a=>m(b,c,a),d,{slow:"Ask something narrower, or hand it to a bot.",failed:"A bot can open the page instead."});return{results:await a.fold(e.text,"web-search"),sources:e.sources}}})}:{}};a.s(["createCallSearchTool",0,s,"createSearchTool",0,r]),c()}catch(a){c(a)}},!1),128232,a=>a.a(async(b,c)=>{try{var d=a.i(527990),e=a.i(723885),f=a.i(569572),g=a.i(762008),h=a.i(221214),i=b([h]);async function j(a){let b=await (0,h.ownLineOf)(a);if(!b)return{};let c=b.line?` It replaces the line you wrote before: "${b.line}".`:"";return{[g.TOOL_NAMES.describe_self]:(0,d.tool)({description:`Write your own line: a few words the roster reads after the description the user gave you, where Thursday and the other bots pick who gets a job.${c} Use it rarely — only when what you do has changed for good: the user told you what you are for, you now hold a skill of your own the description does not name, or the same kind of job keeps coming to you and it misses it. Never for one job, and never to describe a job.`,inputSchema:e.default.object({line:e.default.string().trim().min(1).max(f.COMMON_VALIDATE.shortDescription.max).describe("The whole line, in the words people ask with: what you do that the description does not say. Leave out any subject another bot's line in the roster already names, or a job has two bots to go to."),reason:e.default.string().trim().min(1).describe("What changed for good, in a sentence: why the roster should read this now.")}),execute:async({line:b,reason:c})=>{let d=await (0,h.writeOwnLine)(a,b,c);return d?d.was===b?"That is your line already; nothing changed.":{was:d.was,now:b,reason:c,note:"Thursday and the other bots read it from their next turn. Say in your answer that you wrote it, and why."}:"Nothing was written: the user keeps your line as it is now."}})}}[h]=i.then?(await i)():i,a.s(["createSelfTools",0,j]),c()}catch(a){c(a)}},!1),382442,a=>{"use strict";var b=a.i(527990),c=a.i(723885),d=a.i(569572),e=a.i(762008),f=a.i(487591),g=a.i(422807),h=a.i(821415);let i=c.default.string().describe("The site's address, like instagram.com. No path, no https://.");a.s(["createSignInTools",0,function(a,j,k){let l=k.PLAYWRIGHT_CLI_SESSION??"",m=async b=>{let c=await a.exec(b,{env:k,timeoutMs:d.BROWSER_CLI.loadMs});return 0===c.exitCode?null:(c.stderr||c.stdout).trim().slice(0,300)||`exit ${c.exitCode}`},n=async b=>{if(!await (0,f.sessionWindow)(a,k).catch(()=>!1))return"";let c=await a.exec('playwright-cli --raw run-code "async page => page.url()"',{env:k,timeoutMs:d.BROWSER_CLI.readMs}),g="";try{g=String(JSON.parse(c.stdout))}catch{}let h=await m("playwright-cli close")??await m("playwright-cli open")??await m(`playwright-cli state-load ${b}`)??(/^https?:/.test(g)?await m(`playwright-cli goto '${g.replaceAll("'","'\\''")}'`):null);return h?`The window closed, but your browser did not come back signed in: ${h}. Open it (\`playwright-cli open\`) and call \`${e.TOOL_NAMES.sign_in_use}\` with the site.`:`The window was for the sign-in, so it is closed: your browser goes on without one, signed in, on the same page. When what comes next is theirs to see, open it \`--headed\` and call \`${e.TOOL_NAMES.sign_in_use}\` again.`};return{[e.TOOL_NAMES.sign_in_use]:(0,b.tool)({description:"Sign your browser in to a site with a sign-in the user already made and the app kept. Open your browser first: the sign-in goes into the browser you have open, and opening another one afterwards throws it away.",inputSchema:c.default.object({site:i}),execute:async({site:b})=>{if(await (0,f.sessionBrowser)(a,k)==="theirs")return"You are working in their own Chrome: it is already signed in as them, and nothing is loaded into it. Go to the site.";let c=await (0,f.borrowSignIn)(b,j);if("none"===c.kind)return c.kept.length?`Nothing is kept for ${(0,g.siteOf)(b)}. Kept: ${c.kept.join(", ")} — call again with one of those if it is the same site. Otherwise open the site's sign-in page in a window they can see, ask them to sign in there, and call \`${e.TOOL_NAMES.sign_in_keep}\` once they have.`:`Nothing is kept for ${(0,g.siteOf)(b)}. Open its sign-in page in a window they can see, ask them to sign in there, and call \`${e.TOOL_NAMES.sign_in_keep}\` once they have.`;if("ask"===c.kind)return`The user keeps a ${c.signIn.site} sign-in (${c.signIn.account}) and has not let you use it. Ask them, as a question, whether you may; they allow it on screen. Call again once they have said yes.`;let d=(0,h.browserStateFile)();await a.writeFile(d,JSON.stringify(c.state));let i=await m(`playwright-cli state-load ${d}`).finally(()=>a.exec(`rm -f ${d}`));return!i&&l&&(0,f.holdSignIn)(l,j,c.signIn.site),i?`The sign-in could not be loaded into your browser: ${i}. Open the browser you mean to keep (\`playwright-cli open …\`, headed if you want a window), then call this again — opening another browser after this throws the sign-in away.`:`Signed in to ${c.signIn.site} as ${c.signIn.account}. Go to the site again (\`goto\`) — a page drawn before this still looks signed out. If it still shows you signed out after that, the site does not accept a sign-in carried over from another browser, and signing in again here will not last either: work in their own Chrome instead, \`playwright-cli attach --extension=chrome\`.`}}),[e.TOOL_NAMES.sign_in_keep]:(0,b.tool)({description:"Keep the sign-in the user just made in your browser window, so later work is signed in without asking them again. Call it right after they say they signed in. The window was for the sign-in: it closes, and your browser goes on without one, signed in, on the same page.",inputSchema:c.default.object({site:i,account:c.default.string().describe("Who it is signed in as, as the site shows it — a handle, an email. The site's name when nothing is shown."),keepWindow:c.default.boolean().nullish().describe("True when what comes next on this site is theirs to see — the products to choose, a checkout to confirm — and the window stays up.")}),execute:async({site:b,account:c,keepWindow:d})=>{if(await (0,f.sessionBrowser)(a,k)==="theirs")return"You are working in their own Chrome: it stays signed in as them by itself, and nothing is kept from it.";let e=(0,h.browserStateFile)(),g=await m((0,h.saveBrowserState)(e));if(g)return await a.exec(`rm -f ${e}`),`The browser's state could not be read: ${g}. Nothing was kept.`;try{let g=JSON.parse(await a.readFile(e,"utf-8")),h=await (0,f.keepSignIn)({site:b,account:c,bot:j,state:g});if("taken"===h.kind)return`Not kept: the user already keeps a ${h.signIn.site} sign-in (${h.signIn.account}) for other bots, and only they choose who uses it. This browser stays signed in for this job. Ask them, as a question, whether you may use the kept one — they allow it under Settings › Sign-ins — or, if this one should replace it, to sign out of the kept one there first; then call this again.`;l&&(0,f.holdSignIn)(l,j,h.signIn.site);let i=`Kept: ${h.signIn.site} as ${h.signIn.account}. It is listed for them under Settings › Sign-ins, where they can sign out of it.`;return d?i:`${i} ${await n(e)}`.trim()}finally{await a.exec(`rm -f ${e}`)}}})}}])},451017,a=>a.a(async(b,c)=>{try{var d=a.i(527990),e=a.i(723885),f=a.i(569572),g=a.i(762008),h=a.i(138100),i=a.i(762805),j=b([h,i]);[h,i]=j.then?(await j)():j,a.s(["createSkillTools",0,({skills:a,sandbox:b,bot:c})=>({[g.TOOL_NAMES.load_skill]:(0,d.tool)({description:"Load one skill: its instructions, and the files that ship with it.",inputSchema:e.default.object({name:e.default.string().describe("Exact name from the Skills list, or of a skill installed during this job. Do not guess names.")}),execute:async({name:d},{messages:e})=>{let j=(a,b)=>a.find(a=>a.name.toLowerCase()===b.toLowerCase()),k=j(a,d)?a:await (0,h.loadSkills)(b,c),l=j(k,d)?void 0:f.SKILLS_FOLDED[d.toLowerCase()],m=j(k,l??d);if(!m)return{error:`No skill named '${d}'.`,available:k.map(a=>a.name)};let n=`${m.path}/SKILL.md`;if(e.some(a=>Array.isArray(a.content)&&a.content.some(a=>{if("tool-result"!==a.type||a.toolName!==g.TOOL_NAMES.load_skill||"json"!==a.output.type)return!1;let b=a.output.value;return b?.skillDirectory===m.path&&"string"==typeof b.content})))return{skillDirectory:m.path,note:`Use the full '${m.name}' instructions already in your conversation. To check for changes on disk, read ${n} with the shell.`};let o=await b.readFile(n,"utf-8"),{body:p}=(0,i.splitFrontmatter)(o),{files:q,total:r}=await b.listFiles(m.path,{limit:f.SKILL_FILES_LISTED,skip:[f.PATHS.skills.runtime]});return{skillDirectory:m.path,files:q.map(a=>`${m.path}/${a}`),...r>q.length&&{more:`${r-q.length} more files, deeper in these folders. List a folder in the shell to see them.`},...l&&{note:`'${d}' is part of '${m.name}' now: these are its instructions.`},content:p}}})})]),c()}catch(a){c(a)}},!1),500777,a=>a.a(async(b,c)=>{try{var d=a.i(912714),e=a.i(750227),f=a.i(47919),g=a.i(12208),h=a.i(723885),i=a.i(569572),j=a.i(875931),k=a.i(762008),l=a.i(684321),m=a.i(176668),n=a.i(182248),o=b([j]);function p(a){return{...a,execute:(b,c)=>{let d=a.inputSchema.safeParse(b);if(!d.success)throw Error(h.default.prettifyError(d.error));return a.execute(d.data,c)}}}function q(a,b){let c=(0,n.slug)(a),d=(0,g.format)(new Date,"yyyyMMdd-HHmmss");return`${d}${c?`-${c}`:""}.${b}`}async function r(a,b,c,d){let e=`${b}/${c}`;return await a.exec(`mkdir -p ${b}`),await a.writeFile(e,Buffer.from(d)),e}async function s(a,b){let c=b.trim();if("image"!==(0,l.viewKindOf)(c))return`${c} is not a picture. Work from a png, jpg, webp or gif.`;let e=a.resolve(c),f=await (0,d.stat)(e).catch(()=>null);return f?.isFile()?f.size>i.LOOK.maxBytes?`${c} is ${Math.ceil(f.size/1024/1024)} MB, over the ${i.LOOK.maxBytes/1024/1024} MB one picture takes. Make a smaller copy in the shell first (on a Mac: sips -Z 1600 in.png --out out.png), then use that.`:(0,d.readFile)(e):`There is no file at ${c}. Give the path from the workspace root, as \`ls\` shows it.`}[j]=o.then?(await o)():o;let v=a=>`${a}
111
+ ${h.join("\n")}`:""].filter(Boolean).join("\n\n"),sources:[]}}async function o(a,b,c){let d=AbortSignal.timeout(g.SEARCH.timeoutMs),e=b?AbortSignal.any([b,d]):d;return a(e).catch(a=>{if(b?.aborted)throw a;return{text:d.aborted?`The search did not come back in ${g.SEARCH.timeoutMs/1e3}s. ${c.slow}`:`Search failed: ${(0,k.errorToString)(a)}. ${c.failed}`,sources:[]}})}let r=async(a,b)=>{let c=await (0,j.readConfig)(i.EXA_API_KEY),d=a?.searchTools?{model:a.model,tools:a.searchTools}:null,g=c?(a,b)=>m(c,a,b):d?(a,b)=>n(d,a,b):null;return g?{[h.TOOL_NAMES.web_search]:(0,e.tool)({description:"Search the web and get back what the pages say, with their links. For a fact, a price, a date, what a page says. Not for a page that has to be clicked, filled, or signed into — that is the browser.",inputSchema:f.default.object({query:q}),execute:async({query:a},{abortSignal:c})=>{let d=await o(b=>g(a,b),c,{slow:"Ask something narrower, or open the page in the browser.",failed:"The browser is the other way in."});return b.fold(d.text,"web-search")}})}:{}},s=async a=>{let b=await (0,j.readConfig)(i.EXA_API_KEY);return b?{[h.TOOL_NAMES.web_search]:(0,e.tool)({description:"Search the web and get back what the pages say, with their links. For a fact, a price, a date, what a page says.",inputSchema:f.default.object({query:q}),execute:async({query:c},{abortSignal:d})=>{let e=await o(a=>m(b,c,a),d,{slow:"Ask something narrower, or hand it to a bot.",failed:"A bot can open the page instead."});return{results:await a.fold(e.text,"web-search"),sources:e.sources}}})}:{}};a.s(["createCallSearchTool",0,s,"createSearchTool",0,r]),c()}catch(a){c(a)}},!1),128232,a=>a.a(async(b,c)=>{try{var d=a.i(527990),e=a.i(723885),f=a.i(569572),g=a.i(762008),h=a.i(221214),i=b([h]);async function j(a){let b=await (0,h.ownLineOf)(a);if(!b)return{};let c=b.line?` It replaces the line you wrote before: "${b.line}".`:"";return{[g.TOOL_NAMES.describe_self]:(0,d.tool)({description:`Write your own line: a few words the roster reads after the description the user gave you, where Thursday and the other bots pick who gets a job.${c} Use it rarely — only when what you do has changed for good: the user told you what you are for, you now hold a skill of your own the description does not name, or the same kind of job keeps coming to you and it misses it. Never for one job, and never to describe a job.`,inputSchema:e.default.object({line:e.default.string().trim().min(1).max(f.COMMON_VALIDATE.shortDescription.max).describe("The whole line, in the words people ask with: what you do that the description does not say. Leave out any subject another bot's line in the roster already names, or a job has two bots to go to."),reason:e.default.string().trim().min(1).describe("What changed for good, in a sentence: why the roster should read this now.")}),execute:async({line:b,reason:c})=>{let d=await (0,h.writeOwnLine)(a,b,c);return d?d.was===b?"That is your line already; nothing changed.":{was:d.was,now:b,reason:c,note:"Thursday and the other bots read it from their next turn. Say in your answer that you wrote it, and why."}:"Nothing was written: the user keeps your line as it is now."}})}}[h]=i.then?(await i)():i,a.s(["createSelfTools",0,j]),c()}catch(a){c(a)}},!1),382442,a=>{"use strict";var b=a.i(527990),c=a.i(723885),d=a.i(569572),e=a.i(762008),f=a.i(487591),g=a.i(422807),h=a.i(821415),i=a.i(176668);let j=c.default.string().describe("The site's address, like instagram.com. No path, no https://.");a.s(["createSignInTools",0,function(a,k,l){let m=async b=>{let c=await a.exec(b,{env:l,timeoutMs:d.BROWSER_CLI.loadMs});return 0===c.exitCode?null:(c.stderr||c.stdout).trim().slice(0,300)||`exit ${c.exitCode}`},n=async(b,c)=>{if(!await (0,f.sessionWindow)(a,l).catch(()=>!1))return"";let g=await a.exec('playwright-cli --raw run-code "async page => page.url()"',{env:l,timeoutMs:d.BROWSER_CLI.readMs}),h="";try{h=String(JSON.parse(g.stdout))}catch{}let i=await m("playwright-cli close")??await m("playwright-cli open")??await m(`playwright-cli state-load ${b}`);i?(0,f.forgetBrowser)(l):await (0,f.carryHold)(a,l);let j=i??(/^https?:/.test(h)?await m(`playwright-cli goto '${h.replaceAll("'","'\\''")}'`):null),k=`\`${e.TOOL_NAMES.sign_in_use}\` with ${c.site} and \`account\` ${c.account}`;return j?`The window closed, but your browser did not come back signed in: ${j}. Open it (\`playwright-cli open\`) and call ${k}.`:`The window was for the sign-in, so it is closed: your browser goes on without one, signed in, on the same page. When what comes next is theirs to see, open it \`--headed\` and call ${k} again.`};return{[e.TOOL_NAMES.sign_in_use]:(0,b.tool)({description:"Sign your browser in to a site with a sign-in the user already made and the app kept. Open your browser first: the sign-in goes into the browser you have open, and opening another one afterwards throws it away.",inputSchema:c.default.object({site:j,account:c.default.string().nullish().describe("Which of the site's accounts, as the app names them, when it keeps more than one.")}),execute:({site:b,account:c})=>(0,f.inBrowser)(l,async()=>{if(await (0,f.sessionBrowser)(a,l)==="theirs")return"You are working in their own Chrome: it is already signed in as them, and nothing is loaded into it. Go to the site.";await (0,f.renewHeld)(a,l).catch(a=>i.logger.warn(`${k}: kept sign-ins were not renewed`,a));let d=await (0,f.borrowSignIn)(b,k,c);if("none"===d.kind)return d.kept.length?`Nothing is kept for ${(0,g.siteOf)(b)}. Kept: ${d.kept.join(", ")} — call again with one of those if it is the same site. Otherwise open the site's sign-in page in a window they can see, ask them to sign in there, and call \`${e.TOOL_NAMES.sign_in_keep}\` once they have.`:`Nothing is kept for ${(0,g.siteOf)(b)}. Open its sign-in page in a window they can see, ask them to sign in there, and call \`${e.TOOL_NAMES.sign_in_keep}\` once they have.`;if("pick"===d.kind)return c?.trim()?`Nothing is kept for ${d.site} as ${c.trim()}. Kept there: ${d.accounts.join(", ")} — call again with one of those as it is written. For another account, open the site's sign-in page in a new browser they can see (\`playwright-cli open <its sign-in url> --headed\`), ask them to sign in there, and call \`${e.TOOL_NAMES.sign_in_keep}\` once they have.`:`${d.site} keeps more than one account: ${d.accounts.join(", ")}. Call again with \`account\`, the one this work is for; when the user has not said which, ask them.`;if("ask"===d.kind)return`The user keeps a ${d.signIn.site} sign-in (${d.signIn.account}) and has not let you use it. Ask them, as a question, whether you may; they allow it on screen. Call again with \`account\` ${d.signIn.account} once they have said yes.`;let j=(0,h.browserStateFile)();await a.writeFile(j,JSON.stringify(d.state));let n=await m(`playwright-cli state-load ${j}`).finally(()=>a.exec(`rm -f ${j}`));return n?(0,f.forgetBrowser)(l):await (0,f.holdSignIn)(a,l,k,d.signIn,"loaded"),n?`The sign-in could not be loaded into your browser: ${n}. Open the browser you mean to keep (\`playwright-cli open …\`, headed if you want a window), then call this again — opening another browser after this throws the sign-in away.`:`Signed in to ${d.signIn.site} as ${d.signIn.account}. Go to the site again (\`goto\`) — a page drawn before this still looks signed out. If it still shows you signed out after that, the site does not accept a sign-in carried over from another browser, and signing in again here will not last either: work in their own Chrome instead, \`playwright-cli attach --extension=chrome\`.`})}),[e.TOOL_NAMES.sign_in_keep]:(0,b.tool)({description:"Keep the sign-in the user just made in your browser window, so later work is signed in without asking them again. Call it right after they say they signed in. The window was for the sign-in: it closes, and your browser goes on without one, signed in, on the same page.",inputSchema:c.default.object({site:j,account:c.default.string().describe("Who it is signed in as, as the site shows it — a handle, an email. The site's name when nothing is shown."),keepWindow:c.default.boolean().nullish().describe("True when what comes next on this site is theirs to see — the products to choose, a checkout to confirm — and the window stays up."),another:c.default.boolean().nullish().describe("True when this is a different account from the ones the app keeps for the site.")}),execute:({site:b,account:c,keepWindow:d,another:e})=>(0,f.inBrowser)(l,async()=>{if(await (0,f.sessionBrowser)(a,l)==="theirs")return"You are working in their own Chrome: it stays signed in as them by itself, and nothing is kept from it.";(0,f.releaseSignIn)(l,b);let g=(0,h.browserStateFile)(),i=await m((0,h.saveBrowserState)(g));if(i)return await a.exec(`rm -f ${g}`),`The browser's state could not be read: ${i}. Nothing was kept.`;try{let h=JSON.parse(await a.readFile(g,"utf-8")),i=await (0,f.keepSignIn)({site:b,account:c,bot:k,state:h,another:e});if("unlisted"===i.kind)return`Not kept yet: ${i.site} keeps ${i.accounts.join(", ")}. If they signed in again as one of those, call this again with \`account\` written as it is there; if this is a different account, call again with \`another\` set to true.`;if("clash"===i.kind)return`Not kept yet: ${i.site} keeps a sign-in as ${c.trim()||i.site} already. If this is that account signed in again, call this again without \`another\`; if it is a different one, call again with an \`account\` that tells it apart from ${i.accounts.join(", ")} — what the site shows for it, or what the user calls it.`;if("taken"===i.kind)return`Not kept: the user already keeps a ${i.signIn.site} sign-in (${i.signIn.account}) for other bots, and only they choose who uses it. This browser stays signed in for this job. Ask them, as a question, whether you may use the kept one — they allow it under Settings › Sign-ins — or, if this one should replace it, to sign out of the kept one there first; then call this again.`;await (0,f.holdSignIn)(a,l,k,i.signIn,"kept");let j=`Kept: ${i.signIn.site} as ${i.signIn.account}${i.replaced?", in place of the sign-in kept under that name before":""}. It is listed for them under Settings › Sign-ins, where they can sign out of it.`;return d?j:`${j} ${await n(g,i.signIn)}`.trim()}finally{await a.exec(`rm -f ${g}`)}})})}}])},451017,a=>a.a(async(b,c)=>{try{var d=a.i(527990),e=a.i(723885),f=a.i(569572),g=a.i(762008),h=a.i(138100),i=a.i(762805),j=b([h,i]);[h,i]=j.then?(await j)():j,a.s(["createSkillTools",0,({skills:a,sandbox:b,bot:c})=>({[g.TOOL_NAMES.load_skill]:(0,d.tool)({description:"Load one skill: its instructions, and the files that ship with it.",inputSchema:e.default.object({name:e.default.string().describe("Exact name from the Skills list, or of a skill installed during this job. Do not guess names.")}),execute:async({name:d},{messages:e})=>{let j=(a,b)=>a.find(a=>a.name.toLowerCase()===b.toLowerCase()),k=j(a,d)?a:await (0,h.loadSkills)(b,c),l=j(k,d)?void 0:f.SKILLS_FOLDED[d.toLowerCase()],m=j(k,l??d);if(!m)return{error:`No skill named '${d}'.`,available:k.map(a=>a.name)};let n=`${m.path}/SKILL.md`;if(e.some(a=>Array.isArray(a.content)&&a.content.some(a=>{if("tool-result"!==a.type||a.toolName!==g.TOOL_NAMES.load_skill||"json"!==a.output.type)return!1;let b=a.output.value;return b?.skillDirectory===m.path&&"string"==typeof b.content})))return{skillDirectory:m.path,note:`Use the full '${m.name}' instructions already in your conversation. To check for changes on disk, read ${n} with the shell.`};let o=await b.readFile(n,"utf-8"),{body:p}=(0,i.splitFrontmatter)(o),{files:q,total:r}=await b.listFiles(m.path,{limit:f.SKILL_FILES_LISTED,skip:[f.PATHS.skills.runtime]});return{skillDirectory:m.path,files:q.map(a=>`${m.path}/${a}`),...r>q.length&&{more:`${r-q.length} more files, deeper in these folders. List a folder in the shell to see them.`},...l&&{note:`'${d}' is part of '${m.name}' now: these are its instructions.`},content:p}}})})]),c()}catch(a){c(a)}},!1),500777,a=>a.a(async(b,c)=>{try{var d=a.i(912714),e=a.i(750227),f=a.i(47919),g=a.i(12208),h=a.i(723885),i=a.i(569572),j=a.i(875931),k=a.i(762008),l=a.i(684321),m=a.i(176668),n=a.i(182248),o=b([j]);function p(a){return{...a,execute:(b,c)=>{let d=a.inputSchema.safeParse(b);if(!d.success)throw Error(h.default.prettifyError(d.error));return a.execute(d.data,c)}}}function q(a,b){let c=(0,n.slug)(a),d=(0,g.format)(new Date,"yyyyMMdd-HHmmss");return`${d}${c?`-${c}`:""}.${b}`}async function r(a,b,c,d){let e=`${b}/${c}`;return await a.exec(`mkdir -p ${b}`),await a.writeFile(e,Buffer.from(d)),e}async function s(a,b){let c=b.trim();if("image"!==(0,l.viewKindOf)(c))return`${c} is not a picture. Work from a png, jpg, webp or gif.`;let e=a.resolve(c),f=await (0,d.stat)(e).catch(()=>null);return f?.isFile()?f.size>i.LOOK.maxBytes?`${c} is ${Math.ceil(f.size/1024/1024)} MB, over the ${i.LOOK.maxBytes/1024/1024} MB one picture takes. Make a smaller copy in the shell first (on a Mac: sips -Z 1600 in.png --out out.png), then use that.`:(0,d.readFile)(e):`There is no file at ${c}. Give the path from the workspace root, as \`ls\` shows it.`}[j]=o.then?(await o)():o;let v=a=>`${a}
110
112
  Saved. Give the user this path — the file opens from the thread row. Do not describe it back to them; they can open it.`,w=(a,b)=>a?.split("/")[1]?.split(";")[0]||b,x=["1:1","16:9","9:16","4:3","3:4"],y=async()=>{let a=await (0,j.resolveMediaRef)("image");if(!a)return null;let b=(0,j.buildImageModel)(a.ref,a.apiKey);return p({name:k.STUDIO_TOOLS.generate_image,description:"Draw an image and save it as a file in the workspace, or change pictures already there. What comes back is its path.",inputSchema:h.default.object({prompt:h.default.string().describe("What to draw, described: subject, style, mood, what is in frame. With `images`, what to change about them. The image model does not see the job or the conversation, so nothing can be left implied."),images:h.default.array(h.default.string()).nullish().describe("Workspace paths of pictures to work from: the one being changed, or ones to draw from. Hand the picture over rather than describing it — whatever the words leave out is kept. Null to draw from nothing."),aspectRatio:h.default.enum(x).nullish().describe("Aspect ratio. Null for square, or for the shape of what `images` names.")}),execute:async({prompt:a,images:c,aspectRatio:d},{sandbox:e,artifacts:g,abortSignal:h})=>{let i=[];for(let a of c??[]){let b=await s(e,a);if("string"==typeof b)return b;i.push(b)}let{image:j}=await (0,f.generateImage)({model:b,prompt:i.length?{images:i,text:a}:a,aspectRatio:d??(i.length?void 0:"1:1"),abortSignal:h}),k=await r(e,g,q(a,w(j.mediaType,"png")),j.uint8Array);return v(k)}})},z=async()=>{let a=await (0,j.resolveMediaRef)("speech");if(!a)return null;let b=(0,j.buildSpeechModel)(a.ref,a.apiKey);return p({name:k.STUDIO_TOOLS.generate_speech,description:"Read text aloud into an audio file in the workspace — something the user listens to or sends, not Thursday's voice. What comes back is its path.",inputSchema:h.default.object({text:h.default.string().min(1).max(4e3).describe("The words to read, up to 4000 characters. Longer pieces are read in parts, one call each."),voice:h.default.string().nullish().describe("A voice name the provider knows. Null for its default."),instructions:h.default.string().nullish().describe('How to read it — "slowly", "warm", "like a news anchor". Null for plain.')}),execute:async({text:a,voice:c,instructions:d},{sandbox:e,artifacts:g,abortSignal:h})=>{let{audio:i}=await (0,f.generateSpeech)({model:b,text:a,voice:c??void 0,instructions:d??void 0,outputFormat:"mp3",abortSignal:h}),j=await r(e,g,q(a.slice(0,60),i.format||"mp3"),i.uint8Array);return v(j)}})},A=async()=>{let a=await (0,j.resolveMediaRef)("transcription");if(!a)return null;let b=(0,j.buildTranscriptionModel)(a.ref,a.apiKey);return p({name:k.STUDIO_TOOLS.transcribe,description:"Turn an audio file — a recording, a voice memo, a meeting — into text. The transcript is saved as a file in the workspace; what comes back is its path and the text.",inputSchema:h.default.object({path:h.default.string().min(1).describe("The audio file: a path relative to the workspace, or an absolute one anywhere on this machine.")}),execute:async({path:a},{sandbox:c,artifacts:g,abortSignal:h})=>{var i,j;let k,l=await (0,d.readFile)(c.resolve(a)),m=await (0,f.transcribe)({model:b,audio:l,abortSignal:h}),n=(0,e.basename)(a,(0,e.extname)(a)),o=await r(c,g,q(n,"md"),Buffer.from((i=m.text,k=(j=m.segments).length?`
111
113
 
112
114
  ## Timeline
@@ -141,9 +143,9 @@ Plain text, under ${f} words. No preamble, no headings about the summary itself,
141
143
 
142
144
  ${j}`,usage:C(i)}}let C=a=>({input:a.inputTokens??0,output:a.outputTokens??0,cacheRead:a.inputTokenDetails?.cacheReadTokens??0,cacheWrite:a.inputTokenDetails?.cacheWriteTokens??0}),D=(a,b)=>(0,d.createHash)("sha256").update(`${a}
143
145
  ${b}`).digest("hex").slice(0,32);function A(a,b={}){return a.provider&&a.model?(0,i.getTextModel)({provider:a.provider,model:a.model}):(0,i.resolveDefaultModel)(void 0,b).then(i.getTextModel)}a.s(["resolveModel",0,A,"resumeTranscript",0,function(a,b=new Map){let c=new Map,d=new Set;for(let b of a)if(("tool"===b.role||"assistant"===b.role)&&Array.isArray(b.content))for(let a of b.content)"tool-result"===a.type&&(c.has(a.toolCallId)||c.set(a.toolCallId,a),"assistant"===b.role&&d.add(a.toolCallId));let e=[],f=new Set;for(let g of a){if("tool"===g.role){let a=g.content.filter(a=>"tool-result"!==a.type);a.length&&e.push({...g,content:a});continue}if("assistant"!==g.role||"string"==typeof g.content){e.push(g);continue}let a=[],h=[];for(let e of g.content){if("tool-call"!==e.type){h.push(e);continue}if(f.has(e.toolCallId))continue;let g=e.input;if("string"==typeof g)try{g=JSON.parse(g)}catch{g=void 0}if(!e.toolCallId||void 0===g){h.push({type:"text",text:"A tool argument stream was interrupted before a complete call was recorded. Inspect the saved work before continuing."});continue}let i=e.toolName===l.TOOL_NAMES.send_message?b.get(e.toolCallId):void 0,j=c.get(e.toolCallId)??(i?{type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:{type:"json",value:i}}:void 0);if(e.providerExecuted&&(!j||!d.has(e.toolCallId))){h.push({type:"text",text:j?`The provider operation ${e.toolName} returned this data before its native continuation was interrupted: ${JSON.stringify(j.output)}`:`The provider operation ${e.toolName} was interrupted without a recorded result. Its remote execution state is unknown.`});continue}f.add(e.toolCallId),h.push({...e,input:g}),d.has(e.toolCallId)||a.push(j??{type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:{type:"text",value:"No result: execution was interrupted before a result was recorded. The outcome is unknown. Inspect the current state before repeating the action."}})}h.length&&e.push({...g,content:h}),a.length&&e.push({role:"tool",content:a})}return e},"runBot",0,w]),c()}catch(a){c(a)}},!1),674986,a=>a.a(async(b,c)=>{try{var d=a.i(136340),e=a.i(203469),f=a.i(569572),g=a.i(875931),h=a.i(735502),i=a.i(569549),j=a.i(684321),k=a.i(821415),l=a.i(956802),m=a.i(176668),n=a.i(293480),o=a.i(8412),p=a.i(182248),q=a.i(221214),r=a.i(654034),s=a.i(446957),t=a.i(839430),u=a.i(109955),v=a.i(344853),w=b([g,h,i,q,r,t,v]);[g,h,i,q,r,t,v]=w.then?(await w)():w;let K=globalThis.__roomRuns??=new Map,L=globalThis.__roomThreadLock??=(0,o.createKeyedLock)(),M=globalThis.__roomCompactAsked??=new Set,N=(a,b)=>`${a}
144
- ${b}`;async function x(a){let b=await (0,q.findJobBot)(a.bot);(!b||b.disabled)&&(0,n.publicError)("Choose an enabled bot.");let{from:c,routine:d,...e}={...a,bot:b.name},f=(0,h.buildThreadOpening)({bot:e.bot,request:e.request,from:c,routine:d}),g=await (0,v.insertThread)({...e,routineId:d?.id??null,opening:f});return await z(g.id),g.id}async function y(a,b,c="user",d,e){let f=null;return await L(a,async()=>{let g=await (0,v.findThread)(a);if(g||(0,n.publicError)("No such thread."),d){let b=(await (0,t.listRoomWork)(a)).find(a=>a.bot.toLowerCase()===d.trim().toLowerCase());b&&b.bot!==u.ROOM_THURSDAY||(0,n.publicError)("Choose a participant in this thread."),d=b.bot}b.trim()===s.THREAD_CONTINUE&&(0,s.isAppStop)(g.pending)?(await (0,t.resumeRoom)(a),(await (0,t.listRoomWork)(a)).some(a=>"queued"===a.state)||(f=await (0,t.tellRoom)(a,"Continue from the saved conversation.","user"===c?u.ROOM_USER:u.ROOM_THURSDAY,d,void 0,!1))):f=await (0,t.tellRoom)(a,b,"user"===c?u.ROOM_USER:u.ROOM_THURSDAY,d,e)}),await z(a),f}async function z(a){await L(a,async()=>{for(let b=0;b<2;b++){let b;for(;b=await (0,t.claimRoomWork)(a);)!function(a){let b,c=new AbortController,d=new Promise(a=>{b=a});K.set(a.id,{threadId:a.threadId,stop:c,done:d}),A(a,c.signal).catch(b=>m.logger.error(`thread ${a.threadId}: participant`,b)).finally(()=>{K.delete(a.id),b(),z(a.threadId).catch(b=>m.logger.error(`thread ${a.threadId}: scheduling`,b))})}(b);await (0,t.settleRoom)(a)}})}async function A(a,b){let c=await B(a,b);if(c?.failure?.retry&&!b.aborted&&(await (0,t.noteRoomBreak)(a,c.failure.message),await (0,d.setTimeout)(f.BOT_RUN.retryMs,void 0,{signal:b}).catch(()=>{}),b.aborted||(c=await B(a,b,!1))),!c||b.aborted)return;let g=c.failure?.message,h=c.ending;if(g||!h||h.stopped){let b=g??"The turn was interrupted. Continue from the saved conversation.";L(a.threadId,async()=>{let c=(await (0,t.listRoomWork)(a.threadId)).find(b=>b.id===a.id);if(c?.state!=="running"||c.generation!==a.generation)return;let d=C(a.threadId);await (0,t.pauseRoom)(a.threadId,b),await d}).catch(b=>m.logger.error(`thread ${a.threadId}: pausing`,b));return}await (0,t.finishRoomWork)(a,h.text);let n=await (0,v.findThread)(a.threadId);if(n?.status==="done"){let a=(0,p.plainText)(n.outcome??"").slice(0,f.FINISHED_NOTICE.words);e.presence.watching||await (0,i.isAnyCallLive)()||(0,l.desktopNotify)(n.label,a);let b=await (0,k.filesOnDisk)((0,j.pathsIn)(n.outcome??""),null);e.appEvents.emit({type:"finished",threadId:n.id,label:n.label,bot:n.bot,words:a,paths:(0,j.leadFirst)(b)})}}async function B(a,b,c=!0){let d=new O(a,b),e=null,f=null;try{let g=await (0,v.findThread)(a.threadId);if(!g)return null;if((await (0,t.listParticipantTranscript)(a.threadId,a.bot)).length||await (0,t.joinRoom)(a,b=>(0,h.buildJoinOpening)({bot:a.bot,coordinator:g.bot,job:b,request:g.request})),await (0,t.consumeRoomInbox)(a),c&&(0,u.isCoordinatorSeat)(a.bot,g.bot,a.caller)){let b=await (0,t.roomBoard)(a);b&&await (0,t.appendRoomMessage)(a.threadId,{bot:a.bot,parent:a.id,role:"user",content:b,hidden:!0})}let i=await (0,t.listParticipantTranscript)(a.threadId,a.bot);await (0,r.runBot)({bot:a.bot,messages:(0,r.resumeTranscript)(i,await (0,t.listRoomReceipts)(a.threadId,a.bot,i))},{signal:b,threadId:a.threadId,parent:a.id,caller:a.caller,owner:g.bot,contextBudget:await (0,t.roomContextBudget)(a.threadId,a.bot),compactNow:()=>M.delete(N(a.threadId,a.bot)),session:(0,k.botBrowserSession)(a.threadId,a.bot),notes:()=>(0,t.consumeRoomInbox)(a),send:async c=>{b.throwIfAborted();let d=c.to.trim();if(d.toLowerCase()===u.ROOM_THURSDAY.toLowerCase())d=u.ROOM_THURSDAY;else{let a=await (0,q.findJobBot)(d);(!a||a.disabled)&&(0,n.publicError)(`No enabled bot named "${d}".`),d=a.name}let e=await (0,t.sendRoomMessage)(a,{...c,to:d});return z(a.threadId).catch(a=>m.logger.error("room message scheduling",a)),e},emit:async c=>{(!b.aborted||"tool-result"===c.type)&&(await d.on(c),"step"===c.type&&await (0,v.addThreadUsage)(a.threadId,c.usage,a.bot===g.bot?{tokens:c.usage.input,budget:c.budget}:null),"compact"===c.type&&await (0,v.addThreadUsage)(a.threadId,c.usage),"turn-end"===c.type&&(e=c),"error"===c.type&&(f={message:c.message,retry:c.retry},c.budget&&await (0,t.lowerRoomContextBudget)(a,c.budget)))}})}catch(c){b.aborted||(m.logger.error(`thread ${a.threadId}: ${a.bot} broke`,c),f={message:(0,g.modelErrorToString)(c),retry:!(0,n.isPublicError)(c)&&!(0,g.isProviderRefusal)(c)})}return{ending:e,failure:f}}class O{work;signal;lane;assistant;tool;parts;calls;results;constructor(a,b){this.work=a,this.signal=b,this.lane=(0,p.PromiseChain)(),this.assistant=null,this.tool=null,this.parts={assistant:[],tool:[]},this.calls=new Set,this.results=new Set}async write(a,b,c=!1){let d={bot:this.work.bot,parent:this.work.id,role:b.role,content:b.content,compact:c,note:c};return null===a?(0,t.appendRoomMessage)(this.work.threadId,d):(await (0,v.upsertMessage)(this.work.threadId,a,d),a)}on(a){return this.lane(async()=>{if(!this.signal.aborted||"tool-result"===a.type)if("text"===a.type)this.parts.assistant.push({type:"text",text:a.text}),this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant});else if("tool"===a.type){if(this.calls.has(a.id)){let b=this.parts.assistant.find(b=>"tool-call"===b.type&&b.toolCallId===a.id);b&&"tool-call"===b.type&&a.providerOptions&&(b.providerOptions=a.providerOptions,this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant}));return}this.calls.add(a.id),this.parts.assistant.push({type:"tool-call",toolCallId:a.id,toolName:a.name,input:a.input,...a.providerExecuted?{providerExecuted:!0}:{},...a.providerOptions?{providerOptions:a.providerOptions}:{}}),this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant})}else if("tool-result"===a.type){if(this.results.has(a.id))return;this.results.add(a.id),this.parts.tool.push({type:"tool-result",toolCallId:a.id,toolName:a.name,output:a.error?{type:"error-text",value:String(a.output)}:"string"==typeof a.output?{type:"text",value:a.output}:{type:"json",value:a.output}}),this.tool=await this.write(this.tool,{role:"tool",content:this.parts.tool})}else if("step"===a.type){let b=[this.assistant,this.tool];for(let[c,d]of a.messages.entries())await this.write(b[c]??null,d);let c=b.slice(a.messages.length).filter(a=>null!==a);c.length&&await (0,v.deleteMessages)(this.work.threadId,c),this.assistant=this.tool=null,this.parts={assistant:[],tool:[]}}else"compact"===a.type&&await this.write(null,{role:"user",content:a.text},!0)})}}async function C(a){let b=[...K.values()].filter(b=>b.threadId===a);for(let a of b)a.stop.abort();await Promise.all(b.map(a=>a.done))}async function D(a){await L(a,async()=>{let b=await (0,v.findThread)(a);b||(0,n.publicError)("No such thread."),b.endedAt&&(0,n.publicError)("That thread has already ended."),await (0,t.cancelRoom)(a),await (0,v.updateThread)(a,{status:"cancelled",outcome:null,pending:null,seen:!0,endedAt:new Date}),await C(a),await (0,k.closeJobShell)(a)})}async function E(a){return L(a,()=>F(a))}async function F(a){let b=await (0,v.findThread)(a);await (0,t.cancelRoom)(a),await C(a),await (0,k.removeJobBrowsers)(a);let c=await (0,v.deleteThread)(a);return c&&b&&await (0,k.removeJobScratch)(a,b.label),c}async function G(a){let b=a?.getTime(),c=a=>void 0===b||(a.endedAt??a.updatedAt).getTime()<b,d=0;for(let a of(await (0,v.listThreadFolders)()))("done"===a.status||"cancelled"===a.status)&&c(a)&&await L(a.id,async()=>{let b=await (0,v.findThread)(a.id);b?.status!=="done"&&b?.status!=="cancelled"||c(b)&&await F(a.id)&&(d+=1)});return d}async function H(){let a=Date.now()-f.WORKSPACE_KEEP.forMs,b=b=>("done"===b.status||"cancelled"===b.status)&&(b.endedAt??b.updatedAt).getTime()<a,c=new Set(await (0,k.listScratchFolders)()),d=[];for(let a of(await (0,v.listThreadFolders)())){let e=(0,k.jobScratch)(a.id,a.label);c.delete(e)&&b(a)&&await L(a.id,async()=>{let c=await (0,v.findThread)(a.id);c&&b(c)&&(await (0,k.closeHiddenBrowser)(a.id),await (0,k.removeJobScratch)(a.id,a.label),d.push(e))})}return d.push(...await (0,k.removeUnchangedFolders)([...c])),await (0,k.pruneJobFiles)(),d.length&&m.logger.info(`cleared ${d.length} old job folder(s): ${d.join(", ")}`),d}async function I(){for(let a of(await (0,v.listRunningThreadIds)()))await L(a,async()=>{[...K.values()].some(b=>b.threadId===a)||(await (0,v.findThread)(a))?.status==="running"&&await (0,t.pauseRoom)(a,"The server restarted. Resume from the saved conversation.")})}async function J(a){let b=await (0,v.listRunningThreadIds)();await Promise.all(b.map(b=>L(b,async()=>{(await (0,v.findThread)(b))?.status==="running"&&(await C(b),await (0,t.pauseRoom)(b,a))})))}a.s(["answerThread",0,y,"askCompact",0,function(a,b){M.add(N(a,b))},"cancelThread",0,D,"pauseThreads",0,J,"removeFinishedThreads",0,G,"removeThread",0,E,"startThread",0,x,"sweepJobFiles",0,H,"sweepThreads",0,I]),c()}catch(a){c(a)}},!1),317844,a=>a.a(async(b,c)=>{try{var d,e=a.i(106450),f=a.i(64203),g=a.i(569572),h=a.i(176668),i=a.i(182248),j=a.i(947950),k=a.i(899284),l=b([j]);[j]=l.then?(await l)():l;class m extends Error{serverName;authorizationUrl;constructor(a,b){super(`MCP server "${a}" requires authorization`),this.serverName=a,this.authorizationUrl=b,this.name="McpAuthRequiredError"}}class n{store;serverName;oauth;callbackUrl;clientName;lastAuthorizationUrl;constructor(a,b,c,d,e){this.store=a,this.serverName=b,this.oauth=c,this.callbackUrl=d,this.clientName=e}get redirectUrl(){return this.callbackUrl}get clientMetadata(){return{client_name:this.clientName,redirect_uris:[this.callbackUrl],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"client_secret_post"}}async persist(a){this.oauth={...this.oauth,...a},await this.store.saveOAuth(this.serverName,this.oauth)}clientInformation(){return this.oauth.clientInformation}async saveClientInformation(a){await this.persist({clientInformation:a})}tokens(){return this.oauth.tokens}async saveTokens(a){await this.persist({tokens:a})}authorizationServerInformation(){return this.oauth.authorizationServer}async saveAuthorizationServerInformation(a){await this.persist({authorizationServer:a})}codeVerifier(){if(!this.oauth.codeVerifier)throw Error("No code verifier saved");return this.oauth.codeVerifier}async saveCodeVerifier(a){await this.persist({codeVerifier:a})}state(){return crypto.randomUUID()}async saveState(a){await this.persist({state:a})}storedState(){return this.oauth.state}redirectToAuthorization(a){this.lastAuthorizationUrl=a}async invalidateCredentials(a){let b={...this.oauth};("all"===a||"client"===a)&&(b.clientInformation=void 0),("all"===a||"tokens"===a)&&(b.tokens=void 0),("all"===a||"verifier"===a)&&(b.codeVerifier=void 0),this.oauth=b,await this.store.saveOAuth(this.serverName,b)}}let o=globalThis;o.__thursdayMcpManager&&o.__thursdayMcpManager.dispose(),d={callbackUrl:new URL("/api/mcp/oauth/callback",g.APP_URL).href,clientName:g.APP_NAME},o.__thursdayMcpManager=new class a{store;sessions;connecting;callbackUrl;clientName;constructor(a,b){this.store=a,this.sessions=new Map,this.connecting=new Map,this.callbackUrl=b.callbackUrl,this.clientName=b.clientName??g.APP_NAME}async connect(a){let b=this.connecting.get(a);if(b)return b;let c=this.doConnect(a).finally(()=>this.connecting.delete(a));return this.connecting.set(a,c),c}async callTool(a,b,c,d){let f=await this.ensureClient(a);try{let e=await f.callTool({name:b,arguments:c,options:d?{signal:d}:void 0});return this.touch(a),e}catch(b){if(b instanceof e.UnauthorizedError)throw await this.closeSession(a),new m(a);throw b}}async finishAuthorization(a){let b=a.get("state"),c=a.get("code");if(!b||!c)throw Error("OAuth callback is missing code or state");let d=await this.store.findByOAuthState(b);if(!d||!(0,k.isRemoteConfig)(d.config))throw Error("No server is waiting for this authorization");let f=this.providerFor(d),g=await (0,e.auth)(f,{serverUrl:d.config.url,authorizationCode:c,callbackState:b});if("AUTHORIZED"!==g)throw Error(`Token exchange ended in "${g}"`);return await f.invalidateCredentials("verifier"),await this.connect(d.name),d.name}async disconnect(a){await this.closeSession(a)}async dispose(){await Promise.all([...this.sessions.keys()].map(a=>this.closeSession(a)))}async doConnect(a){await this.closeSession(a);let b=await this.store.load(a);if(!b)throw Error(`Unknown MCP server "${a}"`);let c={};try{let d=await this.openClient(b,c),e=(await d.listTools()).tools.map(a=>({name:a.name,description:a.description,inputSchema:a.inputSchema,outputSchema:a.outputSchema}));return this.adopt(a,d),await this.store.saveConnectionResult(a,{toolInfo:e,lastError:null}),h.logger.info(`mcp "${a}" connected — ${e.length} tools`),{status:"connected",tools:e}}catch(l){var d,f;let g;if(l instanceof e.UnauthorizedError||l?.cause instanceof e.UnauthorizedError){let b=c.href;if(b)return await this.store.saveConnectionResult(a,{toolInfo:[],lastError:"Authorization required — finish sign-in in the opened tab"}),{status:"auth_required",authorizationUrl:b}}let j=(d=l,f=b,g=(0,i.errorToString)(d),(0,k.isRemoteConfig)(f.config)&&!f.oauth?.clientInformation&&/Invalid OAuth error response/.test(g)?`This server does not let an app register itself for sign-in, so it cannot be connected here. It answered: ${g}`:g);throw await this.store.saveConnectionResult(a,{toolInfo:[],lastError:j}),h.logger.warn(`mcp "${a}" failed — ${j}`),Error(j,{cause:l})}}async openClient(a,b={}){if((0,k.isRemoteConfig)(a.config)){let c=this.providerFor(a);try{return await (0,e.createMCPClient)({name:this.clientName,transport:{type:"http",url:a.config.url,headers:a.config.headers,authProvider:c,redirect:"follow"}})}finally{b.href=c.lastAuthorizationUrl?.href}}return(0,e.createMCPClient)({name:this.clientName,transport:new f.Experimental_StdioMCPTransport({command:a.config.command,args:a.config.args,env:a.config.env})})}providerFor(a){return new n(this.store,a.name,a.oauth??{},this.callbackUrl,this.clientName)}async ensureClient(a){let b=this.sessions.get(a);if(b)return b.client;let c=await this.connect(a);if("auth_required"===c.status)throw new m(a,c.authorizationUrl);let d=this.sessions.get(a);if(!d)throw Error(`Session for "${a}" vanished mid-connect`);return d.client}adopt(a,b){this.sessions.set(a,{client:b,idleTimer:this.armIdleTimer(a)})}touch(a){let b=this.sessions.get(a);b&&(clearTimeout(b.idleTimer),b.idleTimer=this.armIdleTimer(a))}armIdleTimer(a){let b=setTimeout(()=>{this.closeSession(a)},g.MCP_IDLE_MS);return b.unref?.(),b}async closeSession(a){let b=this.sessions.get(a);b&&(this.sessions.delete(a),clearTimeout(b.idleTimer),await b.client.close().catch(()=>{}))}}({load:a=>(0,j.findServer)(a),saveOAuth:(a,b)=>(0,j.saveOAuthData)(a,b),saveConnectionResult:(a,b)=>null===b.lastError?(0,j.syncServerTools)(a,b.toolInfo):(0,j.saveConnectionError)(a,b.lastError),findByOAuthState:a=>(0,j.findServerByOAuthState)(a)},d);let p=o.__thursdayMcpManager;a.s(["McpAuthRequiredError",0,m,"mcpManager",0,p]),c()}catch(a){c(a)}},!1),947950,a=>a.a(async(b,c)=>{try{var d=a.i(93321),e=a.i(351674),f=a.i(203469),g=a.i(184838),h=a.i(714428),i=a.i(688034),j=a.i(899284),k=a.i(293480),l=a.i(630189),m=b([g]);async function n(a){var b;let[c]=await g.database.select({name:h.mcpServerTable.name,config:h.mcpServerTable.config,lastError:h.mcpServerTable.lastError,toolsSyncedAt:h.mcpServerTable.toolsSyncedAt}).from(h.mcpServerTable).where((0,d.eq)(h.mcpServerTable.name,a));return c?{...c,config:(b=c.config,(0,j.isRemoteConfig)(b)?{url:b.url}:{command:b.command,args:b.args}),tools:await o(a)}:null}async function o(a){return g.database.select({id:h.mcpToolTable.id,name:h.mcpToolTable.name,description:h.mcpToolTable.description,inputSchema:h.mcpToolTable.inputSchema,outputSchema:h.mcpToolTable.outputSchema}).from(h.mcpToolTable).where((0,d.eq)(h.mcpToolTable.serverName,a)).orderBy(h.mcpToolTable.name)}[g]=m.then?(await m)():m;let A=a=>Object.fromEntries(Object.entries(a).map(([a,b])=>[a,(0,l.isSealed)(b)?b:(0,l.sealSecret)(b)])),B=a=>Object.fromEntries(Object.entries(a).map(([a,b])=>[a,(0,l.openSecret)(b)]));function p(a){try{return function(a){let{sealed:b,...c}=a;return b?{...JSON.parse((0,l.openSecret)(b)),...c}:c}(a)}catch(a){if(a instanceof l.UnreadableSecret)return null;throw a}}function q(a){let b,c,d=function(a){try{return(0,j.isRemoteConfig)(a)?a.headers?{...a,headers:B(a.headers)}:a:a.env?{...a,env:B(a.env)}:a}catch(a){if(a instanceof l.UnreadableSecret)return null;throw a}}(a.config);d||(0,k.publicError)((b=a.name,(0,i.lostWords)(`The key saved for "${b}"`,"Add it again under the same name, with its key: bots keep the tools they pinned.")));let e=a.oauth&&p(a.oauth);return a.oauth&&!e&&(0,k.publicError)((c=a.name,(0,i.lostWords)(`The sign-in saved for "${c}"`,"Reconnect to sign in again."))),{...a,config:d,oauth:e}}async function r(a){let[b]=await g.database.select({oauth:h.mcpServerTable.oauth}).from(h.mcpServerTable).where((0,d.eq)(h.mcpServerTable.name,a));return!(!b?.oauth||p(b.oauth))&&(await g.database.update(h.mcpServerTable).set({oauth:{state:b.oauth.state,authorizationServer:b.oauth.authorizationServer}}).where((0,d.eq)(h.mcpServerTable.name,a)),C(),!0)}async function s(a){let[b]=await g.database.select().from(h.mcpServerTable).where((0,d.eq)(h.mcpServerTable.name,a));return b?q(b):null}let C=()=>f.appEvents.emit({type:"mcp"});async function t(a){var b;let c=(b=a.config,(0,j.isRemoteConfig)(b)?b.headers?{...b,headers:A(b.headers)}:b:b.env?{...b,env:A(b.env)}:b);await g.database.insert(h.mcpServerTable).values({name:a.name,config:c,lastError:null}).onConflictDoUpdate({target:h.mcpServerTable.name,set:{config:c,lastError:null}}),C()}async function u(a,b){await g.database.transaction(async c=>{b.length&&await c.insert(h.mcpToolTable).values(b.map(b=>({...b,serverName:a}))).onConflictDoUpdate({target:[h.mcpToolTable.serverName,h.mcpToolTable.name],set:{description:v(h.mcpToolTable.description),inputSchema:v(h.mcpToolTable.inputSchema),outputSchema:v(h.mcpToolTable.outputSchema)}}),await c.delete(h.mcpToolTable).where(b.length?(0,d.and)((0,d.eq)(h.mcpToolTable.serverName,a),(0,d.notInArray)(h.mcpToolTable.name,b.map(a=>a.name))):(0,d.eq)(h.mcpToolTable.serverName,a)),await c.update(h.mcpServerTable).set({lastError:null,toolsSyncedAt:new Date}).where((0,d.eq)(h.mcpServerTable.name,a))}),C()}function v(a){return e.sql.raw(`excluded."${a.name}"`)}async function w(a,b){await g.database.update(h.mcpServerTable).set({lastError:b}).where((0,d.eq)(h.mcpServerTable.name,a)),C()}async function x(a,b){await g.database.update(h.mcpServerTable).set({oauth:b&&function(a){let{state:b,authorizationServer:c,...d}=a,e=Object.values(d).some(a=>void 0!==a);return{state:b,authorizationServer:c,...e&&{sealed:(0,l.sealSecret)(JSON.stringify(d))}}}(b)}).where((0,d.eq)(h.mcpServerTable.name,a)),C()}async function y(a){let[b]=await g.database.select().from(h.mcpServerTable).where(e.sql`json_extract(${h.mcpServerTable.oauth}, '$.state') = ${a}`);return b?q(b):null}async function z(a){let b=await g.database.delete(h.mcpServerTable).where((0,d.eq)(h.mcpServerTable.name,a)).returning();return b.length>0&&C(),b.length>0}a.s(["deleteServer",0,z,"findPinnedTools",0,function(a){return g.database.select({server:h.mcpToolTable.serverName,name:h.mcpToolTable.name,description:h.mcpToolTable.description,inputSchema:h.mcpToolTable.inputSchema}).from(h.botMcpToolTable).innerJoin(h.mcpToolTable,(0,d.eq)(h.botMcpToolTable.toolId,h.mcpToolTable.id)).where((0,d.eq)(h.botMcpToolTable.botName,a)).orderBy(h.mcpToolTable.serverName,h.mcpToolTable.name)},"findServer",0,s,"findServerByOAuthState",0,y,"findServerDetail",0,n,"findToolSchemas",0,function(a,b){return b.length?g.database.select({name:h.mcpToolTable.name,description:h.mcpToolTable.description,inputSchema:h.mcpToolTable.inputSchema}).from(h.mcpToolTable).where((0,d.and)((0,d.eq)(h.mcpToolTable.serverName,a),(0,d.inArray)(h.mcpToolTable.name,b))).orderBy(h.mcpToolTable.name):Promise.resolve([])},"forgetLostSignIn",0,r,"listServerNames",0,function(){return g.database.select({name:h.mcpServerTable.name}).from(h.mcpServerTable).orderBy(h.mcpServerTable.name)},"listToolNames",0,function(a){let b=g.database.select({server:h.mcpToolTable.serverName,name:h.mcpToolTable.name}).from(h.mcpToolTable);return a?b.where((0,d.eq)(h.mcpToolTable.serverName,a)).orderBy(h.mcpToolTable.name):b.orderBy(h.mcpToolTable.serverName,h.mcpToolTable.name)},"saveConnectionError",0,w,"saveOAuthData",0,x,"syncServerTools",0,u,"upsertServer",0,t]),c()}catch(a){c(a)}},!1),899284,a=>{"use strict";var b=a.i(53112),c=a.i(706210);let d=b.z.object({url:b.z.url(),headers:b.z.record(b.z.string(),b.z.string()).optional()}),e=b.z.object({command:b.z.string().min(1),args:b.z.array(b.z.string()).optional(),env:b.z.record(b.z.string(),b.z.string()).optional()}),f=b.z.union([d,e]),g=b.z.object({name:b.z.string(),description:b.z.string().optional(),inputSchema:b.z.looseObject({}).optional(),outputSchema:b.z.looseObject({}).optional()});b.z.object({clientInformation:b.z.looseObject({}).optional(),tokens:b.z.looseObject({}).optional(),authorizationServer:b.z.looseObject({}).optional(),codeVerifier:b.z.string().optional(),state:b.z.string().optional()});let h=b.z.object({name:b.z.string().min(1).max(40),config:f,toolCount:b.z.number().int(),lastError:b.z.string().nullish()}),i=g.extend({id:b.z.number().int(),description:b.z.string().nullish()});h.omit({toolCount:!0}).extend({tools:i.array().default([]),toolsSyncedAt:c.DateLikeSchema});let j=b.z.object({name:b.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:f});b.z.union([b.z.object({mcpServers:b.z.record(b.z.string(),f)}),b.z.record(b.z.string(),f)]),a.s(["MCPServerFormSchema",0,j,"isRemoteConfig",0,function(a){return"url"in a}])},986743,a=>a.a(async(b,c)=>{try{var d=a.i(93321),e=a.i(530385),f=a.i(351674),g=a.i(203469);a.i(569572);var h=a.i(184838),i=a.i(714428),j=a.i(661210),k=b([h]);[h]=k.then?(await k)():k;let B=()=>g.appEvents.emit({type:"memory"});async function l(a,b,c={}){let[d]=await h.database.insert(i.memoryNoteTable).values({path:a,description:b,ownedByUser:c.ownedByUser??!1}).onConflictDoNothing({target:i.memoryNoteTable.path}).returning();return d&&B(),d??null}async function m(a,b){let[c]=await h.database.update(i.memoryNoteTable).set({...b,updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,a)).returning();return c&&B(),c??null}async function n(a){let b=await h.database.delete(i.memoryNoteTable).where((0,d.eq)(i.memoryNoteTable.id,a)).returning({id:i.memoryNoteTable.id});return b.length>0&&B(),b.length>0}async function o(a,b){let[c]=await h.database.insert(i.memoryFactTable).values({noteId:a,text:b,source:"user"}).returning();return await r(a),B(),c}async function p(a,b,c){let e=await h.database.transaction(async e=>{let f=await e.update(i.memoryFactTable).set({isLatest:!1}).where((0,d.and)((0,d.eq)(i.memoryFactTable.id,b),(0,d.eq)(i.memoryFactTable.noteId,a),(0,d.eq)(i.memoryFactTable.isLatest,!0))).returning({id:i.memoryFactTable.id});if(0===f.length)return null;let[g]=await e.insert(i.memoryFactTable).values({noteId:a,text:c,source:"user"}).returning();return await e.update(i.memoryNoteTable).set({updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,a)),g});return e&&B(),e}async function q(a,b){let c=await h.database.delete(i.memoryFactTable).where((0,d.and)((0,d.eq)(i.memoryFactTable.id,b),(0,d.eq)(i.memoryFactTable.noteId,a))).returning({id:i.memoryFactTable.id});return c.length>0&&(await r(a),B()),c.length>0}function r(a){return h.database.update(i.memoryNoteTable).set({updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,a))}async function s(){for(let a of j.MEMORY_ALWAYS_LISTED){let b=j.MEMORY_PATHS.find(b=>b.path===a)?.of??a;await h.database.insert(i.memoryNoteTable).values({path:a,description:b}).onConflictDoUpdate({target:i.memoryNoteTable.path,set:{description:b}})}}async function t(a,b={}){let c=[...new Set(a.map(a=>a.trim()).filter(Boolean))];if(!c.length)return{notes:[],missing:[]};let g=await h.database.select({id:i.memoryNoteTable.id,path:i.memoryNoteTable.path,description:i.memoryNoteTable.description}).from(i.memoryNoteTable).where((0,d.inArray)(i.memoryNoteTable.path,c)),j=new Map(g.map(a=>[a.path,a])),k=c.filter(a=>!j.has(a));if(!g.length)return{notes:[],missing:k};let l=g.map(a=>a.id),m=await h.database.select({id:i.memoryFactTable.id,noteId:i.memoryFactTable.noteId,text:i.memoryFactTable.text,source:i.memoryFactTable.source,createdAt:i.memoryFactTable.createdAt,saidAt:i.callTable.startedAt}).from(i.memoryFactTable).leftJoin(i.callTable,(0,d.eq)(i.memoryFactTable.callId,i.callTable.id)).where((0,d.and)((0,d.eq)(i.memoryFactTable.isLatest,!0),(0,d.inArray)(i.memoryFactTable.noteId,l))).orderBy((0,e.asc)(i.memoryFactTable.id));return!1!==b.touch&&await h.database.update(i.memoryNoteTable).set({hits:f.sql`${i.memoryNoteTable.hits} + 1`,lastReadAt:new Date}).where((0,d.inArray)(i.memoryNoteTable.id,l)),{notes:c.flatMap(a=>{let b=j.get(a);return b?[{path:b.path,description:b.description,facts:m.filter(a=>a.noteId===b.id).map(a=>({id:a.id,text:a.text,...a.saidAt?{saidAt:a.saidAt}:{}}))}]:[]}),missing:k}}(0,d.inArray)(i.memoryNoteTable.path,j.MEMORY_ALWAYS_LISTED);let C=a=>a.toLowerCase().replace(/[\s.,!?…·'"`]/g,"");async function u(a,b,c,e,f){let g=await a.select({id:i.memoryFactTable.id,text:i.memoryFactTable.text}).from(i.memoryFactTable).where((0,d.and)((0,d.eq)(i.memoryFactTable.noteId,b),(0,d.eq)(i.memoryFactTable.isLatest,!0))),h=new Map(g.map(a=>[C(a.text),a]));for(let g of c){let c=g.text.trim();if(!c)continue;if(null!=g.replaces){let[j]=await a.select({id:i.memoryFactTable.id,text:i.memoryFactTable.text}).from(i.memoryFactTable).where((0,d.and)((0,d.eq)(i.memoryFactTable.id,g.replaces),(0,d.eq)(i.memoryFactTable.noteId,b),(0,d.eq)(i.memoryFactTable.isLatest,!0)));if(j){if(C(j.text)===C(c))continue;await a.update(i.memoryFactTable).set({isLatest:!1}).where((0,d.eq)(i.memoryFactTable.id,j.id)),h.delete(C(j.text));let[g]=await a.insert(i.memoryFactTable).values({noteId:b,text:c,source:e,callId:f}).returning({id:i.memoryFactTable.id});h.set(C(c),{...g,text:c});continue}}if(h.has(C(c)))continue;let[j]=await a.insert(i.memoryFactTable).values({noteId:b,text:c,source:e,callId:f}).returning({id:i.memoryFactTable.id});h.set(C(c),{...j,text:c})}await a.update(i.memoryNoteTable).set({updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,b))}async function v(a,b,c,e=null){let f=a.trim();if(!await h.database.transaction(async a=>{let[g]=await a.select({id:i.memoryNoteTable.id}).from(i.memoryNoteTable).where((0,d.eq)(i.memoryNoteTable.path,f));return!!g&&(await u(a,g.id,b,c,e),!0)}))return null;let{notes:g}=await t([f],{touch:!1});return B(),g[0]??null}async function w(a,b,c,d,e=null){let f=a.trim();if(!await h.database.transaction(async a=>{let[g]=await a.insert(i.memoryNoteTable).values({path:f,description:b}).onConflictDoNothing({target:i.memoryNoteTable.path}).returning({id:i.memoryNoteTable.id});return!!g&&(await u(a,g.id,c,d,e),!0)}))return null;let{notes:g}=await t([f],{touch:!1});return B(),g[0]??null}async function x(a,b){let[c]=await h.database.update(i.memoryNoteTable).set({description:b,updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.path,a.trim())).returning({id:i.memoryNoteTable.id});return c&&B(),!!c}async function y(){let[a,b]=await Promise.all([h.database.select({id:i.memoryNoteTable.id,path:i.memoryNoteTable.path,description:i.memoryNoteTable.description,hits:i.memoryNoteTable.hits,lastReadAt:i.memoryNoteTable.lastReadAt,createdAt:i.memoryNoteTable.createdAt}).from(i.memoryNoteTable),h.database.select({noteId:i.memoryFactTable.noteId,count:f.sql`count(*)`}).from(i.memoryFactTable).where((0,d.eq)(i.memoryFactTable.isLatest,!0)).groupBy(i.memoryFactTable.noteId)]),c=new Map(b.map(a=>[a.noteId,a.count]));return a.filter(a=>(0,j.isAlwaysListed)(a.path)||(c.get(a.id)??0)>0).sort((a,b)=>Number((0,j.isAlwaysListed)(b.path))-Number((0,j.isAlwaysListed)(a.path))||(0,j.recallScore)(b)-(0,j.recallScore)(a)).map(a=>({path:a.path,description:a.description,factCount:c.get(a.id)??0,lastSeenAt:a.lastReadAt??a.createdAt}))}async function z(a){let b=await h.database.transaction(async b=>{let c=await b.delete(i.memoryFactTable).where((0,d.eq)(i.memoryFactTable.id,a)).returning({noteId:i.memoryFactTable.noteId});if(0===c.length)return null;let e=c[0].noteId,[g]=await b.select({path:i.memoryNoteTable.path,ownedByUser:i.memoryNoteTable.ownedByUser}).from(i.memoryNoteTable).where((0,d.eq)(i.memoryNoteTable.id,e)),[h]=await b.select({count:f.sql`count(*)`}).from(i.memoryFactTable).where((0,d.and)((0,d.eq)(i.memoryFactTable.noteId,e),(0,d.eq)(i.memoryFactTable.isLatest,!0)));return h?.count!==0||!g||g.ownedByUser||(0,j.isAlwaysListed)(g.path)?(await b.update(i.memoryNoteTable).set({updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,e)),{path:g?.path??"",noteGone:!1}):(await b.delete(i.memoryNoteTable).where((0,d.eq)(i.memoryNoteTable.id,e)),{path:g.path,noteGone:!0})});return b&&B(),b}async function A(){let a=await h.database.delete(i.memoryNoteTable).returning({id:i.memoryNoteTable.id});return await s(),a.length>0&&B(),a.length}a.s(["addFact",0,o,"createNote",0,l,"createNoteWithFacts",0,w,"deleteAllNotes",0,A,"deleteNote",0,n,"describeNote",0,x,"forgetFact",0,q,"forgetFactById",0,z,"listNoteIndex",0,y,"readNotes",0,t,"reviseFact",0,p,"updateNote",0,m,"writeFacts",0,v]),c()}catch(a){c(a)}},!1),661210,a=>{"use strict";var b=a.i(53112),c=a.i(569572),d=a.i(706210);let e=b.z.enum(["user","call","bot"]),f=b.z.string().trim().min(1,"A note needs a line saying what it is about").max(c.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${c.MEMORY_LIMITS.descriptionChars} characters`),g=b.z.object({id:b.z.number(),text:b.z.string(),source:e.nullish(),createdAt:d.DateLikeSchema});b.z.object({id:b.z.number(),path:b.z.string(),description:b.z.string(),ownedByUser:b.z.boolean(),hits:b.z.number(),lastReadAt:d.DateLikeSchema.nullable(),createdAt:d.DateLikeSchema,updatedAt:d.DateLikeSchema,factCount:b.z.number(),facts:g.array()});let h=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],i=h.filter(a=>!a.path.endsWith("/")).map(a=>a.path),j=h.filter(a=>a.path.endsWith("/")).map(a=>a.path.slice(0,-1)),k=RegExp(`^(?:${i.join("|")}|(?:${j.join("|")})/.+)$`);a.s(["MEMORY_ALWAYS_LISTED",0,i,"MEMORY_PATHS",0,h,"NoteLineSchema",0,f,"isAlwaysListed",0,a=>i.includes(a),"isMemoryPath",0,a=>k.test(a),"recallScore",0,function(a){let b=(0,d.toDate)(a.lastReadAt??a.createdAt),c=Math.max(0,(Date.now()-b.getTime())/864e5);return(a.hits+1)/(1+c)}])},780946,a=>a.a(async(b,c)=>{try{var d=a.i(93321),e=a.i(258261),f=a.i(530385),g=a.i(203469),h=a.i(569572),i=a.i(184838),j=a.i(714428),k=a.i(221214),l=a.i(293480),m=a.i(643020),n=b([i,k]);[i,k]=n.then?(await n)():n;let z=()=>g.appEvents.emit({type:"routines"});async function o(a,b){return i.database.select({id:j.threadTable.id,status:j.threadTable.status,outcome:j.threadTable.outcome,updatedAt:j.threadTable.updatedAt}).from(j.threadTable).where((0,d.eq)(j.threadTable.routineId,a)).orderBy((0,f.desc)(j.threadTable.createdAt)).limit(b)}let A=async a=>{let{createdAt:b,...c}=a;return{...c,runs:await o(a.id,h.ROUTINE.runsShown)}};async function p(){let a=await i.database.select().from(j.routineTable).orderBy(j.routineTable.createdAt);return Promise.all(a.map(A))}async function q(a){let[b]=await i.database.select().from(j.routineTable).where((0,d.eq)(j.routineTable.id,a));return b?A(b):null}async function r(a){let b=await q(a.trim());if(b)return b;let c=a.trim().toLowerCase(),d=(await p()).filter(a=>a.label.toLowerCase()===c);return 1===d.length?d[0]:null}async function s(a){let b=await (0,k.findJobBot)(a);return(!b||b.disabled)&&(0,l.publicError)("Choose an enabled bot."),b.name}function t(a,b){b&&"once"===a.kind&&(0,m.momentOf)(a.at)<=new Date&&(0,l.publicError)("That time has passed. Pick a later one.")}async function u(a){let[{total:b}]=await i.database.select({total:(0,e.count)()}).from(j.routineTable);b>=h.ROUTINE.max&&(0,l.publicError)(`There are already ${h.ROUTINE.max} routines. Delete one to make another.`),t(a.schedule,!0);let[c]=await i.database.insert(j.routineTable).values({id:crypto.randomUUID(),...a,bot:await s(a.bot),nextRunAt:(0,m.nextRun)(a.schedule,new Date)}).returning();return z(),A(c)}async function v(a,b){let[c]=await i.database.select().from(j.routineTable).where((0,d.eq)(j.routineTable.id,a));if(!c)return null;let e=b.schedule??c.schedule,f=!!(b.schedule&&!(0,m.sameSchedule)(b.schedule,c.schedule))||b.enabled&&!c.enabled;f&&t(e,b.enabled??c.enabled);let[g]=await i.database.update(j.routineTable).set({...b,...b.bot?{bot:await s(b.bot)}:{},...f?{nextRunAt:(0,m.nextRun)(e,new Date)}:{}}).where((0,d.eq)(j.routineTable.id,a)).returning();return z(),A(g)}async function w(a){let b=await i.database.delete(j.routineTable).where((0,d.eq)(j.routineTable.id,a)).returning({id:j.routineTable.id});return b.length&&z(),b.length>0}async function x(a){return(await o(a,1))[0]??null}async function y(a){return(await i.database.select({id:j.threadTable.id}).from(j.threadTable).where((0,d.and)((0,d.eq)(j.threadTable.routineId,a),(0,d.eq)(j.threadTable.seen,!1),(0,d.inArray)(j.threadTable.status,["done","cancelled"])))).map(a=>a.id)}a.s(["createRoutine",0,u,"deleteRoutine",0,w,"findRoutine",0,q,"latestRun",0,x,"listRoutines",0,p,"listUnseenRunIds",0,y,"resolveRoutine",0,r,"updateRoutine",0,v]),c()}catch(a){c(a)}},!1),643020,a=>{"use strict";var b=a.i(723885),c=a.i(569572),d=a.i(706210);let e=b.default.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function f(a){let[b,c]=a.split(" "),[d,e,f]=b.split("-").map(Number),[g,h]=c.split(":").map(Number);return new Date(d,e-1,f,g,h)}let g=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,h=b.default.string().regex(g,'A moment is "YYYY-MM-DD HH:MM"').refine(a=>{if(!g.test(a))return!0;let b=f(a);return b.getMonth()===Number(a.slice(5,7))-1&&b.getDate()===Number(a.slice(8,10))},"There is no such day"),i=b.default.discriminatedUnion("kind",[b.default.object({kind:b.default.literal("once"),at:h}),b.default.object({kind:b.default.literal("daily"),time:e,days:b.default.array(b.default.number().int().min(1).max(7)).min(1,"Pick at least one day").transform(a=>[...new Set(a)].sort((a,b)=>a-b))}),b.default.object({kind:b.default.literal("every"),hours:b.default.number().int().min(c.ROUTINE.minHours,`No more often than every ${c.ROUTINE.minHours}h`).max(168)})]),j=b.default.object({bot:b.default.string().trim().min(1,"Pick a bot"),label:b.default.string().trim().min(1,"Give it a name").max(80),request:b.default.string().trim().min(1,"Say what it should do"),schedule:i}),k=b.default.object({id:b.default.string(),status:b.default.enum(["running","waiting","done","cancelled"]),outcome:b.default.string().nullable(),updatedAt:d.DateLikeSchema});j.extend({id:b.default.string(),enabled:b.default.boolean(),nextRunAt:d.DateLikeSchema,runs:b.default.array(k)});let l=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];a.s(["RoutineInputSchema",0,j,"RoutineScheduleSchema",0,i,"momentOf",0,f,"nextRun",0,function(a,b){if("once"===a.kind)return f(a.at);if("every"===a.kind)return new Date(b.getTime()+36e5*a.hours);let[c,d]=a.time.split(":").map(Number);for(let e=0;e<=7;e++){let f=new Date(b);f.setDate(f.getDate()+e),f.setHours(c,d,0,0);let g=0===f.getDay()?7:f.getDay();if(f>b&&a.days.includes(g))return f}return new Date(b.getTime()+864e5)},"sameSchedule",0,function(a,b){if("once"===a.kind)return"once"===b.kind&&a.at===b.at;if("every"===a.kind)return"every"===b.kind&&a.hours===b.hours;let c=a=>[...a].sort((a,b)=>a-b).join();return"daily"===b.kind&&a.time===b.time&&c(a.days)===c(b.days)},"scheduleText",0,function(a){if("once"===a.kind){let[b,c]=a.at.split(" "),[,d,e]=b.split("-").map(Number);return`Once \xb7 ${m[d-1]} ${e} ${c}`}if("every"===a.kind)return 1===a.hours?"Every hour":`Every ${a.hours} hours`;let{days:b,time:c}=a;if(7===b.length)return`Daily ${c}`;if(1===b.length)return`${l[b[0]-1]} ${c}`;let d=b.every((a,c)=>0===c||a===b[c-1]+1)?`${l[b[0]-1]}–${l[b.at(-1)-1]}`:b.map(a=>l[a-1]).join(" ");return`Daily ${c} \xb7 ${d}`}])},487591,422807,a=>{"use strict";var b=a.i(912714),c=a.i(750227),d=a.i(203469),e=a.i(569572),f=a.i(821415);a.i(176668);let g=a=>a.trim().toLowerCase().replace(/^[a-z]+:\/\//,"").replace(/^www\./,"").replace(/[/?#].*$/,"");a.s(["siteOf",0,g],422807);let h=(0,c.join)(e.DATA_DIR,e.PATHS.signIns),i=a=>(0,c.join)(h,`${encodeURIComponent(g(a))}.json`),j=()=>d.appEvents.emit({type:"signins"});async function k(a){try{return JSON.parse(await (0,b.readFile)(i(a),"utf8"))}catch{return null}}async function l(a){let b=g(a),c=await k(b);if(c)return c;let d=(await n()).map(a=>a.site).filter(a=>b.endsWith(`.${a}`)).sort((a,b)=>b.length-a.length)[0];return d?k(d):null}async function m(a){await (0,b.mkdir)(h,{recursive:!0}),await (0,b.writeFile)(i(a.site),JSON.stringify(a),{mode:384}),j()}async function n(){let a=await (0,b.readdir)(h).catch(()=>[]);return(await Promise.all(a.filter(a=>a.endsWith(".json")).map(a=>k(decodeURIComponent(a.slice(0,-5)))))).flatMap(a=>a?[(({state:a,...b})=>b)(a)]:[]).sort((a,b)=>a.site.localeCompare(b.site))}async function o(a){let b=await l(a.site);if(b&&!b.bots.includes(a.bot)){let c=b.asking.includes(a.bot)?b:{...b,asking:[...b.asking,a.bot]};return c!==b&&await m(c),{kind:"taken",signIn:(({state:a,...b})=>b)(c)}}let c=b?.site??g(a.site),d={site:c,account:a.account.trim()||c,bots:[...new Set([...b?.bots??[],a.bot])],asking:(b?.asking??[]).filter(b=>b!==a.bot),keptAt:new Date().toISOString(),usedAt:b?.usedAt??null,state:a.state};return await m(d),{kind:"kept",signIn:(({state:a,...b})=>b)(d)}}let p=globalThis.__signInsHeld??=new Map;async function q(a,b){let c=await l(a);if(!c)return{kind:"none",kept:(await n()).map(a=>a.site)};if(!c.bots.includes(b))return c.asking.includes(b)||await m({...c,asking:[...c.asking,b]}),{kind:"ask",signIn:(({state:a,...b})=>b)(c)};let d={...c,usedAt:new Date().toISOString()};return await m(d),{kind:"state",signIn:(({state:a,...b})=>b)(d),state:c.state}}async function r(a,b){return(await (0,f.listBrowsers)(a,b)).find(a=>a.name===b.PLAYWRIGHT_CLI_SESSION)??null}async function s(a,b){let c=await r(a,b);return c?c.attached?"theirs":"own":null}async function t(a,b){let c=await r(a,b);return!!c&&!c.attached&&!0===c.headed}let u=a=>`${a.name}
146
+ ${b}`;async function x(a){let b=await (0,q.findJobBot)(a.bot);(!b||b.disabled)&&(0,n.publicError)("Choose an enabled bot.");let{from:c,routine:d,...e}={...a,bot:b.name},f=(0,h.buildThreadOpening)({bot:e.bot,request:e.request,from:c,routine:d}),g=await (0,v.insertThread)({...e,routineId:d?.id??null,opening:f});return await z(g.id),g.id}async function y(a,b,c="user",d,e){let f=null;return await L(a,async()=>{let g=await (0,v.findThread)(a);if(g||(0,n.publicError)("No such thread."),d){let b=(await (0,t.listRoomWork)(a)).find(a=>a.bot.toLowerCase()===d.trim().toLowerCase());b&&b.bot!==u.ROOM_THURSDAY||(0,n.publicError)("Choose a participant in this thread."),d=b.bot}b.trim()===s.THREAD_CONTINUE&&(0,s.isAppStop)(g.pending)?(await (0,t.resumeRoom)(a),(await (0,t.listRoomWork)(a)).some(a=>"queued"===a.state)||(f=await (0,t.tellRoom)(a,"Continue from the saved conversation.","user"===c?u.ROOM_USER:u.ROOM_THURSDAY,d,void 0,!1))):f=await (0,t.tellRoom)(a,b,"user"===c?u.ROOM_USER:u.ROOM_THURSDAY,d,e)}),await z(a),f}async function z(a){await L(a,async()=>{for(let b=0;b<2;b++){let b;for(;b=await (0,t.claimRoomWork)(a);)!function(a){let b,c=new AbortController,d=new Promise(a=>{b=a});K.set(a.id,{threadId:a.threadId,stop:c,done:d}),A(a,c.signal).catch(b=>m.logger.error(`thread ${a.threadId}: participant`,b)).finally(()=>{K.delete(a.id),b(),z(a.threadId).catch(b=>m.logger.error(`thread ${a.threadId}: scheduling`,b))})}(b);await (0,t.settleRoom)(a)}})}async function A(a,b){let c=await B(a,b);if(c?.failure?.retry&&!b.aborted&&(await (0,t.noteRoomBreak)(a,c.failure.message),await (0,d.setTimeout)(f.BOT_RUN.retryMs,void 0,{signal:b}).catch(()=>{}),b.aborted||(c=await B(a,b,!1))),!c||b.aborted)return;let g=c.failure?.message,h=c.ending;if(g||!h||h.stopped){let b=g??"The turn was interrupted. Continue from the saved conversation.";L(a.threadId,async()=>{let c=(await (0,t.listRoomWork)(a.threadId)).find(b=>b.id===a.id);if(c?.state!=="running"||c.generation!==a.generation)return;let d=C(a.threadId);await (0,t.pauseRoom)(a.threadId,b),await d}).catch(b=>m.logger.error(`thread ${a.threadId}: pausing`,b));return}await (0,t.finishRoomWork)(a,h.text);let n=await (0,v.findThread)(a.threadId);if(n?.status==="done"){let a=(0,p.plainText)(n.outcome??"").slice(0,f.FINISHED_NOTICE.words);e.presence.watching||await (0,i.isAnyCallLive)()||(0,l.desktopNotify)(n.label,a);let b=await (0,k.filesOnDisk)((0,j.pathsIn)(n.outcome??""),null);e.appEvents.emit({type:"finished",threadId:n.id,label:n.label,bot:n.bot,words:a,paths:(0,j.leadFirst)(b)})}}async function B(a,b,c=!0){let d=new O(a,b),e=null,f=null;try{let g=await (0,v.findThread)(a.threadId);if(!g)return null;if((await (0,t.listParticipantTranscript)(a.threadId,a.bot)).length||await (0,t.joinRoom)(a,b=>(0,h.buildJoinOpening)({bot:a.bot,coordinator:g.bot,job:b,request:g.request})),await (0,t.consumeRoomInbox)(a),c&&(0,u.isCoordinatorSeat)(a.bot,g.bot,a.caller)){let b=await (0,t.roomBoard)(a);b&&await (0,t.appendRoomMessage)(a.threadId,{bot:a.bot,parent:a.id,role:"user",content:b,hidden:!0})}let i=await (0,t.listParticipantTranscript)(a.threadId,a.bot);await (0,r.runBot)({bot:a.bot,messages:(0,r.resumeTranscript)(i,await (0,t.listRoomReceipts)(a.threadId,a.bot,i))},{signal:b,threadId:a.threadId,parent:a.id,caller:a.caller,owner:g.bot,contextBudget:await (0,t.roomContextBudget)(a.threadId,a.bot),compactNow:()=>M.delete(N(a.threadId,a.bot)),session:(0,k.botBrowserSession)(a.threadId,a.bot),notes:()=>(0,t.consumeRoomInbox)(a),send:async c=>{b.throwIfAborted();let d=c.to.trim();if(d.toLowerCase()===u.ROOM_THURSDAY.toLowerCase())d=u.ROOM_THURSDAY;else{let a=await (0,q.findJobBot)(d);(!a||a.disabled)&&(0,n.publicError)(`No enabled bot named "${d}".`),d=a.name}let e=await (0,t.sendRoomMessage)(a,{...c,to:d});return z(a.threadId).catch(a=>m.logger.error("room message scheduling",a)),e},emit:async c=>{(!b.aborted||"tool-result"===c.type)&&(await d.on(c),"step"===c.type&&await (0,v.addThreadUsage)(a.threadId,c.usage,a.bot===g.bot?{tokens:c.usage.input,budget:c.budget}:null),"compact"===c.type&&await (0,v.addThreadUsage)(a.threadId,c.usage),"turn-end"===c.type&&(e=c),"error"===c.type&&(f={message:c.message,retry:c.retry},c.budget&&await (0,t.lowerRoomContextBudget)(a,c.budget)))}})}catch(c){b.aborted||(m.logger.error(`thread ${a.threadId}: ${a.bot} broke`,c),f={message:(0,g.modelErrorToString)(c),retry:!(0,n.isPublicError)(c)&&!(0,g.isProviderRefusal)(c)})}return{ending:e,failure:f}}class O{work;signal;lane;assistant;tool;parts;calls;results;constructor(a,b){this.work=a,this.signal=b,this.lane=(0,p.PromiseChain)(),this.assistant=null,this.tool=null,this.parts={assistant:[],tool:[]},this.calls=new Set,this.results=new Set}async write(a,b,c=!1){let d={bot:this.work.bot,parent:this.work.id,role:b.role,content:b.content,compact:c,note:c};return null===a?(0,t.appendRoomMessage)(this.work.threadId,d):(await (0,v.upsertMessage)(this.work.threadId,a,d),a)}on(a){return this.lane(async()=>{if(!this.signal.aborted||"tool-result"===a.type)if("text"===a.type)this.parts.assistant.push({type:"text",text:a.text}),this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant});else if("tool"===a.type){if(this.calls.has(a.id)){let b=this.parts.assistant.find(b=>"tool-call"===b.type&&b.toolCallId===a.id);b&&"tool-call"===b.type&&a.providerOptions&&(b.providerOptions=a.providerOptions,this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant}));return}this.calls.add(a.id),this.parts.assistant.push({type:"tool-call",toolCallId:a.id,toolName:a.name,input:a.input,...a.providerExecuted?{providerExecuted:!0}:{},...a.providerOptions?{providerOptions:a.providerOptions}:{}}),this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant})}else if("tool-result"===a.type){if(this.results.has(a.id))return;this.results.add(a.id),this.parts.tool.push({type:"tool-result",toolCallId:a.id,toolName:a.name,output:a.error?{type:"error-text",value:String(a.output)}:"string"==typeof a.output?{type:"text",value:a.output}:{type:"json",value:a.output}}),this.tool=await this.write(this.tool,{role:"tool",content:this.parts.tool})}else if("step"===a.type){let b=[this.assistant,this.tool];for(let[c,d]of a.messages.entries())await this.write(b[c]??null,d);let c=b.slice(a.messages.length).filter(a=>null!==a);c.length&&await (0,v.deleteMessages)(this.work.threadId,c),this.assistant=this.tool=null,this.parts={assistant:[],tool:[]}}else"compact"===a.type&&await this.write(null,{role:"user",content:a.text},!0)})}}async function C(a){let b=[...K.values()].filter(b=>b.threadId===a);for(let a of b)a.stop.abort();await Promise.all(b.map(a=>a.done))}async function D(a){await L(a,async()=>{let b=await (0,v.findThread)(a);b||(0,n.publicError)("No such thread."),b.endedAt&&(0,n.publicError)("That thread has already ended."),await (0,t.cancelRoom)(a),await (0,v.updateThread)(a,{status:"cancelled",outcome:null,pending:null,seen:!0,endedAt:new Date}),await C(a),await (0,k.closeJobShell)(a)})}async function E(a){return L(a,()=>F(a))}async function F(a){let b=await (0,v.findThread)(a);await (0,t.cancelRoom)(a),await C(a),await (0,k.removeJobBrowsers)(a);let c=await (0,v.deleteThread)(a);return c&&b&&await (0,k.removeJobScratch)(a,b.label),c}async function G(a){let b=a?.getTime(),c=a=>void 0===b||(a.endedAt??a.updatedAt).getTime()<b,d=0;for(let a of(await (0,v.listThreadFolders)()))("done"===a.status||"cancelled"===a.status)&&c(a)&&await L(a.id,async()=>{let b=await (0,v.findThread)(a.id);b?.status!=="done"&&b?.status!=="cancelled"||c(b)&&await F(a.id)&&(d+=1)});return d}async function H(){let a=Date.now()-f.WORKSPACE_KEEP.forMs,b=b=>("done"===b.status||"cancelled"===b.status)&&(b.endedAt??b.updatedAt).getTime()<a,c=new Set(await (0,k.listScratchFolders)()),d=[];for(let a of(await (0,v.listThreadFolders)())){let e=(0,k.jobScratch)(a.id,a.label);c.delete(e)&&b(a)&&await L(a.id,async()=>{let c=await (0,v.findThread)(a.id);c&&b(c)&&(await (0,k.closeHiddenBrowser)(a.id),await (0,k.removeJobScratch)(a.id,a.label),d.push(e))})}return d.push(...await (0,k.removeUnchangedFolders)([...c])),await (0,k.pruneJobFiles)(),d.length&&m.logger.info(`cleared ${d.length} old job folder(s): ${d.join(", ")}`),d}async function I(){for(let a of(await (0,v.listRunningThreadIds)()))await L(a,async()=>{[...K.values()].some(b=>b.threadId===a)||(await (0,v.findThread)(a))?.status==="running"&&await (0,t.pauseRoom)(a,"The server restarted. Resume from the saved conversation.")})}async function J(a){let b=await (0,v.listRunningThreadIds)();await Promise.all(b.map(b=>L(b,async()=>{(await (0,v.findThread)(b))?.status==="running"&&(await C(b),await (0,t.pauseRoom)(b,a))})))}a.s(["answerThread",0,y,"askCompact",0,function(a,b){M.add(N(a,b))},"cancelThread",0,D,"pauseThreads",0,J,"removeFinishedThreads",0,G,"removeThread",0,E,"startThread",0,x,"sweepJobFiles",0,H,"sweepThreads",0,I]),c()}catch(a){c(a)}},!1),317844,a=>a.a(async(b,c)=>{try{var d,e=a.i(106450),f=a.i(64203),g=a.i(569572),h=a.i(176668),i=a.i(182248),j=a.i(947950),k=a.i(899284),l=b([j]);[j]=l.then?(await l)():l;class m extends Error{serverName;authorizationUrl;constructor(a,b){super(`MCP server "${a}" requires authorization`),this.serverName=a,this.authorizationUrl=b,this.name="McpAuthRequiredError"}}class n{store;serverName;oauth;callbackUrl;clientName;lastAuthorizationUrl;constructor(a,b,c,d,e){this.store=a,this.serverName=b,this.oauth=c,this.callbackUrl=d,this.clientName=e}get redirectUrl(){return this.callbackUrl}get clientMetadata(){return{client_name:this.clientName,redirect_uris:[this.callbackUrl],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"client_secret_post"}}async persist(a){this.oauth={...this.oauth,...a},await this.store.saveOAuth(this.serverName,this.oauth)}clientInformation(){return this.oauth.clientInformation}async saveClientInformation(a){await this.persist({clientInformation:a})}tokens(){return this.oauth.tokens}async saveTokens(a){await this.persist({tokens:a})}authorizationServerInformation(){return this.oauth.authorizationServer}async saveAuthorizationServerInformation(a){await this.persist({authorizationServer:a})}codeVerifier(){if(!this.oauth.codeVerifier)throw Error("No code verifier saved");return this.oauth.codeVerifier}async saveCodeVerifier(a){await this.persist({codeVerifier:a})}state(){return crypto.randomUUID()}async saveState(a){await this.persist({state:a})}storedState(){return this.oauth.state}redirectToAuthorization(a){this.lastAuthorizationUrl=a}async invalidateCredentials(a){let b={...this.oauth};("all"===a||"client"===a)&&(b.clientInformation=void 0),("all"===a||"tokens"===a)&&(b.tokens=void 0),("all"===a||"verifier"===a)&&(b.codeVerifier=void 0),this.oauth=b,await this.store.saveOAuth(this.serverName,b)}}let o=globalThis;o.__thursdayMcpManager&&o.__thursdayMcpManager.dispose(),d={callbackUrl:new URL("/api/mcp/oauth/callback",g.APP_URL).href,clientName:g.APP_NAME},o.__thursdayMcpManager=new class a{store;sessions;connecting;callbackUrl;clientName;constructor(a,b){this.store=a,this.sessions=new Map,this.connecting=new Map,this.callbackUrl=b.callbackUrl,this.clientName=b.clientName??g.APP_NAME}async connect(a){let b=this.connecting.get(a);if(b)return b;let c=this.doConnect(a).finally(()=>this.connecting.delete(a));return this.connecting.set(a,c),c}async callTool(a,b,c,d){let f=await this.ensureClient(a);try{let e=await f.callTool({name:b,arguments:c,options:d?{signal:d}:void 0});return this.touch(a),e}catch(b){if(b instanceof e.UnauthorizedError)throw await this.closeSession(a),new m(a);throw b}}async finishAuthorization(a){let b=a.get("state"),c=a.get("code");if(!b||!c)throw Error("OAuth callback is missing code or state");let d=await this.store.findByOAuthState(b);if(!d||!(0,k.isRemoteConfig)(d.config))throw Error("No server is waiting for this authorization");let f=this.providerFor(d),g=await (0,e.auth)(f,{serverUrl:d.config.url,authorizationCode:c,callbackState:b});if("AUTHORIZED"!==g)throw Error(`Token exchange ended in "${g}"`);return await f.invalidateCredentials("verifier"),await this.connect(d.name),d.name}async disconnect(a){await this.closeSession(a)}async dispose(){await Promise.all([...this.sessions.keys()].map(a=>this.closeSession(a)))}async doConnect(a){await this.closeSession(a);let b=await this.store.load(a);if(!b)throw Error(`Unknown MCP server "${a}"`);let c={};try{let d=await this.openClient(b,c),e=(await d.listTools()).tools.map(a=>({name:a.name,description:a.description,inputSchema:a.inputSchema,outputSchema:a.outputSchema}));return this.adopt(a,d),await this.store.saveConnectionResult(a,{toolInfo:e,lastError:null}),h.logger.info(`mcp "${a}" connected — ${e.length} tools`),{status:"connected",tools:e}}catch(l){var d,f;let g;if(l instanceof e.UnauthorizedError||l?.cause instanceof e.UnauthorizedError){let b=c.href;if(b)return await this.store.saveConnectionResult(a,{toolInfo:[],lastError:"Authorization required — finish sign-in in the opened tab"}),{status:"auth_required",authorizationUrl:b}}let j=(d=l,f=b,g=(0,i.errorToString)(d),(0,k.isRemoteConfig)(f.config)&&!f.oauth?.clientInformation&&/Invalid OAuth error response/.test(g)?`This server does not let an app register itself for sign-in, so it cannot be connected here. It answered: ${g}`:g);throw await this.store.saveConnectionResult(a,{toolInfo:[],lastError:j}),h.logger.warn(`mcp "${a}" failed — ${j}`),Error(j,{cause:l})}}async openClient(a,b={}){if((0,k.isRemoteConfig)(a.config)){let c=this.providerFor(a);try{return await (0,e.createMCPClient)({name:this.clientName,transport:{type:"http",url:a.config.url,headers:a.config.headers,authProvider:c,redirect:"follow"}})}finally{b.href=c.lastAuthorizationUrl?.href}}return(0,e.createMCPClient)({name:this.clientName,transport:new f.Experimental_StdioMCPTransport({command:a.config.command,args:a.config.args,env:a.config.env})})}providerFor(a){return new n(this.store,a.name,a.oauth??{},this.callbackUrl,this.clientName)}async ensureClient(a){let b=this.sessions.get(a);if(b)return b.client;let c=await this.connect(a);if("auth_required"===c.status)throw new m(a,c.authorizationUrl);let d=this.sessions.get(a);if(!d)throw Error(`Session for "${a}" vanished mid-connect`);return d.client}adopt(a,b){this.sessions.set(a,{client:b,idleTimer:this.armIdleTimer(a)})}touch(a){let b=this.sessions.get(a);b&&(clearTimeout(b.idleTimer),b.idleTimer=this.armIdleTimer(a))}armIdleTimer(a){let b=setTimeout(()=>{this.closeSession(a)},g.MCP_IDLE_MS);return b.unref?.(),b}async closeSession(a){let b=this.sessions.get(a);b&&(this.sessions.delete(a),clearTimeout(b.idleTimer),await b.client.close().catch(()=>{}))}}({load:a=>(0,j.findServer)(a),saveOAuth:(a,b)=>(0,j.saveOAuthData)(a,b),saveConnectionResult:(a,b)=>null===b.lastError?(0,j.syncServerTools)(a,b.toolInfo):(0,j.saveConnectionError)(a,b.lastError),findByOAuthState:a=>(0,j.findServerByOAuthState)(a)},d);let p=o.__thursdayMcpManager;a.s(["McpAuthRequiredError",0,m,"mcpManager",0,p]),c()}catch(a){c(a)}},!1),947950,a=>a.a(async(b,c)=>{try{var d=a.i(93321),e=a.i(351674),f=a.i(203469),g=a.i(184838),h=a.i(714428),i=a.i(688034),j=a.i(899284),k=a.i(293480),l=a.i(630189),m=b([g]);async function n(a){var b;let[c]=await g.database.select({name:h.mcpServerTable.name,config:h.mcpServerTable.config,lastError:h.mcpServerTable.lastError,toolsSyncedAt:h.mcpServerTable.toolsSyncedAt}).from(h.mcpServerTable).where((0,d.eq)(h.mcpServerTable.name,a));return c?{...c,config:(b=c.config,(0,j.isRemoteConfig)(b)?{url:b.url}:{command:b.command,args:b.args}),tools:await o(a)}:null}async function o(a){return g.database.select({id:h.mcpToolTable.id,name:h.mcpToolTable.name,description:h.mcpToolTable.description,inputSchema:h.mcpToolTable.inputSchema,outputSchema:h.mcpToolTable.outputSchema}).from(h.mcpToolTable).where((0,d.eq)(h.mcpToolTable.serverName,a)).orderBy(h.mcpToolTable.name)}[g]=m.then?(await m)():m;let A=a=>Object.fromEntries(Object.entries(a).map(([a,b])=>[a,(0,l.isSealed)(b)?b:(0,l.sealSecret)(b)])),B=a=>Object.fromEntries(Object.entries(a).map(([a,b])=>[a,(0,l.openSecret)(b)]));function p(a){try{return function(a){let{sealed:b,...c}=a;return b?{...JSON.parse((0,l.openSecret)(b)),...c}:c}(a)}catch(a){if(a instanceof l.UnreadableSecret)return null;throw a}}function q(a){let b,c,d=function(a){try{return(0,j.isRemoteConfig)(a)?a.headers?{...a,headers:B(a.headers)}:a:a.env?{...a,env:B(a.env)}:a}catch(a){if(a instanceof l.UnreadableSecret)return null;throw a}}(a.config);d||(0,k.publicError)((b=a.name,(0,i.lostWords)(`The key saved for "${b}"`,"Add it again under the same name, with its key: bots keep the tools they pinned.")));let e=a.oauth&&p(a.oauth);return a.oauth&&!e&&(0,k.publicError)((c=a.name,(0,i.lostWords)(`The sign-in saved for "${c}"`,"Reconnect to sign in again."))),{...a,config:d,oauth:e}}async function r(a){let[b]=await g.database.select({oauth:h.mcpServerTable.oauth}).from(h.mcpServerTable).where((0,d.eq)(h.mcpServerTable.name,a));return!(!b?.oauth||p(b.oauth))&&(await g.database.update(h.mcpServerTable).set({oauth:{state:b.oauth.state,authorizationServer:b.oauth.authorizationServer}}).where((0,d.eq)(h.mcpServerTable.name,a)),C(),!0)}async function s(a){let[b]=await g.database.select().from(h.mcpServerTable).where((0,d.eq)(h.mcpServerTable.name,a));return b?q(b):null}let C=()=>f.appEvents.emit({type:"mcp"});async function t(a){var b;let c=(b=a.config,(0,j.isRemoteConfig)(b)?b.headers?{...b,headers:A(b.headers)}:b:b.env?{...b,env:A(b.env)}:b);await g.database.insert(h.mcpServerTable).values({name:a.name,config:c,lastError:null}).onConflictDoUpdate({target:h.mcpServerTable.name,set:{config:c,lastError:null}}),C()}async function u(a,b){await g.database.transaction(async c=>{b.length&&await c.insert(h.mcpToolTable).values(b.map(b=>({...b,serverName:a}))).onConflictDoUpdate({target:[h.mcpToolTable.serverName,h.mcpToolTable.name],set:{description:v(h.mcpToolTable.description),inputSchema:v(h.mcpToolTable.inputSchema),outputSchema:v(h.mcpToolTable.outputSchema)}}),await c.delete(h.mcpToolTable).where(b.length?(0,d.and)((0,d.eq)(h.mcpToolTable.serverName,a),(0,d.notInArray)(h.mcpToolTable.name,b.map(a=>a.name))):(0,d.eq)(h.mcpToolTable.serverName,a)),await c.update(h.mcpServerTable).set({lastError:null,toolsSyncedAt:new Date}).where((0,d.eq)(h.mcpServerTable.name,a))}),C()}function v(a){return e.sql.raw(`excluded."${a.name}"`)}async function w(a,b){await g.database.update(h.mcpServerTable).set({lastError:b}).where((0,d.eq)(h.mcpServerTable.name,a)),C()}async function x(a,b){await g.database.update(h.mcpServerTable).set({oauth:b&&function(a){let{state:b,authorizationServer:c,...d}=a,e=Object.values(d).some(a=>void 0!==a);return{state:b,authorizationServer:c,...e&&{sealed:(0,l.sealSecret)(JSON.stringify(d))}}}(b)}).where((0,d.eq)(h.mcpServerTable.name,a)),C()}async function y(a){let[b]=await g.database.select().from(h.mcpServerTable).where(e.sql`json_extract(${h.mcpServerTable.oauth}, '$.state') = ${a}`);return b?q(b):null}async function z(a){let b=await g.database.delete(h.mcpServerTable).where((0,d.eq)(h.mcpServerTable.name,a)).returning();return b.length>0&&C(),b.length>0}a.s(["deleteServer",0,z,"findPinnedTools",0,function(a){return g.database.select({server:h.mcpToolTable.serverName,name:h.mcpToolTable.name,description:h.mcpToolTable.description,inputSchema:h.mcpToolTable.inputSchema}).from(h.botMcpToolTable).innerJoin(h.mcpToolTable,(0,d.eq)(h.botMcpToolTable.toolId,h.mcpToolTable.id)).where((0,d.eq)(h.botMcpToolTable.botName,a)).orderBy(h.mcpToolTable.serverName,h.mcpToolTable.name)},"findServer",0,s,"findServerByOAuthState",0,y,"findServerDetail",0,n,"findToolSchemas",0,function(a,b){return b.length?g.database.select({name:h.mcpToolTable.name,description:h.mcpToolTable.description,inputSchema:h.mcpToolTable.inputSchema}).from(h.mcpToolTable).where((0,d.and)((0,d.eq)(h.mcpToolTable.serverName,a),(0,d.inArray)(h.mcpToolTable.name,b))).orderBy(h.mcpToolTable.name):Promise.resolve([])},"forgetLostSignIn",0,r,"listServerNames",0,function(){return g.database.select({name:h.mcpServerTable.name}).from(h.mcpServerTable).orderBy(h.mcpServerTable.name)},"listToolNames",0,function(a){let b=g.database.select({server:h.mcpToolTable.serverName,name:h.mcpToolTable.name}).from(h.mcpToolTable);return a?b.where((0,d.eq)(h.mcpToolTable.serverName,a)).orderBy(h.mcpToolTable.name):b.orderBy(h.mcpToolTable.serverName,h.mcpToolTable.name)},"saveConnectionError",0,w,"saveOAuthData",0,x,"syncServerTools",0,u,"upsertServer",0,t]),c()}catch(a){c(a)}},!1),899284,a=>{"use strict";var b=a.i(53112),c=a.i(706210);let d=b.z.object({url:b.z.url(),headers:b.z.record(b.z.string(),b.z.string()).optional()}),e=b.z.object({command:b.z.string().min(1),args:b.z.array(b.z.string()).optional(),env:b.z.record(b.z.string(),b.z.string()).optional()}),f=b.z.union([d,e]),g=b.z.object({name:b.z.string(),description:b.z.string().optional(),inputSchema:b.z.looseObject({}).optional(),outputSchema:b.z.looseObject({}).optional()});b.z.object({clientInformation:b.z.looseObject({}).optional(),tokens:b.z.looseObject({}).optional(),authorizationServer:b.z.looseObject({}).optional(),codeVerifier:b.z.string().optional(),state:b.z.string().optional()});let h=b.z.object({name:b.z.string().min(1).max(40),config:f,toolCount:b.z.number().int(),lastError:b.z.string().nullish()}),i=g.extend({id:b.z.number().int(),description:b.z.string().nullish()});h.omit({toolCount:!0}).extend({tools:i.array().default([]),toolsSyncedAt:c.DateLikeSchema});let j=b.z.object({name:b.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:f});b.z.union([b.z.object({mcpServers:b.z.record(b.z.string(),f)}),b.z.record(b.z.string(),f)]),a.s(["MCPServerFormSchema",0,j,"isRemoteConfig",0,function(a){return"url"in a}])},986743,a=>a.a(async(b,c)=>{try{var d=a.i(93321),e=a.i(530385),f=a.i(351674),g=a.i(203469);a.i(569572);var h=a.i(184838),i=a.i(714428),j=a.i(661210),k=b([h]);[h]=k.then?(await k)():k;let B=()=>g.appEvents.emit({type:"memory"});async function l(a,b,c={}){let[d]=await h.database.insert(i.memoryNoteTable).values({path:a,description:b,ownedByUser:c.ownedByUser??!1}).onConflictDoNothing({target:i.memoryNoteTable.path}).returning();return d&&B(),d??null}async function m(a,b){let[c]=await h.database.update(i.memoryNoteTable).set({...b,updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,a)).returning();return c&&B(),c??null}async function n(a){let b=await h.database.delete(i.memoryNoteTable).where((0,d.eq)(i.memoryNoteTable.id,a)).returning({id:i.memoryNoteTable.id});return b.length>0&&B(),b.length>0}async function o(a,b){let[c]=await h.database.insert(i.memoryFactTable).values({noteId:a,text:b,source:"user"}).returning();return await r(a),B(),c}async function p(a,b,c){let e=await h.database.transaction(async e=>{let f=await e.update(i.memoryFactTable).set({isLatest:!1}).where((0,d.and)((0,d.eq)(i.memoryFactTable.id,b),(0,d.eq)(i.memoryFactTable.noteId,a),(0,d.eq)(i.memoryFactTable.isLatest,!0))).returning({id:i.memoryFactTable.id});if(0===f.length)return null;let[g]=await e.insert(i.memoryFactTable).values({noteId:a,text:c,source:"user"}).returning();return await e.update(i.memoryNoteTable).set({updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,a)),g});return e&&B(),e}async function q(a,b){let c=await h.database.delete(i.memoryFactTable).where((0,d.and)((0,d.eq)(i.memoryFactTable.id,b),(0,d.eq)(i.memoryFactTable.noteId,a))).returning({id:i.memoryFactTable.id});return c.length>0&&(await r(a),B()),c.length>0}function r(a){return h.database.update(i.memoryNoteTable).set({updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,a))}async function s(){for(let a of j.MEMORY_ALWAYS_LISTED){let b=j.MEMORY_PATHS.find(b=>b.path===a)?.of??a;await h.database.insert(i.memoryNoteTable).values({path:a,description:b}).onConflictDoUpdate({target:i.memoryNoteTable.path,set:{description:b}})}}async function t(a,b={}){let c=[...new Set(a.map(a=>a.trim()).filter(Boolean))];if(!c.length)return{notes:[],missing:[]};let g=await h.database.select({id:i.memoryNoteTable.id,path:i.memoryNoteTable.path,description:i.memoryNoteTable.description}).from(i.memoryNoteTable).where((0,d.inArray)(i.memoryNoteTable.path,c)),j=new Map(g.map(a=>[a.path,a])),k=c.filter(a=>!j.has(a));if(!g.length)return{notes:[],missing:k};let l=g.map(a=>a.id),m=await h.database.select({id:i.memoryFactTable.id,noteId:i.memoryFactTable.noteId,text:i.memoryFactTable.text,source:i.memoryFactTable.source,createdAt:i.memoryFactTable.createdAt,saidAt:i.callTable.startedAt}).from(i.memoryFactTable).leftJoin(i.callTable,(0,d.eq)(i.memoryFactTable.callId,i.callTable.id)).where((0,d.and)((0,d.eq)(i.memoryFactTable.isLatest,!0),(0,d.inArray)(i.memoryFactTable.noteId,l))).orderBy((0,e.asc)(i.memoryFactTable.id));return!1!==b.touch&&await h.database.update(i.memoryNoteTable).set({hits:f.sql`${i.memoryNoteTable.hits} + 1`,lastReadAt:new Date}).where((0,d.inArray)(i.memoryNoteTable.id,l)),{notes:c.flatMap(a=>{let b=j.get(a);return b?[{path:b.path,description:b.description,facts:m.filter(a=>a.noteId===b.id).map(a=>({id:a.id,text:a.text,...a.saidAt?{saidAt:a.saidAt}:{}}))}]:[]}),missing:k}}(0,d.inArray)(i.memoryNoteTable.path,j.MEMORY_ALWAYS_LISTED);let C=a=>a.toLowerCase().replace(/[\s.,!?…·'"`]/g,"");async function u(a,b,c,e,f){let g=await a.select({id:i.memoryFactTable.id,text:i.memoryFactTable.text}).from(i.memoryFactTable).where((0,d.and)((0,d.eq)(i.memoryFactTable.noteId,b),(0,d.eq)(i.memoryFactTable.isLatest,!0))),h=new Map(g.map(a=>[C(a.text),a]));for(let g of c){let c=g.text.trim();if(!c)continue;if(null!=g.replaces){let[j]=await a.select({id:i.memoryFactTable.id,text:i.memoryFactTable.text}).from(i.memoryFactTable).where((0,d.and)((0,d.eq)(i.memoryFactTable.id,g.replaces),(0,d.eq)(i.memoryFactTable.noteId,b),(0,d.eq)(i.memoryFactTable.isLatest,!0)));if(j){if(C(j.text)===C(c))continue;await a.update(i.memoryFactTable).set({isLatest:!1}).where((0,d.eq)(i.memoryFactTable.id,j.id)),h.delete(C(j.text));let[g]=await a.insert(i.memoryFactTable).values({noteId:b,text:c,source:e,callId:f}).returning({id:i.memoryFactTable.id});h.set(C(c),{...g,text:c});continue}}if(h.has(C(c)))continue;let[j]=await a.insert(i.memoryFactTable).values({noteId:b,text:c,source:e,callId:f}).returning({id:i.memoryFactTable.id});h.set(C(c),{...j,text:c})}await a.update(i.memoryNoteTable).set({updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,b))}async function v(a,b,c,e=null){let f=a.trim();if(!await h.database.transaction(async a=>{let[g]=await a.select({id:i.memoryNoteTable.id}).from(i.memoryNoteTable).where((0,d.eq)(i.memoryNoteTable.path,f));return!!g&&(await u(a,g.id,b,c,e),!0)}))return null;let{notes:g}=await t([f],{touch:!1});return B(),g[0]??null}async function w(a,b,c,d,e=null){let f=a.trim();if(!await h.database.transaction(async a=>{let[g]=await a.insert(i.memoryNoteTable).values({path:f,description:b}).onConflictDoNothing({target:i.memoryNoteTable.path}).returning({id:i.memoryNoteTable.id});return!!g&&(await u(a,g.id,c,d,e),!0)}))return null;let{notes:g}=await t([f],{touch:!1});return B(),g[0]??null}async function x(a,b){let[c]=await h.database.update(i.memoryNoteTable).set({description:b,updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.path,a.trim())).returning({id:i.memoryNoteTable.id});return c&&B(),!!c}async function y(){let[a,b]=await Promise.all([h.database.select({id:i.memoryNoteTable.id,path:i.memoryNoteTable.path,description:i.memoryNoteTable.description,hits:i.memoryNoteTable.hits,lastReadAt:i.memoryNoteTable.lastReadAt,createdAt:i.memoryNoteTable.createdAt}).from(i.memoryNoteTable),h.database.select({noteId:i.memoryFactTable.noteId,count:f.sql`count(*)`}).from(i.memoryFactTable).where((0,d.eq)(i.memoryFactTable.isLatest,!0)).groupBy(i.memoryFactTable.noteId)]),c=new Map(b.map(a=>[a.noteId,a.count]));return a.filter(a=>(0,j.isAlwaysListed)(a.path)||(c.get(a.id)??0)>0).sort((a,b)=>Number((0,j.isAlwaysListed)(b.path))-Number((0,j.isAlwaysListed)(a.path))||(0,j.recallScore)(b)-(0,j.recallScore)(a)).map(a=>({path:a.path,description:a.description,factCount:c.get(a.id)??0,lastSeenAt:a.lastReadAt??a.createdAt}))}async function z(a){let b=await h.database.transaction(async b=>{let c=await b.delete(i.memoryFactTable).where((0,d.eq)(i.memoryFactTable.id,a)).returning({noteId:i.memoryFactTable.noteId});if(0===c.length)return null;let e=c[0].noteId,[g]=await b.select({path:i.memoryNoteTable.path,ownedByUser:i.memoryNoteTable.ownedByUser}).from(i.memoryNoteTable).where((0,d.eq)(i.memoryNoteTable.id,e)),[h]=await b.select({count:f.sql`count(*)`}).from(i.memoryFactTable).where((0,d.and)((0,d.eq)(i.memoryFactTable.noteId,e),(0,d.eq)(i.memoryFactTable.isLatest,!0)));return h?.count!==0||!g||g.ownedByUser||(0,j.isAlwaysListed)(g.path)?(await b.update(i.memoryNoteTable).set({updatedAt:new Date}).where((0,d.eq)(i.memoryNoteTable.id,e)),{path:g?.path??"",noteGone:!1}):(await b.delete(i.memoryNoteTable).where((0,d.eq)(i.memoryNoteTable.id,e)),{path:g.path,noteGone:!0})});return b&&B(),b}async function A(){let a=await h.database.delete(i.memoryNoteTable).returning({id:i.memoryNoteTable.id});return await s(),a.length>0&&B(),a.length}a.s(["addFact",0,o,"createNote",0,l,"createNoteWithFacts",0,w,"deleteAllNotes",0,A,"deleteNote",0,n,"describeNote",0,x,"forgetFact",0,q,"forgetFactById",0,z,"listNoteIndex",0,y,"readNotes",0,t,"reviseFact",0,p,"updateNote",0,m,"writeFacts",0,v]),c()}catch(a){c(a)}},!1),661210,a=>{"use strict";var b=a.i(53112),c=a.i(569572),d=a.i(706210);let e=b.z.enum(["user","call","bot"]),f=b.z.string().trim().min(1,"A note needs a line saying what it is about").max(c.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${c.MEMORY_LIMITS.descriptionChars} characters`),g=b.z.object({id:b.z.number(),text:b.z.string(),source:e.nullish(),createdAt:d.DateLikeSchema});b.z.object({id:b.z.number(),path:b.z.string(),description:b.z.string(),ownedByUser:b.z.boolean(),hits:b.z.number(),lastReadAt:d.DateLikeSchema.nullable(),createdAt:d.DateLikeSchema,updatedAt:d.DateLikeSchema,factCount:b.z.number(),facts:g.array()});let h=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],i=h.filter(a=>!a.path.endsWith("/")).map(a=>a.path),j=h.filter(a=>a.path.endsWith("/")).map(a=>a.path.slice(0,-1)),k=RegExp(`^(?:${i.join("|")}|(?:${j.join("|")})/.+)$`);a.s(["MEMORY_ALWAYS_LISTED",0,i,"MEMORY_PATHS",0,h,"NoteLineSchema",0,f,"isAlwaysListed",0,a=>i.includes(a),"isMemoryPath",0,a=>k.test(a),"recallScore",0,function(a){let b=(0,d.toDate)(a.lastReadAt??a.createdAt),c=Math.max(0,(Date.now()-b.getTime())/864e5);return(a.hits+1)/(1+c)}])},780946,a=>a.a(async(b,c)=>{try{var d=a.i(93321),e=a.i(258261),f=a.i(530385),g=a.i(203469),h=a.i(569572),i=a.i(184838),j=a.i(714428),k=a.i(221214),l=a.i(293480),m=a.i(643020),n=b([i,k]);[i,k]=n.then?(await n)():n;let z=()=>g.appEvents.emit({type:"routines"});async function o(a,b){return i.database.select({id:j.threadTable.id,status:j.threadTable.status,outcome:j.threadTable.outcome,updatedAt:j.threadTable.updatedAt}).from(j.threadTable).where((0,d.eq)(j.threadTable.routineId,a)).orderBy((0,f.desc)(j.threadTable.createdAt)).limit(b)}let A=async a=>{let{createdAt:b,...c}=a;return{...c,runs:await o(a.id,h.ROUTINE.runsShown)}};async function p(){let a=await i.database.select().from(j.routineTable).orderBy(j.routineTable.createdAt);return Promise.all(a.map(A))}async function q(a){let[b]=await i.database.select().from(j.routineTable).where((0,d.eq)(j.routineTable.id,a));return b?A(b):null}async function r(a){let b=await q(a.trim());if(b)return b;let c=a.trim().toLowerCase(),d=(await p()).filter(a=>a.label.toLowerCase()===c);return 1===d.length?d[0]:null}async function s(a){let b=await (0,k.findJobBot)(a);return(!b||b.disabled)&&(0,l.publicError)("Choose an enabled bot."),b.name}function t(a,b){b&&"once"===a.kind&&(0,m.momentOf)(a.at)<=new Date&&(0,l.publicError)("That time has passed. Pick a later one.")}async function u(a){let[{total:b}]=await i.database.select({total:(0,e.count)()}).from(j.routineTable);b>=h.ROUTINE.max&&(0,l.publicError)(`There are already ${h.ROUTINE.max} routines. Delete one to make another.`),t(a.schedule,!0);let[c]=await i.database.insert(j.routineTable).values({id:crypto.randomUUID(),...a,bot:await s(a.bot),nextRunAt:(0,m.nextRun)(a.schedule,new Date)}).returning();return z(),A(c)}async function v(a,b){let[c]=await i.database.select().from(j.routineTable).where((0,d.eq)(j.routineTable.id,a));if(!c)return null;let e=b.schedule??c.schedule,f=!!(b.schedule&&!(0,m.sameSchedule)(b.schedule,c.schedule))||b.enabled&&!c.enabled;f&&t(e,b.enabled??c.enabled);let[g]=await i.database.update(j.routineTable).set({...b,...b.bot?{bot:await s(b.bot)}:{},...f?{nextRunAt:(0,m.nextRun)(e,new Date)}:{}}).where((0,d.eq)(j.routineTable.id,a)).returning();return z(),A(g)}async function w(a){let b=await i.database.delete(j.routineTable).where((0,d.eq)(j.routineTable.id,a)).returning({id:j.routineTable.id});return b.length&&z(),b.length>0}async function x(a){return(await o(a,1))[0]??null}async function y(a){return(await i.database.select({id:j.threadTable.id}).from(j.threadTable).where((0,d.and)((0,d.eq)(j.threadTable.routineId,a),(0,d.eq)(j.threadTable.seen,!1),(0,d.inArray)(j.threadTable.status,["done","cancelled"])))).map(a=>a.id)}a.s(["createRoutine",0,u,"deleteRoutine",0,w,"findRoutine",0,q,"latestRun",0,x,"listRoutines",0,p,"listUnseenRunIds",0,y,"resolveRoutine",0,r,"updateRoutine",0,v]),c()}catch(a){c(a)}},!1),643020,a=>{"use strict";var b=a.i(723885),c=a.i(569572),d=a.i(706210);let e=b.default.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function f(a){let[b,c]=a.split(" "),[d,e,f]=b.split("-").map(Number),[g,h]=c.split(":").map(Number);return new Date(d,e-1,f,g,h)}let g=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,h=b.default.string().regex(g,'A moment is "YYYY-MM-DD HH:MM"').refine(a=>{if(!g.test(a))return!0;let b=f(a);return b.getMonth()===Number(a.slice(5,7))-1&&b.getDate()===Number(a.slice(8,10))},"There is no such day"),i=b.default.discriminatedUnion("kind",[b.default.object({kind:b.default.literal("once"),at:h}),b.default.object({kind:b.default.literal("daily"),time:e,days:b.default.array(b.default.number().int().min(1).max(7)).min(1,"Pick at least one day").transform(a=>[...new Set(a)].sort((a,b)=>a-b))}),b.default.object({kind:b.default.literal("every"),hours:b.default.number().int().min(c.ROUTINE.minHours,`No more often than every ${c.ROUTINE.minHours}h`).max(168)})]),j=b.default.object({bot:b.default.string().trim().min(1,"Pick a bot"),label:b.default.string().trim().min(1,"Give it a name").max(80),request:b.default.string().trim().min(1,"Say what it should do"),schedule:i}),k=b.default.object({id:b.default.string(),status:b.default.enum(["running","waiting","done","cancelled"]),outcome:b.default.string().nullable(),updatedAt:d.DateLikeSchema});j.extend({id:b.default.string(),enabled:b.default.boolean(),nextRunAt:d.DateLikeSchema,runs:b.default.array(k)});let l=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];a.s(["RoutineInputSchema",0,j,"RoutineScheduleSchema",0,i,"momentOf",0,f,"nextRun",0,function(a,b){if("once"===a.kind)return f(a.at);if("every"===a.kind)return new Date(b.getTime()+36e5*a.hours);let[c,d]=a.time.split(":").map(Number);for(let e=0;e<=7;e++){let f=new Date(b);f.setDate(f.getDate()+e),f.setHours(c,d,0,0);let g=0===f.getDay()?7:f.getDay();if(f>b&&a.days.includes(g))return f}return new Date(b.getTime()+864e5)},"sameSchedule",0,function(a,b){if("once"===a.kind)return"once"===b.kind&&a.at===b.at;if("every"===a.kind)return"every"===b.kind&&a.hours===b.hours;let c=a=>[...a].sort((a,b)=>a-b).join();return"daily"===b.kind&&a.time===b.time&&c(a.days)===c(b.days)},"scheduleText",0,function(a){if("once"===a.kind){let[b,c]=a.at.split(" "),[,d,e]=b.split("-").map(Number);return`Once \xb7 ${m[d-1]} ${e} ${c}`}if("every"===a.kind)return 1===a.hours?"Every hour":`Every ${a.hours} hours`;let{days:b,time:c}=a;if(7===b.length)return`Daily ${c}`;if(1===b.length)return`${l[b[0]-1]} ${c}`;let d=b.every((a,c)=>0===c||a===b[c-1]+1)?`${l[b[0]-1]}–${l[b.at(-1)-1]}`:b.map(a=>l[a-1]).join(" ");return`Daily ${c} \xb7 ${d}`}])},487591,422807,a=>{"use strict";var b=a.i(666680),c=a.i(912714),d=a.i(750227),e=a.i(53112),f=a.i(203469),g=a.i(569572),h=a.i(821415),i=a.i(176668),j=a.i(8412);let k=a=>a.trim().toLowerCase().replace(/^[a-z]+:\/\//,"").replace(/^www\./,"").replace(/[/?#].*$/,"");a.s(["siteOf",0,k],422807);let l=(0,d.join)(g.DATA_DIR,g.PATHS.signIns),m=e.z.object({site:e.z.string().min(1),account:e.z.string().min(1),bots:e.z.array(e.z.string()),asking:e.z.array(e.z.string()),keptAt:e.z.string(),usedAt:e.z.string().nullable(),state:e.z.unknown()}),n=(a,c)=>(0,d.join)(l,`${encodeURIComponent(k(a))}@${(0,b.createHash)("sha256").update(c).digest("hex").slice(0,16)}.json`),o=a=>(0,d.join)(l,`${encodeURIComponent(k(a))}.json`);function p(a){let[,b]=/^([^@]+)(?:@[0-9a-f]{16})?\.json$/.exec(a)??[];if(!b)return null;try{return decodeURIComponent(b)}catch{return null}}let q=()=>f.appEvents.emit({type:"signins"});async function r(a){try{let b=m.safeParse(JSON.parse(await (0,c.readFile)(a,"utf8")));return b.success?b.data:null}catch{return null}}async function s(a,b){let c=await r(n(a,b));if(c)return c;let d=await r(o(a));return d?.site===k(a)&&d.account===b?d:null}async function t(a,b){let d=o(a),e=await r(d);e?.site===k(a)&&e.account===b&&await (0,c.rm)(d,{force:!0})}async function u(a){await (0,c.mkdir)(l,{recursive:!0}),await (0,c.writeFile)(n(a.site,a.account),JSON.stringify(a),{mode:384}),await t(a.site,a.account),q()}let v=globalThis.__signInsVault??=(0,j.createKeyedLock)(),w=a=>v("vault",a);async function x(){return[...new Set((await (0,c.readdir)(l).catch(()=>[])).flatMap(a=>p(a)??[]))].sort()}async function y(a){let b=(await (0,c.readdir)(l).catch(()=>[])).filter(b=>{let c=p(b);return null!==c&&(!a||a(c))});return(await Promise.all(b.map(async a=>{let c=await r((0,d.join)(l,a));if(!c)return null;let e=(0,d.basename)(n(c.site,c.account));return a===e?c:a!==(0,d.basename)(o(c.site))||b.includes(e)?null:c}))).flatMap(a=>a?[a]:[]).sort((a,b)=>a.site.localeCompare(b.site)||a.account.localeCompare(b.account))}async function z(a){let b=k(a),c=await x(),d=c.includes(b)?b:c.filter(a=>b.endsWith(`.${a}`)).sort((a,b)=>b.length-a.length)[0];return d?y(a=>a===d):[]}async function A(a,b){return(await (0,h.listBrowsers)(a,b)).find(a=>a.name===b.PLAYWRIGHT_CLI_SESSION)??null}async function B(a,b){let c=await A(a,b);return c?c.attached?"theirs":"own":null}async function C(a,b){let c=await A(a,b);return!!c&&!c.attached&&!0===c.headed}let D=globalThis.__signInsBrowser??=(0,j.createKeyedLock)(),E=(a,b)=>D(a.PLAYWRIGHT_CLI_SESSION??"",b),F=globalThis.__signInsLentByAccount??=new Map,G="__thursdaySignIns";async function H(a,b){let c=await a.exec(`playwright-cli --raw run-code "async page => page.context().${G} ?? null"`,{env:b,timeoutMs:g.BROWSER_CLI.readMs});if(0===c.exitCode)try{let a=JSON.parse(c.stdout);return"string"==typeof a?a:null}catch{return}}let I=!1;async function J(a,b,c){return 0===(await a.exec(`playwright-cli --raw run-code "async page => { page.context().${G} = '${c}'; return true; }"`,{env:b,timeoutMs:g.BROWSER_CLI.readMs})).exitCode&&(!!I||(I=await H(a,b)===c))}async function K(a,c,d,e,f){let g=c.PLAYWRIGHT_CLI_SESSION;if(!g)return;let h=F.get(g);if("kept"===f&&h?.bot===d&&await H(a,c)===h.mark)return void h.sites.set(e.site,e.account);let j=(0,b.randomUUID)().replaceAll("-","");await J(a,c,j)?F.set(g,{bot:d,mark:j,sites:new Map([[e.site,e.account]])}):(F.delete(g),i.logger.warn(`sign-ins: ${g}'s browser could not be marked, so ${e.site} is not renewed from it`))}async function L(a,b){let c=b.PLAYWRIGHT_CLI_SESSION??"",d=F.get(c);d&&!await J(a,b,d.mark)&&F.delete(c)}let M=a=>`${a.name}
145
147
  ${a.domain}
146
- ${a.path}`;async function v(a){let b,c=(0,f.jobShellEnv)(a),d=c.PLAYWRIGHT_CLI_SESSION??a,g=p.get(d);if(!g?.sites.size)return;let h=await (0,f.openWorkspace)();if(await s(h,c)!=="own")return void p.delete(d);let i=(0,f.browserStateFile)();try{let a=await h.exec((0,f.saveBrowserState)(i),{env:c,timeoutMs:e.BROWSER_CLI.loadMs});if(0!==a.exitCode)return;let d=JSON.parse(await h.readFile(i,"utf-8"));b=new Map((d.cookies??[]).map(a=>[u(a),a]))}finally{await h.exec(`rm -f ${i}`)}for(let a of g.sites){let c=await k(a),d=c?.state;if(!c||!d?.cookies||!c.bots.includes(g.bot))continue;let e=!1,f=d.cookies.map(a=>{let c=b.get(u(a));return c&&JSON.stringify(c)!==JSON.stringify(a)?(e=!0,c):a});e&&await m({...c,state:{...d,cookies:f}})}}async function w(a,b,c){let d=await k(a);d&&await m({...d,bots:c?[...new Set([...d.bots,b])]:d.bots.filter(a=>a!==b),asking:d.asking.filter(a=>a!==b)})}async function x(a){await (0,b.rm)(i(a),{force:!0}),j()}a.s(["borrowSignIn",0,q,"holdSignIn",0,function(a,b,c){let d=p.get(a);d&&d.bot===b?d.sites.add(c):p.set(a,{bot:b,sites:new Set([c])})},"keepSignIn",0,o,"removeSignIn",0,x,"renewSignIns",0,v,"sessionBrowser",0,s,"sessionWindow",0,t,"setSignInBot",0,w],487591)},138100,a=>a.a(async(b,c)=>{try{var d=a.i(666680),e=a.i(750227),f=a.i(569572),g=a.i(821415),h=a.i(176668),i=a.i(182248),j=a.i(762805),k=b([j]);[j]=k.then?(await k)():k;let m=(0,e.join)(f.APP_DIR,f.PATHS.skills.default),n=(0,e.join)(f.APP_DIR,f.PATHS.skills.seeds),o=(0,e.join)(f.DATA_DIR,f.PATHS.skills.custom),p=async(a,b)=>{let c,d=b?(c=b.trim().toLowerCase(),/^[a-z0-9][a-z0-9_-]*$/.test(c)?(0,e.join)(n,c):null):null;return l(a,b?[m,...d?[d]:[],(0,e.join)(g.WORKSPACE,(0,g.botFolder)(b),f.PATHS.skills.own),o]:[m,o],await (0,j.readSkillsOff)(),await (0,j.readRetired)())};async function l(a,b,c=new Set,e=new Map){let f=[],g=new Set;for(let k of b){let b;try{b=await a.readdir(k,{withFileTypes:!0})}catch{continue}for(let l of b){let b,m;if(!l.isDirectory())continue;let n=`${k}/${l.name}`,o=`${n}/SKILL.md`;try{b=await a.readFile(o,"utf-8")}catch{continue}try{m=(0,j.parseFrontmatter)(b)}catch(a){h.logger.warn(`skill ${n}: SKILL.md front matter did not load — ${(0,i.errorToString)(a)}`);continue}if(!(0,j.runsHere)(m))continue;let p=e.get(m.name);!(p?.has((0,d.createHash)("sha256").update(b,"utf8").digest("hex"))||g.has(m.name))&&(g.add(m.name),(0,j.isSkillOff)(m,c)||f.push({name:m.name,description:m.description,path:n}))}}return f}a.s(["loadSkills",0,p]),c()}catch(a){c(a)}},!1),762805,a=>a.a(async(b,c)=>{try{let C;var d=a.i(666680),e=a.i(912714),f=a.i(750227),g=a.i(622650),h=a.i(569572),i=a.i(221214),j=a.i(725466),k=a.i(951941),l=a.i(821415),m=a.i(176668),n=a.i(293480),o=a.i(182248),p=b([i,j]);function q(a){if("default"===a)return(0,f.resolve)(h.APP_DIR,h.PATHS.skills.default);if("custom"===a)return(0,f.resolve)(h.DATA_DIR,h.PATHS.skills.custom);let b=(0,k.botOfSource)(a)??"";return a.startsWith("kit:")?(0,f.resolve)(h.APP_DIR,h.PATHS.skills.seeds,b.toLowerCase()):(0,f.resolve)(l.WORKSPACE,h.PATHS.bots,b,h.PATHS.skills.own)}function r(a,b){let c=q(a),d=(0,f.resolve)(c,b),e=(0,f.relative)(c,d);return(!e||e.startsWith("..")||e.includes(f.sep)||"."===e)&&(0,n.publicError)("Skill not found"),d}function s(a,b){let c=(0,f.resolve)(a,b),d=(0,f.relative)(a,c);return(d.startsWith("..")||(0,f.isAbsolute)(d))&&(0,n.publicError)("File not found"),c}async function t(a,b){let[c,d]=await Promise.all([(0,e.realpath)(a),(0,e.realpath)(b)]).catch(()=>(0,n.publicError)("File not found")),g=(0,f.relative)(c,d);return(g.startsWith("..")||(0,f.isAbsolute)(g))&&(0,n.publicError)("File not found"),d}function u(a){let b=a.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!b)return{head:null,body:a.trim(),rest:a,fence:""};let c=a.slice(b[0].length);return{head:b[1]??null,body:c.trim(),rest:c,fence:b[0]}}async function v(){try{return(0,k.parseSkillsOff)(await (0,j.readConfig)(k.SKILLS_OFF_KEY))}catch(a){return m.logger.warn(`skills switched off could not be read — ${(0,o.errorToString)(a)}`),new Set}}function w(a){let b,{head:c}=u(a);c||(0,n.publicError)("SKILL.md needs a YAML block with name and description");try{b=(0,g.parse)(c)}catch{(0,n.publicError)("SKILL.md frontmatter is not valid YAML")}let d=k.SkillFrontmatterSchema.safeParse(b);return d.success||(0,n.publicError)(`SKILL.md frontmatter: ${d.error.issues[0]?.message??"invalid"}`),d.data}[i,j]=p.then?(await p)():p;let D=/^disabled[ \t]*:[^\n]*(\r?\n|$)/m;async function x(a,b,c){let d,g=(0,f.join)(r(a,b),"SKILL.md");try{d=await (0,e.readFile)(g,"utf-8")}catch{(0,n.publicError)("Skill not found")}let{name:h}=w(d),i=(0,k.parseSkillsOff)(await (0,j.readConfig)(k.SKILLS_OFF_KEY));if(c?i.add(h.toLowerCase()):i.delete(h.toLowerCase()),await (0,j.writeConfig)(k.SKILLS_OFF_KEY,JSON.stringify([...i].sort())),c||"custom"!==a)return;let{head:l,rest:m,fence:o}=u(d);if(!l||!D.test(l))return;let p=o.includes("\r\n")?"\r\n":"\n",q=l.replace(D,"").replace(/\s+$/,"");await (0,e.writeFile)(g,`---${p}${q}${p}---${p}${m}`)}async function y(a,b,c){try{let g,h=await (0,e.readFile)((0,f.join)(q(a),b,"SKILL.md"),"utf-8"),i=w(h);if(a.startsWith("own:")&&(g=i.name,c.get(g)?.has((0,d.createHash)("sha256").update(h,"utf8").digest("hex"))))return null;return{...i,source:a,dir:b}}catch{return null}}async function z(a,b){let c=r("custom",a),d=async a=>(0,e.stat)(a).then(()=>!0,()=>!1);await d(c)&&(0,n.publicError)(`A skill named "${a}" already exists`),await d(r("default",a))&&(0,n.publicError)(`"${a}" is a built-in skill — pick another name`),await (0,e.mkdir)(c,{recursive:!0});try{for(let[a,d]of b){let b=s(c,a);await (0,e.mkdir)((0,f.resolve)(b,".."),{recursive:!0}),await (0,e.writeFile)(b,d)}}catch(a){throw await (0,e.rm)(c,{recursive:!0,force:!0}),a}let g=await y("custom",a,new Map);return g||(await (0,e.rm)(c,{recursive:!0,force:!0}),(0,n.publicError)("SKILL.md could not be read back")),g}async function A(a,b,c,d){(0,k.isEditableSource)(a)||(0,n.publicError)("A skill that ships with the app is read-only");let f=r(a,b),g=await t(f,s(f,c)),i=await (0,e.stat)(g).catch(()=>null);i?.isFile()||(0,n.publicError)("File not found"),Buffer.byteLength(d)>h.SKILL_FILES.inlineBytes&&(0,n.publicError)("That is larger than this screen can write back"),"SKILL.md"===c&&w(d),await (0,e.writeFile)(g,d,"utf-8")}async function B(a,b){(0,k.isEditableSource)(a)||(0,n.publicError)("A skill that ships with the app can only be switched off");let c=r(a,b);await (0,e.stat)(c).then(()=>!0,()=>!1)||(0,n.publicError)("Skill not found"),await (0,e.rm)(c,{recursive:!0,force:!0})}a.s(["deleteSkill",0,B,"isSkillOff",0,(a,b)=>!0===a.disabled||b.has(a.name.toLowerCase()),"parseFrontmatter",0,w,"readRetired",0,()=>C??=(0,e.readFile)((0,f.join)(h.APP_DIR,h.PATHS.skills.seeds,"retired.json"),"utf8").then(a=>{let{sha256:b}=JSON.parse(a);return new Map(Object.entries(b).map(([a,b])=>[a,new Set(b)]))}).catch(()=>new Map),"readSkillsOff",0,v,"renderSkillMarkdown",0,function(a,b){return`---
148
+ ${a.path}`;async function N(a,b){let c,d=b.PLAYWRIGHT_CLI_SESSION??"",e=F.get(d);if(!e?.sites.size)return;if(await B(a,b)!=="own")return void F.delete(d);let f=async()=>{let c=await H(a,b);return void 0!==c&&c!==e.mark&&F.delete(d),c===e.mark};if(!await f())return;let i=(0,h.browserStateFile)();try{let d=await a.exec((0,h.saveBrowserState)(i),{env:b,timeoutMs:g.BROWSER_CLI.loadMs});if(0!==d.exitCode)return;let e=JSON.parse(await a.readFile(i,"utf-8"));c=new Map((e.cookies??[]).map(a=>[M(a),a]))}finally{await a.exec(`rm -f ${i}`)}if(F.get(d)===e&&await f())for(let[a,b]of e.sites)await w(async()=>{let d=await s(a,b),f=d?.state;if(!d||!f?.cookies||!d.bots.includes(e.bot))return;let g=!1,h=f.cookies.map(a=>{let b=c.get(M(a));return b&&JSON.stringify(b)!==JSON.stringify(a)?(g=!0,b):a});g&&await u({...d,state:{...f,cookies:h}})})}async function O(a){let b=(0,h.jobShellEnv)(a);if(!F.get(b.PLAYWRIGHT_CLI_SESSION??"")?.sites.size)return;let c=await (0,h.openWorkspace)();await E(b,()=>N(c,b))}a.s(["borrowSignIn",0,function(a,b,c){return w(async()=>{let d=await z(a);if(!d.length)return{kind:"none",kept:await x()};let e=c?.trim(),f=e?d.find(a=>a.account===e):1===d.length?d[0]:void 0;if(!f)return{kind:"pick",site:d[0].site,accounts:d.map(a=>a.account)};if(!f.bots.includes(b))return f.asking.includes(b)||await u({...f,asking:[...f.asking,b]}),{kind:"ask",signIn:(({state:a,...b})=>b)(f)};let g={...f,usedAt:new Date().toISOString()};return await u(g),{kind:"state",signIn:(({state:a,...b})=>b)(g),state:f.state}})},"carryHold",0,L,"forgetBrowser",0,function(a){F.delete(a.PLAYWRIGHT_CLI_SESSION??"")},"holdSignIn",0,K,"inBrowser",0,E,"keepSignIn",0,function(a){return w(async()=>{let b=await z(a.site),c=b[0]?.site??k(a.site),d=a.account.trim()||c,e=b.map(a=>a.account),f=b.find(a=>a.account===d);if(f&&a.another)return{kind:"clash",site:c,accounts:e};if(f&&!f.bots.includes(a.bot)){let b=f.asking.includes(a.bot)?f:{...f,asking:[...f.asking,a.bot]};return b!==f&&await u(b),{kind:"taken",signIn:(({state:a,...b})=>b)(b)}}if(!f&&b.length&&!a.another)return{kind:"unlisted",site:c,accounts:e};let g={site:c,account:d,bots:[...new Set([...f?.bots??[],a.bot])],asking:(f?.asking??[]).filter(b=>b!==a.bot),keptAt:new Date().toISOString(),usedAt:f?.usedAt??null,state:a.state};return await u(g),{kind:"kept",signIn:(({state:a,...b})=>b)(g),replaced:!!f}})},"releaseSignIn",0,function(a,b){let c=F.get(a.PLAYWRIGHT_CLI_SESSION??"");if(!c)return;let d=k(b);for(let a of[...c.sites.keys()])(a===d||d.endsWith(`.${a}`)||a.endsWith(`.${d}`))&&c.sites.delete(a)},"removeSignIn",0,function(a,b){return w(async()=>{await (0,c.rm)(n(a,b),{force:!0}),await t(a,b),q()})},"renewHeld",0,N,"renewSignIns",0,O,"sessionBrowser",0,B,"sessionWindow",0,C,"setSignInBot",0,function(a,b,c,d){return w(async()=>{let e=await s(a,b);e&&await u({...e,bots:d?[...new Set([...e.bots,c])]:e.bots.filter(a=>a!==c),asking:e.asking.filter(a=>a!==c)})})}],487591)},138100,a=>a.a(async(b,c)=>{try{var d=a.i(666680),e=a.i(750227),f=a.i(569572),g=a.i(821415),h=a.i(176668),i=a.i(182248),j=a.i(762805),k=b([j]);[j]=k.then?(await k)():k;let m=(0,e.join)(f.APP_DIR,f.PATHS.skills.default),n=(0,e.join)(f.APP_DIR,f.PATHS.skills.seeds),o=(0,e.join)(f.DATA_DIR,f.PATHS.skills.custom),p=async(a,b)=>{let c,d=b?(c=b.trim().toLowerCase(),/^[a-z0-9][a-z0-9_-]*$/.test(c)?(0,e.join)(n,c):null):null;return l(a,b?[m,...d?[d]:[],(0,e.join)(g.WORKSPACE,(0,g.botFolder)(b),f.PATHS.skills.own),o]:[m,o],await (0,j.readSkillsOff)(),await (0,j.readRetired)())};async function l(a,b,c=new Set,e=new Map){let f=[],g=new Set;for(let k of b){let b;try{b=await a.readdir(k,{withFileTypes:!0})}catch{continue}for(let l of b){let b,m;if(!l.isDirectory())continue;let n=`${k}/${l.name}`,o=`${n}/SKILL.md`;try{b=await a.readFile(o,"utf-8")}catch{continue}try{m=(0,j.parseFrontmatter)(b)}catch(a){h.logger.warn(`skill ${n}: SKILL.md front matter did not load — ${(0,i.errorToString)(a)}`);continue}if(!(0,j.runsHere)(m))continue;let p=e.get(m.name);!(p?.has((0,d.createHash)("sha256").update(b,"utf8").digest("hex"))||g.has(m.name))&&(g.add(m.name),(0,j.isSkillOff)(m,c)||f.push({name:m.name,description:m.description,path:n}))}}return f}a.s(["loadSkills",0,p]),c()}catch(a){c(a)}},!1),762805,a=>a.a(async(b,c)=>{try{let C;var d=a.i(666680),e=a.i(912714),f=a.i(750227),g=a.i(622650),h=a.i(569572),i=a.i(221214),j=a.i(725466),k=a.i(951941),l=a.i(821415),m=a.i(176668),n=a.i(293480),o=a.i(182248),p=b([i,j]);function q(a){if("default"===a)return(0,f.resolve)(h.APP_DIR,h.PATHS.skills.default);if("custom"===a)return(0,f.resolve)(h.DATA_DIR,h.PATHS.skills.custom);let b=(0,k.botOfSource)(a)??"";return a.startsWith("kit:")?(0,f.resolve)(h.APP_DIR,h.PATHS.skills.seeds,b.toLowerCase()):(0,f.resolve)(l.WORKSPACE,h.PATHS.bots,b,h.PATHS.skills.own)}function r(a,b){let c=q(a),d=(0,f.resolve)(c,b),e=(0,f.relative)(c,d);return(!e||e.startsWith("..")||e.includes(f.sep)||"."===e)&&(0,n.publicError)("Skill not found"),d}function s(a,b){let c=(0,f.resolve)(a,b),d=(0,f.relative)(a,c);return(d.startsWith("..")||(0,f.isAbsolute)(d))&&(0,n.publicError)("File not found"),c}async function t(a,b){let[c,d]=await Promise.all([(0,e.realpath)(a),(0,e.realpath)(b)]).catch(()=>(0,n.publicError)("File not found")),g=(0,f.relative)(c,d);return(g.startsWith("..")||(0,f.isAbsolute)(g))&&(0,n.publicError)("File not found"),d}function u(a){let b=a.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!b)return{head:null,body:a.trim(),rest:a,fence:""};let c=a.slice(b[0].length);return{head:b[1]??null,body:c.trim(),rest:c,fence:b[0]}}async function v(){try{return(0,k.parseSkillsOff)(await (0,j.readConfig)(k.SKILLS_OFF_KEY))}catch(a){return m.logger.warn(`skills switched off could not be read — ${(0,o.errorToString)(a)}`),new Set}}function w(a){let b,{head:c}=u(a);c||(0,n.publicError)("SKILL.md needs a YAML block with name and description");try{b=(0,g.parse)(c)}catch{(0,n.publicError)("SKILL.md frontmatter is not valid YAML")}let d=k.SkillFrontmatterSchema.safeParse(b);return d.success||(0,n.publicError)(`SKILL.md frontmatter: ${d.error.issues[0]?.message??"invalid"}`),d.data}[i,j]=p.then?(await p)():p;let D=/^disabled[ \t]*:[^\n]*(\r?\n|$)/m;async function x(a,b,c){let d,g=(0,f.join)(r(a,b),"SKILL.md");try{d=await (0,e.readFile)(g,"utf-8")}catch{(0,n.publicError)("Skill not found")}let{name:h}=w(d),i=(0,k.parseSkillsOff)(await (0,j.readConfig)(k.SKILLS_OFF_KEY));if(c?i.add(h.toLowerCase()):i.delete(h.toLowerCase()),await (0,j.writeConfig)(k.SKILLS_OFF_KEY,JSON.stringify([...i].sort())),c||"custom"!==a)return;let{head:l,rest:m,fence:o}=u(d);if(!l||!D.test(l))return;let p=o.includes("\r\n")?"\r\n":"\n",q=l.replace(D,"").replace(/\s+$/,"");await (0,e.writeFile)(g,`---${p}${q}${p}---${p}${m}`)}async function y(a,b,c){try{let g,h=await (0,e.readFile)((0,f.join)(q(a),b,"SKILL.md"),"utf-8"),i=w(h);if(a.startsWith("own:")&&(g=i.name,c.get(g)?.has((0,d.createHash)("sha256").update(h,"utf8").digest("hex"))))return null;return{...i,source:a,dir:b}}catch{return null}}async function z(a,b){let c=r("custom",a),d=async a=>(0,e.stat)(a).then(()=>!0,()=>!1);await d(c)&&(0,n.publicError)(`A skill named "${a}" already exists`),await d(r("default",a))&&(0,n.publicError)(`"${a}" is a built-in skill — pick another name`),await (0,e.mkdir)(c,{recursive:!0});try{for(let[a,d]of b){let b=s(c,a);await (0,e.mkdir)((0,f.resolve)(b,".."),{recursive:!0}),await (0,e.writeFile)(b,d)}}catch(a){throw await (0,e.rm)(c,{recursive:!0,force:!0}),a}let g=await y("custom",a,new Map);return g||(await (0,e.rm)(c,{recursive:!0,force:!0}),(0,n.publicError)("SKILL.md could not be read back")),g}async function A(a,b,c,d){(0,k.isEditableSource)(a)||(0,n.publicError)("A skill that ships with the app is read-only");let f=r(a,b),g=await t(f,s(f,c)),i=await (0,e.stat)(g).catch(()=>null);i?.isFile()||(0,n.publicError)("File not found"),Buffer.byteLength(d)>h.SKILL_FILES.inlineBytes&&(0,n.publicError)("That is larger than this screen can write back"),"SKILL.md"===c&&w(d),await (0,e.writeFile)(g,d,"utf-8")}async function B(a,b){(0,k.isEditableSource)(a)||(0,n.publicError)("A skill that ships with the app can only be switched off");let c=r(a,b);await (0,e.stat)(c).then(()=>!0,()=>!1)||(0,n.publicError)("Skill not found"),await (0,e.rm)(c,{recursive:!0,force:!0})}a.s(["deleteSkill",0,B,"isSkillOff",0,(a,b)=>!0===a.disabled||b.has(a.name.toLowerCase()),"parseFrontmatter",0,w,"readRetired",0,()=>C??=(0,e.readFile)((0,f.join)(h.APP_DIR,h.PATHS.skills.seeds,"retired.json"),"utf8").then(a=>{let{sha256:b}=JSON.parse(a);return new Map(Object.entries(b).map(([a,b])=>[a,new Set(b)]))}).catch(()=>new Map),"readSkillsOff",0,v,"renderSkillMarkdown",0,function(a,b){return`---
147
149
  ${(0,g.stringify)(a).trim()}
148
150
  ---
149
151
 
@@ -32,6 +32,6 @@ module.exports=[654816,a=>{"use strict";var b=a.i(187924);a.s([],965156),a.i(965
32
32
 
33
33
  **Ground every claim.** Competitors, prices, search terms and what people say about the problem come from pages you opened, with the link beside them. What you could not check is marked as a guess.
34
34
 
35
- **What you keep.** One brief per product — what it is, for whom, against what, in which voice — dated, and every later job starts from it.`}];a.s(["BOT_SEEDS",0,g,"ERRANDS_BOT",0,f,"findBotSeed",0,a=>g.find(b=>b.name===a)??null])},224303,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f16a0729d72b216d7ee634b3d1407a6b1df13d3d1",b.callServer,void 0,b.findSourceMapURL,"createSeedBotsAction");a.s(["createSeedBotsAction",0,c])}];
35
+ **What you keep.** One brief per product — what it is, for whom, against what, in which voice — dated, and every later job starts from it.`}];a.s(["BOT_SEEDS",0,g,"ERRANDS_BOT",0,f,"findBotSeed",0,a=>g.find(b=>b.name===a)??null])},10828,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7fecf5743ccfdc43606b45739542384212051fd6a6",b.callServer,void 0,b.findSourceMapURL,"createSeedBotsAction");a.s(["createSeedBotsAction",0,c])}];
36
36
 
37
- //# sourceMappingURL=_02ybodf._.js.map
37
+ //# sourceMappingURL=_14nwim3._.js.map