@cleocode/cleo 2026.9.7 → 2026.9.10
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/dist/cli/index.js +3873 -2234
- package/package.json +14 -13
- package/scripts/check-cleo-tarball-size.mjs +105 -0
- package/scripts/copy-studio-dist.mjs +33 -9
- package/studio-dist/client/_app/immutable/chunks/{wI_OOyoh.js → BB7zPpV2.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{D8NsLz6i.js → BOnrCZaR.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{eK8hf4s7.js → BSRBuVG3.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/C6jhAnil.js +1 -0
- package/studio-dist/client/_app/immutable/chunks/C87Q3uxm.js +1 -0
- package/studio-dist/client/_app/immutable/chunks/{DVHIxkgs.js → CLZBEpLY.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{CqF5Lomf.js → CTLGzgdN.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{o1PZ6Kzq.js → CY3heNub.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{RptFUp2P.js → Cge6qiwc.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{BRgWBQlV.js → CnwXLaZJ.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{Bxz2A0ZC.js → DEH43YwF.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/DGftG5oL.js +3 -0
- package/studio-dist/client/_app/immutable/chunks/DX_JOBSO.js +1 -0
- package/studio-dist/client/_app/immutable/chunks/{CEqOYim7.js → DZrdToAH.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/EZwHPWle.js +2 -0
- package/studio-dist/client/_app/immutable/chunks/cWVw9W0E.js +3 -0
- package/studio-dist/client/_app/immutable/chunks/{B9psmq5-.js → rB_71s8h.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{JPJd4fEI.js → rUtW7Hx6.js} +1 -1
- package/studio-dist/client/_app/immutable/entry/app.tvu3-wbp.js +2 -0
- package/studio-dist/client/_app/immutable/entry/start.BS-rpdjH.js +1 -0
- package/studio-dist/client/_app/immutable/nodes/{0.CZzEEyVh.js → 0.DMP7swbx.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{1.Bj3Opbua.js → 1.CYZMFpIp.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{10.xe_Mc2Ko.js → 10.3rxHNnSx.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{11.DuKPA7JD.js → 11.B6jWv3Kz.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{12.BoZ_QrUS.js → 12.BrDHeTEq.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{13.DFJiUiv8.js → 13.CE5bd4JV.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{14.eaAlFU4w.js → 14.DgXD2LRx.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{15.BfXgiwMC.js → 15.Cz1KI9Fv.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{16.mEwy9cqh.js → 16.K9wYQPhb.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{17.DP2QtQGn.js → 17.CtUmdfMg.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{18.Bu0054sX.js → 18.mtosd0sL.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{19.UWt6QbCm.js → 19.su55K8y_.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{2.y5jKpHiR.js → 2.mqgFVWFQ.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{20.B1AIHdkP.js → 20.NJuHLxuS.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{21.CpAN71H8.js → 21.BhwhdQCq.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{22.CrYKrN4c.js → 22.BmJEWwER.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{23.pGRaHQjq.js → 23.CAVIJEH-.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{24.BUoUu37z.js → 24.CMuXs5Sy.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/25.DhMBJYAo.js +39 -0
- package/studio-dist/client/_app/immutable/nodes/26.CJ4FA5FS.js +1 -0
- package/studio-dist/client/_app/immutable/nodes/{28.DcmYM7lb.js → 28.D64RBcfs.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{29.lbHbMqNO.js → 29.yfuBeH1x.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{3.Dyir4xXj.js → 3.y115j1d5.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{30.DXj0Wm2A.js → 30.1WUv5bh9.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/4.D6vXYBoQ.js +1 -0
- package/studio-dist/client/_app/immutable/nodes/{5.VWSdP7oc.js → 5.hjw2O-4e.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{6.Dl-XLwOj.js → 6.CAoDfDt6.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{7.CFuC5L-y.js → 7.CLgPSQ8Z.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{8.BCJ0DhOb.js → 8.zuaO1Hik.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{9.Bq4SUzL9.js → 9.Cdsd85m2.js} +1 -1
- package/studio-dist/client/_app/version.json +1 -1
- package/studio-dist/server/chunks/0-BQvtFOrC.js +41 -0
- package/studio-dist/server/chunks/1-Bx2_yoiK.js +9 -0
- package/studio-dist/server/chunks/{10-DvOD4ksa.js → 10-CYLc3d5x.js} +3 -3
- package/studio-dist/server/chunks/{11-DMnBZ02H.js → 11-DcIYR5vm.js} +3 -3
- package/studio-dist/server/chunks/{12-CCyRyRWX.js → 12-WE1u104t.js} +3 -3
- package/studio-dist/server/chunks/{13-Dx1c3a_X.js → 13-joBDoxhK.js} +3 -3
- package/studio-dist/server/chunks/{14-Bo-dTCaZ.js → 14-Doj5F4uJ.js} +3 -3
- package/studio-dist/server/chunks/{15-BvUNl3KL.js → 15-nQTeHGD1.js} +3 -3
- package/studio-dist/server/chunks/{16-De6EzPSa.js → 16-CcTN0e8k.js} +5 -4
- package/studio-dist/server/chunks/{17-CZNsiZhi.js → 17-DWiFnzES.js} +10 -93
- package/studio-dist/server/chunks/{18-CbxxjZox.js → 18-Dcc9GnPo.js} +5 -4
- package/studio-dist/server/chunks/{19-DqHyladS.js → 19-BAQHPrMB.js} +3 -3
- package/studio-dist/server/chunks/{2-COvmA-ZA.js → 2-DXSVVaej.js} +10 -93
- package/studio-dist/server/chunks/20-DfQlGHPW.js +57 -0
- package/studio-dist/server/chunks/{21-DXK9ptAC.js → 21-qhGjkW41.js} +4 -31
- package/studio-dist/server/chunks/{22-DD5CLWJC.js → 22-Byy16hFA.js} +3 -3
- package/studio-dist/server/chunks/23-CZpFrGp4.js +97 -0
- package/studio-dist/server/chunks/24-EEysaT9T.js +67 -0
- package/studio-dist/server/chunks/{25-CAg6Xcmn.js → 25-CgiYn70L.js} +15 -96
- package/studio-dist/server/chunks/{26-_nfVTvNi.js → 26-Cfd6BaUb.js} +12 -93
- package/studio-dist/server/chunks/{27-C9edghG4.js → 27-Cqzlh9gZ.js} +3 -2
- package/studio-dist/server/chunks/{28-VemTJGyc.js → 28-DeYe2rpm.js} +8 -62
- package/studio-dist/server/chunks/{29-CXP-m29t.js → 29-6pjLM0Z1.js} +10 -93
- package/studio-dist/server/chunks/{3-B8KhfvHp.js → 3-E_fWDAkq.js} +9 -25
- package/studio-dist/server/chunks/{30-QiM1S4cJ.js → 30-Dw317sSW.js} +10 -93
- package/studio-dist/server/chunks/{31-BwdY9NnB.js → 31-Q4kHbp8j.js} +3 -2
- package/studio-dist/server/chunks/{4-CSaG4HjO.js → 4-C9BMSh4K.js} +4 -3
- package/studio-dist/server/chunks/{5-i5ry4y3C.js → 5-C0CF4WKG.js} +3 -3
- package/studio-dist/server/chunks/{6-DR1GWBMT.js → 6-BWyOJust.js} +3 -3
- package/studio-dist/server/chunks/{7-DSNwn3aQ.js → 7-CK4MK5gy.js} +3 -3
- package/studio-dist/server/chunks/{8-Bj0bx07K.js → 8-CiX7Xk9k.js} +3 -3
- package/studio-dist/server/chunks/{9-B3Tz0mZq.js → 9-Be5118w4.js} +3 -3
- package/studio-dist/server/chunks/{HeroHeader-v4Q9vaGr.js → HeroHeader-BrGN5WPw.js} +2 -2
- package/studio-dist/server/chunks/{Sparkline-BJ-GuhRd.js → Sparkline-DU_NVxz9.js} +2 -2
- package/studio-dist/server/chunks/{StatBlock-DHJMmOCx.js → StatBlock-jNsxycS1.js} +2 -2
- package/studio-dist/server/chunks/{Tabs-DzG6Bn9a.js → Tabs-DQKDflnT.js} +2 -2
- package/studio-dist/server/chunks/_dispatch-DTWViLGL.js +145 -0
- package/studio-dist/server/chunks/{_layout.svelte-BEIGQcIv.js → _layout.svelte-CL6GfET2.js} +7 -9
- package/studio-dist/server/chunks/{_page.svelte-al08ovKm.js → _page.svelte-6iMiGR11.js} +5 -5
- package/studio-dist/server/chunks/{_page.svelte-Byz2djto.js → _page.svelte-B-YXGvAW.js} +5 -5
- package/studio-dist/server/chunks/{_page.svelte-tYN7_LXI.js → _page.svelte-B5E6RqVb.js} +9 -11
- package/studio-dist/server/chunks/{_page.svelte-UYiF7YBK.js → _page.svelte-BCRyjlk2.js} +5 -5
- package/studio-dist/server/chunks/{_page.svelte-CCoTp89s.js → _page.svelte-BoYafqft.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-nzffIbBP.js → _page.svelte-C7Wm6_HB.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-C_VSL8NW.js → _page.svelte-Cgqt7ucn.js} +13 -71
- package/studio-dist/server/chunks/{_page.svelte-CophUar3.js → _page.svelte-CqI6hqMm.js} +5 -5
- package/studio-dist/server/chunks/{_page.svelte-BgwL2Gyu.js → _page.svelte-CvQ2rZZ1.js} +11 -13
- package/studio-dist/server/chunks/{_page.svelte-l4Z_xjl9.js → _page.svelte-CvTyJEyS.js} +9 -11
- package/studio-dist/server/chunks/{_page.svelte-DOWw416I.js → _page.svelte-CvzAttO9.js} +11 -13
- package/studio-dist/server/chunks/{_page.svelte-DYNorA0S.js → _page.svelte-Cx9Ptecp.js} +10 -67
- package/studio-dist/server/chunks/{_page.svelte-Wfx7ww_h.js → _page.svelte-Cx9dPjsT.js} +11 -13
- package/studio-dist/server/chunks/{_page.svelte-2cgtvHwW.js → _page.svelte-DGN5j-At.js} +13 -71
- package/studio-dist/server/chunks/{_page.svelte-BVVTrzTL.js → _page.svelte-DaheDIRs.js} +5 -5
- package/studio-dist/server/chunks/{_page.svelte-M5D2QnMS.js → _page.svelte-Dm8y5a8S.js} +10 -67
- package/studio-dist/server/chunks/{_page.svelte-B_pq-Z98.js → _page.svelte-DqXxyNsF.js} +7 -7
- package/studio-dist/server/chunks/{_page.svelte-C3aIui4o.js → _page.svelte-DqsbnAhk.js} +4 -4
- package/studio-dist/server/chunks/{_page.svelte-ksTJUXce.js → _page.svelte-Dt0_c1T-.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-bGhsrIjS.js → _page.svelte-Dv6iwhu7.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-BXyoMME1.js → _page.svelte-GPiHej3P.js} +5 -5
- package/studio-dist/server/chunks/{_page.svelte-CYDjW1R0.js → _page.svelte-LuRm8XxE.js} +5 -5
- package/studio-dist/server/chunks/{_page.svelte-Clbkk1gm.js → _page.svelte-Z7nL9SC-.js} +8 -9
- package/studio-dist/server/chunks/{_page.svelte-DUWbZjC7.js → _page.svelte-_kntHS6v.js} +4 -4
- package/studio-dist/server/chunks/{_page.svelte-BIlhmugm.js → _page.svelte-eiomv6Pa.js} +11 -13
- package/studio-dist/server/chunks/{_page.svelte-9OQphlnm.js → _page.svelte-jXJbd8Mx.js} +14 -69
- package/studio-dist/server/chunks/{_page.svelte-CHzXuw2Q.js → _page.svelte-me5SUosG.js} +3 -3
- package/studio-dist/server/chunks/{_server.ts-DSzRdt1U.js → _server.ts--2m_U4SL.js} +11 -94
- package/studio-dist/server/chunks/{_server.ts-ujoDR2_g.js → _server.ts--sGLmBsz.js} +10 -92
- package/studio-dist/server/chunks/{_server.ts-k2fApwOp.js → _server.ts-0ukyuE0I.js} +5 -60
- package/studio-dist/server/chunks/_server.ts-1eW2mTeh.js +40 -0
- package/studio-dist/server/chunks/{_server.ts-Bfr4u3EP.js → _server.ts-3LzqLzt0.js} +10 -92
- package/studio-dist/server/chunks/_server.ts-40h9Y46Y.js +122 -0
- package/studio-dist/server/chunks/_server.ts-5euivmMj.js +38 -0
- package/studio-dist/server/chunks/{_server.ts-CShsBkeE.js → _server.ts-B0uoay97.js} +7 -23
- package/studio-dist/server/chunks/{_server.ts-hL92cV7Z.js → _server.ts-B5vYKkI6.js} +9 -63
- package/studio-dist/server/chunks/{_server.ts-_RJXtmfi.js → _server.ts-B8dTbPHd.js} +8 -23
- package/studio-dist/server/chunks/{_server.ts-C3Jo-ju8.js → _server.ts-BA8Xdegq.js} +10 -92
- package/studio-dist/server/chunks/_server.ts-BBClE0n9.js +54 -0
- package/studio-dist/server/chunks/{_server.ts-ZS1_yMwR.js → _server.ts-BDwMoyZ_.js} +6 -32
- package/studio-dist/server/chunks/{_server.ts-sv4pA808.js → _server.ts-BE-Uhx4N.js} +5 -46
- package/studio-dist/server/chunks/{_server.ts-DV6pzF-M.js → _server.ts-BSHADOUJ.js} +4 -3
- package/studio-dist/server/chunks/_server.ts-BcsqAqXt.js +67 -0
- package/studio-dist/server/chunks/_server.ts-Bl9tMqwZ.js +159 -0
- package/studio-dist/server/chunks/_server.ts-BlzDnRI0.js +51 -0
- package/studio-dist/server/chunks/{_server.ts-DnE0f-iC.js → _server.ts-BtuemCsf.js} +4 -3
- package/studio-dist/server/chunks/{_server.ts-BPcErnS0.js → _server.ts-C2nYqbd9.js} +10 -92
- package/studio-dist/server/chunks/{_server.ts-4p6cp9ke.js → _server.ts-C6IDM_3I.js} +10 -92
- package/studio-dist/server/chunks/_server.ts-C8Z32vuL.js +45 -0
- package/studio-dist/server/chunks/_server.ts-CBXyadsy.js +26 -0
- package/studio-dist/server/chunks/{_server.ts-Do9RIPRo.js → _server.ts-CE6h2ATE.js} +5 -32
- package/studio-dist/server/chunks/_server.ts-CH06JVqZ.js +65 -0
- package/studio-dist/server/chunks/_server.ts-CNqcws-M.js +29 -0
- package/studio-dist/server/chunks/{_server.ts-CJA1djzJ.js → _server.ts-CPf8necd.js} +8 -92
- package/studio-dist/server/chunks/{_server.ts-uUx7uT2Y.js → _server.ts-CYv5YuHd.js} +6 -43
- package/studio-dist/server/chunks/{_server.ts-B2E7fxo9.js → _server.ts-CZ5GZRWX.js} +6 -91
- package/studio-dist/server/chunks/{_server.ts-DSAv66wD.js → _server.ts-CbThsyhY.js} +4 -3
- package/studio-dist/server/chunks/{_server.ts-DgbY5EB3.js → _server.ts-CeQolQOK.js} +10 -92
- package/studio-dist/server/chunks/_server.ts-ChoGyX5C.js +61 -0
- package/studio-dist/server/chunks/_server.ts-CjJYkLJH.js +61 -0
- package/studio-dist/server/chunks/{_server.ts-lPlBUIJX.js → _server.ts-CtjArzxf.js} +5 -60
- package/studio-dist/server/chunks/{_server.ts-Cq60m8Pw.js → _server.ts-D3QWZwt_.js} +4 -3
- package/studio-dist/server/chunks/{_server.ts-CkoJ2HCW.js → _server.ts-D6wP5bCh.js} +10 -92
- package/studio-dist/server/chunks/{_server.ts-DwTRjS4y.js → _server.ts-D7JwQTun.js} +10 -93
- package/studio-dist/server/chunks/_server.ts-DKFJdXPK.js +97 -0
- package/studio-dist/server/chunks/_server.ts-DNAPGKEF.js +55 -0
- package/studio-dist/server/chunks/_server.ts-DQiTiY3E.js +78 -0
- package/studio-dist/server/chunks/{_server.ts-BT0Uq2yq.js → _server.ts-DUyeSXbV.js} +10 -92
- package/studio-dist/server/chunks/{_server.ts-DRVz9D-J.js → _server.ts-DY7BwZCv.js} +9 -24
- package/studio-dist/server/chunks/{_server.ts-Cz0zgaUV.js → _server.ts-D_E276ms.js} +3 -2
- package/studio-dist/server/chunks/{_server.ts-B5g3eScF.js → _server.ts-DgtmTAp5.js} +5 -60
- package/studio-dist/server/chunks/{_server.ts-CboRJY0Q.js → _server.ts-DhTKaw7h.js} +10 -63
- package/studio-dist/server/chunks/_server.ts-DqKBSCPT.js +31 -0
- package/studio-dist/server/chunks/{_server.ts-CpmMp5D8.js → _server.ts-DyXBNnRD.js} +4 -3
- package/studio-dist/server/chunks/_server.ts-DzjUpduu.js +25 -0
- package/studio-dist/server/chunks/{_server.ts-CGiAXy5i.js → _server.ts-Dznqw6Dg.js} +8 -23
- package/studio-dist/server/chunks/{_server.ts-tKMjUFUP.js → _server.ts-EVwS7UXb.js} +4 -3
- package/studio-dist/server/chunks/_server.ts-J17j25VG.js +62 -0
- package/studio-dist/server/chunks/{_server.ts-BdN4AJ6o.js → _server.ts-VQchZxXq.js} +10 -91
- package/studio-dist/server/chunks/{_server.ts-C4BcDGqS.js → _server.ts-XLV5SvjH.js} +7 -63
- package/studio-dist/server/chunks/_server.ts-jZgqFIJz.js +45 -0
- package/studio-dist/server/chunks/{_server.ts-Bw7A4zgb.js → _server.ts-lyiGGv7w.js} +5 -3
- package/studio-dist/server/chunks/{brain-CXR7ZT7S.js → brain-xt_NeshR.js} +2 -2
- package/studio-dist/server/chunks/cleo-home-_XIqkZaL.js +109 -0
- package/studio-dist/server/chunks/{cli-action-DQcaqcfn.js → cli-action-VJPEn1pY.js} +2 -2
- package/studio-dist/server/chunks/{client-CgX38JBu.js → client-D71MZ7Vi.js} +5 -6
- package/studio-dist/server/chunks/cluster-label-layer-CysRMvhi.js +6721 -0
- package/studio-dist/server/chunks/connections-CWLPjwBP.js +15 -0
- package/studio-dist/server/chunks/{connections2-mi7mZqJM.js → connections2-DHVs5ytW.js} +32 -19
- package/studio-dist/server/chunks/{dev-BNpEUZI3.js → dev-Br5zieNA.js} +2 -2
- package/studio-dist/server/chunks/dist-BzgWhfUR.js +18748 -0
- package/studio-dist/server/chunks/{error.svelte-CplNulnS.js → error.svelte-BIToUowC.js} +6 -8
- package/studio-dist/server/chunks/{explorer-loader-BN_mkt3_.js → explorer-loader-B_uCSs9_.js} +2 -2
- package/studio-dist/server/chunks/exports-Dg-gdPPq.js +124 -0
- package/studio-dist/server/chunks/{hooks.server-DBsyphiX.js → hooks.server-CWBRp8NI.js} +10 -93
- package/studio-dist/server/chunks/{http-CRTZe306.js → http-DPU3HHl2.js} +3 -4
- package/studio-dist/server/chunks/{index-server-DocJvixA.js → index-server-BgfA6C0S.js} +17 -4
- package/studio-dist/server/chunks/{internal-D6eWgsHJ.js → internal-DPnIJYMs.js} +56 -92
- package/studio-dist/server/chunks/{memory2-Cgc_4D5q.js → memory-BZHnDZzu.js} +4 -4
- package/studio-dist/server/chunks/{nexus-adapter-9EL_VlGI.js → nexus-adapter-D1ryYG1Z.js} +5 -5
- package/studio-dist/server/chunks/{no-face-up-DcejJLy-.js → no-face-up-B_3h6Hgs.js} +2 -2
- package/studio-dist/server/chunks/project-context-BAXQmgch.js +188 -0
- package/studio-dist/server/chunks/{src-BUqGet2c.js → src-D2rW9bIF.js} +422 -5
- package/studio-dist/server/chunks/{stores-5DmdjPCH.js → stores-BZdYTyl7.js} +3 -3
- package/studio-dist/server/chunks/{tasks2-Bf9VHrv-.js → tasks-sWuEmiGW.js} +2349 -9
- package/studio-dist/server/chunks/{ui-DR8zOSpC.js → ui-CkQ-pCs3.js} +2 -2
- package/studio-dist/server/chunks/utils-g564cUMV.js +151 -0
- package/studio-dist/server/index.js +5 -16
- package/studio-dist/server/manifest.js +88 -88
- package/dist/cli/index.js.map +0 -6
- package/studio-dist/client/_app/immutable/assets/parse-worker.CSEr67Qi.js +0 -1127
- package/studio-dist/client/_app/immutable/chunks/2mEksghu2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/3KebaI-z.js +0 -53
- package/studio-dist/client/_app/immutable/chunks/3y2yNYEk2.js +0 -3
- package/studio-dist/client/_app/immutable/chunks/7UXYlaI1.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/83VLmCvk.js +0 -4
- package/studio-dist/client/_app/immutable/chunks/84Rhmi6r.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/9CV9TXTg2.js +0 -92
- package/studio-dist/client/_app/immutable/chunks/9LFtcz24.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/9bLMgKwu2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/9kKqohVR2.js +0 -37
- package/studio-dist/client/_app/immutable/chunks/B-Ye28EY.js +0 -7
- package/studio-dist/client/_app/immutable/chunks/B-jnUl7o.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B0ORuy8x2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B0xCM1wN2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B0zCN4sX.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B1wt-iGW.js +0 -7
- package/studio-dist/client/_app/immutable/chunks/B2F3KUIU.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B2_6RrlL2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B2qKEYxA2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B2u2rNyI2.js +0 -8
- package/studio-dist/client/_app/immutable/chunks/B3_X3Lhd2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B3sNtbqf.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/B4NQP1Ax2.js +0 -6
- package/studio-dist/client/_app/immutable/chunks/BAtZg5v5.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BB6WKLm82.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BBX8UDtn.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BBs1U1iU.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BEli_4Jp2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BEt2wIUt.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BEyM8qSW2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BFZA3Dsk2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BGdPweG1.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BGiusSqE.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BGmpyfzD.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BH5rhSIR.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BHciFt922.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BHnFwTQY.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BIvye3XP2.js +0 -59
- package/studio-dist/client/_app/immutable/chunks/BJ8mcpQA2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BK17qSHw.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BLkgUtyb.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BMUko3r62.js +0 -5
- package/studio-dist/client/_app/immutable/chunks/BMwzdEaa.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BQZx6brg.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BUPJTTTd.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BVNGAeZe2.js +0 -146
- package/studio-dist/client/_app/immutable/chunks/BWfLryGm.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BXIfeogw.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BXTfFyUU.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BYJC6_MM.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BZV1ZJzH.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BZu9rehd.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Bbzm48C52.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BfGnlwjH.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Bfjb9LPp.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BieFfu-R.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Bmv63uXe2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BtBW1A0u.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/BxISGQCl2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/ByNR_KvT.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BzjhD6Hr2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/BzpWnq0c2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/C-yJVcyI2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/C0cQ-8kS2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/C1vWmhYe.js +0 -48
- package/studio-dist/client/_app/immutable/chunks/C1w6bBje.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/C243sn7r.js +0 -4
- package/studio-dist/client/_app/immutable/chunks/C2oZaDvt.js +0 -67
- package/studio-dist/client/_app/immutable/chunks/C3OziSQx.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/C3hFPbMK.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/C4P9oFvU2.js +0 -6
- package/studio-dist/client/_app/immutable/chunks/C5Nlanei.js +0 -8
- package/studio-dist/client/_app/immutable/chunks/C6KBAXPl.js +0 -15
- package/studio-dist/client/_app/immutable/chunks/C8MZnWta.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CAoan3K12.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CBpcINYH.js +0 -29
- package/studio-dist/client/_app/immutable/chunks/CE7phgWq.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CFb4Co_K.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/CGWoRK3t2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CH3t4xo1.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CHJgk6g-.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CHgPjuDQ.js +0 -17
- package/studio-dist/client/_app/immutable/chunks/CHkCZrnr.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CI_91WUN.js +0 -4
- package/studio-dist/client/_app/immutable/chunks/CJ7-hP0H.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CKIrNnkY2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CKoQ7Ko5.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CM8O4zqs.js +0 -56
- package/studio-dist/client/_app/immutable/chunks/CMz3AVRO.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CNToUR3P.js +0 -13
- package/studio-dist/client/_app/immutable/chunks/CNuQG1yl2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CQLIZtxj.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/CQYVNgM0.js +0 -20
- package/studio-dist/client/_app/immutable/chunks/CQeVOmFO2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CSPHHq09.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CTJEdbIn.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CTTT3wYw.js +0 -35
- package/studio-dist/client/_app/immutable/chunks/CV4ck7fz.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/CXQrVnHf.js +0 -11
- package/studio-dist/client/_app/immutable/chunks/CXTCtOUQ.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/C_CsU7Qq.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/C_IZx3682.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/CbTnu2Po2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Cba8RZ1a2.js +0 -8
- package/studio-dist/client/_app/immutable/chunks/Cc8xxDr5.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CdPxoldu.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CdqDTozW.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CdsmcCfC.js +0 -25
- package/studio-dist/client/_app/immutable/chunks/CeYPAoY9.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Cf4kGS9y.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CfWEqXtJ2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Cg7Wj2b9.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/CgTpKZfi2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Chpy9ca7.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/CiLKuLrQ.js +0 -4
- package/studio-dist/client/_app/immutable/chunks/CjNDJjwu.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Cjde0ZKr2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Cjgnade02.js +0 -3
- package/studio-dist/client/_app/immutable/chunks/Ckp90om52.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/ClAPVhCD.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/ClT89UdO.js +0 -11
- package/studio-dist/client/_app/immutable/chunks/CnJf5tML.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CpF4Rrcc2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CqCka5yX2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CqtqZrOl.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CrJdywQt.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Cs0zC2l2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CsMn5fBs.js +0 -141
- package/studio-dist/client/_app/immutable/chunks/CsvKLHQQ2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/Ctaresvj.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Ctetf8vc2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/Cv7yW6MG.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CxRIz-Zd.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/CxbvtjIH.js +0 -3
- package/studio-dist/client/_app/immutable/chunks/CxfeoXkZ.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/CySLscL2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/D0PKQAbM.js +0 -87
- package/studio-dist/client/_app/immutable/chunks/D0WQsLTu.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D1LBVx6r2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D1NlFXu9.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D1QfC4hu2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D1yrHAn72.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D2pa4reh.js +0 -7
- package/studio-dist/client/_app/immutable/chunks/D3QsWcIw2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/D4OkQuPl2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D6UDnATk2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D7w7HllH.js +0 -38
- package/studio-dist/client/_app/immutable/chunks/D93KpglN.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D99fQj2G2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DB5ifLM-.js +0 -3
- package/studio-dist/client/_app/immutable/chunks/DBhP8ifO2.js +0 -15
- package/studio-dist/client/_app/immutable/chunks/DF_4OWhj.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/DFpNK1vs2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DGRYMk-W.js +0 -142
- package/studio-dist/client/_app/immutable/chunks/DH3CcQwq.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DHQfJeLU.js +0 -4
- package/studio-dist/client/_app/immutable/chunks/DL89yEDy2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DLRku_0p2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/DMZkjPYT2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DNP72foU.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DO2GztVm.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DOVNXmCK2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DOqzs8kl2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DQnR63hh2.js +0 -7
- package/studio-dist/client/_app/immutable/chunks/DTxtWPkw.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DVDgCC9A2.js +0 -20
- package/studio-dist/client/_app/immutable/chunks/DVVCJYjz.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DWRhYUMj2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DWavBJBI.js +0 -4
- package/studio-dist/client/_app/immutable/chunks/DXDSWRw-.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DXoHaH4a.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/DXpCX2Hi.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DYP3EJMY.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DYQphR_V.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DYUlIivP.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DYo2ye8X2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DYxFu8yV.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DZ66sRb6.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/D_XTiylm2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DaRv9jn22.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DaXb9i_E.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Dccf4VP2.js +0 -24
- package/studio-dist/client/_app/immutable/chunks/DdODs-Sb.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DdekYWer.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/DeHaovsF.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DeRRkRO52.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DeWI5qCn.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DfivR-Md.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DgmxpSo7.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DhPLWrun2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DhhrVdfi.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/Djr2dbcc2.js +0 -37
- package/studio-dist/client/_app/immutable/chunks/DjuRo5vv.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Djz4EDzO.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DkRfaw-K2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DksB5g4W2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Dmqenb5z2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DnbToVyf.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/DpGZwlmj.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Dq0lE5C32.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Dq54XqHT2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DqK84mbb.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DqjFtSJD.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/DrKWWDpL.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DsQIgu-4.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DsqdgJHS2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DtNkZUkq.js +0 -17
- package/studio-dist/client/_app/immutable/chunks/DutIls4V2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DvxYFW4C.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Dwp-76GQ.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/DxSZd548.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DxiUMhk0.js +0 -5
- package/studio-dist/client/_app/immutable/chunks/DxslLswf.js +0 -23
- package/studio-dist/client/_app/immutable/chunks/Dy7EjGgb2.js +0 -9
- package/studio-dist/client/_app/immutable/chunks/DyGQ_VXC.js +0 -3
- package/studio-dist/client/_app/immutable/chunks/DySe3kTV2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DyzE2Uxw.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/DzhuJaxE2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/FmMHyrh6.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Gxs0J274.js +0 -5
- package/studio-dist/client/_app/immutable/chunks/HwtzDYxN.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/ITRz_Q7H2.js +0 -15
- package/studio-dist/client/_app/immutable/chunks/KDNP98XY2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/LmVjFhpk2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/MiAejGV_.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Ml4JR6Jz2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/NU5S3nNs2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/Oh5zPjv3.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/QZkvJ9vi.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Rbn8UpBm.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/SPX3gYwn2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/TX-23QW3.js +0 -3
- package/studio-dist/client/_app/immutable/chunks/UyeQuL132.js +0 -12
- package/studio-dist/client/_app/immutable/chunks/VQszoXcV.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/VtZsEMxD.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/W2IeK61p2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Wadww7ZG.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/WgfA1zWk2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/WxIgAS1f.js +0 -21
- package/studio-dist/client/_app/immutable/chunks/XrsBoOj9.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/Y3PX4poR.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/YxfwqiF32.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Z7uO1YaO.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/_4ykQk_8.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/_kRcZFVn.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/aQNM7eVA2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/bHKz_Fb2.js +0 -45
- package/studio-dist/client/_app/immutable/chunks/bJRyRGSZ.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/dlzF6lnR.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/fjRbpfEr2.js +0 -26
- package/studio-dist/client/_app/immutable/chunks/imLk4if5.js +0 -3
- package/studio-dist/client/_app/immutable/chunks/lgRG0R-32.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/mFhCjxQJ2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/mgnH6qYg.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/n6M_5LoW.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/nLIOiDZp2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/nab7WB3u2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/orUmAKoW2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/p-fLQDfY2.js +0 -63
- package/studio-dist/client/_app/immutable/chunks/s0-WkOGk2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/sPuXfbUF.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/t4h0vrqR2.js +0 -2
- package/studio-dist/client/_app/immutable/chunks/uE83FKL-.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/uzhXlm0g2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/vTrEsGlD2.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/xJgCk3dx2.js +0 -28
- package/studio-dist/client/_app/immutable/chunks/z0Mt579s2.js +0 -13
- package/studio-dist/client/_app/immutable/entry/app.BoQ7cgT2.js +0 -2
- package/studio-dist/client/_app/immutable/entry/start.Cg1v8DU4.js +0 -1
- package/studio-dist/client/_app/immutable/nodes/25.ddZ1_EFk.js +0 -1
- package/studio-dist/client/_app/immutable/nodes/26.6OcmQbLV.js +0 -1
- package/studio-dist/client/_app/immutable/nodes/4.CCjOEwVU.js +0 -1
- package/studio-dist/server/chunks/0-CvsKDxQ6.js +0 -126
- package/studio-dist/server/chunks/1-ck_x2Hf0.js +0 -9
- package/studio-dist/server/chunks/20-DVU22np7.js +0 -142
- package/studio-dist/server/chunks/23-D_tUnnoc.js +0 -181
- package/studio-dist/server/chunks/24-CVlymvLF.js +0 -151
- package/studio-dist/server/chunks/AwsRestJsonProtocol-BZuoNBmL.js +0 -416
- package/studio-dist/server/chunks/UnionSerde-BflIkhKj.js +0 -2653
- package/studio-dist/server/chunks/_dispatch-ncuRztUQ.js +0 -5597
- package/studio-dist/server/chunks/_server.ts-4NyKAneX.js +0 -116
- package/studio-dist/server/chunks/_server.ts-7hGdxdEI.js +0 -136
- package/studio-dist/server/chunks/_server.ts-B6b3b-yA.js +0 -131
- package/studio-dist/server/chunks/_server.ts-BOgGqaZp.js +0 -144
- package/studio-dist/server/chunks/_server.ts-BV1HiKZ0.js +0 -120
- package/studio-dist/server/chunks/_server.ts-BWp3g6Cr.js +0 -110
- package/studio-dist/server/chunks/_server.ts-C5NF-UgC.js +0 -122
- package/studio-dist/server/chunks/_server.ts-CDMurH5m.js +0 -2301
- package/studio-dist/server/chunks/_server.ts-COJHCgbq.js +0 -127
- package/studio-dist/server/chunks/_server.ts-CUl-Utkt.js +0 -148
- package/studio-dist/server/chunks/_server.ts-D0GAFJRb.js +0 -156
- package/studio-dist/server/chunks/_server.ts-DA6p3pmi.js +0 -117
- package/studio-dist/server/chunks/_server.ts-DThYFaZj.js +0 -160
- package/studio-dist/server/chunks/_server.ts-D_3Pm0gr.js +0 -179
- package/studio-dist/server/chunks/_server.ts-DcHxdMsm.js +0 -144
- package/studio-dist/server/chunks/_server.ts-Dlfadh2I.js +0 -144
- package/studio-dist/server/chunks/_server.ts-JallJnps.js +0 -240
- package/studio-dist/server/chunks/_server.ts-NEFTbJpM.js +0 -142
- package/studio-dist/server/chunks/_server.ts-d-2NvRwX.js +0 -122
- package/studio-dist/server/chunks/_server.ts-rUWMLkIw.js +0 -146
- package/studio-dist/server/chunks/abort-events-CDRAJSqb.js +0 -30
- package/studio-dist/server/chunks/adapters-BkMgPNUM.js +0 -359
- package/studio-dist/server/chunks/adapters2-CQ3PzoaK.js +0 -28
- package/studio-dist/server/chunks/api-mode2-3W-I1-XO.js +0 -36
- package/studio-dist/server/chunks/api2-CmNQzb0b.js +0 -96
- package/studio-dist/server/chunks/attention-consolidate-CidG1jfH.js +0 -485
- package/studio-dist/server/chunks/audit3-DMO_fUGp.js +0 -52
- package/studio-dist/server/chunks/auto-extract-B84La1Vs.js +0 -34
- package/studio-dist/server/chunks/brain-consolidator-JGm6mzFf.js +0 -373
- package/studio-dist/server/chunks/brain-doctor-Dc2WqVbs.js +0 -311
- package/studio-dist/server/chunks/brain-embedding-Djw9ekXu.js +0 -42
- package/studio-dist/server/chunks/brain-lifecycle-BOOa876K.js +0 -969
- package/studio-dist/server/chunks/brain-maintenance-U6VvsvmK.js +0 -133
- package/studio-dist/server/chunks/brain-maintenance2-CwVSmfDT.js +0 -43
- package/studio-dist/server/chunks/brain-retrieval2-exR8mdgh.js +0 -751
- package/studio-dist/server/chunks/brain-search-CpSh-SNi.js +0 -48
- package/studio-dist/server/chunks/brain-search2-CwI2cXgg.js +0 -716
- package/studio-dist/server/chunks/brain-similarity-DI4yzm9e.js +0 -113
- package/studio-dist/server/chunks/brain-stdp2-BxSBIlSr.js +0 -960
- package/studio-dist/server/chunks/brain-writer-handlers-Dwu0QCAA.js +0 -188
- package/studio-dist/server/chunks/brain-writer-thread-6n7wI7Gy.js +0 -360
- package/studio-dist/server/chunks/branch-lock-Cq7zzmFK.js +0 -1118
- package/studio-dist/server/chunks/branch-lock2-CmDc4CZW.js +0 -45
- package/studio-dist/server/chunks/cancelled-child-waiver-audit-DkesrN83.js +0 -54
- package/studio-dist/server/chunks/catalog-model-resolver-Bas9qnoP.js +0 -9
- package/studio-dist/server/chunks/catalog-model-resolver2-Cexk2TN0.js +0 -237
- package/studio-dist/server/chunks/catalog-resolver-CLot3XJO.js +0 -260
- package/studio-dist/server/chunks/catalog-resolver2-JmKb91kY.js +0 -33
- package/studio-dist/server/chunks/chunk-DDP5xfzh.js +0 -39
- package/studio-dist/server/chunks/cleo-home-CCfe6kAQ.js +0 -64
- package/studio-dist/server/chunks/concrete-session2-bb_vxJ2N.js +0 -43
- package/studio-dist/server/chunks/config-DHj9CcFs.js +0 -386
- package/studio-dist/server/chunks/config2-F6PPIn7D.js +0 -35
- package/studio-dist/server/chunks/connections-BMGJVYcS.js +0 -98
- package/studio-dist/server/chunks/credential-pool-vF6NdtT9.js +0 -4600
- package/studio-dist/server/chunks/credentials-C7EJFf5O.js +0 -35
- package/studio-dist/server/chunks/credentials-store-CFygIuB2.js +0 -35
- package/studio-dist/server/chunks/cross-db-cleanup-1LWTUKPi.js +0 -147
- package/studio-dist/server/chunks/data-accessor-CWgVndbR.js +0 -72
- package/studio-dist/server/chunks/data-safety-central-DaFxK27G.js +0 -683
- package/studio-dist/server/chunks/decisions-CmVXV2-H.js +0 -574
- package/studio-dist/server/chunks/decisions2-XQsSYdxa.js +0 -48
- package/studio-dist/server/chunks/depends-waiver-audit-CUmlBYHx.js +0 -56
- package/studio-dist/server/chunks/dialectic-evaluator2-BOyyXhdI.js +0 -96
- package/studio-dist/server/chunks/dist-es2-DQy2Mjn_.js +0 -43
- package/studio-dist/server/chunks/dist-es3-CBygU4n5.js +0 -365
- package/studio-dist/server/chunks/dist-es4-CavbNu4B.js +0 -162
- package/studio-dist/server/chunks/dist-es5-Crpm8Wsl.js +0 -465
- package/studio-dist/server/chunks/dist-es6-CgePHzh4.js +0 -99
- package/studio-dist/server/chunks/dist-es7-k6c5GEd7.js +0 -311
- package/studio-dist/server/chunks/dist-es8-Bd9v0_pE.js +0 -91
- package/studio-dist/server/chunks/dist3-23bsJhRw.js +0 -27
- package/studio-dist/server/chunks/dist4-DmC1zSXi.js +0 -35618
- package/studio-dist/server/chunks/dual-scope-db-DKnWu1KM.js +0 -5672
- package/studio-dist/server/chunks/dual-scope-db2-Dht3luRw.js +0 -31
- package/studio-dist/server/chunks/duplicate-bypass-audit-BN5w1H2y.js +0 -36
- package/studio-dist/server/chunks/duplicate-detector-CaVFMKdE.js +0 -692
- package/studio-dist/server/chunks/edge-types-CgBvb0w1.js +0 -28
- package/studio-dist/server/chunks/embedding-local-xEnym8Ho.js +0 -92
- package/studio-dist/server/chunks/event-streams-Bi2p_fVo.js +0 -232
- package/studio-dist/server/chunks/execution-learning-BVCw7Plq.js +0 -278
- package/studio-dist/server/chunks/exodus-BBuuN6aA.js +0 -2594
- package/studio-dist/server/chunks/externalDataInterceptor-C3C4cObe.js +0 -21
- package/studio-dist/server/chunks/extraction-gate-DDNBq7gu.js +0 -48
- package/studio-dist/server/chunks/extraction-gate2-D77EZBQ6.js +0 -375
- package/studio-dist/server/chunks/getSSOTokenFromFile-yZAJxDci.js +0 -21
- package/studio-dist/server/chunks/governor2-CtfV3wfX.js +0 -923
- package/studio-dist/server/chunks/graph-auto-populate-Dmsr9ZJM.js +0 -42
- package/studio-dist/server/chunks/graph-auto-populate2-Cz0qeebM.js +0 -156
- package/studio-dist/server/chunks/graph-memory-bridge-CY8ft_d7.js +0 -43
- package/studio-dist/server/chunks/graph-memory-bridge2-Cd0XZwqc.js +0 -429
- package/studio-dist/server/chunks/handler-helpers-AANBGA_p.js +0 -49
- package/studio-dist/server/chunks/hash-Cm6yMET4.js +0 -14
- package/studio-dist/server/chunks/health-monitor-FepUZN1m.js +0 -106
- package/studio-dist/server/chunks/identity-DRpurt56.js +0 -30
- package/studio-dist/server/chunks/identity2-DeAB5RXE.js +0 -114
- package/studio-dist/server/chunks/index-61916rmV.js +0 -632
- package/studio-dist/server/chunks/index-DAgVDouG.js +0 -268
- package/studio-dist/server/chunks/index-Dtt_h58T.js +0 -2116
- package/studio-dist/server/chunks/indexes-DZ52grq6.js +0 -615
- package/studio-dist/server/chunks/json-Bfixam3g.js +0 -126
- package/studio-dist/server/chunks/learnings-D6Y3YGMU.js +0 -47
- package/studio-dist/server/chunks/learnings2-MwBdR9vb.js +0 -171
- package/studio-dist/server/chunks/lifecycle-ops2-V2CR5-7X.js +0 -121
- package/studio-dist/server/chunks/list-BhObczvn.js +0 -229
- package/studio-dist/server/chunks/living-brain2-j0B_Ir8j.js +0 -285
- package/studio-dist/server/chunks/llm-backend-resolver-D4ANvUPL.js +0 -295
- package/studio-dist/server/chunks/llm-extraction-DVCu4heR.js +0 -408
- package/studio-dist/server/chunks/loadSharedConfigFiles-umvW7kuz.js +0 -73
- package/studio-dist/server/chunks/loadSso-iidd5iKx.js +0 -599
- package/studio-dist/server/chunks/local-model-fit-B0TxifnX.js +0 -53
- package/studio-dist/server/chunks/local-model-fit2-BMqo6GJm.js +0 -2664
- package/studio-dist/server/chunks/lock-CA7d6lj7.js +0 -57
- package/studio-dist/server/chunks/logger-DQIoyZbq.js +0 -34
- package/studio-dist/server/chunks/memory-BUbicBbE.js +0 -618
- package/studio-dist/server/chunks/memory-accessor-i3P-RHSg.js +0 -42
- package/studio-dist/server/chunks/memory-accessor2-B981tHDR.js +0 -467
- package/studio-dist/server/chunks/memory-bridge-BOlEWg9w.js +0 -424
- package/studio-dist/server/chunks/memory-sqlite2-B7dq8doO.js +0 -42
- package/studio-dist/server/chunks/model-runner2-B71xjp4y.js +0 -43
- package/studio-dist/server/chunks/mvi-helpers-BNsJ8ZpQ.js +0 -59
- package/studio-dist/server/chunks/nexus-plasticity-BTfU8cW_.js +0 -269
- package/studio-dist/server/chunks/nexus-risk-audit-p379-TU5.js +0 -54
- package/studio-dist/server/chunks/nexus-schema-zeygY8OD.js +0 -11
- package/studio-dist/server/chunks/nexus-schema2-DP0Qd7CA.js +0 -444
- package/studio-dist/server/chunks/nexus-sqlite-BVNIpwc7.js +0 -36
- package/studio-dist/server/chunks/nexus-sqlite2-BBfY2xnY.js +0 -1103
- package/studio-dist/server/chunks/node-http-handler-CJI8kn7X.js +0 -386
- package/studio-dist/server/chunks/observe-Bo9veHGe.js +0 -47
- package/studio-dist/server/chunks/observe2-wzO0MaMY.js +0 -245
- package/studio-dist/server/chunks/observer-reflector-BwNOuq1d.js +0 -62
- package/studio-dist/server/chunks/observer-reflector2-ggtC1hmk.js +0 -478
- package/studio-dist/server/chunks/on-open-Wpcw7DV4.js +0 -740
- package/studio-dist/server/chunks/open-cleo-db--8sYNaYY.js +0 -70
- package/studio-dist/server/chunks/parseKnownFiles-Dg0pMFcT.js +0 -18
- package/studio-dist/server/chunks/parseUrl-qgGfl-Vh.js +0 -120
- package/studio-dist/server/chunks/paths-CV7S5-Zm.js +0 -30012
- package/studio-dist/server/chunks/patterns-lh5kn13I.js +0 -48
- package/studio-dist/server/chunks/patterns2-CzIcT-ai.js +0 -177
- package/studio-dist/server/chunks/pipeline-stage-IB_pOft-.js +0 -63
- package/studio-dist/server/chunks/prediction-D1lSGJ4c.js +0 -217
- package/studio-dist/server/chunks/premature-close-audit-VG09uAco.js +0 -53
- package/studio-dist/server/chunks/project-context-BjiqfEBi.js +0 -166
- package/studio-dist/server/chunks/provider-registry2-Cu7rAF0R.js +0 -35
- package/studio-dist/server/chunks/quality-feedback-CuCGEI6S.js +0 -371
- package/studio-dist/server/chunks/quality-scoring-CCPuRQmJ.js +0 -160
- package/studio-dist/server/chunks/query-ops-DCrjbZb9.js +0 -78
- package/studio-dist/server/chunks/query-promise-BkPmGPJy.js +0 -1257
- package/studio-dist/server/chunks/readFile-CxwXhymG.js +0 -31
- package/studio-dist/server/chunks/registry-CL2gN1zd.js +0 -27
- package/studio-dist/server/chunks/registry2-DoPYJnUW.js +0 -233
- package/studio-dist/server/chunks/registry3-BajEb-ll.js +0 -42
- package/studio-dist/server/chunks/registry4-DCqffZkT.js +0 -142
- package/studio-dist/server/chunks/retry-B3oEKYpp.js +0 -105
- package/studio-dist/server/chunks/role-executor-CC8BU54L.js +0 -25379
- package/studio-dist/server/chunks/role-resolver-D9QaDT0e.js +0 -6544
- package/studio-dist/server/chunks/role-resolver2-nkhzS1oy.js +0 -37
- package/studio-dist/server/chunks/rollup-CiefjN_Y.js +0 -194
- package/studio-dist/server/chunks/safety-data-accessor-CniDmGJO.js +0 -276
- package/studio-dist/server/chunks/service-connections-accessor-yBCdcgU-.js +0 -282
- package/studio-dist/server/chunks/session-factory-vbengc42.js +0 -96
- package/studio-dist/server/chunks/session-grade-BF4ZZtN_.js +0 -244
- package/studio-dist/server/chunks/session-journal-Bvey70Ur.js +0 -235
- package/studio-dist/server/chunks/session-narrative-BirZINSU.js +0 -304
- package/studio-dist/server/chunks/session-store--N_xHxUH.js +0 -557
- package/studio-dist/server/chunks/session-store2-DAM-eVTH.js +0 -43
- package/studio-dist/server/chunks/sessions-33DD4hkt.js +0 -2273
- package/studio-dist/server/chunks/sessions2-BHswKRDP.js +0 -50
- package/studio-dist/server/chunks/sigil-B-RznFXz.js +0 -33
- package/studio-dist/server/chunks/sigil2-jRMG5DuR.js +0 -47
- package/studio-dist/server/chunks/signin-BAsW3mM8.js +0 -644
- package/studio-dist/server/chunks/sleep-consolidation-BnSwXrvq.js +0 -823
- package/studio-dist/server/chunks/specialists-B_ZbpQlK.js +0 -441
- package/studio-dist/server/chunks/sqlite-Bm5LzbPs.js +0 -5977
- package/studio-dist/server/chunks/sqlite-backup-CFG1-b2e.js +0 -42
- package/studio-dist/server/chunks/sqlite-data-accessor-DD_RFX6r.js +0 -987
- package/studio-dist/server/chunks/sqlite-data-accessor2-CRmgNBnq.js +0 -44
- package/studio-dist/server/chunks/sqlite-native-BwlIqtbs.js +0 -42
- package/studio-dist/server/chunks/sqlite2-CUPut2fh.js +0 -42
- package/studio-dist/server/chunks/src2-DK8DKufK.js +0 -290
- package/studio-dist/server/chunks/src3-BJjf7XRG.js +0 -798
- package/studio-dist/server/chunks/src4-DNleK_t_.js +0 -28
- package/studio-dist/server/chunks/sso-oidc-eUvwseuL.js +0 -861
- package/studio-dist/server/chunks/storage-B9UA3BHR.js +0 -198
- package/studio-dist/server/chunks/sts-g7LDMLEd.js +0 -4655
- package/studio-dist/server/chunks/surprisal-CwTfWQi8.js +0 -224
- package/studio-dist/server/chunks/surprisal-tree-7dfHsuw1.js +0 -230
- package/studio-dist/server/chunks/system-resolver2-Bzhue_zQ.js +0 -53
- package/studio-dist/server/chunks/tasks-SHX7UPGY.js +0 -19694
- package/studio-dist/server/chunks/tasks-schema2-CTMoQKQy.js +0 -42
- package/studio-dist/server/chunks/temporal-supersession-DP4GPG_B.js +0 -298
- package/studio-dist/server/chunks/token-cAhAD9f9.js +0 -139
- package/studio-dist/server/chunks/token-util-D6drEz8_.js +0 -353
- package/studio-dist/server/chunks/token-util2-8UPSGvbb.js +0 -97
- package/studio-dist/server/chunks/transcript-scanner-kJWhWmlg.js +0 -53
- package/studio-dist/server/chunks/transformers.node-_xbxmK5p.js +0 -38475
- package/studio-dist/server/chunks/typed-query-l1D_QElt.js +0 -18
- package/studio-dist/server/chunks/unique-constraint-BZrrwgwc.js +0 -88
- package/studio-dist/server/chunks/update-B2YVBZG0.js +0 -1594
- package/studio-dist/server/chunks/user-profile-B61ZhVmC.js +0 -89
- package/studio-dist/server/chunks/utils-BPSZyajG.js +0 -1176
- package/studio-dist/server/chunks/validation-rules-CE27rtoF.js +0 -44
- package/studio-dist/server/chunks/zod-DsAeKNLm.js +0 -141
- /package/studio-dist/client/_app/immutable/chunks/{CQCxd1p9.js → B8WnZMYa.js} +0 -0
- /package/studio-dist/client/_app/immutable/chunks/{D13Quv9e2.js → B_0_YCYG.js} +0 -0
- /package/studio-dist/client/_app/immutable/chunks/{djL6V-tr.js → CqgtdAx_.js} +0 -0
- /package/studio-dist/client/_app/immutable/chunks/{_FU7h_8p2.js → KrUPZzXZ.js} +0 -0
|
@@ -1,2664 +0,0 @@
|
|
|
1
|
-
import { a as __commonJSMin, b as __require } from './chunk-DDP5xfzh.js';
|
|
2
|
-
import 'node:module';
|
|
3
|
-
import 'node:fs';
|
|
4
|
-
import 'node:path';
|
|
5
|
-
import { execFile } from 'node:child_process';
|
|
6
|
-
import 'node:crypto';
|
|
7
|
-
import { totalmem, freemem } from 'node:os';
|
|
8
|
-
import { P as SYSTEM_ROLE_MAP, b as getLogger, s as object, u as string, z as array, v as number, _ as _enum, w as boolean, W as WHOAMI_ROLE_IDS } from './paths-CV7S5-Zm.js';
|
|
9
|
-
import './src2-DK8DKufK.js';
|
|
10
|
-
import './branch-lock-Cq7zzmFK.js';
|
|
11
|
-
import { s as setConfigValue } from './config-DHj9CcFs.js';
|
|
12
|
-
import './index-Dtt_h58T.js';
|
|
13
|
-
import { readFile } from 'node:fs/promises';
|
|
14
|
-
import './index-61916rmV.js';
|
|
15
|
-
import { g as getProviderProfile, c as addCredential } from './credential-pool-vF6NdtT9.js';
|
|
16
|
-
import { c as catalogKeyForProvider, v as validateModelForProvider, r as resolveProviderDefaultModel } from './catalog-model-resolver2-Cexk2TN0.js';
|
|
17
|
-
import { r as resolveLLMForRole, I as IMPLICIT_FALLBACK_PROVIDER, b as probeOllamaAlive } from './role-resolver-D9QaDT0e.js';
|
|
18
|
-
import './nexus-schema2-DP0Qd7CA.js';
|
|
19
|
-
import './dual-scope-db-DKnWu1KM.js';
|
|
20
|
-
import './identity2-DeAB5RXE.js';
|
|
21
|
-
import 'node:url';
|
|
22
|
-
import { promisify } from 'node:util';
|
|
23
|
-
|
|
24
|
-
//#region ../core/dist/llm/complexity-classifier.js
|
|
25
|
-
/**
|
|
26
|
-
* L1 complexity classifier — a prompt-complexity **tier proposer** for the E9
|
|
27
|
-
* LLM chokepoint.
|
|
28
|
-
*
|
|
29
|
-
* ## What this is
|
|
30
|
-
*
|
|
31
|
-
* A faithful TypeScript port of the deleted Rust `cant-router` Layer-1
|
|
32
|
-
* classifier (`crates/cant-router/src/features.rs` + `classifier.rs`, retired
|
|
33
|
-
* in T11807 / D11137). It converts a raw prompt string into five auditable
|
|
34
|
-
* heuristic features, scores them with a fixed linear model, and maps the
|
|
35
|
-
* scalar score to a three-level complexity tier (`low` / `mid` / `high`).
|
|
36
|
-
*
|
|
37
|
-
* The classifier is a **proposer** that COMPLEMENTS — never replaces — the E9
|
|
38
|
-
* resolver {@link resolveLLMForSystem}. The flow is:
|
|
39
|
-
*
|
|
40
|
-
* ```text
|
|
41
|
-
* classifyComplexity(prompt) -> ComplexityTier ('low'|'mid'|'high')
|
|
42
|
-
* complexityTierToRole(tier) -> RoleName (cheap → capable ladder)
|
|
43
|
-
* resolveLLMForSystem({ kind:'role', id }) -> model + credential
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* So when a caller has NO explicit tier/role, it can derive one from the
|
|
47
|
-
* prompt's complexity and feed it to the chokepoint.
|
|
48
|
-
*
|
|
49
|
-
* ## What this is NOT (Gate-13 LLM Chokepoint Guard — T11783)
|
|
50
|
-
*
|
|
51
|
-
* - It NEVER constructs a transport or SDK client.
|
|
52
|
-
* - It NEVER reads `*_API_KEY` (no credential I/O at all).
|
|
53
|
-
* - It NEVER hardcodes a model-id literal. The tier→model mapping is the E9
|
|
54
|
-
* resolver's job; this module stops at proposing a {@link RoleName}.
|
|
55
|
-
*
|
|
56
|
-
* It returns a TIER (and, via the helper, a role). The provider, model, and
|
|
57
|
-
* credential are resolved exclusively by {@link resolveLLMForSystem}.
|
|
58
|
-
*
|
|
59
|
-
* The classifier is a pure, deterministic function with no I/O and no module
|
|
60
|
-
* side effects — safe to import anywhere in the chokepoint.
|
|
61
|
-
*
|
|
62
|
-
* @module llm/complexity-classifier
|
|
63
|
-
* @task T11906
|
|
64
|
-
* @epic T11745
|
|
65
|
-
* @see {@link resolveLLMForSystem} — the E9 chokepoint this proposer feeds.
|
|
66
|
-
*/
|
|
67
|
-
/** Weight applied to the normalized `tokenCount` feature. */
|
|
68
|
-
var WEIGHT_TOKEN_COUNT = .15;
|
|
69
|
-
/** Weight applied to the normalized `syntacticComplexity` feature. */
|
|
70
|
-
var WEIGHT_SYNTACTIC_COMPLEXITY = .25;
|
|
71
|
-
/** Weight applied to the normalized `reasoningDepth` feature. */
|
|
72
|
-
var WEIGHT_REASONING_DEPTH = .3;
|
|
73
|
-
/** Weight applied to the normalized `domainSpecificity` feature. */
|
|
74
|
-
var WEIGHT_DOMAIN_SPECIFICITY = .2;
|
|
75
|
-
/** Weight applied to the normalized `touchesFilesCount` feature. */
|
|
76
|
-
var WEIGHT_TOUCHES_FILES_COUNT = .1;
|
|
77
|
-
/**
|
|
78
|
-
* Estimate syntactic complexity by counting nested bracket depth.
|
|
79
|
-
*
|
|
80
|
-
* Walks the string once tracking the running depth of `(`, `{`, `[` (and their
|
|
81
|
-
* matching closers). The maximum depth observed is divided by 5 and clamped to
|
|
82
|
-
* `[0.0, 1.0]`, so a prompt with no brackets scores 0 and one with 5+ nested
|
|
83
|
-
* brackets scores 1.
|
|
84
|
-
*
|
|
85
|
-
* @param s - The raw prompt string.
|
|
86
|
-
* @returns A syntactic-complexity score in `[0.0, 1.0]`.
|
|
87
|
-
*/
|
|
88
|
-
function estimateSyntacticComplexity(s) {
|
|
89
|
-
let depth = 0;
|
|
90
|
-
let maxDepth = 0;
|
|
91
|
-
for (const c of s) if (c === "(" || c === "{" || c === "[") {
|
|
92
|
-
depth += 1;
|
|
93
|
-
if (depth > maxDepth) maxDepth = depth;
|
|
94
|
-
} else if (c === ")" || c === "}" || c === "]") depth = Math.max(depth - 1, 0);
|
|
95
|
-
return Math.min(maxDepth / 5, 1);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Reasoning-signal keywords — terms that correlate with multi-step reasoning.
|
|
99
|
-
*
|
|
100
|
-
* Intentionally short and biased; ported verbatim from the Rust `KEYWORDS`
|
|
101
|
-
* slice in `count_reasoning_keywords`.
|
|
102
|
-
*/
|
|
103
|
-
var REASONING_KEYWORDS = [
|
|
104
|
-
"why",
|
|
105
|
-
"should",
|
|
106
|
-
"compare",
|
|
107
|
-
"decide",
|
|
108
|
-
"explain",
|
|
109
|
-
"analyze",
|
|
110
|
-
"evaluate",
|
|
111
|
-
"consider",
|
|
112
|
-
"trade-off",
|
|
113
|
-
"tradeoff"
|
|
114
|
-
];
|
|
115
|
-
/**
|
|
116
|
-
* Count reasoning-signal keyword occurrences in the prompt (case-insensitive,
|
|
117
|
-
* counting every (possibly overlapping-free) occurrence, matching the Rust
|
|
118
|
-
* `str::matches` semantics).
|
|
119
|
-
*
|
|
120
|
-
* @param s - The raw prompt string.
|
|
121
|
-
* @returns The total number of reasoning-keyword occurrences.
|
|
122
|
-
*/
|
|
123
|
-
function countReasoningKeywords(s) {
|
|
124
|
-
const lower = s.toLowerCase();
|
|
125
|
-
let total = 0;
|
|
126
|
-
for (const keyword of REASONING_KEYWORDS) {
|
|
127
|
-
let from = 0;
|
|
128
|
-
for (;;) {
|
|
129
|
-
const idx = lower.indexOf(keyword, from);
|
|
130
|
-
if (idx === -1) break;
|
|
131
|
-
total += 1;
|
|
132
|
-
from = idx + keyword.length;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return total;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Count the uppercase characters in a token (used by the CamelCase proxy).
|
|
139
|
-
*
|
|
140
|
-
* @param w - A single whitespace-delimited token.
|
|
141
|
-
* @returns The number of uppercase characters in `w`.
|
|
142
|
-
*/
|
|
143
|
-
function uppercaseCount(w) {
|
|
144
|
-
let n = 0;
|
|
145
|
-
for (const c of w) if (c !== c.toLowerCase() && c === c.toUpperCase()) n += 1;
|
|
146
|
-
return n;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Estimate domain specificity via CamelCase identifier density.
|
|
150
|
-
*
|
|
151
|
-
* Counts whitespace-delimited tokens containing at least two uppercase letters
|
|
152
|
-
* (a rough proxy for domain-specific identifiers like `ModelSelection` or
|
|
153
|
-
* `XDGBaseDir`). The count is divided by 10 and clamped to `[0.0, 1.0]`.
|
|
154
|
-
*
|
|
155
|
-
* @param s - The raw prompt string.
|
|
156
|
-
* @returns A domain-specificity score in `[0.0, 1.0]`.
|
|
157
|
-
*/
|
|
158
|
-
function estimateDomainSpecificity(s) {
|
|
159
|
-
const camelCaseCount = splitWhitespace(s).filter((w) => uppercaseCount(w) >= 2).length;
|
|
160
|
-
return Math.min(camelCaseCount / 10, 1);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Count file references in the prompt.
|
|
164
|
-
*
|
|
165
|
-
* A token is a file reference if it contains a `/` or ends in a known
|
|
166
|
-
* source-file extension (`.rs`, `.ts`, `.md`, `.json`). Punctuation on the
|
|
167
|
-
* token is left intact for v1 — callers aware of this limitation can pre-clean
|
|
168
|
-
* their prompts.
|
|
169
|
-
*
|
|
170
|
-
* @param s - The raw prompt string.
|
|
171
|
-
* @returns The number of file-reference tokens.
|
|
172
|
-
*/
|
|
173
|
-
function countFileReferences(s) {
|
|
174
|
-
return splitWhitespace(s).filter((w) => w.includes("/") || w.endsWith(".rs") || w.endsWith(".ts") || w.endsWith(".md") || w.endsWith(".json")).length;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Split a string on Unicode whitespace, dropping empty segments — matching
|
|
178
|
-
* Rust's `str::split_whitespace` (which never yields empty tokens).
|
|
179
|
-
*
|
|
180
|
-
* @param s - The string to split.
|
|
181
|
-
* @returns The non-empty whitespace-delimited tokens of `s`.
|
|
182
|
-
*/
|
|
183
|
-
function splitWhitespace(s) {
|
|
184
|
-
return s.split(/\s+/).filter((w) => w.length > 0);
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Extract a {@link PromptFeatures} vector from a raw prompt string.
|
|
188
|
-
*
|
|
189
|
-
* Pure heuristics, no ML runtime — the Layer-1 input stage. Each field is a
|
|
190
|
-
* small, auditable signal that feeds {@link classify}.
|
|
191
|
-
*
|
|
192
|
-
* @param prompt - The raw prompt string.
|
|
193
|
-
* @returns The five-feature vector for `prompt`.
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* ```ts
|
|
197
|
-
* const f = extractFeatures('Refactor auth.ts to use JWT tokens.');
|
|
198
|
-
* f.tokenCount; // > 0
|
|
199
|
-
* ```
|
|
200
|
-
*/
|
|
201
|
-
function extractFeatures(prompt) {
|
|
202
|
-
return {
|
|
203
|
-
tokenCount: splitWhitespace(prompt).length,
|
|
204
|
-
syntacticComplexity: estimateSyntacticComplexity(prompt),
|
|
205
|
-
reasoningDepth: countReasoningKeywords(prompt),
|
|
206
|
-
domainSpecificity: estimateDomainSpecificity(prompt),
|
|
207
|
-
touchesFilesCount: countFileReferences(prompt)
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Clamp a value to `[lo, hi]` — equivalent to Rust's `f64::clamp`. Returns `lo`
|
|
212
|
-
* for `NaN`, matching the saturating intent of the original normalizers.
|
|
213
|
-
*/
|
|
214
|
-
function clamp(value, lo, hi) {
|
|
215
|
-
if (Number.isNaN(value)) return lo;
|
|
216
|
-
return Math.min(Math.max(value, lo), hi);
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Normalize each feature to `[0.0, 1.0]` for the weighted sum.
|
|
220
|
-
*
|
|
221
|
-
* These normalization constants are the heuristic v1 defaults tuned against
|
|
222
|
-
* the ULTRAPLAN §11.1 example ranges (not a labeled corpus). Ported verbatim
|
|
223
|
-
* from the Rust `normalize_features`.
|
|
224
|
-
*/
|
|
225
|
-
function normalizeFeatures(f) {
|
|
226
|
-
return {
|
|
227
|
-
tokenCount: Math.min(f.tokenCount / 1e3, 1),
|
|
228
|
-
syntacticComplexity: clamp(f.syntacticComplexity, 0, 1),
|
|
229
|
-
reasoningDepth: Math.min(f.reasoningDepth / 10, 1),
|
|
230
|
-
domainSpecificity: clamp(f.domainSpecificity, 0, 1),
|
|
231
|
-
touchesFilesCount: Math.min(f.touchesFilesCount / 20, 1)
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Classify a feature vector into a {@link Classification} result.
|
|
236
|
-
*
|
|
237
|
-
* Applies the linear weighted sum from ULTRAPLAN §11.1 and maps the resulting
|
|
238
|
-
* score to a tier via {@link THRESHOLD_HIGH} and {@link THRESHOLD_MID}. The
|
|
239
|
-
* input {@link PromptFeatures} is preserved so downstream consumers can inspect
|
|
240
|
-
* the raw signals that produced the decision.
|
|
241
|
-
*
|
|
242
|
-
* @param features - The five-feature vector to score.
|
|
243
|
-
* @returns The score, tier, and preserved feature vector.
|
|
244
|
-
*/
|
|
245
|
-
function classify(features) {
|
|
246
|
-
const normalized = normalizeFeatures(features);
|
|
247
|
-
const score = WEIGHT_TOKEN_COUNT * normalized.tokenCount + WEIGHT_SYNTACTIC_COMPLEXITY * normalized.syntacticComplexity + WEIGHT_REASONING_DEPTH * normalized.reasoningDepth + WEIGHT_DOMAIN_SPECIFICITY * normalized.domainSpecificity + WEIGHT_TOUCHES_FILES_COUNT * normalized.touchesFilesCount;
|
|
248
|
-
return {
|
|
249
|
-
score,
|
|
250
|
-
tier: score >= .75 ? "high" : score >= .35 ? "mid" : "low",
|
|
251
|
-
features
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Classify a raw prompt into a complexity {@link ComplexityTier}.
|
|
256
|
-
*
|
|
257
|
-
* The one-call entry point: `extractFeatures` → `classify` → tier. This is the
|
|
258
|
-
* **proposer** half of the L1 router — it stops at a tier and never touches a
|
|
259
|
-
* model, transport, or credential (Gate-13 compliant).
|
|
260
|
-
*
|
|
261
|
-
* @param prompt - The raw prompt string to classify.
|
|
262
|
-
* @returns The proposed complexity tier (`low` / `mid` / `high`).
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* ```ts
|
|
266
|
-
* classifyComplexity('list files'); // 'low'
|
|
267
|
-
* classifyComplexity('Why should we compare these and decide the trade-off?'); // 'mid'+
|
|
268
|
-
* ```
|
|
269
|
-
*/
|
|
270
|
-
function classifyComplexity(prompt) {
|
|
271
|
-
return classify(extractFeatures(prompt)).tier;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Map a complexity {@link ComplexityTier} to the {@link RoleName} that
|
|
275
|
-
* {@link resolveLLMForSystem} should resolve when no explicit tier/role was
|
|
276
|
-
* given.
|
|
277
|
-
*
|
|
278
|
-
* This is the wiring contract (AC2) that lets a tier flow into the E9
|
|
279
|
-
* chokepoint: the classifier proposes a tier, this maps it to a role, and
|
|
280
|
-
* `resolveLLMForSystem({ kind: 'role', id })` performs the actual model +
|
|
281
|
-
* credential resolution. The mapping is a cheap → capable ladder over the
|
|
282
|
-
* canonical {@link RoleName} set — it pins NO model literal of its own.
|
|
283
|
-
*
|
|
284
|
-
* - `low` → `hygiene` — cheapest single-turn cleanup-class role.
|
|
285
|
-
* - `mid` → `consolidation` — the default workhorse role.
|
|
286
|
-
* - `high` → `judgement` — the most-capable reasoning role.
|
|
287
|
-
*
|
|
288
|
-
* @param tier - The proposed complexity tier.
|
|
289
|
-
* @returns The {@link RoleName} to feed into the E9 resolver.
|
|
290
|
-
*/
|
|
291
|
-
function complexityTierToRole(tier) {
|
|
292
|
-
switch (tier) {
|
|
293
|
-
case "low": return "hygiene";
|
|
294
|
-
case "mid": return "consolidation";
|
|
295
|
-
case "high": return "judgement";
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Propose the {@link RoleName} for a raw prompt by classifying its complexity
|
|
300
|
-
* and mapping the resulting tier to a role.
|
|
301
|
-
*
|
|
302
|
-
* Convenience composition of {@link classifyComplexity} and
|
|
303
|
-
* {@link complexityTierToRole} — the single call a caller uses to derive a role
|
|
304
|
-
* for {@link resolveLLMForSystem} when it has no explicit tier/role.
|
|
305
|
-
*
|
|
306
|
-
* The returned role is intended to be passed as the structured descriptor:
|
|
307
|
-
* `resolveLLMForSystem({ kind: 'role', id: proposeRoleForPrompt(prompt) })`.
|
|
308
|
-
*
|
|
309
|
-
* @param prompt - The raw prompt string.
|
|
310
|
-
* @returns The proposed {@link RoleName} for the E9 chokepoint.
|
|
311
|
-
*
|
|
312
|
-
* @example
|
|
313
|
-
* ```ts
|
|
314
|
-
* import { proposeRoleForPrompt } from './complexity-classifier.js';
|
|
315
|
-
* import { resolveLLMForSystem } from './system-resolver.js';
|
|
316
|
-
*
|
|
317
|
-
* const role = proposeRoleForPrompt(userPrompt);
|
|
318
|
-
* const llm = await resolveLLMForSystem({ kind: 'role', id: role }, { projectRoot });
|
|
319
|
-
* ```
|
|
320
|
-
*/
|
|
321
|
-
function proposeRoleForPrompt(prompt) {
|
|
322
|
-
return complexityTierToRole(classifyComplexity(prompt));
|
|
323
|
-
}
|
|
324
|
-
//#endregion
|
|
325
|
-
//#region ../core/dist/llm/system-resolver.js
|
|
326
|
-
/**
|
|
327
|
-
* `resolveLLMForSystem` — the single DRY chokepoint for all LLM resolution (E9).
|
|
328
|
-
*
|
|
329
|
-
* ## Purpose
|
|
330
|
-
*
|
|
331
|
-
* CLEO previously had a 4-resolver / 3-picker sprawl: `resolveLLMForRole`,
|
|
332
|
-
* `resolveAnthropicForRole`, `resolveCredentials`, and several inline `pickX`
|
|
333
|
-
* helpers each duplicated the implicit fallback model literal or called different
|
|
334
|
-
* tiers of the resolution chain independently.
|
|
335
|
-
*
|
|
336
|
-
* `resolveLLMForSystem` is the ONE chokepoint that:
|
|
337
|
-
*
|
|
338
|
-
* 1. Accepts a semantic "system of use" label (e.g. `'sentient'`, `'memory'`)
|
|
339
|
-
* instead of raw role names — insulating call-sites from config vocabulary.
|
|
340
|
-
* 2. Maps the system label to the canonical {@link RoleName} via
|
|
341
|
-
* {@link SYSTEM_ROLE_MAP} (overridable by `opts.roleOverride`).
|
|
342
|
-
* 3. Delegates to `resolveLLMForRole` for the full 5-tier config +
|
|
343
|
-
* CredentialPool resolution chain — no duplication.
|
|
344
|
-
* 4. When resolution lands on `implicit-fallback`, replaces the hardcoded
|
|
345
|
-
* haiku literal with the SSoT default model from the provider registry
|
|
346
|
-
* (`getProviderProfile(provider).defaultModel`) — satisfying the
|
|
347
|
-
* "not hardcoded" acceptance criterion.
|
|
348
|
-
*
|
|
349
|
-
* ## What this is NOT
|
|
350
|
-
*
|
|
351
|
-
* - A replacement for `resolveLLMForRole`. Existing callers of
|
|
352
|
-
* `resolveLLMForRole` continue to work unchanged; T11757 will migrate them
|
|
353
|
-
* to this chokepoint incrementally.
|
|
354
|
-
* - A new credential store or provider registry. All credential I/O goes
|
|
355
|
-
* through the existing CredentialPool (E3 pool) inside `resolveLLMForRole`.
|
|
356
|
-
*
|
|
357
|
-
* @module llm/system-resolver
|
|
358
|
-
* @task T11749
|
|
359
|
-
* @epic T11745
|
|
360
|
-
*/
|
|
361
|
-
var logger$2 = getLogger("llm-system-resolver");
|
|
362
|
-
/**
|
|
363
|
-
* Type guard: is `input` the structured {@link RoleSystem} descriptor form
|
|
364
|
-
* (`{ kind: 'role', id: RoleName }`) rather than a flat {@link SystemOfUseLabel}?
|
|
365
|
-
*
|
|
366
|
-
* A flat label is always a `string`; the descriptor is the only object form the
|
|
367
|
-
* chokepoint accepts — so a single `typeof === 'object'` test is sufficient and
|
|
368
|
-
* narrows `input` to {@link RoleSystem}.
|
|
369
|
-
*
|
|
370
|
-
* @task T11750
|
|
371
|
-
*/
|
|
372
|
-
function isRoleSystem(input) {
|
|
373
|
-
return typeof input === "object" && input !== null && input.kind === "role";
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Map a {@link SystemResolverInput} to the {@link RoleName} that
|
|
377
|
-
* `resolveLLMForRole` will use for config lookup.
|
|
378
|
-
*
|
|
379
|
-
* Priority:
|
|
380
|
-
* 1. `opts.roleOverride` — explicit caller override (both input forms).
|
|
381
|
-
* 2. Structured {@link RoleSystem} descriptor → its `id` IS the role (T11750).
|
|
382
|
-
* 3. {@link SYSTEM_ROLE_MAP} — static default for the flat system label.
|
|
383
|
-
* 4. L1 complexity proposer (T11906) — when the label maps to NO role AND a
|
|
384
|
-
* `complexityPrompt` was supplied, classify it and propose a role from the
|
|
385
|
-
* resulting tier. This is the "derive a tier from prompt complexity when no
|
|
386
|
-
* explicit tier/role is given" wiring (AC2): it COMPLEMENTS the resolver,
|
|
387
|
-
* only filling in a role the input left blank. The classifier returns a
|
|
388
|
-
* tier and constructs no LLM client.
|
|
389
|
-
*
|
|
390
|
-
* Returns `null` when a flat label maps to the global default (no role entry)
|
|
391
|
-
* and no `complexityPrompt` was supplied. The descriptor form always carries a
|
|
392
|
-
* concrete {@link RoleName}, so it never returns `null`.
|
|
393
|
-
*/
|
|
394
|
-
function deriveRole(input, opts) {
|
|
395
|
-
if (opts?.roleOverride) return opts.roleOverride;
|
|
396
|
-
if (isRoleSystem(input)) return input.id;
|
|
397
|
-
const mapped = SYSTEM_ROLE_MAP[input] ?? null;
|
|
398
|
-
if (mapped !== null) return mapped;
|
|
399
|
-
if (opts?.complexityPrompt !== void 0) {
|
|
400
|
-
const proposed = proposeRoleForPrompt(opts.complexityPrompt);
|
|
401
|
-
logger$2.debug({
|
|
402
|
-
system: input,
|
|
403
|
-
proposedRole: proposed
|
|
404
|
-
}, "system-resolver: derived role from L1 complexity classifier (no explicit tier/role)");
|
|
405
|
-
return proposed;
|
|
406
|
-
}
|
|
407
|
-
return null;
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* When `resolveLLMForRole` returns `source === 'implicit-fallback'`, the model is
|
|
411
|
-
* the hardcoded `IMPLICIT_FALLBACK_MODEL` literal. This function derives the
|
|
412
|
-
* default from the **`models_catalog` SSoT** (latest `release_date` for the
|
|
413
|
-
* provider) so the resolved model tracks the catalog rather than a frozen
|
|
414
|
-
* constant — the "catalog-driven models, NO hardcoded" North Star (E8 · T11944).
|
|
415
|
-
*
|
|
416
|
-
* ## Resolution order (offline-first degrade — T11944 AC1/AC2)
|
|
417
|
-
*
|
|
418
|
-
* 1. **`models_catalog` table** (via the {@link resolveCatalogEntry} table-first
|
|
419
|
-
* chokepoint — T11737): newest `release_date` row for the provider. When the
|
|
420
|
-
* table is seeded this WINS and the static builtin literal is never reached.
|
|
421
|
-
* 2. **provider-registry `defaultModel`** (the static builtin
|
|
422
|
-
* `ProviderDef.defaultModel`) — reached ONLY when the catalog (table + disk
|
|
423
|
-
* cache + shipped seed) yields nothing for the provider.
|
|
424
|
-
* 3. **the existing `IMPLICIT_FALLBACK_MODEL` literal** already on `resolved` —
|
|
425
|
-
* the absolute offline floor, preserved for a fresh/offline install with no
|
|
426
|
-
* catalog AND no provider profile (degrade does NOT break — AC2).
|
|
427
|
-
*
|
|
428
|
-
* NO network is issued at resolve time (table-or-cache only — AC4). On any lookup
|
|
429
|
-
* error the original `resolved` envelope is returned unchanged so the caller is
|
|
430
|
-
* never blocked.
|
|
431
|
-
*
|
|
432
|
-
* @param resolved - The envelope returned by `resolveLLMForRole`.
|
|
433
|
-
* @returns The same envelope, possibly with `model` replaced from the catalog SSoT.
|
|
434
|
-
*/
|
|
435
|
-
async function upgradeCatalogDefault(resolved) {
|
|
436
|
-
if (resolved.source !== "implicit-fallback") return resolved;
|
|
437
|
-
try {
|
|
438
|
-
const { resolveCatalogEntry } = await import('./catalog-resolver2-JmKb91kY.js');
|
|
439
|
-
const { catalogKeyForProvider } = await import('./catalog-model-resolver-Bas9qnoP.js');
|
|
440
|
-
const entry = await resolveCatalogEntry(catalogKeyForProvider(resolved.provider));
|
|
441
|
-
if (entry?.id && entry.id !== resolved.model) {
|
|
442
|
-
logger$2.debug({
|
|
443
|
-
provider: resolved.provider,
|
|
444
|
-
from: resolved.model,
|
|
445
|
-
to: entry.id,
|
|
446
|
-
source: entry.source
|
|
447
|
-
}, "system-resolver: upgrading implicit-fallback model to models_catalog default");
|
|
448
|
-
return {
|
|
449
|
-
...resolved,
|
|
450
|
-
model: entry.id
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
if (entry?.id) return resolved;
|
|
454
|
-
const { getProviderProfile } = await import('./provider-registry2-Cu7rAF0R.js');
|
|
455
|
-
const profile = await getProviderProfile(resolved.provider);
|
|
456
|
-
if (profile?.defaultModel && profile.defaultModel !== resolved.model) {
|
|
457
|
-
logger$2.debug({
|
|
458
|
-
provider: resolved.provider,
|
|
459
|
-
from: resolved.model,
|
|
460
|
-
to: profile.defaultModel
|
|
461
|
-
}, "system-resolver: catalog empty — degrading to static builtin defaultModel floor");
|
|
462
|
-
return {
|
|
463
|
-
...resolved,
|
|
464
|
-
model: profile.defaultModel
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
return resolved;
|
|
468
|
-
} catch (err) {
|
|
469
|
-
logger$2.warn({ err: err instanceof Error ? err.message : String(err) }, "system-resolver: catalog default lookup failed; keeping existing fallback model");
|
|
470
|
-
return resolved;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Resolve the LLM client + credential for a semantic system-of-use label OR a
|
|
475
|
-
* structured {@link RoleSystem} descriptor.
|
|
476
|
-
*
|
|
477
|
-
* This is the single DRY chokepoint for all LLM resolution in CLEO (E9 ·
|
|
478
|
-
* T11745). It wraps `resolveLLMForRole` with:
|
|
479
|
-
*
|
|
480
|
-
* - System label → role mapping (via {@link SYSTEM_ROLE_MAP}); OR direct
|
|
481
|
-
* `{ kind: 'role', id }` descriptor resolution (T11750 · AC1).
|
|
482
|
-
* - SSoT default model from the provider registry when `implicit-fallback`
|
|
483
|
-
* is reached (the hardcoded haiku literal is NOT used as the final model).
|
|
484
|
-
* - Full CredentialPool (E3) binding via `resolveLLMForRole` delegation.
|
|
485
|
-
*
|
|
486
|
-
* ## Role equivalence (T11750 · AC1)
|
|
487
|
-
*
|
|
488
|
-
* `resolveLLMForSystem({ kind: 'role', id })` is the chokepoint expression of a
|
|
489
|
-
* direct role resolution — identical to `resolveLLMForRole(id)` for every
|
|
490
|
-
* resolution-relevant field (`provider` / `model` / `source` / `credential` /
|
|
491
|
-
* `sealedCredential` / `apiMode` / …), differing ONLY by the additive `system`
|
|
492
|
-
* + `resolvedRole` envelope fields. There is exactly ONE resolution
|
|
493
|
-
* implementation (`resolveLLMForRole`); both input forms funnel through it with
|
|
494
|
-
* ZERO duplicated logic. The descriptor form does NOT thread a `systemKey`
|
|
495
|
-
* (there is no flat label to key the `llm.systems[key]` override tier on), so it
|
|
496
|
-
* walks the same tier chain a bare `resolveLLMForRole(id)` call walks.
|
|
497
|
-
*
|
|
498
|
-
* Like `resolveLLMForRole`, this function **never throws**: when no credential
|
|
499
|
-
* is reachable the caller receives `{ credential: null, client: null, … }` and
|
|
500
|
-
* is responsible for its own graceful-degradation path.
|
|
501
|
-
*
|
|
502
|
-
* @example
|
|
503
|
-
* ```ts
|
|
504
|
-
* // Flat label (background subsystem):
|
|
505
|
-
* const a = await resolveLLMForSystem('sentient', { projectRoot });
|
|
506
|
-
* // Structured role descriptor (T11750 · AC1) — equivalent to
|
|
507
|
-
* // resolveLLMForRole('consolidation'):
|
|
508
|
-
* const b = await resolveLLMForSystem({ kind: 'role', id: 'consolidation' }, { projectRoot });
|
|
509
|
-
* if (!a.sealedCredential || !a.client) {
|
|
510
|
-
* return null; // graceful no-op — no credential available
|
|
511
|
-
* }
|
|
512
|
-
* // Use resolved.model, resolved.client, resolved.credential (metadata only);
|
|
513
|
-
* // materialize the secret at the wire via resolved.sealedCredential.fetch().
|
|
514
|
-
* ```
|
|
515
|
-
*
|
|
516
|
-
* @param system - Flat {@link SystemOfUseLabel} or {@link RoleSystem} descriptor.
|
|
517
|
-
* @param opts - Optional overrides (project root, role override, skipCatalogDefault).
|
|
518
|
-
* @returns A {@link ResolvedLLMForSystem} envelope; never throws.
|
|
519
|
-
*
|
|
520
|
-
* @task T11749
|
|
521
|
-
* @task T11750
|
|
522
|
-
* @epic T11745
|
|
523
|
-
*/
|
|
524
|
-
async function resolveLLMForSystem(system, opts) {
|
|
525
|
-
const resolvedRole = deriveRole(system, opts);
|
|
526
|
-
const roleForResolution = resolvedRole ?? "consolidation";
|
|
527
|
-
const systemKey = opts?.systemKey ?? (isRoleSystem(system) ? void 0 : system);
|
|
528
|
-
let base;
|
|
529
|
-
try {
|
|
530
|
-
base = await resolveLLMForRole(roleForResolution, {
|
|
531
|
-
projectRoot: opts?.projectRoot,
|
|
532
|
-
systemKey,
|
|
533
|
-
...opts?.profile !== void 0 ? { profileOverride: opts.profile } : {},
|
|
534
|
-
...opts?.excludeProviders !== void 0 ? { excludeProviders: opts.excludeProviders } : {}
|
|
535
|
-
});
|
|
536
|
-
} catch (err) {
|
|
537
|
-
logger$2.warn({
|
|
538
|
-
err: err instanceof Error ? err.message : String(err),
|
|
539
|
-
system,
|
|
540
|
-
role: roleForResolution
|
|
541
|
-
}, "system-resolver: resolveLLMForRole threw unexpectedly; returning null-credential envelope");
|
|
542
|
-
base = {
|
|
543
|
-
provider: IMPLICIT_FALLBACK_PROVIDER,
|
|
544
|
-
model: "unknown",
|
|
545
|
-
client: null,
|
|
546
|
-
credential: null,
|
|
547
|
-
sealedCredential: null,
|
|
548
|
-
source: "implicit-fallback",
|
|
549
|
-
apiMode: "anthropic_messages",
|
|
550
|
-
baseUrl: null,
|
|
551
|
-
authType: null
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
return {
|
|
555
|
-
...opts?.skipCatalogDefault ? base : await upgradeCatalogDefault(base),
|
|
556
|
-
system,
|
|
557
|
-
resolvedRole
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
var DreamExtractedMemorySchema = object({
|
|
562
|
-
type: _enum([
|
|
563
|
-
"decision",
|
|
564
|
-
"pattern",
|
|
565
|
-
"learning",
|
|
566
|
-
"constraint"
|
|
567
|
-
]),
|
|
568
|
-
content: string().min(1).max(500),
|
|
569
|
-
importance: number().min(0).max(1),
|
|
570
|
-
entities: array(string()).max(20),
|
|
571
|
-
justification: string().min(1).max(200)
|
|
572
|
-
});
|
|
573
|
-
object({ memories: array(DreamExtractedMemorySchema).max(15) });
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Zod schema for the structured output returned by the LLM escalation call.
|
|
577
|
-
*/
|
|
578
|
-
object({
|
|
579
|
-
is_real_defect: boolean(),
|
|
580
|
-
confidence: number().min(0).max(1),
|
|
581
|
-
recommended_action: _enum([
|
|
582
|
-
"auto-fix",
|
|
583
|
-
"propose",
|
|
584
|
-
"ignore"
|
|
585
|
-
]),
|
|
586
|
-
reasoning: string()
|
|
587
|
-
});
|
|
588
|
-
|
|
589
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/create-id.js
|
|
590
|
-
var require_create_id = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
591
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
592
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
593
|
-
};
|
|
594
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
595
|
-
exports$1.createID = createID;
|
|
596
|
-
var node_crypto_1 = __importDefault(__require("node:crypto"));
|
|
597
|
-
function createID(prefix = "", length = 16) {
|
|
598
|
-
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
599
|
-
const values = node_crypto_1.default.randomBytes(length);
|
|
600
|
-
const id = Array.from(values, (v) => charset[v % 62]).join("");
|
|
601
|
-
return prefix ? `${prefix}-${id}` : id;
|
|
602
|
-
}
|
|
603
|
-
}));
|
|
604
|
-
//#endregion
|
|
605
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/logger.js
|
|
606
|
-
var require_logger = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
607
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
608
|
-
var levelColors = {
|
|
609
|
-
INFO: "\x1B[36m",
|
|
610
|
-
WARN: "\x1B[33m",
|
|
611
|
-
ERROR: "\x1B[31m",
|
|
612
|
-
DEBUG: "\x1B[35m"
|
|
613
|
-
};
|
|
614
|
-
var GREEN = "\x1B[32m";
|
|
615
|
-
var RESET = "\x1B[0m";
|
|
616
|
-
function log(level, message, extra) {
|
|
617
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
618
|
-
const color = levelColors[level] ?? "";
|
|
619
|
-
const output = `${`[${timestamp}] [PID: ${process.pid}] ${GREEN}[NODE-CRON]${GREEN} ${color}[${level}]${RESET}`} ${message}`;
|
|
620
|
-
switch (level) {
|
|
621
|
-
case "ERROR":
|
|
622
|
-
console.error(output, extra ?? "");
|
|
623
|
-
break;
|
|
624
|
-
case "DEBUG":
|
|
625
|
-
console.debug(output, extra ?? "");
|
|
626
|
-
break;
|
|
627
|
-
case "WARN":
|
|
628
|
-
console.warn(output);
|
|
629
|
-
break;
|
|
630
|
-
default:
|
|
631
|
-
console.info(output);
|
|
632
|
-
break;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
exports$1.default = {
|
|
636
|
-
info(message) {
|
|
637
|
-
log("INFO", message);
|
|
638
|
-
},
|
|
639
|
-
warn(message) {
|
|
640
|
-
log("WARN", message);
|
|
641
|
-
},
|
|
642
|
-
error(message, err) {
|
|
643
|
-
if (message instanceof Error) log("ERROR", message.message, message);
|
|
644
|
-
else log("ERROR", message, err);
|
|
645
|
-
},
|
|
646
|
-
debug(message, err) {
|
|
647
|
-
if (message instanceof Error) log("DEBUG", message.message, message);
|
|
648
|
-
else log("DEBUG", message, err);
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
}));
|
|
652
|
-
//#endregion
|
|
653
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/promise/tracked-promise.js
|
|
654
|
-
var require_tracked_promise = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
655
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
656
|
-
exports$1.TrackedPromise = void 0;
|
|
657
|
-
var TrackedPromise = class {
|
|
658
|
-
promise;
|
|
659
|
-
error;
|
|
660
|
-
state;
|
|
661
|
-
value;
|
|
662
|
-
constructor(executor) {
|
|
663
|
-
this.state = "pending";
|
|
664
|
-
this.promise = new Promise((resolve, reject) => {
|
|
665
|
-
executor((value) => {
|
|
666
|
-
this.state = "fulfilled";
|
|
667
|
-
this.value = value;
|
|
668
|
-
resolve(value);
|
|
669
|
-
}, (error) => {
|
|
670
|
-
this.state = "rejected";
|
|
671
|
-
this.error = error;
|
|
672
|
-
reject(error);
|
|
673
|
-
});
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
getPromise() {
|
|
677
|
-
return this.promise;
|
|
678
|
-
}
|
|
679
|
-
getState() {
|
|
680
|
-
return this.state;
|
|
681
|
-
}
|
|
682
|
-
isPending() {
|
|
683
|
-
return this.state === "pending";
|
|
684
|
-
}
|
|
685
|
-
isFulfilled() {
|
|
686
|
-
return this.state === "fulfilled";
|
|
687
|
-
}
|
|
688
|
-
isRejected() {
|
|
689
|
-
return this.state === "rejected";
|
|
690
|
-
}
|
|
691
|
-
getValue() {
|
|
692
|
-
return this.value;
|
|
693
|
-
}
|
|
694
|
-
getError() {
|
|
695
|
-
return this.error;
|
|
696
|
-
}
|
|
697
|
-
then(onfulfilled, onrejected) {
|
|
698
|
-
return this.promise.then(onfulfilled, onrejected);
|
|
699
|
-
}
|
|
700
|
-
catch(onrejected) {
|
|
701
|
-
return this.promise.catch(onrejected);
|
|
702
|
-
}
|
|
703
|
-
finally(onfinally) {
|
|
704
|
-
return this.promise.finally(onfinally);
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
|
-
exports$1.TrackedPromise = TrackedPromise;
|
|
708
|
-
}));
|
|
709
|
-
//#endregion
|
|
710
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/scheduler/runner.js
|
|
711
|
-
var require_runner = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
712
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
713
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
714
|
-
};
|
|
715
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
716
|
-
exports$1.Runner = void 0;
|
|
717
|
-
var create_id_1 = require_create_id();
|
|
718
|
-
var logger_1 = __importDefault(require_logger());
|
|
719
|
-
var tracked_promise_1 = require_tracked_promise();
|
|
720
|
-
function emptyOnFn() {}
|
|
721
|
-
function emptyHookFn() {
|
|
722
|
-
return true;
|
|
723
|
-
}
|
|
724
|
-
function defaultOnError(date, error) {
|
|
725
|
-
logger_1.default.error("Task failed with error!", error);
|
|
726
|
-
}
|
|
727
|
-
var Runner = class {
|
|
728
|
-
timeMatcher;
|
|
729
|
-
onMatch;
|
|
730
|
-
noOverlap;
|
|
731
|
-
maxExecutions;
|
|
732
|
-
maxRandomDelay;
|
|
733
|
-
runCount;
|
|
734
|
-
running;
|
|
735
|
-
heartBeatTimeout;
|
|
736
|
-
onMissedExecution;
|
|
737
|
-
onOverlap;
|
|
738
|
-
onError;
|
|
739
|
-
beforeRun;
|
|
740
|
-
onFinished;
|
|
741
|
-
onMaxExecutions;
|
|
742
|
-
constructor(timeMatcher, onMatch, options) {
|
|
743
|
-
this.timeMatcher = timeMatcher;
|
|
744
|
-
this.onMatch = onMatch;
|
|
745
|
-
this.noOverlap = options == void 0 || options.noOverlap === void 0 ? false : options.noOverlap;
|
|
746
|
-
this.maxExecutions = options?.maxExecutions;
|
|
747
|
-
this.maxRandomDelay = options?.maxRandomDelay || 0;
|
|
748
|
-
this.onMissedExecution = options?.onMissedExecution || emptyOnFn;
|
|
749
|
-
this.onOverlap = options?.onOverlap || emptyOnFn;
|
|
750
|
-
this.onError = options?.onError || defaultOnError;
|
|
751
|
-
this.onFinished = options?.onFinished || emptyHookFn;
|
|
752
|
-
this.beforeRun = options?.beforeRun || emptyHookFn;
|
|
753
|
-
this.onMaxExecutions = options?.onMaxExecutions || emptyOnFn;
|
|
754
|
-
this.runCount = 0;
|
|
755
|
-
this.running = false;
|
|
756
|
-
}
|
|
757
|
-
start() {
|
|
758
|
-
this.running = true;
|
|
759
|
-
let lastExecution;
|
|
760
|
-
let expectedNextExecution;
|
|
761
|
-
const scheduleNextHeartBeat = (currentDate) => {
|
|
762
|
-
if (this.running) {
|
|
763
|
-
clearTimeout(this.heartBeatTimeout);
|
|
764
|
-
this.heartBeatTimeout = setTimeout(heartBeat, getDelay(this.timeMatcher, currentDate));
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
const runTask = (date) => {
|
|
768
|
-
return new Promise(async (resolve) => {
|
|
769
|
-
const execution = {
|
|
770
|
-
id: (0, create_id_1.createID)("exec"),
|
|
771
|
-
reason: "scheduled"
|
|
772
|
-
};
|
|
773
|
-
const shouldExecute = await this.beforeRun(date, execution);
|
|
774
|
-
const randomDelay = Math.floor(Math.random() * this.maxRandomDelay);
|
|
775
|
-
if (shouldExecute) setTimeout(async () => {
|
|
776
|
-
try {
|
|
777
|
-
this.runCount++;
|
|
778
|
-
execution.startedAt = /* @__PURE__ */ new Date();
|
|
779
|
-
const result = await this.onMatch(date, execution);
|
|
780
|
-
execution.finishedAt = /* @__PURE__ */ new Date();
|
|
781
|
-
execution.result = result;
|
|
782
|
-
this.onFinished(date, execution);
|
|
783
|
-
if (this.maxExecutions && this.runCount >= this.maxExecutions) {
|
|
784
|
-
this.onMaxExecutions(date);
|
|
785
|
-
this.stop();
|
|
786
|
-
}
|
|
787
|
-
} catch (error) {
|
|
788
|
-
execution.finishedAt = /* @__PURE__ */ new Date();
|
|
789
|
-
execution.error = error;
|
|
790
|
-
this.onError(date, error, execution);
|
|
791
|
-
}
|
|
792
|
-
resolve(true);
|
|
793
|
-
}, randomDelay);
|
|
794
|
-
});
|
|
795
|
-
};
|
|
796
|
-
const checkAndRun = (date) => {
|
|
797
|
-
return new tracked_promise_1.TrackedPromise(async (resolve, reject) => {
|
|
798
|
-
try {
|
|
799
|
-
if (this.timeMatcher.match(date)) await runTask(date);
|
|
800
|
-
resolve(true);
|
|
801
|
-
} catch (err) {
|
|
802
|
-
reject(err);
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
};
|
|
806
|
-
const heartBeat = async () => {
|
|
807
|
-
const currentDate = nowWithoutMs();
|
|
808
|
-
if (expectedNextExecution && expectedNextExecution.getTime() < currentDate.getTime()) while (expectedNextExecution.getTime() < currentDate.getTime()) {
|
|
809
|
-
logger_1.default.warn(`missed execution at ${expectedNextExecution}! Possible blocking IO or high CPU user at the same process used by node-cron.`);
|
|
810
|
-
expectedNextExecution = this.timeMatcher.getNextMatch(expectedNextExecution);
|
|
811
|
-
runAsync(this.onMissedExecution, expectedNextExecution, defaultOnError);
|
|
812
|
-
}
|
|
813
|
-
if (lastExecution && lastExecution.getState() === "pending") {
|
|
814
|
-
runAsync(this.onOverlap, currentDate, defaultOnError);
|
|
815
|
-
if (this.noOverlap) {
|
|
816
|
-
logger_1.default.warn("task still running, new execution blocked by overlap prevention!");
|
|
817
|
-
expectedNextExecution = this.timeMatcher.getNextMatch(currentDate);
|
|
818
|
-
scheduleNextHeartBeat(currentDate);
|
|
819
|
-
return;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
lastExecution = checkAndRun(currentDate);
|
|
823
|
-
expectedNextExecution = this.timeMatcher.getNextMatch(currentDate);
|
|
824
|
-
scheduleNextHeartBeat(currentDate);
|
|
825
|
-
};
|
|
826
|
-
this.heartBeatTimeout = setTimeout(() => {
|
|
827
|
-
heartBeat();
|
|
828
|
-
}, getDelay(this.timeMatcher, nowWithoutMs()));
|
|
829
|
-
}
|
|
830
|
-
nextRun() {
|
|
831
|
-
return this.timeMatcher.getNextMatch(/* @__PURE__ */ new Date());
|
|
832
|
-
}
|
|
833
|
-
stop() {
|
|
834
|
-
this.running = false;
|
|
835
|
-
if (this.heartBeatTimeout) {
|
|
836
|
-
clearTimeout(this.heartBeatTimeout);
|
|
837
|
-
this.heartBeatTimeout = void 0;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
isStarted() {
|
|
841
|
-
return !!this.heartBeatTimeout && this.running;
|
|
842
|
-
}
|
|
843
|
-
isStopped() {
|
|
844
|
-
return !this.isStarted();
|
|
845
|
-
}
|
|
846
|
-
async execute() {
|
|
847
|
-
const date = /* @__PURE__ */ new Date();
|
|
848
|
-
const execution = {
|
|
849
|
-
id: (0, create_id_1.createID)("exec"),
|
|
850
|
-
reason: "invoked"
|
|
851
|
-
};
|
|
852
|
-
try {
|
|
853
|
-
if (await this.beforeRun(date, execution)) {
|
|
854
|
-
this.runCount++;
|
|
855
|
-
execution.startedAt = /* @__PURE__ */ new Date();
|
|
856
|
-
const result = await this.onMatch(date, execution);
|
|
857
|
-
execution.finishedAt = /* @__PURE__ */ new Date();
|
|
858
|
-
execution.result = result;
|
|
859
|
-
this.onFinished(date, execution);
|
|
860
|
-
}
|
|
861
|
-
} catch (error) {
|
|
862
|
-
execution.finishedAt = /* @__PURE__ */ new Date();
|
|
863
|
-
execution.error = error;
|
|
864
|
-
this.onError(date, error, execution);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
};
|
|
868
|
-
exports$1.Runner = Runner;
|
|
869
|
-
async function runAsync(fn, date, onError) {
|
|
870
|
-
try {
|
|
871
|
-
await fn(date);
|
|
872
|
-
} catch (error) {
|
|
873
|
-
onError(date, error);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
function getDelay(timeMatcher, currentDate) {
|
|
877
|
-
const maxDelay = 864e5;
|
|
878
|
-
const nextRun = timeMatcher.getNextMatch(currentDate);
|
|
879
|
-
const now = /* @__PURE__ */ new Date();
|
|
880
|
-
const delay = nextRun.getTime() - now.getTime();
|
|
881
|
-
if (delay > maxDelay) return maxDelay;
|
|
882
|
-
return Math.max(0, delay);
|
|
883
|
-
}
|
|
884
|
-
function nowWithoutMs() {
|
|
885
|
-
const date = /* @__PURE__ */ new Date();
|
|
886
|
-
date.setMilliseconds(0);
|
|
887
|
-
return date;
|
|
888
|
-
}
|
|
889
|
-
}));
|
|
890
|
-
//#endregion
|
|
891
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/pattern/convertion/month-names-conversion.js
|
|
892
|
-
var require_month_names_conversion = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
893
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
894
|
-
exports$1.default = (() => {
|
|
895
|
-
const months = [
|
|
896
|
-
"january",
|
|
897
|
-
"february",
|
|
898
|
-
"march",
|
|
899
|
-
"april",
|
|
900
|
-
"may",
|
|
901
|
-
"june",
|
|
902
|
-
"july",
|
|
903
|
-
"august",
|
|
904
|
-
"september",
|
|
905
|
-
"october",
|
|
906
|
-
"november",
|
|
907
|
-
"december"
|
|
908
|
-
];
|
|
909
|
-
const shortMonths = [
|
|
910
|
-
"jan",
|
|
911
|
-
"feb",
|
|
912
|
-
"mar",
|
|
913
|
-
"apr",
|
|
914
|
-
"may",
|
|
915
|
-
"jun",
|
|
916
|
-
"jul",
|
|
917
|
-
"aug",
|
|
918
|
-
"sep",
|
|
919
|
-
"oct",
|
|
920
|
-
"nov",
|
|
921
|
-
"dec"
|
|
922
|
-
];
|
|
923
|
-
function convertMonthName(expression, items) {
|
|
924
|
-
for (let i = 0; i < items.length; i++) expression = expression.replace(new RegExp(items[i], "gi"), i + 1);
|
|
925
|
-
return expression;
|
|
926
|
-
}
|
|
927
|
-
function interprete(monthExpression) {
|
|
928
|
-
monthExpression = convertMonthName(monthExpression, months);
|
|
929
|
-
monthExpression = convertMonthName(monthExpression, shortMonths);
|
|
930
|
-
return monthExpression;
|
|
931
|
-
}
|
|
932
|
-
return interprete;
|
|
933
|
-
})();
|
|
934
|
-
}));
|
|
935
|
-
//#endregion
|
|
936
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/pattern/convertion/week-day-names-conversion.js
|
|
937
|
-
var require_week_day_names_conversion = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
938
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
939
|
-
exports$1.default = (() => {
|
|
940
|
-
const weekDays = [
|
|
941
|
-
"sunday",
|
|
942
|
-
"monday",
|
|
943
|
-
"tuesday",
|
|
944
|
-
"wednesday",
|
|
945
|
-
"thursday",
|
|
946
|
-
"friday",
|
|
947
|
-
"saturday"
|
|
948
|
-
];
|
|
949
|
-
const shortWeekDays = [
|
|
950
|
-
"sun",
|
|
951
|
-
"mon",
|
|
952
|
-
"tue",
|
|
953
|
-
"wed",
|
|
954
|
-
"thu",
|
|
955
|
-
"fri",
|
|
956
|
-
"sat"
|
|
957
|
-
];
|
|
958
|
-
function convertWeekDayName(expression, items) {
|
|
959
|
-
for (let i = 0; i < items.length; i++) expression = expression.replace(new RegExp(items[i], "gi"), i);
|
|
960
|
-
return expression;
|
|
961
|
-
}
|
|
962
|
-
function convertWeekDays(expression) {
|
|
963
|
-
expression = expression.replace("7", "0");
|
|
964
|
-
expression = convertWeekDayName(expression, weekDays);
|
|
965
|
-
return convertWeekDayName(expression, shortWeekDays);
|
|
966
|
-
}
|
|
967
|
-
return convertWeekDays;
|
|
968
|
-
})();
|
|
969
|
-
}));
|
|
970
|
-
//#endregion
|
|
971
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/pattern/convertion/asterisk-to-range-conversion.js
|
|
972
|
-
var require_asterisk_to_range_conversion = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
973
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
974
|
-
exports$1.default = (() => {
|
|
975
|
-
function convertAsterisk(expression, replecement) {
|
|
976
|
-
if (expression.indexOf("*") !== -1) return expression.replace("*", replecement);
|
|
977
|
-
return expression;
|
|
978
|
-
}
|
|
979
|
-
function convertAsterisksToRanges(expressions) {
|
|
980
|
-
expressions[0] = convertAsterisk(expressions[0], "0-59");
|
|
981
|
-
expressions[1] = convertAsterisk(expressions[1], "0-59");
|
|
982
|
-
expressions[2] = convertAsterisk(expressions[2], "0-23");
|
|
983
|
-
expressions[3] = convertAsterisk(expressions[3], "1-31");
|
|
984
|
-
expressions[4] = convertAsterisk(expressions[4], "1-12");
|
|
985
|
-
expressions[5] = convertAsterisk(expressions[5], "0-6");
|
|
986
|
-
return expressions;
|
|
987
|
-
}
|
|
988
|
-
return convertAsterisksToRanges;
|
|
989
|
-
})();
|
|
990
|
-
}));
|
|
991
|
-
//#endregion
|
|
992
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/pattern/convertion/range-conversion.js
|
|
993
|
-
var require_range_conversion = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
994
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
995
|
-
exports$1.default = (() => {
|
|
996
|
-
function replaceWithRange(expression, text, init, end, stepTxt) {
|
|
997
|
-
const step = parseInt(stepTxt);
|
|
998
|
-
const numbers = [];
|
|
999
|
-
let last = parseInt(end);
|
|
1000
|
-
let first = parseInt(init);
|
|
1001
|
-
if (first > last) {
|
|
1002
|
-
last = parseInt(init);
|
|
1003
|
-
first = parseInt(end);
|
|
1004
|
-
}
|
|
1005
|
-
for (let i = first; i <= last; i += step) numbers.push(i);
|
|
1006
|
-
return expression.replace(new RegExp(text, "i"), numbers.join());
|
|
1007
|
-
}
|
|
1008
|
-
function convertRange(expression) {
|
|
1009
|
-
const rangeRegEx = /(\d+)-(\d+)(\/(\d+)|)/;
|
|
1010
|
-
let match = rangeRegEx.exec(expression);
|
|
1011
|
-
while (match !== null && match.length > 0) {
|
|
1012
|
-
expression = replaceWithRange(expression, match[0], match[1], match[2], match[4] || "1");
|
|
1013
|
-
match = rangeRegEx.exec(expression);
|
|
1014
|
-
}
|
|
1015
|
-
return expression;
|
|
1016
|
-
}
|
|
1017
|
-
function convertAllRanges(expressions) {
|
|
1018
|
-
for (let i = 0; i < expressions.length; i++) expressions[i] = convertRange(expressions[i]);
|
|
1019
|
-
return expressions;
|
|
1020
|
-
}
|
|
1021
|
-
return convertAllRanges;
|
|
1022
|
-
})();
|
|
1023
|
-
}));
|
|
1024
|
-
//#endregion
|
|
1025
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/pattern/convertion/index.js
|
|
1026
|
-
var require_convertion = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1027
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
1028
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1029
|
-
};
|
|
1030
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1031
|
-
var month_names_conversion_1 = __importDefault(require_month_names_conversion());
|
|
1032
|
-
var week_day_names_conversion_1 = __importDefault(require_week_day_names_conversion());
|
|
1033
|
-
var asterisk_to_range_conversion_1 = __importDefault(require_asterisk_to_range_conversion());
|
|
1034
|
-
var range_conversion_1 = __importDefault(require_range_conversion());
|
|
1035
|
-
exports$1.default = (() => {
|
|
1036
|
-
function appendSeccondExpression(expressions) {
|
|
1037
|
-
if (expressions.length === 5) return ["0"].concat(expressions);
|
|
1038
|
-
return expressions;
|
|
1039
|
-
}
|
|
1040
|
-
function removeSpaces(str) {
|
|
1041
|
-
return str.replace(/\s{2,}/g, " ").trim();
|
|
1042
|
-
}
|
|
1043
|
-
function normalizeIntegers(expressions) {
|
|
1044
|
-
for (let i = 0; i < expressions.length; i++) {
|
|
1045
|
-
const numbers = expressions[i].split(",");
|
|
1046
|
-
for (let j = 0; j < numbers.length; j++) numbers[j] = parseInt(numbers[j]);
|
|
1047
|
-
expressions[i] = numbers;
|
|
1048
|
-
}
|
|
1049
|
-
return expressions;
|
|
1050
|
-
}
|
|
1051
|
-
function interprete(expression) {
|
|
1052
|
-
let expressions = removeSpaces(`${expression}`).split(" ");
|
|
1053
|
-
expressions = appendSeccondExpression(expressions);
|
|
1054
|
-
expressions[4] = (0, month_names_conversion_1.default)(expressions[4]);
|
|
1055
|
-
expressions[5] = (0, week_day_names_conversion_1.default)(expressions[5]);
|
|
1056
|
-
expressions = (0, asterisk_to_range_conversion_1.default)(expressions);
|
|
1057
|
-
expressions = (0, range_conversion_1.default)(expressions);
|
|
1058
|
-
expressions = normalizeIntegers(expressions);
|
|
1059
|
-
return expressions;
|
|
1060
|
-
}
|
|
1061
|
-
return interprete;
|
|
1062
|
-
})();
|
|
1063
|
-
}));
|
|
1064
|
-
//#endregion
|
|
1065
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/time/localized-time.js
|
|
1066
|
-
var require_localized_time = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1067
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1068
|
-
exports$1.LocalizedTime = void 0;
|
|
1069
|
-
var LocalizedTime = class {
|
|
1070
|
-
timestamp;
|
|
1071
|
-
parts;
|
|
1072
|
-
timezone;
|
|
1073
|
-
constructor(date, timezone) {
|
|
1074
|
-
this.timestamp = date.getTime();
|
|
1075
|
-
this.timezone = timezone;
|
|
1076
|
-
this.parts = buildDateParts(date, timezone);
|
|
1077
|
-
}
|
|
1078
|
-
toDate() {
|
|
1079
|
-
return new Date(this.timestamp);
|
|
1080
|
-
}
|
|
1081
|
-
toISO() {
|
|
1082
|
-
const gmt = this.parts.gmt.replace(/^GMT/, "");
|
|
1083
|
-
const offset = gmt ? gmt : "Z";
|
|
1084
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
1085
|
-
return `${this.parts.year}-${pad(this.parts.month)}-${pad(this.parts.day)}T${pad(this.parts.hour)}:${pad(this.parts.minute)}:${pad(this.parts.second)}.${String(this.parts.milisecond).padStart(3, "0")}` + offset;
|
|
1086
|
-
}
|
|
1087
|
-
getParts() {
|
|
1088
|
-
return this.parts;
|
|
1089
|
-
}
|
|
1090
|
-
set(field, value) {
|
|
1091
|
-
this.parts[field] = value;
|
|
1092
|
-
const newDate = new Date(this.toISO());
|
|
1093
|
-
this.timestamp = newDate.getTime();
|
|
1094
|
-
this.parts = buildDateParts(newDate, this.timezone);
|
|
1095
|
-
}
|
|
1096
|
-
};
|
|
1097
|
-
exports$1.LocalizedTime = LocalizedTime;
|
|
1098
|
-
function buildDateParts(date, timezone) {
|
|
1099
|
-
const dftOptions = {
|
|
1100
|
-
year: "numeric",
|
|
1101
|
-
month: "2-digit",
|
|
1102
|
-
day: "2-digit",
|
|
1103
|
-
hour: "2-digit",
|
|
1104
|
-
minute: "2-digit",
|
|
1105
|
-
second: "2-digit",
|
|
1106
|
-
weekday: "short",
|
|
1107
|
-
hour12: false
|
|
1108
|
-
};
|
|
1109
|
-
if (timezone) dftOptions.timeZone = timezone;
|
|
1110
|
-
const parts = new Intl.DateTimeFormat("en-US", dftOptions).formatToParts(date).filter((part) => {
|
|
1111
|
-
return part.type !== "literal";
|
|
1112
|
-
}).reduce((acc, part) => {
|
|
1113
|
-
acc[part.type] = part.value;
|
|
1114
|
-
return acc;
|
|
1115
|
-
}, {});
|
|
1116
|
-
return {
|
|
1117
|
-
day: parseInt(parts.day),
|
|
1118
|
-
month: parseInt(parts.month),
|
|
1119
|
-
year: parseInt(parts.year),
|
|
1120
|
-
hour: parts.hour === "24" ? 0 : parseInt(parts.hour),
|
|
1121
|
-
minute: parseInt(parts.minute),
|
|
1122
|
-
second: parseInt(parts.second),
|
|
1123
|
-
milisecond: date.getMilliseconds(),
|
|
1124
|
-
weekday: parts.weekday,
|
|
1125
|
-
gmt: getTimezoneGMT(date, timezone)
|
|
1126
|
-
};
|
|
1127
|
-
}
|
|
1128
|
-
function getTimezoneGMT(date, timezone) {
|
|
1129
|
-
const utcDate = new Date(date.toLocaleString("en-US", { timeZone: "UTC" }));
|
|
1130
|
-
const tzDate = new Date(date.toLocaleString("en-US", { timeZone: timezone }));
|
|
1131
|
-
let offsetInMinutes = (utcDate.getTime() - tzDate.getTime()) / 6e4;
|
|
1132
|
-
const sign = offsetInMinutes <= 0 ? "+" : "-";
|
|
1133
|
-
offsetInMinutes = Math.abs(offsetInMinutes);
|
|
1134
|
-
if (offsetInMinutes === 0) return "Z";
|
|
1135
|
-
return `GMT${sign}${Math.floor(offsetInMinutes / 60).toString().padStart(2, "0")}:${Math.floor(offsetInMinutes % 60).toString().padStart(2, "0")}`;
|
|
1136
|
-
}
|
|
1137
|
-
}));
|
|
1138
|
-
//#endregion
|
|
1139
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/time/matcher-walker.js
|
|
1140
|
-
var require_matcher_walker = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1141
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
1142
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1143
|
-
};
|
|
1144
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1145
|
-
exports$1.MatcherWalker = void 0;
|
|
1146
|
-
var convertion_1 = __importDefault(require_convertion());
|
|
1147
|
-
var localized_time_1 = require_localized_time();
|
|
1148
|
-
var time_matcher_1 = require_time_matcher();
|
|
1149
|
-
var week_day_names_conversion_1 = __importDefault(require_week_day_names_conversion());
|
|
1150
|
-
var MatcherWalker = class {
|
|
1151
|
-
cronExpression;
|
|
1152
|
-
baseDate;
|
|
1153
|
-
pattern;
|
|
1154
|
-
expressions;
|
|
1155
|
-
timeMatcher;
|
|
1156
|
-
timezone;
|
|
1157
|
-
constructor(cronExpression, baseDate, timezone) {
|
|
1158
|
-
this.cronExpression = cronExpression;
|
|
1159
|
-
this.baseDate = baseDate;
|
|
1160
|
-
this.timeMatcher = new time_matcher_1.TimeMatcher(cronExpression, timezone);
|
|
1161
|
-
this.timezone = timezone;
|
|
1162
|
-
this.expressions = (0, convertion_1.default)(cronExpression);
|
|
1163
|
-
}
|
|
1164
|
-
isMatching() {
|
|
1165
|
-
return this.timeMatcher.match(this.baseDate);
|
|
1166
|
-
}
|
|
1167
|
-
matchNext() {
|
|
1168
|
-
const findNextDateIgnoringWeekday = () => {
|
|
1169
|
-
const baseDate = new Date(this.baseDate.getTime());
|
|
1170
|
-
baseDate.setMilliseconds(0);
|
|
1171
|
-
const localTime = new localized_time_1.LocalizedTime(baseDate, this.timezone);
|
|
1172
|
-
const dateParts = localTime.getParts();
|
|
1173
|
-
const date = new localized_time_1.LocalizedTime(localTime.toDate(), this.timezone);
|
|
1174
|
-
const seconds = this.expressions[0];
|
|
1175
|
-
const nextSecond = availableValue(seconds, dateParts.second);
|
|
1176
|
-
if (nextSecond) {
|
|
1177
|
-
date.set("second", nextSecond);
|
|
1178
|
-
if (this.timeMatcher.match(date.toDate())) return date;
|
|
1179
|
-
}
|
|
1180
|
-
date.set("second", seconds[0]);
|
|
1181
|
-
const minutes = this.expressions[1];
|
|
1182
|
-
const nextMinute = availableValue(minutes, dateParts.minute);
|
|
1183
|
-
if (nextMinute) {
|
|
1184
|
-
date.set("minute", nextMinute);
|
|
1185
|
-
if (this.timeMatcher.match(date.toDate())) return date;
|
|
1186
|
-
}
|
|
1187
|
-
date.set("minute", minutes[0]);
|
|
1188
|
-
const hours = this.expressions[2];
|
|
1189
|
-
const nextHour = availableValue(hours, dateParts.hour);
|
|
1190
|
-
if (nextHour) {
|
|
1191
|
-
date.set("hour", nextHour);
|
|
1192
|
-
if (this.timeMatcher.match(date.toDate())) return date;
|
|
1193
|
-
}
|
|
1194
|
-
date.set("hour", hours[0]);
|
|
1195
|
-
const days = this.expressions[3];
|
|
1196
|
-
const nextDay = availableValue(days, dateParts.day);
|
|
1197
|
-
if (nextDay) {
|
|
1198
|
-
date.set("day", nextDay);
|
|
1199
|
-
if (this.timeMatcher.match(date.toDate())) return date;
|
|
1200
|
-
}
|
|
1201
|
-
date.set("day", days[0]);
|
|
1202
|
-
const months = this.expressions[4];
|
|
1203
|
-
const nextMonth = availableValue(months, dateParts.month);
|
|
1204
|
-
if (nextMonth) {
|
|
1205
|
-
date.set("month", nextMonth);
|
|
1206
|
-
if (this.timeMatcher.match(date.toDate())) return date;
|
|
1207
|
-
}
|
|
1208
|
-
date.set("year", date.getParts().year + 1);
|
|
1209
|
-
date.set("month", months[0]);
|
|
1210
|
-
return date;
|
|
1211
|
-
};
|
|
1212
|
-
const date = findNextDateIgnoringWeekday();
|
|
1213
|
-
const weekdays = this.expressions[5];
|
|
1214
|
-
let currentWeekday = parseInt((0, week_day_names_conversion_1.default)(date.getParts().weekday));
|
|
1215
|
-
while (!(weekdays.indexOf(currentWeekday) > -1)) {
|
|
1216
|
-
date.set("year", date.getParts().year + 1);
|
|
1217
|
-
currentWeekday = parseInt((0, week_day_names_conversion_1.default)(date.getParts().weekday));
|
|
1218
|
-
}
|
|
1219
|
-
return date;
|
|
1220
|
-
}
|
|
1221
|
-
};
|
|
1222
|
-
exports$1.MatcherWalker = MatcherWalker;
|
|
1223
|
-
function availableValue(values, currentValue) {
|
|
1224
|
-
const availableValues = values.sort((a, b) => a - b).filter((s) => s > currentValue);
|
|
1225
|
-
if (availableValues.length > 0) return availableValues[0];
|
|
1226
|
-
return false;
|
|
1227
|
-
}
|
|
1228
|
-
}));
|
|
1229
|
-
//#endregion
|
|
1230
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/time/time-matcher.js
|
|
1231
|
-
var require_time_matcher = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1232
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
1233
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1234
|
-
};
|
|
1235
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1236
|
-
exports$1.TimeMatcher = void 0;
|
|
1237
|
-
var index_1 = __importDefault(require_convertion());
|
|
1238
|
-
var week_day_names_conversion_1 = __importDefault(require_week_day_names_conversion());
|
|
1239
|
-
var localized_time_1 = require_localized_time();
|
|
1240
|
-
var matcher_walker_1 = require_matcher_walker();
|
|
1241
|
-
function matchValue(allowedValues, value) {
|
|
1242
|
-
return allowedValues.indexOf(value) !== -1;
|
|
1243
|
-
}
|
|
1244
|
-
var TimeMatcher = class {
|
|
1245
|
-
timezone;
|
|
1246
|
-
pattern;
|
|
1247
|
-
expressions;
|
|
1248
|
-
constructor(pattern, timezone) {
|
|
1249
|
-
this.timezone = timezone;
|
|
1250
|
-
this.pattern = pattern;
|
|
1251
|
-
this.expressions = (0, index_1.default)(pattern);
|
|
1252
|
-
}
|
|
1253
|
-
match(date) {
|
|
1254
|
-
const parts = new localized_time_1.LocalizedTime(date, this.timezone).getParts();
|
|
1255
|
-
const runOnSecond = matchValue(this.expressions[0], parts.second);
|
|
1256
|
-
const runOnMinute = matchValue(this.expressions[1], parts.minute);
|
|
1257
|
-
const runOnHour = matchValue(this.expressions[2], parts.hour);
|
|
1258
|
-
const runOnDay = matchValue(this.expressions[3], parts.day);
|
|
1259
|
-
const runOnMonth = matchValue(this.expressions[4], parts.month);
|
|
1260
|
-
const runOnWeekDay = matchValue(this.expressions[5], parseInt((0, week_day_names_conversion_1.default)(parts.weekday)));
|
|
1261
|
-
return runOnSecond && runOnMinute && runOnHour && runOnDay && runOnMonth && runOnWeekDay;
|
|
1262
|
-
}
|
|
1263
|
-
getNextMatch(date) {
|
|
1264
|
-
return new matcher_walker_1.MatcherWalker(this.pattern, date, this.timezone).matchNext().toDate();
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
exports$1.TimeMatcher = TimeMatcher;
|
|
1268
|
-
}));
|
|
1269
|
-
//#endregion
|
|
1270
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/tasks/state-machine.js
|
|
1271
|
-
var require_state_machine = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1272
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1273
|
-
exports$1.StateMachine = void 0;
|
|
1274
|
-
var allowedTransitions = {
|
|
1275
|
-
"stopped": [
|
|
1276
|
-
"stopped",
|
|
1277
|
-
"idle",
|
|
1278
|
-
"destroyed"
|
|
1279
|
-
],
|
|
1280
|
-
"idle": [
|
|
1281
|
-
"idle",
|
|
1282
|
-
"running",
|
|
1283
|
-
"stopped",
|
|
1284
|
-
"destroyed"
|
|
1285
|
-
],
|
|
1286
|
-
"running": [
|
|
1287
|
-
"running",
|
|
1288
|
-
"idle",
|
|
1289
|
-
"stopped",
|
|
1290
|
-
"destroyed"
|
|
1291
|
-
],
|
|
1292
|
-
"destroyed": ["destroyed"]
|
|
1293
|
-
};
|
|
1294
|
-
var StateMachine = class {
|
|
1295
|
-
state;
|
|
1296
|
-
constructor(initial = "stopped") {
|
|
1297
|
-
this.state = initial;
|
|
1298
|
-
}
|
|
1299
|
-
changeState(state) {
|
|
1300
|
-
if (allowedTransitions[this.state].includes(state)) this.state = state;
|
|
1301
|
-
else throw new Error(`invalid transition from ${this.state} to ${state}`);
|
|
1302
|
-
}
|
|
1303
|
-
};
|
|
1304
|
-
exports$1.StateMachine = StateMachine;
|
|
1305
|
-
}));
|
|
1306
|
-
//#endregion
|
|
1307
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/tasks/inline-scheduled-task.js
|
|
1308
|
-
var require_inline_scheduled_task = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1309
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
1310
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1311
|
-
};
|
|
1312
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1313
|
-
exports$1.InlineScheduledTask = void 0;
|
|
1314
|
-
var events_1 = __importDefault(__require("events"));
|
|
1315
|
-
var runner_1 = require_runner();
|
|
1316
|
-
var time_matcher_1 = require_time_matcher();
|
|
1317
|
-
var create_id_1 = require_create_id();
|
|
1318
|
-
var state_machine_1 = require_state_machine();
|
|
1319
|
-
var logger_1 = __importDefault(require_logger());
|
|
1320
|
-
var localized_time_1 = require_localized_time();
|
|
1321
|
-
var TaskEmitter = class extends events_1.default {};
|
|
1322
|
-
var InlineScheduledTask = class {
|
|
1323
|
-
emitter;
|
|
1324
|
-
cronExpression;
|
|
1325
|
-
timeMatcher;
|
|
1326
|
-
runner;
|
|
1327
|
-
id;
|
|
1328
|
-
name;
|
|
1329
|
-
stateMachine;
|
|
1330
|
-
timezone;
|
|
1331
|
-
constructor(cronExpression, taskFn, options) {
|
|
1332
|
-
this.emitter = new TaskEmitter();
|
|
1333
|
-
this.cronExpression = cronExpression;
|
|
1334
|
-
this.id = (0, create_id_1.createID)("task", 12);
|
|
1335
|
-
this.name = options?.name || this.id;
|
|
1336
|
-
this.timezone = options?.timezone;
|
|
1337
|
-
this.timeMatcher = new time_matcher_1.TimeMatcher(cronExpression, options?.timezone);
|
|
1338
|
-
this.stateMachine = new state_machine_1.StateMachine();
|
|
1339
|
-
const runnerOptions = {
|
|
1340
|
-
timezone: options?.timezone,
|
|
1341
|
-
noOverlap: options?.noOverlap,
|
|
1342
|
-
maxExecutions: options?.maxExecutions,
|
|
1343
|
-
maxRandomDelay: options?.maxRandomDelay,
|
|
1344
|
-
beforeRun: (date, execution) => {
|
|
1345
|
-
if (execution.reason === "scheduled") this.changeState("running");
|
|
1346
|
-
this.emitter.emit("execution:started", this.createContext(date, execution));
|
|
1347
|
-
return true;
|
|
1348
|
-
},
|
|
1349
|
-
onFinished: (date, execution) => {
|
|
1350
|
-
if (execution.reason === "scheduled") this.changeState("idle");
|
|
1351
|
-
this.emitter.emit("execution:finished", this.createContext(date, execution));
|
|
1352
|
-
return true;
|
|
1353
|
-
},
|
|
1354
|
-
onError: (date, error, execution) => {
|
|
1355
|
-
logger_1.default.error(error);
|
|
1356
|
-
this.emitter.emit("execution:failed", this.createContext(date, execution));
|
|
1357
|
-
this.changeState("idle");
|
|
1358
|
-
},
|
|
1359
|
-
onOverlap: (date) => {
|
|
1360
|
-
this.emitter.emit("execution:overlap", this.createContext(date));
|
|
1361
|
-
},
|
|
1362
|
-
onMissedExecution: (date) => {
|
|
1363
|
-
this.emitter.emit("execution:missed", this.createContext(date));
|
|
1364
|
-
},
|
|
1365
|
-
onMaxExecutions: (date) => {
|
|
1366
|
-
this.emitter.emit("execution:maxReached", this.createContext(date));
|
|
1367
|
-
this.destroy();
|
|
1368
|
-
}
|
|
1369
|
-
};
|
|
1370
|
-
this.runner = new runner_1.Runner(this.timeMatcher, (date, execution) => {
|
|
1371
|
-
return taskFn(this.createContext(date, execution));
|
|
1372
|
-
}, runnerOptions);
|
|
1373
|
-
}
|
|
1374
|
-
getNextRun() {
|
|
1375
|
-
if (this.stateMachine.state !== "stopped") return this.runner.nextRun();
|
|
1376
|
-
return null;
|
|
1377
|
-
}
|
|
1378
|
-
changeState(state) {
|
|
1379
|
-
if (this.runner.isStarted()) this.stateMachine.changeState(state);
|
|
1380
|
-
}
|
|
1381
|
-
start() {
|
|
1382
|
-
if (this.runner.isStopped()) {
|
|
1383
|
-
this.runner.start();
|
|
1384
|
-
this.stateMachine.changeState("idle");
|
|
1385
|
-
this.emitter.emit("task:started", this.createContext(/* @__PURE__ */ new Date()));
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
stop() {
|
|
1389
|
-
if (this.runner.isStarted()) {
|
|
1390
|
-
this.runner.stop();
|
|
1391
|
-
this.stateMachine.changeState("stopped");
|
|
1392
|
-
this.emitter.emit("task:stopped", this.createContext(/* @__PURE__ */ new Date()));
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
getStatus() {
|
|
1396
|
-
return this.stateMachine.state;
|
|
1397
|
-
}
|
|
1398
|
-
destroy() {
|
|
1399
|
-
if (this.stateMachine.state === "destroyed") return;
|
|
1400
|
-
this.stop();
|
|
1401
|
-
this.stateMachine.changeState("destroyed");
|
|
1402
|
-
this.emitter.emit("task:destroyed", this.createContext(/* @__PURE__ */ new Date()));
|
|
1403
|
-
}
|
|
1404
|
-
execute() {
|
|
1405
|
-
return new Promise((resolve, reject) => {
|
|
1406
|
-
const onFail = (context) => {
|
|
1407
|
-
this.off("execution:finished", onFail);
|
|
1408
|
-
reject(context.execution?.error);
|
|
1409
|
-
};
|
|
1410
|
-
const onFinished = (context) => {
|
|
1411
|
-
this.off("execution:failed", onFail);
|
|
1412
|
-
resolve(context.execution?.result);
|
|
1413
|
-
};
|
|
1414
|
-
this.once("execution:finished", onFinished);
|
|
1415
|
-
this.once("execution:failed", onFail);
|
|
1416
|
-
this.runner.execute();
|
|
1417
|
-
});
|
|
1418
|
-
}
|
|
1419
|
-
on(event, fun) {
|
|
1420
|
-
this.emitter.on(event, fun);
|
|
1421
|
-
}
|
|
1422
|
-
off(event, fun) {
|
|
1423
|
-
this.emitter.off(event, fun);
|
|
1424
|
-
}
|
|
1425
|
-
once(event, fun) {
|
|
1426
|
-
this.emitter.once(event, fun);
|
|
1427
|
-
}
|
|
1428
|
-
createContext(executionDate, execution) {
|
|
1429
|
-
const localTime = new localized_time_1.LocalizedTime(executionDate, this.timezone);
|
|
1430
|
-
return {
|
|
1431
|
-
date: localTime.toDate(),
|
|
1432
|
-
dateLocalIso: localTime.toISO(),
|
|
1433
|
-
triggeredAt: /* @__PURE__ */ new Date(),
|
|
1434
|
-
task: this,
|
|
1435
|
-
execution
|
|
1436
|
-
};
|
|
1437
|
-
}
|
|
1438
|
-
};
|
|
1439
|
-
exports$1.InlineScheduledTask = InlineScheduledTask;
|
|
1440
|
-
}));
|
|
1441
|
-
//#endregion
|
|
1442
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/task-registry.js
|
|
1443
|
-
var require_task_registry = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1444
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1445
|
-
exports$1.TaskRegistry = void 0;
|
|
1446
|
-
var tasks = /* @__PURE__ */ new Map();
|
|
1447
|
-
var TaskRegistry = class {
|
|
1448
|
-
add(task) {
|
|
1449
|
-
if (this.has(task.id)) throw Error(`task ${task.id} already registred!`);
|
|
1450
|
-
tasks.set(task.id, task);
|
|
1451
|
-
task.on("task:destroyed", () => {
|
|
1452
|
-
this.remove(task);
|
|
1453
|
-
});
|
|
1454
|
-
}
|
|
1455
|
-
get(taskId) {
|
|
1456
|
-
return tasks.get(taskId);
|
|
1457
|
-
}
|
|
1458
|
-
remove(task) {
|
|
1459
|
-
if (this.has(task.id)) {
|
|
1460
|
-
task?.destroy();
|
|
1461
|
-
tasks.delete(task.id);
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
all() {
|
|
1465
|
-
return tasks;
|
|
1466
|
-
}
|
|
1467
|
-
has(taskId) {
|
|
1468
|
-
return tasks.has(taskId);
|
|
1469
|
-
}
|
|
1470
|
-
killAll() {
|
|
1471
|
-
tasks.forEach((id) => this.remove(id));
|
|
1472
|
-
}
|
|
1473
|
-
};
|
|
1474
|
-
exports$1.TaskRegistry = TaskRegistry;
|
|
1475
|
-
}));
|
|
1476
|
-
//#endregion
|
|
1477
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/pattern/validation/pattern-validation.js
|
|
1478
|
-
var require_pattern_validation = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1479
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
1480
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1481
|
-
};
|
|
1482
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1483
|
-
var index_1 = __importDefault(require_convertion());
|
|
1484
|
-
var validationRegex = /^(?:\d+|\*|\*\/\d+)$/;
|
|
1485
|
-
function isValidExpression(expression, min, max) {
|
|
1486
|
-
const options = expression;
|
|
1487
|
-
for (const option of options) {
|
|
1488
|
-
const optionAsInt = parseInt(option, 10);
|
|
1489
|
-
if (!Number.isNaN(optionAsInt) && (optionAsInt < min || optionAsInt > max) || !validationRegex.test(option)) return false;
|
|
1490
|
-
}
|
|
1491
|
-
return true;
|
|
1492
|
-
}
|
|
1493
|
-
function isInvalidSecond(expression) {
|
|
1494
|
-
return !isValidExpression(expression, 0, 59);
|
|
1495
|
-
}
|
|
1496
|
-
function isInvalidMinute(expression) {
|
|
1497
|
-
return !isValidExpression(expression, 0, 59);
|
|
1498
|
-
}
|
|
1499
|
-
function isInvalidHour(expression) {
|
|
1500
|
-
return !isValidExpression(expression, 0, 23);
|
|
1501
|
-
}
|
|
1502
|
-
function isInvalidDayOfMonth(expression) {
|
|
1503
|
-
return !isValidExpression(expression, 1, 31);
|
|
1504
|
-
}
|
|
1505
|
-
function isInvalidMonth(expression) {
|
|
1506
|
-
return !isValidExpression(expression, 1, 12);
|
|
1507
|
-
}
|
|
1508
|
-
function isInvalidWeekDay(expression) {
|
|
1509
|
-
return !isValidExpression(expression, 0, 7);
|
|
1510
|
-
}
|
|
1511
|
-
function validateFields(patterns, executablePatterns) {
|
|
1512
|
-
if (isInvalidSecond(executablePatterns[0])) throw new Error(`${patterns[0]} is a invalid expression for second`);
|
|
1513
|
-
if (isInvalidMinute(executablePatterns[1])) throw new Error(`${patterns[1]} is a invalid expression for minute`);
|
|
1514
|
-
if (isInvalidHour(executablePatterns[2])) throw new Error(`${patterns[2]} is a invalid expression for hour`);
|
|
1515
|
-
if (isInvalidDayOfMonth(executablePatterns[3])) throw new Error(`${patterns[3]} is a invalid expression for day of month`);
|
|
1516
|
-
if (isInvalidMonth(executablePatterns[4])) throw new Error(`${patterns[4]} is a invalid expression for month`);
|
|
1517
|
-
if (isInvalidWeekDay(executablePatterns[5])) throw new Error(`${patterns[5]} is a invalid expression for week day`);
|
|
1518
|
-
}
|
|
1519
|
-
function validate(pattern) {
|
|
1520
|
-
if (typeof pattern !== "string") throw new TypeError("pattern must be a string!");
|
|
1521
|
-
const patterns = pattern.split(" ");
|
|
1522
|
-
const executablePatterns = (0, index_1.default)(pattern);
|
|
1523
|
-
if (patterns.length === 5) patterns.unshift("0");
|
|
1524
|
-
validateFields(patterns, executablePatterns);
|
|
1525
|
-
}
|
|
1526
|
-
exports$1.default = validate;
|
|
1527
|
-
}));
|
|
1528
|
-
//#endregion
|
|
1529
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/tasks/background-scheduled-task/background-scheduled-task.js
|
|
1530
|
-
var require_background_scheduled_task = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1531
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
1532
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1533
|
-
};
|
|
1534
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1535
|
-
var path_1$1 = __require("path");
|
|
1536
|
-
var child_process_1 = __require("child_process");
|
|
1537
|
-
var create_id_1 = require_create_id();
|
|
1538
|
-
var stream_1 = __require("stream");
|
|
1539
|
-
var state_machine_1 = require_state_machine();
|
|
1540
|
-
var localized_time_1 = require_localized_time();
|
|
1541
|
-
var logger_1 = __importDefault(require_logger());
|
|
1542
|
-
var time_matcher_1 = require_time_matcher();
|
|
1543
|
-
var daemonPath = (0, path_1$1.resolve)(new URL(".", import.meta.url).pathname.replace(/\/+$/, ""), "daemon.js");
|
|
1544
|
-
var TaskEmitter = class extends stream_1.EventEmitter {};
|
|
1545
|
-
var BackgroundScheduledTask = class {
|
|
1546
|
-
emitter;
|
|
1547
|
-
id;
|
|
1548
|
-
name;
|
|
1549
|
-
cronExpression;
|
|
1550
|
-
taskPath;
|
|
1551
|
-
options;
|
|
1552
|
-
forkProcess;
|
|
1553
|
-
stateMachine;
|
|
1554
|
-
constructor(cronExpression, taskPath, options) {
|
|
1555
|
-
this.cronExpression = cronExpression;
|
|
1556
|
-
this.taskPath = taskPath;
|
|
1557
|
-
this.options = options;
|
|
1558
|
-
this.id = (0, create_id_1.createID)("task");
|
|
1559
|
-
this.name = options?.name || this.id;
|
|
1560
|
-
this.emitter = new TaskEmitter();
|
|
1561
|
-
this.stateMachine = new state_machine_1.StateMachine("stopped");
|
|
1562
|
-
this.on("task:stopped", () => {
|
|
1563
|
-
this.forkProcess?.kill();
|
|
1564
|
-
this.forkProcess = void 0;
|
|
1565
|
-
this.stateMachine.changeState("stopped");
|
|
1566
|
-
});
|
|
1567
|
-
this.on("task:destroyed", () => {
|
|
1568
|
-
this.forkProcess?.kill();
|
|
1569
|
-
this.forkProcess = void 0;
|
|
1570
|
-
this.stateMachine.changeState("destroyed");
|
|
1571
|
-
});
|
|
1572
|
-
}
|
|
1573
|
-
getNextRun() {
|
|
1574
|
-
if (this.stateMachine.state !== "stopped") return new time_matcher_1.TimeMatcher(this.cronExpression, this.options?.timezone).getNextMatch(/* @__PURE__ */ new Date());
|
|
1575
|
-
return null;
|
|
1576
|
-
}
|
|
1577
|
-
start() {
|
|
1578
|
-
return new Promise((resolve, reject) => {
|
|
1579
|
-
if (this.forkProcess) return resolve(void 0);
|
|
1580
|
-
const timeout = setTimeout(() => {
|
|
1581
|
-
reject(/* @__PURE__ */ new Error("Start operation timed out"));
|
|
1582
|
-
}, 5e3);
|
|
1583
|
-
try {
|
|
1584
|
-
this.forkProcess = (0, child_process_1.fork)(daemonPath);
|
|
1585
|
-
this.forkProcess.on("error", (err) => {
|
|
1586
|
-
clearTimeout(timeout);
|
|
1587
|
-
reject(/* @__PURE__ */ new Error(`Error on daemon: ${err.message}`));
|
|
1588
|
-
});
|
|
1589
|
-
this.forkProcess.on("exit", (code, signal) => {
|
|
1590
|
-
if (code !== 0 && signal !== "SIGTERM") {
|
|
1591
|
-
const erro = /* @__PURE__ */ new Error(`node-cron daemon exited with code ${code || signal}`);
|
|
1592
|
-
logger_1.default.error(erro);
|
|
1593
|
-
clearTimeout(timeout);
|
|
1594
|
-
reject(erro);
|
|
1595
|
-
}
|
|
1596
|
-
});
|
|
1597
|
-
this.forkProcess.on("message", (message) => {
|
|
1598
|
-
if (message.jsonError) {
|
|
1599
|
-
if (message.context?.execution) {
|
|
1600
|
-
message.context.execution.error = deserializeError(message.jsonError);
|
|
1601
|
-
delete message.jsonError;
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
if (message.context?.task?.state) this.stateMachine.changeState(message.context?.task?.state);
|
|
1605
|
-
if (message.context) {
|
|
1606
|
-
const execution = message.context?.execution;
|
|
1607
|
-
delete execution?.hasError;
|
|
1608
|
-
const context = this.createContext(new Date(message.context.date), execution);
|
|
1609
|
-
this.emitter.emit(message.event, context);
|
|
1610
|
-
}
|
|
1611
|
-
});
|
|
1612
|
-
this.once("task:started", () => {
|
|
1613
|
-
this.stateMachine.changeState("idle");
|
|
1614
|
-
clearTimeout(timeout);
|
|
1615
|
-
resolve(void 0);
|
|
1616
|
-
});
|
|
1617
|
-
this.forkProcess.send({
|
|
1618
|
-
command: "task:start",
|
|
1619
|
-
path: this.taskPath,
|
|
1620
|
-
cron: this.cronExpression,
|
|
1621
|
-
options: this.options
|
|
1622
|
-
});
|
|
1623
|
-
} catch (error) {
|
|
1624
|
-
reject(error);
|
|
1625
|
-
}
|
|
1626
|
-
});
|
|
1627
|
-
}
|
|
1628
|
-
stop() {
|
|
1629
|
-
return new Promise((resolve, reject) => {
|
|
1630
|
-
if (!this.forkProcess) return resolve(void 0);
|
|
1631
|
-
const timeoutId = setTimeout(() => {
|
|
1632
|
-
clearTimeout(timeoutId);
|
|
1633
|
-
reject(/* @__PURE__ */ new Error("Stop operation timed out"));
|
|
1634
|
-
}, 5e3);
|
|
1635
|
-
const cleanupAndResolve = () => {
|
|
1636
|
-
clearTimeout(timeoutId);
|
|
1637
|
-
this.off("task:stopped", onStopped);
|
|
1638
|
-
this.forkProcess = void 0;
|
|
1639
|
-
resolve(void 0);
|
|
1640
|
-
};
|
|
1641
|
-
const onStopped = () => {
|
|
1642
|
-
cleanupAndResolve();
|
|
1643
|
-
};
|
|
1644
|
-
this.once("task:stopped", onStopped);
|
|
1645
|
-
this.forkProcess.send({ command: "task:stop" });
|
|
1646
|
-
});
|
|
1647
|
-
}
|
|
1648
|
-
getStatus() {
|
|
1649
|
-
return this.stateMachine.state;
|
|
1650
|
-
}
|
|
1651
|
-
destroy() {
|
|
1652
|
-
return new Promise((resolve, reject) => {
|
|
1653
|
-
if (!this.forkProcess) return resolve(void 0);
|
|
1654
|
-
const timeoutId = setTimeout(() => {
|
|
1655
|
-
clearTimeout(timeoutId);
|
|
1656
|
-
reject(/* @__PURE__ */ new Error("Destroy operation timed out"));
|
|
1657
|
-
}, 5e3);
|
|
1658
|
-
const onDestroy = () => {
|
|
1659
|
-
clearTimeout(timeoutId);
|
|
1660
|
-
this.off("task:destroyed", onDestroy);
|
|
1661
|
-
resolve(void 0);
|
|
1662
|
-
};
|
|
1663
|
-
this.once("task:destroyed", onDestroy);
|
|
1664
|
-
this.forkProcess.send({ command: "task:destroy" });
|
|
1665
|
-
});
|
|
1666
|
-
}
|
|
1667
|
-
execute() {
|
|
1668
|
-
return new Promise((resolve, reject) => {
|
|
1669
|
-
if (!this.forkProcess) return reject(/* @__PURE__ */ new Error("Cannot execute background task because it hasn't been started yet. Please initialize the task using the start() method before attempting to execute it."));
|
|
1670
|
-
const timeoutId = setTimeout(() => {
|
|
1671
|
-
cleanupListeners();
|
|
1672
|
-
reject(/* @__PURE__ */ new Error("Execution timeout exceeded"));
|
|
1673
|
-
}, 5e3);
|
|
1674
|
-
const cleanupListeners = () => {
|
|
1675
|
-
clearTimeout(timeoutId);
|
|
1676
|
-
this.off("execution:finished", onFinished);
|
|
1677
|
-
this.off("execution:failed", onFail);
|
|
1678
|
-
};
|
|
1679
|
-
const onFinished = (context) => {
|
|
1680
|
-
cleanupListeners();
|
|
1681
|
-
resolve(context.execution?.result);
|
|
1682
|
-
};
|
|
1683
|
-
const onFail = (context) => {
|
|
1684
|
-
cleanupListeners();
|
|
1685
|
-
reject(context.execution?.error || /* @__PURE__ */ new Error("Execution failed without specific error"));
|
|
1686
|
-
};
|
|
1687
|
-
this.once("execution:finished", onFinished);
|
|
1688
|
-
this.once("execution:failed", onFail);
|
|
1689
|
-
this.forkProcess.send({ command: "task:execute" });
|
|
1690
|
-
});
|
|
1691
|
-
}
|
|
1692
|
-
on(event, fun) {
|
|
1693
|
-
this.emitter.on(event, fun);
|
|
1694
|
-
}
|
|
1695
|
-
off(event, fun) {
|
|
1696
|
-
this.emitter.off(event, fun);
|
|
1697
|
-
}
|
|
1698
|
-
once(event, fun) {
|
|
1699
|
-
this.emitter.once(event, fun);
|
|
1700
|
-
}
|
|
1701
|
-
createContext(executionDate, execution) {
|
|
1702
|
-
const localTime = new localized_time_1.LocalizedTime(executionDate, this.options?.timezone);
|
|
1703
|
-
return {
|
|
1704
|
-
date: localTime.toDate(),
|
|
1705
|
-
dateLocalIso: localTime.toISO(),
|
|
1706
|
-
triggeredAt: /* @__PURE__ */ new Date(),
|
|
1707
|
-
task: this,
|
|
1708
|
-
execution
|
|
1709
|
-
};
|
|
1710
|
-
}
|
|
1711
|
-
};
|
|
1712
|
-
function deserializeError(str) {
|
|
1713
|
-
const data = JSON.parse(str);
|
|
1714
|
-
const err = new (globalThis[data.name] || Error)(data.message);
|
|
1715
|
-
if (data.stack) err.stack = data.stack;
|
|
1716
|
-
Object.keys(data).forEach((key) => {
|
|
1717
|
-
if (![
|
|
1718
|
-
"name",
|
|
1719
|
-
"message",
|
|
1720
|
-
"stack"
|
|
1721
|
-
].includes(key)) err[key] = data[key];
|
|
1722
|
-
});
|
|
1723
|
-
return err;
|
|
1724
|
-
}
|
|
1725
|
-
exports$1.default = BackgroundScheduledTask;
|
|
1726
|
-
}));
|
|
1727
|
-
//#endregion
|
|
1728
|
-
//#region ../../node_modules/.pnpm/node-cron@4.2.1/node_modules/node-cron/dist/esm/node-cron.js
|
|
1729
|
-
var require_node_cron = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
1730
|
-
var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
|
|
1731
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1732
|
-
};
|
|
1733
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
1734
|
-
exports$1.nodeCron = exports$1.getTask = exports$1.getTasks = void 0;
|
|
1735
|
-
exports$1.schedule = schedule;
|
|
1736
|
-
exports$1.createTask = createTask;
|
|
1737
|
-
exports$1.solvePath = solvePath;
|
|
1738
|
-
exports$1.validate = validate;
|
|
1739
|
-
var inline_scheduled_task_1 = require_inline_scheduled_task();
|
|
1740
|
-
var task_registry_1 = require_task_registry();
|
|
1741
|
-
var pattern_validation_1 = __importDefault(require_pattern_validation());
|
|
1742
|
-
var background_scheduled_task_1 = __importDefault(require_background_scheduled_task());
|
|
1743
|
-
var path_1 = __importDefault(__require("path"));
|
|
1744
|
-
var url_1 = __require("url");
|
|
1745
|
-
var registry = new task_registry_1.TaskRegistry();
|
|
1746
|
-
function schedule(expression, func, options) {
|
|
1747
|
-
const task = createTask(expression, func, options);
|
|
1748
|
-
task.start();
|
|
1749
|
-
return task;
|
|
1750
|
-
}
|
|
1751
|
-
function createTask(expression, func, options) {
|
|
1752
|
-
let task;
|
|
1753
|
-
if (func instanceof Function) task = new inline_scheduled_task_1.InlineScheduledTask(expression, func, options);
|
|
1754
|
-
else {
|
|
1755
|
-
const taskPath = solvePath(func);
|
|
1756
|
-
task = new background_scheduled_task_1.default(expression, taskPath, options);
|
|
1757
|
-
}
|
|
1758
|
-
registry.add(task);
|
|
1759
|
-
return task;
|
|
1760
|
-
}
|
|
1761
|
-
function solvePath(filePath) {
|
|
1762
|
-
if (path_1.default.isAbsolute(filePath)) return (0, url_1.pathToFileURL)(filePath).href;
|
|
1763
|
-
if (filePath.startsWith("file://")) return filePath;
|
|
1764
|
-
const stackLines = (/* @__PURE__ */ new Error()).stack?.split("\n");
|
|
1765
|
-
if (stackLines) {
|
|
1766
|
-
stackLines?.shift();
|
|
1767
|
-
const match = (stackLines?.find((line) => {
|
|
1768
|
-
return line.indexOf(new URL(import.meta.url).pathname) === -1;
|
|
1769
|
-
}))?.match(/(file:\/\/)?(((\/?)(\w:))?([/\\].+)):\d+:\d+/);
|
|
1770
|
-
if (match) {
|
|
1771
|
-
const dir = `${match[5] ?? ""}${path_1.default.dirname(match[6])}`;
|
|
1772
|
-
return (0, url_1.pathToFileURL)(path_1.default.resolve(dir, filePath)).href;
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
throw new Error(`Could not locate task file ${filePath}`);
|
|
1776
|
-
}
|
|
1777
|
-
function validate(expression) {
|
|
1778
|
-
try {
|
|
1779
|
-
(0, pattern_validation_1.default)(expression);
|
|
1780
|
-
return true;
|
|
1781
|
-
} catch (e) {
|
|
1782
|
-
return false;
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
exports$1.getTasks = registry.all;
|
|
1786
|
-
exports$1.getTask = registry.get;
|
|
1787
|
-
exports$1.nodeCron = {
|
|
1788
|
-
schedule,
|
|
1789
|
-
createTask,
|
|
1790
|
-
validate,
|
|
1791
|
-
getTasks: exports$1.getTasks,
|
|
1792
|
-
getTask: exports$1.getTask
|
|
1793
|
-
};
|
|
1794
|
-
exports$1.default = exports$1.nodeCron;
|
|
1795
|
-
}));
|
|
1796
|
-
//#endregion
|
|
1797
|
-
//#region ../core/dist/llm/onboarding/login-engine.js
|
|
1798
|
-
/**
|
|
1799
|
-
* `runOnboardingLogin` — the 3-step onboarding login engine (T11724 · M3).
|
|
1800
|
-
*
|
|
1801
|
-
* The imperative front-door flow that takes a provider from a cold start to a
|
|
1802
|
-
* usable, validated profile binding. It ORCHESTRATES the already-merged
|
|
1803
|
-
* credential / catalog / config / resolver accessors — it does NOT reimplement
|
|
1804
|
-
* OAuth, construct a transport, or open an LLM client (Gate-13: chokepoint only).
|
|
1805
|
-
*
|
|
1806
|
-
* ## The four steps
|
|
1807
|
-
*
|
|
1808
|
-
* 1. **connect** — resolve the provider (alias → canonical via
|
|
1809
|
-
* {@link getProviderProfile}) and land a credential (Account) in the
|
|
1810
|
-
* multi-credential pool via {@link addCredential}. The OAuth token / API
|
|
1811
|
-
* key is supplied by the caller (`opts.token`): the owner-driven browser
|
|
1812
|
-
* step (PKCE / device-code) runs in `cleo llm login` BEFORE this engine,
|
|
1813
|
-
* so the engine itself is non-interactive and testable. OAuth-less
|
|
1814
|
-
* providers pass the same `opts.token` as an API key (AC4).
|
|
1815
|
-
* 2. **select** — choose a model from the catalog: `opts.model` when given
|
|
1816
|
-
* (validated against the catalog), else the latest by `release_date` via
|
|
1817
|
-
* {@link resolveProviderDefaultModel}.
|
|
1818
|
-
* 3. **bind** — write the `llm.default` (or `llm.roles[role]`) config
|
|
1819
|
-
* binding tying the account + model together via {@link setConfigValue}.
|
|
1820
|
-
* 4. **validate** — round-trip the binding through {@link resolveLLMForSystem}
|
|
1821
|
-
* and confirm the resolved provider/model are consistent. NOT a live LLM
|
|
1822
|
-
* call: no token is materialized; only resolution metadata is asserted,
|
|
1823
|
-
* and the secret stays behind the sealed handle.
|
|
1824
|
-
*
|
|
1825
|
-
* ## Security (AC2)
|
|
1826
|
-
*
|
|
1827
|
-
* The {@link OnboardingResult} envelope carries NO secret fields — never an
|
|
1828
|
-
* access token, API key, or refresh token. The plaintext is materialized only
|
|
1829
|
-
* at the wire via the sealed handle, never on this envelope.
|
|
1830
|
-
*
|
|
1831
|
-
* ## Testability (AC3)
|
|
1832
|
-
*
|
|
1833
|
-
* Every step depends only on the injectable {@link OnboardingDeps} seam, which
|
|
1834
|
-
* defaults to the real core accessors. Tests pass a {@link StubOnboardingDeps}
|
|
1835
|
-
* (stub catalog + in-memory pool/config + stub resolver) to exercise each step
|
|
1836
|
-
* in isolation without a live browser, network, or disk.
|
|
1837
|
-
*
|
|
1838
|
-
* @module llm/onboarding/login-engine
|
|
1839
|
-
* @task T11724
|
|
1840
|
-
* @epic T11671 (E6-ONBOARDING-FRONT-DOOR)
|
|
1841
|
-
*/
|
|
1842
|
-
var logger$1 = getLogger("llm-onboarding");
|
|
1843
|
-
/**
|
|
1844
|
-
* The default dependency set — the real, merged core accessors.
|
|
1845
|
-
*
|
|
1846
|
-
* @task T11724
|
|
1847
|
-
*/
|
|
1848
|
-
function defaultDeps() {
|
|
1849
|
-
return {
|
|
1850
|
-
getProviderProfile,
|
|
1851
|
-
addCredential: (input) => addCredential(input),
|
|
1852
|
-
catalogKeyForProvider,
|
|
1853
|
-
resolveProviderDefaultModel: (catalogKey) => resolveProviderDefaultModel(catalogKey),
|
|
1854
|
-
validateModelForProvider: (model, catalogKey) => validateModelForProvider(model, catalogKey),
|
|
1855
|
-
setConfigValue: (key, value) => setConfigValue(key, value, void 0, { global: true }),
|
|
1856
|
-
resolve: async (_provider, projectRoot, role) => {
|
|
1857
|
-
const resolved = await resolveLLMForSystem({
|
|
1858
|
-
kind: "role",
|
|
1859
|
-
id: role ?? "consolidation"
|
|
1860
|
-
}, projectRoot !== void 0 ? { projectRoot } : void 0);
|
|
1861
|
-
return {
|
|
1862
|
-
provider: resolved.provider,
|
|
1863
|
-
model: resolved.model,
|
|
1864
|
-
sealedCredential: resolved.sealedCredential ? { tokenPreview: resolved.sealedCredential.tokenPreview } : null
|
|
1865
|
-
};
|
|
1866
|
-
}
|
|
1867
|
-
};
|
|
1868
|
-
}
|
|
1869
|
-
/** Build an `ok` step trace. @internal */
|
|
1870
|
-
function ok(step, detail) {
|
|
1871
|
-
return {
|
|
1872
|
-
step,
|
|
1873
|
-
status: "ok",
|
|
1874
|
-
detail
|
|
1875
|
-
};
|
|
1876
|
-
}
|
|
1877
|
-
/** Build a `failed` step trace carrying a stable `E_*` code. @internal */
|
|
1878
|
-
function fail(step, code, detail) {
|
|
1879
|
-
return {
|
|
1880
|
-
step,
|
|
1881
|
-
status: "failed",
|
|
1882
|
-
detail,
|
|
1883
|
-
code
|
|
1884
|
-
};
|
|
1885
|
-
}
|
|
1886
|
-
/** Build a `skipped` step trace (downstream of a failure). @internal */
|
|
1887
|
-
function skipped(step, detail) {
|
|
1888
|
-
return {
|
|
1889
|
-
step,
|
|
1890
|
-
status: "skipped",
|
|
1891
|
-
detail
|
|
1892
|
-
};
|
|
1893
|
-
}
|
|
1894
|
-
/**
|
|
1895
|
-
* Compose the partial envelope returned when a step fails: the failed step's
|
|
1896
|
-
* trace plus a `skipped` trace for every remaining step, so the 4-row shape is
|
|
1897
|
-
* always stable.
|
|
1898
|
-
*
|
|
1899
|
-
* @internal
|
|
1900
|
-
*/
|
|
1901
|
-
function withSkips(done, failedAt) {
|
|
1902
|
-
const order = [
|
|
1903
|
-
"connect",
|
|
1904
|
-
"select",
|
|
1905
|
-
"bind",
|
|
1906
|
-
"validate"
|
|
1907
|
-
];
|
|
1908
|
-
const steps = [...done, failedAt];
|
|
1909
|
-
const seen = new Set(steps.map((s) => s.step));
|
|
1910
|
-
for (const name of order) if (!seen.has(name)) steps.push(skipped(name, "skipped — earlier step failed"));
|
|
1911
|
-
return order.map((name) => steps.find((s) => s.step === name));
|
|
1912
|
-
}
|
|
1913
|
-
/**
|
|
1914
|
-
* Run the 3-step onboarding login flow for a provider (T11724 · M3).
|
|
1915
|
-
*
|
|
1916
|
-
* Walks **connect → select → bind → validate**, reusing the merged credential /
|
|
1917
|
-
* catalog / config / resolver accessors. Returns a typed {@link OnboardingResult}
|
|
1918
|
-
* envelope with the per-step trace and the non-secret binding identifiers.
|
|
1919
|
-
*
|
|
1920
|
-
* Like the resolver chokepoint, this engine **never throws** for an expected
|
|
1921
|
-
* failure (missing credential, unknown model, config write error): it returns
|
|
1922
|
-
* an envelope whose failing step carries `status: 'failed'` and a stable `E_*`
|
|
1923
|
-
* `code`, with `validated: false`. Unexpected accessor errors are caught and
|
|
1924
|
-
* mapped to a failed step trace as well.
|
|
1925
|
-
*
|
|
1926
|
-
* @param provider - Provider name or alias (e.g. `'anthropic'`, `'codex'`).
|
|
1927
|
-
* @param opts - {@link OnboardingLoginOptions} (token, model, role, …).
|
|
1928
|
-
* @param deps - Injectable accessor seam (AC3); defaults to real core accessors.
|
|
1929
|
-
* @returns The typed onboarding result envelope; never throws on expected failure.
|
|
1930
|
-
*
|
|
1931
|
-
* @task T11724
|
|
1932
|
-
*/
|
|
1933
|
-
async function runOnboardingLogin(provider, opts = {}, deps = defaultDeps()) {
|
|
1934
|
-
const label = opts.label?.trim() ? opts.label.trim() : "oauth-login";
|
|
1935
|
-
const done = [];
|
|
1936
|
-
let canonicalProvider;
|
|
1937
|
-
let authMode;
|
|
1938
|
-
try {
|
|
1939
|
-
const profile = await deps.getProviderProfile(provider);
|
|
1940
|
-
if (!profile) return envelope(withSkips(done, fail("connect", "E_UNKNOWN_PROVIDER", `Unknown provider '${provider}'. Run \`cleo llm list-providers\` to see supported providers.`)), provider, label, null, null, null, false);
|
|
1941
|
-
canonicalProvider = profile.name;
|
|
1942
|
-
authMode = opts.authMode ?? (profile.oauth ? "oauth" : "api_key");
|
|
1943
|
-
if (opts.credentialAlreadyStored) done.push(ok("connect", `account '${label}' connected (${authMode}, pre-stored)`));
|
|
1944
|
-
else {
|
|
1945
|
-
if (!opts.token) return envelope(withSkips(done, fail("connect", "E_ONBOARDING_NO_CREDENTIAL", `No credential supplied for '${canonicalProvider}'. Complete \`cleo llm login ${canonicalProvider}\` (OAuth) or pass an API key.`)), canonicalProvider, label, null, null, null, false);
|
|
1946
|
-
const storedAuthType = authMode === "oauth" ? "oauth" : "api_key";
|
|
1947
|
-
await deps.addCredential({
|
|
1948
|
-
provider: canonicalProvider,
|
|
1949
|
-
label,
|
|
1950
|
-
authType: storedAuthType,
|
|
1951
|
-
accessToken: opts.token,
|
|
1952
|
-
source: "onboarding-login"
|
|
1953
|
-
});
|
|
1954
|
-
done.push(ok("connect", `account '${label}' connected (${authMode})`));
|
|
1955
|
-
}
|
|
1956
|
-
} catch (err) {
|
|
1957
|
-
return envelope(withSkips(done, fail("connect", "E_ONBOARDING_CONNECT_FAILED", errMsg(err))), provider, label, null, null, null, false);
|
|
1958
|
-
}
|
|
1959
|
-
let modelId;
|
|
1960
|
-
try {
|
|
1961
|
-
const catalogKey = deps.catalogKeyForProvider(canonicalProvider);
|
|
1962
|
-
if (opts.model) {
|
|
1963
|
-
const validation = deps.validateModelForProvider(opts.model, catalogKey);
|
|
1964
|
-
if (!validation.valid && validation.reason === "not-found") return envelope(withSkips(done, fail("select", "E_MODEL_NOT_IN_CATALOG", `Model '${opts.model}' is not in the catalog for provider '${canonicalProvider}'. Run \`cleo llm refresh-catalog\` to update the catalog.`)), canonicalProvider, label, authMode, null, null, false);
|
|
1965
|
-
modelId = opts.model;
|
|
1966
|
-
done.push(ok("select", `model '${modelId}' selected (explicit, validated)`));
|
|
1967
|
-
} else {
|
|
1968
|
-
const latest = deps.resolveProviderDefaultModel(catalogKey);
|
|
1969
|
-
if (!latest) return envelope(withSkips(done, fail("select", "E_NO_CATALOG_MODEL", `No catalog model available for '${canonicalProvider}'. Run \`cleo llm refresh-catalog\`, or pass an explicit \`--model\`.`)), canonicalProvider, label, authMode, null, null, false);
|
|
1970
|
-
modelId = latest;
|
|
1971
|
-
done.push(ok("select", `model '${modelId}' selected (catalog default, latest release_date)`));
|
|
1972
|
-
}
|
|
1973
|
-
} catch (err) {
|
|
1974
|
-
return envelope(withSkips(done, fail("select", "E_ONBOARDING_SELECT_FAILED", errMsg(err))), canonicalProvider, label, authMode, null, null, false);
|
|
1975
|
-
}
|
|
1976
|
-
let profileName;
|
|
1977
|
-
try {
|
|
1978
|
-
if (opts.role) {
|
|
1979
|
-
if (!WHOAMI_ROLE_IDS.includes(opts.role)) return envelope(withSkips(done, fail("bind", "E_INVALID_ROLE", `Invalid role '${opts.role}'. Valid roles: ${WHOAMI_ROLE_IDS.join(", ")}.`)), canonicalProvider, label, authMode, modelId, null, false);
|
|
1980
|
-
await deps.setConfigValue(`llm.roles.${opts.role}.provider`, canonicalProvider);
|
|
1981
|
-
await deps.setConfigValue(`llm.roles.${opts.role}.model`, modelId);
|
|
1982
|
-
await deps.setConfigValue(`llm.roles.${opts.role}.credentialLabel`, label);
|
|
1983
|
-
profileName = opts.role;
|
|
1984
|
-
done.push(ok("bind", `profile '${profileName}' bound → ${canonicalProvider}/${modelId}`));
|
|
1985
|
-
} else {
|
|
1986
|
-
await deps.setConfigValue("llm.default.provider", canonicalProvider);
|
|
1987
|
-
await deps.setConfigValue("llm.default.model", modelId);
|
|
1988
|
-
profileName = "default";
|
|
1989
|
-
done.push(ok("bind", `default binding → ${canonicalProvider}/${modelId}`));
|
|
1990
|
-
}
|
|
1991
|
-
} catch (err) {
|
|
1992
|
-
return envelope(withSkips(done, fail("bind", "E_ONBOARDING_BIND_FAILED", errMsg(err))), canonicalProvider, label, authMode, modelId, null, false);
|
|
1993
|
-
}
|
|
1994
|
-
try {
|
|
1995
|
-
const resolved = await deps.resolve(canonicalProvider, opts.projectRoot, opts.role);
|
|
1996
|
-
const providerMatch = resolved.provider === canonicalProvider;
|
|
1997
|
-
const modelMatch = resolved.model === modelId;
|
|
1998
|
-
const hasHandle = resolved.sealedCredential !== null;
|
|
1999
|
-
if (providerMatch && modelMatch && hasHandle) {
|
|
2000
|
-
done.push(ok("validate", `round-trip ok — resolves to ${resolved.provider}/${resolved.model} (sealed handle ${resolved.sealedCredential?.tokenPreview ?? "…"})`));
|
|
2001
|
-
return envelope(done, canonicalProvider, label, authMode, modelId, profileName, true);
|
|
2002
|
-
}
|
|
2003
|
-
const step = fail("validate", "E_ONBOARDING_VALIDATION_FAILED", `binding inconsistent — ${!hasHandle ? "no credential handle resolved" : `resolved ${resolved.provider}/${resolved.model}, expected ${canonicalProvider}/${modelId}`}`);
|
|
2004
|
-
return envelope([...done, step], canonicalProvider, label, authMode, modelId, profileName, false);
|
|
2005
|
-
} catch (err) {
|
|
2006
|
-
const step = fail("validate", "E_ONBOARDING_VALIDATION_FAILED", errMsg(err));
|
|
2007
|
-
return envelope([...done, step], canonicalProvider, label, authMode, modelId, profileName, false);
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
/**
|
|
2011
|
-
* Assemble the {@link OnboardingResult} envelope. Centralised so every return
|
|
2012
|
-
* path produces an identically-shaped, secret-free result.
|
|
2013
|
-
*
|
|
2014
|
-
* @internal
|
|
2015
|
-
*/
|
|
2016
|
-
function envelope(steps, provider, accountLabel, authMode, modelId, profileName, validated) {
|
|
2017
|
-
return {
|
|
2018
|
-
steps,
|
|
2019
|
-
provider,
|
|
2020
|
-
accountLabel,
|
|
2021
|
-
authMode,
|
|
2022
|
-
modelId,
|
|
2023
|
-
profileName,
|
|
2024
|
-
validated
|
|
2025
|
-
};
|
|
2026
|
-
}
|
|
2027
|
-
/**
|
|
2028
|
-
* Extract a short, secret-free message from an unknown thrown value. The
|
|
2029
|
-
* onboarding accessors already redact their own error strings; this is a final
|
|
2030
|
-
* defensive narrow so the envelope never carries a raw stack.
|
|
2031
|
-
*
|
|
2032
|
-
* @internal
|
|
2033
|
-
*/
|
|
2034
|
-
function errMsg(err) {
|
|
2035
|
-
const raw = err instanceof Error ? err.message : String(err);
|
|
2036
|
-
logger$1.debug({ err: raw }, "onboarding: step accessor error");
|
|
2037
|
-
return raw;
|
|
2038
|
-
}
|
|
2039
|
-
//#endregion
|
|
2040
|
-
//#region ../core/dist/llm/onboarding/front-door.js
|
|
2041
|
-
/**
|
|
2042
|
-
* `runFrontDoorLogin` — the shared onboarding front-door orchestrator (T11725 · M3).
|
|
2043
|
-
*
|
|
2044
|
-
* This is the ONE function every front-door entry point (`cleo login`,
|
|
2045
|
-
* `cleo auth login`, `cleo llm login`) dispatches to. It owns the small amount
|
|
2046
|
-
* of orchestration that sits ABOVE the 3-step onboarding engine
|
|
2047
|
-
* ({@link runOnboardingLogin}):
|
|
2048
|
-
*
|
|
2049
|
-
* 1. **resolve provider** — alias → canonical via {@link getProviderProfile}.
|
|
2050
|
-
* 2. **resolve auth method** — caller-supplied, else inferred from the
|
|
2051
|
-
* provider profile (OAuth when the profile advertises an `oauth` config,
|
|
2052
|
-
* else `api_key`).
|
|
2053
|
-
* 3. **acquire the credential secret**:
|
|
2054
|
-
* - `api_key` → the caller passes the raw key in {@link FrontDoorLoginOptions.token}.
|
|
2055
|
-
* - `oauth` → the caller's injected {@link OAuthTokenAcquirer} runs the
|
|
2056
|
-
* interactive browser / device-code dance and RETURNS the token. The
|
|
2057
|
-
* interactive step lives in the CLI (so this module stays
|
|
2058
|
-
* non-interactive and unit-testable); the acquirer is a seam, not a hard
|
|
2059
|
-
* dependency.
|
|
2060
|
-
* 4. **run the engine** — hand the acquired token to {@link runOnboardingLogin},
|
|
2061
|
-
* which performs connect → select → bind → validate and returns the typed,
|
|
2062
|
-
* secret-free {@link OnboardingResult} envelope.
|
|
2063
|
-
*
|
|
2064
|
-
* ## Why a core orchestrator (and not CLI glue)
|
|
2065
|
-
*
|
|
2066
|
-
* Keeping this in `@cleocode/core` means the CLI handlers for all three entry
|
|
2067
|
-
* points are THIN — they parse flags, build a {@link ReadlineWizardIO}, supply
|
|
2068
|
-
* the OAuth acquirer, and call THIS function. No entry point re-implements the
|
|
2069
|
-
* picker, the auth-method inference, or the engine call (AC2: no duplicated
|
|
2070
|
-
* handler logic). Studio / the future API surface reuse the same orchestrator.
|
|
2071
|
-
*
|
|
2072
|
-
* ## Security
|
|
2073
|
-
*
|
|
2074
|
-
* The returned {@link OnboardingResult} carries NO secret fields (inherited from
|
|
2075
|
-
* the engine contract). The raw token flows only from the acquirer into the
|
|
2076
|
-
* engine's connect step; it is never logged or surfaced on the envelope.
|
|
2077
|
-
*
|
|
2078
|
-
* @module llm/onboarding/front-door
|
|
2079
|
-
* @task T11725
|
|
2080
|
-
* @epic T11671 (E6-ONBOARDING-FRONT-DOOR)
|
|
2081
|
-
*/
|
|
2082
|
-
/**
|
|
2083
|
-
* The default front-door dependency set — the real, merged core accessors.
|
|
2084
|
-
*
|
|
2085
|
-
* @internal
|
|
2086
|
-
*/
|
|
2087
|
-
function defaultFrontDoorDeps() {
|
|
2088
|
-
return {
|
|
2089
|
-
getProviderProfile,
|
|
2090
|
-
runOnboardingLogin: (provider, opts, deps) => runOnboardingLogin(provider, opts, deps)
|
|
2091
|
-
};
|
|
2092
|
-
}
|
|
2093
|
-
/**
|
|
2094
|
-
* Resolve the auth method for a provider profile: caller override wins, else
|
|
2095
|
-
* `oauth` when the profile advertises an OAuth config, else `api_key`.
|
|
2096
|
-
*
|
|
2097
|
-
* @param profile - The resolved provider profile.
|
|
2098
|
-
* @param override - Optional explicit auth mode from the caller.
|
|
2099
|
-
* @returns The effective {@link OnboardingAuthMode}.
|
|
2100
|
-
* @task T11725
|
|
2101
|
-
*/
|
|
2102
|
-
function resolveAuthMode(profile, override) {
|
|
2103
|
-
if (override) return override;
|
|
2104
|
-
return profile.oauth ? "oauth" : "api_key";
|
|
2105
|
-
}
|
|
2106
|
-
/**
|
|
2107
|
-
* Run the shared onboarding front-door flow for a provider (T11725 · M3).
|
|
2108
|
-
*
|
|
2109
|
-
* Resolves the provider + auth method, acquires the credential secret (raw API
|
|
2110
|
-
* key from `opts.token`, or via the injected {@link OAuthTokenAcquirer} for the
|
|
2111
|
-
* OAuth path), then delegates the heavy lifting to {@link runOnboardingLogin}.
|
|
2112
|
-
*
|
|
2113
|
-
* Mirrors the engine's never-throw-on-expected-failure contract: an unknown
|
|
2114
|
-
* provider or a missing api-key secret returns a failed {@link OnboardingResult}
|
|
2115
|
-
* envelope rather than throwing. The OAuth acquirer's own errors DO propagate —
|
|
2116
|
-
* an aborted browser flow is a hard, caller-visible failure.
|
|
2117
|
-
*
|
|
2118
|
-
* @param provider - Provider name or alias (e.g. `'anthropic'`, `'codex'`).
|
|
2119
|
-
* @param opts - {@link FrontDoorLoginOptions}.
|
|
2120
|
-
* @param acquireOAuth - Interactive OAuth token acquirer (the CLI's browser flow).
|
|
2121
|
-
* Only invoked on the `oauth` path; may be omitted when the flow is `api_key`.
|
|
2122
|
-
* @param deps - Injectable accessor seam; defaults to real core accessors.
|
|
2123
|
-
* @returns The typed onboarding result envelope.
|
|
2124
|
-
* @task T11725
|
|
2125
|
-
*/
|
|
2126
|
-
async function runFrontDoorLogin(provider, opts = {}, acquireOAuth, deps = defaultFrontDoorDeps()) {
|
|
2127
|
-
const profile = await deps.getProviderProfile(provider);
|
|
2128
|
-
if (!profile) return deps.runOnboardingLogin(provider, buildEngineOptions(opts, opts.token, false));
|
|
2129
|
-
const canonicalProvider = profile.name;
|
|
2130
|
-
const authMode = resolveAuthMode(profile, opts.authMode);
|
|
2131
|
-
let token = opts.token;
|
|
2132
|
-
let credentialAlreadyStored = false;
|
|
2133
|
-
let label = opts.label;
|
|
2134
|
-
if (authMode === "oauth") {
|
|
2135
|
-
if (!acquireOAuth) throw new Error(`OAuth login for '${canonicalProvider}' requires an interactive token acquirer. This entry point cannot complete an OAuth flow non-interactively — supply an API key with --api-key/--token, or run on a terminal.`);
|
|
2136
|
-
const acquired = await acquireOAuth(canonicalProvider);
|
|
2137
|
-
credentialAlreadyStored = true;
|
|
2138
|
-
label = label ?? acquired.label;
|
|
2139
|
-
token = void 0;
|
|
2140
|
-
}
|
|
2141
|
-
return deps.runOnboardingLogin(canonicalProvider, buildEngineOptions({
|
|
2142
|
-
...opts,
|
|
2143
|
-
authMode,
|
|
2144
|
-
label
|
|
2145
|
-
}, token, credentialAlreadyStored));
|
|
2146
|
-
}
|
|
2147
|
-
/**
|
|
2148
|
-
* Map the front-door options + resolved token to the engine's option shape.
|
|
2149
|
-
*
|
|
2150
|
-
* Centralised so the unknown-provider deferral path and the happy path build
|
|
2151
|
-
* identical engine options.
|
|
2152
|
-
*
|
|
2153
|
-
* @internal
|
|
2154
|
-
*/
|
|
2155
|
-
function buildEngineOptions(opts, token, credentialAlreadyStored) {
|
|
2156
|
-
const engineOpts = {};
|
|
2157
|
-
if (token !== void 0) engineOpts.token = token;
|
|
2158
|
-
if (opts.authMode !== void 0) engineOpts.authMode = opts.authMode;
|
|
2159
|
-
if (opts.label !== void 0) engineOpts.label = opts.label;
|
|
2160
|
-
if (opts.model !== void 0) engineOpts.model = opts.model;
|
|
2161
|
-
if (opts.role !== void 0) engineOpts.role = opts.role;
|
|
2162
|
-
if (opts.projectRoot !== void 0) engineOpts.projectRoot = opts.projectRoot;
|
|
2163
|
-
if (credentialAlreadyStored) engineOpts.credentialAlreadyStored = true;
|
|
2164
|
-
return engineOpts;
|
|
2165
|
-
}
|
|
2166
|
-
require_node_cron();
|
|
2167
|
-
//#endregion
|
|
2168
|
-
//#region ../core/dist/sentient/daemon.js
|
|
2169
|
-
/** Relative subpath under a project root where sentient state lives. */
|
|
2170
|
-
var SENTIENT_STATE_FILE = ".cleo/sentient-state.json";
|
|
2171
|
-
process.env["CLEO_HYGIENE_CRON"];
|
|
2172
|
-
|
|
2173
|
-
//#region ../core/dist/llm/local-model-fit.js
|
|
2174
|
-
/**
|
|
2175
|
-
* Local-model fit ranking for Ollama-backed open-weight models (T11982).
|
|
2176
|
-
*
|
|
2177
|
-
* ## Purpose
|
|
2178
|
-
*
|
|
2179
|
-
* Given the current machine's hardware (RAM, VRAM), rank 2–3 curated
|
|
2180
|
-
* open-weight models that are actually likely to run well. This is the
|
|
2181
|
-
* `cleo llm fit` wizard building block — it powers T11983's one-keypress
|
|
2182
|
-
* pull+connect flow.
|
|
2183
|
-
*
|
|
2184
|
-
* ## Vendor-vs-inspire decision (llmfit)
|
|
2185
|
-
*
|
|
2186
|
-
* Evaluated `github.com/AlexsJones/llmfit` (MIT, Go, ~400 LOC). The library
|
|
2187
|
-
* is a standalone Go binary — not a TS/ESM package. Its key contribution is
|
|
2188
|
-
* the IDEA: use RAM thresholds to gate model selection, prefer VRAM when
|
|
2189
|
-
* available, and produce a ranked list with human-readable reasons. We
|
|
2190
|
-
* **vendor the IDEA** (TS-native re-implementation) rather than shelling out
|
|
2191
|
-
* to a Go binary or adding a cross-language dependency. The model thresholds
|
|
2192
|
-
* below are independently calibrated from Ollama's documentation and the
|
|
2193
|
-
* Hugging Face model cards, not copy-pasted from llmfit.
|
|
2194
|
-
*
|
|
2195
|
-
* ## Gate-13 compliance
|
|
2196
|
-
*
|
|
2197
|
-
* This module:
|
|
2198
|
-
* - MUST NOT construct any transport or SDK client.
|
|
2199
|
-
* - MUST NOT read `process.env.*_API_KEY` directly.
|
|
2200
|
-
* - MUST NOT define a new `resolveLLMFor*` function.
|
|
2201
|
-
* - MUST NOT hardcode model-id literals in logic — all model IDs come from
|
|
2202
|
-
* the {@link LOCAL_MODEL_CANDIDATES} data table.
|
|
2203
|
-
*
|
|
2204
|
-
* The hardware detection (`os.totalmem`, `os.freemem`, `/proc/meminfo`,
|
|
2205
|
-
* `nvidia-smi`) is plain system inspection — not covered by Gate-13 (which
|
|
2206
|
-
* governs LLM resolution / transport construction).
|
|
2207
|
-
*
|
|
2208
|
-
* Ollama liveness re-uses {@link probeOllamaAlive} from
|
|
2209
|
-
* `cross-provider-selector.ts` (no duplication). The `/api/tags` fetch is
|
|
2210
|
-
* a vanilla HTTP call to localhost, not a transport construction.
|
|
2211
|
-
*
|
|
2212
|
-
* @module llm/local-model-fit
|
|
2213
|
-
* @task T11982
|
|
2214
|
-
* @epic T11671
|
|
2215
|
-
*/
|
|
2216
|
-
var execFileAsync = promisify(execFile);
|
|
2217
|
-
var logger = getLogger("llm-local-model-fit");
|
|
2218
|
-
/**
|
|
2219
|
-
* Curated candidate table. These are the ONLY models `rankLocalModelFit`
|
|
2220
|
-
* can recommend — expand this table to add new models.
|
|
2221
|
-
*
|
|
2222
|
-
* Exclusions:
|
|
2223
|
-
* - `qwen2:0.5b` — proof-of-life only; deliberately absent from this list.
|
|
2224
|
-
*
|
|
2225
|
-
* @task T11982
|
|
2226
|
-
*/
|
|
2227
|
-
var LOCAL_MODEL_CANDIDATES = [
|
|
2228
|
-
{
|
|
2229
|
-
modelTag: "gemma4:e2b",
|
|
2230
|
-
displayName: "Gemma 4 E2B (edge)",
|
|
2231
|
-
family: "gemma4",
|
|
2232
|
-
minRamGb: 4,
|
|
2233
|
-
recommendedRamGb: 6,
|
|
2234
|
-
minVramGb: 3,
|
|
2235
|
-
recommendedVramGb: 5,
|
|
2236
|
-
diskSizeGb: 7.2,
|
|
2237
|
-
quantNote: "Q4_K_M (default pull)",
|
|
2238
|
-
codeSpecialist: false,
|
|
2239
|
-
contextLengthK: 128
|
|
2240
|
-
},
|
|
2241
|
-
{
|
|
2242
|
-
modelTag: "gemma4:e4b",
|
|
2243
|
-
displayName: "Gemma 4 E4B (edge)",
|
|
2244
|
-
family: "gemma4",
|
|
2245
|
-
minRamGb: 6,
|
|
2246
|
-
recommendedRamGb: 8,
|
|
2247
|
-
minVramGb: 6,
|
|
2248
|
-
recommendedVramGb: 8,
|
|
2249
|
-
diskSizeGb: 9.6,
|
|
2250
|
-
quantNote: "Q4_K_M (default pull)",
|
|
2251
|
-
codeSpecialist: false,
|
|
2252
|
-
contextLengthK: 128
|
|
2253
|
-
},
|
|
2254
|
-
{
|
|
2255
|
-
modelTag: "gemma4:12b",
|
|
2256
|
-
displayName: "Gemma 4 12B",
|
|
2257
|
-
family: "gemma4",
|
|
2258
|
-
minRamGb: 10,
|
|
2259
|
-
recommendedRamGb: 16,
|
|
2260
|
-
minVramGb: 8,
|
|
2261
|
-
recommendedVramGb: 12,
|
|
2262
|
-
diskSizeGb: 7.6,
|
|
2263
|
-
quantNote: "QAT (default pull)",
|
|
2264
|
-
codeSpecialist: false,
|
|
2265
|
-
contextLengthK: 256
|
|
2266
|
-
},
|
|
2267
|
-
{
|
|
2268
|
-
modelTag: "qwen3:1.7b",
|
|
2269
|
-
displayName: "Qwen 3 1.7B",
|
|
2270
|
-
family: "qwen3",
|
|
2271
|
-
minRamGb: 3,
|
|
2272
|
-
recommendedRamGb: 4,
|
|
2273
|
-
minVramGb: 2,
|
|
2274
|
-
recommendedVramGb: 3,
|
|
2275
|
-
diskSizeGb: 1.4,
|
|
2276
|
-
quantNote: "Q4_K_M (default pull)",
|
|
2277
|
-
codeSpecialist: false,
|
|
2278
|
-
contextLengthK: 32
|
|
2279
|
-
},
|
|
2280
|
-
{
|
|
2281
|
-
modelTag: "qwen3:4b",
|
|
2282
|
-
displayName: "Qwen 3 4B",
|
|
2283
|
-
family: "qwen3",
|
|
2284
|
-
minRamGb: 6,
|
|
2285
|
-
recommendedRamGb: 8,
|
|
2286
|
-
minVramGb: 4,
|
|
2287
|
-
recommendedVramGb: 6,
|
|
2288
|
-
diskSizeGb: 2.6,
|
|
2289
|
-
quantNote: "Q4_K_M (default pull)",
|
|
2290
|
-
codeSpecialist: false,
|
|
2291
|
-
contextLengthK: 32
|
|
2292
|
-
},
|
|
2293
|
-
{
|
|
2294
|
-
modelTag: "qwen3:8b",
|
|
2295
|
-
displayName: "Qwen 3 8B",
|
|
2296
|
-
family: "qwen3",
|
|
2297
|
-
minRamGb: 8,
|
|
2298
|
-
recommendedRamGb: 12,
|
|
2299
|
-
minVramGb: 7,
|
|
2300
|
-
recommendedVramGb: 10,
|
|
2301
|
-
diskSizeGb: 5.2,
|
|
2302
|
-
quantNote: "Q4_K_M (default pull)",
|
|
2303
|
-
codeSpecialist: false,
|
|
2304
|
-
contextLengthK: 32
|
|
2305
|
-
},
|
|
2306
|
-
{
|
|
2307
|
-
modelTag: "llama3.2:3b",
|
|
2308
|
-
displayName: "Llama 3.2 3B",
|
|
2309
|
-
family: "llama3.2",
|
|
2310
|
-
minRamGb: 4,
|
|
2311
|
-
recommendedRamGb: 6,
|
|
2312
|
-
minVramGb: 3,
|
|
2313
|
-
recommendedVramGb: 4,
|
|
2314
|
-
diskSizeGb: 2,
|
|
2315
|
-
quantNote: "Q4_K_M (default pull)",
|
|
2316
|
-
codeSpecialist: false,
|
|
2317
|
-
contextLengthK: 128
|
|
2318
|
-
},
|
|
2319
|
-
{
|
|
2320
|
-
modelTag: "qwen2.5-coder:3b",
|
|
2321
|
-
displayName: "Qwen 2.5 Coder 3B",
|
|
2322
|
-
family: "qwen2.5-coder",
|
|
2323
|
-
minRamGb: 4,
|
|
2324
|
-
recommendedRamGb: 6,
|
|
2325
|
-
minVramGb: 3,
|
|
2326
|
-
recommendedVramGb: 4,
|
|
2327
|
-
diskSizeGb: 1.9,
|
|
2328
|
-
quantNote: "Q4_K_M (default pull)",
|
|
2329
|
-
codeSpecialist: true,
|
|
2330
|
-
contextLengthK: 128
|
|
2331
|
-
},
|
|
2332
|
-
{
|
|
2333
|
-
modelTag: "phi4-mini:3.8b",
|
|
2334
|
-
displayName: "Phi 4 Mini 3.8B",
|
|
2335
|
-
family: "phi4",
|
|
2336
|
-
minRamGb: 4,
|
|
2337
|
-
recommendedRamGb: 6,
|
|
2338
|
-
minVramGb: 3,
|
|
2339
|
-
recommendedVramGb: 4,
|
|
2340
|
-
diskSizeGb: 2.5,
|
|
2341
|
-
quantNote: "Q4_K_M (default pull)",
|
|
2342
|
-
codeSpecialist: false,
|
|
2343
|
-
contextLengthK: 128
|
|
2344
|
-
}
|
|
2345
|
-
];
|
|
2346
|
-
/**
|
|
2347
|
-
* Read `MemAvailable` from `/proc/meminfo` on Linux.
|
|
2348
|
-
*
|
|
2349
|
-
* Returns `null` on non-Linux or if the file is unreadable.
|
|
2350
|
-
*
|
|
2351
|
-
* @internal
|
|
2352
|
-
*/
|
|
2353
|
-
async function readLinuxMemAvailableBytes() {
|
|
2354
|
-
try {
|
|
2355
|
-
const content = await readFile("/proc/meminfo", "utf-8");
|
|
2356
|
-
for (const line of content.split("\n")) if (line.startsWith("MemAvailable:")) {
|
|
2357
|
-
const match = /MemAvailable:\s+(\d+)\s+kB/.exec(line);
|
|
2358
|
-
if (match?.[1]) return parseInt(match[1], 10) * 1024;
|
|
2359
|
-
}
|
|
2360
|
-
return null;
|
|
2361
|
-
} catch {
|
|
2362
|
-
return null;
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
/**
|
|
2366
|
-
* Detect NVIDIA VRAM via `nvidia-smi`.
|
|
2367
|
-
*
|
|
2368
|
-
* Returns `null` fields if the binary is absent or errors.
|
|
2369
|
-
*
|
|
2370
|
-
* @internal
|
|
2371
|
-
*/
|
|
2372
|
-
async function detectNvidiaVram() {
|
|
2373
|
-
try {
|
|
2374
|
-
const { stdout } = await execFileAsync("nvidia-smi", ["--query-gpu=memory.total,memory.free", "--format=csv,noheader,nounits"]);
|
|
2375
|
-
const parts = stdout.trim().split(",");
|
|
2376
|
-
if (parts.length >= 2) {
|
|
2377
|
-
const totalMib = parseInt(parts[0].trim(), 10);
|
|
2378
|
-
const freeMib = parseInt(parts[1].trim(), 10);
|
|
2379
|
-
if (!Number.isNaN(totalMib) && !Number.isNaN(freeMib)) return {
|
|
2380
|
-
totalBytes: totalMib * 1024 * 1024,
|
|
2381
|
-
freeBytes: freeMib * 1024 * 1024,
|
|
2382
|
-
method: "nvidia-smi"
|
|
2383
|
-
};
|
|
2384
|
-
}
|
|
2385
|
-
return null;
|
|
2386
|
-
} catch {
|
|
2387
|
-
return null;
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
/**
|
|
2391
|
-
* Detect AMD VRAM via `rocm-smi`.
|
|
2392
|
-
*
|
|
2393
|
-
* Returns `null` fields if the binary is absent or errors.
|
|
2394
|
-
*
|
|
2395
|
-
* @internal
|
|
2396
|
-
*/
|
|
2397
|
-
async function detectRocmVram() {
|
|
2398
|
-
try {
|
|
2399
|
-
const { stdout } = await execFileAsync("rocm-smi", [
|
|
2400
|
-
"--showmeminfo",
|
|
2401
|
-
"vram",
|
|
2402
|
-
"--csv"
|
|
2403
|
-
]);
|
|
2404
|
-
const totalMatch = /Total\s+VRAM.*?(\d+)/i.exec(stdout);
|
|
2405
|
-
const usedMatch = /Used\s+VRAM.*?(\d+)/i.exec(stdout);
|
|
2406
|
-
if (totalMatch?.[1]) {
|
|
2407
|
-
const totalBytes = parseInt(totalMatch[1], 10) * 1024 * 1024;
|
|
2408
|
-
const usedBytes = usedMatch?.[1] ? parseInt(usedMatch[1], 10) * 1024 * 1024 : null;
|
|
2409
|
-
return {
|
|
2410
|
-
totalBytes,
|
|
2411
|
-
freeBytes: usedBytes !== null ? totalBytes - usedBytes : null,
|
|
2412
|
-
method: "rocm-smi"
|
|
2413
|
-
};
|
|
2414
|
-
}
|
|
2415
|
-
return null;
|
|
2416
|
-
} catch {
|
|
2417
|
-
return null;
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
/**
|
|
2421
|
-
* Capture a full hardware snapshot.
|
|
2422
|
-
*
|
|
2423
|
-
* Never throws — VRAM detection failures degrade gracefully to `null`.
|
|
2424
|
-
*
|
|
2425
|
-
* @param overrides - Override fields for testing (avoids OS calls in unit tests).
|
|
2426
|
-
* @returns A hardware snapshot describing this machine's capabilities.
|
|
2427
|
-
*
|
|
2428
|
-
* @task T11982
|
|
2429
|
-
*/
|
|
2430
|
-
async function captureHardwareSnapshot(overrides) {
|
|
2431
|
-
const platform = overrides?.platform ?? process.platform;
|
|
2432
|
-
const totalRamBytes = overrides?.totalRamBytes ?? totalmem();
|
|
2433
|
-
let availableRamBytes;
|
|
2434
|
-
if (overrides?.availableRamBytes !== void 0) availableRamBytes = overrides.availableRamBytes;
|
|
2435
|
-
else if (platform === "linux") availableRamBytes = await readLinuxMemAvailableBytes() ?? freemem();
|
|
2436
|
-
else availableRamBytes = freemem();
|
|
2437
|
-
let vram;
|
|
2438
|
-
if (overrides?.vram !== void 0) vram = overrides.vram;
|
|
2439
|
-
else {
|
|
2440
|
-
const nvidia = await detectNvidiaVram();
|
|
2441
|
-
if (nvidia) vram = nvidia;
|
|
2442
|
-
else {
|
|
2443
|
-
const amd = await detectRocmVram();
|
|
2444
|
-
if (amd) vram = amd;
|
|
2445
|
-
else if (platform === "darwin") vram = {
|
|
2446
|
-
totalBytes: totalRamBytes,
|
|
2447
|
-
freeBytes: availableRamBytes,
|
|
2448
|
-
method: "apple-unified"
|
|
2449
|
-
};
|
|
2450
|
-
else vram = {
|
|
2451
|
-
totalBytes: null,
|
|
2452
|
-
freeBytes: null,
|
|
2453
|
-
method: "none"
|
|
2454
|
-
};
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
return {
|
|
2458
|
-
totalRamBytes,
|
|
2459
|
-
availableRamBytes,
|
|
2460
|
-
vram,
|
|
2461
|
-
platform
|
|
2462
|
-
};
|
|
2463
|
-
}
|
|
2464
|
-
/**
|
|
2465
|
-
* Parse raw `/api/tags` response from Ollama.
|
|
2466
|
-
*
|
|
2467
|
-
* @internal
|
|
2468
|
-
*/
|
|
2469
|
-
function parseOllamaTagsResponse(body) {
|
|
2470
|
-
if (typeof body !== "object" || body === null || !Array.isArray(body["models"])) return [];
|
|
2471
|
-
const models = body.models;
|
|
2472
|
-
const result = [];
|
|
2473
|
-
for (const m of models) {
|
|
2474
|
-
if (typeof m !== "object" || m === null) continue;
|
|
2475
|
-
const model = m;
|
|
2476
|
-
const name = typeof model["name"] === "string" ? model["name"] : "";
|
|
2477
|
-
const details = typeof model["details"] === "object" && model["details"] !== null ? model["details"] : {};
|
|
2478
|
-
const parameterSize = typeof details["parameter_size"] === "string" ? details["parameter_size"] : "";
|
|
2479
|
-
const quantizationLevel = typeof details["quantization_level"] === "string" ? details["quantization_level"] : "";
|
|
2480
|
-
const family = typeof details["family"] === "string" ? details["family"] : "";
|
|
2481
|
-
if (name) result.push({
|
|
2482
|
-
name,
|
|
2483
|
-
parameterSize,
|
|
2484
|
-
quantizationLevel,
|
|
2485
|
-
family
|
|
2486
|
-
});
|
|
2487
|
-
}
|
|
2488
|
-
return result;
|
|
2489
|
-
}
|
|
2490
|
-
/**
|
|
2491
|
-
* Fetch the list of locally-pulled models from Ollama's `/api/tags` endpoint.
|
|
2492
|
-
*
|
|
2493
|
-
* Uses the HTTP API (not shelling out) — Gate-13 does not govern plain `fetch`
|
|
2494
|
-
* calls to localhost.
|
|
2495
|
-
*
|
|
2496
|
-
* @param baseUrl - Ollama base URL (default `http://localhost:11434`).
|
|
2497
|
-
* @param fetchFn - Injectable `fetch` for testing (defaults to global `fetch`).
|
|
2498
|
-
* @returns Array of pulled models, or empty array if Ollama is not reachable.
|
|
2499
|
-
*
|
|
2500
|
-
* @task T11982
|
|
2501
|
-
*/
|
|
2502
|
-
async function listOllamaPulledModels(baseUrl = "http://localhost:11434", fetchFn = fetch) {
|
|
2503
|
-
try {
|
|
2504
|
-
const controller = new AbortController();
|
|
2505
|
-
const timeout = setTimeout(() => controller.abort(), 1e3);
|
|
2506
|
-
let response;
|
|
2507
|
-
try {
|
|
2508
|
-
response = await fetchFn(`${baseUrl}/api/tags`, { signal: controller.signal });
|
|
2509
|
-
} finally {
|
|
2510
|
-
clearTimeout(timeout);
|
|
2511
|
-
}
|
|
2512
|
-
if (!response.ok) return [];
|
|
2513
|
-
return parseOllamaTagsResponse(await response.json());
|
|
2514
|
-
} catch {
|
|
2515
|
-
return [];
|
|
2516
|
-
}
|
|
2517
|
-
}
|
|
2518
|
-
/** Score bonus when the model is already pulled locally. */
|
|
2519
|
-
var ALREADY_PULLED_BONUS = 50;
|
|
2520
|
-
/** Score bonus when VRAM is sufficient for full GPU offload. */
|
|
2521
|
-
var VRAM_FULL_OFFLOAD_BONUS = 40;
|
|
2522
|
-
/** Score bonus when VRAM meets the minimum (partial offload). */
|
|
2523
|
-
var VRAM_PARTIAL_BONUS = 15;
|
|
2524
|
-
/** Score bonus when available RAM exceeds the recommended threshold. */
|
|
2525
|
-
var RAM_COMFORTABLE_BONUS = 20;
|
|
2526
|
-
/** Score bonus when RAM is sufficient but below recommended. */
|
|
2527
|
-
var RAM_SUFFICIENT_BONUS = 5;
|
|
2528
|
-
/** Penalty when the model barely meets the minimum RAM. */
|
|
2529
|
-
var RAM_TIGHT_PENALTY = -10;
|
|
2530
|
-
/** Score bonus for models with longer context windows. */
|
|
2531
|
-
var LONG_CONTEXT_BONUS = 8;
|
|
2532
|
-
/**
|
|
2533
|
-
* Compute the fit score for a candidate given this machine's hardware.
|
|
2534
|
-
*
|
|
2535
|
-
* @internal
|
|
2536
|
-
*/
|
|
2537
|
-
function scoreCandidate(candidate, snapshot, alreadyPulled) {
|
|
2538
|
-
const ramGb = snapshot.totalRamBytes / 1024 ** 3;
|
|
2539
|
-
const availableRamGb = snapshot.availableRamBytes / 1024 ** 3;
|
|
2540
|
-
const vramTotalGb = snapshot.vram.totalBytes !== null ? snapshot.vram.totalBytes / 1024 ** 3 : null;
|
|
2541
|
-
const vramFreeGb = snapshot.vram.freeBytes !== null ? snapshot.vram.freeBytes / 1024 ** 3 : null;
|
|
2542
|
-
let score = 0;
|
|
2543
|
-
const reasons = [];
|
|
2544
|
-
let fitTier = "marginal";
|
|
2545
|
-
if (vramTotalGb !== null && vramFreeGb !== null && candidate.minVramGb > 0) if (vramFreeGb >= candidate.recommendedVramGb) {
|
|
2546
|
-
score += VRAM_FULL_OFFLOAD_BONUS;
|
|
2547
|
-
reasons.push(`fits in ${vramFreeGb.toFixed(1)} GB free VRAM (recommended: ${candidate.recommendedVramGb} GB)`);
|
|
2548
|
-
fitTier = "excellent";
|
|
2549
|
-
} else if (vramFreeGb >= candidate.minVramGb) {
|
|
2550
|
-
score += VRAM_PARTIAL_BONUS;
|
|
2551
|
-
reasons.push(`partial GPU offload possible (${vramFreeGb.toFixed(1)} GB free VRAM, min: ${candidate.minVramGb} GB)`);
|
|
2552
|
-
fitTier = "good";
|
|
2553
|
-
} else reasons.push(`CPU inference only — VRAM ${vramFreeGb.toFixed(1)} GB below model minimum ${candidate.minVramGb} GB`);
|
|
2554
|
-
else if (candidate.minVramGb === 0) reasons.push("optimised for CPU inference");
|
|
2555
|
-
else if (snapshot.vram.method === "none") reasons.push("no GPU detected — will use CPU inference");
|
|
2556
|
-
if (availableRamGb >= candidate.recommendedRamGb) {
|
|
2557
|
-
score += RAM_COMFORTABLE_BONUS;
|
|
2558
|
-
reasons.push(`${availableRamGb.toFixed(1)} GB available RAM (recommended: ${candidate.recommendedRamGb} GB)`);
|
|
2559
|
-
if (fitTier !== "excellent") fitTier = "good";
|
|
2560
|
-
} else if (ramGb >= candidate.recommendedRamGb) {
|
|
2561
|
-
score += RAM_SUFFICIENT_BONUS;
|
|
2562
|
-
reasons.push(`${ramGb.toFixed(1)} GB total RAM meets recommendation (some swap may be used)`);
|
|
2563
|
-
if (fitTier !== "excellent") fitTier = "good";
|
|
2564
|
-
} else if (ramGb >= candidate.minRamGb) {
|
|
2565
|
-
score += RAM_TIGHT_PENALTY;
|
|
2566
|
-
reasons.push(`${ramGb.toFixed(1)} GB RAM meets minimum — expect slower inference (recommended: ${candidate.recommendedRamGb} GB)`);
|
|
2567
|
-
}
|
|
2568
|
-
if (candidate.contextLengthK >= 128) {
|
|
2569
|
-
score += LONG_CONTEXT_BONUS;
|
|
2570
|
-
reasons.push(`${candidate.contextLengthK}k context window`);
|
|
2571
|
-
}
|
|
2572
|
-
if (alreadyPulled) {
|
|
2573
|
-
score += ALREADY_PULLED_BONUS;
|
|
2574
|
-
reasons.push("already pulled — no download needed");
|
|
2575
|
-
}
|
|
2576
|
-
return {
|
|
2577
|
-
score,
|
|
2578
|
-
reasons,
|
|
2579
|
-
fitTier
|
|
2580
|
-
};
|
|
2581
|
-
}
|
|
2582
|
-
/**
|
|
2583
|
-
* Rank the 2–3 best-fit local open-weight models for this machine.
|
|
2584
|
-
*
|
|
2585
|
-
* ## Floor
|
|
2586
|
-
*
|
|
2587
|
-
* Machines with total RAM below {@link LOCAL_FIT_FLOOR_GB} (4 GB) receive no
|
|
2588
|
-
* recommendations. This deliberately excludes `qwen2:0.5b` (proof-of-life
|
|
2589
|
-
* only) — it is absent from {@link LOCAL_MODEL_CANDIDATES}.
|
|
2590
|
-
*
|
|
2591
|
-
* ## Algorithm
|
|
2592
|
-
*
|
|
2593
|
-
* 1. Capture hardware snapshot.
|
|
2594
|
-
* 2. Probe Ollama liveness and fetch the pulled-models list.
|
|
2595
|
-
* 3. Filter candidates to those whose `minRamGb` ≤ total RAM.
|
|
2596
|
-
* 4. Score remaining candidates (VRAM fit + RAM comfort + already-pulled bonus).
|
|
2597
|
-
* 5. Return the top 3 (or fewer), ordered by score descending.
|
|
2598
|
-
*
|
|
2599
|
-
* @param opts - Override hardware snapshot for testing.
|
|
2600
|
-
* @returns Fit envelope with ranked candidates.
|
|
2601
|
-
*
|
|
2602
|
-
* @task T11982
|
|
2603
|
-
*/
|
|
2604
|
-
async function rankLocalModelFit(opts) {
|
|
2605
|
-
const ollamaBaseUrl = opts?.ollamaBaseUrl ?? "http://localhost:11434";
|
|
2606
|
-
const [snapshot, ollamaRunning] = await Promise.all([captureHardwareSnapshot(opts?.hardwareOverride), probeOllamaAlive(ollamaBaseUrl)]);
|
|
2607
|
-
const pulledModels = opts?.pulledModelsOverride ?? (ollamaRunning ? await listOllamaPulledModels(ollamaBaseUrl, opts?.fetchFn) : []);
|
|
2608
|
-
const pulledTags = new Set(pulledModels.map((m) => m.name));
|
|
2609
|
-
const ramGb = snapshot.totalRamBytes / 1024 ** 3;
|
|
2610
|
-
const hardware = {
|
|
2611
|
-
totalRamGb: ramGb,
|
|
2612
|
-
availableRamGb: snapshot.availableRamBytes / 1024 ** 3,
|
|
2613
|
-
vramTotalGb: snapshot.vram.totalBytes !== null ? snapshot.vram.totalBytes / 1024 ** 3 : null,
|
|
2614
|
-
vramFreeGb: snapshot.vram.freeBytes !== null ? snapshot.vram.freeBytes / 1024 ** 3 : null,
|
|
2615
|
-
vramMethod: snapshot.vram.method
|
|
2616
|
-
};
|
|
2617
|
-
if (ramGb < 4) {
|
|
2618
|
-
logger.warn({
|
|
2619
|
-
ramGb: ramGb.toFixed(1),
|
|
2620
|
-
floorGb: 4
|
|
2621
|
-
}, "local-model-fit: RAM below floor — no local model recommended");
|
|
2622
|
-
return {
|
|
2623
|
-
hardware,
|
|
2624
|
-
ollamaRunning,
|
|
2625
|
-
pulledModels,
|
|
2626
|
-
recommendations: [],
|
|
2627
|
-
noRecommendationReason: `This machine has only ${ramGb.toFixed(1)} GB RAM. Local LLM inference requires at least 4 GB. Use a cloud provider instead.`
|
|
2628
|
-
};
|
|
2629
|
-
}
|
|
2630
|
-
const eligible = LOCAL_MODEL_CANDIDATES.filter((c) => ramGb >= c.minRamGb);
|
|
2631
|
-
if (eligible.length === 0) return {
|
|
2632
|
-
hardware,
|
|
2633
|
-
ollamaRunning,
|
|
2634
|
-
pulledModels,
|
|
2635
|
-
recommendations: [],
|
|
2636
|
-
noRecommendationReason: `No curated model fits the available RAM (${ramGb.toFixed(1)} GB).`
|
|
2637
|
-
};
|
|
2638
|
-
const scored = eligible.map((candidate) => {
|
|
2639
|
-
const alreadyPulled = pulledTags.has(candidate.modelTag);
|
|
2640
|
-
const { score, reasons, fitTier } = scoreCandidate(candidate, snapshot, alreadyPulled);
|
|
2641
|
-
return {
|
|
2642
|
-
candidate,
|
|
2643
|
-
score,
|
|
2644
|
-
alreadyPulled,
|
|
2645
|
-
reasons,
|
|
2646
|
-
fitTier,
|
|
2647
|
-
pullCommand: `ollama pull ${candidate.modelTag}`
|
|
2648
|
-
};
|
|
2649
|
-
});
|
|
2650
|
-
scored.sort((a, b) => {
|
|
2651
|
-
if (b.score !== a.score) return b.score - a.score;
|
|
2652
|
-
return a.candidate.modelTag.localeCompare(b.candidate.modelTag);
|
|
2653
|
-
});
|
|
2654
|
-
return {
|
|
2655
|
-
hardware,
|
|
2656
|
-
ollamaRunning,
|
|
2657
|
-
pulledModels,
|
|
2658
|
-
recommendations: scored.slice(0, 3),
|
|
2659
|
-
noRecommendationReason: null
|
|
2660
|
-
};
|
|
2661
|
-
}
|
|
2662
|
-
|
|
2663
|
-
export { SENTIENT_STATE_FILE as S, rankLocalModelFit as a, runFrontDoorLogin as b, require_node_cron as c, resolveLLMForSystem as r };
|
|
2664
|
-
//# sourceMappingURL=local-model-fit2-BMqo6GJm.js.map
|