thursday-agent 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +5 -1
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +5 -5
- package/.next/routes-manifest.json +27 -3
- package/.next/server/app/_global-error/page.js +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 +2 -2
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +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 +14 -14
- package/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +12 -12
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/artifact/route.js +3 -3
- package/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/bot/memory/files/route.js +10 -0
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -0
- package/.next/server/app/api/bot/memory/files/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/bot/memory/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/bot/memory/route/build-manifest.json +12 -0
- package/.next/server/app/api/bot/memory/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/bot/memory/route.js +14 -0
- package/.next/server/app/api/bot/memory/route.js.map +5 -0
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -0
- package/.next/server/app/api/bot/memory/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/bot/route.js +7 -7
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/task/[id]/route.js +9 -9
- package/.next/server/app/api/bot/task/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/task/route.js +8 -8
- package/.next/server/app/api/bot/task/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js +6 -6
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/events/route.js +4 -5
- package/.next/server/app/api/events/route.js.nft.json +1 -1
- package/.next/server/app/api/file/[...path]/route.js +3 -3
- package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/catalog/route.js +10 -9
- package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/credits/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/llm-model/credits/route/build-manifest.json +12 -0
- package/.next/server/app/api/llm-model/credits/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/llm-model/credits/route.js +16 -0
- package/.next/server/app/api/llm-model/credits/route.js.map +5 -0
- package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -0
- package/.next/server/app/api/llm-model/credits/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/llm-model/route.js +10 -8
- package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/subscription/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/llm-model/subscription/route/build-manifest.json +12 -0
- package/.next/server/app/api/llm-model/subscription/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/llm-model/subscription/route.js +15 -0
- package/.next/server/app/api/llm-model/subscription/route.js.map +5 -0
- package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -0
- package/.next/server/app/api/llm-model/subscription/route_client-reference-manifest.js +3 -0
- 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/app-paths-manifest.json +3 -0
- package/.next/server/app/api/memory/edit/route/build-manifest.json +12 -0
- package/.next/server/app/api/memory/edit/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/memory/edit/route.js +24 -0
- package/.next/server/app/api/memory/edit/route.js.map +5 -0
- package/.next/server/app/api/memory/edit/route.js.nft.json +1 -0
- package/.next/server/app/api/memory/{tidy → edit}/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/memory/route.js +7 -8
- package/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js +3 -3
- package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +3 -3
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/route.js +9 -7
- package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/skills/route.js +9 -7
- package/.next/server/app/api/thursday/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/tool-call/route.js +16 -15
- package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/route.js +4 -5
- package/.next/server/app/api/workspace/route.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +1 -1
- package/.next/server/app/artifact/[...path]/page.js +5 -6
- package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/favicon.ico/route.js +3 -4
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/favicon.ico.body +0 -0
- package/.next/server/app/page/server-reference-manifest.json +66 -77
- package/.next/server/app/page.js +11 -11
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +5 -1
- package/.next/server/chunks/[externals]__0dzuk6_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__01dkp4a._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__02va5wz._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__02xjoto._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__04q--0f._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__0bl-e63._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0ce8nf8._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0ffbg85._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0j7z0r3._.js +12 -0
- package/.next/server/chunks/[root-of-the-server]__0jq4ohy._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__0ls6_8y._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0pa2n68._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0q0vvt2._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1-ga0kh._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__11n256_._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__12cabg9._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1339jnv._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__15bjnu5._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__18_teo8._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1anc1p9._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ccon1w._.js +10 -0
- package/.next/server/chunks/[root-of-the-server]__1fizn31._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1llj3-b._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1orn-5b._.js +11 -0
- package/.next/server/chunks/[root-of-the-server]__1p8m3f4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1wa1k7r._.js +8 -0
- package/.next/server/chunks/{_1hzrsvg._.js → _0-73of8._.js} +6 -6
- package/.next/server/chunks/{_1cbk7ms._.js → _0-fjql4._.js} +10 -10
- package/.next/server/chunks/_00xh_q0._.js +27 -0
- package/.next/server/chunks/{_0y8is-s._.js → _03a0897._.js} +1 -1
- package/.next/server/chunks/{_0pppbb5._.js → _03kp0jp._.js} +166 -35
- package/.next/server/chunks/_051qh8u._.js +3 -0
- package/.next/server/chunks/{node_modules_next_04q-o58._.js → _05dla15._.js} +2 -2
- package/.next/server/chunks/_05h2cii._.js +1 -1
- package/.next/server/chunks/_0c9j6rb._.js +49 -0
- package/.next/server/chunks/_0fzqt2y._.js +74 -44
- package/.next/server/chunks/{_0kl37zl._.js → _0ioz3nd._.js} +1 -1
- package/.next/server/chunks/_0iwfby5._.js +3 -0
- package/.next/server/chunks/{_0hin38_._.js → _0khihjk._.js} +5 -5
- package/.next/server/chunks/_0mecv0f._.js +26 -0
- package/.next/server/chunks/_0mh8j4m._.js +3 -0
- package/.next/server/chunks/{_1icgbi8._.js → _0n74zsf._.js} +2 -2
- package/.next/server/chunks/_0obojvv._.js +3 -0
- package/.next/server/chunks/_0recufk._.js +49 -0
- package/.next/server/chunks/{_1t8fv7b._.js → _0rnf-6n._.js} +2 -2
- package/.next/server/chunks/_0sb7tlz._.js +3 -0
- package/.next/server/chunks/{_0jgm3b8._.js → _0u10wmw._.js} +6 -6
- package/.next/server/chunks/{_12nr4xc._.js → _0u4aiy2._.js} +2 -2
- package/.next/server/chunks/_0wp4le3._.js +1 -1
- package/.next/server/chunks/_0y5fg-x._.js +1 -1
- package/.next/server/chunks/_1230wbx._.js +10 -0
- package/.next/server/chunks/_12nheja._.js +3 -0
- package/.next/server/chunks/_13510xh._.js +3 -0
- package/.next/server/chunks/_15hq89o._.js +1 -1
- package/.next/server/chunks/_17l5ygt._.js +49 -0
- package/.next/server/chunks/{_0ks6_sg._.js → _18-1wcc._.js} +6 -6
- package/.next/server/chunks/_1_5mnq4._.js +18 -0
- package/.next/server/chunks/{_0tzfesa._.js → _1_9mjx-._.js} +1 -1
- package/.next/server/chunks/_1d0j961._.js +6 -0
- package/.next/server/chunks/_1d5zmy8._.js +1 -1
- package/.next/server/chunks/_1drgfx4._.js +18 -0
- package/.next/server/chunks/{_1skgy7b._.js → _1e48czp._.js} +5 -5
- package/.next/server/chunks/_1f46eie._.js +3 -0
- package/.next/server/chunks/_1h5_8sk._.js +3 -0
- package/.next/server/chunks/_1hdnxb7._.js +3 -0
- package/.next/server/chunks/_1j8k_j5._.js +3 -0
- package/.next/server/chunks/{_10qam6o._.js → _1kg70wc._.js} +5 -5
- package/.next/server/chunks/_1krd9rf._.js +3 -0
- package/.next/server/chunks/_1nc0eui._.js +11 -0
- package/.next/server/chunks/_1nula3v._.js +3 -0
- package/.next/server/chunks/_1pf4qe-._.js +3 -0
- package/.next/server/chunks/_1php4eq._.js +1 -1
- package/.next/server/chunks/_1qxheoa._.js +3 -0
- package/.next/server/chunks/_1x6kd1r._.js +3 -0
- package/.next/server/chunks/_1yuv4vp._.js +1 -1
- package/.next/server/chunks/_1zjrdag._.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_bot_memory_files_route_actions_1_xd_8f.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_bot_memory_route_actions_1a8xfr7.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_llm-model_credits_route_actions_0v424pb.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_llm-model_subscription_route_actions_0-udcm5.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_memory_edit_route_actions_02sfnmr.js +3 -0
- package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
- package/.next/server/chunks/features_0rpfxbk._.js +3 -0
- package/.next/server/chunks/features_1qf3cei._.js +3 -0
- package/.next/server/chunks/features_bot_0zt92oh._.js +3 -0
- package/.next/server/chunks/features_bot_bot_query_ts_12mgkl2._.js +1 -1
- package/.next/server/chunks/features_memory_1uqvksn._.js +6 -0
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0tf290y._.js → node_modules_consola_dist_chunks_prompt_mjs_0i7cvml._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0228f43._.js → node_modules_consola_dist_chunks_prompt_mjs_0icqaqw._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0ir-vo2._.js → node_modules_consola_dist_chunks_prompt_mjs_0j61-ma._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0otw8ef._.js → node_modules_consola_dist_chunks_prompt_mjs_0r28-sm._.js} +1 -1
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0v_7drq._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_11zjo-1._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1pycqsq._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1xoq2rl._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1y49572._.js +3 -0
- package/.next/server/chunks/ssr/[externals]__0dizgek._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__09q9med._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0_69wqr._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0hg5gib._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0i8ie7f._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0jsmmb-._.js → [root-of-the-server]__0mz33a7._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0tbkdlx._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0vnmv-s._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0f6s48x._.js → [root-of-the-server]__0xpcv9w._.js} +3 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0xtssj3._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0zkv7z_._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__10-dz5o._.js +57 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__15_uhip._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__16jc196._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1cyjywu._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1eh7hid._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1gtlw6v._.js +43 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1mzi-ju._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1ox7hbk._.js +4 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1pduf5n._.js +3 -0
- package/.next/server/chunks/ssr/{_1mznrxk._.js → _001_ms1._.js} +3 -3
- package/.next/server/chunks/ssr/_01_6m32._.js +3 -0
- package/.next/server/chunks/ssr/_01n3o0m._.js +3 -0
- package/.next/server/chunks/ssr/_07uchnc._.js +3 -0
- package/.next/server/chunks/ssr/_0ap2fzn._.js +3 -0
- package/.next/server/chunks/ssr/_0c-ql2m._.js +3 -0
- package/.next/server/chunks/ssr/_0h42fze._.js +3 -0
- package/.next/server/chunks/ssr/_0h7zdni._.js +1 -1
- package/.next/server/chunks/ssr/_0i_6q1w._.js +41 -0
- package/.next/server/chunks/ssr/_0kbkmar._.js +3 -0
- package/.next/server/chunks/ssr/_0lu1n_x._.js +3 -0
- package/.next/server/chunks/ssr/{_077-g6s._.js → _0mb8zc8._.js} +3 -3
- package/.next/server/chunks/ssr/_0mo2w06._.js +3 -0
- package/.next/server/chunks/ssr/{_13punpm._.js → _0q0zan6._.js} +2 -2
- package/.next/server/chunks/ssr/{_0gd4vaa._.js → _0u2jv_x._.js} +94 -58
- package/.next/server/chunks/ssr/_0y0tiht._.js +4 -0
- package/.next/server/chunks/ssr/_0zhoc3r._.js +3 -0
- package/.next/server/chunks/ssr/_1-teee5._.js +3 -3
- package/.next/server/chunks/ssr/_13fke0x._.js +3 -0
- package/.next/server/chunks/ssr/{_0q_2f2x._.js → _13z3f85._.js} +2 -2
- package/.next/server/chunks/ssr/_14_lw10._.js +3 -0
- package/.next/server/chunks/ssr/_15j2_8f._.js +3 -0
- package/.next/server/chunks/ssr/{_0lc_7c8._.js → _1eoqg_g._.js} +2 -2
- package/.next/server/chunks/ssr/_1sji22n._.js +3 -0
- package/.next/server/chunks/ssr/_1spzm8z._.js +3 -0
- package/.next/server/chunks/ssr/{_19_o9d-._.js → _1vi_uo7._.js} +2 -2
- package/.next/server/chunks/ssr/_1vyd1ji._.js +3 -0
- package/.next/server/chunks/ssr/_1xvgn77._.js +3 -0
- package/.next/server/chunks/ssr/_20kd_n0._.js +42 -0
- package/.next/server/chunks/ssr/features_bot_1s_-2vj._.js +3 -0
- package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +1 -1
- package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
- package/.next/server/chunks/ssr/lib_date-like_ts_02is0pw._.js +3 -0
- package/.next/server/chunks/ssr/lib_realtime_12wg_dd._.js +27 -0
- package/.next/server/chunks/ssr/lib_realtime_15h_v1v._.js +27 -0
- package/.next/server/chunks/ssr/{node_modules_1d-is1o._.js → node_modules_063xwpp._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1ub40gk._.js → node_modules_0bvraul._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1nhw9qg._.js → node_modules_0eu1va6._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0xwx4u-._.js → node_modules_0h50b8n._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_043-236._.js → node_modules_0h5hnr1._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1t0y5jt._.js → node_modules_0h7u60n._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1k29j1j._.js → node_modules_0lm7_vm._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_16i4o_3._.js → node_modules_0mwym0g._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1y8_3vg._.js → node_modules_0rjg6t1._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_0x3-ply._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_108wd2o._.js → node_modules_0y_cded._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1jatz7w._.js → node_modules_0z5tsu8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0ls96je._.js → node_modules_0zp9r92._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_06kvvuo._.js → node_modules_1-hc6uv._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1_588_4._.js → node_modules_113tz0l._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0ipn1ho._.js → node_modules_124bue5._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_17bwo43._.js +55 -0
- package/.next/server/chunks/ssr/{node_modules_0_j7-g4._.js → node_modules_1_n3ztw._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_20ynonm._.js → node_modules_1bc7gu8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1hn_sd5._.js → node_modules_1bgb6-f._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0bue6gy._.js → node_modules_1h4a4pp._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0fbw5-u._.js → node_modules_1i7u1ia._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1ee8gav._.js → node_modules_1juq3hs._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0_fvxnt._.js → node_modules_1l0qtdu._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_13f2md6._.js → node_modules_1t9cyee._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0y2-av4._.js → node_modules_1uuj9x1._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_00d6675._.js → node_modules_1vqb6po._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1v0077l._.js → node_modules_1xx28h1._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_092s8nx._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0d3skpl._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1nvexgu._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0i44kk5._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_@vercel_oidc_dist_0qe30a_._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_consola_dist_chunks_prompt_mjs_05cwqv2._.js +47 -0
- package/.next/server/chunks/ssr/{node_modules_next_dist_0w6mzq5._.js → node_modules_next_dist_0drixxt._.js} +4 -4
- package/.next/server/chunks/ssr/node_modules_next_dist_1n3w9lb._.js +2 -2
- package/.next/server/instrumentation.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +67 -78
- package/.next/static/chunks/{31ttnjt6g35a0.js → 0ev4hyghq0mbb.js} +1 -1
- package/.next/static/chunks/0r5qcctujhxli.js +1 -0
- package/.next/static/chunks/0tmgrnlje14-s.js +3 -0
- package/.next/static/chunks/0x79tx04dxbpp.js +1 -0
- package/.next/static/chunks/0xzgvc0fkdb6t.js +1 -0
- package/.next/static/chunks/10teww7wt-f6h.js +1 -0
- package/.next/static/chunks/14hgtsjg-kael.css +1 -0
- package/.next/static/chunks/17donp69y4do7.js +40 -0
- package/.next/static/chunks/1dkjg87pxk0n9.js +28 -0
- package/.next/static/chunks/1ekc7ul556kbl.js +1 -0
- package/.next/static/chunks/{1khakdu_iuedc.js → 1grhjo7a5a0_-.js} +1 -1
- package/.next/static/chunks/1kq8h8wi_e0bc.js +53 -0
- package/.next/static/chunks/1okqiww3pnwka.js +1 -0
- package/.next/static/chunks/26-pr2c9ro222.js +1 -0
- package/.next/static/chunks/{2ihkf6l2jowo9.js → 280t0_e99i276.js} +3 -3
- package/.next/static/chunks/28cizcdaabd4h.js +1 -0
- package/.next/static/chunks/2a0k6jlq0_v1u.js +2 -0
- package/.next/static/chunks/2fzs9fm8yarvq.js +1 -0
- package/.next/static/chunks/2h0sd2vumhb15.js +1 -0
- package/.next/static/chunks/2hw2f6zmt7fmt.js +1 -0
- package/.next/static/chunks/2t4vhi3m8ahya.js +1 -0
- package/.next/static/chunks/2tigdtz3dpcy8.js +1 -0
- package/.next/static/chunks/3111pj5wnjgos.js +1 -0
- package/.next/static/chunks/3786h5vayt80-.js +28 -0
- package/.next/static/chunks/{3aquirz5h71da.js → 3agpgkwaa321p.js} +1 -1
- package/.next/static/chunks/3cfi_q6d_wtci.js +1 -0
- package/.next/static/chunks/3ok9_x74rip3v.js +1 -0
- package/.next/static/chunks/3xk7yqgomx7yq.js +1 -0
- package/.next/static/chunks/3xpbkl66ssib5.js +38 -0
- package/.next/static/media/favicon.37o1pjldwi2uc.ico +0 -0
- package/README.md +6 -4
- package/app/api/bot/memory/files/route.ts +14 -0
- package/app/api/bot/memory/route.ts +5 -0
- package/app/api/events/app-event.client.ts +24 -0
- package/app/api/events/app-event.server.ts +45 -0
- package/app/api/events/app-event.ts +42 -0
- package/app/api/llm-model/catalog/route.ts +12 -0
- package/app/api/llm-model/credits/route.ts +11 -0
- package/app/api/llm-model/route.ts +26 -0
- package/app/api/llm-model/subscription/route.ts +11 -0
- package/app/api/memory/edit/route.ts +7 -0
- package/app/api/memory/route.ts +21 -0
- package/app/api/query-key.ts +159 -0
- package/app/api/thursday/tool-call/route.ts +67 -0
- package/bin/thursday.mjs +3 -0
- package/components/ui/button-group.tsx +45 -0
- package/components/ui/custom-icon.tsx +259 -0
- package/components/ui/dropdown-menu.tsx +271 -0
- package/components/ui/folded-text.tsx +68 -0
- package/components/ui/input-group.tsx +157 -0
- package/components/ui/json-view.tsx +240 -0
- package/components/ui/shiny-text.tsx +55 -0
- package/components/ui/text-type.tsx +213 -0
- package/components/ui/theme-sync.tsx +9 -0
- package/database/migrations/{20260908030742_rainy_marvel_zombies → 20260910173049_numerous_spirit}/migration.sql +30 -33
- package/database/migrations/{20260908030742_rainy_marvel_zombies → 20260910173049_numerous_spirit}/snapshot.json +124 -145
- package/database/migrations/20260911030320_opposite_jack_power/migration.sql +1 -0
- package/database/migrations/20260911030320_opposite_jack_power/snapshot.json +1158 -0
- package/docs/how-it-works.md +59 -0
- package/docs/images/keeps-going.png +0 -0
- package/docs/images/task-thread.png +0 -0
- package/docs/images/two-minds.png +0 -0
- package/features/ai/chatgpt.ts +617 -0
- package/features/ai/components/chatgpt-sign-in.tsx +66 -0
- package/features/ai/components/model-picker.tsx +17 -1
- package/features/ai/components/provider-icon.tsx +1 -0
- package/features/ai/load-tools.ts +105 -39
- package/features/ai/model.schema.ts +232 -34
- package/features/ai/model.ts +169 -24
- package/features/ai/prompts/bot.prompt.ts +245 -59
- package/features/ai/prompts/memory-edit.prompt.ts +33 -0
- package/features/ai/prompts/prompt-helper.ts +75 -30
- package/features/ai/prompts/thursday.prompt.ts +42 -17
- package/features/ai/tools/bot.tool.ts +32 -30
- package/features/ai/tools/connected.ts +17 -4
- package/features/ai/tools/mcp.tool.ts +5 -5
- package/features/ai/tools/memory.tool.ts +142 -74
- package/features/ai/tools/search.tool.ts +136 -47
- package/features/ai/tools/studio.tool.ts +5 -5
- package/features/ai/tools/tool-name.ts +2 -3
- package/features/ai/tools/workspace.tool.ts +33 -4
- package/features/bot/bot.action.ts +24 -7
- package/features/bot/bot.memory.ts +89 -0
- package/features/bot/bot.query.ts +41 -6
- package/features/bot/bot.run.ts +516 -210
- package/features/bot/bot.runner.ts +463 -93
- package/features/bot/bot.schema.ts +84 -7
- package/features/bot/bot.seed.ts +89 -16
- package/features/bot/components/bot-mark.tsx +122 -20
- package/features/bot/components/bot-room.tsx +519 -391
- package/features/bot/components/bot-setting.tsx +832 -341
- package/features/bot/components/bot-tool.tsx +2 -6
- package/features/bot/components/mark-palette.tsx +54 -0
- package/features/bot/components/path-chips.tsx +1 -1
- package/features/bot/components/task-badge.tsx +26 -6
- package/features/bot/components/task-reply.tsx +22 -33
- package/features/bot/components/task-setting.tsx +20 -17
- package/features/bot/task.query.ts +233 -33
- package/features/bot/task.store.ts +53 -9
- package/features/config/components/config-setting.tsx +265 -34
- package/features/config/components/models-badge.tsx +42 -0
- package/features/config/config.action.ts +12 -0
- package/features/config/config.const.ts +38 -2
- package/features/connectors/mcp.manager.ts +10 -2
- package/features/intro/components/intro.tsx +47 -46
- package/features/memory/components/memory-edit.tsx +338 -0
- package/features/memory/components/memory-setting.tsx +86 -79
- package/features/memory/memory.action.ts +3 -43
- package/features/memory/memory.edit.ts +87 -0
- package/features/memory/memory.query.ts +33 -44
- package/features/memory/memory.schema.ts +50 -97
- package/features/settings/components/settings.tsx +2 -0
- package/features/settings/settings.alert.ts +3 -1
- package/features/skills/components/skills-setting.tsx +9 -1
- package/features/thursday/components/ascii-orb.tsx +106 -90
- package/features/thursday/components/boot.tsx +7 -0
- package/features/thursday/components/call-log.tsx +219 -92
- package/features/thursday/components/face.tsx +6 -4
- package/features/thursday/components/tab-state.tsx +97 -0
- package/features/thursday/components/thursday-mark.tsx +4 -1
- package/features/thursday/components/thursday-setting.tsx +17 -47
- package/features/thursday/components/thursday.tsx +208 -95
- package/features/thursday/thursday.action.ts +12 -17
- package/features/thursday/thursday.query.ts +61 -70
- package/features/thursday/thursday.schema.ts +20 -7
- package/features/thursday/tool-line.ts +85 -11
- package/features/thursday/use-thursday.ts +86 -59
- package/features/workspace/components/file-view.tsx +4 -2
- package/features/workspace/workspace.ts +230 -13
- package/hooks/use-draft.ts +37 -0
- package/hooks/use-hotkey.ts +105 -0
- package/hooks/use-object-state.ts +51 -0
- package/hooks/use-on-visible.ts +72 -0
- package/hooks/use-theme.ts +106 -0
- package/hooks/use-wake-word.ts +262 -0
- package/lib/limits.ts +1 -1
- package/lib/oauth-page.ts +27 -0
- package/lib/realtime/openai.ts +2 -2
- package/lib/realtime/realtime.driver.ts +34 -1
- package/lib/realtime/realtime.protocol.ts +7 -1
- package/lib/realtime/realtime.tap.ts +122 -0
- package/lib/sandbox.ts +60 -29
- package/lib/tokens.ts +19 -0
- package/package.json +1 -1
- package/skills/browser/SKILL.md +55 -34
- package/.next/server/app/api/memory/tidy/route/app-paths-manifest.json +0 -3
- package/.next/server/app/api/memory/tidy/route.js +0 -23
- package/.next/server/app/api/memory/tidy/route.js.nft.json +0 -1
- package/.next/server/chunks/[root-of-the-server]__019dx9f._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__02_2sm-._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__02kt8yn._.js +0 -10
- package/.next/server/chunks/[root-of-the-server]__05luceg._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__06t77t4._.js +0 -11
- package/.next/server/chunks/[root-of-the-server]__0bed6hu._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__0dupqt7._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0h59di-._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0j_n5l3._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0le4d-p._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0m8ywyo._.js +0 -10
- package/.next/server/chunks/[root-of-the-server]__0nfuugi._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0phdgco._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__0qjqtwo._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0t_dqaj._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0wvgrsl._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0yk6s3w._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0z3gelv._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__10qshki._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__113fqg5._.js +0 -12
- package/.next/server/chunks/[root-of-the-server]__11w_7_3._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__16thabu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__173nhwf._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__1_0q_9w._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1_aoyr9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1bqhuh9._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__1cqizfq._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__1dow0bz._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1e-ci13._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1gmn1cs._.js +0 -10
- package/.next/server/chunks/[root-of-the-server]__1lr7j9t._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__1mzp_el._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1txedx6._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__1u_qvc7._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1zgpz1w._.js +0 -3
- package/.next/server/chunks/_012yhfm._.js +0 -39
- package/.next/server/chunks/_06mxlgn._.js +0 -3
- package/.next/server/chunks/_07rtlxv._.js +0 -3
- package/.next/server/chunks/_0a351g7._.js +0 -6
- package/.next/server/chunks/_0kjjmag._.js +0 -3
- package/.next/server/chunks/_0zmestz._.js +0 -55
- package/.next/server/chunks/_0zuzmt_._.js +0 -39
- package/.next/server/chunks/_12bbv5i._.js +0 -96
- package/.next/server/chunks/_15q1pig._.js +0 -3
- package/.next/server/chunks/_1drv2et._.js +0 -36
- package/.next/server/chunks/_1ic3bew._.js +0 -5
- package/.next/server/chunks/_1mxn_lb._.js +0 -3
- package/.next/server/chunks/_1uj4_io._.js +0 -10
- package/.next/server/chunks/_1x7p319._.js +0 -6
- package/.next/server/chunks/_1yldgo4._.js +0 -55
- package/.next/server/chunks/_2050gwn._.js +0 -255
- package/.next/server/chunks/_next-internal_server_app_api_memory_tidy_route_actions_0_cfuom.js +0 -3
- package/.next/server/chunks/features_0scmr4i._.js +0 -3
- package/.next/server/chunks/features_bot_task_query_ts_11xuzl3._.js +0 -3
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0vorg6w._.js +0 -3
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_0ykklj0._.js +0 -3
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1ryg3wh._.js +0 -3
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1vmaq9f._.js +0 -3
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1vwbnq_._.js +0 -3
- package/.next/server/chunks/ssr/[externals]_node_crypto_1kn79-7._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__01id-v3._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0b-0i32._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0dfwvr4._.js +0 -4
- package/.next/server/chunks/ssr/[root-of-the-server]__0iuoa-r._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1-mnhyd._.js +0 -90
- package/.next/server/chunks/ssr/[root-of-the-server]__185grso._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1minz8_._.js +0 -3
- package/.next/server/chunks/ssr/_0-mc7ro._.js +0 -3
- package/.next/server/chunks/ssr/_01p5r6-._.js +0 -3
- package/.next/server/chunks/ssr/_09-0k3z._.js +0 -3
- package/.next/server/chunks/ssr/_0ay6b01._.js +0 -3
- package/.next/server/chunks/ssr/_0cvjbuz._.js +0 -3
- package/.next/server/chunks/ssr/_0fafgvl._.js +0 -3
- package/.next/server/chunks/ssr/_0j4v8of._.js +0 -3
- package/.next/server/chunks/ssr/_0l81bzy._.js +0 -3
- package/.next/server/chunks/ssr/_0nso8tp._.js +0 -3
- package/.next/server/chunks/ssr/_0sf1isi._.js +0 -3
- package/.next/server/chunks/ssr/_0ti51xc._.js +0 -3
- package/.next/server/chunks/ssr/_0y84qo6._.js +0 -3
- package/.next/server/chunks/ssr/_10uvw3l._.js +0 -3
- package/.next/server/chunks/ssr/_1dcxzqe._.js +0 -3
- package/.next/server/chunks/ssr/_1e-dgz0._.js +0 -4
- package/.next/server/chunks/ssr/_1fq7zgb._.js +0 -3
- package/.next/server/chunks/ssr/_1jbv7m1._.js +0 -3
- package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +0 -4
- package/.next/server/chunks/ssr/features_config_components_14jqgy4._.js +0 -3
- package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +0 -4
- package/.next/server/chunks/ssr/lib_realtime_0aetuyp._.js +0 -24
- package/.next/server/chunks/ssr/lib_realtime_18k_aj-._.js +0 -24
- package/.next/server/chunks/ssr/node_modules_zod_v4_classic_errors_05xv7vp.js +0 -3
- package/.next/server/chunks/ssr/node_modules_zod_v4_classic_external_15fmmz3.js +0 -55
- package/.next/static/chunks/0f9sq-7q_yxyl.js +0 -1
- package/.next/static/chunks/0tydnn2kybibk.js +0 -1
- package/.next/static/chunks/0yysv1gzin17t.js +0 -1
- package/.next/static/chunks/1fr5m75pwtyic.js +0 -1
- package/.next/static/chunks/1gy3bbv7usnjo.js +0 -1
- package/.next/static/chunks/1keib_gt066gc.js +0 -1
- package/.next/static/chunks/1ytnip8wdng93.js +0 -1
- package/.next/static/chunks/21rk8w7bda-su.js +0 -1
- package/.next/static/chunks/247d-r95j8xs0.js +0 -1
- package/.next/static/chunks/28g42tw8tsvhd.js +0 -1
- package/.next/static/chunks/29gyb3nubj51j.js +0 -53
- package/.next/static/chunks/2cwjgkt_hoyhj.js +0 -22
- package/.next/static/chunks/2fq_86jvq9ymq.js +0 -2
- package/.next/static/chunks/2rbf1fpd8n80-.js +0 -22
- package/.next/static/chunks/2ukj8k69y89um.js +0 -1
- package/.next/static/chunks/2uxum7qbyeyxd.js +0 -1
- package/.next/static/chunks/2wngeetfnzxkp.js +0 -2
- package/.next/static/chunks/388-t2v72jh39.css +0 -1
- package/.next/static/chunks/3fqvc0cg-atq_.js +0 -1
- package/.next/static/chunks/3p4egvfjxpatb.js +0 -1
- package/.next/static/chunks/3qe1w1ei-huhl.js +0 -1
- package/.next/static/chunks/3xxa2j56-f3nm.js +0 -3
- package/.next/static/chunks/3y40riycdip-i.js +0 -1
- package/.next/static/chunks/45a6zbtkelph9.js +0 -1
- package/.next/static/media/favicon.2vob68tjqpejf.ico +0 -0
- package/features/ai/prompts/memory-tidy.prompt.ts +0 -123
- package/features/ai/tools/tidy.tool.ts +0 -22
- package/features/memory/components/memory-tidy.tsx +0 -395
- package/features/memory/memory.tidy.ts +0 -332
- package/features/memory/tidy.query.ts +0 -135
- package/features/thursday/use-call-title.ts +0 -31
- /package/.next/server/app/api/{memory/tidy → bot/memory/files}/route/build-manifest.json +0 -0
- /package/.next/server/app/api/{memory/tidy → bot/memory/files}/route/server-reference-manifest.json +0 -0
- /package/.next/server/app/api/{memory/tidy → bot/memory/files}/route.js.map +0 -0
- /package/.next/static/{X34BUd9bfdH27ripuwwBm → x1cCqY0kWpR_VcYx_lWO5}/_buildManifest.js +0 -0
- /package/.next/static/{X34BUd9bfdH27ripuwwBm → x1cCqY0kWpR_VcYx_lWO5}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{X34BUd9bfdH27ripuwwBm → x1cCqY0kWpR_VcYx_lWO5}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[528790,e=>e.a(async(t,i)=>{try{let u;var s=e.i(902157),r=e.i(750227),n=e.i(418520),l=e.i(219756),a=e.i(687388),o=t([n,l]);[n,l]=o.then?(await o)():o;let c=a.DB_FILE_NAME.replace(/^file:/,"");(0,s.mkdirSync)((0,r.dirname)(c),{recursive:!0});let d=globalThis.__dbClient??=((u=(0,n.createClient)({url:a.DB_FILE_NAME})).execute("PRAGMA foreign_keys = ON"),u.execute("PRAGMA journal_mode = WAL"),u.execute("PRAGMA busy_timeout = 5000"),u),h=(0,l.drizzle)({client:d});e.s(["database",0,h]),i()}catch(e){i(e)}},!1),613240,e=>{"use strict";var t=e.i(646683),i=e.i(201440),s=e.i(616918),r=e.i(937540),n=e.i(380568),l=e.i(75799);let a=(0,l.sqliteTable)("bot",{name:(0,n.text)("name").primaryKey(),description:(0,n.text)("description").notNull(),systemPrompt:(0,n.text)("system_prompt"),icon:(0,n.text)("icon",{mode:"json"}).$type(),provider:(0,n.text)("provider").$type(),model:(0,n.text)("model"),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),o=(0,l.sqliteTable)("mcp_server",{name:(0,n.text)("name").primaryKey(),config:(0,n.text)("config",{mode:"json"}).notNull().$type(),toolsSyncedAt:(0,r.int)("tools_synced_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),lastError:(0,n.text)("last_error"),oauth:(0,n.text)("oauth",{mode:"json"}).$type(),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),u=(0,l.sqliteTable)("mcp_tool",{id:(0,r.int)("id").primaryKey({autoIncrement:!0}),serverName:(0,n.text)("server_name").notNull().references(()=>o.name,{onDelete:"cascade"}),name:(0,n.text)("name").notNull(),description:(0,n.text)("description"),inputSchema:(0,n.text)("input_schema",{mode:"json"}).$type(),outputSchema:(0,n.text)("output_schema",{mode:"json"}).$type()},e=>[(0,s.unique)("uq_mcp_tool_server_name").on(e.serverName,e.name)]),c=(0,l.sqliteTable)("bot_mcp_tool",{botName:(0,n.text)().notNull().references(()=>a.name,{onDelete:"cascade"}),toolId:(0,r.int)("tool_id").notNull().references(()=>u.id,{onDelete:"cascade"})},e=>[(0,i.primaryKey)({columns:[e.botName,e.toolId]})]),d=(0,l.sqliteTable)("task",{id:(0,n.text)("id").primaryKey(),bot:(0,n.text)("bot").notNull(),label:(0,n.text)("label").notNull(),request:(0,n.text)("request").notNull(),status:(0,n.text)("status").notNull().$type(),outcome:(0,n.text)("outcome"),pending:(0,n.text)("pending",{mode:"json"}).$type(),reported:(0,r.int)("reported",{mode:"boolean"}).notNull().default(!1),callId:(0,n.text)("call_id"),inputTokens:(0,r.int)("input_tokens").notNull().default(0),outputTokens:(0,r.int)("output_tokens").notNull().default(0),contextTokens:(0,r.int)("context_tokens").notNull().default(0),contextBudget:(0,r.int)("context_budget").notNull().default(0),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),updatedAt:(0,r.int)("updated_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),endedAt:(0,r.int)("ended_at",{mode:"timestamp"})}),h=(0,l.sqliteTable)("task_message",{id:(0,r.int)("id").primaryKey({autoIncrement:!0}),taskId:(0,n.text)("task_id").notNull().references(()=>d.id,{onDelete:"cascade"}),seq:(0,r.int)("seq").notNull(),bot:(0,n.text)("bot"),parent:(0,n.text)("parent"),role:(0,n.text)("role").notNull().$type(),content:(0,n.text)("content",{mode:"json"}).notNull().$type(),compact:(0,r.int)("compact",{mode:"boolean"}).notNull().default(!1),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)},e=>[(0,s.unique)("uq_task_message_seq").on(e.taskId,e.seq)]),f=(0,l.sqliteTable)("call",{id:(0,n.text)("id").primaryKey(),provider:(0,n.text)("provider").notNull(),model:(0,n.text)("model").notNull(),startedAt:(0,r.int)("started_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),endedAt:(0,r.int)("ended_at",{mode:"timestamp"}),tidiedAt:(0,r.int)("tidied_at",{mode:"timestamp"})}),m=(0,l.sqliteTable)("call_message",{callId:(0,n.text)("call_id").notNull().references(()=>f.id,{onDelete:"cascade"}),id:(0,n.text)("id").notNull(),seq:(0,r.int)("seq").notNull(),role:(0,n.text)("role").notNull().$type(),tool:(0,n.text)("tool"),text:(0,n.text)("text").notNull(),at:(0,r.int)("at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)},e=>[(0,i.primaryKey)({columns:[e.callId,e.id]}),(0,t.index)("idx_call_message_call").on(e.callId,e.seq)]),p=(0,l.sqliteTable)("memory_note",{id:(0,r.int)("id").primaryKey({autoIncrement:!0}),path:(0,n.text)("path").notNull().unique(),description:(0,n.text)("description").notNull(),aliases:(0,n.text)("aliases",{mode:"json"}).$type().default([]),ownedByUser:(0,r.int)("owned_by_user",{mode:"boolean"}).notNull().default(!1),hits:(0,r.int)("hits").notNull().default(0),lastReadAt:(0,r.int)("last_read_at",{mode:"timestamp"}),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),updatedAt:(0,r.int)("updated_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),y=(0,l.sqliteTable)("memory_fact",{id:(0,r.int)("id").primaryKey({autoIncrement:!0}),noteId:(0,r.int)("note_id").notNull().references(()=>p.id,{onDelete:"cascade"}),text:(0,n.text)("text").notNull(),isLatest:(0,r.int)("is_latest",{mode:"boolean"}).notNull().default(!0),alwaysLoad:(0,r.int)("always_load",{mode:"boolean"}).notNull().default(!1),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)},e=>[(0,t.index)("idx_memory_fact_note").on(e.noteId,e.isLatest),(0,t.index)("idx_memory_fact_always").on(e.alwaysLoad,e.isLatest)]),g=(0,l.sqliteTable)("memory_tidy_run",{id:(0,n.text)("id").primaryKey(),status:(0,n.text)("status").notNull().$type(),provider:(0,n.text)("provider").notNull(),model:(0,n.text)("model").notNull(),callIds:(0,n.text)("call_ids",{mode:"json"}).notNull().$type(),messages:(0,r.int)("messages").notNull().default(0),changes:(0,n.text)("changes",{mode:"json"}).notNull().$type().default([]),error:(0,n.text)("error"),inputTokens:(0,r.int)("input_tokens").notNull().default(0),outputTokens:(0,r.int)("output_tokens").notNull().default(0),startedAt:(0,r.int)("started_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),endedAt:(0,r.int)("ended_at",{mode:"timestamp"})}),b=(0,l.sqliteTable)("config",{key:(0,n.text)("key").primaryKey(),value:(0,n.text)("value").notNull()});e.s(["botMcpToolTable",0,c,"botTable",0,a,"callMessageTable",0,m,"callTable",0,f,"configTable",0,b,"mcpServerTable",0,o,"mcpToolTable",0,u,"memoryFactTable",0,y,"memoryNoteTable",0,p,"memoryTidyRunTable",0,g,"taskMessageTable",0,h,"taskTable",0,d])},999884,e=>{"use strict";var t=e.i(844988),i=e.i(518899),s=class{static [t.entityKind]="ConsoleLogWriter";write(e){console.log(e)}},r=class{static [t.entityKind]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new s}logQuery(e,t){let i=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),s=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${s}`)}},n=class{static [t.entityKind]="NoopLogger";logQuery(){}},l=e.i(704313),a=class{static [t.entityKind]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}},o=i,u=class e extends o.SQL{static [t.entityKind]="SQLiteCountBuilder";dialect;session;static buildCount(e,t,i){let s=o.sql`select count(*) from ${e}${o.sql` where ${t}`.if(t)}`;return i?o.sql`(${s})`:s}constructor(t){super(e.buildCount(t.source,t.filters,!0).queryChunks),this.countConfig=t,this.dialect=t.dialect,this.session=t.session,this.mapWith(e=>"number"==typeof e?e:Number(e??0))}executableSql;build(){if(!this.executableSql){let{source:t,filters:i}=this.countConfig;this.executableSql=e.buildCount(t,i)}return this.dialect.sqlToQuery(this.executableSql)}},c=class extends u{static [t.entityKind]="SQLiteAsyncCountBuilder";constructor(e){super(e)}executeRaw(e){return this.session.prepareQuery(this.build(),"arrays",!1,"all",e=>{let t=e[0]?.[0];return"number"==typeof t?t:t?Number(t):0}).execute(e)}async execute(e){return await this.executeRaw(e)}};(0,l.applyMixins)(c,[a]);var d=class extends c{static [t.entityKind]="SQLiteSyncCountBuilder";sync(e){return this.executeRaw(e).sync()}},h=class{static [t.entityKind]="SQLiteRelationalQueryBuilderV2";constructor(e,t,i,s,r,n,l,a=f){this.mode=e,this.schema=t,this.table=i,this.tableConfig=s,this.dialect=r,this.session=n,this.forbidJsonb=l,this.builder=a}findMany(e){return new this.builder(this.mode,this.schema,this.table,this.tableConfig,this.dialect,this.session,e??!0,"many",this.forbidJsonb)}findFirst(e){return new this.builder(this.mode,this.schema,this.table,this.tableConfig,this.dialect,this.session,e??!0,"first",this.forbidJsonb)}},f=class{static [t.entityKind]="SQLiteRelationalQueryV2";mode;table;resultKind;constructor(e,t,i,s,r,n,l,a,o){this.schema=t,this.tableConfig=s,this.dialect=r,this.session=n,this.config=l,this.forbidJsonb=o,this.resultKind=e,this.mode=a,this.table=i}getSQL(){return this._getQuery().sql}_getQuery(){let e=this.forbidJsonb?i.sql`json`:i.sql`jsonb`;return this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,jsonb:e})}_toSQL(){let e=this._getQuery();return{query:e,builtQuery:this.dialect.sqlToQuery(e.sql)}}toSQL(){return this._toSQL().builtQuery}},m=class extends f{static [t.entityKind]="SQLiteAsyncRelationalQueryV2";_prepare(e=!1){let{query:t,builtQuery:i}=this._toSQL(),s=this.dialect.mapperGenerators.relationalRows({isFirst:"first"===this.mode,parseJson:!0,parseJsonIfString:!1,rootJsonMappers:!1,selection:t.selection,arrayModeRoot:!0});return this.session.prepareQuery(i,"arrays",e,"all",s)}prepare(){return this._prepare(!0)}async execute(e){return this._prepare().execute(e)}},p=class extends m{static [t.entityKind]="SQLiteSyncRelationalQueryV2";sync(e){return this._prepare().execute(e).sync()}};(0,l.applyMixins)(m,[a]);var y=e.i(792352),g=e.i(156325),b=e.i(88274),q=e.i(923277),S=e.i(369e3),w=class{static [t.entityKind]="ColumnTableAliasProxyHandler";constructor(e,t){this.table=e,this.ignoreColumnAlias=t}get(e,t){return"table"===t?this.table:("isAlias"!==t||!this.ignoreColumnAlias)&&e[t]}},$=class{static [t.entityKind]="ViewSelectionAliasProxyHandler";constructor(e,t,i){this.view=e,this.selection=t,this.ignoreColumnAlias=i}get(e,s){let r=e[s];return(0,t.is)(r,g.Column)?new Proxy(r,new w(this.view,this.ignoreColumnAlias)):(0,t.is)(r,y.Subquery)||(0,t.is)(r,i.SQL)||(0,t.is)(r,i.SQL.Aliased)||(0,i.isSQLWrapper)(r)||"object"!=typeof r||null===r?r:new Proxy(r,this)}},v=class{static [t.entityKind]="TableAliasProxyHandler";constructor(e,t,i){this.alias=e,this.replaceOriginalName=t,this.ignoreColumnAlias=i}get(e,s){if(s===S.Table.Symbol.IsAlias)return!0;if(s===S.Table.Symbol.Name||this.replaceOriginalName&&s===S.Table.Symbol.OriginalName)return this.alias;if(s===b.ViewBaseConfig)return{...e[b.ViewBaseConfig],name:this.alias,isAlias:!0,selectedFields:new Proxy(e[b.ViewBaseConfig].selectedFields,new $(new Proxy(e,this),e[b.ViewBaseConfig].selectedFields,this.ignoreColumnAlias))};if(s===S.Table.Symbol.Columns){let s=e[S.Table.Symbol.Columns];if(!s)return s;if((0,t.is)(e,i.View))return new Proxy(e[S.Table.Symbol.Columns],new $(new Proxy(e,this),e[S.Table.Symbol.Columns],this.ignoreColumnAlias));let r={};return Object.keys(s).map(t=>{r[t]=new Proxy(s[t],new w(new Proxy(e,this),this.ignoreColumnAlias))}),r}let r=e[s];return(0,t.is)(r,g.Column)?new Proxy(r,new w(new Proxy(e,this),this.ignoreColumnAlias)):r}},Q=class{static [t.entityKind]="ColumnAliasProxyHandler";constructor(e){this.alias=e}get(e,t){return"isAlias"===t||("name"===t?this.alias:"keyAsName"!==t&&(t===q.OriginalColumn?()=>e:e[t]))}};function x(e,t){return new Proxy(e,new v(t,!1,!1))}function L(e){return e[q.OriginalColumn]()}t.entityKind,g.Column.prototype.as=function(e){return new Proxy(this,new Q(e))};var N=class e{static [t.entityKind]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(s,r){if("_"===r)return{...s._,selectedFields:new Proxy(s._.selectedFields,this)};if(r===b.ViewBaseConfig)return{...s[b.ViewBaseConfig],selectedFields:new Proxy(s[b.ViewBaseConfig].selectedFields,this)};if("symbol"==typeof r)return s[r];let n=((0,t.is)(s,y.Subquery)?s._.selectedFields:(0,t.is)(s,i.View)?s[b.ViewBaseConfig].selectedFields:s)[r];if((0,t.is)(n,i.SQL.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!n.isSelectionField)return n.sql;let e=n.clone();return e.isSelectionField=!0,e.origin=this.config.alias,e}if((0,t.is)(n,i.SQL)){if("sql"===this.config.sqlBehavior)return n;throw Error(`You tried to reference "${r}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return(0,t.is)(n,g.Column)?this.config.alias?new Proxy(n,new w(new Proxy(n.table,new v(this.config.alias,this.config.replaceOriginalName??!1,!0)),!0)):n:"object"!=typeof n||null===n?n:new Proxy(n,new e(this.config))}},T=e.i(75799);function C(e){return(0,t.is)(e,T.SQLiteTable)?[`${e[S.Table.Symbol.BaseName]}`]:(0,t.is)(e,y.Subquery)?e._.usedTables??[]:(0,t.is)(e,i.SQL)?e.usedTables??[]:[]}t.entityKind,t.entityKind,e.i(361328),e.i(646683),e.i(201440),e.i(616918);var _=class{static [t.entityKind]="SQLiteDelete";config;constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:s}}where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[S.Table.Symbol.Columns],new N({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.table[T.SQLiteTable.Symbol.Columns]){return this.config.returning=(0,l.orderSelectedFields)(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){return this.dialect.sqlToQuery(this.getSQL())}$dynamic(){return this}},A=class extends _{static [t.entityKind]="SQLiteAsyncDelete";_prepare(e=!1){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),"arrays",e,this.config.returning?"all":"run",this.config.returning?this.dialect.mapperGenerators.rows(this.config.returning,void 0):void 0,{type:"delete",tables:C(this.config.table)})}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}};(0,l.applyMixins)(A,[a]);var j=i,B=class extends j.View{static [t.entityKind]="SQLiteViewBase"},F=class{static [t.entityKind]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}withoutSelectionCastCodecs(){return this}},K=class{static [t.entityKind]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e,t=D){this.builder=t,this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let s,r=!!this.fields;return s=this.fields?this.fields:(0,t.is)(e,y.Subquery)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):(0,t.is)(e,B)?e[b.ViewBaseConfig].selectedFields:(0,t.is)(e,i.SQL)?{}:(0,l.getTableColumns)(e),new this.builder({table:e,fields:s,isPartialSelect:r,session:this.session,dialect:this.dialect,withList:this.withList??[],distinct:this.distinct})}},D=class extends F{static [t.entityKind]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:i,session:s,dialect:r,withList:n,distinct:a}){for(const o of(super(),this.config={withList:n,table:e,fields:{...t},distinct:a,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=r,this._={selectedFields:t,config:this.config},this.tableName=(0,l.getTableLikeName)(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{},C(e)))this.usedTables.add(o)}getUsedTables(){return[...this.usedTables]}createJoin(e){return(s,r)=>{let n=this.tableName,a=(0,l.getTableLikeName)(s);for(let e of C(s))this.usedTables.add(e);if("string"==typeof a&&this.config.joins?.some(e=>e.alias===a))throw Error(`Alias "${a}" is already used in this query`);if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof n&&(this.config.fields={[n]:this.config.fields}),"string"==typeof a&&!(0,t.is)(s,i.SQL))){let e=(0,t.is)(s,y.Subquery)?s._.selectedFields:(0,t.is)(s,i.View)?s[b.ViewBaseConfig].selectedFields:s[S.Table.Symbol.Columns];this.config.fields[a]=e}if("function"==typeof r&&(r=r(new Proxy(this.config.fields,new N({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:r,table:s,joinType:e,alias:a}),"string"==typeof a)switch(e){case"left":this.joinsNotNullableMap[a]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[a]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[a]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[a]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return i=>{let s="function"==typeof i?i(O()):i;if(!(0,l.haveSameKeys)(this.getSelectedFields(),s.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:s}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new N({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new N({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new N({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new N({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}$withCache(e){return this.cacheConfig=void 0===e?{config:{},enabled:!0,autoInvalidate:!0}:!1===e?{enabled:!1}:{enabled:!0,autoInvalidate:!0,...e},this}getSQL(){return this.config.fieldsFlat=(0,l.orderSelectedFields)(this.config.fields),this.dialect.buildSelectQuery(this.config)}toSQL(){return this.dialect.sqlToQuery(this.getSQL())}as(e){let t=[];if(t.push(...C(this.config.table)),this.config.joins)for(let e of this.config.joins)t.push(...C(e.table));return new Proxy(new y.Subquery(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new N({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new N({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}withoutSelectionCastCodecs(){return this}$dynamic(){return this}};function k(e,t){return(i,s,...r)=>{let n=[s,...r].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of n)if(!(0,l.haveSameKeys)(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(n)}}let O=()=>({union:P,unionAll:V,intersect:I,except:J}),P=k("union",!1),V=k("union",!0),I=k("intersect",!1),J=k("except",!1);var E=class extends Error{static [t.entityKind]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}},z=class e extends Error{static [t.entityKind]="DrizzleQueryError";constructor(t,i,s){super(`Failed query: ${t}
|
|
1
|
+
module.exports=[528790,e=>e.a(async(t,i)=>{try{let d,h;var s,r=e.i(902157),n=e.i(750227),l=e.i(418520),a=e.i(219756),o=e.i(687388),u=e.i(41444),c=t([l,a]);[l,a]=c.then?(await c)():c;let f=o.DB_FILE_NAME.replace(/^file:/,"");(0,r.mkdirSync)((0,n.dirname)(f),{recursive:!0});let m=globalThis.__dbClient??=(s=((d=(0,l.createClient)({url:o.DB_FILE_NAME,timeout:5e3})).execute("PRAGMA journal_mode = WAL"),d),h=(0,u.PromiseChain)(),{...s,execute:(...e)=>h(()=>s.execute(...e)),batch:(...e)=>h(()=>s.batch(...e)),executeMultiple:(...e)=>h(()=>s.executeMultiple(...e)),migrate:(...e)=>h(()=>s.migrate(...e)),async transaction(...e){let t,i=await new Promise(e=>{let t,i=new Promise(e=>{t=e});h(async()=>{e(t),await i})});try{t=await s.transaction(...e)}catch(e){throw i(),e}let r=!1,n=()=>{r||(r=!0,i())};return{execute:(...e)=>t.execute(...e),batch:(...e)=>t.batch(...e),executeMultiple:(...e)=>t.executeMultiple(...e),get closed(){return t.closed},commit:()=>t.commit().finally(n),rollback:()=>t.rollback().finally(n),close:()=>{try{t.close()}finally{n()}}}}}),p=(0,a.drizzle)({client:m});e.s(["database",0,p]),i()}catch(e){i(e)}},!1),613240,e=>{"use strict";var t=e.i(646683),i=e.i(201440),s=e.i(616918),r=e.i(937540),n=e.i(380568),l=e.i(75799);let a=(0,l.sqliteTable)("bot",{name:(0,n.text)("name").primaryKey(),description:(0,n.text)("description").notNull(),systemPrompt:(0,n.text)("system_prompt"),icon:(0,n.text)("icon",{mode:"json"}).$type(),provider:(0,n.text)("provider").$type(),model:(0,n.text)("model"),compactAt:(0,r.int)("compact_at"),disabled:(0,r.int)("disabled",{mode:"boolean"}).notNull().default(!1),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),o=(0,l.sqliteTable)("mcp_server",{name:(0,n.text)("name").primaryKey(),config:(0,n.text)("config",{mode:"json"}).notNull().$type(),toolsSyncedAt:(0,r.int)("tools_synced_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),lastError:(0,n.text)("last_error"),oauth:(0,n.text)("oauth",{mode:"json"}).$type(),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),u=(0,l.sqliteTable)("mcp_tool",{id:(0,r.int)("id").primaryKey({autoIncrement:!0}),serverName:(0,n.text)("server_name").notNull().references(()=>o.name,{onDelete:"cascade"}),name:(0,n.text)("name").notNull(),description:(0,n.text)("description"),inputSchema:(0,n.text)("input_schema",{mode:"json"}).$type(),outputSchema:(0,n.text)("output_schema",{mode:"json"}).$type()},e=>[(0,s.unique)("uq_mcp_tool_server_name").on(e.serverName,e.name)]),c=(0,l.sqliteTable)("bot_mcp_tool",{botName:(0,n.text)().notNull().references(()=>a.name,{onDelete:"cascade"}),toolId:(0,r.int)("tool_id").notNull().references(()=>u.id,{onDelete:"cascade"})},e=>[(0,i.primaryKey)({columns:[e.botName,e.toolId]})]),d=(0,l.sqliteTable)("task",{id:(0,n.text)("id").primaryKey(),bot:(0,n.text)("bot").notNull(),label:(0,n.text)("label").notNull(),request:(0,n.text)("request").notNull(),status:(0,n.text)("status").notNull().$type(),outcome:(0,n.text)("outcome"),pending:(0,n.text)("pending",{mode:"json"}).$type(),seen:(0,r.int)("seen",{mode:"boolean"}).notNull().default(!1),callId:(0,n.text)("call_id"),inputTokens:(0,r.int)("input_tokens").notNull().default(0),outputTokens:(0,r.int)("output_tokens").notNull().default(0),contextTokens:(0,r.int)("context_tokens").notNull().default(0),contextBudget:(0,r.int)("context_budget").notNull().default(0),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),updatedAt:(0,r.int)("updated_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),endedAt:(0,r.int)("ended_at",{mode:"timestamp"})}),h=(0,l.sqliteTable)("task_message",{id:(0,r.int)("id").primaryKey({autoIncrement:!0}),taskId:(0,n.text)("task_id").notNull().references(()=>d.id,{onDelete:"cascade"}),seq:(0,r.int)("seq").notNull(),bot:(0,n.text)("bot"),parent:(0,n.text)("parent"),role:(0,n.text)("role").notNull().$type(),content:(0,n.text)("content",{mode:"json"}).notNull().$type(),compact:(0,r.int)("compact",{mode:"boolean"}).notNull().default(!1),note:(0,r.int)("note",{mode:"boolean"}).notNull().default(!1),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)},e=>[(0,s.unique)("uq_task_message_seq").on(e.taskId,e.seq)]),f=(0,l.sqliteTable)("call",{id:(0,n.text)("id").primaryKey(),provider:(0,n.text)("provider").notNull(),model:(0,n.text)("model").notNull(),startedAt:(0,r.int)("started_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),endedAt:(0,r.int)("ended_at",{mode:"timestamp"})}),m=(0,l.sqliteTable)("call_message",{callId:(0,n.text)("call_id").notNull().references(()=>f.id,{onDelete:"cascade"}),id:(0,n.text)("id").notNull(),seq:(0,r.int)("seq").notNull(),role:(0,n.text)("role").notNull().$type(),tool:(0,n.text)("tool"),text:(0,n.text)("text").notNull(),at:(0,r.int)("at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)},e=>[(0,i.primaryKey)({columns:[e.callId,e.id]}),(0,t.index)("idx_call_message_call").on(e.callId,e.seq)]),p=(0,l.sqliteTable)("memory_note",{id:(0,r.int)("id").primaryKey({autoIncrement:!0}),path:(0,n.text)("path").notNull().unique(),description:(0,n.text)("description").notNull(),aliases:(0,n.text)("aliases",{mode:"json"}).$type().default([]),ownedByUser:(0,r.int)("owned_by_user",{mode:"boolean"}).notNull().default(!1),hits:(0,r.int)("hits").notNull().default(0),lastReadAt:(0,r.int)("last_read_at",{mode:"timestamp"}),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),updatedAt:(0,r.int)("updated_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),y=(0,l.sqliteTable)("memory_fact",{id:(0,r.int)("id").primaryKey({autoIncrement:!0}),noteId:(0,r.int)("note_id").notNull().references(()=>p.id,{onDelete:"cascade"}),text:(0,n.text)("text").notNull(),isLatest:(0,r.int)("is_latest",{mode:"boolean"}).notNull().default(!0),alwaysLoad:(0,r.int)("always_load",{mode:"boolean"}).notNull().default(!1),source:(0,n.text)("source").$type(),callId:(0,n.text)("call_id").references(()=>f.id,{onDelete:"set null"}),createdAt:(0,r.int)("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)},e=>[(0,t.index)("idx_memory_fact_note").on(e.noteId,e.isLatest),(0,t.index)("idx_memory_fact_always").on(e.alwaysLoad,e.isLatest),(0,t.index)("idx_memory_fact_call").on(e.callId)]),g=(0,l.sqliteTable)("config",{key:(0,n.text)("key").primaryKey(),value:(0,n.text)("value").notNull()});e.s(["botMcpToolTable",0,c,"botTable",0,a,"callMessageTable",0,m,"callTable",0,f,"configTable",0,g,"mcpServerTable",0,o,"mcpToolTable",0,u,"memoryFactTable",0,y,"memoryNoteTable",0,p,"taskMessageTable",0,h,"taskTable",0,d])},41444,e=>{"use strict";e.s(["PromiseChain",0,()=>{let e=Promise.resolve();return t=>{let i=e.then(()=>t());return e=i.catch(()=>{}),i}},"clip",0,function(e,t){let i=e.replace(/\s+/g," ").trim();return i.length>t?`${i.slice(0,t-1).trimEnd()}…`:i},"errorToString",0,function(e){return e instanceof Error?e.message:String(e)}])},999884,e=>{"use strict";var t=e.i(844988),i=e.i(518899),s=class{static [t.entityKind]="ConsoleLogWriter";write(e){console.log(e)}},r=class{static [t.entityKind]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new s}logQuery(e,t){let i=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),s=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${s}`)}},n=class{static [t.entityKind]="NoopLogger";logQuery(){}},l=e.i(704313),a=class{static [t.entityKind]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}},o=i,u=class e extends o.SQL{static [t.entityKind]="SQLiteCountBuilder";dialect;session;static buildCount(e,t,i){let s=o.sql`select count(*) from ${e}${o.sql` where ${t}`.if(t)}`;return i?o.sql`(${s})`:s}constructor(t){super(e.buildCount(t.source,t.filters,!0).queryChunks),this.countConfig=t,this.dialect=t.dialect,this.session=t.session,this.mapWith(e=>"number"==typeof e?e:Number(e??0))}executableSql;build(){if(!this.executableSql){let{source:t,filters:i}=this.countConfig;this.executableSql=e.buildCount(t,i)}return this.dialect.sqlToQuery(this.executableSql)}},c=class extends u{static [t.entityKind]="SQLiteAsyncCountBuilder";constructor(e){super(e)}executeRaw(e){return this.session.prepareQuery(this.build(),"arrays",!1,"all",e=>{let t=e[0]?.[0];return"number"==typeof t?t:t?Number(t):0}).execute(e)}async execute(e){return await this.executeRaw(e)}};(0,l.applyMixins)(c,[a]);var d=class extends c{static [t.entityKind]="SQLiteSyncCountBuilder";sync(e){return this.executeRaw(e).sync()}},h=class{static [t.entityKind]="SQLiteRelationalQueryBuilderV2";constructor(e,t,i,s,r,n,l,a=f){this.mode=e,this.schema=t,this.table=i,this.tableConfig=s,this.dialect=r,this.session=n,this.forbidJsonb=l,this.builder=a}findMany(e){return new this.builder(this.mode,this.schema,this.table,this.tableConfig,this.dialect,this.session,e??!0,"many",this.forbidJsonb)}findFirst(e){return new this.builder(this.mode,this.schema,this.table,this.tableConfig,this.dialect,this.session,e??!0,"first",this.forbidJsonb)}},f=class{static [t.entityKind]="SQLiteRelationalQueryV2";mode;table;resultKind;constructor(e,t,i,s,r,n,l,a,o){this.schema=t,this.tableConfig=s,this.dialect=r,this.session=n,this.config=l,this.forbidJsonb=o,this.resultKind=e,this.mode=a,this.table=i}getSQL(){return this._getQuery().sql}_getQuery(){let e=this.forbidJsonb?i.sql`json`:i.sql`jsonb`;return this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,jsonb:e})}_toSQL(){let e=this._getQuery();return{query:e,builtQuery:this.dialect.sqlToQuery(e.sql)}}toSQL(){return this._toSQL().builtQuery}},m=class extends f{static [t.entityKind]="SQLiteAsyncRelationalQueryV2";_prepare(e=!1){let{query:t,builtQuery:i}=this._toSQL(),s=this.dialect.mapperGenerators.relationalRows({isFirst:"first"===this.mode,parseJson:!0,parseJsonIfString:!1,rootJsonMappers:!1,selection:t.selection,arrayModeRoot:!0});return this.session.prepareQuery(i,"arrays",e,"all",s)}prepare(){return this._prepare(!0)}async execute(e){return this._prepare().execute(e)}},p=class extends m{static [t.entityKind]="SQLiteSyncRelationalQueryV2";sync(e){return this._prepare().execute(e).sync()}};(0,l.applyMixins)(m,[a]);var y=e.i(792352),g=e.i(156325),b=e.i(88274),q=e.i(923277),S=e.i(369e3),w=class{static [t.entityKind]="ColumnTableAliasProxyHandler";constructor(e,t){this.table=e,this.ignoreColumnAlias=t}get(e,t){return"table"===t?this.table:("isAlias"!==t||!this.ignoreColumnAlias)&&e[t]}},$=class{static [t.entityKind]="ViewSelectionAliasProxyHandler";constructor(e,t,i){this.view=e,this.selection=t,this.ignoreColumnAlias=i}get(e,s){let r=e[s];return(0,t.is)(r,g.Column)?new Proxy(r,new w(this.view,this.ignoreColumnAlias)):(0,t.is)(r,y.Subquery)||(0,t.is)(r,i.SQL)||(0,t.is)(r,i.SQL.Aliased)||(0,i.isSQLWrapper)(r)||"object"!=typeof r||null===r?r:new Proxy(r,this)}},v=class{static [t.entityKind]="TableAliasProxyHandler";constructor(e,t,i){this.alias=e,this.replaceOriginalName=t,this.ignoreColumnAlias=i}get(e,s){if(s===S.Table.Symbol.IsAlias)return!0;if(s===S.Table.Symbol.Name||this.replaceOriginalName&&s===S.Table.Symbol.OriginalName)return this.alias;if(s===b.ViewBaseConfig)return{...e[b.ViewBaseConfig],name:this.alias,isAlias:!0,selectedFields:new Proxy(e[b.ViewBaseConfig].selectedFields,new $(new Proxy(e,this),e[b.ViewBaseConfig].selectedFields,this.ignoreColumnAlias))};if(s===S.Table.Symbol.Columns){let s=e[S.Table.Symbol.Columns];if(!s)return s;if((0,t.is)(e,i.View))return new Proxy(e[S.Table.Symbol.Columns],new $(new Proxy(e,this),e[S.Table.Symbol.Columns],this.ignoreColumnAlias));let r={};return Object.keys(s).map(t=>{r[t]=new Proxy(s[t],new w(new Proxy(e,this),this.ignoreColumnAlias))}),r}let r=e[s];return(0,t.is)(r,g.Column)?new Proxy(r,new w(new Proxy(e,this),this.ignoreColumnAlias)):r}},Q=class{static [t.entityKind]="ColumnAliasProxyHandler";constructor(e){this.alias=e}get(e,t){return"isAlias"===t||("name"===t?this.alias:"keyAsName"!==t&&(t===q.OriginalColumn?()=>e:e[t]))}};function x(e,t){return new Proxy(e,new v(t,!1,!1))}function L(e){return e[q.OriginalColumn]()}t.entityKind,g.Column.prototype.as=function(e){return new Proxy(this,new Q(e))};var N=class e{static [t.entityKind]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(s,r){if("_"===r)return{...s._,selectedFields:new Proxy(s._.selectedFields,this)};if(r===b.ViewBaseConfig)return{...s[b.ViewBaseConfig],selectedFields:new Proxy(s[b.ViewBaseConfig].selectedFields,this)};if("symbol"==typeof r)return s[r];let n=((0,t.is)(s,y.Subquery)?s._.selectedFields:(0,t.is)(s,i.View)?s[b.ViewBaseConfig].selectedFields:s)[r];if((0,t.is)(n,i.SQL.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!n.isSelectionField)return n.sql;let e=n.clone();return e.isSelectionField=!0,e.origin=this.config.alias,e}if((0,t.is)(n,i.SQL)){if("sql"===this.config.sqlBehavior)return n;throw Error(`You tried to reference "${r}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return(0,t.is)(n,g.Column)?this.config.alias?new Proxy(n,new w(new Proxy(n.table,new v(this.config.alias,this.config.replaceOriginalName??!1,!0)),!0)):n:"object"!=typeof n||null===n?n:new Proxy(n,new e(this.config))}},T=e.i(75799);function C(e){return(0,t.is)(e,T.SQLiteTable)?[`${e[S.Table.Symbol.BaseName]}`]:(0,t.is)(e,y.Subquery)?e._.usedTables??[]:(0,t.is)(e,i.SQL)?e.usedTables??[]:[]}t.entityKind,t.entityKind,e.i(361328),e.i(646683),e.i(201440),e.i(616918);var _=class{static [t.entityKind]="SQLiteDelete";config;constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:s}}where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[S.Table.Symbol.Columns],new N({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.table[T.SQLiteTable.Symbol.Columns]){return this.config.returning=(0,l.orderSelectedFields)(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){return this.dialect.sqlToQuery(this.getSQL())}$dynamic(){return this}},A=class extends _{static [t.entityKind]="SQLiteAsyncDelete";_prepare(e=!1){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),"arrays",e,this.config.returning?"all":"run",this.config.returning?this.dialect.mapperGenerators.rows(this.config.returning,void 0):void 0,{type:"delete",tables:C(this.config.table)})}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}};(0,l.applyMixins)(A,[a]);var j=i,B=class extends j.View{static [t.entityKind]="SQLiteViewBase"},F=class{static [t.entityKind]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}withoutSelectionCastCodecs(){return this}},K=class{static [t.entityKind]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e,t=D){this.builder=t,this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let s,r=!!this.fields;return s=this.fields?this.fields:(0,t.is)(e,y.Subquery)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):(0,t.is)(e,B)?e[b.ViewBaseConfig].selectedFields:(0,t.is)(e,i.SQL)?{}:(0,l.getTableColumns)(e),new this.builder({table:e,fields:s,isPartialSelect:r,session:this.session,dialect:this.dialect,withList:this.withList??[],distinct:this.distinct})}},D=class extends F{static [t.entityKind]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:i,session:s,dialect:r,withList:n,distinct:a}){for(const o of(super(),this.config={withList:n,table:e,fields:{...t},distinct:a,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=r,this._={selectedFields:t,config:this.config},this.tableName=(0,l.getTableLikeName)(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{},C(e)))this.usedTables.add(o)}getUsedTables(){return[...this.usedTables]}createJoin(e){return(s,r)=>{let n=this.tableName,a=(0,l.getTableLikeName)(s);for(let e of C(s))this.usedTables.add(e);if("string"==typeof a&&this.config.joins?.some(e=>e.alias===a))throw Error(`Alias "${a}" is already used in this query`);if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof n&&(this.config.fields={[n]:this.config.fields}),"string"==typeof a&&!(0,t.is)(s,i.SQL))){let e=(0,t.is)(s,y.Subquery)?s._.selectedFields:(0,t.is)(s,i.View)?s[b.ViewBaseConfig].selectedFields:s[S.Table.Symbol.Columns];this.config.fields[a]=e}if("function"==typeof r&&(r=r(new Proxy(this.config.fields,new N({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:r,table:s,joinType:e,alias:a}),"string"==typeof a)switch(e){case"left":this.joinsNotNullableMap[a]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[a]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[a]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[a]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return i=>{let s="function"==typeof i?i(O()):i;if(!(0,l.haveSameKeys)(this.getSelectedFields(),s.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:s}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new N({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new N({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new N({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new N({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}$withCache(e){return this.cacheConfig=void 0===e?{config:{},enabled:!0,autoInvalidate:!0}:!1===e?{enabled:!1}:{enabled:!0,autoInvalidate:!0,...e},this}getSQL(){return this.config.fieldsFlat=(0,l.orderSelectedFields)(this.config.fields),this.dialect.buildSelectQuery(this.config)}toSQL(){return this.dialect.sqlToQuery(this.getSQL())}as(e){let t=[];if(t.push(...C(this.config.table)),this.config.joins)for(let e of this.config.joins)t.push(...C(e.table));return new Proxy(new y.Subquery(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new N({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new N({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}withoutSelectionCastCodecs(){return this}$dynamic(){return this}};function k(e,t){return(i,s,...r)=>{let n=[s,...r].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of n)if(!(0,l.haveSameKeys)(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(n)}}let O=()=>({union:P,unionAll:V,intersect:I,except:J}),P=k("union",!1),V=k("union",!0),I=k("intersect",!1),J=k("except",!1);var E=class extends Error{static [t.entityKind]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}},z=class e extends Error{static [t.entityKind]="DrizzleQueryError";constructor(t,i,s){super(`Failed query: ${t}
|
|
2
2
|
params: ${i}`),this.query=t,this.params=i,this.cause=s,this.name="DrizzleQueryError",Error.captureStackTrace(this,e),s&&(this.cause=s)}},U=class extends E{static [t.entityKind]="TransactionRollbackError";constructor(){super({message:"Rollback"}),this.name="TransactionRollbackError"}},M=e.i(875225),R=e.i(349129),W=class{static [t.entityKind]="RelationV2";fieldName;sourceColumns;targetColumns;alias;where;sourceTable;targetTable;through;throughTable;isReversed;sourceColumnTableNames=[];targetColumnTableNames=[];constructor(e,t){this.targetTableName=t,this.targetTable=e}},G=class extends W{static [t.entityKind]="OneV2";relationType="one";optional;constructor(e,t,i,s){super(t,i),this.alias=s?.alias,this.where=s?.where,s?.from&&(this.sourceColumns=(Array.isArray(s.from)?s.from:[s.from]).map(t=>(this.throughTable??=t._.through?e[t._.through._.tableName]:void 0,this.sourceColumnTableNames.push(t._.tableName),t._.column))),s?.to&&(this.targetColumns=(Array.isArray(s.to)?s.to:[s.to]).map(t=>(this.throughTable??=t._.through?e[t._.through._.tableName]:void 0,this.targetColumnTableNames.push(t._.tableName),t._.column))),this.throughTable&&(this.through={source:(Array.isArray(s?.from)?s.from:s?.from?[s.from]:[]).map(e=>e._.through),target:(Array.isArray(s?.to)?s.to:s?.to?[s.to]:[]).map(e=>e._.through)}),this.optional=s?.optional??!0}},H=(t.entityKind,class{static [t.entityKind]="AggregatedField";table;onTable(e){return this.table=e,this}});t.entityKind;let Z={and:M.and,between:M.between,eq:M.eq,exists:M.exists,gt:M.gt,gte:M.gte,ilike:M.ilike,inArray:M.inArray,arrayContains:M.arrayContains,arrayContained:M.arrayContained,arrayOverlaps:M.arrayOverlaps,isNull:M.isNull,isNotNull:M.isNotNull,like:M.like,lt:M.lt,lte:M.lte,ne:M.ne,not:M.not,notBetween:M.notBetween,notExists:M.notExists,notLike:M.notLike,notIlike:M.notIlike,notInArray:M.notInArray,or:M.or,sql:i.sql},Y={sql:i.sql,asc:R.asc,desc:R.desc};function X(e,s,r,n=!1,l=!1,a=!0){let o=s?1:e.length,u=r.map(({field:e,codec:s,arrayDimensions:r})=>{let n;return(n=(0,t.is)(e,g.Column)?e:(0,t.is)(e,i.SQL)?e.decoder:(0,t.is)(e,i.SQL.Aliased)?e.sql.decoder:(0,t.is)(e,S.Table)||(0,t.is)(e,i.View)?i.noopDecoder:e.getSQL().decoder,a&&e.mapFromJsonValue)?t=>e.mapFromJsonValue(t):n.mapFromDriverValue.isNoop?s?e=>s(e,r):void 0:s?e=>n.mapFromDriverValue(s(e,r)):e=>n.mapFromDriverValue(e)});for(let t=0;t<o;++t){let i=s?e:e[t];for(let e=0;e<r.length;++e){let t=r[e];if(t.selection){if(null===i[t.key])continue;if(n){if(i[t.key]=JSON.parse(i[t.key]),null===i[t.key])continue}else l&&"string"==typeof i[t.key]&&(i[t.key]=JSON.parse(i[t.key]));if(t.isArray){X(i[t.key],!1,t.selection,!1,l);continue}X(i[t.key],!0,t.selection,!1,l);continue}if(null===i[t.key])continue;let s=u[e];s&&(i[t.key]=s(i[t.key]))}}return e}function ee({selection:e,isFirst:s,parseJson:r,parseJsonIfString:n,rootJsonMappers:l,arrayModeRoot:a}){return o=>s&&!o[0]?o[0]:a?function(e,s,r,n=!1,l=!1){let a=s?1:e.length,o=r.map(({field:e,codec:s,arrayDimensions:r})=>{let n;return(n=(0,t.is)(e,g.Column)?e:(0,t.is)(e,i.SQL)?e.decoder:(0,t.is)(e,i.SQL.Aliased)?e.sql.decoder:(0,t.is)(e,S.Table)||(0,t.is)(e,i.View)?i.noopDecoder:e.getSQL().decoder).mapFromDriverValue.isNoop?s?e=>s(e,r):void 0:s?e=>n.mapFromDriverValue(s(e,r)):e=>n.mapFromDriverValue(e)}),u=Array.from({length:a});for(let t=0;t<a;++t){let i=s?e:e[t],a={};for(let e=0;e<r.length;++e){let t=r[e],s=i[e];if(t.selection){if(null===s){a[t.key]=null;continue}if(n){if(null===(s=JSON.parse(s))){a[t.key]=null;continue}}else l&&"string"==typeof s&&(s=JSON.parse(s));t.isArray?X(s,!1,t.selection,!1,l):X(s,!0,t.selection,!1,l),a[t.key]=s;continue}if(null===s){a[t.key]=null;continue}let u=o[e];a[t.key]=u?u(s):s}u[t]=a}return s?u[0]:u}(s?o[0]:o,s,e,r,n):X(s?o[0]:o,s,e,r,n,l)}function et({selection:e,isFirst:s,parseJson:r,parseJsonIfString:n,rootJsonMappers:a,arrayModeRoot:o}){let u=[],c=function e(s,r,n,l,a,o,u,c,d){let h=[],f=[],m=!1,p=s.map(()=>`c${c.n++}`),y=s.map((e,t)=>d?p[t]:`${JSON.stringify(e.key)}: ${p[t]}`);for(let[b,{field:q,key:w,codec:$,isArray:v,selection:Q,arrayDimensions:x}]of(h.push(d?`let [ ${y.join(", ")} ] = ${r};`:`let { ${y.join(", ")} } = ${r};`),s.entries())){let s=`${n}[${b}]`,r=JSON.stringify(w),d=p[b];if(Q){l?(h.push(`if (${d} !== null) ${d} = JSON.parse(${d});`),m=!0):a&&(h.push(`if (typeof ${d} === 'string') ${d} = JSON.parse(${d});`),m=!0);let t=`s${c.n++}`,i=u.length;if(u.push(`const { selection: ${t} } = ${s};`),v){let s=`j${c.n++}`,r=e(Q,`${d}[${s}]`,t,!1,a,!0,u,c,!1);if(r.hasWork){for(let e of(m=!0,h.push(`if (${d} !== null) {`),h.push(` for (let ${s} = 0; ${s} < ${d}.length; ++${s}) {`),r.bodyStmts))h.push(` ${e}`);h.push(` ${d}[${s}] = ${r.literal};`),h.push(" }"),h.push("}")}else u.splice(i,1)}else{let s=e(Q,d,t,!1,a,!0,u,c,!1);if(s.hasWork){for(let e of(m=!0,h.push(`if (${d} !== null) {`),s.bodyStmts))h.push(` ${e}`);h.push(` ${d} = ${s.literal};`),h.push("}")}else u.splice(i,1)}f.push(`${r}: ${d}`);continue}let y="",L="",N=!1;if((0,t.is)(q,g.Column)){if(o&&q.mapFromJsonValue){N=!0;let e=c.n++;L=`field: dec${e}`,y=`dec${e}.mapFromJsonValue`}else if(!q.mapFromDriverValue.isNoop){let e=c.n++;L=`field: dec${e}`,y=`dec${e}.mapFromDriverValue`}}else if((0,t.is)(q,i.SQL)){if(o&&q.decoder.mapFromJsonValue){N=!0;let e=c.n++;L=`field: { decoder: dec${e} }`,y=`dec${e}.mapFromJsonValue`}else if(!q.decoder.mapFromDriverValue.isNoop){let e=c.n++;L=`field: { decoder: dec${e} }`,y=`dec${e}.mapFromDriverValue`}}else if((0,t.is)(q,i.SQL.Aliased)){if(o&&q.sql.decoder.mapFromJsonValue){N=!0;let e=c.n++;L=`field: { sql: { decoder: dec${e} } }`,y=`dec${e}.mapFromJsonValue`}else if(!q.sql.decoder.mapFromDriverValue.isNoop){let e=c.n++;L=`field: { sql: { decoder: dec${e} } }`,y=`dec${e}.mapFromDriverValue`}}else if((0,t.is)(q,S.Table)||(0,t.is)(q,i.View));else{let e=q.getSQL();if(o&&e.decoder.mapFromJsonValue){N=!0;let e=c.n++;u.push(`const dec${e} = ${s}.field.getSQL().decoder;`),y=`dec${e}.mapFromJsonValue`}else if(!e.decoder.mapFromDriverValue.isNoop){let e=c.n++;u.push(`const dec${e} = ${s}.field.getSQL().decoder;`),y=`dec${e}.mapFromDriverValue`}}let T="";if(!N&&$&&(T=`codec${c.n++}`),L||T){let e=[];L&&e.push(L),T&&e.push(`codec: ${T}`),u.push(`const { ${e.join(", ")} } = ${s};`)}if(y||T){m=!0;let e=d;T&&(e=`${T}(${e}, ${x})`),y&&(e=`${y}(${e})`),f.push(`${r}: ${d} === null ? null : ${e}`)}else f.push(`${r}: ${d}`)}return{bodyStmts:h,literal:`{ ${f.join(", ")} }`,hasWork:m}}(e,"row","selection",r,n,!o&&a,u,{n:0},!!o),d=[];for(let e of(d.push(` "use strict";
|
|
3
3
|
const { selection } = this;`),u))d.push(` ${e}`);if(o)if(s){for(let e of(d.push(" const row = rows[0];"),d.push(" if (!row) return undefined;"),c.bodyStmts))d.push(` ${e}`);d.push(` return ${c.literal};`)}else{for(let e of(d.push(" const { length } = rows;"),d.push(" const mapped = Array.from({ length });"),d.push(" for (let i = 0; i < length; ++i) {"),d.push(" const row = rows[i];"),c.bodyStmts))d.push(` ${e}`);d.push(` mapped[i] = ${c.literal};`),d.push(" }"),d.push(" return mapped;")}else if(c.hasWork)if(s){for(let e of(d.push(" const row = rows[0];"),d.push(" if (!row) return undefined;"),c.bodyStmts))d.push(` ${e}`);d.push(` rows[0] = ${c.literal};`),d.push(" return rows[0];")}else{for(let e of(d.push(" for (let i = 0; i < rows.length; ++i) {"),d.push(" const row = rows[i];"),c.bodyStmts))d.push(` ${e}`);d.push(` rows[i] = ${c.literal};`),d.push(" }"),d.push(" return rows;")}else d.push(s?" return rows[0];":" return rows;");d.push(" //# sourceURL=drizzle:jit-relational-query-mapper");let h=d.join("\n");return Object.assign(new l.FnConstructor("rows",h).bind({selection:e}),{body:`function jitRqbMapper (rows) {
|
|
4
4
|
${h}
|
|
@@ -15,4 +15,4 @@ ${h}
|
|
|
15
15
|
${a}
|
|
16
16
|
}`})},"mapUpdateSet",0,function(e,t){let l=Object.entries(t).filter(([,e])=>void 0!==e).map(([t,l])=>(0,i.is)(l,n.SQL)||(0,i.is)(l,s.Column)?[t,l]:[t,new n.Param(l,e[r.Table.Symbol.Columns][t])]);if(0===l.length)throw Error("No values to set");return Object.fromEntries(l)},"orderSelectedFields",0,function e(t,a,o){return Object.entries(t).reduce((t,[c,d])=>{if("string"!=typeof c)return t;let h=a?[...a,c]:[c];if((0,i.is)(d,s.Column))t.push({path:h,field:d,codec:o?.get(d,"normalize"),arrayDimensions:d.dimensions,column:d});else if((0,i.is)(d,n.SQL)||(0,i.is)(d,n.SQL.Aliased)){let e=u(d);t.push(e?{path:h,field:d,codec:o?.get(e,"normalize"),arrayDimensions:e.dimensions,column:e}:{path:h,field:d})}else if((0,i.is)(d,l.Subquery)){let e,r,l=Object.values(d._.selectedFields)[0];(0,i.is)(l,s.Column)?(e=l,r=l):(0,i.is)(l,n.SQL)?(e=u(l),r=l.decoder):(e=u(l),r=l.sql.decoder),r&&(d._.sql.decoder=r),t.push(e?{path:h,field:d,codec:o?.get(e,"normalize"),arrayDimensions:e.dimensions,column:e}:{path:h,field:d})}else(0,i.is)(d,r.Table)?t.push(...e(d[r.Table.Symbol.Columns],h,o)):t.push(...e(d,h,o));return t},[])},"textDecoder",0,d],704313);var h=s,f=class{static [i.entityKind]="ColumnBuilder";config;constructor(e,t,i){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e,t){""===this.config.name&&(this.config.name=t(e))}},m=e.i(500833),p=class{static [i.entityKind]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:s}=e();return{name:t,columns:i,foreignTable:s[0].table,foreignColumns:s}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new y(e,this)}},y=class{static [i.entityKind]="SQLiteForeignKey";reference;onUpdate;onDelete;constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),s=t.map(e=>e.name),r=i.map(e=>e.name),n=[this.table[m.TableName],...s,i[0].table[m.TableName],...r];return e??`${n.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}};e.s(["ForeignKeyBuilder",0,p],361328);var g=class extends f{static [i.entityKind]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:s})=>{let r;return r=new p(()=>({columns:[e],foreignColumns:[i()]})),s.onUpdate&&r.onUpdate(s.onUpdate),s.onDelete&&r.onDelete(s.onDelete),r.build(t)})}},b=class extends h.Column{static [i.entityKind]="SQLiteColumn";table;constructor(e,t){super(e,t),this.table=e}};function q(e){let t="";for(let i=0;i<e.length;i+=2)t+=String.fromCodePoint(Number.parseInt(e.slice(i,i+2),16));return t}e.s(["SQLiteColumn",0,b,"SQLiteColumnBuilder",0,g],100849);var S=class extends g{static [i.entityKind]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint int64","SQLiteBigInt")}build(e){return new w(e,this.config)}},w=class extends b{static [i.entityKind]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue=e=>"string"==typeof e?BigInt(q(e)):"u">typeof Buffer&&Buffer.from?BigInt((Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e)).toString("utf8")):BigInt(d.decode(e));mapToDriverValue=e=>Buffer.from(e.toString())},$=class extends g{static [i.entityKind]="SQLiteBlobJsonBuilder";constructor(e){super(e,"object json","SQLiteBlobJson")}build(e){return new v(e,this.config)}},v=class extends b{static [i.entityKind]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue=e=>"string"==typeof e?JSON.parse(q(e)):"u">typeof Buffer&&Buffer.from?JSON.parse((Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e)).toString("utf8")):JSON.parse(d.decode(e));mapToDriverValue=e=>Buffer.from(JSON.stringify(e))},Q=class extends g{static [i.entityKind]="SQLiteBlobBufferBuilder";constructor(e){super(e,"object buffer","SQLiteBlobBuffer")}build(e){return new x(e,this.config)}},x=class extends b{static [i.entityKind]="SQLiteBlobBuffer";mapFromDriverValue=e=>Buffer.isBuffer(e)?e:"string"==typeof e?Buffer.from(e,"hex"):Buffer.from(e);getSQLType(){return"blob"}};function L(e,t){let{name:i,config:s}=c(e,t);return s?.mode==="bigint"?new S(i):s?.mode==="buffer"?new Q(i):new $(i)}var N=class extends g{static [i.entityKind]="SQLiteCustomColumnBuilder";constructor(e,t,i){super(e,"custom","SQLiteCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new T(e,this.config)}},T=class extends b{static [i.entityKind]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;mapJson;forJsonSelect;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver,this.mapJson=t.customTypeParams.fromJson,this.forJsonSelect=t.customTypeParams.forJsonSelect}getSQLType(){return this.sqlName}mapFromDriverValue=e=>"function"==typeof this.mapFrom?this.mapFrom(e):e;mapFromJsonValue(e){return"function"==typeof this.mapJson?this.mapJson(e):this.mapFromDriverValue(e)}jsonSelectIdentifier(e,t){if("function"==typeof this.forJsonSelect)return this.forJsonSelect(e,t);let i=this.getSQLType().toLowerCase(),s=i.indexOf("(");switch(s+1?i.slice(0,s):i){case"numeric":case"decimal":case"bigint":return t`cast(${e} as text)`;case"blob":return t`hex(${e})`;default:return e}}mapToDriverValue=e=>"function"==typeof this.mapTo?this.mapTo(e):e};function C(e){return(t,i)=>{let{name:s,config:r}=c(t,i);return new N(s,r,e)}}var _=class extends g{static [i.entityKind]="SQLiteBaseIntegerBuilder";constructor(e,t,i){super(e,t,i),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}},A=class extends b{static [i.entityKind]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}},j=class extends _{static [i.entityKind]="SQLiteIntegerBuilder";constructor(e){super(e,"number int53","SQLiteInteger")}build(e){return new B(e,this.config)}},B=class extends A{static [i.entityKind]="SQLiteInteger"},F=class extends _{static [i.entityKind]="SQLiteTimestampBuilder";constructor(e,t){super(e,"object date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default(n.sql`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new K(e,this.config)}},K=class extends A{static [i.entityKind]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue=e=>new Date("string"==typeof e?e.replaceAll('"',""):"timestamp"===this.config.mode?1e3*e:e);mapToDriverValue=e=>{if("number"==typeof e)return e;let t=e.getTime();return"timestamp"===this.config.mode?Math.floor(t/1e3):t}},D=class extends _{static [i.entityKind]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new k(e,this.config)}},k=class extends A{static [i.entityKind]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue=e=>1===Number(e);mapToDriverValue=e=>+!!e};function O(e,t){let{name:i,config:s}=c(e,t);return s?.mode==="timestamp"||s?.mode==="timestamp_ms"?new F(i,s.mode):s?.mode==="boolean"?new D(i,s.mode):new j(i)}e.s(["int",0,O,"integer",0,O],937540);var P=class extends g{static [i.entityKind]="SQLiteNumericBuilder";constructor(e){super(e,"string numeric","SQLiteNumeric")}build(e){return new V(e,this.config)}},V=class extends b{static [i.entityKind]="SQLiteNumeric";mapFromDriverValue=e=>"string"==typeof e?e:String(e);getSQLType(){return"numeric"}},I=class extends g{static [i.entityKind]="SQLiteNumericNumberBuilder";constructor(e){super(e,"number","SQLiteNumericNumber")}build(e){return new J(e,this.config)}},J=class extends b{static [i.entityKind]="SQLiteNumericNumber";mapFromDriverValue=e=>"number"==typeof e?e:Number(e);mapToDriverValue=String;getSQLType(){return"numeric"}},E=class extends g{static [i.entityKind]="SQLiteNumericBigIntBuilder";constructor(e){super(e,"bigint int64","SQLiteNumericBigInt")}build(e){return new z(e,this.config)}},z=class extends b{static [i.entityKind]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}};function U(e,t){let{name:i,config:s}=c(e,t),r=s?.mode;return"number"===r?new I(i):"bigint"===r?new E(i):new P(i)}var M=class extends g{static [i.entityKind]="SQLiteRealBuilder";constructor(e){super(e,"number double","SQLiteReal")}build(e){return new R(e,this.config)}},R=class extends b{static [i.entityKind]="SQLiteReal";getSQLType(){return"real"}};function W(e){return new M(e??"")}var G=class extends g{static [i.entityKind]="SQLiteTextBuilder";constructor(e,t){super(e,t.enum?.length?"string enum":"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new H(e,this.config)}},H=class extends b{static [i.entityKind]="SQLiteText";enumValues=this.config.enumValues;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}},Z=class extends g{static [i.entityKind]="SQLiteTextJsonBuilder";constructor(e){super(e,"object json","SQLiteTextJson")}build(e){return new Y(e,this.config)}},Y=class extends b{static [i.entityKind]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue=e=>JSON.parse(e);mapToDriverValue=e=>JSON.stringify(e)};function X(e,t={}){let{name:i,config:s}=c(e,t);return"json"===s.mode?new Z(i):new G(i,s)}e.s(["text",0,X],380568);var ee=r;function et(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function ei(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,i)=>e+(0===i?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}let es=Symbol.for("drizzle:SQLiteInlineForeignKeys");var er=class extends ee.Table{static [i.entityKind]="SQLiteTable";static Symbol=Object.assign({},ee.Table.Symbol,{InlineForeignKeys:es});[ee.Table.Symbol.Columns];[es]=[];[ee.Table.Symbol.ExtraConfigBuilder]=void 0};let en=(t=void 0,(e,i,s)=>(function(e,t,i,s,r,n=e){let l="snake_case"===r?et:"camelCase"===r?ei:e=>e,a=new er(e,s,n),o=Object.fromEntries(Object.entries("function"==typeof t?t({blob:L,customType:C,integer:O,numeric:U,real:W,text:X}):t).map(([e,t])=>{t.setName(e,l);let i=t.build(a).postBuild();return a[es].push(...t.buildForeignKeys(i,a)),[e,i]})),u=Object.assign(a,o);return u[ee.Table.Symbol.Columns]=o,u[ee.Table.Symbol.ExtraConfigColumns]=o,i&&(u[er.Symbol.ExtraConfigBuilder]=i),u})(e,i,s,void 0,t));e.s(["SQLiteTable",0,er,"sqliteTable",0,en],75799);var el=class{static [i.entityKind]="SQLiteIndexBuilderOn";constructor(e,t){this.name=e,this.unique=t}on(...e){return new ea(this.name,e,this.unique)}},ea=class{static [i.entityKind]="SQLiteIndexBuilder";config;constructor(e,t,i){this.config={name:e,columns:t,unique:i,where:void 0}}where(e){return this.config.where=e,this}build(e){return new eo(this.config,e)}},eo=class{static [i.entityKind]="SQLiteIndex";config;isNameExplicit;constructor(e,t){this.config={...e,table:t},this.isNameExplicit=!!e.name}};e.s(["IndexBuilder",0,ea,"index",0,function(e){return new el(e,!1)}],646683);var eu=class{static [i.entityKind]="SQLitePrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new ec(e,this.columns,this.name)}},ec=class{static [i.entityKind]="SQLitePrimaryKey";columns;name;isNameExplicit;constructor(e,t,i){this.table=e,this.columns=t,this.name=i,this.isNameExplicit=!!i}getName(){return this.name??`${this.table[er.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}};e.s(["PrimaryKeyBuilder",0,eu,"primaryKey",0,function(...e){return e[0].columns?new eu(e[0].columns,e[0].name):new eu(e)}],201440);var ed=class{static [i.entityKind]="SQLiteUniqueConstraintBuilder";columns;constructor(e,t){this.name=t,this.columns=e}build(e){return new ef(e,this.columns,this.name)}},eh=class{static [i.entityKind]="SQLiteUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new ed(e,this.name)}},ef=class{static [i.entityKind]="SQLiteUniqueConstraint";columns;name;isNameExplicit;constructor(e,t,i){this.table=e,this.columns=t,this.isNameExplicit=!!i,this.name=i??function(e,t){return`${e[m.TableName]}_${t.join("_")}_unique`}(this.table,this.columns.map(e=>e.name))}getName(){return this.name}};e.s(["UniqueConstraintBuilder",0,ed,"unique",0,function(e){return new eh(e)}],616918)}];
|
|
17
17
|
|
|
18
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=_0rnf-6n._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[161335,e=>e.a(async(t,a)=>{try{var r=e.i(148831),o=e.i(91264),n=t([r]);[r]=n.then?(await n)():n;let l=(0,o.serverRoute)(()=>(0,r.findAllServers)());e.s(["GET",0,l]),a()}catch(e){a(e)}},!1),312508,e=>{"use strict";var t=e.i(747909),a=e.i(174017),r=e.i(996250),o=e.i(759756),n=e.i(561916),l=e.i(174677),i=e.i(869741),s=e.i(316795),c=e.i(487718),p=e.i(995169),m=e.i(47587),u=e.i(666012),d=e.i(570101),T=e.i(626937),b=e.i(10372),h=e.i(193695);e.i(52474);var v=e.i(600220);let f=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/mcp/route",pathname:"/api/mcp",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/mcp/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(161335),...{}}),{workAsyncStorage:g,workUnitAsyncStorage:S,serverHooks:w}=f;async function R(e,t,r){r.requestMeta&&(0,o.setRequestMeta)(e,r.requestMeta),f.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/mcp/route";g=g.replace(/\/index$/,"")||"/";let S=await f.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!S)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:w,deploymentId:R,params:y,nextConfig:E,parsedUrl:C,isDraftMode:z,prerenderManifest:A,routerServerContext:N,isOnDemandRevalidate:x,revalidateOnlyGenerated:q,resolvedPathname:O,clientReferenceManifest:P,serverActionsManifest:_}=S,j=(0,i.normalizeAppPath)(g),D=!!(A.dynamicRoutes[j]||A.routes[O]),I=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,C,!1):t.end("This page could not be found"),null);if(D&&!z){let e=!!A.routes[O],t=A.dynamicRoutes[j];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await I();throw new h.NoFallbackError}}let H=null;!D||f.isDev||z||(H="/index"===(H=O)?"/":H);let M=!0===f.isDev||!D,k=D&&!M;_&&P&&(0,l.setManifestsSingleton)({page:g,clientReferenceManifest:P,serverActionsManifest:_});let U=e.method||"GET",B=(0,n.getTracer)(),$=B.getActiveScopeSpan(),L=!!(null==N?void 0:N.isWrappedByNextServer),F=!!(0,o.getRequestMeta)(e,"minimalMode"),K=(0,o.getRequestMeta)(e,"incrementalCache")||await f.getIncrementalCache(e,E,A,F);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let G={params:y,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts,useCacheTimeout:E.experimental.useCacheTimeout},cacheComponents:!!E.cacheComponents,validationLevel:E.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:K,hmrRefreshHash:(0,o.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:E.cacheLife,staticPageGenerationTimeout:E.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,o)=>f.onRequestError(e,t,r,o,N)},sharedContext:{buildId:w,deploymentId:R}},V=new s.NodeNextRequest(e),W=new s.NodeNextResponse(t),X=c.NextRequestAdapter.fromNodeNextRequest(V,(0,c.signalFromNodeResponse)(t)),J=async({previousCacheEntry:a})=>{try{if(!F&&x&&q&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await f.handle(X,G);e.fetchMetrics=G.renderOpts.fetchMetrics;let n=G.renderOpts.pendingWaitUntil;n&&r.waitUntil&&(r.waitUntil(n),n=void 0);let l=G.renderOpts.collectedTags;if(!D)return await (0,u.sendResponse)(V,W,o,n),null;{let e=await o.blob(),t=(0,d.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[b.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=b.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,r=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=b.INFINITE_CACHE?!1!==a&&a>0?E.expireTime:void 0:G.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await f.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,m.getRevalidateReason)({isStaticGeneration:k,isOnDemandRevalidate:x})},!1,N),t}},Z=async(o,l)=>{try{var i,s;let o=await f.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:x,revalidateOnlyGenerated:q,responseGenerator:J,waitUntil:r.waitUntil,isMinimalMode:F});if(!D)return;if((null==o||null==(i=o.value)?void 0:i.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==o||null==(s=o.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});F||t.setHeader("x-nextjs-cache",x?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),z&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let n=(0,d.fromNodeOutgoingHttpHeaders)(o.value.headers);F&&D||n.delete(b.NEXT_CACHE_TAGS_HEADER),!o.cacheControl||t.getHeader("Cache-Control")||n.get("Cache-Control")||n.set("Cache-Control",(0,T.getCacheControlHeader)(o.cacheControl)),await (0,u.sendResponse)(V,W,new Response(o.value.body,{headers:n,status:o.value.status||200}));return}catch(t){if(t instanceof h.NoFallbackError||await f.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,m.getRevalidateReason)({isStaticGeneration:k,isOnDemandRevalidate:x})},!1,N),D)throw t;await (0,u.sendResponse)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!o)return;let e=t.statusCode;o.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(o.setStatus({code:n.SpanStatusCode.ERROR}),o.setAttribute("error.type",e.toString()));let a=B.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==p.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route")||j,i=`${U} ${r}`;o.setAttributes({"next.route":r,"http.route":r,"next.span_name":i}),o.updateName(i),l&&l!==o&&(l.setAttribute("http.route",r),l.updateName(i))})()}};if(L&&$)await Z($,void 0);else{let t=B.getActiveScopeSpan();await B.withPropagatedContext(e.headers,()=>B.trace(p.BaseServerSpan.handleRequest,{spanName:`${U} ${g}`,kind:n.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},e=>Z(e,t)),void 0,!L)}}e.s(["handler",0,R,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:g,workUnitAsyncStorage:S})},"routeModule",0,f,"serverHooks",0,w,"workAsyncStorage",0,g,"workUnitAsyncStorage",0,S])},148831,e=>e.a(async(t,a)=>{try{var r=e.i(875225),o=e.i(260338),n=e.i(518899),l=e.i(380690),i=e.i(528790),s=e.i(613240),c=e.i(441963),p=t([i]);function m(e){return(0,c.isRemoteConfig)(e)?{url:e.url}:{command:e.command,args:e.args}}async function u(){return(await i.database.select({name:s.mcpServerTable.name,config:s.mcpServerTable.config,lastError:s.mcpServerTable.lastError,toolCount:(0,o.count)(s.mcpToolTable.id)}).from(s.mcpServerTable).leftJoin(s.mcpToolTable,(0,r.eq)(s.mcpToolTable.serverName,s.mcpServerTable.name)).groupBy(s.mcpServerTable.name)).map(e=>({...e,config:m(e.config)}))}async function d(e){let[t]=await i.database.select({name:s.mcpServerTable.name,config:s.mcpServerTable.config,lastError:s.mcpServerTable.lastError,toolsSyncedAt:s.mcpServerTable.toolsSyncedAt}).from(s.mcpServerTable).where((0,r.eq)(s.mcpServerTable.name,e));return t?{...t,config:m(t.config),tools:await T(e)}:null}async function T(e){return i.database.select({id:s.mcpToolTable.id,name:s.mcpToolTable.name,description:s.mcpToolTable.description,inputSchema:s.mcpToolTable.inputSchema,outputSchema:s.mcpToolTable.outputSchema}).from(s.mcpToolTable).where((0,r.eq)(s.mcpToolTable.serverName,e)).orderBy(s.mcpToolTable.name)}async function b(e){let[t]=await i.database.select().from(s.mcpServerTable).where((0,r.eq)(s.mcpServerTable.name,e));return t??null}[i]=p.then?(await p)():p;let w=()=>l.appEvents.emit({type:"mcp"});async function h(e,t){await i.database.transaction(async a=>{t.length&&await a.insert(s.mcpToolTable).values(t.map(t=>({...t,serverName:e}))).onConflictDoUpdate({target:[s.mcpToolTable.serverName,s.mcpToolTable.name],set:{description:v(s.mcpToolTable.description),inputSchema:v(s.mcpToolTable.inputSchema),outputSchema:v(s.mcpToolTable.outputSchema)}}),await a.delete(s.mcpToolTable).where(t.length?(0,r.and)((0,r.eq)(s.mcpToolTable.serverName,e),(0,r.notInArray)(s.mcpToolTable.name,t.map(e=>e.name))):(0,r.eq)(s.mcpToolTable.serverName,e)),await a.update(s.mcpServerTable).set({lastError:null,toolsSyncedAt:new Date}).where((0,r.eq)(s.mcpServerTable.name,e))}),w()}function v(e){return n.sql.raw(`excluded."${e.name}"`)}async function f(e,t){await i.database.update(s.mcpServerTable).set({lastError:t}).where((0,r.eq)(s.mcpServerTable.name,e)),w()}async function g(e,t){await i.database.update(s.mcpServerTable).set({oauth:t}).where((0,r.eq)(s.mcpServerTable.name,e)),w()}async function S(e){let[t]=await i.database.select().from(s.mcpServerTable).where(n.sql`json_extract(${s.mcpServerTable.oauth}, '$.state') = ${e}`);return t??null}e.s(["findAllServers",0,u,"findAllTools",0,function(){return i.database.select({id:s.mcpToolTable.id,name:s.mcpToolTable.name,serverName:s.mcpToolTable.serverName,description:s.mcpToolTable.description}).from(s.mcpToolTable).orderBy(s.mcpToolTable.serverName,s.mcpToolTable.name)},"findPinnedTools",0,function(e){return i.database.select({server:s.mcpToolTable.serverName,name:s.mcpToolTable.name,description:s.mcpToolTable.description,inputSchema:s.mcpToolTable.inputSchema}).from(s.botMcpToolTable).innerJoin(s.mcpToolTable,(0,r.eq)(s.botMcpToolTable.toolId,s.mcpToolTable.id)).where((0,r.eq)(s.botMcpToolTable.botName,e)).orderBy(s.mcpToolTable.serverName,s.mcpToolTable.name)},"findServer",0,b,"findServerByOAuthState",0,S,"findServerDetail",0,d,"findToolSchemas",0,function(e,t){return t.length?i.database.select({name:s.mcpToolTable.name,description:s.mcpToolTable.description,inputSchema:s.mcpToolTable.inputSchema}).from(s.mcpToolTable).where((0,r.and)((0,r.eq)(s.mcpToolTable.serverName,e),(0,r.inArray)(s.mcpToolTable.name,t))).orderBy(s.mcpToolTable.name):Promise.resolve([])},"listServerNames",0,function(){return i.database.select({name:s.mcpServerTable.name}).from(s.mcpServerTable).orderBy(s.mcpServerTable.name)},"listToolNames",0,function(e){let t=i.database.select({server:s.mcpToolTable.serverName,name:s.mcpToolTable.name}).from(s.mcpToolTable);return e?t.where((0,r.eq)(s.mcpToolTable.serverName,e)).orderBy(s.mcpToolTable.name):t.orderBy(s.mcpToolTable.serverName,s.mcpToolTable.name)},"saveConnectionError",0,f,"saveOAuthData",0,g,"syncServerTools",0,h]),a()}catch(e){a(e)}},!1),441963,e=>{"use strict";var t=e.i(469719),a=e.i(704161);let r=t.z.object({url:t.z.url(),headers:t.z.record(t.z.string(),t.z.string()).optional(),oauthClient:t.z.object({clientId:t.z.string().min(1),clientSecret:t.z.string().optional()}).optional()}),o=t.z.object({command:t.z.string().min(1),args:t.z.array(t.z.string()).optional(),env:t.z.record(t.z.string(),t.z.string()).optional()}),n=t.z.union([r,o]),l=t.z.object({name:t.z.string(),description:t.z.string().optional(),inputSchema:t.z.looseObject({}).optional(),outputSchema:t.z.looseObject({}).optional()});t.z.object({clientInformation:t.z.looseObject({}).optional(),tokens:t.z.looseObject({}).optional(),authorizationServer:t.z.looseObject({}).optional(),codeVerifier:t.z.string().optional(),state:t.z.string().optional()});let i=t.z.object({name:t.z.string().min(1).max(40),config:n,toolCount:t.z.number().int(),lastError:t.z.string().nullish()}),s=l.extend({id:t.z.number().int(),description:t.z.string().nullish()});i.omit({toolCount:!0}).extend({tools:s.array().default([]),toolsSyncedAt:a.DateLikeSchema}),t.z.object({name:t.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:n}),t.z.union([t.z.object({mcpServers:t.z.record(t.z.string(),n)}),t.z.record(t.z.string(),n)]),e.s(["isRemoteConfig",0,function(e){return"url"in e}])},704161,e=>{"use strict";var t=e.i(469719);let a=t.z.union([t.z.date(),t.z.iso.datetime()]);e.s(["DateLikeSchema",0,a,"toDate",0,e=>new Date(e)])},260338,e=>{"use strict";var t=e.i(518899),a=e.i(844988),r=e.i(156325);e.s(["count",0,function(e){return t.sql`count(${e||t.sql.raw("*")})`.mapWith(Number)},"max",0,function(e){return t.sql`max(${e})`.mapWith((0,a.is)(e,r.Column)?e:String)}])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_0sb7tlz._.js.map
|