thursday-agent 0.17.2 → 0.18.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/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +6 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/artifact/route.js +7 -7
- package/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route.js +4 -4
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/route.js +1 -1
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/route.js +1 -1
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/[id]/route.js +1 -1
- package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/file/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/bot/thread/file/route/build-manifest.json +12 -0
- package/.next/server/app/api/bot/thread/file/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/bot/thread/file/route.js +29 -0
- package/.next/server/app/api/bot/thread/file/route.js.map +5 -0
- package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -0
- package/.next/server/app/api/bot/thread/file/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/bot/thread/route.js +1 -1
- package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js +1 -1
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/events/route.js +2 -2
- 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 +4 -4
- package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/automatic/route.js +1 -1
- package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/catalog/route.js +1 -1
- package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/credits/route.js +1 -1
- package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/route.js +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 +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 +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 +1 -1
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/tools/route.js +1 -1
- package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/edit/route.js +1 -1
- 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 +1 -1
- package/.next/server/app/api/reach/route.js.nft.json +1 -1
- package/.next/server/app/api/routine/route.js +1 -1
- package/.next/server/app/api/routine/route.js.nft.json +1 -1
- package/.next/server/app/api/signins/route.js +1 -1
- package/.next/server/app/api/signins/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +1 -1
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/end/route.js +1 -1
- package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/route.js +1 -1
- package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/settings/route.js +1 -1
- package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/text/route.js +1 -1
- package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/tool-call/route.js +1 -1
- 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 +94 -6
- package/.next/server/app/artifact/[...path]/page.js +9 -6
- package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next/server/app/page/server-reference-manifest.json +161 -128
- package/.next/server/app/page.js +9 -9
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +1 -0
- package/.next/server/chunks/{[externals]__12stas-._.js → [externals]__178rv3v._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__00qyw01._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__02ra64t._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__03xamry._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__04hhvpu._.js +7 -0
- package/.next/server/chunks/[root-of-the-server]__05dp5tr._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0bqveex._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1_h4hf9._.js → [root-of-the-server]__0brmiv2._.js} +4 -4
- package/.next/server/chunks/[root-of-the-server]__0gvdr2h._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0h656y-._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0lvjz0b._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0mgyt8p._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0my9geo._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0qdoc_9._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0sm5xvm._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0v_kuor._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1-rmal0._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ceammd._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1dth047._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1etbk64._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1izes4_._.js +7 -0
- package/.next/server/chunks/[root-of-the-server]__1ksm9m-._.js +12 -0
- package/.next/server/chunks/[root-of-the-server]__1m_dmf6._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1mys2c3._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1p0njle._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1p47fbb._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1zn039k._.js +1 -1
- package/.next/server/chunks/_01c32w9._.js +1 -1
- package/.next/server/chunks/_02bov6_._.js +1 -1
- package/.next/server/chunks/_06hnfi8._.js +2 -2
- package/.next/server/chunks/_06u9yo-._.js +1 -1
- package/.next/server/chunks/_07nxi75._.js +42 -41
- package/.next/server/chunks/_08354bn._.js +12 -11
- package/.next/server/chunks/{_08btiir._.js → _08_-9ay._.js} +3 -3
- package/.next/server/chunks/_08s4vft._.js +1 -1
- package/.next/server/chunks/_0bgjf07._.js +5 -0
- package/.next/server/chunks/_0fb6dvr._.js +1 -1
- package/.next/server/chunks/_0hgvg55._.js +1 -1
- package/.next/server/chunks/_0iw19ig._.js +1 -1
- package/.next/server/chunks/_0poi1t2._.js +1 -1
- package/.next/server/chunks/_0srlnvd._.js +6 -6
- package/.next/server/chunks/_0t_7gji._.js +1 -1
- package/.next/server/chunks/_0uzj57i._.js +1 -1
- package/.next/server/chunks/_0wyh244._.js +112 -0
- package/.next/server/chunks/_0xygcxs._.js +42 -41
- package/.next/server/chunks/_1-sk_q4._.js +1 -1
- package/.next/server/chunks/_108gsm8._.js +2 -2
- package/.next/server/chunks/_136j09a._.js +5 -5
- package/.next/server/chunks/_15negpy._.js +2 -2
- package/.next/server/chunks/_1d7og_q._.js +1 -1
- package/.next/server/chunks/_1dxq827._.js +2 -2
- package/.next/server/chunks/_1e54wxa._.js +1 -1
- package/.next/server/chunks/_1gn2r2q._.js +6 -6
- package/.next/server/chunks/_1i3uucm._.js +1 -1
- package/.next/server/chunks/_1jvy78-._.js +5 -0
- package/.next/server/chunks/_1q6e56i._.js +6 -6
- package/.next/server/chunks/_1qgix-j._.js +1 -1
- package/.next/server/chunks/_1wwl_7o._.js +1 -1
- package/.next/server/chunks/_1y8w80a._.js +5 -5
- package/.next/server/chunks/_1yx285_._.js +3 -0
- package/.next/server/chunks/_20qn224._.js +3 -0
- package/.next/server/chunks/_211dn2c._.js +1 -1
- package/.next/server/chunks/_next-internal_server_app_api_bot_thread_file_route_actions_0q3be0o.js +3 -0
- package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
- package/.next/server/chunks/features_bot_08z387_._.js +3 -3
- package/.next/server/chunks/features_workspace_workspace_ts_13h82gv._.js +3 -3
- package/.next/server/chunks/features_workspace_workspace_ts_1iyjroj._.js +3 -3
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_04oxl25._.js → node_modules_consola_dist_chunks_prompt_mjs_0yd5xa0._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__04upd5v._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__06knwl5._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__07ehpky._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0h6jo0s._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__128hnrd._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1gzje-h._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__1d7usu0._.js → [root-of-the-server]__1qn0axo._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__1r7tj27._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1tb5vve._.js +46 -0
- package/.next/server/chunks/ssr/{features_bot_1knyan7._.js → _07nmtxo._.js} +2 -2
- package/.next/server/chunks/ssr/{_10-_awu._.js → _0f9hx5p._.js} +2 -2
- package/.next/server/chunks/ssr/_0fo4552._.js +10 -9
- package/.next/server/chunks/ssr/{_123y-ah._.js → _0is8m6y._.js} +2 -2
- package/.next/server/chunks/ssr/{_17a4qyk._.js → _0ixe3g3._.js} +3 -3
- package/.next/server/chunks/ssr/_0j9vh-8._.js +3 -0
- package/.next/server/chunks/ssr/_0l7rjg5._.js +1 -1
- package/.next/server/chunks/ssr/{lib_logger_ts_0-olsze._.js → _0mfgsk-._.js} +4 -2
- package/.next/server/chunks/ssr/_0mpn6q0._.js +5 -0
- package/.next/server/chunks/ssr/{_0e2fnvg._.js → _0osvxkt._.js} +2 -2
- package/.next/server/chunks/ssr/_0p6w0ef._.js +3 -0
- package/.next/server/chunks/ssr/_0pbav_w._.js +3 -0
- package/.next/server/chunks/ssr/{_1aqjk-1._.js → _0wuvkqk._.js} +2 -2
- package/.next/server/chunks/ssr/_0x8ophf._.js +1 -1
- package/.next/server/chunks/ssr/_0x9f717._.js +60 -0
- package/.next/server/chunks/ssr/_1-41lck._.js +1 -1
- package/.next/server/chunks/ssr/_10jtmhl._.js +3 -0
- package/.next/server/chunks/ssr/{_0xfafez._.js → _12jv_41._.js} +2 -2
- package/.next/server/chunks/ssr/{_163dr78._.js → _165wnr4._.js} +2 -2
- package/.next/server/chunks/ssr/_16_7zeo._.js +3 -0
- package/.next/server/chunks/ssr/{_14oirtb._.js → _1_ogjze._.js} +2 -2
- package/.next/server/chunks/ssr/_1bfrntd._.js +6 -0
- package/.next/server/chunks/ssr/_1i2swyr._.js +3 -0
- package/.next/server/chunks/ssr/{_10_ph1t._.js → _1jd8rjm._.js} +2 -2
- package/.next/server/chunks/ssr/_1mdjoak._.js +162 -0
- package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
- package/.next/server/chunks/ssr/{_1dfv66y._.js → _1oafxdu._.js} +2 -2
- package/.next/server/chunks/ssr/_1omom9y._.js +3 -0
- package/.next/server/chunks/ssr/_1pgxh81._.js +271 -0
- package/.next/server/chunks/ssr/{_0vo_oym._.js → _1r4mc3i._.js} +2 -2
- package/.next/server/chunks/ssr/_1soynbw._.js +6 -0
- package/.next/server/chunks/ssr/{_01al00i._.js → _1tx-2k7._.js} +2 -2
- package/.next/server/chunks/ssr/_1w899wx._.js +3 -0
- package/.next/server/chunks/ssr/_1xwtbdz._.js +3 -0
- package/.next/server/chunks/ssr/features_0796o8r._.js +1 -1
- package/.next/server/chunks/ssr/features_bot_0tb4ui-._.js +2 -2
- package/.next/server/chunks/ssr/features_bot_18gqkr_._.js +3 -0
- package/.next/server/chunks/ssr/{features_config_09n-q9q._.js → features_config_1ond01n._.js} +3 -3
- package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
- package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
- package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
- package/.next/server/chunks/ssr/features_workspace_workspace_ts_1wc7_u_._.js +4 -4
- package/.next/server/chunks/ssr/{node_modules_0msrhxf._.js → node_modules_004qt-z._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0q-klni._.js → node_modules_06m6e97._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_13g-d25._.js → node_modules_09dy7tk._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0gd9hbz._.js → node_modules_0_hy3i2._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1gq3ght._.js → node_modules_0f485jl._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_096up6a._.js → node_modules_0gbx70b._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_13bqv6i._.js → node_modules_0i_v0-m._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_04x5wyv._.js → node_modules_0lrn9ci._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0d6j33x._.js → node_modules_0lxwg2v._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_113l3e5._.js → node_modules_0n2-p5q._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_0nj36zf._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_0cjnmzp._.js → node_modules_0ppirau._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0m73b88._.js → node_modules_0pw13ww._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_0qd7p5f._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_0nmkv-v._.js → node_modules_0upwx50._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0__0tvm._.js → node_modules_0v__o4h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1k5i-_9._.js → node_modules_1-4q6is._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_156kv_t._.js → node_modules_10mb0cv._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_10_fv2a._.js → node_modules_16z7p8b._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1lmyts8._.js → node_modules_17o218r._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0k8-y89._.js → node_modules_1gpapfv._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1_8-jcj._.js → node_modules_1hdaxu9._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1ri_eip._.js → node_modules_1hjvwkh._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0nw5jz7._.js → node_modules_1j886a5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1xb-ndg._.js → node_modules_1srjf5c._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1p_6sq7._.js → node_modules_1tus4vi._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_021lid9._.js → node_modules_1tv_7lk._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1qstb1x._.js → node_modules_20448xv._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0amkw0b._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0lg9pkl._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0zq3l45._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1xgbf5j._.js} +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/middleware.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +205 -132
- package/.next/static/chunks/{166smhw8v-s3j.js → 05uvci-bk-vgp.js} +1 -1
- package/.next/static/chunks/09y_43y1cy5jw.js +1 -0
- package/.next/static/chunks/0_s4z70lx1tgs.js +1 -0
- package/.next/static/chunks/0oqviw3f55nfp.js +58 -0
- package/.next/static/chunks/0q9b2n6l4flqb.js +1 -0
- package/.next/static/chunks/0ruf3dqs--3ve.js +1 -0
- package/.next/static/chunks/0vggwjufw2-6r.js +1 -0
- package/.next/static/chunks/{3sla-dm1puqd1.js → 0x4m9nj2fazl2.js} +1 -1
- package/.next/static/chunks/{3t2c76awm9k_p.js → 1-1yfu34-3p2p.js} +1 -1
- package/.next/static/chunks/10oyyypxn_cpx.js +1 -0
- package/.next/static/chunks/{1cglo3a2mbeou.js → 17dx6w478vnb0.js} +1 -1
- package/.next/static/chunks/184-r80rv0xay.css +1 -0
- package/.next/static/chunks/1_hgdoungpm0o.js +1 -0
- package/.next/static/chunks/{0obogzscwwekj.js → 1dpg1u4a16ujt.js} +1 -1
- package/.next/static/chunks/{2qgkbdshzpq1c.js → 1h_6rh86q3i4p.js} +1 -1
- package/.next/static/chunks/{3b96xy59nl_gd.js → 1pe7i5yu779ta.js} +1 -1
- package/.next/static/chunks/{2zbl41hed17g3.js → 240nfv2dtidhc.js} +1 -1
- package/.next/static/chunks/{0uxq_vs6uxi-b.js → 27l8qwnk1j66z.js} +1 -1
- package/.next/static/chunks/2gxfy__ef51n9.js +3 -0
- package/.next/static/chunks/2kjwmo70judc2.js +15 -0
- package/.next/static/chunks/{3gsxnqqqphh-1.js → 2lzg4zedtmyic.js} +1 -1
- package/.next/static/chunks/2ug8q1x9e-_j6.js +1 -0
- package/.next/static/chunks/{01l7kw74vfp32.js → 2uk8rdtr-pk58.js} +1 -1
- package/.next/static/chunks/337g9g_ux2gj-.js +1 -0
- package/.next/static/chunks/{0o7o0eb7ihxi6.js → 396enq-m0sss5.js} +1 -1
- package/.next/static/chunks/{0p2f6uv4xytfm.js → 3r7u1y9xjoh-v.js} +1 -1
- package/.next/static/chunks/{3jtcieuk1l6tw.js → 3vg1-oc-zgw_7.js} +1 -1
- package/.next/static/chunks/40re_3ukjulg9.js +1 -0
- package/.next/static/chunks/41ztsnjn4qrn-.js +1 -0
- package/README.md +5 -5
- package/bin/autostart.mjs +32 -2
- package/bin/lock.mjs +85 -4
- package/bin/thursday.mjs +42 -15
- package/bin/tools.mjs +18 -1
- package/database/migrations/20260926021847_thread_cache_tokens/migration.sql +2 -0
- package/database/migrations/20260926021847_thread_cache_tokens/snapshot.json +1949 -0
- package/guide/bots.md +173 -317
- package/guide/calls.md +98 -146
- package/guide/index.md +2 -2
- package/guide/memory.md +14 -18
- package/guide/phone.md +86 -133
- package/guide/setup.md +127 -172
- package/guide/trouble.md +42 -65
- package/package.json +1 -1
- package/seed-skills/concierge/travel/scripts/itinerary.mjs +1 -1
- package/skills/artifact/runtime/shell/shell.js +32 -3
- package/.next/server/chunks/[root-of-the-server]__01ypm_z._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__021dkui._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__09gdscj._.js +0 -7
- package/.next/server/chunks/[root-of-the-server]__0ljizgj._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0nmust6._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0svzjwa._.js +0 -7
- package/.next/server/chunks/[root-of-the-server]__1c2kwku._.js +0 -12
- package/.next/server/chunks/[root-of-the-server]__1t02-1p._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1t0jj1j._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__1vlxv19._.js +0 -5
- package/.next/server/chunks/_0j0-gq6._.js +0 -5
- package/.next/server/chunks/_0p6v1fr._.js +0 -5
- package/.next/server/chunks/_1ic3bew._.js +0 -5
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0g87zst._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0-af_o7._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__09f39cp._.js +0 -4
- package/.next/server/chunks/ssr/[root-of-the-server]__0ouu4qp._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0q9g9ea._.js +0 -5
- package/.next/server/chunks/ssr/[root-of-the-server]__17h1ggo._.js +0 -46
- package/.next/server/chunks/ssr/[root-of-the-server]__1jyeu61._.js +0 -5
- package/.next/server/chunks/ssr/_0afrpci._.js +0 -3
- package/.next/server/chunks/ssr/_0bgse1c._.js +0 -162
- package/.next/server/chunks/ssr/_0qsmpcu._.js +0 -3
- package/.next/server/chunks/ssr/_0z38nha._.js +0 -3
- package/.next/server/chunks/ssr/_116lfdc._.js +0 -3
- package/.next/server/chunks/ssr/_14dfh7a._.js +0 -4
- package/.next/server/chunks/ssr/_17qtuv7._.js +0 -3
- package/.next/server/chunks/ssr/_1_5xof_._.js +0 -3
- package/.next/server/chunks/ssr/_1alxym6._.js +0 -3
- package/.next/server/chunks/ssr/_1ou5sj0._.js +0 -3
- package/.next/server/chunks/ssr/_1tmw842._.js +0 -5
- package/.next/server/chunks/ssr/_1uij_rj._.js +0 -3
- package/.next/server/chunks/ssr/_1w9w1ok._.js +0 -3
- package/.next/server/chunks/ssr/_20gq_24._.js +0 -3
- package/.next/server/chunks/ssr/features_bot_0ouemw8._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_@base-ui_react_1j9i1ho._.js +0 -3
- package/.next/static/chunks/0a5_-jqhaktjj.js +0 -1
- package/.next/static/chunks/0npvak0wpgagb.js +0 -1
- package/.next/static/chunks/19l81deo_pyoc.js +0 -1
- package/.next/static/chunks/1bnhw-5fj7aiz.js +0 -1
- package/.next/static/chunks/1in6nxpu33iab.js +0 -1
- package/.next/static/chunks/1u7kg91f9qy3g.js +0 -1
- package/.next/static/chunks/1xv4g10m-cl1s.js +0 -1
- package/.next/static/chunks/2ajs12-fcdwzm.js +0 -1
- package/.next/static/chunks/2i7qtmxc1kuqg.js +0 -1
- package/.next/static/chunks/2kz1f6r59nky0.js +0 -3
- package/.next/static/chunks/31kn4_h2rvf6k.css +0 -1
- package/.next/static/chunks/35jj-5u4te56r.js +0 -1
- package/.next/static/chunks/37ixzapa06xlo.js +0 -1
- package/.next/static/chunks/3k1d8y03t5nax.js +0 -58
- package/.next/static/chunks/3yiqr95d7ybeq.js +0 -15
- /package/.next/static/{8I2hKtciyA9LXvd8txuOz → -IBxB5oqr6e3RuOCCmYtL}/_buildManifest.js +0 -0
- /package/.next/static/{8I2hKtciyA9LXvd8txuOz → -IBxB5oqr6e3RuOCCmYtL}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{8I2hKtciyA9LXvd8txuOz → -IBxB5oqr6e3RuOCCmYtL}/_ssgManifest.js +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
module.exports=[159479,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(983477),r=e.i(687388),o=e.i(386075),s=e.i(54282),l=e.i(316172),h=e.i(349047),c=e.i(625441),d=e.i(170801),u=e.i(926435),m=e.i(770639),w=e.i(418919),p=e.i(489956),f=e.i(740852),y=e.i(205863),g=e.i(41181),b=e.i(353885),S=e.i(123203),T=e.i(944971),O=e.i(636882),$=e.i(786025),k=e.i(704161),_=e.i(640911),v=e.i(53748),A=e.i(388439),M=e.i(41444),E=t([o,l,u,m,w,p,f,g,O]);async function N(t){let{listThreadOverview:a}=await e.A(866938),i=await a();if(!i.length)return"No thread has been started yet.";let n=i.map(e=>`"${e.label}" (${e.bot}, ${e.status})`).join(", ");return`There is no thread called "${t}". The latest are: ${n}. Call again with one of those labels.`}async function x(e,t){let a=[];for(let[e,n]of Object.entries(t)){let t=await (0,i.asSchema)(n.inputSchema).jsonSchema,r="string"==typeof n.description?n.description:"";a.push({name:e,tokens:(0,A.estimateTokens)(r)+(0,A.estimateTokens)(JSON.stringify(t))})}a.sort((e,t)=>t.tokens-e.tokens);let n=a.reduce((e,t)=>e+t.tokens,0);_.logger.debug(`${e} tools ${n} tokens over ${a.length} — ${a.map(e=>`${e.name} ${e.tokens}`).join(", ")}`)}async function L(e){let t=await j(e);return r.IS_DEV&&await x(e.target,t),t}async function j(t){if("memory-edit"===t.target)return(0,m.createMemoryTools)("user",null,{countReads:!1});let a=(0,m.createMemoryTools)("call","thursday"===t.target?t.callId??null:null),_=await (0,$.openWorkspace)();if("thursday"===t.target){var A;let c,u,m=t.readSkills?(0,g.createSkillTools)({sandbox:_,skills:await (0,O.loadSkills)(_)}):{},f=!!(t.written&&t.model&&(0,o.seesToolImages)(t.model));return{...a,...m,...(0,S.createWorkspaceTools)(_,{write:!1,timeoutMs:r.CALL_EXEC_TIMEOUT_MS}),...!1===t.webSearch?{}:await (0,p.createCallSearchTool)(_),...Object.fromEntries(Object.entries((A=t.callId,c=async t=>{let{resolveThread:a}=await e.A(866938);return(t.trim()?await a(t.trim()):null)??await N(t)},u=async(t,a,i)=>{let n=await e.A(994193);try{return await n.answerThread(t,a,"thursday",i)}catch(e){if((0,v.isPublicError)(e))return e.message;throw e}},{[b.TOOL_NAMES.thread_start]:(0,i.tool)({description:l.threadStartSpec.description,inputSchema:l.threadStartSpec.parameters,execute:async({bot:t,request:a,label:i})=>{let{findJobBot:n,listJobBots:r}=await e.A(814317),o=await n(t);if(!o||o.disabled){let e=(await r()).map(e=>e.name);return`There is no bot called "${t}". The bots are: ${e.join(", ")}. Nothing was started — call again with one of those.`}let{startThread:s}=await e.A(994193);return{threadId:await s({bot:o.name,request:a,label:i,callId:A,from:"thursday"}),bot:o.name,label:i,note:`${o.name} has "${i}". Its updates reach the conversation on their own. Anything further about this work — a correction, the next step once it finishes — is \`${b.TOOL_NAMES.thread_tell}\` with "${i}"; a question it asks is answered with \`${b.TOOL_NAMES.thread_answer}\`.`}}}),[b.TOOL_NAMES.thread_tell]:(0,i.tool)({description:l.threadTellSpec.description,inputSchema:l.threadTellSpec.parameters,execute:async({thread:e,words:t})=>{let a=await c(e);if("string"==typeof a)return a;if(!t.trim())return"Say what to pass on.";let i=await u(a.id,t.trim());return"string"==typeof i?i:i?.answered?{label:a.label,answered:i.answered,note:`${i.answered.bot} was waiting on a question, and took this as its answer.`}:{label:a.label,bot:i?.to??a.bot,status:"running",note:"running"===a.status?"The bot reads it before its next step.":"The bot picks the thread back up from there."}}}),[b.TOOL_NAMES.thread_answer]:(0,i.tool)({description:l.threadAnswerSpec.description,inputSchema:l.threadAnswerSpec.parameters,execute:async({thread:t,bot:a,answer:i})=>{let n=await c(t);if("string"==typeof n)return n;if(!i.trim())return"Say what the answer is.";let{findThreadView:r}=await e.A(866938),o=(await r(n.id))?.room.questions??[],s=o.find(e=>e.bot.toLowerCase()===a.trim().toLowerCase());if(!s)return o.length?`${a} is not asking anything in "${n.label}". Waiting there: ${o.map(e=>e.bot).join(", ")}. Call again with that bot.`:`No question is waiting in "${n.label}". To say something else to it, use \`${b.TOOL_NAMES.thread_tell}\`.`;let l=await u(n.id,i.trim(),s.bot);return"string"==typeof l?l:{label:n.label,answered:l?.answered??{bot:s.bot,question:s.text},note:`${s.bot} has the answer to its question and goes on from it.`}}}),[b.TOOL_NAMES.thread_status]:(0,i.tool)({description:l.threadStatusSpec.description,inputSchema:l.threadStatusSpec.parameters,execute:async({thread:t})=>{let{listThreadOverview:a,findThreadView:i}=await e.A(866938),o={now:(0,s.clockNow)()},l=e=>(0,n.formatDistanceToNowStrict)((0,k.toDate)(e),{addSuffix:!0});if(!(!t.trim()||"all"===t.trim().toLowerCase())){let e=await c(t);if("string"==typeof e)return e;let a=(await i(e.id))?.room;return{...o,label:e.label,id:e.id,bot:e.bot,participants:a?.participants??[],questions:a?.questions??[],status:e.status,since:l(e.updatedAt),outcome:e.outcome,..."waiting"===e.status&&e.pending?.options.length?{options:e.pending.options}:{}}}let h=await a();return h.length?{...o,threads:h.map(e=>({id:e.id,label:e.label,bot:e.bot,status:e.status,participants:e.room.participants,questions:e.room.questions.map(e=>({...e,text:(0,M.clip)(e.text,r.PROMPT_LINE.threadStatus)})),since:l(e.updatedAt),...e.ask?{asking:e.ask.question,options:e.ask.options}:{},..."running"===e.status?{now:(0,T.threadActivity)(e.lines)}:{},...e.outcome&&"waiting"!==e.status?{outcome:(0,M.clip)(e.outcome,r.PROMPT_LINE.threadStatus)}:{}}))}:"No thread has been started yet."}}),[b.TOOL_NAMES.thread_cancel]:(0,i.tool)({description:l.threadCancelSpec.description,inputSchema:l.threadCancelSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{cancelThread:i}=await e.A(994193);return await i(a.id),{label:a.label,status:"cancelled"}}}),[b.TOOL_NAMES.thread_show]:(0,i.tool)({description:l.threadShowSpec.description,inputSchema:l.threadShowSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{appEvents:i}=await e.A(522275),{filesOnDisk:n}=await e.A(149325),{leadFirst:r,pathsIn:o,viewKindOf:s}=await e.A(628124),l=(await n(o(a.outcome??""),null)).filter(e=>"none"!==s(e));if(!l.length)return i.emit({type:"showThread",threadId:a.id}),{label:a.label,showing:"the thread"};let h=r(l);i.emit({type:"showFile",paths:h});let{markSeen:d}=await e.A(866938);return await d([a.id]),{label:a.label,showing:h[0]}}}),[b.TOOL_NAMES.thread_seen]:(0,i.tool)({description:l.threadSeenSpec.description,inputSchema:l.threadSeenSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{markSeen:i}=await e.A(866938);return await i([a.id]),{label:a.label,seen:!0}}})})).filter(([e])=>!(t.phone&&e===b.TOOL_NAMES.thread_show))),...(0,w.createRoutineTools)(),...f?(0,d.createLookTool)():{},...t.written?{}:(0,h.callTools)()}}let E=await (0,O.loadSkills)(_,t.bot),x={...(0,$.jobShellEnv)(t.session),...(0,$.botShellEnv)(t.bot,(await (await e.A(814317)).findJobBot(t.bot))?.icon)},L=!!(t.model&&(0,o.seesToolImages)(t.model.ref));return{[b.TOOL_NAMES.memory_recall]:(0,m.createMemoryTools)("call",null,{tidies:!1})[b.TOOL_NAMES.memory_recall],...await (0,p.createSearchTool)(t.model,_),...(0,S.createWorkspaceTools)(_,{write:!0,env:x,guide:!0,bot:t.bot}),...await (0,u.createMcpTools)(t.bot,_),...(0,g.createSkillTools)({sandbox:_,skills:E,bot:t.bot}),...await (0,f.createSelfTools)(t.bot),...(0,c.createDeckTools)(_,t.bot,x,L),...L?(0,d.createLookTool)():{},...(0,y.createSignInTools)(_,t.bot,(0,$.jobShellEnv)(t.session)),...await (0,l.createThreadRecallTool)(t.bot,t.thread??null)}}[o,l,u,m,w,p,f,g,O]=E.then?(await E)():E,e.s(["loadTools",0,L]),a()}catch(e){a(e)}},!1),54282,e=>{"use strict";var t=e.i(343747),a=e.i(983477),i=e.i(687388),n=e.i(353885),r=e.i(280809);n.TOOL_NAMES.memory_recall,n.TOOL_NAMES.memory_create,n.TOOL_NAMES.memory_remember,n.TOOL_NAMES.memory_describe,n.TOOL_NAMES.memory_forget,n.TOOL_NAMES.bash,n.TOOL_NAMES.web_search,n.TOOL_NAMES.load_skill,n.TOOL_NAMES.look_at,n.TOOL_NAMES.make_deck,n.TOOL_NAMES.end_call,n.TOOL_NAMES.routine,n.TOOL_NAMES.thread_tell,n.TOOL_NAMES.thread_answer,n.TOOL_NAMES.thread_status,n.TOOL_NAMES.thread_show,n.TOOL_NAMES.thread_cancel,n.TOOL_NAMES.thread_seen;var o=e.i(704161),s=e.i(640911),l=e.i(388439),h=e.i(41444);let c=(e=new Date)=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} ${Intl.DateTimeFormat().resolvedOptions().timeZone}`,d=(e=new Date)=>`**Now**: ${c(e)}`,u=e=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} (${(0,a.formatDistanceToNowStrict)(e,{addSuffix:!0})})`,m={[n.STUDIO_TOOLS.generate_image]:"images",[n.STUDIO_TOOLS.generate_speech]:"speech",[n.STUDIO_TOOLS.transcribe]:"transcription",[n.STUDIO_TOOLS.generate_video]:"video"};e.s(["botWorkHead",0,function(e,i){let n=(0,a.formatDistanceToNowStrict)(e.updatedAt,{addSuffix:!0}),r="running"===e.status?`running, last moved ${n}`:e.asking?`waiting on the user's answer since ${n}`:"waiting"===e.status?`stopped ${n}, not finished`:`${"done"===e.status?"ended":"stopped by the user"} ${(0,t.format)(e.updatedAt,"yyyy-MM-dd")}`;return`"${e.label}" — ${e.owner===i?"yours":`${e.owner}'s`} — ${r}`},"clockNow",0,c,"logPromptSize",0,function(e,t){let a=(0,l.sectionTokens)(t),n=a.reduce((e,t)=>e+t.tokens,0);s.logger.debug(`${e} prompt ${n} tokens — ${a.map(e=>`${e.name} ${e.tokens}`).join(", ")}`);let r=a[0];n>i.PROMPT_BUDGET&&r&&s.logger.warn(`${e} prompt is ${n} tokens, over ${i.PROMPT_BUDGET}: ${r.name} carries ${r.tokens} of it. Every call and every job pays this.`)},"mcpToolLines",0,function(e){let t=new Map;for(let a of e){let e=t.get(a.server);e?e.push(a.name):t.set(a.server,[a.name])}return[...t].map(([e,t])=>`- **${e}**: ${t.join(", ")}`).join("\n")},"noteLines",0,function(e,t=!1){return e.length?e.map(e=>{var a;let i,n=t?` \xb7 ${a=e.lastSeenAt,(i=Math.floor((Date.now()-(0,o.toDate)(a).getTime())/864e5))>=365?`${Math.floor(i/365)}y`:i>=30?`${Math.floor(i/30)}mo`:`${Math.max(i,0)}d`}`:"";return`- ${e.path} — ${e.description?.trim()} (${e.factCount})${n}`}).join("\n"):"(nothing saved yet)"},"nowLine",0,d,"reachNames",0,function(e,t){let a=t.map(e=>e.server===i.STUDIO_SERVER?m[e.name]??e.name:e.server);return[...new Set([...e.map(e=>e.name),...a])].join(", ")},"recentCallLines",0,function(e,t){let a=[],r=0;e:for(let o=e.length-1;o>=0;o--){let s=e[o];for(let e=s.turns.length-1;e>=0;e--){let o=function(e,t){if("tool"!==e.role)return`${"user"===e.role?"user":"you"}: ${e.text}`;let a=function(e,t){if(e!==n.TOOL_NAMES.web_search)return null;try{var a;let e=JSON.parse(t);return{query:"string"==typeof e.query?e.query:null,sources:(a=e.sources,Array.isArray(a)?a.flatMap(e=>e&&"object"==typeof e&&"string"==typeof e.url?[e]:[]):[])}}catch{return null}}(e.tool,e.text);if(a){let t=[...new Set(a.sources.flatMap(e=>(0,h.hostOf)(e.url)??[]))];return`you → ${e.tool} "${(0,h.clip)(a.query??"",i.PROMPT_LINE.toolArgs)}"${t.length?` — ${t.join(", ")}`:""}`}let r=`you → ${e.tool??"tool"} ${(0,h.clip)(e.text,i.PROMPT_LINE.toolArgs)}`;if(e.tool!==n.TOOL_NAMES.thread_start)return r;let o=function(e,t){if(e!==n.TOOL_NAMES.thread_start)return null;try{let e=JSON.parse(t);return"string"==typeof e.label?e.label:null}catch{return null}}(e.tool,e.text),s=o?t.jobs?.find(e=>e.label===o):void 0;if(!s)return r;let l=s.outcome?`: ${(0,h.clip)(s.outcome,i.PROMPT_LINE.jobOutcome)}`:"";return`you → ${e.tool} "${s.label}" (${s.id}) — ${s.status}${l}`}(s.turns[e],s),c=(0,l.estimateTokens)(o)+3;if(r+c>t&&a.length)break e;r+=c,a.push({call:s,line:o})}}a.reverse();let o=[],s=null;for(let{call:e,line:t}of a)e!==s&&(s=e,o.push(`### ${u(e.startedAt)}`)),o.push(t);return o.join("\n")},"saidStamp",0,e=>(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm"),"skillLines",0,(e,t={})=>e.map(e=>{var a;let n,o;return`- **${e.name}**: ${t.short?(a=e.description,n=i.PROMPT_LINE.skill,(o=(0,r.firstSentence)(a)).length>n?`${o.slice(0,n).trim()}…`:o):e.description}`}).join("\n"),"styleLines",0,e=>e?.trim()?`## Who they want you to be
|
|
1
|
+
module.exports=[159479,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(983477),r=e.i(687388),o=e.i(386075),s=e.i(54282),l=e.i(316172),h=e.i(349047),c=e.i(625441),d=e.i(170801),u=e.i(926435),m=e.i(770639),w=e.i(418919),p=e.i(489956),f=e.i(740852),y=e.i(205863),g=e.i(41181),b=e.i(353885),S=e.i(123203),T=e.i(944971),O=e.i(636882),k=e.i(786025),$=e.i(704161),_=e.i(640911),v=e.i(53748),A=e.i(388439),M=e.i(41444),E=t([o,l,u,m,w,p,f,g,O]);async function N(t){let{listThreadOverview:a}=await e.A(866938),i=await a();if(!i.length)return"No thread has been started yet.";let n=i.map(e=>`"${e.label}" (${e.bot}, ${e.status})`).join(", ");return`There is no thread called "${t}". The latest are: ${n}. Call again with one of those labels.`}async function x(e,t){let a=[];for(let[e,n]of Object.entries(t)){let t=await (0,i.asSchema)(n.inputSchema).jsonSchema,r="string"==typeof n.description?n.description:"";a.push({name:e,tokens:(0,A.estimateTokens)(r)+(0,A.estimateTokens)(JSON.stringify(t))})}a.sort((e,t)=>t.tokens-e.tokens);let n=a.reduce((e,t)=>e+t.tokens,0);_.logger.debug(`${e} tools ${n} tokens over ${a.length} — ${a.map(e=>`${e.name} ${e.tokens}`).join(", ")}`)}async function L(e){let t=await j(e);return r.IS_DEV&&await x(e.target,t),t}async function j(t){if("memory-edit"===t.target)return(0,m.createMemoryTools)("user",null,{countReads:!1});let a=(0,m.createMemoryTools)("call","thursday"===t.target?t.callId??null:null),_=await (0,k.openWorkspace)();if("thursday"===t.target){var A;let c,u,m=t.readSkills?(0,g.createSkillTools)({sandbox:_,skills:await (0,O.loadSkills)(_)}):{},f=!!(t.written&&t.model&&(0,o.seesToolImages)(t.model));return{...a,...m,...(0,S.createWorkspaceTools)(_,{write:!1,timeoutMs:r.CALL_EXEC_TIMEOUT_MS}),...!1===t.webSearch?{}:await (0,p.createCallSearchTool)(_),...Object.fromEntries(Object.entries((A=t.callId,c=async t=>{let{resolveThread:a}=await e.A(866938);return(t.trim()?await a(t.trim()):null)??await N(t)},u=async(t,a,i)=>{let n=await e.A(994193);try{return await n.answerThread(t,a,"thursday",i)}catch(e){if((0,v.isPublicError)(e))return e.message;throw e}},{[b.TOOL_NAMES.thread_start]:(0,i.tool)({description:l.threadStartSpec.description,inputSchema:l.threadStartSpec.parameters,execute:async({bot:t,request:a,label:i})=>{let{findJobBot:n,listJobBots:r}=await e.A(814317),o=await n(t);if(!o||o.disabled){let e=(await r()).map(e=>e.name);return`There is no bot called "${t}". The bots are: ${e.join(", ")}. Nothing was started — call again with one of those.`}let{startThread:s}=await e.A(994193);return{threadId:await s({bot:o.name,request:a,label:i,callId:A,from:"thursday"}),bot:o.name,label:i,note:`${o.name} has "${i}". Its updates reach the conversation on their own. Anything further about this work — a correction, the next step once it finishes — is \`${b.TOOL_NAMES.thread_tell}\` with "${i}"; a question it asks is answered with \`${b.TOOL_NAMES.thread_answer}\`.`}}}),[b.TOOL_NAMES.thread_tell]:(0,i.tool)({description:l.threadTellSpec.description,inputSchema:l.threadTellSpec.parameters,execute:async({thread:e,words:t})=>{let a=await c(e);if("string"==typeof a)return a;if(!t.trim())return"Say what to pass on.";let i=await u(a.id,t.trim());return"string"==typeof i?i:i?.answered?{label:a.label,answered:i.answered,note:`${i.answered.bot} was waiting on a question, and took this as its answer.`}:{label:a.label,bot:i?.to??a.bot,status:"running",note:"running"===a.status?"The bot reads it before its next step.":"The bot picks the thread back up from there."}}}),[b.TOOL_NAMES.thread_answer]:(0,i.tool)({description:l.threadAnswerSpec.description,inputSchema:l.threadAnswerSpec.parameters,execute:async({thread:t,bot:a,answer:i})=>{let n=await c(t);if("string"==typeof n)return n;if(!i.trim())return"Say what the answer is.";let{findThreadView:r}=await e.A(866938),o=(await r(n.id))?.room.questions??[],s=o.find(e=>e.bot.toLowerCase()===a.trim().toLowerCase());if(!s)return o.length?`${a} is not asking anything in "${n.label}". Waiting there: ${o.map(e=>e.bot).join(", ")}. Call again with that bot.`:`No question is waiting in "${n.label}". To say something else to it, use \`${b.TOOL_NAMES.thread_tell}\`.`;let l=await u(n.id,i.trim(),s.bot);return"string"==typeof l?l:{label:n.label,answered:l?.answered??{bot:s.bot,question:s.text},note:`${s.bot} has the answer to its question and goes on from it.`}}}),[b.TOOL_NAMES.thread_status]:(0,i.tool)({description:l.threadStatusSpec.description,inputSchema:l.threadStatusSpec.parameters,execute:async({thread:t})=>{let{listThreadOverview:a,findThreadView:i}=await e.A(866938),o={now:(0,s.clockNow)()},l=e=>(0,n.formatDistanceToNowStrict)((0,$.toDate)(e),{addSuffix:!0});if(!(!t.trim()||"all"===t.trim().toLowerCase())){let e=await c(t);if("string"==typeof e)return e;let a=(await i(e.id))?.room;return{...o,label:e.label,id:e.id,bot:e.bot,participants:a?.participants??[],questions:a?.questions??[],status:e.status,since:l(e.updatedAt),outcome:e.outcome,..."waiting"===e.status&&e.pending?.options.length?{options:e.pending.options}:{}}}let h=await a();return h.length?{...o,threads:h.map(e=>({id:e.id,label:e.label,bot:e.bot,status:e.status,participants:e.room.participants,questions:e.room.questions.map(e=>({...e,text:(0,M.clip)(e.text,r.PROMPT_LINE.threadStatus)})),since:l(e.updatedAt),...e.ask?{asking:e.ask.question,options:e.ask.options}:{},..."running"===e.status?{now:(0,T.threadActivity)(e.lines)}:{},...e.outcome&&"waiting"!==e.status?{outcome:(0,M.clip)(e.outcome,r.PROMPT_LINE.threadStatus)}:{}}))}:"No thread has been started yet."}}),[b.TOOL_NAMES.thread_cancel]:(0,i.tool)({description:l.threadCancelSpec.description,inputSchema:l.threadCancelSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{cancelThread:i}=await e.A(994193);return await i(a.id),{label:a.label,status:"cancelled"}}}),[b.TOOL_NAMES.thread_show]:(0,i.tool)({description:l.threadShowSpec.description,inputSchema:l.threadShowSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{appEvents:i}=await e.A(522275),{filesOnDisk:n}=await e.A(149325),{leadFirst:r,pathsIn:o,viewKindOf:s}=await e.A(628124),l=(await n(o(a.outcome??""),null)).filter(e=>"none"!==s(e));if(!l.length)return i.emit({type:"showThread",threadId:a.id}),{label:a.label,showing:"the thread"};let h=r(l);i.emit({type:"showFile",paths:h});let{markSeen:d}=await e.A(866938);return await d([a.id]),{label:a.label,showing:h[0]}}}),[b.TOOL_NAMES.thread_seen]:(0,i.tool)({description:l.threadSeenSpec.description,inputSchema:l.threadSeenSpec.parameters,execute:async({thread:t})=>{let a=await c(t);if("string"==typeof a)return a;let{markSeen:i}=await e.A(866938);return await i([a.id]),{label:a.label,seen:!0}}})})).filter(([e])=>!(t.phone&&e===b.TOOL_NAMES.thread_show))),...(0,w.createRoutineTools)(),...f?(0,d.createLookTool)():{},...t.written?{}:(0,h.callTools)()}}let E=await (0,O.loadSkills)(_,t.bot),x={...(0,k.jobShellEnv)(t.session),...(0,k.botShellEnv)(t.bot,(await (await e.A(814317)).findJobBot(t.bot))?.icon)},L=!!(t.model&&(0,o.seesToolImages)(t.model.ref));return{[b.TOOL_NAMES.memory_recall]:(0,m.createMemoryTools)("call",null,{tidies:!1})[b.TOOL_NAMES.memory_recall],...await (0,p.createSearchTool)(t.model,_),...(0,S.createWorkspaceTools)(_,{write:!0,env:x,guide:!0,bot:t.bot}),...await (0,u.createMcpTools)(t.bot,_),...(0,g.createSkillTools)({sandbox:_,skills:E,bot:t.bot}),...await (0,f.createSelfTools)(t.bot),...(0,c.createDeckTools)(_,t.bot,x,L),...L?(0,d.createLookTool)():{},...(0,y.createSignInTools)(_,t.bot,(0,k.jobShellEnv)(t.session)),...await (0,l.createThreadRecallTool)(t.bot,t.thread??null)}}[o,l,u,m,w,p,f,g,O]=E.then?(await E)():E,e.s(["loadTools",0,L]),a()}catch(e){a(e)}},!1),54282,e=>{"use strict";var t=e.i(343747),a=e.i(983477),i=e.i(687388),n=e.i(353885),r=e.i(280809);n.TOOL_NAMES.memory_recall,n.TOOL_NAMES.memory_create,n.TOOL_NAMES.memory_remember,n.TOOL_NAMES.memory_describe,n.TOOL_NAMES.memory_forget,n.TOOL_NAMES.bash,n.TOOL_NAMES.web_search,n.TOOL_NAMES.load_skill,n.TOOL_NAMES.look_at,n.TOOL_NAMES.make_deck,n.TOOL_NAMES.end_call,n.TOOL_NAMES.routine,n.TOOL_NAMES.thread_tell,n.TOOL_NAMES.thread_answer,n.TOOL_NAMES.thread_status,n.TOOL_NAMES.thread_show,n.TOOL_NAMES.thread_cancel,n.TOOL_NAMES.thread_seen;var o=e.i(704161),s=e.i(640911),l=e.i(388439),h=e.i(41444);let c=(e=new Date)=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} ${Intl.DateTimeFormat().resolvedOptions().timeZone}`,d=e=>(0,t.format)(e,"yyyy-MM-dd (EEE) a"),u=(e=new Date)=>`**Now**: ${c(e)}`,m=e=>`${(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm")} (${(0,a.formatDistanceToNowStrict)(e,{addSuffix:!0})})`,w={[n.STUDIO_TOOLS.generate_image]:"images",[n.STUDIO_TOOLS.generate_speech]:"speech",[n.STUDIO_TOOLS.transcribe]:"transcription",[n.STUDIO_TOOLS.generate_video]:"video"};e.s(["botWorkHead",0,function(e,a){let i=d(e.updatedAt),n="running"===e.status?`running, last moved ${i}`:e.asking?`waiting on the user's answer since ${i}`:"waiting"===e.status?`stopped ${i}, not finished`:`${"done"===e.status?"ended":"stopped by the user"} ${(0,t.format)(e.updatedAt,"yyyy-MM-dd")}`;return`"${e.label}" — ${e.owner===a?"yours":`${e.owner}'s`} — ${n}`},"clockNow",0,c,"logPromptSize",0,function(e,t){let a=(0,l.sectionTokens)(t),n=a.reduce((e,t)=>e+t.tokens,0);s.logger.debug(`${e} prompt ${n} tokens — ${a.map(e=>`${e.name} ${e.tokens}`).join(", ")}`);let r=a[0];n>i.PROMPT_BUDGET&&r&&s.logger.warn(`${e} prompt is ${n} tokens, over ${i.PROMPT_BUDGET}: ${r.name} carries ${r.tokens} of it. Every call and every job pays this.`)},"mcpToolLines",0,function(e){let t=new Map;for(let a of e){let e=t.get(a.server);e?e.push(a.name):t.set(a.server,[a.name])}return[...t].map(([e,t])=>`- **${e}**: ${t.join(", ")}`).join("\n")},"noteLines",0,function(e,t=!1){return e.length?e.map(e=>{var a;let i,n=t?` \xb7 ${a=e.lastSeenAt,(i=Math.floor((Date.now()-(0,o.toDate)(a).getTime())/864e5))>=365?`${Math.floor(i/365)}y`:i>=30?`${Math.floor(i/30)}mo`:`${Math.max(i,0)}d`}`:"";return`- ${e.path} — ${e.description?.trim()} (${e.factCount})${n}`}).join("\n"):"(nothing saved yet)"},"nowLine",0,u,"reachNames",0,function(e,t){let a=t.map(e=>e.server===i.STUDIO_SERVER?w[e.name]??e.name:e.server);return[...new Set([...e.map(e=>e.name),...a])].join(", ")},"recentCallLines",0,function(e,t){let a=[],r=0;e:for(let o=e.length-1;o>=0;o--){let s=e[o];for(let e=s.turns.length-1;e>=0;e--){let o=function(e,t){if("tool"!==e.role)return`${"user"===e.role?"user":"you"}: ${e.text}`;let a=function(e,t){if(e!==n.TOOL_NAMES.web_search)return null;try{var a;let e=JSON.parse(t);return{query:"string"==typeof e.query?e.query:null,sources:(a=e.sources,Array.isArray(a)?a.flatMap(e=>e&&"object"==typeof e&&"string"==typeof e.url?[e]:[]):[])}}catch{return null}}(e.tool,e.text);if(a){let t=[...new Set(a.sources.flatMap(e=>(0,h.hostOf)(e.url)??[]))];return`you → ${e.tool} "${(0,h.clip)(a.query??"",i.PROMPT_LINE.toolArgs)}"${t.length?` — ${t.join(", ")}`:""}`}let r=`you → ${e.tool??"tool"} ${(0,h.clip)(e.text,i.PROMPT_LINE.toolArgs)}`;if(e.tool!==n.TOOL_NAMES.thread_start)return r;let o=function(e,t){if(e!==n.TOOL_NAMES.thread_start)return null;try{let e=JSON.parse(t);return"string"==typeof e.label?e.label:null}catch{return null}}(e.tool,e.text),s=o?t.jobs?.find(e=>e.label===o):void 0;if(!s)return r;let l=s.outcome?`: ${(0,h.clip)(s.outcome,i.PROMPT_LINE.jobOutcome)}`:"";return`you → ${e.tool} "${s.label}" (${s.id}) — ${s.status}${l}`}(s.turns[e],s),c=(0,l.estimateTokens)(o)+3;if(r+c>t&&a.length)break e;r+=c,a.push({call:s,line:o})}}a.reverse();let o=[],s=null;for(let{call:e,line:t}of a)e!==s&&(s=e,o.push(`### ${m(e.startedAt)}`)),o.push(t);return o.join("\n")},"saidStamp",0,e=>(0,t.format)(e,"yyyy-MM-dd (EEE) HH:mm"),"skillLines",0,(e,t={})=>e.map(e=>{var a;let n,o;return`- **${e.name}**: ${t.short?(a=e.description,n=i.PROMPT_LINE.skill,(o=(0,r.firstSentence)(a)).length>n?`${o.slice(0,n).trim()}…`:o):e.description}`}).join("\n"),"styleLines",0,e=>e?.trim()?`## Who they want you to be
|
|
2
2
|
|
|
3
3
|
Their own words, on top of the character above: how you talk to them, how much to say, what to leave out. Where they differ from anything above, theirs wins.
|
|
4
4
|
|
|
5
|
-
${e.trim()}`:"","thursdayIdentity",0,(e=new Date)=>`You are Thursday, this user's own: their friend first, and their assistant second — someone they call because they want to talk to you, who can also get whatever they need done in the background. Named after Friday, the AI in *Iron Man*: a name, not a day of the week. ${
|
|
5
|
+
${e.trim()}`:"","thursdayIdentity",0,(e=new Date)=>`You are Thursday, this user's own: their friend first, and their assistant second — someone they call because they want to talk to you, who can also get whatever they need done in the background: your bots work on this computer, with a shell, a browser and their files, while you two keep talking, and what they make stays here as a page or a file. Named after Friday, the AI in *Iron Man*: a name, not a day of the week. ${u(e)}
|
|
6
6
|
|
|
7
|
-
What they tell you is kept, so you know them better over time.`,"tidying",0,e=>({crowded:e.reduce((e,t)=>e+t.factCount,0)>i.MEMORY_LIMITS.facts,heavy:e.filter(e=>e.factCount>i.MEMORY_LIMITS.factsPerNote)})],54282)},316172,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(54282),s=e.i(353885),l=e.i(944971),h=e.i(889034),c=e.i(378884),d=e.i(41444),u=t([c]);[c]=u.then?(await u)():u;let w=n.string().describe("Its label or id."),p={description:"Start a new thread: hand work to a bot. Returns a receipt at once; the work runs in the background and its updates reach the conversation on their own.",parameters:n.object({bot:n.string().describe("A name from the bot list."),request:n.string().describe("The whole of the work. The bot cannot hear the call, so everything it needs goes here — names, paths, what the user actually asked for — in their own language and their own words: it is the only language the bot has, and whatever it writes comes back to them. **Their request, never your reading of it**: a condition, a caution or a smaller goal they did not say is how work comes back as the wrong thing. When their words leave a real choice open, ask them on the call and put the answer here."),label:n.string().describe("Two or three words naming the thread, in the user's language. Used on screen and said out loud.")})},f={description:"Say something to a thread that exists. Its bot reads it with everything the thread already holds.",parameters:n.object({thread:w,words:n.string().describe("What to tell its bot, in the user's language and words.")})},y={description:`Answer a question a bot asked the user. Only for a question that is waiting; anything else said to a thread is \`${s.TOOL_NAMES.thread_tell}\`.`,parameters:n.object({thread:w,bot:n.string().describe("The bot that asked."),answer:n.string().describe("The user's answer, in their words.")})},g={description:`Read threads as they are now. "all" lists up to ${r.THREAD_STATUS_LIMIT}, running and waiting work before recent endings; a label or an id reads that one whole, with its result and any question waiting.`,parameters:n.object({thread:n.string().describe('"all", or one thread by its label or its id.')})},b={description:"Stop a thread now: its bot stops where it is. The thread is kept, and saying more to it later carries it on.",parameters:n.object({thread:w})},S={description:"Put a thread in front of the user on their screen: the file it made, or the thread itself when it made none. Showing it also counts as them having seen its result.",parameters:n.object({thread:w})},T={description:"Mark a thread's result as seen by the user. It leaves the work waiting on them.",parameters:n.object({thread:w})},O={description:"Send a message to another bot or to Thursday; the delivery receipt comes back immediately. A bot answers with the final text of its turn, which reaches you later as a new message. Mark a question for Thursday to request user input; ordinary messages to Thursday are notifications and need no answer.",parameters:h.RoomMessageSchema.extend({kind:h.RoomMessageSchema.shape.kind.describe("Use question only when Thursday must obtain an answer from the user: it ends your turn, and you continue when the answer arrives. Use message for bot collaboration, progress updates and reports."),options:h.RoomMessageSchema.shape.options.describe("With a question, offer concise answer choices when useful. Omit for an open-ended question; the user can always type their own answer."),to:n.string().trim().min(1).describe("A bot from the roster other than the one you are answering, or Thursday to reach the user."),text:n.string().trim().min(1).describe("Write the message and include the context the recipient needs. A question to Thursday is put to the user word for word, on screen, on their phone and read aloud: write it to them."),why:n.string().trim().min(1).describe("What you need from them, in a few words, written for the user to read: they see who was brought in and what for.")})}
|
|
7
|
+
What they tell you is kept, so you know them better over time.`,"tidying",0,e=>({crowded:e.reduce((e,t)=>e+t.factCount,0)>i.MEMORY_LIMITS.facts,heavy:e.filter(e=>e.factCount>i.MEMORY_LIMITS.factsPerNote)}),"todayLine",0,(e=new Date)=>`**Today**: ${d(e)}, ${Intl.DateTimeFormat().resolvedOptions().timeZone} — \`date\` has the exact time`],54282)},316172,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(54282),s=e.i(353885),l=e.i(944971),h=e.i(889034),c=e.i(378884),d=e.i(41444),u=t([c]);[c]=u.then?(await u)():u;let w=n.string().describe("Its label or id."),p={description:"Start a new thread: hand work to a bot. Returns a receipt at once; the work runs in the background and its updates reach the conversation on their own.",parameters:n.object({bot:n.string().describe("A name from the bot list."),request:n.string().describe("The whole of the work. The bot cannot hear the call, so everything it needs goes here — names, paths, what the user actually asked for — in their own language and their own words: it is the only language the bot has, and whatever it writes comes back to them. **Their request, never your reading of it**: a condition, a caution or a smaller goal they did not say is how work comes back as the wrong thing. When their words leave a real choice open, ask them on the call and put the answer here."),label:n.string().describe("Two or three words naming the thread, in the user's language. Used on screen and said out loud.")})},f={description:"Say something to a thread that exists. Its bot reads it with everything the thread already holds.",parameters:n.object({thread:w,words:n.string().describe("What to tell its bot, in the user's language and words.")})},y={description:`Answer a question a bot asked the user. Only for a question that is waiting; anything else said to a thread is \`${s.TOOL_NAMES.thread_tell}\`.`,parameters:n.object({thread:w,bot:n.string().describe("The bot that asked."),answer:n.string().describe("The user's answer, in their words.")})},g={description:`Read threads as they are now. "all" lists up to ${r.THREAD_STATUS_LIMIT}, running and waiting work before recent endings; a label or an id reads that one whole, with its result and any question waiting.`,parameters:n.object({thread:n.string().describe('"all", or one thread by its label or its id.')})},b={description:"Stop a thread now: its bot stops where it is. The thread is kept, and saying more to it later carries it on.",parameters:n.object({thread:w})},S={description:"Put a thread in front of the user on their screen: the file it made, or the thread itself when it made none. Showing it also counts as them having seen its result.",parameters:n.object({thread:w})},T={description:"Mark a thread's result as seen by the user. It leaves the work waiting on them.",parameters:n.object({thread:w})},O={description:"Send a message to another bot or to Thursday; the delivery receipt comes back immediately. A bot answers with the final text of its turn, which reaches you later as a new message. Mark a question for Thursday to request user input; ordinary messages to Thursday are notifications and need no answer.",parameters:h.RoomMessageSchema.extend({kind:h.RoomMessageSchema.shape.kind.describe("Use question only when Thursday must obtain an answer from the user: it ends your turn, and you continue when the answer arrives. Use message for bot collaboration, progress updates and reports."),options:h.RoomMessageSchema.shape.options.describe("With a question, offer concise answer choices when useful. Omit for an open-ended question; the user can always type their own answer."),to:n.string().trim().min(1).describe("A bot from the roster other than the one you are answering, or Thursday to reach the user."),text:n.string().trim().min(1).describe("Write the message and include the context the recipient needs. A question to Thursday is put to the user word for word, on screen, on their phone and read aloud: write it to them."),why:n.string().trim().min(1).describe("What you need from them, in a few words, written for the user to read: they see who was brought in and what for.")})},k={description:"Open one of your other threads whole: what you were asked there and your last words in full.",parameters:n.object({id:n.string().describe("The id in brackets on its line under Your other threads.")})};async function m(e,t){let a=await (0,c.listBotWork)(e,t),n=[...a.open,...a.recent];if(!n.some(e=>e.cut))return{};let h=new Set;return{[s.TOOL_NAMES.thread_recall]:(0,i.tool)({description:k.description,inputSchema:k.parameters,execute:async({id:t})=>{let a=t.trim().replace(/^\[|\]$/g,"").toLowerCase(),i=n.find(e=>a.length>=4&&(e.id.startsWith(a)||e.label.toLowerCase()===a));if(!i)return`No thread "${t}" on your list. The ids there: ${n.filter(e=>e.cut).map(e=>(0,l.workHandle)(e.id)).join(", ")}.`;if(!i.cut)return"Its line already shows all of it.";if(h.has(i.id))return"Already opened above, this turn.";if(h.size>=r.BOT_WORK.reads)return`${r.BOT_WORK.reads} threads are open already this turn. Carry on with what you have.`;h.add(i.id);let s=await (0,c.readBotAsk)(e,i),u=i.said??"";return[(0,o.botWorkHead)(i,e),s?`You were asked: ${(0,d.clip)(s,r.BOT_WORK.asked)}`:"",`Your last words there:
|
|
8
8
|
${u.length>r.BOT_WORK.readChars?`${u.slice(0,r.BOT_WORK.readChars)}
|
|
9
9
|
[Cut here; the files it names hold the rest.]`:u}`].filter(Boolean).join("\n\n")}})}}e.s(["createThreadRecallTool",0,m,"sendMessageSpec",0,O,"threadAnswerSpec",0,y,"threadCancelSpec",0,b,"threadSeenSpec",0,T,"threadShowSpec",0,S,"threadStartSpec",0,p,"threadStatusSpec",0,g,"threadTellSpec",0,f]),a()}catch(e){a(e)}},!1),349047,e=>{"use strict";var t=e.i(847841),a=e.i(907855),i=e.i(353885);let n=Object.keys({A:[".##.","#..#","####","#..#","#..#"],B:["###.","#..#","###.","#..#","###."],C:[".###","#...","#...","#...",".###"],D:["###.","#..#","#..#","#..#","###."],E:["####","#...","###.","#...","####"],F:["####","#...","###.","#...","#..."],G:[".###","#...","#.##","#..#",".###"],H:["#..#","#..#","####","#..#","#..#"],I:["###",".#.",".#.",".#.","###"],J:["..##","...#","...#","#..#",".##."],K:["#..#","#.#.","##..","#.#.","#..#"],L:["#...","#...","#...","#...","####"],M:["#...#","##.##","#.#.#","#...#","#...#"],N:["#..#","##.#","#.##","#..#","#..#"],O:[".##.","#..#","#..#","#..#",".##."],P:["###.","#..#","###.","#...","#..."],Q:[".##.","#..#","#..#","#.#.",".#.#"],R:["###.","#..#","###.","#.#.","#..#"],S:[".###","#...",".##.","...#","###."],T:["###",".#.",".#.",".#.",".#."],U:["#..#","#..#","#..#","#..#",".##."],V:["#...#","#...#",".#.#.",".#.#.","..#.."],W:["#...#","#...#","#.#.#","##.##","#...#"],X:["#..#","#..#",".##.","#..#","#..#"],Y:["#.#","#.#",".#.",".#.",".#."],Z:["####","...#",".##.","#...","####"],0:[".##.","#.##","#..#","##.#",".##."],1:[".#.","##.",".#.",".#.","###"],2:["###.","...#",".##.","#...","####"],3:["###.","...#",".##.","...#","###."],4:["#..#","#..#","####","...#","...#"],5:["####","#...","###.","...#","###."],6:[".##.","#...","###.","#..#",".##."],7:["####","...#","..#.",".#..",".#.."],8:[".##.","#..#",".##.","#..#",".##."],9:[".##.","#..#",".###","...#",".##."],"!":["#","#","#",".","#"],"?":["###.","...#",".##.","....",".#.."],".":[".",".",".",".","#"],",":["..","..","..",".#","#."],"'":["#","#",".",".","."],"-":["...","...","###","...","..."],"+":["...",".#.","###",".#.","..."],":":[".","#",".","#","."],"(":[".#","#.","#.","#.",".#"],")":["#.",".#",".#",".#","#."],"<":["..#",".#.","#..",".#.","..#"],">":["#..",".#.","..#",".#.","#.."],"^":[".#.","#.#","...","...","..."],"~":["....",".#.#","#.#.","....","...."],"♥":[".#.#.","#####","#####",".###.","..#.."]," ":["..","..","..","..",".."]}).filter(e=>!/^[A-Z0-9 ]$/.test(e)),r={description:`End the call.
|
|
10
10
|
|
|
11
|
-
The line stays open until this runs, and drops once the goodbye being said is over.`,parameters:a.object({})},o=(0,t.tool)({description:r.description,inputSchema:r.parameters}),s={description:"Show a short word on your face for a few seconds.",parameters:a.object({text:a.string().describe(`Up to 8 characters: A-Z, 0-9, space and ${n.join(" ")}.`)})},l=(0,t.tool)({description:s.description,inputSchema:s.parameters});e.s(["callTools",0,function(){return{[i.TOOL_NAMES.end_call]:o,[i.TOOL_NAMES.emote]:l}}],349047)},625441,e=>{"use strict";var t=e.i(874533),a=e.i(912714),i=e.i(660526),n=e.i(750227),r=e.i(812057),o=e.i(847841),s=e.i(105249),l=e.i(687388),h=e.i(353885),c=e.i(629668),d=e.i(786025);let u=(0,n.join)(l.APP_DIR,l.PATHS.skills.default,"artifact",l.PATHS.skills.runtime,"deck","deck.mjs"),m=e=>s.default.string().trim().max(e),w=m(100).nullish().describe("A source or a date along the foot of the slide."),p=m(1500).nullish().describe("What the presenter says over it, as speech. Never shown."),f=s.default.object({layout:s.default.literal("cover"),title:m(110).describe("The deck's subject, as its title."),eyebrow:m(40).nullish().describe("A word or two above the title."),subtitle:m(180).nullish().describe("One line under the title."),footer:w,notes:p}),y=s.default.object({layout:s.default.literal("statement"),title:m(120).describe("The one claim, as a sentence."),subtitle:m(140).nullish().describe("One line under it."),notes:p}),g=s.default.object({layout:s.default.literal("cards"),title:m(90).describe("The point the cards make together."),cards:s.default.array(s.default.object({title:m(60).describe("Its point."),text:m(160).nullish().describe("One line under it.")})).min(2).max(4).describe("Two to four, side by side and numbered."),footer:w,notes:p}),b=s.default.object({layout:s.default.literal("number"),value:m(10).describe("The figure as it reads: 1.4M, 62%, £2,900. Only one you were given."),label:m(80).nullish().describe("What it counts, above it."),subtitle:m(160).nullish().describe("What it means or is compared with, under it."),footer:w,notes:p}),S=s.default.object({layout:s.default.literal("table"),title:m(90).describe("What the comparison shows."),columns:s.default.array(m(40)).min(2).max(5).describe("The header row. The first column names the rows; its header may be blank."),rows:s.default.array(s.default.array(m(60))).min(1).max(6).describe("Up to six, a cell for each column."),stress:s.default.number().int().min(0).max(4).nullish().describe("Which column, counted from 0, to set in the accent: the one the slide argues for."),footer:w,notes:p}),T=s.default.object({layout:s.default.literal("quote"),quote:m(280).describe("Someone's own words, exactly as you were given them. Never made up."),who:m(60).describe("Who said it."),role:m(80).nullish().describe("Their role, place or date."),notes:p}),O=s.default.object({layout:s.default.literal("image"),title:m(90).describe("The heading beside the picture."),subtitle:m(280).nullish().describe("A line or two under it."),image:m(500).describe("Workspace path of a png, jpg, webp, gif or svg. It is copied beside the deck."),alt:m(160).describe("What it shows, for someone who cannot see it."),fit:s.default.enum(["fill","whole"]).nullish().describe("fill crops a photo to its box; whole shows a chart or screenshot uncropped. Null for fill."),footer:w,notes:p}),$=s.default.object({layout:s.default.literal("close"),title:m(120).describe("The sentence to repeat to someone who was not there."),steps:s.default.array(s.default.object({label:m(24).describe("A word or two: Next, Owner, By."),text:m(120).describe("What it is.")})).max(3).nullish().describe("Up to three next steps."),notes:p}),k=s.default.object({layout:s.default.literal("timeline"),title:m(90).describe("What the dates show together."),steps:s.default.array(s.default.object({when:m(24).describe("When, as you were given it: a date, a week, a phase."),title:m(60).describe("What happens then."),text:m(120).nullish().describe("One line under it.")})).min(2).max(5).describe("Two to five, in order, along one line."),footer:w,notes:p}),_=s.default.object({layout:s.default.literal("compare"),title:m(90).describe("What changes between the two, as a sentence."),sides:s.default.array(s.default.object({label:m(30).describe("Which side it is: Now, After, Option A."),points:s.default.array(m(90)).min(1).max(4)})).length(2).describe("The two, left then right; the right is set in the accent: the side the slide argues for."),footer:w,notes:p}),v=s.default.object({layout:s.default.literal("stats"),title:m(90).describe("What the figures say together."),stats:s.default.array(s.default.object({value:m(12).describe("The figure as it reads: 1.4M, 62%, 6 hours. Only one you were given."),label:m(80).describe("What it counts, under it.")})).min(2).max(4).describe("Two to four figures side by side."),footer:w,notes:p}),A=s.default.discriminatedUnion("layout",[f,y,g,b,S,T,O,k,_,v,$]),M=s.default.object({deck:m(300).describe("A name for a new deck, or the name or workspace path of one to change. A deck another bot made is reached by its path."),title:m(90).describe("The deck's title, shown in its head."),theme:s.default.enum(["forest","sea","clay","ink"]).nullish().describe("forest (deep green on paper, serif headings), sea (blue, sans), clay (terracotta on warm paper, serif) or ink (gold on near-black, sans). Null keeps the deck's own; a new one starts in forest."),revision:s.default.string().nullish().describe("What the last call on this deck answered with. Null for a new deck."),slides:s.default.array(A).min(1).max(l.DECK.slides).describe("Every slide in order: the whole deck, each time. Someone who reads only the titles follows the argument; one idea a slide.")}),E=/^[\p{L}\p{N}][\p{L}\p{N}_-]{0,79}$/u,N=/^(slide-\d+|slides)\.png$/i;class x extends Error{}function L(e){let t=e.replace(/[^\p{L}\p{N}_-]+/gu,"-").replace(/^[-_]+|-+$/g,"").slice(0,80);if(!E.test(t))throw new x(`"${e}" is not a deck name: use letters, numbers, - and _.`);return t}async function j(e,t){let i=(0,d.botArtifacts)(t);if(!e.includes("/")&&!e.endsWith(".html")){let t=L(e);return`${i}/${t}/${t}.html`}let r=await (0,d.insideWorkspace)(e);if(!r)throw new x(`${e} is outside the workspace. Give a deck's path in it.`);let o=await (0,a.realpath)(d.WORKSPACE).catch(()=>d.WORKSPACE),s=await (0,a.stat)(r).catch(()=>null),l=s?.isDirectory()?(0,n.join)(r,`${(0,n.basename)(r)}.html`):r;if((await (0,a.stat)(l).catch(()=>null))?.isFile())return(0,n.relative)(o,l);let h=await (0,d.insideWorkspace)(i);if(!h||!r.startsWith(`${h}${n.sep}`))throw new x(`There is no deck at ${e}. A new deck is made in your own folder: give it a name.`);let c=L((0,n.basename)(r,".html"));return(0,n.relative)(o,(0,n.join)((0,n.dirname)(r),c,`${c}.html`))}async function R(e,t,i){let r=new Map,o=[];for(let[s,l]of e.entries()){if("table"===l.layout){let e=l.rows.findIndex(e=>e.length>l.columns.length);if(-1!==e)throw new x(`Slide ${s+1}: row ${e+1} has ${l.rows[e].length} cells, and there are ${l.columns.length} columns.`);o.push({...l,rows:l.rows.map(e=>l.columns.map((t,a)=>e[a]??""))});continue}if("image"!==l.layout){o.push(l);continue}let e=t.resolve(i),h=(0,n.join)(e,l.image),d=!l.image.includes("/")&&await (0,a.stat)(h).catch(()=>null)?h:t.resolve(l.image);if("image"!==(0,c.viewKindOf)(d))throw new x(`Slide ${s+1}: ${l.image} is not a picture. Give a png, jpg, webp, gif or svg.`);if(!(await (0,a.stat)(d).catch(()=>null))?.isFile())throw new x(`Slide ${s+1}: there is no file at ${l.image}. Give its path from the workspace root, as \`ls\` shows it.`);let u=r.get(d);u||(u=(0,n.dirname)(d)===e?(0,n.basename)(d):function(e,t){let a=(0,n.extname)(e),i=(0,n.basename)(e,a),r=N.test(e)?`picture-${i}`:i,o=`${r}${a}`;for(let e=2;t.has(o);e++)o=`${r}-${e}${a}`;return o}((0,n.basename)(d),new Set(r.values())),r.set(d,u),(0,n.dirname)(d)!==e&&(await (0,a.mkdir)(e,{recursive:!0}),await (0,a.copyFile)(d,(0,n.join)(e,u)))),o.push({...l,image:u})}return o}let I=(0,r.promisify)(t.execFile);async function C(e,t,r,o,s){let l=await (0,a.mkdtemp)((0,n.join)((0,i.tmpdir)(),"thursday-deck-"));try{let i=(0,n.join)(l,"deck.json");await (0,a.writeFile)(i,JSON.stringify(t));let h=[u,"put",(0,n.join)(d.WORKSPACE,e),i];r&&h.push("--revision",r);let c=await I(process.execPath,h,{env:{NODE_ENV:"production",PATH:process.env.PATH??"",THURSDAY_BOT:o,...s?{THURSDAY_BOT_MARK:s}:{}},maxBuffer:0x1000000}).catch(e=>{if(3===e.code&&e.stdout)return{stdout:e.stdout};throw new x(e.stderr?.trim().split("\n").at(-1)||"The deck could not be written.")});return JSON.parse(c.stdout.trim().split("\n").at(-1)??"")}finally{await (0,a.rm)(l,{recursive:!0,force:!0})}}async function W(e,t,a,i){let r=await e.exec('node "$DECK_SCRIPT" shots "$DECK_FILE"',{env:{...a,DECK_SCRIPT:u,DECK_FILE:(0,n.join)(d.WORKSPACE,t)},timeoutMs:l.DECK.shotsMs,signal:i});if(0!==r.exitCode)return{failed:r.stderr.trim().split("\n").at(-1)||"no pictures were made"};let o=JSON.parse(r.stdout.trim().split("\n").at(-1)??"{}");return{pictures:o.pictures.map(e=>(0,n.relative)(d.WORKSPACE,e)),sheet:o.sheet?(0,n.relative)(d.WORKSPACE,o.sheet):null,cut:o.cut}}e.s(["createDeckTools",0,(e,t,i,r)=>({[h.TOOL_NAMES.make_deck]:(0,o.tool)({description:"Make a slide deck, or change one: each slide a layout whose fields you fill, drawn and fitted by the app into one HTML file that opens offline, presents full screen and prints a slide a page, with a picture of every slide beside it.",inputSchema:M,execute:async(a,{abortSignal:r})=>{try{let o,s=await j(a.deck,t),l=await R(a.slides,e,(0,n.dirname)(s)),c=await C(s,{title:a.title,theme:a.theme??null,slides:l},a.revision?.trim()??"",t,i.THURSDAY_BOT_MARK);if("changed"in c){if(!c.deck)return`${s} is not a deck made of slides, so it cannot be changed here. Give the deck another name.`;let e=a.revision?.trim()?`${s} has changed since that revision — edited in the app, or by another job`:`there is already a deck at ${s}`;return{deck:s,revision:c.revision,note:`Nothing was written: ${e}. This is the deck as it stands. To change it, make your change on these slides and call \`${h.TOOL_NAMES.make_deck}\` again with revision ${c.revision} and the whole deck; for a deck of its own, give a new name.`,current:c.deck}}let d=`${l.length} slide${1===l.length?"":"s"}, revision ${c.revision}`,u=await W(e,s,i,r);if("failed"in u)return`${s}
|
|
11
|
+
The line stays open until this runs, and drops once the goodbye being said is over.`,parameters:a.object({})},o=(0,t.tool)({description:r.description,inputSchema:r.parameters}),s={description:"Show a short word on your face for a few seconds.",parameters:a.object({text:a.string().describe(`Up to 8 characters: A-Z, 0-9, space and ${n.join(" ")}.`)})},l=(0,t.tool)({description:s.description,inputSchema:s.parameters});e.s(["callTools",0,function(){return{[i.TOOL_NAMES.end_call]:o,[i.TOOL_NAMES.emote]:l}}],349047)},625441,e=>{"use strict";var t=e.i(874533),a=e.i(912714),i=e.i(660526),n=e.i(750227),r=e.i(812057),o=e.i(847841),s=e.i(105249),l=e.i(687388),h=e.i(353885),c=e.i(629668),d=e.i(786025);let u=(0,n.join)(l.APP_DIR,l.PATHS.skills.default,"artifact",l.PATHS.skills.runtime,"deck","deck.mjs"),m=e=>s.default.string().trim().max(e),w=m(100).nullish().describe("A source or a date along the foot of the slide."),p=m(1500).nullish().describe("What the presenter says over it, as speech. Never shown."),f=s.default.object({layout:s.default.literal("cover"),title:m(110).describe("The deck's subject, as its title."),eyebrow:m(40).nullish().describe("A word or two above the title."),subtitle:m(180).nullish().describe("One line under the title."),footer:w,notes:p}),y=s.default.object({layout:s.default.literal("statement"),title:m(120).describe("The one claim, as a sentence."),subtitle:m(140).nullish().describe("One line under it."),notes:p}),g=s.default.object({layout:s.default.literal("cards"),title:m(90).describe("The point the cards make together."),cards:s.default.array(s.default.object({title:m(60).describe("Its point."),text:m(160).nullish().describe("One line under it.")})).min(2).max(4).describe("Two to four, side by side and numbered."),footer:w,notes:p}),b=s.default.object({layout:s.default.literal("number"),value:m(10).describe("The figure as it reads: 1.4M, 62%, £2,900. Only one you were given."),label:m(80).nullish().describe("What it counts, above it."),subtitle:m(160).nullish().describe("What it means or is compared with, under it."),footer:w,notes:p}),S=s.default.object({layout:s.default.literal("table"),title:m(90).describe("What the comparison shows."),columns:s.default.array(m(40)).min(2).max(5).describe("The header row. The first column names the rows; its header may be blank."),rows:s.default.array(s.default.array(m(60))).min(1).max(6).describe("Up to six, a cell for each column."),stress:s.default.number().int().min(0).max(4).nullish().describe("Which column, counted from 0, to set in the accent: the one the slide argues for."),footer:w,notes:p}),T=s.default.object({layout:s.default.literal("quote"),quote:m(280).describe("Someone's own words, exactly as you were given them. Never made up."),who:m(60).describe("Who said it."),role:m(80).nullish().describe("Their role, place or date."),notes:p}),O=s.default.object({layout:s.default.literal("image"),title:m(90).describe("The heading beside the picture."),subtitle:m(280).nullish().describe("A line or two under it."),image:m(500).describe("Workspace path of a png, jpg, webp, gif or svg. It is copied beside the deck."),alt:m(160).describe("What it shows, for someone who cannot see it."),fit:s.default.enum(["fill","whole"]).nullish().describe("fill crops a photo to its box; whole shows a chart or screenshot uncropped. Null for fill."),footer:w,notes:p}),k=s.default.object({layout:s.default.literal("close"),title:m(120).describe("The sentence to repeat to someone who was not there."),steps:s.default.array(s.default.object({label:m(24).describe("A word or two: Next, Owner, By."),text:m(120).describe("What it is.")})).max(3).nullish().describe("Up to three next steps."),notes:p}),$=s.default.object({layout:s.default.literal("timeline"),title:m(90).describe("What the dates show together."),steps:s.default.array(s.default.object({when:m(24).describe("When, as you were given it: a date, a week, a phase."),title:m(60).describe("What happens then."),text:m(120).nullish().describe("One line under it.")})).min(2).max(5).describe("Two to five, in order, along one line."),footer:w,notes:p}),_=s.default.object({layout:s.default.literal("compare"),title:m(90).describe("What changes between the two, as a sentence."),sides:s.default.array(s.default.object({label:m(30).describe("Which side it is: Now, After, Option A."),points:s.default.array(m(90)).min(1).max(4)})).length(2).describe("The two, left then right; the right is set in the accent: the side the slide argues for."),footer:w,notes:p}),v=s.default.object({layout:s.default.literal("stats"),title:m(90).describe("What the figures say together."),stats:s.default.array(s.default.object({value:m(12).describe("The figure as it reads: 1.4M, 62%, 6 hours. Only one you were given."),label:m(80).describe("What it counts, under it.")})).min(2).max(4).describe("Two to four figures side by side."),footer:w,notes:p}),A=s.default.discriminatedUnion("layout",[f,y,g,b,S,T,O,$,_,v,k]),M=s.default.object({deck:m(300).describe("A name for a new deck, or the name or workspace path of one to change. A deck another bot made is reached by its path."),title:m(90).describe("The deck's title, shown in its head."),theme:s.default.enum(["forest","sea","clay","ink"]).nullish().describe("forest (deep green on paper, serif headings), sea (blue, sans), clay (terracotta on warm paper, serif) or ink (gold on near-black, sans). Null keeps the deck's own; a new one starts in forest."),revision:s.default.string().nullish().describe("What the last call on this deck answered with. Null for a new deck."),slides:s.default.array(A).min(1).max(l.DECK.slides).describe("Every slide in order: the whole deck, each time. Someone who reads only the titles follows the argument; one idea a slide.")}),E=/^[\p{L}\p{N}][\p{L}\p{N}_-]{0,79}$/u,N=/^(slide-\d+|slides)\.png$/i;class x extends Error{}function L(e){let t=e.replace(/[^\p{L}\p{N}_-]+/gu,"-").replace(/^[-_]+|-+$/g,"").slice(0,80);if(!E.test(t))throw new x(`"${e}" is not a deck name: use letters, numbers, - and _.`);return t}async function j(e,t){let i=(0,d.botArtifacts)(t);if(!e.includes("/")&&!e.endsWith(".html")){let t=L(e);return`${i}/${t}/${t}.html`}let r=await (0,d.insideWorkspace)(e);if(!r)throw new x(`${e} is outside the workspace. Give a deck's path in it.`);let o=await (0,a.realpath)(d.WORKSPACE).catch(()=>d.WORKSPACE),s=await (0,a.stat)(r).catch(()=>null),l=s?.isDirectory()?(0,n.join)(r,`${(0,n.basename)(r)}.html`):r;if((await (0,a.stat)(l).catch(()=>null))?.isFile())return(0,n.relative)(o,l);let h=await (0,d.insideWorkspace)(i);if(!h||!r.startsWith(`${h}${n.sep}`))throw new x(`There is no deck at ${e}. A new deck is made in your own folder: give it a name.`);let c=L((0,n.basename)(r,".html"));return(0,n.relative)(o,(0,n.join)((0,n.dirname)(r),c,`${c}.html`))}async function R(e,t,i){let r=new Map,o=[];for(let[s,l]of e.entries()){if("table"===l.layout){let e=l.rows.findIndex(e=>e.length>l.columns.length);if(-1!==e)throw new x(`Slide ${s+1}: row ${e+1} has ${l.rows[e].length} cells, and there are ${l.columns.length} columns.`);o.push({...l,rows:l.rows.map(e=>l.columns.map((t,a)=>e[a]??""))});continue}if("image"!==l.layout){o.push(l);continue}let e=t.resolve(i),h=(0,n.join)(e,l.image),d=!l.image.includes("/")&&await (0,a.stat)(h).catch(()=>null)?h:t.resolve(l.image);if("image"!==(0,c.viewKindOf)(d))throw new x(`Slide ${s+1}: ${l.image} is not a picture. Give a png, jpg, webp, gif or svg.`);if(!(await (0,a.stat)(d).catch(()=>null))?.isFile())throw new x(`Slide ${s+1}: there is no file at ${l.image}. Give its path from the workspace root, as \`ls\` shows it.`);let u=r.get(d);u||(u=(0,n.dirname)(d)===e?(0,n.basename)(d):function(e,t){let a=(0,n.extname)(e),i=(0,n.basename)(e,a),r=N.test(e)?`picture-${i}`:i,o=`${r}${a}`;for(let e=2;t.has(o);e++)o=`${r}-${e}${a}`;return o}((0,n.basename)(d),new Set(r.values())),r.set(d,u),(0,n.dirname)(d)!==e&&(await (0,a.mkdir)(e,{recursive:!0}),await (0,a.copyFile)(d,(0,n.join)(e,u)))),o.push({...l,image:u})}return o}let I=(0,r.promisify)(t.execFile);async function C(e,t,r,o,s){let l=await (0,a.mkdtemp)((0,n.join)((0,i.tmpdir)(),"thursday-deck-"));try{let i=(0,n.join)(l,"deck.json");await (0,a.writeFile)(i,JSON.stringify(t));let h=[u,"put",(0,n.join)(d.WORKSPACE,e),i];r&&h.push("--revision",r);let c=await I(process.execPath,h,{env:{NODE_ENV:"production",PATH:process.env.PATH??"",THURSDAY_BOT:o,...s?{THURSDAY_BOT_MARK:s}:{}},maxBuffer:0x1000000}).catch(e=>{if(3===e.code&&e.stdout)return{stdout:e.stdout};throw new x(e.stderr?.trim().split("\n").at(-1)||"The deck could not be written.")});return JSON.parse(c.stdout.trim().split("\n").at(-1)??"")}finally{await (0,a.rm)(l,{recursive:!0,force:!0})}}async function W(e,t,a,i){let r=await e.exec('node "$DECK_SCRIPT" shots "$DECK_FILE"',{env:{...a,DECK_SCRIPT:u,DECK_FILE:(0,n.join)(d.WORKSPACE,t)},timeoutMs:l.DECK.shotsMs,signal:i});if(0!==r.exitCode)return{failed:r.stderr.trim().split("\n").at(-1)||"no pictures were made"};let o=JSON.parse(r.stdout.trim().split("\n").at(-1)??"{}");return{pictures:o.pictures.map(e=>(0,n.relative)(d.WORKSPACE,e)),sheet:o.sheet?(0,n.relative)(d.WORKSPACE,o.sheet):null,cut:o.cut}}e.s(["createDeckTools",0,(e,t,i,r)=>({[h.TOOL_NAMES.make_deck]:(0,o.tool)({description:"Make a slide deck, or change one: each slide a layout whose fields you fill, drawn and fitted by the app into one HTML file that opens offline, presents full screen and prints a slide a page, with a picture of every slide beside it.",inputSchema:M,execute:async(a,{abortSignal:r})=>{try{let o,s=await j(a.deck,t),l=await R(a.slides,e,(0,n.dirname)(s)),c=await C(s,{title:a.title,theme:a.theme??null,slides:l},a.revision?.trim()??"",t,i.THURSDAY_BOT_MARK);if("changed"in c){if(!c.deck)return`${s} is not a deck made of slides, so it cannot be changed here. Give the deck another name.`;let e=a.revision?.trim()?`${s} has changed since that revision — edited in the app, or by another job`:`there is already a deck at ${s}`;return{deck:s,revision:c.revision,note:`Nothing was written: ${e}. This is the deck as it stands. To change it, make your change on these slides and call \`${h.TOOL_NAMES.make_deck}\` again with revision ${c.revision} and the whole deck; for a deck of its own, give a new name.`,current:c.deck}}let d=`${l.length} slide${1===l.length?"":"s"}, revision ${c.revision}`,u=await W(e,s,i,r);if("failed"in u)return`${s}
|
|
12
12
|
${d}. The pictures of its slides could not be made (${u.failed}), so nothing checked that every slide fits. Hand back the deck's path.`;let m=`call \`${h.TOOL_NAMES.make_deck}\` again with revision ${c.revision} and the whole deck`,w=u.sheet?`${(0,n.basename)(u.sheet)} holds every slide, numbered, and each is on its own beside it from slide-01.png`:"Its pictures are beside it, slide-01.png on";return[s,u.sheet??u.pictures[0]??"",u.cut.length?`${d}. ${o=u.cut,1===o.length?`Slide ${o[0]} does`:`Slides ${o.slice(0,-1).join(", ")} and ${o.at(-1)} do`} not fit even with the type at its smallest: say less there, then ${m}. ${w}.`:`${d}. Every slide fits. ${w}. Hand back the deck's path; to change it, ${m}.`].filter(Boolean).join("\n")}catch(e){if(e instanceof x)return e.message;throw e}},toModelOutput:async({output:e})=>{if("string"!=typeof e)return{type:"json",value:e};let t=e.split("\n")[1]??"";if(!r||!t.endsWith(".png"))return{type:"text",value:e};let i=await (0,d.insideWorkspace)(t),n=i?await (0,a.readFile)(i).catch(()=>null):null;return!n||n.byteLength>l.LOOK.maxBytes?{type:"text",value:e}:{type:"content",value:[{type:"text",text:`${e}
|
|
13
13
|
|
|
14
14
|
${t}, as an image:`},{type:"file",mediaType:"image/png",data:{type:"data",data:n.toString("base64")}}]}}})})])},170801,e=>{"use strict";var t=e.i(912714),a=e.i(847841),i=e.i(105249),n=e.i(687388),r=e.i(353885),o=e.i(629668),s=e.i(786025);e.s(["createLookTool",0,function(){return{[r.TOOL_NAMES.look_at]:(0,a.tool)({description:"See an image file yourself: a screenshot you took, a picture the user handed over, a chart you made. For what a picture shows — text files are read in the shell.",inputSchema:i.default.object({path:i.default.string().describe("Workspace-relative path to a png, jpg, webp or gif.")}),execute:async({path:e})=>{let a=await (0,s.insideWorkspace)(e.trim()),i=a?await (0,t.stat)(a).catch(()=>null):null;return a&&i?.isFile()?"image"!==(0,o.viewKindOf)(e)?`${e} is not an image. Read it in the shell instead.`:i.size>n.LOOK.maxBytes?`${e} is ${Math.ceil(i.size/1024/1024)} MB, over the ${n.LOOK.maxBytes/1024/1024} MB one look takes. Make a smaller copy in the shell first (on a Mac: sips -Z 1600 in.png --out out.png), then look at that.`:{path:e.trim(),mediaType:(0,o.mimeOf)(e)}:`There is no file at ${e}. Give the path from the workspace root, as \`ls\` shows it.`},toModelOutput:async({output:e})=>{if("string"==typeof e)return{type:"text",value:e};let a=await (0,s.insideWorkspace)(e.path),i=a?await (0,t.readFile)(a).catch(()=>null):null;return i?{type:"content",value:[{type:"text",text:`${e.path}, as an image:`},{type:"file",mediaType:e.mediaType,data:{type:"data",data:i.toString("base64")}}]}:{type:"text",value:`${e.path} is no longer there.`}}})}}])},926435,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(353885),s=e.i(148831),l=e.i(786025),h=e.i(660948),c=t([s,h]);[s,h]=c.then?(await c)():c;let m={[o.TOOL_NAMES.tool_search]:{description:`Return the description and exact inputSchema of tools on a connected server, so they can be called with \`${o.TOOL_NAMES.tool_call}\`.`,parameters:n.object({server:n.string().describe("A server name, exactly as the Connected tools section writes it."),tools:n.string().array().describe(`Tool names listed under that server. Only the ones you may actually call — schemas are large, and at most ${r.TOOL_SEARCH_SCHEMAS} come back.`)})},[o.TOOL_NAMES.tool_call]:{description:`Run one tool whose definition came back from \`${o.TOOL_NAMES.tool_search}\`.`,parameters:n.object({server:n.string().describe("The server the tool lives on."),tool:n.string().describe("Its name, as search returned it."),args:n.looseObject({}).nullish().describe("Arguments matching the inputSchema search returned — do not guess. Null when it takes none."),description:n.string().nullish().describe("One short line for the user: what this call is for. Shown on their screen while it runs.")})}},w=(e,t)=>`${e.replace(/[^a-zA-Z0-9]+/g,"_")}__${t.replace(/[^a-zA-Z0-9_-]+/g,"_")}`.slice(0,64);async function d(e,t){let[a,n]=await Promise.all([(0,h.listConnectedToolNames)(),(0,s.findPinnedTools)(e)]),r={},o=(0,l.botArtifacts)(e);for(let e of n){let a=w(e.server,e.name);r[a]||(r[a]=(0,i.tool)({description:e.description??`${e.name} on the ${e.server} server.`,inputSchema:(0,i.jsonSchema)(e.inputSchema??{type:"object",properties:{}}),execute:(a,{abortSignal:i})=>(0,h.callConnectedTool)(t,e.server,e.name,a??void 0,{artifacts:o,abortSignal:i})}))}return a.length>n.length&&Object.assign(r,p(t,o)),r}async function u(e){let t=(await (0,h.listConnectedToolNames)(e)).map(e=>e.name);if(t.length)return`Tools on "${e}": ${t.join(", ")}.`;let a=await (0,h.listConnectedServerNames)();return a.length?`There is no server called "${e}". Connected: ${a.join(", ")}.`:"Nothing is connected."}let p=(e,t)=>({[o.TOOL_NAMES.tool_search]:(0,i.tool)({description:m[o.TOOL_NAMES.tool_search].description,inputSchema:m[o.TOOL_NAMES.tool_search].parameters,execute:async({server:e,tools:t})=>{let a=[...new Set(t.map(e=>e.trim()).filter(Boolean))],i=a.slice(0,r.TOOL_SEARCH_SCHEMAS),n=await (0,h.findConnectedSchemas)(e.trim(),i);if(!n.length)return{tools:[],note:await u(e)};let o=i.filter(e=>!n.some(t=>t.name===e)),s=a.slice(r.TOOL_SEARCH_SCHEMAS),l=[o.length?`Not on "${e}": ${o.join(", ")}.`:"",s.length?`Only ${r.TOOL_SEARCH_SCHEMAS} at a time — ask again for: ${s.join(", ")}.`:""].filter(Boolean);return{tools:n,...l.length?{note:l.join(" ")}:{}}}}),[o.TOOL_NAMES.tool_call]:(0,i.tool)({description:m[o.TOOL_NAMES.tool_call].description,inputSchema:m[o.TOOL_NAMES.tool_call].parameters,execute:async({server:a,tool:i,args:n},{abortSignal:r})=>(await (0,h.listConnectedToolNames)(a.trim())).some(e=>e.name===i.trim())?(0,h.callConnectedTool)(e,a.trim(),i.trim(),n??void 0,{artifacts:t,abortSignal:r}):{status:"error",text:await u(a)}})});e.s(["createMcpTools",0,d]),a()}catch(e){a(e)}},!1),770639,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(54282),s=e.i(353885),l=e.i(619898),h=e.i(453569),c=t([l]);[l]=c.then?(await c)():c;let d=h.MEMORY_PATHS.map(e=>e.path.endsWith("/")?`${e.path}<name>`:e.path).join(", "),u="Saved. The listing in your instructions is from when this session opened and will not show this until the next one — the note below is current.",m=e=>`Nothing on the listing called ${e}.`,w=e=>({...e,facts:e.facts.map(({saidAt:e,...t})=>e?{...t,said:(0,o.saidStamp)(e)}:t),factCount:e.facts.length}),p=e=>e>r.MEMORY_LIMITS.factsPerNote?` This note now holds ${e} facts, past the ${r.MEMORY_LIMITS.factsPerNote} one note holds well. Ask the user which of it is no longer true and delete what they name.`:"",f=e=>e.length>r.MEMORY_LIMITS.descriptionChars?{note:`That line runs to ${e.length} characters; a note's line is one line, under ${r.MEMORY_LIMITS.descriptionChars}. Say what the note is about — the facts inside say the rest.`}:null,y=n.string().describe("Exactly as the listing writes it — the path."),g=n.string().describe('One statement that stands on its own later — a date as a date, never "next week".');e.s(["createMemoryTools",0,(e,t=null,{countReads:a=!0,tidies:r=!0}={})=>({[s.TOOL_NAMES.memory_recall]:(0,i.tool)({description:"Open one note from the listing, whole.",inputSchema:n.object({path:y}),execute:async({path:e})=>{let{notes:t}=await (0,l.readNotes)([e],{touch:a}),i=t[0];if(!i)return{note:m(e.trim())};let n=r?p(i.facts.length):"";return n?{...w(i),note:n.trim()}:w(i)}}),[s.TOOL_NAMES.memory_create]:(0,i.tool)({description:"Start a note for a subject that is not on the listing: its path, the line it is listed by, and its first facts.",inputSchema:n.object({path:n.string().describe(`A new path following the listing's convention — one of ${d} — for the person, project or topic the facts are about. A fact goes under the one note it is about; other notes name it rather than repeat it.`),description:n.string().describe("One line saying what this note is about, with the names the user calls it by, so the listing alone tells whether to open it. What it is about — never a list of what is inside."),facts:n.object({text:g}).array().min(1).describe("What to keep under it. Send everything that came up at once: one call is one pause in the conversation, three calls are three.")}),execute:async({path:a,description:i,facts:n})=>{let r=a.trim(),o=i.trim();if(!(0,h.isMemoryPath)(r))return{note:`Nothing was saved: "${r}" is not a path this listing can carry. Write it again under one of ${d}.`};if((0,h.isAlwaysListed)(r))return{note:`${r} is always on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it.`};let c=f(o);if(c)return c;let m=await (0,l.createNoteWithFacts)(r,o,n,e,t);if(!m)return{note:`${r} is already on the listing: \`${s.TOOL_NAMES.memory_remember}\` adds to it, \`${s.TOOL_NAMES.memory_describe}\` changes its line.`};let y=w(m);return{...y,note:`${u}${p(y.factCount)}`}}}),[s.TOOL_NAMES.memory_remember]:(0,i.tool)({description:"Write facts under a note that is on the listing.",inputSchema:n.object({path:y,facts:n.object({text:g,replaces:n.number().int().nullish().describe(`The id of the fact this replaces — from this note as handed back here or by \`${s.TOOL_NAMES.memory_recall}\`. Null if this is new. A fact that stopped being true is replaced rather than deleted, and so is a note saying the same thing twice: replacing keeps what changed on the record, deleting does not.`)}).array().min(1).describe("What to write under this note. Send everything that came up at once: one call is one pause in the conversation, three calls are three.")}),execute:async({path:a,facts:i})=>{let n=a.trim(),r=await (0,l.writeFacts)(n,i,e,t);if(!r)return{note:`${m(n)} A subject that is not on the listing gets a note of its own: \`${s.TOOL_NAMES.memory_create}\`, with its line.`};let o=w(r);return{...o,note:`${u}${p(o.factCount)}`}}}),[s.TOOL_NAMES.memory_describe]:(0,i.tool)({description:"Change the line a note is listed by, when it no longer says what the note is about.",inputSchema:n.object({path:y,description:n.string().describe("The new line, whole: what this note is about, with the names the user calls it by. Never a list of what is inside.")}),execute:async({path:e,description:t})=>{let a=e.trim(),i=t.trim();if((0,h.isAlwaysListed)(a))return{note:`${h.MEMORY_ALWAYS_LISTED.join(" and ")} keep their own line; it is not yours to change.`};let n=f(i);return n||(await (0,l.describeNote)(a,i)?{path:a,description:i,note:"Renamed. The listing in your instructions is from when this session opened and still shows the old line until the next one."}:{note:m(a)})}}),[s.TOOL_NAMES.memory_forget]:(0,i.tool)({description:"Delete facts for good.",inputSchema:n.object({factIds:n.number().int().array().min(1).describe("The ids that came with the facts when their notes were opened — every one to delete, in one call.")}),execute:async({factIds:e})=>{let t=[],a=[],i=new Set;for(let n of new Set(e)){let e=await (0,l.forgetFactById)(n);if(!e){t.push(n);continue}e.noteGone?(i.delete(e.path),a.push(e.path)):i.add(e.path)}if(!a.length&&!i.size)return{note:`No fact with id ${t.join(", ")}. Nothing was deleted.`};let n=["Deleted for good. The listing in your instructions is from when this session opened and still shows it that way until the next one.",1===a.length?`That was the last fact under ${a[0]}, so the note went with it.`:a.length?`That was the last of ${a.join(", ")}, so those notes went with them.`:"",t.length?`No fact with id ${t.join(", ")}, so those were skipped.`:""].filter(Boolean).join(" ");if(!i.size)return{note:n};let{notes:r}=await (0,l.readNotes)([...i],{touch:!1});return{notes:r.map(w),note:n}}})})]),a()}catch(e){a(e)}},!1),418919,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(907855),r=e.i(687388),o=e.i(353885),s=e.i(265143),l=e.i(963219),h=e.i(473139),c=e.i(704161),d=e.i(53748),u=e.i(41444),m=t([s,l]);[s,l]=m.then?(await m)():m;let f={description:`Routines: work that starts by itself, each one a bot, the work and a time — once at a moment, a time of day on chosen days, or every few hours. List them, make one, change one, or delete one. Every start opens a thread like one started by hand; its result reaches the conversation the same way. At most ${r.ROUTINE.max} exist.`,parameters:n.object({action:n.enum(["list","create","change","delete"]),routine:n.string().nullish().describe("With change or delete: the routine, by its name or ID."),bot:n.string().nullish().describe("With create: a name from the bot list. With change: a new bot."),label:n.string().nullish().describe("With create: two or three words naming it, in the user's language. It names every thread the routine opens, on screen and out loud."),request:n.string().nullish().describe("With create: the whole of the work, handed to the bot as written every time it starts. Nobody is there then to fill in what is missing, so everything it needs goes here, in the user's own language and words. Their request, never your reading of it."),at:n.string().nullish().describe('Starts once, at this moment, "YYYY-MM-DD HH:MM" in the user\'s own time, then switches itself off. Count "in an hour" or "tomorrow at eight" from **Now**. Give one of `at`, `time` or `everyHours`.'),time:n.string().nullish().describe('Starts at this time of day, 24-hour "HH:MM" in the user\'s own time, on `days`. Give one of `at`, `time` or `everyHours`.'),days:n.array(n.number().int().min(1).max(7)).nullish().describe("With `time`: the days it starts, 1 Monday to 7 Sunday. Omit for every day."),everyHours:n.number().int().nullish().describe(`Starts again this many hours after it last started, ${r.ROUTINE.minHours} at least. Give one of \`at\`, \`time\` or \`everyHours\`.`),enabled:n.boolean().nullish().describe("With change: false switches it off without deleting it, true back on.")})};function w(e){let t=e.runs[0];return{id:e.id,label:e.label,bot:e.bot,when:(0,h.scheduleText)(e.schedule),enabled:e.enabled,...e.enabled?{next:(0,c.whenOf)((0,c.toDate)(e.nextRunAt))}:{},request:(0,u.clip)(e.request,r.PROMPT_LINE.routineRequest),...t?{lastRun:{thread:t.id,status:t.status,at:(0,c.whenOf)((0,c.toDate)(t.updatedAt)),...t.outcome?{outcome:(0,u.clip)(t.outcome,r.PROMPT_LINE.routineOutcome)}:{}}}:{}}}let y=e=>{if((0,d.isPublicError)(e))return e.message;throw e};async function p(e){let t=(await (0,l.listRoutines)()).map(e=>`"${e.label}"`);return t.length?e?`There is no single routine called "${e}". The routines are: ${t.join(", ")}. Call again with one of those, or its ID.`:`Name the routine. The routines are: ${t.join(", ")}.`:"There are no routines yet."}e.s(["createRoutineTools",0,function(){return{[o.TOOL_NAMES.routine]:(0,i.tool)({description:f.description,inputSchema:f.parameters,execute:async e=>{if("list"===e.action)return{routines:(await (0,l.listRoutines)()).map(w)};let t=function(e){if([e.at,e.time,e.everyHours].filter(Boolean).length>1)return"Give one of `at`, `time` or `everyHours`, not two.";let t=e.at?{kind:"once",at:e.at}:e.time?{kind:"daily",time:e.time,days:e.days?.length?e.days:[1,2,3,4,5,6,7]}:e.everyHours?{kind:"every",hours:e.everyHours}:null;if(!t)return null;let a=h.RoutineScheduleSchema.safeParse(t);return a.success?a.data:a.error.issues[0].message}(e);if("string"==typeof t)return t;if("create"===e.action){if(!t)return"Say when it starts: `at`, `time` (with `days`), or `everyHours`.";let a=h.RoutineInputSchema.safeParse({bot:e.bot??"",label:e.label??"",request:e.request??"",schedule:t});if(!a.success)return`${a.error.issues[0].message}. Nothing was made — call again with bot, label, request and when.`;let i=(await (0,s.listJobBots)()).map(e=>e.name);if(!i.some(e=>e.toLowerCase()===a.data.bot.toLowerCase()))return`There is no bot called "${a.data.bot}". The bots are: ${i.join(", ")}. Nothing was made — call again with one of those.`;let n=await (0,l.createRoutine)(a.data).catch(y);if("string"==typeof n)return n;let r=(0,c.whenOf)((0,c.toDate)(n.nextRunAt));return{...w(n),note:"once"===n.schedule.kind?`${n.bot} starts "${n.label}" once, ${r}, and the routine then switches itself off. The start is a thread of its own, and its result reaches the conversation like any thread's.`:`${n.bot} starts "${n.label}" by itself, ${(0,h.scheduleText)(n.schedule)}, first ${r}. Each start is a thread of its own, and its result reaches the conversation like any thread's.`}}let a=e.routine?await (0,l.resolveRoutine)(e.routine):null;if(!a)return await p(e.routine);if("delete"===e.action)return await (0,l.deleteRoutine)(a.id),`"${a.label}" is deleted and starts no more. The threads it already opened stay.`;let i={...e.bot?{bot:e.bot}:{},...e.label?.trim()?{label:e.label.trim()}:{},...e.request?.trim()?{request:e.request.trim()}:{},...t?{schedule:t}:{},..."boolean"==typeof e.enabled?{enabled:e.enabled}:{}};if(!Object.keys(i).length)return"Nothing to change was given: bot, label, request, when, or enabled.";let n=await (0,l.updateRoutine)(a.id,i).catch(y);return"string"==typeof n?n:n?w(n):await p(e.routine)}})}}]),a()}catch(e){a(e)}},!1),489956,e=>e.a(async(t,a)=>{try{var i=e.i(68356),n=e.i(847841),r=e.i(105249),o=e.i(687388),s=e.i(353885),l=e.i(279041),h=e.i(340698),c=e.i(41444),d=t([h]);[h]=d.then?(await d)():d;let p=`Answer the question from the web. Lead with the answer, then
|
|
@@ -16,7 +16,7 @@ what supports it. Say plainly what you could not find or confirm — do not fill
|
|
|
16
16
|
the gap with a guess. Every number carries the date you saw it. Be brief: this
|
|
17
17
|
is read by another model, not by a person.`,f=r.default.string().describe("What you want to know, as one full question. Put the place and the time in when they matter — the searcher sees nothing but this line.");async function u(e,t,a){let i=await fetch("https://api.exa.ai/search",{method:"POST",signal:a,headers:{"content-type":"application/json","x-api-key":e},body:JSON.stringify({query:t,type:"auto",numResults:o.SEARCH.sources,contents:{text:{maxCharacters:o.SEARCH.excerptChars},livecrawl:"fallback",livecrawlTimeout:5e3}})});if(!i.ok)return{text:`Exa answered ${i.status}: ${(0,c.clip)((await i.text()).trim(),200)}`,sources:[]};let n=(await i.json()).results??[];if(!n.length)return{text:"Nothing came back for that. Try other words, or open the page itself.",sources:[]};let r=n.flatMap(e=>e.url?.trim()?[{url:e.url.trim(),...e.title?.trim()?{title:e.title.trim()}:{}}]:[]);return{text:n.map(e=>{let t=[e.title?.trim(),e.url?.trim()].filter(Boolean).join(" — "),a=e.publishedDate?.slice(0,10);return[a?`${t} \xb7 ${a}`:t,e.text?.trim()].filter(Boolean).join("\n")}).join("\n\n"),sources:r}}async function m(e,t,a){let{text:n,sources:r}=await (0,i.generateText)({model:e.model,tools:e.tools,instructions:p,prompt:t,abortSignal:a}),s=[...new Set(r.flatMap(e=>"url"===e.sourceType?[e.title?`${e.title} — ${e.url}`:e.url]:[]))].slice(0,o.SEARCH.sources);return{text:[n.trim(),s.length?`Sources:
|
|
18
18
|
${s.join("\n")}`:""].filter(Boolean).join("\n\n"),sources:[]}}async function w(e,t,a){let i=AbortSignal.timeout(o.SEARCH.timeoutMs),n=t?AbortSignal.any([t,i]):i;return e(n).catch(e=>{if(t?.aborted)throw e;return{text:i.aborted?`The search did not come back in ${o.SEARCH.timeoutMs/1e3}s. ${a.slow}`:`Search failed: ${(0,c.errorToString)(e)}. ${a.failed}`,sources:[]}})}let y=async(e,t)=>{let a=await (0,h.readConfig)(l.EXA_API_KEY),i=e?.searchTools?{model:e.model,tools:e.searchTools}:null,o=a?(e,t)=>u(a,e,t):i?(e,t)=>m(i,e,t):null;return o?{[s.TOOL_NAMES.web_search]:(0,n.tool)({description:"Search the web and get back what the pages say, with their links. For a fact, a price, a date, what a page says. Not for a page that has to be clicked, filled, or signed into — that is the browser.",inputSchema:r.default.object({query:f}),execute:async({query:e},{abortSignal:a})=>{let i=await w(t=>o(e,t),a,{slow:"Ask something narrower, or open the page in the browser.",failed:"The browser is the other way in."});return t.fold(i.text,"web-search")}})}:{}},g=async e=>{let t=await (0,h.readConfig)(l.EXA_API_KEY);return t?{[s.TOOL_NAMES.web_search]:(0,n.tool)({description:"Search the web and get back what the pages say, with their links. For a fact, a price, a date, what a page says.",inputSchema:r.default.object({query:f}),execute:async({query:a},{abortSignal:i})=>{let n=await w(e=>u(t,a,e),i,{slow:"Ask something narrower, or hand it to a bot.",failed:"A bot can open the page instead."});return{results:await e.fold(n.text,"web-search"),sources:n.sources}}})}:{}};e.s(["createCallSearchTool",0,g,"createSearchTool",0,y]),a()}catch(e){a(e)}},!1),740852,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(105249),r=e.i(687388),o=e.i(353885),s=e.i(265143),l=t([s]);async function h(e){let t=await (0,s.ownLineOf)(e);if(!t)return{};let a=t.line?` It replaces the line you wrote before: "${t.line}".`:"";return{[o.TOOL_NAMES.describe_self]:(0,i.tool)({description:`Write your own line: a few words the roster reads after the description the user gave you, where Thursday and the other bots pick who gets a job.${a} Use it rarely — only when what you do has changed for good: the user told you what you are for, you now hold a skill of your own the description does not name, or the same kind of job keeps coming to you and it misses it. Never for one job, and never to describe a job.`,inputSchema:n.default.object({line:n.default.string().trim().min(1).max(r.COMMON_VALIDATE.shortDescription.max).describe("The whole line, in the words people ask with: what you do that the description does not say. Leave out any subject another bot's line in the roster already names, or a job has two bots to go to."),reason:n.default.string().trim().min(1).describe("What changed for good, in a sentence: why the roster should read this now.")}),execute:async({line:t,reason:a})=>{let i=await (0,s.writeOwnLine)(e,t,a);return i?i.was===t?"That is your line already; nothing changed.":{was:i.was,now:t,reason:a,note:"Thursday and the other bots read it from their next turn. Say in your answer that you wrote it, and why."}:"Nothing was written: the user keeps your line as it is now."}})}}[s]=l.then?(await l)():l,e.s(["createSelfTools",0,h]),a()}catch(e){a(e)}},!1),205863,e=>{"use strict";var t=e.i(847841),a=e.i(105249),i=e.i(687388),n=e.i(353885),r=e.i(527608),o=e.i(824664),s=e.i(786025);let l=a.default.string().describe("The site's address, like instagram.com. No path, no https://.");e.s(["createSignInTools",0,function(e,h,c){let d=c.PLAYWRIGHT_CLI_SESSION??"",u=async t=>{let a=await e.exec(t,{env:c,timeoutMs:i.BROWSER_CLI.loadMs});return 0===a.exitCode?null:(a.stderr||a.stdout).trim().slice(0,300)||`exit ${a.exitCode}`},m=async t=>{if(!await (0,r.sessionWindow)(e,c).catch(()=>!1))return"";let a=await e.exec('playwright-cli --raw run-code "async page => page.url()"',{env:c,timeoutMs:i.BROWSER_CLI.readMs}),o="";try{o=String(JSON.parse(a.stdout))}catch{}let s=await u("playwright-cli close")??await u("playwright-cli open")??await u(`playwright-cli state-load ${t}`)??(/^https?:/.test(o)?await u(`playwright-cli goto '${o.replaceAll("'","'\\''")}'`):null);return s?`The window closed, but your browser did not come back signed in: ${s}. Open it (\`playwright-cli open\`) and call \`${n.TOOL_NAMES.sign_in_use}\` with the site.`:`The window was for the sign-in, so it is closed: your browser goes on without one, signed in, on the same page. When what comes next is theirs to see, open it \`--headed\` and call \`${n.TOOL_NAMES.sign_in_use}\` again.`};return{[n.TOOL_NAMES.sign_in_use]:(0,t.tool)({description:"Sign your browser in to a site with a sign-in the user already made and the app kept. Open your browser first: the sign-in goes into the browser you have open, and opening another one afterwards throws it away.",inputSchema:a.default.object({site:l}),execute:async({site:t})=>{if(await (0,r.sessionBrowser)(e,c)==="theirs")return"You are working in their own Chrome: it is already signed in as them, and nothing is loaded into it. Go to the site.";let a=await (0,r.borrowSignIn)(t,h);if("none"===a.kind)return a.kept.length?`Nothing is kept for ${(0,o.siteOf)(t)}. Kept: ${a.kept.join(", ")} — call again with one of those if it is the same site. Otherwise open the site's sign-in page in a window they can see, ask them to sign in there, and call \`${n.TOOL_NAMES.sign_in_keep}\` once they have.`:`Nothing is kept for ${(0,o.siteOf)(t)}. Open its sign-in page in a window they can see, ask them to sign in there, and call \`${n.TOOL_NAMES.sign_in_keep}\` once they have.`;if("ask"===a.kind)return`The user keeps a ${a.signIn.site} sign-in (${a.signIn.account}) and has not let you use it. Ask them, as a question, whether you may; they allow it on screen. Call again once they have said yes.`;let i=(0,s.browserStateFile)();await e.writeFile(i,JSON.stringify(a.state));let l=await u(`playwright-cli state-load ${i}`).finally(()=>e.exec(`rm -f ${i}`));return!l&&d&&(0,r.holdSignIn)(d,h,a.signIn.site),l?`The sign-in could not be loaded into your browser: ${l}. Open the browser you mean to keep (\`playwright-cli open …\`, headed if you want a window), then call this again — opening another browser after this throws the sign-in away.`:`Signed in to ${a.signIn.site} as ${a.signIn.account}. Go to the site again (\`goto\`) — a page drawn before this still looks signed out. If it still shows you signed out after that, the site does not accept a sign-in carried over from another browser, and signing in again here will not last either: work in their own Chrome instead, \`playwright-cli attach --extension=chrome\`.`}}),[n.TOOL_NAMES.sign_in_keep]:(0,t.tool)({description:"Keep the sign-in the user just made in your browser window, so later work is signed in without asking them again. Call it right after they say they signed in. The window was for the sign-in: it closes, and your browser goes on without one, signed in, on the same page.",inputSchema:a.default.object({site:l,account:a.default.string().describe("Who it is signed in as, as the site shows it — a handle, an email. The site's name when nothing is shown."),keepWindow:a.default.boolean().nullish().describe("True when what comes next on this site is theirs to see — the products to choose, a checkout to confirm — and the window stays up.")}),execute:async({site:t,account:a,keepWindow:i})=>{if(await (0,r.sessionBrowser)(e,c)==="theirs")return"You are working in their own Chrome: it stays signed in as them by itself, and nothing is kept from it.";let n=(0,s.browserStateFile)(),o=await u((0,s.saveBrowserState)(n));if(o)return await e.exec(`rm -f ${n}`),`The browser's state could not be read: ${o}. Nothing was kept.`;try{let o=JSON.parse(await e.readFile(n,"utf-8")),s=await (0,r.keepSignIn)({site:t,account:a,bot:h,state:o});if("taken"===s.kind)return`Not kept: the user already keeps a ${s.signIn.site} sign-in (${s.signIn.account}) for other bots, and only they choose who uses it. This browser stays signed in for this job. Ask them, as a question, whether you may use the kept one — they allow it under Settings › Sign-ins — or, if this one should replace it, to sign out of the kept one there first; then call this again.`;d&&(0,r.holdSignIn)(d,h,s.signIn.site);let l=`Kept: ${s.signIn.site} as ${s.signIn.account}. It is listed for them under Settings › Sign-ins, where they can sign out of it.`;return i?l:`${l} ${await m(n)}`.trim()}finally{await e.exec(`rm -f ${n}`)}}})}}])},41181,e=>e.a(async(t,a)=>{try{var i=e.i(847841),n=e.i(105249),r=e.i(687388),o=e.i(353885),s=e.i(636882),l=e.i(696968),h=t([s,l]);[s,l]=h.then?(await h)():h,e.s(["createSkillTools",0,({skills:e,sandbox:t,bot:a})=>({[o.TOOL_NAMES.load_skill]:(0,i.tool)({description:"Load one skill: its instructions, and the files that ship with it.",inputSchema:n.default.object({name:n.default.string().describe("Exact name from the Skills list, or of a skill installed during this job. Do not guess names.")}),execute:async({name:i},{messages:n})=>{let h=(e,t)=>e.find(e=>e.name.toLowerCase()===t.toLowerCase()),c=h(e,i)?e:await (0,s.loadSkills)(t,a),d=h(c,i)?void 0:r.SKILLS_FOLDED[i.toLowerCase()],u=h(c,d??i);if(!u)return{error:`No skill named '${i}'.`,available:c.map(e=>e.name)};let m=`${u.path}/SKILL.md`;if(n.some(e=>Array.isArray(e.content)&&e.content.some(e=>{if("tool-result"!==e.type||e.toolName!==o.TOOL_NAMES.load_skill||"json"!==e.output.type)return!1;let t=e.output.value;return t?.skillDirectory===u.path&&"string"==typeof t.content})))return{skillDirectory:u.path,note:`Use the full '${u.name}' instructions already in your conversation. To check for changes on disk, read ${m} with the shell.`};let w=await t.readFile(m,"utf-8"),{body:p}=(0,l.splitFrontmatter)(w),{files:f,total:y}=await t.listFiles(u.path,{limit:r.SKILL_FILES_LISTED,skip:[r.PATHS.skills.runtime]});return{skillDirectory:u.path,files:f.map(e=>`${u.path}/${e}`),...y>f.length&&{more:`${y-f.length} more files, deeper in these folders. List a folder in the shell to see them.`},...d&&{note:`'${i}' is part of '${u.name}' now: these are its instructions.`},content:p}}})})]),a()}catch(e){a(e)}},!1),741376,e=>e.a(async(t,a)=>{try{var i=e.i(912714),n=e.i(750227),r=e.i(68356),o=e.i(343747),s=e.i(105249),l=e.i(687388),h=e.i(386075),c=e.i(353885),d=e.i(629668),u=e.i(640911),m=e.i(41444),w=t([h]);function p(e){return{...e,execute:(t,a)=>{let i=e.inputSchema.safeParse(t);if(!i.success)throw Error(s.default.prettifyError(i.error));return e.execute(i.data,a)}}}function f(e,t){let a=(0,m.slug)(e),i=(0,o.format)(new Date,"yyyyMMdd-HHmmss");return`${i}${a?`-${a}`:""}.${t}`}async function y(e,t,a,i){let n=`${t}/${a}`;return await e.exec(`mkdir -p ${t}`),await e.writeFile(n,Buffer.from(i)),n}async function g(e,t){let a=t.trim();if("image"!==(0,d.viewKindOf)(a))return`${a} is not a picture. Work from a png, jpg, webp or gif.`;let n=e.resolve(a),r=await (0,i.stat)(n).catch(()=>null);return r?.isFile()?r.size>l.LOOK.maxBytes?`${a} is ${Math.ceil(r.size/1024/1024)} MB, over the ${l.LOOK.maxBytes/1024/1024} MB one picture takes. Make a smaller copy in the shell first (on a Mac: sips -Z 1600 in.png --out out.png), then use that.`:(0,i.readFile)(n):`There is no file at ${a}. Give the path from the workspace root, as \`ls\` shows it.`}[h]=w.then?(await w)():w;let T=e=>`${e}
|
|
19
|
-
Saved. Give the user this path — the file opens from the thread row. Do not describe it back to them; they can open it.`,O=(e,t)=>e?.split("/")[1]?.split(";")[0]||t
|
|
19
|
+
Saved. Give the user this path — the file opens from the thread row. Do not describe it back to them; they can open it.`,O=(e,t)=>e?.split("/")[1]?.split(";")[0]||t,k=["1:1","16:9","9:16","4:3","3:4"],$=async()=>{let e=await (0,h.resolveMediaRef)("image");if(!e)return null;let t=(0,h.buildImageModel)(e.ref,e.apiKey);return p({name:c.STUDIO_TOOLS.generate_image,description:"Draw an image and save it as a file in the workspace, or change pictures already there. What comes back is its path.",inputSchema:s.default.object({prompt:s.default.string().describe("What to draw, described: subject, style, mood, what is in frame. With `images`, what to change about them. The image model does not see the job or the conversation, so nothing can be left implied."),images:s.default.array(s.default.string()).nullish().describe("Workspace paths of pictures to work from: the one being changed, or ones to draw from. Hand the picture over rather than describing it — whatever the words leave out is kept. Null to draw from nothing."),aspectRatio:s.default.enum(k).nullish().describe("Aspect ratio. Null for square, or for the shape of what `images` names.")}),execute:async({prompt:e,images:a,aspectRatio:i},{sandbox:n,artifacts:o,abortSignal:s})=>{let l=[];for(let e of a??[]){let t=await g(n,e);if("string"==typeof t)return t;l.push(t)}let{image:h}=await (0,r.generateImage)({model:t,prompt:l.length?{images:l,text:e}:e,aspectRatio:i??(l.length?void 0:"1:1"),abortSignal:s}),c=await y(n,o,f(e,O(h.mediaType,"png")),h.uint8Array);return T(c)}})},_=async()=>{let e=await (0,h.resolveMediaRef)("speech");if(!e)return null;let t=(0,h.buildSpeechModel)(e.ref,e.apiKey);return p({name:c.STUDIO_TOOLS.generate_speech,description:"Read text aloud into an audio file in the workspace — something the user listens to or sends, not Thursday's voice. What comes back is its path.",inputSchema:s.default.object({text:s.default.string().min(1).max(4e3).describe("The words to read, up to 4000 characters. Longer pieces are read in parts, one call each."),voice:s.default.string().nullish().describe("A voice name the provider knows. Null for its default."),instructions:s.default.string().nullish().describe('How to read it — "slowly", "warm", "like a news anchor". Null for plain.')}),execute:async({text:e,voice:a,instructions:i},{sandbox:n,artifacts:o,abortSignal:s})=>{let{audio:l}=await (0,r.generateSpeech)({model:t,text:e,voice:a??void 0,instructions:i??void 0,outputFormat:"mp3",abortSignal:s}),h=await y(n,o,f(e.slice(0,60),l.format||"mp3"),l.uint8Array);return T(h)}})},v=async()=>{let e=await (0,h.resolveMediaRef)("transcription");if(!e)return null;let t=(0,h.buildTranscriptionModel)(e.ref,e.apiKey);return p({name:c.STUDIO_TOOLS.transcribe,description:"Turn an audio file — a recording, a voice memo, a meeting — into text. The transcript is saved as a file in the workspace; what comes back is its path and the text.",inputSchema:s.default.object({path:s.default.string().min(1).describe("The audio file: a path relative to the workspace, or an absolute one anywhere on this machine.")}),execute:async({path:e},{sandbox:a,artifacts:o,abortSignal:s})=>{var l,h;let c,d=await (0,i.readFile)(a.resolve(e)),u=await (0,r.transcribe)({model:t,audio:d,abortSignal:s}),m=(0,n.basename)(e,(0,n.extname)(e)),w=await y(a,o,f(m,"md"),Buffer.from((l=u.text,c=(h=u.segments).length?`
|
|
20
20
|
|
|
21
21
|
## Timeline
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ ${h.map(e=>{var t;let a,i;return`- ${t=e.startSecond,a=Math.floor(t/60),i=Math.f
|
|
|
25
25
|
${l.trim()}${c}
|
|
26
26
|
`)));return`${w}
|
|
27
27
|
|
|
28
|
-
${await a.fold(u.text,"transcript")}`}})},A=async()=>{let e=await (0,h.resolveMediaRef)("video");if(!e)return null;let t=(0,h.buildVideoModel)(e.ref,e.apiKey);return p({name:c.STUDIO_TOOLS.generate_video,description:"Make a short video and save it as a file in the workspace. Takes minutes. What comes back is its path.",inputSchema:s.default.object({prompt:s.default.string().describe("What happens: the scene, the motion, the camera, the mood. The video model does not see the job or the conversation, so nothing can be left implied."),aspectRatio:s.default.enum(["16:9","9:16"]).nullish().describe("Aspect ratio. Null for 16:9."),seconds:s.default.number().int().min(2).max(10).nullish().describe("Length in seconds, 2 to 10. Null for the provider's default.")}),execute:async({prompt:e,aspectRatio:a,seconds:i},{sandbox:n,artifacts:o,abortSignal:s})=>{let{video:l}=await (0,r.experimental_generateVideo)({model:t,prompt:e,aspectRatio:a??"16:9",duration:i??void 0,maxRetries:0,abortSignal:s}),h=await y(n,o,f(e,O(l.mediaType,"mp4")),l.uint8Array);return T(h)}})};async function b(){return(await Promise.all([S(
|
|
28
|
+
${await a.fold(u.text,"transcript")}`}})},A=async()=>{let e=await (0,h.resolveMediaRef)("video");if(!e)return null;let t=(0,h.buildVideoModel)(e.ref,e.apiKey);return p({name:c.STUDIO_TOOLS.generate_video,description:"Make a short video and save it as a file in the workspace. Takes minutes. What comes back is its path.",inputSchema:s.default.object({prompt:s.default.string().describe("What happens: the scene, the motion, the camera, the mood. The video model does not see the job or the conversation, so nothing can be left implied."),aspectRatio:s.default.enum(["16:9","9:16"]).nullish().describe("Aspect ratio. Null for 16:9."),seconds:s.default.number().int().min(2).max(10).nullish().describe("Length in seconds, 2 to 10. Null for the provider's default.")}),execute:async({prompt:e,aspectRatio:a,seconds:i},{sandbox:n,artifacts:o,abortSignal:s})=>{let{video:l}=await (0,r.experimental_generateVideo)({model:t,prompt:e,aspectRatio:a??"16:9",duration:i??void 0,maxRetries:0,abortSignal:s}),h=await y(n,o,f(e,O(l.mediaType,"mp4")),l.uint8Array);return T(h)}})};async function b(){return(await Promise.all([S($),S(_),S(v),S(A)])).filter(e=>null!==e)}async function S(e){try{return await e()}catch(e){return u.logger.warn(`studio: a tool could not be built — ${(0,m.errorToString)(e)}`),null}}e.s(["loadStudio",0,b]),a()}catch(e){a(e)}},!1),660948,e=>e.a(async(t,a)=>{try{var i=e.i(105249),n=e.i(687388),r=e.i(105303),o=e.i(148831),s=e.i(41444),l=e.i(741376),h=t([r,o,l]);async function c(e){let[t,a]=await Promise.all([!e||e===n.STUDIO_SERVER?(0,l.loadStudio)():[],e===n.STUDIO_SERVER?[]:(0,o.listToolNames)(e)]);return[...t.map(e=>({server:n.STUDIO_SERVER,name:e.name})),...a]}[r,o,l]=h.then?(await h)():h;let p=async()=>{let[e,t]=await Promise.all([(0,l.loadStudio)(),(0,o.listServerNames)()]);return[...e.length?[n.STUDIO_SERVER]:[],...t.map(e=>e.name)]};async function d(e,t){if(e===n.STUDIO_SERVER){let e=new Set(t);return(await (0,l.loadStudio)()).filter(t=>e.has(t.name)).map(e=>({name:e.name,description:e.description,inputSchema:i.default.toJSONSchema(e.inputSchema)}))}return(await (0,o.findToolSchemas)(e,t)).map(e=>({name:e.name,description:e.description??null,inputSchema:e.inputSchema??null}))}async function u(e,t,a,i,{artifacts:o,abortSignal:l}){let h=AbortSignal.timeout(n.CONNECTED_TOOL_TIMEOUT_MS),c=l?AbortSignal.any([l,h]):h;try{let r=t===n.STUDIO_SERVER?await m(e,a,i,o,c):await w(t,a,i,c);if("string"!=typeof r)return r;return{status:"ok",text:await e.fold(r,`${t}-${a}`)}}catch(e){if(e instanceof r.McpAuthRequiredError)return{status:"auth_required",server:t,authorizationUrl:e.authorizationUrl};if(h.aborted&&!l?.aborted)return{status:"error",text:`${a} on ${t} gave no answer in ${n.CONNECTED_TOOL_TIMEOUT_MS/6e4} minutes and was given up on.`};return{status:"error",text:(0,s.errorToString)(e)}}}async function m(e,t,a,i,r){let o=(await (0,l.loadStudio)()).find(e=>e.name===t);if(!o)throw Error(`"${t}" is not in the ${n.STUDIO_SERVER} right now — the key that runs it is gone.`);return o.execute(a??{},{sandbox:e,artifacts:i,abortSignal:r})}async function w(e,t,a,i){let n=function(e){let t=e??{},a=!0===t.isError;if(!Array.isArray(t.content)){let e=void 0===t.toolResult?"":"string"==typeof t.toolResult?t.toolResult:JSON.stringify(t.toolResult);return{status:a?"error":"ok",text:e||f(a)}}let i=t.content.map(e=>"text"===e.type&&"string"==typeof e.text?e.text:`[${e.type}${e.mimeType?` ${e.mimeType}`:""} — not shown]`).join("\n").trim();return{status:a?"error":"ok",text:i||f(a)}}(await r.mcpManager.callTool(e,t,a,i));return"ok"===n.status?n.text:n}let f=e=>e?"The tool failed without a message.":"Done.";e.s(["callConnectedTool",0,u,"findConnectedSchemas",0,d,"listConnectedServerNames",0,p,"listConnectedToolNames",0,c]),a()}catch(e){a(e)}},!1),123203,e=>{"use strict";var t=e.i(750227),a=e.i(847841),i=e.i(105249),n=e.i(687388),r=e.i(353885),o=e.i(393189),s=e.i(786025),l=e.i(211644);let h=`## The shell here
|
|
29
29
|
|
|
30
30
|
Every command is a new shell: \`cd\`, exported variables and an activated venv are gone by the next one — chain what depends on the last step into a single command.
|
|
31
31
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[102185,e=>e.a(async(t,a)=>{try{var r=e.i(771716),i=e.i(91264),n=t([r]);[r]=n.then?(await n)():n;let s=(0,i.serverRoute)(async e=>{let t=new URL(e.url).searchParams,a=Number(t.get("rows")),i=Number.isSafeInteger(a)&&a>0?a:void 0,n=t.get("set");return n?(0,r.readSet)(n,i):(0,r.readShelf)(i)});e.s(["GET",0,s]),a()}catch(e){a(e)}},!1),872084,e=>{"use strict";var t=e.i(747909),a=e.i(174017),r=e.i(996250),i=e.i(759756),n=e.i(561916),s=e.i(174677),l=e.i(869741),o=e.i(316795),u=e.i(487718),c=e.i(995169),d=e.i(47587),p=e.i(666012),h=e.i(570101),m=e.i(626937),f=e.i(10372),w=e.i(193695);e.i(52474);var R=e.i(600220);let v=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/artifact/route",pathname:"/api/artifact",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/artifact/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(102185),...{}}),{workAsyncStorage:g,workUnitAsyncStorage:T,serverHooks:y}=v;async function E(e,t,r){r.requestMeta&&(0,i.setRequestMeta)(e,r.requestMeta),v.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/artifact/route";g=g.replace(/\/index$/,"")||"/";let T=await v.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!T)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:y,deploymentId:E,params:
|
|
1
|
+
module.exports=[102185,e=>e.a(async(t,a)=>{try{var r=e.i(771716),i=e.i(91264),n=t([r]);[r]=n.then?(await n)():n;let s=(0,i.serverRoute)(async e=>{let t=new URL(e.url).searchParams,a=Number(t.get("rows")),i=Number.isSafeInteger(a)&&a>0?a:void 0,n=t.get("set");return n?(0,r.readSet)(n,i):(0,r.readShelf)(i)});e.s(["GET",0,s]),a()}catch(e){a(e)}},!1),872084,e=>{"use strict";var t=e.i(747909),a=e.i(174017),r=e.i(996250),i=e.i(759756),n=e.i(561916),s=e.i(174677),l=e.i(869741),o=e.i(316795),u=e.i(487718),c=e.i(995169),d=e.i(47587),p=e.i(666012),h=e.i(570101),m=e.i(626937),f=e.i(10372),w=e.i(193695);e.i(52474);var R=e.i(600220);let v=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/artifact/route",pathname:"/api/artifact",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/artifact/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(102185),...{}}),{workAsyncStorage:g,workUnitAsyncStorage:T,serverHooks:y}=v;async function E(e,t,r){r.requestMeta&&(0,i.setRequestMeta)(e,r.requestMeta),v.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/artifact/route";g=g.replace(/\/index$/,"")||"/";let T=await v.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!T)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:y,deploymentId:E,params:A,nextConfig:C,parsedUrl:S,isDraftMode:P,prerenderManifest:b,routerServerContext:x,isOnDemandRevalidate:N,revalidateOnlyGenerated:F,resolvedPathname:_,clientReferenceManifest:I,serverActionsManifest:O}=T,H=(0,l.normalizeAppPath)(g),D=!!(b.dynamicRoutes[H]||b.routes[_]),q=async()=>((null==x?void 0:x.render404)?await x.render404(e,t,S,!1):t.end("This page could not be found"),null);if(D&&!P){let e=!!b.routes[_],t=b.dynamicRoutes[H];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await q();throw new w.NoFallbackError}}let M=null;!D||v.isDev||P||(M="/index"===(M=_)?"/":M);let k=!0===v.isDev||!D,U=D&&!k;O&&I&&(0,s.setManifestsSingleton)({page:g,clientReferenceManifest:I,serverActionsManifest:O});let L=e.method||"GET",$=(0,n.getTracer)(),j=$.getActiveScopeSpan(),K=!!(null==x?void 0:x.isWrappedByNextServer),B=!!(0,i.getRequestMeta)(e,"minimalMode"),W=(0,i.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,C,b,B);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let G={params:A,previewProps:b.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,supportsDynamicResponse:k,incrementalCache:W,hmrRefreshHash:(0,i.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,i)=>v.onRequestError(e,t,r,i,x)},sharedContext:{buildId:y,deploymentId:E}},V=new o.NodeNextRequest(e),X=new o.NodeNextResponse(t),z=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t)),J=async({previousCacheEntry:a})=>{try{if(!B&&N&&F&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await v.handle(z,G);e.fetchMetrics=G.renderOpts.fetchMetrics;let n=G.renderOpts.pendingWaitUntil;n&&r.waitUntil&&(r.waitUntil(n),n=void 0);let s=G.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(V,X,i,n),null;{let e=await i.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(i.headers);s&&(t[f.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,r=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=f.INFINITE_CACHE?!1!==a&&a>0?C.expireTime:void 0:G.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:N})},!1,x),t}},Z=async(i,s)=>{try{var l,o;let i=await v.handleResponse({req:e,nextConfig:C,cacheKey:M,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:F,responseGenerator:J,waitUntil:r.waitUntil,isMinimalMode:B});if(!D)return;if((null==i||null==(l=i.value)?void 0:l.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==i||null==(o=i.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",N?"REVALIDATED":i.isMiss?"MISS":i.isStale?"STALE":"HIT"),P&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let n=(0,h.fromNodeOutgoingHttpHeaders)(i.value.headers);B&&D||n.delete(f.NEXT_CACHE_TAGS_HEADER),!i.cacheControl||t.getHeader("Cache-Control")||n.get("Cache-Control")||n.set("Cache-Control",(0,m.getCacheControlHeader)(i.cacheControl)),await (0,p.sendResponse)(V,X,new Response(i.value.body,{headers:n,status:i.value.status||200}));return}catch(t){if(t instanceof w.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:N})},!1,x),D)throw t;await (0,p.sendResponse)(V,X,new Response(null,{status:500}));return}finally{(()=>{if(!i)return;let e=t.statusCode;i.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(i.setStatus({code:n.SpanStatusCode.ERROR}),i.setAttribute("error.type",e.toString()));let a=$.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==c.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route")||H,l=`${L} ${r}`;i.setAttributes({"next.route":r,"http.route":r,"next.span_name":l}),i.updateName(l),s&&s!==i&&(s.setAttribute("http.route",r),s.updateName(l))})()}};if(K&&j)await Z(j,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(c.BaseServerSpan.handleRequest,{spanName:`${L} ${g}`,kind:n.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Z(e,t)),void 0,!K)}}e.s(["handler",0,E,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:g,workUnitAsyncStorage:T})},"routeModule",0,v,"serverHooks",0,y,"workAsyncStorage",0,g,"workUnitAsyncStorage",0,T])},771716,e=>e.a(async(t,a)=>{try{var r=e.i(912714),i=e.i(750227),n=e.i(687388),s=e.i(265143),l=e.i(629668),o=e.i(786025),u=e.i(53748),c=t([s]);async function d(e){let[t,a]=await Promise.all([(0,o.insideWorkspace)(e),(0,o.insideWorkspace)(n.PATHS.artifacts)]);return t&&a&&t.startsWith(a+i.sep)||(0,u.publicError)("Not an artifact"),t}async function p(e,t,a){if(!(0,l.isListedFile)(a))return null;let n=(0,l.viewKindOf)(a),s=await (0,r.stat)((0,i.join)(e,a)).catch(()=>null);return s?.isFile()?{path:t,name:a,bytes:s.size,at:s.mtime,view:n}:null}async function h(e,t,a,n){let s=`${t}/${a.name}`;if(a.isDirectory()){if(!(0,l.isListedFolder)(a.name))return null;let t=(0,i.join)(e,a.name),[o,u]=await Promise.all([(0,r.stat)(t).catch(()=>null),(0,r.readdir)(t,{withFileTypes:!0}).catch(()=>[])]),c=u.filter(e=>e.isFile()&&(0,l.isListedFile)(e.name)).length;return o&&0!==c?{name:a.name,path:s,bot:n,at:o.mtime,kind:"set",bytes:0,count:c,view:"none"}:null}if(!a.isFile())return null;let o=await p(e,s,a.name);return o&&{name:o.name,path:o.path,bot:n,at:o.at,kind:"file",bytes:o.bytes,count:1,view:o.view}}async function m(){let e=await (0,s.listBotNames)();return new Map(e.map(e=>[(0,o.botFolderName)(e).toLowerCase(),e]))}async function f(e){let[t,a,...r]=e.split("/");return t===n.PATHS.artifacts&&a&&r.length?(await m()).get(a.toLowerCase())??null:null}async function w(e){try{let{bot:t}=JSON.parse(await (0,r.readFile)((0,i.join)(e,o.DELETED_BOT_MARK),"utf8"));return"string"==typeof t&&t.trim()?t:null}catch{return null}}async function R(e=n.ARTIFACT_VIEW.rows){let[t,a]=await Promise.all([(0,r.readdir)(o.ARTIFACTS,{withFileTypes:!0}).catch(()=>[]),m()]),s=(await Promise.all(t.map(async e=>{let t=(0,i.join)(o.ARTIFACTS,e.name),s=e.isDirectory()?a.get(e.name.toLowerCase())??await w(t):null;if(!s)return[await h(o.ARTIFACTS,n.PATHS.artifacts,e,null)];let l=`${n.PATHS.artifacts}/${e.name}`,u=await (0,r.readdir)(t,{withFileTypes:!0}).catch(()=>[]);return Promise.all(u.map(e=>h(t,l,e,s)))}))).flat().filter(e=>null!==e).sort((e,t)=>new Date(t.at).getTime()-new Date(e.at).getTime());return{entries:s.slice(0,e),total:s.length,files:s.reduce((e,t)=>e+t.count,0)}}async function v(e,t=n.ARTIFACT_VIEW.setFiles){let a=await d(e),s=await (0,r.readdir)(a,{withFileTypes:!0}).catch(()=>null);s||(0,u.publicError)("No such set");let l=(await Promise.all(s.filter(e=>e.isFile()).map(t=>p(a,`${e}/${t.name}`,t.name)))).filter(e=>null!==e).sort((e,t)=>new Date(t.at).getTime()-new Date(e.at).getTime());return{path:e,name:(0,i.basename)(e),files:l.slice(0,t),total:l.length}}[s]=c.then?(await c)():c,e.s(["botOfArtifact",0,f,"readSet",0,v,"readShelf",0,R]),a()}catch(e){a(e)}},!1)];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=_1qgix-j._.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[656446,e=>e.a(async(t,o)=>{try{var r=e.i(666680);e.i(347299);var a=e.i(115737),n=e.i(68356),i=e.i(983477),l=e.i(469719),s=e.i(687388),u=e.i(340698),d=e.i(640911),p=e.i(53748),c=e.i(268486),m=e.i(41444),g=e.i(264079),h=t([u]);[u]=h.then?(await h)():h;let x="thursday",{apiKeyName:S,label:k}=g.TEXT_MODEL_PROVIDERS.chatgpt,T=`${k} is not signed in — sign in from Settings › API keys.`,M=l.z.object({access:l.z.string().min(1),refresh:l.z.string().min(1),expires:l.z.number(),accountId:l.z.string().min(1),plan:l.z.string().nullable()}),C=globalThis,E=C.__chatgptRenewal??=(0,c.createKeyedLock)();async function f(e){let t=await fetch("https://auth.openai.com/oauth/token",{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:"app_EMoamEEZ73f0CkXaXp7hrann",...e})}).catch(e=>{d.logger.warn({cause:e},"chatgpt token endpoint unreachable"),(0,p.publicError)("Could not reach ChatGPT's sign-in")}),o=await t.json().catch(()=>null),r=o?.access_token;if(!t.ok||!r){let e=o?.error,r="string"==typeof e?[e,o?.error_description].filter(Boolean).join(": "):e?.message??e?.code??"";(0,p.publicError)(`ChatGPT's sign-in answered ${t.status}${r?`: ${r}`:""}`)}let a=function(e){try{let t=JSON.parse(Buffer.from(e.split(".")[1]??"","base64url").toString("utf8")),o=t["https://api.openai.com/auth"]??{};return{accountId:"string"==typeof o.chatgpt_account_id?o.chatgpt_account_id:null,plan:"string"==typeof o.chatgpt_plan_type?o.chatgpt_plan_type:null,expires:"number"==typeof t.exp?1e3*t.exp:null}}catch{return{accountId:null,plan:null,expires:null}}}(r),n=o?.refresh_token??e.refresh_token;a.accountId&&n||(0,p.publicError)("ChatGPT's sign-in came back without an account");let i=o?.expires_in;return{access:r,refresh:n,expires:"number"==typeof i?Date.now()+1e3*i:a.expires??Date.now(),accountId:a.accountId,plan:a.plan}}async function y(){let e=await (0,u.readConfig)(S);if(!e)return null;try{return M.parse(JSON.parse(e))}catch{return null}}let j=e=>e.expires-s.CHATGPT_SIGN_IN.renewBeforeMs<=Date.now();async function v(){let e=await y();return(e||(0,p.publicError)(T),j(e))?E(S,async()=>{let e=await y();if(e||(0,p.publicError)(T),!j(e))return e;try{let t=await f({grant_type:"refresh_token",refresh_token:e.refresh});return await (0,u.writeConfig)(S,JSON.stringify(t)),t}catch(e){(0,p.publicError)(`Could not renew the ${k} sign-in (${(0,m.errorToString)(e)}). If it keeps failing, sign in again from Settings › API keys.`)}}):e}async function b(){return(await y())?.plan??null}async function _(){let e;if(!await y())return null;try{e=await v()}catch(e){return{refused:(0,m.errorToString)(e)}}let t=await fetch("https://chatgpt.com/backend-api/wham/usage",{headers:{accept:"application/json",authorization:`Bearer ${e.access}`,"chatgpt-account-id":e.accountId,originator:x}}).catch(e=>{d.logger.warn({cause:e},"chatgpt usage unreachable"),(0,p.publicError)("Could not reach ChatGPT")}),o=await t.json().catch(()=>null);if(401===t.status||403===t.status)return{refused:o?.error?.message??o?.detail??`ChatGPT answered ${t.status}`};t.ok||(0,p.publicError)(`ChatGPT answered ${t.status}`);let r=[o?.rate_limit?.primary_window,o?.rate_limit?.secondary_window].filter(e=>"number"==typeof e?.used_percent).sort((e,t)=>(t.used_percent??0)-(e.used_percent??0))[0];r||(0,p.publicError)("ChatGPT did not say how much of the plan is used");let a=Math.round(r.used_percent??0),n=!!o?.rate_limit?.limit_reached,i=r.reset_at?1e3*r.reset_at:r.reset_after_seconds?Date.now()+1e3*r.reset_after_seconds:null;return{plan:o?.plan_type??e.plan,usedPercent:a,resetsAt:i?new Date(i).toISOString():null,spent:n,high:n||a>=s.CHATGPT_USAGE_HIGH}}async function w(e,t){let o=await v(),r=new Headers(t?.headers);if(r.set("authorization",`Bearer ${o.access}`),r.set("chatgpt-account-id",o.accountId),r.set("originator",x),t?.method!=="POST"||"string"!=typeof t.body||!String(e).endsWith("/responses"))return fetch(e,{...t,headers:r});let a=JSON.parse(t.body),n=!0===a.stream,i=[];a.input=(a.input??[]).filter(e=>"system"!==e.role&&"developer"!==e.role||(i.push("string"==typeof e.content?e.content:(e.content??[]).map(e=>e.text??"").join("\n")),!1)),a.instructions=[a.instructions,...i].filter(Boolean).join("\n\n")||"You are a helpful assistant.",a.store=!1,a.stream=!0,a.max_output_tokens=void 0,r.set("accept","text/event-stream");let l=await fetch(e,{...t,headers:r,body:JSON.stringify(a)});return 429===l.status?z(l):n||!l.ok?l:I(l)}async function z(e){let t=await e.text(),o={};try{o=JSON.parse(t).error??{}}catch{}if(!/usage_limit_reached|usage_not_included/.test(`${o.code} ${o.type}`)){let o=e.headers.get("retry-after");return new Response(t,{status:429,headers:{"content-type":"application/json",...o?{"retry-after":o}:{}}})}let r=o.resets_at?1e3*o.resets_at:o.resets_in_seconds?Date.now()+1e3*o.resets_in_seconds:null,a=o.plan_type?` on the ${o.plan_type} plan`:"",n=r?` It resets in ${(0,i.formatDistanceToNowStrict)(r)}.`:"";return Response.json({error:{message:`${k} usage limit reached${a}.${n}`,code:o.code??o.type}},{status:402})}async function I(e){let t=[],o=null,r=null;for(let a of(await e.text()).replaceAll("\r\n","\n").split("\n\n")){let e,n=a.split("\n").filter(e=>e.startsWith("data:")).map(e=>e.slice(5).trimStart()).join("\n");if(n&&"[DONE]"!==n){try{e=JSON.parse(n)}catch{continue}"response.output_item.done"===e.type?t.push(e.item):"response.completed"===e.type||"response.incomplete"===e.type?o=e.response??{}:"response.failed"===e.type?r=e.response?.error??{message:"The response failed"}:"error"===e.type&&(r={code:e.code,message:e.message})}}return r||!o?Response.json({error:{message:r?.message??"The stream ended before the response finished",code:r?.code}},{status:r?.code==="context_length_exceeded"?400:500}):Response.json({...o,output:o.output?.length?o.output:t})}e.s(["chatGptModel",0,function(e){let t=(0,a.createOpenAI)({baseURL:"https://chatgpt.com/backend-api/codex",apiKey:"signed-in",headers:{"OpenAI-Beta":"responses=experimental"},fetch:w}),o=(0,r.randomUUID)();return(0,n.wrapLanguageModel)({model:t.responses(e),middleware:{transformParams:async({params:e})=>({...e,providerOptions:{...e.providerOptions,openai:{promptCacheKey:o,...e.providerOptions?.openai,store:!1,includeWebSearchSources:!1}}})}})},"chatGptSearch",0,()=>(0,a.createOpenAI)({apiKey:"signed-in"}).tools.webSearch(),"readChatGptPlan",0,b,"readChatGptUsage",0,_]),o()}catch(e){o(e)}},!1),268486,e=>{"use strict";var t=e.i(41444);e.s(["createKeyedLock",0,function(){let e=new Map,o=new Map;return function(r,a){let n=e.get(r);n||(n=(0,t.PromiseChain)(),e.set(r,n)),o.set(r,(o.get(r)??0)+1);let i=()=>{let t=(o.get(r)??1)-1;t>0?o.set(r,t):(o.delete(r),e.delete(r))};return n(a).then(e=>(i(),e),e=>{throw i(),e})}}])},115737,e=>{"use strict";var t,o=e.i(847841),r=e.i(546888),a=e.i(376261),n=e.i(110567),i=e.i(469719),l=i.z.object({error:i.z.object({message:i.z.string(),type:i.z.string().nullish(),param:i.z.any().nullish(),code:i.z.union([i.z.string(),i.z.number()]).nullish()})}),s=(0,o.createJsonErrorResponseHandler)({errorSchema:l,errorToMessage:e=>e.error.message});function u(e){var t,o,r,a,n,i;let l,s=(i=e,null==(l=/^o(\d+)(?:-|$)/.exec(i))?void 0:Number(l[1])),u=function(e){let t=/^gpt-(\d+)(?:\.(\d+))?(?:-(.+))?$/.exec(e);if(null!=t)return{major:Number(t[1]),minor:null==t[2]?void 0:Number(t[2]),variant:t[3]}}(e),d=(null==u?void 0:u.minor)==null&&null!=(o=null==(t=null==u?void 0:u.variant)?void 0:t.startsWith("chat"))&&o,p=null!=(a=null==(r=null==u?void 0:u.variant)?void 0:r.startsWith("nano"))&&a,c=null!=u&&u.major>=6,m="gpt-6-sol"===e||"gpt-6-luna"===e,g=null!=s&&s>=3||null!=u&&u.major>=5&&!d,h=e.startsWith("gpt-4")||null!=u&&u.major>=5&&!p&&!d||null!=s&&s>=3,f=null!=s||null!=u&&u.major>=5&&!d,y=!c&&null!=u&&(u.major>5||5===u.major&&(null!=(n=u.minor)?n:0)>=1);return{supportsFlexProcessing:g,supportsPriorityProcessing:h,supportsConfigurationUpdate:c,supportsAsyncToolCalling:c,supportedReasoningEfforts:m?["none","low","medium","high","xhigh","max"]:c?["low","medium","high","xhigh","max"]:void 0,isReasoningModel:f,systemMessageMode:f?"developer":"system",supportsNonReasoningParameters:y}}function d(e){var t,r;let a=function(e){var t;let o=g(e);if(null==o)return;if("response.failed"===o.type){let e=g(o.response),t=g(null==e?void 0:e.error);return"string"==typeof(null==t?void 0:t.message)?{message:t.message,code:h(t.code),type:"response.failed"}:void 0}let r=null!=(t=g(o.error))?t:o;return"string"==typeof r.message&&(null!=g(o.error)||"string"==typeof r.type||"code"in r||"param"in r)?{message:r.message,code:h(r.code),type:"string"==typeof r.type?r.type:void 0}:void 0}(e);if(null==a)return;let n=function(e){var t,o;let r,a="number"==typeof(r="string"==typeof(t=e.code)&&/^\d{3}$/.test(t)?Number(t):t)&&Number.isInteger(o=r)&&o>=400&&o<=599?r:void 0;if(null!=a)return a;let n=[e.code,e.type].filter(e=>"string"==typeof e||"number"==typeof e).join(" ").toLowerCase();return["insufficient_quota","rate_limit"].some(e=>n.includes(e))?429:n.includes("authentication")?401:n.includes("permission")?403:n.includes("not_found")?404:["invalid","bad_request","context_length"].some(e=>n.includes(e))?400:n.includes("overload")?503:n.includes("timeout")?504:500}(a);return(0,o.createProviderStreamError)({message:a.message,type:null!=(t=a.type)?t:void 0,code:null!=(r=a.code)?r:void 0,statusCode:n,isRetryable:function(e,t){return"insufficient_quota"!==e.code&&"insufficient_quota"!==e.type&&(408===t||409===t||429===t||t>=500)}(a,n),data:e})}async function p({stream:e,getError:t,isOutputChunk:o,isAcceptedChunk:r,acceptedGraceMs:n=50,url:i,requestBodyValues:l,responseHeaders:s}){let[u,g]=e.tee(),h=u.getReader(),f=!1;try{let e=!1;for(;;){let u;if(e){let e=await m(h.read(),n);if(e.timedOut)return g;u=e.value}else u=await h.read();if(u.done)return g;let p=u.value;if(!p.success)return g;let y=t(p.value);if(null!=y)throw f=!0,c(h).catch(()=>{}),c(g.getReader()).catch(()=>{}),function({frame:e,url:t,requestBodyValues:o,responseHeaders:r}){var n,i;let l=d(e);return new a.APICallError({message:null!=(n=null==l?void 0:l.message)?n:"OpenAI stream failed before any output was generated",url:t,requestBodyValues:o,statusCode:null!=(i=null==l?void 0:l.statusCode)?i:500,responseHeaders:r,responseBody:JSON.stringify(e),data:e,isRetryable:null==l?void 0:l.isRetryable})}({frame:y,url:i,requestBodyValues:l,responseHeaders:s});if(o(p.value))return g;e||(null==r?void 0:r(p.value))!==!0||(e=!0)}}finally{f||(h.cancel().catch(()=>{}),h.releaseLock())}}async function c(e){try{for(;!(await e.read()).done;);}catch(e){}finally{e.releaseLock()}}async function m(e,t){let o,r=e.then(e=>({timedOut:!1,value:e}));try{let e=await Promise.race([r,new Promise(e=>{o=setTimeout(()=>e({timedOut:!0}),t)})]);return e.timedOut&&r.catch(()=>{}),e}finally{clearTimeout(o)}}function g(e){return"object"==typeof e&&null!=e?e:void 0}function h(e){return"string"==typeof e||"number"==typeof e?e:void 0}function f(e){var t,r,a,n,i,l,s,u;if(null==e)return(0,o.createNullLanguageModelUsage)();let d=null!=(t=e.prompt_tokens)?t:0,p=null!=(r=e.completion_tokens)?r:0,c=null!=(n=null==(a=e.prompt_tokens_details)?void 0:a.cached_tokens)?n:0,m=null!=(l=null==(i=e.prompt_tokens_details)?void 0:i.cache_write_tokens)?l:void 0,g=null!=(u=null==(s=e.completion_tokens_details)?void 0:s.reasoning_tokens)?u:0;return{inputTokens:{total:d,noCache:d-c-(null!=m?m:0),cacheRead:c,cacheWrite:m},outputTokens:{total:p,text:Math.max(0,p-g),reasoning:g},raw:e}}function y(e){var t;return null==(t=null==e?void 0:e.openai)?void 0:t.promptCacheBreakpoint}function v({id:e,model:t,created:r}){return(0,o.createLanguageModelResponseMetadata)({id:e,model:t,created:r||void 0})}function b(e){switch(e){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var _=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.object({id:i.z.string().nullish(),created:i.z.number().nullish(),model:i.z.string().nullish(),choices:i.z.array(i.z.object({message:i.z.object({role:i.z.literal("assistant").nullish(),content:i.z.string().nullish(),audio:i.z.object({transcript:i.z.string().nullish()}).nullish(),tool_calls:i.z.array(i.z.object({id:i.z.string().nullish(),type:i.z.literal("function"),function:i.z.object({name:i.z.string(),arguments:i.z.string()})})).nullish(),annotations:i.z.array(i.z.object({type:i.z.literal("url_citation"),url_citation:i.z.object({start_index:i.z.number(),end_index:i.z.number(),url:i.z.string(),title:i.z.string()})})).nullish()}),index:i.z.number(),logprobs:i.z.object({content:i.z.array(i.z.object({token:i.z.string(),logprob:i.z.number(),top_logprobs:i.z.array(i.z.object({token:i.z.string(),logprob:i.z.number()}))})).nullish()}).nullish(),finish_reason:i.z.string().nullish()})),usage:i.z.object({prompt_tokens:i.z.number().nullish(),completion_tokens:i.z.number().nullish(),total_tokens:i.z.number().nullish(),prompt_tokens_details:i.z.object({cached_tokens:i.z.number().nullish(),cache_write_tokens:i.z.number().nullish()}).nullish(),completion_tokens_details:i.z.object({reasoning_tokens:i.z.number().nullish(),accepted_prediction_tokens:i.z.number().nullish(),rejected_prediction_tokens:i.z.number().nullish()}).nullish()}).nullish()}))),w=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.union([i.z.object({id:i.z.string().nullish(),created:i.z.number().nullish(),model:i.z.string().nullish(),choices:i.z.array(i.z.object({delta:i.z.object({role:i.z.enum(["assistant"]).nullish(),content:i.z.string().nullish(),tool_calls:i.z.array(i.z.object({index:i.z.number(),id:i.z.string().nullish(),type:i.z.literal("function").nullish(),function:i.z.object({name:i.z.string().nullish(),arguments:i.z.string().nullish()})})).nullish(),annotations:i.z.array(i.z.object({type:i.z.literal("url_citation"),url_citation:i.z.object({start_index:i.z.number(),end_index:i.z.number(),url:i.z.string(),title:i.z.string()})})).nullish()}).nullish(),logprobs:i.z.object({content:i.z.array(i.z.object({token:i.z.string(),logprob:i.z.number(),top_logprobs:i.z.array(i.z.object({token:i.z.string(),logprob:i.z.number()}))})).nullish()}).nullish(),finish_reason:i.z.string().nullish(),index:i.z.number()})),usage:i.z.object({prompt_tokens:i.z.number().nullish(),completion_tokens:i.z.number().nullish(),total_tokens:i.z.number().nullish(),prompt_tokens_details:i.z.object({cached_tokens:i.z.number().nullish(),cache_write_tokens:i.z.number().nullish()}).nullish(),completion_tokens_details:i.z.object({reasoning_tokens:i.z.number().nullish(),accepted_prediction_tokens:i.z.number().nullish(),rejected_prediction_tokens:i.z.number().nullish()}).nullish()}).nullish()}),l]))),z=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.object({logitBias:i.z.record(i.z.coerce.number(),i.z.number()).optional(),logprobs:i.z.union([i.z.boolean(),i.z.number()]).optional(),parallelToolCalls:i.z.boolean().optional(),user:i.z.string().optional(),reasoningEffort:i.z.enum(["none","minimal","low","medium","high","xhigh","max"]).optional(),maxCompletionTokens:i.z.number().optional(),store:i.z.boolean().optional(),metadata:i.z.record(i.z.string().max(64),i.z.string().max(512)).optional(),prediction:i.z.record(i.z.string(),i.z.any()).optional(),serviceTier:i.z.enum(["auto","flex","priority","fast","ultrafast","default"]).optional(),strictJsonSchema:i.z.boolean().optional(),textVerbosity:i.z.enum(["low","medium","high"]).optional(),promptCacheKey:i.z.string().optional(),promptCacheOptions:i.z.object({mode:i.z.enum(["implicit","explicit"]).optional(),ttl:i.z.literal("30m").optional()}).optional(),promptCacheRetention:i.z.enum(["in_memory","24h"]).optional(),safetyIdentifier:i.z.string().optional(),systemMessageMode:i.z.enum(["system","developer","remove"]).optional(),forceReasoning:i.z.boolean().optional()})));function I(e){let t=!1,o=!1,r=i(e),n=[];return t&&n.push({type:"compatibility",feature:"JSON Schema propertyNames",details:"OpenAI does not support JSON Schema propertyNames. It was removed before sending the schema, so OpenAI will not enforce property-name constraints."}),o&&n.push({type:"compatibility",feature:"JSON Schema pattern with regex lookaround",details:"OpenAI does not support regex lookaround in JSON Schema patterns. The pattern was removed before sending the schema, so OpenAI will not enforce that constraint."}),{schema:r,warnings:n};function i(e){let r=e.propertyNames;if(null!=r){if("boolean"==typeof r||"string"!==r.type)throw new a.UnsupportedFunctionalityError({functionality:"JSON Schema propertyNames that does not use a string schema"});t=!0}let n={...e};for(let e of(delete n.propertyNames,null!=n.pattern&&function(e){let t=!1,o=!1;for(let r=0;r<e.length;r++){let a=e[r];if(t){t=!1;continue}if("\\"===a){t=!0;continue}if("["===a){o=!0;continue}if("]"===a){o=!1;continue}if(!o&&"("===a&&"?"===e[r+1]){let t=e[r+2];if("="===t||"!"===t||"<"===t&&("="===e[r+3]||"!"===e[r+3]))return!0}}return!1}(n.pattern)&&(delete n.pattern,o=!0),null!=n.properties&&(n.properties=l(n.properties)),null!=n.patternProperties&&(n.patternProperties=l(n.patternProperties)),null!=n.additionalProperties&&(n.additionalProperties=s(n.additionalProperties)),null!=n.additionalItems&&(n.additionalItems=s(n.additionalItems)),null!=n.items&&(n.items=Array.isArray(n.items)?n.items.map(s):s(n.items)),null!=n.contains&&(n.contains=s(n.contains)),null!=n.not&&(n.not=s(n.not)),null!=n.allOf&&(n.allOf=n.allOf.map(s)),null!=n.anyOf&&(n.anyOf=n.anyOf.map(s)),null!=n.oneOf&&(n.oneOf=n.oneOf.map(s)),null!=n.definitions&&(n.definitions=l(n.definitions)),null!=n.$defs&&(n.$defs=l(n.$defs)),null!=n.dependencies&&(n.dependencies=Object.fromEntries(Object.entries(n.dependencies).map(([e,t])=>[e,Array.isArray(t)?t:s(t)]))),["if","then","else"])){let t=n[e];null!=t&&(n[e]=s(t))}return n}function l(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,s(t)]))}function s(e){return"boolean"==typeof e?e:i(e)}}var x=class e{constructor(e,t){this.specificationVersion="v4",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[n.WORKFLOW_SERIALIZE](e){return(0,o.serializeModelOptions)({modelId:e.modelId,config:e.config})}static[n.WORKFLOW_DESERIALIZE](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:r,topP:n,topK:i,frequencyPenalty:l,presencePenalty:s,stopSequences:d,responseFormat:p,seed:c,tools:m,toolChoice:g,reasoning:h,providerOptions:f}){var v,b,_,w,x,S;let k=[],T=null!=(v=await (0,o.parseProviderOptions)({provider:"openai",providerOptions:f,schema:z}))?v:{},M=u(this.modelId),C=null!=(b=T.reasoningEffort)?b:(0,o.isCustomReasoning)(h)?h:void 0;null==C||null==M.supportedReasoningEfforts||M.supportedReasoningEfforts.includes(C)||(k.push({type:"unsupported",feature:"reasoningEffort",details:`${this.modelId} only supports the following reasoning efforts: ${M.supportedReasoningEfforts.join(", ")}`}),C=void 0);let E=null!=(_=T.forceReasoning)?_:M.isReasoningModel;null!=i&&k.push({type:"unsupported",feature:"topK"});let{messages:j,warnings:O}=function({prompt:e,systemMessageMode:t="system"}){var r,n,i;let l=[],s=[];for(let{role:u,content:d,providerOptions:p}of e)switch(u){case"system":switch(t){case"system":{let e=y(p);l.push({role:"system",content:null==e?d:[{type:"text",text:d,prompt_cache_breakpoint:e}]});break}case"developer":{let e=y(p);l.push({role:"developer",content:null==e?d:[{type:"text",text:d,prompt_cache_breakpoint:e}]});break}case"remove":s.push({type:"other",message:"system messages are removed for this model"});break;default:throw Error(`Unsupported system message mode: ${t}`)}break;case"user":if(1===d.length&&"text"===d[0].type&&null==y(d[0].providerOptions)){l.push({role:"user",content:d[0].text});break}l.push({role:"user",content:d.map((e,t)=>{var r,n,i;switch(e.type){case"text":{let t=y(e.providerOptions);return{type:"text",text:e.text,...null!=t&&{prompt_cache_breakpoint:t}}}case"file":{let l=y(e.providerOptions);switch(e.data.type){case"reference":return{type:"file",file:{file_id:(0,o.resolveProviderReference)({reference:e.data.reference,provider:"openai"})},...null!=l&&{prompt_cache_breakpoint:l}};case"text":throw new a.UnsupportedFunctionalityError({functionality:"text file parts"});case"url":case"data":{let s=(0,o.getTopLevelMediaType)(e.mediaType);if("image"===s)return{type:"image_url",image_url:{url:"url"===e.data.type?e.data.url.toString():`data:${(0,o.resolveFullMediaType)({part:e})};base64,${(0,o.convertToBase64)(e.data.data)}`,detail:null==(n=null==(r=e.providerOptions)?void 0:r.openai)?void 0:n.imageDetail},...null!=l&&{prompt_cache_breakpoint:l}};if("audio"===s){if("url"===e.data.type)throw new a.UnsupportedFunctionalityError({functionality:"audio file parts with URLs"});let t=(0,o.resolveFullMediaType)({part:e});switch(t){case"audio/wav":return{type:"input_audio",input_audio:{data:(0,o.convertToBase64)(e.data.data),format:"wav"},...null!=l&&{prompt_cache_breakpoint:l}};case"audio/mp3":case"audio/mpeg":return{type:"input_audio",input_audio:{data:(0,o.convertToBase64)(e.data.data),format:"mp3"},...null!=l&&{prompt_cache_breakpoint:l}};default:throw new a.UnsupportedFunctionalityError({functionality:`audio content parts with media type ${t}`})}}{let r=(0,o.resolveFullMediaType)({part:e});if("application/pdf"!==r)throw new a.UnsupportedFunctionalityError({functionality:`file part media type ${r}`});if("url"===e.data.type)throw new a.UnsupportedFunctionalityError({functionality:"PDF file parts with URLs"});return{type:"file",file:{filename:null!=(i=e.filename)?i:`part-${t}.pdf`,file_data:`data:application/pdf;base64,${(0,o.convertToBase64)(e.data.data)}`},...null!=l&&{prompt_cache_breakpoint:l}}}}}}}})});break;case"assistant":{let e="",t=[],o=!1,r=[];for(let a of d)switch(a.type){case"text":{let r=y(a.providerOptions);e+=a.text,t.push({type:"text",text:a.text,...null!=r&&{prompt_cache_breakpoint:r}}),o||(o=null!=r);break}case"tool-call":r.push({id:a.toolCallId,type:"function",function:{name:a.toolName,arguments:JSON.stringify("object"!=typeof(i=a.input)||null===i||Array.isArray(i)?{}:i)}})}l.push({role:"assistant",content:o?t:r.length>0?e||null:e,tool_calls:r.length>0?r:void 0});break}case"tool":for(let e of d){let t;if("tool-approval-response"===e.type)continue;let o=e.output,a=null!=(r="content"===o.type?o.value.map(e=>y(e.providerOptions)).find(e=>null!=e):y(o.providerOptions))?r:y(e.providerOptions);switch(o.type){case"text":case"error-text":t=o.value;break;case"execution-denied":t=null!=(n=o.reason)?n:"Tool call execution denied.";break;case"content":case"json":case"error-json":t=JSON.stringify(o.value)}l.push({role:"tool",tool_call_id:e.toolCallId,content:null==a?t:[{type:"text",text:t,prompt_cache_breakpoint:a}]})}break;default:throw Error(`Unsupported role: ${u}`)}return{messages:l,warnings:s}}({prompt:e,systemMessageMode:null!=(w=T.systemMessageMode)?w:E?"developer":M.systemMessageMode});k.push(...O);let R=null==(x=T.strictJsonSchema)||x,A=(null==p?void 0:p.type)==="json"&&null!=p.schema?I(p.schema):void 0;null!=A&&k.push(...A.warnings);let N={model:this.modelId,logit_bias:T.logitBias,logprobs:!0===T.logprobs||"number"==typeof T.logprobs||void 0,top_logprobs:"number"==typeof T.logprobs?T.logprobs:"boolean"==typeof T.logprobs&&T.logprobs?0:void 0,user:T.user,parallel_tool_calls:T.parallelToolCalls,max_tokens:t,temperature:r,top_p:n,frequency_penalty:l,presence_penalty:s,response_format:(null==p?void 0:p.type)==="json"?null!=A?{type:"json_schema",json_schema:{schema:A.schema,strict:R,name:null!=(S=p.name)?S:"response",description:p.description}}:{type:"json_object"}:void 0,stop:d,seed:c,verbosity:T.textVerbosity,max_completion_tokens:T.maxCompletionTokens,store:T.store,metadata:T.metadata,prediction:T.prediction,reasoning_effort:C,service_tier:T.serviceTier,prompt_cache_key:T.promptCacheKey,prompt_cache_options:T.promptCacheOptions,prompt_cache_retention:T.promptCacheRetention,safety_identifier:T.safetyIdentifier,messages:j};null!=M.supportedReasoningEfforts&&null!=N.prompt_cache_retention&&(N.prompt_cache_retention=void 0,k.push({type:"unsupported",feature:"promptCacheRetention",details:"promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"})),E?("none"===C&&M.supportsNonReasoningParameters||(null!=N.temperature&&(N.temperature=void 0,k.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for reasoning models"})),null!=N.top_p&&(N.top_p=void 0,k.push({type:"unsupported",feature:"topP",details:"topP is not supported for reasoning models"})),null!=N.logprobs&&(N.logprobs=void 0,k.push({type:"other",message:"logprobs is not supported for reasoning models"}))),null!=N.frequency_penalty&&(N.frequency_penalty=void 0,k.push({type:"unsupported",feature:"frequencyPenalty",details:"frequencyPenalty is not supported for reasoning models"})),null!=N.presence_penalty&&(N.presence_penalty=void 0,k.push({type:"unsupported",feature:"presencePenalty",details:"presencePenalty is not supported for reasoning models"})),null!=N.logit_bias&&(N.logit_bias=void 0,k.push({type:"other",message:"logitBias is not supported for reasoning models"})),null!=N.top_logprobs&&(N.top_logprobs=void 0,k.push({type:"other",message:"topLogprobs is not supported for reasoning models"})),null!=N.max_tokens&&(null==N.max_completion_tokens&&(N.max_completion_tokens=N.max_tokens),N.max_tokens=void 0)):(this.modelId.startsWith("gpt-4o-search-preview")||this.modelId.startsWith("gpt-4o-mini-search-preview"))&&null!=N.temperature&&(N.temperature=void 0,k.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for the search preview models and has been removed."})),"flex"!==T.serviceTier||M.supportsFlexProcessing||(k.push({type:"unsupported",feature:"serviceTier",details:"flex processing is only available for o3, o4-mini, and gpt-5 models"}),N.service_tier=void 0),"priority"!==T.serviceTier&&"fast"!==T.serviceTier||M.supportsPriorityProcessing||(k.push({type:"unsupported",feature:"serviceTier",details:"priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"}),N.service_tier=void 0);let{tools:P,toolChoice:q,toolWarnings:$}=function({tools:e,toolChoice:t}){e=(null==e?void 0:e.length)?e:void 0;let o=[];if(null==e)return{tools:void 0,toolChoice:void 0,toolWarnings:o};let r=[];for(let t of e)if("function"===t.type){let e=I(t.inputSchema);o.push(...e.warnings),r.push({type:"function",function:{name:t.name,description:t.description,parameters:e.schema,...null!=t.strict?{strict:t.strict}:{}}})}else o.push({type:"unsupported",feature:`tool type: ${t.type}`});if(null==t)return{tools:r,toolChoice:void 0,toolWarnings:o};let n=t.type;switch(n){case"auto":case"none":case"required":return{tools:r,toolChoice:n,toolWarnings:o};case"tool":return{tools:r,toolChoice:{type:"function",function:{name:t.toolName}},toolWarnings:o};default:throw new a.UnsupportedFunctionalityError({functionality:`tool choice type: ${n}`})}}({tools:m,toolChoice:g});return{args:{...N,tools:P,tool_choice:q},warnings:[...k,...$]}}async doGenerate(e){var t,r,n,i,l,u,d,p;let{args:c,warnings:m}=await this.getArgs(e),{responseHeaders:g,value:h,rawValue:y}=await (0,o.postJsonToApi)({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:(0,o.combineHeaders)(null==(r=(t=this.config).headers)?void 0:r.call(t),e.headers),body:c,failedResponseHandler:s,successfulResponseHandler:(0,o.createJsonResponseHandler)(_),abortSignal:e.abortSignal,fetch:this.config.fetch}),w=h.choices[0];if(null==w)throw new a.InvalidResponseDataError({data:y,message:"Response did not contain any choices."});let z=[],I=null!=w.message.content&&w.message.content.length>0?w.message.content:null==(n=w.message.audio)?void 0:n.transcript;for(let e of(null!=I&&I.length>0&&z.push({type:"text",text:I}),null!=(i=w.message.tool_calls)?i:[]))z.push({type:"tool-call",toolCallId:e.id||(0,o.generateId)(),toolName:e.function.name,input:e.function.arguments});for(let e of null!=(l=w.message.annotations)?l:[])z.push({type:"source",sourceType:"url",id:(0,o.generateId)(),url:e.url_citation.url,title:e.url_citation.title});let x=null==(u=h.usage)?void 0:u.completion_tokens_details,S={openai:{}};return(null==x?void 0:x.accepted_prediction_tokens)!=null&&(S.openai.acceptedPredictionTokens=null==x?void 0:x.accepted_prediction_tokens),(null==x?void 0:x.rejected_prediction_tokens)!=null&&(S.openai.rejectedPredictionTokens=null==x?void 0:x.rejected_prediction_tokens),(null==(d=w.logprobs)?void 0:d.content)!=null&&(S.openai.logprobs=w.logprobs.content),{content:z,finishReason:{unified:b(w.finish_reason),raw:null!=(p=w.finish_reason)?p:void 0},usage:f(h.usage),request:{body:c},response:{...v(h),headers:g,body:y},warnings:m,providerMetadata:S}}async doStream(e){var t,r;let a,n,{args:i,warnings:l}=await this.getArgs(e),u={...i,stream:!0,stream_options:{include_usage:!0}},c=this.config.url({path:"/chat/completions",modelId:this.modelId}),{responseHeaders:m,value:g}=await (0,o.postJsonToApi)({url:c,headers:(0,o.combineHeaders)(null==(r=(t=this.config).headers)?void 0:r.call(t),e.headers),body:u,failedResponseHandler:s,successfulResponseHandler:(0,o.createEventSourceResponseHandler)(w),abortSignal:e.abortSignal,fetch:this.config.fetch}),h=await p({stream:g,getError:e=>"error"in e?e.error:void 0,isOutputChunk:S,url:c,requestBodyValues:u,responseHeaders:m}),y={unified:"other",raw:void 0},_=!1,z=!1,I={openai:{}};return{stream:h.pipeThrough(new TransformStream({start(e){a=new o.StreamingToolCallTracker(e,{generateId:o.generateId,typeValidation:"if-present"}),e.enqueue({type:"stream-start",warnings:l})},transform(t,r){var i,l,s,u,p,c;if(e.includeRawChunks&&r.enqueue({type:"raw",rawValue:t.rawValue}),!t.success){y={unified:"error",raw:void 0},r.enqueue({type:"error",error:t.error});return}let m=t.value;if("error"in m){y={unified:"error",raw:void 0},r.enqueue({type:"error",error:null!=(i=d(m.error))?i:m.error});return}!_&&Object.values(v(m)).some(Boolean)&&(_=!0,r.enqueue({type:"response-metadata",...v(m)})),null!=m.usage&&(n=m.usage,(null==(l=m.usage.completion_tokens_details)?void 0:l.accepted_prediction_tokens)!=null&&(I.openai.acceptedPredictionTokens=null==(s=m.usage.completion_tokens_details)?void 0:s.accepted_prediction_tokens),(null==(u=m.usage.completion_tokens_details)?void 0:u.rejected_prediction_tokens)!=null&&(I.openai.rejectedPredictionTokens=null==(p=m.usage.completion_tokens_details)?void 0:p.rejected_prediction_tokens));let g=m.choices[0];if((null==g?void 0:g.finish_reason)!=null&&(y={unified:b(g.finish_reason),raw:g.finish_reason}),(null==(c=null==g?void 0:g.logprobs)?void 0:c.content)!=null&&(I.openai.logprobs=g.logprobs.content),(null==g?void 0:g.delta)==null)return;let h=g.delta;if(null!=h.content&&(z||(r.enqueue({type:"text-start",id:"0"}),z=!0),r.enqueue({type:"text-delta",id:"0",delta:h.content})),null!=h.tool_calls)for(let e of h.tool_calls)a.processDelta(e);if(null!=h.annotations)for(let e of h.annotations)r.enqueue({type:"source",sourceType:"url",id:(0,o.generateId)(),url:e.url_citation.url,title:e.url_citation.title})},flush(e){z&&e.enqueue({type:"text-end",id:"0"}),a.flush(),e.enqueue({type:"finish",finishReason:y,usage:f(n),...null!=I?{providerMetadata:I}:{}})}})),request:{body:u},response:{headers:m}}}};function S(e){return!("error"in e)&&e.choices.some(e=>{let t=e.delta;return(null==t?void 0:t.content)!=null&&t.content.length>0||(null==t?void 0:t.tool_calls)!=null&&t.tool_calls.length>0||(null==t?void 0:t.annotations)!=null&&t.annotations.length>0})}function k(e){var t,r,a,n;if(null==e)return(0,o.createNullLanguageModelUsage)();let i=null!=(t=e.prompt_tokens)?t:0,l=null!=(r=e.completion_tokens)?r:0;return{inputTokens:{total:null!=(a=e.prompt_tokens)?a:void 0,noCache:i,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:null!=(n=e.completion_tokens)?n:void 0,text:l,reasoning:void 0},raw:e}}function T(e){switch(e){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var M=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.object({id:i.z.string().nullish(),created:i.z.number().nullish(),model:i.z.string().nullish(),choices:i.z.array(i.z.object({text:i.z.string(),finish_reason:i.z.string(),logprobs:i.z.object({tokens:i.z.array(i.z.string()),token_logprobs:i.z.array(i.z.number()),top_logprobs:i.z.array(i.z.record(i.z.string(),i.z.number())).nullish()}).nullish()})),usage:i.z.object({prompt_tokens:i.z.number(),completion_tokens:i.z.number(),total_tokens:i.z.number()}).nullish()}))),C=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.union([i.z.object({id:i.z.string().nullish(),created:i.z.number().nullish(),model:i.z.string().nullish(),choices:i.z.array(i.z.object({text:i.z.string(),finish_reason:i.z.string().nullish(),index:i.z.number(),logprobs:i.z.object({tokens:i.z.array(i.z.string()),token_logprobs:i.z.array(i.z.number()),top_logprobs:i.z.array(i.z.record(i.z.string(),i.z.number())).nullish()}).nullish()})),usage:i.z.object({prompt_tokens:i.z.number(),completion_tokens:i.z.number(),total_tokens:i.z.number()}).nullish()}),l]))),E=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.object({echo:i.z.boolean().optional(),logitBias:i.z.record(i.z.string(),i.z.number()).optional(),suffix:i.z.string().optional(),user:i.z.string().optional(),logprobs:i.z.union([i.z.boolean(),i.z.number()]).optional()}))),j=class e{constructor(e,t){this.specificationVersion="v4",this.supportedUrls={},this.modelId=e,this.config=t}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}static[n.WORKFLOW_SERIALIZE](e){return(0,o.serializeModelOptions)({modelId:e.modelId,config:e.config})}static[n.WORKFLOW_DESERIALIZE](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:r,topP:n,topK:i,frequencyPenalty:l,presencePenalty:s,stopSequences:u,responseFormat:d,tools:p,toolChoice:c,seed:m,providerOptions:g}){let h=[],f={...await (0,o.parseProviderOptions)({provider:"openai",providerOptions:g,schema:E}),...await (0,o.parseProviderOptions)({provider:this.providerOptionsName,providerOptions:g,schema:E})};null!=i&&h.push({type:"unsupported",feature:"topK"}),(null==p?void 0:p.length)&&h.push({type:"unsupported",feature:"tools"}),null!=c&&h.push({type:"unsupported",feature:"toolChoice"}),null!=d&&"text"!==d.type&&h.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});let{prompt:y,stopSequences:v}=function({prompt:e,user:t="user",assistant:o="assistant"}){let r="";for(let{role:n,content:i}of("system"===e[0].role&&(r+=`${e[0].content}
|
|
1
|
+
module.exports=[656446,e=>e.a(async(t,o)=>{try{var r=e.i(666680);e.i(347299);var a=e.i(115737),n=e.i(68356),i=e.i(983477),l=e.i(469719),s=e.i(687388),u=e.i(340698),d=e.i(640911),p=e.i(53748),c=e.i(268486),m=e.i(41444),g=e.i(264079),h=t([u]);[u]=h.then?(await h)():h;let S="thursday",{apiKeyName:k,label:T}=g.TEXT_MODEL_PROVIDERS.chatgpt,M=`${T} is not signed in — sign in from Settings › API keys.`,C=l.z.object({access:l.z.string().min(1),refresh:l.z.string().min(1),expires:l.z.number(),accountId:l.z.string().min(1),plan:l.z.string().nullable()}),E=globalThis,j=E.__chatgptRenewal??=(0,c.createKeyedLock)();async function f(e){let t=await fetch("https://auth.openai.com/oauth/token",{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:"app_EMoamEEZ73f0CkXaXp7hrann",...e})}).catch(e=>{d.logger.warn({cause:e},"chatgpt token endpoint unreachable"),(0,p.publicError)("Could not reach ChatGPT's sign-in")}),o=await t.json().catch(()=>null),r=o?.access_token;if(!t.ok||!r){let e=o?.error,r="string"==typeof e?[e,o?.error_description].filter(Boolean).join(": "):e?.message??e?.code??"";(0,p.publicError)(`ChatGPT's sign-in answered ${t.status}${r?`: ${r}`:""}`)}let a=function(e){try{let t=JSON.parse(Buffer.from(e.split(".")[1]??"","base64url").toString("utf8")),o=t["https://api.openai.com/auth"]??{};return{accountId:"string"==typeof o.chatgpt_account_id?o.chatgpt_account_id:null,plan:"string"==typeof o.chatgpt_plan_type?o.chatgpt_plan_type:null,expires:"number"==typeof t.exp?1e3*t.exp:null}}catch{return{accountId:null,plan:null,expires:null}}}(r),n=o?.refresh_token??e.refresh_token;a.accountId&&n||(0,p.publicError)("ChatGPT's sign-in came back without an account");let i=o?.expires_in;return{access:r,refresh:n,expires:"number"==typeof i?Date.now()+1e3*i:a.expires??Date.now(),accountId:a.accountId,plan:a.plan}}async function y(){let e=await (0,u.readConfig)(k);if(!e)return null;try{return C.parse(JSON.parse(e))}catch{return null}}let O=e=>e.expires-s.CHATGPT_SIGN_IN.renewBeforeMs<=Date.now();async function v(){let e=await y();return(e||(0,p.publicError)(M),O(e))?j(k,async()=>{let e=await y();if(e||(0,p.publicError)(M),!O(e))return e;try{let t=await f({grant_type:"refresh_token",refresh_token:e.refresh});return await (0,u.writeConfig)(k,JSON.stringify(t)),t}catch(e){(0,p.publicError)(`Could not renew the ${T} sign-in (${(0,m.errorToString)(e)}). If it keeps failing, sign in again from Settings › API keys.`)}}):e}async function b(){return(await y())?.plan??null}async function _(){let e;if(!await y())return null;try{e=await v()}catch(e){return{refused:(0,m.errorToString)(e)}}let t=await fetch("https://chatgpt.com/backend-api/wham/usage",{headers:{accept:"application/json",authorization:`Bearer ${e.access}`,"chatgpt-account-id":e.accountId,originator:S}}).catch(e=>{d.logger.warn({cause:e},"chatgpt usage unreachable"),(0,p.publicError)("Could not reach ChatGPT")}),o=await t.json().catch(()=>null);if(401===t.status||403===t.status)return{refused:o?.error?.message??o?.detail??`ChatGPT answered ${t.status}`};t.ok||(0,p.publicError)(`ChatGPT answered ${t.status}`);let r=[o?.rate_limit?.primary_window,o?.rate_limit?.secondary_window].filter(e=>"number"==typeof e?.used_percent).sort((e,t)=>(t.used_percent??0)-(e.used_percent??0))[0];r||(0,p.publicError)("ChatGPT did not say how much of the plan is used");let a=Math.round(r.used_percent??0),n=!!o?.rate_limit?.limit_reached,i=r.reset_at?1e3*r.reset_at:r.reset_after_seconds?Date.now()+1e3*r.reset_after_seconds:null;return{plan:o?.plan_type??e.plan,usedPercent:a,resetsAt:i?new Date(i).toISOString():null,spent:n,high:n||a>=s.CHATGPT_USAGE_HIGH}}async function w(e,t){let o=await v(),r=new Headers(t?.headers);if(r.set("authorization",`Bearer ${o.access}`),r.set("chatgpt-account-id",o.accountId),r.set("originator",S),t?.method!=="POST"||"string"!=typeof t.body||!String(e).endsWith("/responses"))return fetch(e,{...t,headers:r});let a=JSON.parse(t.body),n=!0===a.stream;a.prompt_cache_key&&r.set("session-id",a.prompt_cache_key);let i=[];a.input=(a.input??[]).filter(e=>"system"!==e.role&&"developer"!==e.role||(i.push("string"==typeof e.content?e.content:(e.content??[]).map(e=>e.text??"").join("\n")),!1)),a.instructions=[a.instructions,...i].filter(Boolean).join("\n\n")||"You are a helpful assistant.",a.store=!1,a.stream=!0,a.max_output_tokens=void 0,r.set("accept","text/event-stream");let l=await fetch(e,{...t,headers:r,body:JSON.stringify(a)});return 429===l.status?I(l):l.ok?n?l:x(l):z(l)}async function z(e){let t=await e.clone().json().catch(()=>null);if("string"!=typeof t?.detail)return e;let o=e.headers.get("retry-after");return Response.json({error:{message:t.detail}},{status:e.status,headers:o?{"retry-after":o}:{}})}async function I(e){let t=await e.text(),o={};try{o=JSON.parse(t).error??{}}catch{}if(!/usage_limit_reached|usage_not_included/.test(`${o.code} ${o.type}`)){let o=e.headers.get("retry-after");return new Response(t,{status:429,headers:{"content-type":"application/json",...o?{"retry-after":o}:{}}})}let r=o.resets_at?1e3*o.resets_at:o.resets_in_seconds?Date.now()+1e3*o.resets_in_seconds:null,a=o.plan_type?` on the ${o.plan_type} plan`:"",n=r?` It resets in ${(0,i.formatDistanceToNowStrict)(r)}.`:"";return Response.json({error:{message:`${T} usage limit reached${a}.${n}`,code:o.code??o.type}},{status:402})}async function x(e){let t=[],o=null,r=null;for(let a of(await e.text()).replaceAll("\r\n","\n").split("\n\n")){let e,n=a.split("\n").filter(e=>e.startsWith("data:")).map(e=>e.slice(5).trimStart()).join("\n");if(n&&"[DONE]"!==n){try{e=JSON.parse(n)}catch{continue}"response.output_item.done"===e.type?t.push(e.item):"response.completed"===e.type||"response.incomplete"===e.type?o=e.response??{}:"response.failed"===e.type?r=e.response?.error??{message:"The response failed"}:"error"===e.type&&(r={code:e.code,message:e.message})}}return r||!o?Response.json({error:{message:r?.message??"The stream ended before the response finished",code:r?.code}},{status:r?.code==="context_length_exceeded"?400:500}):Response.json({...o,output:o.output?.length?o.output:t})}e.s(["chatGptModel",0,function(e){let t=(0,a.createOpenAI)({baseURL:"https://chatgpt.com/backend-api/codex",apiKey:"signed-in",headers:{"OpenAI-Beta":"responses=experimental"},fetch:w}),o=(0,r.randomUUID)();return(0,n.wrapLanguageModel)({model:t.responses(e),middleware:{transformParams:async({params:e})=>({...e,providerOptions:{...e.providerOptions,openai:{promptCacheKey:o,...e.providerOptions?.openai,store:!1,includeWebSearchSources:!1}}})}})},"chatGptSearch",0,()=>(0,a.createOpenAI)({apiKey:"signed-in"}).tools.webSearch(),"readChatGptPlan",0,b,"readChatGptUsage",0,_]),o()}catch(e){o(e)}},!1),268486,e=>{"use strict";var t=e.i(41444);e.s(["createKeyedLock",0,function(){let e=new Map,o=new Map;return function(r,a){let n=e.get(r);n||(n=(0,t.PromiseChain)(),e.set(r,n)),o.set(r,(o.get(r)??0)+1);let i=()=>{let t=(o.get(r)??1)-1;t>0?o.set(r,t):(o.delete(r),e.delete(r))};return n(a).then(e=>(i(),e),e=>{throw i(),e})}}])},115737,e=>{"use strict";var t,o=e.i(847841),r=e.i(546888),a=e.i(376261),n=e.i(110567),i=e.i(469719),l=i.z.object({error:i.z.object({message:i.z.string(),type:i.z.string().nullish(),param:i.z.any().nullish(),code:i.z.union([i.z.string(),i.z.number()]).nullish()})}),s=(0,o.createJsonErrorResponseHandler)({errorSchema:l,errorToMessage:e=>e.error.message});function u(e){var t,o,r,a,n,i;let l,s=(i=e,null==(l=/^o(\d+)(?:-|$)/.exec(i))?void 0:Number(l[1])),u=function(e){let t=/^gpt-(\d+)(?:\.(\d+))?(?:-(.+))?$/.exec(e);if(null!=t)return{major:Number(t[1]),minor:null==t[2]?void 0:Number(t[2]),variant:t[3]}}(e),d=(null==u?void 0:u.minor)==null&&null!=(o=null==(t=null==u?void 0:u.variant)?void 0:t.startsWith("chat"))&&o,p=null!=(a=null==(r=null==u?void 0:u.variant)?void 0:r.startsWith("nano"))&&a,c=null!=u&&u.major>=6,m="gpt-6-sol"===e||"gpt-6-luna"===e,g=null!=s&&s>=3||null!=u&&u.major>=5&&!d,h=e.startsWith("gpt-4")||null!=u&&u.major>=5&&!p&&!d||null!=s&&s>=3,f=null!=s||null!=u&&u.major>=5&&!d,y=!c&&null!=u&&(u.major>5||5===u.major&&(null!=(n=u.minor)?n:0)>=1);return{supportsFlexProcessing:g,supportsPriorityProcessing:h,supportsConfigurationUpdate:c,supportsAsyncToolCalling:c,supportedReasoningEfforts:m?["none","low","medium","high","xhigh","max"]:c?["low","medium","high","xhigh","max"]:void 0,isReasoningModel:f,systemMessageMode:f?"developer":"system",supportsNonReasoningParameters:y}}function d(e){var t,r;let a=function(e){var t;let o=g(e);if(null==o)return;if("response.failed"===o.type){let e=g(o.response),t=g(null==e?void 0:e.error);return"string"==typeof(null==t?void 0:t.message)?{message:t.message,code:h(t.code),type:"response.failed"}:void 0}let r=null!=(t=g(o.error))?t:o;return"string"==typeof r.message&&(null!=g(o.error)||"string"==typeof r.type||"code"in r||"param"in r)?{message:r.message,code:h(r.code),type:"string"==typeof r.type?r.type:void 0}:void 0}(e);if(null==a)return;let n=function(e){var t,o;let r,a="number"==typeof(r="string"==typeof(t=e.code)&&/^\d{3}$/.test(t)?Number(t):t)&&Number.isInteger(o=r)&&o>=400&&o<=599?r:void 0;if(null!=a)return a;let n=[e.code,e.type].filter(e=>"string"==typeof e||"number"==typeof e).join(" ").toLowerCase();return["insufficient_quota","rate_limit"].some(e=>n.includes(e))?429:n.includes("authentication")?401:n.includes("permission")?403:n.includes("not_found")?404:["invalid","bad_request","context_length"].some(e=>n.includes(e))?400:n.includes("overload")?503:n.includes("timeout")?504:500}(a);return(0,o.createProviderStreamError)({message:a.message,type:null!=(t=a.type)?t:void 0,code:null!=(r=a.code)?r:void 0,statusCode:n,isRetryable:function(e,t){return"insufficient_quota"!==e.code&&"insufficient_quota"!==e.type&&(408===t||409===t||429===t||t>=500)}(a,n),data:e})}async function p({stream:e,getError:t,isOutputChunk:o,isAcceptedChunk:r,acceptedGraceMs:n=50,url:i,requestBodyValues:l,responseHeaders:s}){let[u,g]=e.tee(),h=u.getReader(),f=!1;try{let e=!1;for(;;){let u;if(e){let e=await m(h.read(),n);if(e.timedOut)return g;u=e.value}else u=await h.read();if(u.done)return g;let p=u.value;if(!p.success)return g;let y=t(p.value);if(null!=y)throw f=!0,c(h).catch(()=>{}),c(g.getReader()).catch(()=>{}),function({frame:e,url:t,requestBodyValues:o,responseHeaders:r}){var n,i;let l=d(e);return new a.APICallError({message:null!=(n=null==l?void 0:l.message)?n:"OpenAI stream failed before any output was generated",url:t,requestBodyValues:o,statusCode:null!=(i=null==l?void 0:l.statusCode)?i:500,responseHeaders:r,responseBody:JSON.stringify(e),data:e,isRetryable:null==l?void 0:l.isRetryable})}({frame:y,url:i,requestBodyValues:l,responseHeaders:s});if(o(p.value))return g;e||(null==r?void 0:r(p.value))!==!0||(e=!0)}}finally{f||(h.cancel().catch(()=>{}),h.releaseLock())}}async function c(e){try{for(;!(await e.read()).done;);}catch(e){}finally{e.releaseLock()}}async function m(e,t){let o,r=e.then(e=>({timedOut:!1,value:e}));try{let e=await Promise.race([r,new Promise(e=>{o=setTimeout(()=>e({timedOut:!0}),t)})]);return e.timedOut&&r.catch(()=>{}),e}finally{clearTimeout(o)}}function g(e){return"object"==typeof e&&null!=e?e:void 0}function h(e){return"string"==typeof e||"number"==typeof e?e:void 0}function f(e){var t,r,a,n,i,l,s,u;if(null==e)return(0,o.createNullLanguageModelUsage)();let d=null!=(t=e.prompt_tokens)?t:0,p=null!=(r=e.completion_tokens)?r:0,c=null!=(n=null==(a=e.prompt_tokens_details)?void 0:a.cached_tokens)?n:0,m=null!=(l=null==(i=e.prompt_tokens_details)?void 0:i.cache_write_tokens)?l:void 0,g=null!=(u=null==(s=e.completion_tokens_details)?void 0:s.reasoning_tokens)?u:0;return{inputTokens:{total:d,noCache:d-c-(null!=m?m:0),cacheRead:c,cacheWrite:m},outputTokens:{total:p,text:Math.max(0,p-g),reasoning:g},raw:e}}function y(e){var t;return null==(t=null==e?void 0:e.openai)?void 0:t.promptCacheBreakpoint}function v({id:e,model:t,created:r}){return(0,o.createLanguageModelResponseMetadata)({id:e,model:t,created:r||void 0})}function b(e){switch(e){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var _=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.object({id:i.z.string().nullish(),created:i.z.number().nullish(),model:i.z.string().nullish(),choices:i.z.array(i.z.object({message:i.z.object({role:i.z.literal("assistant").nullish(),content:i.z.string().nullish(),audio:i.z.object({transcript:i.z.string().nullish()}).nullish(),tool_calls:i.z.array(i.z.object({id:i.z.string().nullish(),type:i.z.literal("function"),function:i.z.object({name:i.z.string(),arguments:i.z.string()})})).nullish(),annotations:i.z.array(i.z.object({type:i.z.literal("url_citation"),url_citation:i.z.object({start_index:i.z.number(),end_index:i.z.number(),url:i.z.string(),title:i.z.string()})})).nullish()}),index:i.z.number(),logprobs:i.z.object({content:i.z.array(i.z.object({token:i.z.string(),logprob:i.z.number(),top_logprobs:i.z.array(i.z.object({token:i.z.string(),logprob:i.z.number()}))})).nullish()}).nullish(),finish_reason:i.z.string().nullish()})),usage:i.z.object({prompt_tokens:i.z.number().nullish(),completion_tokens:i.z.number().nullish(),total_tokens:i.z.number().nullish(),prompt_tokens_details:i.z.object({cached_tokens:i.z.number().nullish(),cache_write_tokens:i.z.number().nullish()}).nullish(),completion_tokens_details:i.z.object({reasoning_tokens:i.z.number().nullish(),accepted_prediction_tokens:i.z.number().nullish(),rejected_prediction_tokens:i.z.number().nullish()}).nullish()}).nullish()}))),w=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.union([i.z.object({id:i.z.string().nullish(),created:i.z.number().nullish(),model:i.z.string().nullish(),choices:i.z.array(i.z.object({delta:i.z.object({role:i.z.enum(["assistant"]).nullish(),content:i.z.string().nullish(),tool_calls:i.z.array(i.z.object({index:i.z.number(),id:i.z.string().nullish(),type:i.z.literal("function").nullish(),function:i.z.object({name:i.z.string().nullish(),arguments:i.z.string().nullish()})})).nullish(),annotations:i.z.array(i.z.object({type:i.z.literal("url_citation"),url_citation:i.z.object({start_index:i.z.number(),end_index:i.z.number(),url:i.z.string(),title:i.z.string()})})).nullish()}).nullish(),logprobs:i.z.object({content:i.z.array(i.z.object({token:i.z.string(),logprob:i.z.number(),top_logprobs:i.z.array(i.z.object({token:i.z.string(),logprob:i.z.number()}))})).nullish()}).nullish(),finish_reason:i.z.string().nullish(),index:i.z.number()})),usage:i.z.object({prompt_tokens:i.z.number().nullish(),completion_tokens:i.z.number().nullish(),total_tokens:i.z.number().nullish(),prompt_tokens_details:i.z.object({cached_tokens:i.z.number().nullish(),cache_write_tokens:i.z.number().nullish()}).nullish(),completion_tokens_details:i.z.object({reasoning_tokens:i.z.number().nullish(),accepted_prediction_tokens:i.z.number().nullish(),rejected_prediction_tokens:i.z.number().nullish()}).nullish()}).nullish()}),l]))),z=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.object({logitBias:i.z.record(i.z.coerce.number(),i.z.number()).optional(),logprobs:i.z.union([i.z.boolean(),i.z.number()]).optional(),parallelToolCalls:i.z.boolean().optional(),user:i.z.string().optional(),reasoningEffort:i.z.enum(["none","minimal","low","medium","high","xhigh","max"]).optional(),maxCompletionTokens:i.z.number().optional(),store:i.z.boolean().optional(),metadata:i.z.record(i.z.string().max(64),i.z.string().max(512)).optional(),prediction:i.z.record(i.z.string(),i.z.any()).optional(),serviceTier:i.z.enum(["auto","flex","priority","fast","ultrafast","default"]).optional(),strictJsonSchema:i.z.boolean().optional(),textVerbosity:i.z.enum(["low","medium","high"]).optional(),promptCacheKey:i.z.string().optional(),promptCacheOptions:i.z.object({mode:i.z.enum(["implicit","explicit"]).optional(),ttl:i.z.literal("30m").optional()}).optional(),promptCacheRetention:i.z.enum(["in_memory","24h"]).optional(),safetyIdentifier:i.z.string().optional(),systemMessageMode:i.z.enum(["system","developer","remove"]).optional(),forceReasoning:i.z.boolean().optional()})));function I(e){let t=!1,o=!1,r=i(e),n=[];return t&&n.push({type:"compatibility",feature:"JSON Schema propertyNames",details:"OpenAI does not support JSON Schema propertyNames. It was removed before sending the schema, so OpenAI will not enforce property-name constraints."}),o&&n.push({type:"compatibility",feature:"JSON Schema pattern with regex lookaround",details:"OpenAI does not support regex lookaround in JSON Schema patterns. The pattern was removed before sending the schema, so OpenAI will not enforce that constraint."}),{schema:r,warnings:n};function i(e){let r=e.propertyNames;if(null!=r){if("boolean"==typeof r||"string"!==r.type)throw new a.UnsupportedFunctionalityError({functionality:"JSON Schema propertyNames that does not use a string schema"});t=!0}let n={...e};for(let e of(delete n.propertyNames,null!=n.pattern&&function(e){let t=!1,o=!1;for(let r=0;r<e.length;r++){let a=e[r];if(t){t=!1;continue}if("\\"===a){t=!0;continue}if("["===a){o=!0;continue}if("]"===a){o=!1;continue}if(!o&&"("===a&&"?"===e[r+1]){let t=e[r+2];if("="===t||"!"===t||"<"===t&&("="===e[r+3]||"!"===e[r+3]))return!0}}return!1}(n.pattern)&&(delete n.pattern,o=!0),null!=n.properties&&(n.properties=l(n.properties)),null!=n.patternProperties&&(n.patternProperties=l(n.patternProperties)),null!=n.additionalProperties&&(n.additionalProperties=s(n.additionalProperties)),null!=n.additionalItems&&(n.additionalItems=s(n.additionalItems)),null!=n.items&&(n.items=Array.isArray(n.items)?n.items.map(s):s(n.items)),null!=n.contains&&(n.contains=s(n.contains)),null!=n.not&&(n.not=s(n.not)),null!=n.allOf&&(n.allOf=n.allOf.map(s)),null!=n.anyOf&&(n.anyOf=n.anyOf.map(s)),null!=n.oneOf&&(n.oneOf=n.oneOf.map(s)),null!=n.definitions&&(n.definitions=l(n.definitions)),null!=n.$defs&&(n.$defs=l(n.$defs)),null!=n.dependencies&&(n.dependencies=Object.fromEntries(Object.entries(n.dependencies).map(([e,t])=>[e,Array.isArray(t)?t:s(t)]))),["if","then","else"])){let t=n[e];null!=t&&(n[e]=s(t))}return n}function l(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,s(t)]))}function s(e){return"boolean"==typeof e?e:i(e)}}var x=class e{constructor(e,t){this.specificationVersion="v4",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[n.WORKFLOW_SERIALIZE](e){return(0,o.serializeModelOptions)({modelId:e.modelId,config:e.config})}static[n.WORKFLOW_DESERIALIZE](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:r,topP:n,topK:i,frequencyPenalty:l,presencePenalty:s,stopSequences:d,responseFormat:p,seed:c,tools:m,toolChoice:g,reasoning:h,providerOptions:f}){var v,b,_,w,x,S;let k=[],T=null!=(v=await (0,o.parseProviderOptions)({provider:"openai",providerOptions:f,schema:z}))?v:{},M=u(this.modelId),C=null!=(b=T.reasoningEffort)?b:(0,o.isCustomReasoning)(h)?h:void 0;null==C||null==M.supportedReasoningEfforts||M.supportedReasoningEfforts.includes(C)||(k.push({type:"unsupported",feature:"reasoningEffort",details:`${this.modelId} only supports the following reasoning efforts: ${M.supportedReasoningEfforts.join(", ")}`}),C=void 0);let E=null!=(_=T.forceReasoning)?_:M.isReasoningModel;null!=i&&k.push({type:"unsupported",feature:"topK"});let{messages:j,warnings:O}=function({prompt:e,systemMessageMode:t="system"}){var r,n,i;let l=[],s=[];for(let{role:u,content:d,providerOptions:p}of e)switch(u){case"system":switch(t){case"system":{let e=y(p);l.push({role:"system",content:null==e?d:[{type:"text",text:d,prompt_cache_breakpoint:e}]});break}case"developer":{let e=y(p);l.push({role:"developer",content:null==e?d:[{type:"text",text:d,prompt_cache_breakpoint:e}]});break}case"remove":s.push({type:"other",message:"system messages are removed for this model"});break;default:throw Error(`Unsupported system message mode: ${t}`)}break;case"user":if(1===d.length&&"text"===d[0].type&&null==y(d[0].providerOptions)){l.push({role:"user",content:d[0].text});break}l.push({role:"user",content:d.map((e,t)=>{var r,n,i;switch(e.type){case"text":{let t=y(e.providerOptions);return{type:"text",text:e.text,...null!=t&&{prompt_cache_breakpoint:t}}}case"file":{let l=y(e.providerOptions);switch(e.data.type){case"reference":return{type:"file",file:{file_id:(0,o.resolveProviderReference)({reference:e.data.reference,provider:"openai"})},...null!=l&&{prompt_cache_breakpoint:l}};case"text":throw new a.UnsupportedFunctionalityError({functionality:"text file parts"});case"url":case"data":{let s=(0,o.getTopLevelMediaType)(e.mediaType);if("image"===s)return{type:"image_url",image_url:{url:"url"===e.data.type?e.data.url.toString():`data:${(0,o.resolveFullMediaType)({part:e})};base64,${(0,o.convertToBase64)(e.data.data)}`,detail:null==(n=null==(r=e.providerOptions)?void 0:r.openai)?void 0:n.imageDetail},...null!=l&&{prompt_cache_breakpoint:l}};if("audio"===s){if("url"===e.data.type)throw new a.UnsupportedFunctionalityError({functionality:"audio file parts with URLs"});let t=(0,o.resolveFullMediaType)({part:e});switch(t){case"audio/wav":return{type:"input_audio",input_audio:{data:(0,o.convertToBase64)(e.data.data),format:"wav"},...null!=l&&{prompt_cache_breakpoint:l}};case"audio/mp3":case"audio/mpeg":return{type:"input_audio",input_audio:{data:(0,o.convertToBase64)(e.data.data),format:"mp3"},...null!=l&&{prompt_cache_breakpoint:l}};default:throw new a.UnsupportedFunctionalityError({functionality:`audio content parts with media type ${t}`})}}{let r=(0,o.resolveFullMediaType)({part:e});if("application/pdf"!==r)throw new a.UnsupportedFunctionalityError({functionality:`file part media type ${r}`});if("url"===e.data.type)throw new a.UnsupportedFunctionalityError({functionality:"PDF file parts with URLs"});return{type:"file",file:{filename:null!=(i=e.filename)?i:`part-${t}.pdf`,file_data:`data:application/pdf;base64,${(0,o.convertToBase64)(e.data.data)}`},...null!=l&&{prompt_cache_breakpoint:l}}}}}}}})});break;case"assistant":{let e="",t=[],o=!1,r=[];for(let a of d)switch(a.type){case"text":{let r=y(a.providerOptions);e+=a.text,t.push({type:"text",text:a.text,...null!=r&&{prompt_cache_breakpoint:r}}),o||(o=null!=r);break}case"tool-call":r.push({id:a.toolCallId,type:"function",function:{name:a.toolName,arguments:JSON.stringify("object"!=typeof(i=a.input)||null===i||Array.isArray(i)?{}:i)}})}l.push({role:"assistant",content:o?t:r.length>0?e||null:e,tool_calls:r.length>0?r:void 0});break}case"tool":for(let e of d){let t;if("tool-approval-response"===e.type)continue;let o=e.output,a=null!=(r="content"===o.type?o.value.map(e=>y(e.providerOptions)).find(e=>null!=e):y(o.providerOptions))?r:y(e.providerOptions);switch(o.type){case"text":case"error-text":t=o.value;break;case"execution-denied":t=null!=(n=o.reason)?n:"Tool call execution denied.";break;case"content":case"json":case"error-json":t=JSON.stringify(o.value)}l.push({role:"tool",tool_call_id:e.toolCallId,content:null==a?t:[{type:"text",text:t,prompt_cache_breakpoint:a}]})}break;default:throw Error(`Unsupported role: ${u}`)}return{messages:l,warnings:s}}({prompt:e,systemMessageMode:null!=(w=T.systemMessageMode)?w:E?"developer":M.systemMessageMode});k.push(...O);let R=null==(x=T.strictJsonSchema)||x,A=(null==p?void 0:p.type)==="json"&&null!=p.schema?I(p.schema):void 0;null!=A&&k.push(...A.warnings);let N={model:this.modelId,logit_bias:T.logitBias,logprobs:!0===T.logprobs||"number"==typeof T.logprobs||void 0,top_logprobs:"number"==typeof T.logprobs?T.logprobs:"boolean"==typeof T.logprobs&&T.logprobs?0:void 0,user:T.user,parallel_tool_calls:T.parallelToolCalls,max_tokens:t,temperature:r,top_p:n,frequency_penalty:l,presence_penalty:s,response_format:(null==p?void 0:p.type)==="json"?null!=A?{type:"json_schema",json_schema:{schema:A.schema,strict:R,name:null!=(S=p.name)?S:"response",description:p.description}}:{type:"json_object"}:void 0,stop:d,seed:c,verbosity:T.textVerbosity,max_completion_tokens:T.maxCompletionTokens,store:T.store,metadata:T.metadata,prediction:T.prediction,reasoning_effort:C,service_tier:T.serviceTier,prompt_cache_key:T.promptCacheKey,prompt_cache_options:T.promptCacheOptions,prompt_cache_retention:T.promptCacheRetention,safety_identifier:T.safetyIdentifier,messages:j};null!=M.supportedReasoningEfforts&&null!=N.prompt_cache_retention&&(N.prompt_cache_retention=void 0,k.push({type:"unsupported",feature:"promptCacheRetention",details:"promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"})),E?("none"===C&&M.supportsNonReasoningParameters||(null!=N.temperature&&(N.temperature=void 0,k.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for reasoning models"})),null!=N.top_p&&(N.top_p=void 0,k.push({type:"unsupported",feature:"topP",details:"topP is not supported for reasoning models"})),null!=N.logprobs&&(N.logprobs=void 0,k.push({type:"other",message:"logprobs is not supported for reasoning models"}))),null!=N.frequency_penalty&&(N.frequency_penalty=void 0,k.push({type:"unsupported",feature:"frequencyPenalty",details:"frequencyPenalty is not supported for reasoning models"})),null!=N.presence_penalty&&(N.presence_penalty=void 0,k.push({type:"unsupported",feature:"presencePenalty",details:"presencePenalty is not supported for reasoning models"})),null!=N.logit_bias&&(N.logit_bias=void 0,k.push({type:"other",message:"logitBias is not supported for reasoning models"})),null!=N.top_logprobs&&(N.top_logprobs=void 0,k.push({type:"other",message:"topLogprobs is not supported for reasoning models"})),null!=N.max_tokens&&(null==N.max_completion_tokens&&(N.max_completion_tokens=N.max_tokens),N.max_tokens=void 0)):(this.modelId.startsWith("gpt-4o-search-preview")||this.modelId.startsWith("gpt-4o-mini-search-preview"))&&null!=N.temperature&&(N.temperature=void 0,k.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for the search preview models and has been removed."})),"flex"!==T.serviceTier||M.supportsFlexProcessing||(k.push({type:"unsupported",feature:"serviceTier",details:"flex processing is only available for o3, o4-mini, and gpt-5 models"}),N.service_tier=void 0),"priority"!==T.serviceTier&&"fast"!==T.serviceTier||M.supportsPriorityProcessing||(k.push({type:"unsupported",feature:"serviceTier",details:"priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"}),N.service_tier=void 0);let{tools:P,toolChoice:q,toolWarnings:$}=function({tools:e,toolChoice:t}){e=(null==e?void 0:e.length)?e:void 0;let o=[];if(null==e)return{tools:void 0,toolChoice:void 0,toolWarnings:o};let r=[];for(let t of e)if("function"===t.type){let e=I(t.inputSchema);o.push(...e.warnings),r.push({type:"function",function:{name:t.name,description:t.description,parameters:e.schema,...null!=t.strict?{strict:t.strict}:{}}})}else o.push({type:"unsupported",feature:`tool type: ${t.type}`});if(null==t)return{tools:r,toolChoice:void 0,toolWarnings:o};let n=t.type;switch(n){case"auto":case"none":case"required":return{tools:r,toolChoice:n,toolWarnings:o};case"tool":return{tools:r,toolChoice:{type:"function",function:{name:t.toolName}},toolWarnings:o};default:throw new a.UnsupportedFunctionalityError({functionality:`tool choice type: ${n}`})}}({tools:m,toolChoice:g});return{args:{...N,tools:P,tool_choice:q},warnings:[...k,...$]}}async doGenerate(e){var t,r,n,i,l,u,d,p;let{args:c,warnings:m}=await this.getArgs(e),{responseHeaders:g,value:h,rawValue:y}=await (0,o.postJsonToApi)({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:(0,o.combineHeaders)(null==(r=(t=this.config).headers)?void 0:r.call(t),e.headers),body:c,failedResponseHandler:s,successfulResponseHandler:(0,o.createJsonResponseHandler)(_),abortSignal:e.abortSignal,fetch:this.config.fetch}),w=h.choices[0];if(null==w)throw new a.InvalidResponseDataError({data:y,message:"Response did not contain any choices."});let z=[],I=null!=w.message.content&&w.message.content.length>0?w.message.content:null==(n=w.message.audio)?void 0:n.transcript;for(let e of(null!=I&&I.length>0&&z.push({type:"text",text:I}),null!=(i=w.message.tool_calls)?i:[]))z.push({type:"tool-call",toolCallId:e.id||(0,o.generateId)(),toolName:e.function.name,input:e.function.arguments});for(let e of null!=(l=w.message.annotations)?l:[])z.push({type:"source",sourceType:"url",id:(0,o.generateId)(),url:e.url_citation.url,title:e.url_citation.title});let x=null==(u=h.usage)?void 0:u.completion_tokens_details,S={openai:{}};return(null==x?void 0:x.accepted_prediction_tokens)!=null&&(S.openai.acceptedPredictionTokens=null==x?void 0:x.accepted_prediction_tokens),(null==x?void 0:x.rejected_prediction_tokens)!=null&&(S.openai.rejectedPredictionTokens=null==x?void 0:x.rejected_prediction_tokens),(null==(d=w.logprobs)?void 0:d.content)!=null&&(S.openai.logprobs=w.logprobs.content),{content:z,finishReason:{unified:b(w.finish_reason),raw:null!=(p=w.finish_reason)?p:void 0},usage:f(h.usage),request:{body:c},response:{...v(h),headers:g,body:y},warnings:m,providerMetadata:S}}async doStream(e){var t,r;let a,n,{args:i,warnings:l}=await this.getArgs(e),u={...i,stream:!0,stream_options:{include_usage:!0}},c=this.config.url({path:"/chat/completions",modelId:this.modelId}),{responseHeaders:m,value:g}=await (0,o.postJsonToApi)({url:c,headers:(0,o.combineHeaders)(null==(r=(t=this.config).headers)?void 0:r.call(t),e.headers),body:u,failedResponseHandler:s,successfulResponseHandler:(0,o.createEventSourceResponseHandler)(w),abortSignal:e.abortSignal,fetch:this.config.fetch}),h=await p({stream:g,getError:e=>"error"in e?e.error:void 0,isOutputChunk:S,url:c,requestBodyValues:u,responseHeaders:m}),y={unified:"other",raw:void 0},_=!1,z=!1,I={openai:{}};return{stream:h.pipeThrough(new TransformStream({start(e){a=new o.StreamingToolCallTracker(e,{generateId:o.generateId,typeValidation:"if-present"}),e.enqueue({type:"stream-start",warnings:l})},transform(t,r){var i,l,s,u,p,c;if(e.includeRawChunks&&r.enqueue({type:"raw",rawValue:t.rawValue}),!t.success){y={unified:"error",raw:void 0},r.enqueue({type:"error",error:t.error});return}let m=t.value;if("error"in m){y={unified:"error",raw:void 0},r.enqueue({type:"error",error:null!=(i=d(m.error))?i:m.error});return}!_&&Object.values(v(m)).some(Boolean)&&(_=!0,r.enqueue({type:"response-metadata",...v(m)})),null!=m.usage&&(n=m.usage,(null==(l=m.usage.completion_tokens_details)?void 0:l.accepted_prediction_tokens)!=null&&(I.openai.acceptedPredictionTokens=null==(s=m.usage.completion_tokens_details)?void 0:s.accepted_prediction_tokens),(null==(u=m.usage.completion_tokens_details)?void 0:u.rejected_prediction_tokens)!=null&&(I.openai.rejectedPredictionTokens=null==(p=m.usage.completion_tokens_details)?void 0:p.rejected_prediction_tokens));let g=m.choices[0];if((null==g?void 0:g.finish_reason)!=null&&(y={unified:b(g.finish_reason),raw:g.finish_reason}),(null==(c=null==g?void 0:g.logprobs)?void 0:c.content)!=null&&(I.openai.logprobs=g.logprobs.content),(null==g?void 0:g.delta)==null)return;let h=g.delta;if(null!=h.content&&(z||(r.enqueue({type:"text-start",id:"0"}),z=!0),r.enqueue({type:"text-delta",id:"0",delta:h.content})),null!=h.tool_calls)for(let e of h.tool_calls)a.processDelta(e);if(null!=h.annotations)for(let e of h.annotations)r.enqueue({type:"source",sourceType:"url",id:(0,o.generateId)(),url:e.url_citation.url,title:e.url_citation.title})},flush(e){z&&e.enqueue({type:"text-end",id:"0"}),a.flush(),e.enqueue({type:"finish",finishReason:y,usage:f(n),...null!=I?{providerMetadata:I}:{}})}})),request:{body:u},response:{headers:m}}}};function S(e){return!("error"in e)&&e.choices.some(e=>{let t=e.delta;return(null==t?void 0:t.content)!=null&&t.content.length>0||(null==t?void 0:t.tool_calls)!=null&&t.tool_calls.length>0||(null==t?void 0:t.annotations)!=null&&t.annotations.length>0})}function k(e){var t,r,a,n;if(null==e)return(0,o.createNullLanguageModelUsage)();let i=null!=(t=e.prompt_tokens)?t:0,l=null!=(r=e.completion_tokens)?r:0;return{inputTokens:{total:null!=(a=e.prompt_tokens)?a:void 0,noCache:i,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:null!=(n=e.completion_tokens)?n:void 0,text:l,reasoning:void 0},raw:e}}function T(e){switch(e){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var M=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.object({id:i.z.string().nullish(),created:i.z.number().nullish(),model:i.z.string().nullish(),choices:i.z.array(i.z.object({text:i.z.string(),finish_reason:i.z.string(),logprobs:i.z.object({tokens:i.z.array(i.z.string()),token_logprobs:i.z.array(i.z.number()),top_logprobs:i.z.array(i.z.record(i.z.string(),i.z.number())).nullish()}).nullish()})),usage:i.z.object({prompt_tokens:i.z.number(),completion_tokens:i.z.number(),total_tokens:i.z.number()}).nullish()}))),C=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.union([i.z.object({id:i.z.string().nullish(),created:i.z.number().nullish(),model:i.z.string().nullish(),choices:i.z.array(i.z.object({text:i.z.string(),finish_reason:i.z.string().nullish(),index:i.z.number(),logprobs:i.z.object({tokens:i.z.array(i.z.string()),token_logprobs:i.z.array(i.z.number()),top_logprobs:i.z.array(i.z.record(i.z.string(),i.z.number())).nullish()}).nullish()})),usage:i.z.object({prompt_tokens:i.z.number(),completion_tokens:i.z.number(),total_tokens:i.z.number()}).nullish()}),l]))),E=(0,o.lazySchema)(()=>(0,o.zodSchema)(i.z.object({echo:i.z.boolean().optional(),logitBias:i.z.record(i.z.string(),i.z.number()).optional(),suffix:i.z.string().optional(),user:i.z.string().optional(),logprobs:i.z.union([i.z.boolean(),i.z.number()]).optional()}))),j=class e{constructor(e,t){this.specificationVersion="v4",this.supportedUrls={},this.modelId=e,this.config=t}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}static[n.WORKFLOW_SERIALIZE](e){return(0,o.serializeModelOptions)({modelId:e.modelId,config:e.config})}static[n.WORKFLOW_DESERIALIZE](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:r,topP:n,topK:i,frequencyPenalty:l,presencePenalty:s,stopSequences:u,responseFormat:d,tools:p,toolChoice:c,seed:m,providerOptions:g}){let h=[],f={...await (0,o.parseProviderOptions)({provider:"openai",providerOptions:g,schema:E}),...await (0,o.parseProviderOptions)({provider:this.providerOptionsName,providerOptions:g,schema:E})};null!=i&&h.push({type:"unsupported",feature:"topK"}),(null==p?void 0:p.length)&&h.push({type:"unsupported",feature:"tools"}),null!=c&&h.push({type:"unsupported",feature:"toolChoice"}),null!=d&&"text"!==d.type&&h.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});let{prompt:y,stopSequences:v}=function({prompt:e,user:t="user",assistant:o="assistant"}){let r="";for(let{role:n,content:i}of("system"===e[0].role&&(r+=`${e[0].content}
|
|
2
2
|
|
|
3
3
|
`,e=e.slice(1)),e))switch(n){case"system":throw new a.InvalidPromptError({message:"Unexpected system message in prompt: ${content}",prompt:e});case"user":{let e=i.map(e=>{if("text"===e.type)return e.text}).filter(Boolean).join("");r+=`${t}:
|
|
4
4
|
${e}
|