thursday-agent 0.17.1 → 0.17.2
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.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +2 -0
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +12 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/artifact/route.js +9 -8
- package/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/route.js +8 -7
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/route.js +8 -7
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/[id]/route.js +4 -4
- package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/route.js +3 -3
- package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/events/route.js.nft.json +1 -1
- package/.next/server/app/api/favicon/[host]/route.js +4 -3
- package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
- package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/automatic/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/llm-model/automatic/route/build-manifest.json +12 -0
- package/.next/server/app/api/llm-model/automatic/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/llm-model/automatic/route.js +17 -0
- package/.next/server/app/api/llm-model/automatic/route.js.map +5 -0
- package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -0
- package/.next/server/app/api/llm-model/automatic/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/edit/route.js +14 -13
- package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/reach/route.js +17 -16
- package/.next/server/app/api/reach/route.js.nft.json +1 -1
- package/.next/server/app/api/routine/route.js +10 -10
- package/.next/server/app/api/routine/route.js.nft.json +1 -1
- package/.next/server/app/api/signins/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js +9 -8
- package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +9 -8
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/end/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/thursday/call/end/route/build-manifest.json +12 -0
- package/.next/server/app/api/thursday/call/end/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/thursday/call/end/route.js +17 -0
- package/.next/server/app/api/thursday/call/end/route.js.map +5 -0
- package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -0
- package/.next/server/app/api/thursday/call/end/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/thursday/call/route.js +6 -6
- package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/settings/route.js +5 -5
- package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/text/route.js +16 -15
- package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/tool-call/route.js +13 -12
- package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/files/route.js +5 -5
- package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/route.js +5 -5
- package/.next/server/app/api/workspace/route.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +3 -3
- package/.next/server/app/artifact/[...path]/page.js +2 -2
- package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next/server/app/page/server-reference-manifest.json +60 -60
- package/.next/server/app/page.js +8 -8
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +2 -0
- package/.next/server/chunks/{[externals]__178rv3v._.js → [externals]__12stas-._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__00qyw01._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1ignh6-._.js → [root-of-the-server]__01k3vi3._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__01ypm_z._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__021dkui._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__03vunn6._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__03xamry._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__05dp5tr._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__208vmyf._.js → [root-of-the-server]__061o2_x._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__09gdscj._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0bqveex._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0eivkvk._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0f7m79q._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0g38-aj._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0h656y-._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0hkxwim._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0hm3tiq._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0hzdqnv._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0liwkmx._.js +4 -4
- package/.next/server/chunks/[root-of-the-server]__0ljizgj._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0mgyt8p._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0nmust6._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0p80i1n._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0qzho69._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sm5xvm._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0svzjwa._.js +3 -3
- package/.next/server/chunks/{[root-of-the-server]__0b36yfw._.js → [root-of-the-server]__0ts7ai0._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1-18_pz._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1-rmal0._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1_h4hf9._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__1ceammd._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1ckt1yj._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1cu5f3z._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1hviq62._.js +5 -0
- package/.next/server/chunks/{[root-of-the-server]__12m24xl._.js → [root-of-the-server]__1k2qs1m._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1kmnkbk._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1p47fbb._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1pugoq0._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1t02-1p._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1t0jj1j._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1vlxv19._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1zn039k._.js +1 -1
- package/.next/server/chunks/_05gl-xy._.js +5 -5
- package/.next/server/chunks/_06hnfi8._.js +8 -0
- package/.next/server/chunks/_06u9yo-._.js +1 -1
- package/.next/server/chunks/_07nxi75._.js +50 -46
- package/.next/server/chunks/_08354bn._.js +22 -18
- package/.next/server/chunks/_08btiir._.js +3 -3
- package/.next/server/chunks/_0c49lmw._.js +5 -0
- package/.next/server/chunks/_0ey0s6v._.js +3 -0
- package/.next/server/chunks/_0hgvg55._.js +5 -0
- package/.next/server/chunks/_0j0-gq6._.js +2 -2
- package/.next/server/chunks/_0nn99o2._.js +1 -1
- package/.next/server/chunks/_0p6v1fr._.js +2 -2
- package/.next/server/chunks/_0s8ao8z._.js +3 -0
- package/.next/server/chunks/_0srlnvd._.js +1 -1
- package/.next/server/chunks/_0t_7gji._.js +1 -1
- package/.next/server/chunks/_0ucx1jv._.js +3 -0
- package/.next/server/chunks/_0uzj57i._.js +1 -1
- package/.next/server/chunks/_0xygcxs._.js +50 -46
- package/.next/server/chunks/_1-sk_q4._.js +1 -1
- package/.next/server/chunks/{_1xcnogc._.js → _108gsm8._.js} +4 -4
- package/.next/server/chunks/{_20oecmn._.js → _15negpy._.js} +4 -4
- package/.next/server/chunks/_19fh9t2._.js +3 -0
- package/.next/server/chunks/_19kea1l._.js +18 -18
- package/.next/server/chunks/_1dtm9bs._.js +1 -1
- package/.next/server/chunks/_1dxq827._.js +2 -2
- package/.next/server/chunks/_1e54wxa._.js +1 -1
- package/.next/server/chunks/_1frcwj1._.js +3 -0
- package/.next/server/chunks/_1gn2r2q._.js +5 -5
- package/.next/server/chunks/_1gxankq._.js +2 -2
- package/.next/server/chunks/_1i3uucm._.js +5 -0
- package/.next/server/chunks/_1m88lkh._.js +9 -9
- package/.next/server/chunks/_1mx9sfo._.js +1 -1
- package/.next/server/chunks/_1q6e56i._.js +5 -5
- package/.next/server/chunks/_1qxheoa._.js +1 -1
- package/.next/server/chunks/_1t5ijzv._.js +3 -0
- package/.next/server/chunks/_1wwl_7o._.js +1 -1
- package/.next/server/chunks/_1zfxb7j._.js +1 -1
- package/.next/server/chunks/_211dn2c._.js +1 -1
- package/.next/server/chunks/_next-internal_server_app_api_llm-model_automatic_route_actions_1-eyan7.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_thursday_call_end_route_actions_0u5xjft.js +3 -0
- package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
- package/.next/server/chunks/{features_0wm-ujw._.js → features_bot_08z387_._.js} +4 -4
- package/.next/server/chunks/{ssr/[root-of-the-server]__07660xu._.js → features_bot_0zy_q8y._.js} +7 -8
- package/.next/server/chunks/features_bot_1dfrdsb._.js +37 -0
- package/.next/server/chunks/features_workspace_workspace_ts_13h82gv._.js +3 -3
- package/.next/server/chunks/features_workspace_workspace_ts_1iyjroj._.js +3 -3
- package/.next/server/chunks/node_modules_103lpef._.js +3 -0
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0_nz09c._.js → node_modules_consola_dist_chunks_prompt_mjs_0-t5tbs._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_1341cnf._.js → node_modules_consola_dist_chunks_prompt_mjs_039fwo9._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_1x3bsmx._.js → node_modules_consola_dist_chunks_prompt_mjs_0pce1b3._.js} +1 -1
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0tvy5lq._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0wxw35t._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1dlthym._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1smfi4-._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1x1omfi._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_20is7e3._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0g__u45._.js → [root-of-the-server]__0-af_o7._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__09f39cp._.js +4 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0ouu4qp._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0q9g9ea._.js +5 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__17h1ggo._.js +11 -9
- package/.next/server/chunks/ssr/[root-of-the-server]__1jyeu61._.js +1 -1
- package/.next/server/chunks/ssr/_01al00i._.js +3 -0
- package/.next/server/chunks/ssr/_088vzgn._.js +1 -1
- package/.next/server/chunks/ssr/_0afrpci._.js +1 -1
- package/.next/server/chunks/ssr/_0bgse1c._.js +162 -0
- package/.next/server/chunks/ssr/_0cd6g3l._.js +15 -15
- package/.next/server/chunks/ssr/_0cv9tmv._.js +1 -1
- package/.next/server/chunks/ssr/{_1hn3szq._.js → _0e2fnvg._.js} +2 -2
- package/.next/server/chunks/ssr/_0fo4552._.js +21 -17
- package/.next/server/chunks/ssr/_0jstvlg._.js +39 -0
- package/.next/server/chunks/ssr/{_0r0g9ki._.js → _0l7rjg5._.js} +2 -2
- package/.next/server/chunks/ssr/_0qsmpcu._.js +1 -1
- package/.next/server/chunks/ssr/_0v9r8g2._.js +1 -1
- package/.next/server/chunks/ssr/{_113ukfo._.js → _0vo_oym._.js} +3 -3
- package/.next/server/chunks/ssr/_0x8ophf._.js +1 -1
- package/.next/server/chunks/ssr/{_03akcjz._.js → _0xfafez._.js} +2 -2
- package/.next/server/chunks/ssr/_0z38nha._.js +1 -1
- package/.next/server/chunks/ssr/_10-_awu._.js +1 -1
- package/.next/server/chunks/ssr/{_20ywznt._.js → _10_ph1t._.js} +2 -2
- package/.next/server/chunks/ssr/{_06xy39t._.js → _116lfdc._.js} +2 -2
- package/.next/server/chunks/ssr/_14dfh7a._.js +1 -1
- package/.next/server/chunks/ssr/_14oirtb._.js +3 -0
- package/.next/server/chunks/ssr/{_1umbr78._.js → _163dr78._.js} +2 -2
- package/.next/server/chunks/ssr/{_1swhm5m._.js → _17a4qyk._.js} +3 -3
- package/.next/server/chunks/ssr/{_00g5sq-._.js → _1_5xof_._.js} +2 -2
- package/.next/server/chunks/ssr/{_0sefgiu._.js → _1aqjk-1._.js} +2 -2
- package/.next/server/chunks/ssr/_1dfv66y._.js +3 -0
- package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
- package/.next/server/chunks/ssr/_1ou5sj0._.js +1 -1
- package/.next/server/chunks/ssr/{_1_gwau0._.js → _1tmw842._.js} +2 -2
- package/.next/server/chunks/ssr/_1uij_rj._.js +1 -1
- package/.next/server/chunks/ssr/_1w9w1ok._.js +1 -1
- package/.next/server/chunks/ssr/features_0796o8r._.js +1 -1
- package/.next/server/chunks/ssr/features_bot_0ouemw8._.js +3 -0
- package/.next/server/chunks/ssr/{features_133mpna._.js → features_bot_0tb4ui-._.js} +2 -2
- package/.next/server/chunks/ssr/features_config_09n-q9q._.js +20 -0
- package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
- package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
- package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
- package/.next/server/chunks/ssr/features_workspace_workspace_ts_1wc7_u_._.js +4 -4
- package/.next/server/chunks/ssr/{node_modules_0kg-vd-._.js → node_modules_021lid9._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_17azpeb._.js → node_modules_04x5wyv._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0pyepmf._.js → node_modules_096up6a._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_00kqq8n._.js → node_modules_0__0tvm._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1mcsva4._.js → node_modules_0cjnmzp._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1_il5l7._.js → node_modules_0d6j33x._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_07w6r9n._.js → node_modules_0gd9hbz._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1aeg65a._.js → node_modules_0k8-y89._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0g0lr19._.js → node_modules_0m73b88._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_04o9dd2._.js → node_modules_0msrhxf._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_05jatne._.js → node_modules_0nmkv-v._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0p0xf5f._.js → node_modules_0nw5jz7._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_08ld3lm._.js → node_modules_0q-klni._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_13seln7._.js → node_modules_10_fv2a._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1iq8zjs._.js → node_modules_113l3e5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1va4lz9._.js → node_modules_13bqv6i._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0ft86sp._.js → node_modules_13g-d25._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_15vsfpv._.js → node_modules_156kv_t._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1d73q89._.js → node_modules_1_8-jcj._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0nl9i29._.js → node_modules_1gq3ght._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_06rkzq5._.js → node_modules_1k5i-_9._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0vg-4fo._.js → node_modules_1lmyts8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_207ay1p._.js → node_modules_1p_6sq7._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1mhg5br._.js → node_modules_1qstb1x._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1mqisle._.js → node_modules_1ri_eip._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0y5upun._.js → node_modules_1xb-ndg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0hefprb._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0amkw0b._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1uuvrfp._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0zq3l45._.js} +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/middleware.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +61 -61
- package/.next/static/chunks/{32oho7re_n3dq.js → 01l7kw74vfp32.js} +1 -1
- package/.next/static/chunks/0a5_-jqhaktjj.js +1 -0
- package/.next/static/chunks/{1-q6so9vze75d.js → 0obogzscwwekj.js} +2 -2
- package/.next/static/chunks/{44n-w1bs83ejz.js → 0p2f6uv4xytfm.js} +1 -1
- package/.next/static/chunks/{2y2v3bk65fdle.js → 0uxq_vs6uxi-b.js} +3 -3
- package/.next/static/chunks/{25ciqm-ee14nf.js → 166smhw8v-s3j.js} +1 -1
- package/.next/static/chunks/{1_me_-lnpwdfd.js → 1bnhw-5fj7aiz.js} +1 -1
- package/.next/static/chunks/1cglo3a2mbeou.js +1 -0
- package/.next/static/chunks/{3suz18umxycuk.js → 1in6nxpu33iab.js} +1 -1
- package/.next/static/chunks/1u7kg91f9qy3g.js +1 -0
- package/.next/static/chunks/{1njjf8bfkg4_v.js → 1xv4g10m-cl1s.js} +1 -1
- package/.next/static/chunks/{2rpyc6mevfhu6.js → 2ajs12-fcdwzm.js} +1 -1
- package/.next/static/chunks/2i7qtmxc1kuqg.js +1 -0
- package/.next/static/chunks/{106jbz6qd0c5l.js → 2kz1f6r59nky0.js} +1 -1
- package/.next/static/chunks/2qgkbdshzpq1c.js +1 -0
- package/.next/static/chunks/2zbl41hed17g3.js +18 -0
- package/.next/static/chunks/35jj-5u4te56r.js +1 -0
- package/.next/static/chunks/37ixzapa06xlo.js +1 -0
- package/.next/static/chunks/3b96xy59nl_gd.js +1 -0
- package/.next/static/chunks/{09opsnra7k4k0.js → 3gsxnqqqphh-1.js} +2 -2
- package/.next/static/chunks/{1mkw_05uc8_ft.js → 3jtcieuk1l6tw.js} +1 -1
- package/.next/static/chunks/{05scfrgo_a_5_.js → 3k1d8y03t5nax.js} +1 -1
- package/.next/static/chunks/3sla-dm1puqd1.js +35 -0
- package/.next/static/chunks/3t2c76awm9k_p.js +1 -0
- package/.next/static/chunks/3vrmcm31ih7gb.js +1 -0
- package/.next/static/chunks/3yiqr95d7ybeq.js +15 -0
- package/bin/autostart.mjs +4 -1
- package/bin/database.mjs +26 -4
- package/bin/lock.mjs +59 -0
- package/bin/node-check.mjs +21 -0
- package/bin/thursday.mjs +8 -1
- package/guide/bots.md +4 -2
- package/guide/calls.md +11 -9
- package/guide/memory.md +3 -2
- package/guide/phone.md +7 -4
- package/guide/setup.md +26 -9
- package/guide/trouble.md +11 -4
- package/package.json +1 -1
- package/public/voices/intro/asleepBare-15199d56.ogg +0 -0
- package/public/voices/intro/style-88adf274.ogg +0 -0
- package/seed-skills/concierge/travel/scripts/itinerary.mjs +6 -4
- package/skills/browser/SKILL.md +9 -6
- package/.next/server/chunks/[root-of-the-server]__03b09q0._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__05n-hql._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0j_nz36._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0jzwdg-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0tsded0._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__12tahb4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1de1o6m._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1yl5l25._.js +0 -3
- package/.next/server/chunks/_02lipqs._.js +0 -5
- package/.next/server/chunks/_05sa7xl._.js +0 -3
- package/.next/server/chunks/_074f2ts._.js +0 -3
- package/.next/server/chunks/_0caua_s._.js +0 -3
- package/.next/server/chunks/_0p-h6xe._.js +0 -5
- package/.next/server/chunks/_0up2a9o._.js +0 -3
- package/.next/server/chunks/_17i1lt2._.js +0 -3
- package/.next/server/chunks/_1hy9x9_._.js +0 -3
- package/.next/server/chunks/_1hyvcgk._.js +0 -5
- package/.next/server/chunks/_1wl2g8_._.js +0 -6
- package/.next/server/chunks/_1y3mnz4._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__07iyl1_._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__10eb-1x._.js +0 -3
- package/.next/server/chunks/ssr/_0-i6wdi._.js +0 -3
- package/.next/server/chunks/ssr/_0rvbegp._.js +0 -7
- package/.next/server/chunks/ssr/_12p8f9_._.js +0 -3
- package/.next/server/chunks/ssr/_1o7a11b._.js +0 -162
- package/.next/server/chunks/ssr/_1wac78_._.js +0 -3
- package/.next/server/chunks/ssr/features_bot_0j4h9qu._.js +0 -3
- package/.next/server/chunks/ssr/features_config_1xrlh3l._.js +0 -20
- package/.next/static/chunks/04toe_3nqfjqt.js +0 -1
- package/.next/static/chunks/0780wmy0_rva8.js +0 -1
- package/.next/static/chunks/0if7xqoj3ysfj.js +0 -1
- package/.next/static/chunks/0mtfu8adz57qz.js +0 -1
- package/.next/static/chunks/19wkcgzetkh6-.js +0 -1
- package/.next/static/chunks/29laj9_xhx0d1.js +0 -18
- package/.next/static/chunks/2b306ek_blfp1.js +0 -1
- package/.next/static/chunks/2mpqmpf8wcst1.js +0 -15
- package/.next/static/chunks/2wj77vx62ng3n.js +0 -1
- package/.next/static/chunks/388l-zszwa_jf.js +0 -1
- package/.next/static/chunks/3_s5svfgu9kl_.js +0 -35
- package/.next/static/chunks/3bwrvpjk95_x4.js +0 -1
- package/.next/static/chunks/3kj0pri2oc1g1.js +0 -1
- package/public/voices/intro/style-cb6fa4f7.ogg +0 -0
- /package/.next/static/{SNCDmWKeIrXB6yqnwzClS → 8I2hKtciyA9LXvd8txuOz}/_buildManifest.js +0 -0
- /package/.next/static/{SNCDmWKeIrXB6yqnwzClS → 8I2hKtciyA9LXvd8txuOz}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{SNCDmWKeIrXB6yqnwzClS → 8I2hKtciyA9LXvd8txuOz}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
module.exports=[175936,e=>{"use strict";let t=e=>e.split("/").map(encodeURIComponent).join("/");e.s(["decodePath",0,e=>e.join("/"),"queryKey",0,{memory:"/api/memory",memoryPage:e=>({url:"/api/memory",query:{offset:e||null}}),mcp:"/api/mcp",mcpServer:e=>({url:"/api/mcp",pathVariable:[e]}),mcpTools:"/api/mcp/tools",skills:"/api/skills",skillNode:(e,t,a)=>({url:"/api/skills",pathVariable:[e,t],query:{path:a}}),bot:"/api/bot",botMemory:"/api/bot/memory",botMemoryFiles:e=>({url:"/api/bot/memory/files",query:{bot:e}}),routines:"/api/routine",threads:"/api/bot/thread",threadHistory:e=>({url:"/api/bot/thread",query:{history:1,before:e}}),thread:e=>({url:"/api/bot/thread",query:{id:e}}),toolResult:(e,t)=>({url:"/api/bot/thread",pathVariable:[e],query:{call:t}}),workspace:"/api/workspace",workspaceFolder:(e,t)=>({url:"/api/workspace",query:{path:e||null,rows:t}}),workspaceFiles:e=>({url:"/api/workspace/files",query:{paths:JSON.stringify(e)}}),artifacts:"/api/artifact",artifactShelf:e=>({url:"/api/artifact",query:{rows:e}}),artifactSet:(e,t)=>({url:"/api/artifact",query:{set:e,rows:t}}),file:e=>`/api/file/${t(e)}`,fileFace:e=>`/api/file/${t(e)}?face`,favicon:e=>`/api/favicon/${encodeURIComponent(e)}`,fileView:e=>`/artifact/${t(e)}`,events:"/api/events",config:"/api/config",callHistory:e=>({url:"/api/thursday/call",query:{before:e}}),thursdaySettings:"/api/thursday/settings",toolCall:"/api/thursday/tool-call",callEnd:"/api/thursday/call/end",signIns:"/api/signins",reach:"/api/reach",textCall:"/api/thursday/text",memoryEdit:"/api/memory/edit",llmModel:"/api/llm-model",automaticModel:"/api/llm-model/automatic",modelCatalog:"/api/llm-model/catalog",gatewayCredits:"/api/llm-model/credits",subscriptionUsage:"/api/llm-model/subscription"}])},393189,e=>{"use strict";var t=e.i(912714),a=e.i(750227),i=e.i(687388),n=e.i(786025);let r=e=>`${(0,n.botFolder)(e)}/memory`;async function o(e,t=i.BOT_MEMORY_LIMITS.files){let s=r(e),m=(0,a.join)(n.WORKSPACE,s),c=(await l(m)).sort((e,t)=>t.info.mtimeMs-e.info.mtimeMs),d=await Promise.all(c.slice(0,t).map(async({name:e,info:t})=>({file:e,path:`${s}/${e}`,line:await u((0,a.join)(m,e)),at:new Date(t.mtimeMs),bytes:t.size})));return{folder:s,entries:d,total:c.length}}async function l(e){let i=await (0,t.readdir)(e).catch(()=>[]);return(await Promise.all(i.filter(e=>!e.startsWith(".")).map(async i=>{let n=await (0,t.stat)((0,a.join)(e,i)).catch(()=>null);return n?.isFile()?{name:i,info:n}:null}))).filter(e=>null!==e)}async function s(e){let o=(0,a.join)(n.WORKSPACE,r(e)),s=new Map;return await Promise.all((await l(o)).map(async({name:e,info:n})=>{let r=n.size>4*i.BOT_MEMORY_LIMITS.chars?null:await (0,t.readFile)((0,a.join)(o,e),"utf8").catch(()=>null);s.set(e,{text:null!==r&&c(r)<=i.BOT_MEMORY_LIMITS.chars?r:null,size:n.size,mtimeMs:n.mtimeMs,atime:n.atime,mtime:n.mtime})})),s}async function m(e,o){let s=r(e),m=(0,a.join)(n.WORKSPACE,s),{files:u,chars:d}=i.BOT_MEMORY_LIMITS,p=[],f=[],b=0;for(let{name:e,info:i}of(await l(m))){b+=1;let n=o.get(e);if(n&&n.size===i.size&&n.mtimeMs===i.mtimeMs)continue;let r=(0,a.join)(m,e),l=c(await (0,t.readFile)(r,"utf8").catch(()=>""));if(l<=d){n||f.push(e);continue}let u=`${l.toLocaleString("en-US")} characters, past the ${d.toLocaleString("en-US")} a memory file holds`;n?null!==n.text?(await (0,t.writeFile)(r,n.text),await (0,t.utimes)(r,n.atime,n.mtime),p.push(`Not kept: \`${s}/${e}\` came to ${u}, so it is back as it was. Write it again shorter.`)):p.push(`\`${s}/${e}\` is ${u}. Shorten it.`):(await (0,t.rm)(r,{force:!0}),b-=1,p.push(`Not kept: \`${s}/${e}\` came to ${u}, so it was removed. Write it again shorter.`))}if(b>u&&f.length){await Promise.all(f.map(e=>(0,t.rm)((0,a.join)(m,e),{force:!0})));let e=f.map(e=>`\`${s}/${e}\``).join(", ");p.push(`Not kept: your memory holds ${u} files at most and this made ${b}, so ${e} ${1===f.length?"was":"were"} removed. Delete or merge files no longer worth keeping, then write it again.`)}return p.length?p.join("\n"):null}let c=e=>[...e.trim()].length;async function u(e){let a=await (0,t.open)(e,"r").catch(()=>null);if(!a)return"";try{let e=Buffer.alloc(1024),{bytesRead:t}=await a.read(e,0,1024,0),i=e.toString("utf8",0,t).split("\n").map(e=>e.trim()).filter(Boolean);if("---"===i[0]){let e=i.find(e=>e.startsWith("description:"));if(e)return e.slice(12).trim().replace(/^["']|["']$/g,"");let t=i.indexOf("---",1);return t>0?(i[t+1]??"").replace(/^#+\s*/,""):""}return(i[0]??"").replace(/^#+\s*/,"")}finally{await a.close()}}e.s(["botMemoryFolder",0,r,"holdBotMemory",0,s,"keepBotMemory",0,m,"listBotMemory",0,o])},148831,e=>e.a(async(t,a)=>{try{var i=e.i(875225),n=e.i(260338),r=e.i(518899),o=e.i(380690),l=e.i(528790),s=e.i(613240),m=e.i(441963),c=t([l]);function u(e){return(0,m.isRemoteConfig)(e)?{url:e.url}:{command:e.command,args:e.args}}async function d(){return(await l.database.select({name:s.mcpServerTable.name,config:s.mcpServerTable.config,lastError:s.mcpServerTable.lastError,toolCount:(0,n.count)(s.mcpToolTable.id)}).from(s.mcpServerTable).leftJoin(s.mcpToolTable,(0,i.eq)(s.mcpToolTable.serverName,s.mcpServerTable.name)).groupBy(s.mcpServerTable.name)).map(e=>({...e,config:u(e.config)}))}async function p(e){let[t]=await l.database.select({name:s.mcpServerTable.name,config:s.mcpServerTable.config,lastError:s.mcpServerTable.lastError,toolsSyncedAt:s.mcpServerTable.toolsSyncedAt}).from(s.mcpServerTable).where((0,i.eq)(s.mcpServerTable.name,e));return t?{...t,config:u(t.config),tools:await f(e)}:null}async function f(e){return l.database.select({id:s.mcpToolTable.id,name:s.mcpToolTable.name,description:s.mcpToolTable.description,inputSchema:s.mcpToolTable.inputSchema,outputSchema:s.mcpToolTable.outputSchema}).from(s.mcpToolTable).where((0,i.eq)(s.mcpToolTable.serverName,e)).orderBy(s.mcpToolTable.name)}async function b(e){let[t]=await l.database.select().from(s.mcpServerTable).where((0,i.eq)(s.mcpServerTable.name,e));return t??null}[l]=c.then?(await c)():c;let S=()=>o.appEvents.emit({type:"mcp"});async function h(e,t){await l.database.transaction(async a=>{t.length&&await a.insert(s.mcpToolTable).values(t.map(t=>({...t,serverName:e}))).onConflictDoUpdate({target:[s.mcpToolTable.serverName,s.mcpToolTable.name],set:{description:T(s.mcpToolTable.description),inputSchema:T(s.mcpToolTable.inputSchema),outputSchema:T(s.mcpToolTable.outputSchema)}}),await a.delete(s.mcpToolTable).where(t.length?(0,i.and)((0,i.eq)(s.mcpToolTable.serverName,e),(0,i.notInArray)(s.mcpToolTable.name,t.map(e=>e.name))):(0,i.eq)(s.mcpToolTable.serverName,e)),await a.update(s.mcpServerTable).set({lastError:null,toolsSyncedAt:new Date}).where((0,i.eq)(s.mcpServerTable.name,e))}),S()}function T(e){return r.sql.raw(`excluded."${e.name}"`)}async function w(e,t){await l.database.update(s.mcpServerTable).set({lastError:t}).where((0,i.eq)(s.mcpServerTable.name,e)),S()}async function g(e,t){await l.database.update(s.mcpServerTable).set({oauth:t}).where((0,i.eq)(s.mcpServerTable.name,e)),S()}async function y(e){let[t]=await l.database.select().from(s.mcpServerTable).where(r.sql`json_extract(${s.mcpServerTable.oauth}, '$.state') = ${e}`);return t??null}e.s(["findAllServers",0,d,"findAllTools",0,function(){return l.database.select({id:s.mcpToolTable.id,name:s.mcpToolTable.name,serverName:s.mcpToolTable.serverName,description:s.mcpToolTable.description}).from(s.mcpToolTable).orderBy(s.mcpToolTable.serverName,s.mcpToolTable.name)},"findPinnedTools",0,function(e){return l.database.select({server:s.mcpToolTable.serverName,name:s.mcpToolTable.name,description:s.mcpToolTable.description,inputSchema:s.mcpToolTable.inputSchema}).from(s.botMcpToolTable).innerJoin(s.mcpToolTable,(0,i.eq)(s.botMcpToolTable.toolId,s.mcpToolTable.id)).where((0,i.eq)(s.botMcpToolTable.botName,e)).orderBy(s.mcpToolTable.serverName,s.mcpToolTable.name)},"findServer",0,b,"findServerByOAuthState",0,y,"findServerDetail",0,p,"findToolSchemas",0,function(e,t){return t.length?l.database.select({name:s.mcpToolTable.name,description:s.mcpToolTable.description,inputSchema:s.mcpToolTable.inputSchema}).from(s.mcpToolTable).where((0,i.and)((0,i.eq)(s.mcpToolTable.serverName,e),(0,i.inArray)(s.mcpToolTable.name,t))).orderBy(s.mcpToolTable.name):Promise.resolve([])},"listServerNames",0,function(){return l.database.select({name:s.mcpServerTable.name}).from(s.mcpServerTable).orderBy(s.mcpServerTable.name)},"listToolNames",0,function(e){let t=l.database.select({server:s.mcpToolTable.serverName,name:s.mcpToolTable.name}).from(s.mcpToolTable);return e?t.where((0,i.eq)(s.mcpToolTable.serverName,e)).orderBy(s.mcpToolTable.name):t.orderBy(s.mcpToolTable.serverName,s.mcpToolTable.name)},"saveConnectionError",0,w,"saveOAuthData",0,g,"syncServerTools",0,h]),a()}catch(e){a(e)}},!1),441963,e=>{"use strict";var t=e.i(469719),a=e.i(704161);let i=t.z.object({url:t.z.url(),headers:t.z.record(t.z.string(),t.z.string()).optional()}),n=t.z.object({command:t.z.string().min(1),args:t.z.array(t.z.string()).optional(),env:t.z.record(t.z.string(),t.z.string()).optional()}),r=t.z.union([i,n]),o=t.z.object({name:t.z.string(),description:t.z.string().optional(),inputSchema:t.z.looseObject({}).optional(),outputSchema:t.z.looseObject({}).optional()});t.z.object({clientInformation:t.z.looseObject({}).optional(),tokens:t.z.looseObject({}).optional(),authorizationServer:t.z.looseObject({}).optional(),codeVerifier:t.z.string().optional(),state:t.z.string().optional()});let l=t.z.object({name:t.z.string().min(1).max(40),config:r,toolCount:t.z.number().int(),lastError:t.z.string().nullish()}),s=o.extend({id:t.z.number().int(),description:t.z.string().nullish()});l.omit({toolCount:!0}).extend({tools:s.array().default([]),toolsSyncedAt:a.DateLikeSchema}),t.z.object({name:t.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:r}),t.z.union([t.z.object({mcpServers:t.z.record(t.z.string(),r)}),t.z.record(t.z.string(),r)]),e.s(["isRemoteConfig",0,function(e){return"url"in e}])},963219,e=>e.a(async(t,a)=>{try{var i=e.i(260338),n=e.i(349129),r=e.i(875225),o=e.i(380690),l=e.i(687388),s=e.i(528790),m=e.i(613240),c=e.i(265143),u=e.i(53748),d=e.i(473139),p=t([s,c]);[s,c]=p.then?(await p)():p;let k=()=>o.appEvents.emit({type:"routines"});async function f(e,t){return s.database.select({id:m.threadTable.id,status:m.threadTable.status,outcome:m.threadTable.outcome,updatedAt:m.threadTable.updatedAt}).from(m.threadTable).where((0,r.eq)(m.threadTable.routineId,e)).orderBy((0,n.desc)(m.threadTable.createdAt)).limit(t)}let $=async e=>{let{createdAt:t,...a}=e;return{...a,runs:await f(e.id,l.ROUTINE.runsShown)}};async function b(){let e=await s.database.select().from(m.routineTable).orderBy(m.routineTable.createdAt);return Promise.all(e.map($))}async function h(e){let[t]=await s.database.select().from(m.routineTable).where((0,r.eq)(m.routineTable.id,e));return t?$(t):null}async function T(e){let t=await h(e.trim());if(t)return t;let a=e.trim().toLowerCase(),i=(await b()).filter(e=>e.label.toLowerCase()===a);return 1===i.length?i[0]:null}async function w(e){let t=await (0,c.findJobBot)(e);return(!t||t.disabled)&&(0,u.publicError)("Choose an enabled bot."),t.name}function g(e,t){t&&"once"===e.kind&&(0,d.momentOf)(e.at)<=new Date&&(0,u.publicError)("That time has passed. Pick a later one.")}async function y(e){let[{total:t}]=await s.database.select({total:(0,i.count)()}).from(m.routineTable);t>=l.ROUTINE.max&&(0,u.publicError)(`There are already ${l.ROUTINE.max} routines. Delete one to make another.`),g(e.schedule,!0);let[a]=await s.database.insert(m.routineTable).values({id:crypto.randomUUID(),...e,bot:await w(e.bot),nextRunAt:(0,d.nextRun)(e.schedule,new Date)}).returning();return k(),$(a)}async function S(e,t){let[a]=await s.database.select().from(m.routineTable).where((0,r.eq)(m.routineTable.id,e));if(!a)return null;let i=t.schedule??a.schedule,n=!!(t.schedule&&!(0,d.sameSchedule)(t.schedule,a.schedule))||t.enabled&&!a.enabled;n&&g(i,t.enabled??a.enabled);let[o]=await s.database.update(m.routineTable).set({...t,...t.bot?{bot:await w(t.bot)}:{},...n?{nextRunAt:(0,d.nextRun)(i,new Date)}:{}}).where((0,r.eq)(m.routineTable.id,e)).returning();return k(),$(o)}async function v(e){let t=await s.database.delete(m.routineTable).where((0,r.eq)(m.routineTable.id,e)).returning({id:m.routineTable.id});return t.length&&k(),t.length>0}e.s(["createRoutine",0,y,"deleteRoutine",0,v,"listRoutines",0,b,"resolveRoutine",0,T,"updateRoutine",0,S]),a()}catch(e){a(e)}},!1),473139,e=>{"use strict";var t=e.i(105249),a=e.i(687388),i=e.i(704161);let n=t.default.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function r(e){let[t,a]=e.split(" "),[i,n,r]=t.split("-").map(Number),[o,l]=a.split(":").map(Number);return new Date(i,n-1,r,o,l)}let o=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,l=t.default.string().regex(o,'A moment is "YYYY-MM-DD HH:MM"').refine(e=>{if(!o.test(e))return!0;let t=r(e);return t.getMonth()===Number(e.slice(5,7))-1&&t.getDate()===Number(e.slice(8,10))},"There is no such day"),s=t.default.discriminatedUnion("kind",[t.default.object({kind:t.default.literal("once"),at:l}),t.default.object({kind:t.default.literal("daily"),time:n,days:t.default.array(t.default.number().int().min(1).max(7)).min(1,"Pick at least one day").transform(e=>[...new Set(e)].sort((e,t)=>e-t))}),t.default.object({kind:t.default.literal("every"),hours:t.default.number().int().min(a.ROUTINE.minHours,`No more often than every ${a.ROUTINE.minHours}h`).max(168)})]),m=t.default.object({bot:t.default.string().trim().min(1,"Pick a bot"),label:t.default.string().trim().min(1,"Give it a name").max(80),request:t.default.string().trim().min(1,"Say what it should do"),schedule:s}),c=t.default.object({id:t.default.string(),status:t.default.enum(["running","waiting","done","cancelled"]),outcome:t.default.string().nullable(),updatedAt:i.DateLikeSchema});m.extend({id:t.default.string(),enabled:t.default.boolean(),nextRunAt:i.DateLikeSchema,runs:t.default.array(c)});let u=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.s(["RoutineInputSchema",0,m,"RoutineScheduleSchema",0,s,"momentOf",0,r,"nextRun",0,function(e,t){if("once"===e.kind)return r(e.at);if("every"===e.kind)return new Date(t.getTime()+36e5*e.hours);let[a,i]=e.time.split(":").map(Number);for(let n=0;n<=7;n++){let r=new Date(t);r.setDate(r.getDate()+n),r.setHours(a,i,0,0);let o=0===r.getDay()?7:r.getDay();if(r>t&&e.days.includes(o))return r}return new Date(t.getTime()+864e5)},"sameSchedule",0,function(e,t){if("once"===e.kind)return"once"===t.kind&&e.at===t.at;if("every"===e.kind)return"every"===t.kind&&e.hours===t.hours;let a=e=>[...e].sort((e,t)=>e-t).join();return"daily"===t.kind&&e.time===t.time&&a(e.days)===a(t.days)},"scheduleText",0,function(e){if("once"===e.kind){let[t,a]=e.at.split(" "),[,i,n]=t.split("-").map(Number);return`Once \xb7 ${d[i-1]} ${n} ${a}`}if("every"===e.kind)return 1===e.hours?"Every hour":`Every ${e.hours} hours`;let{days:t,time:a}=e;if(7===t.length)return`Daily ${a}`;if(1===t.length)return`${u[t[0]-1]} ${a}`;let i=t.every((e,a)=>0===a||e===t[a-1]+1)?`${u[t[0]-1]}–${u[t.at(-1)-1]}`:t.map(e=>u[e-1]).join(" ");return`Daily ${a} \xb7 ${i}`}])},527608,824664,e=>{"use strict";var t=e.i(912714),a=e.i(750227),i=e.i(380690),n=e.i(687388),r=e.i(786025);e.i(640911);let o=e=>e.trim().toLowerCase().replace(/^[a-z]+:\/\//,"").replace(/^www\./,"").replace(/[/?#].*$/,"");e.s(["siteOf",0,o],824664);let l=(0,a.join)(n.DATA_DIR,n.PATHS.signIns),s=e=>(0,a.join)(l,`${encodeURIComponent(o(e))}.json`);async function m(e){try{return JSON.parse(await (0,t.readFile)(s(e),"utf8"))}catch{return null}}async function c(e){let t=o(e),a=await m(t);if(a)return a;let i=(await d()).map(e=>e.site).filter(e=>t.endsWith(`.${e}`)).sort((e,t)=>t.length-e.length)[0];return i?m(i):null}async function u(e){await (0,t.mkdir)(l,{recursive:!0}),await (0,t.writeFile)(s(e.site),JSON.stringify(e),{mode:384}),i.appEvents.emit({type:"signins"})}async function d(){let e=await (0,t.readdir)(l).catch(()=>[]);return(await Promise.all(e.filter(e=>e.endsWith(".json")).map(e=>m(decodeURIComponent(e.slice(0,-5)))))).flatMap(e=>e?[(({state:e,...t})=>t)(e)]:[]).sort((e,t)=>e.site.localeCompare(t.site))}async function p(e){let t=await c(e.site);if(t&&!t.bots.includes(e.bot)){let a=t.asking.includes(e.bot)?t:{...t,asking:[...t.asking,e.bot]};return a!==t&&await u(a),{kind:"taken",signIn:(({state:e,...t})=>t)(a)}}let a=t?.site??o(e.site),i={site:a,account:e.account.trim()||a,bots:[...new Set([...t?.bots??[],e.bot])],asking:(t?.asking??[]).filter(t=>t!==e.bot),keptAt:new Date().toISOString(),usedAt:t?.usedAt??null,state:e.state};return await u(i),{kind:"kept",signIn:(({state:e,...t})=>t)(i)}}let f=globalThis.__signInsHeld??=new Map;async function b(e,t){let a=await c(e);if(!a)return{kind:"none",kept:(await d()).map(e=>e.site)};if(!a.bots.includes(t))return a.asking.includes(t)||await u({...a,asking:[...a.asking,t]}),{kind:"ask",signIn:(({state:e,...t})=>t)(a)};let i={...a,usedAt:new Date().toISOString()};return await u(i),{kind:"state",signIn:(({state:e,...t})=>t)(i),state:a.state}}async function h(e,t){return(await (0,r.listBrowsers)(e,t)).find(e=>e.name===t.PLAYWRIGHT_CLI_SESSION)??null}async function T(e,t){let a=await h(e,t);return a?a.attached?"theirs":"own":null}async function w(e,t){let a=await h(e,t);return!!a&&!a.attached&&!0===a.headed}let g=e=>`${e.name}
|
|
2
|
+
${e.domain}
|
|
3
|
+
${e.path}`;async function y(e){let t,a=(0,r.jobShellEnv)(e),i=a.PLAYWRIGHT_CLI_SESSION??e,o=f.get(i);if(!o?.sites.size)return;let l=await (0,r.openWorkspace)();if(await T(l,a)!=="own")return void f.delete(i);let s=(0,r.browserStateFile)();try{let e=await l.exec((0,r.saveBrowserState)(s),{env:a,timeoutMs:n.BROWSER_CLI.loadMs});if(0!==e.exitCode)return;let i=JSON.parse(await l.readFile(s,"utf-8"));t=new Map((i.cookies??[]).map(e=>[g(e),e]))}finally{await l.exec(`rm -f ${s}`)}for(let e of o.sites){let a=await m(e),i=a?.state;if(!a||!i?.cookies||!a.bots.includes(o.bot))continue;let n=!1,r=i.cookies.map(e=>{let a=t.get(g(e));return a&&JSON.stringify(a)!==JSON.stringify(e)?(n=!0,a):e});n&&await u({...a,state:{...i,cookies:r}})}}e.s(["borrowSignIn",0,b,"holdSignIn",0,function(e,t,a){let i=f.get(e);i&&i.bot===t?i.sites.add(a):f.set(e,{bot:t,sites:new Set([a])})},"keepSignIn",0,p,"listSignIns",0,d,"renewSignIns",0,y,"sessionBrowser",0,T,"sessionWindow",0,w],527608)},629668,e=>{"use strict";var t=e.i(175936),a=e.i(687388);let i=e=>`text/${e}; charset=utf-8`,n={md:{kind:"markdown",mime:i("markdown")},markdown:{kind:"markdown",mime:i("markdown")},csv:{kind:"csv",mime:i("csv")},json:{kind:"json",mime:"application/json; charset=utf-8"},txt:{kind:"text",mime:i("plain")},log:{kind:"text",mime:i("plain")},html:{kind:"frame",mime:i("html")},htm:{kind:"frame",mime:i("html")},pdf:{kind:"frame",mime:"application/pdf"},png:{kind:"image",mime:"image/png"},jpg:{kind:"image",mime:"image/jpeg"},jpeg:{kind:"image",mime:"image/jpeg"},gif:{kind:"image",mime:"image/gif"},webp:{kind:"image",mime:"image/webp"},svg:{kind:"image",mime:"image/svg+xml"},mp3:{kind:"audio",mime:"audio/mpeg"},wav:{kind:"audio",mime:"audio/wav"},mp4:{kind:"video",mime:"video/mp4"},webm:{kind:"video",mime:"video/webm"},docx:{kind:"none",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},xlsx:{kind:"none",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},pptx:{kind:"none",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"},css:{kind:"none",mime:i("css")},js:{kind:"none",mime:i("javascript")},woff2:{kind:"none",mime:"font/woff2"}},r=e=>e.split(".").pop()?.toLowerCase()??"",o=new Set(["node_modules","__pycache__"]),l=new Set(["css","js","woff2"]),s=Object.keys(n).filter(e=>!l.has(e)),m=RegExp(String.raw`(?<![\p{L}\p{N}_/:@%-])\/?(?:[\p{L}\p{N}_.@%-]+/)*[\p{L}\p{N}_@%-]+(?:\.[\p{L}\p{N}_-]+)*\.(?:${s.join("|")})\b`,"giu"),c=`${a.PATHS.workspace}/`,u=t.queryKey.file(""),d=e=>e.startsWith(`${a.PATHS.artifacts}/`)&&["md","markdown","html","htm"].includes(r(e));e.s(["isListedFile",0,e=>!e.startsWith(".")&&!l.has(r(e)),"isListedFolder",0,e=>!e.startsWith(".")&&!o.has(e),"leadFirst",0,function(e){let t=e.findIndex(d);return t>0?[e[t],...e.filter((e,a)=>a!==t)]:e},"mimeOf",0,e=>n[r(e)]?.mime??"application/octet-stream","pathsIn",0,function(e){let t=e.replace(/\b[a-z][\w+.-]*:\/\/\S+/gi," ").replace(/\b[a-z][\w+.-]+:(?=\/)/gi," "),a=new Set,i="";for(let[e]of t.matchAll(m)){let t=!e.includes("/"),n=function(e){let t,a,i=(a=(t=function(e){if(!e.startsWith(u))return e;let t=e.slice(u.length);try{return decodeURIComponent(t)}catch{return t}}(e.trim())).indexOf(c))>=0?t.slice(a+c.length)||null:t.startsWith("/")||/^[A-Za-z]:/.test(t)||t.split("/").includes("..")?null:t||null;if(!i)return null;let[n,...r]=i.split("/");return r.length&&n.includes(".")?null:i}(t?i+e:e);t||(i=n?.slice(0,n.lastIndexOf("/")+1)??""),n&&a.add(n)}return[...a].slice(0,12)},"viewKindOf",0,e=>n[r(e)]?.kind??"none"])},260338,e=>{"use strict";var t=e.i(518899),a=e.i(844988),i=e.i(156325);e.s(["count",0,function(e){return t.sql`count(${e||t.sql.raw("*")})`.mapWith(Number)},"max",0,function(e){return t.sql`max(${e})`.mapWith((0,a.is)(e,i.Column)?e:String)}])}];
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=_1i3uucm._.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[56802,e=>e.a(async(t,a)=>{try{e.i(687388);var o=e.i(378884);e.i(704161);var n=t([o]);[o]=n.then?(await n)():n,e.s([]),a()}catch(e){a(e)}},!1),962072,e=>e.a(async(t,a)=>{try{var o=e.i(687388),n=e.i(186304),s=e.i(353885),r=e.i(265143),i=e.i(944971),h=e.i(378884),l=e.i(619898),d=e.i(453569),u=e.i(636882),c=e.i(22676),
|
|
1
|
+
module.exports=[56802,e=>e.a(async(t,a)=>{try{e.i(687388);var o=e.i(378884);e.i(704161);var n=t([o]);[o]=n.then?(await n)():n,e.s([]),a()}catch(e){a(e)}},!1),962072,e=>e.a(async(t,a)=>{try{var o=e.i(687388),n=e.i(186304),s=e.i(353885),r=e.i(265143),i=e.i(944971),h=e.i(378884),l=e.i(619898),d=e.i(453569),u=e.i(636882),c=e.i(22676),w=e.i(786025),m=e.i(660948),y=e.i(899352),p=e.i(54282),f=t([r,h,l,u,c,m]);async function g(e){var t,a,f,g,v,T,O,S;let _,{backendPrompt:E,written:$=!1,phone:A=!1,readSkills:L}=e,M=await (0,w.openWorkspace)(),[N,x,I,C,W,j,q]=await Promise.all([(0,u.loadSkills)(M),(0,l.listNoteIndex)(),(0,l.readNotes)(d.MEMORY_ALWAYS_LISTED,{touch:!1}),(0,m.listConnectedToolNames)(),(0,r.listJobBots)(),(0,c.listRecentTurns)(o.RECENT_CALL.rows,e.callId),(0,r.readBotMemoryOn)()]),P=await (0,h.listCallJobs)(j.map(e=>e.callId)),R=[(0,p.thursdayIdentity)(),$?(0,y.personaLines)(e.persona):"",$?(0,p.styleLines)(e.stylePrompt):"",function(e,t){let{crowded:a,heavy:o}=(0,p.tidying)(e),n=[...o].sort((e,t)=>t.factCount-e.factCount).slice(0,3).map(e=>e.path),r=a||o.length?`
|
|
2
2
|
|
|
3
3
|
Saved memory has grown past what it holds well${n.length?` (${n.join(", ")})`:""}: say so once in what you return, go through what looks out of date with the user, and forget only what they name.`:"",i=new Set(t.map(e=>e.path)),h=`## Memory
|
|
4
4
|
|
|
@@ -10,11 +10,11 @@ ${(0,p.noteLines)(e.filter(e=>!i.has(e.path)),a)}${r}
|
|
|
10
10
|
|
|
11
11
|
Open a note before answering out of it; a topic not listed is one you know nothing about. A fact marked \`said\` came from a call.
|
|
12
12
|
|
|
13
|
-
Keep what the user tells you as it comes up, with \`${s.TOOL_NAMES.memory_remember}\`, without waiting to be asked: what they actually said, never a guess, nothing they asked you not to keep, and from a bot's report only what it confirmed about them. What tells you most about them comes first: what they loved or could not stand and why — how they want you to talk goes under preferences — then what they are going through or working toward, good news, stories from their past and the people in their life, and last plain facts and tastes. A subject that is not on the listing gets a note of its own with \`${s.TOOL_NAMES.memory_create}\`, under one of the paths below.
|
|
13
|
+
Keep what the user tells you as it comes up, with \`${s.TOOL_NAMES.memory_remember}\`, without waiting to be asked: what they actually said, never a guess, nothing they asked you not to keep, and from a bot's report only what it confirmed about them. What they say that bears on work already handed over is said to that thread as well (\`${s.TOOL_NAMES.thread_tell}\`). What tells you most about them comes first: what they loved or could not stand and why — how they want you to talk goes under preferences — then what they are going through or working toward, good news, stories from their past and the people in their life, and last plain facts and tastes. A subject that is not on the listing gets a note of its own with \`${s.TOOL_NAMES.memory_create}\`, under one of the paths below.
|
|
14
14
|
|
|
15
15
|
**Keep memory clean as you write.** A fact that repeats, narrows or changes one already in the note replaces it, merged into one line, rather than sitting beside it. A later call finds a note only by its path and its line: give something new its own path below, and when a line no longer says what its note is about, \`${s.TOOL_NAMES.memory_describe}\` puts it right.
|
|
16
16
|
|
|
17
|
-
${d.MEMORY_PATHS.map(e=>`- ${e.path} — ${e.of}`).join("\n")}`;return[h,l,u].join("\n\n")}(
|
|
17
|
+
${d.MEMORY_PATHS.map(e=>`- ${e.path} — ${e.of}`).join("\n")}`;return[h,l,u].join("\n\n")}(x,I.notes),(t=W,a=(0,p.reachNames)(L?[]:N,C),f=q,g=A,0===t.length?"":`## Background work
|
|
18
18
|
|
|
19
19
|
Who you hand work to — the names \`${s.TOOL_NAMES.thread_start}\` takes.
|
|
20
20
|
|
|
@@ -24,11 +24,11 @@ What bots can reach for: ${a}.`:""}
|
|
|
24
24
|
|
|
25
25
|
**A bot can take on almost anything, and anything that takes more than a few seconds is a bot's**; a note, a look at a file or one command is yours. A bot has this computer, a real browser, the web, a shell to build what is missing and far more time than a call; it signs in where it has to and carries work to the end, so something you do not know how to do is work for a bot, not a no. Bots bring each other in, so work that spans several things is still one thread.${f?" Each bot keeps its own memory from thread to thread: when the user says how a bot should work from now on, pass it to that bot to remember.":""}
|
|
26
26
|
|
|
27
|
-
**Work lives in threads.** A thread's bot remembers that thread and nothing else, so the same bot started on a new one begins from nothing. More about work already handed over — a correction, the next step once it finished, going on after it stopped — is said to that thread (\`${s.TOOL_NAMES.thread_tell}\`); only a request that stands on its own starts a new one (\`${s.TOOL_NAMES.thread_start}\`). The threads open as this call started come into the conversation at the start, and they move while you talk: \`${s.TOOL_NAMES.thread_status}\` reads them as they are now, before you answer about one or hand anything over. Ask the user which it is only when the request could be either. Write the request in the user's own words, with what it stands on — including how they told you they want work done — and nothing they did not say.
|
|
27
|
+
**Work lives in threads.** A thread's bot remembers that thread and nothing else, so the same bot started on a new one begins from nothing. More about work already handed over — a correction, the next step once it finished, going on after it stopped — is said to that thread (\`${s.TOOL_NAMES.thread_tell}\`); only a request that stands on its own starts a new one (\`${s.TOOL_NAMES.thread_start}\`). The threads open as this call started come into the conversation at the start, and they move while you talk: \`${s.TOOL_NAMES.thread_status}\` reads them as they are now, before you answer about one or hand anything over. Ask the user which it is only when the request could be either. Write the request in the user's own words, with what it stands on — including how they told you they want work done — and nothing they did not say. When something the work needs is still missing, either ask the user yourself before handing it over or let the bot ask them — never both.
|
|
28
28
|
|
|
29
29
|
**Work that should start by itself — every morning, every few hours — is a routine.** \`${s.TOOL_NAMES.routine}\` makes one from a bot, the work in the user's own words, and when; from then on it starts a thread for it each time without being asked, and the result reaches the user like any thread's. Ask once for whichever of those they left out, and read the ones that exist before making, changing or deleting one.
|
|
30
30
|
|
|
31
|
-
Updates and questions from threads reach the conversation by themselves, naming their thread and the bot that asks; they come from bots, not the user, and a question is answered with \`${s.TOOL_NAMES.thread_answer}\`. ${g?"When the user wants to see what a thread made, name its files by their path in your answer: they are sent along with it.":`When the user wants to see what a thread made, \`${s.TOOL_NAMES.thread_show}\` puts it on their screen.`} Once you have told them how a thread ended, or when they ask you to clear what is finished, mark it with \`${s.TOOL_NAMES.thread_seen}\`.`),(v=M.cwd,T=L?
|
|
31
|
+
Updates and questions from threads reach the conversation by themselves, naming their thread and the bot that asks; they come from bots, not the user, and a question is answered with \`${s.TOOL_NAMES.thread_answer}\`. ${g?"When the user wants to see what a thread made, name its files by their path in your answer: they are sent along with it.":`When the user wants to see what a thread made, \`${s.TOOL_NAMES.thread_show}\` puts it on their screen.`} Once you have told them how a thread ended, or when they ask you to clear what is finished, mark it with \`${s.TOOL_NAMES.thread_seen}\`.`),(v=M.cwd,T=L?N:[],_=`## This computer
|
|
32
32
|
|
|
33
33
|
Current Cwd: ${v}
|
|
34
34
|
Platform: ${process.platform}
|
|
@@ -41,19 +41,19 @@ Skills are written-down ways of doing things here. \`${s.TOOL_NAMES.load_skill}\
|
|
|
41
41
|
|
|
42
42
|
${(0,p.skillLines)(T,{short:!0})}`),$?`## Answer in writing
|
|
43
43
|
|
|
44
|
-
This call is in writing: there is no voice, and what you write is what the user reads, so answer them directly, in their language. Say the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question they have to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. Keep it short and plain.`:`## Return the result
|
|
44
|
+
This call is in writing: there is no voice, and what you write is what the user reads, so answer them directly, in their language. Say the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question they have to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. Keep it short and plain. News from a bot comes in the middle of whatever you were talking about: say whose work it is and which job before what it says.`:`## Return the result
|
|
45
45
|
|
|
46
|
-
Return the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question the user has to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. What you return is said aloud: keep it short and plain, and carry what they do not know yet — never a confirmation this conversation has already given them.`,(O=j,S=
|
|
46
|
+
Return the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question the user has to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. What you return is said aloud: keep it short and plain, and carry what they do not know yet — never a confirmation this conversation has already given them. When all the turn did was keep what they told you about themselves, return only that it was kept: the voice is already answering them.`,(O=j,S=P,O.some(e=>e.turns.length>0)?`## Earlier calls
|
|
47
47
|
|
|
48
48
|
What was said on the last calls, verbatim, newest last. It is the past: pick it up when the user does, and never answer it as a new request.
|
|
49
49
|
|
|
50
50
|
A \`${s.TOOL_NAMES.thread_start}\` line carries the thread's handle and how it ended; the handle is for the thread tools, never said aloud. What they ask for now is often one of these carried further.
|
|
51
51
|
|
|
52
|
-
${(0,p.recentCallLines)(O.map(e=>({...e,jobs:S.filter(t=>t.callId===e.callId)})),o.RECENT_CALL.tokens)}`:""),k(E)].filter(Boolean).join("\n\n");return(0,p.logPromptSize)("thursday",
|
|
52
|
+
${(0,p.recentCallLines)(O.map(e=>({...e,jobs:S.filter(t=>t.callId===e.callId)})),o.RECENT_CALL.tokens)}`:""),k(E)].filter(Boolean).join("\n\n");return(0,p.logPromptSize)("thursday",R),R}[r,h,l,u,c,m]=f.then?(await f)():f;let k=e=>e?.trim()?`## Additional instructions
|
|
53
53
|
|
|
54
54
|
Written by the user. Follow them together with everything above.
|
|
55
55
|
|
|
56
56
|
${e.trim()}`:"";function b(e){let t=e.facts.map(e=>`- ${e.text} #${e.id}`);return`${e.path} — ${e.description}
|
|
57
|
-
${t.length?t.join("\n"):"- (nothing yet)"}`}e.s(["loadThursdayPrompt",0,g]),a()}catch(e){a(e)}},!1),97334,e=>e.a(async(t,a)=>{try{var o=e.i(68356),n=e.i(469719),s=e.i(687388),r=e.i(911757),i=e.i(159479),h=e.i(386075),l=e.i(264079),d=e.i(56802),u=e.i(962072),c=e.i(353885),
|
|
57
|
+
${t.length?t.join("\n"):"- (nothing yet)"}`}e.s(["loadThursdayPrompt",0,g]),a()}catch(e){a(e)}},!1),97334,e=>e.a(async(t,a)=>{try{var o=e.i(68356),n=e.i(469719),s=e.i(687388),r=e.i(911757),i=e.i(159479),h=e.i(386075),l=e.i(264079),d=e.i(56802),u=e.i(962072),c=e.i(353885),w=e.i(279041),m=e.i(340698),y=e.i(878498),p=e.i(120219),f=e.i(53748),g=e.i(22676),b=e.i(134344),k=t([i,h,d,u,m,g]);async function v(){let e=await Promise.all(b.TEXT_CALL_PROVIDERS.map(async e=>await (0,m.readConfig)(e.apiKeyName)?e.apiKeyName:null));return(0,b.textCallRunsOn)(t=>e.includes(t))}async function T(e,t){if(t)return t;let a=await v();return a||(0,f.publicError)(A),{provider:a,model:e.backendModel}}[i,h,d,u,m,g]=k.then?(await k)():k;let E=n.z.object({callId:n.z.string().min(1),standing:n.z.string().nullish(),runsOn:l.textModelRefSchema.nullish(),turn:n.z.string().min(1),messages:n.z.array(n.z.unknown()).min(1)}),$=globalThis.__textCallTurns??=new Map;async function O(e,t){var a;let n,r,i=null,l=[],d=()=>{i&&$.delete(i)};try{let a=E.parse(e);i=a.turn,$.set(i,{callId:a.callId,notes:l}),t.addEventListener("abort",d,{once:!0}),t.aborted&&d(),r=await _(a)}catch(a){d();let{status:e,message:t}=(0,p.startError)(a,"Could not reach her");return new Response(t,{status:e})}let u=(a=r.callId,n=r.seq,{step:async e=>{for(let t of e.content)if("tool-call"===t.type){let o=e.content.find(e=>"tool-result"===e.type&&e.toolCallId===t.toolCallId);await (0,g.saveTurns)(a,[{id:t.toolCallId,role:"tool",tool:t.toolName,text:t.toolName===c.TOOL_NAMES.web_search?function(e,t){let a=t??{},o=[(e??{}).query,a.action?.query].find(e=>"string"==typeof e&&!!e.trim()),n=Array.isArray(a.sources)?a.sources.flatMap(e=>e&&"object"==typeof e&&"url"in e&&"string"==typeof e.url?[{url:e.url,..."title"in e&&"string"==typeof e.title?{title:e.title}:{}}]:[]):[];return JSON.stringify({query:o??null,sources:n})}(t.input,o?.type==="tool-result"?o.output:null):JSON.stringify(t.input??{}),seq:n++}])}else"text"===t.type&&t.text.trim()?await (0,g.saveTurns)(a,[{id:crypto.randomUUID(),role:"assistant",text:t.text.trim(),seq:n++}]):"reasoning"===t.type&&t.text.trim()&&await (0,g.saveThought)(a,{id:crypto.randomUUID(),text:t.text.trim(),seq:n})},said:(e,t=crypto.randomUUID())=>(0,g.saveTurns)(a,[{id:t,role:"user",text:e,seq:n++}])}),w=new Map,m=(0,o.streamText)({model:r.model,instructions:r.system,messages:r.messages,allowSystemInMessages:!0,tools:r.tools,providerOptions:r.providerOptions,stopWhen:(0,o.stepCountIs)(s.TEXT_CALL.maxSteps),abortSignal:t,prepareStep:async({stepNumber:e,messages:t})=>{let a=l.splice(0);if(a.length){for(let e of a)e.said&&await u.said(e.text,e.id);return w.set(e,a),{messages:[...t,...a.map(e=>({role:"user",content:e.text}))]}}},onStepEnd:u.step}),y=-1,f=new TransformStream({transform(e,t){if("start-step"===e.type)for(let e of(y+=1,w.get(y)??[]))t.enqueue({type:`data-${b.TEXT_CALL_NOTE}`,id:e.id,data:e});t.enqueue(e)},flush:d});return(0,o.createUIMessageStreamResponse)({stream:(0,o.toUIMessageStream)({stream:m.stream,tools:r.tools,onError:h.modelErrorToString}).pipeThrough(f)})}async function S(e,t,a=!1){let o=await (0,g.readLiveSettings)(),n=await T(o,t),s="openai"===n.provider||"chatgpt"===n.provider,[l,d,p,f,b]=await Promise.all([(0,h.getTextModel)(n),(0,u.loadThursdayPrompt)({backendPrompt:o.backendPrompt,written:!0,callId:e,phone:a,persona:o.persona,stylePrompt:o.stylePrompt,readSkills:o.readSkills}),(0,i.loadTools)({target:"thursday",callId:e,webSearch:o.webSearch,readSkills:o.readSkills,written:!0,model:n,phone:a}),(0,m.readConfig)(w.EXA_API_KEY),(0,m.readConfig)(r.LIVE_PROVIDER.apiKeyName)]),k=l.searchTools&&Object.values(l.searchTools)[0],v={...p,...o.webSearch&&!f&&k?{[c.TOOL_NAMES.web_search]:k}:{}},O=s?b?await (0,y.acceptedReasoning)({apiKey:b,model:n.model,effort:o.reasoningEffort}):(0,y.wantedReasoning)(o.reasoningEffort):null;return{model:l.model,system:d,tools:v,providerOptions:{openai:{...O?.effort?{reasoningEffort:O.effort}:{},...O&&"summary"in O&&O.summary?{reasoningSummary:O.summary}:{}}}}}async function _({callId:e,standing:t,runsOn:a,messages:n}){let[s,r,i]=await Promise.all([S(e,a),(0,o.validateUIMessages)({messages:n,dataSchemas:{[b.TEXT_CALL_NOTE]:b.TextCallNoteSchema}}),(0,g.nextTurnSeq)(e)]),h=r.at(-1)?.role;"user"!==h&&"assistant"!==h&&(0,f.publicError)("The conversation must end with your words or hers.");let l=i,d=r.findLastIndex(e=>"assistant"===e.role);for(let t of r.slice(d+1)){for(let a of(0,b.notesIn)([t]))a.said&&await (0,g.saveTurns)(e,[{id:a.id,role:"user",text:a.text,seq:l++}]);let a=L(t);a&&await (0,g.saveTurns)(e,[{id:t.id,role:"user",text:a,seq:l++}])}return{...s,callId:e,seq:l,messages:[...t?[{role:"system",content:t}]:[],...await (0,o.convertToModelMessages)(r.flatMap(e=>{let t=[],a=[],o=()=>{a.length&&t.push({...e,id:`${e.id}:${t.length}`,parts:a}),a=[]};for(let n of e.parts){let e=(0,b.noteOf)(n);if(!e){a.push(n);continue}o(),t.push({id:e.id,role:"user",parts:[{type:"text",text:e.text}]})}return o(),t}),{ignoreIncompleteToolCalls:!0})]}}let A="Writing to Thursday needs a GPT subscription sign-in or an OpenAI key — Settings › API keys.",L=e=>e.parts.flatMap(e=>"text"===e.type?e.text:[]).join("\n").trim();e.s(["streamTextCall",0,O]),a()}catch(e){a(e)}},!1),878498,e=>{"use strict";var t=e.i(469719),a=e.i(687388),o=e.i(640911);e.i(904309),t.z.object({session:t.z.object({id:t.z.string().min(1)}),transport:t.z.object({type:t.z.literal("webrtc"),sdp:t.z.string().min(1)})});let n=new Map;function s(e){return"none"===e?{effort:e}:{...e?{effort:e}:{},summary:"auto"}}async function r(e){let{apiKey:t,model:r,effort:i}=e,h=`${r} ${i??"auto"}`,l=n.get(h);if(void 0!==l)return l;let d=s(i);for(;;){let e=await fetch("https://api.openai.com/v1/responses/input_tokens",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(a.LIVE_CALL.reasoningCheckMs),body:JSON.stringify({model:r,input:".",reasoning:d})}).catch(()=>null);if(!e)return d;let s=Object.keys(d).length?d:null;if(e.ok)return n.set(h,s),s;let i=await e.json().catch(()=>null),l=i?.error?.param?.replace(/^reasoning\./,"");if("effort"!==l&&"summary"!==l||!(l in d))return d;if(o.logger.warn(`${r} takes no reasoning ${l}; calls omit it`),delete d[l],!Object.keys(d).length)return n.set(h,null),null}}e.s(["acceptedReasoning",0,r,"wantedReasoning",0,s])}];
|
|
58
58
|
|
|
59
59
|
//# sourceMappingURL=_1m88lkh._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[441758,e=>e.a(async(t,a)=>{try{var l=e.i(97334),s=e.i(91264),n=t([l]);[l]=n.then?(await n)():n;let r=(0,s.serverRoute)(async e=>(0,l.streamTextCall)(await e.json(),e.signal));e.s(["POST",0,r]),a()}catch(e){a(e)}},!1),495744,e=>{"use strict";var t=e.i(747909),a=e.i(174017),l=e.i(996250),s=e.i(759756),n=e.i(561916),r=e.i(174677),i=e.i(869741),o=e.i(316795),d=e.i(487718),u=e.i(995169),c=e.i(47587),p=e.i(666012),h=e.i(570101),g=e.i(626937),f=e.i(10372),b=e.i(193695);e.i(52474);var T=e.i(600220);let m=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/thursday/text/route",pathname:"/api/thursday/text",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/thursday/text/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(441758),...{}}),{workAsyncStorage:R,workUnitAsyncStorage:w,serverHooks:v}=m;async function A(e,t,l){l.requestMeta&&(0,s.setRequestMeta)(e,l.requestMeta),m.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let R="/api/thursday/text/route";R=R.replace(/\/index$/,"")||"/";let w=await m.prepare(e,t,{srcPage:R,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==l.waitUntil||l.waitUntil.call(l,Promise.resolve()),null;let{buildId:v,deploymentId:A,params:y,nextConfig:E,parsedUrl:x,isDraftMode:M,prerenderManifest:S,routerServerContext:C,isOnDemandRevalidate:I,revalidateOnlyGenerated:_,resolvedPathname:q,clientReferenceManifest:P,serverActionsManifest:N}=w,O=(0,i.normalizeAppPath)(R),H=!!(S.dynamicRoutes[O]||S.routes[q]),D=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,x,!1):t.end("This page could not be found"),null);if(H&&!M){let e=!!S.routes[q],t=S.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await D();throw new b.NoFallbackError}}let L=null;!H||m.isDev||M||(L="/index"===(L=q)?"/":L);let k=!0===m.isDev||!H,U=H&&!k;N&&P&&(0,r.setManifestsSingleton)({page:R,clientReferenceManifest:P,serverActionsManifest:N});let j=e.method||"GET",K=(0,n.getTracer)(),$=K.getActiveScopeSpan(),B=!!(null==C?void 0:C.isWrappedByNextServer),F=!!(0,s.getRequestMeta)(e,"minimalMode"),Y=(0,s.getRequestMeta)(e,"incrementalCache")||await m.getIncrementalCache(e,E,S,F);null==Y||Y.resetRequestCache(),globalThis.__incrementalCache=Y;let G={params:y,previewProps:S.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts,useCacheTimeout:E.experimental.useCacheTimeout},cacheComponents:!!E.cacheComponents,validationLevel:E.experimental.instantInsights.validationLevel,supportsDynamicResponse:k,incrementalCache:Y,hmrRefreshHash:(0,s.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:E.cacheLife,staticPageGenerationTimeout:E.staticPageGenerationTimeout,waitUntil:l.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,l,s)=>m.onRequestError(e,t,l,s,C)},sharedContext:{buildId:v,deploymentId:A}},X=new o.NodeNextRequest(e),V=new o.NodeNextResponse(t),J=d.NextRequestAdapter.fromNodeNextRequest(X,(0,d.signalFromNodeResponse)(t)),W=async({previousCacheEntry:a})=>{try{if(!F&&I&&_&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await m.handle(J,G);e.fetchMetrics=G.renderOpts.fetchMetrics;let n=G.renderOpts.pendingWaitUntil;n&&l.waitUntil&&(l.waitUntil(n),n=void 0);let r=G.renderOpts.collectedTags;if(!H)return await (0,p.sendResponse)(X,V,s,n),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);r&&(t[f.NEXT_CACHE_TAGS_HEADER]=r),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,l=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=f.INFINITE_CACHE?!1!==a&&a>0?E.expireTime:void 0:G.renderOpts.collectedExpire;return{value:{kind:T.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:l}}}}catch(t){throw(null==a?void 0:a.isStale)&&await m.onRequestError(e,t,{routerKind:"App Router",routePath:R,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:I})},!1,C),t}},z=async(s,r)=>{try{var i,o;let s=await m.handleResponse({req:e,nextConfig:E,cacheKey:L,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:S,isRoutePPREnabled:!1,isOnDemandRevalidate:I,revalidateOnlyGenerated:_,responseGenerator:W,waitUntil:l.waitUntil,isMinimalMode:F});if(!H)return;if((null==s||null==(i=s.value)?void 0:i.kind)!==T.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==s||null==(o=s.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});F||t.setHeader("x-nextjs-cache",I?"REVALIDATED":s.isMiss?"MISS":s.isStale?"STALE":"HIT"),M&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let n=(0,h.fromNodeOutgoingHttpHeaders)(s.value.headers);F&&H||n.delete(f.NEXT_CACHE_TAGS_HEADER),!s.cacheControl||t.getHeader("Cache-Control")||n.get("Cache-Control")||n.set("Cache-Control",(0,g.getCacheControlHeader)(s.cacheControl)),await (0,p.sendResponse)(X,V,new Response(s.value.body,{headers:n,status:s.value.status||200}));return}catch(t){if(t instanceof b.NoFallbackError||await m.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:I})},!1,C),H)throw t;await (0,p.sendResponse)(X,V,new Response(null,{status:500}));return}finally{(()=>{if(!s)return;let e=t.statusCode;s.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(s.setStatus({code:n.SpanStatusCode.ERROR}),s.setAttribute("error.type",e.toString()));let a=K.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let l=a.get("next.route")||O,i=`${j} ${l}`;s.setAttributes({"next.route":l,"http.route":l,"next.span_name":i}),s.updateName(i),r&&r!==s&&(r.setAttribute("http.route",l),r.updateName(i))})()}};if(B&&$)await z($,void 0);else{let t=K.getActiveScopeSpan();await K.withPropagatedContext(e.headers,()=>K.trace(u.BaseServerSpan.handleRequest,{spanName:`${j} ${R}`,kind:n.SpanKind.SERVER,attributes:{"http.method":j,"http.target":e.url}},e=>z(e,t)),void 0,!B)}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,l.patchFetch)({workAsyncStorage:R,workUnitAsyncStorage:w})},"routeModule",0,m,"serverHooks",0,v,"workAsyncStorage",0,R,"workUnitAsyncStorage",0,w])},186304,e=>{"use strict";e.i(902157),e.i(912714);var t=e.i(750227),a=e.i(687388);(0,t.join)(a.APP_DIR,"guide");let l=".guide";e.s(["botGuideLine",0,()=>`How ${a.APP_NAME} itself works for the user — its screens and settings — is written under \`${l}/\` here, \`index.md\` first; read it only when the job is about the app.`,"guideLine",0,()=>`How ${a.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 \`${l}/\` 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.`])},22676,e=>e.a(async(t,a)=>{try{var l=e.i(349129),s=e.i(875225),n=e.i(518899),r=e.i(687388),i=e.i(528790),o=e.i(613240),d=e.i(911757),u=e.i(378884),c=e.i(340698),p=e.i(134344),h=t([i,u,c]);async function g(){let e=function(e){if(!e)return null;try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}(await (0,c.readConfig)(p.THURSDAY_KEYS.settings)),t=d.LiveSettingsSchema.parse((0,d.migrateLiveSettings)(e));return e?t:{...t,readSkills:await f()}}async function f(){return(await (0,c.readConfig)(p.THURSDAY_KEYS.wasSkills))?.trim()==="on"}async function b(e,t){for(let a of t)await i.database.insert(o.callMessageTable).values({callId:e,...a,fragments:a.fragments??null}).onConflictDoUpdate({target:[o.callMessageTable.callId,o.callMessageTable.id],set:{text:a.text,role:a.role,tool:a.tool??null,fragments:a.fragments??null}})}async function T(e){let[t]=await i.database.select({seq:n.sql`max(${o.callMessageTable.seq})`}).from(o.callMessageTable).where((0,s.eq)(o.callMessageTable.callId,e));return t?.seq==null?0:Number(t.seq)+1}async function m(e,t){await i.database.insert(o.callThoughtTable).values({callId:e,...t}).onConflictDoNothing()}async function R(e){let t=await i.database.select({callId:o.callMessageTable.callId,startedAt:o.callTable.startedAt,role:o.callMessageTable.role,tool:o.callMessageTable.tool,text:o.callMessageTable.text,seq:o.callMessageTable.seq}).from(o.callMessageTable).innerJoin(o.callTable,(0,s.eq)(o.callMessageTable.callId,o.callTable.id)).orderBy((0,l.desc)(o.callTable.startedAt),(0,l.desc)(o.callMessageTable.seq)).limit(e),a=new Map;for(let e of t){let t=a.get(e.callId)??{callId:e.callId,startedAt:e.startedAt,turns:[]};t.turns.push({role:e.role,tool:e.tool,text:e.text,seq:e.seq}),a.set(e.callId,t)}return[...a.values()].reverse().map(e=>({...e,turns:e.turns.reverse()}))}async function w(){return(await i.database.select({id:o.callTable.id}).from(o.callTable).where((0,s.isNull)(o.callTable.endedAt)).limit(1)).length>0}async function v(e){let t=e.limit??r.CALL_HISTORY_PAGE,a=await i.database.select({id:o.callTable.id,provider:o.callTable.provider,model:o.callTable.model,backendModel:o.callTable.backendModel,startedAt:o.callTable.startedAt,endedAt:o.callTable.endedAt,endedReason:o.callTable.endedReason,seconds:o.callTable.seconds}).from(o.callTable).innerJoin(o.callMessageTable,(0,s.eq)(o.callMessageTable.callId,o.callTable.id)).where(e.before?(0,s.lt)(o.callTable.startedAt,e.before):void 0).groupBy(o.callTable.id).orderBy((0,l.desc)(o.callTable.startedAt)).limit(t);if(0===a.length)return[];let n=await i.database.select({callId:o.callMessageTable.callId,id:o.callMessageTable.id,role:o.callMessageTable.role,tool:o.callMessageTable.tool,text:o.callMessageTable.text,seq:o.callMessageTable.seq,fragments:o.callMessageTable.fragments,at:o.callMessageTable.at}).from(o.callMessageTable).where((0,s.inArray)(o.callMessageTable.callId,a.map(e=>e.id))).orderBy((0,l.asc)(o.callMessageTable.callId),(0,l.asc)(o.callMessageTable.seq)),d=new Map;for(let e of n){let{callId:t,...a}=e,l=d.get(t);l?l.push(a):d.set(t,[a])}let c=await (0,u.listCallJobs)(a.map(e=>e.id));return a.map(e=>({...e,turns:d.get(e.id)??[],jobs:c.filter(t=>t.callId===e.id).map(e=>({id:e.id,label:e.label,status:e.status,outcome:e.outcome}))}))}[i,u,c]=h.then?(await h)():h,e.s(["isAnyCallLive",0,w,"listCallHistory",0,v,"listRecentTurns",0,R,"nextTurnSeq",0,T,"readLiveSettings",0,g,"saveThought",0,m,"saveTurns",0,b]),a()}catch(e){a(e)}},!1),134344,e=>{"use strict";var t=e.i(105249),a=e.i(264079),l=e.i(904309);let s=[{id:"chatgpt",...a.TEXT_MODEL_PROVIDERS.chatgpt},{id:"openai",...a.TEXT_MODEL_PROVIDERS.openai}],n=t.default.object({id:t.default.string().min(1),text:t.default.string(),said:t.default.boolean()}),r="note",i=e=>e.type===`data-${r}`?e.data:null;t.default.object({enabled:t.default.boolean(),phrase:t.default.string().trim().min(3).max(32)}),t.default.object({enabled:t.default.boolean(),combo:t.default.string().trim().min(1).max(64)}),t.default.enum(["off","waiting","any"]),t.default.enum(["center","sides"]),t.default.object({id:t.default.string().min(1),role:t.default.enum(["user","assistant","tool"]),tool:t.default.string().nullish(),text:t.default.string(),seq:t.default.number().int().min(0),fragments:t.default.array(l.LiveFragmentSchema).nullish()}),t.default.object({id:t.default.string().min(1),text:t.default.string(),seq:t.default.number().int().min(0)}),e.s(["TEXT_CALL_NOTE",0,r,"TEXT_CALL_PROVIDERS",0,s,"THURSDAY_KEYS",0,{settings:"THURSDAY_SETTINGS",wasSkills:"THURSDAY_SKILLS"},"TextCallNoteSchema",0,n,"noteOf",0,i,"notesIn",0,e=>e.flatMap(e=>e.parts.flatMap(e=>{let t=i(e);return t?[t]:[]})),"textCallRunsOn",0,e=>s.find(t=>e(t.apiKeyName))?.id??null])}];
|
|
1
|
+
module.exports=[441758,e=>e.a(async(t,a)=>{try{var l=e.i(97334),s=e.i(91264),n=t([l]);[l]=n.then?(await n)():n;let r=(0,s.serverRoute)(async e=>(0,l.streamTextCall)(await e.json(),e.signal));e.s(["POST",0,r]),a()}catch(e){a(e)}},!1),495744,e=>{"use strict";var t=e.i(747909),a=e.i(174017),l=e.i(996250),s=e.i(759756),n=e.i(561916),r=e.i(174677),i=e.i(869741),o=e.i(316795),d=e.i(487718),c=e.i(995169),u=e.i(47587),p=e.i(666012),h=e.i(570101),g=e.i(626937),f=e.i(10372),b=e.i(193695);e.i(52474);var T=e.i(600220);let m=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/thursday/text/route",pathname:"/api/thursday/text",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/thursday/text/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(441758),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:R,serverHooks:v}=m;async function A(e,t,l){l.requestMeta&&(0,s.setRequestMeta)(e,l.requestMeta),m.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/thursday/text/route";w=w.replace(/\/index$/,"")||"/";let R=await m.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==l.waitUntil||l.waitUntil.call(l,Promise.resolve()),null;let{buildId:v,deploymentId:A,params:y,nextConfig:E,parsedUrl:x,isDraftMode:M,prerenderManifest:C,routerServerContext:S,isOnDemandRevalidate:I,revalidateOnlyGenerated:_,resolvedPathname:q,clientReferenceManifest:P,serverActionsManifest:N}=R,O=(0,i.normalizeAppPath)(w),H=!!(C.dynamicRoutes[O]||C.routes[q]),D=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,x,!1):t.end("This page could not be found"),null);if(H&&!M){let e=!!C.routes[q],t=C.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await D();throw new b.NoFallbackError}}let L=null;!H||m.isDev||M||(L="/index"===(L=q)?"/":L);let k=!0===m.isDev||!H,U=H&&!k;N&&P&&(0,r.setManifestsSingleton)({page:w,clientReferenceManifest:P,serverActionsManifest:N});let j=e.method||"GET",K=(0,n.getTracer)(),$=K.getActiveScopeSpan(),B=!!(null==S?void 0:S.isWrappedByNextServer),F=!!(0,s.getRequestMeta)(e,"minimalMode"),Y=(0,s.getRequestMeta)(e,"incrementalCache")||await m.getIncrementalCache(e,E,C,F);null==Y||Y.resetRequestCache(),globalThis.__incrementalCache=Y;let G={params:y,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts,useCacheTimeout:E.experimental.useCacheTimeout},cacheComponents:!!E.cacheComponents,validationLevel:E.experimental.instantInsights.validationLevel,supportsDynamicResponse:k,incrementalCache:Y,hmrRefreshHash:(0,s.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:E.cacheLife,staticPageGenerationTimeout:E.staticPageGenerationTimeout,waitUntil:l.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,l,s)=>m.onRequestError(e,t,l,s,S)},sharedContext:{buildId:v,deploymentId:A}},X=new o.NodeNextRequest(e),V=new o.NodeNextResponse(t),J=d.NextRequestAdapter.fromNodeNextRequest(X,(0,d.signalFromNodeResponse)(t)),W=async({previousCacheEntry:a})=>{try{if(!F&&I&&_&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await m.handle(J,G);e.fetchMetrics=G.renderOpts.fetchMetrics;let n=G.renderOpts.pendingWaitUntil;n&&l.waitUntil&&(l.waitUntil(n),n=void 0);let r=G.renderOpts.collectedTags;if(!H)return await (0,p.sendResponse)(X,V,s,n),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);r&&(t[f.NEXT_CACHE_TAGS_HEADER]=r),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,l=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=f.INFINITE_CACHE?!1!==a&&a>0?E.expireTime:void 0:G.renderOpts.collectedExpire;return{value:{kind:T.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:l}}}}catch(t){throw(null==a?void 0:a.isStale)&&await m.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:I})},!1,S),t}},z=async(s,r)=>{try{var i,o;let s=await m.handleResponse({req:e,nextConfig:E,cacheKey:L,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:I,revalidateOnlyGenerated:_,responseGenerator:W,waitUntil:l.waitUntil,isMinimalMode:F});if(!H)return;if((null==s||null==(i=s.value)?void 0:i.kind)!==T.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==s||null==(o=s.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});F||t.setHeader("x-nextjs-cache",I?"REVALIDATED":s.isMiss?"MISS":s.isStale?"STALE":"HIT"),M&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let n=(0,h.fromNodeOutgoingHttpHeaders)(s.value.headers);F&&H||n.delete(f.NEXT_CACHE_TAGS_HEADER),!s.cacheControl||t.getHeader("Cache-Control")||n.get("Cache-Control")||n.set("Cache-Control",(0,g.getCacheControlHeader)(s.cacheControl)),await (0,p.sendResponse)(X,V,new Response(s.value.body,{headers:n,status:s.value.status||200}));return}catch(t){if(t instanceof b.NoFallbackError||await m.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:I})},!1,S),H)throw t;await (0,p.sendResponse)(X,V,new Response(null,{status:500}));return}finally{(()=>{if(!s)return;let e=t.statusCode;s.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(s.setStatus({code:n.SpanStatusCode.ERROR}),s.setAttribute("error.type",e.toString()));let a=K.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==c.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let l=a.get("next.route")||O,i=`${j} ${l}`;s.setAttributes({"next.route":l,"http.route":l,"next.span_name":i}),s.updateName(i),r&&r!==s&&(r.setAttribute("http.route",l),r.updateName(i))})()}};if(B&&$)await z($,void 0);else{let t=K.getActiveScopeSpan();await K.withPropagatedContext(e.headers,()=>K.trace(c.BaseServerSpan.handleRequest,{spanName:`${j} ${w}`,kind:n.SpanKind.SERVER,attributes:{"http.method":j,"http.target":e.url}},e=>z(e,t)),void 0,!B)}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,l.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:R})},"routeModule",0,m,"serverHooks",0,v,"workAsyncStorage",0,w,"workUnitAsyncStorage",0,R])},186304,e=>{"use strict";e.i(902157),e.i(912714);var t=e.i(750227),a=e.i(687388);(0,t.join)(a.APP_DIR,"guide");let l=".guide";e.s(["botGuideLine",0,()=>`How ${a.APP_NAME} itself works for the user — its screens and settings — is written under \`${l}/\` here, \`index.md\` first; read it only when the job is about the app.`,"guideLine",0,()=>`How ${a.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 \`${l}/\` 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.`])},22676,e=>e.a(async(t,a)=>{try{var l=e.i(875225),s=e.i(349129),n=e.i(518899),r=e.i(687388),i=e.i(528790),o=e.i(613240),d=e.i(911757),c=e.i(378884),u=e.i(340698),p=e.i(134344),h=t([i,c,u]);async function g(){let e=function(e){if(!e)return null;try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}(await (0,u.readConfig)(p.THURSDAY_KEYS.settings)),t=d.LiveSettingsSchema.parse((0,d.migrateLiveSettings)(e));return e?t:{...t,readSkills:await f()}}async function f(){return(await (0,u.readConfig)(p.THURSDAY_KEYS.wasSkills))?.trim()==="on"}async function b(e,t){return(await i.database.update(o.callTable).set({endedAt:new Date,...t?{endedReason:t.reason,seconds:t.seconds??null}:{}}).where((0,l.and)((0,l.eq)(o.callTable.id,e),(0,l.isNull)(o.callTable.endedAt))).returning({id:o.callTable.id})).length>0}async function T(e,t){for(let a of t)await i.database.insert(o.callMessageTable).values({callId:e,...a,fragments:a.fragments??null}).onConflictDoUpdate({target:[o.callMessageTable.callId,o.callMessageTable.id],set:{text:a.text,role:a.role,tool:a.tool??null,fragments:a.fragments??null}})}async function m(e){let[t]=await i.database.select({seq:n.sql`max(${o.callMessageTable.seq})`}).from(o.callMessageTable).where((0,l.eq)(o.callMessageTable.callId,e));return t?.seq==null?0:Number(t.seq)+1}async function w(e,t){await i.database.insert(o.callThoughtTable).values({callId:e,...t}).onConflictDoNothing()}async function R(e,t){let a=await i.database.select({callId:o.callMessageTable.callId,startedAt:o.callTable.startedAt,role:o.callMessageTable.role,tool:o.callMessageTable.tool,text:o.callMessageTable.text,seq:o.callMessageTable.seq}).from(o.callMessageTable).innerJoin(o.callTable,(0,l.eq)(o.callMessageTable.callId,o.callTable.id)).where(t?(0,l.ne)(o.callMessageTable.callId,t):void 0).orderBy((0,s.desc)(o.callTable.startedAt),(0,s.desc)(o.callMessageTable.seq)).limit(e),n=new Map;for(let e of a){let t=n.get(e.callId)??{callId:e.callId,startedAt:e.startedAt,turns:[]};t.turns.push({role:e.role,tool:e.tool,text:e.text,seq:e.seq}),n.set(e.callId,t)}return[...n.values()].reverse().map(e=>({...e,turns:e.turns.reverse()}))}async function v(){return(await i.database.select({id:o.callTable.id}).from(o.callTable).where((0,l.isNull)(o.callTable.endedAt)).limit(1)).length>0}async function A(e){let t=e.limit??r.CALL_HISTORY_PAGE,a=await i.database.select({id:o.callTable.id,provider:o.callTable.provider,model:o.callTable.model,backendModel:o.callTable.backendModel,startedAt:o.callTable.startedAt,endedAt:o.callTable.endedAt,endedReason:o.callTable.endedReason,seconds:o.callTable.seconds}).from(o.callTable).innerJoin(o.callMessageTable,(0,l.eq)(o.callMessageTable.callId,o.callTable.id)).where(e.before?(0,l.lt)(o.callTable.startedAt,e.before):void 0).groupBy(o.callTable.id).orderBy((0,s.desc)(o.callTable.startedAt)).limit(t);if(0===a.length)return[];let n=await i.database.select({callId:o.callMessageTable.callId,id:o.callMessageTable.id,role:o.callMessageTable.role,tool:o.callMessageTable.tool,text:o.callMessageTable.text,seq:o.callMessageTable.seq,fragments:o.callMessageTable.fragments,at:o.callMessageTable.at}).from(o.callMessageTable).where((0,l.inArray)(o.callMessageTable.callId,a.map(e=>e.id))).orderBy((0,s.asc)(o.callMessageTable.callId),(0,s.asc)(o.callMessageTable.seq)),d=new Map;for(let e of n){let{callId:t,...a}=e,l=d.get(t);l?l.push(a):d.set(t,[a])}let u=await (0,c.listCallJobs)(a.map(e=>e.id));return a.map(e=>({...e,turns:d.get(e.id)??[],jobs:u.filter(t=>t.callId===e.id).map(e=>({id:e.id,label:e.label,status:e.status,outcome:e.outcome}))}))}[i,c,u]=h.then?(await h)():h,e.s(["endCall",0,b,"isAnyCallLive",0,v,"listCallHistory",0,A,"listRecentTurns",0,R,"nextTurnSeq",0,m,"readLiveSettings",0,g,"saveThought",0,w,"saveTurns",0,T]),a()}catch(e){a(e)}},!1),134344,e=>{"use strict";var t=e.i(105249),a=e.i(264079),l=e.i(904309);let s=[{id:"chatgpt",...a.TEXT_MODEL_PROVIDERS.chatgpt},{id:"openai",...a.TEXT_MODEL_PROVIDERS.openai}],n=t.default.object({id:t.default.string().min(1),text:t.default.string(),said:t.default.boolean()}),r="note",i=e=>e.type===`data-${r}`?e.data:null;t.default.object({enabled:t.default.boolean(),phrase:t.default.string().trim().min(3).max(32)}),t.default.object({enabled:t.default.boolean(),combo:t.default.string().trim().min(1).max(64)}),t.default.enum(["off","waiting","any"]),t.default.enum(["center","sides"]),t.default.object({id:t.default.string().min(1),role:t.default.enum(["user","assistant","tool"]),tool:t.default.string().nullish(),text:t.default.string(),seq:t.default.number().int().min(0),fragments:t.default.array(l.LiveFragmentSchema).nullish()}),t.default.object({id:t.default.string().min(1),text:t.default.string(),seq:t.default.number().int().min(0)}),e.s(["TEXT_CALL_NOTE",0,r,"TEXT_CALL_PROVIDERS",0,s,"THURSDAY_KEYS",0,{settings:"THURSDAY_SETTINGS",wasSkills:"THURSDAY_SKILLS"},"TextCallNoteSchema",0,n,"noteOf",0,i,"notesIn",0,e=>e.flatMap(e=>e.parts.flatMap(e=>{let t=i(e);return t?[t]:[]})),"textCallRunsOn",0,e=>s.find(t=>e(t.apiKeyName))?.id??null])}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=_1mx9sfo._.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
module.exports=[159479,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(983477),r=e.i(687388),o=e.i(386075),s=e.i(54282),l=e.i(316172),h=e.i(349047),c=e.i(625441),d=e.i(170801),u=e.i(926435),m=e.i(770639),w=e.i(418919),p=e.i(489956),f=e.i(740852),y=e.i(205863),g=e.i(41181),b=e.i(353885),S=e.i(123203),T=e.i(944971),O=e.i(636882),$=e.i(786025),k=e.i(704161),_=e.i(640911),v=e.i(53748),A=e.i(388439),M=e.i(41444),E=t([o,l,u,m,w,p,f,g,O]);async function N(t){let{listThreadOverview:a}=await e.A(866938),i=await a();if(!i.length)return"No thread has been started yet.";let n=i.map(e=>`"${e.label}" (${e.bot}, ${e.status})`).join(", ");return`There is no thread called "${t}". The latest are: ${n}. Call again with one of those labels.`}async function x(e,t){let a=[];for(let[e,n]of Object.entries(t)){let t=await (0,i.asSchema)(n.inputSchema).jsonSchema,r="string"==typeof n.description?n.description:"";a.push({name:e,tokens:(0,A.estimateTokens)(r)+(0,A.estimateTokens)(JSON.stringify(t))})}a.sort((e,t)=>t.tokens-e.tokens);let n=a.reduce((e,t)=>e+t.tokens,0);_.logger.debug(`${e} tools ${n} tokens over ${a.length} — ${a.map(e=>`${e.name} ${e.tokens}`).join(", ")}`)}async function L(e){let t=await j(e);return r.IS_DEV&&await x(e.target,t),t}async function j(t){if("memory-edit"===t.target)return(0,m.createMemoryTools)("user",null,{countReads:!1});let a=(0,m.createMemoryTools)("call","thursday"===t.target?t.callId??null:null),_=await (0,$.openWorkspace)();if("thursday"===t.target){var A;let c,u,m=t.readSkills?(0,g.createSkillTools)({sandbox:_,skills:await (0,O.loadSkills)(_)}):{},f=!!(t.written&&t.model&&(0,o.seesToolImages)(t.model));return{...a,...m,...(0,S.createWorkspaceTools)(_,{write:!1,timeoutMs:r.CALL_EXEC_TIMEOUT_MS}),...!1===t.webSearch?{}:await (0,p.createCallSearchTool)(_),...Object.fromEntries(Object.entries((A=t.callId,c=async t=>{let{resolveThread:a}=await e.A(866938);return(t.trim()?await a(t.trim()):null)??await N(t)},u=async(t,a,i)=>{let n=await e.A(994193);try{return await n.answerThread(t,a,"thursday",i)}catch(e){if((0,v.isPublicError)(e))return e.message;throw e}},{[b.TOOL_NAMES.thread_start]:(0,i.tool)({description:l.threadStartSpec.description,inputSchema:l.threadStartSpec.parameters,execute:async({bot:t,request:a,label:i})=>{let{findJobBot:n,listJobBots:r}=await e.A(814317),o=await n(t);if(!o||o.disabled){let e=(await r()).map(e=>e.name);return`There is no bot called "${t}". The bots are: ${e.join(", ")}. Nothing was started — call again with one of those.`}let{startThread:s}=await e.A(994193);return{threadId:await s({bot:o.name,request:a,label:i,callId:A,from:"thursday"}),note:`${o.name} has "${i}". Its updates reach the conversation on their own. Anything further about this work — a correction, the next step once it finishes — is \`${b.TOOL_NAMES.thread_tell}\` with "${i}"; a question it asks is answered with \`${b.TOOL_NAMES.thread_answer}\`.`}}}),[b.TOOL_NAMES.thread_tell]:(0,i.tool)({description:l.threadTellSpec.description,inputSchema:l.threadTellSpec.parameters,execute:async({thread:e,words:t})=>{let a=await c(e);if("string"==typeof a)return a;if(!t.trim())return"Say what to pass on.";let i=await u(a.id,t.trim());return"string"==typeof i?i:i?.answered?{label:a.label,answered:i.answered,note:`${i.answered.bot} was waiting on a question, and took this as its answer.`}:{label:a.label,bot:i?.to??a.bot,status:"running",note:"running"===a.status?"The bot reads it before its next step.":"The bot picks the thread back up from there."}}}),[b.TOOL_NAMES.thread_answer]:(0,i.tool)({description:l.threadAnswerSpec.description,inputSchema:l.threadAnswerSpec.parameters,execute:async({thread:t,bot:a,answer:i})=>{let n=await c(t);if("string"==typeof n)return n;if(!i.trim())return"Say what the answer is.";let{findThreadView:r}=await e.A(866938),o=(await r(n.id))?.room.questions??[],s=o.find(e=>e.bot.toLowerCase()===a.trim().toLowerCase());if(!s)return o.length?`${a} is not asking anything in "${n.label}". Waiting there: ${o.map(e=>e.bot).join(", ")}. Call again with that bot.`:`No question is waiting in "${n.label}". To say something else to it, use \`${b.TOOL_NAMES.thread_tell}\`.`;let l=await u(n.id,i.trim(),s.bot);return"string"==typeof l?l:{label:n.label,answered:l?.answered??{bot:s.bot,question:s.text},note:`${s.bot} has the answer to its question and goes on from it.`}}}),[b.TOOL_NAMES.thread_status]:(0,i.tool)({description:l.threadStatusSpec.description,inputSchema:l.threadStatusSpec.parameters,execute:async({thread:t})=>{let{listThreadOverview:a,findThreadView:i}=await e.A(866938),o={now:(0,s.clockNow)()},l=e=>(0,n.formatDistanceToNowStrict)((0,k.toDate)(e),{addSuffix:!0});if(!(!t.trim()||"all"===t.trim().toLowerCase())){let e=await c(t);if("string"==typeof e)return e;let a=(await i(e.id))?.room;return{...o,label:e.label,id:e.id,bot:e.bot,participants:a?.participants??[],questions:a?.questions??[],status:e.status,since:l(e.updatedAt),outcome:e.outcome,..."waiting"===e.status&&e.pending?.options.length?{options:e.pending.options}:{}}}let h=await a();return h.length?{...o,threads:h.map(e=>({id:e.id,label:e.label,bot:e.bot,status:e.status,participants:e.room.participants,questions:e.room.questions.map(e=>({...e,text:(0,M.clip)(e.text,r.PROMPT_LINE.threadStatus)})),since:l(e.updatedAt),...e.ask?{asking:e.ask.question,options:e.ask.options}:{},..."running"===e.status?{now:(0,T.threadActivity)(e.lines)}:{},...e.outcome&&"waiting"!==e.status?{outcome:(0,M.clip)(e.outcome,r.PROMPT_LINE.threadStatus)}:{}}))}:"No thread has been started yet."}}),[b.TOOL_NAMES.thread_cancel]:(0,i.tool)({description:l.threadCancelSpec.description,inputSchema:l.threadCancelSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{cancelThread:i}=await e.A(994193);return await i(a.id),{label:a.label,status:"cancelled"}}}),[b.TOOL_NAMES.thread_show]:(0,i.tool)({description:l.threadShowSpec.description,inputSchema:l.threadShowSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{appEvents:i}=await e.A(522275),{filesOnDisk:n}=await e.A(149325),{leadFirst:r,pathsIn:o,viewKindOf:s}=await e.A(628124),l=(await n(o(a.outcome??""),null)).filter(e=>"none"!==s(e));if(!l.length)return i.emit({type:"showThread",threadId:a.id}),{label:a.label,showing:"the thread"};let h=r(l);i.emit({type:"showFile",paths:h});let{markSeen:d}=await e.A(866938);return await d([a.id]),{label:a.label,showing:h[0]}}}),[b.TOOL_NAMES.thread_seen]:(0,i.tool)({description:l.threadSeenSpec.description,inputSchema:l.threadSeenSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{markSeen:i}=await e.A(866938);return await i([a.id]),{label:a.label,seen:!0}}})})).filter(([e])=>!(t.phone&&e===b.TOOL_NAMES.thread_show))),...(0,w.createRoutineTools)(),...f?(0,d.createLookTool)():{},...t.written?{}:(0,h.callTools)()}}let E=await (0,O.loadSkills)(_,t.bot),x={...(0,$.jobShellEnv)(t.session),...(0,$.botShellEnv)(t.bot,(await (await e.A(814317)).findJobBot(t.bot))?.icon)},L=!!(t.model&&(0,o.seesToolImages)(t.model.ref));return{[b.TOOL_NAMES.memory_recall]:a[b.TOOL_NAMES.memory_recall],...await (0,p.createSearchTool)(t.model,_),...(0,S.createWorkspaceTools)(_,{write:!0,env:x,guide:!0,bot:t.bot}),...await (0,u.createMcpTools)(t.bot,_),...(0,g.createSkillTools)({sandbox:_,skills:E,bot:t.bot}),...await (0,f.createSelfTools)(t.bot),...(0,c.createDeckTools)(_,t.bot,x,L),...L?(0,d.createLookTool)():{},...(0,y.createSignInTools)(_,t.bot,(0,$.jobShellEnv)(t.session)),...await (0,l.createThreadRecallTool)(t.bot,t.thread??null)}}[o,l,u,m,w,p,f,g,O]=E.then?(await E)():E,e.s(["loadTools",0,L]),a()}catch(e){a(e)}},!1),54282,e=>{"use strict";var t=e.i(343747),a=e.i(983477),i=e.i(687388),n=e.i(353885),r=e.i(280809);n.TOOL_NAMES.memory_recall,n.TOOL_NAMES.memory_create,n.TOOL_NAMES.memory_remember,n.TOOL_NAMES.memory_describe,n.TOOL_NAMES.memory_forget,n.TOOL_NAMES.bash,n.TOOL_NAMES.web_search,n.TOOL_NAMES.load_skill,n.TOOL_NAMES.look_at,n.TOOL_NAMES.make_deck,n.TOOL_NAMES.end_call,n.TOOL_NAMES.routine,n.TOOL_NAMES.thread_tell,n.TOOL_NAMES.thread_answer,n.TOOL_NAMES.thread_status,n.TOOL_NAMES.thread_show,n.TOOL_NAMES.thread_cancel,n.TOOL_NAMES.thread_seen;var o=e.i(704161),s=e.i(640911),l=e.i(388439),h=e.i(41444);let c=(e=new Date)=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} ${Intl.DateTimeFormat().resolvedOptions().timeZone}`,d=(e=new Date)=>`**Now**: ${c(e)}`,u=e=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} (${(0,a.formatDistanceToNowStrict)(e,{addSuffix:!0})})`,m={[n.STUDIO_TOOLS.generate_image]:"images",[n.STUDIO_TOOLS.generate_speech]:"speech",[n.STUDIO_TOOLS.transcribe]:"transcription",[n.STUDIO_TOOLS.generate_video]:"video"};e.s(["botWorkHead",0,function(e,i){let n=(0,a.formatDistanceToNowStrict)(e.updatedAt,{addSuffix:!0}),r="running"===e.status?`running, last moved ${n}`:e.asking?`waiting on the user's answer since ${n}`:"waiting"===e.status?`stopped ${n}, not finished`:`${"done"===e.status?"ended":"stopped by the user"} ${(0,t.format)(e.updatedAt,"yyyy-MM-dd")}`;return`"${e.label}" — ${e.owner===i?"yours":`${e.owner}'s`} — ${r}`},"clockNow",0,c,"logPromptSize",0,function(e,t){let a=(0,l.sectionTokens)(t),n=a.reduce((e,t)=>e+t.tokens,0);s.logger.debug(`${e} prompt ${n} tokens — ${a.map(e=>`${e.name} ${e.tokens}`).join(", ")}`);let r=a[0];n>i.PROMPT_BUDGET&&r&&s.logger.warn(`${e} prompt is ${n} tokens, over ${i.PROMPT_BUDGET}: ${r.name} carries ${r.tokens} of it. Every call and every job pays this.`)},"mcpToolLines",0,function(e){let t=new Map;for(let a of e){let e=t.get(a.server);e?e.push(a.name):t.set(a.server,[a.name])}return[...t].map(([e,t])=>`- **${e}**: ${t.join(", ")}`).join("\n")},"noteLines",0,function(e,t=!1){return e.length?e.map(e=>{var a;let i,n=t?` \xb7 ${a=e.lastSeenAt,(i=Math.floor((Date.now()-(0,o.toDate)(a).getTime())/864e5))>=365?`${Math.floor(i/365)}y`:i>=30?`${Math.floor(i/30)}mo`:`${Math.max(i,0)}d`}`:"";return`- ${e.path} — ${e.description?.trim()} (${e.factCount})${n}`}).join("\n"):"(nothing saved yet)"},"nowLine",0,d,"reachNames",0,function(e,t){let a=t.map(e=>e.server===i.STUDIO_SERVER?m[e.name]??e.name:e.server);return[...new Set([...e.map(e=>e.name),...a])].join(", ")},"recentCallLines",0,function(e,t){let a=[],r=0;e:for(let o=e.length-1;o>=0;o--){let s=e[o];for(let e=s.turns.length-1;e>=0;e--){let o=function(e,t){if("tool"!==e.role)return`${"user"===e.role?"user":"you"}: ${e.text}`;let a=function(e,t){if(e!==n.TOOL_NAMES.web_search)return null;try{var a;let e=JSON.parse(t);return{query:"string"==typeof e.query?e.query:null,sources:(a=e.sources,Array.isArray(a)?a.flatMap(e=>e&&"object"==typeof e&&"string"==typeof e.url?[e]:[]):[])}}catch{return null}}(e.tool,e.text);if(a){let t=[...new Set(a.sources.flatMap(e=>(0,h.hostOf)(e.url)??[]))];return`you → ${e.tool} "${(0,h.clip)(a.query??"",i.PROMPT_LINE.toolArgs)}"${t.length?` — ${t.join(", ")}`:""}`}let r=`you → ${e.tool??"tool"} ${(0,h.clip)(e.text,i.PROMPT_LINE.toolArgs)}`;if(e.tool!==n.TOOL_NAMES.thread_start)return r;let o=function(e,t){if(e!==n.TOOL_NAMES.thread_start)return null;try{let e=JSON.parse(t);return"string"==typeof e.label?e.label:null}catch{return null}}(e.tool,e.text),s=o?t.jobs?.find(e=>e.label===o):void 0;if(!s)return r;let l=s.outcome?`: ${(0,h.clip)(s.outcome,i.PROMPT_LINE.jobOutcome)}`:"";return`you → ${e.tool} "${s.label}" (${s.id}) — ${s.status}${l}`}(s.turns[e],s),c=(0,l.estimateTokens)(o)+3;if(r+c>t&&a.length)break e;r+=c,a.push({call:s,line:o})}}a.reverse();let o=[],s=null;for(let{call:e,line:t}of a)e!==s&&(s=e,o.push(`### ${u(e.startedAt)}`)),o.push(t);return o.join("\n")},"saidStamp",0,e=>(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm"),"skillLines",0,(e,t={})=>e.map(e=>{var a;let n,o;return`- **${e.name}**: ${t.short?(a=e.description,n=i.PROMPT_LINE.skill,(o=(0,r.firstSentence)(a)).length>n?`${o.slice(0,n).trim()}…`:o):e.description}`}).join("\n"),"styleLines",0,e=>e?.trim()?`## Who they want you to be
|
|
1
|
+
module.exports=[159479,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(983477),r=e.i(687388),o=e.i(386075),s=e.i(54282),l=e.i(316172),h=e.i(349047),c=e.i(625441),d=e.i(170801),u=e.i(926435),m=e.i(770639),w=e.i(418919),p=e.i(489956),f=e.i(740852),y=e.i(205863),g=e.i(41181),b=e.i(353885),S=e.i(123203),T=e.i(944971),O=e.i(636882),$=e.i(786025),k=e.i(704161),_=e.i(640911),v=e.i(53748),A=e.i(388439),M=e.i(41444),E=t([o,l,u,m,w,p,f,g,O]);async function N(t){let{listThreadOverview:a}=await e.A(866938),i=await a();if(!i.length)return"No thread has been started yet.";let n=i.map(e=>`"${e.label}" (${e.bot}, ${e.status})`).join(", ");return`There is no thread called "${t}". The latest are: ${n}. Call again with one of those labels.`}async function x(e,t){let a=[];for(let[e,n]of Object.entries(t)){let t=await (0,i.asSchema)(n.inputSchema).jsonSchema,r="string"==typeof n.description?n.description:"";a.push({name:e,tokens:(0,A.estimateTokens)(r)+(0,A.estimateTokens)(JSON.stringify(t))})}a.sort((e,t)=>t.tokens-e.tokens);let n=a.reduce((e,t)=>e+t.tokens,0);_.logger.debug(`${e} tools ${n} tokens over ${a.length} — ${a.map(e=>`${e.name} ${e.tokens}`).join(", ")}`)}async function L(e){let t=await j(e);return r.IS_DEV&&await x(e.target,t),t}async function j(t){if("memory-edit"===t.target)return(0,m.createMemoryTools)("user",null,{countReads:!1});let a=(0,m.createMemoryTools)("call","thursday"===t.target?t.callId??null:null),_=await (0,$.openWorkspace)();if("thursday"===t.target){var A;let c,u,m=t.readSkills?(0,g.createSkillTools)({sandbox:_,skills:await (0,O.loadSkills)(_)}):{},f=!!(t.written&&t.model&&(0,o.seesToolImages)(t.model));return{...a,...m,...(0,S.createWorkspaceTools)(_,{write:!1,timeoutMs:r.CALL_EXEC_TIMEOUT_MS}),...!1===t.webSearch?{}:await (0,p.createCallSearchTool)(_),...Object.fromEntries(Object.entries((A=t.callId,c=async t=>{let{resolveThread:a}=await e.A(866938);return(t.trim()?await a(t.trim()):null)??await N(t)},u=async(t,a,i)=>{let n=await e.A(994193);try{return await n.answerThread(t,a,"thursday",i)}catch(e){if((0,v.isPublicError)(e))return e.message;throw e}},{[b.TOOL_NAMES.thread_start]:(0,i.tool)({description:l.threadStartSpec.description,inputSchema:l.threadStartSpec.parameters,execute:async({bot:t,request:a,label:i})=>{let{findJobBot:n,listJobBots:r}=await e.A(814317),o=await n(t);if(!o||o.disabled){let e=(await r()).map(e=>e.name);return`There is no bot called "${t}". The bots are: ${e.join(", ")}. Nothing was started — call again with one of those.`}let{startThread:s}=await e.A(994193);return{threadId:await s({bot:o.name,request:a,label:i,callId:A,from:"thursday"}),bot:o.name,label:i,note:`${o.name} has "${i}". Its updates reach the conversation on their own. Anything further about this work — a correction, the next step once it finishes — is \`${b.TOOL_NAMES.thread_tell}\` with "${i}"; a question it asks is answered with \`${b.TOOL_NAMES.thread_answer}\`.`}}}),[b.TOOL_NAMES.thread_tell]:(0,i.tool)({description:l.threadTellSpec.description,inputSchema:l.threadTellSpec.parameters,execute:async({thread:e,words:t})=>{let a=await c(e);if("string"==typeof a)return a;if(!t.trim())return"Say what to pass on.";let i=await u(a.id,t.trim());return"string"==typeof i?i:i?.answered?{label:a.label,answered:i.answered,note:`${i.answered.bot} was waiting on a question, and took this as its answer.`}:{label:a.label,bot:i?.to??a.bot,status:"running",note:"running"===a.status?"The bot reads it before its next step.":"The bot picks the thread back up from there."}}}),[b.TOOL_NAMES.thread_answer]:(0,i.tool)({description:l.threadAnswerSpec.description,inputSchema:l.threadAnswerSpec.parameters,execute:async({thread:t,bot:a,answer:i})=>{let n=await c(t);if("string"==typeof n)return n;if(!i.trim())return"Say what the answer is.";let{findThreadView:r}=await e.A(866938),o=(await r(n.id))?.room.questions??[],s=o.find(e=>e.bot.toLowerCase()===a.trim().toLowerCase());if(!s)return o.length?`${a} is not asking anything in "${n.label}". Waiting there: ${o.map(e=>e.bot).join(", ")}. Call again with that bot.`:`No question is waiting in "${n.label}". To say something else to it, use \`${b.TOOL_NAMES.thread_tell}\`.`;let l=await u(n.id,i.trim(),s.bot);return"string"==typeof l?l:{label:n.label,answered:l?.answered??{bot:s.bot,question:s.text},note:`${s.bot} has the answer to its question and goes on from it.`}}}),[b.TOOL_NAMES.thread_status]:(0,i.tool)({description:l.threadStatusSpec.description,inputSchema:l.threadStatusSpec.parameters,execute:async({thread:t})=>{let{listThreadOverview:a,findThreadView:i}=await e.A(866938),o={now:(0,s.clockNow)()},l=e=>(0,n.formatDistanceToNowStrict)((0,k.toDate)(e),{addSuffix:!0});if(!(!t.trim()||"all"===t.trim().toLowerCase())){let e=await c(t);if("string"==typeof e)return e;let a=(await i(e.id))?.room;return{...o,label:e.label,id:e.id,bot:e.bot,participants:a?.participants??[],questions:a?.questions??[],status:e.status,since:l(e.updatedAt),outcome:e.outcome,..."waiting"===e.status&&e.pending?.options.length?{options:e.pending.options}:{}}}let h=await a();return h.length?{...o,threads:h.map(e=>({id:e.id,label:e.label,bot:e.bot,status:e.status,participants:e.room.participants,questions:e.room.questions.map(e=>({...e,text:(0,M.clip)(e.text,r.PROMPT_LINE.threadStatus)})),since:l(e.updatedAt),...e.ask?{asking:e.ask.question,options:e.ask.options}:{},..."running"===e.status?{now:(0,T.threadActivity)(e.lines)}:{},...e.outcome&&"waiting"!==e.status?{outcome:(0,M.clip)(e.outcome,r.PROMPT_LINE.threadStatus)}:{}}))}:"No thread has been started yet."}}),[b.TOOL_NAMES.thread_cancel]:(0,i.tool)({description:l.threadCancelSpec.description,inputSchema:l.threadCancelSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{cancelThread:i}=await e.A(994193);return await i(a.id),{label:a.label,status:"cancelled"}}}),[b.TOOL_NAMES.thread_show]:(0,i.tool)({description:l.threadShowSpec.description,inputSchema:l.threadShowSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{appEvents:i}=await e.A(522275),{filesOnDisk:n}=await e.A(149325),{leadFirst:r,pathsIn:o,viewKindOf:s}=await e.A(628124),l=(await n(o(a.outcome??""),null)).filter(e=>"none"!==s(e));if(!l.length)return i.emit({type:"showThread",threadId:a.id}),{label:a.label,showing:"the thread"};let h=r(l);i.emit({type:"showFile",paths:h});let{markSeen:d}=await e.A(866938);return await d([a.id]),{label:a.label,showing:h[0]}}}),[b.TOOL_NAMES.thread_seen]:(0,i.tool)({description:l.threadSeenSpec.description,inputSchema:l.threadSeenSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{markSeen:i}=await e.A(866938);return await i([a.id]),{label:a.label,seen:!0}}})})).filter(([e])=>!(t.phone&&e===b.TOOL_NAMES.thread_show))),...(0,w.createRoutineTools)(),...f?(0,d.createLookTool)():{},...t.written?{}:(0,h.callTools)()}}let E=await (0,O.loadSkills)(_,t.bot),x={...(0,$.jobShellEnv)(t.session),...(0,$.botShellEnv)(t.bot,(await (await e.A(814317)).findJobBot(t.bot))?.icon)},L=!!(t.model&&(0,o.seesToolImages)(t.model.ref));return{[b.TOOL_NAMES.memory_recall]:(0,m.createMemoryTools)("call",null,{tidies:!1})[b.TOOL_NAMES.memory_recall],...await (0,p.createSearchTool)(t.model,_),...(0,S.createWorkspaceTools)(_,{write:!0,env:x,guide:!0,bot:t.bot}),...await (0,u.createMcpTools)(t.bot,_),...(0,g.createSkillTools)({sandbox:_,skills:E,bot:t.bot}),...await (0,f.createSelfTools)(t.bot),...(0,c.createDeckTools)(_,t.bot,x,L),...L?(0,d.createLookTool)():{},...(0,y.createSignInTools)(_,t.bot,(0,$.jobShellEnv)(t.session)),...await (0,l.createThreadRecallTool)(t.bot,t.thread??null)}}[o,l,u,m,w,p,f,g,O]=E.then?(await E)():E,e.s(["loadTools",0,L]),a()}catch(e){a(e)}},!1),54282,e=>{"use strict";var t=e.i(343747),a=e.i(983477),i=e.i(687388),n=e.i(353885),r=e.i(280809);n.TOOL_NAMES.memory_recall,n.TOOL_NAMES.memory_create,n.TOOL_NAMES.memory_remember,n.TOOL_NAMES.memory_describe,n.TOOL_NAMES.memory_forget,n.TOOL_NAMES.bash,n.TOOL_NAMES.web_search,n.TOOL_NAMES.load_skill,n.TOOL_NAMES.look_at,n.TOOL_NAMES.make_deck,n.TOOL_NAMES.end_call,n.TOOL_NAMES.routine,n.TOOL_NAMES.thread_tell,n.TOOL_NAMES.thread_answer,n.TOOL_NAMES.thread_status,n.TOOL_NAMES.thread_show,n.TOOL_NAMES.thread_cancel,n.TOOL_NAMES.thread_seen;var o=e.i(704161),s=e.i(640911),l=e.i(388439),h=e.i(41444);let c=(e=new Date)=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} ${Intl.DateTimeFormat().resolvedOptions().timeZone}`,d=(e=new Date)=>`**Now**: ${c(e)}`,u=e=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} (${(0,a.formatDistanceToNowStrict)(e,{addSuffix:!0})})`,m={[n.STUDIO_TOOLS.generate_image]:"images",[n.STUDIO_TOOLS.generate_speech]:"speech",[n.STUDIO_TOOLS.transcribe]:"transcription",[n.STUDIO_TOOLS.generate_video]:"video"};e.s(["botWorkHead",0,function(e,i){let n=(0,a.formatDistanceToNowStrict)(e.updatedAt,{addSuffix:!0}),r="running"===e.status?`running, last moved ${n}`:e.asking?`waiting on the user's answer since ${n}`:"waiting"===e.status?`stopped ${n}, not finished`:`${"done"===e.status?"ended":"stopped by the user"} ${(0,t.format)(e.updatedAt,"yyyy-MM-dd")}`;return`"${e.label}" — ${e.owner===i?"yours":`${e.owner}'s`} — ${r}`},"clockNow",0,c,"logPromptSize",0,function(e,t){let a=(0,l.sectionTokens)(t),n=a.reduce((e,t)=>e+t.tokens,0);s.logger.debug(`${e} prompt ${n} tokens — ${a.map(e=>`${e.name} ${e.tokens}`).join(", ")}`);let r=a[0];n>i.PROMPT_BUDGET&&r&&s.logger.warn(`${e} prompt is ${n} tokens, over ${i.PROMPT_BUDGET}: ${r.name} carries ${r.tokens} of it. Every call and every job pays this.`)},"mcpToolLines",0,function(e){let t=new Map;for(let a of e){let e=t.get(a.server);e?e.push(a.name):t.set(a.server,[a.name])}return[...t].map(([e,t])=>`- **${e}**: ${t.join(", ")}`).join("\n")},"noteLines",0,function(e,t=!1){return e.length?e.map(e=>{var a;let i,n=t?` \xb7 ${a=e.lastSeenAt,(i=Math.floor((Date.now()-(0,o.toDate)(a).getTime())/864e5))>=365?`${Math.floor(i/365)}y`:i>=30?`${Math.floor(i/30)}mo`:`${Math.max(i,0)}d`}`:"";return`- ${e.path} — ${e.description?.trim()} (${e.factCount})${n}`}).join("\n"):"(nothing saved yet)"},"nowLine",0,d,"reachNames",0,function(e,t){let a=t.map(e=>e.server===i.STUDIO_SERVER?m[e.name]??e.name:e.server);return[...new Set([...e.map(e=>e.name),...a])].join(", ")},"recentCallLines",0,function(e,t){let a=[],r=0;e:for(let o=e.length-1;o>=0;o--){let s=e[o];for(let e=s.turns.length-1;e>=0;e--){let o=function(e,t){if("tool"!==e.role)return`${"user"===e.role?"user":"you"}: ${e.text}`;let a=function(e,t){if(e!==n.TOOL_NAMES.web_search)return null;try{var a;let e=JSON.parse(t);return{query:"string"==typeof e.query?e.query:null,sources:(a=e.sources,Array.isArray(a)?a.flatMap(e=>e&&"object"==typeof e&&"string"==typeof e.url?[e]:[]):[])}}catch{return null}}(e.tool,e.text);if(a){let t=[...new Set(a.sources.flatMap(e=>(0,h.hostOf)(e.url)??[]))];return`you → ${e.tool} "${(0,h.clip)(a.query??"",i.PROMPT_LINE.toolArgs)}"${t.length?` — ${t.join(", ")}`:""}`}let r=`you → ${e.tool??"tool"} ${(0,h.clip)(e.text,i.PROMPT_LINE.toolArgs)}`;if(e.tool!==n.TOOL_NAMES.thread_start)return r;let o=function(e,t){if(e!==n.TOOL_NAMES.thread_start)return null;try{let e=JSON.parse(t);return"string"==typeof e.label?e.label:null}catch{return null}}(e.tool,e.text),s=o?t.jobs?.find(e=>e.label===o):void 0;if(!s)return r;let l=s.outcome?`: ${(0,h.clip)(s.outcome,i.PROMPT_LINE.jobOutcome)}`:"";return`you → ${e.tool} "${s.label}" (${s.id}) — ${s.status}${l}`}(s.turns[e],s),c=(0,l.estimateTokens)(o)+3;if(r+c>t&&a.length)break e;r+=c,a.push({call:s,line:o})}}a.reverse();let o=[],s=null;for(let{call:e,line:t}of a)e!==s&&(s=e,o.push(`### ${u(e.startedAt)}`)),o.push(t);return o.join("\n")},"saidStamp",0,e=>(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm"),"skillLines",0,(e,t={})=>e.map(e=>{var a;let n,o;return`- **${e.name}**: ${t.short?(a=e.description,n=i.PROMPT_LINE.skill,(o=(0,r.firstSentence)(a)).length>n?`${o.slice(0,n).trim()}…`:o):e.description}`}).join("\n"),"styleLines",0,e=>e?.trim()?`## Who they want you to be
|
|
2
2
|
|
|
3
3
|
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.
|
|
4
4
|
|
|
5
5
|
${e.trim()}`:"","thursdayIdentity",0,(e=new Date)=>`You are Thursday, this user's own: their friend first, and their assistant second — someone they call because they want to talk to you, who can also get whatever they need done in the background. Named after Friday, the AI in *Iron Man*: a name, not a day of the week. ${d(e)}
|
|
6
6
|
|
|
7
|
-
What they tell you is kept, so you know them better over time.`,"tidying",0,e=>({crowded:e.reduce((e,t)=>e+t.factCount,0)>i.MEMORY_LIMITS.facts,heavy:e.filter(e=>e.factCount>i.MEMORY_LIMITS.factsPerNote)})],54282)},316172,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(54282),s=e.i(353885),l=e.i(944971),h=e.i(889034),c=e.i(378884),d=e.i(41444),u=t([c]);[c]=u.then?(await u)():u;let w=n.string().describe("Its label or id."),p={description:"Start a new thread: hand work to a bot. Returns a receipt at once; the work runs in the background and its updates reach the conversation on their own.",parameters:n.object({bot:n.string().describe("A name from the bot list."),request:n.string().describe("The whole of the work. The bot cannot hear the call, so everything it needs goes here — names, paths, what the user actually asked for — in their own language and their own words: it is the only language the bot has, and whatever it writes comes back to them. **Their request, never your reading of it**: a condition, a caution or a smaller goal they did not say is how work comes back as the wrong thing. When their words leave a real choice open, ask them on the call and put the answer here."),label:n.string().describe("Two or three words naming the thread, in the user's language. Used on screen and said out loud.")})},f={description:"Say something to a thread that exists. Its bot reads it with everything the thread already holds.",parameters:n.object({thread:w,words:n.string().describe("What to tell its bot, in the user's language and words.")})},y={description:`Answer a question a bot asked the user. Only for a question that is waiting; anything else said to a thread is \`${s.TOOL_NAMES.thread_tell}\`.`,parameters:n.object({thread:w,bot:n.string().describe("The bot that asked."),answer:n.string().describe("The user's answer, in their words.")})},g={description:`Read threads as they are now. "all" lists up to ${r.THREAD_STATUS_LIMIT}, running and waiting work before recent endings; a label or an id reads that one whole, with its result and any question waiting.`,parameters:n.object({thread:n.string().describe('"all", or one thread by its label or its id.')})},b={description:"Stop a thread
|
|
7
|
+
What they tell you is kept, so you know them better over time.`,"tidying",0,e=>({crowded:e.reduce((e,t)=>e+t.factCount,0)>i.MEMORY_LIMITS.facts,heavy:e.filter(e=>e.factCount>i.MEMORY_LIMITS.factsPerNote)})],54282)},316172,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(54282),s=e.i(353885),l=e.i(944971),h=e.i(889034),c=e.i(378884),d=e.i(41444),u=t([c]);[c]=u.then?(await u)():u;let w=n.string().describe("Its label or id."),p={description:"Start a new thread: hand work to a bot. Returns a receipt at once; the work runs in the background and its updates reach the conversation on their own.",parameters:n.object({bot:n.string().describe("A name from the bot list."),request:n.string().describe("The whole of the work. The bot cannot hear the call, so everything it needs goes here — names, paths, what the user actually asked for — in their own language and their own words: it is the only language the bot has, and whatever it writes comes back to them. **Their request, never your reading of it**: a condition, a caution or a smaller goal they did not say is how work comes back as the wrong thing. When their words leave a real choice open, ask them on the call and put the answer here."),label:n.string().describe("Two or three words naming the thread, in the user's language. Used on screen and said out loud.")})},f={description:"Say something to a thread that exists. Its bot reads it with everything the thread already holds.",parameters:n.object({thread:w,words:n.string().describe("What to tell its bot, in the user's language and words.")})},y={description:`Answer a question a bot asked the user. Only for a question that is waiting; anything else said to a thread is \`${s.TOOL_NAMES.thread_tell}\`.`,parameters:n.object({thread:w,bot:n.string().describe("The bot that asked."),answer:n.string().describe("The user's answer, in their words.")})},g={description:`Read threads as they are now. "all" lists up to ${r.THREAD_STATUS_LIMIT}, running and waiting work before recent endings; a label or an id reads that one whole, with its result and any question waiting.`,parameters:n.object({thread:n.string().describe('"all", or one thread by its label or its id.')})},b={description:"Stop a thread now: its bot stops where it is. The thread is kept, and saying more to it later carries it on.",parameters:n.object({thread:w})},S={description:"Put a thread in front of the user on their screen: the file it made, or the thread itself when it made none. Showing it also counts as them having seen its result.",parameters:n.object({thread:w})},T={description:"Mark a thread's result as seen by the user. It leaves the work waiting on them.",parameters:n.object({thread:w})},O={description:"Send a message to another bot or to Thursday; the delivery receipt comes back immediately. A bot answers with the final text of its turn, which reaches you later as a new message. Mark a question for Thursday to request user input; ordinary messages to Thursday are notifications and need no answer.",parameters:h.RoomMessageSchema.extend({kind:h.RoomMessageSchema.shape.kind.describe("Use question only when Thursday must obtain an answer from the user: it ends your turn, and you continue when the answer arrives. Use message for bot collaboration, progress updates and reports."),options:h.RoomMessageSchema.shape.options.describe("With a question, offer concise answer choices when useful. Omit for an open-ended question; the user can always type their own answer."),to:n.string().trim().min(1).describe("A bot from the roster other than the one you are answering, or Thursday to reach the user."),text:n.string().trim().min(1).describe("Write the message and include the context the recipient needs. A question to Thursday is put to the user word for word, on screen, on their phone and read aloud: write it to them."),why:n.string().trim().min(1).describe("What you need from them, in a few words, written for the user to read: they see who was brought in and what for.")})},$={description:"Open one of your other threads whole: what you were asked there and your last words in full.",parameters:n.object({id:n.string().describe("The id in brackets on its line under Your other threads.")})};async function m(e,t){let a=await (0,c.listBotWork)(e,t),n=[...a.open,...a.recent];if(!n.some(e=>e.cut))return{};let h=new Set;return{[s.TOOL_NAMES.thread_recall]:(0,i.tool)({description:$.description,inputSchema:$.parameters,execute:async({id:t})=>{let a=t.trim().replace(/^\[|\]$/g,"").toLowerCase(),i=n.find(e=>a.length>=4&&(e.id.startsWith(a)||e.label.toLowerCase()===a));if(!i)return`No thread "${t}" on your list. The ids there: ${n.filter(e=>e.cut).map(e=>(0,l.workHandle)(e.id)).join(", ")}.`;if(!i.cut)return"Its line already shows all of it.";if(h.has(i.id))return"Already opened above, this turn.";if(h.size>=r.BOT_WORK.reads)return`${r.BOT_WORK.reads} threads are open already this turn. Carry on with what you have.`;h.add(i.id);let s=await (0,c.readBotAsk)(e,i),u=i.said??"";return[(0,o.botWorkHead)(i,e),s?`You were asked: ${(0,d.clip)(s,r.BOT_WORK.asked)}`:"",`Your last words there:
|
|
8
8
|
${u.length>r.BOT_WORK.readChars?`${u.slice(0,r.BOT_WORK.readChars)}
|
|
9
9
|
[Cut here; the files it names hold the rest.]`:u}`].filter(Boolean).join("\n\n")}})}}e.s(["createThreadRecallTool",0,m,"sendMessageSpec",0,O,"threadAnswerSpec",0,y,"threadCancelSpec",0,b,"threadSeenSpec",0,T,"threadShowSpec",0,S,"threadStartSpec",0,p,"threadStatusSpec",0,g,"threadTellSpec",0,f]),a()}catch(e){a(e)}},!1),349047,e=>{"use strict";var t=e.i(847841),a=e.i(907855),i=e.i(353885);let n=Object.keys({A:[".##.","#..#","####","#..#","#..#"],B:["###.","#..#","###.","#..#","###."],C:[".###","#...","#...","#...",".###"],D:["###.","#..#","#..#","#..#","###."],E:["####","#...","###.","#...","####"],F:["####","#...","###.","#...","#..."],G:[".###","#...","#.##","#..#",".###"],H:["#..#","#..#","####","#..#","#..#"],I:["###",".#.",".#.",".#.","###"],J:["..##","...#","...#","#..#",".##."],K:["#..#","#.#.","##..","#.#.","#..#"],L:["#...","#...","#...","#...","####"],M:["#...#","##.##","#.#.#","#...#","#...#"],N:["#..#","##.#","#.##","#..#","#..#"],O:[".##.","#..#","#..#","#..#",".##."],P:["###.","#..#","###.","#...","#..."],Q:[".##.","#..#","#..#","#.#.",".#.#"],R:["###.","#..#","###.","#.#.","#..#"],S:[".###","#...",".##.","...#","###."],T:["###",".#.",".#.",".#.",".#."],U:["#..#","#..#","#..#","#..#",".##."],V:["#...#","#...#",".#.#.",".#.#.","..#.."],W:["#...#","#...#","#.#.#","##.##","#...#"],X:["#..#","#..#",".##.","#..#","#..#"],Y:["#.#","#.#",".#.",".#.",".#."],Z:["####","...#",".##.","#...","####"],0:[".##.","#.##","#..#","##.#",".##."],1:[".#.","##.",".#.",".#.","###"],2:["###.","...#",".##.","#...","####"],3:["###.","...#",".##.","...#","###."],4:["#..#","#..#","####","...#","...#"],5:["####","#...","###.","...#","###."],6:[".##.","#...","###.","#..#",".##."],7:["####","...#","..#.",".#..",".#.."],8:[".##.","#..#",".##.","#..#",".##."],9:[".##.","#..#",".###","...#",".##."],"!":["#","#","#",".","#"],"?":["###.","...#",".##.","....",".#.."],".":[".",".",".",".","#"],",":["..","..","..",".#","#."],"'":["#","#",".",".","."],"-":["...","...","###","...","..."],"+":["...",".#.","###",".#.","..."],":":[".","#",".","#","."],"(":[".#","#.","#.","#.",".#"],")":["#.",".#",".#",".#","#."],"<":["..#",".#.","#..",".#.","..#"],">":["#..",".#.","..#",".#.","#.."],"^":[".#.","#.#","...","...","..."],"~":["....",".#.#","#.#.","....","...."],"♥":[".#.#.","#####","#####",".###.","..#.."]," ":["..","..","..","..",".."]}).filter(e=>!/^[A-Z0-9 ]$/.test(e)),r={description:`End the call.
|
|
10
10
|
|
|
11
11
|
The line stays open until this runs, and drops once the goodbye being said is over.`,parameters:a.object({})},o=(0,t.tool)({description:r.description,inputSchema:r.parameters}),s={description:"Show a short word on your face for a few seconds.",parameters:a.object({text:a.string().describe(`Up to 8 characters: A-Z, 0-9, space and ${n.join(" ")}.`)})},l=(0,t.tool)({description:s.description,inputSchema:s.parameters});e.s(["callTools",0,function(){return{[i.TOOL_NAMES.end_call]:o,[i.TOOL_NAMES.emote]:l}}],349047)},625441,e=>{"use strict";var t=e.i(874533),a=e.i(912714),i=e.i(660526),n=e.i(750227),r=e.i(812057),o=e.i(847841),s=e.i(105249),l=e.i(687388),h=e.i(353885),c=e.i(629668),d=e.i(786025);let u=(0,n.join)(l.APP_DIR,l.PATHS.skills.default,"artifact",l.PATHS.skills.runtime,"deck","deck.mjs"),m=e=>s.default.string().trim().max(e),w=m(100).nullish().describe("A source or a date along the foot of the slide."),p=m(1500).nullish().describe("What the presenter says over it, as speech. Never shown."),f=s.default.object({layout:s.default.literal("cover"),title:m(110).describe("The deck's subject, as its title."),eyebrow:m(40).nullish().describe("A word or two above the title."),subtitle:m(180).nullish().describe("One line under the title."),footer:w,notes:p}),y=s.default.object({layout:s.default.literal("statement"),title:m(120).describe("The one claim, as a sentence."),subtitle:m(140).nullish().describe("One line under it."),notes:p}),g=s.default.object({layout:s.default.literal("cards"),title:m(90).describe("The point the cards make together."),cards:s.default.array(s.default.object({title:m(60).describe("Its point."),text:m(160).nullish().describe("One line under it.")})).min(2).max(4).describe("Two to four, side by side and numbered."),footer:w,notes:p}),b=s.default.object({layout:s.default.literal("number"),value:m(10).describe("The figure as it reads: 1.4M, 62%, £2,900. Only one you were given."),label:m(80).nullish().describe("What it counts, above it."),subtitle:m(160).nullish().describe("What it means or is compared with, under it."),footer:w,notes:p}),S=s.default.object({layout:s.default.literal("table"),title:m(90).describe("What the comparison shows."),columns:s.default.array(m(40)).min(2).max(5).describe("The header row. The first column names the rows; its header may be blank."),rows:s.default.array(s.default.array(m(60))).min(1).max(6).describe("Up to six, a cell for each column."),stress:s.default.number().int().min(0).max(4).nullish().describe("Which column, counted from 0, to set in the accent: the one the slide argues for."),footer:w,notes:p}),T=s.default.object({layout:s.default.literal("quote"),quote:m(280).describe("Someone's own words, exactly as you were given them. Never made up."),who:m(60).describe("Who said it."),role:m(80).nullish().describe("Their role, place or date."),notes:p}),O=s.default.object({layout:s.default.literal("image"),title:m(90).describe("The heading beside the picture."),subtitle:m(280).nullish().describe("A line or two under it."),image:m(500).describe("Workspace path of a png, jpg, webp, gif or svg. It is copied beside the deck."),alt:m(160).describe("What it shows, for someone who cannot see it."),fit:s.default.enum(["fill","whole"]).nullish().describe("fill crops a photo to its box; whole shows a chart or screenshot uncropped. Null for fill."),footer:w,notes:p}),$=s.default.object({layout:s.default.literal("close"),title:m(120).describe("The sentence to repeat to someone who was not there."),steps:s.default.array(s.default.object({label:m(24).describe("A word or two: Next, Owner, By."),text:m(120).describe("What it is.")})).max(3).nullish().describe("Up to three next steps."),notes:p}),k=s.default.object({layout:s.default.literal("timeline"),title:m(90).describe("What the dates show together."),steps:s.default.array(s.default.object({when:m(24).describe("When, as you were given it: a date, a week, a phase."),title:m(60).describe("What happens then."),text:m(120).nullish().describe("One line under it.")})).min(2).max(5).describe("Two to five, in order, along one line."),footer:w,notes:p}),_=s.default.object({layout:s.default.literal("compare"),title:m(90).describe("What changes between the two, as a sentence."),sides:s.default.array(s.default.object({label:m(30).describe("Which side it is: Now, After, Option A."),points:s.default.array(m(90)).min(1).max(4)})).length(2).describe("The two, left then right; the right is set in the accent: the side the slide argues for."),footer:w,notes:p}),v=s.default.object({layout:s.default.literal("stats"),title:m(90).describe("What the figures say together."),stats:s.default.array(s.default.object({value:m(12).describe("The figure as it reads: 1.4M, 62%, 6 hours. Only one you were given."),label:m(80).describe("What it counts, under it.")})).min(2).max(4).describe("Two to four figures side by side."),footer:w,notes:p}),A=s.default.discriminatedUnion("layout",[f,y,g,b,S,T,O,k,_,v,$]),M=s.default.object({deck:m(300).describe("A name for a new deck, or the name or workspace path of one to change. A deck another bot made is reached by its path."),title:m(90).describe("The deck's title, shown in its head."),theme:s.default.enum(["forest","sea","clay","ink"]).nullish().describe("forest (deep green on paper, serif headings), sea (blue, sans), clay (terracotta on warm paper, serif) or ink (gold on near-black, sans). Null keeps the deck's own; a new one starts in forest."),revision:s.default.string().nullish().describe("What the last call on this deck answered with. Null for a new deck."),slides:s.default.array(A).min(1).max(l.DECK.slides).describe("Every slide in order: the whole deck, each time. Someone who reads only the titles follows the argument; one idea a slide.")}),E=/^[\p{L}\p{N}][\p{L}\p{N}_-]{0,79}$/u,N=/^(slide-\d+|slides)\.png$/i;class x extends Error{}function L(e){let t=e.replace(/[^\p{L}\p{N}_-]+/gu,"-").replace(/^[-_]+|-+$/g,"").slice(0,80);if(!E.test(t))throw new x(`"${e}" is not a deck name: use letters, numbers, - and _.`);return t}async function j(e,t){let i=(0,d.botArtifacts)(t);if(!e.includes("/")&&!e.endsWith(".html")){let t=L(e);return`${i}/${t}/${t}.html`}let r=await (0,d.insideWorkspace)(e);if(!r)throw new x(`${e} is outside the workspace. Give a deck's path in it.`);let o=await (0,a.realpath)(d.WORKSPACE).catch(()=>d.WORKSPACE),s=await (0,a.stat)(r).catch(()=>null),l=s?.isDirectory()?(0,n.join)(r,`${(0,n.basename)(r)}.html`):r;if((await (0,a.stat)(l).catch(()=>null))?.isFile())return(0,n.relative)(o,l);let h=await (0,d.insideWorkspace)(i);if(!h||!r.startsWith(`${h}${n.sep}`))throw new x(`There is no deck at ${e}. A new deck is made in your own folder: give it a name.`);let c=L((0,n.basename)(r,".html"));return(0,n.relative)(o,(0,n.join)((0,n.dirname)(r),c,`${c}.html`))}async function R(e,t,i){let r=new Map,o=[];for(let[s,l]of e.entries()){if("table"===l.layout){let e=l.rows.findIndex(e=>e.length>l.columns.length);if(-1!==e)throw new x(`Slide ${s+1}: row ${e+1} has ${l.rows[e].length} cells, and there are ${l.columns.length} columns.`);o.push({...l,rows:l.rows.map(e=>l.columns.map((t,a)=>e[a]??""))});continue}if("image"!==l.layout){o.push(l);continue}let e=t.resolve(i),h=(0,n.join)(e,l.image),d=!l.image.includes("/")&&await (0,a.stat)(h).catch(()=>null)?h:t.resolve(l.image);if("image"!==(0,c.viewKindOf)(d))throw new x(`Slide ${s+1}: ${l.image} is not a picture. Give a png, jpg, webp, gif or svg.`);if(!(await (0,a.stat)(d).catch(()=>null))?.isFile())throw new x(`Slide ${s+1}: there is no file at ${l.image}. Give its path from the workspace root, as \`ls\` shows it.`);let u=r.get(d);u||(u=(0,n.dirname)(d)===e?(0,n.basename)(d):function(e,t){let a=(0,n.extname)(e),i=(0,n.basename)(e,a),r=N.test(e)?`picture-${i}`:i,o=`${r}${a}`;for(let e=2;t.has(o);e++)o=`${r}-${e}${a}`;return o}((0,n.basename)(d),new Set(r.values())),r.set(d,u),(0,n.dirname)(d)!==e&&(await (0,a.mkdir)(e,{recursive:!0}),await (0,a.copyFile)(d,(0,n.join)(e,u)))),o.push({...l,image:u})}return o}let I=(0,r.promisify)(t.execFile);async function C(e,t,r,o,s){let l=await (0,a.mkdtemp)((0,n.join)((0,i.tmpdir)(),"thursday-deck-"));try{let i=(0,n.join)(l,"deck.json");await (0,a.writeFile)(i,JSON.stringify(t));let h=[u,"put",(0,n.join)(d.WORKSPACE,e),i];r&&h.push("--revision",r);let c=await I(process.execPath,h,{env:{NODE_ENV:"production",PATH:process.env.PATH??"",THURSDAY_BOT:o,...s?{THURSDAY_BOT_MARK:s}:{}},maxBuffer:0x1000000}).catch(e=>{if(3===e.code&&e.stdout)return{stdout:e.stdout};throw new x(e.stderr?.trim().split("\n").at(-1)||"The deck could not be written.")});return JSON.parse(c.stdout.trim().split("\n").at(-1)??"")}finally{await (0,a.rm)(l,{recursive:!0,force:!0})}}async function W(e,t,a,i){let r=await e.exec('node "$DECK_SCRIPT" shots "$DECK_FILE"',{env:{...a,DECK_SCRIPT:u,DECK_FILE:(0,n.join)(d.WORKSPACE,t)},timeoutMs:l.DECK.shotsMs,signal:i});if(0!==r.exitCode)return{failed:r.stderr.trim().split("\n").at(-1)||"no pictures were made"};let o=JSON.parse(r.stdout.trim().split("\n").at(-1)??"{}");return{pictures:o.pictures.map(e=>(0,n.relative)(d.WORKSPACE,e)),sheet:o.sheet?(0,n.relative)(d.WORKSPACE,o.sheet):null,cut:o.cut}}e.s(["createDeckTools",0,(e,t,i,r)=>({[h.TOOL_NAMES.make_deck]:(0,o.tool)({description:"Make a slide deck, or change one: each slide a layout whose fields you fill, drawn and fitted by the app into one HTML file that opens offline, presents full screen and prints a slide a page, with a picture of every slide beside it.",inputSchema:M,execute:async(a,{abortSignal:r})=>{try{let o,s=await j(a.deck,t),l=await R(a.slides,e,(0,n.dirname)(s)),c=await C(s,{title:a.title,theme:a.theme??null,slides:l},a.revision?.trim()??"",t,i.THURSDAY_BOT_MARK);if("changed"in c){if(!c.deck)return`${s} is not a deck made of slides, so it cannot be changed here. Give the deck another name.`;let e=a.revision?.trim()?`${s} has changed since that revision — edited in the app, or by another job`:`there is already a deck at ${s}`;return{deck:s,revision:c.revision,note:`Nothing was written: ${e}. This is the deck as it stands. To change it, make your change on these slides and call \`${h.TOOL_NAMES.make_deck}\` again with revision ${c.revision} and the whole deck; for a deck of its own, give a new name.`,current:c.deck}}let d=`${l.length} slide${1===l.length?"":"s"}, revision ${c.revision}`,u=await W(e,s,i,r);if("failed"in u)return`${s}
|
|
12
12
|
${d}. The pictures of its slides could not be made (${u.failed}), so nothing checked that every slide fits. Hand back the deck's path.`;let m=`call \`${h.TOOL_NAMES.make_deck}\` again with revision ${c.revision} and the whole deck`,w=u.sheet?`${(0,n.basename)(u.sheet)} holds every slide, numbered, and each is on its own beside it from slide-01.png`:"Its pictures are beside it, slide-01.png on";return[s,u.sheet??u.pictures[0]??"",u.cut.length?`${d}. ${o=u.cut,1===o.length?`Slide ${o[0]} does`:`Slides ${o.slice(0,-1).join(", ")} and ${o.at(-1)} do`} not fit even with the type at its smallest: say less there, then ${m}. ${w}.`:`${d}. Every slide fits. ${w}. Hand back the deck's path; to change it, ${m}.`].filter(Boolean).join("\n")}catch(e){if(e instanceof x)return e.message;throw e}},toModelOutput:async({output:e})=>{if("string"!=typeof e)return{type:"json",value:e};let t=e.split("\n")[1]??"";if(!r||!t.endsWith(".png"))return{type:"text",value:e};let i=await (0,d.insideWorkspace)(t),n=i?await (0,a.readFile)(i).catch(()=>null):null;return!n||n.byteLength>l.LOOK.maxBytes?{type:"text",value:e}:{type:"content",value:[{type:"text",text:`${e}
|
|
13
13
|
|
|
14
|
-
${t}, as an image:`},{type:"file",mediaType:"image/png",data:{type:"data",data:n.toString("base64")}}]}}})})])},170801,e=>{"use strict";var t=e.i(912714),a=e.i(847841),i=e.i(105249),n=e.i(687388),r=e.i(353885),o=e.i(629668),s=e.i(786025);e.s(["createLookTool",0,function(){return{[r.TOOL_NAMES.look_at]:(0,a.tool)({description:"See an image file yourself: a screenshot you took, a picture the user handed over, a chart you made. For what a picture shows — text files are read in the shell.",inputSchema:i.default.object({path:i.default.string().describe("Workspace-relative path to a png, jpg, webp or gif.")}),execute:async({path:e})=>{let a=await (0,s.insideWorkspace)(e.trim()),i=a?await (0,t.stat)(a).catch(()=>null):null;return a&&i?.isFile()?"image"!==(0,o.viewKindOf)(e)?`${e} is not an image. Read it in the shell instead.`:i.size>n.LOOK.maxBytes?`${e} is ${Math.ceil(i.size/1024/1024)} MB, over the ${n.LOOK.maxBytes/1024/1024} MB one look takes. Make a smaller copy in the shell first (on a Mac: sips -Z 1600 in.png --out out.png), then look at that.`:{path:e.trim(),mediaType:(0,o.mimeOf)(e)}:`There is no file at ${e}. Give the path from the workspace root, as \`ls\` shows it.`},toModelOutput:async({output:e})=>{if("string"==typeof e)return{type:"text",value:e};let a=await (0,s.insideWorkspace)(e.path),i=a?await (0,t.readFile)(a).catch(()=>null):null;return i?{type:"content",value:[{type:"text",text:`${e.path}, as an image:`},{type:"file",mediaType:e.mediaType,data:{type:"data",data:i.toString("base64")}}]}:{type:"text",value:`${e.path} is no longer there.`}}})}}])},926435,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(353885),s=e.i(148831),l=e.i(786025),h=e.i(660948),c=t([s,h]);[s,h]=c.then?(await c)():c;let m={[o.TOOL_NAMES.tool_search]:{description:`Return the description and exact inputSchema of tools on a connected server, so they can be called with \`${o.TOOL_NAMES.tool_call}\`.`,parameters:n.object({server:n.string().describe("A server name, exactly as the Connected tools section writes it."),tools:n.string().array().describe(`Tool names listed under that server. Only the ones you may actually call — schemas are large, and at most ${r.TOOL_SEARCH_SCHEMAS} come back.`)})},[o.TOOL_NAMES.tool_call]:{description:`Run one tool whose definition came back from \`${o.TOOL_NAMES.tool_search}\`.`,parameters:n.object({server:n.string().describe("The server the tool lives on."),tool:n.string().describe("Its name, as search returned it."),args:n.looseObject({}).nullish().describe("Arguments matching the inputSchema search returned — do not guess. Null when it takes none."),description:n.string().nullish().describe("One short line for the user: what this call is for. Shown on their screen while it runs.")})}},w=(e,t)=>`${e.replace(/[^a-zA-Z0-9]+/g,"_")}__${t.replace(/[^a-zA-Z0-9_-]+/g,"_")}`.slice(0,64);async function d(e,t){let[a,n]=await Promise.all([(0,h.listConnectedToolNames)(),(0,s.findPinnedTools)(e)]),r={},o=(0,l.botArtifacts)(e);for(let e of n){let a=w(e.server,e.name);r[a]||(r[a]=(0,i.tool)({description:e.description??`${e.name} on the ${e.server} server.`,inputSchema:(0,i.jsonSchema)(e.inputSchema??{type:"object",properties:{}}),execute:(a,{abortSignal:i})=>(0,h.callConnectedTool)(t,e.server,e.name,a??void 0,{artifacts:o,abortSignal:i})}))}return a.length>n.length&&Object.assign(r,p(t,o)),r}async function u(e){let t=(await (0,h.listConnectedToolNames)(e)).map(e=>e.name);if(t.length)return`Tools on "${e}": ${t.join(", ")}.`;let a=await (0,h.listConnectedServerNames)();return a.length?`There is no server called "${e}". Connected: ${a.join(", ")}.`:"Nothing is connected."}let p=(e,t)=>({[o.TOOL_NAMES.tool_search]:(0,i.tool)({description:m[o.TOOL_NAMES.tool_search].description,inputSchema:m[o.TOOL_NAMES.tool_search].parameters,execute:async({server:e,tools:t})=>{let a=[...new Set(t.map(e=>e.trim()).filter(Boolean))],i=a.slice(0,r.TOOL_SEARCH_SCHEMAS),n=await (0,h.findConnectedSchemas)(e.trim(),i);if(!n.length)return{tools:[],note:await u(e)};let o=i.filter(e=>!n.some(t=>t.name===e)),s=a.slice(r.TOOL_SEARCH_SCHEMAS),l=[o.length?`Not on "${e}": ${o.join(", ")}.`:"",s.length?`Only ${r.TOOL_SEARCH_SCHEMAS} at a time — ask again for: ${s.join(", ")}.`:""].filter(Boolean);return{tools:n,...l.length?{note:l.join(" ")}:{}}}}),[o.TOOL_NAMES.tool_call]:(0,i.tool)({description:m[o.TOOL_NAMES.tool_call].description,inputSchema:m[o.TOOL_NAMES.tool_call].parameters,execute:async({server:a,tool:i,args:n},{abortSignal:r})=>(await (0,h.listConnectedToolNames)(a.trim())).some(e=>e.name===i.trim())?(0,h.callConnectedTool)(e,a.trim(),i.trim(),n??void 0,{artifacts:t,abortSignal:r}):{status:"error",text:await u(a)}})});e.s(["createMcpTools",0,d]),a()}catch(e){a(e)}},!1),770639,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(54282),s=e.i(353885),l=e.i(619898),h=e.i(453569),c=t([l]);[l]=c.then?(await c)():c;let d=h.MEMORY_PATHS.map(e=>e.path.endsWith("/")?`${e.path}<name>`:e.path).join(", "),u="Saved. The listing in your instructions is from when this session opened and will not show this until the next one — the note below is current.",m=e=>`Nothing on the listing called ${e}.`,w=e=>({...e,facts:e.facts.map(({saidAt:e,...t})=>e?{...t,said:(0,o.saidStamp)(e)}:t),factCount:e.facts.length}),p=e=>e>r.MEMORY_LIMITS.factsPerNote?` This note now holds ${e} facts, past the ${r.MEMORY_LIMITS.factsPerNote} one note holds well. Ask the user which of it is no longer true and delete what they name.`:"",f=e=>e.length>r.MEMORY_LIMITS.descriptionChars?{note:`That line runs to ${e.length} characters; a note's line is one line, under ${r.MEMORY_LIMITS.descriptionChars}. Say what the note is about — the facts inside say the rest.`}:null,y=n.string().describe("Exactly as the listing writes it — the path."),g=n.string().describe('One statement that stands on its own later — a date as a date, never "next week".');e.s(["createMemoryTools",0,(e,t=null,{countReads:a=!0}={})=>({[s.TOOL_NAMES.memory_recall]:(0,i.tool)({description:"Open one note from the listing, whole.",inputSchema:n.object({path:y}),execute:async({path:e})=>{let{notes:t}=await (0,l.readNotes)([e],{touch:a}),i=t[0];if(!i)return{note:m(e.trim())};let n=p(i.facts.length);return n?{...w(i),note:n.trim()}:w(i)}}),[s.TOOL_NAMES.memory_create]:(0,i.tool)({description:"Start a note for a subject that is not on the listing: its path, the line it is listed by, and its first facts.",inputSchema:n.object({path:n.string().describe(`A new path following the listing's convention — one of ${d} — for the person, project or topic the facts are about. A fact goes under the one note it is about; other notes name it rather than repeat it.`),description:n.string().describe("One line saying what this note is about, with the names the user calls it by, so the listing alone tells whether to open it. What it is about — never a list of what is inside."),facts:n.object({text:g}).array().min(1).describe("What to keep under it. Send everything that came up at once: one call is one pause in the conversation, three calls are three.")}),execute:async({path:a,description:i,facts:n})=>{let r=a.trim(),o=i.trim();if(!(0,h.isMemoryPath)(r))return{note:`Nothing was saved: "${r}" is not a path this listing can carry. Write it again under one of ${d}.`};if((0,h.isAlwaysListed)(r))return{note:`${r} is always on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it.`};let c=f(o);if(c)return c;let m=await (0,l.createNoteWithFacts)(r,o,n,e,t);if(!m)return{note:`${r} is already on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it, \`${s.TOOL_NAMES.memory_describe}\` changes its line.`};let y=w(m);return{...y,note:`${u}${p(y.factCount)}`}}}),[s.TOOL_NAMES.memory_remember]:(0,i.tool)({description:"Write facts under a note that is on the listing.",inputSchema:n.object({path:y,facts:n.object({text:g,replaces:n.number().int().nullish().describe(`The id of the fact this replaces — from this note as handed back here or by \`${s.TOOL_NAMES.memory_recall}\`. Null if this is new. A fact that stopped being true is replaced rather than deleted, and so is a note saying the same thing twice: replacing keeps what changed on the record, deleting does not.`)}).array().min(1).describe("What to write under this note. Send everything that came up at once: one call is one pause in the conversation, three calls are three.")}),execute:async({path:a,facts:i})=>{let n=a.trim(),r=await (0,l.writeFacts)(n,i,e,t);if(!r)return{note:`${m(n)} A subject that is not on the listing gets a note of its own: \`${s.TOOL_NAMES.memory_create}\`, with its line.`};let o=w(r);return{...o,note:`${u}${p(o.factCount)}`}}}),[s.TOOL_NAMES.memory_describe]:(0,i.tool)({description:"Change the line a note is listed by, when it no longer says what the note is about.",inputSchema:n.object({path:y,description:n.string().describe("The new line, whole: what this note is about, with the names the user calls it by. Never a list of what is inside.")}),execute:async({path:e,description:t})=>{let a=e.trim(),i=t.trim();if((0,h.isAlwaysListed)(a))return{note:`${h.MEMORY_ALWAYS_LISTED.join(" and ")} keep their own line; it is not yours to change.`};let n=f(i);return n||(await (0,l.describeNote)(a,i)?{path:a,description:i,note:"Renamed. The listing in your instructions is from when this session opened and still shows the old line until the next one."}:{note:m(a)})}}),[s.TOOL_NAMES.memory_forget]:(0,i.tool)({description:"Delete facts for good.",inputSchema:n.object({factIds:n.number().int().array().min(1).describe("The ids that came with the facts when their notes were opened — every one to delete, in one call.")}),execute:async({factIds:e})=>{let t=[],a=[],i=new Set;for(let n of new Set(e)){let e=await (0,l.forgetFactById)(n);if(!e){t.push(n);continue}e.noteGone?(i.delete(e.path),a.push(e.path)):i.add(e.path)}if(!a.length&&!i.size)return{note:`No fact with id ${t.join(", ")}. Nothing was deleted.`};let n=["Deleted for good. The listing in your instructions is from when this session opened and still shows it that way until the next one.",1===a.length?`That was the last fact under ${a[0]}, so the note went with it.`:a.length?`That was the last of ${a.join(", ")}, so those notes went with them.`:"",t.length?`No fact with id ${t.join(", ")}, so those were skipped.`:""].filter(Boolean).join(" ");if(!i.size)return{note:n};let{notes:r}=await (0,l.readNotes)([...i],{touch:!1});return{notes:r.map(w),note:n}}})})]),a()}catch(e){a(e)}},!1),418919,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(353885),s=e.i(265143),l=e.i(963219),h=e.i(473139),c=e.i(704161),d=e.i(53748),u=e.i(41444),m=t([s,l]);[s,l]=m.then?(await m)():m;let f={description:`Routines: work that starts by itself, each one a bot, the work and a time — once at a moment, a time of day on chosen days, or every few hours. List them, make one, change one, or delete one. Every start opens a thread like one started by hand; its result reaches the conversation the same way. At most ${r.ROUTINE.max} exist.`,parameters:n.object({action:n.enum(["list","create","change","delete"]),routine:n.string().nullish().describe("With change or delete: the routine, by its name or ID."),bot:n.string().nullish().describe("With create: a name from the bot list. With change: a new bot."),label:n.string().nullish().describe("With create: two or three words naming it, in the user's language. It names every thread the routine opens, on screen and out loud."),request:n.string().nullish().describe("With create: the whole of the work, handed to the bot as written every time it starts. Nobody is there then to fill in what is missing, so everything it needs goes here, in the user's own language and words. Their request, never your reading of it."),at:n.string().nullish().describe('Starts once, at this moment, "YYYY-MM-DD HH:MM" in the user\'s own time, then switches itself off. Count "in an hour" or "tomorrow at eight" from **Now**. Give one of `at`, `time` or `everyHours`.'),time:n.string().nullish().describe('Starts at this time of day, 24-hour "HH:MM" in the user\'s own time, on `days`. Give one of `at`, `time` or `everyHours`.'),days:n.array(n.number().int().min(1).max(7)).nullish().describe("With `time`: the days it starts, 1 Monday to 7 Sunday. Omit for every day."),everyHours:n.number().int().nullish().describe(`Starts again this many hours after it last started, ${r.ROUTINE.minHours} at least. Give one of \`at\`, \`time\` or \`everyHours\`.`),enabled:n.boolean().nullish().describe("With change: false switches it off without deleting it, true back on.")})};function w(e){let t=e.runs[0];return{id:e.id,label:e.label,bot:e.bot,when:(0,h.scheduleText)(e.schedule),enabled:e.enabled,...e.enabled?{next:(0,c.whenOf)((0,c.toDate)(e.nextRunAt))}:{},request:(0,u.clip)(e.request,r.PROMPT_LINE.routineRequest),...t?{lastRun:{thread:t.id,status:t.status,at:(0,c.whenOf)((0,c.toDate)(t.updatedAt)),...t.outcome?{outcome:(0,u.clip)(t.outcome,r.PROMPT_LINE.routineOutcome)}:{}}}:{}}}let y=e=>{if((0,d.isPublicError)(e))return e.message;throw e};async function p(e){let t=(await (0,l.listRoutines)()).map(e=>`"${e.label}"`);return t.length?e?`There is no single routine called "${e}". The routines are: ${t.join(", ")}. Call again with one of those, or its ID.`:`Name the routine. The routines are: ${t.join(", ")}.`:"There are no routines yet."}e.s(["createRoutineTools",0,function(){return{[o.TOOL_NAMES.routine]:(0,i.tool)({description:f.description,inputSchema:f.parameters,execute:async e=>{if("list"===e.action)return{routines:(await (0,l.listRoutines)()).map(w)};let t=function(e){if([e.at,e.time,e.everyHours].filter(Boolean).length>1)return"Give one of `at`, `time` or `everyHours`, not two.";let t=e.at?{kind:"once",at:e.at}:e.time?{kind:"daily",time:e.time,days:e.days?.length?e.days:[1,2,3,4,5,6,7]}:e.everyHours?{kind:"every",hours:e.everyHours}:null;if(!t)return null;let a=h.RoutineScheduleSchema.safeParse(t);return a.success?a.data:a.error.issues[0].message}(e);if("string"==typeof t)return t;if("create"===e.action){if(!t)return"Say when it starts: `at`, `time` (with `days`), or `everyHours`.";let a=h.RoutineInputSchema.safeParse({bot:e.bot??"",label:e.label??"",request:e.request??"",schedule:t});if(!a.success)return`${a.error.issues[0].message}. Nothing was made — call again with bot, label, request and when.`;let i=(await (0,s.listJobBots)()).map(e=>e.name);if(!i.some(e=>e.toLowerCase()===a.data.bot.toLowerCase()))return`There is no bot called "${a.data.bot}". The bots are: ${i.join(", ")}. Nothing was made — call again with one of those.`;let n=await (0,l.createRoutine)(a.data).catch(y);if("string"==typeof n)return n;let r=(0,c.whenOf)((0,c.toDate)(n.nextRunAt));return{...w(n),note:"once"===n.schedule.kind?`${n.bot} starts "${n.label}" once, ${r}, and the routine then switches itself off. The start is a thread of its own, and its result reaches the conversation like any thread's.`:`${n.bot} starts "${n.label}" by itself, ${(0,h.scheduleText)(n.schedule)}, first ${r}. Each start is a thread of its own, and its result reaches the conversation like any thread's.`}}let a=e.routine?await (0,l.resolveRoutine)(e.routine):null;if(!a)return await p(e.routine);if("delete"===e.action)return await (0,l.deleteRoutine)(a.id),`"${a.label}" is deleted and starts no more. The threads it already opened stay.`;let i={...e.bot?{bot:e.bot}:{},...e.label?.trim()?{label:e.label.trim()}:{},...e.request?.trim()?{request:e.request.trim()}:{},...t?{schedule:t}:{},..."boolean"==typeof e.enabled?{enabled:e.enabled}:{}};if(!Object.keys(i).length)return"Nothing to change was given: bot, label, request, when, or enabled.";let n=await (0,l.updateRoutine)(a.id,i).catch(y);return"string"==typeof n?n:n?w(n):await p(e.routine)}})}}]),a()}catch(e){a(e)}},!1),489956,e=>e.a(async(t,a)=>{try{var i=e.i(68356),n=e.i(847841),r=e.i(105249),o=e.i(687388),s=e.i(353885),l=e.i(279041),h=e.i(340698),c=e.i(41444),d=t([h]);[h]=d.then?(await d)():d;let p=`Answer the question from the web. Lead with the answer, then
|
|
14
|
+
${t}, as an image:`},{type:"file",mediaType:"image/png",data:{type:"data",data:n.toString("base64")}}]}}})})])},170801,e=>{"use strict";var t=e.i(912714),a=e.i(847841),i=e.i(105249),n=e.i(687388),r=e.i(353885),o=e.i(629668),s=e.i(786025);e.s(["createLookTool",0,function(){return{[r.TOOL_NAMES.look_at]:(0,a.tool)({description:"See an image file yourself: a screenshot you took, a picture the user handed over, a chart you made. For what a picture shows — text files are read in the shell.",inputSchema:i.default.object({path:i.default.string().describe("Workspace-relative path to a png, jpg, webp or gif.")}),execute:async({path:e})=>{let a=await (0,s.insideWorkspace)(e.trim()),i=a?await (0,t.stat)(a).catch(()=>null):null;return a&&i?.isFile()?"image"!==(0,o.viewKindOf)(e)?`${e} is not an image. Read it in the shell instead.`:i.size>n.LOOK.maxBytes?`${e} is ${Math.ceil(i.size/1024/1024)} MB, over the ${n.LOOK.maxBytes/1024/1024} MB one look takes. Make a smaller copy in the shell first (on a Mac: sips -Z 1600 in.png --out out.png), then look at that.`:{path:e.trim(),mediaType:(0,o.mimeOf)(e)}:`There is no file at ${e}. Give the path from the workspace root, as \`ls\` shows it.`},toModelOutput:async({output:e})=>{if("string"==typeof e)return{type:"text",value:e};let a=await (0,s.insideWorkspace)(e.path),i=a?await (0,t.readFile)(a).catch(()=>null):null;return i?{type:"content",value:[{type:"text",text:`${e.path}, as an image:`},{type:"file",mediaType:e.mediaType,data:{type:"data",data:i.toString("base64")}}]}:{type:"text",value:`${e.path} is no longer there.`}}})}}])},926435,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(353885),s=e.i(148831),l=e.i(786025),h=e.i(660948),c=t([s,h]);[s,h]=c.then?(await c)():c;let m={[o.TOOL_NAMES.tool_search]:{description:`Return the description and exact inputSchema of tools on a connected server, so they can be called with \`${o.TOOL_NAMES.tool_call}\`.`,parameters:n.object({server:n.string().describe("A server name, exactly as the Connected tools section writes it."),tools:n.string().array().describe(`Tool names listed under that server. Only the ones you may actually call — schemas are large, and at most ${r.TOOL_SEARCH_SCHEMAS} come back.`)})},[o.TOOL_NAMES.tool_call]:{description:`Run one tool whose definition came back from \`${o.TOOL_NAMES.tool_search}\`.`,parameters:n.object({server:n.string().describe("The server the tool lives on."),tool:n.string().describe("Its name, as search returned it."),args:n.looseObject({}).nullish().describe("Arguments matching the inputSchema search returned — do not guess. Null when it takes none."),description:n.string().nullish().describe("One short line for the user: what this call is for. Shown on their screen while it runs.")})}},w=(e,t)=>`${e.replace(/[^a-zA-Z0-9]+/g,"_")}__${t.replace(/[^a-zA-Z0-9_-]+/g,"_")}`.slice(0,64);async function d(e,t){let[a,n]=await Promise.all([(0,h.listConnectedToolNames)(),(0,s.findPinnedTools)(e)]),r={},o=(0,l.botArtifacts)(e);for(let e of n){let a=w(e.server,e.name);r[a]||(r[a]=(0,i.tool)({description:e.description??`${e.name} on the ${e.server} server.`,inputSchema:(0,i.jsonSchema)(e.inputSchema??{type:"object",properties:{}}),execute:(a,{abortSignal:i})=>(0,h.callConnectedTool)(t,e.server,e.name,a??void 0,{artifacts:o,abortSignal:i})}))}return a.length>n.length&&Object.assign(r,p(t,o)),r}async function u(e){let t=(await (0,h.listConnectedToolNames)(e)).map(e=>e.name);if(t.length)return`Tools on "${e}": ${t.join(", ")}.`;let a=await (0,h.listConnectedServerNames)();return a.length?`There is no server called "${e}". Connected: ${a.join(", ")}.`:"Nothing is connected."}let p=(e,t)=>({[o.TOOL_NAMES.tool_search]:(0,i.tool)({description:m[o.TOOL_NAMES.tool_search].description,inputSchema:m[o.TOOL_NAMES.tool_search].parameters,execute:async({server:e,tools:t})=>{let a=[...new Set(t.map(e=>e.trim()).filter(Boolean))],i=a.slice(0,r.TOOL_SEARCH_SCHEMAS),n=await (0,h.findConnectedSchemas)(e.trim(),i);if(!n.length)return{tools:[],note:await u(e)};let o=i.filter(e=>!n.some(t=>t.name===e)),s=a.slice(r.TOOL_SEARCH_SCHEMAS),l=[o.length?`Not on "${e}": ${o.join(", ")}.`:"",s.length?`Only ${r.TOOL_SEARCH_SCHEMAS} at a time — ask again for: ${s.join(", ")}.`:""].filter(Boolean);return{tools:n,...l.length?{note:l.join(" ")}:{}}}}),[o.TOOL_NAMES.tool_call]:(0,i.tool)({description:m[o.TOOL_NAMES.tool_call].description,inputSchema:m[o.TOOL_NAMES.tool_call].parameters,execute:async({server:a,tool:i,args:n},{abortSignal:r})=>(await (0,h.listConnectedToolNames)(a.trim())).some(e=>e.name===i.trim())?(0,h.callConnectedTool)(e,a.trim(),i.trim(),n??void 0,{artifacts:t,abortSignal:r}):{status:"error",text:await u(a)}})});e.s(["createMcpTools",0,d]),a()}catch(e){a(e)}},!1),770639,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(54282),s=e.i(353885),l=e.i(619898),h=e.i(453569),c=t([l]);[l]=c.then?(await c)():c;let d=h.MEMORY_PATHS.map(e=>e.path.endsWith("/")?`${e.path}<name>`:e.path).join(", "),u="Saved. The listing in your instructions is from when this session opened and will not show this until the next one — the note below is current.",m=e=>`Nothing on the listing called ${e}.`,w=e=>({...e,facts:e.facts.map(({saidAt:e,...t})=>e?{...t,said:(0,o.saidStamp)(e)}:t),factCount:e.facts.length}),p=e=>e>r.MEMORY_LIMITS.factsPerNote?` This note now holds ${e} facts, past the ${r.MEMORY_LIMITS.factsPerNote} one note holds well. Ask the user which of it is no longer true and delete what they name.`:"",f=e=>e.length>r.MEMORY_LIMITS.descriptionChars?{note:`That line runs to ${e.length} characters; a note's line is one line, under ${r.MEMORY_LIMITS.descriptionChars}. Say what the note is about — the facts inside say the rest.`}:null,y=n.string().describe("Exactly as the listing writes it — the path."),g=n.string().describe('One statement that stands on its own later — a date as a date, never "next week".');e.s(["createMemoryTools",0,(e,t=null,{countReads:a=!0,tidies:r=!0}={})=>({[s.TOOL_NAMES.memory_recall]:(0,i.tool)({description:"Open one note from the listing, whole.",inputSchema:n.object({path:y}),execute:async({path:e})=>{let{notes:t}=await (0,l.readNotes)([e],{touch:a}),i=t[0];if(!i)return{note:m(e.trim())};let n=r?p(i.facts.length):"";return n?{...w(i),note:n.trim()}:w(i)}}),[s.TOOL_NAMES.memory_create]:(0,i.tool)({description:"Start a note for a subject that is not on the listing: its path, the line it is listed by, and its first facts.",inputSchema:n.object({path:n.string().describe(`A new path following the listing's convention — one of ${d} — for the person, project or topic the facts are about. A fact goes under the one note it is about; other notes name it rather than repeat it.`),description:n.string().describe("One line saying what this note is about, with the names the user calls it by, so the listing alone tells whether to open it. What it is about — never a list of what is inside."),facts:n.object({text:g}).array().min(1).describe("What to keep under it. Send everything that came up at once: one call is one pause in the conversation, three calls are three.")}),execute:async({path:a,description:i,facts:n})=>{let r=a.trim(),o=i.trim();if(!(0,h.isMemoryPath)(r))return{note:`Nothing was saved: "${r}" is not a path this listing can carry. Write it again under one of ${d}.`};if((0,h.isAlwaysListed)(r))return{note:`${r} is always on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it.`};let c=f(o);if(c)return c;let m=await (0,l.createNoteWithFacts)(r,o,n,e,t);if(!m)return{note:`${r} is already on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it, \`${s.TOOL_NAMES.memory_describe}\` changes its line.`};let y=w(m);return{...y,note:`${u}${p(y.factCount)}`}}}),[s.TOOL_NAMES.memory_remember]:(0,i.tool)({description:"Write facts under a note that is on the listing.",inputSchema:n.object({path:y,facts:n.object({text:g,replaces:n.number().int().nullish().describe(`The id of the fact this replaces — from this note as handed back here or by \`${s.TOOL_NAMES.memory_recall}\`. Null if this is new. A fact that stopped being true is replaced rather than deleted, and so is a note saying the same thing twice: replacing keeps what changed on the record, deleting does not.`)}).array().min(1).describe("What to write under this note. Send everything that came up at once: one call is one pause in the conversation, three calls are three.")}),execute:async({path:a,facts:i})=>{let n=a.trim(),r=await (0,l.writeFacts)(n,i,e,t);if(!r)return{note:`${m(n)} A subject that is not on the listing gets a note of its own: \`${s.TOOL_NAMES.memory_create}\`, with its line.`};let o=w(r);return{...o,note:`${u}${p(o.factCount)}`}}}),[s.TOOL_NAMES.memory_describe]:(0,i.tool)({description:"Change the line a note is listed by, when it no longer says what the note is about.",inputSchema:n.object({path:y,description:n.string().describe("The new line, whole: what this note is about, with the names the user calls it by. Never a list of what is inside.")}),execute:async({path:e,description:t})=>{let a=e.trim(),i=t.trim();if((0,h.isAlwaysListed)(a))return{note:`${h.MEMORY_ALWAYS_LISTED.join(" and ")} keep their own line; it is not yours to change.`};let n=f(i);return n||(await (0,l.describeNote)(a,i)?{path:a,description:i,note:"Renamed. The listing in your instructions is from when this session opened and still shows the old line until the next one."}:{note:m(a)})}}),[s.TOOL_NAMES.memory_forget]:(0,i.tool)({description:"Delete facts for good.",inputSchema:n.object({factIds:n.number().int().array().min(1).describe("The ids that came with the facts when their notes were opened — every one to delete, in one call.")}),execute:async({factIds:e})=>{let t=[],a=[],i=new Set;for(let n of new Set(e)){let e=await (0,l.forgetFactById)(n);if(!e){t.push(n);continue}e.noteGone?(i.delete(e.path),a.push(e.path)):i.add(e.path)}if(!a.length&&!i.size)return{note:`No fact with id ${t.join(", ")}. Nothing was deleted.`};let n=["Deleted for good. The listing in your instructions is from when this session opened and still shows it that way until the next one.",1===a.length?`That was the last fact under ${a[0]}, so the note went with it.`:a.length?`That was the last of ${a.join(", ")}, so those notes went with them.`:"",t.length?`No fact with id ${t.join(", ")}, so those were skipped.`:""].filter(Boolean).join(" ");if(!i.size)return{note:n};let{notes:r}=await (0,l.readNotes)([...i],{touch:!1});return{notes:r.map(w),note:n}}})})]),a()}catch(e){a(e)}},!1),418919,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(353885),s=e.i(265143),l=e.i(963219),h=e.i(473139),c=e.i(704161),d=e.i(53748),u=e.i(41444),m=t([s,l]);[s,l]=m.then?(await m)():m;let f={description:`Routines: work that starts by itself, each one a bot, the work and a time — once at a moment, a time of day on chosen days, or every few hours. List them, make one, change one, or delete one. Every start opens a thread like one started by hand; its result reaches the conversation the same way. At most ${r.ROUTINE.max} exist.`,parameters:n.object({action:n.enum(["list","create","change","delete"]),routine:n.string().nullish().describe("With change or delete: the routine, by its name or ID."),bot:n.string().nullish().describe("With create: a name from the bot list. With change: a new bot."),label:n.string().nullish().describe("With create: two or three words naming it, in the user's language. It names every thread the routine opens, on screen and out loud."),request:n.string().nullish().describe("With create: the whole of the work, handed to the bot as written every time it starts. Nobody is there then to fill in what is missing, so everything it needs goes here, in the user's own language and words. Their request, never your reading of it."),at:n.string().nullish().describe('Starts once, at this moment, "YYYY-MM-DD HH:MM" in the user\'s own time, then switches itself off. Count "in an hour" or "tomorrow at eight" from **Now**. Give one of `at`, `time` or `everyHours`.'),time:n.string().nullish().describe('Starts at this time of day, 24-hour "HH:MM" in the user\'s own time, on `days`. Give one of `at`, `time` or `everyHours`.'),days:n.array(n.number().int().min(1).max(7)).nullish().describe("With `time`: the days it starts, 1 Monday to 7 Sunday. Omit for every day."),everyHours:n.number().int().nullish().describe(`Starts again this many hours after it last started, ${r.ROUTINE.minHours} at least. Give one of \`at\`, \`time\` or \`everyHours\`.`),enabled:n.boolean().nullish().describe("With change: false switches it off without deleting it, true back on.")})};function w(e){let t=e.runs[0];return{id:e.id,label:e.label,bot:e.bot,when:(0,h.scheduleText)(e.schedule),enabled:e.enabled,...e.enabled?{next:(0,c.whenOf)((0,c.toDate)(e.nextRunAt))}:{},request:(0,u.clip)(e.request,r.PROMPT_LINE.routineRequest),...t?{lastRun:{thread:t.id,status:t.status,at:(0,c.whenOf)((0,c.toDate)(t.updatedAt)),...t.outcome?{outcome:(0,u.clip)(t.outcome,r.PROMPT_LINE.routineOutcome)}:{}}}:{}}}let y=e=>{if((0,d.isPublicError)(e))return e.message;throw e};async function p(e){let t=(await (0,l.listRoutines)()).map(e=>`"${e.label}"`);return t.length?e?`There is no single routine called "${e}". The routines are: ${t.join(", ")}. Call again with one of those, or its ID.`:`Name the routine. The routines are: ${t.join(", ")}.`:"There are no routines yet."}e.s(["createRoutineTools",0,function(){return{[o.TOOL_NAMES.routine]:(0,i.tool)({description:f.description,inputSchema:f.parameters,execute:async e=>{if("list"===e.action)return{routines:(await (0,l.listRoutines)()).map(w)};let t=function(e){if([e.at,e.time,e.everyHours].filter(Boolean).length>1)return"Give one of `at`, `time` or `everyHours`, not two.";let t=e.at?{kind:"once",at:e.at}:e.time?{kind:"daily",time:e.time,days:e.days?.length?e.days:[1,2,3,4,5,6,7]}:e.everyHours?{kind:"every",hours:e.everyHours}:null;if(!t)return null;let a=h.RoutineScheduleSchema.safeParse(t);return a.success?a.data:a.error.issues[0].message}(e);if("string"==typeof t)return t;if("create"===e.action){if(!t)return"Say when it starts: `at`, `time` (with `days`), or `everyHours`.";let a=h.RoutineInputSchema.safeParse({bot:e.bot??"",label:e.label??"",request:e.request??"",schedule:t});if(!a.success)return`${a.error.issues[0].message}. Nothing was made — call again with bot, label, request and when.`;let i=(await (0,s.listJobBots)()).map(e=>e.name);if(!i.some(e=>e.toLowerCase()===a.data.bot.toLowerCase()))return`There is no bot called "${a.data.bot}". The bots are: ${i.join(", ")}. Nothing was made — call again with one of those.`;let n=await (0,l.createRoutine)(a.data).catch(y);if("string"==typeof n)return n;let r=(0,c.whenOf)((0,c.toDate)(n.nextRunAt));return{...w(n),note:"once"===n.schedule.kind?`${n.bot} starts "${n.label}" once, ${r}, and the routine then switches itself off. The start is a thread of its own, and its result reaches the conversation like any thread's.`:`${n.bot} starts "${n.label}" by itself, ${(0,h.scheduleText)(n.schedule)}, first ${r}. Each start is a thread of its own, and its result reaches the conversation like any thread's.`}}let a=e.routine?await (0,l.resolveRoutine)(e.routine):null;if(!a)return await p(e.routine);if("delete"===e.action)return await (0,l.deleteRoutine)(a.id),`"${a.label}" is deleted and starts no more. The threads it already opened stay.`;let i={...e.bot?{bot:e.bot}:{},...e.label?.trim()?{label:e.label.trim()}:{},...e.request?.trim()?{request:e.request.trim()}:{},...t?{schedule:t}:{},..."boolean"==typeof e.enabled?{enabled:e.enabled}:{}};if(!Object.keys(i).length)return"Nothing to change was given: bot, label, request, when, or enabled.";let n=await (0,l.updateRoutine)(a.id,i).catch(y);return"string"==typeof n?n:n?w(n):await p(e.routine)}})}}]),a()}catch(e){a(e)}},!1),489956,e=>e.a(async(t,a)=>{try{var i=e.i(68356),n=e.i(847841),r=e.i(105249),o=e.i(687388),s=e.i(353885),l=e.i(279041),h=e.i(340698),c=e.i(41444),d=t([h]);[h]=d.then?(await d)():d;let p=`Answer the question from the web. Lead with the answer, then
|
|
15
15
|
what supports it. Say plainly what you could not find or confirm — do not fill
|
|
16
16
|
the gap with a guess. Every number carries the date you saw it. Be brief: this
|
|
17
17
|
is read by another model, not by a person.`,f=r.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 u(e,t,a){let i=await fetch("https://api.exa.ai/search",{method:"POST",signal:a,headers:{"content-type":"application/json","x-api-key":e},body:JSON.stringify({query:t,type:"auto",numResults:o.SEARCH.sources,contents:{text:{maxCharacters:o.SEARCH.excerptChars},livecrawl:"fallback",livecrawlTimeout:5e3}})});if(!i.ok)return{text:`Exa answered ${i.status}: ${(0,c.clip)((await i.text()).trim(),200)}`,sources:[]};let n=(await i.json()).results??[];if(!n.length)return{text:"Nothing came back for that. Try other words, or open the page itself.",sources:[]};let r=n.flatMap(e=>e.url?.trim()?[{url:e.url.trim(),...e.title?.trim()?{title:e.title.trim()}:{}}]:[]);return{text:n.map(e=>{let t=[e.title?.trim(),e.url?.trim()].filter(Boolean).join(" — "),a=e.publishedDate?.slice(0,10);return[a?`${t} \xb7 ${a}`:t,e.text?.trim()].filter(Boolean).join("\n")}).join("\n\n"),sources:r}}async function m(e,t,a){let{text:n,sources:r}=await (0,i.generateText)({model:e.model,tools:e.tools,instructions:p,prompt:t,abortSignal:a}),s=[...new Set(r.flatMap(e=>"url"===e.sourceType?[e.title?`${e.title} — ${e.url}`:e.url]:[]))].slice(0,o.SEARCH.sources);return{text:[n.trim(),s.length?`Sources:
|
|
@@ -25,12 +25,12 @@ ${h.map(e=>{var t;let a,i;return`- ${t=e.startSecond,a=Math.floor(t/60),i=Math.f
|
|
|
25
25
|
${l.trim()}${c}
|
|
26
26
|
`)));return`${w}
|
|
27
27
|
|
|
28
|
-
${await a.fold(u.text,"transcript")}`}})},A=async()=>{let e=await (0,h.resolveMediaRef)("video");if(!e)return null;let t=(0,h.buildVideoModel)(e.ref,e.apiKey);return p({name:c.STUDIO_TOOLS.generate_video,description:"Make a short video and save it as a file in the workspace. Takes minutes. What comes back is its path.",inputSchema:s.default.object({prompt:s.default.string().describe("What happens: the scene, the motion, the camera, the mood. The video model does not see the job or the conversation, so nothing can be left implied."),aspectRatio:s.default.enum(["16:9","9:16"]).nullish().describe("Aspect ratio. Null for 16:9."),seconds:s.default.number().int().min(2).max(10).nullish().describe("Length in seconds, 2 to 10. Null for the provider's default.")}),execute:async({prompt:e,aspectRatio:a,seconds:i},{sandbox:n,artifacts:o,abortSignal:s})=>{let{video:l}=await (0,r.experimental_generateVideo)({model:t,prompt:e,aspectRatio:a??"16:9",duration:i??void 0,abortSignal:s}),h=await y(n,o,f(e,O(l.mediaType,"mp4")),l.uint8Array);return T(h)}})};async function b(){return(await Promise.all([S(k),S(_),S(v),S(A)])).filter(e=>null!==e)}async function S(e){try{return await e()}catch(e){return u.logger.warn(`studio: a tool could not be built — ${(0,m.errorToString)(e)}`),null}}e.s(["loadStudio",0,b]),a()}catch(e){a(e)}},!1),660948,e=>e.a(async(t,a)=>{try{var i=e.i(105249),n=e.i(687388),r=e.i(105303),o=e.i(148831),s=e.i(41444),l=e.i(741376),h=t([r,o,l]);async function c(e){let[t,a]=await Promise.all([!e||e===n.STUDIO_SERVER?(0,l.loadStudio)():[],e===n.STUDIO_SERVER?[]:(0,o.listToolNames)(e)]);return[...t.map(e=>({server:n.STUDIO_SERVER,name:e.name})),...a]}[r,o,l]=h.then?(await h)():h;let p=async()=>{let[e,t]=await Promise.all([(0,l.loadStudio)(),(0,o.listServerNames)()]);return[...e.length?[n.STUDIO_SERVER]:[],...t.map(e=>e.name)]};async function d(e,t){if(e===n.STUDIO_SERVER){let e=new Set(t);return(await (0,l.loadStudio)()).filter(t=>e.has(t.name)).map(e=>({name:e.name,description:e.description,inputSchema:i.default.toJSONSchema(e.inputSchema)}))}return(await (0,o.findToolSchemas)(e,t)).map(e=>({name:e.name,description:e.description??null,inputSchema:e.inputSchema??null}))}async function u(e,t,a,i,{artifacts:o,abortSignal:l}){let h=AbortSignal.timeout(n.CONNECTED_TOOL_TIMEOUT_MS),c=l?AbortSignal.any([l,h]):h;try{let r=t===n.STUDIO_SERVER?await m(e,a,i,o,c):await w(t,a,i,c);if("string"!=typeof r)return r;return{status:"ok",text:await e.fold(r,`${t}-${a}`)}}catch(e){if(e instanceof r.McpAuthRequiredError)return{status:"auth_required",server:t,authorizationUrl:e.authorizationUrl};if(h.aborted&&!l?.aborted)return{status:"error",text:`${a} on ${t} gave no answer in ${n.CONNECTED_TOOL_TIMEOUT_MS/6e4} minutes and was given up on.`};return{status:"error",text:(0,s.errorToString)(e)}}}async function m(e,t,a,i,r){let o=(await (0,l.loadStudio)()).find(e=>e.name===t);if(!o)throw Error(`"${t}" is not in the ${n.STUDIO_SERVER} right now — the key that runs it is gone.`);return o.execute(a??{},{sandbox:e,artifacts:i,abortSignal:r})}async function w(e,t,a,i){let n=function(e){let t=e??{},a=!0===t.isError;if(!Array.isArray(t.content)){let e=void 0===t.toolResult?"":"string"==typeof t.toolResult?t.toolResult:JSON.stringify(t.toolResult);return{status:a?"error":"ok",text:e||f(a)}}let i=t.content.map(e=>"text"===e.type&&"string"==typeof e.text?e.text:`[${e.type}${e.mimeType?` ${e.mimeType}`:""} — not shown]`).join("\n").trim();return{status:a?"error":"ok",text:i||f(a)}}(await r.mcpManager.callTool(e,t,a,i));return"ok"===n.status?n.text:n}let f=e=>e?"The tool failed without a message.":"Done.";e.s(["callConnectedTool",0,u,"findConnectedSchemas",0,d,"listConnectedServerNames",0,p,"listConnectedToolNames",0,c]),a()}catch(e){a(e)}},!1),123203,e=>{"use strict";var t=e.i(750227),a=e.i(847841),i=e.i(105249),n=e.i(687388),r=e.i(353885),o=e.i(393189),s=e.i(786025);let
|
|
28
|
+
${await a.fold(u.text,"transcript")}`}})},A=async()=>{let e=await (0,h.resolveMediaRef)("video");if(!e)return null;let t=(0,h.buildVideoModel)(e.ref,e.apiKey);return p({name:c.STUDIO_TOOLS.generate_video,description:"Make a short video and save it as a file in the workspace. Takes minutes. What comes back is its path.",inputSchema:s.default.object({prompt:s.default.string().describe("What happens: the scene, the motion, the camera, the mood. The video model does not see the job or the conversation, so nothing can be left implied."),aspectRatio:s.default.enum(["16:9","9:16"]).nullish().describe("Aspect ratio. Null for 16:9."),seconds:s.default.number().int().min(2).max(10).nullish().describe("Length in seconds, 2 to 10. Null for the provider's default.")}),execute:async({prompt:e,aspectRatio:a,seconds:i},{sandbox:n,artifacts:o,abortSignal:s})=>{let{video:l}=await (0,r.experimental_generateVideo)({model:t,prompt:e,aspectRatio:a??"16:9",duration:i??void 0,maxRetries:0,abortSignal:s}),h=await y(n,o,f(e,O(l.mediaType,"mp4")),l.uint8Array);return T(h)}})};async function b(){return(await Promise.all([S(k),S(_),S(v),S(A)])).filter(e=>null!==e)}async function S(e){try{return await e()}catch(e){return u.logger.warn(`studio: a tool could not be built — ${(0,m.errorToString)(e)}`),null}}e.s(["loadStudio",0,b]),a()}catch(e){a(e)}},!1),660948,e=>e.a(async(t,a)=>{try{var i=e.i(105249),n=e.i(687388),r=e.i(105303),o=e.i(148831),s=e.i(41444),l=e.i(741376),h=t([r,o,l]);async function c(e){let[t,a]=await Promise.all([!e||e===n.STUDIO_SERVER?(0,l.loadStudio)():[],e===n.STUDIO_SERVER?[]:(0,o.listToolNames)(e)]);return[...t.map(e=>({server:n.STUDIO_SERVER,name:e.name})),...a]}[r,o,l]=h.then?(await h)():h;let p=async()=>{let[e,t]=await Promise.all([(0,l.loadStudio)(),(0,o.listServerNames)()]);return[...e.length?[n.STUDIO_SERVER]:[],...t.map(e=>e.name)]};async function d(e,t){if(e===n.STUDIO_SERVER){let e=new Set(t);return(await (0,l.loadStudio)()).filter(t=>e.has(t.name)).map(e=>({name:e.name,description:e.description,inputSchema:i.default.toJSONSchema(e.inputSchema)}))}return(await (0,o.findToolSchemas)(e,t)).map(e=>({name:e.name,description:e.description??null,inputSchema:e.inputSchema??null}))}async function u(e,t,a,i,{artifacts:o,abortSignal:l}){let h=AbortSignal.timeout(n.CONNECTED_TOOL_TIMEOUT_MS),c=l?AbortSignal.any([l,h]):h;try{let r=t===n.STUDIO_SERVER?await m(e,a,i,o,c):await w(t,a,i,c);if("string"!=typeof r)return r;return{status:"ok",text:await e.fold(r,`${t}-${a}`)}}catch(e){if(e instanceof r.McpAuthRequiredError)return{status:"auth_required",server:t,authorizationUrl:e.authorizationUrl};if(h.aborted&&!l?.aborted)return{status:"error",text:`${a} on ${t} gave no answer in ${n.CONNECTED_TOOL_TIMEOUT_MS/6e4} minutes and was given up on.`};return{status:"error",text:(0,s.errorToString)(e)}}}async function m(e,t,a,i,r){let o=(await (0,l.loadStudio)()).find(e=>e.name===t);if(!o)throw Error(`"${t}" is not in the ${n.STUDIO_SERVER} right now — the key that runs it is gone.`);return o.execute(a??{},{sandbox:e,artifacts:i,abortSignal:r})}async function w(e,t,a,i){let n=function(e){let t=e??{},a=!0===t.isError;if(!Array.isArray(t.content)){let e=void 0===t.toolResult?"":"string"==typeof t.toolResult?t.toolResult:JSON.stringify(t.toolResult);return{status:a?"error":"ok",text:e||f(a)}}let i=t.content.map(e=>"text"===e.type&&"string"==typeof e.text?e.text:`[${e.type}${e.mimeType?` ${e.mimeType}`:""} — not shown]`).join("\n").trim();return{status:a?"error":"ok",text:i||f(a)}}(await r.mcpManager.callTool(e,t,a,i));return"ok"===n.status?n.text:n}let f=e=>e?"The tool failed without a message.":"Done.";e.s(["callConnectedTool",0,u,"findConnectedSchemas",0,d,"listConnectedServerNames",0,p,"listConnectedToolNames",0,c]),a()}catch(e){a(e)}},!1),123203,e=>{"use strict";var t=e.i(750227),a=e.i(847841),i=e.i(105249),n=e.i(687388),r=e.i(353885),o=e.i(393189),s=e.i(786025),l=e.i(211644);let h=`## The shell here
|
|
29
29
|
|
|
30
30
|
Every command is a new shell: \`cd\`, exported variables and an activated venv are gone by the next one — chain what depends on the last step into a single command.
|
|
31
31
|
|
|
32
32
|
Nothing is watching it. A command that stops to ask never gets an answer and is killed after ${n.EXEC_TIMEOUT_MS/1e3}s, so pass the flag that skips the question (\`-y\`, \`--yes\`, \`--no-input\`), and send anything genuinely long to the background with its output redirected to a file.
|
|
33
33
|
|
|
34
|
-
Keys are not in the environment: every variable named like a key, a token or a secret is removed before the shell starts. An empty one is not an unset one — say which it was, and ask for what a command needs.`;e.s(["createWorkspaceTools",0,(e,n)=>{let
|
|
34
|
+
Keys are not in the environment: every variable named like a key, a token or a secret is removed before the shell starts. An empty one is not an unset one — say which it was, and ask for what a command needs.`;e.s(["createWorkspaceTools",0,(e,n)=>{let c=!0===n.guide,d=async e=>{let t=n.bot;if(!t)return{result:await e(),memory:null};let a=await (0,o.holdBotMemory)(t);return{result:await e(),memory:await (0,o.keepBotMemory)(t,a)}},u=(0,a.tool)({description:l.BASH?"Run a bash command.":"Run a command in sh: this machine has no bash, so bash-only syntax fails.",inputSchema:i.default.object({command:i.default.string(),description:i.default.string().nullish().describe("One short line for the user: what this command does and why. Shown on their screen while it runs — not a restatement of the command.")}),execute:async({command:t},{abortSignal:a})=>{let{result:i,memory:r}=await d(()=>e.exec(t,{signal:a,env:n.env,timeoutMs:n.timeoutMs})),o=r?{...i,memory:r}:i;return c?(c=!1,{...o,guide:h}):o}});if(!n.write)return{[r.TOOL_NAMES.bash]:u};let m=(0,a.tool)({description:"Write a whole file — what was there is gone. Parent directories are created.",inputSchema:i.default.object({path:i.default.string().describe("Relative to the working directory — under one of its folders — or absolute"),content:i.default.string(),description:i.default.string().nullish().describe("One short line for the user: what this file is. Shown on their screen next to the path.")}),execute:async({path:a,content:i})=>{let r,o=e.resolve(a),l=(0,s.writeRefusal)(o,n.bot);if(l)return l;let{memory:h}=await d(()=>e.writeFile(a,i));return h??`Wrote ${(r=(0,t.relative)(e.cwd,o))&&!r.startsWith("..")?r:o} (${i.split("\n").length} lines)`}});return{[r.TOOL_NAMES.bash]:u,[r.TOOL_NAMES.write_file]:m}}])},636882,e=>e.a(async(t,a)=>{try{var i=e.i(666680),n=e.i(750227),r=e.i(687388),o=e.i(786025),s=e.i(640911),l=e.i(41444),h=e.i(696968),c=t([h]);[h]=c.then?(await c)():c;let u=(0,n.join)(r.APP_DIR,r.PATHS.skills.default),m=(0,n.join)(r.APP_DIR,r.PATHS.skills.seeds),w=(0,n.join)(r.DATA_DIR,r.PATHS.skills.custom),p=async(e,t)=>{let a,i=t?(a=t.trim().toLowerCase(),/^[a-z0-9][a-z0-9_-]*$/.test(a)?(0,n.join)(m,a):null):null;return d(e,t?[u,...i?[i]:[],(0,n.join)(o.WORKSPACE,(0,o.botFolder)(t),r.PATHS.skills.own),w]:[u,w],await (0,h.readSkillsOff)(),await (0,h.readRetired)())};async function d(e,t,a=new Set,n=new Map){let r=[],o=new Set;for(let c of t){let t;try{t=await e.readdir(c,{withFileTypes:!0})}catch{continue}for(let d of t){let t,u;if(!d.isDirectory())continue;let m=`${c}/${d.name}`,w=`${m}/SKILL.md`;try{t=await e.readFile(w,"utf-8")}catch{continue}try{u=(0,h.parseFrontmatter)(t)}catch(e){s.logger.warn(`skill ${m}: SKILL.md front matter did not load — ${(0,l.errorToString)(e)}`);continue}if(!(0,h.runsHere)(u))continue;let p=n.get(u.name);!(p?.has((0,i.createHash)("sha256").update(t,"utf8").digest("hex"))||o.has(u.name))&&(o.add(u.name),(0,h.isSkillOff)(u,a)||r.push({name:u.name,description:u.description,path:m}))}}return r}e.s(["loadSkills",0,p]),a()}catch(e){a(e)}},!1),388439,e=>{"use strict";let t=/[\u1100-\u11ff\u3040-\u30ff\u3130-\u318f\u4e00-\u9fff\uac00-\ud7af]/;function a(e){let a=0,i=0;for(let n of e)t.test(n)?a+=1:i+=1;return Math.ceil(a/1.3+i/4)}e.s(["estimateTokens",0,a,"sectionTokens",0,function(e){return e.split(/\n(?=## )/).map(e=>({name:e.startsWith("## ")?e.slice(3,e.indexOf("\n")):"identity",tokens:a(e)})).sort((e,t)=>t.tokens-e.tokens)}])}];
|
|
35
35
|
|
|
36
36
|
//# sourceMappingURL=_1q6e56i._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[952934,e=>{e.v(s=>Promise.all(["server/chunks/
|
|
1
|
+
module.exports=[952934,e=>{e.v(s=>Promise.all(["server/chunks/_06hnfi8._.js"].map(s=>e.l(s))).then(()=>s(482438)))},769449,e=>{"use strict";async function s(){{let{boot:s}=await e.A(952934);await s()}}e.s(["register",0,s])}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=_1qxheoa._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[874274,e=>e.a(async(t,a)=>{try{var l=e.i(22676),n=e.i(91264),s=t([l]);[l]=s.then?(await s)():s;let r=(0,n.serverRoute)(async e=>{let t=(await e.text()).trim();t&&await (0,l.endCall)(t)});e.s(["POST",0,r]),a()}catch(e){a(e)}},!1),552041,e=>{"use strict";var t=e.i(747909),a=e.i(174017),l=e.i(996250),n=e.i(759756),s=e.i(561916),r=e.i(174677),i=e.i(869741),o=e.i(316795),d=e.i(487718),c=e.i(995169),u=e.i(47587),p=e.i(666012),g=e.i(570101),b=e.i(626937),f=e.i(10372),h=e.i(193695);e.i(52474);var T=e.i(600220);let m=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/thursday/call/end/route",pathname:"/api/thursday/call/end",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/thursday/call/end/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(874274),...{}}),{workAsyncStorage:R,workUnitAsyncStorage:v,serverHooks:w}=m;async function y(e,t,l){l.requestMeta&&(0,n.setRequestMeta)(e,l.requestMeta),m.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let R="/api/thursday/call/end/route";R=R.replace(/\/index$/,"")||"/";let v=await m.prepare(e,t,{srcPage:R,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==l.waitUntil||l.waitUntil.call(l,Promise.resolve()),null;let{buildId:w,deploymentId:y,params:A,nextConfig:E,parsedUrl:C,isDraftMode:S,prerenderManifest:M,routerServerContext:x,isOnDemandRevalidate:I,revalidateOnlyGenerated:q,resolvedPathname:_,clientReferenceManifest:N,serverActionsManifest:O}=v,P=(0,i.normalizeAppPath)(R),D=!!(M.dynamicRoutes[P]||M.routes[_]),H=async()=>((null==x?void 0:x.render404)?await x.render404(e,t,C,!1):t.end("This page could not be found"),null);if(D&&!S){let e=!!M.routes[_],t=M.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await H();throw new h.NoFallbackError}}let L=null;!D||m.isDev||S||(L="/index"===(L=_)?"/":L);let U=!0===m.isDev||!D,k=D&&!U;O&&N&&(0,r.setManifestsSingleton)({page:R,clientReferenceManifest:N,serverActionsManifest:O});let j=e.method||"GET",K=(0,s.getTracer)(),B=K.getActiveScopeSpan(),F=!!(null==x?void 0:x.isWrappedByNextServer),Y=!!(0,n.getRequestMeta)(e,"minimalMode"),$=(0,n.getRequestMeta)(e,"incrementalCache")||await m.getIncrementalCache(e,E,M,Y);null==$||$.resetRequestCache(),globalThis.__incrementalCache=$;let G={params:A,previewProps:M.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts,useCacheTimeout:E.experimental.useCacheTimeout},cacheComponents:!!E.cacheComponents,validationLevel:E.experimental.instantInsights.validationLevel,supportsDynamicResponse:U,incrementalCache:$,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:E.cacheLife,staticPageGenerationTimeout:E.staticPageGenerationTimeout,waitUntil:l.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,l,n)=>m.onRequestError(e,t,l,n,x)},sharedContext:{buildId:w,deploymentId:y}},X=new o.NodeNextRequest(e),V=new o.NodeNextResponse(t),J=d.NextRequestAdapter.fromNodeNextRequest(X,(0,d.signalFromNodeResponse)(t)),W=async({previousCacheEntry:a})=>{try{if(!Y&&I&&q&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await m.handle(J,G);e.fetchMetrics=G.renderOpts.fetchMetrics;let s=G.renderOpts.pendingWaitUntil;s&&l.waitUntil&&(l.waitUntil(s),s=void 0);let r=G.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(X,V,n,s),null;{let e=await n.blob(),t=(0,g.toNodeOutgoingHttpHeaders)(n.headers);r&&(t[f.NEXT_CACHE_TAGS_HEADER]=r),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,l=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=f.INFINITE_CACHE?!1!==a&&a>0?E.expireTime:void 0:G.renderOpts.collectedExpire;return{value:{kind:T.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:l}}}}catch(t){throw(null==a?void 0:a.isStale)&&await m.onRequestError(e,t,{routerKind:"App Router",routePath:R,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:k,isOnDemandRevalidate:I})},!1,x),t}},z=async(n,r)=>{try{var i,o;let n=await m.handleResponse({req:e,nextConfig:E,cacheKey:L,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:M,isRoutePPREnabled:!1,isOnDemandRevalidate:I,revalidateOnlyGenerated:q,responseGenerator:W,waitUntil:l.waitUntil,isMinimalMode:Y});if(!D)return;if((null==n||null==(i=n.value)?void 0:i.kind)!==T.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(o=n.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});Y||t.setHeader("x-nextjs-cache",I?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,g.fromNodeOutgoingHttpHeaders)(n.value.headers);Y&&D||s.delete(f.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,b.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(X,V,new Response(n.value.body,{headers:s,status:n.value.status||200}));return}catch(t){if(t instanceof h.NoFallbackError||await m.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:k,isOnDemandRevalidate:I})},!1,x),D)throw t;await (0,p.sendResponse)(X,V,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:s.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let a=K.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==c.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let l=a.get("next.route")||P,i=`${j} ${l}`;n.setAttributes({"next.route":l,"http.route":l,"next.span_name":i}),n.updateName(i),r&&r!==n&&(r.setAttribute("http.route",l),r.updateName(i))})()}};if(F&&B)await z(B,void 0);else{let t=K.getActiveScopeSpan();await K.withPropagatedContext(e.headers,()=>K.trace(c.BaseServerSpan.handleRequest,{spanName:`${j} ${R}`,kind:s.SpanKind.SERVER,attributes:{"http.method":j,"http.target":e.url}},e=>z(e,t)),void 0,!F)}}e.s(["handler",0,y,"patchFetch",0,function(){return(0,l.patchFetch)({workAsyncStorage:R,workUnitAsyncStorage:v})},"routeModule",0,m,"serverHooks",0,w,"workAsyncStorage",0,R,"workUnitAsyncStorage",0,v])},22676,e=>e.a(async(t,a)=>{try{var l=e.i(875225),n=e.i(349129),s=e.i(518899),r=e.i(687388),i=e.i(528790),o=e.i(613240),d=e.i(911757),c=e.i(378884),u=e.i(340698),p=e.i(134344),g=t([i,c,u]);async function b(){let e=function(e){if(!e)return null;try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}(await (0,u.readConfig)(p.THURSDAY_KEYS.settings)),t=d.LiveSettingsSchema.parse((0,d.migrateLiveSettings)(e));return e?t:{...t,readSkills:await f()}}async function f(){return(await (0,u.readConfig)(p.THURSDAY_KEYS.wasSkills))?.trim()==="on"}async function h(e,t){return(await i.database.update(o.callTable).set({endedAt:new Date,...t?{endedReason:t.reason,seconds:t.seconds??null}:{}}).where((0,l.and)((0,l.eq)(o.callTable.id,e),(0,l.isNull)(o.callTable.endedAt))).returning({id:o.callTable.id})).length>0}async function T(e,t){for(let a of t)await i.database.insert(o.callMessageTable).values({callId:e,...a,fragments:a.fragments??null}).onConflictDoUpdate({target:[o.callMessageTable.callId,o.callMessageTable.id],set:{text:a.text,role:a.role,tool:a.tool??null,fragments:a.fragments??null}})}async function m(e){let[t]=await i.database.select({seq:s.sql`max(${o.callMessageTable.seq})`}).from(o.callMessageTable).where((0,l.eq)(o.callMessageTable.callId,e));return t?.seq==null?0:Number(t.seq)+1}async function R(e,t){await i.database.insert(o.callThoughtTable).values({callId:e,...t}).onConflictDoNothing()}async function v(e,t){let a=await i.database.select({callId:o.callMessageTable.callId,startedAt:o.callTable.startedAt,role:o.callMessageTable.role,tool:o.callMessageTable.tool,text:o.callMessageTable.text,seq:o.callMessageTable.seq}).from(o.callMessageTable).innerJoin(o.callTable,(0,l.eq)(o.callMessageTable.callId,o.callTable.id)).where(t?(0,l.ne)(o.callMessageTable.callId,t):void 0).orderBy((0,n.desc)(o.callTable.startedAt),(0,n.desc)(o.callMessageTable.seq)).limit(e),s=new Map;for(let e of a){let t=s.get(e.callId)??{callId:e.callId,startedAt:e.startedAt,turns:[]};t.turns.push({role:e.role,tool:e.tool,text:e.text,seq:e.seq}),s.set(e.callId,t)}return[...s.values()].reverse().map(e=>({...e,turns:e.turns.reverse()}))}async function w(){return(await i.database.select({id:o.callTable.id}).from(o.callTable).where((0,l.isNull)(o.callTable.endedAt)).limit(1)).length>0}async function y(e){let t=e.limit??r.CALL_HISTORY_PAGE,a=await i.database.select({id:o.callTable.id,provider:o.callTable.provider,model:o.callTable.model,backendModel:o.callTable.backendModel,startedAt:o.callTable.startedAt,endedAt:o.callTable.endedAt,endedReason:o.callTable.endedReason,seconds:o.callTable.seconds}).from(o.callTable).innerJoin(o.callMessageTable,(0,l.eq)(o.callMessageTable.callId,o.callTable.id)).where(e.before?(0,l.lt)(o.callTable.startedAt,e.before):void 0).groupBy(o.callTable.id).orderBy((0,n.desc)(o.callTable.startedAt)).limit(t);if(0===a.length)return[];let s=await i.database.select({callId:o.callMessageTable.callId,id:o.callMessageTable.id,role:o.callMessageTable.role,tool:o.callMessageTable.tool,text:o.callMessageTable.text,seq:o.callMessageTable.seq,fragments:o.callMessageTable.fragments,at:o.callMessageTable.at}).from(o.callMessageTable).where((0,l.inArray)(o.callMessageTable.callId,a.map(e=>e.id))).orderBy((0,n.asc)(o.callMessageTable.callId),(0,n.asc)(o.callMessageTable.seq)),d=new Map;for(let e of s){let{callId:t,...a}=e,l=d.get(t);l?l.push(a):d.set(t,[a])}let u=await (0,c.listCallJobs)(a.map(e=>e.id));return a.map(e=>({...e,turns:d.get(e.id)??[],jobs:u.filter(t=>t.callId===e.id).map(e=>({id:e.id,label:e.label,status:e.status,outcome:e.outcome}))}))}[i,c,u]=g.then?(await g)():g,e.s(["endCall",0,h,"isAnyCallLive",0,w,"listCallHistory",0,y,"listRecentTurns",0,v,"nextTurnSeq",0,m,"readLiveSettings",0,b,"saveThought",0,R,"saveTurns",0,T]),a()}catch(e){a(e)}},!1),134344,e=>{"use strict";var t=e.i(105249),a=e.i(264079),l=e.i(904309);let n=[{id:"chatgpt",...a.TEXT_MODEL_PROVIDERS.chatgpt},{id:"openai",...a.TEXT_MODEL_PROVIDERS.openai}],s=t.default.object({id:t.default.string().min(1),text:t.default.string(),said:t.default.boolean()}),r="note",i=e=>e.type===`data-${r}`?e.data:null;t.default.object({enabled:t.default.boolean(),phrase:t.default.string().trim().min(3).max(32)}),t.default.object({enabled:t.default.boolean(),combo:t.default.string().trim().min(1).max(64)}),t.default.enum(["off","waiting","any"]),t.default.enum(["center","sides"]),t.default.object({id:t.default.string().min(1),role:t.default.enum(["user","assistant","tool"]),tool:t.default.string().nullish(),text:t.default.string(),seq:t.default.number().int().min(0),fragments:t.default.array(l.LiveFragmentSchema).nullish()}),t.default.object({id:t.default.string().min(1),text:t.default.string(),seq:t.default.number().int().min(0)}),e.s(["TEXT_CALL_NOTE",0,r,"TEXT_CALL_PROVIDERS",0,n,"THURSDAY_KEYS",0,{settings:"THURSDAY_SETTINGS",wasSkills:"THURSDAY_SKILLS"},"TextCallNoteSchema",0,s,"noteOf",0,i,"notesIn",0,e=>e.flatMap(e=>e.parts.flatMap(e=>{let t=i(e);return t?[t]:[]})),"textCallRunsOn",0,e=>n.find(t=>e(t.apiKeyName))?.id??null])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_1t5ijzv._.js.map
|