thursday-agent 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +4 -4
- 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/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +12 -12
- package/.next/server/app/_not-found.segments/_full.segment.rsc +12 -12
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +11 -11
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/artifact/route.js +6 -6
- package/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route.js +5 -4
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/route.js +9 -9
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/route.js +9 -9
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/[id]/route.js +2 -2
- package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/file/route.js +12 -12
- package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/route.js +2 -2
- package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js +2 -2
- 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.nft.json +1 -1
- package/.next/server/app/api/file/[...path]/route.js +3 -3
- package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/credits/[provider]/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 +2 -2
- 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 +13 -13
- package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/route.js +1 -1
- package/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/reach/route.js +11 -11
- package/.next/server/app/api/reach/route.js.nft.json +1 -1
- package/.next/server/app/api/routine/route.js +9 -9
- package/.next/server/app/api/routine/route.js.nft.json +1 -1
- package/.next/server/app/api/running/route.js.nft.json +1 -1
- package/.next/server/app/api/signins/route.js +7 -6
- package/.next/server/app/api/signins/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js +8 -8
- package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +8 -8
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/end/route.js +6 -6
- package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/plan/route.js +16 -16
- package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
- 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 +6 -6
- package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/text/route.js +16 -16
- package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/tool-call/route.js +10 -10
- package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/files/route.js +1 -1
- package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/route.js +1 -1
- package/.next/server/app/api/workspace/route.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
- package/.next/server/app/artifact/[...path]/page.js +5 -5
- 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/react-loadable-manifest.json +2 -2
- package/.next/server/app/page/server-reference-manifest.json +162 -162
- package/.next/server/app/page.js +7 -7
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__019e1fy._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__01jpmcj._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__03bjojd._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__03vunn6._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__06kxzw-._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0atwstu._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__005onk_._.js → [root-of-the-server]__0cfv4rq._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0d-dfqm._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1-i6lgn._.js → [root-of-the-server]__0d00o4_._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0itmdqy._.js → [root-of-the-server]__0e8y4ok._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1tyftcr._.js → [root-of-the-server]__0eem_66._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0xn7a8p._.js → [root-of-the-server]__0jn2qbf._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__08922kg._.js → [root-of-the-server]__0l563r8._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0mh1tgg._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0mq0qmk._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1a7rgvy._.js → [root-of-the-server]__0pp2355._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1g08s7l._.js → [root-of-the-server]__0r77huw._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__10_v9ml._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1478lu3._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__16xao_p._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__17kdjf6._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__17m7ag9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__17yv6lg._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__19aqyg-._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__19imprr._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ceammd._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1fhule0._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1hing45._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0mttntm._.js → [root-of-the-server]__1ivfglf._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1jcu_e9._.js +5 -0
- package/.next/server/chunks/{[root-of-the-server]__0m0qglo._.js → [root-of-the-server]__1kb-dkn._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0eluax8._.js → [root-of-the-server]__1mowvzz._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1o7z93z._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1onvx8x._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1q_d6dj._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1u_6dhy._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1_wtn0q._.js → [root-of-the-server]__1yiqjfx._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1yr_vvq._.js +3 -0
- package/.next/server/chunks/_0-mqt2w._.js +3 -0
- package/.next/server/chunks/_0-qt5if._.js +1 -1
- package/.next/server/chunks/{_0fau3ya._.js → _00aztuo._.js} +2 -2
- package/.next/server/chunks/_021kabv._.js +53 -0
- package/.next/server/chunks/_032k4m6._.js +3 -0
- package/.next/server/chunks/_03p6r2-._.js +1 -1
- package/.next/server/chunks/_06b5b4-._.js +2 -2
- package/.next/server/chunks/_06u9yo-._.js +1 -1
- package/.next/server/chunks/_07mczew._.js +3 -0
- package/.next/server/chunks/_07pkeds._.js +1 -1
- package/.next/server/chunks/_08354bn._.js +22 -22
- package/.next/server/chunks/_083t_nr._.js +5 -0
- package/.next/server/chunks/_0c-s0ei._.js +3 -0
- package/.next/server/chunks/_0cq69mm._.js +1 -1
- package/.next/server/chunks/_0gifi_2._.js +7 -0
- package/.next/server/chunks/_0gxz_1b._.js +1 -1
- package/.next/server/chunks/{_1tjwvoz._.js → _0la8s6t._.js} +2 -2
- package/.next/server/chunks/_0p27in2._.js +1 -1
- package/.next/server/chunks/{_09rtyfn._.js → _0rn3c_0._.js} +24 -26
- package/.next/server/chunks/_0ue8nq-._.js +5 -1
- package/.next/server/chunks/{_1uu4wjr._.js → _0wkhub3._.js} +2 -2
- package/.next/server/chunks/_0wyh244._.js +22 -22
- package/.next/server/chunks/_0ynjnhl._.js +5 -0
- package/.next/server/chunks/_1-wp0r0._.js +1 -1
- package/.next/server/chunks/{_201k0ah._.js → _12-7atf._.js} +2 -2
- package/.next/server/chunks/{_02mn8d7._.js → _124q1p2._.js} +2 -2
- package/.next/server/chunks/{_14xuq46._.js → _13qoxq9._.js} +24 -26
- package/.next/server/chunks/{_11y8h29._.js → _15-_mie._.js} +2 -2
- package/.next/server/chunks/_1823_7a._.js +1 -1
- package/.next/server/chunks/{_0uir6hb._.js → _186uku9._.js} +2 -2
- package/.next/server/chunks/{_0ggqpiz._.js → _18sj4xf._.js} +2 -2
- package/.next/server/chunks/_19kea1l._.js +12 -12
- package/.next/server/chunks/_1ac33qw._.js +2 -2
- package/.next/server/chunks/{_18z965x._.js → _1chy-lk._.js} +2 -2
- package/.next/server/chunks/_1cw6-rv._.js +1 -1
- package/.next/server/chunks/_1evvnbp._.js +1 -1
- package/.next/server/chunks/_1f_x75d._.js +3 -0
- package/.next/server/chunks/_1gn2r2q._.js +7 -9
- package/.next/server/chunks/_1icgbi8._.js +1 -1
- package/.next/server/chunks/{_1ozcb6o._.js → _1k6bmez._.js} +2 -2
- package/.next/server/chunks/_1ko5shz._.js +1 -1
- package/.next/server/chunks/_1ksyu6r._.js +1 -1
- package/.next/server/chunks/_1kwmzab._.js +3 -0
- package/.next/server/chunks/_1lg0lsu._.js +1 -1
- package/.next/server/chunks/_1pv6xbq._.js +5 -0
- package/.next/server/chunks/_1q42187._.js +2 -2
- package/.next/server/chunks/_1q6e56i._.js +7 -9
- package/.next/server/chunks/_1t43w6q._.js +1 -1
- package/.next/server/chunks/_1t8fv7b._.js +1 -1
- package/.next/server/chunks/_1ufbxe1._.js +1 -1
- package/.next/server/chunks/_1wgae1c._.js +1 -1
- package/.next/server/chunks/_1xps4ob._.js +1 -1
- package/.next/server/chunks/_1znrlca._.js +3 -0
- package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
- package/.next/server/chunks/features_14kex_m._.js +11 -11
- package/.next/server/chunks/features_bot_08z387_._.js +2 -2
- package/.next/server/chunks/features_bot_1d6ghh5._.js +41 -0
- package/.next/server/chunks/features_bot_1dfrdsb._.js +10 -6
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0yd5xa0._.js → node_modules_consola_dist_chunks_prompt_mjs_0k--vqs._.js} +1 -1
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0ufuc3s._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__05qiosr._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0y03pu0._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0zt_au4._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0eloa6y._.js → [root-of-the-server]__17yeveo._.js} +5 -5
- package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1t38-p_._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1u42eh0._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__203utm3._.js +1 -1
- package/.next/server/chunks/ssr/{_0xurp8n._.js → _0-s7ria._.js} +2 -2
- package/.next/server/chunks/ssr/_03vw3u5._.js +3 -0
- package/.next/server/chunks/ssr/_088qe9a._.js +162 -0
- package/.next/server/chunks/ssr/_09a6bpd._.js +1 -1
- package/.next/server/chunks/ssr/{_0u43zjx._.js → _0a_pedm._.js} +2 -2
- package/.next/server/chunks/ssr/_0ali_i8._.js +3 -0
- package/.next/server/chunks/ssr/_0cd6g3l._.js +3 -3
- package/.next/server/chunks/ssr/{_1nwey7a._.js → _0eprrig._.js} +2 -2
- package/.next/server/chunks/ssr/_0flnog5._.js +3 -0
- package/.next/server/chunks/ssr/_0iuvjnw._.js +1 -1
- package/.next/server/chunks/ssr/{_0t_e9rd._.js → _0k-gl8l._.js} +2 -2
- package/.next/server/chunks/ssr/_0kmldic._.js +41 -0
- package/.next/server/chunks/ssr/_0ks03l-._.js +3 -0
- package/.next/server/chunks/ssr/_0mng-y8._.js +6 -0
- package/.next/server/chunks/ssr/_0tg3o37._.js +1 -1
- package/.next/server/chunks/ssr/_0ugzm_0._.js +3 -0
- package/.next/server/chunks/ssr/{_0ntol64._.js → _0wnv6c0._.js} +2 -2
- package/.next/server/chunks/ssr/{_0-y08rv._.js → _0z9zkd-._.js} +2 -2
- package/.next/server/chunks/ssr/_11l9kc0._.js +1 -1
- package/.next/server/chunks/ssr/_12_ail7._.js +3 -0
- package/.next/server/chunks/ssr/_16_7zeo._.js +1 -1
- package/.next/server/chunks/ssr/_16wjbs2._.js +3 -0
- package/.next/server/chunks/ssr/{_16o81mn._.js → _18rmqqu._.js} +2 -2
- package/.next/server/chunks/ssr/_1bfrntd._.js +2 -2
- package/.next/server/chunks/ssr/{_0gn_i4s._.js → _1ckje8g._.js} +2 -2
- package/.next/server/chunks/ssr/_1crszf7._.js +1 -1
- package/.next/server/chunks/ssr/_1h3qetc._.js +3 -0
- package/.next/server/chunks/ssr/{_1gz4ov7._.js → _1kpvfmn._.js} +3 -3
- package/.next/server/chunks/ssr/{_12hdw8x._.js → _1l-3enz._.js} +26 -28
- package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
- package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
- package/.next/server/chunks/ssr/{_0ux4i2m._.js → _1v1pcoh._.js} +2 -2
- package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
- package/.next/server/chunks/ssr/{features_bot_06n7hmd._.js → features_bot_0-7flc-._.js} +2 -2
- package/.next/server/chunks/ssr/features_bot_0tb4ui-._.js +1 -1
- package/.next/server/chunks/ssr/features_bot_1stfytf._.js +41 -0
- package/.next/server/chunks/ssr/features_config_10xs4l1._.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_thursday_0cf9y0b._.js +1 -1
- package/.next/server/chunks/ssr/features_thursday_components_here-globe_tsx_055duhw._.js +1 -1
- package/.next/server/chunks/ssr/lib_utils_ts_0_f1xvm._.js +1 -1
- package/.next/server/chunks/ssr/{node_modules_1i-g3bz._.js → node_modules_00mh9o-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1bvw77g._.js → node_modules_04f_uw2._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_16tn8xu._.js → node_modules_07udd3z._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0ksqeyy._.js → node_modules_08-pj-2._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0e398ts._.js → node_modules_098h6h5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_19r9vjv._.js → node_modules_0_7yfem._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_01v7ybp._.js → node_modules_0ayoorn._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0_zk6yd._.js → node_modules_0bp3vfu._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0m-dnm-._.js → node_modules_0ch5hqr._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0536cp2._.js → node_modules_0e-hyim._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0yn2z6s._.js → node_modules_0ffm9w3._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1jf8aik._.js → node_modules_0jzyuwk._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0m2oth3._.js → node_modules_0ln4iwf._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1dlue-g._.js → node_modules_0my2hph._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0cpegwf._.js → node_modules_0y_k4h5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_13dwal5._.js → node_modules_10bzndo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1ctm_ju._.js → node_modules_1b5rxw5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_01fukqn._.js → node_modules_1b_h09q._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_12hh0bx._.js → node_modules_1e83j9e._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_08m1gvh._.js → node_modules_1e9ugfy._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_06n6ruk._.js → node_modules_1hd66k0._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1zdz2zf._.js → node_modules_1inwr2m._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1zalmtr._.js → node_modules_1j9xx1k._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1kfbdfo._.js → node_modules_1k8kypa._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_056xgci._.js → node_modules_1oeu85h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0ie8g6a._.js → node_modules_1r2ghv5._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1fqgrh0._.js → node_modules_1ttpnib._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0nj1l8f._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0ir6p7s._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_17ok98u._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1ejf5ye._.js} +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- 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 +163 -163
- package/.next/static/chunks/02lze_e5sagjn.js +1 -0
- package/.next/static/chunks/{3866u-edsoyj3.js → 081kl7k8r6f8z.js} +1 -1
- package/.next/static/chunks/0_s4z70lx1tgs.js +1 -0
- package/.next/static/chunks/0fklfoj8o_msg.js +18 -0
- package/.next/static/chunks/0ve2gb0hw3wkq.js +1 -0
- package/.next/static/chunks/11c3uijgqik4m.js +39 -0
- package/.next/static/chunks/{0go5_9zqag7l0.js → 125lh2zzxk3r2.js} +1 -1
- package/.next/static/chunks/{3zv4wiqjl5kex.js → 166v36614ycsf.js} +1 -1
- package/.next/static/chunks/16np6727e61io.js +1 -0
- package/.next/static/chunks/18amidjlaqexf.js +1 -0
- package/.next/static/chunks/{35ehi-okrfot5.js → 1ettmta9iet7b.js} +1 -1
- package/.next/static/chunks/{1dy5xaxjdsy11.js → 1j4rndg17wgfk.js} +1 -1
- package/.next/static/chunks/{01r1uco3ikisc.js → 1mpz4epyg-7pz.js} +1 -1
- package/.next/static/chunks/{05blzta_1i7c2.js → 1oh4hbusfz97l.js} +1 -1
- package/.next/static/chunks/{3qfhjwd9yuijo.js → 1x1-44qmhu437.js} +1 -1
- package/.next/static/chunks/{0hpx0--bh7vld.js → 22jb4s3-8ckup.js} +1 -1
- package/.next/static/chunks/236le5kv_yj6a.css +1 -0
- package/.next/static/chunks/24op50z6sqi_5.js +1 -0
- package/.next/static/chunks/2eczs-lporqt6.js +1 -0
- package/.next/static/chunks/{2nbj2t9yp8ke9.js → 2sxclirl-c-um.js} +1 -1
- package/.next/static/chunks/2yfmmo4qr_f-m.js +1 -0
- package/.next/static/chunks/2z4sodeldj_86.js +1 -0
- package/.next/static/chunks/{3tyacy8fh5_18.js → 2zhiqxw61qowv.js} +2 -2
- package/.next/static/chunks/338dt83llhu5m.js +1 -0
- package/.next/static/chunks/3ezjz93yvzmop.js +4 -0
- package/.next/static/chunks/3h6rqjx92wva9.js +1 -0
- package/.next/static/chunks/3ph9u-51x6jhe.js +15 -0
- package/.next/static/chunks/{052u13mcoxt87.js → 3uf32hp_g9stz.js} +1 -1
- package/.next/static/chunks/3w7zt3xzyjn86.js +3 -0
- package/.next/static/chunks/3xkx7vqefm7on.js +2 -0
- package/.next/static/chunks/3ygk41pgsw7nv.js +1 -0
- package/.next/static/chunks/{3146sccz1j76i.js → 411uyd0is9u5s.js} +1 -1
- package/.next/static/chunks/4384atd5zerir.js +1 -0
- package/README.md +1 -1
- package/database/migrations/20260929121448_thread_started_by/migration.sql +1 -0
- package/database/migrations/20260929121448_thread_started_by/snapshot.json +1969 -0
- package/guide/bots.md +89 -44
- package/guide/calls.md +41 -25
- package/guide/index.md +5 -2
- package/guide/phone.md +7 -4
- package/guide/setup.md +12 -6
- package/guide/trouble.md +3 -2
- package/package.json +1 -1
- package/public/voices/intro/mic-b17ca82d.ogg +0 -0
- package/seed-skills/concierge/travel/SKILL.md +2 -1
- package/seed-skills/concierge/travel/page/itinerary.css +1009 -257
- package/seed-skills/concierge/travel/references/itinerary.md +95 -35
- package/seed-skills/concierge/travel/references/plan.md +11 -4
- package/seed-skills/concierge/travel/scripts/itinerary.mjs +754 -138
- package/skills/README.md +7 -4
- package/skills/artifact/SKILL.md +17 -13
- package/skills/artifact/references/canvas.md +4 -5
- package/skills/artifact/references/deck.md +93 -2
- package/skills/artifact/runtime/app/kit/src/index.css +35 -0
- package/skills/artifact/runtime/app/kit/tailwind.config.js +6 -0
- package/skills/artifact/runtime/deck/data.mjs +21 -0
- package/skills/artifact/runtime/deck/deck.css +254 -4
- package/skills/artifact/runtime/deck/deck.html +3 -0
- package/skills/artifact/runtime/deck/deck.js +88 -5
- package/skills/artifact/runtime/deck/deck.mjs +1 -17
- package/skills/artifact/runtime/document/quick.css +264 -89
- package/skills/artifact/runtime/document/quick.html +16 -7
- package/skills/artifact/runtime/document/quick.js +377 -98
- package/skills/artifact/runtime/render.mjs +52 -6
- package/skills/artifact/runtime/sheet/sheet.css +29 -21
- package/skills/artifact/runtime/shell/drafts.js +25 -0
- package/skills/artifact/runtime/shell/fonts/Geist-latin-ext.woff2 +0 -0
- package/skills/artifact/runtime/shell/fonts/Geist-latin.woff2 +0 -0
- package/skills/artifact/runtime/shell/fonts/GeistMono-latin-ext.woff2 +0 -0
- package/skills/artifact/runtime/shell/fonts/GeistMono-latin.woff2 +0 -0
- package/skills/artifact/runtime/shell/fonts/OFL.txt +93 -0
- package/skills/artifact/runtime/shell/head.html +27 -2
- package/skills/artifact/runtime/shell/shell.css +88 -8
- package/skills/artifact/runtime/shell/shell.js +318 -22
- package/skills/artifact/runtime/shell/wear.mjs +114 -12
- package/skills/artifact/scripts/app.mjs +5 -0
- package/skills/artifact/scripts/chart.mjs +20 -19
- package/skills/artifact/scripts/deck.mjs +276 -0
- package/skills/artifact/scripts/document.mjs +55 -2
- package/skills/artifact/scripts/media.mjs +1 -1
- package/skills/artifact/templates/boards/direction.html +55 -2
- package/skills/browser/SKILL.md +1 -1
- package/skills/browser/references/scripts.md +1 -1
- package/skills/daily-brief/SKILL.md +2 -0
- package/skills/daily-brief/page/brief.css +460 -302
- package/skills/daily-brief/references/brief.md +33 -7
- package/skills/daily-brief/scripts/page.mjs +241 -48
- package/skills/media-digest/SKILL.md +1 -0
- package/skills/media-digest/scripts/digest.mjs +57 -43
- package/.next/server/chunks/[root-of-the-server]__00f051a._.js +0 -7
- package/.next/server/chunks/[root-of-the-server]__0340k46._.js +0 -7
- package/.next/server/chunks/[root-of-the-server]__0ndw2yj._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__16y0k92._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__18e65_-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1a0xgyh._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__1dth047._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__1huywqp._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__1ij4h2a._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1q1s4ls._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1qa67zs._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1t-mfa4._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__20ofm9t._.js +0 -3
- package/.next/server/chunks/_0483t_f._.js +0 -5
- package/.next/server/chunks/_0lcthk8._.js +0 -3
- package/.next/server/chunks/_0uv1gs1._.js +0 -3
- package/.next/server/chunks/_17fjc-7._.js +0 -5
- package/.next/server/chunks/_1dcbwn-._.js +0 -3
- package/.next/server/chunks/_1mgzs18._.js +0 -3
- package/.next/server/chunks/_20qn224._.js +0 -3
- package/.next/server/chunks/features_bot_0zy_q8y._.js +0 -37
- package/.next/server/chunks/ssr/[root-of-the-server]__04upd5v._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0dy20eb._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0yyxgt2._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__14j8gxy._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__20t_4l2._.js +0 -3
- package/.next/server/chunks/ssr/_00buy3i._.js +0 -162
- package/.next/server/chunks/ssr/_014_wjp._.js +0 -3
- package/.next/server/chunks/ssr/_07m4ii5._.js +0 -3
- package/.next/server/chunks/ssr/_0cv9tmv._.js +0 -3
- package/.next/server/chunks/ssr/_0j6rtjm._.js +0 -6
- package/.next/server/chunks/ssr/_0ogkeu-._.js +0 -3
- package/.next/server/chunks/ssr/_10sc7ab._.js +0 -3
- package/.next/server/chunks/ssr/_14nwim3._.js +0 -37
- package/.next/server/chunks/ssr/_1e01b-_._.js +0 -3
- package/.next/server/chunks/ssr/_1nfv27b._.js +0 -3
- package/.next/server/chunks/ssr/features_bot_1c56lew._.js +0 -37
- package/.next/server/chunks/ssr/features_bot_1knyan7._.js +0 -3
- package/.next/server/chunks/ssr/features_config_09wq1s9._.js +0 -20
- package/.next/static/chunks/01gkq9y6_xk4a.js +0 -1
- package/.next/static/chunks/09kwsjbmr_z1w.js +0 -1
- package/.next/static/chunks/0ynv7zu_bguve.js +0 -1
- package/.next/static/chunks/0zi59tghmg1lu.js +0 -18
- package/.next/static/chunks/1_ftsgxa-sia_.js +0 -1
- package/.next/static/chunks/1cg3torc90q5t.js +0 -1
- package/.next/static/chunks/1qnx1h5c8f93b.js +0 -1
- package/.next/static/chunks/1rwn3d9ji5w35.js +0 -1
- package/.next/static/chunks/1so3f5fi7e5g9.js +0 -35
- package/.next/static/chunks/1ya41wxfmp4s8.js +0 -1
- package/.next/static/chunks/27rwkfu7_xvs1.js +0 -4
- package/.next/static/chunks/2hueh8masqd91.js +0 -15
- package/.next/static/chunks/2jrt_752fqz2f.js +0 -1
- package/.next/static/chunks/2ogme4qydxnaq.js +0 -3
- package/.next/static/chunks/2r2tocw2rpvm2.js +0 -1
- package/.next/static/chunks/2t4kimg1lt-p7.js +0 -2
- package/.next/static/chunks/2w6y71o27my_z.js +0 -1
- package/.next/static/chunks/31_am8rtmk_tv.css +0 -1
- package/.next/static/chunks/337g9g_ux2gj-.js +0 -1
- package/public/voices/intro/heard-1f12cd45.ogg +0 -0
- package/public/voices/intro/mic-e561372a.ogg +0 -0
- package/skills/artifact/references/book.md +0 -163
- package/skills/artifact/runtime/book/book.css +0 -256
- package/skills/artifact/runtime/book/book.html +0 -38
- package/skills/artifact/runtime/book/book.js +0 -81
- package/skills/artifact/scripts/book-pdf.mjs +0 -73
- package/skills/artifact/scripts/book-video.mjs +0 -168
- package/skills/artifact/scripts/book.mjs +0 -291
- /package/.next/static/{8exfHAtcoebYtxjUC4ugl → 6tIYlzfG_5P4sIxxgmucO}/_buildManifest.js +0 -0
- /package/.next/static/{8exfHAtcoebYtxjUC4ugl → 6tIYlzfG_5P4sIxxgmucO}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{8exfHAtcoebYtxjUC4ugl → 6tIYlzfG_5P4sIxxgmucO}/_ssgManifest.js +0 -0
- /package/seed-skills/{marketer → writer}/marketing/LICENSE +0 -0
- /package/seed-skills/{marketer → writer}/marketing/SKILL.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/copywriting-copy-frameworks.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/copywriting-natural-transitions.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/copywriting.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/emails-copy-guidelines.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/emails-email-types.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/emails-sequence-templates.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/emails.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/launch.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/product-marketing.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/seo-audit-ai-writing-detection.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/seo-audit-international-seo.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/seo-audit.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/social-carousel-frameworks.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/social-platform-limits.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/social-platforms.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/social-post-templates.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/social-reverse-engineering.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/social-short-form-video.md +0 -0
- /package/seed-skills/{marketer → writer}/marketing/references/social.md +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
module.exports=[113022,e=>e.a(async(t,n)=>{try{var o=e.i(691296),r=e.i(588762),i=e.i(333925),a=e.i(986507),s=e.i(636608),l=e.i(423620),u=e.i(330436),c=e.i(448548),d=e.i(690285),p=e.i(759118),h=e.i(391830),m=e.i(303583),g=e.i(308070),f=e.i(907883),y=e.i(156732),b=e.i(594537),_=e.i(51083),z=e.i(859727),w=e.i(951056),v=e.i(343229),k=e.i(871096),x=e.i(900533),S=e.i(938281),T=e.i(212389),I=e.i(610150),O=e.i(64774),E=t([a,l,p,h,m,g,f,b,v]);async function C(t){let{listThreadOverview:n}=await e.A(193435),o=await n();if(!o.length)return"No thread has been started yet.";let r=o.map(e=>`"${e.label}" (${e.bot}, ${e.status})`).join(", ");return`There is no thread called "${t}". The latest are: ${r}. Call again with one of those labels.`}async function A(e,t){let n=[];for(let[e,r]of Object.entries(t)){let t=await (0,o.asSchema)(r.inputSchema).jsonSchema,i="string"==typeof r.description?r.description:"";n.push({name:e,tokens:(0,I.estimateTokens)(i)+(0,I.estimateTokens)(JSON.stringify(t))})}n.sort((e,t)=>t.tokens-e.tokens);let r=n.reduce((e,t)=>e+t.tokens,0);S.logger.debug(`${e} tools ${r} tokens over ${n.length} — ${n.map(e=>`${e.name} ${e.tokens}`).join(", ")}`)}async function j(e){let t=await R(e);return i.IS_DEV&&await A(e.target,t),t}async function R(t){if("memory-edit"===t.target)return(0,h.createMemoryTools)("user",null,{countReads:!1});let n=(0,h.createMemoryTools)("call","thursday"===t.target?t.callId??null:null),S=await (0,k.openWorkspace)();if("thursday"===t.target){var I;let c,p,h=t.readSkills?(0,b.createSkillTools)({sandbox:S,skills:await (0,v.loadSkills)(S)}):{},f=!!(t.written&&t.model&&(0,a.seesToolImages)(t.model));return{...n,...h,...(0,z.createWorkspaceTools)(S,{write:!1,timeoutMs:i.CALL_EXEC_TIMEOUT_MS}),...!1===t.webSearch?{}:await (0,g.createCallSearchTool)(S),...Object.fromEntries(Object.entries((I=t.callId,c=async t=>{let{resolveThread:n}=await e.A(193435);return(t.trim()?await n(t.trim()):null)??await C(t)},p=async(t,n,o)=>{let r=await e.A(327784);try{return await r.answerThread(t,n,"thursday",o)}catch(e){if((0,T.isPublicError)(e))return e.message;throw e}},{[_.TOOL_NAMES.thread_start]:(0,o.tool)({description:l.threadStartSpec.description,inputSchema:l.threadStartSpec.parameters,execute:async({bot:t,request:n,label:o})=>{let{findJobBot:r,listJobBots:i}=await e.A(242792),a=await r(t);if(!a||a.disabled){let e=(await i()).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(327784);return{threadId:await s({bot:a.name,request:n,label:o,callId:I,from:"thursday"}),bot:a.name,label:o,note:`${a.name} has "${o}". Its updates reach the conversation on their own. Anything further about this work — a correction, the next step once it finishes — is \`${_.TOOL_NAMES.thread_tell}\` with "${o}"; a question it asks is answered with \`${_.TOOL_NAMES.thread_answer}\`.`}}}),[_.TOOL_NAMES.thread_tell]:(0,o.tool)({description:l.threadTellSpec.description,inputSchema:l.threadTellSpec.parameters,execute:async({thread:e,words:t})=>{let n=await c(e);if("string"==typeof n)return n;if(!t.trim())return"Say what to pass on.";let o=await p(n.id,t.trim());return"string"==typeof o?o:o?.answered?{label:n.label,answered:o.answered,note:`${o.answered.bot} was waiting on a question, and took this as its answer.`}:{label:n.label,bot:o?.to??n.bot,status:"running",note:"running"===n.status?"The bot reads it before its next step.":"The bot picks the thread back up from there."}}}),[_.TOOL_NAMES.thread_answer]:(0,o.tool)({description:l.threadAnswerSpec.description,inputSchema:l.threadAnswerSpec.parameters,execute:async({thread:t,bot:n,answer:o})=>{let r=await c(t);if("string"==typeof r)return r;if(!o.trim())return"Say what the answer is.";let{findThreadView:i}=await e.A(193435),a=(await i(r.id))?.room.questions??[],s=a.find(e=>e.bot.toLowerCase()===n.trim().toLowerCase());if(!s)return a.length?`${n} is not asking anything in "${r.label}". Waiting there: ${a.map(e=>e.bot).join(", ")}. Call again with that bot.`:`No question is waiting in "${r.label}". To say something else to it, use \`${_.TOOL_NAMES.thread_tell}\`.`;let l=await p(r.id,o.trim(),s.bot);return"string"==typeof l?l:{label:r.label,answered:l?.answered??{bot:s.bot,question:s.text},note:`${s.bot} has the answer to its question and goes on from it.`}}}),[_.TOOL_NAMES.thread_status]:(0,o.tool)({description:l.threadStatusSpec.description,inputSchema:l.threadStatusSpec.parameters,execute:async({thread:t})=>{let{listThreadOverview:n,findThreadView:o}=await e.A(193435),a={now:(0,s.clockNow)()},l=e=>(0,r.formatDistanceToNowStrict)((0,x.toDate)(e),{addSuffix:!0});if(!(!t.trim()||"all"===t.trim().toLowerCase())){let e=await c(t);if("string"==typeof e)return e;let n=(await o(e.id))?.room;return{...a,label:e.label,id:e.id,bot:e.bot,participants:n?.participants??[],questions:n?.questions??[],status:e.status,since:l(e.updatedAt),outcome:e.outcome,..."waiting"===e.status&&e.pending?.options.length?{options:e.pending.options}:{}}}let u=await n();return u.length?{...a,threads:u.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,O.clip)(e.text,i.PROMPT_LINE.threadStatus)})),since:l(e.updatedAt),...e.ask?{asking:e.ask.question,options:e.ask.options}:{},..."running"===e.status?{now:(0,w.threadActivity)(e.lines)}:{},...e.outcome&&"waiting"!==e.status?{outcome:(0,O.clip)(e.outcome,i.PROMPT_LINE.threadStatus)}:{}}))}:"No thread has been started yet."}}),[_.TOOL_NAMES.thread_cancel]:(0,o.tool)({description:l.threadCancelSpec.description,inputSchema:l.threadCancelSpec.parameters,execute:async({thread:t})=>{let n=await c(t);if("string"==typeof n)return n;let{cancelThread:o}=await e.A(327784);return await o(n.id),{label:n.label,status:"cancelled"}}}),[_.TOOL_NAMES.thread_show]:(0,o.tool)({description:l.threadShowSpec.description,inputSchema:l.threadShowSpec.parameters,execute:async({thread:t})=>{let n=await c(t);if("string"==typeof n)return n;let{appEvents:o}=await e.A(102473),{filesOnDisk:r}=await e.A(51833),{leadFirst:i,pathsIn:a,viewKindOf:s}=await e.A(890054),l=(await r(a(n.outcome??""),null)).filter(e=>"none"!==s(e));if(!l.length)return o.emit({type:"showThread",threadId:n.id}),{label:n.label,showing:"the thread"};let u=i(l);o.emit({type:"showFile",paths:u});let{markSeen:d}=await e.A(193435);return await d([n.id]),{label:n.label,showing:u[0]}}}),[_.TOOL_NAMES.thread_seen]:(0,o.tool)({description:l.threadSeenSpec.description,inputSchema:l.threadSeenSpec.parameters,execute:async({thread:t})=>{let n=await c(t);if("string"==typeof n)return n;let{markSeen:o}=await e.A(193435);return await o([n.id]),{label:n.label,seen:!0}}})})).filter(([e])=>!(t.phone&&e===_.TOOL_NAMES.thread_show))),...(0,m.createRoutineTools)(),...f?(0,d.createLookTool)():{},...t.written?{}:(0,u.callTools)()}}let E=await (0,v.loadSkills)(S,t.bot),A={...(0,k.jobShellEnv)(t.session),...(0,k.botShellEnv)(t.bot,(await (await e.A(242792)).findJobBot(t.bot))?.icon)},j=!!(t.model&&(0,a.seesToolImages)(t.model.ref));return{[_.TOOL_NAMES.memory_recall]:(0,h.createMemoryTools)("call",null,{tidies:!1})[_.TOOL_NAMES.memory_recall],...await (0,g.createSearchTool)(t.model,S),...(0,z.createWorkspaceTools)(S,{write:!0,env:A,guide:!0,bot:t.bot}),...await (0,p.createMcpTools)(t.bot,S),...(0,b.createSkillTools)({sandbox:S,skills:E,bot:t.bot}),...await (0,f.createSelfTools)(t.bot),...(0,c.createDeckTools)(S,t.bot,A,j),...j?(0,d.createLookTool)():{},...(0,y.createSignInTools)(S,t.bot,(0,k.jobShellEnv)(t.session)),...await (0,l.createThreadRecallTool)(t.bot,t.thread??null)}}[a,l,p,h,m,g,f,b,v]=E.then?(await E)():E,e.s(["loadTools",0,j]),n()}catch(e){n(e)}},!1),463103,e=>e.a(async(t,n)=>{try{e.i(333925);var o=e.i(724185),r=e.i(938281),i=e.i(212389),a=e.i(864328),s=t([o]);[o]=s.then?(await s)():s;let c={"x-ai":"spacexai","z-ai":"zai",mistralai:"mistral","meta-llama":"meta",qwen:"alibaba","bytedance-seed":"bytedance"},d=e=>{let t=e.slice(0,e.indexOf("/")).replace(/^~/,"");return c[t]??t};function l(e){if(null==e||""===e)return null;let t=Number(e);return!Number.isFinite(t)||t<0?null:Math.round(1e6*t*1e4)/1e4}async function u(){let e=await fetch("https://openrouter.ai/api/v1/models",{headers:{accept:"application/json"}}).catch(e=>{r.logger.warn({cause:e},"openrouter catalog unreachable"),(0,i.publicError)("Could not reach OpenRouter")});return e.ok||(0,i.publicError)(`OpenRouter answered ${e.status}`),((await e.json()).data??[]).filter(e=>!!e.id).map(e=>{let t,n,o,r;return{id:e.id,label:e.name||e.id,owner:d(e.id),type:(e.architecture?.output_modalities??[]).includes("text")?a.CATALOG_TEXT:null,tags:(e.supported_parameters??[]).includes("tools")?[a.CATALOG_TOOL_USE]:[],price:(t=l(e.pricing?.prompt),n=l(e.pricing?.completion),0===t&&0===n?{in:0,out:0,note:null,free:!0}:{in:t,out:n,note:null===t&&null===n?"per model it picks":null,free:!1}),retiring:!!e.expiration_date,contextWindow:"number"==typeof e.context_length&&e.context_length>0?e.context_length:null,efforts:(o=e.reasoning?.supported_efforts??[],(r=a.EFFORTS.filter(e=>o.includes(e))).length?r:null)}})}e.s(["fetchOpenRouterCatalog",0,u,"vendorOf",0,d]),n()}catch(e){n(e)}},!1),986507,e=>e.a(async(t,n)=>{try{var o=e.i(128278),r=e.i(882630),i=e.i(285346),a=e.i(885612),s=e.i(527133),l=e.i(605184),u=e.i(19698),c=e.i(352392),d=e.i(955066),p=e.i(970354),h=e.i(717433),m=e.i(853421),g=e.i(800405),f=e.i(296194),y=e.i(784913),b=e.i(734732),_=e.i(333925),z=e.i(656719),w=e.i(724185),v=e.i(938281),k=e.i(212389),x=e.i(64774),S=e.i(396217),T=e.i(864328),I=e.i(463103),O=t([w,S,I]);[w,S,I]=O.then?(await O)():O;let F=/context[ _-]?(length|window)|maximum context|prompt is too long|too many (input )?tokens|input token count|exceeds? the (maximum|model'?s?) (context|input|prompt|number of tokens)|maximum prompt length|request (entity )?too large/i;function E(e){return C(e).some(e=>{let{statusCode:t,message:n,error:o}=e;if(void 0!==t&&400!==t&&413!==t)return!1;let r=f.APICallError.isInstance(e)?e.responseBody:null;return[n,o,r].some(e=>"string"==typeof e&&F.test(e))})}let H=new Set([408,409,429]);function C(e){let t=[],n=[e];for(;n.length&&t.length<12;){let e=n.shift();!("object"!=typeof e||null===e||t.includes(e))&&(t.push(e),b.RetryError.isInstance(e)&&n.push(...e.errors),"cause"in e&&n.push(e.cause))}return t}let B=(e,t)=>({ref:e,model:t,searchTools:null}),W={};function A(e){if(null==e||""===e)return null;let t=Number(e);return Number.isFinite(t)?Math.round(1e6*t*1e4)/1e4:null}async function j(e){let t=W[e];if(t&&Date.now()-t.at<_.CATALOG_MS)return t.models;let n=("openrouter"===e?await (0,I.fetchOpenRouterCatalog)():await R()).sort((e,t)=>e.id.localeCompare(t.id));return W[e]={at:Date.now(),models:n},n}async function R(){let e=await fetch("https://ai-gateway.vercel.sh/v1/models",{headers:{accept:"application/json"}}).catch(e=>{v.logger.warn({cause:e},"gateway catalog unreachable"),(0,k.publicError)("Could not reach the gateway")});return e.ok||(0,k.publicError)(`The gateway answered ${e.status}`),((await e.json()).data??[]).filter(e=>!!e.id).map(e=>{let t,n;return{id:e.id,label:e.name||e.id,owner:e.owned_by||e.id.slice(0,e.id.indexOf("/")),type:e.type??null,tags:e.tags??[],price:function(e){let t=e.pricing??{},n=A(t.input),o=A(t.output);if((e.tags??[]).includes("free")||0===n)return{in:0,out:0,note:null,free:!0};let r=t.transcription_duration_cost_per_second??t.realtime_session_duration_cost_per_second;if(r)return{in:null,out:null,note:`$${r}/s`,free:!1};if(t.speech_input_character_cost)return{in:null,out:null,note:"per character",free:!1};let i=Array.isArray(t.video_duration_pricing)?t.video_duration_pricing[0]:null;if(i?.cost_per_second)return{in:null,out:null,note:`$${i.cost_per_second}/s ${i.resolution??""}`.trimEnd(),free:!1};let a=t.image?`$${t.image}/image`:t.image_dimension_quality_pricing?"per image, by size":null;return null===n&&null===o?{in:null,out:null,note:a,free:!1}:{in:n,out:o,note:t.input_tiers?"tiered":t.varies_by_provider?"varies":a&&"+ per image",free:!1}}(e),retiring:!!e.deprecated_at,contextWindow:"number"==typeof e.context_window&&e.context_window>0?e.context_window:null,efforts:(t=(e.reasoning_options??[]).find(e=>e?.type==="effort"),(n=T.EFFORTS.filter(e=>t?.values?.includes(e))).length?n:null)}})}async function $(e,t){if(t&&t>0)return t;let n=await M(e);return(0,T.compactAtFor)((0,T.contextWindowOf)(e.provider,e.model,n))}async function M(e){return(0,T.isCatalogProvider)(e.provider)?await j(e.provider).catch(()=>[]):[]}async function N(e,t){let n=t??T.effortSchema.safeParse(await (0,w.readConfig)(z.DEFAULT_EFFORT_KEY)).data;if(!n)return;let o=await M(e);return(0,T.effortsOf)(e.provider,e.model,o)?.includes(n)?n:void 0}async function L(e){return await j(e).then(e=>new Set(e.map(e=>e.id))).catch(()=>null)}async function P(e,t){if(!(0,T.isCatalogProvider)(e))return t;let n=await L(e);if(!n)return t;let o=t.filter(e=>n.has(e.id));return o.length>0?o:t}async function U(e){let{label:t,apiKeyName:n,signIn:f}=T.TEXT_MODEL_PROVIDERS[e.provider],_=await (0,w.readConfig)(n);return _||(0,k.publicError)(await (0,w.missingKeyWords)(n,f?`${t} is not signed in — sign in from Settings › API keys.`:`No ${t} key — add one in Settings › API keys.`)),function(e,t){switch(e.provider){case"openai":{let n=(0,p.createOpenAI)({apiKey:t});return{ref:e,model:n(e.model),searchTools:{search:n.tools.webSearch()}}}case"chatgpt":return{ref:e,model:(0,S.chatGptModel)(e.model),searchTools:{search:(0,S.chatGptSearch)()}};case"anthropic":{let n=(0,o.createAnthropic)({apiKey:t});return{ref:e,model:n(e.model),searchTools:{search:n.tools.webSearch_20260209()}}}case"google":{let n=(0,u.createGoogleGenerativeAI)({apiKey:t});return{ref:e,model:n(e.model),searchTools:{search:n.tools.googleSearch({})}}}case"xai":{let n=(0,m.createXai)({apiKey:t});return{ref:e,model:n(e.model),searchTools:{search:n.tools.webSearch()}}}case"mistral":return B(e,(0,d.createMistral)({apiKey:t})(e.model));case"deepseek":return B(e,(0,s.createDeepSeek)({apiKey:t})(e.model));case"groq":return B(e,(0,c.createGroq)({apiKey:t})(e.model));case"cerebras":return B(e,(0,r.createCerebras)({apiKey:t})(e.model));case"togetherai":return B(e,(0,h.createTogetherAI)({apiKey:t})(e.model));case"fireworks":return B(e,(0,l.createFireworks)({apiKey:t})(e.model));case"deepinfra":return B(e,(0,a.createDeepInfra)({apiKey:t})(e.model));case"cohere":return B(e,(0,i.createCohere)({apiKey:t})(e.model));case"vercel-ai-gateway":{let n=(0,y.createGateway)({apiKey:t});return{ref:e,model:n(e.model),searchTools:null}}case"openrouter":{var n;let o=(0,g.createOpenRouter)({apiKey:t});return{ref:e,model:(n=o(e.model),(0,b.wrapLanguageModel)({model:n,middleware:{specificationVersion:"v4",transformParams:async({params:e})=>e.reasoning&&"provider-default"!==e.reasoning?{...e,providerOptions:{...e.providerOptions,openrouter:{...e.providerOptions?.openrouter,reasoning:{effort:e.reasoning}}}}:e}})),searchTools:{search:o.tools.webSearch({})}}}default:(0,k.publicError)(`Not supported provider: ${String(e.provider)}`)}}(e,_)}async function q(e,{quiet:t=!1}={}){let n=async e=>(0,T.defaultModelOf)({defaultTier:"chatgpt"===e.id&&await (0,S.readChatGptPlan)()==="free"?"small":e.defaultTier,suggestModels:await P(e.id,e.suggestModels)}),o=e?T.TEXT_MODEL_PROVIDER_LIST.find(t=>t.id===e):void 0,r=["chatgpt","openai","xai"].map(e=>({...T.TEXT_MODEL_PROVIDERS[e],id:e}));if(o){let e=await n(o);if(e)return{provider:o.id,model:e}}let i=(0,T.parseTextModel)(await (0,w.readConfig)(z.DEFAULT_MODEL_KEY)??void 0);if(i){let{label:e,apiKeyName:t,signIn:n}=T.TEXT_MODEL_PROVIDERS[i.provider];if(await (0,w.readConfig)(t))return i;(0,k.publicError)(await (0,w.missingKeyWords)(t,n?`The default model is ${i.model} on ${e}, which is signed out — sign in again, or pick another in Settings › Models.`:`The default model is ${i.model}, and there is no ${e} key any more — add it in Settings › API keys, or pick another in Settings › Models.`))}for(let e of[...r,...T.TEXT_MODEL_PROVIDER_LIST]){if(!await (0,w.readConfig)(e.apiKeyName))continue;let o=await n(e);if(o)return t||v.logger.info(`no model set, falling back to ${e.id}/${o}`),{provider:e.id,model:o}}(0,k.publicError)("No model key is set — add one in Settings › API keys.")}async function D(e){let t=(0,T.parseMediaModel)(await (0,w.readConfig)(z.MEDIA_MODEL_KEYS[e]));if(!t){let t=await (0,w.readConfig)(T.MEDIA_MODEL_PROVIDERS.chatgpt.apiKeyName),n=t?(0,T.planMediaOf)(e,{plan:await (0,S.readChatGptPlan)()}):null;return n&&t?{ref:n,apiKey:t}:null}if(!(0,T.canMakeKind)(t.provider,e))return null;let n=await (0,w.readConfig)(T.MEDIA_MODEL_PROVIDERS[t.provider].apiKeyName);return n?{ref:t,apiKey:n}:null}e.s(["buildImageModel",0,function(e,t){switch(e.provider){case"openai":return(0,p.createOpenAI)({apiKey:t}).image(e.model);case"chatgpt":return(0,S.chatGptImageModel)(e.model);case"google":return(0,u.createGoogleGenerativeAI)({apiKey:t}).image(e.model);case"xai":return(0,m.createXai)({apiKey:t}).image(e.model);case"vercel-ai-gateway":return(0,y.createGateway)({apiKey:t}).image(e.model);default:(0,k.publicError)(`Not supported image provider: ${String(e.provider)}`)}},"buildSpeechModel",0,function(e,t){switch(e.provider){case"openai":return(0,p.createOpenAI)({apiKey:t}).speech(e.model);case"google":return(0,u.createGoogleGenerativeAI)({apiKey:t}).speech(e.model);case"xai":return(0,m.createXai)({apiKey:t}).speech();case"vercel-ai-gateway":return(0,y.createGateway)({apiKey:t}).speech(e.model);default:(0,k.publicError)(`Not supported speech provider: ${String(e.provider)}`)}},"buildTranscriptionModel",0,function(e,t){switch(e.provider){case"openai":return(0,p.createOpenAI)({apiKey:t}).transcription(e.model);case"google":return(0,u.createGoogleGenerativeAI)({apiKey:t}).transcription(e.model);case"xai":return(0,m.createXai)({apiKey:t}).transcription();case"vercel-ai-gateway":return(0,y.createGateway)({apiKey:t}).transcription(e.model);default:(0,k.publicError)(`Not supported transcription provider: ${String(e.provider)}`)}},"buildVideoModel",0,function(e,t){switch(e.provider){case"google":return(0,u.createGoogleGenerativeAI)({apiKey:t}).video(e.model);case"xai":return(0,m.createXai)({apiKey:t}).video(e.model);case"vercel-ai-gateway":return(0,y.createGateway)({apiKey:t}).video(e.model);default:(0,k.publicError)(`${e.provider} has no video model`)}},"compactBudget",0,$,"getTextModel",0,U,"isContextOverflow",0,E,"isPlanSpent",0,function(e){return C(e).some(e=>{if(!f.APICallError.isInstance(e)||402!==e.statusCode)return!1;try{let{code:t}=JSON.parse(e.responseBody??"").error??{};return"string"==typeof t&&S.PLAN_SPENT_CODE.test(t)}catch{return!1}})},"isProviderRefusal",0,function(e){return!E(e)&&C(e).some(e=>{let{statusCode:t}=e;return"number"==typeof t&&t>=400&&t<500&&!H.has(t)})},"modelErrorToString",0,function(e){if(!f.APICallError.isInstance(e))return(0,x.errorToString)(e);let t=e.statusCode?`(${e.statusCode})`:"",n=e.responseBody?.trim(),o=n&&!(e.message&&n.includes(e.message))?(0,x.clip)(n,300):"";return[e.message,t,o].filter(Boolean).join(" ")},"promptCacheOptions",0,function(e,t){switch(e.provider){case"openai":case"chatgpt":return t?{openai:{promptCacheKey:t}}:{};case"anthropic":return{anthropic:{cacheControl:{type:"ephemeral"}}};case"vercel-ai-gateway":return{gateway:{caching:"auto"}};case"openrouter":return"anthropic"===(0,I.vendorOf)(e.model)?{openrouter:{cacheControl:{type:"ephemeral"}}}:{};default:return{}}},"resolveDefaultModel",0,q,"resolveMediaRef",0,D,"runEffort",0,N,"seesToolImages",0,function(e){let t="vercel-ai-gateway"===e.provider?T.VENDOR_PROVIDERS[e.model.split("/")[0]]:"openrouter"===e.provider?T.VENDOR_PROVIDERS[(0,I.vendorOf)(e.model)]:e.provider;return void 0!==t&&["openai","chatgpt","anthropic","google","xai"].includes(t)}]),n()}catch(e){n(e)}},!1),475235,e=>e.a(async(t,n)=>{try{var o=e.i(489938),r=e.i(333925),i=e.i(973589),a=e.i(51083),s=e.i(75752),l=e.i(799791),u=e.i(951056),c=e.i(776857),d=e.i(600690),p=e.i(5509),h=e.i(993195),m=e.i(1363),g=e.i(343229),f=e.i(375814),y=e.i(871096),b=e.i(900533),_=e.i(64774),z=e.i(340697),w=e.i(636608),v=t([l,p,h,m,g,z]);async function k(e,t,n,i){var c,d,v,k,I,O,E,C,A,j;let R,$,M,N,L,P,U,q,D,F=await (0,y.openWorkspace)(),H=e.trim(),[B,W,K,V,J,G,Y,Z,X]=await Promise.all([(0,g.loadSkills)(F,H),(0,m.listNoteIndex)(),(0,z.listConnectedToolNames)(),(0,h.findPinnedTools)(H),(0,l.listJobBots)(),(0,s.listBotMemory)(H),(0,l.readBotMemoryOn)(),(0,y.readMachineTools)(F),(0,p.listBotWork)(H,n?.thread??null)]),Q=J.filter(e=>e.name!==H),ee=J.find(e=>e.name===H)??await (0,l.findJobBot)(H),et=[(c=H,d=ee,v=n,$=(R=v?.owner??c)===c?"**You** coordinate this thread: its result goes from you to Thursday.":`**${R}** coordinates this thread and brings its result to Thursday.`,M=v?`
|
|
1
|
+
module.exports=[113022,e=>e.a(async(t,n)=>{try{var o=e.i(691296),r=e.i(588762),i=e.i(333925),a=e.i(986507),s=e.i(636608),l=e.i(423620),u=e.i(330436),c=e.i(448548),d=e.i(690285),p=e.i(759118),h=e.i(391830),m=e.i(303583),g=e.i(308070),f=e.i(907883),y=e.i(156732),b=e.i(594537),_=e.i(51083),z=e.i(859727),w=e.i(951056),v=e.i(343229),k=e.i(871096),x=e.i(900533),S=e.i(938281),T=e.i(212389),I=e.i(610150),O=e.i(64774),E=t([a,l,p,h,m,g,f,b,v]);async function C(t){let{listThreadOverview:n}=await e.A(193435),o=await n();if(!o.length)return"No thread has been started yet.";let r=o.map(e=>`"${e.label}" (${e.bot}, ${e.status})`).join(", ");return`There is no thread called "${t}". The latest are: ${r}. Call again with one of those labels.`}async function A(e,t){let n=[];for(let[e,r]of Object.entries(t)){let t=await (0,o.asSchema)(r.inputSchema).jsonSchema,i="string"==typeof r.description?r.description:"";n.push({name:e,tokens:(0,I.estimateTokens)(i)+(0,I.estimateTokens)(JSON.stringify(t))})}n.sort((e,t)=>t.tokens-e.tokens);let r=n.reduce((e,t)=>e+t.tokens,0);S.logger.debug(`${e} tools ${r} tokens over ${n.length} — ${n.map(e=>`${e.name} ${e.tokens}`).join(", ")}`)}async function j(e){let t=await R(e);return i.IS_DEV&&await A(e.target,t),t}async function R(t){if("memory-edit"===t.target)return(0,h.createMemoryTools)("user",null,{countReads:!1});let n=(0,h.createMemoryTools)("call","thursday"===t.target?t.callId??null:null),S=await (0,k.openWorkspace)();if("thursday"===t.target){var I;let c,p,h=t.readSkills?(0,b.createSkillTools)({sandbox:S,skills:await (0,v.loadSkills)(S)}):{},f=!!(t.written&&t.model&&(0,a.seesToolImages)(t.model));return{...n,...h,...(0,z.createWorkspaceTools)(S,{write:!1,timeoutMs:i.CALL_EXEC_TIMEOUT_MS}),...!1===t.webSearch?{}:await (0,g.createCallSearchTool)(S),...Object.fromEntries(Object.entries((I=t.callId,c=async t=>{let{resolveThread:n}=await e.A(193435);return(t.trim()?await n(t.trim()):null)??await C(t)},p=async(t,n,o)=>{let r=await e.A(327784);try{return await r.answerThread(t,n,"thursday",o)}catch(e){if((0,T.isPublicError)(e))return e.message;throw e}},{[_.TOOL_NAMES.thread_start]:(0,o.tool)({description:l.threadStartSpec.description,inputSchema:l.threadStartSpec.parameters,execute:async({bot:t,request:n,label:o})=>{let{findJobBot:r,listJobBots:i}=await e.A(242792),a=await r(t);if(!a||a.disabled){let e=(await i()).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(327784);return{threadId:await s({bot:a.name,request:n,label:o,callId:I,from:"thursday"}),bot:a.name,label:o,note:`${a.name} has "${o}". Its updates reach the conversation on their own. Anything further about this work — a correction, the next step once it finishes — is \`${_.TOOL_NAMES.thread_tell}\` with "${o}"; a question it asks is answered with \`${_.TOOL_NAMES.thread_answer}\`.`}}}),[_.TOOL_NAMES.thread_tell]:(0,o.tool)({description:l.threadTellSpec.description,inputSchema:l.threadTellSpec.parameters,execute:async({thread:e,words:t})=>{let n=await c(e);if("string"==typeof n)return n;if(!t.trim())return"Say what to pass on.";let o=await p(n.id,t.trim());return"string"==typeof o?o:o?.answered?{label:n.label,answered:o.answered,note:`${o.answered.bot} was waiting on a question, and took this as its answer.`}:{label:n.label,bot:o?.to??n.bot,status:"running",note:"running"===n.status?"The bot reads it before its next step.":"The bot picks the thread back up from there."}}}),[_.TOOL_NAMES.thread_answer]:(0,o.tool)({description:l.threadAnswerSpec.description,inputSchema:l.threadAnswerSpec.parameters,execute:async({thread:t,bot:n,answer:o})=>{let r=await c(t);if("string"==typeof r)return r;if(!o.trim())return"Say what the answer is.";let{findThreadView:i}=await e.A(193435),a=(await i(r.id))?.room.questions??[],s=a.find(e=>e.bot.toLowerCase()===n.trim().toLowerCase());if(!s)return a.length?`${n} is not asking anything in "${r.label}". Waiting there: ${a.map(e=>e.bot).join(", ")}. Call again with that bot.`:`No question is waiting in "${r.label}". To say something else to it, use \`${_.TOOL_NAMES.thread_tell}\`.`;let l=await p(r.id,o.trim(),s.bot);return"string"==typeof l?l:{label:r.label,answered:l?.answered??{bot:s.bot,question:s.text},note:`${s.bot} has the answer to its question and goes on from it.`}}}),[_.TOOL_NAMES.thread_status]:(0,o.tool)({description:l.threadStatusSpec.description,inputSchema:l.threadStatusSpec.parameters,execute:async({thread:t})=>{let{listThreadOverview:n,findThreadView:o}=await e.A(193435),a={now:(0,s.clockNow)()},l=e=>(0,r.formatDistanceToNowStrict)((0,x.toDate)(e),{addSuffix:!0});if(!(!t.trim()||"all"===t.trim().toLowerCase())){let e=await c(t);if("string"==typeof e)return e;let n=(await o(e.id))?.room;return{...a,label:e.label,id:e.id,bot:e.bot,participants:n?.participants??[],questions:n?.questions??[],status:e.status,since:l(e.updatedAt),outcome:e.outcome,..."waiting"===e.status&&e.pending?.options.length?{options:e.pending.options}:{}}}let u=await n();return u.length?{...a,threads:u.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,O.clip)(e.text,i.PROMPT_LINE.threadStatus)})),since:l(e.updatedAt),...e.ask?{asking:e.ask.question,options:e.ask.options}:{},..."running"===e.status?{now:(0,w.threadActivity)(e.lines)}:{},...e.outcome&&"waiting"!==e.status?{outcome:(0,O.clip)(e.outcome,i.PROMPT_LINE.threadStatus)}:{}}))}:"No thread has been started yet."}}),[_.TOOL_NAMES.thread_cancel]:(0,o.tool)({description:l.threadCancelSpec.description,inputSchema:l.threadCancelSpec.parameters,execute:async({thread:t})=>{let n=await c(t);if("string"==typeof n)return n;let{cancelThread:o}=await e.A(327784);return await o(n.id),{label:n.label,status:"cancelled"}}}),[_.TOOL_NAMES.thread_show]:(0,o.tool)({description:l.threadShowSpec.description,inputSchema:l.threadShowSpec.parameters,execute:async({thread:t})=>{let n=await c(t);if("string"==typeof n)return n;let{appEvents:o}=await e.A(102473),{filesOnDisk:r}=await e.A(51833),{leadFirst:i,pathsIn:a,viewKindOf:s}=await e.A(890054),l=(await r(a(n.outcome??""),null)).filter(e=>"none"!==s(e));if(!l.length)return o.emit({type:"showThread",threadId:n.id}),{label:n.label,showing:"the thread"};let u=i(l);o.emit({type:"showFile",paths:u});let{markSeen:d}=await e.A(193435);return await d([n.id]),{label:n.label,showing:u[0]}}}),[_.TOOL_NAMES.thread_seen]:(0,o.tool)({description:l.threadSeenSpec.description,inputSchema:l.threadSeenSpec.parameters,execute:async({thread:t})=>{let n=await c(t);if("string"==typeof n)return n;let{markSeen:o}=await e.A(193435);return await o([n.id]),{label:n.label,seen:!0}}})})).filter(([e])=>!(t.phone&&e===_.TOOL_NAMES.thread_show))),...(0,m.createRoutineTools)(),...f?(0,d.createLookTool)():{},...t.written?{}:(0,u.callTools)()}}let E=await (0,v.loadSkills)(S,t.bot),A={...(0,k.jobShellEnv)(t.session),...(0,k.botShellEnv)(t.bot,(await (await e.A(242792)).findJobBot(t.bot))?.icon)},j=!!(t.model&&(0,a.seesToolImages)(t.model.ref));return{[_.TOOL_NAMES.memory_recall]:(0,h.createMemoryTools)("call",null,{tidies:!1})[_.TOOL_NAMES.memory_recall],...await (0,g.createSearchTool)(t.model,S),...(0,z.createWorkspaceTools)(S,{write:!0,env:A,guide:!0,bot:t.bot}),...await (0,p.createMcpTools)(t.bot,S),...(0,b.createSkillTools)({sandbox:S,skills:E,bot:t.bot}),...await (0,f.createSelfTools)(t.bot),...(0,c.createDeckTools)(S,t.bot,A,j),...j?(0,d.createLookTool)():{},...(0,y.createSignInTools)(S,t.bot,(0,k.jobShellEnv)(t.session)),...await (0,l.createThreadRecallTool)(t.bot,t.thread??null)}}[a,l,p,h,m,g,f,b,v]=E.then?(await E)():E,e.s(["loadTools",0,j]),n()}catch(e){n(e)}},!1),463103,e=>e.a(async(t,n)=>{try{e.i(333925);var o=e.i(724185),r=e.i(938281),i=e.i(212389);e.i(64774);var a=e.i(864328),s=t([o]);[o]=s.then?(await s)():s;let c={"x-ai":"spacexai","z-ai":"zai",mistralai:"mistral","meta-llama":"meta",qwen:"alibaba","bytedance-seed":"bytedance"},d=e=>{let t=e.slice(0,e.indexOf("/")).replace(/^~/,"");return c[t]??t};function l(e){if(null==e||""===e)return null;let t=Number(e);return!Number.isFinite(t)||t<0?null:Math.round(1e6*t*1e4)/1e4}async function u(){let e=await fetch("https://openrouter.ai/api/v1/models",{headers:{accept:"application/json"}}).catch(e=>{r.logger.warn({cause:e},"openrouter catalog unreachable"),(0,i.publicError)("Could not reach OpenRouter")});return e.ok||(0,i.publicError)(`OpenRouter answered ${e.status}`),((await e.json()).data??[]).filter(e=>!!e.id).map(e=>{let t,n,o,r;return{id:e.id,label:e.name||e.id,owner:d(e.id),type:(e.architecture?.output_modalities??[]).includes("text")?a.CATALOG_TEXT:null,tags:(e.supported_parameters??[]).includes("tools")?[a.CATALOG_TOOL_USE]:[],price:(t=l(e.pricing?.prompt),n=l(e.pricing?.completion),0===t&&0===n?{in:0,out:0,note:null,free:!0}:{in:t,out:n,note:null===t&&null===n?"per model it picks":null,free:!1}),retiring:!!e.expiration_date,contextWindow:"number"==typeof e.context_length&&e.context_length>0?e.context_length:null,efforts:(o=e.reasoning?.supported_efforts??[],(r=a.EFFORTS.filter(e=>o.includes(e))).length?r:null)}})}e.s(["fetchOpenRouterCatalog",0,u,"vendorOf",0,d]),n()}catch(e){n(e)}},!1),986507,e=>e.a(async(t,n)=>{try{var o=e.i(128278),r=e.i(882630),i=e.i(285346),a=e.i(885612),s=e.i(527133),l=e.i(605184),u=e.i(19698),c=e.i(352392),d=e.i(955066),p=e.i(970354),h=e.i(717433),m=e.i(853421),g=e.i(800405),f=e.i(296194),y=e.i(784913),b=e.i(734732),_=e.i(333925),z=e.i(656719),w=e.i(724185),v=e.i(938281),k=e.i(212389),x=e.i(64774),S=e.i(396217),T=e.i(864328),I=e.i(463103),O=t([w,S,I]);[w,S,I]=O.then?(await O)():O;let F=/context[ _-]?(length|window)|maximum context|prompt is too long|too many (input )?tokens|input token count|exceeds? the (maximum|model'?s?) (context|input|prompt|number of tokens)|maximum prompt length|request (entity )?too large/i;function E(e){return C(e).some(e=>{let{statusCode:t,message:n,error:o}=e;if(void 0!==t&&400!==t&&413!==t)return!1;let r=f.APICallError.isInstance(e)?e.responseBody:null;return[n,o,r].some(e=>"string"==typeof e&&F.test(e))})}let H=new Set([408,409,429]);function C(e){let t=[],n=[e];for(;n.length&&t.length<12;){let e=n.shift();!("object"!=typeof e||null===e||t.includes(e))&&(t.push(e),b.RetryError.isInstance(e)&&n.push(...e.errors),"cause"in e&&n.push(e.cause))}return t}let B=(e,t)=>({ref:e,model:t,searchTools:null}),W={};function A(e){if(null==e||""===e)return null;let t=Number(e);return Number.isFinite(t)?Math.round(1e6*t*1e4)/1e4:null}async function j(e){let t=W[e];if(t&&Date.now()-t.at<_.CATALOG_MS)return t.models;let n=("openrouter"===e?await (0,I.fetchOpenRouterCatalog)():await R()).sort((e,t)=>e.id.localeCompare(t.id));return W[e]={at:Date.now(),models:n},n}async function R(){let e=await fetch("https://ai-gateway.vercel.sh/v1/models",{headers:{accept:"application/json"}}).catch(e=>{v.logger.warn({cause:e},"gateway catalog unreachable"),(0,k.publicError)("Could not reach the gateway")});return e.ok||(0,k.publicError)(`The gateway answered ${e.status}`),((await e.json()).data??[]).filter(e=>!!e.id).map(e=>{let t,n;return{id:e.id,label:e.name||e.id,owner:e.owned_by||e.id.slice(0,e.id.indexOf("/")),type:e.type??null,tags:e.tags??[],price:function(e){let t=e.pricing??{},n=A(t.input),o=A(t.output);if((e.tags??[]).includes("free")||0===n)return{in:0,out:0,note:null,free:!0};let r=t.transcription_duration_cost_per_second??t.realtime_session_duration_cost_per_second;if(r)return{in:null,out:null,note:`$${r}/s`,free:!1};if(t.speech_input_character_cost)return{in:null,out:null,note:"per character",free:!1};let i=Array.isArray(t.video_duration_pricing)?t.video_duration_pricing[0]:null;if(i?.cost_per_second)return{in:null,out:null,note:`$${i.cost_per_second}/s ${i.resolution??""}`.trimEnd(),free:!1};let a=t.image?`$${t.image}/image`:t.image_dimension_quality_pricing?"per image, by size":null;return null===n&&null===o?{in:null,out:null,note:a,free:!1}:{in:n,out:o,note:t.input_tiers?"tiered":t.varies_by_provider?"varies":a&&"+ per image",free:!1}}(e),retiring:!!e.deprecated_at,contextWindow:"number"==typeof e.context_window&&e.context_window>0?e.context_window:null,efforts:(t=(e.reasoning_options??[]).find(e=>e?.type==="effort"),(n=T.EFFORTS.filter(e=>t?.values?.includes(e))).length?n:null)}})}async function $(e,t){if(t&&t>0)return t;let n=await M(e);return(0,T.compactAtFor)((0,T.contextWindowOf)(e.provider,e.model,n))}async function M(e){return(0,T.isCatalogProvider)(e.provider)?await j(e.provider).catch(()=>[]):[]}async function N(e,t){let n=t??T.effortSchema.safeParse(await (0,w.readConfig)(z.DEFAULT_EFFORT_KEY)).data;if(!n)return;let o=await M(e);return(0,T.effortsOf)(e.provider,e.model,o)?.includes(n)?n:void 0}async function L(e){return await j(e).then(e=>new Set(e.map(e=>e.id))).catch(()=>null)}async function P(e,t){if(!(0,T.isCatalogProvider)(e))return t;let n=await L(e);if(!n)return t;let o=t.filter(e=>n.has(e.id));return o.length>0?o:t}async function U(e){let{label:t,apiKeyName:n,signIn:f}=T.TEXT_MODEL_PROVIDERS[e.provider],_=await (0,w.readConfig)(n);return _||(0,k.publicError)(await (0,w.missingKeyWords)(n,f?`${t} is not signed in — sign in from Settings › API keys.`:`No ${t} key — add one in Settings › API keys.`)),function(e,t){switch(e.provider){case"openai":{let n=(0,p.createOpenAI)({apiKey:t});return{ref:e,model:n(e.model),searchTools:{search:n.tools.webSearch()}}}case"chatgpt":return{ref:e,model:(0,S.chatGptModel)(e.model),searchTools:{search:(0,S.chatGptSearch)()}};case"anthropic":{let n=(0,o.createAnthropic)({apiKey:t});return{ref:e,model:n(e.model),searchTools:{search:n.tools.webSearch_20260209()}}}case"google":{let n=(0,u.createGoogleGenerativeAI)({apiKey:t});return{ref:e,model:n(e.model),searchTools:{search:n.tools.googleSearch({})}}}case"xai":{let n=(0,m.createXai)({apiKey:t});return{ref:e,model:n(e.model),searchTools:{search:n.tools.webSearch()}}}case"mistral":return B(e,(0,d.createMistral)({apiKey:t})(e.model));case"deepseek":return B(e,(0,s.createDeepSeek)({apiKey:t})(e.model));case"groq":return B(e,(0,c.createGroq)({apiKey:t})(e.model));case"cerebras":return B(e,(0,r.createCerebras)({apiKey:t})(e.model));case"togetherai":return B(e,(0,h.createTogetherAI)({apiKey:t})(e.model));case"fireworks":return B(e,(0,l.createFireworks)({apiKey:t})(e.model));case"deepinfra":return B(e,(0,a.createDeepInfra)({apiKey:t})(e.model));case"cohere":return B(e,(0,i.createCohere)({apiKey:t})(e.model));case"vercel-ai-gateway":{let n=(0,y.createGateway)({apiKey:t});return{ref:e,model:n(e.model),searchTools:null}}case"openrouter":{var n;let o=(0,g.createOpenRouter)({apiKey:t});return{ref:e,model:(n=o(e.model),(0,b.wrapLanguageModel)({model:n,middleware:{specificationVersion:"v4",transformParams:async({params:e})=>e.reasoning&&"provider-default"!==e.reasoning?{...e,providerOptions:{...e.providerOptions,openrouter:{...e.providerOptions?.openrouter,reasoning:{effort:e.reasoning}}}}:e}})),searchTools:{search:o.tools.webSearch({})}}}default:(0,k.publicError)(`Not supported provider: ${String(e.provider)}`)}}(e,_)}async function q(e,{quiet:t=!1}={}){let n=async e=>(0,T.defaultModelOf)({defaultTier:"chatgpt"===e.id&&await (0,S.readChatGptPlan)()==="free"?"small":e.defaultTier,suggestModels:await P(e.id,e.suggestModels)}),o=e?T.TEXT_MODEL_PROVIDER_LIST.find(t=>t.id===e):void 0,r=["chatgpt","openai","xai"].map(e=>({...T.TEXT_MODEL_PROVIDERS[e],id:e}));if(o){let e=await n(o);if(e)return{provider:o.id,model:e}}let i=(0,T.parseTextModel)(await (0,w.readConfig)(z.DEFAULT_MODEL_KEY)??void 0);if(i){let{label:e,apiKeyName:t,signIn:n}=T.TEXT_MODEL_PROVIDERS[i.provider];if(await (0,w.readConfig)(t))return i;(0,k.publicError)(await (0,w.missingKeyWords)(t,n?`The default model is ${i.model} on ${e}, which is signed out — sign in again, or pick another in Settings › Models.`:`The default model is ${i.model}, and there is no ${e} key any more — add it in Settings › API keys, or pick another in Settings › Models.`))}for(let e of[...r,...T.TEXT_MODEL_PROVIDER_LIST]){if(!await (0,w.readConfig)(e.apiKeyName))continue;let o=await n(e);if(o)return t||v.logger.info(`no model set, falling back to ${e.id}/${o}`),{provider:e.id,model:o}}(0,k.publicError)("No model key is set — add one in Settings › API keys.")}async function D(e){let t=(0,T.parseMediaModel)(await (0,w.readConfig)(z.MEDIA_MODEL_KEYS[e]));if(!t){let t=await (0,w.readConfig)(T.MEDIA_MODEL_PROVIDERS.chatgpt.apiKeyName),n=t?(0,T.planMediaOf)(e,{plan:await (0,S.readChatGptPlan)()}):null;return n&&t?{ref:n,apiKey:t}:null}if(!(0,T.canMakeKind)(t.provider,e))return null;let n=await (0,w.readConfig)(T.MEDIA_MODEL_PROVIDERS[t.provider].apiKeyName);return n?{ref:t,apiKey:n}:null}e.s(["buildImageModel",0,function(e,t){switch(e.provider){case"openai":return(0,p.createOpenAI)({apiKey:t}).image(e.model);case"chatgpt":return(0,S.chatGptImageModel)(e.model);case"google":return(0,u.createGoogleGenerativeAI)({apiKey:t}).image(e.model);case"xai":return(0,m.createXai)({apiKey:t}).image(e.model);case"vercel-ai-gateway":return(0,y.createGateway)({apiKey:t}).image(e.model);default:(0,k.publicError)(`Not supported image provider: ${String(e.provider)}`)}},"buildSpeechModel",0,function(e,t){switch(e.provider){case"openai":return(0,p.createOpenAI)({apiKey:t}).speech(e.model);case"google":return(0,u.createGoogleGenerativeAI)({apiKey:t}).speech(e.model);case"xai":return(0,m.createXai)({apiKey:t}).speech();case"vercel-ai-gateway":return(0,y.createGateway)({apiKey:t}).speech(e.model);default:(0,k.publicError)(`Not supported speech provider: ${String(e.provider)}`)}},"buildTranscriptionModel",0,function(e,t){switch(e.provider){case"openai":return(0,p.createOpenAI)({apiKey:t}).transcription(e.model);case"google":return(0,u.createGoogleGenerativeAI)({apiKey:t}).transcription(e.model);case"xai":return(0,m.createXai)({apiKey:t}).transcription();case"vercel-ai-gateway":return(0,y.createGateway)({apiKey:t}).transcription(e.model);default:(0,k.publicError)(`Not supported transcription provider: ${String(e.provider)}`)}},"buildVideoModel",0,function(e,t){switch(e.provider){case"google":return(0,u.createGoogleGenerativeAI)({apiKey:t}).video(e.model);case"xai":return(0,m.createXai)({apiKey:t}).video(e.model);case"vercel-ai-gateway":return(0,y.createGateway)({apiKey:t}).video(e.model);default:(0,k.publicError)(`${e.provider} has no video model`)}},"compactBudget",0,$,"getTextModel",0,U,"isContextOverflow",0,E,"isKeyRefused",0,function(e){return C(e).some(e=>401===e.statusCode)},"isPlanSpent",0,function(e){return C(e).some(e=>{if(!f.APICallError.isInstance(e)||402!==e.statusCode)return!1;try{let{code:t}=JSON.parse(e.responseBody??"").error??{};return"string"==typeof t&&S.PLAN_SPENT_CODE.test(t)}catch{return!1}})},"isProviderRefusal",0,function(e){return!E(e)&&C(e).some(e=>{let{statusCode:t}=e;return"number"==typeof t&&t>=400&&t<500&&!H.has(t)})},"modelErrorToString",0,function(e){if(!f.APICallError.isInstance(e))return(0,x.errorToString)(e);let t=e.statusCode?`(${e.statusCode})`:"",n=e.responseBody?.trim(),o=n&&!(e.message&&n.includes(e.message))?(0,x.clip)(n,300):"";return[e.message,t,o].filter(Boolean).join(" ")},"promptCacheOptions",0,function(e,t){switch(e.provider){case"openai":case"chatgpt":return t?{openai:{promptCacheKey:t}}:{};case"anthropic":return{anthropic:{cacheControl:{type:"ephemeral"}}};case"vercel-ai-gateway":return{gateway:{caching:"auto"}};case"openrouter":return"anthropic"===(0,I.vendorOf)(e.model)?{openrouter:{cacheControl:{type:"ephemeral"}}}:{};default:return{}}},"resolveDefaultModel",0,q,"resolveMediaRef",0,D,"runEffort",0,N,"seesToolImages",0,function(e){let t="vercel-ai-gateway"===e.provider?T.VENDOR_PROVIDERS[e.model.split("/")[0]]:"openrouter"===e.provider?T.VENDOR_PROVIDERS[(0,I.vendorOf)(e.model)]:e.provider;return void 0!==t&&["openai","chatgpt","anthropic","google","xai"].includes(t)}]),n()}catch(e){n(e)}},!1),475235,e=>e.a(async(t,n)=>{try{var o=e.i(489938),r=e.i(333925),i=e.i(973589),a=e.i(51083),s=e.i(75752),l=e.i(799791),u=e.i(951056),c=e.i(776857),d=e.i(352985),p=e.i(600690),h=e.i(5509),m=e.i(993195),g=e.i(1363),f=e.i(343229),y=e.i(375814),b=e.i(871096),_=e.i(900533),z=e.i(64774),w=e.i(340697),v=e.i(636608),k=t([l,h,m,g,f,w]);async function x(e,t,n,i){var c,d,p,k,x,O,E,C,A,j;let R,$,M,N,L,P,U,q,D,F=await (0,b.openWorkspace)(),H=e.trim(),[B,W,K,V,J,G,Y,Z,X]=await Promise.all([(0,f.loadSkills)(F,H),(0,g.listNoteIndex)(),(0,w.listConnectedToolNames)(),(0,m.findPinnedTools)(H),(0,l.listJobBots)(),(0,s.listBotMemory)(H),(0,l.readBotMemoryOn)(),(0,b.readMachineTools)(F),(0,h.listBotWork)(H,n?.thread??null)]),Q=J.filter(e=>e.name!==H),ee=J.find(e=>e.name===H)??await (0,l.findJobBot)(H),et=[(c=H,d=ee,p=n,$=(R=p?.owner??c)===c?"**You** coordinate this thread: its result goes from you to Thursday.":`**${R}** coordinates this thread and brings its result to Thursday.`,M=p?`
|
|
2
2
|
|
|
3
|
-
Current conversation: ${
|
|
4
|
-
Others know you as: ${(0,u.rosterLine)(d)}`:"",L=
|
|
3
|
+
Current conversation: ${p.caller} → ${c}. Your final text goes back to ${p.caller}.`:"",N=d?`
|
|
4
|
+
Others know you as: ${(0,u.rosterLine)(d)}`:"",L=S(c,p)?"your tools, the other bots, this machine":`your tools, this machine, and the other bots through ${R}`,`You are ${c}, one of the bots in this thread. ${(0,v.todayLine)()}${N}
|
|
5
5
|
|
|
6
6
|
- **The user** — the one person all of this is for. They talk with Thursday by voice and follow this thread on their screen.
|
|
7
7
|
- **Thursday** — their personal assistant. She talks with them, hands bots the work that takes time, and tells them what comes back.
|
|
@@ -16,32 +16,32 @@ What Thursday keeps from talking with them. When the job needs something about t
|
|
|
16
16
|
|
|
17
17
|
path — what it is about (facts)
|
|
18
18
|
|
|
19
|
-
${(0,
|
|
19
|
+
${(0,v.noteLines)(k)}`),function(e,t){let n=new Set(t.map(e=>`${e.server}/${e.name}`)),o=e.filter(e=>!n.has(`${e.server}/${e.name}`));if(0===o.length)return"";let r=n.size?" The ones you already hold are in your tools instead.":"";return`## Connected tools
|
|
20
20
|
|
|
21
|
-
${(0,
|
|
21
|
+
${(0,v.mcpToolLines)(o)}
|
|
22
22
|
|
|
23
|
-
Names only: \`${a.TOOL_NAMES.tool_search}\` returns what each one takes, \`${a.TOOL_NAMES.tool_call}\` runs one.${r}`}(K,V),(
|
|
23
|
+
Names only: \`${a.TOOL_NAMES.tool_search}\` returns what each one takes, \`${a.TOOL_NAMES.tool_call}\` runs one.${r}`}(K,V),(x=B,0===x.length?"":`## Skills
|
|
24
24
|
|
|
25
25
|
Written-down ways of doing things. Open one with \`${a.TOOL_NAMES.load_skill}\` before a job it covers, unless its instructions are already in your conversation.
|
|
26
26
|
|
|
27
|
-
${(0,
|
|
27
|
+
${(0,v.skillLines)(x)}`),I(F.cwd,Z,i),Y?(O=(0,s.botMemoryFolder)(H),P=(E=G).entries.length?E.entries.map(({file:e,line:t,at:n})=>{let i=t?` — ${(0,z.clip)(t,r.PROMPT_LINE.botMemory)}`:"";return`- ${e}${i} \xb7 ${(0,o.format)((0,_.toDate)(n),"yyyy-MM-dd")}`}).join("\n"):"Empty.",U=E.total>E.entries.length?`
|
|
28
28
|
|
|
29
29
|
The newest ${E.entries.length} of ${E.total}; \`ls ${O}\` for the rest.`:"",`## Your memory
|
|
30
30
|
|
|
31
31
|
What you learned on your own earlier jobs, in \`${O}/\`: one topic per file, its first line saying what it holds, read by no other bot, up to ${r.BOT_MEMORY_LIMITS.files} files of ${r.BOT_MEMORY_LIMITS.chars.toLocaleString("en-US")} characters each. It is how you get better at this work. When a job teaches you something a later one would otherwise find out again — how a site signs in, the way through its screens, a command that turned out right — or the user asks you to remember how to work, keep it with the date it was true, and fix or delete what proved wrong. No passwords, keys or codes.
|
|
32
32
|
|
|
33
|
-
${P}${U}`):"",(C=`${(0,
|
|
33
|
+
${P}${U}`):"",(C=`${(0,b.botFolder)(H)}/${r.PATHS.skills.own}`,`## Your own skills
|
|
34
34
|
|
|
35
|
-
A skill in \`${C}/\` is listed to you alone, and read on every step you take, so keep few. Write one only when the job is a kind that comes again — a routine runs it, or your other threads show the same kind of job — and doing it well took a way of working, not a fact your memory can hold. Before writing one, improve the one of yours that covers the job instead. Write it as the skill-creator skill says; the job you just did is its test, so validate it and run no test prompts. Say in one line of your answer which skill you wrote or changed. Any skill outside that folder changes only when the user asks.`),function(e,t){if(!t.open.length&&!t.recent.length)return"";let n=t=>{let n=t.said?` — ${(0,
|
|
35
|
+
A skill in \`${C}/\` is listed to you alone, and read on every step you take, so keep few. Write one only when the job is a kind that comes again — a routine runs it, or your other threads show the same kind of job — and doing it well took a way of working, not a fact your memory can hold. Before writing one, improve the one of yours that covers the job instead. Write it as the skill-creator skill says; the job you just did is its test, so validate it and run no test prompts. Say in one line of your answer which skill you wrote or changed. Any skill outside that folder changes only when the user asks.`),function(e,t){if(!t.open.length&&!t.recent.length)return"";let n=t=>{let n=t.said?` — ${(0,z.clip)(t.said,r.BOT_WORK.said)}`:"",o=t.said?(0,y.pathsIn)(t.said).slice(0,r.BOT_WORK.files):[],i=o.length?` \xb7 ${o.map(e=>`\`${e}\``).join(", ")}`:"";return`- ${t.cut?`[${(0,u.workHandle)(t.id)}] `:""}${(0,v.botWorkHead)(t,e)}${n}${i}`},o=(e,t)=>t.length?`${e}
|
|
36
36
|
${t.map(n).join("\n")}`:"",i=[...t.open,...t.recent].some(e=>e.cut)?` A line with an id in brackets was cut short: \`${a.TOOL_NAMES.thread_recall}\` opens that one whole, for when this job builds on it.`:"";return`## Your other threads
|
|
37
37
|
|
|
38
38
|
Your threads besides this one. You remember none of them here: each line is where it stands, your own last words there, and the files those words name.${i}
|
|
39
39
|
|
|
40
|
-
${[o("Open",t.open),o("Ended",t.recent)].filter(Boolean).join("\n")}`}(H,X),function(e,t,n){if(0===e.length)return"";let o=
|
|
40
|
+
${[o("Open",t.open),o("Ended",t.recent)].filter(Boolean).join("\n")}`}(H,X),function(e,t,n){if(0===e.length)return"";let o=S(t,n)?`When part of the job is another bot's strength, bring it in with \`${a.TOOL_NAMES.send_message}\` rather than rebuilding it yourself.`:`When part of the job is another bot's strength, say so in your answer: ${n?.owner??"the coordinator"} brings them in.`;return`## Bots
|
|
41
41
|
|
|
42
42
|
${e.map(e=>`- **${e.name}** — ${(0,u.rosterLine)(e)}`).join("\n")}
|
|
43
43
|
|
|
44
|
-
These lines were written for the user: where one says "you", it means them. ${o}`}(Q,H,n),(A=H,j=n,q=j?.caller??"whoever asked",D=`Write in the user's language, and name the paths of finished work. In Markdown, reference images by absolute route (\`/api/file/${r.PATHS.artifacts}/…\`).`,
|
|
44
|
+
These lines were written for the user: where one says "you", it means them. ${o}`}(Q,H,n),(A=H,j=n,q=j?.caller??"whoever asked",D=`Write in the user's language, and name the paths of finished work. In Markdown, reference images by absolute route (\`/api/file/${r.PATHS.artifacts}/…\`).`,S(A,j)?`## Working together
|
|
45
45
|
|
|
46
46
|
Nobody sees your work but you, and you see only what others send you, so whatever crosses between you has to stand on its own. A request says what is wanted, what is already known or done, and where the files are; an answer gives exact values, file paths and what is still unverified. Tell a bot you handed work to when what it depends on changes: it reads that before its next step. End your turn when you have nothing more to do now: answers arrive as new messages and wake you. The bots you bring in answer only to you: when one needs another bot's work or something from the user, it says so in its answer, and you decide.
|
|
47
47
|
|
|
@@ -55,15 +55,15 @@ Nobody sees your work but you: ${q} sees only your final text, so it has to stan
|
|
|
55
55
|
|
|
56
56
|
Your final text is your answer to ${q}, and all they see of your work: give them everything they need to carry on. When you cannot go on without something — from them, from another bot, or a fact only the user has, such as a date, a name, a place or an amount — end with that question instead of guessing it or leaving a blank; ${q} gets it for you, and their reply brings you back with all you have done still in front of you.
|
|
57
57
|
|
|
58
|
-
${D}`),
|
|
58
|
+
${D}`),T(H,t)].filter(Boolean).join("\n\n");return(0,v.logPromptSize)("bot",et),{text:et}}[l,h,m,g,f,w]=k.then?(await k)():k;let T=(e,t)=>{let n=t?.trim();return n?(0,c.findBotSeed)(e)?.systemPrompt.trim()===n||(0,d.wasSeedRole)(e,n)?`## Your role
|
|
59
59
|
|
|
60
|
-
What this bot is for, as the app sets it up. Where it and anything above disagree, it wins.
|
|
60
|
+
What this bot is for, as the app sets it up. Where it and anything above disagree, it wins. The form it names is where to start: a job that asks for another — one page, slides, a sheet, a few lines — gets that one.
|
|
61
61
|
|
|
62
62
|
${n}`:`## Owner's instructions
|
|
63
63
|
|
|
64
64
|
Written by the person this bot works for. Where these and anything above disagree, these win.
|
|
65
65
|
|
|
66
|
-
${n}`:""},
|
|
66
|
+
${n}`:""},I=(e,t,n)=>{var o;let s,l;return`## Environment
|
|
67
67
|
|
|
68
68
|
Current Cwd: ${e}
|
|
69
69
|
Platform: ${process.platform}
|
|
@@ -80,15 +80,15 @@ Your workspace, where \`${a.TOOL_NAMES.bash}\` runs. Everything you write goes i
|
|
|
80
80
|
|
|
81
81
|
Inside the workspace, set up whatever the job needs yourself; installing anything machine-wide waits for the user's yes. Never the directory above the workspace — it is the app's, not the user's; outside the workspace, only where the user pointed you.
|
|
82
82
|
|
|
83
|
-
${(0,i.botGuideLine)()}`};function
|
|
83
|
+
${(0,i.botGuideLine)()}`};function S(e,t){return!t||(0,p.isCoordinatorSeat)(e,t.owner,t.caller)}e.s(["buildJoinOpening",0,function(e){if(!e.job)return[{type:"text",text:`You are ${e.bot}. The user writes to you in this thread, which ${e.coordinator} coordinates.`},{type:"text",text:`## The thread's first request
|
|
84
84
|
|
|
85
85
|
${e.request.trim()}`}];let{from:t}=e.job;return[{type:"text",text:`You are ${e.bot}. ${t} brings you into this thread, ${t===e.coordinator?"which they coordinate":`which ${e.coordinator} coordinates`}.`},{type:"text",text:`## ${t} → ${e.bot}: the job
|
|
86
86
|
|
|
87
|
-
${e.job.text.trim()}`}]},"buildThreadOpening",0,function(e){if(e.routine){let{when:t,last:n}=e.routine,i=n?` Its last run ended ${(0,o.format)(n.at,"yyyy-MM-dd HH:mm")}: ${(0,
|
|
87
|
+
${e.job.text.trim()}`}]},"buildThreadOpening",0,function(e){if(e.routine){let{when:t,last:n}=e.routine,i=n?` Its last run ended ${(0,o.format)(n.at,"yyyy-MM-dd HH:mm")}: ${(0,z.clip)(n.said,r.PROMPT_LINE.jobOutcome)}`:" This is its first run.";return[{type:"text",text:`You are ${e.bot}. A routine the user set up hands you this thread: it starts by itself, ${t}, and nobody is watching as it does.${i}`},{type:"text",text:`## The routine → ${e.bot}: the job
|
|
88
88
|
|
|
89
89
|
${e.request.trim()}`}]}let t="user"===e.from?"The user":"Thursday";return[{type:"text",text:`You are ${e.bot}. ${t} hands you this thread${"user"===e.from?" on screen":" during a call"}.`},{type:"text",text:`## ${t} → ${e.bot}: the job
|
|
90
90
|
|
|
91
|
-
${e.request.trim()}`}]},"loadBotPrompt",0,
|
|
91
|
+
${e.request.trim()}`}]},"loadBotPrompt",0,x]),n()}catch(e){n(e)}},!1),636608,e=>{"use strict";var t=e.i(489938),n=e.i(588762),o=e.i(333925),r=e.i(51083),i=e.i(546686),a=e.i(293822),s=e.i(900533),l=e.i(938281),u=e.i(610150),c=e.i(64774);let d=(e=new Date)=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} ${Intl.DateTimeFormat().resolvedOptions().timeZone}`,p=e=>(0,t.format)(e,"yyyy-MM-dd (EEE) a"),h={0:"clear sky",1:"mainly clear",2:"partly cloudy",3:"overcast",45:"fog",48:"depositing rime fog",51:"light drizzle",53:"moderate drizzle",55:"dense drizzle",56:"light freezing drizzle",57:"dense freezing drizzle",61:"slight rain",63:"moderate rain",65:"heavy rain",66:"light freezing rain",67:"heavy freezing rain",71:"slight snow fall",73:"moderate snow fall",75:"heavy snow fall",77:"snow grains",80:"slight rain showers",81:"moderate rain showers",82:"violent rain showers",85:"slight snow showers",86:"heavy snow showers",95:"thunderstorm",96:"thunderstorm with slight hail",99:"thunderstorm with heavy hail"};function m(e){if(!e)return"";let t=e.weather,n=t?`${h[t.code]??`weather code ${t.code}`}, ${Math.round(t.temperature)}\xb0C (today ${Math.round(t.low)}–${Math.round(t.high)}\xb0C), sunrise ${t.sunrise}, sunset ${t.sunset}${null==t.gusts?"":`, gusts ${Math.round(t.gusts)} km/h`}`:"";return e.place?`**Where they are**: ${e.place}${n?` — ${n}`:""}`:n?`**Weather where they are**: ${n}`:""}let g=e=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} (${(0,n.formatDistanceToNowStrict)(e,{addSuffix:!0})})`,f={[r.STUDIO_TOOLS.generate_image]:"images",[r.STUDIO_TOOLS.generate_speech]:"speech",[r.STUDIO_TOOLS.transcribe]:"transcription",[r.STUDIO_TOOLS.generate_video]:"video"};e.s(["botWorkHead",0,function(e,n){let o=p(e.updatedAt),r="running"===e.status?`running, last moved ${o}`:e.asking?`waiting on the user's answer since ${o}`:"waiting"===e.status?`stopped ${o}, not finished`:`${"done"===e.status?"ended":"stopped by the user"} ${(0,t.format)(e.updatedAt,"yyyy-MM-dd")}`;return`"${e.label}" — ${e.owner===n?"yours":`${e.owner}'s`} — ${r}`},"clockNow",0,d,"logPromptSize",0,function(e,t){let n=(0,u.sectionTokens)(t),r=n.reduce((e,t)=>e+t.tokens,0);l.logger.debug(`${e} prompt ${r} tokens — ${n.map(e=>`${e.name} ${e.tokens}`).join(", ")}`);let i=n[0];r>o.PROMPT_BUDGET&&i&&l.logger.warn(`${e} prompt is ${r} tokens, over ${o.PROMPT_BUDGET}: ${i.name} carries ${i.tokens} of it. Every call and every job pays this.`)},"mcpToolLines",0,function(e){let t=new Map;for(let n of e){let e=t.get(n.server);e?e.push(n.name):t.set(n.server,[n.name])}return[...t].map(([e,t])=>`- **${e}**: ${t.join(", ")}`).join("\n")},"noteLines",0,function(e,t=!1){return e.length?e.map(e=>{var n;let o,r=t?` \xb7 ${n=e.lastSeenAt,(o=Math.floor((Date.now()-(0,s.toDate)(n).getTime())/864e5))>=365?`${Math.floor(o/365)}y`:o>=30?`${Math.floor(o/30)}mo`:`${Math.max(o,0)}d`}`:"";return`- ${e.path} — ${e.description?.trim()} (${e.factCount})${r}`}).join("\n"):"(nothing saved yet)"},"reachNames",0,function(e,t){let n=t.map(e=>e.server===o.STUDIO_SERVER?f[e.name]??e.name:e.server);return[...new Set([...e.map(e=>e.name),...n])].join(", ")},"recentCallLines",0,function(e,t){let n=[],i=0;e:for(let s=e.length-1;s>=0;s--){let l=e[s];for(let e=l.turns.length-1;e>=0;e--){let s=function(e,t){if("tool"!==e.role)return`${"user"===e.role?"user":"you"}: ${e.text}`;let n=(0,a.searchOf)(e.tool,e.text);if(n){let t=[...new Set(n.sources.flatMap(e=>(0,c.hostOf)(e.url)??[]))];return`you → ${e.tool} "${(0,c.clip)(n.query??"",o.PROMPT_LINE.toolArgs)}"${t.length?` — ${t.join(", ")}`:""}`}let i=`you → ${e.tool??"tool"} ${(0,c.clip)(e.text,o.PROMPT_LINE.toolArgs)}`;if(e.tool!==r.TOOL_NAMES.thread_start)return i;let s=(0,a.startedLabel)(e.tool,e.text),l=s?t.jobs?.find(e=>e.label===s):void 0;if(!l)return i;let u=l.outcome?`: ${(0,c.clip)(l.outcome,o.PROMPT_LINE.jobOutcome)}`:"";return`you → ${e.tool} "${l.label}" (${l.id}) — ${l.status}${u}`}(l.turns[e],l),d=(0,u.estimateTokens)(s)+3;if(i+d>t&&n.length)break e;i+=d,n.push({call:l,line:s})}}n.reverse();let s=[],l=null;for(let{call:e,line:t}of n)e!==l&&(l=e,s.push(`### ${g(e.startedAt)}`)),s.push(t);return s.join("\n")},"saidStamp",0,e=>(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm"),"skillLines",0,(e,t={})=>e.map(e=>{var n;let r,a;return`- **${e.name}**: ${t.short?(n=e.description,r=o.PROMPT_LINE.skill,(a=(0,i.firstSentence)(n)).length>r?`${a.slice(0,r).trim()}…`:a):e.description}`}).join("\n"),"styleLines",0,e=>e?.trim()?`## Who they want you to be
|
|
92
92
|
|
|
93
93
|
Their own words, on top of the character above: how you talk to them, how much to say, what to leave out. Where they differ from anything above, theirs wins.
|
|
94
94
|
|
|
@@ -99,12 +99,10 @@ What they tell you is kept, so you know them better over time.`,"tidying",0,e=>(
|
|
|
99
99
|
${p.length>i.BOT_WORK.readChars?`${p.slice(0,i.BOT_WORK.readChars)}
|
|
100
100
|
[Cut here; the files it names hold the rest.]`:p}`].filter(Boolean).join("\n\n")}})}}e.s(["createThreadRecallTool",0,h,"sendMessageSpec",0,v,"threadAnswerSpec",0,y,"threadCancelSpec",0,_,"threadSeenSpec",0,w,"threadShowSpec",0,z,"threadStartSpec",0,g,"threadStatusSpec",0,b,"threadTellSpec",0,f]),n()}catch(e){n(e)}},!1),330436,e=>{"use strict";var t=e.i(691296),n=e.i(749906),o=e.i(51083);let r=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)),i={description:`End the call.
|
|
101
101
|
|
|
102
|
-
The line stays open until this runs, and drops once the goodbye being said is over.`,parameters:n.object({})},a=(0,t.tool)({description:i.description,inputSchema:i.parameters}),s={description:"Show a short word on your face for a few seconds.",parameters:n.object({text:n.string().describe(`Up to 8 characters: A-Z, 0-9, space and ${r.join(" ")}.`)})},l=(0,t.tool)({description:s.description,inputSchema:s.parameters}),u={description:`See what the user is showing you, their screen or their camera, as it is at this moment.
|
|
102
|
+
The line stays open until this runs, and drops once the goodbye being said is over.`,parameters:n.object({})},a=(0,t.tool)({description:i.description,inputSchema:i.parameters}),s={description:"Show a short word on your face for a few seconds.",parameters:n.object({text:n.string().describe(`Up to 8 characters: A-Z, 0-9, space and ${r.join(" ")}.`)})},l=(0,t.tool)({description:s.description,inputSchema:s.parameters});e.s(["callTools",0,function(){return{[o.TOOL_NAMES.end_call]:a,[o.TOOL_NAMES.emote]:l}}],330436)},448548,e=>{"use strict";var t=e.i(874533),n=e.i(912714),o=e.i(660526),r=e.i(750227),i=e.i(812057),a=e.i(691296),s=e.i(517435),l=e.i(333925),u=e.i(51083),c=e.i(375814),d=e.i(871096);let p=(0,r.join)(l.APP_DIR,l.PATHS.skills.default,"artifact",l.PATHS.skills.runtime,"deck","deck.mjs"),h=e=>s.default.string().trim().max(e),m=h(100).nullish().describe("A source or a date along the foot of the slide."),g=h(1500).nullish().describe("What the presenter says over it, as speech; a video of the deck reads it aloud. Never shown."),f=h(500).describe("Workspace path of a png, jpg, webp, gif or svg. It is copied beside the deck."),y=s.default.object({layout:s.default.literal("cover"),title:h(110).describe("The deck's subject, as its title."),eyebrow:h(40).nullish().describe("A word or two above the title."),subtitle:h(180).nullish().describe("One line under the title."),footer:m,notes:g}),b=s.default.object({layout:s.default.literal("statement"),title:h(120).describe("The one claim, as a sentence."),subtitle:h(140).nullish().describe("One line under it."),notes:g}),_=s.default.object({layout:s.default.literal("cards"),title:h(90).describe("The point the cards make together."),cards:s.default.array(s.default.object({title:h(60).describe("Its point."),text:h(160).nullish().describe("One line under it.")})).min(2).max(4).describe("Two to four, side by side and numbered."),footer:m,notes:g}),z=s.default.object({layout:s.default.literal("number"),value:h(10).describe("The figure as it reads: 1.4M, 62%, £2,900. Only one you were given."),label:h(80).nullish().describe("What it counts, above it."),subtitle:h(160).nullish().describe("What it means or is compared with, under it."),footer:m,notes:g}),w=s.default.object({layout:s.default.literal("table"),title:h(90).describe("What the comparison shows."),columns:s.default.array(h(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(h(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:m,notes:g}),v=s.default.object({layout:s.default.literal("quote"),quote:h(280).describe("Someone's own words, exactly as you were given them. Never made up."),who:h(60).describe("Who said it."),role:h(80).nullish().describe("Their role, place or date."),notes:g}),k=s.default.object({layout:s.default.literal("image"),title:h(90).describe("The heading beside the picture."),subtitle:h(280).nullish().describe("A line or two under it."),image:f,alt:h(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:m,notes:g}),x=s.default.object({layout:s.default.literal("picture"),image:f,alt:h(160).describe("What it shows, for someone who cannot see it."),text:h(110).describe("The line under the picture: what it shows, in short everyday words."),more:h(110).nullish().describe("A second, lighter line, only when one more is needed."),term:h(40).nullish().describe("The new word this slide names, exactly as `text` writes it: it is marked there. Only on the slide whose picture has just shown the thing."),fit:s.default.enum(["whole","fill"]).nullish().describe("whole shows a drawing, chart or screenshot uncropped; fill crops a photo to its box. Null for whole."),footer:m,notes:g}),S=s.default.object({layout:s.default.literal("quiz"),question:h(120).describe("One question about what the slides before it showed."),choices:s.default.array(s.default.object({text:h(40).describe("The pick, in a word or two."),image:f.nullish()})).min(2).max(4).describe("Two to four picks, side by side."),right:s.default.number().int().min(0).max(3).describe("Which pick is right, counted from 0."),answer:h(160).describe("Why that one is right, in a sentence: shown once a pick is made, and printed."),notes:g}),T=s.default.object({layout:s.default.literal("close"),title:h(120).describe("The sentence to repeat to someone who was not there."),steps:s.default.array(s.default.object({label:h(24).describe("A word or two: Next, Owner, By."),text:h(120).describe("What it is.")})).max(3).nullish().describe("Up to three next steps."),notes:g}),I=s.default.object({layout:s.default.literal("timeline"),title:h(90).describe("What the dates show together."),steps:s.default.array(s.default.object({when:h(24).describe("When, as you were given it: a date, a week, a phase."),title:h(60).describe("What happens then."),text:h(120).nullish().describe("One line under it.")})).min(2).max(5).describe("Two to five, in order, along one line."),footer:m,notes:g}),O=s.default.object({layout:s.default.literal("compare"),title:h(90).describe("What changes between the two, as a sentence."),sides:s.default.array(s.default.object({label:h(30).describe("Which side it is: Now, After, Option A."),points:s.default.array(h(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:m,notes:g}),E=s.default.object({layout:s.default.literal("stats"),title:h(90).describe("What the figures say together."),stats:s.default.array(s.default.object({value:h(12).describe("The figure as it reads: 1.4M, 62%, 6 hours. Only one you were given."),label:h(80).describe("What it counts, under it.")})).min(2).max(4).describe("Two to four figures side by side."),footer:m,notes:g}),C=s.default.discriminatedUnion("layout",[y,b,_,z,w,v,k,x,S,I,O,E,T]),A=s.default.object({deck:h(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:h(90).describe("The deck's title, shown in its head."),theme:s.default.enum(["forest","sea","clay","ink","paper","night"]).nullish().describe("forest (deep green on paper, serif headings), sea (blue, sans), clay (terracotta on warm paper, serif), ink (gold on near-black, sans), paper (black on white, bold sans) or night (white on black, bold 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(C).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.")}),j=/^[\p{L}\p{N}][\p{L}\p{N}_-]{0,79}$/u,R=/^(slide-\d+|slides)\.png$/i;class $ extends Error{}function M(e){let t=e.replace(/[^\p{L}\p{N}_-]+/gu,"-").replace(/^[-_]+|-+$/g,"").slice(0,80);if(!j.test(t))throw new $(`"${e}" is not a deck name: use letters, numbers, - and _.`);return t}async function N(e,t){let o=(0,d.botArtifacts)(t);if(!e.includes("/")&&!e.endsWith(".html")){let t=M(e);return`${o}/${t}/${t}.html`}let i=await (0,d.insideWorkspace)(e);if(!i)throw new $(`${e} is outside the workspace. Give a deck's path in it.`);let a=await (0,n.realpath)(d.WORKSPACE).catch(()=>d.WORKSPACE),s=await (0,n.stat)(i).catch(()=>null),l=s?.isDirectory()?(0,r.join)(i,`${(0,r.basename)(i)}.html`):i;if((await (0,n.stat)(l).catch(()=>null))?.isFile())return(0,r.relative)(a,l);let u=await (0,d.insideWorkspace)(o);if(!u||!i.startsWith(`${u}${r.sep}`))throw new $(`There is no deck at ${e}. A new deck is made in your own folder: give it a name.`);let c=M((0,r.basename)(i,".html"));return(0,r.relative)(a,(0,r.join)((0,r.dirname)(i),c,`${c}.html`))}async function L(e,t,o){let i=t.resolve(o),a=new Map,s=async(e,o)=>{let s=(0,r.join)(i,o),l=!o.includes("/")&&await (0,n.stat)(s).catch(()=>null)?s:t.resolve(o);if("image"!==(0,c.viewKindOf)(l))throw new $(`Slide ${e+1}: ${o} is not a picture. Give a png, jpg, webp, gif or svg.`);if(!(await (0,n.stat)(l).catch(()=>null))?.isFile())throw new $(`Slide ${e+1}: there is no file at ${o}. Give its path from the workspace root, as \`ls\` shows it.`);let u=a.get(l);if(!u){if((0,r.dirname)(l)===i)u=(0,r.basename)(l);else{let e=await P(i,l,new Set(a.values()));u=e.name,e.there||(await (0,n.mkdir)(i,{recursive:!0}),await (0,n.copyFile)(l,(0,r.join)(i,u)))}a.set(l,u)}return u},l=[];for(let[t,n]of e.entries())if("table"===n.layout){let e=n.rows.findIndex(e=>e.length>n.columns.length);if(-1!==e)throw new $(`Slide ${t+1}: row ${e+1} has ${n.rows[e].length} cells, and there are ${n.columns.length} columns.`);l.push({...n,rows:n.rows.map(e=>n.columns.map((t,n)=>e[n]??""))})}else if("image"===n.layout||"picture"===n.layout)l.push({...n,image:await s(t,n.image)});else if("quiz"===n.layout){if(n.right>=n.choices.length)throw new $(`Slide ${t+1}: right is ${n.right}, and there are ${n.choices.length} picks, counted from 0.`);let e=[];for(let o of n.choices)e.push(o.image?{...o,image:await s(t,o.image)}:o);l.push({...n,choices:e})}else l.push(n);return l}async function P(e,t,o){let i=(0,r.extname)(t),a=(0,r.basename)(t,i),s=R.test((0,r.basename)(t))?`picture-${a}`:a,l=await (0,n.readFile)(t);for(let t=1;;t++){let a=1===t?`${s}${i}`:`${s}-${t}${i}`;if(o.has(a))continue;let u=await (0,n.readFile)((0,r.join)(e,a)).catch(()=>null);if(!u)return{name:a,there:!1};if(u.equals(l))return{name:a,there:!0}}}let U=(0,i.promisify)(t.execFile);async function q(e,t,i,a,s){let l=await (0,n.mkdtemp)((0,r.join)((0,o.tmpdir)(),"thursday-deck-"));try{let o=(0,r.join)(l,"deck.json");await (0,n.writeFile)(o,JSON.stringify(t));let u=[p,"put",(0,r.join)(d.WORKSPACE,e),o];i&&u.push("--revision",i);let c=await U(process.execPath,u,{env:{NODE_ENV:"production",PATH:process.env.PATH??"",THURSDAY_BOT:a,...s?{THURSDAY_BOT_MARK:s}:{}},maxBuffer:0x1000000}).catch(e=>{if(3===e.code&&e.stdout)return{stdout:e.stdout};throw new $(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,n.rm)(l,{recursive:!0,force:!0})}}async function D(e,t,n,o){let i=await e.exec('node "$DECK_SCRIPT" shots "$DECK_FILE"',{env:{...n,DECK_SCRIPT:p,DECK_FILE:(0,r.join)(d.WORKSPACE,t)},timeoutMs:l.DECK.shotsMs,signal:o});if(0!==i.exitCode)return{failed:i.stderr.trim().split("\n").at(-1)||"no pictures were made"};let a=JSON.parse(i.stdout.trim().split("\n").at(-1)??"{}");return{pictures:a.pictures.map(e=>(0,r.relative)(d.WORKSPACE,e)),sheet:a.sheet?(0,r.relative)(d.WORKSPACE,a.sheet):null,cut:a.cut}}e.s(["createDeckTools",0,(e,t,o,i)=>({[u.TOOL_NAMES.make_deck]:(0,a.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:A,execute:async(n,{abortSignal:i})=>{try{let a,s=await N(n.deck,t),l=await L(n.slides,e,(0,r.dirname)(s)),c=await q(s,{title:n.title,theme:n.theme??null,slides:l},n.revision?.trim()??"",t,o.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=n.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 \`${u.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}`,p=await D(e,s,o,i);if("failed"in p)return`${s}
|
|
103
|
+
${d}. The pictures of its slides could not be made (${p.failed}), so nothing checked that every slide fits. Hand back the deck's path.`;let h=`call \`${u.TOOL_NAMES.make_deck}\` again with revision ${c.revision} and the whole deck`,m=p.sheet?`${(0,r.basename)(p.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,p.sheet??p.pictures[0]??"",p.cut.length?`${d}. ${a=p.cut,1===a.length?`Slide ${a[0]} does`:`Slides ${a.slice(0,-1).join(", ")} and ${a.at(-1)} do`} not fit even with the type at its smallest: say less there, then ${h}. ${m}.`:`${d}. Every slide fits. ${m}. Hand back the deck's path; to change it, ${h}.`].filter(Boolean).join("\n")}catch(e){if(e instanceof $)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(!i||!t.endsWith(".png"))return{type:"text",value:e};let o=await (0,d.insideWorkspace)(t),r=o?await (0,n.readFile)(o).catch(()=>null):null;return!r||r.byteLength>l.LOOK.maxBytes?{type:"text",value:e}:{type:"content",value:[{type:"text",text:`${e}
|
|
103
104
|
|
|
104
|
-
The picture comes right after this result. When they are showing nothing, the result says so.`,parameters:n.object({})},c=(0,t.tool)({description:u.description,inputSchema:u.parameters});e.s(["callTools",0,function(){return{[o.TOOL_NAMES.end_call]:a,[o.TOOL_NAMES.emote]:l,[o.TOOL_NAMES.look_at_shared]:c}}],330436)},448548,e=>{"use strict";var t=e.i(874533),n=e.i(912714),o=e.i(660526),r=e.i(750227),i=e.i(812057),a=e.i(691296),s=e.i(517435),l=e.i(333925),u=e.i(51083),c=e.i(375814),d=e.i(871096);let p=(0,r.join)(l.APP_DIR,l.PATHS.skills.default,"artifact",l.PATHS.skills.runtime,"deck","deck.mjs"),h=e=>s.default.string().trim().max(e),m=h(100).nullish().describe("A source or a date along the foot of the slide."),g=h(1500).nullish().describe("What the presenter says over it, as speech. Never shown."),f=s.default.object({layout:s.default.literal("cover"),title:h(110).describe("The deck's subject, as its title."),eyebrow:h(40).nullish().describe("A word or two above the title."),subtitle:h(180).nullish().describe("One line under the title."),footer:m,notes:g}),y=s.default.object({layout:s.default.literal("statement"),title:h(120).describe("The one claim, as a sentence."),subtitle:h(140).nullish().describe("One line under it."),notes:g}),b=s.default.object({layout:s.default.literal("cards"),title:h(90).describe("The point the cards make together."),cards:s.default.array(s.default.object({title:h(60).describe("Its point."),text:h(160).nullish().describe("One line under it.")})).min(2).max(4).describe("Two to four, side by side and numbered."),footer:m,notes:g}),_=s.default.object({layout:s.default.literal("number"),value:h(10).describe("The figure as it reads: 1.4M, 62%, £2,900. Only one you were given."),label:h(80).nullish().describe("What it counts, above it."),subtitle:h(160).nullish().describe("What it means or is compared with, under it."),footer:m,notes:g}),z=s.default.object({layout:s.default.literal("table"),title:h(90).describe("What the comparison shows."),columns:s.default.array(h(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(h(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:m,notes:g}),w=s.default.object({layout:s.default.literal("quote"),quote:h(280).describe("Someone's own words, exactly as you were given them. Never made up."),who:h(60).describe("Who said it."),role:h(80).nullish().describe("Their role, place or date."),notes:g}),v=s.default.object({layout:s.default.literal("image"),title:h(90).describe("The heading beside the picture."),subtitle:h(280).nullish().describe("A line or two under it."),image:h(500).describe("Workspace path of a png, jpg, webp, gif or svg. It is copied beside the deck."),alt:h(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:m,notes:g}),k=s.default.object({layout:s.default.literal("close"),title:h(120).describe("The sentence to repeat to someone who was not there."),steps:s.default.array(s.default.object({label:h(24).describe("A word or two: Next, Owner, By."),text:h(120).describe("What it is.")})).max(3).nullish().describe("Up to three next steps."),notes:g}),x=s.default.object({layout:s.default.literal("timeline"),title:h(90).describe("What the dates show together."),steps:s.default.array(s.default.object({when:h(24).describe("When, as you were given it: a date, a week, a phase."),title:h(60).describe("What happens then."),text:h(120).nullish().describe("One line under it.")})).min(2).max(5).describe("Two to five, in order, along one line."),footer:m,notes:g}),S=s.default.object({layout:s.default.literal("compare"),title:h(90).describe("What changes between the two, as a sentence."),sides:s.default.array(s.default.object({label:h(30).describe("Which side it is: Now, After, Option A."),points:s.default.array(h(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:m,notes:g}),T=s.default.object({layout:s.default.literal("stats"),title:h(90).describe("What the figures say together."),stats:s.default.array(s.default.object({value:h(12).describe("The figure as it reads: 1.4M, 62%, 6 hours. Only one you were given."),label:h(80).describe("What it counts, under it.")})).min(2).max(4).describe("Two to four figures side by side."),footer:m,notes:g}),I=s.default.discriminatedUnion("layout",[f,y,b,_,z,w,v,x,S,T,k]),O=s.default.object({deck:h(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:h(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(I).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,C=/^(slide-\d+|slides)\.png$/i;class A extends Error{}function j(e){let t=e.replace(/[^\p{L}\p{N}_-]+/gu,"-").replace(/^[-_]+|-+$/g,"").slice(0,80);if(!E.test(t))throw new A(`"${e}" is not a deck name: use letters, numbers, - and _.`);return t}async function R(e,t){let o=(0,d.botArtifacts)(t);if(!e.includes("/")&&!e.endsWith(".html")){let t=j(e);return`${o}/${t}/${t}.html`}let i=await (0,d.insideWorkspace)(e);if(!i)throw new A(`${e} is outside the workspace. Give a deck's path in it.`);let a=await (0,n.realpath)(d.WORKSPACE).catch(()=>d.WORKSPACE),s=await (0,n.stat)(i).catch(()=>null),l=s?.isDirectory()?(0,r.join)(i,`${(0,r.basename)(i)}.html`):i;if((await (0,n.stat)(l).catch(()=>null))?.isFile())return(0,r.relative)(a,l);let u=await (0,d.insideWorkspace)(o);if(!u||!i.startsWith(`${u}${r.sep}`))throw new A(`There is no deck at ${e}. A new deck is made in your own folder: give it a name.`);let c=j((0,r.basename)(i,".html"));return(0,r.relative)(a,(0,r.join)((0,r.dirname)(i),c,`${c}.html`))}async function $(e,t,o){let i=new Map,a=[];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 A(`Slide ${s+1}: row ${e+1} has ${l.rows[e].length} cells, and there are ${l.columns.length} columns.`);a.push({...l,rows:l.rows.map(e=>l.columns.map((t,n)=>e[n]??""))});continue}if("image"!==l.layout){a.push(l);continue}let e=t.resolve(o),u=(0,r.join)(e,l.image),d=!l.image.includes("/")&&await (0,n.stat)(u).catch(()=>null)?u:t.resolve(l.image);if("image"!==(0,c.viewKindOf)(d))throw new A(`Slide ${s+1}: ${l.image} is not a picture. Give a png, jpg, webp, gif or svg.`);if(!(await (0,n.stat)(d).catch(()=>null))?.isFile())throw new A(`Slide ${s+1}: there is no file at ${l.image}. Give its path from the workspace root, as \`ls\` shows it.`);let p=i.get(d);p||(p=(0,r.dirname)(d)===e?(0,r.basename)(d):function(e,t){let n=(0,r.extname)(e),o=(0,r.basename)(e,n),i=C.test(e)?`picture-${o}`:o,a=`${i}${n}`;for(let e=2;t.has(a);e++)a=`${i}-${e}${n}`;return a}((0,r.basename)(d),new Set(i.values())),i.set(d,p),(0,r.dirname)(d)!==e&&(await (0,n.mkdir)(e,{recursive:!0}),await (0,n.copyFile)(d,(0,r.join)(e,p)))),a.push({...l,image:p})}return a}let M=(0,i.promisify)(t.execFile);async function N(e,t,i,a,s){let l=await (0,n.mkdtemp)((0,r.join)((0,o.tmpdir)(),"thursday-deck-"));try{let o=(0,r.join)(l,"deck.json");await (0,n.writeFile)(o,JSON.stringify(t));let u=[p,"put",(0,r.join)(d.WORKSPACE,e),o];i&&u.push("--revision",i);let c=await M(process.execPath,u,{env:{NODE_ENV:"production",PATH:process.env.PATH??"",THURSDAY_BOT:a,...s?{THURSDAY_BOT_MARK:s}:{}},maxBuffer:0x1000000}).catch(e=>{if(3===e.code&&e.stdout)return{stdout:e.stdout};throw new A(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,n.rm)(l,{recursive:!0,force:!0})}}async function L(e,t,n,o){let i=await e.exec('node "$DECK_SCRIPT" shots "$DECK_FILE"',{env:{...n,DECK_SCRIPT:p,DECK_FILE:(0,r.join)(d.WORKSPACE,t)},timeoutMs:l.DECK.shotsMs,signal:o});if(0!==i.exitCode)return{failed:i.stderr.trim().split("\n").at(-1)||"no pictures were made"};let a=JSON.parse(i.stdout.trim().split("\n").at(-1)??"{}");return{pictures:a.pictures.map(e=>(0,r.relative)(d.WORKSPACE,e)),sheet:a.sheet?(0,r.relative)(d.WORKSPACE,a.sheet):null,cut:a.cut}}e.s(["createDeckTools",0,(e,t,o,i)=>({[u.TOOL_NAMES.make_deck]:(0,a.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:O,execute:async(n,{abortSignal:i})=>{try{let a,s=await R(n.deck,t),l=await $(n.slides,e,(0,r.dirname)(s)),c=await N(s,{title:n.title,theme:n.theme??null,slides:l},n.revision?.trim()??"",t,o.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=n.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 \`${u.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}`,p=await L(e,s,o,i);if("failed"in p)return`${s}
|
|
105
|
-
${d}. The pictures of its slides could not be made (${p.failed}), so nothing checked that every slide fits. Hand back the deck's path.`;let h=`call \`${u.TOOL_NAMES.make_deck}\` again with revision ${c.revision} and the whole deck`,m=p.sheet?`${(0,r.basename)(p.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,p.sheet??p.pictures[0]??"",p.cut.length?`${d}. ${a=p.cut,1===a.length?`Slide ${a[0]} does`:`Slides ${a.slice(0,-1).join(", ")} and ${a.at(-1)} do`} not fit even with the type at its smallest: say less there, then ${h}. ${m}.`:`${d}. Every slide fits. ${m}. Hand back the deck's path; to change it, ${h}.`].filter(Boolean).join("\n")}catch(e){if(e instanceof A)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(!i||!t.endsWith(".png"))return{type:"text",value:e};let o=await (0,d.insideWorkspace)(t),r=o?await (0,n.readFile)(o).catch(()=>null):null;return!r||r.byteLength>l.LOOK.maxBytes?{type:"text",value:e}:{type:"content",value:[{type:"text",text:`${e}
|
|
106
|
-
|
|
107
|
-
${t}, as an image:`},{type:"file",mediaType:"image/png",data:{type:"data",data:r.toString("base64")}}]}}})})])},690285,e=>{"use strict";var t=e.i(912714),n=e.i(691296),o=e.i(517435),r=e.i(333925),i=e.i(51083),a=e.i(375814),s=e.i(871096);e.s(["createLookTool",0,function(){return{[i.TOOL_NAMES.look_at]:(0,n.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:o.default.object({path:o.default.string().describe("Workspace-relative path to a png, jpg, webp or gif.")}),execute:async({path:e})=>{let n=await (0,s.insideWorkspace)(e.trim()),o=n?await (0,t.stat)(n).catch(()=>null):null;return n&&o?.isFile()?"image"!==(0,a.viewKindOf)(e)?`${e} is not an image. Read it in the shell instead.`:o.size>r.LOOK.maxBytes?`${e} is ${Math.ceil(o.size/1024/1024)} MB, over the ${r.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,a.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 n=await (0,s.insideWorkspace)(e.path),o=n?await (0,t.readFile)(n).catch(()=>null):null;return o?{type:"content",value:[{type:"text",text:`${e.path}, as an image:`},{type:"file",mediaType:e.mediaType,data:{type:"data",data:o.toString("base64")}}]}:{type:"text",value:`${e.path} is no longer there.`}}})}}])},759118,e=>e.a(async(t,n)=>{try{var o=e.i(691296),r=e.i(749906),i=e.i(333925),a=e.i(51083),s=e.i(993195),l=e.i(871096),u=e.i(340697),c=t([s,u]);[s,u]=c.then?(await c)():c;let h={[a.TOOL_NAMES.tool_search]:{description:`Return the description and exact inputSchema of tools on a connected server, so they can be called with \`${a.TOOL_NAMES.tool_call}\`.`,parameters:r.object({server:r.string().describe("A server name, exactly as the Connected tools section writes it."),tools:r.string().array().describe(`Tool names listed under that server. Only the ones you may actually call — schemas are large, and at most ${i.TOOL_SEARCH_SCHEMAS} come back.`)})},[a.TOOL_NAMES.tool_call]:{description:`Run one tool whose definition came back from \`${a.TOOL_NAMES.tool_search}\`.`,parameters:r.object({server:r.string().describe("The server the tool lives on."),tool:r.string().describe("Its name, as search returned it."),args:r.looseObject({}).nullish().describe("Arguments matching the inputSchema search returned — do not guess. Null when it takes none."),description:r.string().nullish().describe("One short line for the user: what this call is for. Shown on their screen while it runs.")})}},m=(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[n,r]=await Promise.all([(0,u.listConnectedToolNames)(),(0,s.findPinnedTools)(e)]),i={},a=(0,l.botArtifacts)(e);for(let e of r){let n=m(e.server,e.name);i[n]||(i[n]=(0,o.tool)({description:e.description??`${e.name} on the ${e.server} server.`,inputSchema:(0,o.jsonSchema)(e.inputSchema??{type:"object",properties:{}}),execute:(n,{abortSignal:o})=>(0,u.callConnectedTool)(t,e.server,e.name,n??void 0,{artifacts:a,abortSignal:o})}))}return n.length>r.length&&Object.assign(i,g(t,a)),i}async function p(e){let t=(await (0,u.listConnectedToolNames)(e)).map(e=>e.name);if(t.length)return`Tools on "${e}": ${t.join(", ")}.`;let n=await (0,u.listConnectedServerNames)();return n.length?`There is no server called "${e}". Connected: ${n.join(", ")}.`:"Nothing is connected."}let g=(e,t)=>({[a.TOOL_NAMES.tool_search]:(0,o.tool)({description:h[a.TOOL_NAMES.tool_search].description,inputSchema:h[a.TOOL_NAMES.tool_search].parameters,execute:async({server:e,tools:t})=>{let n=[...new Set(t.map(e=>e.trim()).filter(Boolean))],o=n.slice(0,i.TOOL_SEARCH_SCHEMAS),r=await (0,u.findConnectedSchemas)(e.trim(),o);if(!r.length)return{tools:[],note:await p(e)};let a=o.filter(e=>!r.some(t=>t.name===e)),s=n.slice(i.TOOL_SEARCH_SCHEMAS),l=[a.length?`Not on "${e}": ${a.join(", ")}.`:"",s.length?`Only ${i.TOOL_SEARCH_SCHEMAS} at a time — ask again for: ${s.join(", ")}.`:""].filter(Boolean);return{tools:r,...l.length?{note:l.join(" ")}:{}}}}),[a.TOOL_NAMES.tool_call]:(0,o.tool)({description:h[a.TOOL_NAMES.tool_call].description,inputSchema:h[a.TOOL_NAMES.tool_call].parameters,execute:async({server:n,tool:o,args:r},{abortSignal:i})=>(await (0,u.listConnectedToolNames)(n.trim())).some(e=>e.name===o.trim())?(0,u.callConnectedTool)(e,n.trim(),o.trim(),r??void 0,{artifacts:t,abortSignal:i}):{status:"error",text:await p(n)}})});e.s(["createMcpTools",0,d]),n()}catch(e){n(e)}},!1),391830,e=>e.a(async(t,n)=>{try{var o=e.i(691296),r=e.i(749906),i=e.i(333925),a=e.i(636608),s=e.i(51083),l=e.i(1363),u=e.i(232549),c=t([l]);[l]=c.then?(await c)():c;let d=u.MEMORY_PATHS.map(e=>e.path.endsWith("/")?`${e.path}<name>`:e.path).join(", "),p="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.",h=e=>`Nothing on the listing called ${e}.`,m=e=>({...e,facts:e.facts.map(({saidAt:e,...t})=>e?{...t,said:(0,a.saidStamp)(e)}:t),factCount:e.facts.length}),g=e=>e>i.MEMORY_LIMITS.factsPerNote?` This note now holds ${e} facts, past the ${i.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>i.MEMORY_LIMITS.descriptionChars?{note:`That line runs to ${e.length} characters; a note's line is one line, under ${i.MEMORY_LIMITS.descriptionChars}. Say what the note is about — the facts inside say the rest.`}:null,y=r.string().describe("Exactly as the listing writes it — the path."),b=r.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:n=!0,tidies:i=!0}={})=>({[s.TOOL_NAMES.memory_recall]:(0,o.tool)({description:"Open one note from the listing, whole.",inputSchema:r.object({path:y}),execute:async({path:e})=>{let{notes:t}=await (0,l.readNotes)([e],{touch:n}),o=t[0];if(!o)return{note:h(e.trim())};let r=i?g(o.facts.length):"";return r?{...m(o),note:r.trim()}:m(o)}}),[s.TOOL_NAMES.memory_create]:(0,o.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:r.object({path:r.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:r.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:r.object({text:b}).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:n,description:o,facts:r})=>{let i=n.trim(),a=o.trim();if(!(0,u.isMemoryPath)(i))return{note:`Nothing was saved: "${i}" is not a path this listing can carry. Write it again under one of ${d}.`};if((0,u.isAlwaysListed)(i))return{note:`${i} is always on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it.`};let c=f(a);if(c)return c;let h=await (0,l.createNoteWithFacts)(i,a,r,e,t);if(!h)return{note:`${i} is already on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it, \`${s.TOOL_NAMES.memory_describe}\` changes its line.`};let y=m(h);return{...y,note:`${p}${g(y.factCount)}`}}}),[s.TOOL_NAMES.memory_remember]:(0,o.tool)({description:"Write facts under a note that is on the listing.",inputSchema:r.object({path:y,facts:r.object({text:b,replaces:r.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:n,facts:o})=>{let r=n.trim(),i=await (0,l.writeFacts)(r,o,e,t);if(!i)return{note:`${h(r)} A subject that is not on the listing gets a note of its own: \`${s.TOOL_NAMES.memory_create}\`, with its line.`};let a=m(i);return{...a,note:`${p}${g(a.factCount)}`}}}),[s.TOOL_NAMES.memory_describe]:(0,o.tool)({description:"Change the line a note is listed by, when it no longer says what the note is about.",inputSchema:r.object({path:y,description:r.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 n=e.trim(),o=t.trim();if((0,u.isAlwaysListed)(n))return{note:`${u.MEMORY_ALWAYS_LISTED.join(" and ")} keep their own line; it is not yours to change.`};let r=f(o);return r||(await (0,l.describeNote)(n,o)?{path:n,description:o,note:"Renamed. The listing in your instructions is from when this session opened and still shows the old line until the next one."}:{note:h(n)})}}),[s.TOOL_NAMES.memory_forget]:(0,o.tool)({description:"Delete facts for good.",inputSchema:r.object({factIds:r.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=[],n=[],o=new Set;for(let r of new Set(e)){let e=await (0,l.forgetFactById)(r);if(!e){t.push(r);continue}e.noteGone?(o.delete(e.path),n.push(e.path)):o.add(e.path)}if(!n.length&&!o.size)return{note:`No fact with id ${t.join(", ")}. Nothing was deleted.`};let r=["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===n.length?`That was the last fact under ${n[0]}, so the note went with it.`:n.length?`That was the last of ${n.join(", ")}, so those notes went with them.`:"",t.length?`No fact with id ${t.join(", ")}, so those were skipped.`:""].filter(Boolean).join(" ");if(!o.size)return{note:r};let{notes:i}=await (0,l.readNotes)([...o],{touch:!1});return{notes:i.map(m),note:r}}})})]),n()}catch(e){n(e)}},!1),303583,e=>e.a(async(t,n)=>{try{var o=e.i(691296),r=e.i(749906),i=e.i(333925),a=e.i(51083),s=e.i(799791),l=e.i(519645),u=e.i(275841),c=e.i(900533),d=e.i(212389),p=e.i(64774),h=t([s,l]);[s,l]=h.then?(await h)():h;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 ${i.ROUTINE.max} exist.`,parameters:r.object({action:r.enum(["list","create","change","delete"]),routine:r.string().nullish().describe("With change or delete: the routine, by its name or ID."),bot:r.string().nullish().describe("With create: a name from the bot list. With change: a new bot."),label:r.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:r.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:r.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:r.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:r.array(r.number().int().min(1).max(7)).nullish().describe("With `time`: the days it starts, 1 Monday to 7 Sunday. Omit for every day."),everyHours:r.number().int().nullish().describe(`Starts again this many hours after it last started, ${i.ROUTINE.minHours} at least. Give one of \`at\`, \`time\` or \`everyHours\`.`),enabled:r.boolean().nullish().describe("With change: false switches it off without deleting it, true back on.")})};function m(e){let t=e.runs[0];return{id:e.id,label:e.label,bot:e.bot,when:(0,u.scheduleText)(e.schedule),enabled:e.enabled,...e.enabled?{next:(0,c.whenOf)((0,c.toDate)(e.nextRunAt))}:{},request:(0,p.clip)(e.request,i.PROMPT_LINE.routineRequest),...t?{lastRun:{thread:t.id,status:t.status,at:(0,c.whenOf)((0,c.toDate)(t.updatedAt)),...t.outcome?{outcome:(0,p.clip)(t.outcome,i.PROMPT_LINE.routineOutcome)}:{}}}:{}}}let y=e=>{if((0,d.isPublicError)(e))return e.message;throw e};async function g(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{[a.TOOL_NAMES.routine]:(0,o.tool)({description:f.description,inputSchema:f.parameters,execute:async e=>{if("list"===e.action)return{routines:(await (0,l.listRoutines)()).map(m)};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 n=u.RoutineScheduleSchema.safeParse(t);return n.success?n.data:n.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 n=u.RoutineInputSchema.safeParse({bot:e.bot??"",label:e.label??"",request:e.request??"",schedule:t});if(!n.success)return`${n.error.issues[0].message}. Nothing was made — call again with bot, label, request and when.`;let o=(await (0,s.listJobBots)()).map(e=>e.name);if(!o.some(e=>e.toLowerCase()===n.data.bot.toLowerCase()))return`There is no bot called "${n.data.bot}". The bots are: ${o.join(", ")}. Nothing was made — call again with one of those.`;let r=await (0,l.createRoutine)(n.data).catch(y);if("string"==typeof r)return r;let i=(0,c.whenOf)((0,c.toDate)(r.nextRunAt));return{...m(r),note:"once"===r.schedule.kind?`${r.bot} starts "${r.label}" once, ${i}, 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.`:`${r.bot} starts "${r.label}" by itself, ${(0,u.scheduleText)(r.schedule)}, first ${i}. Each start is a thread of its own, and its result reaches the conversation like any thread's.`}}let n=e.routine?await (0,l.resolveRoutine)(e.routine):null;if(!n)return await g(e.routine);if("delete"===e.action)return await (0,l.deleteRoutine)(n.id),`"${n.label}" is deleted and starts no more. The threads it already opened stay.`;let o={...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(o).length)return"Nothing to change was given: bot, label, request, when, or enabled.";let r=await (0,l.updateRoutine)(n.id,o).catch(y);return"string"==typeof r?r:r?m(r):await g(e.routine)}})}}]),n()}catch(e){n(e)}},!1),308070,e=>e.a(async(t,n)=>{try{var o=e.i(734732),r=e.i(691296),i=e.i(517435),a=e.i(333925),s=e.i(51083),l=e.i(656719),u=e.i(724185),c=e.i(64774),d=t([u]);[u]=d.then?(await d)():d;let g=`Answer the question from the web. Lead with the answer, then
|
|
105
|
+
${t}, as an image:`},{type:"file",mediaType:"image/png",data:{type:"data",data:r.toString("base64")}}]}}})})])},690285,e=>{"use strict";var t=e.i(912714),n=e.i(691296),o=e.i(517435),r=e.i(333925),i=e.i(51083),a=e.i(375814),s=e.i(871096),l=e.i(64774);async function u(e){let n=await (0,s.insideWorkspace)(e.trim()),o=n?await (0,t.stat)(n).catch(()=>null):null;return n&&o?.isFile()?(0,a.isPicture)(e)?o.size>r.LOOK.maxBytes?{tooBig:o.size}:{full:n,mediaType:(0,a.mimeOf)(e),bytes:o.size}:{notPicture:!0}:{missing:!0}}let c=(e,t)=>`${e} is ${(0,l.formatBytes)(t)}, over the ${(0,l.formatBytes)(r.LOOK.maxBytes)} a picture sent to a model can be. Make a smaller copy in the shell first (on a Mac: sips -Z 1600 in.png --out out.png), then look at that.`;e.s(["checkPicture",0,u,"createLookTool",0,function(){return{[i.TOOL_NAMES.look_at]:(0,n.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:o.default.object({path:o.default.string().describe("Workspace-relative path to a png, jpg, webp or gif.")}),execute:async({path:e})=>{let t=await u(e);return"missing"in t?`There is no file at ${e}. Give the path from the workspace root, as \`ls\` shows it.`:"notPicture"in t?`${e} is not a png, jpg, webp or gif. Read it in the shell instead.`:"tooBig"in t?c(e,t.tooBig):{path:e.trim(),mediaType:t.mediaType}},toModelOutput:async({output:e})=>{if("string"==typeof e)return{type:"text",value:e};let n=await (0,s.insideWorkspace)(e.path),o=n?await (0,t.readFile)(n).catch(()=>null):null;return o?{type:"content",value:[{type:"text",text:`${e.path}, as an image:`},{type:"file",mediaType:e.mediaType,data:{type:"data",data:o.toString("base64")}}]}:{type:"text",value:`${e.path} is no longer there.`}}})}},"tooBigToSee",0,c])},759118,e=>e.a(async(t,n)=>{try{var o=e.i(691296),r=e.i(749906),i=e.i(333925),a=e.i(51083),s=e.i(993195),l=e.i(871096),u=e.i(340697),c=t([s,u]);[s,u]=c.then?(await c)():c;let h={[a.TOOL_NAMES.tool_search]:{description:`Return the description and exact inputSchema of tools on a connected server, so they can be called with \`${a.TOOL_NAMES.tool_call}\`.`,parameters:r.object({server:r.string().describe("A server name, exactly as the Connected tools section writes it."),tools:r.string().array().describe(`Tool names listed under that server. Only the ones you may actually call — schemas are large, and at most ${i.TOOL_SEARCH_SCHEMAS} come back.`)})},[a.TOOL_NAMES.tool_call]:{description:`Run one tool whose definition came back from \`${a.TOOL_NAMES.tool_search}\`.`,parameters:r.object({server:r.string().describe("The server the tool lives on."),tool:r.string().describe("Its name, as search returned it."),args:r.looseObject({}).nullish().describe("Arguments matching the inputSchema search returned — do not guess. Null when it takes none."),description:r.string().nullish().describe("One short line for the user: what this call is for. Shown on their screen while it runs.")})}},m=(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[n,r]=await Promise.all([(0,u.listConnectedToolNames)(),(0,s.findPinnedTools)(e)]),i={},a=(0,l.botArtifacts)(e);for(let e of r){let n=m(e.server,e.name);i[n]||(i[n]=(0,o.tool)({description:e.description??`${e.name} on the ${e.server} server.`,inputSchema:(0,o.jsonSchema)(e.inputSchema??{type:"object",properties:{}}),execute:(n,{abortSignal:o})=>(0,u.callConnectedTool)(t,e.server,e.name,n??void 0,{artifacts:a,abortSignal:o})}))}return n.length>r.length&&Object.assign(i,g(t,a)),i}async function p(e){let t=(await (0,u.listConnectedToolNames)(e)).map(e=>e.name);if(t.length)return`Tools on "${e}": ${t.join(", ")}.`;let n=await (0,u.listConnectedServerNames)();return n.length?`There is no server called "${e}". Connected: ${n.join(", ")}.`:"Nothing is connected."}let g=(e,t)=>({[a.TOOL_NAMES.tool_search]:(0,o.tool)({description:h[a.TOOL_NAMES.tool_search].description,inputSchema:h[a.TOOL_NAMES.tool_search].parameters,execute:async({server:e,tools:t})=>{let n=[...new Set(t.map(e=>e.trim()).filter(Boolean))],o=n.slice(0,i.TOOL_SEARCH_SCHEMAS),r=await (0,u.findConnectedSchemas)(e.trim(),o);if(!r.length)return{tools:[],note:await p(e)};let a=o.filter(e=>!r.some(t=>t.name===e)),s=n.slice(i.TOOL_SEARCH_SCHEMAS),l=[a.length?`Not on "${e}": ${a.join(", ")}.`:"",s.length?`Only ${i.TOOL_SEARCH_SCHEMAS} at a time — ask again for: ${s.join(", ")}.`:""].filter(Boolean);return{tools:r,...l.length?{note:l.join(" ")}:{}}}}),[a.TOOL_NAMES.tool_call]:(0,o.tool)({description:h[a.TOOL_NAMES.tool_call].description,inputSchema:h[a.TOOL_NAMES.tool_call].parameters,execute:async({server:n,tool:o,args:r},{abortSignal:i})=>(await (0,u.listConnectedToolNames)(n.trim())).some(e=>e.name===o.trim())?(0,u.callConnectedTool)(e,n.trim(),o.trim(),r??void 0,{artifacts:t,abortSignal:i}):{status:"error",text:await p(n)}})});e.s(["createMcpTools",0,d]),n()}catch(e){n(e)}},!1),391830,e=>e.a(async(t,n)=>{try{var o=e.i(691296),r=e.i(749906),i=e.i(333925),a=e.i(636608),s=e.i(51083),l=e.i(1363),u=e.i(232549),c=t([l]);[l]=c.then?(await c)():c;let d=u.MEMORY_PATHS.map(e=>e.path.endsWith("/")?`${e.path}<name>`:e.path).join(", "),p="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.",h=e=>`Nothing on the listing called ${e}.`,m=e=>({...e,facts:e.facts.map(({saidAt:e,...t})=>e?{...t,said:(0,a.saidStamp)(e)}:t),factCount:e.facts.length}),g=e=>e>i.MEMORY_LIMITS.factsPerNote?` This note now holds ${e} facts, past the ${i.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>i.MEMORY_LIMITS.descriptionChars?{note:`That line runs to ${e.length} characters; a note's line is one line, under ${i.MEMORY_LIMITS.descriptionChars}. Say what the note is about — the facts inside say the rest.`}:null,y=r.string().describe("Exactly as the listing writes it — the path."),b=r.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:n=!0,tidies:i=!0}={})=>({[s.TOOL_NAMES.memory_recall]:(0,o.tool)({description:"Open one note from the listing, whole.",inputSchema:r.object({path:y}),execute:async({path:e})=>{let{notes:t}=await (0,l.readNotes)([e],{touch:n}),o=t[0];if(!o)return{note:h(e.trim())};let r=i?g(o.facts.length):"";return r?{...m(o),note:r.trim()}:m(o)}}),[s.TOOL_NAMES.memory_create]:(0,o.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:r.object({path:r.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:r.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:r.object({text:b}).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:n,description:o,facts:r})=>{let i=n.trim(),a=o.trim();if(!(0,u.isMemoryPath)(i))return{note:`Nothing was saved: "${i}" is not a path this listing can carry. Write it again under one of ${d}.`};if((0,u.isAlwaysListed)(i))return{note:`${i} is always on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it.`};let c=f(a);if(c)return c;let h=await (0,l.createNoteWithFacts)(i,a,r,e,t);if(!h)return{note:`${i} is already on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it, \`${s.TOOL_NAMES.memory_describe}\` changes its line.`};let y=m(h);return{...y,note:`${p}${g(y.factCount)}`}}}),[s.TOOL_NAMES.memory_remember]:(0,o.tool)({description:"Write facts under a note that is on the listing.",inputSchema:r.object({path:y,facts:r.object({text:b,replaces:r.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:n,facts:o})=>{let r=n.trim(),i=await (0,l.writeFacts)(r,o,e,t);if(!i)return{note:`${h(r)} A subject that is not on the listing gets a note of its own: \`${s.TOOL_NAMES.memory_create}\`, with its line.`};let a=m(i);return{...a,note:`${p}${g(a.factCount)}`}}}),[s.TOOL_NAMES.memory_describe]:(0,o.tool)({description:"Change the line a note is listed by, when it no longer says what the note is about.",inputSchema:r.object({path:y,description:r.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 n=e.trim(),o=t.trim();if((0,u.isAlwaysListed)(n))return{note:`${u.MEMORY_ALWAYS_LISTED.join(" and ")} keep their own line; it is not yours to change.`};let r=f(o);return r||(await (0,l.describeNote)(n,o)?{path:n,description:o,note:"Renamed. The listing in your instructions is from when this session opened and still shows the old line until the next one."}:{note:h(n)})}}),[s.TOOL_NAMES.memory_forget]:(0,o.tool)({description:"Delete facts for good.",inputSchema:r.object({factIds:r.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=[],n=[],o=new Set;for(let r of new Set(e)){let e=await (0,l.forgetFactById)(r);if(!e){t.push(r);continue}e.noteGone?(o.delete(e.path),n.push(e.path)):o.add(e.path)}if(!n.length&&!o.size)return{note:`No fact with id ${t.join(", ")}. Nothing was deleted.`};let r=["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===n.length?`That was the last fact under ${n[0]}, so the note went with it.`:n.length?`That was the last of ${n.join(", ")}, so those notes went with them.`:"",t.length?`No fact with id ${t.join(", ")}, so those were skipped.`:""].filter(Boolean).join(" ");if(!o.size)return{note:r};let{notes:i}=await (0,l.readNotes)([...o],{touch:!1});return{notes:i.map(m),note:r}}})})]),n()}catch(e){n(e)}},!1),303583,e=>e.a(async(t,n)=>{try{var o=e.i(691296),r=e.i(749906),i=e.i(333925),a=e.i(51083),s=e.i(799791),l=e.i(519645),u=e.i(275841),c=e.i(900533),d=e.i(212389),p=e.i(64774),h=t([s,l]);[s,l]=h.then?(await h)():h;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 ${i.ROUTINE.max} exist.`,parameters:r.object({action:r.enum(["list","create","change","delete"]),routine:r.string().nullish().describe("With change or delete: the routine, by its name or ID."),bot:r.string().nullish().describe("With create: a name from the bot list. With change: a new bot."),label:r.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:r.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:r.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:r.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:r.array(r.number().int().min(1).max(7)).nullish().describe("With `time`: the days it starts, 1 Monday to 7 Sunday. Omit for every day."),everyHours:r.number().int().nullish().describe(`Starts again this many hours after it last started, ${i.ROUTINE.minHours} at least. Give one of \`at\`, \`time\` or \`everyHours\`.`),enabled:r.boolean().nullish().describe("With change: false switches it off without deleting it, true back on.")})};function m(e){let t=e.runs[0];return{id:e.id,label:e.label,bot:e.bot,when:(0,u.scheduleText)(e.schedule),enabled:e.enabled,...e.enabled?{next:(0,c.whenOf)((0,c.toDate)(e.nextRunAt))}:{},request:(0,p.clip)(e.request,i.PROMPT_LINE.routineRequest),...t?{lastRun:{thread:t.id,status:t.status,at:(0,c.whenOf)((0,c.toDate)(t.updatedAt)),...t.outcome?{outcome:(0,p.clip)(t.outcome,i.PROMPT_LINE.routineOutcome)}:{}}}:{}}}let y=e=>{if((0,d.isPublicError)(e))return e.message;throw e};async function g(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{[a.TOOL_NAMES.routine]:(0,o.tool)({description:f.description,inputSchema:f.parameters,execute:async e=>{if("list"===e.action)return{routines:(await (0,l.listRoutines)()).map(m)};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 n=u.RoutineScheduleSchema.safeParse(t);return n.success?n.data:n.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 n=u.RoutineInputSchema.safeParse({bot:e.bot??"",label:e.label??"",request:e.request??"",schedule:t});if(!n.success)return`${n.error.issues[0].message}. Nothing was made — call again with bot, label, request and when.`;let o=(await (0,s.listJobBots)()).map(e=>e.name);if(!o.some(e=>e.toLowerCase()===n.data.bot.toLowerCase()))return`There is no bot called "${n.data.bot}". The bots are: ${o.join(", ")}. Nothing was made — call again with one of those.`;let r=await (0,l.createRoutine)(n.data).catch(y);if("string"==typeof r)return r;let i=(0,c.whenOf)((0,c.toDate)(r.nextRunAt));return{...m(r),note:"once"===r.schedule.kind?`${r.bot} starts "${r.label}" once, ${i}, 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.`:`${r.bot} starts "${r.label}" by itself, ${(0,u.scheduleText)(r.schedule)}, first ${i}. Each start is a thread of its own, and its result reaches the conversation like any thread's.`}}let n=e.routine?await (0,l.resolveRoutine)(e.routine):null;if(!n)return await g(e.routine);if("delete"===e.action)return await (0,l.deleteRoutine)(n.id),`"${n.label}" is deleted and starts no more. The threads it already opened stay.`;let o={...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(o).length)return"Nothing to change was given: bot, label, request, when, or enabled.";let r=await (0,l.updateRoutine)(n.id,o).catch(y);return"string"==typeof r?r:r?m(r):await g(e.routine)}})}}]),n()}catch(e){n(e)}},!1),308070,e=>e.a(async(t,n)=>{try{var o=e.i(734732),r=e.i(691296),i=e.i(517435),a=e.i(333925),s=e.i(51083),l=e.i(656719),u=e.i(724185),c=e.i(64774),d=t([u]);[u]=d.then?(await d)():d;let g=`Answer the question from the web. Lead with the answer, then
|
|
108
106
|
what supports it. Say plainly what you could not find or confirm — do not fill
|
|
109
107
|
the gap with a guess. Every number carries the date you saw it. Be brief: this
|
|
110
108
|
is read by another model, not by a person.`,f=i.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 p(e,t,n){let o=await fetch("https://api.exa.ai/search",{method:"POST",signal:n,headers:{"content-type":"application/json","x-api-key":e},body:JSON.stringify({query:t,type:"auto",numResults:a.SEARCH.sources,contents:{text:{maxCharacters:a.SEARCH.excerptChars},livecrawl:"fallback",livecrawlTimeout:5e3}})});if(!o.ok)return{text:`Exa answered ${o.status}: ${(0,c.clip)((await o.text()).trim(),200)}`,sources:[]};let r=(await o.json()).results??[];if(!r.length)return{text:"Nothing came back for that. Try other words, or open the page itself.",sources:[]};let i=r.flatMap(e=>e.url?.trim()?[{url:e.url.trim(),...e.title?.trim()?{title:e.title.trim()}:{}}]:[]);return{text:r.map(e=>{let t=[e.title?.trim(),e.url?.trim()].filter(Boolean).join(" — "),n=e.publishedDate?.slice(0,10);return[n?`${t} \xb7 ${n}`:t,e.text?.trim()].filter(Boolean).join("\n")}).join("\n\n"),sources:i}}async function h(e,t,n){let{text:r,sources:i}=await (0,o.generateText)({model:e.model,tools:e.tools,instructions:g,prompt:t,abortSignal:n}),s=[...new Set(i.flatMap(e=>"url"===e.sourceType?[e.title?`${e.title} — ${e.url}`:e.url]:[]))].slice(0,a.SEARCH.sources);return{text:[r.trim(),s.length?`Sources:
|
|
@@ -124,8 +122,8 @@ Every command is a new shell: \`cd\`, exported variables and an activated venv a
|
|
|
124
122
|
|
|
125
123
|
Nothing is watching it. A command that stops to ask never gets an answer and is killed after ${r.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.
|
|
126
124
|
|
|
127
|
-
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,r)=>{let c=!0===r.guide,d=async e=>{let t=r.bot;if(!t)return{result:await e(),memory:null};let n=await (0,a.holdBotMemory)(t);return{result:await e(),memory:await (0,a.keepBotMemory)(t,n)}},p=(0,n.tool)({description:l.BASH?"Run a bash command.":"Run a command in sh: this machine has no bash, so bash-only syntax fails.",inputSchema:o.default.object({command:o.default.string(),description:o.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:n})=>{let{result:o,memory:i}=await d(()=>e.exec(t,{signal:n,env:r.env,timeoutMs:r.timeoutMs})),a=i?{...o,memory:i}:o;return c?(c=!1,{...a,guide:u}):a}});if(!r.write)return{[i.TOOL_NAMES.bash]:p};let h=(0,n.tool)({description:"Write a whole file — what was there is gone. Parent directories are created.",inputSchema:o.default.object({path:o.default.string().describe("Relative to the working directory — under one of its folders — or absolute"),content:o.default.string(),description:o.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:n,content:o})=>{let i,a=e.resolve(n),l=(0,s.writeRefusal)(a,r.bot);if(l)return l;let{memory:u}=await d(()=>e.writeFile(n,o));return u??`Wrote ${(i=(0,t.relative)(e.cwd,a))&&!i.startsWith("..")?i:a} (${o.split("\n").length} lines)`}});return{[i.TOOL_NAMES.bash]:p,[i.TOOL_NAMES.write_file]:h}}])},450220,e=>{"use strict";e.s(["asWords",0,function(e,t,n=e=>e){let o=[];for(let r of e){if("tool"===r.role)continue;if("system"===r.role){o.push(r);continue}if("user"===r.role){o.push("string"==typeof r.content?{role:"user",content:n(r.content)}:r);continue}let e="string"==typeof r.content?[{type:"text",text:r.content}]:r.content,i=e.flatMap(e=>"text"===e.type?[e.text]:[]).join("\n").trim()||e.flatMap(e=>"tool-call"===e.type?[t(e.toolName,e.input)]:[]).join("\n");if(!i)continue;let a=o.at(-1);a?.role==="assistant"&&"string"==typeof a.content?o[o.length-1]={role:"assistant",content:`${a.content}
|
|
128
|
-
${n(i)}`}:o.push({role:"assistant",content:n(i)})}return o}])},75752,e=>{"use strict";var t=e.i(912714),n=e.i(750227),o=e.i(333925),r=e.i(871096);let i=e=>`${(0,r.botFolder)(e)}/memory`;async function a(e,t=o.BOT_MEMORY_LIMITS.files){let l=i(e),u=(0,n.join)(r.WORKSPACE,l),c=(await s(u)).sort((e,t)=>t.info.mtimeMs-e.info.mtimeMs),p=await Promise.all(c.slice(0,t).map(async({name:e,info:t})=>({file:e,path:`${l}/${e}`,line:await d((0,n.join)(u,e)),at:new Date(t.mtimeMs),bytes:t.size})));return{folder:l,entries:p,total:c.length}}async function s(e){let o=await (0,t.readdir)(e).catch(()=>[]);return(await Promise.all(o.filter(e=>!e.startsWith(".")).map(async o=>{let r=await (0,t.stat)((0,n.join)(e,o)).catch(()=>null);return r?.isFile()?{name:o,info:r}:null}))).filter(e=>null!==e)}async function l(e){let a=(0,n.join)(r.WORKSPACE,i(e)),l=new Map;return await Promise.all((await s(a)).map(async({name:e,info:r})=>{let i=r.size>4*o.BOT_MEMORY_LIMITS.chars?null:await (0,t.readFile)((0,n.join)(a,e),"utf8").catch(()=>null);l.set(e,{text:null!==i&&c(i)<=o.BOT_MEMORY_LIMITS.chars?i:null,size:r.size,mtimeMs:r.mtimeMs,atime:r.atime,mtime:r.mtime})})),l}async function u(e,a){let l=i(e),u=(0,n.join)(r.WORKSPACE,l),{files:d,chars:p}=o.BOT_MEMORY_LIMITS,h=[],m=[],g=0;for(let{name:e,info:o}of(await s(u))){g+=1;let r=a.get(e);if(r&&r.size===o.size&&r.mtimeMs===o.mtimeMs)continue;let i=(0,n.join)(u,e),s=c(await (0,t.readFile)(i,"utf8").catch(()=>""));if(s<=p){r||m.push(e);continue}let d=`${s.toLocaleString("en-US")} characters, past the ${p.toLocaleString("en-US")} a memory file holds`;r?null!==r.text?(await (0,t.writeFile)(i,r.text),await (0,t.utimes)(i,r.atime,r.mtime),h.push(`Not kept: \`${l}/${e}\` came to ${d}, so it is back as it was. Write it again shorter.`)):h.push(`\`${l}/${e}\` is ${d}. Shorten it.`):(await (0,t.rm)(i,{force:!0}),g-=1,h.push(`Not kept: \`${l}/${e}\` came to ${d}, so it was removed. Write it again shorter.`))}if(g>d&&m.length){await Promise.all(m.map(e=>(0,t.rm)((0,n.join)(u,e),{force:!0})));let e=m.map(e=>`\`${l}/${e}\``).join(", ");h.push(`Not kept: your memory holds ${d} files at most and this made ${g}, so ${e} ${1===m.length?"was":"were"} removed. Delete or merge files no longer worth keeping, then write it again.`)}return h.length?h.join("\n"):null}let c=e=>[...e.trim()].length;async function d(e){let n=await (0,t.open)(e,"r").catch(()=>null);if(!n)return"";try{let e=Buffer.alloc(1024),{bytesRead:t}=await n.read(e,0,1024,0),o=e.toString("utf8",0,t).split("\n").map(e=>e.trim()).filter(Boolean);if("---"===o[0]){let e=o.find(e=>e.startsWith("description:"));if(e)return e.slice(12).trim().replace(/^["']|["']$/g,"");let t=o.indexOf("---",1);return t>0?(o[t+1]??"").replace(/^#+\s*/,""):""}return(o[0]??"").replace(/^#+\s*/,"")}finally{await n.close()}}e.s(["botMemoryFolder",0,i,"holdBotMemory",0,l,"keepBotMemory",0,u,"listBotMemory",0,a])},277259,e=>e.a(async(t,n)=>{try{var o=e.i(666680),r=e.i(734732),i=e.i(691296),a=e.i(333925),s=e.i(113022),l=e.i(986507),u=e.i(475235),c=e.i(423620),d=e.i(51083),p=e.i(450220),h=e.i(951056),m=e.i(379651),g=e.i(871096),f=e.i(938281),y=e.i(610150),b=e.i(799791),_=e.i(600690),z=e.i(5509),w=t([s,l,u,c,b,z]);[s,l,u,c,b,z]=w.then?(await w)():w;let T=a.BOT_RUN.steps;async function v(e,t){var n;let o,p,w,v,S,E,C,A,j,R=t.parent??null,$=await (0,b.findJobBot)(e.bot.trim()),M=$?.name??e.bot.trim(),N=e=>t.emit({...e,bot:M,parent:R});if(!$)return void await N({type:"error",message:`No bot named "${e.bot}". Use a name from the list.`,retry:!1});let L=e.messages,P=await function(e,t={}){return e.provider&&e.model?(0,l.getTextModel)({provider:e.provider,model:e.model}):(0,l.resolveDefaultModel)(void 0,t).then(l.getTextModel)}($),U=t.threadId?await (0,z.findThread)(t.threadId):null,[q,{own:D,artifacts:F}]=await Promise.all([t.threadId?(0,g.openJobScratch)(t.threadId,U?.label??"job"):null,(0,g.openBotFolders)(M)]),H=t.session??(t.threadId?(0,g.botBrowserSession)(t.threadId,M):null),[B,W]=await Promise.all([(0,u.loadBotPrompt)(M,$.systemPrompt,{thread:t.threadId??null,owner:t.owner,caller:t.caller},{scratch:q,own:D,artifacts:F}),(0,s.loadTools)({target:"bot",bot:M,thread:t.threadId??null,session:H,model:P})]),K=Math.min(await (0,l.compactBudget)(P.ref,$.compactAt),t.contextBudget||1/0),V=await (0,l.runEffort)(P.ref,$.effort),J=(0,l.promptCacheOptions)(P.ref,t.threadId?O(t.threadId,M):null),G=!1,Y=(0,_.isCoordinatorSeat)(M,t.owner,t.caller)?{...W,[d.TOOL_NAMES.send_message]:(0,i.tool)({description:c.sendMessageSpec.description,inputSchema:c.sendMessageSpec.parameters,execute:async(e,n)=>{let o=await t.send({...e,id:n.toolCallId});return"question"===e.kind&&(G=!0),o}})}:W,Z=new Set,X=(n=a.BOT_RUN.silenceMs,p=new AbortController,w=0,v=!1,S=()=>{clearTimeout(o),o=void 0,v||w>0||(o=setTimeout(()=>{p.abort(new DOMException(`The model sent nothing for ${Math.round(n/6e4)} minutes.`,"TimeoutError"))},n))},{signal:p.signal,touch:S,hold:()=>{w+=1,S()},release:()=>{w=Math.max(0,w-1),S()},end:()=>{v=!0,S()}});for(let[e,n]of Object.entries(Y)){let o=n.execute;o&&(n.execute=(n,r)=>{let i=(async()=>{t.signal?.throwIfAborted(),await N({type:"tool",id:r.toolCallId,name:e,input:n}),X.hold();try{t.signal?.throwIfAborted();let i=await o(n,r);if(i&&"object"==typeof i&&Symbol.asyncIterator in i){let e;for await(let t of i)e=t;i=e}return await N({type:"tool-result",id:r.toolCallId,name:e,output:i}),i}catch(t){throw await N({type:"tool-result",id:r.toolCallId,name:e,output:(0,l.modelErrorToString)(t),error:!0}),t}finally{X.release()}})();return Z.add(i),i.finally(()=>Z.delete(i)).catch(()=>{}),i})}let Q=Promise.resolve(),ee=()=>{},et=0,en=new r.ToolLoopAgent({model:P.model,instructions:B.text,tools:Y,reasoning:V,providerOptions:J,stopWhen:[(0,r.stepCountIs)(T),()=>G],prepareStep:async({stepNumber:e,steps:n,messages:o})=>{await Q,t.signal?.throwIfAborted();let r={},i=(n.at(-1)?.usage.inputTokens??0)||o.reduce((e,t)=>e+(0,y.estimateTokens)("string"==typeof t.content?t.content:JSON.stringify(t.content))+4,0);et=i;let a=o,s=t.compactNow?.()??!1;if((i>K||s)&&o.length>2){X.hold();let e=await x(P.model,Y,o,{signal:t.signal,budget:K,instructions:B.text,providerOptions:J}).finally(X.release);f.logger.debug(`compacted ${o.length} messages at ${i} tokens (budget ${K})`);let n=`${e.text}${await k(U?.id??null,o,q)}`;await N({type:"compact",text:n,usage:e.usage,messages:o.length,tokens:i}),a=[o[0],{role:"user",content:n}]}let l=e>0?await t.notes?.()??[]:[];return(l.length&&(a=[...a,...l.map(e=>({role:"user",content:e}))]),a===o)?r:{...r,messages:a}}}),eo=(E=[],C=[],A=!1,{push(e){let t=C.shift();t?t(e):E.push(e)},take(){let e=E.shift();return e?Promise.resolve(e):A?Promise.resolve(null):new Promise(e=>C.push(e))},end(){for(let e of(A=!0,C.splice(0)))e(null)}}),er=t.signal?AbortSignal.any([t.signal,X.signal]):X.signal;X.touch();let ei=new AbortController,ea=AbortSignal.any([er,ei.signal]);try{j=await en.stream({messages:L,abortSignal:ea,onStepEnd:e=>{Q=new Promise(e=>{ee=e}),eo.push({messages:function(e){if(!e.toolResults.length)return e.response.messages;let t=new Map(e.toolResults.map(e=>[e.toolCallId,e.output]));return e.response.messages.map(e=>"tool"!==e.role?e:{...e,content:e.content.map(e=>{if("tool-result"!==e.type||!t.has(e.toolCallId))return e;let n=t.get(e.toolCallId);return{...e,output:"string"==typeof n?{type:"text",value:n}:{type:"json",value:n}}})})}(e),usage:I(e.usage)})}})}catch(e){throw X.end(),ei.abort(),await Promise.allSettled([...Z]),e}let es="",el="",eu=null,ec=e=>{f.logger.error(`${M}: the model run broke`,e);let t=(0,l.modelErrorToString)(e),n=!(0,l.isProviderRefusal)(e);if(!(0,l.isContextOverflow)(e))return{type:"error",message:t,retry:n};let
|
|
125
|
+
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,r)=>{let c=!0===r.guide,d=async e=>{let t=r.bot;if(!t)return{result:await e(),memory:null};let n=await (0,a.holdBotMemory)(t);return{result:await e(),memory:await (0,a.keepBotMemory)(t,n)}},p=(0,n.tool)({description:l.BASH?"Run a bash command.":"Run a command in sh: this machine has no bash, so bash-only syntax fails.",inputSchema:o.default.object({command:o.default.string(),description:o.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:n})=>{let{result:o,memory:i}=await d(()=>e.exec(t,{signal:n,env:r.env,timeoutMs:r.timeoutMs})),a=i?{...o,memory:i}:o;return c?(c=!1,{...a,guide:u}):a}});if(!r.write)return{[i.TOOL_NAMES.bash]:p};let h=(0,n.tool)({description:"Write a whole file — what was there is gone. Parent directories are created.",inputSchema:o.default.object({path:o.default.string().describe("Relative to the working directory — under one of its folders — or absolute"),content:o.default.string(),description:o.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:n,content:o})=>{let i,a=e.resolve(n),l=(0,s.writeRefusal)(a,r.bot);if(l)return l;let{memory:u}=await d(()=>e.writeFile(n,o));return u??`Wrote ${(i=(0,t.relative)(e.cwd,a))&&!i.startsWith("..")?i:a} (${o.split("\n").length} lines)`}});return{[i.TOOL_NAMES.bash]:p,[i.TOOL_NAMES.write_file]:h}}])},450220,e=>{"use strict";e.s(["asWords",0,function(e,t,n=e=>e){let o=[];for(let r of e){if("tool"===r.role)continue;if("system"===r.role){o.push(r);continue}if("user"===r.role){o.push("string"==typeof r.content?{role:"user",content:n(r.content)}:{...r,content:r.content.map(e=>"text"===e.type?{...e,text:n(e.text)}:e)});continue}let e="string"==typeof r.content?[{type:"text",text:r.content}]:r.content,i=e.flatMap(e=>"text"===e.type?[e.text]:[]).join("\n").trim()||e.flatMap(e=>"tool-call"===e.type?[t(e.toolName,e.input)]:[]).join("\n");if(!i)continue;let a=o.at(-1);a?.role==="assistant"&&"string"==typeof a.content?o[o.length-1]={role:"assistant",content:`${a.content}
|
|
126
|
+
${n(i)}`}:o.push({role:"assistant",content:n(i)})}return o}])},75752,e=>{"use strict";var t=e.i(912714),n=e.i(750227),o=e.i(333925),r=e.i(871096);let i=e=>`${(0,r.botFolder)(e)}/memory`;async function a(e,t=o.BOT_MEMORY_LIMITS.files){let l=i(e),u=(0,n.join)(r.WORKSPACE,l),c=(await s(u)).sort((e,t)=>t.info.mtimeMs-e.info.mtimeMs),p=await Promise.all(c.slice(0,t).map(async({name:e,info:t})=>({file:e,path:`${l}/${e}`,line:await d((0,n.join)(u,e)),at:new Date(t.mtimeMs),bytes:t.size})));return{folder:l,entries:p,total:c.length}}async function s(e){let o=await (0,t.readdir)(e).catch(()=>[]);return(await Promise.all(o.filter(e=>!e.startsWith(".")).map(async o=>{let r=await (0,t.stat)((0,n.join)(e,o)).catch(()=>null);return r?.isFile()?{name:o,info:r}:null}))).filter(e=>null!==e)}async function l(e){let a=(0,n.join)(r.WORKSPACE,i(e)),l=new Map;return await Promise.all((await s(a)).map(async({name:e,info:r})=>{let i=r.size>4*o.BOT_MEMORY_LIMITS.chars?null:await (0,t.readFile)((0,n.join)(a,e),"utf8").catch(()=>null);l.set(e,{text:null!==i&&c(i)<=o.BOT_MEMORY_LIMITS.chars?i:null,size:r.size,mtimeMs:r.mtimeMs,atime:r.atime,mtime:r.mtime})})),l}async function u(e,a){let l=i(e),u=(0,n.join)(r.WORKSPACE,l),{files:d,chars:p}=o.BOT_MEMORY_LIMITS,h=[],m=[],g=0;for(let{name:e,info:o}of(await s(u))){g+=1;let r=a.get(e);if(r&&r.size===o.size&&r.mtimeMs===o.mtimeMs)continue;let i=(0,n.join)(u,e),s=c(await (0,t.readFile)(i,"utf8").catch(()=>""));if(s<=p){r||m.push(e);continue}let d=`${s.toLocaleString("en-US")} characters, past the ${p.toLocaleString("en-US")} a memory file holds`;r?null!==r.text?(await (0,t.writeFile)(i,r.text),await (0,t.utimes)(i,r.atime,r.mtime),h.push(`Not kept: \`${l}/${e}\` came to ${d}, so it is back as it was. Write it again shorter.`)):h.push(`\`${l}/${e}\` is ${d}. Shorten it.`):(await (0,t.rm)(i,{force:!0}),g-=1,h.push(`Not kept: \`${l}/${e}\` came to ${d}, so it was removed. Write it again shorter.`))}if(g>d&&m.length){await Promise.all(m.map(e=>(0,t.rm)((0,n.join)(u,e),{force:!0})));let e=m.map(e=>`\`${l}/${e}\``).join(", ");h.push(`Not kept: your memory holds ${d} files at most and this made ${g}, so ${e} ${1===m.length?"was":"were"} removed. Delete or merge files no longer worth keeping, then write it again.`)}return h.length?h.join("\n"):null}let c=e=>[...e.trim()].length;async function d(e){let n=await (0,t.open)(e,"r").catch(()=>null);if(!n)return"";try{let e=Buffer.alloc(1024),{bytesRead:t}=await n.read(e,0,1024,0),o=e.toString("utf8",0,t).split("\n").map(e=>e.trim()).filter(Boolean);if("---"===o[0]){let e=o.find(e=>e.startsWith("description:"));if(e)return e.slice(12).trim().replace(/^["']|["']$/g,"");let t=o.indexOf("---",1);return t>0?(o[t+1]??"").replace(/^#+\s*/,""):""}return(o[0]??"").replace(/^#+\s*/,"")}finally{await n.close()}}e.s(["botMemoryFolder",0,i,"holdBotMemory",0,l,"keepBotMemory",0,u,"listBotMemory",0,a])},277259,e=>e.a(async(t,n)=>{try{var o=e.i(666680),r=e.i(734732),i=e.i(691296),a=e.i(333925),s=e.i(113022),l=e.i(986507),u=e.i(475235),c=e.i(423620),d=e.i(51083),p=e.i(450220),h=e.i(951056),m=e.i(379651),g=e.i(871096),f=e.i(938281),y=e.i(610150),b=e.i(799791),_=e.i(600690),z=e.i(5509),w=t([s,l,u,c,b,z]);[s,l,u,c,b,z]=w.then?(await w)():w;let T=a.BOT_RUN.steps;async function v(e,t){var n;let o,p,w,v,S,E,C,A,j,R=t.parent??null,$=await (0,b.findJobBot)(e.bot.trim()),M=$?.name??e.bot.trim(),N=e=>t.emit({...e,bot:M,parent:R});if(!$)return void await N({type:"error",message:`No bot named "${e.bot}". Use a name from the list.`,retry:!1});let L=e.messages,P=await function(e,t={}){return e.provider&&e.model?(0,l.getTextModel)({provider:e.provider,model:e.model}):(0,l.resolveDefaultModel)(void 0,t).then(l.getTextModel)}($),U=t.threadId?await (0,z.findThread)(t.threadId):null,[q,{own:D,artifacts:F}]=await Promise.all([t.threadId?(0,g.openJobScratch)(t.threadId,U?.label??"job"):null,(0,g.openBotFolders)(M)]),H=t.session??(t.threadId?(0,g.botBrowserSession)(t.threadId,M):null),[B,W]=await Promise.all([(0,u.loadBotPrompt)(M,$.systemPrompt,{thread:t.threadId??null,owner:t.owner,caller:t.caller},{scratch:q,own:D,artifacts:F}),(0,s.loadTools)({target:"bot",bot:M,thread:t.threadId??null,session:H,model:P})]),K=Math.min(await (0,l.compactBudget)(P.ref,$.compactAt),t.contextBudget||1/0),V=await (0,l.runEffort)(P.ref,$.effort),J=(0,l.promptCacheOptions)(P.ref,t.threadId?O(t.threadId,M):null),G=!1,Y=(0,_.isCoordinatorSeat)(M,t.owner,t.caller)?{...W,[d.TOOL_NAMES.send_message]:(0,i.tool)({description:c.sendMessageSpec.description,inputSchema:c.sendMessageSpec.parameters,execute:async(e,n)=>{let o=await t.send({...e,id:n.toolCallId});return"question"===e.kind&&(G=!0),o}})}:W,Z=new Set,X=(n=a.BOT_RUN.silenceMs,p=new AbortController,w=0,v=!1,S=()=>{clearTimeout(o),o=void 0,v||w>0||(o=setTimeout(()=>{p.abort(new DOMException(`The model sent nothing for ${Math.round(n/6e4)} minutes.`,"TimeoutError"))},n))},{signal:p.signal,touch:S,hold:()=>{w+=1,S()},release:()=>{w=Math.max(0,w-1),S()},end:()=>{v=!0,S()}});for(let[e,n]of Object.entries(Y)){let o=n.execute;o&&(n.execute=(n,r)=>{let i=(async()=>{t.signal?.throwIfAborted(),await N({type:"tool",id:r.toolCallId,name:e,input:n}),X.hold();try{t.signal?.throwIfAborted();let i=await o(n,r);if(i&&"object"==typeof i&&Symbol.asyncIterator in i){let e;for await(let t of i)e=t;i=e}return await N({type:"tool-result",id:r.toolCallId,name:e,output:i}),i}catch(t){throw await N({type:"tool-result",id:r.toolCallId,name:e,output:(0,l.modelErrorToString)(t),error:!0}),t}finally{X.release()}})();return Z.add(i),i.finally(()=>Z.delete(i)).catch(()=>{}),i})}let Q=Promise.resolve(),ee=()=>{},et=0,en=new r.ToolLoopAgent({model:P.model,instructions:B.text,tools:Y,reasoning:V,providerOptions:J,stopWhen:[(0,r.stepCountIs)(T),()=>G],prepareStep:async({stepNumber:e,steps:n,messages:o})=>{await Q,t.signal?.throwIfAborted();let r={},i=(n.at(-1)?.usage.inputTokens??0)||o.reduce((e,t)=>e+(0,y.estimateTokens)("string"==typeof t.content?t.content:JSON.stringify(t.content))+4,0);et=i;let a=o,s=t.compactNow?.()??!1;if((i>K||s)&&o.length>2){X.hold();let e=await x(P.model,Y,o,{signal:t.signal,budget:K,instructions:B.text,providerOptions:J}).finally(X.release);f.logger.debug(`compacted ${o.length} messages at ${i} tokens (budget ${K})`);let n=`${e.text}${await k(U?.id??null,o,q)}`;await N({type:"compact",text:n,usage:e.usage,messages:o.length,tokens:i}),a=[o[0],{role:"user",content:n}]}let l=e>0?await t.notes?.()??[]:[];return(l.length&&(a=[...a,...l.map(e=>({role:"user",content:e}))]),a===o)?r:{...r,messages:a}}}),eo=(E=[],C=[],A=!1,{push(e){let t=C.shift();t?t(e):E.push(e)},take(){let e=E.shift();return e?Promise.resolve(e):A?Promise.resolve(null):new Promise(e=>C.push(e))},end(){for(let e of(A=!0,C.splice(0)))e(null)}}),er=t.signal?AbortSignal.any([t.signal,X.signal]):X.signal;X.touch();let ei=new AbortController,ea=AbortSignal.any([er,ei.signal]);try{j=await en.stream({messages:L,abortSignal:ea,onStepEnd:e=>{Q=new Promise(e=>{ee=e}),eo.push({messages:function(e){if(!e.toolResults.length)return e.response.messages;let t=new Map(e.toolResults.map(e=>[e.toolCallId,e.output]));return e.response.messages.map(e=>"tool"!==e.role?e:{...e,content:e.content.map(e=>{if("tool-result"!==e.type||!t.has(e.toolCallId))return e;let n=t.get(e.toolCallId);return{...e,output:"string"==typeof n?{type:"text",value:n}:{type:"json",value:n}}})})}(e),usage:I(e.usage)})}})}catch(e){throw X.end(),ei.abort(),await Promise.allSettled([...Z]),e}let es="",el="",eu=null,ec=e=>{f.logger.error(`${M}: the model run broke`,e);let t=(0,l.modelErrorToString)(e),n=!(0,l.isProviderRefusal)(e),o=(0,l.isKeyRefused)(e)?{refused:P.ref.provider}:{};if(!(0,l.isContextOverflow)(e))return{type:"error",message:t,retry:n,...o};let r=Math.floor(Math.min(K,et||K)*a.BOT_RUN.overflowShrink);return{type:"error",message:t,budget:Math.max(h.COMPACT_AT_MIN,r),retry:n,...o}};er.addEventListener("abort",()=>{eo.end(),ee()},{once:!0});try{for await(let e of j.stream)switch(X.touch(),e.type){case"start-step":el="",es="";break;case"text-delta":es+=e.text;break;case"text-end":{let e=es.trim();if(es="",!e)break;el=[el,e].filter(Boolean).join("\n\n"),await N({type:"text",text:e});break}case"tool-call":await N({type:"tool",id:e.toolCallId,name:e.toolName,input:e.input,providerExecuted:e.providerExecuted,providerOptions:e.providerMetadata});break;case"tool-result":await N({type:"tool-result",id:e.toolCallId,name:e.toolName,output:e.output});break;case"tool-error":await N({type:"tool-result",id:e.toolCallId,name:e.toolName,output:(0,l.modelErrorToString)(e.error),error:!0});break;case"finish-step":{eu=e.finishReason;let t=await eo.take();t&&await N({type:"step",...t,budget:K}),ee();break}case"abort":if(t.signal?.aborted)return;await N(ec(e.reason??"The model stopped sending."));return;case"error":await N(ec(e.error));return}}finally{ei.abort(),eo.end(),X.end(),ee(),await Promise.allSettled([...Z]),H&&(0,m.renewSignIns)(H).catch(e=>f.logger.warn(`${M}: kept sign-ins were not renewed`,e))}try{await j.finalStep}catch(e){if(t.signal?.aborted)return;await N(ec(e));return}"content-filter"===eu?await N({type:"error",message:"The provider's content filter stopped the response.",retry:!1}):await N({type:"turn-end",text:el,stopped:!G&&("length"===eu||"error"===eu||"tool-calls"===eu)})}async function k(e,t,n){try{let o=e?await (0,z.listWrittenPaths)(e):(0,z.writtenPathsIn)(t.map(e=>e.content)),r=await (0,g.filesOnDisk)(o,n);if(!r.length)return"";let i=r.slice(-a.BOT_RUN.compactFiles),s=r.length-i.length,l=i.map(e=>`- ${e}`);return s&&l.unshift(`- …and ${s} older ones`),`
|
|
129
127
|
|
|
130
128
|
Files this job has on disk now — open one rather than fetching again what is in it:
|
|
131
129
|
${l.join("\n")}`}catch(e){return f.logger.warn("files under the summary could not be listed",e),""}}async function x(e,t,n,o){let r;try{return await S(e,t,n,o)}catch(e){if(o.signal?.aborted)throw e;r=e}if((0,l.isContextOverflow)(r)){let i=(0,p.asWords)(n,(e,t)=>`${e}: ${(0,z.argumentLine)(e,t)}`);try{return await S(e,t,i,o)}catch(e){if(o.signal?.aborted)throw e;r=e}}throw Error(`Could not compact the context (${(0,l.modelErrorToString)(r)}).`,{cause:r})}async function S(e,t,n,o){let i,{text:s,usage:l}=await (0,r.generateText)({model:e,instructions:o.instructions,tools:t,toolChoice:"none",messages:[...n,{role:"user",content:(i=(e=>{let{min:t,max:n,perTokens:o}=a.BOT_RUN.summaryWords;return Math.min(n,Math.max(t,Math.round(e/o)))})(o.budget),`Compact your context. The first message above — who handed you the job, and the job — stays exactly as it is. Everything after it is replaced by what you write now, and you carry on from that first message and this alone; nothing else above can be read again. Write it for a fresh copy of you that has your tools, your instructions and that first message, but has seen none of the rest.
|
|
@@ -143,7 +141,7 @@ Plain text, under ${i} words. No preamble, no headings about the summary itself,
|
|
|
143
141
|
|
|
144
142
|
${u}`,usage:I(l)}}let I=e=>({input:e.inputTokens??0,output:e.outputTokens??0,cacheRead:e.inputTokenDetails?.cacheReadTokens??0,cacheWrite:e.inputTokenDetails?.cacheWriteTokens??0}),O=(e,t)=>(0,o.createHash)("sha256").update(`${e}
|
|
145
143
|
${t}`).digest("hex").slice(0,32);e.s(["resumeTranscript",0,function(e,t=new Map){let n=new Map,o=new Set;for(let t of e)if(("tool"===t.role||"assistant"===t.role)&&Array.isArray(t.content))for(let e of t.content)"tool-result"===e.type&&(n.has(e.toolCallId)||n.set(e.toolCallId,e),"assistant"===t.role&&o.add(e.toolCallId));let r=[],i=new Set;for(let a of e){if("tool"===a.role){let e=a.content.filter(e=>"tool-result"!==e.type);e.length&&r.push({...a,content:e});continue}if("assistant"!==a.role||"string"==typeof a.content){r.push(a);continue}let e=[],s=[];for(let r of a.content){if("tool-call"!==r.type){s.push(r);continue}if(i.has(r.toolCallId))continue;let a=r.input;if("string"==typeof a)try{a=JSON.parse(a)}catch{a=void 0}if(!r.toolCallId||void 0===a){s.push({type:"text",text:"A tool argument stream was interrupted before a complete call was recorded. Inspect the saved work before continuing."});continue}let l=r.toolName===d.TOOL_NAMES.send_message?t.get(r.toolCallId):void 0,u=n.get(r.toolCallId)??(l?{type:"tool-result",toolCallId:r.toolCallId,toolName:r.toolName,output:{type:"json",value:l}}:void 0);if(r.providerExecuted&&(!u||!o.has(r.toolCallId))){s.push({type:"text",text:u?`The provider operation ${r.toolName} returned this data before its native continuation was interrupted: ${JSON.stringify(u.output)}`:`The provider operation ${r.toolName} was interrupted without a recorded result. Its remote execution state is unknown.`});continue}i.add(r.toolCallId),s.push({...r,input:a}),o.has(r.toolCallId)||e.push(u??{type:"tool-result",toolCallId:r.toolCallId,toolName:r.toolName,output:{type:"text",value:"No result: execution was interrupted before a result was recorded. The outcome is unknown. Inspect the current state before repeating the action."}})}s.length&&r.push({...a,content:s}),e.length&&r.push({role:"tool",content:e})}return r},"runBot",0,v]),n()}catch(e){n(e)}},!1),49002,e=>e.a(async(t,n)=>{try{var o=e.i(136340),r=e.i(232347),i=e.i(333925),a=e.i(986507),s=e.i(475235),l=e.i(520401),u=e.i(375814),c=e.i(871096),d=e.i(528803),p=e.i(938281),h=e.i(212389),m=e.i(991243),g=e.i(64774),f=e.i(799791),y=e.i(277259),b=e.i(951056),_=e.i(811592),z=e.i(600690),w=e.i(5509),v=t([a,s,l,f,y,_,w]);[a,s,l,f,y,_,w]=v.then?(await v)():v;let N=globalThis.__roomRuns??=new Map,L=globalThis.__roomThreadLock??=(0,m.createKeyedLock)(),P=globalThis.__roomCompactAsked??=new Set,U=(e,t)=>`${e}
|
|
146
|
-
${t}`;async function k(e){let t=await (0,f.findJobBot)(e.bot);(!t||t.disabled)&&(0,h.publicError)("Choose an enabled bot.");let{from:n,routine:o,...r}={...e,bot:t.name},i=(0,s.buildThreadOpening)({bot:r.bot,request:r.request,from:n,routine:o}),a=await (0,w.insertThread)({...r,routineId:o?.id??null,opening:i});return await S(a.id),a.id}async function x(e,t,n="user",o,r){let i=null;return await L(e,async()=>{let a=await (0,w.findThread)(e);if(a||(0,h.publicError)("No such thread."),o){let t=(await (0,_.listRoomWork)(e)).find(e=>e.bot.toLowerCase()===o.trim().toLowerCase());t&&t.bot!==z.ROOM_THURSDAY||(0,h.publicError)("Choose a participant in this thread."),o=t.bot}t.trim()===b.THREAD_CONTINUE&&(0,b.isAppStop)(a.pending)?(await (0,_.resumeRoom)(e),(await (0,_.listRoomWork)(e)).some(e=>"queued"===e.state)||(i=await (0,_.tellRoom)(e,"Continue from the saved conversation.","user"===n?z.ROOM_USER:z.ROOM_THURSDAY,o,void 0,!1))):i=await (0,_.tellRoom)(e,t,"user"===n?z.ROOM_USER:z.ROOM_THURSDAY,o,r)}),await S(e),i}async function S(e){await L(e,async()=>{for(let t=0;t<2;t++){let t;for(;t=await (0,_.claimRoomWork)(e);)!function(e){let t,n=new AbortController,o=new Promise(e=>{t=e});N.set(e.id,{threadId:e.threadId,stop:n,done:o}),T(e,n.signal).catch(t=>p.logger.error(`thread ${e.threadId}: participant`,t)).finally(()=>{N.delete(e.id),t(),S(e.threadId).catch(t=>p.logger.error(`thread ${e.threadId}: scheduling`,t))})}(t);await (0,_.settleRoom)(e)}})}async function T(e,t){let n=await I(e,t);if(n?.failure?.retry&&!t.aborted&&(await (0,_.noteRoomBreak)(e,n.failure.message),await (0,o.setTimeout)(i.BOT_RUN.retryMs,void 0,{signal:t}).catch(()=>{}),t.aborted||(n=await I(e,t,!1))),!n||t.aborted)return;let a=n.failure?.message,s=n.ending;if(a||!s||s.stopped){let t=a??"The turn was interrupted. Continue from the saved conversation.";L(e.threadId,async()=>{let n=(await (0,_.listRoomWork)(e.threadId)).find(t=>t.id===e.id);if(n?.state!=="running"||n.generation!==e.generation)return;let o=O(e.threadId);await (0,_.pauseRoom)(e.threadId,t),await o}).catch(t=>p.logger.error(`thread ${e.threadId}: pausing`,t));return}await (0,_.finishRoomWork)(e,s.text);let h=await (0,w.findThread)(e.threadId);if(h?.status==="done"){let e=(0,g.plainText)(h.outcome??"").slice(0,i.FINISHED_NOTICE.words);r.presence.watching||await (0,l.isAnyCallLive)()||(0,d.desktopNotify)(h.label,e);let t=await (0,c.filesOnDisk)((0,u.pathsIn)(h.outcome??""),null);r.appEvents.emit({type:"finished",threadId:h.id,label:h.label,bot:h.bot,words:e,paths:(0,u.leadFirst)(t)})}}async function I(e,t,n=!0){let o=new q(e,t),r=null,i=null;try{let a=await (0,w.findThread)(e.threadId);if(!a)return null;if((await (0,_.listParticipantTranscript)(e.threadId,e.bot)).length||await (0,_.joinRoom)(e,t=>(0,s.buildJoinOpening)({bot:e.bot,coordinator:a.bot,job:t,request:a.request})),await (0,_.consumeRoomInbox)(e),n&&(0,z.isCoordinatorSeat)(e.bot,a.bot,e.caller)){let t=await (0,_.roomBoard)(e);t&&await (0,_.appendRoomMessage)(e.threadId,{bot:e.bot,parent:e.id,role:"user",content:t,hidden:!0})}let l=await (0,_.listParticipantTranscript)(e.threadId,e.bot);await (0,y.runBot)({bot:e.bot,messages:(0,y.resumeTranscript)(l,await (0,_.listRoomReceipts)(e.threadId,e.bot,l))},{signal:t,threadId:e.threadId,parent:e.id,caller:e.caller,owner:a.bot,contextBudget:await (0,_.roomContextBudget)(e.threadId,e.bot),compactNow:()=>P.delete(U(e.threadId,e.bot)),session:(0,c.botBrowserSession)(e.threadId,e.bot),notes:()=>(0,_.consumeRoomInbox)(e),send:async n=>{t.throwIfAborted();let o=n.to.trim();if(o.toLowerCase()===z.ROOM_THURSDAY.toLowerCase())o=z.ROOM_THURSDAY;else{let e=await (0,f.findJobBot)(o);(!e||e.disabled)&&(0,h.publicError)(`No enabled bot named "${o}".`),o=e.name}let r=await (0,_.sendRoomMessage)(e,{...n,to:o});return S(e.threadId).catch(e=>p.logger.error("room message scheduling",e)),r},emit:async n=>{(!t.aborted||"tool-result"===n.type)&&(await o.on(n),"step"===n.type&&await (0,w.addThreadUsage)(e.threadId,n.usage,e.bot===a.bot?{tokens:n.usage.input,budget:n.budget}:null),"compact"===n.type&&await (0,w.addThreadUsage)(e.threadId,n.usage),"turn-end"===n.type&&(r=n),"error"===n.type&&(i={message:n.message,retry:n.retry},n.budget&&await (0,_.lowerRoomContextBudget)(e,n.budget)))}})}catch(n){t.aborted||(p.logger.error(`thread ${e.threadId}: ${e.bot} broke`,n),i={message:(0,a.modelErrorToString)(n),retry:!(0,h.isPublicError)(n)&&!(0,a.isProviderRefusal)(n)})}return{ending:r,failure:i}}class q{work;signal;lane;assistant;tool;parts;calls;results;constructor(e,t){this.work=e,this.signal=t,this.lane=(0,g.PromiseChain)(),this.assistant=null,this.tool=null,this.parts={assistant:[],tool:[]},this.calls=new Set,this.results=new Set}async write(e,t,n=!1){let o={bot:this.work.bot,parent:this.work.id,role:t.role,content:t.content,compact:n,note:n};return null===e?(0,_.appendRoomMessage)(this.work.threadId,o):(await (0,w.upsertMessage)(this.work.threadId,e,o),e)}on(e){return this.lane(async()=>{if(!this.signal.aborted||"tool-result"===e.type)if("text"===e.type)this.parts.assistant.push({type:"text",text:e.text}),this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant});else if("tool"===e.type){if(this.calls.has(e.id)){let t=this.parts.assistant.find(t=>"tool-call"===t.type&&t.toolCallId===e.id);t&&"tool-call"===t.type&&e.providerOptions&&(t.providerOptions=e.providerOptions,this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant}));return}this.calls.add(e.id),this.parts.assistant.push({type:"tool-call",toolCallId:e.id,toolName:e.name,input:e.input,...e.providerExecuted?{providerExecuted:!0}:{},...e.providerOptions?{providerOptions:e.providerOptions}:{}}),this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant})}else if("tool-result"===e.type){if(this.results.has(e.id))return;this.results.add(e.id),this.parts.tool.push({type:"tool-result",toolCallId:e.id,toolName:e.name,output:e.error?{type:"error-text",value:String(e.output)}:"string"==typeof e.output?{type:"text",value:e.output}:{type:"json",value:e.output}}),this.tool=await this.write(this.tool,{role:"tool",content:this.parts.tool})}else if("step"===e.type){let t=[this.assistant,this.tool];for(let[n,o]of e.messages.entries())await this.write(t[n]??null,o);let n=t.slice(e.messages.length).filter(e=>null!==e);n.length&&await (0,w.deleteMessages)(this.work.threadId,n),this.assistant=this.tool=null,this.parts={assistant:[],tool:[]}}else"compact"===e.type&&await this.write(null,{role:"user",content:e.text},!0)})}}async function O(e){let t=[...N.values()].filter(t=>t.threadId===e);for(let e of t)e.stop.abort();await Promise.all(t.map(e=>e.done))}async function E(e){await L(e,async()=>{let t=await (0,w.findThread)(e);t||(0,h.publicError)("No such thread."),t.endedAt&&(0,h.publicError)("That thread has already ended."),await (0,_.cancelRoom)(e),await (0,w.updateThread)(e,{status:"cancelled",outcome:null,pending:null,seen:!0,endedAt:new Date}),await O(e),await (0,c.closeJobShell)(e)})}async function C(e){return L(e,()=>A(e))}async function A(e){let t=await (0,w.findThread)(e);await (0,_.cancelRoom)(e),await O(e),await (0,c.removeJobBrowsers)(e);let n=await (0,w.deleteThread)(e);return n&&t&&await (0,c.removeJobScratch)(e,t.label),n}async function j(e){let t=e?.getTime(),n=e=>void 0===t||(e.endedAt??e.updatedAt).getTime()<t,o=0;for(let e of(await (0,w.listThreadFolders)()))("done"===e.status||"cancelled"===e.status)&&n(e)&&await L(e.id,async()=>{let t=await (0,w.findThread)(e.id);t?.status!=="done"&&t?.status!=="cancelled"||n(t)&&await A(e.id)&&(o+=1)});return o}async function R(){let e=Date.now()-i.WORKSPACE_KEEP.forMs,t=t=>("done"===t.status||"cancelled"===t.status)&&(t.endedAt??t.updatedAt).getTime()<e,n=new Set(await (0,c.listScratchFolders)()),o=[];for(let e of(await (0,w.listThreadFolders)())){let r=(0,c.jobScratch)(e.id,e.label);n.delete(r)&&t(e)&&await L(e.id,async()=>{let n=await (0,w.findThread)(e.id);n&&t(n)&&(await (0,c.closeHiddenBrowser)(e.id),await (0,c.removeJobScratch)(e.id,e.label),o.push(r))})}return o.push(...await (0,c.removeUnchangedFolders)([...n])),await (0,c.pruneJobFiles)(),o.length&&p.logger.info(`cleared ${o.length} old job folder(s): ${o.join(", ")}`),o}async function $(){for(let e of(await (0,w.listRunningThreadIds)()))await L(e,async()=>{[...N.values()].some(t=>t.threadId===e)||(await (0,w.findThread)(e))?.status==="running"&&await (0,_.pauseRoom)(e,"The server restarted. Resume from the saved conversation.")})}async function M(e){let t=await (0,w.listRunningThreadIds)();await Promise.all(t.map(t=>L(t,async()=>{(await (0,w.findThread)(t))?.status==="running"&&(await O(t),await (0,_.pauseRoom)(t,e))})))}e.s(["answerThread",0,x,"askCompact",0,function(e,t){P.add(U(e,t))},"cancelThread",0,E,"pauseThreads",0,M,"removeFinishedThreads",0,j,"removeThread",0,C,"startThread",0,k,"sweepJobFiles",0,R,"sweepThreads",0,$]),n()}catch(e){n(e)}},!1),539904,e=>e.a(async(t,n)=>{try{var o,r=e.i(753955),i=e.i(940655),a=e.i(333925),s=e.i(938281),l=e.i(64774),u=e.i(993195),c=e.i(950262),d=t([u]);[u]=d.then?(await d)():d;class p extends Error{serverName;authorizationUrl;constructor(e,t){super(`MCP server "${e}" requires authorization`),this.serverName=e,this.authorizationUrl=t,this.name="McpAuthRequiredError"}}class h{store;serverName;oauth;callbackUrl;clientName;lastAuthorizationUrl;constructor(e,t,n,o,r){this.store=e,this.serverName=t,this.oauth=n,this.callbackUrl=o,this.clientName=r}get redirectUrl(){return this.callbackUrl}get clientMetadata(){return{client_name:this.clientName,redirect_uris:[this.callbackUrl],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"client_secret_post"}}async persist(e){this.oauth={...this.oauth,...e},await this.store.saveOAuth(this.serverName,this.oauth)}clientInformation(){return this.oauth.clientInformation}async saveClientInformation(e){await this.persist({clientInformation:e})}tokens(){return this.oauth.tokens}async saveTokens(e){await this.persist({tokens:e})}authorizationServerInformation(){return this.oauth.authorizationServer}async saveAuthorizationServerInformation(e){await this.persist({authorizationServer:e})}codeVerifier(){if(!this.oauth.codeVerifier)throw Error("No code verifier saved");return this.oauth.codeVerifier}async saveCodeVerifier(e){await this.persist({codeVerifier:e})}state(){return crypto.randomUUID()}async saveState(e){await this.persist({state:e})}storedState(){return this.oauth.state}redirectToAuthorization(e){this.lastAuthorizationUrl=e}async invalidateCredentials(e){let t={...this.oauth};("all"===e||"client"===e)&&(t.clientInformation=void 0),("all"===e||"tokens"===e)&&(t.tokens=void 0),("all"===e||"verifier"===e)&&(t.codeVerifier=void 0),this.oauth=t,await this.store.saveOAuth(this.serverName,t)}}let m=globalThis;m.__thursdayMcpManager&&m.__thursdayMcpManager.dispose(),o={callbackUrl:new URL("/api/mcp/oauth/callback",a.APP_URL).href,clientName:a.APP_NAME},m.__thursdayMcpManager=new class e{store;sessions;connecting;callbackUrl;clientName;constructor(e,t){this.store=e,this.sessions=new Map,this.connecting=new Map,this.callbackUrl=t.callbackUrl,this.clientName=t.clientName??a.APP_NAME}async connect(e){let t=this.connecting.get(e);if(t)return t;let n=this.doConnect(e).finally(()=>this.connecting.delete(e));return this.connecting.set(e,n),n}async callTool(e,t,n,o){let i=await this.ensureClient(e);try{let r=await i.callTool({name:t,arguments:n,options:o?{signal:o}:void 0});return this.touch(e),r}catch(t){if(t instanceof r.UnauthorizedError)throw await this.closeSession(e),new p(e);throw t}}async finishAuthorization(e){let t=e.get("state"),n=e.get("code");if(!t||!n)throw Error("OAuth callback is missing code or state");let o=await this.store.findByOAuthState(t);if(!o||!(0,c.isRemoteConfig)(o.config))throw Error("No server is waiting for this authorization");let i=this.providerFor(o),a=await (0,r.auth)(i,{serverUrl:o.config.url,authorizationCode:n,callbackState:t});if("AUTHORIZED"!==a)throw Error(`Token exchange ended in "${a}"`);return await i.invalidateCredentials("verifier"),await this.connect(o.name),o.name}async disconnect(e){await this.closeSession(e)}async dispose(){await Promise.all([...this.sessions.keys()].map(e=>this.closeSession(e)))}async doConnect(e){await this.closeSession(e);let t=await this.store.load(e);if(!t)throw Error(`Unknown MCP server "${e}"`);let n={};try{let o=await this.openClient(t,n),r=(await o.listTools()).tools.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema,outputSchema:e.outputSchema}));return this.adopt(e,o),await this.store.saveConnectionResult(e,{toolInfo:r,lastError:null}),s.logger.info(`mcp "${e}" connected — ${r.length} tools`),{status:"connected",tools:r}}catch(d){var o,i;let a;if(d instanceof r.UnauthorizedError||d?.cause instanceof r.UnauthorizedError){let t=n.href;if(t)return await this.store.saveConnectionResult(e,{toolInfo:[],lastError:"Authorization required — finish sign-in in the opened tab"}),{status:"auth_required",authorizationUrl:t}}let u=(o=d,i=t,a=(0,l.errorToString)(o),(0,c.isRemoteConfig)(i.config)&&!i.oauth?.clientInformation&&/Invalid OAuth error response/.test(a)?`This server does not let an app register itself for sign-in, so it cannot be connected here. It answered: ${a}`:a);throw await this.store.saveConnectionResult(e,{toolInfo:[],lastError:u}),s.logger.warn(`mcp "${e}" failed — ${u}`),Error(u,{cause:d})}}async openClient(e,t={}){if((0,c.isRemoteConfig)(e.config)){let n=this.providerFor(e);try{return await (0,r.createMCPClient)({name:this.clientName,transport:{type:"http",url:e.config.url,headers:e.config.headers,authProvider:n,redirect:"follow"}})}finally{t.href=n.lastAuthorizationUrl?.href}}return(0,r.createMCPClient)({name:this.clientName,transport:new i.Experimental_StdioMCPTransport({command:e.config.command,args:e.config.args,env:e.config.env})})}providerFor(e){return new h(this.store,e.name,e.oauth??{},this.callbackUrl,this.clientName)}async ensureClient(e){let t=this.sessions.get(e);if(t)return t.client;let n=await this.connect(e);if("auth_required"===n.status)throw new p(e,n.authorizationUrl);let o=this.sessions.get(e);if(!o)throw Error(`Session for "${e}" vanished mid-connect`);return o.client}adopt(e,t){this.sessions.set(e,{client:t,idleTimer:this.armIdleTimer(e)})}touch(e){let t=this.sessions.get(e);t&&(clearTimeout(t.idleTimer),t.idleTimer=this.armIdleTimer(e))}armIdleTimer(e){let t=setTimeout(()=>{this.closeSession(e)},a.MCP_IDLE_MS);return t.unref?.(),t}async closeSession(e){let t=this.sessions.get(e);t&&(this.sessions.delete(e),clearTimeout(t.idleTimer),await t.client.close().catch(()=>{}))}}({load:e=>(0,u.findServer)(e),saveOAuth:(e,t)=>(0,u.saveOAuthData)(e,t),saveConnectionResult:(e,t)=>null===t.lastError?(0,u.syncServerTools)(e,t.toolInfo):(0,u.saveConnectionError)(e,t.lastError),findByOAuthState:e=>(0,u.findServerByOAuthState)(e)},o);let g=m.__thursdayMcpManager;e.s(["McpAuthRequiredError",0,p,"mcpManager",0,g]),n()}catch(e){n(e)}},!1),519645,e=>e.a(async(t,n)=>{try{var o=e.i(336763),r=e.i(157406),i=e.i(396918),a=e.i(232347),s=e.i(333925),l=e.i(876393),u=e.i(220376),c=e.i(799791),d=e.i(212389),p=e.i(275841),h=t([l,c]);[l,c]=h.then?(await h)():h;let I=()=>a.appEvents.emit({type:"routines"});async function m(e,t){return l.database.select({id:u.threadTable.id,status:u.threadTable.status,outcome:u.threadTable.outcome,updatedAt:u.threadTable.updatedAt}).from(u.threadTable).where((0,o.eq)(u.threadTable.routineId,e)).orderBy((0,i.desc)(u.threadTable.createdAt)).limit(t)}let O=async e=>{let{createdAt:t,...n}=e;return{...n,runs:await m(e.id,s.ROUTINE.runsShown)}};async function g(){let e=await l.database.select().from(u.routineTable).orderBy(u.routineTable.createdAt);return Promise.all(e.map(O))}async function f(e){let[t]=await l.database.select().from(u.routineTable).where((0,o.eq)(u.routineTable.id,e));return t?O(t):null}async function y(e){let t=await f(e.trim());if(t)return t;let n=e.trim().toLowerCase(),o=(await g()).filter(e=>e.label.toLowerCase()===n);return 1===o.length?o[0]:null}async function b(e){let t=await (0,c.findJobBot)(e);return(!t||t.disabled)&&(0,d.publicError)("Choose an enabled bot."),t.name}function _(e,t){t&&"once"===e.kind&&(0,p.momentOf)(e.at)<=new Date&&(0,d.publicError)("That time has passed. Pick a later one.")}async function z(e){let[{total:t}]=await l.database.select({total:(0,r.count)()}).from(u.routineTable);t>=s.ROUTINE.max&&(0,d.publicError)(`There are already ${s.ROUTINE.max} routines. Delete one to make another.`),_(e.schedule,!0);let[n]=await l.database.insert(u.routineTable).values({id:crypto.randomUUID(),...e,bot:await b(e.bot),nextRunAt:(0,p.nextRun)(e.schedule,new Date)}).returning();return I(),O(n)}async function w(e,t){let[n]=await l.database.select().from(u.routineTable).where((0,o.eq)(u.routineTable.id,e));if(!n)return null;let r=t.schedule??n.schedule,i=!!(t.schedule&&!(0,p.sameSchedule)(t.schedule,n.schedule))||t.enabled&&!n.enabled;i&&_(r,t.enabled??n.enabled);let[a]=await l.database.update(u.routineTable).set({...t,...t.bot?{bot:await b(t.bot)}:{},...i?{nextRunAt:(0,p.nextRun)(r,new Date)}:{}}).where((0,o.eq)(u.routineTable.id,e)).returning();return I(),O(a)}async function v(e){let t=await l.database.delete(u.routineTable).where((0,o.eq)(u.routineTable.id,e)).returning({id:u.routineTable.id});return t.length&&I(),t.length>0}async function k(e){return l.database.select().from(u.routineTable).where((0,o.and)((0,o.eq)(u.routineTable.enabled,!0),(0,o.lte)(u.routineTable.nextRunAt,e))).orderBy(u.routineTable.nextRunAt)}async function x(e,t){let n=await l.database.update(u.routineTable).set("once"===e.schedule.kind?{enabled:!1}:{nextRunAt:(0,p.nextRun)(e.schedule,t)}).where((0,o.and)((0,o.eq)(u.routineTable.id,e.id),(0,o.eq)(u.routineTable.enabled,!0),(0,o.eq)(u.routineTable.nextRunAt,e.nextRunAt))).returning({id:u.routineTable.id});return n.length&&I(),n.length>0}async function S(e){return(await m(e,1))[0]??null}async function T(e){return(await l.database.select({id:u.threadTable.id}).from(u.threadTable).where((0,o.and)((0,o.eq)(u.threadTable.routineId,e),(0,o.eq)(u.threadTable.seen,!1),(0,o.inArray)(u.threadTable.status,["done","cancelled"])))).map(e=>e.id)}e.s(["claimRoutine",0,x,"createRoutine",0,z,"deleteRoutine",0,v,"latestRun",0,S,"listDueRoutines",0,k,"listRoutines",0,g,"listUnseenRunIds",0,T,"resolveRoutine",0,y,"updateRoutine",0,w]),n()}catch(e){n(e)}},!1),275841,e=>{"use strict";var t=e.i(517435),n=e.i(333925),o=e.i(900533);let r=t.default.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function i(e){let[t,n]=e.split(" "),[o,r,i]=t.split("-").map(Number),[a,s]=n.split(":").map(Number);return new Date(o,r-1,i,a,s)}let a=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,s=t.default.string().regex(a,'A moment is "YYYY-MM-DD HH:MM"').refine(e=>{if(!a.test(e))return!0;let t=i(e);return t.getMonth()===Number(e.slice(5,7))-1&&t.getDate()===Number(e.slice(8,10))},"There is no such day"),l=t.default.discriminatedUnion("kind",[t.default.object({kind:t.default.literal("once"),at:s}),t.default.object({kind:t.default.literal("daily"),time:r,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(n.ROUTINE.minHours,`No more often than every ${n.ROUTINE.minHours}h`).max(168)})]),u=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:l}),c=t.default.object({id:t.default.string(),status:t.default.enum(["running","waiting","done","cancelled"]),outcome:t.default.string().nullable(),updatedAt:o.DateLikeSchema});u.extend({id:t.default.string(),enabled:t.default.boolean(),nextRunAt:o.DateLikeSchema,runs:t.default.array(c)});let d=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.s(["RoutineInputSchema",0,u,"RoutineScheduleSchema",0,l,"momentOf",0,i,"nextRun",0,function(e,t){if("once"===e.kind)return i(e.at);if("every"===e.kind)return new Date(t.getTime()+36e5*e.hours);let[n,o]=e.time.split(":").map(Number);for(let r=0;r<=7;r++){let i=new Date(t);i.setDate(i.getDate()+r),i.setHours(n,o,0,0);let a=0===i.getDay()?7:i.getDay();if(i>t&&e.days.includes(a))return i}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 n=e=>[...e].sort((e,t)=>e-t).join();return"daily"===t.kind&&e.time===t.time&&n(e.days)===n(t.days)},"scheduleText",0,function(e){if("once"===e.kind){let[t,n]=e.at.split(" "),[,o,r]=t.split("-").map(Number);return`Once \xb7 ${p[o-1]} ${r} ${n}`}if("every"===e.kind)return 1===e.hours?"Every hour":`Every ${e.hours} hours`;let{days:t,time:n}=e;if(7===t.length)return`Daily ${n}`;if(1===t.length)return`${d[t[0]-1]} ${n}`;let o=t.every((e,n)=>0===n||e===t[n-1]+1)?`${d[t[0]-1]}–${d[t.at(-1)-1]}`:t.map(e=>d[e-1]).join(" ");return`Daily ${n} \xb7 ${o}`}])},343229,e=>e.a(async(t,n)=>{try{var o=e.i(666680),r=e.i(750227),i=e.i(333925),a=e.i(871096),s=e.i(938281),l=e.i(64774),u=e.i(202837),c=t([u]);[u]=c.then?(await c)():c;let p=(0,r.join)(i.APP_DIR,i.PATHS.skills.default),h=(0,r.join)(i.APP_DIR,i.PATHS.skills.seeds),m=(0,r.join)(i.DATA_DIR,i.PATHS.skills.custom),g=async(e,t)=>{let n,o=t?(n=t.trim().toLowerCase(),/^[a-z0-9][a-z0-9_-]*$/.test(n)?(0,r.join)(h,n):null):null;return d(e,t?[p,...o?[o]:[],(0,r.join)(a.WORKSPACE,(0,a.botFolder)(t),i.PATHS.skills.own),m]:[p,m],await (0,u.readSkillsOff)(),await (0,u.readRetired)())};async function d(e,t,n=new Set,r=new Map){let i=[],a=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,p;if(!d.isDirectory())continue;let h=`${c}/${d.name}`,m=`${h}/SKILL.md`;try{t=await e.readFile(m,"utf-8")}catch{continue}try{p=(0,u.parseFrontmatter)(t)}catch(e){s.logger.warn(`skill ${h}: SKILL.md front matter did not load — ${(0,l.errorToString)(e)}`);continue}if(!(0,u.runsHere)(p))continue;let g=r.get(p.name);!(g?.has((0,o.createHash)("sha256").update(t,"utf8").digest("hex"))||a.has(p.name))&&(a.add(p.name),(0,u.isSkillOff)(p,n)||i.push({name:p.name,description:p.description,path:h}))}}return i}e.s(["loadSkills",0,g]),n()}catch(e){n(e)}},!1),202837,e=>e.a(async(t,n)=>{try{let f;e.i(666680);var o=e.i(912714),r=e.i(750227),i=e.i(891906),a=e.i(333925),s=e.i(799791),l=e.i(724185),u=e.i(546686);e.i(871096);var c=e.i(938281),d=e.i(212389),p=e.i(64774),h=t([s,l]);function m(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!t)return{head:null,body:e.trim(),rest:e,fence:""};let n=e.slice(t[0].length);return{head:t[1]??null,body:n.trim(),rest:n,fence:t[0]}}async function g(){try{return(0,u.parseSkillsOff)(await (0,l.readConfig)(u.SKILLS_OFF_KEY))}catch(e){return c.logger.warn(`skills switched off could not be read — ${(0,p.errorToString)(e)}`),new Set}}[s,l]=h.then?(await h)():h,e.s(["isSkillOff",0,(e,t)=>!0===e.disabled||t.has(e.name.toLowerCase()),"parseFrontmatter",0,function(e){let t,{head:n}=m(e);n||(0,d.publicError)("SKILL.md needs a YAML block with name and description");try{t=(0,i.parse)(n)}catch{(0,d.publicError)("SKILL.md frontmatter is not valid YAML")}let o=u.SkillFrontmatterSchema.safeParse(t);return o.success||(0,d.publicError)(`SKILL.md frontmatter: ${o.error.issues[0]?.message??"invalid"}`),o.data},"readRetired",0,()=>f??=(0,o.readFile)((0,r.join)(a.APP_DIR,a.PATHS.skills.seeds,"retired.json"),"utf8").then(e=>{let{sha256:t}=JSON.parse(e);return new Map(Object.entries(t).map(([e,t])=>[e,new Set(t)]))}).catch(()=>new Map),"readSkillsOff",0,g,"runsHere",0,e=>{let t=function({metadata:e,platforms:t}){let n=e?.platforms;return"string"==typeof n?n.split(/[\s,]+/).filter(Boolean):t}(e);return!t?.length||t.includes(process.platform)},"splitFrontmatter",0,m]),n()}catch(e){n(e)}},!1),546686,e=>{"use strict";var t=e.i(853205);t.z.union([t.z.enum(["custom","default"]),t.z.templateLiteral(["kit:",t.z.string().regex(/^[\p{L}\p{N}_-]+$/u)]),t.z.templateLiteral(["own:",t.z.string().regex(/^[\p{L}\p{N}_-]+$/u)])]);let n=t.z.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long").regex(/^[a-z0-9][a-z0-9_-]*$/i,"Use letters, numbers, dashes and underscores only"),o=t.z.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long"),r=t.z.object({name:o,description:t.z.string().trim().min(1,"Description is required"),metadata:t.z.record(t.z.string(),t.z.unknown()).optional(),disabled:t.z.boolean().optional(),platforms:t.z.array(t.z.string()).optional()});r.extend({name:n,content:t.z.string().trim().min(1,"Content is required")}),e.s(["SKILLS_OFF_KEY",0,"SKILLS_OFF","SkillFrontmatterSchema",0,r,"firstSentence",0,e=>e.trim().split(/(?<=[.。])\s|\n/)[0].trim(),"parseSkillsOff",0,function(e){if(!e)return new Set;try{let t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e).map(e=>e.trim().toLowerCase()):[])}catch{return new Set}}])},293822,e=>{"use strict";var t=e.i(51083);let n={[t.TOOL_NAMES.memory_recall]:"Checking your notes",[t.TOOL_NAMES.memory_create]:"Starting a note",[t.TOOL_NAMES.memory_remember]:"Noting that down",[t.TOOL_NAMES.memory_describe]:"Renaming a note",[t.TOOL_NAMES.memory_forget]:"Forgetting that",[t.TOOL_NAMES.bash]:"Doing it on this computer",[t.TOOL_NAMES.web_search]:"Searching the web",[t.TOOL_NAMES.load_skill]:"Reading how to do this",[t.TOOL_NAMES.look_at]:"Looking at the picture",[t.TOOL_NAMES.make_deck]:"Making the deck",[t.TOOL_NAMES.end_call]:"Ending the call",[t.TOOL_NAMES.look_at_shared]:"Looking at what you show",[t.TOOL_NAMES.routine]:"Checking your routines"};function o(e,t=28){let n=e.trim().replace(/\s+/g," ");if(n.length<=t)return n;let r=n.slice(0,t),i=r.lastIndexOf(" ");return`${(i>t/2?r.slice(0,i):r).trimEnd()}…`}let r=(e,t)=>"string"==typeof e[t]?e[t].trim():"";t.TOOL_NAMES.thread_tell,t.TOOL_NAMES.thread_answer,t.TOOL_NAMES.thread_status,t.TOOL_NAMES.thread_show,t.TOOL_NAMES.thread_cancel,t.TOOL_NAMES.thread_seen,e.s(["searchOf",0,function(e,n){if(e!==t.TOOL_NAMES.web_search)return null;try{var o;let e=JSON.parse(n);return{query:"string"==typeof e.query?e.query:null,sources:(o=e.sources,Array.isArray(o)?o.flatMap(e=>e&&"object"==typeof e&&"string"==typeof e.url?[e]:[]):[])}}catch{return null}},"startedLabel",0,function(e,n){if(e!==t.TOOL_NAMES.thread_start)return null;try{let e=JSON.parse(n);return"string"==typeof e.label?e.label:null}catch{return null}},"toolLine",0,function(e,i,a=null){let s;if(e===t.TOOL_NAMES.tool_search||e===t.TOOL_NAMES.tool_call)return"Reaching a connected service";let l=function(e){if(!e)return null;try{let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return null}(i);return(l&&function(e,n,i){if(e===t.TOOL_NAMES.memory_remember||e===t.TOOL_NAMES.memory_create){let i=r(n,"path"),a=function(e){if(!Array.isArray(e.facts))return null;let t=e.facts.map(e=>e&&"object"==typeof e&&"string"==typeof e.text?e.text.trim():"").filter(Boolean);return t.length?{text:t[0],more:t.length-1}:null}(n),s=e===t.TOOL_NAMES.memory_create?"Starting":"Noting";if(!i)return null;if(!a)return`${s} ${i}`;let l=a.more>0?` (+${a.more})`:"";return`${s} ${i}: ${o(a.text)}${l}`}if(e===t.TOOL_NAMES.memory_recall){let e=r(n,"path");return e?`Checking \xb7 ${e}`:null}if(e===t.TOOL_NAMES.memory_describe){let e=r(n,"path");return e?`Renaming \xb7 ${e}`:null}if(e===t.TOOL_NAMES.bash){let e=r(n,"description")||r(n,"command");return e?`On this computer \xb7 ${o(e,44)}`:null}if(e===t.TOOL_NAMES.load_skill){let e=r(n,"name");return e?`Reading the ${e} skill`:null}if(e===t.TOOL_NAMES.look_at){let e=r(n,"path");return e?`Looking at ${e.split("/").filter(Boolean).at(-1)??""}`:null}if(e===t.TOOL_NAMES.make_deck){let e=r(n,"title");return e?`Making the deck \xb7 ${o(e,44)}`:null}if(e===t.TOOL_NAMES.thread_start){let e=r(n,"bot");return e?`Handing this to ${e}`:"Handing this over"}if(e===t.TOOL_NAMES.web_search){let e=r(n,"query");return e?`Searching \xb7 ${e}`:null}if(e===t.TOOL_NAMES.routine){if("create"===n.action){let e=[r(n,"bot"),function(e){if("string"==typeof e.at&&e.at.length>=16){let[t,n]=e.at.split(" "),[o,r,i]=t.split("-").map(Number),a=new Date(o,r-1,i);if(a.toDateString()===new Date().toDateString())return`once at ${n}`;let s=a.toLocaleDateString("en-US",{month:"short",day:"numeric"});return`once, ${s} ${n}`}return"string"==typeof e.time&&e.time?`daily at ${e.time}`:"number"==typeof e.everyHours?`every ${e.everyHours} hours`:null}(n)].filter(Boolean).join(", ");return e?`Setting a routine \xb7 ${e}`:"Setting a routine"}return"change"===n.action?"Changing a routine":"delete"===n.action?"Deleting a routine":null}let a=r(n,"thread");return e===t.TOOL_NAMES.thread_tell?i?`Telling ${i}`:"Passing that on":e===t.TOOL_NAMES.thread_answer?i?`Answering ${i}`:"Answering that":e===t.TOOL_NAMES.thread_cancel?a?`Stopping ${a}`:"Stopping that":e===t.TOOL_NAMES.thread_seen?a?`Marking ${a} as read`:"Marking that as read":e===t.TOOL_NAMES.thread_show?a?`Opening ${a}`:"Opening that":e===t.TOOL_NAMES.thread_status?a&&"all"!==a.toLowerCase()?`Checking on ${a}`:"Checking on the work":null}(e,l,a))??n[e]??((s=e.indexOf("__"))<=0?null:`Reaching ${e.slice(0,s).replace(/[-_]/g," ")}`)}])},528803,e=>{"use strict";var t=e.i(874533),n=e.i(333925);let o=`on run argv
|
|
144
|
+
${t}`;async function k(e){let t=await (0,f.findJobBot)(e.bot);(!t||t.disabled)&&(0,h.publicError)("Choose an enabled bot.");let{from:n,routine:o,...r}={...e,bot:t.name},i=(0,s.buildThreadOpening)({bot:r.bot,request:r.request,from:n,routine:o}),a=await (0,w.insertThread)({...r,routineId:o?.id??null,startedBy:o?null:n,opening:i});return await S(a.id),a.id}async function x(e,t,n="user",o,r){let i=null;return await L(e,async()=>{let a=await (0,w.findThread)(e);if(a||(0,h.publicError)("No such thread."),o){let t=(await (0,_.listRoomWork)(e)).find(e=>e.bot.toLowerCase()===o.trim().toLowerCase());t&&t.bot!==z.ROOM_THURSDAY||(0,h.publicError)("Choose a participant in this thread."),o=t.bot}t.trim()===b.THREAD_CONTINUE&&(0,b.isAppStop)(a.pending)?(await (0,_.resumeRoom)(e),(await (0,_.listRoomWork)(e)).some(e=>"queued"===e.state)||(i=await (0,_.tellRoom)(e,"Continue from the saved conversation.","user"===n?z.ROOM_USER:z.ROOM_THURSDAY,o,void 0,!1))):i=await (0,_.tellRoom)(e,t,"user"===n?z.ROOM_USER:z.ROOM_THURSDAY,o,r)}),await S(e),i}async function S(e){await L(e,async()=>{for(let t=0;t<2;t++){let t;for(;t=await (0,_.claimRoomWork)(e);)!function(e){let t,n=new AbortController,o=new Promise(e=>{t=e});N.set(e.id,{threadId:e.threadId,stop:n,done:o}),T(e,n.signal).catch(t=>p.logger.error(`thread ${e.threadId}: participant`,t)).finally(()=>{N.delete(e.id),t(),S(e.threadId).catch(t=>p.logger.error(`thread ${e.threadId}: scheduling`,t))})}(t);await (0,_.settleRoom)(e)}})}async function T(e,t){let n=await I(e,t);if(n?.failure?.retry&&!t.aborted&&(await (0,_.noteRoomBreak)(e,n.failure.message),await (0,o.setTimeout)(i.BOT_RUN.retryMs,void 0,{signal:t}).catch(()=>{}),t.aborted||(n=await I(e,t,!1))),!n||t.aborted)return;let a=n.failure?.message,s=n.ending;if(a||!s||s.stopped){let t=a??"The turn was interrupted. Continue from the saved conversation.";L(e.threadId,async()=>{let o=(await (0,_.listRoomWork)(e.threadId)).find(t=>t.id===e.id);if(o?.state!=="running"||o.generation!==e.generation)return;let r=O(e.threadId);await (0,_.pauseRoom)(e.threadId,t,n.failure?.refused),await r}).catch(t=>p.logger.error(`thread ${e.threadId}: pausing`,t));return}await (0,_.finishRoomWork)(e,s.text);let h=await (0,w.findThread)(e.threadId);if(h?.status==="done"){let e=(0,g.plainText)(h.outcome??"").slice(0,i.FINISHED_NOTICE.words);r.presence.watching||await (0,l.isAnyCallLive)()||(0,d.desktopNotify)(h.label,e);let t=await (0,c.filesOnDisk)((0,u.pathsIn)(h.outcome??""),null);r.appEvents.emit({type:"finished",threadId:h.id,label:h.label,bot:h.bot,words:e,paths:(0,u.leadFirst)(t)})}}async function I(e,t,n=!0){let o=new q(e,t),r=null,i=null;try{let a=await (0,w.findThread)(e.threadId);if(!a)return null;if((await (0,_.listParticipantTranscript)(e.threadId,e.bot)).length||await (0,_.joinRoom)(e,t=>(0,s.buildJoinOpening)({bot:e.bot,coordinator:a.bot,job:t,request:a.request})),await (0,_.consumeRoomInbox)(e),n&&(0,z.isCoordinatorSeat)(e.bot,a.bot,e.caller)){let t=await (0,_.roomBoard)(e);t&&await (0,_.appendRoomMessage)(e.threadId,{bot:e.bot,parent:e.id,role:"user",content:t,hidden:!0})}let l=await (0,_.listParticipantTranscript)(e.threadId,e.bot);await (0,y.runBot)({bot:e.bot,messages:(0,y.resumeTranscript)(l,await (0,_.listRoomReceipts)(e.threadId,e.bot,l))},{signal:t,threadId:e.threadId,parent:e.id,caller:e.caller,owner:a.bot,contextBudget:await (0,_.roomContextBudget)(e.threadId,e.bot),compactNow:()=>P.delete(U(e.threadId,e.bot)),session:(0,c.botBrowserSession)(e.threadId,e.bot),notes:()=>(0,_.consumeRoomInbox)(e),send:async n=>{t.throwIfAborted();let o=n.to.trim();if(o.toLowerCase()===z.ROOM_THURSDAY.toLowerCase())o=z.ROOM_THURSDAY;else{let e=await (0,f.findJobBot)(o);(!e||e.disabled)&&(0,h.publicError)(`No enabled bot named "${o}".`),o=e.name}let r=await (0,_.sendRoomMessage)(e,{...n,to:o});return S(e.threadId).catch(e=>p.logger.error("room message scheduling",e)),r},emit:async n=>{(!t.aborted||"tool-result"===n.type)&&(await o.on(n),"step"===n.type&&await (0,w.addThreadUsage)(e.threadId,n.usage,e.bot===a.bot?{tokens:n.usage.input,budget:n.budget}:null),"compact"===n.type&&await (0,w.addThreadUsage)(e.threadId,n.usage),"turn-end"===n.type&&(r=n),"error"===n.type&&(i={message:n.message,retry:n.retry,refused:n.refused},n.budget&&await (0,_.lowerRoomContextBudget)(e,n.budget)))}})}catch(n){t.aborted||(p.logger.error(`thread ${e.threadId}: ${e.bot} broke`,n),i={message:(0,a.modelErrorToString)(n),retry:!(0,h.isPublicError)(n)&&!(0,a.isProviderRefusal)(n)})}return{ending:r,failure:i}}class q{work;signal;lane;assistant;tool;parts;calls;results;constructor(e,t){this.work=e,this.signal=t,this.lane=(0,g.PromiseChain)(),this.assistant=null,this.tool=null,this.parts={assistant:[],tool:[]},this.calls=new Set,this.results=new Set}async write(e,t,n=!1){let o={bot:this.work.bot,parent:this.work.id,role:t.role,content:t.content,compact:n,note:n};return null===e?(0,_.appendRoomMessage)(this.work.threadId,o):(await (0,w.upsertMessage)(this.work.threadId,e,o),e)}on(e){return this.lane(async()=>{if(!this.signal.aborted||"tool-result"===e.type)if("text"===e.type)this.parts.assistant.push({type:"text",text:e.text}),this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant});else if("tool"===e.type){if(this.calls.has(e.id)){let t=this.parts.assistant.find(t=>"tool-call"===t.type&&t.toolCallId===e.id);t&&"tool-call"===t.type&&e.providerOptions&&(t.providerOptions=e.providerOptions,this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant}));return}this.calls.add(e.id),this.parts.assistant.push({type:"tool-call",toolCallId:e.id,toolName:e.name,input:e.input,...e.providerExecuted?{providerExecuted:!0}:{},...e.providerOptions?{providerOptions:e.providerOptions}:{}}),this.assistant=await this.write(this.assistant,{role:"assistant",content:this.parts.assistant})}else if("tool-result"===e.type){if(this.results.has(e.id))return;this.results.add(e.id),this.parts.tool.push({type:"tool-result",toolCallId:e.id,toolName:e.name,output:e.error?{type:"error-text",value:String(e.output)}:"string"==typeof e.output?{type:"text",value:e.output}:{type:"json",value:e.output}}),this.tool=await this.write(this.tool,{role:"tool",content:this.parts.tool})}else if("step"===e.type){let t=[this.assistant,this.tool];for(let[n,o]of e.messages.entries())await this.write(t[n]??null,o);let n=t.slice(e.messages.length).filter(e=>null!==e);n.length&&await (0,w.deleteMessages)(this.work.threadId,n),this.assistant=this.tool=null,this.parts={assistant:[],tool:[]}}else"compact"===e.type&&await this.write(null,{role:"user",content:e.text},!0)})}}async function O(e){let t=[...N.values()].filter(t=>t.threadId===e);for(let e of t)e.stop.abort();await Promise.all(t.map(e=>e.done))}async function E(e){await L(e,async()=>{let t=await (0,w.findThread)(e);t||(0,h.publicError)("No such thread."),t.endedAt&&(0,h.publicError)("That thread has already ended."),await (0,_.cancelRoom)(e),await (0,w.updateThread)(e,{status:"cancelled",outcome:null,pending:null,seen:!0,endedAt:new Date}),await O(e),await (0,c.closeJobShell)(e)})}async function C(e){return L(e,()=>A(e))}async function A(e){let t=await (0,w.findThread)(e);await (0,_.cancelRoom)(e),await O(e),await (0,c.removeJobBrowsers)(e);let n=await (0,w.deleteThread)(e);return n&&t&&await (0,c.removeJobScratch)(e,t.label),n}async function j(e){let t=e?.getTime(),n=e=>void 0===t||(e.endedAt??e.updatedAt).getTime()<t,o=0;for(let e of(await (0,w.listThreadFolders)()))("done"===e.status||"cancelled"===e.status)&&n(e)&&await L(e.id,async()=>{let t=await (0,w.findThread)(e.id);t?.status!=="done"&&t?.status!=="cancelled"||n(t)&&await A(e.id)&&(o+=1)});return o}async function R(){let e=Date.now()-i.WORKSPACE_KEEP.forMs,t=t=>("done"===t.status||"cancelled"===t.status)&&(t.endedAt??t.updatedAt).getTime()<e,n=new Set(await (0,c.listScratchFolders)()),o=[];for(let e of(await (0,w.listThreadFolders)())){let r=(0,c.jobScratch)(e.id,e.label);n.delete(r)&&t(e)&&await L(e.id,async()=>{let n=await (0,w.findThread)(e.id);n&&t(n)&&(await (0,c.closeHiddenBrowser)(e.id),await (0,c.removeJobScratch)(e.id,e.label),o.push(r))})}return o.push(...await (0,c.removeUnchangedFolders)([...n])),await (0,c.pruneJobFiles)(),o.length&&p.logger.info(`cleared ${o.length} old job folder(s): ${o.join(", ")}`),o}async function $(){for(let e of(await (0,w.listRunningThreadIds)()))await L(e,async()=>{[...N.values()].some(t=>t.threadId===e)||(await (0,w.findThread)(e))?.status==="running"&&await (0,_.pauseRoom)(e,"The server restarted. Resume from the saved conversation.")})}async function M(e){let t=await (0,w.listRunningThreadIds)();await Promise.all(t.map(t=>L(t,async()=>{(await (0,w.findThread)(t))?.status==="running"&&(await O(t),await (0,_.pauseRoom)(t,e))})))}e.s(["answerThread",0,x,"askCompact",0,function(e,t){P.add(U(e,t))},"cancelThread",0,E,"pauseThreads",0,M,"removeFinishedThreads",0,j,"removeThread",0,C,"startThread",0,k,"sweepJobFiles",0,R,"sweepThreads",0,$]),n()}catch(e){n(e)}},!1),539904,e=>e.a(async(t,n)=>{try{var o,r=e.i(753955),i=e.i(940655),a=e.i(333925),s=e.i(938281),l=e.i(64774),u=e.i(993195),c=e.i(950262),d=t([u]);[u]=d.then?(await d)():d;class p extends Error{serverName;authorizationUrl;constructor(e,t){super(`MCP server "${e}" requires authorization`),this.serverName=e,this.authorizationUrl=t,this.name="McpAuthRequiredError"}}class h{store;serverName;oauth;callbackUrl;clientName;lastAuthorizationUrl;constructor(e,t,n,o,r){this.store=e,this.serverName=t,this.oauth=n,this.callbackUrl=o,this.clientName=r}get redirectUrl(){return this.callbackUrl}get clientMetadata(){return{client_name:this.clientName,redirect_uris:[this.callbackUrl],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"client_secret_post"}}async persist(e){this.oauth={...this.oauth,...e},await this.store.saveOAuth(this.serverName,this.oauth)}clientInformation(){return this.oauth.clientInformation}async saveClientInformation(e){await this.persist({clientInformation:e})}tokens(){return this.oauth.tokens}async saveTokens(e){await this.persist({tokens:e})}authorizationServerInformation(){return this.oauth.authorizationServer}async saveAuthorizationServerInformation(e){await this.persist({authorizationServer:e})}codeVerifier(){if(!this.oauth.codeVerifier)throw Error("No code verifier saved");return this.oauth.codeVerifier}async saveCodeVerifier(e){await this.persist({codeVerifier:e})}state(){return crypto.randomUUID()}async saveState(e){await this.persist({state:e})}storedState(){return this.oauth.state}redirectToAuthorization(e){this.lastAuthorizationUrl=e}async invalidateCredentials(e){let t={...this.oauth};("all"===e||"client"===e)&&(t.clientInformation=void 0),("all"===e||"tokens"===e)&&(t.tokens=void 0),("all"===e||"verifier"===e)&&(t.codeVerifier=void 0),this.oauth=t,await this.store.saveOAuth(this.serverName,t)}}let m=globalThis;m.__thursdayMcpManager&&m.__thursdayMcpManager.dispose(),o={callbackUrl:new URL("/api/mcp/oauth/callback",a.APP_URL).href,clientName:a.APP_NAME},m.__thursdayMcpManager=new class e{store;sessions;connecting;callbackUrl;clientName;constructor(e,t){this.store=e,this.sessions=new Map,this.connecting=new Map,this.callbackUrl=t.callbackUrl,this.clientName=t.clientName??a.APP_NAME}async connect(e){let t=this.connecting.get(e);if(t)return t;let n=this.doConnect(e).finally(()=>this.connecting.delete(e));return this.connecting.set(e,n),n}async callTool(e,t,n,o){let i=await this.ensureClient(e);try{let r=await i.callTool({name:t,arguments:n,options:o?{signal:o}:void 0});return this.touch(e),r}catch(t){if(t instanceof r.UnauthorizedError)throw await this.closeSession(e),new p(e);throw t}}async finishAuthorization(e){let t=e.get("state"),n=e.get("code");if(!t||!n)throw Error("OAuth callback is missing code or state");let o=await this.store.findByOAuthState(t);if(!o||!(0,c.isRemoteConfig)(o.config))throw Error("No server is waiting for this authorization");let i=this.providerFor(o),a=await (0,r.auth)(i,{serverUrl:o.config.url,authorizationCode:n,callbackState:t});if("AUTHORIZED"!==a)throw Error(`Token exchange ended in "${a}"`);return await i.invalidateCredentials("verifier"),await this.connect(o.name),o.name}async disconnect(e){await this.closeSession(e)}async dispose(){await Promise.all([...this.sessions.keys()].map(e=>this.closeSession(e)))}async doConnect(e){await this.closeSession(e);let t=await this.store.load(e);if(!t)throw Error(`Unknown MCP server "${e}"`);let n={};try{let o=await this.openClient(t,n),r=(await o.listTools()).tools.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema,outputSchema:e.outputSchema}));return this.adopt(e,o),await this.store.saveConnectionResult(e,{toolInfo:r,lastError:null}),s.logger.info(`mcp "${e}" connected — ${r.length} tools`),{status:"connected",tools:r}}catch(d){var o,i;let a;if(d instanceof r.UnauthorizedError||d?.cause instanceof r.UnauthorizedError){let t=n.href;if(t)return await this.store.saveConnectionResult(e,{toolInfo:[],lastError:"Authorization required — finish sign-in in the opened tab"}),{status:"auth_required",authorizationUrl:t}}let u=(o=d,i=t,a=(0,l.errorToString)(o),(0,c.isRemoteConfig)(i.config)&&!i.oauth?.clientInformation&&/Invalid OAuth error response/.test(a)?`This server does not let an app register itself for sign-in, so it cannot be connected here. It answered: ${a}`:a);throw await this.store.saveConnectionResult(e,{toolInfo:[],lastError:u}),s.logger.warn(`mcp "${e}" failed — ${u}`),Error(u,{cause:d})}}async openClient(e,t={}){if((0,c.isRemoteConfig)(e.config)){let n=this.providerFor(e);try{return await (0,r.createMCPClient)({name:this.clientName,transport:{type:"http",url:e.config.url,headers:e.config.headers,authProvider:n,redirect:"follow"}})}finally{t.href=n.lastAuthorizationUrl?.href}}return(0,r.createMCPClient)({name:this.clientName,transport:new i.Experimental_StdioMCPTransport({command:e.config.command,args:e.config.args,env:e.config.env})})}providerFor(e){return new h(this.store,e.name,e.oauth??{},this.callbackUrl,this.clientName)}async ensureClient(e){let t=this.sessions.get(e);if(t)return t.client;let n=await this.connect(e);if("auth_required"===n.status)throw new p(e,n.authorizationUrl);let o=this.sessions.get(e);if(!o)throw Error(`Session for "${e}" vanished mid-connect`);return o.client}adopt(e,t){this.sessions.set(e,{client:t,idleTimer:this.armIdleTimer(e)})}touch(e){let t=this.sessions.get(e);t&&(clearTimeout(t.idleTimer),t.idleTimer=this.armIdleTimer(e))}armIdleTimer(e){let t=setTimeout(()=>{this.closeSession(e)},a.MCP_IDLE_MS);return t.unref?.(),t}async closeSession(e){let t=this.sessions.get(e);t&&(this.sessions.delete(e),clearTimeout(t.idleTimer),await t.client.close().catch(()=>{}))}}({load:e=>(0,u.findServer)(e),saveOAuth:(e,t)=>(0,u.saveOAuthData)(e,t),saveConnectionResult:(e,t)=>null===t.lastError?(0,u.syncServerTools)(e,t.toolInfo):(0,u.saveConnectionError)(e,t.lastError),findByOAuthState:e=>(0,u.findServerByOAuthState)(e)},o);let g=m.__thursdayMcpManager;e.s(["McpAuthRequiredError",0,p,"mcpManager",0,g]),n()}catch(e){n(e)}},!1),519645,e=>e.a(async(t,n)=>{try{var o=e.i(336763),r=e.i(157406),i=e.i(396918),a=e.i(232347),s=e.i(333925),l=e.i(876393),u=e.i(220376),c=e.i(799791),d=e.i(212389),p=e.i(275841),h=t([l,c]);[l,c]=h.then?(await h)():h;let I=()=>a.appEvents.emit({type:"routines"});async function m(e,t){return l.database.select({id:u.threadTable.id,status:u.threadTable.status,outcome:u.threadTable.outcome,updatedAt:u.threadTable.updatedAt}).from(u.threadTable).where((0,o.eq)(u.threadTable.routineId,e)).orderBy((0,i.desc)(u.threadTable.createdAt)).limit(t)}let O=async e=>{let{createdAt:t,...n}=e;return{...n,runs:await m(e.id,s.ROUTINE.runsShown)}};async function g(){let e=await l.database.select().from(u.routineTable).orderBy(u.routineTable.createdAt);return Promise.all(e.map(O))}async function f(e){let[t]=await l.database.select().from(u.routineTable).where((0,o.eq)(u.routineTable.id,e));return t?O(t):null}async function y(e){let t=await f(e.trim());if(t)return t;let n=e.trim().toLowerCase(),o=(await g()).filter(e=>e.label.toLowerCase()===n);return 1===o.length?o[0]:null}async function b(e){let t=await (0,c.findJobBot)(e);return(!t||t.disabled)&&(0,d.publicError)("Choose an enabled bot."),t.name}function _(e,t){t&&"once"===e.kind&&(0,p.momentOf)(e.at)<=new Date&&(0,d.publicError)("That time has passed. Pick a later one.")}async function z(e){let[{total:t}]=await l.database.select({total:(0,r.count)()}).from(u.routineTable);t>=s.ROUTINE.max&&(0,d.publicError)(`There are already ${s.ROUTINE.max} routines. Delete one to make another.`),_(e.schedule,!0);let[n]=await l.database.insert(u.routineTable).values({id:crypto.randomUUID(),...e,bot:await b(e.bot),nextRunAt:(0,p.nextRun)(e.schedule,new Date)}).returning();return I(),O(n)}async function w(e,t){let[n]=await l.database.select().from(u.routineTable).where((0,o.eq)(u.routineTable.id,e));if(!n)return null;let r=t.schedule??n.schedule,i=!!(t.schedule&&!(0,p.sameSchedule)(t.schedule,n.schedule))||t.enabled&&!n.enabled;i&&_(r,t.enabled??n.enabled);let[a]=await l.database.update(u.routineTable).set({...t,...t.bot?{bot:await b(t.bot)}:{},...i?{nextRunAt:(0,p.nextRun)(r,new Date)}:{}}).where((0,o.eq)(u.routineTable.id,e)).returning();return I(),O(a)}async function v(e){let t=await l.database.delete(u.routineTable).where((0,o.eq)(u.routineTable.id,e)).returning({id:u.routineTable.id});return t.length&&I(),t.length>0}async function k(e){return l.database.select().from(u.routineTable).where((0,o.and)((0,o.eq)(u.routineTable.enabled,!0),(0,o.lte)(u.routineTable.nextRunAt,e))).orderBy(u.routineTable.nextRunAt)}async function x(e,t){let n=await l.database.update(u.routineTable).set("once"===e.schedule.kind?{enabled:!1}:{nextRunAt:(0,p.nextRun)(e.schedule,t)}).where((0,o.and)((0,o.eq)(u.routineTable.id,e.id),(0,o.eq)(u.routineTable.enabled,!0),(0,o.eq)(u.routineTable.nextRunAt,e.nextRunAt))).returning({id:u.routineTable.id});return n.length&&I(),n.length>0}async function S(e){return(await m(e,1))[0]??null}async function T(e){return(await l.database.select({id:u.threadTable.id}).from(u.threadTable).where((0,o.and)((0,o.eq)(u.threadTable.routineId,e),(0,o.eq)(u.threadTable.seen,!1),(0,o.inArray)(u.threadTable.status,["done","cancelled"])))).map(e=>e.id)}e.s(["claimRoutine",0,x,"createRoutine",0,z,"deleteRoutine",0,v,"latestRun",0,S,"listDueRoutines",0,k,"listRoutines",0,g,"listUnseenRunIds",0,T,"resolveRoutine",0,y,"updateRoutine",0,w]),n()}catch(e){n(e)}},!1),275841,e=>{"use strict";var t=e.i(517435),n=e.i(333925),o=e.i(900533);let r=t.default.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function i(e){let[t,n]=e.split(" "),[o,r,i]=t.split("-").map(Number),[a,s]=n.split(":").map(Number);return new Date(o,r-1,i,a,s)}let a=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,s=t.default.string().regex(a,'A moment is "YYYY-MM-DD HH:MM"').refine(e=>{if(!a.test(e))return!0;let t=i(e);return t.getMonth()===Number(e.slice(5,7))-1&&t.getDate()===Number(e.slice(8,10))},"There is no such day"),l=t.default.discriminatedUnion("kind",[t.default.object({kind:t.default.literal("once"),at:s}),t.default.object({kind:t.default.literal("daily"),time:r,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(n.ROUTINE.minHours,`No more often than every ${n.ROUTINE.minHours}h`).max(168)})]),u=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:l}),c=t.default.object({id:t.default.string(),status:t.default.enum(["running","waiting","done","cancelled"]),outcome:t.default.string().nullable(),updatedAt:o.DateLikeSchema});u.extend({id:t.default.string(),enabled:t.default.boolean(),nextRunAt:o.DateLikeSchema,runs:t.default.array(c)});let d=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.s(["RoutineInputSchema",0,u,"RoutineScheduleSchema",0,l,"momentOf",0,i,"nextRun",0,function(e,t){if("once"===e.kind)return i(e.at);if("every"===e.kind)return new Date(t.getTime()+36e5*e.hours);let[n,o]=e.time.split(":").map(Number);for(let r=0;r<=7;r++){let i=new Date(t);i.setDate(i.getDate()+r),i.setHours(n,o,0,0);let a=0===i.getDay()?7:i.getDay();if(i>t&&e.days.includes(a))return i}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 n=e=>[...e].sort((e,t)=>e-t).join();return"daily"===t.kind&&e.time===t.time&&n(e.days)===n(t.days)},"scheduleText",0,function(e){if("once"===e.kind){let[t,n]=e.at.split(" "),[,o,r]=t.split("-").map(Number);return`Once \xb7 ${p[o-1]} ${r} ${n}`}if("every"===e.kind)return 1===e.hours?"Every hour":`Every ${e.hours} hours`;let{days:t,time:n}=e;if(7===t.length)return`Daily ${n}`;if(1===t.length)return`${d[t[0]-1]} ${n}`;let o=t.every((e,n)=>0===n||e===t[n-1]+1)?`${d[t[0]-1]}–${d[t.at(-1)-1]}`:t.map(e=>d[e-1]).join(" ");return`Daily ${n} \xb7 ${o}`}])},397140,e=>{"use strict";var t=e.i(333925);e.s(["seedKitName",0,e=>{let n=e.trim().toLowerCase();return Object.hasOwn(t.SEED_KITS_RENAMED,n)?t.SEED_KITS_RENAMED[n]:n}])},343229,e=>e.a(async(t,n)=>{try{var o=e.i(666680),r=e.i(750227),i=e.i(333925),a=e.i(871096),s=e.i(938281),l=e.i(64774),u=e.i(397140),c=e.i(202837),d=t([c]);[c]=d.then?(await d)():d;let h=(0,r.join)(i.APP_DIR,i.PATHS.skills.default),m=(0,r.join)(i.APP_DIR,i.PATHS.skills.seeds),g=(0,r.join)(i.DATA_DIR,i.PATHS.skills.custom),f=async(e,t)=>{let n,o=t?(n=(0,u.seedKitName)(t),/^[a-z0-9][a-z0-9_-]*$/.test(n)?(0,r.join)(m,n):null):null;return p(e,t?[h,...o?[o]:[],(0,r.join)(a.WORKSPACE,(0,a.botFolder)(t),i.PATHS.skills.own),g]:[h,g],await (0,c.readSkillsOff)(),await (0,c.readRetired)())};async function p(e,t,n=new Set,r=new Map){let i=[],a=new Set;for(let u of t){let t;try{t=await e.readdir(u,{withFileTypes:!0})}catch{continue}for(let d of t){let t,p;if(!d.isDirectory())continue;let h=`${u}/${d.name}`,m=`${h}/SKILL.md`;try{t=await e.readFile(m,"utf-8")}catch{continue}try{p=(0,c.parseFrontmatter)(t)}catch(e){s.logger.warn(`skill ${h}: SKILL.md front matter did not load — ${(0,l.errorToString)(e)}`);continue}if(!(0,c.runsHere)(p))continue;let g=r.get(p.name);!(g?.has((0,o.createHash)("sha256").update(t,"utf8").digest("hex"))||a.has(p.name))&&(a.add(p.name),(0,c.isSkillOff)(p,n)||i.push({name:p.name,description:p.description,path:h}))}}return i}e.s(["loadSkills",0,f]),n()}catch(e){n(e)}},!1),202837,e=>e.a(async(t,n)=>{try{let f;e.i(666680);var o=e.i(912714),r=e.i(750227),i=e.i(891906),a=e.i(333925),s=e.i(799791),l=e.i(724185),u=e.i(546686);e.i(871096);var c=e.i(938281),d=e.i(212389),p=e.i(64774);e.i(397140);var h=t([s,l]);function m(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!t)return{head:null,body:e.trim(),rest:e,fence:""};let n=e.slice(t[0].length);return{head:t[1]??null,body:n.trim(),rest:n,fence:t[0]}}async function g(){try{return(0,u.parseSkillsOff)(await (0,l.readConfig)(u.SKILLS_OFF_KEY))}catch(e){return c.logger.warn(`skills switched off could not be read — ${(0,p.errorToString)(e)}`),new Set}}[s,l]=h.then?(await h)():h,e.s(["isSkillOff",0,(e,t)=>!0===e.disabled||t.has(e.name.toLowerCase()),"parseFrontmatter",0,function(e){let t,{head:n}=m(e);n||(0,d.publicError)("SKILL.md needs a YAML block with name and description");try{t=(0,i.parse)(n)}catch{(0,d.publicError)("SKILL.md frontmatter is not valid YAML")}let o=u.SkillFrontmatterSchema.safeParse(t);return o.success||(0,d.publicError)(`SKILL.md frontmatter: ${o.error.issues[0]?.message??"invalid"}`),o.data},"readRetired",0,()=>f??=(0,o.readFile)((0,r.join)(a.APP_DIR,a.PATHS.skills.seeds,"retired.json"),"utf8").then(e=>{let{sha256:t}=JSON.parse(e);return new Map(Object.entries(t).map(([e,t])=>[e,new Set(t)]))}).catch(()=>new Map),"readSkillsOff",0,g,"runsHere",0,e=>{let t=function({metadata:e,platforms:t}){let n=e?.platforms;return"string"==typeof n?n.split(/[\s,]+/).filter(Boolean):t}(e);return!t?.length||t.includes(process.platform)},"splitFrontmatter",0,m]),n()}catch(e){n(e)}},!1),546686,e=>{"use strict";var t=e.i(853205);t.z.union([t.z.enum(["custom","default"]),t.z.templateLiteral(["kit:",t.z.string().regex(/^[\p{L}\p{N}_-]+$/u)]),t.z.templateLiteral(["own:",t.z.string().regex(/^[\p{L}\p{N}_-]+$/u)])]);let n=t.z.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long").regex(/^[a-z0-9][a-z0-9_-]*$/i,"Use letters, numbers, dashes and underscores only"),o=t.z.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long"),r=t.z.object({name:o,description:t.z.string().trim().min(1,"Description is required"),metadata:t.z.record(t.z.string(),t.z.unknown()).optional(),disabled:t.z.boolean().optional(),platforms:t.z.array(t.z.string()).optional()});r.extend({name:n,content:t.z.string().trim().min(1,"Content is required")}),e.s(["SKILLS_OFF_KEY",0,"SKILLS_OFF","SkillFrontmatterSchema",0,r,"firstSentence",0,e=>e.trim().split(/(?<=[.。])\s|\n/)[0].trim(),"parseSkillsOff",0,function(e){if(!e)return new Set;try{let t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e).map(e=>e.trim().toLowerCase()):[])}catch{return new Set}}])},293822,e=>{"use strict";var t=e.i(51083);let n={[t.TOOL_NAMES.memory_recall]:"Checking your notes",[t.TOOL_NAMES.memory_create]:"Starting a note",[t.TOOL_NAMES.memory_remember]:"Noting that down",[t.TOOL_NAMES.memory_describe]:"Renaming a note",[t.TOOL_NAMES.memory_forget]:"Forgetting that",[t.TOOL_NAMES.bash]:"Doing it on this computer",[t.TOOL_NAMES.web_search]:"Searching the web",[t.TOOL_NAMES.load_skill]:"Reading how to do this",[t.TOOL_NAMES.look_at]:"Looking at the picture",[t.TOOL_NAMES.make_deck]:"Making the deck",[t.TOOL_NAMES.end_call]:"Ending the call",[t.TOOL_NAMES.routine]:"Checking your routines"};function o(e,t=28){let n=e.trim().replace(/\s+/g," ");if(n.length<=t)return n;let r=n.slice(0,t),i=r.lastIndexOf(" ");return`${(i>t/2?r.slice(0,i):r).trimEnd()}…`}let r=(e,t)=>"string"==typeof e[t]?e[t].trim():"";t.TOOL_NAMES.thread_tell,t.TOOL_NAMES.thread_answer,t.TOOL_NAMES.thread_status,t.TOOL_NAMES.thread_show,t.TOOL_NAMES.thread_cancel,t.TOOL_NAMES.thread_seen,e.s(["searchOf",0,function(e,n){if(e!==t.TOOL_NAMES.web_search)return null;try{var o;let e=JSON.parse(n);return{query:"string"==typeof e.query?e.query:null,sources:(o=e.sources,Array.isArray(o)?o.flatMap(e=>e&&"object"==typeof e&&"string"==typeof e.url?[e]:[]):[])}}catch{return null}},"startedLabel",0,function(e,n){if(e!==t.TOOL_NAMES.thread_start)return null;try{let e=JSON.parse(n);return"string"==typeof e.label?e.label:null}catch{return null}},"toolLine",0,function(e,i,a=null){let s;if(e===t.TOOL_NAMES.tool_search||e===t.TOOL_NAMES.tool_call)return"Reaching a connected service";let l=function(e){if(!e)return null;try{let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return null}(i);return(l&&function(e,n,i){if(e===t.TOOL_NAMES.memory_remember||e===t.TOOL_NAMES.memory_create){let i=r(n,"path"),a=function(e){if(!Array.isArray(e.facts))return null;let t=e.facts.map(e=>e&&"object"==typeof e&&"string"==typeof e.text?e.text.trim():"").filter(Boolean);return t.length?{text:t[0],more:t.length-1}:null}(n),s=e===t.TOOL_NAMES.memory_create?"Starting":"Noting";if(!i)return null;if(!a)return`${s} ${i}`;let l=a.more>0?` (+${a.more})`:"";return`${s} ${i}: ${o(a.text)}${l}`}if(e===t.TOOL_NAMES.memory_recall){let e=r(n,"path");return e?`Checking \xb7 ${e}`:null}if(e===t.TOOL_NAMES.memory_describe){let e=r(n,"path");return e?`Renaming \xb7 ${e}`:null}if(e===t.TOOL_NAMES.bash){let e=r(n,"description")||r(n,"command");return e?`On this computer \xb7 ${o(e,44)}`:null}if(e===t.TOOL_NAMES.load_skill){let e=r(n,"name");return e?`Reading the ${e} skill`:null}if(e===t.TOOL_NAMES.look_at){let e=r(n,"path");return e?`Looking at ${e.split("/").filter(Boolean).at(-1)??""}`:null}if(e===t.TOOL_NAMES.make_deck){let e=r(n,"title");return e?`Making the deck \xb7 ${o(e,44)}`:null}if(e===t.TOOL_NAMES.thread_start){let e=r(n,"bot");return e?`Handing this to ${e}`:"Handing this over"}if(e===t.TOOL_NAMES.web_search){let e=r(n,"query");return e?`Searching \xb7 ${e}`:null}if(e===t.TOOL_NAMES.routine){if("create"===n.action){let e=[r(n,"bot"),function(e){if("string"==typeof e.at&&e.at.length>=16){let[t,n]=e.at.split(" "),[o,r,i]=t.split("-").map(Number),a=new Date(o,r-1,i);if(a.toDateString()===new Date().toDateString())return`once at ${n}`;let s=a.toLocaleDateString("en-US",{month:"short",day:"numeric"});return`once, ${s} ${n}`}return"string"==typeof e.time&&e.time?`daily at ${e.time}`:"number"==typeof e.everyHours?`every ${e.everyHours} hours`:null}(n)].filter(Boolean).join(", ");return e?`Setting a routine \xb7 ${e}`:"Setting a routine"}return"change"===n.action?"Changing a routine":"delete"===n.action?"Deleting a routine":null}let a=r(n,"thread");return e===t.TOOL_NAMES.thread_tell?i?`Telling ${i}`:"Passing that on":e===t.TOOL_NAMES.thread_answer?i?`Answering ${i}`:"Answering that":e===t.TOOL_NAMES.thread_cancel?a?`Stopping ${a}`:"Stopping that":e===t.TOOL_NAMES.thread_seen?a?`Marking ${a} as read`:"Marking that as read":e===t.TOOL_NAMES.thread_show?a?`Opening ${a}`:"Opening that":e===t.TOOL_NAMES.thread_status?a&&"all"!==a.toLowerCase()?`Checking on ${a}`:"Checking on the work":null}(e,l,a))??n[e]??((s=e.indexOf("__"))<=0?null:`Reaching ${e.slice(0,s).replace(/[-_]/g," ")}`)}])},528803,e=>{"use strict";var t=e.i(874533),n=e.i(333925);let o=`on run argv
|
|
147
145
|
display notification (item 2 of argv) with title (item 1 of argv)
|
|
148
146
|
end run`,r=`
|
|
149
147
|
$ErrorActionPreference = 'Stop'
|
|
@@ -230,4 +228,4 @@ ${t}`:n}else{let e=r.commentBefore;r.commentBefore=e?`${n}
|
|
|
230
228
|
${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:d(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(o.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,n,o)=>{let r=c(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,o)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=l.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new a.YAMLParseError(c(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){this.errors.push(new a.YAMLParseError(c(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=u.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}
|
|
231
229
|
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new a.YAMLParseError(c(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new i.Document(void 0,e);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}}},476103,(e,t,n)=>{"use strict";var o=e.r(776306),r=e.r(194920),i=e.r(809070),a=e.r(788433);function s(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function l(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let o=e.props.slice(1),r=t.length;for(let t of("block-scalar-header"===e.props[0].type&&(r-=e.props[0].source.length),o))t.offset+=r;delete e.props,Object.assign(e,{type:n,source:t,end:o});break}case"block-map":case"block-seq":{let o={type:"newline",offset:e.offset+t.length,indent:e.indent,source:"\n"};delete e.items,Object.assign(e,{type:n,source:t,end:[o]});break}default:{let o="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(e=>"space"===e.type||"comment"===e.type||"newline"===e.type):[];for(let t of Object.keys(e))"type"!==t&&"offset"!==t&&delete e[t];Object.assign(e,{type:n,indent:o,source:t,end:r})}}}n.createScalarToken=function(e,t){let{implicitKey:n=!1,indent:o,inFlow:r=!1,offset:i=-1,type:l="PLAIN"}=t,u=a.stringifyString({type:l,value:e},{implicitKey:n,indent:o>0?" ".repeat(o):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:o,source:"\n"}];switch(u[0]){case"|":case">":{let e=u.indexOf("\n"),t=u.substring(0,e),n=u.substring(e+1)+"\n",r=[{type:"block-scalar-header",offset:i,indent:o,source:t}];return s(r,c)||r.push({type:"newline",offset:-1,indent:o,source:"\n"}),{type:"block-scalar",offset:i,indent:o,props:r,source:n}}case'"':return{type:"double-quoted-scalar",offset:i,indent:o,source:u,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:o,source:u,end:c};default:return{type:"scalar",offset:i,indent:o,source:u,end:c}}},n.resolveAsScalar=function(e,t=!0,n){if(e){let a=(e,t,o)=>{let r="number"==typeof e?e:Array.isArray(e)?e[0]:e.offset;if(n)n(r,t,o);else throw new i.YAMLParseError([r,r+1],t,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return r.resolveFlowScalar(e,t,a);case"block-scalar":return o.resolveBlockScalar({options:{strict:t}},e,a)}}return null},n.setScalarValue=function(e,t,n={}){let{afterKey:o=!1,implicitKey:r=!1,inFlow:i=!1,type:u}=n,c="indent"in e?e.indent:null;if(o&&"number"==typeof c&&(c+=2),!u)switch(e.type){case"single-quoted-scalar":u="QUOTE_SINGLE";break;case"double-quoted-scalar":u="QUOTE_DOUBLE";break;case"block-scalar":{let t=e.props[0];if("block-scalar-header"!==t.type)throw Error("Invalid block scalar header");u=">"===t.source[0]?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:u="PLAIN"}let d=a.stringifyString({type:u,value:t},{implicitKey:r||null===c,indent:null!==c&&c>0?" ".repeat(c):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(d[0]){case"|":case">":!function(e,t){let n=t.indexOf("\n"),o=t.substring(0,n),r=t.substring(n+1)+"\n";if("block-scalar"===e.type){let t=e.props[0];if("block-scalar-header"!==t.type)throw Error("Invalid block scalar header");t.source=o,e.source=r}else{let{offset:t}=e,n="indent"in e?e.indent:-1,i=[{type:"block-scalar-header",offset:t,indent:n,source:o}];for(let t of(s(i,"end"in e?e.end:void 0)||i.push({type:"newline",offset:-1,indent:n,source:"\n"}),Object.keys(e)))"type"!==t&&"offset"!==t&&delete e[t];Object.assign(e,{type:"block-scalar",indent:n,props:i,source:r})}}(e,d);break;case'"':l(e,d,"double-quoted-scalar");break;case"'":l(e,d,"single-quoted-scalar");break;default:l(e,d,"scalar")}}},480085,(e,t,n)=>{"use strict";function o(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=o(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=r(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=r(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=r(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function r({start:e,key:t,sep:n,value:i}){let a="";for(let t of e)a+=t.source;if(t&&(a+=o(t)),n)for(let e of n)a+=e.source;return i&&(a+=o(i)),a}n.stringify=e=>"type"in e?o(e):r(e)},81253,(e,t,n)=>{"use strict";let o=Symbol("break visit"),r=Symbol("skip children"),i=Symbol("remove item");function a(e,t){"type"in e&&"document"===e.type&&(e={start:e.start,value:e.value}),function e(t,n,r){let a=r(n,t);if("symbol"==typeof a)return a;for(let s of["key","value"]){let l=n[s];if(l&&"items"in l){for(let n=0;n<l.items.length;++n){let a=e(Object.freeze(t.concat([[s,n]])),l.items[n],r);if("number"==typeof a)n=a-1;else{if(a===o)return o;a===i&&(l.items.splice(n,1),n-=1)}}"function"==typeof a&&"key"===s&&(a=a(n,t))}}return"function"==typeof a?a(n,t):a}(Object.freeze([]),e,t)}a.BREAK=o,a.SKIP=r,a.REMOVE=i,a.itemAtPath=(e,t)=>{let n=e;for(let[e,o]of t){let t=n?.[e];if(!t||!("items"in t))return;n=t.items[o]}return n},a.parentCollection=(e,t)=>{let n=a.itemAtPath(e,t.slice(0,-1)),o=t[t.length-1][0],r=n?.[o];if(r&&"items"in r)return r;throw Error("Parent collection not found")},n.visit=a},350021,(e,t,n)=>{"use strict";var o=e.r(476103),r=e.r(480085),i=e.r(81253);n.createScalarToken=o.createScalarToken,n.resolveAsScalar=o.resolveAsScalar,n.setScalarValue=o.setScalarValue,n.stringify=r.stringify,n.visit=i.visit,n.BOM="\uFEFF",n.DOCUMENT="\x02",n.FLOW_END="\x18",n.SCALAR="\x1f",n.isCollection=e=>!!e&&"items"in e,n.isScalar=e=>!!e&&("scalar"===e.type||"single-quoted-scalar"===e.type||"double-quoted-scalar"===e.type||"block-scalar"===e.type),n.prettyToken=function(e){switch(e){case"\uFEFF":return"<BOM>";case"\x02":return"<DOC>";case"\x18":return"<FLOW_END>";case"\x1f":return"<SCALAR>";default:return JSON.stringify(e)}},n.tokenType=function(e){switch(e){case"\uFEFF":return"byte-order-mark";case"\x02":return"doc-mode";case"\x18":return"flow-error-end";case"\x1f":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case"\n":case"\r\n":return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}},457142,(e,t,n)=>{"use strict";var o=e.r(350021);function r(e){switch(e){case void 0:case" ":case"\n":case"\r":case" ":return!0;default:return!1}}let i=new Set("0123456789ABCDEFabcdef"),a=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),s=new Set(",[]{}"),l=new Set(" ,[]{}\n\r "),u=e=>!e||l.has(e);n.Lexer=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if("string"!=typeof e)throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;" "===t||" "===t;)t=this.buffer[++e];return!t||"#"===t||"\n"===t||"\r"===t&&"\n"===this.buffer[e+1]}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;" "===t;)t=this.buffer[++n+e];if("\r"===t){let t=this.buffer[n+e+1];if("\n"===t||!t&&!this.atEnd)return e+n+1}return"\n"!==t&&!(n>=this.indentNext)&&(t||this.atEnd)?-1:e+n}if("-"===t||"."===t){let t=this.buffer.substr(e,3);if(("---"===t||"..."===t)&&r(this.buffer[e+3]))return -1}return e}getLine(){let e=this.lineEndPos;return(("number"!=typeof e||-1!==e&&e<this.pos)&&(e=this.buffer.indexOf("\n",this.pos),this.lineEndPos=e),-1===e)?this.atEnd?this.buffer.substring(this.pos):null:("\r"===this.buffer[e-1]&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(null===e)return this.setNext("stream");if(e[0]===o.BOM&&(yield*this.pushCount(1),e=e.substring(1)),"%"===e[0]){let t=e.length,n=e.indexOf("#");for(;-1!==n;){let o=e[n-1];if(" "===o||" "===o){t=n-1;break}n=e.indexOf("#",n+1)}for(;;){let n=e[t-1];if(" "===n||" "===n)t-=1;else break}let o=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield o.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if("-"===e||"."===e){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let e=this.peek(3);if(("---"===e||"..."===e)&&r(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"---"===e?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!r(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if(("-"===e||"?"===e||":"===e)&&r(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(null===e)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(u),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do(e=yield*this.pushNewline())>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0)let i=this.getLine();if(null===i)return this.setNext("flow");if((-1!==n&&n<this.indentNext&&"#"!==i[0]||0===n&&(i.startsWith("---")||i.startsWith("..."))&&r(i[3]))&&(n!==this.indentNext-1||1!==this.flowLevel||"]"!==i[0]&&"}"!==i[0]))return this.flowLevel=0,yield o.FLOW_END,yield*this.parseLineStart();let a=0;for(;","===i[a];)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i[a+=yield*this.pushIndicators()]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(u),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let e=this.charAt(1);if(this.flowKey||r(e)||","===e)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if("'"===e)for(;-1!==t&&"'"===this.buffer[t+1];)t=this.buffer.indexOf("'",t+2);else for(;-1!==t;){let e=0;for(;"\\"===this.buffer[t-1-e];)e+=1;if(e%2==0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),o=n.indexOf("\n",this.pos);if(-1!==o){for(;-1!==o;){let e=this.continueScalar(o+1);if(-1===e)break;o=n.indexOf("\n",e)}-1!==o&&(t=o-("\r"===n[o-1]?2:1))}if(-1===t){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if("+"===t)this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if("-"!==t)break}return yield*this.pushUntil(e=>r(e)||"#"===e)}*parseBlockScalar(){let e,t=this.pos-1,n=0;t:for(let o=this.pos;e=this.buffer[o];++o)switch(e){case" ":n+=1;break;case"\n":t=o,n=0;break;case"\r":{let e=this.buffer[o+1];if(!e&&!this.atEnd)return this.setNext("block-scalar");if("\n"===e)break}default:break t}if(!e&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){-1===this.blockScalarIndent?this.indentNext=n:this.indentNext=this.blockScalarIndent+(0===this.indentNext?1:this.indentNext);do{let e=this.continueScalar(t+1);if(-1===e)break;t=this.buffer.indexOf("\n",e)}while(-1!==t)if(-1===t){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(e=this.buffer[r];" "===e;)e=this.buffer[++r];if(" "===e){for(;" "===e||" "===e||"\r"===e||"\n"===e;)e=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)for(;;){let e=t-1,o=this.buffer[e];"\r"===o&&(o=this.buffer[--e]);let r=e;for(;" "===o;)o=this.buffer[--e];if("\n"===o&&e>=this.pos&&e+1+n>r)t=e;else break}return yield o.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e,t=this.flowLevel>0,n=this.pos-1,i=this.pos-1;for(;e=this.buffer[++i];)if(":"===e){let e=this.buffer[i+1];if(r(e)||t&&s.has(e))break;n=i}else if(r(e)){let o=this.buffer[i+1];if("\r"===e&&("\n"===o?(i+=1,e="\n",o=this.buffer[i+1]):n=i),"#"===o||t&&s.has(o))break;if("\n"===e){let e=this.continueScalar(i+1);if(-1===e)break;i=Math.max(i,e-2)}}else{if(t&&s.has(e))break;n=i}return e||this.atEnd?(yield o.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc"):this.setNext("plain-scalar")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){let e=0;for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue;case"&":e+=yield*this.pushUntil(u),e+=yield*this.pushSpaces(!0);continue;case"-":case"?":case":":{let t=this.flowLevel>0,n=this.charAt(1);if(r(n)||t&&s.has(n)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue}}}break}return e}*pushTag(){if("<"===this.charAt(1)){let e=this.pos+2,t=this.buffer[e];for(;!r(t)&&">"!==t;)t=this.buffer[++e];return yield*this.pushToIndex(">"===t?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(a.has(t))t=this.buffer[++e];else if("%"===t&&i.has(this.buffer[e+1])&&i.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return"\n"===e?yield*this.pushCount(1):"\r"===e&&"\n"===this.charAt(1)?yield*this.pushCount(2):0}*pushSpaces(e){let t,n=this.pos-1;do t=this.buffer[++n];while(" "===t||e&&" "===t)let o=n-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=n),o}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}},884462,(e,t,n)=>{"use strict";n.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let o=t+n>>1;this.lineStarts[o]<e?t=o+1:n=o}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(0===t)return{line:0,col:e};let o=this.lineStarts[t-1];return{line:t,col:e-o+1}}}}},765038,(e,t,n)=>{"use strict";var o=e.r(605365),r=e.r(350021),i=e.r(457142);function a(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function s(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return -1}function l(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function u(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function c(e){if(0===e.length)return[];let t=e.length;t:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break t}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function d(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function p(e){if("flow-seq-start"===e.start.type)for(let t of e.items)!t.sep||t.value||a(t.start,"explicit-key-ind")||a(t.sep,"map-value-ind")||(t.key&&(t.value=t.key),delete t.key,l(t.value)?t.value.end?d(t.value.end,t.sep):t.value.end=t.sep:d(t.start,t.sep),delete t.sep)}n.Parser=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new i.Lexer,this.onNewLine=e}*parse(e,t=!1){for(let n of(this.onNewLine&&0===this.offset&&this.onNewLine(0),this.lexer.lex(e,t)))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,o.env.LOG_TOKENS&&console.log("|",r.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=r.tokenType(e);if(t)if("scalar"===t)this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&" "===e[0]&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let t=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:t,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if("doc-end"===this.type&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(t)if(0===this.stack.length)yield t;else{let e=this.peek(1);switch("block-scalar"===t.type?t.indent="indent"in e?e.indent:0:"flow-collection"===t.type&&"document"===e.type&&(t.indent=0),"flow-collection"===t.type&&p(t),e.type){case"document":e.value=t;break;case"block-scalar":e.props.push(t);break;case"block-map":{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if(("document"===e.type||"block-map"===e.type||"block-seq"===e.type)&&("block-map"===t.type||"block-seq"===t.type)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&-1===s(n.start)&&(0===t.indent||n.start.every(e=>"comment"!==e.type||e.indent<t.indent))&&("document"===e.type?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}else yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};"doc-start"===this.type&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":-1!==s(e.start)?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return;case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if("map-value-ind"===this.type){let t,n=c(u(this.peek(2)));e.end?((t=e.end).push(this.sourceToken),delete e.end):t=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:t}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0,o=Array.isArray(n)?n[n.length-1]:void 0;o?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2],o=n?.value?.end;if(Array.isArray(o)){d(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,o=n&&(t.sep||t.explicitKey)&&"seq-item-ind"!==this.type,r=[];if(o&&t.sep&&!t.value){let n=[];for(let o=0;o<t.sep.length;++o){let r=t.sep[o];switch(r.type){case"newline":n.push(o);break;case"space":break;case"comment":r.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(r=t.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":o||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":t.sep||t.explicitKey?o||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(t.start.push(this.sourceToken),t.explicitKey=!0),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(a(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(l(t.key)&&!a(t.sep,"newline")){let e=c(t.start),n=t.key,o=t.sep;o.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:o}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(a(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=c(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||o?e.items.push({start:r,key:null,sep:[this.sourceToken]}):a(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);o||t.value?(e.items.push({start:r,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if("block-seq"===o.type){if(!t.explicitKey&&t.sep&&!a(t.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else n&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0,o=Array.isArray(n)?n[n.length-1]:void 0;o?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2],o=n?.value?.end;if(Array.isArray(o)){d(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||a(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t)return void this.stack.push(t)}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if("flow-error-end"===this.type){let e;do yield*this.pop(),e=this.peek(1);while(e?.type==="flow-collection")}else if(0===e.end.length){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if("block-map"!==t.type||("map-value-ind"!==this.type||t.indent!==e.indent)&&("newline"!==this.type||t.items[t.items.length-1].sep))if("map-value-ind"===this.type&&"flow-collection"!==t.type){let n=c(u(t));p(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e);else yield*this.pop(),yield*this.step()}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=c(u(e));return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=c(u(e));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return"comment"===this.type&&!(this.indent<=t)&&e.every(e=>"newline"===e.type||"space"===e.type)}*documentEnd(e){"doc-mode"!==this.type&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop())}}}},130560,(e,t,n)=>{"use strict";var o=e.r(576214),r=e.r(722871),i=e.r(809070),a=e.r(250202),s=e.r(767080),l=e.r(884462),u=e.r(765038);function c(e){let t=!1!==e.prettyErrors;return{lineCounter:e.lineCounter||t&&new l.LineCounter||null,prettyErrors:t}}function d(e,t={}){let{lineCounter:n,prettyErrors:r}=c(t),a=new u.Parser(n?.addNewLine),s=new o.Composer(t),l=null;for(let t of s.compose(a.parse(e),!0,e.length))if(l){if("silent"!==l.options.logLevel){l.errors.push(new i.YAMLParseError(t.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else l=t;return r&&n&&(l.errors.forEach(i.prettifyError(e,n)),l.warnings.forEach(i.prettifyError(e,n))),l}n.parse=function(e,t,n){let o;"function"==typeof t?o=t:void 0===n&&t&&"object"==typeof t&&(n=t);let r=d(e,n);if(!r)return null;if(r.warnings.forEach(e=>a.warn(r.options.logLevel,e)),r.errors.length>0)if("silent"!==r.options.logLevel)throw r.errors[0];else r.errors=[];return r.toJS(Object.assign({reviver:o},n))},n.parseAllDocuments=function(e,t={}){let{lineCounter:n,prettyErrors:r}=c(t),a=new u.Parser(n?.addNewLine),s=new o.Composer(t),l=Array.from(s.compose(a.parse(e)));if(r&&n)for(let t of l)t.errors.forEach(i.prettifyError(e,n)),t.warnings.forEach(i.prettifyError(e,n));return l.length>0?l:Object.assign([],{empty:!0},s.streamInfo())},n.parseDocument=d,n.stringify=function(e,t,n){let o=null;if("function"==typeof t||Array.isArray(t)?o=t:void 0===n&&t&&(n=t),"string"==typeof n&&(n=n.length),"number"==typeof n){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(void 0===e){let{keepUndefined:e}=n??t??{};if(!e)return}return s.isDocument(e)&&!o?e.toString(n):new r.Document(e,o,n).toString(n)}},891906,(e,t,n)=>{"use strict";var o=e.r(576214),r=e.r(722871),i=e.r(891485),a=e.r(809070),s=e.r(917429),l=e.r(767080),u=e.r(812735),c=e.r(826090),d=e.r(976970),p=e.r(379482),h=e.r(350021),m=e.r(457142),g=e.r(884462),f=e.r(765038),y=e.r(130560),b=e.r(341141);n.Composer=o.Composer,n.Document=r.Document,n.Schema=i.Schema,n.YAMLError=a.YAMLError,n.YAMLParseError=a.YAMLParseError,n.YAMLWarning=a.YAMLWarning,n.Alias=s.Alias,n.isAlias=l.isAlias,n.isCollection=l.isCollection,n.isDocument=l.isDocument,n.isMap=l.isMap,n.isNode=l.isNode,n.isPair=l.isPair,n.isScalar=l.isScalar,n.isSeq=l.isSeq,n.Pair=u.Pair,n.Scalar=c.Scalar,n.YAMLMap=d.YAMLMap,n.YAMLSeq=p.YAMLSeq,n.CST=h,n.Lexer=m.Lexer,n.LineCounter=g.LineCounter,n.Parser=f.Parser,n.parse=y.parse,n.parseAllDocuments=y.parseAllDocuments,n.parseDocument=y.parseDocument,n.stringify=y.stringify,n.visit=b.visit,n.visitAsync=b.visitAsync}];
|
|
232
230
|
|
|
233
|
-
//# sourceMappingURL=
|
|
231
|
+
//# sourceMappingURL=_0rn3c_0._.js.map
|