thursday-agent 0.9.0 → 0.11.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 +0 -1
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +0 -6
- 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.nft.json +1 -1
- package/.next/server/app/api/bot/keep-working/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/events/route.js.nft.json +1 -1
- package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
- package/.next/server/app/api/file/[...path]/route.js.nft.json +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.nft.json +1 -1
- package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/reach/route.js +13 -13
- package/.next/server/app/api/reach/route.js.nft.json +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.nft.json +1 -1
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/skills/route.js.nft.json +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 +14 -15
- package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/files/route.js.nft.json +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 +1 -1
- 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 +56 -56
- package/.next/server/app/page.js +4 -4
- 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 +0 -1
- package/.next/server/chunks/[root-of-the-server]__014ydvq._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0209ah4._.js +7 -5
- package/.next/server/chunks/[root-of-the-server]__04r4h-2._.js +4 -2
- package/.next/server/chunks/[root-of-the-server]__0542v_d._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0gewdg9._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1-swlkw._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__12iddfq._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1ai5lme._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__1cjxw0-._.js +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1fy2g82._.js → [root-of-the-server]__1k3j52n._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1kyjt5m._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
- package/.next/server/chunks/_05v8k21._.js +3 -1
- package/.next/server/chunks/_0awtznl._.js +1 -1
- package/.next/server/chunks/_0na2fj1._.js +1 -1
- package/.next/server/chunks/_0x-ej3f._.js +17 -17
- package/.next/server/chunks/_12-amdu._.js +2 -2
- package/.next/server/chunks/_15740dw._.js +60 -0
- package/.next/server/chunks/_1dc_d1q._.js +3 -3
- package/.next/server/chunks/_1i350l5._.js +3 -1
- package/.next/server/chunks/_1jc5g4p._.js +2 -2
- package/.next/server/chunks/_1jn-aep._.js +4 -4
- package/.next/server/chunks/_1m88lkh._.js +11 -11
- package/.next/server/chunks/_1ogqovh._.js +4 -4
- package/.next/server/chunks/_1uuucy-._.js +1 -1
- package/.next/server/chunks/_1zxp-p6._.js +1 -1
- package/.next/server/chunks/features_0rfvely._.js +5 -3
- package/.next/server/chunks/ssr/{[root-of-the-server]__1se25x0._.js → [root-of-the-server]__0hpp3nw._.js} +29 -13
- package/.next/server/chunks/ssr/[root-of-the-server]__0m7u9j-._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0tzekbl._.js +24 -60
- package/.next/server/chunks/ssr/[root-of-the-server]__1cz2rz5._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0tvavy9._.js → [root-of-the-server]__1iwyp1e._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1w9hqq8._.js +1 -1
- package/.next/server/chunks/ssr/_097-ljd._.js +1 -1
- package/.next/server/chunks/ssr/{_1tmu8z-._.js → _0btzccu._.js} +2 -2
- package/.next/server/chunks/ssr/_0fqhhwi._.js +1 -1
- package/.next/server/chunks/ssr/_0hjzb5o._.js +3 -0
- package/.next/server/chunks/ssr/_0ld9_qq._.js +1 -1
- package/.next/server/chunks/ssr/{_0urj3mc._.js → _0ouzu9f._.js} +2 -2
- package/.next/server/chunks/ssr/{_1-zyvdb._.js → _0u7ko71._.js} +2 -2
- package/.next/server/chunks/ssr/{_0ltz2q5._.js → _0wd_o8-._.js} +2 -2
- package/.next/server/chunks/ssr/_0ya0cb0._.js +3 -0
- package/.next/server/chunks/ssr/_10yyqtk._.js +67 -0
- package/.next/server/chunks/ssr/{_1uy0xom._.js → _12eyown._.js} +3 -3
- package/.next/server/chunks/ssr/_12mijol._.js +11 -11
- package/.next/server/chunks/ssr/_132qkfz._.js +1 -1
- package/.next/server/chunks/ssr/_184327j._.js +1 -1
- package/.next/server/chunks/ssr/{_1z74dmq._.js → _19ps4p3._.js} +7 -7
- package/.next/server/chunks/ssr/{_1flbs77._.js → _1bhy4yg._.js} +2 -2
- package/.next/server/chunks/ssr/_1d423aj._.js +7 -5
- package/.next/server/chunks/ssr/{_1a-nuxx._.js → _1kd843u._.js} +2 -2
- package/.next/server/chunks/ssr/{_0ital-2._.js → _1kq2ye_._.js} +2 -2
- package/.next/server/chunks/ssr/_1mqn9mc._.js +1 -1
- package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
- package/.next/server/chunks/ssr/_1p8xorg._.js +3 -0
- package/.next/server/chunks/ssr/{_1x-kojb._.js → _1q683w8._.js} +3 -3
- package/.next/server/chunks/ssr/_1tawxu2._.js +3 -0
- package/.next/server/chunks/ssr/{_0scf7xy._.js → _1w2oba6._.js} +2 -2
- package/.next/server/chunks/ssr/_1xoch6f._.js +1 -1
- package/.next/server/chunks/ssr/{_0kjj5ts._.js → _1ybo1hd._.js} +3 -3
- package/.next/server/chunks/ssr/features_bot_0s11m4r._.js +3 -0
- package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
- package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
- package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
- package/.next/server/chunks/ssr/features_workspace_00jz2hu._.js +1 -1
- package/.next/server/chunks/ssr/{node_modules_1af3w91._.js → node_modules_00pocul._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0th357h._.js → node_modules_02zt4az._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0jljel9._.js → node_modules_05ojmcl._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0wnlddw._.js → node_modules_06i6bli._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_06bb4q8._.js → node_modules_09dj429._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_068ws5v._.js → node_modules_0auzgvx._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1ogczzz._.js → node_modules_0evjwh1._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_13kwejm._.js → node_modules_0gmdur8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1s-gb-1._.js → node_modules_0j3te-1._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1bucjlk._.js → node_modules_0rbaymq._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1wbkzl9._.js → node_modules_0tf8_1e._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_12et8d5._.js → node_modules_0yqy-0b._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1lkix61._.js → node_modules_1-53ebx._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_03d0rfz._.js → node_modules_1-y9aho._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0x630an._.js → node_modules_11bltzp._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0uyh_vb._.js → node_modules_18jn2qo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0dzm4um._.js → node_modules_1_te3bu._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_07rs_p2._.js → node_modules_1c0pg3k._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0sgy-dc._.js → node_modules_1en2jx5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0ubdtk-._.js → node_modules_1p-c8cr._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1z1lrbk._.js → node_modules_1qe-oxg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_04_sbbc._.js → node_modules_1rjt833._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0yvz9e0._.js → node_modules_1tzw5sn._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1uwg-gz._.js → node_modules_1x6uwvn._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0t_ez6-._.js → node_modules_1zqddke._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_05ybmta._.js → node_modules_211zgim._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0r443fh._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0y51bqj._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_10wnlbk._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1sc114e._.js} +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +57 -57
- package/.next/static/chunks/{13ixzheqw7o-w.js → 03-724sj0nk_z.js} +2 -2
- package/.next/static/chunks/03bhu4mk8en2q.js +1 -0
- package/.next/static/chunks/{3h2e-xv1zxh_f.js → 04imzjhvzw65d.js} +2 -2
- package/.next/static/chunks/{27tvv1i-smrck.js → 0gljzv9fz1g7d.js} +1 -1
- package/.next/static/chunks/{37j27b3e1gt7r.js → 0h0lythv1ql93.js} +1 -1
- package/.next/static/chunks/{2o4dndk0d68do.js → 0hzbj7f48cmx0.js} +1 -1
- package/.next/static/chunks/0lwunwbl7u7pt.js +1 -0
- package/.next/static/chunks/{0u9ae9k_2g7k3.js → 0r6nwxg4dv83t.js} +1 -1
- package/.next/static/chunks/0rn9nbg6aif9f.js +17 -0
- package/.next/static/chunks/{3bbzsitgiltnt.js → 0x_w4shtvrrfg.js} +1 -1
- package/.next/static/chunks/{2sdwbfs1x5skp.js → 0ympuji_ufypd.js} +1 -1
- package/.next/static/chunks/{3t9huugh-5_ps.js → 0zmrz4zfzm4dt.js} +1 -1
- package/.next/static/chunks/{0qmd8n52hp-6v.js → 11tlxkr7a_rpc.js} +1 -1
- package/.next/static/chunks/{2c64drdevdla3.js → 12scesro428m7.js} +2 -2
- package/.next/static/chunks/16s2fx3890_jd.js +65 -0
- package/.next/static/chunks/{0oyz95sujd2c7.js → 1qzfgplyo18tc.js} +1 -1
- package/.next/static/chunks/{04e-e--5lk26x.js → 1r4zajz14jp9-.js} +1 -1
- package/.next/static/chunks/1s6m4cmbn7htf.js +1 -0
- package/.next/static/chunks/1wl9t1-3i-q8p.css +1 -0
- package/.next/static/chunks/2-asot3p1j3yg.js +1 -0
- package/.next/static/chunks/{0u3ktztrzu1fa.js → 2-jn4xscbm-i2.js} +1 -1
- package/.next/static/chunks/22h9gvclqtx_2.js +1 -0
- package/.next/static/chunks/{337g9g_ux2gj-.js → 26-eblxwnykck.js} +1 -1
- package/.next/static/chunks/{43q9cgbuw8krx.js → 2kzwhbuobpkw3.js} +2 -2
- package/.next/static/chunks/2m6jd3586ijb-.js +1 -0
- package/.next/static/chunks/{0_awn8tucznxc.js → 304q9p54tcgm1.js} +1 -1
- package/.next/static/chunks/{1u5i-jti87jbo.js → 35wdx3wt7cg4a.js} +1 -1
- package/.next/static/chunks/37unh9460im7v.js +18 -0
- package/.next/static/chunks/{01xjer0i_e5z5.js → 39gj5vxz1zpm_.js} +1 -1
- package/.next/static/chunks/{427qsc6kahxyo.js → 39vrqy1r_00jc.js} +1 -1
- package/.next/static/chunks/{245hb85nsy6j4.js → 3dipmu0mptqum.js} +1 -1
- package/.next/static/chunks/3gki-squw28yu.js +1 -0
- package/.next/static/chunks/{3obf9n3cxj99k.js → 3jvldk2wvwbge.js} +1 -1
- package/.next/static/chunks/{38301ji-85i30.js → 3nnzdl_te20hv.js} +1 -1
- package/.next/static/chunks/{2m267diam_vib.js → 3tz4dr0_8pq1-.js} +1 -1
- package/.next/static/chunks/{2gocl3dq0_h1s.js → 3x6pggb-2kyrk.js} +1 -1
- package/.next/static/chunks/{025bmrgeukcb2.js → 4440mws9jz3mt.js} +1 -1
- package/README.md +4 -0
- package/app/api/thursday/tool-call/route.ts +1 -15
- package/components/ui/radio-group.tsx +2 -2
- package/docs/images/demo-still.jpg +0 -0
- package/docs/live-calls.md +19 -11
- package/features/ai/prompts/live.prompt.ts +51 -26
- package/features/ai/prompts/prompt-helper.ts +1 -9
- package/features/ai/prompts/thursday.prompt.ts +8 -2
- package/features/bot/bot.run.ts +9 -3
- package/features/bot/bot.seed.ts +35 -91
- package/features/bot/components/bot-room.tsx +0 -6
- package/features/bot/components/bot-setting.tsx +4 -4
- package/features/bot/components/room-pill.tsx +4 -2
- package/features/bot/seed-bots.ts +2 -2
- package/features/intro/components/intro.tsx +2 -3
- package/features/reach/reach.ts +2 -2
- package/features/routine/components/routine-setting.tsx +1 -1
- package/features/signins/signins.query.ts +66 -1
- package/features/thursday/components/side-captions.tsx +31 -8
- package/features/thursday/components/thursday-setting.tsx +5 -5
- package/features/thursday/components/thursday.tsx +97 -39
- package/features/thursday/components/write-line.tsx +28 -17
- package/features/thursday/thursday.action.ts +4 -20
- package/features/thursday/thursday.schema.ts +0 -9
- package/features/thursday/thursday.store.ts +11 -15
- package/features/thursday/thursday.text.ts +10 -8
- package/features/thursday/tool-line.ts +17 -6
- package/features/thursday/use-call-ring.ts +1 -5
- package/features/thursday/use-text-call.ts +37 -21
- package/features/thursday/use-thursday.ts +14 -44
- package/features/workspace/workspace.ts +4 -2
- package/guide/bots.md +13 -3
- package/guide/calls.md +7 -5
- package/knip.json +1 -0
- package/lib/live/live.session.ts +0 -39
- package/package.json +1 -1
- package/scripts/live-session.test.mts +19 -26
- package/seed-skills/analyst/README.md +18 -0
- package/seed-skills/analyst/data-report/SKILL.md +60 -0
- package/seed-skills/analyst/data-report/references/brief.md +31 -0
- package/seed-skills/analyst/data-report/references/company.md +41 -0
- package/seed-skills/analyst/data-report/references/comparison.md +42 -0
- package/seed-skills/analyst/data-report/references/decision.md +28 -0
- package/seed-skills/analyst/data-report/references/market-size.md +49 -0
- package/seed-skills/analyst/data-report/references/price-check.md +33 -0
- package/seed-skills/analyst/data-report/references/sources.md +51 -0
- package/seed-skills/analyst/data-report/references/trend.md +39 -0
- package/seed-skills/analyst/data-report/scripts/fetch.mjs +521 -0
- package/seed-skills/insta/instagram/SKILL.md +36 -0
- package/seed-skills/insta/instagram/references/dm.md +49 -0
- package/seed-skills/insta/instagram/references/post.md +74 -0
- package/seed-skills/insta/instagram/scripts/compose.mjs +333 -0
- package/seed-skills/insta/instagram/scripts/inbox.mjs +163 -0
- package/seed-skills/insta/instagram/scripts/lib.mjs +33 -0
- package/seed-skills/insta/instagram/scripts/media.mjs +104 -0
- package/seed-skills/insta/instagram/scripts/profile.mjs +143 -0
- package/seed-skills/insta/instagram/scripts/read.mjs +244 -0
- package/seed-skills/insta/instagram/scripts/search.mjs +137 -0
- package/seed-skills/insta/instagram/scripts/selectors.mjs +56 -0
- package/seed-skills/insta/instagram/scripts/sheet.mjs +43 -0
- package/seed-skills/insta/instagram/templates/carousel.html +62 -0
- package/seed-skills/marketer/README.md +6 -4
- package/seed-skills/marketer/copywriting/SKILL.md +1 -1
- package/seed-skills/marketer/emails/SKILL.md +1 -1
- package/seed-skills/marketer/launch/SKILL.md +1 -1
- package/seed-skills/marketer/product-marketing/SKILL.md +5 -5
- package/seed-skills/marketer/seo-audit/SKILL.md +1 -1
- package/seed-skills/marketer/social/SKILL.md +1 -1
- package/seed-skills/tutor/picture-book/SKILL.md +16 -0
- package/seed-skills/tutor/picture-book/book/book.css +181 -0
- package/seed-skills/tutor/picture-book/book/book.html +33 -0
- package/seed-skills/tutor/picture-book/book/book.js +60 -0
- package/seed-skills/tutor/picture-book/references/picture-book.md +104 -0
- package/seed-skills/tutor/picture-book/scripts/book-video.mjs +177 -0
- package/seed-skills/tutor/picture-book/scripts/book.mjs +98 -0
- package/skills/browser/SKILL.md +13 -4
- package/skills/browser/references/scripts.md +55 -0
- package/skills/browser/scripts/image-size.mjs +30 -0
- package/skills/browser/scripts/render.mjs +126 -0
- package/skills/browser/scripts/session.mjs +105 -0
- package/skills/browser/scripts/sheet.mjs +97 -0
- package/skills/browser/scripts/webimage.mjs +105 -0
- package/skills/interactive-page/SKILL.md +4 -3
- package/skills/interactive-page/scripts/chart.mjs +679 -0
- package/skills/interactive-page/scripts/page.mjs +1 -0
- package/.next/server/app/api/probe/route/app-paths-manifest.json +0 -3
- package/.next/server/app/api/probe/route/build-manifest.json +0 -12
- package/.next/server/app/api/probe/route/server-reference-manifest.json +0 -4
- package/.next/server/app/api/probe/route.js +0 -10
- package/.next/server/app/api/probe/route.js.map +0 -5
- package/.next/server/app/api/probe/route.js.nft.json +0 -1
- package/.next/server/app/api/probe/route_client-reference-manifest.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__012s2o8._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0z0hc1f._.js +0 -4
- package/.next/server/chunks/[root-of-the-server]__1v7-zke._.js +0 -5
- package/.next/server/chunks/_0whlpyi._.js +0 -4
- package/.next/server/chunks/_next-internal_server_app_api_probe_route_actions_0cqd30j.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0oo-wlv._.js +0 -103
- package/.next/server/chunks/ssr/[root-of-the-server]__0zuns7e._.js +0 -3
- package/.next/server/chunks/ssr/_070nv1_._.js +0 -3
- package/.next/server/chunks/ssr/_0dshsh4._.js +0 -3
- package/.next/server/chunks/ssr/_0l_mcfz._.js +0 -3
- package/.next/server/chunks/ssr/_0u5xv6g._.js +0 -3
- package/.next/server/chunks/ssr/_157yfrk._.js +0 -3
- package/.next/server/chunks/ssr/features_bot_1nr94ks._.js +0 -3
- package/.next/static/chunks/06nt9tatr-dug.js +0 -1
- package/.next/static/chunks/0ge-hx0ed83a1.js +0 -1
- package/.next/static/chunks/0pda_vf-abwvx.js +0 -1
- package/.next/static/chunks/0rowp9rx3qbxu.js +0 -18
- package/.next/static/chunks/1grkt5gr8pbg1.js +0 -17
- package/.next/static/chunks/1yugpvvi8qrbu.js +0 -101
- package/.next/static/chunks/27lkanxvtdn09.js +0 -1
- package/.next/static/chunks/3fec-aeteddr-.js +0 -1
- package/.next/static/chunks/3go3hwp1z2_h2.css +0 -1
- package/.next/static/chunks/3h2bun3hcggg8.js +0 -1
- package/.next/static/chunks/3j1y335o95mj7.js +0 -1
- package/lib/probe.server.ts +0 -17
- package/lib/probe.ts +0 -55
- /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_buildManifest.js +0 -0
- /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module.exports=[280281,a=>{"use strict";var b=a.i(187924);a.s([],584102),a.i(584102);var c=a.i(572131),d=a.i(950381),e=a.i(801811),f=a.i(357738),g=a.i(462824),h=a.i(524715),i=a.i(926184),j=a.i(300557),k=a.i(221436),l=a.i(854662);let m=c.createContext(void 0),n={...a.i(827576).fieldValidityMapping,checked:a=>a?{"data-checked":""}:{"data-unchecked":""}};var o=a.i(85933),p=a.i(1230),q=a.i(958589),r=a.i(541302),s=a.i(77260),t=a.i(346919),u=a.i(769476),v=a.i(394552),w=a.i(307436),x=a.i(964072);let y=c.forwardRef(function(a,l){let{checked:y,className:z,defaultChecked:A,"aria-labelledby":B,form:C,id:D,inputRef:E,name:F,nativeButton:G=!1,onCheckedChange:H,readOnly:I=!1,required:J=!1,disabled:K=!1,render:L,uncheckedValue:M,value:N,style:O,...P}=a,{clearErrors:Q}=(0,r.useFormContext)(),{state:R,setTouched:S,setDirty:T,validityData:U,setFilled:V,setFocused:W,validationMode:X,disabled:Y,name:Z,validation:$}=(0,p.useFieldRootContext)(),{labelId:_}=(0,s.useLabelableContext)(),aa=Y||K,ab=Z??F,ac=c.useRef(null),ad=(0,e.useMergedRefs)(ac,E,$.inputRef),ae=c.useRef(null),af=(0,j.useBaseUiId)(),ag=(0,u.useLabelableId)({id:D}),ah=G?void 0:ag,[ai,aj]=(0,d.useControlled)({controlled:y,default:!!A,name:"Switch",state:"checked"});(0,q.useRegisterFieldControl)(ae,af,ai,void 0,!aa,F),(0,f.useIsoLayoutEffect)(()=>{V(ai)},[ai,V]),(0,x.useValueChanged)(ai,()=>{Q(ab),T(ai!==U.initialValue),$.change(ai)});let{getButtonProps:ak,buttonRef:al}=(0,k.useButton)({disabled:aa,native:G}),am=(0,t.useAriaLabelledBy)(B,_,ac,!G,ah),an={...$.getValidationProps(aa),checked:ai,disabled:aa,form:C,id:ah,name:ab,required:J,style:ab?g.visuallyHiddenInput:g.visuallyHidden,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:ad,onChange(a){if(a.nativeEvent.defaultPrevented)return;if(I)return void a.preventDefault();let b=a.currentTarget.checked,c=(0,v.createChangeEventDetails)(w.REASONS.none,a.nativeEvent);H?.(b,c),c.isCanceled||aj(b)},onClick(a){a.stopPropagation()},onFocus(){ae.current?.focus()},...void 0!==N?{value:N}:h.EMPTY_OBJECT},ao=c.useMemo(()=>({...R,checked:ai,disabled:aa,readOnly:I,required:J}),[R,ai,aa,I,J]),ap=(0,i.useRenderElement)("span",a,{state:ao,ref:[l,ae,al],props:[{id:G?ag:af,role:"switch","aria-checked":ai,"aria-readonly":I||void 0,"aria-required":J||void 0,"aria-labelledby":am,onFocus(){aa||W(!0)},onBlur(){let a=ac.current;a&&!aa&&(S(!0),W(!1),"onBlur"===X&&$.commit(a.checked))},onClick(a){if(I||aa)return;a.preventDefault();let b=ac.current;b&&(0,o.dispatchClickWithModifiers)(b,a)}},P,ak,a=>$.getValidationProps(aa,a)],stateAttributesMapping:n});return(0,b.jsxs)(m.Provider,{value:ao,children:[ap,!ai&&ab&&void 0!==M&&(0,b.jsx)("input",{type:"hidden",form:C,name:ab,value:M,disabled:aa}),(0,b.jsx)("input",{...an,suppressHydrationWarning:!0})]})}),z=c.forwardRef(function(a,b){let{render:d,className:e,style:f,...g}=a,h=function(){let a=c.useContext(m);if(void 0===a)throw Error((0,l.default)(63));return a}();return(0,i.useRenderElement)("span",a,{state:h,ref:b,stateAttributesMapping:n,props:g})});a.s(["Root",0,y,"Thumb",0,z],940499);var A=a.i(940499),A=A,B=a.i(497895);a.s(["Switch",0,function({className:a,size:c="default",...d}){return(0,b.jsx)(A.Root,{"data-slot":"switch","data-size":c,className:(0,B.cn)("cursor-pointer peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-brand data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",a),...d,children:(0,b.jsx)(A.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-brand-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}],280281)},411509,a=>{"use strict";var b=a.i(702080),c=a.i(61876),d=a.i(199169),e=a.i(616682),f=a.i(324835),g=a.i(983874);let h=b.default.object({color:b.default.string().regex(/^(#[0-9a-fA-F]{6}|currentColor)$/,"Hex color").optional(),shape:b.default.enum(f.MARK_SHAPES).optional(),outline:b.default.boolean().optional(),paint:b.default.enum(f.MARK_PAINT_IDS).optional()}),i=b.default.string().max(e.COMMON_VALIDATE.prompt.max);function j(a){return(0,f.randomMarkFills)(a).map(a=>({...a,shape:f.MARK_SHAPES[Math.floor(Math.random()*f.MARK_SHAPES.length)]}))}let k=b.default.object({id:b.default.number(),name:b.default.string(),serverName:b.default.string()}),l=b.default.string().trim().transform(a=>a.replace(/\s+/g," ")).refine(a=>a.toLowerCase()!==g.ROOM_THURSDAY.toLowerCase(),"Thursday is reserved for the voice assistant.").pipe(b.default.string().min(1,"A name is required").max(e.COMMON_VALIDATE.name.max)),m=b.default.object({input:b.default.number(),output:b.default.number()});b.default.object({name:b.default.string(),description:b.default.string(),systemPrompt:b.default.string().nullish(),icon:h.nullish(),provider:c.textModelProviderSchema.nullish(),model:b.default.string().nullish(),compactAt:b.default.number().nullish(),disabled:b.default.boolean(),createdAt:d.DateLikeSchema,tools:k.array().default([]),tokens:m,lastJobAt:d.DateLikeSchema.nullish()}),b.default.object({name:l,description:b.default.string().trim().min(1,"Say what this bot is for").max(e.COMMON_VALIDATE.description.max),systemPrompt:i.optional(),icon:h.optional(),provider:c.textModelProviderSchema.nullish(),model:b.default.string().trim().max(80).nullish(),compactAt:b.default.coerce.number().int().min(8e3,"At least 8k").nullish(),disabled:b.default.boolean().optional(),toolIds:b.default.number().int().array().max(10).default([])}),b.default.object({file:b.default.string(),path:b.default.string(),line:b.default.string(),at:d.DateLikeSchema,bytes:b.default.number()});let n="Continue",o=b.default.discriminatedUnion("type",[b.default.object({type:b.default.literal("text"),text:b.default.string()}),b.default.object({type:b.default.literal("image"),src:b.default.string()})]),p=b.default.object({id:b.default.string(),seq:b.default.number(),bot:b.default.string().nullable(),parent:b.default.string().nullable(),to:b.default.string().nullish(),at:d.DateLikeSchema}),q=b.default.discriminatedUnion("kind",[p.extend({kind:b.default.literal("user"),text:b.default.string()}),p.extend({kind:b.default.literal("text"),text:b.default.string()}),p.extend({kind:b.default.literal("note"),text:b.default.string()}),p.extend({kind:b.default.literal("stop"),text:b.default.string()}),p.extend({kind:b.default.literal("tool"),callId:b.default.string(),name:b.default.string(),input:b.default.string(),note:b.default.string().nullish(),path:b.default.string().nullish()}),p.extend({kind:b.default.literal("tool-result"),callId:b.default.string(),name:b.default.string(),results:o.array(),more:b.default.boolean()}),p.extend({kind:b.default.literal("ask"),callId:b.default.string(),to:b.default.string(),text:b.default.string(),question:b.default.boolean().optional()})]),r=b.default.object({question:b.default.string(),messageId:b.default.string().optional(),bot:b.default.string().optional(),options:b.default.string().array(),auto:b.default.boolean()});b.default.object({id:b.default.string(),bot:b.default.string(),label:b.default.string(),request:b.default.string(),status:b.default.enum(["running","waiting","done","cancelled"]),outcome:b.default.string().nullable(),ask:r.nullable(),seen:b.default.boolean(),routineId:b.default.string().nullable(),tokens:m,contextTokens:b.default.number(),contextBudget:b.default.number(),createdAt:d.DateLikeSchema,updatedAt:d.DateLikeSchema,lines:q.array(),room:g.RoomViewSchema}),a.s(["DEFAULT_BOT",0,{name:"Jarvis",description:"Anything — this computer, a browser, the web, files, services",systemPrompt:null,icon:{color:"#14B8A6",shape:"squircle"},provider:null,model:null,disabled:!1,compactAt:null},"MAX_PINNED_TOOLS",0,10,"THREAD_CONTINUE",0,n,"isAppStop",0,a=>{let b=a?.options??[];return!a?.messageId&&1===b.length&&b[0]===n},"needsThreadReply",0,a=>"waiting"===a.status||a.room.questions.length>0,"randomBotIcon",0,()=>j(1)[0],"randomBotIcons",0,j])},398026,a=>{"use strict";var b=a.i(287702),c=a.i(421042),d=a.i(411509);let e=[{name:"Jarvis",description:"Anything nobody else is for — orders, bookings, forms, the web, this computer",hint:"Takes whatever nobody else is for",systemPrompt:""},{name:"Planner",description:"Any job that needs a team — decides what done means, assigns the parts, checks them, signs off",hint:"Runs the job: assigns, checks, decides",systemPrompt:`You run the team the way a chief executive runs a company: accountable for the result, not the one who produces it. A job comes in as a request and goes out as one finished result. Between the two you decide what done means, give each part to whoever on Bots is best placed for it, hold every part to what it was asked for, and make the calls nobody else can. A part is yours only when nobody on Bots fits it.
|
|
2
|
+
|
|
3
|
+
**Decide what done means, first.** Before anything is handed out, send Thursday one \`${c.TOOL_NAMES.send_message}\` question holding everything only the user can decide — which one, how much, by when, in what form — with options where they fit. What you can find out, or the request already says, is not asked. After that, a doubt a reasonable choice settles is yours: decide, write \`Ruling: <what> — <why>\` in the plan, and keep going. Only what cannot be undone goes back to Thursday.
|
|
4
|
+
|
|
5
|
+
**Staff it to its size.** A job one bot can do goes whole to that bot. Split only where parts run at the same time or need different strengths, and never let two parts write the same file at once.
|
|
6
|
+
|
|
7
|
+
**The plan is the one record.** \`plan.md\` in the job's scratch folder holds the goal; the facts every part needs (the user's answers, names, dates, units); one line per part, \`- [ ] <what exists when done, and how it will be checked> — <who> → <path>\`; then rulings and misses. Read it before every decision and update it as each part lands. Send the checklist to Thursday as a \`message\` once it is written.
|
|
8
|
+
|
|
9
|
+
**A brief is an assignment finished without asking you.** The goal and how it will be judged; the facts from \`plan.md\` it needs; the files to read; where to write — the part's own folder in scratch, the bot's own folder under \`artifacts/\` for what the user opens, \`projects/\` for code that outlives the job; what not to touch because another part owns it; what to send back — a few lines and the paths. Send every part that waits on nothing in the same step; a part that needs another's output goes out once that file exists.
|
|
10
|
+
|
|
11
|
+
**Judge the work, not the report.** Open what a part wrote and test it against its line — values, units, names and dates agreeing across parts — then tick it. Short or wrong: back to the same bot once, saying exactly what. Short again: another bot or another way, never the same brief twice. A third miss stops that part: ask Thursday how to go on, with what was tried. Every miss goes in the plan.
|
|
12
|
+
|
|
13
|
+
**Your memory is how the team gets better.** Keep a file for each: which bot did which kind of part well or badly; briefs that worked; jobs that come back and where their results live. Date each line, merge rather than add, delete what proved wrong. Never a job's contents — those stay in its files. The team changes: a bot you remember may be gone, so staff from Bots as it is now.
|
|
14
|
+
|
|
15
|
+
**Sign off on one result.** Put the deliverable together from the part files. Your final text says what was done, where it is, who did which part, the rulings you made, and what is unverified and why.`},{name:"Analyst",description:"Answers with numbers — costs, markets, trends, companies, which to pick — cited and charted",hint:"Finds the numbers and draws them",systemPrompt:`Questions answered with numbers are yours — what something costs, how big a market is, how a figure moved and why, how a company is doing, which option to pick, whether to buy now or wait.
|
|
16
|
+
|
|
17
|
+
**Answer first.** Whoever asked reads your first lines and may stop there, so they hold the answer and the two or three numbers behind it; everything after supports them. A title says the finding ("Rent rose faster than pay"), not the topic.
|
|
18
|
+
|
|
19
|
+
**Size the answer to the ask.** A few numbers are your final text and nothing more. A trend, a comparison, or more rows than a few lines hold is one self-contained page in your folder under \`artifacts/\`, written in minutes: the finding, then the charts and tables, every figure with where it came from — one file, never a report beside a chart beside a spreadsheet. A built page, with controls that keep state, is only for a reader who will work the numbers themselves.
|
|
20
|
+
|
|
21
|
+
**Work by a skill.** Before collecting anything, load the method on your Skills list for reports with numbers: it holds the form each kind of question wants, and scripts that fetch series and draw charts, so a chart or a data table is never typed by hand. When nothing there fits the kind of work — a statistical test, a valuation model — find one to install.
|
|
22
|
+
|
|
23
|
+
**Get the real numbers.** From where they are published — a filing, an official statistic, the seller's own page, a file you were given — never from memory or an article quoting them, and a trend as the series from its source, not one value from today. Compare like with like: the same period, definition and currency, with the rate and its date when you convert.
|
|
24
|
+
|
|
25
|
+
**Show your working.** A number you derive — a share, a growth rate, a market size — shows its arithmetic; an estimate is a range, with the input it depends on most.
|
|
26
|
+
|
|
27
|
+
**Mark what is not solid.** A figure you could not confirm, a source older than the question, two sources that disagree: say so beside it.
|
|
28
|
+
|
|
29
|
+
**One bash call per step.** Fetch every series in one call, draw every chart in the next.
|
|
30
|
+
|
|
31
|
+
Your final text gives the answer with its numbers, what is not solid, and the page's path when there is one.`},{name:"Tutor",description:"Explains anything simply, as a picture book — a picture and a line or two a page — or a video of it",hint:"Explains anything like a picture book",systemPrompt:`Explaining is yours — anything someone wants to understand, told so that a person who knows nothing about it follows every step. It ends as a picture book in your folder under \`artifacts/\`: one picture and a line or two a page, as a page to swipe through, a PDF, or a video that reads itself aloud. Load your own \`picture-book\` skill before any step: it holds how a page is written, where each picture comes from, and the scripts that print and voice the book.
|
|
32
|
+
|
|
33
|
+
**Ask which one, once.** When the request does not say a page, a PDF or a video, send Thursday one \`${c.TOOL_NAMES.send_message}\` question before writing anything, with the options \`A page\`, \`A PDF\` and \`A video that reads itself\`. A video spends a speech model on every page.
|
|
34
|
+
|
|
35
|
+
**Simple, never wrong.** Read what you explain from where it is stated — the official page, a textbook, the thing itself — before the first page. A picture that simplifies still shows how it really works; a comparison that would mislead is left out.
|
|
36
|
+
|
|
37
|
+
**Start where they are.** Your memory keeps what the user already knows and how they liked being taught: the level, a picture style, how many pages. Read it before the story, and after a book keep what this one showed, dated.
|
|
38
|
+
|
|
39
|
+
Your final text gives the path, and in one sentence the idea the book leaves them with.`},{name:"Marketer",description:"Marketing — positioning, copy, launch plans, posts, ads, emails, SEO and competitor reviews",hint:"Works out what to say, to whom, and where",systemPrompt:`Marketing work is yours — positioning, page copy, a launch plan, posts, ads, emails, an SEO or competitor review — and it ends as the thing itself in your folder under \`artifacts/\`, ready to paste, post or send.
|
|
40
|
+
|
|
41
|
+
**Work by a skill.** Copy, SEO, launches, social posts, ads, emails, competitors and pricing each have written methods worth following. Start from the closest one on your Skills list and load it; only when nothing there fits, find one to install, then load it and follow it. Install only what this job needs.
|
|
42
|
+
|
|
43
|
+
**Ground every claim.** Competitors, prices, search terms and what people say about the problem come from pages you opened, with the link beside them. What you could not check is marked as a guess.
|
|
44
|
+
|
|
45
|
+
**Hand off what is not marketing work.** Posting, publishing and sending belong to whoever on Bots does that; when nobody does, deliver it ready to post and say where it goes.
|
|
46
|
+
|
|
47
|
+
Your final text gives the file's path, the angle you would lead with, and what to test first.`},{name:"Insta",description:"Instagram end to end — studies accounts that work, builds posts like theirs, posts them, reads DMs",hint:"Posts like the best in a niche, reads DMs",systemPrompt:`Instagram is yours end to end — find what works in a niche, build the post the same way, put it up, and read the account's messages. Load the \`${b.BROWSER_SKILL}\` skill and your own \`instagram\` skill before any step: its scripts read Instagram in a few lines where a snapshot costs twenty thousand characters, so run them first, chain them in one bash call, and snapshot only when a script says the page changed.
|
|
48
|
+
|
|
49
|
+
Sign in once, and into an account made for this rather than their own — the session is kept and every later job posts as whoever it is. \`${c.TOOL_NAMES.sign_in_use}\` with \`instagram.com\` before anything else; the login page is \`https://www.instagram.com/accounts/login/\` when nothing is kept.
|
|
50
|
+
|
|
51
|
+
Settle a post in one question. Ask only what the request leaves open — the topic, how many slides — in a single \`${c.TOOL_NAMES.send_message}\` question to Thursday. Told to decide yourself: \`${c.TOOL_NAMES.web_search}\` for what is current on the topic. Never ask twice for one round.
|
|
52
|
+
|
|
53
|
+
**Copy what already works.** Before building for a niche you hold no pattern for, find three or four accounts in it with many followers and study how they post: ratio and slide count, the cover's hook and type, text over the picture, how the background is treated, the caption's shape and hashtag count. Keep that pattern in your memory with the accounts and the date, and build every post in that niche to it until the user says otherwise.
|
|
54
|
+
|
|
55
|
+
**A picture tells the truth about what it is.** A post about something that happened uses the real picture — the person in the story, the article's own image, a frame from the source — with the source named on the slide. A post about an idea or a mood can use a drawn one: \`${c.STUDIO_TOOLS.generate_image}\` through \`${c.TOOL_NAMES.tool_call}\` on \`${b.STUDIO_SERVER}\`, the whole picture in \`prompt\` and the same look repeated in each. A drawn picture is never passed off as the event, and one that looks real goes up with the AI label. \`${c.STUDIO_TOOLS.generate_image}\` not coming back from \`${c.TOOL_NAMES.tool_search}\`, or a call answering that the model cannot make images, means there is no image model: go on when real pictures make the post; when it needs a drawn one, send Thursday a \`${c.TOOL_NAMES.send_message}\` question saying to pick an image model in Settings › Models, and end your turn.
|
|
56
|
+
|
|
57
|
+
**Every slide is HTML rendered at the post's exact size**, one size for the whole carousel: that is how text comes out right and nothing is cut. Look at the finished slides once, side by side, before they go anywhere.
|
|
58
|
+
|
|
59
|
+
Write the caption to be read: what this is, in the user's voice, no invented facts, hashtags as the pattern has them.
|
|
60
|
+
|
|
61
|
+
**Ask before it goes up.** Fill the composer to its last screen and leave it there; send Thursday a \`${c.TOOL_NAMES.send_message}\` question with the caption as written and the slide paths, options \`Post it\` / \`Change something\`, and press Share only on the first. When the user has said you may post without asking, keep that in your memory with the date and their words, and post. Once it is up, check it went up at the ratio you built; a cut one is deleted and posted again.
|
|
62
|
+
|
|
63
|
+
Messages are read without being opened: list the inbox first and open only the threads the job is about, since opening one marks it seen. A reply goes out only when the user asked for one.
|
|
64
|
+
|
|
65
|
+
Answer with the post's url and the file paths, or with what the messages say and what they need.`}];a.s(["BOT_SEEDS",0,e,"rollSeedIcons",0,()=>(0,d.randomBotIcons)(e.length)])},722484,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f103a83b991de39443fc8c60a564ba475aae83b98",b.callServer,void 0,b.findSourceMapURL,"createSeedBotsAction");a.s(["createSeedBotsAction",0,c])},983874,a=>{"use strict";var b=a.i(156757);b.z.object({to:b.z.string().trim().min(1),text:b.z.string().trim().min(1),kind:b.z.enum(["message","question"]).default("message"),options:b.z.array(b.z.string().trim().min(1)).nullish(),replyTo:b.z.string().nullish()});let c=b.z.enum(["queued","running","waiting","external","paused","done","cancelled"]),d=b.z.object({bot:b.z.string(),state:c}),e=b.z.object({id:b.z.string(),bot:b.z.string(),text:b.z.string(),options:b.z.string().array().optional()}),f=b.z.object({participants:d.array(),questions:e.array(),deliveries:b.z.object({id:b.z.string(),bot:b.z.string(),text:b.z.string(),delivered:b.z.boolean()}).array(),relays:b.z.object({id:b.z.number(),bot:b.z.string(),text:b.z.string(),kind:b.z.enum(["message","question","report","interrupted"]),messageId:b.z.string().nullable()}).array()});a.s(["ROOM_THURSDAY",0,"Thursday","RoomViewSchema",0,f])},28996,a=>{"use strict";let b=(0,a.i(920226).create)()(a=>({open:!1,section:"thursday",show:b=>a(a=>({open:!0,section:b??a.section})),hide:()=>a({open:!1}),pick:b=>a({section:b})}));a.s(["openSettings",0,a=>b.getState().show(a),"useSettingsStore",0,b])},346919,a=>{"use strict";var b=a.i(572131),c=a.i(357738),d=a.i(300557);a.s(["useAriaLabelledBy",0,function(a,e,f,g=!0,h){let[i,j]=b.useState(),k=(0,d.useBaseUiId)(h?`${h}-label`:void 0),l=a??e??i;return(0,c.useIsoLayoutEffect)(()=>{let b=a||e||!g?void 0:function(a,b){let c=function(a){if(!a)return;let b=a.parentElement;if(b&&"LABEL"===b.tagName)return b;let c=a.id;if(c){let b=a.nextElementSibling;if(b&&b.htmlFor===c)return b}let d=a.labels;return d&&d[0]}(a);if(c)return!c.id&&b&&(c.id=b),c.id||void 0}(f.current,k);i!==b&&j(b)}),l}])},763802,a=>{"use strict";var b=a.i(2589);a.s(["CheckIcon",()=>b.default])},844561,a=>{"use strict";var b=a.i(164831);let c={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};c.node;let d=(0,b.default)(c);a.s(["FolderOpen",0,d],844561)},920226,a=>{"use strict";var b=a.i(572131);let c=a=>{let b,c=new Set,d=(a,d)=>{let e="function"==typeof a?a(b):a;if(!Object.is(e,b)){let a=b;b=(null!=d?d:"object"!=typeof e||null===e)?e:Object.assign({},b,e),c.forEach(c=>c(b,a))}},e=()=>b,f={setState:d,getState:e,getInitialState:()=>g,subscribe:a=>(c.add(a),()=>c.delete(a))},g=b=a(d,e,f);return f},d=a=>{let d=a?c(a):c,e=a=>(function(a,c=a=>a){let d=b.default.useSyncExternalStore(a.subscribe,b.default.useCallback(()=>c(a.getState()),[a,c]),b.default.useCallback(()=>c(a.getInitialState()),[a,c]));return b.default.useDebugValue(d),d})(d,a);return Object.assign(e,d),e};a.s(["create",0,a=>a?d(a):d],920226)}];
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=_10yyqtk._.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module.exports=[673701,a=>{"use strict";var b=a.i(187924),c=a.i(676459),d=a.i(926184),e=a.i(400187),f=a.i(497895);let g=(0,e.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});(0,e.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}}),a.s(["Bubble",0,function({variant:a="default",align:c="start",className:d,...e}){return(0,b.jsx)("div",{"data-slot":"bubble","data-variant":a,"data-align":c,className:(0,f.cn)(g({variant:a}),d),...e})},"BubbleContent",0,function({className:a,render:b,...e}){var g;return g={defaultTagName:"div",props:(0,c.mergeProps)({className:(0,f.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",a)},e),render:b,state:{slot:"bubble-content"}},(0,d.useRenderElement)(g.defaultTagName??"div",g,g)}],673701)},613350,a=>{"use strict";var b=a.i(187924),c=a.i(589027),d=a.i(572131),e=a.i(497895);a.s(["FoldedText",0,function({text:a,subject:f,clamp:g="line-clamp-3",tall:h="max-h-40",className:i}){let[j,k]=(0,d.useState)(!1),[l,m]=(0,d.useState)(!1),n=(0,d.useRef)(null);return(0,d.useEffect)(()=>k(!1),[a]),(0,d.useEffect)(()=>{let a=n.current;a&&!j&&m(a.scrollHeight>a.clientHeight+1)},[j,a]),(0,b.jsxs)("div",{className:(0,e.cn)("flex items-start gap-1",i),children:[(0,b.jsx)("p",{ref:n,className:(0,e.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",j?(0,e.cn)(h,"overflow-y-auto scrollbar-none"):g),children:a}),(l||j)&&(0,b.jsx)("button",{type:"button",onClick:()=>k(a=>!a),"aria-label":j?`Fold the ${f}`:`Read the whole ${f}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,b.jsx)(c.ChevronDown,{className:(0,e.cn)("size-3.5",j&&"rotate-180")})})]})}])},42380,a=>{"use strict";var b=a.i(187924),c=a.i(913834);a.s(["BotRoster",0,function({bots:a}){return a.length<2?null:(0,b.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:a.map(a=>a.name).join(", "),children:[(0,b.jsx)("span",{className:"flex items-center gap-0.5",children:a.slice(0,3).map(a=>(0,b.jsx)(c.BotMark,{size:18,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"shrink-0"},a.name))}),(0,b.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[a.length," bots"]})]})}])},181809,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(256711),f=a.i(752562),g=a.i(589027),h=a.i(707963),i=a.i(802550),j=a.i(585650),k=a.i(851528),l=a.i(875160),m=a.i(748819),n=a.i(474215),o=a.i(572131),p=a.i(673701),q=a.i(613350),r=a.i(846991),s=a.i(545097),t=a.i(621958),u=a.i(864037),v=a.i(641643),w=a.i(321799),x=a.i(913834),y=a.i(346075),z=a.i(369768),A=a.i(199169),B=a.i(313237),C=a.i(497895),D=a.i(983874),E=a.i(135432),F=a.i(8468),G=b([r,w,z,F]);function H({onClick:a}){return(0,d.jsx)("button",{type:"button",onClick:a,"aria-label":"Fold the room away",className:"grid size-7 shrink-0 place-items-center rounded-full bg-muted text-foreground outline-none transition-colors hover:bg-muted-foreground/20 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,d.jsx)(n.X,{className:"size-3.5"})})}function I({thread:a}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(J,{thread:a}),(0,d.jsx)(K,{thread:a}),(0,d.jsx)(L,{thread:a})]})}function J({thread:a}){let{contextTokens:b,tokens:c}=a;return b?(0,d.jsx)("span",{title:`Last step ${(0,C.formatCount)(b)} tokens \xb7 in total in ${(0,C.formatCount)(c.input)} \xb7 out ${(0,C.formatCount)(c.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,C.formatCount)(b)}):null}function K({thread:a}){let{contextTokens:b,contextBudget:c}=a,[e,f]=(0,o.useState)(!1),[g,h]=(0,B.useServerAction)(v.compactThreadAction,{onOk:()=>f(!0)});if((0,o.useEffect)(()=>f(!1),[b]),!b||!c)return null;let i=Math.min(1,b/c);return(0,d.jsx)("button",{type:"button",disabled:h||e,onClick:()=>void g(a.id,a.bot.name).catch(()=>{}),title:e?"It summarizes itself at its next step":`Context ${(0,C.formatCount)(b)} of ${(0,C.formatCount)(c)} — it summarizes itself at the end of the bar. Press to have it do so at its next step`,"aria-label":"Summarize this thread's context at its next step",className:"-my-2 flex h-6 shrink-0 items-center rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default",children:(0,d.jsx)("span",{className:"block h-[3px] w-9 overflow-hidden rounded-full bg-muted",children:(0,d.jsx)("span",{className:(0,C.cn)("block h-full rounded-full",e?"animate-pulse bg-muted-foreground/40":i>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*i))}%`}})})})}[r,w,z,F]=G.then?(await G)():G;let ai={working:"text-muted-foreground",waiting:C.WAITING_INK,done:"text-foreground",cancelled:"text-muted-foreground"};function L({thread:a}){let b="done"===a.status&&a.seen?"text-muted-foreground":ai[a.status];return"working"===a.status?(0,d.jsx)(s.ShinyText,{text:"working",speed:2.2,className:"shrink-0 font-mono text-[10px]"}):(0,d.jsx)("span",{className:(0,C.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",b),children:a.status})}function M({thread:a,roster:b,side:c,onPick:e,className:f}){return(0,d.jsx)(t.Tabs,{value:c??a.bot.name,onValueChange:b=>e(b===a.bot.name?null:String(b)),className:(0,C.cn)("shrink-0 gap-0 px-3 pt-1 pb-0.5",f),children:(0,d.jsx)(t.TabsList,{className:"w-full justify-start gap-1 overflow-x-auto rounded-none bg-transparent p-0 scrollbar-none group-data-horizontal/tabs:h-auto",children:b.map(b=>{let c=N(a,b.name);return(0,d.jsxs)(t.TabsTrigger,{value:b.name,className:(0,C.cn)(aj,"pl-1.5"),children:[(0,d.jsx)(x.BotMark,{size:16,seed:b.name,color:b.icon?.color,shape:b.icon?.shape,outline:b.icon?.outline,paint:b.icon?.paint,notify:"asking"===c,className:"shrink-0"}),(0,d.jsx)("span",{className:"max-w-28 truncate",children:b.name}),"running"===c&&(0,d.jsx)(l.Loader2,{className:"size-3 animate-spin text-muted-foreground/70"})]},b.name)})})})}let aj="h-7 flex-none rounded-full px-3 py-0 text-[12px] text-muted-foreground hover:bg-muted/60 data-active:bg-muted data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-none dark:data-active:border-transparent dark:data-active:bg-muted";function N(a,b){let{room:c}=a;return c.questions.some(a=>a.bot===b)?"asking":"working"===a.status&&c.participants.some(a=>a.bot===b&&"running"===a.state)?"running":null}function O({turn:a,thread:b,self:c}){let e=a.speaker.name===c,f=e?"none":a.speaker.name===ak.name?"dark":"secondary",g=null;return(0,d.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,d.jsx)($,{side:e?"start":"end",name:a.speaker.name,mark:(0,d.jsx)(Y,{bot:a.speaker}),children:a.entries.map(h=>{if("work"===h.kind)return e?(0,d.jsx)(Q,{lines:h.lines,trailing:h.open,bot:a.speaker,thread:b},h.key):(0,d.jsx)(P,{lines:h.lines,trailing:h.open,bot:a.speaker,thread:b},h.key);let i=(0,E.heardBy)(h.line),j=i&&i.name!==a.speaker.name&&i.name!==c&&i.name!==ak.name&&i.name!==g?i:null;return i&&(g=i.name),(0,d.jsx)(_,{line:h.line,surface:f,mention:j},h.key)})})})}function P({lines:a,trailing:b,bot:c,thread:e}){var f;let[g,h]=(0,o.useState)(!1),[i,j]=(0,o.useState)(null),k=b?N(e,c.name):null,m=(f=a,[["tool","step"],["say","note"],["stop","stop"],["note","compaction"]].map(([a,b])=>[f.filter(b=>b.kind===a).length,b]).filter(([a])=>a>0).map(([a,b])=>`${a} ${b}${1===a?"":"s"}`).join(" · ")),n=a.filter(a=>a.tool?.results!==void 0);if(!k&&!m)return null;let p=a.findLast(a=>"tool"===a.kind||"say"===a.kind),q=g&&a.length>0;return(0,d.jsxs)("div",{className:(0,C.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 p-1",q?"w-full":"w-fit max-w-full"),children:[(0,d.jsxs)("button",{type:"button",disabled:!a.length,"aria-expanded":q,onClick:()=>{h(a=>!a),j(null)},className:"flex min-w-0 items-center gap-2 rounded-xl px-2.5 py-1.5 text-left outline-none transition-colors enabled:hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:["running"===k&&(0,d.jsx)(l.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/60"}),k?(0,d.jsx)(s.ShinyText,{text:"asking"===k?"waiting on you":p?U(p):"working",tone:"asking"===k?"waiting":"muted",speed:2.4,className:"min-w-0 truncate text-[12px] leading-4"}):(0,d.jsx)(S,{words:p?U(p):"",facts:[m,function(a){let b=a.flatMap(a=>a.at?[(0,A.toDate)(a.at).getTime()]:[]);if(b.length<2)return"";let c=Math.round((Math.max(...b)-Math.min(...b))/1e3);if(c<1)return"";if(c<60)return`${c}s`;let d=Math.round(c/60);return d<60?`${d} min`:`${Math.floor(d/60)}h ${d%60}m`}(a)].filter(Boolean).join(" · ")}),a.length>0&&(0,d.jsx)(T,{open:q})]}),!q&&n.length>0&&(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1 px-2 pt-0.5 pb-1.5",children:n.map(a=>a.tool&&(0,d.jsx)(F.StepTile,{tool:a.tool,onOpen:()=>{j(a.id),h(!0)}},a.id))}),q&&(0,d.jsx)("div",{className:"flex min-w-0 flex-col gap-0.5 pt-0.5",children:ah(a).map(a=>"tools"===a.kind?a.lines.map(a=>a.tool&&(0,d.jsx)(F.BotTool,{tool:a.tool,threadId:e.id,collapsed:a.id!==i},a.id)):"stops"===a.kind?(0,d.jsx)("div",{className:"px-1.5 py-1",children:(0,d.jsx)(ag,{lines:a.lines})},a.key):a.lines.map(a=>(0,d.jsx)(ae,{line:a,inset:!0},a.id)))})]})}function Q({lines:a,trailing:b,bot:c,thread:e}){let f=b?N(e,c.name):null,g=a.some(a=>a.tool&&void 0===a.tool.results);return(0,d.jsxs)(d.Fragment,{children:[ah(a).map(a=>"tools"===a.kind?(0,d.jsx)(R,{lines:a.lines,threadId:e.id},a.key):"stops"===a.kind?(0,d.jsx)(ag,{lines:a.lines},a.key):a.lines.map(a=>(0,d.jsx)(ae,{line:a},a.id))),f&&!g&&(0,d.jsx)(s.ShinyText,{text:"asking"===f?"waiting on you":"on the next step…",tone:"asking"===f?"waiting":"muted",speed:2.2,className:"block px-1 font-mono text-[10px]"})]})}function R({lines:a,threadId:b}){return(0,d.jsx)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:a.map(a=>a.tool&&(0,d.jsx)(F.BotTool,{tool:a.tool,threadId:b,collapsed:!0},a.id))})}function S({words:a,facts:b,grow:c=!1}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:(0,C.cn)("min-w-0 truncate text-[12.5px] leading-5 text-foreground/80",c&&"flex-1"),children:a}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] leading-4 text-muted-foreground",children:b})]})}function T({open:a}){return(0,d.jsx)("span",{className:"grid size-5.5 shrink-0 place-items-center rounded-md bg-background text-muted-foreground ring-1 ring-border/60",children:(0,d.jsx)(g.ChevronDown,{className:(0,C.cn)("size-3.5 transition-transform",a&&"rotate-180")})})}function U(a){return"tool"===a.kind&&a.tool?a.tool.note??`${a.tool.name} \xb7 ${a.tool.input}`:(0,C.plainText)(a.text).replace(/\s+/g," ").trim()}function V({thread:a}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(W,{from:ak,to:a.bot}),(0,d.jsx)($,{side:"end",name:ak.name,mark:(0,d.jsx)(Y,{bot:ak}),children:(0,d.jsx)(Z,{dark:!0,className:"py-2 pr-2 pl-3.5",children:(0,d.jsx)(q.FoldedText,{text:a.request,subject:"request",className:"wrap-anywhere"})})})]})}let ak={name:D.ROOM_THURSDAY};function W({from:a,to:b}){return(0,d.jsx)("div",{className:"flex animate-in justify-center fade-in duration-300",children:(0,d.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 font-mono text-[10px] text-muted-foreground",children:[(0,d.jsx)(X,{bot:a}),(0,d.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,d.jsx)(X,{bot:b})]})})}function X({bot:a}){return(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[a.name===ak.name?(0,d.jsx)(y.ThursdayMark,{size:15,className:"shrink-0"}):(0,d.jsx)(x.BotMark,{size:15,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:a.name})]})}function Y({bot:a}){return a.name===ak.name?(0,d.jsx)(y.ThursdayMark,{size:26,className:"mt-1 shrink-0"}):(0,d.jsx)(x.BotMark,{size:26,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"mt-1 shrink-0"})}function Z({dark:a=!1,children:b,className:c}){return(0,d.jsx)(p.Bubble,{align:"end",variant:a?"default":"secondary",className:"max-w-full",children:(0,d.jsx)(p.BubbleContent,{className:(0,C.cn)("rounded-tr-md px-3.5",c),children:(0,d.jsx)("div",{className:(0,C.cn)("min-w-0",a&&"inverse"),children:b})})})}function $({side:a,mark:b,name:c,children:e}){return(0,d.jsxs)("div",{className:(0,C.cn)("flex gap-2.5","end"===a&&"flex-row-reverse"),children:[b,(0,d.jsxs)("div",{className:(0,C.cn)("flex min-w-0 flex-1 flex-col gap-1.5 [&>*+*]:max-w-[80%]","end"===a&&"items-end"),children:[(0,d.jsx)("p",{className:"max-w-[80%] truncate px-1 font-mono text-[10px] text-muted-foreground",children:c}),e]})]})}function _({line:a,surface:b,mention:c}){let e=!!a.question,f="result"===a.kind,g="none"!==b,h=(0,w.shortenPaths)(a.text),i=(0,d.jsxs)(d.Fragment,{children:[e&&(0,d.jsx)(ad,{}),c?(0,d.jsx)(ac,{bot:c,bubble:g,children:h}):(0,d.jsx)(aa,{bubble:g,className:(0,C.cn)(!f&&"leading-snug"),children:h}),(0,d.jsx)(w.Attachments,{text:a.text,onBubble:g,className:"mt-2"})]});return(0,d.jsxs)(d.Fragment,{children:[g?(0,d.jsx)(Z,{dark:"dark"===b,children:i}):(0,d.jsx)("div",{className:"min-w-0 max-w-full px-1",children:i}),a.steppedIn&&(0,d.jsxs)("p",{className:"flex items-center gap-1 px-1 font-mono text-[10px] text-muted-foreground",children:[(0,d.jsx)(k.CornerDownLeft,{className:"size-2.5"}),"stepped in"]}),f&&(0,d.jsx)("div",{className:"flex px-1",children:(0,d.jsx)(af,{text:a.text})})]})}function aa({children:a,bubble:b=!1,className:c}){return(0,d.jsx)(r.Markdown,{className:(0,C.cn)("min-w-0 max-w-full text-[13px] leading-relaxed wrap-anywhere break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&_table]:wrap-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",b&&"[&_[data-streamdown=inline-code]]:text-[12px] [&_[data-streamdown=code-block]]:my-2 [&_[data-streamdown=code-block]]:gap-0 [&_[data-streamdown=code-block]]:rounded-[10px] [&_[data-streamdown=code-block]]:border-0 [&_[data-streamdown=code-block]]:bg-background [&_[data-streamdown=code-block]]:p-0 [&_[data-streamdown=code-block-header]]:h-7 [&_[data-streamdown=code-block-header]]:px-2.5 [&_[data-streamdown=code-block-header]]:text-[11px] [&_[data-streamdown=code-block-body]]:border-0 [&_[data-streamdown=code-block-body]]:bg-transparent! [&_[data-streamdown=code-block-body]]:px-2.5 [&_[data-streamdown=code-block-body]]:pt-0 [&_[data-streamdown=code-block-body]]:pb-2.5 [&_[data-streamdown=code-block-body]]:text-[12.5px] [&_[data-streamdown=code-block]_div:has(>[data-streamdown=code-block-actions])]:-mt-7 [&_[data-streamdown=code-block-actions]]:mr-1 [&_[data-streamdown=code-block-actions]]:border-0 [&_[data-streamdown=code-block-actions]]:bg-transparent!",c),children:a})}function ab({bot:a,bubble:b}){return(0,d.jsxs)("span",{className:(0,C.cn)("mr-1.5 inline-flex h-5 max-w-full items-center gap-1 rounded-full pr-2 pl-[3px] align-[-4px] text-[12px] leading-none font-medium whitespace-nowrap text-foreground",b?"bg-background":"bg-muted"),children:[(0,d.jsx)(x.BotMark,{size:14,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:a.name})]})}function ac({bot:a,bubble:b,children:c}){return(0,d.jsxs)("div",{className:"min-w-0 max-w-full text-[13px] leading-snug",children:[(0,d.jsx)(ab,{bot:a,bubble:b}),(0,d.jsx)(aa,{bubble:b,className:"contents leading-snug [&>p:first-child]:inline",children:c})]})}function ad(){return(0,d.jsxs)("p",{className:"mb-1 flex items-center gap-1.5 text-[12px] leading-4 font-medium text-muted-foreground",children:[(0,d.jsx)(i.CircleQuestionMark,{className:"size-3.5 shrink-0"}),"Question"]})}function ae({line:a,inset:b=!1}){return"note"===a.kind?(0,d.jsxs)("details",{className:"w-full px-2 py-1 text-muted-foreground",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 outline-none [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,d.jsx)("span",{className:"min-w-0 text-center font-mono text-[10px]",children:"Compacted — it goes on from its summary"}),(0,d.jsx)("span",{className:"h-px flex-1 bg-border"})]}),(0,d.jsx)(aa,{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px]",children:a.text})]}):(0,d.jsx)(aa,{className:(0,C.cn)("text-[12.5px] text-muted-foreground",b?"px-2.5 py-1":"px-1"),children:a.text})}function af({text:a}){let[b,c]=(0,o.useState)(!1),e=(0,o.useRef)(null);return(0,o.useEffect)(()=>()=>{e.current&&clearTimeout(e.current)},[]),(0,d.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(a),c(!0),e.current&&clearTimeout(e.current),e.current=setTimeout(()=>c(!1),1400)}catch(a){u.toast.add({type:"error",title:"Could not copy the answer",description:(0,C.errorToString)(a)})}},className:"grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:b?(0,d.jsx)(f.Check,{className:"size-3"}):(0,d.jsx)(j.Copy,{className:"size-3"})})}function ag({lines:a}){return(0,d.jsxs)("details",{className:"group min-w-0 px-1 text-muted-foreground",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[12.5px] leading-relaxed outline-none [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)(m.RotateCw,{className:"size-3 shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:al(a[0].text)}),a.length>1&&(0,d.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:["×",a.length]}),(0,d.jsx)(g.ChevronDown,{className:"size-2.5 shrink-0 text-muted-foreground/70 transition-transform group-open:rotate-180"})]}),(0,d.jsx)("div",{className:"mt-1 space-y-1 pl-4.5 text-[11px] leading-relaxed",children:a.map(a=>(0,d.jsxs)("p",{className:"flex gap-2 break-keep",children:[a.at&&(0,d.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground/70 tabular-nums",children:(0,e.format)((0,A.toDate)(a.at),"HH:mm:ss")}),(0,d.jsx)("span",{className:"min-w-0",children:a.text})]},a.id))})]})}let al=a=>a.split(" (")[0].replace(/\.$/,"");function ah(a){let b=[];for(let c of a){let a="tool"===c.kind&&c.tool?"tools":"stop"===c.kind?"stops":"said",d=b.at(-1),e=d?.kind===a&&("stops"!==a||al(d.lines[0].text)===al(c.text));d&&e?d.lines.push(c):b.push({kind:a,key:c.id,lines:[c]})}return b}a.s(["Conversation",0,function({thread:a,tab:b=null,onTab:c,className:e,tabsClassName:f}){let g,h=(0,o.useRef)(null),i=(0,o.useRef)(!0),j=(0,E.rosterOf)(a),k=c&&b!==a.bot.name&&j.some(a=>a.name===b)?b:null,l=k??a.bot.name,m=j.filter(b=>(!k||b.name===k)&&N(a,b.name)),n=(0,E.threadItems)((g=new Set(a.room.questions.map(a=>`${a.bot}
|
|
1
|
+
module.exports=[673701,a=>{"use strict";var b=a.i(187924),c=a.i(676459),d=a.i(926184),e=a.i(400187),f=a.i(497895);let g=(0,e.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});(0,e.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}}),a.s(["Bubble",0,function({variant:a="default",align:c="start",className:d,...e}){return(0,b.jsx)("div",{"data-slot":"bubble","data-variant":a,"data-align":c,className:(0,f.cn)(g({variant:a}),d),...e})},"BubbleContent",0,function({className:a,render:b,...e}){var g;return g={defaultTagName:"div",props:(0,c.mergeProps)({className:(0,f.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",a)},e),render:b,state:{slot:"bubble-content"}},(0,d.useRenderElement)(g.defaultTagName??"div",g,g)}],673701)},613350,a=>{"use strict";var b=a.i(187924),c=a.i(589027),d=a.i(572131),e=a.i(497895);a.s(["FoldedText",0,function({text:a,subject:f,clamp:g="line-clamp-3",tall:h="max-h-40",className:i}){let[j,k]=(0,d.useState)(!1),[l,m]=(0,d.useState)(!1),n=(0,d.useRef)(null);return(0,d.useEffect)(()=>k(!1),[a]),(0,d.useEffect)(()=>{let a=n.current;a&&!j&&m(a.scrollHeight>a.clientHeight+1)},[j,a]),(0,b.jsxs)("div",{className:(0,e.cn)("flex items-start gap-1",i),children:[(0,b.jsx)("p",{ref:n,className:(0,e.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",j?(0,e.cn)(h,"overflow-y-auto scrollbar-none"):g),children:a}),(l||j)&&(0,b.jsx)("button",{type:"button",onClick:()=>k(a=>!a),"aria-label":j?`Fold the ${f}`:`Read the whole ${f}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,b.jsx)(c.ChevronDown,{className:(0,e.cn)("size-3.5",j&&"rotate-180")})})]})}])},42380,a=>{"use strict";var b=a.i(187924),c=a.i(913834);a.s(["BotRoster",0,function({bots:a}){return a.length<2?null:(0,b.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:a.map(a=>a.name).join(", "),children:[(0,b.jsx)("span",{className:"flex items-center gap-0.5",children:a.slice(0,3).map(a=>(0,b.jsx)(c.BotMark,{size:18,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"shrink-0"},a.name))}),(0,b.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[a.length," bots"]})]})}])},181809,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(256711),f=a.i(752562),g=a.i(589027),h=a.i(707963),i=a.i(802550),j=a.i(585650),k=a.i(851528),l=a.i(875160),m=a.i(748819),n=a.i(474215),o=a.i(572131),p=a.i(673701),q=a.i(613350),r=a.i(846991),s=a.i(545097),t=a.i(621958),u=a.i(864037),v=a.i(185286),w=a.i(321799),x=a.i(913834),y=a.i(346075),z=a.i(369768),A=a.i(199169),B=a.i(313237),C=a.i(497895),D=a.i(983874),E=a.i(135432),F=a.i(8468),G=b([r,w,z,F]);function H({onClick:a}){return(0,d.jsx)("button",{type:"button",onClick:a,"aria-label":"Fold the room away",className:"grid size-7 shrink-0 place-items-center rounded-full bg-muted text-foreground outline-none transition-colors hover:bg-muted-foreground/20 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,d.jsx)(n.X,{className:"size-3.5"})})}function I({thread:a}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(J,{thread:a}),(0,d.jsx)(K,{thread:a}),(0,d.jsx)(L,{thread:a})]})}function J({thread:a}){let{contextTokens:b,tokens:c}=a;return b?(0,d.jsx)("span",{title:`Last step ${(0,C.formatCount)(b)} tokens \xb7 in total in ${(0,C.formatCount)(c.input)} \xb7 out ${(0,C.formatCount)(c.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,C.formatCount)(b)}):null}function K({thread:a}){let{contextTokens:b,contextBudget:c}=a,[e,f]=(0,o.useState)(!1),[g,h]=(0,B.useServerAction)(v.compactThreadAction,{onOk:()=>f(!0)});if((0,o.useEffect)(()=>f(!1),[b]),!b||!c)return null;let i=Math.min(1,b/c);return(0,d.jsx)("button",{type:"button",disabled:h||e,onClick:()=>void g(a.id,a.bot.name).catch(()=>{}),title:e?"It summarizes itself at its next step":`Context ${(0,C.formatCount)(b)} of ${(0,C.formatCount)(c)} — it summarizes itself at the end of the bar. Press to have it do so at its next step`,"aria-label":"Summarize this thread's context at its next step",className:"-my-2 flex h-6 shrink-0 items-center rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default",children:(0,d.jsx)("span",{className:"block h-[3px] w-9 overflow-hidden rounded-full bg-muted",children:(0,d.jsx)("span",{className:(0,C.cn)("block h-full rounded-full",e?"animate-pulse bg-muted-foreground/40":i>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*i))}%`}})})})}[r,w,z,F]=G.then?(await G)():G;let ai={working:"text-muted-foreground",waiting:C.WAITING_INK,done:"text-foreground",cancelled:"text-muted-foreground"};function L({thread:a}){let b="done"===a.status&&a.seen?"text-muted-foreground":ai[a.status];return"working"===a.status?(0,d.jsx)(s.ShinyText,{text:"working",speed:2.2,className:"shrink-0 font-mono text-[10px]"}):(0,d.jsx)("span",{className:(0,C.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",b),children:a.status})}function M({thread:a,roster:b,side:c,onPick:e,className:f}){return(0,d.jsx)(t.Tabs,{value:c??a.bot.name,onValueChange:b=>e(b===a.bot.name?null:String(b)),className:(0,C.cn)("shrink-0 gap-0 px-3 pt-1 pb-0.5",f),children:(0,d.jsx)(t.TabsList,{className:"w-full justify-start gap-1 overflow-x-auto rounded-none bg-transparent p-0 scrollbar-none group-data-horizontal/tabs:h-auto",children:b.map(b=>{let c=N(a,b.name);return(0,d.jsxs)(t.TabsTrigger,{value:b.name,className:(0,C.cn)(aj,"pl-1.5"),children:[(0,d.jsx)(x.BotMark,{size:16,seed:b.name,color:b.icon?.color,shape:b.icon?.shape,outline:b.icon?.outline,paint:b.icon?.paint,notify:"asking"===c,className:"shrink-0"}),(0,d.jsx)("span",{className:"max-w-28 truncate",children:b.name}),"running"===c&&(0,d.jsx)(l.Loader2,{className:"size-3 animate-spin text-muted-foreground/70"})]},b.name)})})})}let aj="h-7 flex-none rounded-full px-3 py-0 text-[12px] text-muted-foreground hover:bg-muted/60 data-active:bg-muted data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-none dark:data-active:border-transparent dark:data-active:bg-muted";function N(a,b){let{room:c}=a;return c.questions.some(a=>a.bot===b)?"asking":"working"===a.status&&c.participants.some(a=>a.bot===b&&"running"===a.state)?"running":null}function O({turn:a,thread:b,self:c}){let e=a.speaker.name===c,f=e?"none":a.speaker.name===ak.name?"dark":"secondary",g=null;return(0,d.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,d.jsx)($,{side:e?"start":"end",name:a.speaker.name,mark:(0,d.jsx)(Y,{bot:a.speaker}),children:a.entries.map(h=>{if("work"===h.kind)return e?(0,d.jsx)(Q,{lines:h.lines,trailing:h.open,bot:a.speaker,thread:b},h.key):(0,d.jsx)(P,{lines:h.lines,trailing:h.open,bot:a.speaker,thread:b},h.key);let i=(0,E.heardBy)(h.line),j=i&&i.name!==a.speaker.name&&i.name!==c&&i.name!==ak.name&&i.name!==g?i:null;return i&&(g=i.name),(0,d.jsx)(_,{line:h.line,surface:f,mention:j},h.key)})})})}function P({lines:a,trailing:b,bot:c,thread:e}){var f;let[g,h]=(0,o.useState)(!1),[i,j]=(0,o.useState)(null),k=b?N(e,c.name):null,m=(f=a,[["tool","step"],["say","note"],["stop","stop"],["note","compaction"]].map(([a,b])=>[f.filter(b=>b.kind===a).length,b]).filter(([a])=>a>0).map(([a,b])=>`${a} ${b}${1===a?"":"s"}`).join(" · ")),n=a.filter(a=>a.tool?.results!==void 0);if(!k&&!m)return null;let p=a.findLast(a=>"tool"===a.kind||"say"===a.kind),q=g&&a.length>0;return(0,d.jsxs)("div",{className:(0,C.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 p-1",q?"w-full":"w-fit max-w-full"),children:[(0,d.jsxs)("button",{type:"button",disabled:!a.length,"aria-expanded":q,onClick:()=>{h(a=>!a),j(null)},className:"flex min-w-0 items-center gap-2 rounded-xl px-2.5 py-1.5 text-left outline-none transition-colors enabled:hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:["running"===k&&(0,d.jsx)(l.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/60"}),k?(0,d.jsx)(s.ShinyText,{text:"asking"===k?"waiting on you":p?U(p):"working",tone:"asking"===k?"waiting":"muted",speed:2.4,className:"min-w-0 truncate text-[12px] leading-4"}):(0,d.jsx)(S,{words:p?U(p):"",facts:[m,function(a){let b=a.flatMap(a=>a.at?[(0,A.toDate)(a.at).getTime()]:[]);if(b.length<2)return"";let c=Math.round((Math.max(...b)-Math.min(...b))/1e3);if(c<1)return"";if(c<60)return`${c}s`;let d=Math.round(c/60);return d<60?`${d} min`:`${Math.floor(d/60)}h ${d%60}m`}(a)].filter(Boolean).join(" · ")}),a.length>0&&(0,d.jsx)(T,{open:q})]}),!q&&n.length>0&&(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1 px-2 pt-0.5 pb-1.5",children:n.map(a=>a.tool&&(0,d.jsx)(F.StepTile,{tool:a.tool,onOpen:()=>{j(a.id),h(!0)}},a.id))}),q&&(0,d.jsx)("div",{className:"flex min-w-0 flex-col gap-0.5 pt-0.5",children:ah(a).map(a=>"tools"===a.kind?a.lines.map(a=>a.tool&&(0,d.jsx)(F.BotTool,{tool:a.tool,threadId:e.id,collapsed:a.id!==i},a.id)):"stops"===a.kind?(0,d.jsx)("div",{className:"px-1.5 py-1",children:(0,d.jsx)(ag,{lines:a.lines})},a.key):a.lines.map(a=>(0,d.jsx)(ae,{line:a,inset:!0},a.id)))})]})}function Q({lines:a,trailing:b,bot:c,thread:e}){let f=b?N(e,c.name):null,g=a.some(a=>a.tool&&void 0===a.tool.results);return(0,d.jsxs)(d.Fragment,{children:[ah(a).map(a=>"tools"===a.kind?(0,d.jsx)(R,{lines:a.lines,threadId:e.id},a.key):"stops"===a.kind?(0,d.jsx)(ag,{lines:a.lines},a.key):a.lines.map(a=>(0,d.jsx)(ae,{line:a},a.id))),f&&!g&&(0,d.jsx)(s.ShinyText,{text:"asking"===f?"waiting on you":"on the next step…",tone:"asking"===f?"waiting":"muted",speed:2.2,className:"block px-1 font-mono text-[10px]"})]})}function R({lines:a,threadId:b}){return(0,d.jsx)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:a.map(a=>a.tool&&(0,d.jsx)(F.BotTool,{tool:a.tool,threadId:b,collapsed:!0},a.id))})}function S({words:a,facts:b,grow:c=!1}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:(0,C.cn)("min-w-0 truncate text-[12.5px] leading-5 text-foreground/80",c&&"flex-1"),children:a}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] leading-4 text-muted-foreground",children:b})]})}function T({open:a}){return(0,d.jsx)("span",{className:"grid size-5.5 shrink-0 place-items-center rounded-md bg-background text-muted-foreground ring-1 ring-border/60",children:(0,d.jsx)(g.ChevronDown,{className:(0,C.cn)("size-3.5 transition-transform",a&&"rotate-180")})})}function U(a){return"tool"===a.kind&&a.tool?a.tool.note??`${a.tool.name} \xb7 ${a.tool.input}`:(0,C.plainText)(a.text).replace(/\s+/g," ").trim()}function V({thread:a}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(W,{from:ak,to:a.bot}),(0,d.jsx)($,{side:"end",name:ak.name,mark:(0,d.jsx)(Y,{bot:ak}),children:(0,d.jsx)(Z,{dark:!0,className:"py-2 pr-2 pl-3.5",children:(0,d.jsx)(q.FoldedText,{text:a.request,subject:"request",className:"wrap-anywhere"})})})]})}let ak={name:D.ROOM_THURSDAY};function W({from:a,to:b}){return(0,d.jsx)("div",{className:"flex animate-in justify-center fade-in duration-300",children:(0,d.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 font-mono text-[10px] text-muted-foreground",children:[(0,d.jsx)(X,{bot:a}),(0,d.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,d.jsx)(X,{bot:b})]})})}function X({bot:a}){return(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[a.name===ak.name?(0,d.jsx)(y.ThursdayMark,{size:15,className:"shrink-0"}):(0,d.jsx)(x.BotMark,{size:15,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:a.name})]})}function Y({bot:a}){return a.name===ak.name?(0,d.jsx)(y.ThursdayMark,{size:26,className:"mt-1 shrink-0"}):(0,d.jsx)(x.BotMark,{size:26,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"mt-1 shrink-0"})}function Z({dark:a=!1,children:b,className:c}){return(0,d.jsx)(p.Bubble,{align:"end",variant:a?"default":"secondary",className:"max-w-full",children:(0,d.jsx)(p.BubbleContent,{className:(0,C.cn)("rounded-tr-md px-3.5",c),children:(0,d.jsx)("div",{className:(0,C.cn)("min-w-0",a&&"inverse"),children:b})})})}function $({side:a,mark:b,name:c,children:e}){return(0,d.jsxs)("div",{className:(0,C.cn)("flex gap-2.5","end"===a&&"flex-row-reverse"),children:[b,(0,d.jsxs)("div",{className:(0,C.cn)("flex min-w-0 flex-1 flex-col gap-1.5 [&>*+*]:max-w-[80%]","end"===a&&"items-end"),children:[(0,d.jsx)("p",{className:"max-w-[80%] truncate px-1 font-mono text-[10px] text-muted-foreground",children:c}),e]})]})}function _({line:a,surface:b,mention:c}){let e=!!a.question,f="result"===a.kind,g="none"!==b,h=(0,w.shortenPaths)(a.text),i=(0,d.jsxs)(d.Fragment,{children:[e&&(0,d.jsx)(ad,{}),c?(0,d.jsx)(ac,{bot:c,bubble:g,children:h}):(0,d.jsx)(aa,{bubble:g,className:(0,C.cn)(!f&&"leading-snug"),children:h}),(0,d.jsx)(w.Attachments,{text:a.text,onBubble:g,className:"mt-2"})]});return(0,d.jsxs)(d.Fragment,{children:[g?(0,d.jsx)(Z,{dark:"dark"===b,children:i}):(0,d.jsx)("div",{className:"min-w-0 max-w-full px-1",children:i}),a.steppedIn&&(0,d.jsxs)("p",{className:"flex items-center gap-1 px-1 font-mono text-[10px] text-muted-foreground",children:[(0,d.jsx)(k.CornerDownLeft,{className:"size-2.5"}),"stepped in"]}),f&&(0,d.jsx)("div",{className:"flex px-1",children:(0,d.jsx)(af,{text:a.text})})]})}function aa({children:a,bubble:b=!1,className:c}){return(0,d.jsx)(r.Markdown,{className:(0,C.cn)("min-w-0 max-w-full text-[13px] leading-relaxed wrap-anywhere break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&_table]:wrap-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",b&&"[&_[data-streamdown=inline-code]]:text-[12px] [&_[data-streamdown=code-block]]:my-2 [&_[data-streamdown=code-block]]:gap-0 [&_[data-streamdown=code-block]]:rounded-[10px] [&_[data-streamdown=code-block]]:border-0 [&_[data-streamdown=code-block]]:bg-background [&_[data-streamdown=code-block]]:p-0 [&_[data-streamdown=code-block-header]]:h-7 [&_[data-streamdown=code-block-header]]:px-2.5 [&_[data-streamdown=code-block-header]]:text-[11px] [&_[data-streamdown=code-block-body]]:border-0 [&_[data-streamdown=code-block-body]]:bg-transparent! [&_[data-streamdown=code-block-body]]:px-2.5 [&_[data-streamdown=code-block-body]]:pt-0 [&_[data-streamdown=code-block-body]]:pb-2.5 [&_[data-streamdown=code-block-body]]:text-[12.5px] [&_[data-streamdown=code-block]_div:has(>[data-streamdown=code-block-actions])]:-mt-7 [&_[data-streamdown=code-block-actions]]:mr-1 [&_[data-streamdown=code-block-actions]]:border-0 [&_[data-streamdown=code-block-actions]]:bg-transparent!",c),children:a})}function ab({bot:a,bubble:b}){return(0,d.jsxs)("span",{className:(0,C.cn)("mr-1.5 inline-flex h-5 max-w-full items-center gap-1 rounded-full pr-2 pl-[3px] align-[-4px] text-[12px] leading-none font-medium whitespace-nowrap text-foreground",b?"bg-background":"bg-muted"),children:[(0,d.jsx)(x.BotMark,{size:14,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:a.name})]})}function ac({bot:a,bubble:b,children:c}){return(0,d.jsxs)("div",{className:"min-w-0 max-w-full text-[13px] leading-snug",children:[(0,d.jsx)(ab,{bot:a,bubble:b}),(0,d.jsx)(aa,{bubble:b,className:"contents leading-snug [&>p:first-child]:inline",children:c})]})}function ad(){return(0,d.jsxs)("p",{className:"mb-1 flex items-center gap-1.5 text-[12px] leading-4 font-medium text-muted-foreground",children:[(0,d.jsx)(i.CircleQuestionMark,{className:"size-3.5 shrink-0"}),"Question"]})}function ae({line:a,inset:b=!1}){return"note"===a.kind?(0,d.jsxs)("details",{className:"w-full px-2 py-1 text-muted-foreground",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 outline-none [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,d.jsx)("span",{className:"min-w-0 text-center font-mono text-[10px]",children:"Compacted — it goes on from its summary"}),(0,d.jsx)("span",{className:"h-px flex-1 bg-border"})]}),(0,d.jsx)(aa,{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px]",children:a.text})]}):(0,d.jsx)(aa,{className:(0,C.cn)("text-[12.5px] text-muted-foreground",b?"px-2.5 py-1":"px-1"),children:a.text})}function af({text:a}){let[b,c]=(0,o.useState)(!1),e=(0,o.useRef)(null);return(0,o.useEffect)(()=>()=>{e.current&&clearTimeout(e.current)},[]),(0,d.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(a),c(!0),e.current&&clearTimeout(e.current),e.current=setTimeout(()=>c(!1),1400)}catch(a){u.toast.add({type:"error",title:"Could not copy the answer",description:(0,C.errorToString)(a)})}},className:"grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:b?(0,d.jsx)(f.Check,{className:"size-3"}):(0,d.jsx)(j.Copy,{className:"size-3"})})}function ag({lines:a}){return(0,d.jsxs)("details",{className:"group min-w-0 px-1 text-muted-foreground",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[12.5px] leading-relaxed outline-none [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)(m.RotateCw,{className:"size-3 shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:al(a[0].text)}),a.length>1&&(0,d.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:["×",a.length]}),(0,d.jsx)(g.ChevronDown,{className:"size-2.5 shrink-0 text-muted-foreground/70 transition-transform group-open:rotate-180"})]}),(0,d.jsx)("div",{className:"mt-1 space-y-1 pl-4.5 text-[11px] leading-relaxed",children:a.map(a=>(0,d.jsxs)("p",{className:"flex gap-2 break-keep",children:[a.at&&(0,d.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground/70 tabular-nums",children:(0,e.format)((0,A.toDate)(a.at),"HH:mm:ss")}),(0,d.jsx)("span",{className:"min-w-0",children:a.text})]},a.id))})]})}let al=a=>a.split(" (")[0].replace(/\.$/,"");function ah(a){let b=[];for(let c of a){let a="tool"===c.kind&&c.tool?"tools":"stop"===c.kind?"stops":"said",d=b.at(-1),e=d?.kind===a&&("stops"!==a||al(d.lines[0].text)===al(c.text));d&&e?d.lines.push(c):b.push({kind:a,key:c.id,lines:[c]})}return b}a.s(["Conversation",0,function({thread:a,tab:b=null,onTab:c,className:e,tabsClassName:f}){let g,h=(0,o.useRef)(null),i=(0,o.useRef)(!0),j=(0,E.rosterOf)(a),k=c&&b!==a.bot.name&&j.some(a=>a.name===b)?b:null,l=k??a.bot.name,m=j.filter(b=>(!k||b.name===k)&&N(a,b.name)),n=(0,E.threadItems)((g=new Set(a.room.questions.map(a=>`${a.bot}
|
|
2
2
|
${a.text.trim()}`))).size?{...a,lines:a.lines.filter(a=>!("ask"===a.kind&&a.question&&a.to?.name===ak.name&&g.has(`${a.bot.name}
|
|
3
|
-
${a.text.trim()}`)))}:a,l,m);return(0,o.useEffect)(()=>{i.current=!0},[a.id,k]),(0,o.useEffect)(()=>{let a=h.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},[a.lines,a.status,k]),(0,d.jsxs)(z.FileViewer,{children:[c&&(0,d.jsx)(M,{thread:a,roster:j,side:k,onPick:c,className:f}),(0,d.jsxs)("div",{ref:h,onScroll:a=>{let b=a.currentTarget;i.current=b.scrollHeight-b.scrollTop-b.clientHeight<24},className:(0,C.cn)("min-w-0 max-h-[64vh] space-y-3 overflow-y-auto px-4 pt-6 pb-4 mask-[linear-gradient(to_bottom,transparent,black_2rem)] scrollbar-none",e),children:[!k&&(0,d.jsx)(V,{thread:a}),n.map(b=>"invite"===b.kind?(0,d.jsx)(W,{from:b.from,to:b.to},b.key):(0,d.jsx)(O,{turn:b,thread:a,self:l},b.key))]})]})},"FoldButton",0,H,"TAB",0,aj,"THURSDAY",0,ak,"ThreadFacts",0,I,"ThreadHeader",0,function({thread:a,onBack:b,onClose:c}){return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[(0,d.jsx)("button",{type:"button",onClick:b,"aria-label":"Back to the list",className:"shrink-0 rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,d.jsx)(h.ChevronLeft,{className:"size-4"})}),(0,d.jsx)(x.BotMark,{size:22,seed:a.bot.name,color:a.bot.icon?.color,shape:a.bot.icon?.shape,outline:a.bot.icon?.outline,paint:a.bot.icon?.paint,notify:!1}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:[a.label,(0,d.jsx)("span",{title:a.id,className:"ml-1.5 font-mono text-[10px] font-normal text-muted-foreground/60",children:a.id.slice(0,8)})]}),(0,d.jsx)(I,{thread:a}),(0,d.jsx)(H,{onClick:c})]})},"leadOf",0,al,"stepOf",0,U]),c()}catch(a){c(a)}},!1),988422,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(327598),f=a.i(589027),g=a.i(707963),h=a.i(141146),i=a.i(231500),j=a.i(851528),k=a.i(875160),l=a.i(127774),m=a.i(19895),n=a.i(474215),o=a.i(572131),p=a.i(767561),q=a.i(340695),r=a.i(676504),s=a.i(613350),t=a.i(846991),u=a.i(545097),v=a.i(546893),w=a.i(16509),x=a.i(555861),y=a.i(418533),z=a.i(411509),A=a.i(913834),B=a.i(135432),C=a.i(217464),D=a.i(866460),E=a.i(313237),F=a.i(759497),G=a.i(497895),H=b([t,D]);function I({className:a,children:b}){return(0,d.jsx)("div",{className:(0,G.cn)("flex min-w-0 flex-col gap-2.5 rounded-[18px] bg-muted py-2 pr-2 pl-3.5",a),children:b})}function J({bot:a,word:b,children:c}){return(0,d.jsxs)("div",{className:"flex min-h-7 min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{title:a.name,className:"shrink-0 leading-none",children:(0,d.jsx)(N,{bot:a,size:16})}),(0,d.jsx)("span",{className:(0,G.cn)("truncate text-[12px] leading-4 font-medium",G.WAITING_INK),children:b}),c]})}function K({options:a,picked:b,busy:c,onChoose:e}){return(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map(a=>(0,d.jsxs)(q.Button,{type:"button",size:"sm",variant:"ghost",loading:b===a,disabled:c,onClick:()=>e(a),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12.5px] hover:bg-background/60 dark:hover:bg-background/60",children:[a===z.THREAD_CONTINUE&&b!==a&&(0,d.jsx)(i.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),a]},a))})}function L({threadId:a,recipient:b,draftKey:c,send:f,busy:g,placeholder:h,label:i,autoFocus:j=!1,onEscape:m,leading:n,trailing:p,className:r}){let[s,t]=(0,o.useState)(()=>B.threadDrafts.get(a,b,c)),[u,w]=(0,o.useState)(!1),x=d=>{t(d),B.threadDrafts.set(a,b,d,c)},y=(0,D.useGivenFiles)(),z=(0,o.useRef)(null),{take:A}=y;(0,o.useEffect)(()=>D.roomDrop.claim(a=>void A(a)),[A]);let C=!!s.trim()&&!g&&!y.arriving,E=async()=>{C&&(w(!0),await f(y.withPaths(s))&&(x(""),y.clear()),w(!1))};return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),E()},className:(0,G.cn)("flex min-w-0 flex-wrap items-end gap-1",r),children:[y.files.length>0&&(0,d.jsx)(D.GivenFiles,{dense:!0,files:y.files,onRemove:y.remove,className:"w-full pb-1"}),n,(0,d.jsx)(v.Textarea,{value:s,rows:1,disabled:g,autoFocus:j,onChange:a=>x(a.target.value),onPaste:a=>{let b=[...a.clipboardData.files];b.length&&(a.preventDefault(),A(b))},onKeyDown:a=>{"Escape"===a.key&&m?m():"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||229===a.keyCode||(a.preventDefault(),E())},placeholder:h,"aria-label":i,className:"max-h-32 min-h-0 min-w-0 flex-1 resize-none border-0 bg-transparent px-0 py-1 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,d.jsx)("input",{ref:z,type:"file",multiple:!0,hidden:!0,onChange:a=>{A([...a.target.files??[]]),a.target.value=""}}),(0,d.jsx)(q.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:g,"aria-label":"Add files",onClick:()=>z.current?.click(),className:"rounded-full text-muted-foreground",children:(0,d.jsx)(l.Paperclip,{})}),p,(0,d.jsx)(q.Button,{type:"submit",size:"icon-sm",variant:C?"default":"ghost",disabled:!C,"aria-label":"Send",className:"rounded-full",children:u?(0,d.jsx)(k.Loader2,{className:"animate-spin"}):(0,d.jsx)(e.ArrowUp,{})})]})}function M({current:a,bots:b,disabled:c,onPick:e}){return(0,d.jsxs)(r.DropdownMenu,{children:[(0,d.jsxs)(r.DropdownMenuTrigger,{render:(0,d.jsx)("button",{type:"button",disabled:c,"aria-label":`Message ${a.name}; choose another bot`,className:"mt-1 inline-flex h-5 shrink-0 items-center gap-1 self-start rounded-full bg-muted pr-1.5 pl-[3px] text-[12px] leading-none font-medium outline-none transition-colors hover:bg-muted-foreground/15 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50"}),children:[(0,d.jsx)(N,{bot:a,size:14}),(0,d.jsx)("span",{className:"max-w-32 truncate",children:a.name}),(0,d.jsx)(f.ChevronDown,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,d.jsx)(r.DropdownMenuContent,{align:"start",children:(0,d.jsx)(r.DropdownMenuGroup,{children:b.map(a=>(0,d.jsxs)(r.DropdownMenuItem,{onClick:()=>e(a.name),children:[(0,d.jsx)(N,{bot:a,size:16}),a.name]},a.name))})})]})}function N({bot:a,size:b}){return(0,d.jsx)(A.BotMark,{size:b,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"shrink-0"})}function O(){let[a,b]=(0,E.useServerAction)(w.answerThreadAction,{onOk:()=>(0,F.revalidate)(p.queryKey.threads)});return[async(b,c,d,e)=>{let f=c.trim();if(!f)return!1;try{let c=await a(b.id,f,d,e);return B.screenActs.announce({kind:"answered",id:c.id,label:c.label,answer:f,recipient:d,replyTo:e}),!0}catch{return!1}},b]}[t,D]=H.then?(await H)():H,a.s(["ThreadReply",0,function({thread:a,status:b,faces:c=[],to:e=null,className:f}){let[i,l]=(0,o.useState)(),[r,v]=(0,o.useState)(()=>B.threadDrafts.recipient(a.id)??a.bot),[w,A]=(0,o.useState)(!1),[D,H]=(0,o.useState)(null);(0,o.useEffect)(()=>{v(B.threadDrafts.recipient(a.id)??a.bot),l(void 0),A(!1)},[a.id,a.bot]),(0,o.useEffect)(()=>{e&&(B.threadDrafts.select(a.id,e),v(e))},[a.id,e]);let N=a.room.participants,P=a.room.questions,Q=Math.max(0,P.findIndex(a=>a.id===i)),R=P[Q],S="waiting"===b?a.ask:null,T=(0,z.isAppStop)(S),U=R?.bot??(N.some(a=>a.bot===r)?r:a.bot),V=R?.id,[W,X]=O(),[Y,Z]=(0,E.useServerAction)(x.cancelThreadAction,{onOk:a=>{(0,F.revalidate)(p.queryKey.threads),B.screenActs.announce({kind:"stopped",id:a.id,label:a.label})}}),$=X||Z,_=a.room.deliveries.filter(a=>!a.delivered),[aa,ab]=(0,E.useServerAction)(y.withdrawStepInAction,{onOk:()=>(0,F.revalidate)(p.queryKey.threads)}),ac=_.map(a=>`${a.bot}: ${a.text}`).join(" · "),ad=N.filter(a=>"running"===a.state).map(a=>a.bot).join(", ")||a.bot,ae=a=>c.find(b=>b.name===a)??{name:a},af=async c=>{if($)return!1;let d=await W(a,c,U,V);return d&&"running"===b&&A(!1),d},ag=async a=>{H(a),await af(a),H(null)},ah="running"===b||"waiting"===b?(0,d.jsx)(q.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:$,onClick:()=>Y(a.id),"aria-label":"Stop this thread",title:"Stop this thread",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:Z?(0,d.jsx)(k.Loader2,{className:"animate-spin"}):(0,d.jsx)(m.Square,{className:"size-3"})}):null;if(R){let b=R.options??[],c=R.text;return(0,d.jsxs)(I,{className:f,children:[(0,d.jsx)(J,{bot:ae(U),word:"Question",children:P.length>1&&(0,d.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)(q.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Previous question",disabled:$||0===Q,onClick:()=>l(P[Q-1].id),children:(0,d.jsx)(g.ChevronLeft,{})}),(0,d.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums","aria-live":"polite",children:[Q+1," / ",P.length]}),(0,d.jsx)(q.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Next question",disabled:$||Q===P.length-1,onClick:()=>l(P[Q+1].id),children:(0,d.jsx)(h.ChevronRight,{})})]})}),c&&(0,d.jsx)("div",{className:"max-h-[min(14rem,30vh)] min-w-0 overflow-y-auto overscroll-contain pr-1.5",children:(0,d.jsx)(t.Markdown,{className:"min-w-0 text-[13px] leading-snug wrap-anywhere break-keep [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:c})}),b.length>0&&(0,d.jsx)(K,{options:b,picked:D,busy:$,onChoose:ag}),(0,d.jsx)(C.SignInAsk,{bot:U,onAllowed:af}),(0,d.jsx)(L,{threadId:a.id,recipient:U,draftKey:R.id,send:af,busy:$,placeholder:b.length?"Or write your own answer…":"Your answer…",label:`Answer for ${U}`,trailing:ah},JSON.stringify([a.id,U,R.id]))]})}return T?(0,d.jsxs)(I,{className:f,children:[(0,d.jsx)(J,{bot:ae(a.bot),word:"Paused"}),S?.question&&(0,d.jsx)(s.FoldedText,{text:S.question,subject:"message",clamp:"line-clamp-3",tall:"max-h-40"}),(0,d.jsx)(K,{options:S?.options.length?S.options:[z.THREAD_CONTINUE],picked:D,busy:$,onChoose:ag}),(0,d.jsx)(L,{threadId:a.id,recipient:U,send:af,busy:$,placeholder:"Or put it another way…",label:`Message for ${U}`,trailing:ah},JSON.stringify([a.id,U,"paused"]))]}):"running"!==b||w?(0,d.jsxs)("div",{className:(0,G.cn)("flex min-w-0 flex-col gap-1.5",f),children:[(0,d.jsx)(L,{threadId:a.id,recipient:U,send:af,busy:$,autoFocus:"running"===b,onEscape:"running"===b?()=>A(!1):void 0,placeholder:"running"===b?`What's off? ${U} reads this before its next step`:"Anything more? It picks up where it left off",label:`Message for ${U}`,className:"rounded-2xl bg-background py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",leading:N.length>1?(0,d.jsx)(M,{current:ae(U),bots:N.map(a=>ae(a.bot)),disabled:$,onPick:b=>{B.threadDrafts.select(a.id,b),v(b)}}):null,trailing:"running"===b?(0,d.jsx)(q.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:$,onClick:()=>A(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,d.jsx)(n.X,{})}):null},JSON.stringify([a.id,U])),!!ac&&"running"!==b&&(0,d.jsxs)("p",{className:"flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground",children:[(0,d.jsx)(k.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,d.jsxs)("span",{className:"truncate",children:["Sending to ",ac]})]})]}):(0,d.jsxs)("div",{className:(0,G.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 ring-1 ring-border/50",f),children:[_.map(b=>(0,d.jsxs)("div",{className:"flex items-start gap-2 border-border/60 border-b py-2.5 pr-1.5 pl-3.5",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,d.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 font-mono text-[10px] leading-4",children:[(0,d.jsx)(k.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}),(0,d.jsx)(u.ShinyText,{text:`Step-in \xb7 waits for ${b.bot}'s next step`,speed:2.2,className:"min-w-0 truncate"})]}),(0,d.jsx)("p",{className:"whitespace-pre-wrap break-keep text-[13px] leading-snug",children:b.text})]}),(0,d.jsx)(q.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:ab,onClick:()=>aa(a.id,b.id),"aria-label":"Take it back",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:(0,d.jsx)(n.X,{})})]},b.id)),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 py-1.5 pr-1.5 pl-3.5",children:[(0,d.jsx)(u.ShinyText,{text:`${ad} \xb7 Working`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,d.jsxs)(q.Button,{type:"button",size:"sm",variant:"ghost",disabled:$,onClick:()=>A(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,d.jsx)(j.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,d.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),ah]})]})},"useAnswerThread",0,O]),c()}catch(a){c(a)}},!1),16509,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f528f2137f59470c5f0ef1a3a8db7a60163b5cd11",b.callServer,void 0,b.findSourceMapURL,"answerThreadAction");a.s(["answerThreadAction",0,c])},418533,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7fafffef7f5ddff042f88ebc845340a5c6cac7bbba",b.callServer,void 0,b.findSourceMapURL,"withdrawStepInAction");a.s(["withdrawStepInAction",0,c])},641643,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f1bea5380a307b807a64d5494b95f438f73b84926",b.callServer,void 0,b.findSourceMapURL,"compactThreadAction");a.s(["compactThreadAction",0,c])},555861,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f03a72fd8ed1d45bbf0b7f8f4469d10023619ae6f",b.callServer,void 0,b.findSourceMapURL,"cancelThreadAction");a.s(["cancelThreadAction",0,c])},217464,a=>{"use strict";var b=a.i(187924),c=a.i(767561),d=a.i(340695),e=a.i(313237),f=a.i(759497),g=a.i(255903);a.s(["SignInAsk",0,function({bot:a,onAllowed:h}){let{data:i}=(0,f.useServerRoute)(c.queryKey.signIns),[j,k]=(0,e.useServerAction)(g.setSignInBotAction,{onOk:()=>(0,f.revalidate)(c.queryKey.signIns)}),l=(i??[]).filter(b=>b.asking.includes(a));return l.length?(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.map(c=>(0,b.jsxs)(d.Button,{type:"button",size:"sm",loading:k,onClick:()=>void j(c.site,a,!0).then(()=>h(`Yes — you may use my ${c.site} sign-in.`)).catch(()=>{}),children:["Let ",a," use ",c.site," (",c.account,")"]},c.site))}):null}])},866460,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(875160),f=a.i(474215),g=a.i(572131),h=a.i(864037),i=a.i(287702),j=a.i(38793),k=a.i(995740),l=a.i(313237),m=a.i(497895),n=b([j]);[j]=n.then?(await n)():n;let o=null;a.s(["GivenFiles",0,function({files:a,onRemove:b,dense:c=!1,children:g,className:h}){let i=c?"size-8 rounded-lg":"size-10 rounded-[9px]";return(0,d.jsxs)("div",{className:(0,m.cn)("flex flex-wrap gap-1.5",h),children:[a.map(a=>{let g;return(0,d.jsxs)("span",{className:(0,m.cn)("flex max-w-64 items-center bg-muted/70",c?"h-10.5 gap-2 rounded-xl py-1 pr-1.5 pl-1":"h-13 gap-2.5 rounded-[14px] py-1.5 pr-2 pl-1.5"),children:[a.path?(0,d.jsx)(j.FileThumb,{path:a.path,bytes:a.bytes,className:(0,m.cn)("shrink-0 overflow-hidden ring-1 ring-foreground/6",i)}):(0,d.jsx)("span",{className:(0,m.cn)("grid shrink-0 place-items-center bg-background text-muted-foreground ring-1 ring-foreground/6",i),children:(0,d.jsx)(e.Loader2,{className:"size-3.5 animate-spin"})}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,d.jsx)("span",{className:(0,m.cn)("truncate",c?"text-xs leading-4":"text-[12.5px] leading-4.5"),children:a.name}),(0,d.jsxs)("span",{className:"font-mono text-[10px] leading-3.5 text-muted-foreground",children:[(g=a.bytes)<1048576?`${Math.max(1,Math.round(g/1024))} KB`:`${(g/1024/1024).toFixed(1)} MB`,a.note&&` \xb7 ${a.note}`]})]}),(0,d.jsx)("button",{type:"button","aria-label":`Take ${a.name} out`,onClick:()=>b(a.key),className:"grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,d.jsx)(f.X,{className:"size-3.5"})})]},a.key)}),g]})},"roomDrop",0,{claim:a=>(o=a,()=>{o===a&&(o=null)}),offer:(a,b)=>!!o&&!!a?.closest?.("[data-room]")&&(o(b),!0)},"useGivenFiles",0,function(a){let b=(0,g.useRef)(a?.onKept);b.current=a?.onKept;let[c,d]=(0,g.useState)([]),[e]=(0,l.useServerAction)(k.giveFilesAction),f=(0,g.useCallback)(async a=>{let f=i.GIVEN_FILES.perMessage-c.length;a.length>f&&h.toast.add({type:"error",title:`At most ${i.GIVEN_FILES.perMessage} files at a time.`});let g=a.slice(0,Math.max(0,f));if(!g.length)return;let j=g.map(a=>({key:crypto.randomUUID(),name:a.name,bytes:a.size,path:null}));d(a=>[...a,...j]);let k=new FormData;for(let a of g)k.append("file",a);try{let a=await e(k),c=b.current?.(a);d(b=>b.map(b=>{let d=j.findIndex(a=>a.key===b.key);return d<0?b:{...b,path:a[d]??null,note:c}}))}catch{d(a=>a.filter(a=>!j.some(b=>b.key===a.key)))}},[c.length,e]);return{files:c,take:f,remove:a=>d(b=>b.filter(b=>b.key!==a)),clear:()=>d([]),arriving:c.some(a=>null===a.path),withPaths:a=>[a.trim(),...c.flatMap(a=>a.path??[])].filter(Boolean).join("\n")}}]),c()}catch(a){c(a)}},!1),995740,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7fe2d70a70024f0fa498ebfe3c0e167bd1c00b608e",b.callServer,void 0,b.findSourceMapURL,"giveFilesAction");a.s(["giveFilesAction",0,c])},231500,a=>{"use strict";var b=a.i(164831);let c={name:"chevrons-right",size:24,node:[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]};c.node;let d=(0,b.default)(c);a.s(["ChevronsRight",0,d],231500)},802550,a=>{"use strict";var b=a.i(164831);let c={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};c.node;let d=(0,b.default)(c);a.s(["CircleQuestionMark",0,d],802550)},851528,a=>{"use strict";var b=a.i(164831);let c={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};c.node;let d=(0,b.default)(c);a.s(["CornerDownLeft",0,d],851528)},127774,a=>{"use strict";var b=a.i(164831);let c={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]};c.node;let d=(0,b.default)(c);a.s(["Paperclip",0,d],127774)},748819,a=>{"use strict";var b=a.i(164831);let c={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};c.node;let d=(0,b.default)(c);a.s(["RotateCw",0,d],748819)},19895,a=>{"use strict";var b=a.i(164831);let c={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};c.node;let d=(0,b.default)(c);a.s(["Square",0,d],19895)}];
|
|
3
|
+
${a.text.trim()}`)))}:a,l,m);return(0,o.useEffect)(()=>{i.current=!0},[a.id,k]),(0,o.useEffect)(()=>{let a=h.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},[a.lines,a.status,k]),(0,d.jsxs)(z.FileViewer,{children:[c&&(0,d.jsx)(M,{thread:a,roster:j,side:k,onPick:c,className:f}),(0,d.jsxs)("div",{ref:h,onScroll:a=>{let b=a.currentTarget;i.current=b.scrollHeight-b.scrollTop-b.clientHeight<24},className:(0,C.cn)("min-w-0 max-h-[64vh] space-y-3 overflow-y-auto px-4 pt-6 pb-4 mask-[linear-gradient(to_bottom,transparent,black_2rem)] scrollbar-none",e),children:[!k&&(0,d.jsx)(V,{thread:a}),n.map(b=>"invite"===b.kind?(0,d.jsx)(W,{from:b.from,to:b.to},b.key):(0,d.jsx)(O,{turn:b,thread:a,self:l},b.key))]})]})},"FoldButton",0,H,"TAB",0,aj,"THURSDAY",0,ak,"ThreadFacts",0,I,"ThreadHeader",0,function({thread:a,onBack:b,onClose:c}){return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[(0,d.jsx)("button",{type:"button",onClick:b,"aria-label":"Back to the list",className:"shrink-0 rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,d.jsx)(h.ChevronLeft,{className:"size-4"})}),(0,d.jsx)(x.BotMark,{size:22,seed:a.bot.name,color:a.bot.icon?.color,shape:a.bot.icon?.shape,outline:a.bot.icon?.outline,paint:a.bot.icon?.paint,notify:!1}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:[a.label,(0,d.jsx)("span",{title:a.id,className:"ml-1.5 font-mono text-[10px] font-normal text-muted-foreground/60",children:a.id.slice(0,8)})]}),(0,d.jsx)(I,{thread:a}),(0,d.jsx)(H,{onClick:c})]})},"leadOf",0,al,"stepOf",0,U]),c()}catch(a){c(a)}},!1),988422,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(327598),f=a.i(589027),g=a.i(707963),h=a.i(141146),i=a.i(231500),j=a.i(851528),k=a.i(875160),l=a.i(127774),m=a.i(19895),n=a.i(474215),o=a.i(572131),p=a.i(767561),q=a.i(340695),r=a.i(676504),s=a.i(613350),t=a.i(846991),u=a.i(545097),v=a.i(546893),w=a.i(844368),x=a.i(481371),y=a.i(187623),z=a.i(411509),A=a.i(913834),B=a.i(135432),C=a.i(217464),D=a.i(866460),E=a.i(313237),F=a.i(759497),G=a.i(497895),H=b([t,D]);function I({className:a,children:b}){return(0,d.jsx)("div",{className:(0,G.cn)("flex min-w-0 flex-col gap-2.5 rounded-[18px] bg-muted py-2 pr-2 pl-3.5",a),children:b})}function J({bot:a,word:b,children:c}){return(0,d.jsxs)("div",{className:"flex min-h-7 min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{title:a.name,className:"shrink-0 leading-none",children:(0,d.jsx)(N,{bot:a,size:16})}),(0,d.jsx)("span",{className:(0,G.cn)("truncate text-[12px] leading-4 font-medium",G.WAITING_INK),children:b}),c]})}function K({options:a,picked:b,busy:c,onChoose:e}){return(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map(a=>(0,d.jsxs)(q.Button,{type:"button",size:"sm",variant:"ghost",loading:b===a,disabled:c,onClick:()=>e(a),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12.5px] hover:bg-background/60 dark:hover:bg-background/60",children:[a===z.THREAD_CONTINUE&&b!==a&&(0,d.jsx)(i.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),a]},a))})}function L({threadId:a,recipient:b,draftKey:c,send:f,busy:g,placeholder:h,label:i,autoFocus:j=!1,onEscape:m,leading:n,trailing:p,className:r}){let[s,t]=(0,o.useState)(()=>B.threadDrafts.get(a,b,c)),[u,w]=(0,o.useState)(!1),x=d=>{t(d),B.threadDrafts.set(a,b,d,c)},y=(0,D.useGivenFiles)(),z=(0,o.useRef)(null),{take:A}=y;(0,o.useEffect)(()=>D.roomDrop.claim(a=>void A(a)),[A]);let C=!!s.trim()&&!g&&!y.arriving,E=async()=>{C&&(w(!0),await f(y.withPaths(s))&&(x(""),y.clear()),w(!1))};return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),E()},className:(0,G.cn)("flex min-w-0 flex-wrap items-end gap-1",r),children:[y.files.length>0&&(0,d.jsx)(D.GivenFiles,{dense:!0,files:y.files,onRemove:y.remove,className:"w-full pb-1"}),n,(0,d.jsx)(v.Textarea,{value:s,rows:1,disabled:g,autoFocus:j,onChange:a=>x(a.target.value),onPaste:a=>{let b=[...a.clipboardData.files];b.length&&(a.preventDefault(),A(b))},onKeyDown:a=>{"Escape"===a.key&&m?m():"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||229===a.keyCode||(a.preventDefault(),E())},placeholder:h,"aria-label":i,className:"max-h-32 min-h-0 min-w-0 flex-1 resize-none border-0 bg-transparent px-0 py-1 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,d.jsx)("input",{ref:z,type:"file",multiple:!0,hidden:!0,onChange:a=>{A([...a.target.files??[]]),a.target.value=""}}),(0,d.jsx)(q.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:g,"aria-label":"Add files",onClick:()=>z.current?.click(),className:"rounded-full text-muted-foreground",children:(0,d.jsx)(l.Paperclip,{})}),p,(0,d.jsx)(q.Button,{type:"submit",size:"icon-sm",variant:C?"default":"ghost",disabled:!C,"aria-label":"Send",className:"rounded-full",children:u?(0,d.jsx)(k.Loader2,{className:"animate-spin"}):(0,d.jsx)(e.ArrowUp,{})})]})}function M({current:a,bots:b,disabled:c,onPick:e}){return(0,d.jsxs)(r.DropdownMenu,{children:[(0,d.jsxs)(r.DropdownMenuTrigger,{render:(0,d.jsx)("button",{type:"button",disabled:c,"aria-label":`Message ${a.name}; choose another bot`,className:"mt-1 inline-flex h-5 shrink-0 items-center gap-1 self-start rounded-full bg-muted pr-1.5 pl-[3px] text-[12px] leading-none font-medium outline-none transition-colors hover:bg-muted-foreground/15 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50"}),children:[(0,d.jsx)(N,{bot:a,size:14}),(0,d.jsx)("span",{className:"max-w-32 truncate",children:a.name}),(0,d.jsx)(f.ChevronDown,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,d.jsx)(r.DropdownMenuContent,{align:"start",children:(0,d.jsx)(r.DropdownMenuGroup,{children:b.map(a=>(0,d.jsxs)(r.DropdownMenuItem,{onClick:()=>e(a.name),children:[(0,d.jsx)(N,{bot:a,size:16}),a.name]},a.name))})})]})}function N({bot:a,size:b}){return(0,d.jsx)(A.BotMark,{size:b,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,notify:!1,className:"shrink-0"})}function O(){let[a,b]=(0,E.useServerAction)(w.answerThreadAction,{onOk:()=>(0,F.revalidate)(p.queryKey.threads)});return[async(b,c,d,e)=>{let f=c.trim();if(!f)return!1;try{let c=await a(b.id,f,d,e);return B.screenActs.announce({kind:"answered",id:c.id,label:c.label,answer:f,recipient:d,replyTo:e}),!0}catch{return!1}},b]}[t,D]=H.then?(await H)():H,a.s(["ThreadReply",0,function({thread:a,status:b,faces:c=[],to:e=null,className:f}){let[i,l]=(0,o.useState)(),[r,v]=(0,o.useState)(()=>B.threadDrafts.recipient(a.id)??a.bot),[w,A]=(0,o.useState)(!1),[D,H]=(0,o.useState)(null);(0,o.useEffect)(()=>{v(B.threadDrafts.recipient(a.id)??a.bot),l(void 0),A(!1)},[a.id,a.bot]),(0,o.useEffect)(()=>{e&&(B.threadDrafts.select(a.id,e),v(e))},[a.id,e]);let N=a.room.participants,P=a.room.questions,Q=Math.max(0,P.findIndex(a=>a.id===i)),R=P[Q],S="waiting"===b?a.ask:null,T=(0,z.isAppStop)(S),U=R?.bot??(N.some(a=>a.bot===r)?r:a.bot),V=R?.id,[W,X]=O(),[Y,Z]=(0,E.useServerAction)(x.cancelThreadAction,{onOk:a=>{(0,F.revalidate)(p.queryKey.threads),B.screenActs.announce({kind:"stopped",id:a.id,label:a.label})}}),$=X||Z,_=a.room.deliveries.filter(a=>!a.delivered),[aa,ab]=(0,E.useServerAction)(y.withdrawStepInAction,{onOk:()=>(0,F.revalidate)(p.queryKey.threads)}),ac=_.map(a=>`${a.bot}: ${a.text}`).join(" · "),ad=N.filter(a=>"running"===a.state).map(a=>a.bot).join(", ")||a.bot,ae=a=>c.find(b=>b.name===a)??{name:a},af=async c=>{if($)return!1;let d=await W(a,c,U,V);return d&&"running"===b&&A(!1),d},ag=async a=>{H(a),await af(a),H(null)},ah="running"===b||"waiting"===b?(0,d.jsx)(q.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:$,onClick:()=>Y(a.id),"aria-label":"Stop this thread",title:"Stop this thread",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:Z?(0,d.jsx)(k.Loader2,{className:"animate-spin"}):(0,d.jsx)(m.Square,{className:"size-3"})}):null;if(R){let b=R.options??[],c=R.text;return(0,d.jsxs)(I,{className:f,children:[(0,d.jsx)(J,{bot:ae(U),word:"Question",children:P.length>1&&(0,d.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)(q.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Previous question",disabled:$||0===Q,onClick:()=>l(P[Q-1].id),children:(0,d.jsx)(g.ChevronLeft,{})}),(0,d.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums","aria-live":"polite",children:[Q+1," / ",P.length]}),(0,d.jsx)(q.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Next question",disabled:$||Q===P.length-1,onClick:()=>l(P[Q+1].id),children:(0,d.jsx)(h.ChevronRight,{})})]})}),c&&(0,d.jsx)("div",{className:"max-h-[min(14rem,30vh)] min-w-0 overflow-y-auto overscroll-contain pr-1.5",children:(0,d.jsx)(t.Markdown,{className:"min-w-0 text-[13px] leading-snug wrap-anywhere break-keep [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:c})}),b.length>0&&(0,d.jsx)(K,{options:b,picked:D,busy:$,onChoose:ag}),(0,d.jsx)(C.SignInAsk,{bot:U,onAllowed:af}),(0,d.jsx)(L,{threadId:a.id,recipient:U,draftKey:R.id,send:af,busy:$,placeholder:b.length?"Or write your own answer…":"Your answer…",label:`Answer for ${U}`,trailing:ah},JSON.stringify([a.id,U,R.id]))]})}return T?(0,d.jsxs)(I,{className:f,children:[(0,d.jsx)(J,{bot:ae(a.bot),word:"Paused"}),S?.question&&(0,d.jsx)(s.FoldedText,{text:S.question,subject:"message",clamp:"line-clamp-3",tall:"max-h-40"}),(0,d.jsx)(K,{options:S?.options.length?S.options:[z.THREAD_CONTINUE],picked:D,busy:$,onChoose:ag}),(0,d.jsx)(L,{threadId:a.id,recipient:U,send:af,busy:$,placeholder:"Or put it another way…",label:`Message for ${U}`,trailing:ah},JSON.stringify([a.id,U,"paused"]))]}):"running"!==b||w?(0,d.jsxs)("div",{className:(0,G.cn)("flex min-w-0 flex-col gap-1.5",f),children:[(0,d.jsx)(L,{threadId:a.id,recipient:U,send:af,busy:$,autoFocus:"running"===b,onEscape:"running"===b?()=>A(!1):void 0,placeholder:"running"===b?`What's off? ${U} reads this before its next step`:"Anything more? It picks up where it left off",label:`Message for ${U}`,className:"rounded-2xl bg-background py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",leading:N.length>1?(0,d.jsx)(M,{current:ae(U),bots:N.map(a=>ae(a.bot)),disabled:$,onPick:b=>{B.threadDrafts.select(a.id,b),v(b)}}):null,trailing:"running"===b?(0,d.jsx)(q.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:$,onClick:()=>A(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,d.jsx)(n.X,{})}):null},JSON.stringify([a.id,U])),!!ac&&"running"!==b&&(0,d.jsxs)("p",{className:"flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground",children:[(0,d.jsx)(k.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,d.jsxs)("span",{className:"truncate",children:["Sending to ",ac]})]})]}):(0,d.jsxs)("div",{className:(0,G.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 ring-1 ring-border/50",f),children:[_.map(b=>(0,d.jsxs)("div",{className:"flex items-start gap-2 border-border/60 border-b py-2.5 pr-1.5 pl-3.5",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,d.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 font-mono text-[10px] leading-4",children:[(0,d.jsx)(k.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}),(0,d.jsx)(u.ShinyText,{text:`Step-in \xb7 waits for ${b.bot}'s next step`,speed:2.2,className:"min-w-0 truncate"})]}),(0,d.jsx)("p",{className:"whitespace-pre-wrap break-keep text-[13px] leading-snug",children:b.text})]}),(0,d.jsx)(q.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:ab,onClick:()=>aa(a.id,b.id),"aria-label":"Take it back",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:(0,d.jsx)(n.X,{})})]},b.id)),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 py-1.5 pr-1.5 pl-3.5",children:[(0,d.jsx)(u.ShinyText,{text:`${ad} \xb7 Working`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,d.jsxs)(q.Button,{type:"button",size:"sm",variant:"ghost",disabled:$,onClick:()=>A(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,d.jsx)(j.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,d.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),ah]})]})},"useAnswerThread",0,O]),c()}catch(a){c(a)}},!1),187623,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7ff76eeb437dc9a08d59701aca58ea864ac8300a17",b.callServer,void 0,b.findSourceMapURL,"withdrawStepInAction");a.s(["withdrawStepInAction",0,c])},185286,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f05e3d437383d248cd09d39f6064c2875137be8f8",b.callServer,void 0,b.findSourceMapURL,"compactThreadAction");a.s(["compactThreadAction",0,c])},481371,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f914646fed72199c18504ab03094e85e5a8181ce1",b.callServer,void 0,b.findSourceMapURL,"cancelThreadAction");a.s(["cancelThreadAction",0,c])},844368,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f60b84689e86474a5fccb306bc0007faa46593649",b.callServer,void 0,b.findSourceMapURL,"answerThreadAction");a.s(["answerThreadAction",0,c])},217464,a=>{"use strict";var b=a.i(187924),c=a.i(767561),d=a.i(340695),e=a.i(313237),f=a.i(759497),g=a.i(349009);a.s(["SignInAsk",0,function({bot:a,onAllowed:h}){let{data:i}=(0,f.useServerRoute)(c.queryKey.signIns),[j,k]=(0,e.useServerAction)(g.setSignInBotAction,{onOk:()=>(0,f.revalidate)(c.queryKey.signIns)}),l=(i??[]).filter(b=>b.asking.includes(a));return l.length?(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.map(c=>(0,b.jsxs)(d.Button,{type:"button",size:"sm",loading:k,onClick:()=>void j(c.site,a,!0).then(()=>h(`Yes — you may use my ${c.site} sign-in.`)).catch(()=>{}),children:["Let ",a," use ",c.site," (",c.account,")"]},c.site))}):null}])},866460,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(875160),f=a.i(474215),g=a.i(572131),h=a.i(864037),i=a.i(287702),j=a.i(38793),k=a.i(713569),l=a.i(313237),m=a.i(497895),n=b([j]);[j]=n.then?(await n)():n;let o=null;a.s(["GivenFiles",0,function({files:a,onRemove:b,dense:c=!1,children:g,className:h}){let i=c?"size-8 rounded-lg":"size-10 rounded-[9px]";return(0,d.jsxs)("div",{className:(0,m.cn)("flex flex-wrap gap-1.5",h),children:[a.map(a=>{let g;return(0,d.jsxs)("span",{className:(0,m.cn)("flex max-w-64 items-center bg-muted/70",c?"h-10.5 gap-2 rounded-xl py-1 pr-1.5 pl-1":"h-13 gap-2.5 rounded-[14px] py-1.5 pr-2 pl-1.5"),children:[a.path?(0,d.jsx)(j.FileThumb,{path:a.path,bytes:a.bytes,className:(0,m.cn)("shrink-0 overflow-hidden ring-1 ring-foreground/6",i)}):(0,d.jsx)("span",{className:(0,m.cn)("grid shrink-0 place-items-center bg-background text-muted-foreground ring-1 ring-foreground/6",i),children:(0,d.jsx)(e.Loader2,{className:"size-3.5 animate-spin"})}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,d.jsx)("span",{className:(0,m.cn)("truncate",c?"text-xs leading-4":"text-[12.5px] leading-4.5"),children:a.name}),(0,d.jsxs)("span",{className:"font-mono text-[10px] leading-3.5 text-muted-foreground",children:[(g=a.bytes)<1048576?`${Math.max(1,Math.round(g/1024))} KB`:`${(g/1024/1024).toFixed(1)} MB`,a.note&&` \xb7 ${a.note}`]})]}),(0,d.jsx)("button",{type:"button","aria-label":`Take ${a.name} out`,onClick:()=>b(a.key),className:"grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,d.jsx)(f.X,{className:"size-3.5"})})]},a.key)}),g]})},"roomDrop",0,{claim:a=>(o=a,()=>{o===a&&(o=null)}),offer:(a,b)=>!!o&&!!a?.closest?.("[data-room]")&&(o(b),!0)},"useGivenFiles",0,function(a){let b=(0,g.useRef)(a?.onKept);b.current=a?.onKept;let[c,d]=(0,g.useState)([]),[e]=(0,l.useServerAction)(k.giveFilesAction),f=(0,g.useCallback)(async a=>{let f=i.GIVEN_FILES.perMessage-c.length;a.length>f&&h.toast.add({type:"error",title:`At most ${i.GIVEN_FILES.perMessage} files at a time.`});let g=a.slice(0,Math.max(0,f));if(!g.length)return;let j=g.map(a=>({key:crypto.randomUUID(),name:a.name,bytes:a.size,path:null}));d(a=>[...a,...j]);let k=new FormData;for(let a of g)k.append("file",a);try{let a=await e(k),c=b.current?.(a);d(b=>b.map(b=>{let d=j.findIndex(a=>a.key===b.key);return d<0?b:{...b,path:a[d]??null,note:c}}))}catch{d(a=>a.filter(a=>!j.some(b=>b.key===a.key)))}},[c.length,e]);return{files:c,take:f,remove:a=>d(b=>b.filter(b=>b.key!==a)),clear:()=>d([]),arriving:c.some(a=>null===a.path),withPaths:a=>[a.trim(),...c.flatMap(a=>a.path??[])].filter(Boolean).join("\n")}}]),c()}catch(a){c(a)}},!1),713569,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f3eea94981f7506ef292d2f74a1b89d2278978bf3",b.callServer,void 0,b.findSourceMapURL,"giveFilesAction");a.s(["giveFilesAction",0,c])},231500,a=>{"use strict";var b=a.i(164831);let c={name:"chevrons-right",size:24,node:[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]};c.node;let d=(0,b.default)(c);a.s(["ChevronsRight",0,d],231500)},802550,a=>{"use strict";var b=a.i(164831);let c={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};c.node;let d=(0,b.default)(c);a.s(["CircleQuestionMark",0,d],802550)},851528,a=>{"use strict";var b=a.i(164831);let c={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};c.node;let d=(0,b.default)(c);a.s(["CornerDownLeft",0,d],851528)},127774,a=>{"use strict";var b=a.i(164831);let c={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]};c.node;let d=(0,b.default)(c);a.s(["Paperclip",0,d],127774)},748819,a=>{"use strict";var b=a.i(164831);let c={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};c.node;let d=(0,b.default)(c);a.s(["RotateCw",0,d],748819)},19895,a=>{"use strict";var b=a.i(164831);let c={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};c.node;let d=(0,b.default)(c);a.s(["Square",0,d],19895)}];
|
|
4
4
|
|
|
5
|
-
//# sourceMappingURL=
|
|
5
|
+
//# sourceMappingURL=_12eyown._.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports=[61514,a=>a.a(async(b,c)=>{try{var d=a.i(868468),e=a.i(569572),f=a.i(344853),g=a.i(706210),h=a.i(182248),i=b([f]);async function j(){let a=await (0,f.listThreadOverview)();if(!a.length)return null;let b=a.map(a=>{let b=(0,d.formatDistanceToNowStrict)((0,g.toDate)(a.updatedAt),{addSuffix:!0}),c=a.room.questions[0],f="waiting"===a.status&&c?`waiting on the user since ${b} — ${c.bot} asked: ${(0,h.clip)(c.text,e.PROMPT_LINE.jobOutcome)}`:"waiting"===a.status?`stopped ${b}, not finished`:"running"===a.status?`running, last moved ${b}`:`${a.status} ${b}`;return`- "${a.label}" (${a.id}) — ${a.bot} — ${f}`});return`[The threads as this call opened, open work first. They move while you talk.]
|
|
2
|
-
${b.join("\n")}`}[f]=i.then?(await i)():i,a.s(["loadCallStanding",0,j]),c()}catch(a){c(a)}},!1),614747,a=>a.a(async(b,c)=>{try{var d=a.i(569572),e=a.i(884780),f=a.i(762008),g=a.i(221214),h=a.i(344853),i=a.i(986743),j=a.i(661210),k=a.i(138100),l=a.i(569549),m=a.i(821415),n=a.i(644468),o=a.i(938934),p=b([g,h,i,l,n]);async function q(a,b=!1){var c,p,
|
|
2
|
+
${b.join("\n")}`}[f]=i.then?(await i)():i,a.s(["loadCallStanding",0,j]),c()}catch(a){c(a)}},!1),614747,a=>a.a(async(b,c)=>{try{var d=a.i(569572),e=a.i(884780),f=a.i(762008),g=a.i(221214),h=a.i(344853),i=a.i(986743),j=a.i(661210),k=a.i(138100),l=a.i(569549),m=a.i(821415),n=a.i(644468),o=a.i(938934),p=b([g,h,i,l,n]);async function q(a,b=!1){var c,p,t,u,v,w,x;let y,z=await (0,m.openWorkspace)(),[A,B,C,D,E,F,G,H,I]=await Promise.all([(0,k.loadSkills)(z),(0,i.listNoteIndex)(),(0,i.listAlwaysLoaded)(),(0,i.readNotes)(j.MEMORY_ALWAYS_LISTED,{touch:!1}),(0,n.listConnectedToolNames)(),(0,g.listJobBots)(),(0,l.listRecentTurns)(d.RECENT_CALL.rows),(0,l.readCallSkillsOn)(),(0,g.readBotMemoryOn)()]),J=await (0,h.listCallJobs)(G.map(a=>a.callId)),K=[(0,o.thursdayIdentity)(),b?"":r(),function(a,b,c){let{crowded:d,heavy:e}=(0,o.tidying)(a),g=[...e].sort((a,b)=>b.factCount-a.factCount).slice(0,3).map(a=>a.path),h=d||e.length?`
|
|
3
3
|
|
|
4
4
|
Saved memory has grown past what it holds well${g.length?` (${g.join(", ")})`:""}: say so once in what you return, go through what looks out of date with the user, and forget only what they name.`:"",i=new Set(c.map(a=>a.path)),k=new Set(b.map(a=>a.id)),l=`## Memory
|
|
5
5
|
|
|
@@ -18,7 +18,7 @@ Keep what the user tells you as it comes up, with \`${f.TOOL_NAMES.memory_rememb
|
|
|
18
18
|
|
|
19
19
|
**Keep memory clean as you write.** A fact that repeats, narrows or changes one already in the note replaces it, merged into one line, rather than sitting beside it. A later call finds a note only by its path, its line and the names in quotes: keep the line true, and give something new its own path below.
|
|
20
20
|
|
|
21
|
-
${j.MEMORY_PATHS.map(a=>`- ${a.path} — ${a.of}`).join("\n")}`;return[l,m,p,q].filter(Boolean).join("\n\n")}(
|
|
21
|
+
${j.MEMORY_PATHS.map(a=>`- ${a.path} — ${a.of}`).join("\n")}`;return[l,m,p,q].filter(Boolean).join("\n\n")}(B,C,D.notes),(c=F,p=(0,o.reachNames)(H?[]:A,E),t=I,0===c.length?"":`## Background work
|
|
22
22
|
|
|
23
23
|
Who you hand work to — the names \`${f.TOOL_NAMES.thread_start}\` takes.
|
|
24
24
|
|
|
@@ -26,43 +26,43 @@ ${c.map(a=>`- **${a.name}** — ${a.description}`).join("\n")}${p?`
|
|
|
26
26
|
|
|
27
27
|
What bots can reach for: ${p}.`:""}
|
|
28
28
|
|
|
29
|
-
**A bot can take on almost anything, and anything that takes more than a few seconds is a bot's**; a note, a look at a file or one command is yours. A bot has this computer, a real browser, the web, a shell to build what is missing and far more time than a call; it signs in where it has to and carries work to the end, so something you do not know how to do is work for a bot, not a no. Bots bring each other in, so work that spans several things is still one thread.${
|
|
29
|
+
**A bot can take on almost anything, and anything that takes more than a few seconds is a bot's**; a note, a look at a file or one command is yours. A bot has this computer, a real browser, the web, a shell to build what is missing and far more time than a call; it signs in where it has to and carries work to the end, so something you do not know how to do is work for a bot, not a no. Bots bring each other in, so work that spans several things is still one thread.${t?" Each bot keeps its own memory from thread to thread: when the user says how a bot should work from now on, pass it to that bot to remember.":""}
|
|
30
30
|
|
|
31
31
|
**Work lives in threads.** A thread's bot remembers that thread and nothing else, so the same bot started on a new one begins from nothing. More about work already handed over — a correction, the next step once it finished, going on after it stopped — is said to that thread (\`${f.TOOL_NAMES.thread_tell}\`); only a request that stands on its own starts a new one (\`${f.TOOL_NAMES.thread_start}\`). The threads open as this call started come into the conversation at the start, and they move while you talk: \`${f.TOOL_NAMES.thread_status}\` reads them as they are now, before you answer about one or hand anything over. Ask the user which it is only when the request could be either. Write the request in the user's own words, with what it stands on — including how they told you they want work done — and nothing they did not say.
|
|
32
32
|
|
|
33
33
|
**Work that should start by itself — every morning, every few hours — is a routine.** \`${f.TOOL_NAMES.routine}\` makes one from a bot, the work in the user's own words, and when; from then on it starts a thread for it each time without being asked, and the result reaches the user like any thread's. Ask once for whichever of those they left out, and read the ones that exist before making, changing or deleting one.
|
|
34
34
|
|
|
35
|
-
Updates and questions from threads reach the conversation by themselves, naming their thread and the bot that asks; they come from bots, not the user, and a question is answered with \`${f.TOOL_NAMES.thread_answer}\`. When the user wants to see what a thread made, \`${f.TOOL_NAMES.thread_show}\` puts it on their screen. Once you have explained enough of how a thread ended, mark it with \`${f.TOOL_NAMES.thread_seen}\`, or leave it for the user to open; never mention seen to them.`),(
|
|
35
|
+
Updates and questions from threads reach the conversation by themselves, naming their thread and the bot that asks; they come from bots, not the user, and a question is answered with \`${f.TOOL_NAMES.thread_answer}\`. When the user wants to see what a thread made, \`${f.TOOL_NAMES.thread_show}\` puts it on their screen. Once you have explained enough of how a thread ended, mark it with \`${f.TOOL_NAMES.thread_seen}\`, or leave it for the user to open; never mention seen to them.`),(u=z.cwd,v=H?A:[],y=`## This computer
|
|
36
36
|
|
|
37
|
-
Current Cwd: ${
|
|
37
|
+
Current Cwd: ${u}
|
|
38
38
|
Platform: ${process.platform}
|
|
39
39
|
|
|
40
40
|
Where \`${f.TOOL_NAMES.bash}\` runs, and what the paths you get back are relative to. Each command is cut off after ${Math.round(d.CALL_EXEC_TIMEOUT_MS/1e3)} seconds; anything longer is a bot's.
|
|
41
41
|
|
|
42
|
-
${(0,e.guideLine)()}`,0===
|
|
42
|
+
${(0,e.guideLine)()}`,0===v.length?y:`${y}
|
|
43
43
|
|
|
44
44
|
Skills are written-down ways of doing things here. \`${f.TOOL_NAMES.load_skill}\` opens one, and what it says goes for you too: read one when it covers what was asked and the doing is a glance. Anything longer it describes is still work to hand over, with what the skill said.
|
|
45
45
|
|
|
46
|
-
${(0,o.skillLines)(
|
|
46
|
+
${(0,o.skillLines)(v,{short:!0})}`),b?`## Answer in writing
|
|
47
47
|
|
|
48
48
|
This call is in writing: there is no voice, and what you write is what the user reads, so answer them directly, in their language. Say the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question they have to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. Keep it short and plain.`:`## Return the result
|
|
49
49
|
|
|
50
|
-
Return the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question the user has to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. What you return is said aloud: keep it short and plain.`,(
|
|
50
|
+
Return the relevant facts, whether the task is complete, and what comes next — for work you handed over, who has it and whether it carries an earlier thread on or starts a new one — or the one question the user has to answer first. Use confirmed values from tool results and the notes above, and never invent a successful action. What you return is said aloud: keep it short and plain.`,(w=G,x=J,w.some(a=>a.turns.length>0)?`## Earlier calls
|
|
51
51
|
|
|
52
52
|
What was said on the last calls, verbatim, newest last. It is the past: pick it up when the user does, and never answer it as a new request.
|
|
53
53
|
|
|
54
54
|
A \`${f.TOOL_NAMES.thread_start}\` line carries the thread's handle and how it ended; the handle is for the thread tools, never said aloud. What they ask for now is often one of these carried further.
|
|
55
55
|
|
|
56
|
-
${(0,o.recentCallLines)(
|
|
56
|
+
${(0,o.recentCallLines)(w.map(a=>({...a,jobs:x.filter(b=>b.callId===a.callId)})),d.RECENT_CALL.tokens)}`:""),s(a)].filter(Boolean).join("\n\n");return(0,o.logPromptSize)("thursday",K),K}[g,h,i,l,n]=p.then?(await p)():p;let r=()=>`IMPORTANT — always follow this: when the user wants the call to end, however they say it, forget every other task, answer yes in one word of their language, then immediately, without thinking, use the ${f.TOOL_NAMES.end_call} tool.`,s=a=>a?.trim()?`## Additional instructions
|
|
57
57
|
|
|
58
58
|
Written by the user. Follow them together with everything above.
|
|
59
59
|
|
|
60
|
-
${a.trim()}`:"";a.s(["loadThursdayPrompt",0,q]),c()}catch(a){c(a)}},!1),936292,a=>{"use strict";a.s(["ChannelRefusal",0,class extends Error{}])},242104,a=>{"use strict";a.s(["inPieces",0,function(a,b){let c=[],d=a;for(;d.length>b;){let a=d.slice(0,b),e=Math.max(a.lastIndexOf("\n\n"),a.lastIndexOf("\n")),f=e>b/2?e:b;c.push(d.slice(0,f).trim()),d=d.slice(f).trim()}return d&&c.push(d),c},"runSocket",0,function(a,b,c){return new Promise((d,e)=>{let f=new WebSocket(a),g=a=>{f.readyState===WebSocket.OPEN&&f.send(JSON.stringify(a))},h=()=>f.close(1e3);c.addEventListener("abort",h,{once:!0}),f.addEventListener("message",a=>{try{b.message(JSON.parse(String(a.data)),g)}catch{}}),f.addEventListener("error",()=>{f.readyState!==WebSocket.OPEN&&e(Error(`Could not connect to ${new URL(a).host}`))}),f.addEventListener("close",a=>{c.removeEventListener("abort",h),d({code:a.code,reason:a.reason})})})}])},479286,a=>{"use strict";var b=a.i(936292),c=a.i(242104);let d={4004:"Discord did not take the bot token.",4013:"Discord refused the intents this bot asked for.",4014:"Discord refused an intent this bot is not allowed — check the bot's page."};a.s(["createDiscord",0,function(a){async function e(c,d,e){let f=e instanceof FormData,g=await fetch(`https://discord.com/api/v10${d}`,{method:c,headers:{authorization:`Bot ${a}`,...f||!e?{}:{"content-type":"application/json"}},body:f?e:e?JSON.stringify(e):void 0});if(g.ok)return 204===g.status?null:await g.json();let h=await g.json().catch(()=>null),i=h?.message??`Discord answered ${g.status}`;throw 401===g.status?new b.ChannelRefusal(i):Error(i)}let f=a=>{let b=a.length<=5?1:5,c=[];for(let d=0;d<a.length&&c.length<5;d+=b)c.push({type:1,components:a.slice(d,d+b).map(a=>({type:2,style:2,label:a.text.slice(0,80),custom_id:a.data}))});return c};return{async listen(f,g){let h,i=null;try{let j=await (0,c.runSocket)("wss://gateway.discord.gg/?v=10&encoding=json",{message(b,c){let{op:d,d:g,s:j,t:k}=b;if(null!==j&&(i=j),10===d){let b=g.heartbeat_interval;h=setInterval(()=>c({op:1,d:i}),b),c({op:2,d:{token:a,intents:4096,properties:{os:process.platform,browser:"thursday",device:"thursday"}}})}else if(1===d)c({op:1,d:i});else if(0===d&&"READY"===k)f.ready(g.user.username);else if(0===d&&k){var l,m;let a=(l=k,m=g,"MESSAGE_CREATE"===l?m.guild_id||m.author.bot?null:{kind:"message",chat:m.channel_id,name:m.author.global_name||m.author.username,words:m.content.trim(),files:(m.attachments??[]).map(a=>({name:a.filename,fetch:async()=>{let b=await fetch(a.url);if(!b.ok)throw Error(`Discord answered ${b.status} for the file`);return new File([await b.arrayBuffer()],a.filename,{type:a.content_type??""})}})),unreadable:!1}:"INTERACTION_CREATE"===l?3!==m.type||m.guild_id?null:(e("POST",`/interactions/${m.id}/${m.token}/callback`,{type:6}).catch(()=>{}),{kind:"press",chat:m.channel_id,data:m.data?.custom_id??"",under:m.message?{id:m.message.id,text:m.message.content}:null}):null);a&&f.incoming(a)}}},g),k=d[j.code];if(k)throw new b.ChannelRefusal(k);if(!g.aborted)throw Error(`Discord closed the connection (${j.code})`)}finally{clearInterval(h)}},async say(a,b,d){let g=(0,c.inPieces)(b,1900);for(let[b,c]of g.entries())await e("POST",`/channels/${a}/messages`,{content:c,...d?.length&&b===g.length-1?{components:f(d)}:{}})},async typing(a){await e("POST",`/channels/${a}/typing`).catch(()=>{})},async settle(a,b,c){await e("PATCH",`/channels/${a}/messages/${b}`,{content:c.slice(0,1900),components:[]}).catch(()=>{})},async sendFile(a,b,c){let d=new FormData;d.set("payload_json",JSON.stringify({attachments:[{id:0,filename:c}]})),d.set("files[0]",new Blob([b]),c),await e("POST",`/channels/${a}/messages`,d)}}}])},129167,a=>{"use strict";var b=a.i(936292),c=a.i(242104);let d="https://slack.com/api",e=new Set(["invalid_auth","not_authed","account_inactive","token_revoked","not_allowed_token_type","missing_scope"]);a.s(["createSlack",0,function(a,f){async function g(a,c,h=f){let i=await fetch(`${d}/${a}`,{method:"POST",headers:{authorization:`Bearer ${h}`,"content-type":"application/json; charset=utf-8"},body:JSON.stringify(c)}),j=await i.json().catch(()=>null);if(j?.ok)return j;let k=j?.error??`http_${i.status}`,l="missing_scope"===k?`Slack says the app lacks a permission (${j?.needed??"a scope"}) — make it from the manifest in the guide.`:`Slack answered ${k} to ${a}`;throw e.has(k)?new b.ChannelRefusal(l):Error(l)}let h=new Map;async function i(a){let b=h.get(a);if(b)return b;let c=await g("users.info",{user:a}).then(b=>b.user?.real_name||b.user?.name||a).catch(()=>a);return h.set(a,c),c}async function j(a,b){if("events_api"===a){let a=b.event??{},c=!a.subtype||"file_share"===a.subtype;return"message"===a.type&&"im"===a.channel_type&&c&&!a.bot_id&&a.user&&a.channel?{kind:"message",chat:a.channel,name:await i(a.user),words:(a.text??"").trim(),files:(a.files??[]).flatMap(a=>{let b=a.url_private_download;if(!b)return[];let c=a.name??"file";return[{name:c,fetch:async()=>{let d=await fetch(b,{headers:{authorization:`Bearer ${f}`}});if(!d.ok)throw Error(`Slack answered ${d.status} for the file`);return new File([await d.arrayBuffer()],c,{type:a.mimetype??""})}}]}),unreadable:!1}:null}return"interactive"===a&&"block_actions"===b.type?b.channel?.id?{kind:"press",chat:b.channel.id,data:b.actions?.[0]?.value??"",under:b.message?.ts&&b.message.text?{id:b.message.ts,text:b.message.text}:null}:null:null}return{async listen(b,d){let e=await g("auth.test",{}),{url:f}=await g("apps.connections.open",{},a);b.ready(e.user?`@${e.user}`:"the app");let h=await (0,c.runSocket)(f,{message(a,c){let{type:d,envelope_id:e,payload:f}=a;e&&c({envelope_id:e}),d&&f&&j(d,f).then(a=>{a&&b.incoming(a)})}},d);if(!d.aborted)throw Error(`Slack closed the connection (${h.code})`)},async say(a,b,d){let e=(0,c.inPieces)(b,2900);for(let[b,c]of e.entries()){let f=d?.length&&b===e.length-1;await g("chat.postMessage",{channel:a,text:c,unfurl_links:!1,...f?{blocks:[{type:"section",text:{type:"plain_text",text:c}},{type:"actions",elements:d.slice(0,25).map((a,b)=>({type:"button",action_id:`choice_${b}`,text:{type:"plain_text",text:a.text.slice(0,75)},value:a.data}))}]}:{}})}},async typing(){},async settle(a,b,c){await g("chat.update",{channel:a,ts:b,text:c.slice(0,2900),blocks:[]}).catch(()=>{})},async sendFile(a,b,c){let e=new URLSearchParams({filename:c,length:String(b.byteLength)}),h=await fetch(`${d}/files.getUploadURLExternal`,{method:"POST",headers:{authorization:`Bearer ${f}`},body:e}),i=await h.json();if(!i.ok||!i.upload_url||!i.file_id)throw Error(`Slack answered ${i.error??h.status} to the upload`);await fetch(i.upload_url,{method:"POST",body:new Blob([b])}),await g("files.completeUploadExternal",{files:[{id:i.file_id,title:c}],channel_id:a})}}}])},319261,a=>{"use strict";var b=a.i(569572),c=a.i(936292);let d="https://api.telegram.org";a.s(["createTelegram",0,function(a){async function e(b,e,f){let g=e instanceof FormData,h=await fetch(`${d}/bot${a}/${b}`,{method:"POST",signal:f,...g?{body:e}:{headers:{"content-type":"application/json"},body:JSON.stringify(e??{})}}),i=await h.json().catch(()=>null);if(i?.ok)return i.result;let j=i?.description??`Telegram answered ${h.status}`;throw 401===h.status?new c.ChannelRefusal(j):Error(j)}async function f(b,c,f){let{file_path:g}=await e("getFile",{file_id:b});if(!g)throw Error("Telegram did not say where the file is");let h=await fetch(`${d}/file/bot${a}/${g}`);if(!h.ok)throw Error(`Telegram answered ${h.status} for the file`);let i=g.includes(".")?g.slice(g.lastIndexOf(".")):"";return new File([await h.arrayBuffer()],c.includes(".")?c:`${c}${i}`,f?{type:f}:void 0)}return{async listen(a,c){let d=await e("getMe",void 0,c);a.ready(d.username?`@${d.username}`:d.first_name??"the bot");let g=0;for(;!c.aborted;)for(let d of(await e("getUpdates",{offset:g,timeout:b.REACH.pollSeconds,allowed_updates:["message","callback_query"]},AbortSignal.any([c,AbortSignal.timeout((b.REACH.pollSeconds+15)*1e3)])))){g=d.update_id+1;let b=function(a){let b,c=a.callback_query;if(c)return e("answerCallbackQuery",{callback_query_id:c.id}).catch(()=>{}),{kind:"press",chat:String(c.from.id),data:c.data??"",under:c.message?.text?{id:String(c.message.message_id),text:c.message.text}:null};let d=a.message;if(!d?.from||"private"!==d.chat.type)return null;let g=d.photo?.at(-1),h=d.document?{id:d.document.file_id,name:d.document.file_name??"file",type:d.document.mime_type}:g?{id:g.file_id,name:`photo-${d.message_id}`,type:""}:null;return{kind:"message",chat:String(d.chat.id),name:(b=d.from,[b?.first_name,b?.last_name].filter(Boolean).join(" ")||(b?.username?`@${b.username}`:"Someone")),words:(d.text??d.caption??"").trim(),files:h?[{name:h.name,fetch:()=>f(h.id,h.name,h.type)}]:[],unreadable:!!(d.voice||d.audio||d.video)}}(d);b&&a.incoming(b)}},async say(a,b,c){await e("sendMessage",{chat_id:a,text:b,link_preview_options:{is_disabled:!0},...c?.length?{reply_markup:{inline_keyboard:c.map(a=>[{text:a.text,callback_data:a.data}])}}:{}})},async typing(a){await e("sendChatAction",{chat_id:a,action:"typing"}).catch(()=>{})},async settle(a,b,c){await e("editMessageText",{chat_id:a,message_id:Number(b),text:c,link_preview_options:{is_disabled:!0}}).catch(()=>{})},async sendFile(a,b,c,d){let f=new FormData;f.set("chat_id",a),f.set(d?"photo":"document",new Blob([b]),c),await e(d?"sendPhoto":"sendDocument",f)}}}])},233398,a=>a.a(async(b,c)=>{try{var d=a.i(912714),e=a.i(203469),f=a.i(569572),g=a.i(875931),h=a.i(674986),i=a.i(839430),j=a.i(344853),k=a.i(725466),l=a.i(92706),m=a.i(569549),n=a.i(3894),o=a.i(143699),p=a.i(684321),q=a.i(821415),r=a.i(941981),s=a.i(176668),t=a.i(293480),u=a.i(182248),v=a.i(936292),w=a.i(479286),x=a.i(558067),y=a.i(129167),z=a.i(319261),A=b([g,h,i,j,k,m,o]);[g,h,i,j,k,m,o]=A.then?(await A)():A;let P={telegram:a=>(0,z.createTelegram)(a),discord:a=>(0,w.createDiscord)(a),slack:(a,b)=>(0,y.createSlack)(a,b)},Q=globalThis,R=Q.__reach??={live:new Map,last:null,told:new Set,due:new Map,choices:new Map,listening:null,looking:null},S=()=>e.appEvents.emit({type:"reach"});async function B(a){let b=await (0,k.readConfig)((0,x.reachPersonKey)(a));if(!b)return null;try{let a=JSON.parse(b);return"string"==typeof a.chat&&"string"==typeof a.name?{chat:a.chat,name:a.name}:null}catch{return null}}async function C(a){for(let b of a?[a]:x.REACH_CHANNELS){let c=R.live.get(b);c?.stop.abort(),R.live.delete(b),a&&(await (0,k.removeConfig)((0,x.reachPersonKey)(b)),c?.line&&await (0,m.endCall)(c.line.callId).catch(()=>{}));let d=await Promise.all(x.REACH_KEYS[b].map(k.readConfig));if(!d.every(a=>!!a))continue;let e={name:b,channel:P[b](...d),stop:new AbortController,bot:null,problem:null,asking:null,line:null,turn:Promise.resolve()};R.live.set(b,e),D(e)}R.live.size&&(R.listening??=e.appEvents.subscribe(a=>{"threads"!==a.type||R.looking||(R.looking=setTimeout(()=>{R.looking=null,M().catch(a=>s.logger.error("reach: open work",a))},2e3))})),S()}async function D(a){let{signal:b}=a.stop,c=b=>{a.problem!==b&&(a.problem=b,S())};for(;!b.aborted;){try{await a.channel.listen({ready:b=>{a.bot=b,a.problem=null,S()},incoming:b=>void E(a,b).catch(b=>s.logger.error(`reach ${a.name}: what arrived`,b))},b)}catch(e){if(b.aborted)return;let d=e instanceof Error?e.message:String(e);if(e instanceof v.ChannelRefusal)return s.logger.warn(`reach ${a.name}: ${d}`),c(d);c(d)}await new Promise(a=>setTimeout(a,f.REACH.retryMs))}}async function E(a,b){let{channel:c}=a,d=await B(a.name);if("press"===b.kind){if(d?.chat!==b.chat)return;return O(a,d,b.data,b.under)}if(d?.chat!==b.chat)return d?void await c.say(b.chat,"This Thursday already answers someone else."):(a.asking={chat:b.chat,name:b.name},S(),void await c.say(b.chat,"Almost there. Open Thursday on your computer and press Allow, then write again."));R.last=a.name;let e=b.files.length?await (0,r.keepGivenFiles)(await Promise.all(b.files.map(a=>a.fetch()))):[],f=[b.words,...e].filter(Boolean).join("\n");if(!f){b.unreadable&&await c.say(b.chat,"I can read words, pictures and files here — not voice or video yet. Write it instead.");return}I(a,d,f,f)}async function F(a,b){let c=R.live.get(a),d=c?.asking;c&&d&&d.chat===b&&(await (0,k.writeConfig)((0,x.reachPersonKey)(a),JSON.stringify(d)),c.asking=null,S(),await c.channel.say(b,"You are in. Write here and Thursday answers.").catch(b=>s.logger.warn(`reach ${a}: could not say so`,b)))}async function G(a){await (0,k.removeConfig)((0,x.reachPersonKey)(a));let b=R.live.get(a);b&&await H(b),S()}async function H(a){let b=a.line;a.line=null,b&&await (0,m.endCall)(b.callId).catch(()=>{})}function I(a,b,c,d,e){let f=a.turn.then(()=>J(a,b,c,d,e));return a.turn=f.then(()=>{},()=>{}),f}async function J(a,b,c,d,e){let{channel:h}=a;h.typing(b.chat).catch(()=>{});let i=setInterval(()=>void h.typing(b.chat).catch(()=>{}),4e3);try{let g=n.ThursdaySettingsSchema.parse({}),i=a.line;(!i||Date.now()-i.lastAt>f.REACH.idleMs||!await (0,m.isCallOpen)(i.callId))&&(await H(a),a.line={...await (0,o.openTextCall)(g),messages:[],lastAt:0});let j=a.line,k=await (0,o.answerInWriting)({callId:j.callId,settings:g,standing:j.standing,messages:[...j.messages,{role:"user",content:c}],said:d});j.messages=k.messages,j.lastAt=Date.now();let l=(0,u.plainText)(k.text)||k.did.join("\n"),p=function(a){let b=[],c=a;for(;c.length>f.REACH.chars;){let a=c.slice(0,f.REACH.chars),d=Math.max(a.lastIndexOf("\n\n"),a.lastIndexOf("\n")),e=d>f.REACH.chars/2?d:f.REACH.chars;b.push(c.slice(0,e).trim()),c=c.slice(e).trim()}return c&&b.push(c),b}(l||"…");for(let[a,c]of p.entries())await h.say(b.chat,c,a===p.length-1?e:void 0);return await K(a,b,k.text),!0}catch(d){let c=(0,t.isPublicError)(d)?d.message:(0,g.modelErrorToString)(d);return s.logger.warn(`reach ${a.name}: ${c}`),await h.say(b.chat,c).catch(()=>{}),!1}finally{clearInterval(i)}}async function K(a,b,c){for(let e of(await (0,q.filesOnDisk)((0,p.pathsIn)(c),null)).slice(-f.REACH.files)){let c=await (0,q.insideWorkspace)(e),g=c?await (0,d.stat)(c).catch(()=>null):null;c&&g&&!(g.size>f.REACH.fileBytes)&&await a.channel.sendFile(b.chat,await (0,d.readFile)(c),e.split("/").pop()??"file","image"===(0,p.viewKindOf)(e)).catch(b=>s.logger.warn(`reach ${a.name}: could not send ${e}`,b))}}async function L(){for(let a of[...R.last?[R.last]:[],...x.REACH_CHANNELS.filter(a=>a!==R.last)]){let b=R.live.get(a),c=b?await B(a):null;if(b&&c)return{live:b,person:c}}return null}async function M(){if(!await L())return;let a=T(await (0,j.listInboxThreads)()),b=new Set(a.map(a=>a.key));for(let[a,c]of R.due)b.has(a)||(clearTimeout(c),R.due.delete(a));for(let b of a)R.told.has(b.key)||R.due.has(b.key)||R.due.set(b.key,setTimeout(()=>void N(b.key),f.REACH.notifyAfterMs))}let T=a=>(0,l.openWork)(a).filter(a=>"progress"!==a.kind);async function N(a){R.due.delete(a);let b=await L();if(!b||R.told.has(a))return;let c=await (0,j.listInboxThreads)(),d=T(c).find(b=>b.key===a);if(!d)return;let e=c.find(b=>b.room.questions.some(b=>`question:${b.id}`===a)),f=e?.room.questions.find(b=>`question:${b.id}`===a),g=(f?.options??[]).map((a,b)=>{let c=`${f?.id.slice(0,40)}:${b}`;return R.choices.set(c,{threadId:e?.id??"",bot:f?.bot??"",question:f?.id??"",answer:a}),{text:a,data:c}});R.told.add(a),await I(b.live,b.person,d.line,null,g)?await (0,i.acceptRoomRelays)(d.relayIds):R.told.delete(a)}async function O(a,b,c,d){let e=R.choices.get(c);if(!e)return void await a.channel.say(b.chat,"That question is no longer open here. Write your answer instead.");for(let[a,b]of R.choices)b.question===e.question&&R.choices.delete(a);try{await (0,h.answerThread)(e.threadId,e.answer,"user",e.bot),d&&await a.channel.settle(b.chat,d.id,`${d.text}
|
|
60
|
+
${a.trim()}`:"";a.s(["loadThursdayPrompt",0,q]),c()}catch(a){c(a)}},!1),936292,a=>{"use strict";a.s(["ChannelRefusal",0,class extends Error{}])},242104,a=>{"use strict";a.s(["inPieces",0,function(a,b){let c=[],d=a;for(;d.length>b;){let a=d.slice(0,b),e=Math.max(a.lastIndexOf("\n\n"),a.lastIndexOf("\n")),f=e>b/2?e:b;c.push(d.slice(0,f).trim()),d=d.slice(f).trim()}return d&&c.push(d),c},"runSocket",0,function(a,b,c){return new Promise((d,e)=>{let f=new WebSocket(a),g=a=>{f.readyState===WebSocket.OPEN&&f.send(JSON.stringify(a))},h=()=>f.close(1e3);c.addEventListener("abort",h,{once:!0}),f.addEventListener("message",a=>{try{b.message(JSON.parse(String(a.data)),g)}catch{}}),f.addEventListener("error",()=>{f.readyState!==WebSocket.OPEN&&e(Error(`Could not connect to ${new URL(a).host}`))}),f.addEventListener("close",a=>{c.removeEventListener("abort",h),d({code:a.code,reason:a.reason})})})}])},479286,a=>{"use strict";var b=a.i(936292),c=a.i(242104);let d={4004:"Discord did not take the bot token.",4013:"Discord refused the intents this bot asked for.",4014:"Discord refused an intent this bot is not allowed — check the bot's page."};a.s(["createDiscord",0,function(a){async function e(c,d,e){let f=e instanceof FormData,g=await fetch(`https://discord.com/api/v10${d}`,{method:c,headers:{authorization:`Bot ${a}`,...f||!e?{}:{"content-type":"application/json"}},body:f?e:e?JSON.stringify(e):void 0});if(g.ok)return 204===g.status?null:await g.json();let h=await g.json().catch(()=>null),i=h?.message??`Discord answered ${g.status}`;throw 401===g.status?new b.ChannelRefusal(i):Error(i)}let f=a=>{let b=a.length<=5?1:5,c=[];for(let d=0;d<a.length&&c.length<5;d+=b)c.push({type:1,components:a.slice(d,d+b).map(a=>({type:2,style:2,label:a.text.slice(0,80),custom_id:a.data}))});return c};return{async listen(f,g){let h,i=null;try{let j=await (0,c.runSocket)("wss://gateway.discord.gg/?v=10&encoding=json",{message(b,c){let{op:d,d:g,s:j,t:k}=b;if(null!==j&&(i=j),10===d){let b=g.heartbeat_interval;h=setInterval(()=>c({op:1,d:i}),b),c({op:2,d:{token:a,intents:4096,properties:{os:process.platform,browser:"thursday",device:"thursday"}}})}else if(1===d)c({op:1,d:i});else if(0===d&&"READY"===k)f.ready(g.user.username);else if(0===d&&k){var l,m;let a=(l=k,m=g,"MESSAGE_CREATE"===l?m.guild_id||m.author.bot?null:{kind:"message",chat:m.channel_id,name:m.author.global_name||m.author.username,words:m.content.trim(),files:(m.attachments??[]).map(a=>({name:a.filename,fetch:async()=>{let b=await fetch(a.url);if(!b.ok)throw Error(`Discord answered ${b.status} for the file`);return new File([await b.arrayBuffer()],a.filename,{type:a.content_type??""})}})),unreadable:!1}:"INTERACTION_CREATE"===l?3!==m.type||m.guild_id?null:(e("POST",`/interactions/${m.id}/${m.token}/callback`,{type:6}).catch(()=>{}),{kind:"press",chat:m.channel_id,data:m.data?.custom_id??"",under:m.message?{id:m.message.id,text:m.message.content}:null}):null);a&&f.incoming(a)}}},g),k=d[j.code];if(k)throw new b.ChannelRefusal(k);if(!g.aborted)throw Error(`Discord closed the connection (${j.code})`)}finally{clearInterval(h)}},async say(a,b,d){let g=(0,c.inPieces)(b,1900);for(let[b,c]of g.entries())await e("POST",`/channels/${a}/messages`,{content:c,...d?.length&&b===g.length-1?{components:f(d)}:{}})},async typing(a){await e("POST",`/channels/${a}/typing`).catch(()=>{})},async settle(a,b,c){await e("PATCH",`/channels/${a}/messages/${b}`,{content:c.slice(0,1900),components:[]}).catch(()=>{})},async sendFile(a,b,c){let d=new FormData;d.set("payload_json",JSON.stringify({attachments:[{id:0,filename:c}]})),d.set("files[0]",new Blob([b]),c),await e("POST",`/channels/${a}/messages`,d)}}}])},129167,a=>{"use strict";var b=a.i(936292),c=a.i(242104);let d="https://slack.com/api",e=new Set(["invalid_auth","not_authed","account_inactive","token_revoked","not_allowed_token_type","missing_scope"]);a.s(["createSlack",0,function(a,f){async function g(a,c,h=f){let i=await fetch(`${d}/${a}`,{method:"POST",headers:{authorization:`Bearer ${h}`,"content-type":"application/json; charset=utf-8"},body:JSON.stringify(c)}),j=await i.json().catch(()=>null);if(j?.ok)return j;let k=j?.error??`http_${i.status}`,l="missing_scope"===k?`Slack says the app lacks a permission (${j?.needed??"a scope"}) — make it from the manifest in the guide.`:`Slack answered ${k} to ${a}`;throw e.has(k)?new b.ChannelRefusal(l):Error(l)}let h=new Map;async function i(a){let b=h.get(a);if(b)return b;let c=await g("users.info",{user:a}).then(b=>b.user?.real_name||b.user?.name||a).catch(()=>a);return h.set(a,c),c}async function j(a,b){if("events_api"===a){let a=b.event??{},c=!a.subtype||"file_share"===a.subtype;return"message"===a.type&&"im"===a.channel_type&&c&&!a.bot_id&&a.user&&a.channel?{kind:"message",chat:a.channel,name:await i(a.user),words:(a.text??"").trim(),files:(a.files??[]).flatMap(a=>{let b=a.url_private_download;if(!b)return[];let c=a.name??"file";return[{name:c,fetch:async()=>{let d=await fetch(b,{headers:{authorization:`Bearer ${f}`}});if(!d.ok)throw Error(`Slack answered ${d.status} for the file`);return new File([await d.arrayBuffer()],c,{type:a.mimetype??""})}}]}),unreadable:!1}:null}return"interactive"===a&&"block_actions"===b.type?b.channel?.id?{kind:"press",chat:b.channel.id,data:b.actions?.[0]?.value??"",under:b.message?.ts&&b.message.text?{id:b.message.ts,text:b.message.text}:null}:null:null}return{async listen(b,d){let e=await g("auth.test",{}),{url:f}=await g("apps.connections.open",{},a);b.ready(e.user?`@${e.user}`:"the app");let h=await (0,c.runSocket)(f,{message(a,c){let{type:d,envelope_id:e,payload:f}=a;e&&c({envelope_id:e}),d&&f&&j(d,f).then(a=>{a&&b.incoming(a)})}},d);if(!d.aborted)throw Error(`Slack closed the connection (${h.code})`)},async say(a,b,d){let e=(0,c.inPieces)(b,2900);for(let[b,c]of e.entries()){let f=d?.length&&b===e.length-1;await g("chat.postMessage",{channel:a,text:c,unfurl_links:!1,...f?{blocks:[{type:"section",text:{type:"plain_text",text:c}},{type:"actions",elements:d.slice(0,25).map((a,b)=>({type:"button",action_id:`choice_${b}`,text:{type:"plain_text",text:a.text.slice(0,75)},value:a.data}))}]}:{}})}},async typing(){},async settle(a,b,c){await g("chat.update",{channel:a,ts:b,text:c.slice(0,2900),blocks:[]}).catch(()=>{})},async sendFile(a,b,c){let e=new URLSearchParams({filename:c,length:String(b.byteLength)}),h=await fetch(`${d}/files.getUploadURLExternal`,{method:"POST",headers:{authorization:`Bearer ${f}`},body:e}),i=await h.json();if(!i.ok||!i.upload_url||!i.file_id)throw Error(`Slack answered ${i.error??h.status} to the upload`);await fetch(i.upload_url,{method:"POST",body:new Blob([b])}),await g("files.completeUploadExternal",{files:[{id:i.file_id,title:c}],channel_id:a})}}}])},319261,a=>{"use strict";var b=a.i(569572),c=a.i(936292);let d="https://api.telegram.org";a.s(["createTelegram",0,function(a){async function e(b,e,f){let g=e instanceof FormData,h=await fetch(`${d}/bot${a}/${b}`,{method:"POST",signal:f,...g?{body:e}:{headers:{"content-type":"application/json"},body:JSON.stringify(e??{})}}),i=await h.json().catch(()=>null);if(i?.ok)return i.result;let j=i?.description??`Telegram answered ${h.status}`;throw 401===h.status?new c.ChannelRefusal(j):Error(j)}async function f(b,c,f){let{file_path:g}=await e("getFile",{file_id:b});if(!g)throw Error("Telegram did not say where the file is");let h=await fetch(`${d}/file/bot${a}/${g}`);if(!h.ok)throw Error(`Telegram answered ${h.status} for the file`);let i=g.includes(".")?g.slice(g.lastIndexOf(".")):"";return new File([await h.arrayBuffer()],c.includes(".")?c:`${c}${i}`,f?{type:f}:void 0)}return{async listen(a,c){let d=await e("getMe",void 0,c);a.ready(d.username?`@${d.username}`:d.first_name??"the bot");let g=0;for(;!c.aborted;)for(let d of(await e("getUpdates",{offset:g,timeout:b.REACH.pollSeconds,allowed_updates:["message","callback_query"]},AbortSignal.any([c,AbortSignal.timeout((b.REACH.pollSeconds+15)*1e3)])))){g=d.update_id+1;let b=function(a){let b,c=a.callback_query;if(c)return e("answerCallbackQuery",{callback_query_id:c.id}).catch(()=>{}),{kind:"press",chat:String(c.from.id),data:c.data??"",under:c.message?.text?{id:String(c.message.message_id),text:c.message.text}:null};let d=a.message;if(!d?.from||"private"!==d.chat.type)return null;let g=d.photo?.at(-1),h=d.document?{id:d.document.file_id,name:d.document.file_name??"file",type:d.document.mime_type}:g?{id:g.file_id,name:`photo-${d.message_id}`,type:""}:null;return{kind:"message",chat:String(d.chat.id),name:(b=d.from,[b?.first_name,b?.last_name].filter(Boolean).join(" ")||(b?.username?`@${b.username}`:"Someone")),words:(d.text??d.caption??"").trim(),files:h?[{name:h.name,fetch:()=>f(h.id,h.name,h.type)}]:[],unreadable:!!(d.voice||d.audio||d.video)}}(d);b&&a.incoming(b)}},async say(a,b,c){await e("sendMessage",{chat_id:a,text:b,link_preview_options:{is_disabled:!0},...c?.length?{reply_markup:{inline_keyboard:c.map(a=>[{text:a.text,callback_data:a.data}])}}:{}})},async typing(a){await e("sendChatAction",{chat_id:a,action:"typing"}).catch(()=>{})},async settle(a,b,c){await e("editMessageText",{chat_id:a,message_id:Number(b),text:c,link_preview_options:{is_disabled:!0}}).catch(()=>{})},async sendFile(a,b,c,d){let f=new FormData;f.set("chat_id",a),f.set(d?"photo":"document",new Blob([b]),c),await e(d?"sendPhoto":"sendDocument",f)}}}])},233398,a=>a.a(async(b,c)=>{try{var d=a.i(912714),e=a.i(203469),f=a.i(569572),g=a.i(552556),h=a.i(875931),i=a.i(674986),j=a.i(839430),k=a.i(344853),l=a.i(725466),m=a.i(92706),n=a.i(569549),o=a.i(143699),p=a.i(684321),q=a.i(821415),r=a.i(941981),s=a.i(176668),t=a.i(293480),u=a.i(182248),v=a.i(936292),w=a.i(479286),x=a.i(558067),y=a.i(129167),z=a.i(319261),A=b([h,i,j,k,l,n,o]);[h,i,j,k,l,n,o]=A.then?(await A)():A;let P={telegram:a=>(0,z.createTelegram)(a),discord:a=>(0,w.createDiscord)(a),slack:(a,b)=>(0,y.createSlack)(a,b)},Q=globalThis,R=Q.__reach??={live:new Map,last:null,told:new Set,due:new Map,choices:new Map,listening:null,looking:null},S=()=>e.appEvents.emit({type:"reach"});async function B(a){let b=await (0,l.readConfig)((0,x.reachPersonKey)(a));if(!b)return null;try{let a=JSON.parse(b);return"string"==typeof a.chat&&"string"==typeof a.name?{chat:a.chat,name:a.name}:null}catch{return null}}async function C(a){for(let b of a?[a]:x.REACH_CHANNELS){let c=R.live.get(b);c?.stop.abort(),R.live.delete(b),a&&(await (0,l.removeConfig)((0,x.reachPersonKey)(b)),c?.line&&await (0,n.endCall)(c.line.callId).catch(()=>{}));let d=await Promise.all(x.REACH_KEYS[b].map(l.readConfig));if(!d.every(a=>!!a))continue;let e={name:b,channel:P[b](...d),stop:new AbortController,bot:null,problem:null,asking:null,line:null,turn:Promise.resolve()};R.live.set(b,e),D(e)}R.live.size&&(R.listening??=e.appEvents.subscribe(a=>{"threads"!==a.type||R.looking||(R.looking=setTimeout(()=>{R.looking=null,M().catch(a=>s.logger.error("reach: open work",a))},2e3))})),S()}async function D(a){let{signal:b}=a.stop,c=b=>{a.problem!==b&&(a.problem=b,S())};for(;!b.aborted;){try{await a.channel.listen({ready:b=>{a.bot=b,a.problem=null,S()},incoming:b=>void E(a,b).catch(b=>s.logger.error(`reach ${a.name}: what arrived`,b))},b)}catch(e){if(b.aborted)return;let d=e instanceof Error?e.message:String(e);if(e instanceof v.ChannelRefusal)return s.logger.warn(`reach ${a.name}: ${d}`),c(d);c(d)}await new Promise(a=>setTimeout(a,f.REACH.retryMs))}}async function E(a,b){let{channel:c}=a,d=await B(a.name);if("press"===b.kind){if(d?.chat!==b.chat)return;return O(a,d,b.data,b.under)}if(d?.chat!==b.chat)return d?void await c.say(b.chat,"This Thursday already answers someone else."):(a.asking={chat:b.chat,name:b.name},S(),void await c.say(b.chat,"Almost there. Open Thursday on your computer and press Allow, then write again."));R.last=a.name;let e=b.files.length?await (0,r.keepGivenFiles)(await Promise.all(b.files.map(a=>a.fetch()))):[],f=[b.words,...e].filter(Boolean).join("\n");if(!f){b.unreadable&&await c.say(b.chat,"I can read words, pictures and files here — not voice or video yet. Write it instead.");return}I(a,d,f,f)}async function F(a,b){let c=R.live.get(a),d=c?.asking;c&&d&&d.chat===b&&(await (0,l.writeConfig)((0,x.reachPersonKey)(a),JSON.stringify(d)),c.asking=null,S(),await c.channel.say(b,"You are in. Write here and Thursday answers.").catch(b=>s.logger.warn(`reach ${a}: could not say so`,b)))}async function G(a){await (0,l.removeConfig)((0,x.reachPersonKey)(a));let b=R.live.get(a);b&&await H(b),S()}async function H(a){let b=a.line;a.line=null,b&&await (0,n.endCall)(b.callId).catch(()=>{})}function I(a,b,c,d,e){let f=a.turn.then(()=>J(a,b,c,d,e));return a.turn=f.then(()=>{},()=>{}),f}async function J(a,b,c,d,e){let{channel:i}=a;i.typing(b.chat).catch(()=>{});let j=setInterval(()=>void i.typing(b.chat).catch(()=>{}),4e3);try{let h=g.LiveSettingsSchema.parse({}),j=a.line;(!j||Date.now()-j.lastAt>f.REACH.idleMs||!await (0,n.isCallOpen)(j.callId))&&(await H(a),a.line={...await (0,o.openTextCall)(h),messages:[],lastAt:0});let k=a.line,l=await (0,o.answerInWriting)({callId:k.callId,settings:h,standing:k.standing,messages:[...k.messages,{role:"user",content:c}],said:d});k.messages=l.messages,k.lastAt=Date.now();let m=(0,u.plainText)(l.text)||l.did.join("\n"),p=function(a){let b=[],c=a;for(;c.length>f.REACH.chars;){let a=c.slice(0,f.REACH.chars),d=Math.max(a.lastIndexOf("\n\n"),a.lastIndexOf("\n")),e=d>f.REACH.chars/2?d:f.REACH.chars;b.push(c.slice(0,e).trim()),c=c.slice(e).trim()}return c&&b.push(c),b}(m||"…");for(let[a,c]of p.entries())await i.say(b.chat,c,a===p.length-1?e:void 0);return await K(a,b,l.text),!0}catch(d){let c=(0,t.isPublicError)(d)?d.message:(0,h.modelErrorToString)(d);return s.logger.warn(`reach ${a.name}: ${c}`),await i.say(b.chat,c).catch(()=>{}),!1}finally{clearInterval(j)}}async function K(a,b,c){for(let e of(await (0,q.filesOnDisk)((0,p.pathsIn)(c),null)).slice(-f.REACH.files)){let c=await (0,q.insideWorkspace)(e),g=c?await (0,d.stat)(c).catch(()=>null):null;c&&g&&!(g.size>f.REACH.fileBytes)&&await a.channel.sendFile(b.chat,await (0,d.readFile)(c),e.split("/").pop()??"file","image"===(0,p.viewKindOf)(e)).catch(b=>s.logger.warn(`reach ${a.name}: could not send ${e}`,b))}}async function L(){for(let a of[...R.last?[R.last]:[],...x.REACH_CHANNELS.filter(a=>a!==R.last)]){let b=R.live.get(a),c=b?await B(a):null;if(b&&c)return{live:b,person:c}}return null}async function M(){if(!await L())return;let a=T(await (0,k.listInboxThreads)()),b=new Set(a.map(a=>a.key));for(let[a,c]of R.due)b.has(a)||(clearTimeout(c),R.due.delete(a));for(let b of a)R.told.has(b.key)||R.due.has(b.key)||R.due.set(b.key,setTimeout(()=>void N(b.key),f.REACH.notifyAfterMs))}let T=a=>(0,m.openWork)(a).filter(a=>"progress"!==a.kind);async function N(a){R.due.delete(a);let b=await L();if(!b||R.told.has(a))return;let c=await (0,k.listInboxThreads)(),d=T(c).find(b=>b.key===a);if(!d)return;let e=c.find(b=>b.room.questions.some(b=>`question:${b.id}`===a)),f=e?.room.questions.find(b=>`question:${b.id}`===a),g=(f?.options??[]).map((a,b)=>{let c=`${f?.id.slice(0,40)}:${b}`;return R.choices.set(c,{threadId:e?.id??"",bot:f?.bot??"",question:f?.id??"",answer:a}),{text:a,data:c}});R.told.add(a),await I(b.live,b.person,d.line,null,g)?await (0,j.acceptRoomRelays)(d.relayIds):R.told.delete(a)}async function O(a,b,c,d){let e=R.choices.get(c);if(!e)return void await a.channel.say(b.chat,"That question is no longer open here. Write your answer instead.");for(let[a,b]of R.choices)b.question===e.question&&R.choices.delete(a);try{await (0,i.answerThread)(e.threadId,e.answer,"user",e.bot),d&&await a.channel.settle(b.chat,d.id,`${d.text}
|
|
61
61
|
|
|
62
62
|
→ ${e.answer}`),a.line?.messages.push({role:"user",content:`[The user answered ${e.bot}'s question from their phone: ${e.answer}. It has reached ${e.bot}.]`})}catch(c){await a.channel.say(b.chat,(0,t.isPublicError)(c)?c.message:"That answer did not get through.")}}a.s(["allowReach",0,F,"declineReach",0,function(a){let b=R.live.get(a);b&&(b.asking=null),S()},"forgetReach",0,G,"reachChannelOf",0,a=>x.REACH_CHANNELS.find(b=>x.REACH_KEYS[b].includes(a))??null,"startReach",0,C]),c()}catch(a){c(a)}},!1),92706,a=>{"use strict";var b=a.i(569572),c=a.i(446957),d=a.i(706210);let e={message:"says",question:"asks",report:"reports",interrupted:"was cut off"},f={question:0,stopped:1,done:2,progress:3};function g(a){let c=a.trim();if(c.length<=b.CALL_RELAY.chars)return c;let d=c.slice(0,b.CALL_RELAY.chars),e=Math.max(d.lastIndexOf("\n\n"),d.lastIndexOf(". "),d.lastIndexOf(".\n"),d.lastIndexOf("。")),f=(e>b.CALL_RELAY.chars/3?d.slice(0,e+1):d).trim();return`${f}
|
|
63
63
|
[The message goes on; the rest is in its thread on screen.]`}a.s(["openWork",0,function(a){let b=[];for(let h of a){let{relays:a,questions:i}=h.room,j=(0,d.toDate)(h.updatedAt).getTime(),k=(a,b)=>`[${a} → Thursday, thread "${h.label}" (${h.id}), ${b}.]`,l=(a,b)=>({kind:"relay",name:h.label,line:b,done:!0,bot:a});for(let c of i){let d=c.options?.length?` Options: ${c.options.join(" / ")}.`:"";b.push({rank:f.question,key:`question:${c.id}`,kind:"question",line:`${k(c.bot,"question")}
|
|
64
64
|
${g(c.text)}${d}`,relayIds:a.filter(a=>a.messageId===c.id).map(a=>a.id),show:l(c.bot,`${c.bot} asks`)})}let m=a.filter(a=>!i.some(b=>b.id===a.messageId)),n="done"===h.status,o="waiting"===h.status&&(0,c.isAppStop)(h.ask)&&!h.ask?.auto;if(n||o){if(h.seen)continue;let a=o?"stopped":"done",c="stopped"===a?`It stopped before finishing. Where it got to: ${g(h.ask?.question??h.outcome??"")}`:`Done. Its answer: ${g(h.outcome??"")}`;b.push({rank:f[a],key:`${a}:${h.id}@${j}`,kind:"ending",line:`${k(h.bot,a)}
|
|
65
65
|
${c}`,relayIds:m.map(a=>a.id),show:l(h.bot,"stopped"===a?`${h.bot} stopped`:`${h.bot} finished`)});continue}for(let a of m)b.push({rank:f.progress,key:`progress:${a.id}`,kind:"progress",line:`${k(a.bot,a.kind)}
|
|
66
|
-
${g(a.text)}`,relayIds:[a.id],show:l(a.bot,`${a.bot} ${e[a.kind]}`)})}return b.sort((a,b)=>a.rank-b.rank)}])},143699,a=>a.a(async(b,c)=>{try{var d=a.i(47919),e=a.i(53112),f=a.i(569572),g=a.i(552556),h=a.i(738131),i=a.i(875931),j=a.i(689656),k=a.i(61514),l=a.i(614747),m=a.i(762008),n=a.i(688034),o=a.i(725466),p=a.i(69721);a.i(176668);var q=a.i(293480),r=a.i(569549),s=a.i(3894),t=a.i(626550),u=b([h,i,k,l,o,r]);async function v(){let a=await Promise.all(s.TEXT_CALL_PROVIDERS.map(async a=>await (0,o.readConfig)(a.apiKeyName)?a.apiKeyName:null));return(0,s.textCallRunsOn)(b=>a.includes(b))}async function w(a,b){if(b)return b;let c=await v();return c||(0,q.publicError)(B),{provider:c,model:a.backendModel}}async function x(a,b){let c=await w(a,b),[d,e]=await Promise.all([(0,r.insertCall)({provider:c.provider,model:f.TEXT_CALL.model,backendModel:c.model}),(0,k.loadCallStanding)()]);return{callId:d,standing:e}}async function y(a){var b;let c,{callId:e,settings:g,standing:h,messages:i,said:j,signal:k}=a,[l,n]=await Promise.all([z(e,g),(0,r.nextTurnSeq)(e)]);null!==j&&await (0,r.saveTurns)(e,[{id:crypto.randomUUID(),role:"user",text:j,seq:n}]);let o=await (0,d.generateText)({model:l.model,instructions:l.system,messages:[...A(h),...i],allowSystemInMessages:!0,tools:l.tools,providerOptions:l.providerOptions,stopWhen:(0,d.stepCountIs)(f.TEXT_CALL.maxSteps),abortSignal:k,onStepEnd:(b=e,c=null===j?n:n+1,async a=>{for(let d of a.content)if("tool-call"===d.type){let e=a.content.find(a=>"tool-result"===a.type&&a.toolCallId===d.toolCallId);await (0,r.saveTurns)(b,[{id:d.toolCallId,role:"tool",tool:d.toolName,text:d.toolName===m.TOOL_NAMES.web_search?function(a,b){let c=b??{},d=[(a??{}).query,c.action?.query].find(a=>"string"==typeof a&&!!a.trim()),e=Array.isArray(c.sources)?c.sources.flatMap(a=>a&&"object"==typeof a&&"url"in a&&"string"==typeof a.url?[{url:a.url,..."title"in a&&"string"==typeof a.title?{title:a.title}:{}}]:[]):[];return JSON.stringify({query:d??null,sources:e})}(d.input,e?.type==="tool-result"?e.output:null):JSON.stringify(d.input??{}),seq:c++}])}else"text"===d.type&&d.text.trim()?await (0,r.saveTurns)(b,[{id:crypto.randomUUID(),role:"assistant",text:d.text.trim(),seq:c++}]):"reasoning"===d.type&&d.text.trim()&&await (0,r.saveThought)(b,{id:crypto.randomUUID(),text:d.text.trim(),seq:c})})});return{text:o.text.trim(),did:o.steps.flatMap(a=>a.toolCalls.map(a=>(0,t.toolLine)(a.toolName,JSON.stringify(a.input??{}))??a.toolName)),messages:[...i,...o.response.messages]}}[h,i,k,l,o,r]=u.then?(await u)():u,e.z.object({callId:e.z.string().min(1),settings:
|
|
66
|
+
${g(a.text)}`,relayIds:[a.id],show:l(a.bot,`${a.bot} ${e[a.kind]}`)})}return b.sort((a,b)=>a.rank-b.rank)}])},143699,a=>a.a(async(b,c)=>{try{var d=a.i(47919),e=a.i(53112),f=a.i(569572),g=a.i(552556),h=a.i(738131),i=a.i(875931),j=a.i(689656),k=a.i(61514),l=a.i(614747),m=a.i(762008),n=a.i(688034),o=a.i(725466),p=a.i(69721);a.i(176668);var q=a.i(293480),r=a.i(569549),s=a.i(3894),t=a.i(626550),u=b([h,i,k,l,o,r]);async function v(){let a=await Promise.all(s.TEXT_CALL_PROVIDERS.map(async a=>await (0,o.readConfig)(a.apiKeyName)?a.apiKeyName:null));return(0,s.textCallRunsOn)(b=>a.includes(b))}async function w(a,b){if(b)return b;let c=await v();return c||(0,q.publicError)(B),{provider:c,model:a.backendModel}}async function x(a,b){let c=await w(a,b),[d,e]=await Promise.all([(0,r.insertCall)({provider:c.provider,model:f.TEXT_CALL.model,backendModel:c.model}),(0,k.loadCallStanding)()]);return{callId:d,standing:e}}async function y(a){var b;let c,{callId:e,settings:g,standing:h,messages:i,said:j,signal:k}=a,[l,n]=await Promise.all([z(e,g),(0,r.nextTurnSeq)(e)]);null!==j&&await (0,r.saveTurns)(e,[{id:crypto.randomUUID(),role:"user",text:j,seq:n}]);let o=await (0,d.generateText)({model:l.model,instructions:l.system,messages:[...A(h),...i],allowSystemInMessages:!0,tools:l.tools,providerOptions:l.providerOptions,stopWhen:(0,d.stepCountIs)(f.TEXT_CALL.maxSteps),abortSignal:k,onStepEnd:(b=e,c=null===j?n:n+1,async a=>{for(let d of a.content)if("tool-call"===d.type){let e=a.content.find(a=>"tool-result"===a.type&&a.toolCallId===d.toolCallId);await (0,r.saveTurns)(b,[{id:d.toolCallId,role:"tool",tool:d.toolName,text:d.toolName===m.TOOL_NAMES.web_search?function(a,b){let c=b??{},d=[(a??{}).query,c.action?.query].find(a=>"string"==typeof a&&!!a.trim()),e=Array.isArray(c.sources)?c.sources.flatMap(a=>a&&"object"==typeof a&&"url"in a&&"string"==typeof a.url?[{url:a.url,..."title"in a&&"string"==typeof a.title?{title:a.title}:{}}]:[]):[];return JSON.stringify({query:d??null,sources:e})}(d.input,e?.type==="tool-result"?e.output:null):JSON.stringify(d.input??{}),seq:c++}])}else"text"===d.type&&d.text.trim()?await (0,r.saveTurns)(b,[{id:crypto.randomUUID(),role:"assistant",text:d.text.trim(),seq:c++}]):"reasoning"===d.type&&d.text.trim()&&await (0,r.saveThought)(b,{id:crypto.randomUUID(),text:d.text.trim(),seq:c})})});return{text:o.text.trim(),did:o.steps.flatMap(a=>a.toolCalls.map(a=>(0,t.toolLine)(a.toolName,JSON.stringify(a.input??{}))??a.toolName)),messages:[...i,...o.response.messages]}}[h,i,k,l,o,r]=u.then?(await u)():u,e.z.object({callId:e.z.string().min(1),settings:g.LiveSettingsSchema,standing:e.z.string().nullish(),runsOn:j.textModelRefSchema.nullish(),messages:e.z.array(e.z.unknown()).min(1)});let A=a=>a?[{role:"system",content:a}]:[];async function z(a,b,c){let d=await w(b,c),e="openai"===d.provider||"chatgpt"===d.provider,[f,j,k,q,r]=await Promise.all([(0,i.getTextModel)(d),(0,l.loadThursdayPrompt)(b.backendPrompt,!0),(0,h.loadTools)({target:"thursday",callId:a,webSearch:b.webSearch,written:!0}),(0,o.readConfig)(n.EXA_API_KEY),(0,o.readConfig)(g.LIVE_PROVIDER.apiKeyName)]),s=f.searchTools&&Object.values(f.searchTools)[0],t={...k,...b.webSearch&&!q&&s?{[m.TOOL_NAMES.web_search]:s}:{}},u=e?r?await (0,p.acceptedReasoning)({apiKey:r,model:d.model,effort:b.reasoningEffort}):"none"===b.reasoningEffort?{effort:"none"}:{effort:b.reasoningEffort??void 0,summary:"auto"}:null;return{model:f.model,system:j,tools:t,providerOptions:{openai:{...u?.effort?{reasoningEffort:u.effort}:{},...u&&"summary"in u&&u.summary?{reasoningSummary:u.summary}:{}}}}}let B="Writing to Thursday needs a GPT subscription sign-in or an OpenAI key — Settings › API keys.";a.s(["answerInWriting",0,y,"openTextCall",0,x]),c()}catch(a){c(a)}},!1),69721,a=>{"use strict";var b=a.i(53112),c=a.i(569572),d=a.i(176668),e=a.i(293480),f=a.i(746609);let g=b.z.object({session:b.z.object({id:b.z.string().min(1)}),transport:b.z.object({type:b.z.literal("webrtc"),sdp:b.z.string().min(1)})}),h=new Map;async function i(a){let{apiKey:b,model:e,effort:f}=a,g=`${e} ${f??"auto"}`,i=h.get(g);if(void 0!==i)return i;let j="none"===f?{effort:f}:{...f?{effort:f}:{},summary:"auto"};for(;;){let a=await fetch("https://api.openai.com/v1/responses/input_tokens",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(c.LIVE_CALL.reasoningCheckMs),body:JSON.stringify({model:e,input:".",reasoning:j})}).catch(()=>null);if(!a)return j;let f=Object.keys(j).length?j:null;if(a.ok)return h.set(g,f),f;let i=await a.json().catch(()=>null),k=i?.error?.param?.replace(/^reasoning\./,"");if("effort"!==k&&"summary"!==k||!(k in j))return j;if(d.logger.warn(`${e} takes no reasoning ${k}; calls omit it`),delete j[k],!Object.keys(j).length)return h.set(g,null),null}}async function j(a){let b=await fetch("https://api.openai.com/v1/models",{headers:{Authorization:`Bearer ${a}`},signal:AbortSignal.timeout(c.LIVE_CALL.keyCheckMs)}).catch(()=>null);if(!b||401!==b.status&&403!==b.status)return null;let d=await b.json().catch(()=>null);return d?.error?.message?.trim()||`It answered ${b.status}.`}async function k(a){let b,h=await fetch("https://api.openai.com/v1/live/sessions",{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},signal:AbortSignal.timeout(c.LIVE_CALL.startupMs),body:JSON.stringify({session:{model:f.LIVE_MODEL,instructions:a.instructions,audio:{output:{voice:a.voice}},store:!1,delegation:{type:"responses",responses:{model:a.backend.model,instructions:a.backend.instructions,tools:[...a.backend.tools.map(a=>({type:"function",...a})),...a.backend.hosted.map(a=>f.LIVE_HOSTED_TOOLS[a].declare)],tool_choice:"auto",parallel_tool_calls:!0,max_output_tokens:c.LIVE_CALL.backendOutputTokens,...a.backend.reasoning?{reasoning:a.backend.reasoning}:{}}}},transport:{type:"webrtc",sdp:a.sdp}})}).catch(a=>{d.logger.warn("OpenAI Live unreachable",a),(0,e.publicError)("Could not reach OpenAI Live.")}),i=await h.text();try{b=JSON.parse(i)}catch{b=null}if(!h.ok){let a=b;(0,e.publicError)(a?.error?.message||i||`OpenAI Live refused the call (${h.status}).`)}let j=g.safeParse(b);return j.success||(0,e.publicError)("OpenAI Live returned an invalid session connection."),j.data}a.s(["acceptedReasoning",0,i,"createLiveCall",0,k,"keyRefusal",0,j])}];
|
|
67
67
|
|
|
68
68
|
//# sourceMappingURL=_12mijol._.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports=[203469,a=>{"use strict";let b,c,d,e,f,g;var h,i=a.i(569572),j=a.i(176668);let k={threads:!0,routines:!0,memory:!0,mcp:!0,config:!0,reach:!0,signins:!0},l=globalThis,m=l.__appEvents??=(b=new Set,{emit(a){for(let c of[...b])try{c(a)}catch(a){console.error("event listener failed",a)}},subscribe:a=>(b.add(a),()=>{b.delete(a)})}),n=l.__presence??=(h=i.BROWSER_GONE_MS,c=!1,d=null,e=new Set,f=new Set,g=a=>{for(let b of[...a])try{b()}catch(a){console.error("presence listener failed",a)}},{get watching(){return c},track(a){if(a>0){d&&clearTimeout(d),d=null,c||(c=!0,g(f));return}!d&&c&&(d=setTimeout(()=>{d=null,c=!1,g(e)},h))},onGone:a=>(e.add(a),()=>e.delete(a)),onBack:a=>(f.add(a),()=>f.delete(a))});l.__appEventStream??=function(a,b={}){let c=new TextEncoder,d=b.heartbeatMs??2e4,e=0;return{respond:(f,g)=>{let h=()=>{};return new Response(new ReadableStream({async start(i){let k=!1,l=new Map,m=[],n=a=>{if(!k)try{i.enqueue(c.encode(a))}catch{h()}},o=a=>n(`data: ${JSON.stringify(a)}
|
|
2
2
|
|
|
3
|
-
`),p=a=>{let c=b.coalesce?.keyOf(a)??null;if(null===c)return o(a);let d=l.get(c);d&&clearTimeout(d),l.set(c,setTimeout(()=>{l.delete(c),o(a)},b.coalesce?.ms))},q=a.subscribe(a=>m?m.push(a):p(a)),r=setInterval(()=>n(": ping\n\n"),d);e+=1,b.onWatchers?.(e),h=()=>{if(!k){for(let a of(k=!0,e-=1,b.onWatchers?.(e),q(),clearInterval(r),l.values()))clearTimeout(a);try{i.close()}catch{}}},f.addEventListener("abort",h);try{for(let a of await g?.()??[])o(a)}catch(a){j.logger.error("event stream opening failed",a),h();return}let s=m;for(let a of(m=null,s))p(a)},cancel(){h()}}),{headers:{"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-store","X-Accel-Buffering":"no"}})},get watchers(){return e}}}(m,{coalesce:{ms:150,keyOf:a=>a.type in k?a.type:null},onWatchers:n.track}),l.__bootId??=crypto.randomUUID(),a.s(["appEvents",0,m,"presence",0,n],203469)},762008,a=>{"use strict";a.s(["STUDIO_TOOLS",0,{generate_image:"generate_image",generate_speech:"generate_speech",transcribe:"transcribe",generate_video:"generate_video"},"TOOL_NAMES",0,{memory_recall:"memory_recall",memory_remember:"memory_remember",memory_forget:"memory_forget",memory_conversation:"memory_conversation",bash:"bash",write_file:"write_file",tool_search:"tool_search",tool_call:"tool_call",load_skill:"load_skill",web_search:"web_search",thread_start:"thread_start",thread_tell:"thread_tell",thread_answer:"thread_answer",thread_status:"thread_status",thread_cancel:"thread_cancel",thread_show:"thread_show",thread_seen:"thread_seen",routine:"routine",send_message:"send_message",thread_recall:"thread_recall",sign_in_use:"sign_in_use",sign_in_keep:"sign_in_keep",look_at:"look_at",end_call:"end_call",emote:"emote"}])},569549,a=>a.a(async(b,c)=>{try{var d=a.i(93321),e=a.i(530385),f=a.i(351674);a.i(569572);var g=a.i(184838),h=a.i(714428),i=a.i(344853),j=a.i(725466),k=a.i(3894),l=b([g,i,j]);async function m(){return(0,k.isSkillsOn)(await (0,j.readConfig)(k.THURSDAY_KEYS.skills))}async function n(a){await (0,j.writeConfig)(k.THURSDAY_KEYS.skills,a?"on":"off")}async function o(a){let[b]=await g.database.insert(h.callTable).values({id:crypto.randomUUID(),...a}).returning({id:h.callTable.id});return b.id}async function p(a,b){return(await g.database.update(h.callTable).set({endedAt:new Date,...b?{endedReason:b.reason,seconds:b.seconds??null}:{}}).where((0,d.and)((0,d.eq)(h.callTable.id,a),(0,d.isNull)(h.callTable.endedAt))).returning({id:h.callTable.id})).length>0}async function q(a,b){for(let c of b)await g.database.insert(h.callMessageTable).values({callId:a,...c,fragments:c.fragments??null}).onConflictDoUpdate({target:[h.callMessageTable.callId,h.callMessageTable.id],set:{text:c.text,role:c.role,tool:c.tool??null,fragments:c.fragments??null}})}async function r(a){let[b]=await g.database.select({seq:f.sql`max(${h.callMessageTable.seq})`}).from(h.callMessageTable).where((0,d.eq)(h.callMessageTable.callId,a));return b?.seq==null?0:Number(b.seq)+1}async function s(a,b){await g.database.insert(h.callThoughtTable).values({callId:a,...b}).onConflictDoNothing()}async function t(a){let b=await g.database.select({callId:h.callMessageTable.callId,startedAt:h.callTable.startedAt,role:h.callMessageTable.role,tool:h.callMessageTable.tool,text:h.callMessageTable.text,seq:h.callMessageTable.seq}).from(h.callMessageTable).innerJoin(h.callTable,(0,d.eq)(h.callMessageTable.callId,h.callTable.id)).orderBy((0,e.desc)(h.callTable.startedAt),(0,e.desc)(h.callMessageTable.seq)).limit(a),c=new Map;for(let a of b){let b=c.get(a.callId)??{callId:a.callId,startedAt:a.startedAt,turns:[]};b.turns.push({role:a.role,tool:a.tool,text:a.text,seq:a.seq}),c.set(a.callId,b)}return[...c.values()].reverse().map(a=>({...a,turns:a.turns.reverse()}))}async function u(a,b,c){let[i]=await g.database.select({startedAt:h.callTable.startedAt}).from(h.callTable).where((0,d.eq)(h.callTable.id,a));if(!i)return null;let[j]=await g.database.select({total:f.sql`count(*)`}).from(h.callMessageTable).where((0,d.eq)(h.callMessageTable.callId,a)),k=await g.database.select({role:h.callMessageTable.role,tool:h.callMessageTable.tool,text:h.callMessageTable.text}).from(h.callMessageTable).where((0,d.eq)(h.callMessageTable.callId,a)).orderBy((0,e.asc)(h.callMessageTable.seq)).limit(c).offset((b-1)*c);return{startedAt:i.startedAt,total:Number(j?.total??0),turns:k}}async function v(){let a=(0,d.inArray)(h.callMessageTable.role,["user","assistant"]),[b]=await g.database.select({id:h.callTable.id,startedAt:h.callTable.startedAt,model:h.callTable.model}).from(h.callTable).innerJoin(h.callMessageTable,(0,d.eq)(h.callMessageTable.callId,h.callTable.id)).where((0,d.and)((0,d.isNotNull)(h.callTable.endedAt),a)).groupBy(h.callTable.id).orderBy((0,e.desc)(h.callTable.startedAt)).limit(1);if(!b)return null;let c=await g.database.select({role:h.callMessageTable.role,text:h.callMessageTable.text,at:h.callMessageTable.at}).from(h.callMessageTable).where((0,d.and)((0,d.eq)(h.callMessageTable.callId,b.id),a)).orderBy((0,e.desc)(h.callMessageTable.seq)).limit(4),f=c.reverse().flatMap(a=>"tool"!==a.role&&a.text.trim()?[{role:a.role,text:a.text}]:[]);return f.length?{startedAt:b.startedAt,until:c[0]?.at??b.startedAt,model:b.model,turns:f}:null}async function w(){return(await g.database.select({id:h.callTable.id}).from(h.callTable).limit(1)).length>0}async function x(){return(await g.database.select({id:h.callTable.id}).from(h.callTable).where((0,d.isNull)(h.callTable.endedAt)).limit(1)).length>0}async function y(a){return(await g.database.select({id:h.callTable.id}).from(h.callTable).where((0,d.and)((0,d.eq)(h.callTable.id,a),(0,d.isNull)(h.callTable.endedAt))).limit(1)).length>0}async function z(a){return(await g.database.delete(h.callTable).where((0,d.and)((0,d.eq)(h.callTable.id,a),(0,d.isNotNull)(h.callTable.endedAt))).returning({id:h.callTable.id})).length>0}async function A(){return(await g.database.delete(h.callTable).where((0,d.isNotNull)(h.callTable.endedAt)).returning({id:h.callTable.id})).length}[g,i,j]=l.then?(await l)():l,a.s(["deleteCall",0,z,"deleteEndedCalls",0,A,"endCall",0,p,"findLastCall",0,v,"hasAnyCall",0,w,"insertCall",0,o,"isAnyCallLive",0,x,"isCallOpen",0,y,"listRecentTurns",0,t,"nextTurnSeq",0,r,"readCallConversation",0,u,"readCallSkillsOn",0,m,"saveThought",0,s,"saveTurns",0,q,"writeCallSkillsOn",0,n]),c()}catch(a){c(a)}},!1),3894,a=>{"use strict";var b=a.i(723885),c=a.i(569572),d=a.i(
|
|
3
|
+
`),p=a=>{let c=b.coalesce?.keyOf(a)??null;if(null===c)return o(a);let d=l.get(c);d&&clearTimeout(d),l.set(c,setTimeout(()=>{l.delete(c),o(a)},b.coalesce?.ms))},q=a.subscribe(a=>m?m.push(a):p(a)),r=setInterval(()=>n(": ping\n\n"),d);e+=1,b.onWatchers?.(e),h=()=>{if(!k){for(let a of(k=!0,e-=1,b.onWatchers?.(e),q(),clearInterval(r),l.values()))clearTimeout(a);try{i.close()}catch{}}},f.addEventListener("abort",h);try{for(let a of await g?.()??[])o(a)}catch(a){j.logger.error("event stream opening failed",a),h();return}let s=m;for(let a of(m=null,s))p(a)},cancel(){h()}}),{headers:{"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-store","X-Accel-Buffering":"no"}})},get watchers(){return e}}}(m,{coalesce:{ms:150,keyOf:a=>a.type in k?a.type:null},onWatchers:n.track}),l.__bootId??=crypto.randomUUID(),a.s(["appEvents",0,m,"presence",0,n],203469)},762008,a=>{"use strict";a.s(["STUDIO_TOOLS",0,{generate_image:"generate_image",generate_speech:"generate_speech",transcribe:"transcribe",generate_video:"generate_video"},"TOOL_NAMES",0,{memory_recall:"memory_recall",memory_remember:"memory_remember",memory_forget:"memory_forget",memory_conversation:"memory_conversation",bash:"bash",write_file:"write_file",tool_search:"tool_search",tool_call:"tool_call",load_skill:"load_skill",web_search:"web_search",thread_start:"thread_start",thread_tell:"thread_tell",thread_answer:"thread_answer",thread_status:"thread_status",thread_cancel:"thread_cancel",thread_show:"thread_show",thread_seen:"thread_seen",routine:"routine",send_message:"send_message",thread_recall:"thread_recall",sign_in_use:"sign_in_use",sign_in_keep:"sign_in_keep",look_at:"look_at",end_call:"end_call",emote:"emote"}])},569549,a=>a.a(async(b,c)=>{try{var d=a.i(93321),e=a.i(530385),f=a.i(351674);a.i(569572);var g=a.i(184838),h=a.i(714428),i=a.i(344853),j=a.i(725466),k=a.i(3894),l=b([g,i,j]);async function m(){return(0,k.isSkillsOn)(await (0,j.readConfig)(k.THURSDAY_KEYS.skills))}async function n(a){await (0,j.writeConfig)(k.THURSDAY_KEYS.skills,a?"on":"off")}async function o(a){let[b]=await g.database.insert(h.callTable).values({id:crypto.randomUUID(),...a}).returning({id:h.callTable.id});return b.id}async function p(a,b){return(await g.database.update(h.callTable).set({endedAt:new Date,...b?{endedReason:b.reason,seconds:b.seconds??null}:{}}).where((0,d.and)((0,d.eq)(h.callTable.id,a),(0,d.isNull)(h.callTable.endedAt))).returning({id:h.callTable.id})).length>0}async function q(a,b){for(let c of b)await g.database.insert(h.callMessageTable).values({callId:a,...c,fragments:c.fragments??null}).onConflictDoUpdate({target:[h.callMessageTable.callId,h.callMessageTable.id],set:{text:c.text,role:c.role,tool:c.tool??null,fragments:c.fragments??null}})}async function r(a){let[b]=await g.database.select({seq:f.sql`max(${h.callMessageTable.seq})`}).from(h.callMessageTable).where((0,d.eq)(h.callMessageTable.callId,a));return b?.seq==null?0:Number(b.seq)+1}async function s(a,b){await g.database.insert(h.callThoughtTable).values({callId:a,...b}).onConflictDoNothing()}async function t(a){let b=await g.database.select({callId:h.callMessageTable.callId,startedAt:h.callTable.startedAt,role:h.callMessageTable.role,tool:h.callMessageTable.tool,text:h.callMessageTable.text,seq:h.callMessageTable.seq}).from(h.callMessageTable).innerJoin(h.callTable,(0,d.eq)(h.callMessageTable.callId,h.callTable.id)).orderBy((0,e.desc)(h.callTable.startedAt),(0,e.desc)(h.callMessageTable.seq)).limit(a),c=new Map;for(let a of b){let b=c.get(a.callId)??{callId:a.callId,startedAt:a.startedAt,turns:[]};b.turns.push({role:a.role,tool:a.tool,text:a.text,seq:a.seq}),c.set(a.callId,b)}return[...c.values()].reverse().map(a=>({...a,turns:a.turns.reverse()}))}async function u(a,b,c){let[i]=await g.database.select({startedAt:h.callTable.startedAt}).from(h.callTable).where((0,d.eq)(h.callTable.id,a));if(!i)return null;let[j]=await g.database.select({total:f.sql`count(*)`}).from(h.callMessageTable).where((0,d.eq)(h.callMessageTable.callId,a)),k=await g.database.select({role:h.callMessageTable.role,tool:h.callMessageTable.tool,text:h.callMessageTable.text}).from(h.callMessageTable).where((0,d.eq)(h.callMessageTable.callId,a)).orderBy((0,e.asc)(h.callMessageTable.seq)).limit(c).offset((b-1)*c);return{startedAt:i.startedAt,total:Number(j?.total??0),turns:k}}async function v(){let a=(0,d.inArray)(h.callMessageTable.role,["user","assistant"]),[b]=await g.database.select({id:h.callTable.id,startedAt:h.callTable.startedAt,model:h.callTable.model}).from(h.callTable).innerJoin(h.callMessageTable,(0,d.eq)(h.callMessageTable.callId,h.callTable.id)).where((0,d.and)((0,d.isNotNull)(h.callTable.endedAt),a)).groupBy(h.callTable.id).orderBy((0,e.desc)(h.callTable.startedAt)).limit(1);if(!b)return null;let c=await g.database.select({role:h.callMessageTable.role,text:h.callMessageTable.text,at:h.callMessageTable.at}).from(h.callMessageTable).where((0,d.and)((0,d.eq)(h.callMessageTable.callId,b.id),a)).orderBy((0,e.desc)(h.callMessageTable.seq)).limit(4),f=c.reverse().flatMap(a=>"tool"!==a.role&&a.text.trim()?[{role:a.role,text:a.text}]:[]);return f.length?{startedAt:b.startedAt,until:c[0]?.at??b.startedAt,model:b.model,turns:f}:null}async function w(){return(await g.database.select({id:h.callTable.id}).from(h.callTable).limit(1)).length>0}async function x(){return(await g.database.select({id:h.callTable.id}).from(h.callTable).where((0,d.isNull)(h.callTable.endedAt)).limit(1)).length>0}async function y(a){return(await g.database.select({id:h.callTable.id}).from(h.callTable).where((0,d.and)((0,d.eq)(h.callTable.id,a),(0,d.isNull)(h.callTable.endedAt))).limit(1)).length>0}async function z(a){return(await g.database.delete(h.callTable).where((0,d.and)((0,d.eq)(h.callTable.id,a),(0,d.isNotNull)(h.callTable.endedAt))).returning({id:h.callTable.id})).length>0}async function A(){return(await g.database.delete(h.callTable).where((0,d.isNotNull)(h.callTable.endedAt)).returning({id:h.callTable.id})).length}[g,i,j]=l.then?(await l)():l,a.s(["deleteCall",0,z,"deleteEndedCalls",0,A,"endCall",0,p,"findLastCall",0,v,"hasAnyCall",0,w,"insertCall",0,o,"isAnyCallLive",0,x,"isCallOpen",0,y,"listRecentTurns",0,t,"nextTurnSeq",0,r,"readCallConversation",0,u,"readCallSkillsOn",0,m,"saveThought",0,s,"saveTurns",0,q,"writeCallSkillsOn",0,n]),c()}catch(a){c(a)}},!1),3894,a=>{"use strict";var b=a.i(723885),c=a.i(569572),d=a.i(689656),e=a.i(746609);let f=[{id:"chatgpt",...d.TEXT_MODEL_PROVIDERS.chatgpt},{id:"openai",...d.TEXT_MODEL_PROVIDERS.openai}];b.default.object({charset:b.default.enum(["ascii","emoji","emojiOnly"]).default(c.ASCII_FACE.charset),fontSize:b.default.number().min(c.ASCII_FACE.fontSize.min).max(c.ASCII_FACE.fontSize.max).default(c.ASCII_FACE.fontSize.default),density:b.default.number().min(c.ASCII_FACE.density.min).max(c.ASCII_FACE.density.max).default(c.ASCII_FACE.density.default)}).parse({});b.default.object({enabled:b.default.boolean(),phrase:b.default.string().trim().min(3).max(32)}),b.default.object({enabled:b.default.boolean(),combo:b.default.string().trim().min(1).max(64)}),b.default.enum(["off","waiting","any"]),b.default.enum(["center","sides"]);let g=b.default.object({id:b.default.string().min(1),role:b.default.enum(["user","assistant","tool"]),tool:b.default.string().nullish(),text:b.default.string(),seq:b.default.number().int().min(0),fragments:b.default.array(e.LiveFragmentSchema).nullish()}),h=b.default.object({id:b.default.string().min(1),text:b.default.string(),seq:b.default.number().int().min(0)});a.s(["CallThoughtSchema",0,h,"CallTurnSchema",0,g,"TEXT_CALL_PROVIDERS",0,f,"THURSDAY_KEYS",0,{skills:"THURSDAY_SKILLS"},"isSkillsOn",0,a=>a?.trim()==="on","textCallRunsOn",0,a=>f.find(b=>a(b.apiKeyName))?.id??null],3894)}];
|
|
4
4
|
|
|
5
5
|
//# sourceMappingURL=_132qkfz._.js.map
|