thursday-agent 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +5 -5
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +5 -5
- package/.next/server/app/_global-error/page/build-manifest.json +2 -2
- 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/build-manifest.json +2 -2
- 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 +10 -10
- package/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route.js +1 -1
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/route.js +8 -8
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/route.js +8 -8
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/file/route.js +15 -15
- package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/route.js +5 -5
- package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/tool-result/[id]/route.js +6 -6
- package/.next/server/app/api/bot/tool-result/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js +3 -3
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/events/route.js +1 -1
- package/.next/server/app/api/events/route.js.nft.json +1 -1
- package/.next/server/app/api/favicon/[host]/route.js +4 -4
- package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
- package/.next/server/app/api/file/[...path]/route.js +4 -4
- package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/automatic/route.js +5 -5
- package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/catalog/[provider]/route.js +5 -5
- package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/credits/[provider]/route.js +5 -5
- package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/route.js +6 -6
- package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/subscription/route.js +6 -6
- package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/[name]/route.js +5 -5
- package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/oauth/callback/route.js +6 -6
- package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/route.js +5 -5
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/tools/route.js +5 -5
- package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/edit/route.js +15 -15
- package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/route.js +4 -4
- package/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/reach/route.js +18 -18
- package/.next/server/app/api/reach/route.js.nft.json +1 -1
- package/.next/server/app/api/routine/route.js +8 -8
- package/.next/server/app/api/routine/route.js.nft.json +1 -1
- package/.next/server/app/api/running/route.js +2 -2
- package/.next/server/app/api/running/route.js.nft.json +1 -1
- package/.next/server/app/api/signins/route.js +3 -3
- package/.next/server/app/api/signins/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js +6 -6
- package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +6 -6
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/end/route.js +5 -5
- package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/plan/route.js +14 -14
- package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/route.js +6 -6
- package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/settings/route.js +5 -5
- package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/text/route.js +14 -14
- package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/tool-call/route.js +15 -15
- package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
- package/.next/server/app/api/update/route.js +7 -7
- package/.next/server/app/api/update/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/files/route.js +6 -6
- package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/route.js +6 -6
- package/.next/server/app/api/workspace/route.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page/build-manifest.json +2 -2
- package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
- 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 +2 -2
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next/server/app/page/build-manifest.json +2 -2
- package/.next/server/app/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/page/server-reference-manifest.json +184 -184
- package/.next/server/app/page.js +10 -10
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__01jpmcj._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__03bjojd._.js +3 -3
- package/.next/server/chunks/{[root-of-the-server]__0wosonh._.js → [root-of-the-server]__05u-9a3._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1dyse-1._.js → [root-of-the-server]__0_qe8iq._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0d-dfqm._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0jqidnu._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0mmynvy._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0qhf60h._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sea36s._.js +4 -4
- package/.next/server/chunks/[root-of-the-server]__0zezbds._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__12hkdpz._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__14inehv._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__17kdjf6._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__17yv6lg._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0b3_rzi._.js → [root-of-the-server]__1hjb8wf._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1jcu_e9._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1jmr2ed._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1o7z93z._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1onvx8x._.js +2 -2
- package/.next/server/chunks/_0-mqt2w._.js +1 -1
- package/.next/server/chunks/_04s1gb9._.js +30 -27
- package/.next/server/chunks/_06u9yo-._.js +1 -1
- package/.next/server/chunks/_08354bn._.js +33 -30
- package/.next/server/chunks/_083t_nr._.js +1 -1
- package/.next/server/chunks/_0c-s0ei._.js +1 -1
- package/.next/server/chunks/_0gifi_2._.js +2 -2
- package/.next/server/chunks/_0m3sdq8._.js +1 -1
- package/.next/server/chunks/_0pljp-1._.js +1 -1
- package/.next/server/chunks/_0wjia9n._.js +1 -1
- package/.next/server/chunks/_0wyh244._.js +33 -30
- package/.next/server/chunks/_0x2mdif._.js +1 -1
- package/.next/server/chunks/_1-sk_q4._.js +1 -1
- package/.next/server/chunks/_12a_gfz._.js +1 -1
- package/.next/server/chunks/_14-kmob._.js +1 -1
- package/.next/server/chunks/_16zct7w._.js +30 -27
- package/.next/server/chunks/_1823_7a._.js +4 -4
- package/.next/server/chunks/_1f_x75d._.js +1 -1
- package/.next/server/chunks/_1o2r4ja._.js +1 -1
- package/.next/server/chunks/_1q42187._.js +3 -3
- package/.next/server/chunks/_1ufbxe1._.js +1 -1
- package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
- package/.next/server/chunks/features_14kex_m._.js +11 -11
- package/.next/server/chunks/features_bot_08z387_._.js +4 -4
- package/.next/server/chunks/features_memory_0__61kl._.js +1 -1
- package/.next/server/chunks/features_memory_1uqvksn._.js +1 -1
- package/.next/server/chunks/features_workspace_workspace_ts_13h82gv._.js +1 -1
- package/.next/server/chunks/features_workspace_workspace_ts_1iyjroj._.js +3 -3
- package/.next/server/chunks/ssr/{[root-of-the-server]__0x297x3._.js → [root-of-the-server]__03_9u5q._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__0653diy._.js → [root-of-the-server]__04ky8w1._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__1zlzs9j._.js → [root-of-the-server]__0crm8gr._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__02936mh._.js → [root-of-the-server]__0d3n8i_._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__0s8q44q._.js → [root-of-the-server]__0d4o9hs._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0id2dqb._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__1s0etwd._.js → [root-of-the-server]__0q2c15o._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0t_oz3-._.js +6 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__16x99f1._.js → [root-of-the-server]__12r70jm._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0glkz9k._.js → [root-of-the-server]__1fvh0zn._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__1t38-p_._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__1c1xyyb._.js → [root-of-the-server]__1uy0zqr._.js} +2 -2
- package/.next/server/chunks/ssr/_02uubus._.js +3 -0
- package/.next/server/chunks/ssr/_0692i-a._.js +3 -0
- package/.next/server/chunks/ssr/_079xt7h._.js +32 -29
- package/.next/server/chunks/ssr/_07g7ojr._.js +3 -0
- package/.next/server/chunks/ssr/_0ewhz_x._.js +3 -0
- package/.next/server/chunks/ssr/_0f3t9pm._.js +2 -2
- package/.next/server/chunks/ssr/_0gx6qzr._.js +57 -0
- package/.next/server/chunks/ssr/_0pjwmak._.js +6 -0
- package/.next/server/chunks/ssr/_0pnzfq1._.js +1 -1
- package/.next/server/chunks/ssr/_0px9eat._.js +3 -0
- package/.next/server/chunks/ssr/_0r2_l__._.js +3 -0
- package/.next/server/chunks/ssr/{_20_wc-g._.js → _0rcuovx._.js} +2 -2
- package/.next/server/chunks/ssr/_0uwhhcs._.js +3 -0
- package/.next/server/chunks/ssr/{_1wct0tm._.js → _128r03g._.js} +1 -1
- package/.next/server/chunks/ssr/_12c2n7f._.js +3 -0
- package/.next/server/chunks/ssr/{_12_ail7._.js → _14f64h2._.js} +1 -1
- package/.next/server/chunks/ssr/_17fa2ns._.js +162 -0
- package/.next/server/chunks/ssr/_1_px1o-._.js +3 -0
- package/.next/server/chunks/ssr/_1a_w_du._.js +1 -1
- package/.next/server/chunks/ssr/_1e_9qjr._.js +1 -1
- package/.next/server/chunks/ssr/_1f59vze._.js +57 -0
- package/.next/server/chunks/ssr/_1j5ohq5._.js +3 -0
- package/.next/server/chunks/ssr/{_0ingto_._.js → _1kj3d2q._.js} +2 -2
- package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
- package/.next/server/chunks/ssr/_1ocl7u0._.js +3 -0
- package/.next/server/chunks/ssr/_1q9r6u6._.js +3 -0
- package/.next/server/chunks/ssr/{_0fvctar._.js → _1qqusa-._.js} +2 -2
- package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
- package/.next/server/chunks/ssr/_1uok0wt._.js +3 -0
- package/.next/server/chunks/ssr/_1v1pcoh._.js +1 -1
- package/.next/server/chunks/ssr/_1xw9imq._.js +3 -0
- package/.next/server/chunks/ssr/{components_ui_markdown-body_tsx_0h7bkrz._.js → components_ui_markdown-body_tsx_08i96c6._.js} +2 -2
- package/.next/server/chunks/ssr/features_0rrgq_t._.js +1 -1
- package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
- package/.next/server/chunks/ssr/features_bot_0tb4ui-._.js +2 -2
- package/.next/server/chunks/ssr/features_bot_components_01ye2wp._.js +1 -1
- package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +2 -2
- package/.next/server/chunks/ssr/features_bot_components_thread-setting_tsx_0yae7zy._.js +1 -1
- package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +2 -2
- 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 +2 -2
- package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
- package/.next/server/chunks/ssr/features_skills_components_skills-setting_tsx_1wtuuip._.js +1 -1
- package/.next/server/chunks/ssr/features_thursday_components_thursday-setting_tsx_1_6ydrc._.js +1 -1
- package/.next/server/chunks/ssr/{node_modules_193w7l8._.js → node_modules_02djdfa._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1bwlhwa._.js → node_modules_03ybg-h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_01xoz64._.js → node_modules_066eqdg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_20ifwl6._.js → node_modules_09605b3._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1yilsx4._.js → node_modules_0_c17cv._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_080f5gu._.js → node_modules_0a1-9-h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_17c047f._.js → node_modules_0bfpl_c._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1pav8g4._.js → node_modules_0brchjo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0gwiuga._.js → node_modules_0c0pgdi._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_02-zrtu._.js → node_modules_0ep265x._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0kqej10._.js → node_modules_0gzvt6a._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0i18max._.js → node_modules_0h4gjw5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1m2_gxv._.js → node_modules_0iso-he._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0cda8i6._.js → node_modules_0jvqmb4._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_0kzgugm._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_0uvoegq._.js → node_modules_0l8gpkg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_12ajdg8._.js → node_modules_0mlrvds._.js} +2 -2
- package/.next/server/chunks/ssr/node_modules_0nvqvnw._.js +7 -7
- package/.next/server/chunks/ssr/{node_modules_1s3j8gb._.js → node_modules_0ogtyfm._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1_xiwxs._.js → node_modules_0os_-0h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1abjhxx._.js → node_modules_0p05zru._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1o-m6_3._.js → node_modules_0pf8124._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0eqvt2l._.js → node_modules_0pp3v4f._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0rzz90e._.js → node_modules_0r1vv13._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1kum1yu._.js → node_modules_0r9yw6x._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1yw5fq4._.js → node_modules_0rk1a3e._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1es3wjv._.js → node_modules_0sq1pa3._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1-cv1_p._.js → node_modules_0w-pjyz._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0g_yuwn._.js → node_modules_0yoh66_._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1s9agqr._.js → node_modules_10kn3ni._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1yajzrd._.js → node_modules_124ipg-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0svoyrb._.js → node_modules_12_p7d0._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_203yqqb._.js → node_modules_12w12wr._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_17ks351._.js → node_modules_16kmp_v._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_05qs8r_._.js → node_modules_16m_yhd._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_07dc1cr._.js → node_modules_171uvar._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0qsi9t2._.js → node_modules_19pn2ti._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0k9_jdk._.js → node_modules_1_ly5yy._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0o_gq58._.js → node_modules_1_wsn9q._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1u7wlaq._.js → node_modules_1djak6n._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_08cq8i-._.js → node_modules_1e-oxmh._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_15x7int._.js → node_modules_1ed4zep._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1pkpq6d._.js → node_modules_1f2qlxm._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1aw7c9f._.js → node_modules_1fn72fs._.js} +2 -2
- package/.next/server/chunks/ssr/node_modules_1h9p77x._.js +7 -7
- package/.next/server/chunks/ssr/{node_modules_1ucf2fi._.js → node_modules_1hj0rvo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_12pvysk._.js → node_modules_1jvkoqj._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0tq4-57._.js → node_modules_1jzofr8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_08hfp3a._.js → node_modules_1maqy-g._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_071fb26._.js → node_modules_1oox5h1._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0_jxnnn._.js → node_modules_1p56fwh._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_01yukzc._.js → node_modules_1prbr1-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1hrbceb._.js → node_modules_1qfou69._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_11f1w-3._.js → node_modules_1qnosqe._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1kd_hpx._.js → node_modules_1rdpn6v._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_079iwnx._.js → node_modules_1v6m9sp._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1iapzqf._.js → node_modules_1z8ywx9._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1dim95c._.js → node_modules_1zzudo-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1_71wv3._.js → node_modules_2157u1j._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_1c5gb92._.js → node_modules_katex_dist_katex_mjs_12lynt6._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_1ocxq2z._.js → node_modules_katex_dist_katex_mjs_1vjoadq._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1v93o68._.js +1 -1
- package/.next/server/middleware-build-manifest.js +5 -5
- 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 +185 -185
- package/.next/static/chunks/051z85h3ofmif.js +1 -0
- package/.next/static/chunks/05722zc-sohb_.js +4 -0
- package/.next/static/chunks/07jo959manleh.js +1 -0
- package/.next/static/chunks/0_5a18_y41-_4.js +1 -0
- package/.next/static/chunks/0be7dgti95u_2.js +1 -0
- package/.next/static/chunks/0c28x0q2aqsbj.js +1 -0
- package/.next/static/chunks/0o_rabv5are-o.js +2 -0
- package/.next/static/chunks/{0776-hu4_eek7.js → 0wwq57j09skhy.js} +2 -2
- package/.next/static/chunks/0zm3urd75-zw5.js +1 -0
- package/.next/static/chunks/16hfi69t-6a4t.js +2 -0
- package/.next/static/chunks/1g58g8-daiwu5.js +3 -0
- package/.next/static/chunks/1i1u85j-_yb1n.js +15 -0
- package/.next/static/chunks/1kd2sxkkrae8e.js +1 -0
- package/.next/static/chunks/{3xloayc4c096r.js → 1n3a07w81jbc-.js} +1 -1
- package/.next/static/chunks/1nncyxatu7une.js +1 -0
- package/.next/static/chunks/1s5t41jiomssd.css +1 -0
- package/.next/static/chunks/1yl4mlpsw8e7h.js +1 -0
- package/.next/static/chunks/{33qtnlc00c9gq.js → 2gl-fo_rmmmq0.js} +1 -1
- package/.next/static/chunks/2h_sak2oi70qs.js +1 -0
- package/.next/static/chunks/2isg5redeg2bc.js +1 -0
- package/.next/static/chunks/{2fxn-xltgy2un.js → 2of2-kggzp-fk.js} +1 -1
- package/.next/static/chunks/2vmran3sacktz.js +1 -0
- package/.next/static/chunks/2w02v9g8o9-rz.js +1 -0
- package/.next/static/chunks/2wi2pcbjrqm86.js +1 -0
- package/.next/static/chunks/2xk8otp3gnzml.js +1 -0
- package/.next/static/chunks/2ym1hrikoit8p.js +1 -0
- package/.next/static/chunks/34d1f980dv5c6.js +18 -0
- package/.next/static/chunks/34zhr71217o1-.js +2 -0
- package/.next/static/chunks/{0o1r15rfncytn.js → 37r4l2878vybp.js} +1 -1
- package/.next/static/chunks/{2cz5734j90h5b.js → 3a-2z23puvz2z.js} +1 -1
- package/.next/static/chunks/3d55-y263hup9.js +1 -0
- package/.next/static/chunks/3dzrveotr82eu.js +39 -0
- package/.next/static/chunks/3fensfht8pxhl.js +55 -0
- package/.next/static/chunks/3k7fum0yljmyr.js +1 -0
- package/.next/static/chunks/3sawwm4vucnzn.js +1 -0
- package/.next/static/chunks/{0z0-g4k1hnpw2.js → 3u208m--8u1iq.js} +1 -1
- package/.next/static/chunks/{turbopack-1kym6rf88i5i0.js → turbopack-0ekrsq98buh0j.js} +1 -1
- package/README.md +18 -18
- package/bin/background.mjs +60 -32
- package/bin/print.mjs +82 -0
- package/bin/thursday.mjs +44 -13
- package/guide/bots.md +19 -3
- package/guide/calls.md +5 -2
- package/guide/memory.md +2 -1
- package/guide/setup.md +8 -6
- package/guide/trouble.md +4 -0
- package/package.json +11 -5
- package/public/voices/intro/awake-f4e02fad.ogg +0 -0
- package/seed-skills/concierge/travel/scripts/itinerary.mjs +2 -1
- package/server.js +1 -1
- package/skills/artifact/references/document.md +5 -2
- package/skills/artifact/runtime/document/markdown.mjs +14 -1
- package/skills/artifact/runtime/shell/head.html +1 -1
- package/skills/artifact/scripts/document.mjs +9 -3
- package/skills/browser/SKILL.md +17 -13
- package/.next/server/chunks/[root-of-the-server]__0ald4vb._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0srfj96._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1kos36s._.js +0 -6
- package/.next/server/chunks/ssr/_024j8bs._.js +0 -3
- package/.next/server/chunks/ssr/_04jb10a._.js +0 -3
- package/.next/server/chunks/ssr/_059oyhd._.js +0 -3
- package/.next/server/chunks/ssr/_0d0uyl3._.js +0 -3
- package/.next/server/chunks/ssr/_0fk7dbp._.js +0 -88
- package/.next/server/chunks/ssr/_0gfa_rb._.js +0 -3
- package/.next/server/chunks/ssr/_0i7zd74._.js +0 -3
- package/.next/server/chunks/ssr/_0sp2z94._.js +0 -3
- package/.next/server/chunks/ssr/_1avnw03._.js +0 -57
- package/.next/server/chunks/ssr/_1bfrntd._.js +0 -6
- package/.next/server/chunks/ssr/_1cpvfkg._.js +0 -3
- package/.next/server/chunks/ssr/_1cqjpyq._.js +0 -3
- package/.next/server/chunks/ssr/_1khngyc._.js +0 -72
- package/.next/server/chunks/ssr/_1kyjimg._.js +0 -162
- package/.next/server/chunks/ssr/_1sw4r4m._.js +0 -6
- package/.next/server/chunks/ssr/_20004tu._.js +0 -57
- package/.next/server/chunks/ssr/node_modules_01alue6._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_02n9-pb._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_0zxr5sz._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_trash_mjs_0px2gzr._.js +0 -3
- package/.next/static/chunks/02d9vhnz5mwvu.js +0 -1
- package/.next/static/chunks/06ff4fq0z4das.js +0 -1
- package/.next/static/chunks/09q9n7jrkm4c9.js +0 -39
- package/.next/static/chunks/0b3wt5kqs-mk2.js +0 -2
- package/.next/static/chunks/0blrj_tg1yur0.js +0 -1
- package/.next/static/chunks/0dn1ptom1ahgg.js +0 -18
- package/.next/static/chunks/0dq7uppta9s--.js +0 -1
- package/.next/static/chunks/0hoz2b--nhn4y.js +0 -1
- package/.next/static/chunks/0kfjtkez2xze2.js +0 -1
- package/.next/static/chunks/0mv2zywfzt83k.js +0 -4
- package/.next/static/chunks/0txtrhykehsd_.js +0 -55
- package/.next/static/chunks/17vs1vz7_4l4p.css +0 -1
- package/.next/static/chunks/1dnvf_117h4k3.js +0 -2
- package/.next/static/chunks/1irynso77np9t.js +0 -1
- package/.next/static/chunks/1sh_-w_keseat.js +0 -1
- package/.next/static/chunks/1z2_9pl3nezly.js +0 -3
- package/.next/static/chunks/23ty4edkuxirx.js +0 -1
- package/.next/static/chunks/2f1cnfz4h1e2x.js +0 -1
- package/.next/static/chunks/2jepcbdewlwlg.js +0 -1
- package/.next/static/chunks/2r_zq_knm0hph.js +0 -15
- package/.next/static/chunks/2yfmmo4qr_f-m.js +0 -1
- package/.next/static/chunks/3-xnkknav7azp.js +0 -1
- package/.next/static/chunks/38q31td1ecuay.js +0 -1
- package/.next/static/chunks/3n75-7grldc6f.js +0 -1
- package/.next/static/chunks/3ofr4htw4wpj3.js +0 -1
- package/.next/static/chunks/40bkw3zfenss4.js +0 -2
- package/public/voices/intro/awake-17dbafbf.ogg +0 -0
- package/public/voices/intro/models-d09ddc74.ogg +0 -0
- /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_buildManifest.js +0 -0
- /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[857022,a=>{"use strict";var b=a.i(187924),c=a.i(256711),d=a.i(752562),e=a.i(141146),f=a.i(164831);let g={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};g.node;let h=(0,f.default)(g);var i=a.i(403512),j=a.i(951675),k=a.i(474215),l=a.i(572131),m=a.i(767561),n=a.i(340695),o=a.i(316474),p=a.i(205522),q=a.i(446181),r=a.i(950463),s=a.i(621958),t=a.i(546893),u=a.i(287702),v=a.i(379630),w=a.i(61876),x=a.i(275086),y=a.i(172654),z=a.i(327598);let A={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};A.node;let B=(0,f.default)(A);var C=a.i(589027),D=a.i(875160);let E={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};E.node;let F=(0,f.default)(E);var G=a.i(545097),H=a.i(608902),I=a.i(421042),J=a.i(497895);let K=new y.DefaultChatTransport({api:m.queryKey.memoryEdit});function L({notes:a}){let[c,d]=(0,l.useState)(""),[e,f]=(0,l.useState)({provider:null,model:""}),[g,h]=(0,l.useState)(!1),{messages:i,sendMessage:j,setMessages:k,status:m,stop:o,error:p,clearError:q}=(0,x.useChat)({transport:K}),r=(0,l.useRef)(o);r.current=o,(0,l.useEffect)(()=>()=>{r.current()},[]);let s=(0,l.useRef)(new Map);for(let b of a)for(let a of b.facts)s.current.set(a.id,{text:a.text,path:b.path});let t="submitted"===m||"streaming"===m,u=!!(e.provider&&e.model.trim()),w=[...i].reverse().find(a=>"assistant"===a.role),A=w?.parts??[],B=A.filter(y.isToolUIPart),D=A.flatMap(a=>"text"===a.type?[a.text]:[]).join(" ").trim(),E=!!p||B.some(a=>"output-error"===a.state),F=B.filter(a=>"output-available"===a.state&&(0,y.getToolName)(a)!==I.TOOL_NAMES.memory_recall).length;(0,l.useEffect)(()=>{if("ready"!==m||E||0===i.length)return;let a=setTimeout(()=>k([]),4e3);return()=>clearTimeout(a)},[m,E,i.length,k]);let M=(0,l.useRef)("");(0,l.useEffect)(()=>{if(!p||!M.current)return;let a=M.current;M.current="",d(b=>b||a)},[p]);let O=t?(0,b.jsx)(G.ShinyText,{text:"Working on memory",className:"text-xs"}):p?(0,b.jsx)("span",{className:"text-xs text-destructive",children:p.message}):w?(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:D||(0===F?"Nothing to change":1===F?"1 change saved":`${F} changes saved`)}):null;return(0,b.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,b.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[g&&(0,b.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,b.jsx)(H.ModelPicker,{provider:e.provider,model:e.model,unset:"Provider",onChange:f})}),B.length>0&&(0,b.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:B.map(a=>(0,b.jsx)(N,{name:(0,y.getToolName)(a),input:a.input,state:a.state,errorText:"output-error"===a.state?a.errorText:void 0,known:s.current},a.toolCallId))}),O&&(0,b.jsx)("p",{className:"max-w-full truncate px-1",children:O}),(0,b.jsxs)("form",{onSubmit:a=>{a.preventDefault();let b=c.trim();b&&u&&!t&&(M.current=b,d(""),h(!1),q(),k([]),j({text:b},{body:{model:e}}))},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,b.jsx)("input",{autoFocus:!0,value:c,onChange:a=>d(a.target.value),disabled:t,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,b.jsxs)(n.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>h(!g),className:(0,J.cn)("max-w-44",!u&&"text-muted-foreground"),children:[u&&e.provider?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v.ProviderIcon,{provider:e.provider,className:"size-3"}),(0,b.jsx)("span",{className:"truncate",children:e.model})]}):"Model",(0,b.jsx)(C.ChevronDown,{className:"text-muted-foreground"})]}),(0,b.jsx)(n.Button,{type:"submit",size:"icon-sm",loading:t,disabled:!c.trim()||!u||t,"aria-label":"Send",children:!t&&(0,b.jsx)(z.ArrowUp,{})})]})]})})}let M={Remember:i.Plus,Replace:h,Forget:F,Rename:h,Opened:B};function N({name:a,input:c,state:e,errorText:f,known:g}){let h=function(a,b,c){if(a===I.TOOL_NAMES.memory_recall)return{kind:"Opened",path:(b??{}).path??"",lines:[]};if(a===I.TOOL_NAMES.memory_describe){let a=b??{};return{kind:"Rename",path:a.path??"",lines:a.description?[{after:`“${a.description}”`}]:[]}}if(a===I.TOOL_NAMES.memory_forget){let a=((b??{}).factIds??[]).filter(a=>null!=a),d=a.map(a=>c.get(a));return{kind:"Forget",path:d.find(a=>a)?.path??"",lines:a.map((a,b)=>({before:d[b]?.text??`Fact #${a}`}))}}let d=b??{},e=d.path??"",f=(d.facts??[]).filter(a=>null!=a),g=f.map(a=>null!=a.replaces?{before:c.get(a.replaces)?.text??`Fact #${a.replaces}`,after:a.text}:{after:a.text});return a===I.TOOL_NAMES.memory_create&&d.description&&g.unshift({after:`“${d.description}”`}),{kind:f.some(a=>null!=a.replaces)?"Replace":"Remember",path:e,lines:g}}(a,c,g),i=M[h.kind],j="output-error"===e;return(0,b.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,b.jsx)(i,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[h.lines.map((a,c)=>(0,b.jsxs)("div",{children:[a.before&&(0,b.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:a.before}),a.after&&(0,b.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:a.after})]},`${h.kind}-${c}`)),(0,b.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[h.kind,h.path&&` \xb7 ${h.path}`]}),j&&f&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:f})]}),(0,b.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:j?(0,b.jsx)(k.X,{className:"size-3.5 text-destructive"}):"output-available"===e?(0,b.jsx)(d.Check,{className:"size-3.5"}):(0,b.jsx)(D.Loader2,{className:"size-3.5 animate-spin"})})]})}var O=a.i(405050);let P=(0,O.createServerReference)("7f9c280168285e4880784cc3e9f1982ab1a9733af9",O.callServer,void 0,O.findSourceMapURL,"addFactsAction"),Q=(0,O.createServerReference)("7f03661eb937f44ac992df3e335d576961f70812a4",O.callServer,void 0,O.findSourceMapURL,"createNoteAction"),R=(0,O.createServerReference)("7f09ff0a5d8faef57df309f5822112aa275e105e80",O.callServer,void 0,O.findSourceMapURL,"deleteNoteAction"),S=(0,O.createServerReference)("7f05691b3e133912f7fd5888fe58601f1eab2488a0",O.callServer,void 0,O.findSourceMapURL,"forgetFactAction"),T=(0,O.createServerReference)("7f47afb03978b520fbb4d15da6e6adcd76533e9a66",O.callServer,void 0,O.findSourceMapURL,"reviseFactAction"),U=(0,O.createServerReference)("7f4bd35ee0d84a638cffcd5b030d1e4c1eea4606cb",O.callServer,void 0,O.findSourceMapURL,"updateNoteAction");var V=a.i(954714),W=a.i(199169);let X=V.enum(["user","call","bot"]);V.string().trim().min(1,"A note needs a line saying what it is about").max(u.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${u.MEMORY_LIMITS.descriptionChars} characters`);let Y=V.object({id:V.number(),text:V.string(),source:X.nullish(),createdAt:W.DateLikeSchema});V.object({id:V.number(),path:V.string(),description:V.string(),ownedByUser:V.boolean(),hits:V.number(),lastReadAt:W.DateLikeSchema.nullable(),createdAt:W.DateLikeSchema,updatedAt:W.DateLikeSchema,factCount:V.number(),facts:Y.array()});let Z=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],$=Z.filter(a=>!a.path.endsWith("/")).map(a=>a.path),_=Z.filter(a=>a.path.endsWith("/")).map(a=>a.path.slice(0,-1));RegExp(`^(?:${$.join("|")}|(?:${_.join("|")})/.+)$`);var aa=a.i(619477),ab=a.i(332033),ac=a.i(313237),ad=a.i(862966),ae=a.i(759497);let af=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ag={onOk:()=>(0,ae.revalidate)(m.queryKey.memory)},ah=w.textModelProviderSchema.options.filter(a=>"chatgpt"!==a).slice(0,3);function ai(){return(0,b.jsx)("span",{className:"mr-0.5 flex items-center",children:ah.map(a=>(0,b.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,b.jsx)(v.ProviderIcon,{provider:a,className:"size-3"})},a))})}function aj(a,b){return c=>{(0,ab.composing)(c)||("Enter"===c.key&&(c.preventDefault(),a()),"Escape"===c.key&&(c.stopPropagation(),b()))}}function ak({note:a,open:c,onToggle:d}){var f;let g,i,k,m,o,[p,r]=(0,l.useState)(!1),[s,t]=(0,ac.useServerAction)(R,ag),u=async()=>{await q.notify.confirm({title:`Forget ${a.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&s(a.id)},v=(0,b.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(g=(f=a.path).indexOf("/"))?f:f.slice(g+1)});return(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(e.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),v,(0,b.jsx)(al,{note:a,onDone:()=>r(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("button",{type:"button","aria-expanded":c,onClick:d,className:(0,J.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(i=a.path,!$.includes(i)&&.15>(k=(0,W.toDate)(a.lastReadAt??a.createdAt),m=Math.max(0,(Date.now()-k.getTime())/864e5),(a.hits+1)/(1+m))&&!c&&"opacity-55")),children:[(0,b.jsx)(e.ChevronRight,{className:(0,J.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",c&&"rotate-90")}),v,(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:a.description}),(0,b.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground/70",children:[a.factCount," ",1===a.factCount?"fact":"facts"]}),(0,b.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground/50",title:a.lastReadAt?"Last read back":"Never read back",children:a.lastReadAt?(0,W.shortAgo)(a.lastReadAt):"—"})]}),(0,b.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:c&&(0,b.jsxs)(b.Fragment,{children:[(o=a.path,!$.includes(o)&&(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>r(!0),children:(0,b.jsx)(h,{})})),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:t,onClick:u,children:!t&&(0,b.jsx)(j.Trash2,{})})]})})]})}),c&&(0,b.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,b.jsx)(am,{noteId:a.id}),a.facts.map(c=>(0,b.jsx)(an,{noteId:a.id,fact:c},c.id))]})]})}function al({note:a,onDone:c}){let[e,f]=(0,l.useState)(a.description),[g,h]=(0,ac.useServerAction)(U,{onOk:()=>{c(),(0,ae.revalidate)(m.queryKey.memory)}}),i=()=>{let b=e.trim();if(!b||b===a.description)return c();g(a.id,{description:b})};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Input,{autoFocus:!0,value:e,onChange:a=>f(a.target.value),onKeyDown:aj(i,c),"aria-label":"The note's line",placeholder:"One line Thursday sees in her list",maxLength:u.MEMORY_LIMITS.descriptionChars,className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:h,onClick:i,children:!h&&(0,b.jsx)(d.Check,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:c,children:(0,b.jsx)(k.X,{})})]})}function am({noteId:a}){let[c,d]=(0,l.useState)(""),[e,f]=(0,ac.useServerAction)(P,{onOk:()=>{d(""),(0,ae.revalidate)(m.queryKey.memory)}}),g=()=>{let b=c.trim();b&&!f&&e(a,[b])};return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,b.jsx)(p.Input,{value:c,onChange:a=>d(a.target.value),onKeyDown:aj(g,()=>d("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,b.jsxs)(n.Button,{size:"sm",variant:"outline",loading:f,disabled:!c.trim(),onClick:g,children:[!f&&(0,b.jsx)(i.Plus,{}),"Add"]})]})}function an({noteId:a,fact:e}){let f,[g,i]=(0,l.useState)(!1),[o,r]=(0,l.useState)(e.text),[s,t]=(0,ac.useServerAction)(T,{onOk:()=>{i(!1),(0,ae.revalidate)(m.queryKey.memory)}}),[u,v]=(0,ac.useServerAction)(S,ag),w=async()=>{await q.notify.confirm({title:"Forget this fact?",description:`"${e.text}" is deleted for good.`,okText:"Delete",destructive:!0})&&u(a,e.id)},x=()=>{let b=o.trim();if(!b||b===e.text)return i(!1);s(a,e.id,b)},y="user"===(f=e.source)?"you":"call"===f?"on a call":"bot"===f?"a bot":"";return(0,b.jsx)("div",{className:"flex min-h-10 items-center gap-1.5",children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Input,{autoFocus:!0,value:o,onChange:a=>r(a.target.value),onKeyDown:aj(x,()=>i(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:t,onClick:x,children:!t&&(0,b.jsx)(d.Check,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>i(!1),children:(0,b.jsx)(k.X,{})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:e.text}),(0,b.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground/50",children:[(0,c.format)(e.createdAt,"yyyy.MM.dd"),y&&` \xb7 ${y}`]}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{r(e.text),i(!0)},children:(0,b.jsx)(h,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:v,onClick:()=>void w(),children:!v&&(0,b.jsx)(j.Trash2,{})})]})})}let ao=[{key:"people",label:"Person",placeholder:"alex",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ap(){return q.notify.component({className:"sm:max-w-lg",renderer:({close:a})=>(0,b.jsx)(aq,{onDone:a})})}function aq({onDone:a}){let[c,d]=(0,l.useState)("people"),[e,f]=(0,l.useState)(""),[g,h]=(0,l.useState)(""),[j,k]=(0,l.useState)(""),[q,r,,v]=(0,ac.useServerAction)(Q,{errorMessage:!1,onOk:()=>{(0,ae.revalidate)(m.queryKey.memory),a()}}),w=ao.find(a=>a.key===c),x=e.trim()&&g.trim()&&!r,y=()=>{x&&q(`${c}/${e.trim()}`,g.trim(),j.split("\n").map(a=>a.trim()).filter(Boolean))};return(0,b.jsxs)(aa.SettingDialogContent,{title:"New note",description:"Where Thursday keeps what she learns about this.",footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{variant:"ghost",onClick:a,children:"Cancel"}),(0,b.jsxs)(n.Button,{disabled:!x,loading:r,onClick:y,children:[!r&&(0,b.jsx)(i.Plus,{}),"Create"]})]}),children:[(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{children:"Kind"}),(0,b.jsx)(s.Tabs,{value:c,onValueChange:a=>d(a),children:(0,b.jsx)(s.TabsList,{className:"w-full",children:ao.map(a=>(0,b.jsx)(s.TabsTrigger,{value:a.key,children:a.label},a.key))})})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,b.jsxs)(o.FieldContent,{children:[(0,b.jsx)(p.Input,{id:"note-name",value:e,onChange:a=>f(a.target.value),placeholder:w?.placeholder,spellCheck:!1,required:!0}),(0,b.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[c,"/",e.trim()||"…"]})]})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,b.jsx)(o.FieldContent,{children:(0,b.jsx)(p.Input,{id:"note-summary",value:g,onChange:a=>h(a.target.value),onKeyDown:a=>{a.nativeEvent.isComposing||229===a.keyCode||"Enter"===a.key&&y()},placeholder:"One line Thursday sees in her list",maxLength:u.MEMORY_LIMITS.descriptionChars,required:!0})})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,b.jsx)(t.Textarea,{id:"note-facts",value:j,onChange:a=>k(a.target.value),placeholder:`One per line
|
|
2
|
-
${w?.fact??""}`,className:"min-h-24 resize-none text-sm"})]})]}),v&&(0,b.jsx)("p",{className:"font-mono text-xs text-destructive",children:v})]})}a.s(["MemorySetting",0,function(){let{items:a,isLoading:c,isLoadingMore:d,error:e,hasMore:f,sentinelRef:g}=(0,ad.useServerPages)({key:a=>m.queryKey.memoryPage(a*u.PAGE_SIZE)}),[h,j]=(0,l.useState)(""),[k,o]=(0,l.useState)(new Set),[p,q]=(0,l.useState)(!1);if(c)return(0,b.jsx)(aa.SettingSkeleton,{});if(e)return(0,b.jsx)(aa.SettingError,{message:e.message});let s=h.trim().toLowerCase(),t=s?a.filter(a=>[a.path,a.description,...a.facts.map(a=>a.text)].some(a=>a.toLowerCase().includes(s))):a,v=a.reduce((a,b)=>a+b.factCount,0),w=f?"+":"";return(0,b.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,b.jsxs)(aa.SettingScreen,{footer:(0,b.jsxs)(n.Button,{size:"sm",variant:p?"secondary":"ghost","aria-pressed":p,onClick:()=>q(!p),children:[(0,b.jsx)(ai,{}),"Edit with a model"]}),children:[(0,b.jsx)(aa.SettingToolbar,{count:(0,b.jsxs)("span",{className:"flex items-center gap-3",children:[`${a.length}${w} notes \xb7 ${v}${w} facts`,(0,b.jsxs)(n.Button,{size:"sm",variant:"outline",className:"font-sans",onClick:ap,children:[(0,b.jsx)(i.Plus,{}),"New note"]})]}),children:(0,b.jsx)(aa.SettingFilter,{value:h,onChange:j,placeholder:"Filter memory"})}),s&&0===t.length&&(0,b.jsx)("p",{className:"px-1 text-xs text-muted-foreground
|
|
1
|
+
module.exports=[857022,a=>{"use strict";var b=a.i(187924),c=a.i(256711),d=a.i(752562),e=a.i(141146),f=a.i(164831);let g={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};g.node;let h=(0,f.default)(g);var i=a.i(403512),j=a.i(951675),k=a.i(474215),l=a.i(572131),m=a.i(767561),n=a.i(340695),o=a.i(316474),p=a.i(205522),q=a.i(446181),r=a.i(950463),s=a.i(621958),t=a.i(546893),u=a.i(287702),v=a.i(379630),w=a.i(61876),x=a.i(275086),y=a.i(172654),z=a.i(327598);let A={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};A.node;let B=(0,f.default)(A);var C=a.i(589027),D=a.i(875160);let E={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};E.node;let F=(0,f.default)(E);var G=a.i(545097),H=a.i(608902),I=a.i(421042),J=a.i(497895);let K=new y.DefaultChatTransport({api:m.queryKey.memoryEdit});function L({notes:a}){let[c,d]=(0,l.useState)(""),[e,f]=(0,l.useState)({provider:null,model:""}),[g,h]=(0,l.useState)(!1),{messages:i,sendMessage:j,setMessages:k,status:m,stop:o,error:p,clearError:q}=(0,x.useChat)({transport:K}),r=(0,l.useRef)(o);r.current=o,(0,l.useEffect)(()=>()=>{r.current()},[]);let s=(0,l.useRef)(new Map);for(let b of a)for(let a of b.facts)s.current.set(a.id,{text:a.text,path:b.path});let t="submitted"===m||"streaming"===m,u=!!(e.provider&&e.model.trim()),w=[...i].reverse().find(a=>"assistant"===a.role),A=w?.parts??[],B=A.filter(y.isToolUIPart),D=A.flatMap(a=>"text"===a.type?[a.text]:[]).join(" ").trim(),E=!!p||B.some(a=>"output-error"===a.state),F=B.filter(a=>"output-available"===a.state&&(0,y.getToolName)(a)!==I.TOOL_NAMES.memory_recall).length;(0,l.useEffect)(()=>{if("ready"!==m||E||0===i.length)return;let a=setTimeout(()=>k([]),4e3);return()=>clearTimeout(a)},[m,E,i.length,k]);let M=(0,l.useRef)("");(0,l.useEffect)(()=>{if(!p||!M.current)return;let a=M.current;M.current="",d(b=>b||a)},[p]);let O=t?(0,b.jsx)(G.ShinyText,{text:"Working on memory",className:"text-xs"}):p?(0,b.jsx)("span",{className:"text-xs text-destructive",children:p.message}):w?(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:D||(0===F?"Nothing to change":1===F?"1 change saved":`${F} changes saved`)}):!c.trim()||u||g?null:(0,b.jsx)("button",{type:"button",onClick:()=>h(!0),className:"rounded-sm text-xs text-muted-foreground underline-offset-3 outline-none hover:text-foreground hover:underline focus-visible:ring-3 focus-visible:ring-ring/50",children:"Pick a model to edit with"});return(0,b.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,b.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[g&&(0,b.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,b.jsx)(H.ModelPicker,{provider:e.provider,model:e.model,unset:"Provider",onChange:f})}),B.length>0&&(0,b.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:B.map(a=>(0,b.jsx)(N,{name:(0,y.getToolName)(a),input:a.input,state:a.state,errorText:"output-error"===a.state?a.errorText:void 0,known:s.current},a.toolCallId))}),O&&(0,b.jsx)("p",{className:"max-w-full truncate px-1",children:O}),(0,b.jsxs)("form",{onSubmit:a=>{a.preventDefault();let b=c.trim();if(b&&!t){if(!u)return void h(!0);M.current=b,d(""),h(!1),q(),k([]),j({text:b},{body:{model:e}})}},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,b.jsx)("input",{autoFocus:!0,value:c,onChange:a=>d(a.target.value),disabled:t,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,b.jsxs)(n.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>h(!g),className:(0,J.cn)("max-w-44",!u&&"text-muted-foreground"),children:[u&&e.provider?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v.ProviderIcon,{provider:e.provider,className:"size-3"}),(0,b.jsx)("span",{className:"truncate",children:e.model})]}):"Model",(0,b.jsx)(C.ChevronDown,{className:"text-muted-foreground"})]}),(0,b.jsx)(n.Button,{type:"submit",size:"icon-sm",loading:t,disabled:!c.trim()||t,"aria-label":"Send",children:!t&&(0,b.jsx)(z.ArrowUp,{})})]})]})})}let M={Remember:i.Plus,Replace:h,Forget:F,Rename:h,Opened:B};function N({name:a,input:c,state:e,errorText:f,known:g}){let h=function(a,b,c){if(a===I.TOOL_NAMES.memory_recall)return{kind:"Opened",path:(b??{}).path??"",lines:[]};if(a===I.TOOL_NAMES.memory_describe){let a=b??{};return{kind:"Rename",path:a.path??"",lines:a.description?[{after:`“${a.description}”`}]:[]}}if(a===I.TOOL_NAMES.memory_forget){let a=((b??{}).factIds??[]).filter(a=>null!=a),d=a.map(a=>c.get(a));return{kind:"Forget",path:d.find(a=>a)?.path??"",lines:a.map((a,b)=>({before:d[b]?.text??`Fact #${a}`}))}}let d=b??{},e=d.path??"",f=(d.facts??[]).filter(a=>null!=a),g=f.map(a=>null!=a.replaces?{before:c.get(a.replaces)?.text??`Fact #${a.replaces}`,after:a.text}:{after:a.text});return a===I.TOOL_NAMES.memory_create&&d.description&&g.unshift({after:`“${d.description}”`}),{kind:f.some(a=>null!=a.replaces)?"Replace":"Remember",path:e,lines:g}}(a,c,g),i=M[h.kind],j="output-error"===e;return(0,b.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,b.jsx)(i,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[h.lines.map((a,c)=>(0,b.jsxs)("div",{children:[a.before&&(0,b.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:a.before}),a.after&&(0,b.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:a.after})]},`${h.kind}-${c}`)),(0,b.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[h.kind,h.path&&` \xb7 ${h.path}`]}),j&&f&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:f})]}),(0,b.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:j?(0,b.jsx)(k.X,{className:"size-3.5 text-destructive"}):"output-available"===e?(0,b.jsx)(d.Check,{className:"size-3.5"}):(0,b.jsx)(D.Loader2,{className:"size-3.5 animate-spin"})})]})}var O=a.i(405050);let P=(0,O.createServerReference)("7f778d1e1d9d5fe4a0bfefcb5829024f1c37eb17c3",O.callServer,void 0,O.findSourceMapURL,"addFactsAction"),Q=(0,O.createServerReference)("7ffa8a2dd6092d5634c0afd449a8770a0a4ac295be",O.callServer,void 0,O.findSourceMapURL,"createNoteAction"),R=(0,O.createServerReference)("7f1181e8e9af091ebbec97b17c74f875db2a474cde",O.callServer,void 0,O.findSourceMapURL,"deleteNoteAction"),S=(0,O.createServerReference)("7fa441589d5fbf4cd06bbeda5a3228383ad486fc1c",O.callServer,void 0,O.findSourceMapURL,"forgetFactAction"),T=(0,O.createServerReference)("7ff7001819dbde7db5a64168bf3f11708e3f8af5f5",O.callServer,void 0,O.findSourceMapURL,"reviseFactAction"),U=(0,O.createServerReference)("7fb69a0b4423357fde7f88352da64ce6aed542ea08",O.callServer,void 0,O.findSourceMapURL,"updateNoteAction");var V=a.i(954714),W=a.i(199169);let X=V.enum(["user","call","bot"]);V.string().trim().min(1,"A note needs a line saying what it is about").max(u.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${u.MEMORY_LIMITS.descriptionChars} characters`);let Y=V.object({id:V.number(),text:V.string(),source:X.nullish(),createdAt:W.DateLikeSchema});V.object({id:V.number(),path:V.string(),description:V.string(),ownedByUser:V.boolean(),hits:V.number(),lastReadAt:W.DateLikeSchema.nullable(),createdAt:W.DateLikeSchema,updatedAt:W.DateLikeSchema,factCount:V.number(),facts:Y.array()});let Z=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],$=Z.filter(a=>!a.path.endsWith("/")).map(a=>a.path),_=Z.filter(a=>a.path.endsWith("/")).map(a=>a.path.slice(0,-1));RegExp(`^(?:${$.join("|")}|(?:${_.join("|")})/.+)$`);var aa=a.i(619477),ab=a.i(332033),ac=a.i(313237),ad=a.i(862966),ae=a.i(759497);let af=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ag={onOk:()=>(0,ae.revalidate)(m.queryKey.memory)},ah=w.textModelProviderSchema.options.filter(a=>"chatgpt"!==a).slice(0,3);function ai(){return(0,b.jsx)("span",{className:"mr-0.5 flex items-center",children:ah.map(a=>(0,b.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,b.jsx)(v.ProviderIcon,{provider:a,className:"size-3"})},a))})}function aj(a,b){return c=>{(0,ab.composing)(c)||("Enter"===c.key&&(c.preventDefault(),a()),"Escape"===c.key&&(c.stopPropagation(),b()))}}function ak({note:a,open:c,onToggle:d}){var f;let g,i,k,m,o,[p,r]=(0,l.useState)(!1),[s,t]=(0,ac.useServerAction)(R,ag),u=async()=>{await q.notify.confirm({title:`Forget ${a.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&s(a.id)},v=(0,b.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(g=(f=a.path).indexOf("/"))?f:f.slice(g+1)});return(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(e.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),v,(0,b.jsx)(al,{note:a,onDone:()=>r(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("button",{type:"button","aria-expanded":c,onClick:d,className:(0,J.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(i=a.path,!$.includes(i)&&.15>(k=(0,W.toDate)(a.lastReadAt??a.createdAt),m=Math.max(0,(Date.now()-k.getTime())/864e5),(a.hits+1)/(1+m))&&!c&&"opacity-55")),children:[(0,b.jsx)(e.ChevronRight,{className:(0,J.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",c&&"rotate-90")}),v,(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:a.description}),(0,b.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground",children:[a.factCount," ",1===a.factCount?"fact":"facts"]}),(0,b.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground",title:a.lastReadAt?"Last read back":"Never read back",children:a.lastReadAt?(0,W.shortAgo)(a.lastReadAt):"—"})]}),(0,b.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:c&&(0,b.jsxs)(b.Fragment,{children:[(o=a.path,!$.includes(o)&&(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>r(!0),children:(0,b.jsx)(h,{})})),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:t,onClick:u,children:!t&&(0,b.jsx)(j.Trash2,{})})]})})]})}),c&&(0,b.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,b.jsx)(am,{noteId:a.id}),a.facts.map(c=>(0,b.jsx)(an,{noteId:a.id,fact:c},c.id))]})]})}function al({note:a,onDone:c}){let[e,f]=(0,l.useState)(a.description),[g,h]=(0,ac.useServerAction)(U,{onOk:()=>{c(),(0,ae.revalidate)(m.queryKey.memory)}}),i=()=>{let b=e.trim();if(!b||b===a.description)return c();g(a.id,{description:b})};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Input,{autoFocus:!0,value:e,onChange:a=>f(a.target.value),onKeyDown:aj(i,c),"aria-label":"The note's line",placeholder:"One line Thursday sees in her list",maxLength:u.MEMORY_LIMITS.descriptionChars,className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:h,onClick:i,children:!h&&(0,b.jsx)(d.Check,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:c,children:(0,b.jsx)(k.X,{})})]})}function am({noteId:a}){let[c,d]=(0,l.useState)(""),[e,f]=(0,ac.useServerAction)(P,{onOk:()=>{d(""),(0,ae.revalidate)(m.queryKey.memory)}}),g=()=>{let b=c.trim();b&&!f&&e(a,[b])};return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,b.jsx)(p.Input,{value:c,onChange:a=>d(a.target.value),onKeyDown:aj(g,()=>d("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,b.jsxs)(n.Button,{size:"sm",variant:"outline",loading:f,disabled:!c.trim(),onClick:g,children:[!f&&(0,b.jsx)(i.Plus,{}),"Add"]})]})}function an({noteId:a,fact:e}){let f,[g,i]=(0,l.useState)(!1),[o,r]=(0,l.useState)(e.text),[s,t]=(0,ac.useServerAction)(T,{onOk:()=>{i(!1),(0,ae.revalidate)(m.queryKey.memory)}}),[u,v]=(0,ac.useServerAction)(S,ag),w=async()=>{await q.notify.confirm({title:"Forget this fact?",description:`"${e.text}" is deleted for good.`,okText:"Delete",destructive:!0})&&u(a,e.id)},x=()=>{let b=o.trim();if(!b||b===e.text)return i(!1);s(a,e.id,b)},y="user"===(f=e.source)?"you":"call"===f?"on a call":"bot"===f?"a bot":"";return(0,b.jsx)("div",{className:"flex min-h-10 items-center gap-1.5",children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Input,{autoFocus:!0,value:o,onChange:a=>r(a.target.value),onKeyDown:aj(x,()=>i(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:t,onClick:x,children:!t&&(0,b.jsx)(d.Check,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>i(!1),children:(0,b.jsx)(k.X,{})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:e.text}),(0,b.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground",children:[(0,c.format)(e.createdAt,"yyyy.MM.dd"),y&&` \xb7 ${y}`]}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{r(e.text),i(!0)},children:(0,b.jsx)(h,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:v,onClick:()=>void w(),children:!v&&(0,b.jsx)(j.Trash2,{})})]})})}let ao=[{key:"people",label:"Person",placeholder:"alex",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ap(){return q.notify.component({className:"sm:max-w-lg",renderer:({close:a})=>(0,b.jsx)(aq,{onDone:a})})}function aq({onDone:a}){let[c,d]=(0,l.useState)("people"),[e,f]=(0,l.useState)(""),[g,h]=(0,l.useState)(""),[j,k]=(0,l.useState)(""),[q,r,,v]=(0,ac.useServerAction)(Q,{errorMessage:!1,onOk:()=>{(0,ae.revalidate)(m.queryKey.memory),a()}}),w=ao.find(a=>a.key===c),x=e.trim()&&g.trim()&&!r,y=()=>{x&&q(`${c}/${e.trim()}`,g.trim(),j.split("\n").map(a=>a.trim()).filter(Boolean))};return(0,b.jsxs)(aa.SettingDialogContent,{title:"New note",description:"Where Thursday keeps what she learns about this.",footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{variant:"ghost",onClick:a,children:"Cancel"}),(0,b.jsxs)(n.Button,{disabled:!x,loading:r,onClick:y,children:[!r&&(0,b.jsx)(i.Plus,{}),"Create"]})]}),children:[(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{children:"Kind"}),(0,b.jsx)(s.Tabs,{value:c,onValueChange:a=>d(a),children:(0,b.jsx)(s.TabsList,{className:"w-full",children:ao.map(a=>(0,b.jsx)(s.TabsTrigger,{value:a.key,children:a.label},a.key))})})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,b.jsxs)(o.FieldContent,{children:[(0,b.jsx)(p.Input,{id:"note-name",value:e,onChange:a=>f(a.target.value),placeholder:w?.placeholder,spellCheck:!1,required:!0}),(0,b.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[c,"/",e.trim()||"…"]})]})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,b.jsx)(o.FieldContent,{children:(0,b.jsx)(p.Input,{id:"note-summary",value:g,onChange:a=>h(a.target.value),onKeyDown:a=>{a.nativeEvent.isComposing||229===a.keyCode||"Enter"===a.key&&y()},placeholder:"One line Thursday sees in her list",maxLength:u.MEMORY_LIMITS.descriptionChars,required:!0})})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,b.jsx)(t.Textarea,{id:"note-facts",value:j,onChange:a=>k(a.target.value),placeholder:`One per line
|
|
2
|
+
${w?.fact??""}`,className:"min-h-24 resize-none text-sm"})]})]}),v&&(0,b.jsx)("p",{className:"font-mono text-xs text-destructive",children:v})]})}a.s(["MemorySetting",0,function(){let{items:a,isLoading:c,isLoadingMore:d,error:e,hasMore:f,sentinelRef:g}=(0,ad.useServerPages)({key:a=>m.queryKey.memoryPage(a*u.PAGE_SIZE)}),[h,j]=(0,l.useState)(""),[k,o]=(0,l.useState)(new Set),[p,q]=(0,l.useState)(!1);if(c)return(0,b.jsx)(aa.SettingSkeleton,{});if(e)return(0,b.jsx)(aa.SettingError,{message:e.message});let s=h.trim().toLowerCase(),t=s?a.filter(a=>[a.path,a.description,...a.facts.map(a=>a.text)].some(a=>a.toLowerCase().includes(s))):a,v=a.reduce((a,b)=>a+b.factCount,0),w=f?"+":"";return(0,b.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,b.jsxs)(aa.SettingScreen,{footer:(0,b.jsxs)(n.Button,{size:"sm",variant:p?"secondary":"ghost","aria-pressed":p,onClick:()=>q(!p),children:[(0,b.jsx)(ai,{}),"Edit with a model"]}),children:[(0,b.jsx)(aa.SettingToolbar,{count:(0,b.jsxs)("span",{className:"flex items-center gap-3",children:[`${a.length}${w} notes \xb7 ${v}${w} facts`,(0,b.jsxs)(n.Button,{size:"sm",variant:"outline",className:"font-sans",onClick:ap,children:[(0,b.jsx)(i.Plus,{}),"New note"]})]}),children:(0,b.jsx)(aa.SettingFilter,{value:h,onChange:j,placeholder:"Filter memory"})}),s&&0===t.length&&(0,b.jsx)("p",{className:"px-1 text-xs text-muted-foreground",children:"Nothing matches"}),af.map(({key:a,label:c})=>{let d=t.filter(b=>(function(a){if($.includes(a))return"you";let b=a.slice(0,a.indexOf("/"));return _.includes(b)?b:"other"})(b.path)===a);return 0===d.length?null:(0,b.jsx)(aa.SettingGroup,{label:c,children:(0,b.jsx)(aa.SettingItems,{children:d.map(a=>(0,b.jsx)(ak,{note:a,open:k.has(a.id)!==!!s,onToggle:()=>{let b;return b=a.id,o(a=>{let c=new Set(a);return c.delete(b)||c.add(b),c})}},a.id))})},a)}),(0,b.jsx)(aa.SettingMore,{hasMore:f,loading:d,sentinelRef:g,ghost:(0,b.jsxs)("div",{className:"flex h-12 items-center gap-3 px-4",children:[(0,b.jsx)(r.Skeleton,{className:"h-3 w-24"}),(0,b.jsx)(r.Skeleton,{className:"h-3 w-56"})]})})]}),p&&(0,b.jsx)(L,{notes:a})]})}],857022)}];
|
|
3
3
|
|
|
4
4
|
//# sourceMappingURL=features_memory_components_memory-setting_tsx_0oa43sw._.js.map
|
package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[41014,a=>{"use strict";var b=a.i(187924),c=a.i(256711),d=a.i(987234),e=a.i(164831);let f={name:"calendar-days",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M12 13h.01",key:"y0uutt"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M8 17h.01",key:"p3bg7i"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M16 17h.01",key:"ql8jdd"}]]};f.node;let g=(0,e.default)(f);var h=a.i(752562),i=a.i(589027),j=a.i(141146),k=a.i(875160),l=a.i(272944),m=a.i(738835),n=a.i(951675),o=a.i(474215),p=a.i(572131),q=a.i(767561),r=a.i(340695),s=a.i(965733),t=a.i(676504),u=a.i(205522),v=a.i(446181),w=a.i(777794),x=a.i(545097),y=a.i(280281),z=a.i(546893),A=a.i(287702),B=a.i(913834),C=a.i(135432),D=a.i(619477),E=a.i(28996),F=a.i(199169),G=a.i(313237),H=a.i(759497),I=a.i(497895),J=a.i(405050);let K=(0,J.createServerReference)("7fabe86e547bfb8470741bd4e4fb46143b4dbd1384",J.callServer,void 0,J.findSourceMapURL,"createRoutineAction"),L=(0,J.createServerReference)("7f607df1a42d9eeb8d244a7d6a8ff1c91334f46870",J.callServer,void 0,J.findSourceMapURL,"deleteRoutineAction"),M=(0,J.createServerReference)("7fc3679d73e980c1fbb797a33639f10e1a7817cc27",J.callServer,void 0,J.findSourceMapURL,"runRoutineNowAction"),N=(0,J.createServerReference)("7f0cc6cdd3bb4b023bd90b93707f3251f5ceaa45eb",J.callServer,void 0,J.findSourceMapURL,"updateRoutineAction");var O=a.i(954714);let P=[1,2,3,4,5,6,7],Q=O.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function R(a){let[b,c]=a.split(" "),[d,e,f]=b.split("-").map(Number),[g,h]=c.split(":").map(Number);return new Date(d,e-1,f,g,h)}let S=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,T=O.string().regex(S,'A moment is "YYYY-MM-DD HH:MM"').refine(a=>{if(!S.test(a))return!0;let b=R(a);return b.getMonth()===Number(a.slice(5,7))-1&&b.getDate()===Number(a.slice(8,10))},"There is no such day"),U=O.discriminatedUnion("kind",[O.object({kind:O.literal("once"),at:T}),O.object({kind:O.literal("daily"),time:Q,days:O.array(O.number().int().min(1).max(7)).min(1,"Pick at least one day").transform(a=>[...new Set(a)].sort((a,b)=>a-b))}),O.object({kind:O.literal("every"),hours:O.number().int().min(A.ROUTINE.minHours,`No more often than every ${A.ROUTINE.minHours}h`).max(168)})]),V=O.object({bot:O.string().trim().min(1,"Pick a bot"),label:O.string().trim().min(1,"Give it a name").max(80),request:O.string().trim().min(1,"Say what it should do"),schedule:U}),W=O.object({id:O.string(),status:O.enum(["running","waiting","done","cancelled"]),outcome:O.string().nullable(),updatedAt:F.DateLikeSchema});V.extend({id:O.string(),enabled:O.boolean(),nextRunAt:F.DateLikeSchema,runs:O.array(W)});let X=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Z(a){if("once"===a.kind){let[b,c]=a.at.split(" "),[,d,e]=b.split("-").map(Number);return`Once \xb7 ${Y[d-1]} ${e} ${c}`}if("every"===a.kind)return 1===a.hours?"Every hour":`Every ${a.hours} hours`;let{days:b,time:c}=a;if(7===b.length)return`Daily ${c}`;if(1===b.length)return`${X[b[0]-1]} ${c}`;let d=b.every((a,c)=>0===c||a===b[c-1]+1)?`${X[b[0]-1]}–${X[b.at(-1)-1]}`:b.map(a=>X[a-1]).join(" ");return`Daily ${c} \xb7 ${d}`}var $=a.i(156819);function _({routine:a,bots:c,open:d,onOpen:e,onSwitch:f}){let g=function(a,b){let c=a.runs[0],d=c?.outcome?(0,I.plainText)(c.outcome):"",e=c?`${(0,F.whenOf)(c.updatedAt)}${d?` — ${d}`:""}`:"Not run yet";if(!a.enabled)return{text:`Off \xb7 ${e}`,tone:"text-muted-foreground"};let f=b?.find(b=>b.name===a.bot);return b&&(!f||f.disabled)?{text:f?`${a.bot} is switched off`:`${a.bot} is gone — pick another bot`,tone:I.WAITING_INK,waits:!0}:c?.status==="running"?{text:"Running now",tone:"",shine:!0}:c?.status==="waiting"?{text:`The last run waits on you${d?`: ${d}`:""}`,tone:I.WAITING_INK,waits:!0}:{text:e,tone:"text-muted-foreground"}}(a,c),h=a.runs[0]?.status==="running";return(0,b.jsxs)("div",{className:(0,I.cn)("flex items-center gap-3 p-4 transition-colors",d?"bg-muted/80":"hover:bg-muted/50"),children:[(0,b.jsxs)("button",{type:"button",onClick:e,className:(0,I.cn)("flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",!a.enabled&&"opacity-70"),children:[(0,b.jsx)(B.BotMark,{size:40,seed:a.bot,...(0,B.markOf)(a.bot,c),state:h?"thinking":"idle",notify:!!g.waits,className:"shrink-0"}),(0,b.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"truncate text-sm font-medium",children:a.label}),h&&(0,b.jsx)(k.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),(0,b.jsx)("span",{className:"flex min-w-0 text-[13px] leading-snug",children:g.shine?(0,b.jsx)(x.ShinyText,{text:g.text,speed:2.2,className:"min-w-0 truncate"}):(0,b.jsx)("span",{className:(0,I.cn)("min-w-0 truncate",g.tone),children:g.text})})]}),(0,b.jsxs)("span",{className:"flex w-44 shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",children:[(0,b.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 text-foreground",children:[(0,b.jsx)($.RoutineMark,{className:"size-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"truncate",children:Z(a.schedule)})]}),(0,b.jsx)("span",{className:"max-w-full truncate text-muted-foreground/70",children:a.enabled?`next ${(0,F.whenOf)(a.nextRunAt)}`:"off"})]})]}),(0,b.jsx)(y.Switch,{checked:a.enabled,onCheckedChange:f,"aria-label":`${a.label} on or off`,className:"shrink-0"}),(0,b.jsx)("button",{type:"button",onClick:e,"aria-label":`Open ${a.label}`,className:"shrink-0 rounded-md text-muted-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,b.jsx)(j.ChevronRight,{className:"size-4"})})]})}let aa=a=>String(a).padStart(2,"0");function ab(a,b=new Date){let d=new Date(b);return d.setDate(d.getDate()+a),(0,c.format)(d,"yyyy-MM-dd")}let ac=(a,b)=>{let c=a?.schedule;return{label:a?.label??"",bot:a?.bot??b.find(a=>!a.disabled)?.name??"",request:a?.request??"",kind:c?.kind??"daily",time:c?.kind==="daily"?c.time:c?.kind==="once"?c.at.slice(11):"09:00",days:c?.kind==="daily"?c.days:[...P],hours:c?.kind==="every"?c.hours:6,date:c?.kind==="once"?c.at.slice(0,10):ab(1)}};function ad(a){let b=/^\d\d:\d\d$/.test(a.time);return"once"===a.kind?b&&a.date?{kind:"once",at:`${a.date} ${a.time}`}:null:"daily"===a.kind?a.days.length&&b?{kind:"daily",time:a.time,days:a.days}:null:{kind:"every",hours:a.hours}}let ae=a=>a?.kind==="once"&&R(a.at)<=new Date,af=[{label:"Every day",days:[...P]},{label:"Weekdays",days:[1,2,3,4,5]},{label:"Weekends",days:[6,7]}],ag=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ah=[1,2,3,6,12,24].filter(a=>a>=A.ROUTINE.minHours);function ai({routine:a,bots:c,onClose:d,onMade:e}){var f,g;let h,[k,x]=(0,p.useState)(null),A=(0,p.useCallback)(a=>{x(a?.closest("[data-slot=dialog-content]")??null)},[]),D="new"===a?null:a,J="new"===a?"new":a?.id??"",[O,Q]=(0,p.useState)(()=>ac(D,c));(0,p.useEffect)(()=>Q(ac(D,c)),[J]);let R=a=>Q(b=>({...b,...a})),S=()=>(0,H.revalidate)(q.queryKey.routines),[T,U]=(0,G.useServerAction)(K,{onOk:a=>{S(),e(a.id)}}),[V]=(0,G.useServerAction)(N,{onOk:S}),[W]=(0,G.useServerAction)(L,{onOk:S}),[Y,_]=(0,G.useServerAction)(M,{onOk:()=>{S(),(0,H.revalidate)(q.queryKey.threads)}}),am=ad(O),ar=am&&!ae(am)&&O.label.trim()&&O.bot&&O.request.trim()?{label:O.label.trim(),bot:O.bot,request:O.request.trim(),schedule:am}:null,as=a=>{D&&V(D.id,a)},at=a=>{R(a);let b=ad({...O,...a});!b||ae(b)||D&&function(a,b){if("once"===a.kind)return"once"===b.kind&&a.at===b.at;if("every"===a.kind)return"every"===b.kind&&a.hours===b.hours;let c=a=>[...a].sort((a,b)=>a-b).join();return"daily"===b.kind&&a.time===b.time&&c(a.days)===c(b.days)}(b,D.schedule)||as({schedule:b,..."once"===b.kind?{enabled:!0}:{}})},au=!!(D&&(O.label.trim()&&O.label.trim()!==D.label||O.request.trim()&&O.request.trim()!==D.request)),av=D?au:!!(O.label.trim()||O.request.trim()),aw=(0,p.useRef)(av);aw.current=av;let ax=(0,E.useSettingsStore)(a=>a.holdUnsaved);(0,p.useEffect)(()=>(ax(()=>aw.current),()=>ax(null)),[ax]);let ay=async()=>{(!aw.current||await v.notify.discard())&&d()},az=async()=>{!D||await v.notify.confirm({title:`Delete "${D.label}"?`,description:"It starts no more. The jobs it already opened stay.",okText:"Delete",destructive:!0})&&(await W(D.id).catch(()=>{}),d())},aA=c.find(a=>a.name===O.bot),aB=D?.runs[0]?.status==="running"||D?.runs[0]?.status==="waiting";return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{ref:A,hidden:!0}),(0,b.jsx)(s.Dialog,{open:!!(a&&k),onOpenChange:a=>!a&&void ay(),modal:!1,disablePointerDismissal:!0,children:(0,b.jsx)(s.DialogPortal,{container:k,children:(0,b.jsx)(s.DialogPopup,{className:"absolute inset-y-0 right-0 z-10 flex w-[min(35rem,calc(100%-13rem))] flex-col border-l border-border/60 bg-popover text-popover-foreground shadow-2xl shadow-black/10 duration-150 data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-right-4 data-closed:animate-out data-closed:fade-out-0 data-closed:slide-out-to-right-4",children:a&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 pt-3.5 pr-3 pb-1.5 pl-5",children:[aA?(0,b.jsx)(B.BotMark,{size:28,seed:aA.name,...(0,B.markOf)(aA.name,c),notify:!1,className:"shrink-0"}):(0,b.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,b.jsx)($.RoutineMark,{className:"size-3.5"})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)(s.DialogTitle,{className:"sr-only",children:D?D.label:"New routine"}),(0,b.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:D?D.label:"New routine"}),D&&(0,b.jsxs)("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[(0,b.jsx)($.RoutineMark,{className:"size-3 shrink-0"}),(0,b.jsxs)("span",{className:"truncate",children:[D.bot," · ",Z(D.schedule),D.enabled&&` \xb7 next ${(0,F.whenOf)(D.nextRunAt)}`]})]})]}),D&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(y.Switch,{checked:D.enabled,onCheckedChange:a=>void V(D.id,{enabled:a}),"aria-label":`${D.label} on or off`,className:"mr-1 shrink-0"}),(0,b.jsxs)(t.DropdownMenu,{children:[(0,b.jsx)(t.DropdownMenuTrigger,{render:(0,b.jsx)(r.Button,{size:"icon-sm",variant:"ghost","aria-label":"More",className:"text-muted-foreground"}),children:(0,b.jsx)(l.MoreHorizontal,{})}),(0,b.jsx)(t.DropdownMenuContent,{align:"end",children:(0,b.jsxs)(t.DropdownMenuItem,{variant:"destructive",onClick:az,children:[(0,b.jsx)(n.Trash2,{}),"Delete"]})})]})]}),(0,b.jsx)(s.DialogClose,{render:(0,b.jsx)(r.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the routine"}),children:(0,b.jsx)(o.X,{})})]}),(0,b.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pt-3 pb-5",children:[(0,b.jsxs)(aq,{label:"Name",htmlFor:"routine-name",children:[(0,b.jsx)(u.Input,{id:"routine-name",value:O.label,onChange:a=>R({label:a.target.value}),placeholder:"e.g. Morning mail",maxLength:80,autoFocus:!D}),(0,b.jsx)(aj,{children:"What it is called in this list, and what she calls it on a call."})]}),(0,b.jsxs)(aq,{label:"Bot",children:[(0,b.jsxs)(t.DropdownMenu,{children:[(0,b.jsxs)(t.DropdownMenuTrigger,{render:(0,b.jsx)(r.Button,{variant:"outline",className:"justify-start gap-2 pl-1.5 font-normal"}),children:[aA?(0,b.jsx)(B.BotMark,{size:20,seed:aA.name,...(0,B.markOf)(aA.name,c),notify:!1,className:"shrink-0"}):null,(0,b.jsx)("span",{className:(0,I.cn)(!aA&&"pl-1.5 text-muted-foreground"),children:aA?.name??(O.bot||"Pick a bot")}),(0,b.jsx)(i.ChevronDown,{className:"ml-1 size-3.5 text-muted-foreground"})]}),(0,b.jsx)(t.DropdownMenuContent,{align:"start",children:(0,b.jsx)(t.DropdownMenuGroup,{children:c.filter(a=>!a.disabled).map(a=>(0,b.jsxs)(t.DropdownMenuItem,{onClick:()=>{R({bot:a.name}),a.name!==D?.bot&&as({bot:a.name})},children:[(0,b.jsx)(B.BotMark,{size:16,seed:a.name,...(0,B.markOf)(a.name,c),notify:!1,className:"shrink-0"}),a.name]},a.name))})})]}),(0,b.jsx)(aj,{children:"Who does the job each time it starts."})]}),(0,b.jsx)(aq,{label:"When",children:(0,b.jsxs)("div",{className:"space-y-3.5",children:[(0,b.jsx)(w.Segmented,{"aria-label":"How it starts",value:O.kind,onChange:a=>at({kind:a}),options:[{value:"once",label:"Once"},{value:"daily",label:"On set days"},{value:"every",label:"Every few hours"}]}),(0,b.jsx)("div",{className:"space-y-2.5",children:"once"===O.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(al,{word:"On",children:(0,b.jsx)(an,{value:O.date,onPick:a=>at({date:a})})}),(0,b.jsxs)(al,{word:"At",children:[(0,b.jsx)(ao,{value:O.time,onChange:a=>R({time:a}),onDone:()=>at({})}),(0,b.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"or"}),(0,b.jsx)(ak,{picked:!1,onClick:()=>{let a;return at(((a=new Date(Date.now()+36e5)).setMinutes(5*Math.ceil(a.getMinutes()/5),0,0),{date:ab(0,a),time:`${aa(a.getHours())}:${aa(a.getMinutes())}`}))},children:"In an hour"})]})]}):"daily"===O.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(al,{word:"On",children:P.map(a=>{let c=O.days.includes(a);return(0,b.jsx)(ak,{picked:c,several:!0,"aria-label":ag[a-1],onClick:()=>at({days:c?O.days.filter(b=>b!==a):[...O.days,a].sort((a,b)=>a-b)}),children:X[a-1]},a)})}),(0,b.jsx)(al,{children:af.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>at({days:[...a.days]}),className:"h-6.5 rounded-full bg-muted px-2.5 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:a.label},a.label))}),(0,b.jsx)(al,{word:"At",children:(0,b.jsx)(ao,{value:O.time,onChange:a=>R({time:a}),onDone:()=>at({})})})]}):(0,b.jsxs)(al,{word:"Every",children:[(ah.includes(O.hours)?ah:[...ah,O.hours].sort((a,b)=>a-b)).map(a=>(0,b.jsx)(ak,{picked:a===O.hours,onClick:()=>at({hours:a}),className:"min-w-10 px-3",children:a},a)),(0,b.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"hours"})]})}),(0,b.jsx)(ap,{schedule:am,kind:O.kind})]})}),(0,b.jsxs)(aq,{label:"Job",htmlFor:"routine-request",children:[(0,b.jsx)(z.Textarea,{id:"routine-request",value:O.request,onChange:a=>R({request:a.target.value}),placeholder:"e.g. Go through the mail that came since the last run and draft replies to what needs one. Send nothing.",className:"min-h-28"}),(0,b.jsx)(aj,{children:"Handed to the bot as a new thread each time, with a line on how the last run ended. Nobody is there to ask, so say everything it needs."})]}),D&&(0,b.jsxs)("div",{className:"pt-1",children:[(0,b.jsx)("div",{className:"flex h-6 items-center",children:(0,b.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:"Runs"})}),0===D.runs.length?(0,b.jsx)("p",{className:"py-2 text-[13px] text-muted-foreground",children:"Not run yet."}):D.runs.map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>{var b;return b=a.id,void(E.useSettingsStore.getState().hide(),C.roomOpens.open(b))},className:"flex h-9 w-full items-center gap-3 border-t border-border/60 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,b.jsx)("span",{className:"w-28 shrink-0 font-mono text-[11px] text-muted-foreground tabular-nums",children:(0,F.whenOf)(a.updatedAt)}),(0,b.jsx)("span",{className:(0,I.cn)("min-w-0 flex-1 truncate","waiting"===a.status?I.WAITING_INK:"text-muted-foreground"),children:"running"===a.status?"Running now":a.outcome?(0,I.plainText)(a.outcome):"cancelled"===a.status?"Stopped":"No words"}),(0,b.jsx)(j.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground"})]},a.id))]})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-3 border-t border-border/60 px-5 py-3",children:[(0,b.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-4 text-muted-foreground",children:D||ar?"Starts while Thursday is running on this computer, whether or not a tab is open. A time that passed meanwhile starts once, not once for each.":`Still needs ${f=O,g=am,(h=[f.label.trim()?null:"a name",f.bot?null:"a bot",!g?"a time":ae(g)?"a time still ahead":null,f.request.trim()?null:"a job"].filter(a=>null!==a)).length>1?`${h.slice(0,-1).join(", ")} and ${h.at(-1)}`:h[0]??"nothing"}.`}),au&&(0,b.jsx)(r.Button,{size:"sm",onClick:()=>{if(!D)return;let a={};O.label.trim()&&O.label.trim()!==D.label&&(a.label=O.label.trim()),O.request.trim()&&O.request.trim()!==D.request&&(a.request=O.request.trim()),Object.keys(a).length&&as(a)},children:"Save"}),D?(0,b.jsxs)(r.Button,{variant:"outline",size:"sm",loading:_,disabled:aB,title:aB?"Its last run is still open":void 0,onClick:()=>void Y(D.id),children:[(0,b.jsx)(m.Play,{}),"Run now"]}):(0,b.jsx)(r.Button,{size:"sm",loading:U,disabled:!ar,onClick:()=>ar&&void T(ar),children:"Create"})]})]})})})})]})}let aj=({children:a})=>(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a});function ak({picked:a,several:c=!1,className:d,children:e,...f}){return(0,b.jsxs)("button",{type:"button","aria-pressed":a,className:(0,I.cn)("inline-flex h-8 items-center justify-center gap-1.5 rounded-full px-3.5 text-[13px] whitespace-nowrap outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",!a&&"text-foreground ring-1 ring-border ring-inset hover:bg-muted",a&&(c?"bg-brand/10 pl-2.5 font-medium text-brand ring-1 ring-brand/30 ring-inset":"bg-brand font-medium text-brand-foreground"),d),...f,children:[a&&c&&(0,b.jsx)(h.Check,{className:"size-3.5"}),e]})}function al({word:a,children:c}){return(0,b.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,b.jsx)("span",{className:"flex h-8 w-9 shrink-0 items-center text-[13px] text-muted-foreground",children:a}),(0,b.jsx)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",children:c})]})}function am(a){let b=R(`${a} 00:00`),d=(b.getTime()-R(`${ab(0)} 00:00`).getTime())/864e5;return(0,c.format)(b,d<7?"EEE d":"EEE, MMM d")}function an({value:a,onPick:c}){let d=(0,p.useRef)(null),e=[0,1,2,3].map(a=>ab(a)),f=()=>d.current?.showPicker();return(0,b.jsxs)(b.Fragment,{children:[e.map((d,e)=>(0,b.jsx)(ak,{picked:d===a,onClick:()=>c(d),children:0===e?"Today":1===e?"Tomorrow":am(d)},d)),!e.includes(a)&&(0,b.jsx)(ak,{picked:!0,onClick:f,children:am(a)}),(0,b.jsxs)("span",{className:"relative",children:[(0,b.jsx)(ak,{picked:!1,"aria-label":"Another day",onClick:f,className:"w-8 px-0",children:(0,b.jsx)(g,{className:"size-3.5"})}),(0,b.jsx)("input",{ref:d,type:"date",tabIndex:-1,"aria-hidden":!0,min:e[0],value:a,onChange:a=>a.target.value&&c(a.target.value),className:"pointer-events-none absolute inset-0 opacity-0"})]})]})}function ao({value:a,onChange:c,onDone:d}){return(0,b.jsx)(u.Input,{type:"time","aria-label":"Time of day",value:a,onChange:a=>c(a.target.value),onBlur:d,onClick:a=>a.currentTarget.showPicker?.(),className:"h-8.5 w-28 px-3 text-[15px] tabular-nums md:text-[15px] [&::-webkit-calendar-picker-indicator]:hidden"})}function ap({schedule:a,kind:c}){if(!a||ae(a))return(0,b.jsx)("p",{className:"text-xs text-destructive",children:a?"That time has passed. Pick a later one.":"daily"===c?"Pick a time and at least one day.":"Pick a time."});let e=function(a,b){if("once"===a.kind)return R(a.at);if("every"===a.kind)return new Date(b.getTime()+36e5*a.hours);let[c,d]=a.time.split(":").map(Number);for(let e=0;e<=7;e++){let f=new Date(b);f.setDate(f.getDate()+e),f.setHours(c,d,0,0);let g=0===f.getDay()?7:f.getDay();if(f>b&&a.days.includes(g))return f}return new Date(b.getTime()+864e5)}(a,new Date);return(0,b.jsxs)("p",{className:"flex items-start gap-2 text-[13px] leading-5",children:[(0,b.jsx)($.RoutineMark,{className:"mt-0.75 size-3.5 shrink-0 text-muted-foreground"}),(0,b.jsxs)("span",{className:"min-w-0",children:[Z(a),(0,b.jsxs)("span",{className:"text-muted-foreground",children:[" · ","once"===a.kind?`${(0,d.formatDistanceToNowStrict)(e,{addSuffix:!0})}, then it switches itself off`:`first start ${(0,F.whenOf)(e)}`]})]})]})}function aq({label:a,htmlFor:c,children:d}){return(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsx)("label",{htmlFor:c,className:"w-14 shrink-0 pt-2 font-mono text-xs text-muted-foreground",children:a}),(0,b.jsx)("div",{className:"min-w-0 flex-1 space-y-1.5",children:d})]})}a.s(["RoutineSetting",0,function(){let[a,c]=(0,p.useState)(null),{data:d,isLoading:e,error:f}=(0,H.useServerRoute)(q.queryKey.routines),{data:g}=(0,H.useServerRoute)(q.queryKey.bot),[h]=(0,G.useServerAction)(N,{onOk:()=>(0,H.revalidate)(q.queryKey.routines)});if(e)return(0,b.jsx)(D.SettingSkeleton,{rows:3});if(f)return(0,b.jsx)(D.SettingError,{message:f.message});let i=d??[],j=i.filter(a=>a.enabled).length,k=i.find(b=>b.id===a);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.SettingScreen,{footer:(0,b.jsxs)(D.SettingRailNote,{children:[i.length," set up · ",j," on",i.length>=A.ROUTINE.max&&` \xb7 ${A.ROUTINE.max} is the most`]}),children:(0,b.jsx)(D.SettingItems,{addRow:i.length<A.ROUTINE.max?{label:"New routine",onClick:()=>c("new")}:void 0,children:0===i.length?(0,b.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:'Nothing starts by itself yet. Tell Thursday what should — "every weekday at nine, go through my mail" — or make one here.'}):i.map(d=>(0,b.jsx)(_,{routine:d,bots:g,open:d.id===a,onOpen:()=>c(d.id),onSwitch:a=>h(d.id,{enabled:a})},d.id))})}),(0,b.jsx)(ai,{routine:"new"===a?"new":k??null,bots:g??[],onClose:()=>c(null),onMade:a=>c(a)})]})}],41014)}];
|
|
1
|
+
module.exports=[41014,a=>{"use strict";var b=a.i(187924),c=a.i(256711),d=a.i(987234),e=a.i(164831);let f={name:"calendar-days",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M12 13h.01",key:"y0uutt"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M8 17h.01",key:"p3bg7i"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M16 17h.01",key:"ql8jdd"}]]};f.node;let g=(0,e.default)(f);var h=a.i(752562),i=a.i(589027),j=a.i(141146),k=a.i(875160),l=a.i(272944),m=a.i(738835),n=a.i(951675),o=a.i(474215),p=a.i(572131),q=a.i(767561),r=a.i(340695),s=a.i(965733),t=a.i(676504),u=a.i(205522),v=a.i(446181),w=a.i(777794),x=a.i(545097),y=a.i(280281),z=a.i(546893),A=a.i(287702),B=a.i(913834),C=a.i(135432),D=a.i(619477),E=a.i(28996),F=a.i(199169),G=a.i(313237),H=a.i(759497),I=a.i(497895),J=a.i(405050);let K=(0,J.createServerReference)("7ff028931dd99e1d9034d92bbdef9476be3a0d44cb",J.callServer,void 0,J.findSourceMapURL,"createRoutineAction"),L=(0,J.createServerReference)("7f431074a6ea8f8df32cd916ee5f7894ee54d3b63c",J.callServer,void 0,J.findSourceMapURL,"deleteRoutineAction"),M=(0,J.createServerReference)("7f319138c225f4f0f1e255a2af4e1e26219bc08845",J.callServer,void 0,J.findSourceMapURL,"runRoutineNowAction"),N=(0,J.createServerReference)("7fac792931b187134a1b6246b461d5cb9dd658ccb5",J.callServer,void 0,J.findSourceMapURL,"updateRoutineAction");var O=a.i(954714);let P=[1,2,3,4,5,6,7],Q=O.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function R(a){let[b,c]=a.split(" "),[d,e,f]=b.split("-").map(Number),[g,h]=c.split(":").map(Number);return new Date(d,e-1,f,g,h)}let S=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,T=O.string().regex(S,'A moment is "YYYY-MM-DD HH:MM"').refine(a=>{if(!S.test(a))return!0;let b=R(a);return b.getMonth()===Number(a.slice(5,7))-1&&b.getDate()===Number(a.slice(8,10))},"There is no such day"),U=O.discriminatedUnion("kind",[O.object({kind:O.literal("once"),at:T}),O.object({kind:O.literal("daily"),time:Q,days:O.array(O.number().int().min(1).max(7)).min(1,"Pick at least one day").transform(a=>[...new Set(a)].sort((a,b)=>a-b))}),O.object({kind:O.literal("every"),hours:O.number().int().min(A.ROUTINE.minHours,`No more often than every ${A.ROUTINE.minHours}h`).max(168)})]),V=O.object({bot:O.string().trim().min(1,"Pick a bot"),label:O.string().trim().min(1,"Give it a name").max(80),request:O.string().trim().min(1,"Say what it should do"),schedule:U}),W=O.object({id:O.string(),status:O.enum(["running","waiting","done","cancelled"]),outcome:O.string().nullable(),updatedAt:F.DateLikeSchema});V.extend({id:O.string(),enabled:O.boolean(),nextRunAt:F.DateLikeSchema,runs:O.array(W)});let X=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Z(a){if("once"===a.kind){let[b,c]=a.at.split(" "),[,d,e]=b.split("-").map(Number);return`Once \xb7 ${Y[d-1]} ${e} ${c}`}if("every"===a.kind)return 1===a.hours?"Every hour":`Every ${a.hours} hours`;let{days:b,time:c}=a;if(7===b.length)return`Daily ${c}`;if(1===b.length)return`${X[b[0]-1]} ${c}`;let d=b.every((a,c)=>0===c||a===b[c-1]+1)?`${X[b[0]-1]}–${X[b.at(-1)-1]}`:b.map(a=>X[a-1]).join(" ");return`Daily ${c} \xb7 ${d}`}var $=a.i(156819);function _({routine:a,bots:c,open:d,onOpen:e,onSwitch:f}){let g=function(a,b){let c=a.runs[0],d=c?.outcome?(0,I.plainText)(c.outcome):"",e=c?`${(0,F.whenOf)(c.updatedAt)}${d?` — ${d}`:""}`:"Not run yet";if(!a.enabled)return{text:`Off \xb7 ${e}`,tone:"text-muted-foreground"};let f=b?.find(b=>b.name===a.bot);return b&&(!f||f.disabled)?{text:f?`${a.bot} is switched off`:`${a.bot} is gone — pick another bot`,tone:I.WAITING_INK,waits:!0}:c?.status==="running"?{text:"Running now",tone:"",shine:!0}:c?.status==="waiting"?{text:`The last run waits on you${d?`: ${d}`:""}`,tone:I.WAITING_INK,waits:!0}:{text:e,tone:"text-muted-foreground"}}(a,c),h=a.runs[0]?.status==="running";return(0,b.jsxs)("div",{className:(0,I.cn)("flex items-center gap-3 p-4 transition-colors",d?"bg-muted/80":"hover:bg-muted/50"),children:[(0,b.jsxs)("button",{type:"button",onClick:e,className:(0,I.cn)("flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",!a.enabled&&"opacity-70"),children:[(0,b.jsx)(B.BotMark,{size:40,seed:a.bot,...(0,B.markOf)(a.bot,c),state:h?"thinking":"idle",notify:!!g.waits,className:"shrink-0"}),(0,b.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"truncate text-sm font-medium",children:a.label}),h&&(0,b.jsx)(k.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),(0,b.jsx)("span",{className:"flex min-w-0 text-[13px] leading-snug",children:g.shine?(0,b.jsx)(x.ShinyText,{text:g.text,speed:2.2,className:"min-w-0 truncate"}):(0,b.jsx)("span",{className:(0,I.cn)("min-w-0 truncate",g.tone),children:g.text})})]}),(0,b.jsxs)("span",{className:"flex w-44 shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",children:[(0,b.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 text-foreground",children:[(0,b.jsx)($.RoutineMark,{className:"size-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"truncate",children:Z(a.schedule)})]}),(0,b.jsx)("span",{className:"max-w-full truncate text-muted-foreground",children:a.enabled?`next ${(0,F.whenOf)(a.nextRunAt)}`:"off"})]})]}),(0,b.jsx)(y.Switch,{checked:a.enabled,onCheckedChange:f,"aria-label":`${a.label} on or off`,className:"shrink-0"}),(0,b.jsx)("button",{type:"button",onClick:e,"aria-label":`Open ${a.label}`,className:"shrink-0 rounded-md text-muted-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,b.jsx)(j.ChevronRight,{className:"size-4"})})]})}let aa=a=>String(a).padStart(2,"0");function ab(a,b=new Date){let d=new Date(b);return d.setDate(d.getDate()+a),(0,c.format)(d,"yyyy-MM-dd")}let ac=(a,b)=>{let c=a?.schedule;return{label:a?.label??"",bot:a?.bot??b.find(a=>!a.disabled)?.name??"",request:a?.request??"",kind:c?.kind??"daily",time:c?.kind==="daily"?c.time:c?.kind==="once"?c.at.slice(11):"09:00",days:c?.kind==="daily"?c.days:[...P],hours:c?.kind==="every"?c.hours:6,date:c?.kind==="once"?c.at.slice(0,10):ab(1)}};function ad(a){let b=/^\d\d:\d\d$/.test(a.time);return"once"===a.kind?b&&a.date?{kind:"once",at:`${a.date} ${a.time}`}:null:"daily"===a.kind?a.days.length&&b?{kind:"daily",time:a.time,days:a.days}:null:{kind:"every",hours:a.hours}}let ae=a=>a?.kind==="once"&&R(a.at)<=new Date,af=[{label:"Every day",days:[...P]},{label:"Weekdays",days:[1,2,3,4,5]},{label:"Weekends",days:[6,7]}],ag=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ah=[1,2,3,6,12,24].filter(a=>a>=A.ROUTINE.minHours);function ai({routine:a,bots:c,onClose:d,onMade:e}){var f,g;let h,[k,x]=(0,p.useState)(null),A=(0,p.useCallback)(a=>{x(a?.closest("[data-slot=dialog-content]")??null)},[]),D="new"===a?null:a,J="new"===a?"new":a?.id??"",[O,Q]=(0,p.useState)(()=>ac(D,c));(0,p.useEffect)(()=>Q(ac(D,c)),[J]);let R=a=>Q(b=>({...b,...a})),S=()=>(0,H.revalidate)(q.queryKey.routines),[T,U]=(0,G.useServerAction)(K,{onOk:a=>{S(),e(a.id)}}),[V]=(0,G.useServerAction)(N,{onOk:S}),[W]=(0,G.useServerAction)(L,{onOk:S}),[Y,_]=(0,G.useServerAction)(M,{onOk:()=>{S(),(0,H.revalidate)(q.queryKey.threads)}}),am=ad(O),ar=am&&!ae(am)&&O.label.trim()&&O.bot&&O.request.trim()?{label:O.label.trim(),bot:O.bot,request:O.request.trim(),schedule:am}:null,as=a=>{D&&V(D.id,a)},at=a=>{R(a);let b=ad({...O,...a});!b||ae(b)||D&&function(a,b){if("once"===a.kind)return"once"===b.kind&&a.at===b.at;if("every"===a.kind)return"every"===b.kind&&a.hours===b.hours;let c=a=>[...a].sort((a,b)=>a-b).join();return"daily"===b.kind&&a.time===b.time&&c(a.days)===c(b.days)}(b,D.schedule)||as({schedule:b,..."once"===b.kind?{enabled:!0}:{}})},au=!!(D&&(O.label.trim()&&O.label.trim()!==D.label||O.request.trim()&&O.request.trim()!==D.request)),av=D?au:!!(O.label.trim()||O.request.trim()),aw=(0,p.useRef)(av);aw.current=av;let ax=(0,E.useSettingsStore)(a=>a.holdUnsaved);(0,p.useEffect)(()=>(ax(()=>aw.current),()=>ax(null)),[ax]);let ay=async()=>{(!aw.current||await v.notify.discard())&&d()},az=async()=>{!D||await v.notify.confirm({title:`Delete "${D.label}"?`,description:"It starts no more. The jobs it already opened stay.",okText:"Delete",destructive:!0})&&(await W(D.id).catch(()=>{}),d())},aA=c.find(a=>a.name===O.bot),aB=D?.runs[0]?.status==="running"||D?.runs[0]?.status==="waiting";return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{ref:A,hidden:!0}),(0,b.jsx)(s.Dialog,{open:!!(a&&k),onOpenChange:a=>!a&&void ay(),modal:!1,disablePointerDismissal:!0,children:(0,b.jsx)(s.DialogPortal,{container:k,children:(0,b.jsx)(s.DialogPopup,{className:"absolute inset-y-0 right-0 z-10 flex w-[min(35rem,calc(100%-13rem))] flex-col border-l border-border/60 bg-popover text-popover-foreground shadow-2xl shadow-black/10 duration-150 data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-right-4 data-closed:animate-out data-closed:fade-out-0 data-closed:slide-out-to-right-4",children:a&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 pt-3.5 pr-3 pb-1.5 pl-5",children:[aA?(0,b.jsx)(B.BotMark,{size:28,seed:aA.name,...(0,B.markOf)(aA.name,c),notify:!1,className:"shrink-0"}):(0,b.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,b.jsx)($.RoutineMark,{className:"size-3.5"})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)(s.DialogTitle,{className:"sr-only",children:D?D.label:"New routine"}),(0,b.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:D?D.label:"New routine"}),D&&(0,b.jsxs)("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[(0,b.jsx)($.RoutineMark,{className:"size-3 shrink-0"}),(0,b.jsxs)("span",{className:"truncate",children:[D.bot," · ",Z(D.schedule),D.enabled&&` \xb7 next ${(0,F.whenOf)(D.nextRunAt)}`]})]})]}),D&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(y.Switch,{checked:D.enabled,onCheckedChange:a=>void V(D.id,{enabled:a}),"aria-label":`${D.label} on or off`,className:"mr-1 shrink-0"}),(0,b.jsxs)(t.DropdownMenu,{children:[(0,b.jsx)(t.DropdownMenuTrigger,{render:(0,b.jsx)(r.Button,{size:"icon-sm",variant:"ghost","aria-label":"More",className:"text-muted-foreground"}),children:(0,b.jsx)(l.MoreHorizontal,{})}),(0,b.jsx)(t.DropdownMenuContent,{align:"end",children:(0,b.jsxs)(t.DropdownMenuItem,{variant:"destructive",onClick:az,children:[(0,b.jsx)(n.Trash2,{}),"Delete"]})})]})]}),(0,b.jsx)(s.DialogClose,{render:(0,b.jsx)(r.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the routine"}),children:(0,b.jsx)(o.X,{})})]}),(0,b.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pt-3 pb-5",children:[(0,b.jsxs)(aq,{label:"Name",htmlFor:"routine-name",children:[(0,b.jsx)(u.Input,{id:"routine-name",value:O.label,onChange:a=>R({label:a.target.value}),placeholder:"e.g. Morning mail",maxLength:80,autoFocus:!D}),(0,b.jsx)(aj,{children:"What it is called in this list, and what she calls it on a call."})]}),(0,b.jsxs)(aq,{label:"Bot",children:[(0,b.jsxs)(t.DropdownMenu,{children:[(0,b.jsxs)(t.DropdownMenuTrigger,{render:(0,b.jsx)(r.Button,{variant:"outline",className:"justify-start gap-2 pl-1.5 font-normal"}),children:[aA?(0,b.jsx)(B.BotMark,{size:20,seed:aA.name,...(0,B.markOf)(aA.name,c),notify:!1,className:"shrink-0"}):null,(0,b.jsx)("span",{className:(0,I.cn)(!aA&&"pl-1.5 text-muted-foreground"),children:aA?.name??(O.bot||"Pick a bot")}),(0,b.jsx)(i.ChevronDown,{className:"ml-1 size-3.5 text-muted-foreground"})]}),(0,b.jsx)(t.DropdownMenuContent,{align:"start",children:(0,b.jsx)(t.DropdownMenuGroup,{children:c.filter(a=>!a.disabled).map(a=>(0,b.jsxs)(t.DropdownMenuItem,{onClick:()=>{R({bot:a.name}),a.name!==D?.bot&&as({bot:a.name})},children:[(0,b.jsx)(B.BotMark,{size:16,seed:a.name,...(0,B.markOf)(a.name,c),notify:!1,className:"shrink-0"}),a.name]},a.name))})})]}),(0,b.jsx)(aj,{children:"Who does the job each time it starts."})]}),(0,b.jsx)(aq,{label:"When",children:(0,b.jsxs)("div",{className:"space-y-3.5",children:[(0,b.jsx)(w.Segmented,{"aria-label":"How it starts",value:O.kind,onChange:a=>at({kind:a}),options:[{value:"once",label:"Once"},{value:"daily",label:"On set days"},{value:"every",label:"Every few hours"}]}),(0,b.jsx)("div",{className:"space-y-2.5",children:"once"===O.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(al,{word:"On",children:(0,b.jsx)(an,{value:O.date,onPick:a=>at({date:a})})}),(0,b.jsxs)(al,{word:"At",children:[(0,b.jsx)(ao,{value:O.time,onChange:a=>R({time:a}),onDone:()=>at({})}),(0,b.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"or"}),(0,b.jsx)(ak,{picked:!1,onClick:()=>{let a;return at(((a=new Date(Date.now()+36e5)).setMinutes(5*Math.ceil(a.getMinutes()/5),0,0),{date:ab(0,a),time:`${aa(a.getHours())}:${aa(a.getMinutes())}`}))},children:"In an hour"})]})]}):"daily"===O.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(al,{word:"On",children:P.map(a=>{let c=O.days.includes(a);return(0,b.jsx)(ak,{picked:c,several:!0,"aria-label":ag[a-1],onClick:()=>at({days:c?O.days.filter(b=>b!==a):[...O.days,a].sort((a,b)=>a-b)}),children:X[a-1]},a)})}),(0,b.jsx)(al,{children:af.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>at({days:[...a.days]}),className:"h-6.5 rounded-full bg-muted px-2.5 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:a.label},a.label))}),(0,b.jsx)(al,{word:"At",children:(0,b.jsx)(ao,{value:O.time,onChange:a=>R({time:a}),onDone:()=>at({})})})]}):(0,b.jsxs)(al,{word:"Every",children:[(ah.includes(O.hours)?ah:[...ah,O.hours].sort((a,b)=>a-b)).map(a=>(0,b.jsx)(ak,{picked:a===O.hours,onClick:()=>at({hours:a}),className:"min-w-10 px-3",children:a},a)),(0,b.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"hours"})]})}),(0,b.jsx)(ap,{schedule:am,kind:O.kind})]})}),(0,b.jsxs)(aq,{label:"Job",htmlFor:"routine-request",children:[(0,b.jsx)(z.Textarea,{id:"routine-request",value:O.request,onChange:a=>R({request:a.target.value}),placeholder:"e.g. Go through the mail that came since the last run and draft replies to what needs one. Send nothing.",className:"min-h-28"}),(0,b.jsx)(aj,{children:"Handed to the bot as a new thread each time, with a line on how the last run ended. Nobody is there to ask, so say everything it needs."})]}),D&&(0,b.jsxs)("div",{className:"pt-1",children:[(0,b.jsx)("div",{className:"flex h-6 items-center",children:(0,b.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:"Runs"})}),0===D.runs.length?(0,b.jsx)("p",{className:"py-2 text-[13px] text-muted-foreground",children:"Not run yet."}):D.runs.map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>{var b;return b=a.id,void(E.useSettingsStore.getState().hide(),C.roomOpens.open(b))},className:"flex h-9 w-full items-center gap-3 border-t border-border/60 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,b.jsx)("span",{className:"w-28 shrink-0 font-mono text-[11px] text-muted-foreground tabular-nums",children:(0,F.whenOf)(a.updatedAt)}),(0,b.jsx)("span",{className:(0,I.cn)("min-w-0 flex-1 truncate","waiting"===a.status?I.WAITING_INK:"text-muted-foreground"),children:"running"===a.status?"Running now":a.outcome?(0,I.plainText)(a.outcome):"cancelled"===a.status?"Stopped":"No words"}),(0,b.jsx)(j.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground"})]},a.id))]})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-3 border-t border-border/60 px-5 py-3",children:[(0,b.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-4 text-muted-foreground",children:D||ar?"Starts while Thursday is running on this computer, whether or not a tab is open. A time that passed meanwhile starts once, not once for each.":`Still needs ${f=O,g=am,(h=[f.label.trim()?null:"a name",f.bot?null:"a bot",!g?"a time":ae(g)?"a time still ahead":null,f.request.trim()?null:"a job"].filter(a=>null!==a)).length>1?`${h.slice(0,-1).join(", ")} and ${h.at(-1)}`:h[0]??"nothing"}.`}),au&&(0,b.jsx)(r.Button,{size:"sm",onClick:()=>{if(!D)return;let a={};O.label.trim()&&O.label.trim()!==D.label&&(a.label=O.label.trim()),O.request.trim()&&O.request.trim()!==D.request&&(a.request=O.request.trim()),Object.keys(a).length&&as(a)},children:"Save"}),D?(0,b.jsxs)(r.Button,{variant:"outline",size:"sm",loading:_,disabled:aB,title:aB?"Its last run is still open":void 0,onClick:()=>void Y(D.id),children:[(0,b.jsx)(m.Play,{}),"Run now"]}):(0,b.jsx)(r.Button,{size:"sm",loading:U,disabled:!ar,onClick:()=>ar&&void T(ar),children:"Create"})]})]})})})})]})}let aj=({children:a})=>(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a});function ak({picked:a,several:c=!1,className:d,children:e,...f}){return(0,b.jsxs)("button",{type:"button","aria-pressed":a,className:(0,I.cn)("inline-flex h-8 items-center justify-center gap-1.5 rounded-full px-3.5 text-[13px] whitespace-nowrap outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",!a&&"text-foreground ring-1 ring-border ring-inset hover:bg-muted",a&&(c?"bg-brand/10 pl-2.5 font-medium text-brand ring-1 ring-brand/30 ring-inset":"bg-brand font-medium text-brand-foreground"),d),...f,children:[a&&c&&(0,b.jsx)(h.Check,{className:"size-3.5"}),e]})}function al({word:a,children:c}){return(0,b.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,b.jsx)("span",{className:"flex h-8 w-9 shrink-0 items-center text-[13px] text-muted-foreground",children:a}),(0,b.jsx)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",children:c})]})}function am(a){let b=R(`${a} 00:00`),d=(b.getTime()-R(`${ab(0)} 00:00`).getTime())/864e5;return(0,c.format)(b,d<7?"EEE d":"EEE, MMM d")}function an({value:a,onPick:c}){let d=(0,p.useRef)(null),e=[0,1,2,3].map(a=>ab(a)),f=()=>d.current?.showPicker();return(0,b.jsxs)(b.Fragment,{children:[e.map((d,e)=>(0,b.jsx)(ak,{picked:d===a,onClick:()=>c(d),children:0===e?"Today":1===e?"Tomorrow":am(d)},d)),!e.includes(a)&&(0,b.jsx)(ak,{picked:!0,onClick:f,children:am(a)}),(0,b.jsxs)("span",{className:"relative",children:[(0,b.jsx)(ak,{picked:!1,"aria-label":"Another day",onClick:f,className:"w-8 px-0",children:(0,b.jsx)(g,{className:"size-3.5"})}),(0,b.jsx)("input",{ref:d,type:"date",tabIndex:-1,"aria-hidden":!0,min:e[0],value:a,onChange:a=>a.target.value&&c(a.target.value),className:"pointer-events-none absolute inset-0 opacity-0"})]})]})}function ao({value:a,onChange:c,onDone:d}){return(0,b.jsx)(u.Input,{type:"time","aria-label":"Time of day",value:a,onChange:a=>c(a.target.value),onBlur:d,onClick:a=>a.currentTarget.showPicker?.(),className:"h-8.5 w-28 px-3 text-[15px] tabular-nums md:text-[15px] [&::-webkit-calendar-picker-indicator]:hidden"})}function ap({schedule:a,kind:c}){if(!a||ae(a))return(0,b.jsx)("p",{className:"text-xs text-destructive",children:a?"That time has passed. Pick a later one.":"daily"===c?"Pick a time and at least one day.":"Pick a time."});let e=function(a,b){if("once"===a.kind)return R(a.at);if("every"===a.kind)return new Date(b.getTime()+36e5*a.hours);let[c,d]=a.time.split(":").map(Number);for(let e=0;e<=7;e++){let f=new Date(b);f.setDate(f.getDate()+e),f.setHours(c,d,0,0);let g=0===f.getDay()?7:f.getDay();if(f>b&&a.days.includes(g))return f}return new Date(b.getTime()+864e5)}(a,new Date);return(0,b.jsxs)("p",{className:"flex items-start gap-2 text-[13px] leading-5",children:[(0,b.jsx)($.RoutineMark,{className:"mt-0.75 size-3.5 shrink-0 text-muted-foreground"}),(0,b.jsxs)("span",{className:"min-w-0",children:[Z(a),(0,b.jsxs)("span",{className:"text-muted-foreground",children:[" · ","once"===a.kind?`${(0,d.formatDistanceToNowStrict)(e,{addSuffix:!0})}, then it switches itself off`:`first start ${(0,F.whenOf)(e)}`]})]})]})}function aq({label:a,htmlFor:c,children:d}){return(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsx)("label",{htmlFor:c,className:"w-14 shrink-0 pt-2 font-mono text-xs text-muted-foreground",children:a}),(0,b.jsx)("div",{className:"min-w-0 flex-1 space-y-1.5",children:d})]})}a.s(["RoutineSetting",0,function(){let[a,c]=(0,p.useState)(null),{data:d,isLoading:e,error:f}=(0,H.useServerRoute)(q.queryKey.routines),{data:g}=(0,H.useServerRoute)(q.queryKey.bot),[h]=(0,G.useServerAction)(N,{onOk:()=>(0,H.revalidate)(q.queryKey.routines)});if(e)return(0,b.jsx)(D.SettingSkeleton,{rows:3});if(f)return(0,b.jsx)(D.SettingError,{message:f.message});let i=d??[],j=i.filter(a=>a.enabled).length,k=i.find(b=>b.id===a);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.SettingScreen,{footer:(0,b.jsxs)(D.SettingRailNote,{children:[i.length," set up · ",j," on",i.length>=A.ROUTINE.max&&` \xb7 ${A.ROUTINE.max} is the most`]}),children:(0,b.jsx)(D.SettingItems,{addRow:i.length<A.ROUTINE.max?{label:"New routine",onClick:()=>c("new")}:void 0,children:0===i.length?(0,b.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:'Nothing starts by itself yet. Tell Thursday what should — "every weekday at nine, go through my mail" — or make one here.'}):i.map(d=>(0,b.jsx)(_,{routine:d,bots:g,open:d.id===a,onOpen:()=>c(d.id),onSwitch:a=>h(d.id,{enabled:a})},d.id))})}),(0,b.jsx)(ai,{routine:"new"===a?"new":k??null,bots:g??[],onClose:()=>c(null),onMade:a=>c(a)})]})}],41014)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=features_routine_components_routine-setting_tsx_055fknz._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[703228,a=>{"use strict";var b=a.i(187924),c=a.i(263359),d=a.i(444080),e=a.i(707963),f=a.i(141146),g=a.i(998697),h=a.i(483138),i=a.i(69095),j=a.i(164831);let k={name:"frame",size:24,node:[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]};k.node;let l=(0,j.default)(k);var m=a.i(696732),n=a.i(403512),o=a.i(233540);let p={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]};p.node;let q=(0,j.default)(p);var r=a.i(951675);let s={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};s.node;let t=(0,j.default)(s);var u=a.i(572131),v=a.i(767561),w=a.i(340695),x=a.i(316474),y=a.i(205522),z=a.i(846991),A=a.i(446181),B=a.i(950463),C=a.i(280281),D=a.i(621958),E=a.i(546893),F=a.i(287702),G=a.i(619477),H=a.i(405050);let I=(0,H.createServerReference)("7f9c1ccb5f0167d50068f333fe81e30d40ca28400a",H.callServer,void 0,H.findSourceMapURL,"createSkillAction"),J=(0,H.createServerReference)("7f5038060b22c44e14ecd8bbd559e82fc273937344",H.callServer,void 0,H.findSourceMapURL,"deleteSkillAction"),K=(0,H.createServerReference)("7f8075f36d932a8b71d0ab7b738cf35cedd6ffa73a",H.callServer,void 0,H.findSourceMapURL,"setSkillDisabledAction"),L=(0,H.createServerReference)("7f4d556e93220ee9757636285716a370b169d4fad2",H.callServer,void 0,H.findSourceMapURL,"uploadSkillAction"),M=(0,H.createServerReference)("7ffa71f3aef2f5c2aa55a28bc887480ee7033be867",H.callServer,void 0,H.findSourceMapURL,"writeSkillFileAction");var N=a.i(954714);N.union([N.enum(["custom","default"]),N.templateLiteral(["kit:",N.string().regex(/^[\p{L}\p{N}_-]+$/u)]),N.templateLiteral(["own:",N.string().regex(/^[\p{L}\p{N}_-]+$/u)])]);let O=a=>"custom"===a||a.startsWith("own:"),P=N.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long").regex(/^[a-z0-9][a-z0-9_-]*$/i,"Use letters, numbers, dashes and underscores only"),Q=N.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long");N.object({name:Q,description:N.string().trim().min(1,"Description is required"),metadata:N.record(N.string(),N.unknown()).optional(),disabled:N.boolean().optional(),platforms:N.array(N.string()).optional()}).extend({name:P,content:N.string().trim().min(1,"Content is required")});var R=a.i(313237),S=a.i(759497),T=a.i(497895);let U={artifact:l,browser:m.Globe,computer:c.AppWindow,"find-skills":o.Search,"skill-creator":q};function V({skill:a}){let[c,e]=(0,R.useServerAction)(J,{onOk:()=>(0,S.revalidate)(v.queryKey.skills)}),[g]=(0,R.useServerAction)(K,{onOk:()=>(0,S.revalidate)(v.queryKey.skills)}),h=async()=>{await A.notify.confirm({title:`Delete ${a.name}?`,description:"Every file in this skill is deleted for good.",okText:"Delete",destructive:!0})&&c(a.source,a.dir)},i="default"===a.source&&U[a.dir]||d.BookMarked;return(0,b.jsxs)("div",{className:"group flex items-center transition-colors hover:bg-muted/50",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>{var c;return c=a,A.notify.component({className:"sm:max-w-4xl",renderer:({guard:a})=>(0,b.jsx)(W,{skill:c,guard:a})})},className:"flex min-w-0 flex-1 items-center gap-3 py-4 pl-4 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,b.jsx)("span",{className:(0,T.cn)("grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",a.disabled&&"opacity-45"),children:(0,b.jsx)(i,{className:"size-4"})}),(0,b.jsxs)("span",{className:(0,T.cn)("min-w-0 flex-1 space-y-0.5",a.disabled&&"opacity-45"),children:[(0,b.jsx)("span",{className:"block truncate text-sm font-medium",children:a.name}),(0,b.jsx)("span",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:a.description.trim().split(/(?<=[.。])\s|\n/)[0].trim()})]}),(0,b.jsx)(f.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 group-hover:text-foreground"})]}),(0,b.jsxs)("div",{className:"mr-4 ml-5 flex w-18 shrink-0 items-center justify-end gap-3",children:[(0,b.jsx)(C.Switch,{checked:!a.disabled,onCheckedChange:b=>g(a.source,a.dir,!b),"aria-label":`${a.name} on or off`,className:"shrink-0"}),O(a.source)?(0,b.jsx)(w.Button,{size:"icon-sm",variant:"ghost",loading:e,onClick:h,"aria-label":`Delete ${a.name}`,className:"shrink-0 text-muted-foreground",children:(0,b.jsx)(r.Trash2,{})}):(0,b.jsx)("span",{className:"size-7 shrink-0"})]})]})}function W({skill:a,guard:c}){let[d,f]=(0,u.useState)(""),[g,h]=(0,u.useState)("SKILL.md"),i=(0,u.useRef)(!1);(0,u.useEffect)(()=>c(()=>i.current),[c]);let j=async a=>{let b=d?`${d}/${a.name}`:a.name;"dir"===a.kind?f(b):b===g||(!i.current||await A.notify.confirm({title:"Discard your changes?",description:`What you wrote in ${g?.split("/").pop()} is not saved.`,okText:"Discard",destructive:!0}))&&(i.current=!1,h(b))};return(0,b.jsx)(G.SettingDialogContent,{title:a.name,description:(0,b.jsx)(X,{skill:a,path:g??d}),children:(0,b.jsxs)("div",{className:"flex h-[36rem] divide-x divide-border/60 overflow-hidden rounded-xl border border-border/60 bg-background",children:[(0,b.jsxs)("div",{className:"flex w-44 shrink-0 flex-col overflow-y-auto bg-muted/20 py-1",children:[d&&(0,b.jsxs)("button",{type:"button",onClick:()=>f(d.split("/").slice(0,-1).join("/")),className:"mx-1 mb-1 flex items-center gap-1 rounded-md px-2 py-1 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/50 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,b.jsx)(e.ChevronLeft,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:d.split("/").pop()})]}),(0,b.jsx)(Z,{source:a.source,dir:a.dir,path:d,current:g,onPick:j})]}),(0,b.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:g?(0,b.jsx)(_,{source:a.source,dir:a.dir,path:g,editable:O(a.source),onUnsaved:a=>{i.current=a}},g):(0,b.jsx)("p",{className:"p-6 text-sm text-muted-foreground/60",children:"Pick a file"})})]})})}function X({skill:a,path:c}){if(!a)return(0,b.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground/60",children:"Pick a skill"});let d=[a.name,...c.split("/").filter(Boolean)];return(0,b.jsx)("span",{className:"flex min-w-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:d.map((a,c)=>(0,b.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[c>0&&(0,b.jsx)(f.ChevronRight,{className:"size-3 shrink-0 opacity-50"}),(0,b.jsx)("span",{className:(0,T.cn)("truncate",c===d.length-1&&"text-foreground"),children:a})]},`${c}-${a}`))})}function Y({icon:a,label:c,active:d,hasChildren:e,onClick:g}){return(0,b.jsxs)("button",{type:"button",onClick:g,className:(0,T.cn)("mx-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",d?G.PICKED_ROW:"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[(0,b.jsx)("span",{className:"shrink-0 text-muted-foreground/70 [&>svg]:size-3",children:a}),(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate",children:c}),e&&(0,b.jsx)(f.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function Z({source:a,dir:c,path:d,current:e,onPick:f}){let{data:j,isLoading:k,error:l}=(0,S.useServerRoute)(v.queryKey.skillNode(a,c,d));return l?(0,b.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:l.message}):k||!j?(0,b.jsxs)("div",{className:"space-y-2 p-2",children:[(0,b.jsx)(B.Skeleton,{className:"h-5 w-full"}),(0,b.jsx)(B.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==j.kind?null:(0,b.jsxs)(b.Fragment,{children:[j.entries.map(a=>(0,b.jsx)(Y,{icon:"dir"===a.kind?(0,b.jsx)(i.Folder,{}):a.name.endsWith(".md")?(0,b.jsx)(h.FileText,{}):(0,b.jsx)(g.File,{}),label:a.name,hasChildren:"dir"===a.kind,active:(d?`${d}/${a.name}`:a.name)===e,onClick:()=>f(a)},a.name)),0===j.entries.length&&(0,b.jsx)("p",{className:"p-3 text-xs text-muted-foreground/60",children:"Empty folder"})]})}function $({content:a,description:c}){let d=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(a),e=c?.trim(),f=d?a.slice(d[0].length):a;return(0,b.jsxs)("div",{className:"min-w-0",children:[e&&(0,b.jsx)("p",{className:"border-b border-border/60 px-5 py-3 text-[13px] leading-relaxed text-muted-foreground",children:e}),(0,b.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,b.jsx)(z.Markdown,{children:f})})]})}function _({source:a,dir:c,path:d,editable:e,onUnsaved:f}){let[g,h]=(0,u.useState)(null),{data:i,isLoading:j,error:k}=(0,S.useServerRoute)(v.queryKey.skillNode(a,c,d)),l=null!==g&&(i?.kind!=="file"||g!==i.content);(0,u.useEffect)(()=>f?.(l),[l,f]);let[m,n]=(0,R.useServerAction)(M,{okMessage:"Saved",onOk:()=>{h(null),(0,S.revalidate)(v.queryKey.skills)}});if(k)return(0,b.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:k.message});if(j||!i)return(0,b.jsxs)("div",{className:"space-y-3 p-5",children:[(0,b.jsx)(B.Skeleton,{className:"h-5 w-2/3"}),(0,b.jsx)(B.Skeleton,{className:"h-4 w-full"}),(0,b.jsx)(B.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==i.kind)return null;let o=d.split("/").pop()??"";return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"sticky top-0 z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/90 px-5 py-2 font-mono text-[11px] text-muted-foreground backdrop-blur",children:[(0,b.jsx)("span",{className:"truncate",children:o}),(0,b.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)("span",{children:(0,T.formatBytes)(i.size)}),e&&null!==i.content&&null===g&&(0,b.jsxs)(w.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>h(i.content??""),children:[(0,b.jsx)(q,{}),"Edit"]}),null!==g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>h(null),children:"Cancel"}),(0,b.jsx)(w.Button,{size:"xs",className:"font-mono",loading:n,disabled:g===i.content,onClick:()=>m(a,c,d,g),children:"Save"})]})]})]}),null!==g?(0,b.jsx)(E.Textarea,{value:g,onChange:a=>h(a.target.value),spellCheck:!1,"aria-label":`${o} contents`,className:"min-h-120 resize-none rounded-none border-0 font-mono text-[13px] leading-relaxed shadow-none focus-visible:ring-0"}):null===i.content?(0,b.jsx)("p",{className:"px-5 py-4 text-sm text-muted-foreground/60",children:i.size>F.SKILL_FILES.inlineBytes?"Too long to show here — a bot still reads it from disk.":"Not a text file — a bot can still read it from disk."}):o.toLowerCase().endsWith(".md")?(0,b.jsx)($,{content:i.content,description:i.description}):(0,b.jsx)("pre",{className:"overflow-x-auto px-5 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-foreground/90",children:i.content})]})}function aa(){return A.notify.component({className:"sm:max-w-lg",renderer:({close:a,guard:c})=>(0,b.jsx)(ab,{onDone:a,guard:c})})}function ab({onDone:a,guard:c}){let[d,e]=(0,u.useState)("write"),[f,g]=(0,u.useState)(""),[h,i]=(0,u.useState)(""),[j,k]=(0,u.useState)(""),[l,m]=(0,u.useState)(null),[o,p]=(0,u.useState)(!1),q=(0,u.useRef)(null),r=(0,u.useRef)(!1);r.current=!!(f.trim()||h.trim()||j.trim()||l),(0,u.useEffect)(()=>c(()=>r.current),[c]);let s={errorMessage:!1,onOk:()=>{(0,S.revalidate)(v.queryKey.skills),a()}},[z,A,,B]=(0,R.useServerAction)(I,s),[C,H,,J]=(0,R.useServerAction)(L,s),K=A||H,M="write"===d?B:J,N=null!==l&&l.size>F.SKILL_FILES.uploadBytes,O=Math.round(F.SKILL_FILES.uploadBytes/1024/1024),P=!K&&("write"===d?f.trim()&&h.trim()&&j.trim():null!==l&&!N),Q=async()=>{if(!P)return;if("write"===d)return void z({name:f.trim(),description:h.trim(),content:j});if(!l)return;let a=new FormData;a.append("file",l),C(a)},U=a=>{let b=a?.[0]??null;b&&m(b)};return(0,b.jsxs)(G.SettingDialogContent,{title:"New skill",description:"Instructions a bot reads when a job calls for them.",footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w.Button,{variant:"ghost",onClick:a,children:"Cancel"}),(0,b.jsxs)(w.Button,{disabled:!P,loading:K,onClick:Q,children:[!K&&("write"===d?(0,b.jsx)(n.Plus,{}):(0,b.jsx)(t,{})),"write"===d?"Create":"Upload"]})]}),children:[(0,b.jsxs)(D.Tabs,{value:d,onValueChange:a=>e(a),children:[(0,b.jsxs)(D.TabsList,{className:"w-full",children:[(0,b.jsx)(D.TabsTrigger,{value:"write",children:"Write"}),(0,b.jsx)(D.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,b.jsxs)(D.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,b.jsxs)(x.Field,{children:[(0,b.jsx)(x.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,b.jsxs)(x.FieldContent,{children:[(0,b.jsx)(y.Input,{id:"skill-name",value:f,onChange:a=>g(a.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,b.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[F.PATHS.skills.custom,"/",f.trim()||"…","/SKILL.md"]})]})]}),(0,b.jsxs)(x.Field,{children:[(0,b.jsx)(x.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,b.jsx)(x.FieldContent,{children:(0,b.jsx)(y.Input,{id:"skill-description",value:h,onChange:a=>i(a.target.value),placeholder:"What it does, then when to use it — a bot reads this to decide"})})]}),(0,b.jsxs)(x.Field,{children:[(0,b.jsx)(x.FieldLabel,{htmlFor:"skill-content",children:"Content"}),(0,b.jsx)(E.Textarea,{id:"skill-content",value:j,onChange:a=>k(a.target.value),placeholder:"Markdown. The steps, the rules, the examples.",className:"min-h-40 resize-none font-mono text-xs"})]})]}),(0,b.jsxs)(D.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>q.current?.click(),onDragOver:a=>{a.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:a=>{a.preventDefault(),p(!1),U(a.dataTransfer.files)},className:(0,T.cn)("flex w-full flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-10 text-center outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",o?"border-foreground/60 bg-muted/60":"border-border hover:bg-muted/40"),children:[(0,b.jsx)(t,{className:"size-5 text-muted-foreground"}),l?(0,b.jsxs)("span",{className:"text-sm",children:[l.name,(0,b.jsxs)("span",{className:(0,T.cn)("ml-2 font-mono text-[11px]",N?"text-destructive":"text-muted-foreground"),children:[(0,T.formatBytes)(l.size),N&&` \xb7 over ${O} MB`]})]}):(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"Drop a file here, or click to choose"})]}),(0,b.jsx)("input",{ref:q,type:"file",accept:".md,.zip,.skill",className:"hidden",onChange:a=>U(a.target.files)}),(0,b.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,b.jsx)("p",{className:"font-medium text-foreground/80",children:"File requirements"}),(0,b.jsxs)("p",{children:["A ",(0,b.jsx)("span",{className:"font-mono",children:".md"})," file needs a YAML block with the skill's name and description."]}),(0,b.jsxs)("p",{children:["A ",(0,b.jsx)("span",{className:"font-mono",children:".zip"})," or"," ",(0,b.jsx)("span",{className:"font-mono",children:".skill"})," archive needs a SKILL.md inside — the rest of its folder comes along."]}),(0,b.jsxs)("p",{children:["Up to ",O," MB."]})]})]})]}),M&&(0,b.jsx)("p",{className:"font-mono text-xs text-destructive",children:M})]})}a.s(["SkillsSetting",0,function(){let[a,c]=(0,u.useState)(""),{data:d,isLoading:e,error:f}=(0,S.useServerRoute)(v.queryKey.skills),g=d??[];if(e)return(0,b.jsx)(G.SettingSkeleton,{rows:4});if(f)return(0,b.jsx)(G.SettingError,{message:f.message});let h=a.trim().toLowerCase(),i=g.filter(a=>!h||`${a.name} ${a.description}`.toLowerCase().includes(h)),j=g.filter(a=>!a.disabled).length,k=g.filter(a=>!a.disabled&&("default"===a.source||"custom"===a.source)).length,l=new Map;for(let a of i)a.bot&&l.set(a.bot,[...l.get(a.bot)??[],a]);return(0,b.jsxs)(G.SettingScreen,{footer:(0,b.jsxs)(G.SettingRailNote,{children:[g.filter(a=>!O(a.source)).length," ","shipped ·"," ",g.filter(a=>O(a.source)).length," ","installed"]}),children:[(0,b.jsx)(G.SettingToolbar,{count:`${j} on \xb7 ${g.length-j} off`,children:(0,b.jsx)(G.SettingFilter,{value:a,onChange:c,placeholder:"Filter skills"})}),(0,b.jsx)(G.SettingGroup,{label:"Custom",hint:"yours — added here · a Default skill of the same name wins",children:(0,b.jsx)(G.SettingItems,{addRow:{label:"Add skill",onClick:aa},children:i.filter(a=>"custom"===a.source).map(a=>(0,b.jsx)(V,{skill:a},`custom/${a.dir}`))})}),[...l].map(([a,c])=>(0,b.jsx)(G.SettingGroup,{label:`${a}'s own`,hint:`only ${a} reads these \xb7 what it found or wrote can be edited or deleted`,children:(0,b.jsx)(G.SettingItems,{children:c.map(a=>(0,b.jsx)(V,{skill:a},`${a.source}/${a.dir}`))})},a)),(0,b.jsx)(G.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,b.jsx)(G.SettingItems,{children:i.filter(a=>"default"===a.source).map(a=>(0,b.jsx)(V,{skill:a},`default/${a.dir}`))})}),k>F.PROMPT_CROWDED.skills&&(0,b.jsxs)(G.SettingNote,{children:[k," skills are on for every bot. Each is a line in every prompt a bot reads, and one more to look past when it picks."]})]})}],703228)}];
|
|
1
|
+
module.exports=[703228,a=>{"use strict";var b=a.i(187924),c=a.i(263359),d=a.i(444080),e=a.i(707963),f=a.i(141146),g=a.i(998697),h=a.i(483138),i=a.i(69095),j=a.i(164831);let k={name:"frame",size:24,node:[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]};k.node;let l=(0,j.default)(k);var m=a.i(696732),n=a.i(403512),o=a.i(233540);let p={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]};p.node;let q=(0,j.default)(p);var r=a.i(951675);let s={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};s.node;let t=(0,j.default)(s);var u=a.i(572131),v=a.i(767561),w=a.i(340695),x=a.i(316474),y=a.i(205522),z=a.i(846991),A=a.i(446181),B=a.i(950463),C=a.i(280281),D=a.i(621958),E=a.i(546893),F=a.i(287702),G=a.i(619477),H=a.i(405050);let I=(0,H.createServerReference)("7fe5f4bf6b964dd6f121b0dc282b504fa8a745e45a",H.callServer,void 0,H.findSourceMapURL,"createSkillAction"),J=(0,H.createServerReference)("7f34e023c0ea69d1f87a162e575f9b12af2dc06a8f",H.callServer,void 0,H.findSourceMapURL,"deleteSkillAction"),K=(0,H.createServerReference)("7f7901462a9e7444ab83b77d45a9821e80e7aa3af1",H.callServer,void 0,H.findSourceMapURL,"setSkillDisabledAction"),L=(0,H.createServerReference)("7f191ee382843c869a6b08c4af8a85c75b3adb62ec",H.callServer,void 0,H.findSourceMapURL,"uploadSkillAction"),M=(0,H.createServerReference)("7fd538676ffa8ee9b752e8fc5bbd57fa1f1b462886",H.callServer,void 0,H.findSourceMapURL,"writeSkillFileAction");var N=a.i(954714);N.union([N.enum(["custom","default"]),N.templateLiteral(["kit:",N.string().regex(/^[\p{L}\p{N}_-]+$/u)]),N.templateLiteral(["own:",N.string().regex(/^[\p{L}\p{N}_-]+$/u)])]);let O=a=>"custom"===a||a.startsWith("own:"),P=N.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long").regex(/^[a-z0-9][a-z0-9_-]*$/i,"Use letters, numbers, dashes and underscores only"),Q=N.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long");N.object({name:Q,description:N.string().trim().min(1,"Description is required"),metadata:N.record(N.string(),N.unknown()).optional(),disabled:N.boolean().optional(),platforms:N.array(N.string()).optional()}).extend({name:P,content:N.string().trim().min(1,"Content is required")});var R=a.i(313237),S=a.i(759497),T=a.i(497895);let U={artifact:l,browser:m.Globe,computer:c.AppWindow,"find-skills":o.Search,"skill-creator":q};function V({skill:a}){let[c,e]=(0,R.useServerAction)(J,{onOk:()=>(0,S.revalidate)(v.queryKey.skills)}),[g]=(0,R.useServerAction)(K,{onOk:()=>(0,S.revalidate)(v.queryKey.skills)}),h=async()=>{await A.notify.confirm({title:`Delete ${a.name}?`,description:"Every file in this skill is deleted for good.",okText:"Delete",destructive:!0})&&c(a.source,a.dir)},i="default"===a.source&&U[a.dir]||d.BookMarked;return(0,b.jsxs)("div",{className:"group flex items-center transition-colors hover:bg-muted/50",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>{var c;return c=a,A.notify.component({className:"sm:max-w-4xl",renderer:({guard:a})=>(0,b.jsx)(W,{skill:c,guard:a})})},className:"flex min-w-0 flex-1 items-center gap-3 py-4 pl-4 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,b.jsx)("span",{className:(0,T.cn)("grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",a.disabled&&"opacity-45"),children:(0,b.jsx)(i,{className:"size-4"})}),(0,b.jsxs)("span",{className:(0,T.cn)("min-w-0 flex-1 space-y-0.5",a.disabled&&"opacity-45"),children:[(0,b.jsx)("span",{className:"block truncate text-sm font-medium",children:a.name}),(0,b.jsx)("span",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:a.description.trim().split(/(?<=[.。])\s|\n/)[0].trim()})]}),(0,b.jsx)(f.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 group-hover:text-foreground"})]}),(0,b.jsxs)("div",{className:"mr-4 ml-5 flex w-18 shrink-0 items-center justify-end gap-3",children:[(0,b.jsx)(C.Switch,{checked:!a.disabled,onCheckedChange:b=>g(a.source,a.dir,!b),"aria-label":`${a.name} on or off`,className:"shrink-0"}),O(a.source)?(0,b.jsx)(w.Button,{size:"icon-sm",variant:"ghost",loading:e,onClick:h,"aria-label":`Delete ${a.name}`,className:"shrink-0 text-muted-foreground",children:(0,b.jsx)(r.Trash2,{})}):(0,b.jsx)("span",{className:"size-7 shrink-0"})]})]})}function W({skill:a,guard:c}){let[d,f]=(0,u.useState)(""),[g,h]=(0,u.useState)("SKILL.md"),i=(0,u.useRef)(!1);(0,u.useEffect)(()=>c(()=>i.current),[c]);let j=async a=>{let b=d?`${d}/${a.name}`:a.name;"dir"===a.kind?f(b):b===g||(!i.current||await A.notify.confirm({title:"Discard your changes?",description:`What you wrote in ${g?.split("/").pop()} is not saved.`,okText:"Discard",destructive:!0}))&&(i.current=!1,h(b))};return(0,b.jsx)(G.SettingDialogContent,{title:a.name,description:(0,b.jsx)(X,{skill:a,path:g??d}),children:(0,b.jsxs)("div",{className:"flex h-[36rem] divide-x divide-border/60 overflow-hidden rounded-xl border border-border/60 bg-background",children:[(0,b.jsxs)("div",{className:"flex w-44 shrink-0 flex-col overflow-y-auto bg-muted/20 py-1",children:[d&&(0,b.jsxs)("button",{type:"button",onClick:()=>f(d.split("/").slice(0,-1).join("/")),className:"mx-1 mb-1 flex items-center gap-1 rounded-md px-2 py-1 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/50 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,b.jsx)(e.ChevronLeft,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:d.split("/").pop()})]}),(0,b.jsx)(Z,{source:a.source,dir:a.dir,path:d,current:g,onPick:j})]}),(0,b.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:g?(0,b.jsx)(_,{source:a.source,dir:a.dir,path:g,editable:O(a.source),onUnsaved:a=>{i.current=a}},g):(0,b.jsx)("p",{className:"p-6 text-sm text-muted-foreground",children:"Pick a file"})})]})})}function X({skill:a,path:c}){if(!a)return(0,b.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:"Pick a skill"});let d=[a.name,...c.split("/").filter(Boolean)];return(0,b.jsx)("span",{className:"flex min-w-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:d.map((a,c)=>(0,b.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[c>0&&(0,b.jsx)(f.ChevronRight,{className:"size-3 shrink-0 opacity-50"}),(0,b.jsx)("span",{className:(0,T.cn)("truncate",c===d.length-1&&"text-foreground"),children:a})]},`${c}-${a}`))})}function Y({icon:a,label:c,active:d,hasChildren:e,onClick:g}){return(0,b.jsxs)("button",{type:"button",onClick:g,className:(0,T.cn)("mx-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",d?G.PICKED_ROW:"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[(0,b.jsx)("span",{className:"shrink-0 text-muted-foreground/70 [&>svg]:size-3",children:a}),(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate",children:c}),e&&(0,b.jsx)(f.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function Z({source:a,dir:c,path:d,current:e,onPick:f}){let{data:j,isLoading:k,error:l}=(0,S.useServerRoute)(v.queryKey.skillNode(a,c,d));return l?(0,b.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:l.message}):k||!j?(0,b.jsxs)("div",{className:"space-y-2 p-2",children:[(0,b.jsx)(B.Skeleton,{className:"h-5 w-full"}),(0,b.jsx)(B.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==j.kind?null:(0,b.jsxs)(b.Fragment,{children:[j.entries.map(a=>(0,b.jsx)(Y,{icon:"dir"===a.kind?(0,b.jsx)(i.Folder,{}):a.name.endsWith(".md")?(0,b.jsx)(h.FileText,{}):(0,b.jsx)(g.File,{}),label:a.name,hasChildren:"dir"===a.kind,active:(d?`${d}/${a.name}`:a.name)===e,onClick:()=>f(a)},a.name)),0===j.entries.length&&(0,b.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"Empty folder"})]})}function $({content:a,description:c}){let d=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(a),e=c?.trim(),f=d?a.slice(d[0].length):a;return(0,b.jsxs)("div",{className:"min-w-0",children:[e&&(0,b.jsx)("p",{className:"border-b border-border/60 px-5 py-3 text-[13px] leading-relaxed text-muted-foreground",children:e}),(0,b.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,b.jsx)(z.Markdown,{children:f})})]})}function _({source:a,dir:c,path:d,editable:e,onUnsaved:f}){let[g,h]=(0,u.useState)(null),{data:i,isLoading:j,error:k}=(0,S.useServerRoute)(v.queryKey.skillNode(a,c,d)),l=null!==g&&(i?.kind!=="file"||g!==i.content);(0,u.useEffect)(()=>f?.(l),[l,f]);let[m,n]=(0,R.useServerAction)(M,{okMessage:"Saved",onOk:()=>{h(null),(0,S.revalidate)(v.queryKey.skills)}});if(k)return(0,b.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:k.message});if(j||!i)return(0,b.jsxs)("div",{className:"space-y-3 p-5",children:[(0,b.jsx)(B.Skeleton,{className:"h-5 w-2/3"}),(0,b.jsx)(B.Skeleton,{className:"h-4 w-full"}),(0,b.jsx)(B.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==i.kind)return null;let o=d.split("/").pop()??"";return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"sticky top-0 z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/90 px-5 py-2 font-mono text-[11px] text-muted-foreground backdrop-blur",children:[(0,b.jsx)("span",{className:"truncate",children:o}),(0,b.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)("span",{children:(0,T.formatBytes)(i.size)}),e&&null!==i.content&&null===g&&(0,b.jsxs)(w.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>h(i.content??""),children:[(0,b.jsx)(q,{}),"Edit"]}),null!==g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>h(null),children:"Cancel"}),(0,b.jsx)(w.Button,{size:"xs",className:"font-mono",loading:n,disabled:g===i.content,onClick:()=>m(a,c,d,g),children:"Save"})]})]})]}),null!==g?(0,b.jsx)(E.Textarea,{value:g,onChange:a=>h(a.target.value),spellCheck:!1,"aria-label":`${o} contents`,className:"min-h-120 resize-none rounded-none border-0 font-mono text-[13px] leading-relaxed shadow-none focus-visible:ring-0"}):null===i.content?(0,b.jsx)("p",{className:"px-5 py-4 text-sm text-muted-foreground",children:i.size>F.SKILL_FILES.inlineBytes?"Too long to show here — a bot still reads it from disk.":"Not a text file — a bot can still read it from disk."}):o.toLowerCase().endsWith(".md")?(0,b.jsx)($,{content:i.content,description:i.description}):(0,b.jsx)("pre",{className:"overflow-x-auto px-5 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-foreground/90",children:i.content})]})}function aa(){return A.notify.component({className:"sm:max-w-lg",renderer:({close:a,guard:c})=>(0,b.jsx)(ab,{onDone:a,guard:c})})}function ab({onDone:a,guard:c}){let[d,e]=(0,u.useState)("write"),[f,g]=(0,u.useState)(""),[h,i]=(0,u.useState)(""),[j,k]=(0,u.useState)(""),[l,m]=(0,u.useState)(null),[o,p]=(0,u.useState)(!1),q=(0,u.useRef)(null),r=(0,u.useRef)(!1);r.current=!!(f.trim()||h.trim()||j.trim()||l),(0,u.useEffect)(()=>c(()=>r.current),[c]);let s={errorMessage:!1,onOk:()=>{(0,S.revalidate)(v.queryKey.skills),a()}},[z,A,,B]=(0,R.useServerAction)(I,s),[C,H,,J]=(0,R.useServerAction)(L,s),K=A||H,M="write"===d?B:J,N=null!==l&&l.size>F.SKILL_FILES.uploadBytes,O=Math.round(F.SKILL_FILES.uploadBytes/1024/1024),P=!K&&("write"===d?f.trim()&&h.trim()&&j.trim():null!==l&&!N),Q=async()=>{if(!P)return;if("write"===d)return void z({name:f.trim(),description:h.trim(),content:j});if(!l)return;let a=new FormData;a.append("file",l),C(a)},U=a=>{let b=a?.[0]??null;b&&m(b)};return(0,b.jsxs)(G.SettingDialogContent,{title:"New skill",description:"Instructions a bot reads when a job calls for them.",footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w.Button,{variant:"ghost",onClick:a,children:"Cancel"}),(0,b.jsxs)(w.Button,{disabled:!P,loading:K,onClick:Q,children:[!K&&("write"===d?(0,b.jsx)(n.Plus,{}):(0,b.jsx)(t,{})),"write"===d?"Create":"Upload"]})]}),children:[(0,b.jsxs)(D.Tabs,{value:d,onValueChange:a=>e(a),children:[(0,b.jsxs)(D.TabsList,{className:"w-full",children:[(0,b.jsx)(D.TabsTrigger,{value:"write",children:"Write"}),(0,b.jsx)(D.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,b.jsxs)(D.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,b.jsxs)(x.Field,{children:[(0,b.jsx)(x.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,b.jsxs)(x.FieldContent,{children:[(0,b.jsx)(y.Input,{id:"skill-name",value:f,onChange:a=>g(a.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,b.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[F.PATHS.skills.custom,"/",f.trim()||"…","/SKILL.md"]})]})]}),(0,b.jsxs)(x.Field,{children:[(0,b.jsx)(x.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,b.jsx)(x.FieldContent,{children:(0,b.jsx)(y.Input,{id:"skill-description",value:h,onChange:a=>i(a.target.value),placeholder:"What it does, then when to use it — a bot reads this to decide"})})]}),(0,b.jsxs)(x.Field,{children:[(0,b.jsx)(x.FieldLabel,{htmlFor:"skill-content",children:"Content"}),(0,b.jsx)(E.Textarea,{id:"skill-content",value:j,onChange:a=>k(a.target.value),placeholder:"Markdown. The steps, the rules, the examples.",className:"min-h-40 resize-none font-mono text-xs"})]})]}),(0,b.jsxs)(D.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>q.current?.click(),onDragOver:a=>{a.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:a=>{a.preventDefault(),p(!1),U(a.dataTransfer.files)},className:(0,T.cn)("flex w-full flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-10 text-center outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",o?"border-foreground/60 bg-muted/60":"border-border hover:bg-muted/40"),children:[(0,b.jsx)(t,{className:"size-5 text-muted-foreground"}),l?(0,b.jsxs)("span",{className:"text-sm",children:[l.name,(0,b.jsxs)("span",{className:(0,T.cn)("ml-2 font-mono text-[11px]",N?"text-destructive":"text-muted-foreground"),children:[(0,T.formatBytes)(l.size),N&&` \xb7 over ${O} MB`]})]}):(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"Drop a file here, or click to choose"})]}),(0,b.jsx)("input",{ref:q,type:"file",accept:".md,.zip,.skill",className:"hidden",onChange:a=>U(a.target.files)}),(0,b.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,b.jsx)("p",{className:"font-medium text-foreground/80",children:"File requirements"}),(0,b.jsxs)("p",{children:["A ",(0,b.jsx)("span",{className:"font-mono",children:".md"})," file needs a YAML block with the skill's name and description."]}),(0,b.jsxs)("p",{children:["A ",(0,b.jsx)("span",{className:"font-mono",children:".zip"})," or"," ",(0,b.jsx)("span",{className:"font-mono",children:".skill"})," archive needs a SKILL.md inside — the rest of its folder comes along."]}),(0,b.jsxs)("p",{children:["Up to ",O," MB."]})]})]})]}),M&&(0,b.jsx)("p",{className:"font-mono text-xs text-destructive",children:M})]})}a.s(["SkillsSetting",0,function(){let[a,c]=(0,u.useState)(""),{data:d,isLoading:e,error:f}=(0,S.useServerRoute)(v.queryKey.skills),g=d??[];if(e)return(0,b.jsx)(G.SettingSkeleton,{rows:4});if(f)return(0,b.jsx)(G.SettingError,{message:f.message});let h=a.trim().toLowerCase(),i=g.filter(a=>!h||`${a.name} ${a.description}`.toLowerCase().includes(h)),j=g.filter(a=>!a.disabled).length,k=g.filter(a=>!a.disabled&&("default"===a.source||"custom"===a.source)).length,l=new Map;for(let a of i)a.bot&&l.set(a.bot,[...l.get(a.bot)??[],a]);return(0,b.jsxs)(G.SettingScreen,{footer:(0,b.jsxs)(G.SettingRailNote,{children:[g.filter(a=>!O(a.source)).length," ","shipped ·"," ",g.filter(a=>O(a.source)).length," ","installed"]}),children:[(0,b.jsx)(G.SettingToolbar,{count:`${j} on \xb7 ${g.length-j} off`,children:(0,b.jsx)(G.SettingFilter,{value:a,onChange:c,placeholder:"Filter skills"})}),(0,b.jsx)(G.SettingGroup,{label:"Custom",hint:"yours — added here · a Default skill of the same name wins",children:(0,b.jsx)(G.SettingItems,{addRow:{label:"Add skill",onClick:aa},children:i.filter(a=>"custom"===a.source).map(a=>(0,b.jsx)(V,{skill:a},`custom/${a.dir}`))})}),[...l].map(([a,c])=>(0,b.jsx)(G.SettingGroup,{label:`${a}'s own`,hint:`only ${a} reads these \xb7 what it found or wrote can be edited or deleted`,children:(0,b.jsx)(G.SettingItems,{children:c.map(a=>(0,b.jsx)(V,{skill:a},`${a.source}/${a.dir}`))})},a)),(0,b.jsx)(G.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,b.jsx)(G.SettingItems,{children:i.filter(a=>"default"===a.source).map(a=>(0,b.jsx)(V,{skill:a},`default/${a.dir}`))})}),k>F.PROMPT_CROWDED.skills&&(0,b.jsxs)(G.SettingNote,{children:[k," skills are on for every bot. Each is a line in every prompt a bot reads, and one more to look past when it picks."]})]})}],703228)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=features_skills_components_skills-setting_tsx_1wtuuip._.js.map
|