nolune 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +1622 -0
- package/LICENSE +21 -0
- package/README.md +226 -0
- package/build/client/_app/immutable/assets/0.CO3c3JBa.css +2 -0
- package/build/client/_app/immutable/assets/0.CO3c3JBa.css.br +0 -0
- package/build/client/_app/immutable/assets/0.CO3c3JBa.css.gz +0 -0
- package/build/client/_app/immutable/assets/10.DiHYpJ-g.css +1 -0
- package/build/client/_app/immutable/assets/10.DiHYpJ-g.css.br +0 -0
- package/build/client/_app/immutable/assets/10.DiHYpJ-g.css.gz +0 -0
- package/build/client/_app/immutable/assets/14.D8mCg27h.css +1 -0
- package/build/client/_app/immutable/assets/14.D8mCg27h.css.br +0 -0
- package/build/client/_app/immutable/assets/14.D8mCg27h.css.gz +0 -0
- package/build/client/_app/immutable/assets/AssistantAvatar.BH1P1JPA.css +1 -0
- package/build/client/_app/immutable/assets/AssistantAvatar.BH1P1JPA.css.br +0 -0
- package/build/client/_app/immutable/assets/AssistantAvatar.BH1P1JPA.css.gz +0 -0
- package/build/client/_app/immutable/assets/AvatarPicker.BWZNEVEv.css +1 -0
- package/build/client/_app/immutable/assets/AvatarPicker.BWZNEVEv.css.br +0 -0
- package/build/client/_app/immutable/assets/AvatarPicker.BWZNEVEv.css.gz +0 -0
- package/build/client/_app/immutable/assets/DotGrid.uBe8QJ6R.css +1 -0
- package/build/client/_app/immutable/assets/DotGrid.uBe8QJ6R.css.br +0 -0
- package/build/client/_app/immutable/assets/DotGrid.uBe8QJ6R.css.gz +0 -0
- package/build/client/_app/immutable/assets/ModelMenu.CfwWh95X.css +1 -0
- package/build/client/_app/immutable/assets/ModelMenu.CfwWh95X.css.br +0 -0
- package/build/client/_app/immutable/assets/ModelMenu.CfwWh95X.css.gz +0 -0
- package/build/client/_app/immutable/assets/confirm.BpBhXN_i.mp3 +0 -0
- package/build/client/_app/immutable/assets/data.9aNBaxbh.json +1 -0
- package/build/client/_app/immutable/assets/data.9aNBaxbh.json.br +0 -0
- package/build/client/_app/immutable/assets/data.9aNBaxbh.json.gz +0 -0
- package/build/client/_app/immutable/assets/data.BF1r6TM-.json +1 -0
- package/build/client/_app/immutable/assets/data.BF1r6TM-.json.br +0 -0
- package/build/client/_app/immutable/assets/data.BF1r6TM-.json.gz +0 -0
- package/build/client/_app/immutable/assets/data.BnNTV_b6.json +1 -0
- package/build/client/_app/immutable/assets/data.BnNTV_b6.json.br +0 -0
- package/build/client/_app/immutable/assets/data.BnNTV_b6.json.gz +0 -0
- package/build/client/_app/immutable/assets/data.CreAftJo.json +1 -0
- package/build/client/_app/immutable/assets/data.CreAftJo.json.br +0 -0
- package/build/client/_app/immutable/assets/data.CreAftJo.json.gz +0 -0
- package/build/client/_app/immutable/assets/data.DKp8PYJD.json +1 -0
- package/build/client/_app/immutable/assets/data.DKp8PYJD.json.br +0 -0
- package/build/client/_app/immutable/assets/data.DKp8PYJD.json.gz +0 -0
- package/build/client/_app/immutable/assets/figtree-latin-ext-wght-italic.Q0qr0lrZ.woff2 +0 -0
- package/build/client/_app/immutable/assets/figtree-latin-ext-wght-normal.DCwSJGxG.woff2 +0 -0
- package/build/client/_app/immutable/assets/figtree-latin-wght-italic.BEAWuiTz.woff2 +0 -0
- package/build/client/_app/immutable/assets/figtree-latin-wght-normal.D_ZTVpCC.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-cyrillic-400-normal.BJkDdjbt.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-cyrillic-400-normal.DUd3efVn.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-cyrillic-500-normal.CAy0Dwk2.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-cyrillic-500-normal.CFTSF0cD.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-cyrillic-ext-400-normal.Co4MVjrD.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-cyrillic-ext-400-normal.FAIU8e3o.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-cyrillic-ext-500-normal.BDCQVX4y.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-cyrillic-ext-500-normal.BGV2-mDE.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-greek-400-normal.B_0AmgK7.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-greek-400-normal.ftNhKy_S.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-greek-500-normal.DNFqaoqB.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-greek-500-normal.kj_VgxTv.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-greek-ext-400-normal.BQ5yw6bY.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-greek-ext-400-normal.Be4g_LSk.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-greek-ext-500-normal.CGPEfoom.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-greek-ext-500-normal.g6G8W_LY.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-latin-400-normal.C3FQ26ho.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-latin-400-normal.DVTTRLHv.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-latin-500-normal.DknboRIW.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-latin-500-normal.Du17Nws8.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-latin-ext-400-normal.B2gPvaNr.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-latin-ext-400-normal.CbD3vWRE.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-latin-ext-500-normal.-0AGvlKU.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-latin-ext-500-normal.DPED3Y3R.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-symbols2-400-normal.C6JptOil.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-symbols2-400-normal.CpeG9ob9.woff +0 -0
- package/build/client/_app/immutable/assets/fira-mono-symbols2-500-normal.0PpNbZw_.woff2 +0 -0
- package/build/client/_app/immutable/assets/fira-mono-symbols2-500-normal.fxu0Prpo.woff +0 -0
- package/build/client/_app/immutable/assets/music.z3ymEIJM.mp3 +0 -0
- package/build/client/_app/immutable/assets/select.CV-KWLNP.css +1 -0
- package/build/client/_app/immutable/assets/select.CV-KWLNP.css.br +1 -0
- package/build/client/_app/immutable/assets/select.CV-KWLNP.css.gz +0 -0
- package/build/client/_app/immutable/assets/wash.BnjShmr3.mp3 +0 -0
- package/build/client/_app/immutable/assets/yap.SNl9LSqC.mp3 +0 -0
- package/build/client/_app/immutable/chunks/-FJ70HB3.js +1 -0
- package/build/client/_app/immutable/chunks/-FJ70HB3.js.br +0 -0
- package/build/client/_app/immutable/chunks/-FJ70HB3.js.gz +0 -0
- package/build/client/_app/immutable/chunks/9J99lH1E.js +4 -0
- package/build/client/_app/immutable/chunks/9J99lH1E.js.br +0 -0
- package/build/client/_app/immutable/chunks/9J99lH1E.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B4AK16CS.js +1 -0
- package/build/client/_app/immutable/chunks/B4AK16CS.js.br +0 -0
- package/build/client/_app/immutable/chunks/B4AK16CS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B5IRm2KW.js +1 -0
- package/build/client/_app/immutable/chunks/B5IRm2KW.js.br +0 -0
- package/build/client/_app/immutable/chunks/B5IRm2KW.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BAJE4yH_.js +9 -0
- package/build/client/_app/immutable/chunks/BAJE4yH_.js.br +0 -0
- package/build/client/_app/immutable/chunks/BAJE4yH_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BDCREBKE.js +1 -0
- package/build/client/_app/immutable/chunks/BDCREBKE.js.br +0 -0
- package/build/client/_app/immutable/chunks/BDCREBKE.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BOf4cn4q.js +16 -0
- package/build/client/_app/immutable/chunks/BOf4cn4q.js.br +0 -0
- package/build/client/_app/immutable/chunks/BOf4cn4q.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BOixjj3c.js +1 -0
- package/build/client/_app/immutable/chunks/BOixjj3c.js.br +1 -0
- package/build/client/_app/immutable/chunks/BOixjj3c.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BQb4WE-8.js +1 -0
- package/build/client/_app/immutable/chunks/BQb4WE-8.js.br +0 -0
- package/build/client/_app/immutable/chunks/BQb4WE-8.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BTeK4a_a.js +1 -0
- package/build/client/_app/immutable/chunks/BTeK4a_a.js.br +0 -0
- package/build/client/_app/immutable/chunks/BTeK4a_a.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BYNjkfU_.js +1 -0
- package/build/client/_app/immutable/chunks/BYNjkfU_.js.br +0 -0
- package/build/client/_app/immutable/chunks/BYNjkfU_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BeDhKqx_.js +1 -0
- package/build/client/_app/immutable/chunks/BeDhKqx_.js.br +3 -0
- package/build/client/_app/immutable/chunks/BeDhKqx_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Bmf5cCYM.js +1 -0
- package/build/client/_app/immutable/chunks/Bmf5cCYM.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bmf5cCYM.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Bo7a0aly.js +1 -0
- package/build/client/_app/immutable/chunks/Bo7a0aly.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bo7a0aly.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BvAz--0N.js +1 -0
- package/build/client/_app/immutable/chunks/BvAz--0N.js.br +0 -0
- package/build/client/_app/immutable/chunks/BvAz--0N.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C-5HEoLn.js +1 -0
- package/build/client/_app/immutable/chunks/C-5HEoLn.js.br +0 -0
- package/build/client/_app/immutable/chunks/C-5HEoLn.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C7dZK71a.js +1 -0
- package/build/client/_app/immutable/chunks/C7dZK71a.js.br +0 -0
- package/build/client/_app/immutable/chunks/C7dZK71a.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C98TgtTN.js +1 -0
- package/build/client/_app/immutable/chunks/C98TgtTN.js.br +0 -0
- package/build/client/_app/immutable/chunks/C98TgtTN.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C9u9ikCJ.js +1 -0
- package/build/client/_app/immutable/chunks/C9u9ikCJ.js.br +0 -0
- package/build/client/_app/immutable/chunks/C9u9ikCJ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CBy5xNAu.js +1 -0
- package/build/client/_app/immutable/chunks/CBy5xNAu.js.br +0 -0
- package/build/client/_app/immutable/chunks/CBy5xNAu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CCDGpt2Z.js +1 -0
- package/build/client/_app/immutable/chunks/CCDGpt2Z.js.br +0 -0
- package/build/client/_app/immutable/chunks/CCDGpt2Z.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CNU7dyxe.js +1 -0
- package/build/client/_app/immutable/chunks/CNU7dyxe.js.br +3 -0
- package/build/client/_app/immutable/chunks/CNU7dyxe.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CNij7yXO.js +1 -0
- package/build/client/_app/immutable/chunks/CNij7yXO.js.br +0 -0
- package/build/client/_app/immutable/chunks/CNij7yXO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CPbGz0nD.js +1 -0
- package/build/client/_app/immutable/chunks/CPbGz0nD.js.br +0 -0
- package/build/client/_app/immutable/chunks/CPbGz0nD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Ce5rxuHE.js +1 -0
- package/build/client/_app/immutable/chunks/Ce5rxuHE.js.br +0 -0
- package/build/client/_app/immutable/chunks/Ce5rxuHE.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CgJaNa38.js +1 -0
- package/build/client/_app/immutable/chunks/CgJaNa38.js.br +0 -0
- package/build/client/_app/immutable/chunks/CgJaNa38.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CgoZLTv2.js +1 -0
- package/build/client/_app/immutable/chunks/CgoZLTv2.js.br +0 -0
- package/build/client/_app/immutable/chunks/CgoZLTv2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Ch-tX5Y1.js +1 -0
- package/build/client/_app/immutable/chunks/Ch-tX5Y1.js.br +0 -0
- package/build/client/_app/immutable/chunks/Ch-tX5Y1.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CkALdgl6.js +1 -0
- package/build/client/_app/immutable/chunks/CkALdgl6.js.br +0 -0
- package/build/client/_app/immutable/chunks/CkALdgl6.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Cn31HPZM.js +1 -0
- package/build/client/_app/immutable/chunks/Cn31HPZM.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cn31HPZM.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CoVud_S-.js +1 -0
- package/build/client/_app/immutable/chunks/CoVud_S-.js.br +0 -0
- package/build/client/_app/immutable/chunks/CoVud_S-.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CraKVm2C.js +1 -0
- package/build/client/_app/immutable/chunks/CraKVm2C.js.br +0 -0
- package/build/client/_app/immutable/chunks/CraKVm2C.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D2KG5w4u.js +1 -0
- package/build/client/_app/immutable/chunks/D2KG5w4u.js.br +0 -0
- package/build/client/_app/immutable/chunks/D2KG5w4u.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DD7ObTOV.js +1 -0
- package/build/client/_app/immutable/chunks/DD7ObTOV.js.br +0 -0
- package/build/client/_app/immutable/chunks/DD7ObTOV.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DD9f1wuL.js +1 -0
- package/build/client/_app/immutable/chunks/DD9f1wuL.js.br +0 -0
- package/build/client/_app/immutable/chunks/DD9f1wuL.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DFMQ7Wtb.js +1 -0
- package/build/client/_app/immutable/chunks/DFMQ7Wtb.js.br +0 -0
- package/build/client/_app/immutable/chunks/DFMQ7Wtb.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DFO_JKVL.js +1 -0
- package/build/client/_app/immutable/chunks/DFO_JKVL.js.br +0 -0
- package/build/client/_app/immutable/chunks/DFO_JKVL.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DGyl1a-y.js +2 -0
- package/build/client/_app/immutable/chunks/DGyl1a-y.js.br +0 -0
- package/build/client/_app/immutable/chunks/DGyl1a-y.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DM7BiLiI.js +1 -0
- package/build/client/_app/immutable/chunks/DM7BiLiI.js.br +0 -0
- package/build/client/_app/immutable/chunks/DM7BiLiI.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DRu3YDxz.js +1 -0
- package/build/client/_app/immutable/chunks/DRu3YDxz.js.br +2 -0
- package/build/client/_app/immutable/chunks/DRu3YDxz.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DTmdu5jU.js +1 -0
- package/build/client/_app/immutable/chunks/DTmdu5jU.js.br +0 -0
- package/build/client/_app/immutable/chunks/DTmdu5jU.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DW6oei0W.js +1 -0
- package/build/client/_app/immutable/chunks/DW6oei0W.js.br +0 -0
- package/build/client/_app/immutable/chunks/DW6oei0W.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DZ_NkRbw.js +1 -0
- package/build/client/_app/immutable/chunks/DZ_NkRbw.js.br +0 -0
- package/build/client/_app/immutable/chunks/DZ_NkRbw.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DfNBP7nd.js +1 -0
- package/build/client/_app/immutable/chunks/DfNBP7nd.js.br +0 -0
- package/build/client/_app/immutable/chunks/DfNBP7nd.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DkhXP75k.js +1 -0
- package/build/client/_app/immutable/chunks/DkhXP75k.js.br +0 -0
- package/build/client/_app/immutable/chunks/DkhXP75k.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DpugZNaj.js +1 -0
- package/build/client/_app/immutable/chunks/DpugZNaj.js.br +0 -0
- package/build/client/_app/immutable/chunks/DpugZNaj.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DuEN1GTI.js +5 -0
- package/build/client/_app/immutable/chunks/DuEN1GTI.js.br +0 -0
- package/build/client/_app/immutable/chunks/DuEN1GTI.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DubTk1R0.js +1 -0
- package/build/client/_app/immutable/chunks/DubTk1R0.js.br +0 -0
- package/build/client/_app/immutable/chunks/DubTk1R0.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dyxd9rrM.js +5 -0
- package/build/client/_app/immutable/chunks/Dyxd9rrM.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dyxd9rrM.js.gz +0 -0
- package/build/client/_app/immutable/chunks/F14uK0sn.js +1 -0
- package/build/client/_app/immutable/chunks/F14uK0sn.js.br +1 -0
- package/build/client/_app/immutable/chunks/F14uK0sn.js.gz +0 -0
- package/build/client/_app/immutable/chunks/GbStyEBD.js +1 -0
- package/build/client/_app/immutable/chunks/GbStyEBD.js.br +0 -0
- package/build/client/_app/immutable/chunks/GbStyEBD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/IV6C0355.js +1 -0
- package/build/client/_app/immutable/chunks/IV6C0355.js.br +0 -0
- package/build/client/_app/immutable/chunks/IV6C0355.js.gz +0 -0
- package/build/client/_app/immutable/chunks/KSWUKh8r.js +1 -0
- package/build/client/_app/immutable/chunks/KSWUKh8r.js.br +0 -0
- package/build/client/_app/immutable/chunks/KSWUKh8r.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Nhc5CiNi.js +1 -0
- package/build/client/_app/immutable/chunks/Nhc5CiNi.js.br +0 -0
- package/build/client/_app/immutable/chunks/Nhc5CiNi.js.gz +0 -0
- package/build/client/_app/immutable/chunks/OrbH09aZ.js +318 -0
- package/build/client/_app/immutable/chunks/OrbH09aZ.js.br +0 -0
- package/build/client/_app/immutable/chunks/OrbH09aZ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/PnjGAuWf.js +1 -0
- package/build/client/_app/immutable/chunks/PnjGAuWf.js.br +0 -0
- package/build/client/_app/immutable/chunks/PnjGAuWf.js.gz +0 -0
- package/build/client/_app/immutable/chunks/ZoO6eRK-.js +1 -0
- package/build/client/_app/immutable/chunks/ZoO6eRK-.js.br +0 -0
- package/build/client/_app/immutable/chunks/ZoO6eRK-.js.gz +0 -0
- package/build/client/_app/immutable/chunks/eHlSYfzc.js +67 -0
- package/build/client/_app/immutable/chunks/eHlSYfzc.js.br +0 -0
- package/build/client/_app/immutable/chunks/eHlSYfzc.js.gz +0 -0
- package/build/client/_app/immutable/chunks/kUgLbqVN.js +1 -0
- package/build/client/_app/immutable/chunks/kUgLbqVN.js.br +0 -0
- package/build/client/_app/immutable/chunks/kUgLbqVN.js.gz +0 -0
- package/build/client/_app/immutable/chunks/kW5akbMY.js +1 -0
- package/build/client/_app/immutable/chunks/kW5akbMY.js.br +0 -0
- package/build/client/_app/immutable/chunks/kW5akbMY.js.gz +0 -0
- package/build/client/_app/immutable/chunks/lOC7RXgz.js +1 -0
- package/build/client/_app/immutable/chunks/lOC7RXgz.js.br +0 -0
- package/build/client/_app/immutable/chunks/lOC7RXgz.js.gz +0 -0
- package/build/client/_app/immutable/chunks/mxa1wXkp.js +3 -0
- package/build/client/_app/immutable/chunks/mxa1wXkp.js.br +0 -0
- package/build/client/_app/immutable/chunks/mxa1wXkp.js.gz +0 -0
- package/build/client/_app/immutable/chunks/q0g666o4.js +6 -0
- package/build/client/_app/immutable/chunks/q0g666o4.js.br +0 -0
- package/build/client/_app/immutable/chunks/q0g666o4.js.gz +0 -0
- package/build/client/_app/immutable/chunks/rTK8FScS.js +1 -0
- package/build/client/_app/immutable/chunks/rTK8FScS.js.br +0 -0
- package/build/client/_app/immutable/chunks/rTK8FScS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/uBIymjUX.js +1 -0
- package/build/client/_app/immutable/chunks/uBIymjUX.js.br +0 -0
- package/build/client/_app/immutable/chunks/uBIymjUX.js.gz +0 -0
- package/build/client/_app/immutable/chunks/vt9Yl3tP.js +1 -0
- package/build/client/_app/immutable/chunks/vt9Yl3tP.js.br +0 -0
- package/build/client/_app/immutable/chunks/vt9Yl3tP.js.gz +0 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.BBB0nTuC.js +2 -0
- package/build/client/_app/immutable/entry/app.BBB0nTuC.js.br +0 -0
- package/build/client/_app/immutable/entry/app.BBB0nTuC.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.CmBINDhZ.js +1 -0
- package/build/client/_app/immutable/entry/start.CmBINDhZ.js.br +1 -0
- package/build/client/_app/immutable/entry/start.CmBINDhZ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.But357jM.js +1 -0
- package/build/client/_app/immutable/nodes/0.But357jM.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.But357jM.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.DT8uBymP.js +1 -0
- package/build/client/_app/immutable/nodes/1.DT8uBymP.js.br +4 -0
- package/build/client/_app/immutable/nodes/1.DT8uBymP.js.gz +0 -0
- package/build/client/_app/immutable/nodes/10.BacbVQXe.js +1 -0
- package/build/client/_app/immutable/nodes/10.BacbVQXe.js.br +0 -0
- package/build/client/_app/immutable/nodes/10.BacbVQXe.js.gz +0 -0
- package/build/client/_app/immutable/nodes/11.CF-CErr7.js +2 -0
- package/build/client/_app/immutable/nodes/11.CF-CErr7.js.br +0 -0
- package/build/client/_app/immutable/nodes/11.CF-CErr7.js.gz +0 -0
- package/build/client/_app/immutable/nodes/12.CAPJJBGQ.js +1 -0
- package/build/client/_app/immutable/nodes/12.CAPJJBGQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/12.CAPJJBGQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/13.DFyrYJal.js +1 -0
- package/build/client/_app/immutable/nodes/13.DFyrYJal.js.br +0 -0
- package/build/client/_app/immutable/nodes/13.DFyrYJal.js.gz +0 -0
- package/build/client/_app/immutable/nodes/14.D35Ot9wm.js +46 -0
- package/build/client/_app/immutable/nodes/14.D35Ot9wm.js.br +0 -0
- package/build/client/_app/immutable/nodes/14.D35Ot9wm.js.gz +0 -0
- package/build/client/_app/immutable/nodes/15.Cp0A6oCa.js +1 -0
- package/build/client/_app/immutable/nodes/15.Cp0A6oCa.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.Cp0A6oCa.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.DFKUnwHk.js +1 -0
- package/build/client/_app/immutable/nodes/2.DFKUnwHk.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.DFKUnwHk.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.DtSCxjUL.js +1 -0
- package/build/client/_app/immutable/nodes/3.DtSCxjUL.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.DtSCxjUL.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.BY04Tg68.js +2 -0
- package/build/client/_app/immutable/nodes/4.BY04Tg68.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.BY04Tg68.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.CXq_oj0Q.js +1 -0
- package/build/client/_app/immutable/nodes/5.CXq_oj0Q.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.CXq_oj0Q.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.BVjg5uYT.js +1 -0
- package/build/client/_app/immutable/nodes/6.BVjg5uYT.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.BVjg5uYT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/7.BX0HQjn_.js +1 -0
- package/build/client/_app/immutable/nodes/7.BX0HQjn_.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.BX0HQjn_.js.gz +0 -0
- package/build/client/_app/immutable/nodes/8.De0kNeyT.js +4 -0
- package/build/client/_app/immutable/nodes/8.De0kNeyT.js.br +0 -0
- package/build/client/_app/immutable/nodes/8.De0kNeyT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/9.CjcFLNkE.js +1 -0
- package/build/client/_app/immutable/nodes/9.CjcFLNkE.js.br +0 -0
- package/build/client/_app/immutable/nodes/9.CjcFLNkE.js.gz +0 -0
- package/build/client/_app/version.json +1 -0
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/client/apple-touch-icon.png +0 -0
- package/build/client/favicon.ico +0 -0
- package/build/client/robots.txt +3 -0
- package/build/client/robots.txt.br +0 -0
- package/build/client/robots.txt.gz +0 -0
- package/build/env.js +70 -0
- package/build/handler.js +26 -0
- package/build/index.js +149 -0
- package/build/server/chunks/chunks/AssistantAvatar.js-CR1xF68O.js +294 -0
- package/build/server/chunks/chunks/AvatarPicker.js-DZPhpy7w.js +136 -0
- package/build/server/chunks/chunks/Composer.js-mKR_nJD9.js +332 -0
- package/build/server/chunks/chunks/ComposerDock.js-CCH7a93l.js +58 -0
- package/build/server/chunks/chunks/CopyButton.js-BztgBjPI.js +81 -0
- package/build/server/chunks/chunks/DotGrid.js-CftrAYTh.js +107 -0
- package/build/server/chunks/chunks/LucideIcon.js-B_cwdnXZ.js +19 -0
- package/build/server/chunks/chunks/MemoryChangeItem.js-BBDjCjIq.js +2557 -0
- package/build/server/chunks/chunks/ModelMenu.js-DHccPOZS.js +510 -0
- package/build/server/chunks/chunks/MoveToFolderMenu.js-DI6yuRr_.js +288 -0
- package/build/server/chunks/chunks/NewChatForm.js-BesIRgmI.js +296 -0
- package/build/server/chunks/chunks/NewFolderDialog.js-BTTYnEvA.js +192 -0
- package/build/server/chunks/chunks/Notifications.js-BUIjQEFf.js +762 -0
- package/build/server/chunks/chunks/PageHeader.js-CBhoVn_r.js +59 -0
- package/build/server/chunks/chunks/RenameFolderDialog.js-DRXA1rE1.js +258 -0
- package/build/server/chunks/chunks/Rich.js-DEvHcohw.js +31 -0
- package/build/server/chunks/chunks/StepIcon.js-DbIHgd-j.js +38 -0
- package/build/server/chunks/chunks/TopBar.js-DL3V5e8_.js +34 -0
- package/build/server/chunks/chunks/TypedText.js-CBSV0Eww.js +62 -0
- package/build/server/chunks/chunks/UserAvatar.js-zDozVLYj.js +17 -0
- package/build/server/chunks/chunks/UserMenu.js-CD42Fp5q.js +960 -0
- package/build/server/chunks/chunks/access.js-0oJZgR4f.js +40 -0
- package/build/server/chunks/chunks/after-sleep.js-BBvqb2L4.js +10 -0
- package/build/server/chunks/chunks/alert-dialog.js-DFswoRFb.js +505 -0
- package/build/server/chunks/chunks/articles.js-DmiBPIor.js +16 -0
- package/build/server/chunks/chunks/auth.js-avakWenI.js +20044 -0
- package/build/server/chunks/chunks/avatars.js-CZXD-JBu.js +496 -0
- package/build/server/chunks/chunks/badge.js-CBKfxi1n.js +38 -0
- package/build/server/chunks/chunks/check.js-DlXI7kOF.js +15 -0
- package/build/server/chunks/chunks/chevron-right.js-D2YPHtEd.js +15 -0
- package/build/server/chunks/chunks/chevrons-up-down.js-kIInlPpp.js +15 -0
- package/build/server/chunks/chunks/client.js-DXLagFo3.js +120 -0
- package/build/server/chunks/chunks/clock.js-DLKiHbA7.js +19 -0
- package/build/server/chunks/chunks/collapsible.js-TEhMCaES.js +410 -0
- package/build/server/chunks/chunks/command.js-DYF1chyA.js +2231 -0
- package/build/server/chunks/chunks/core.js-fgH-0YTF.js +6 -0
- package/build/server/chunks/chunks/dialog.js-CSahHfdK.js +544 -0
- package/build/server/chunks/chunks/dist.js-Dgve-3EB.js +600 -0
- package/build/server/chunks/chunks/dist2.js-DzuN_1ds.js +347 -0
- package/build/server/chunks/chunks/dropdown-menu.js-CnOm2iRl.js +2396 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
- package/build/server/chunks/chunks/eraser.js-CwqAwzLd.js +15 -0
- package/build/server/chunks/chunks/exports.js-DPPmkIPk.js +236 -0
- package/build/server/chunks/chunks/factory.js-B2lDZWU5.js +2344 -0
- package/build/server/chunks/chunks/files.js-BTCcxPsy.js +33 -0
- package/build/server/chunks/chunks/folder-input.js-bTjsbAVr.js +19 -0
- package/build/server/chunks/chunks/format.js-D-G-GNZJ.js +57 -0
- package/build/server/chunks/chunks/forms.js-TIFaBiDZ.js +4052 -0
- package/build/server/chunks/chunks/hidden-input.js-3jXOp67_.js +47 -0
- package/build/server/chunks/chunks/http.js-B-SIUg23.js +19 -0
- package/build/server/chunks/chunks/i18n.js-gmnYop5e.js +5049 -0
- package/build/server/chunks/chunks/icons.js-DqrSaQen.js +32087 -0
- package/build/server/chunks/chunks/index-server.js-BgjjN9Dl.js +146 -0
- package/build/server/chunks/chunks/internal.js-CPnM6pod.js +28 -0
- package/build/server/chunks/chunks/internal2.js-BJdu5v6t.js +1135 -0
- package/build/server/chunks/chunks/key-round.js-ALDn8H2Z.js +20 -0
- package/build/server/chunks/chunks/last-profile.js-CGCyMPCt.js +6 -0
- package/build/server/chunks/chunks/media-refs.js-CTbNjDi5.js +129 -0
- package/build/server/chunks/chunks/memory-categories.js-BMxcWbJ1.js +141 -0
- package/build/server/chunks/chunks/memory-export.js-B-0sQxo9.js +126 -0
- package/build/server/chunks/chunks/memory.js-BmjM2yTP.js +25 -0
- package/build/server/chunks/chunks/message-circle.js-Boy7xak8.js +15 -0
- package/build/server/chunks/chunks/motion.js-e6Xy0FvI.js +224 -0
- package/build/server/chunks/chunks/node.js-B1BYsTq2.js +9 -0
- package/build/server/chunks/chunks/node2.js-BoQ3pSBK.js +7 -0
- package/build/server/chunks/chunks/node3.js-DUajZgS1.js +2420 -0
- package/build/server/chunks/chunks/openai.js-usndTuuG.js +20473 -0
- package/build/server/chunks/chunks/paths.js-Dv5_wc5b.js +19 -0
- package/build/server/chunks/chunks/pencil.js-BBTMEZ3O.js +15 -0
- package/build/server/chunks/chunks/plus.js-BEkOQr9Q.js +15 -0
- package/build/server/chunks/chunks/preferences.svelte.js-CzoLtrIH.js +93 -0
- package/build/server/chunks/chunks/remote.js-DRgAwsBW.js +3 -0
- package/build/server/chunks/chunks/rolldown-runtime.js-n5G0F_TW.js +37 -0
- package/build/server/chunks/chunks/routing.js-CQ7vk27s.js +265 -0
- package/build/server/chunks/chunks/schedule.js-22hng-Kw.js +296 -0
- package/build/server/chunks/chunks/sdk.js-CRLWYx_O.js +42918 -0
- package/build/server/chunks/chunks/sdk2.js-Dp6IbCdi.js +13701 -0
- package/build/server/chunks/chunks/sdk3.js-DEwIpbCP.js +4 -0
- package/build/server/chunks/chunks/select.js-DGOA1VL9.js +1965 -0
- package/build/server/chunks/chunks/server.js-XxNf6kVC.js +3907 -0
- package/build/server/chunks/chunks/shared.js-1FwmeXhQ.js +789 -0
- package/build/server/chunks/chunks/sidebar.js-B-PyxBE9.js +1498 -0
- package/build/server/chunks/chunks/square-pen.js-B7nqpNVl.js +20 -0
- package/build/server/chunks/chunks/src.js-Cb-pJk2c.js +25288 -0
- package/build/server/chunks/chunks/state.js-CrwNc-tR.js +67 -0
- package/build/server/chunks/chunks/suggestions.js-DxdV1W1D.js +15 -0
- package/build/server/chunks/chunks/switch.js-CDuy0MzW.js +283 -0
- package/build/server/chunks/chunks/terminal.js-BEi5NMPR.js +15 -0
- package/build/server/chunks/chunks/textarea.js-DnOcXQXd.js +25 -0
- package/build/server/chunks/chunks/tint.js-D75gRPbz.js +165 -0
- package/build/server/chunks/chunks/tooltip.js-0flEKjnb.js +5863 -0
- package/build/server/chunks/chunks/uneval.js-C7SIrMEV.js +536 -0
- package/build/server/chunks/chunks/usage.js-BzKKyzUN.js +27 -0
- package/build/server/chunks/chunks/utils.js-rQQrRQUR.js +1020 -0
- package/build/server/chunks/chunks/utils2.js-BgS8NcJx.js +1167 -0
- package/build/server/chunks/chunks/zod.js-DkbjBCP6.js +18824 -0
- package/build/server/chunks/chunks/zod2.js-FNRC10wS.js +4 -0
- package/build/server/chunks/entries/endpoints/api/c/_id_/continue/_server.ts.js-DPkjAoli.js +45 -0
- package/build/server/chunks/entries/endpoints/api/c/_id_/effort/_server.ts.js-B8su8yn5.js +46 -0
- package/build/server/chunks/entries/endpoints/api/c/_id_/events/_server.ts.js-CLDxKKTx.js +73 -0
- package/build/server/chunks/entries/endpoints/api/c/_id_/folder/_server.ts.js-DT3NoKYe.js +54 -0
- package/build/server/chunks/entries/endpoints/api/c/_id_/media/_mediaId_/_server.ts.js-bvxQlwcS.js +52 -0
- package/build/server/chunks/entries/endpoints/api/c/_id_/messages/_server.ts.js-ClMX8O_R.js +57 -0
- package/build/server/chunks/entries/endpoints/api/c/_id_/preset/_server.ts.js-DQ8N5-g_.js +50 -0
- package/build/server/chunks/entries/endpoints/api/c/_id_/stop/_server.ts.js-4v8WbwCB.js +43 -0
- package/build/server/chunks/entries/endpoints/api/events/_server.ts.js-lUrCowKV.js +78 -0
- package/build/server/chunks/entries/endpoints/api/hooks/_token_/_server.ts.js-CoqUCiud.js +49 -0
- package/build/server/chunks/entries/endpoints/api/icons/_name_/_server.ts.js-k_TzYggq.js +18 -0
- package/build/server/chunks/entries/endpoints/api/models/_server.ts.js-BnE6M4aY.js +56 -0
- package/build/server/chunks/entries/endpoints/api/notifications/_id_/continue/_server.ts.js-7cVqAe1A.js +50 -0
- package/build/server/chunks/entries/endpoints/api/notifications/_id_/dismiss/_server.ts.js-nebszEA8.js +42 -0
- package/build/server/chunks/entries/endpoints/api/notifications/clear/_server.ts.js-8UNQWqlv.js +43 -0
- package/build/server/chunks/entries/endpoints/api/notifications/seen/_server.ts.js-BigNQ41d.js +43 -0
- package/build/server/chunks/entries/endpoints/api/p/_slug_/folders/_folder_/files/_file_/_server.ts.js-CVZofPL8.js +56 -0
- package/build/server/chunks/entries/endpoints/api/p/_slug_/folders/_server.ts.js--huBNcxm.js +57 -0
- package/build/server/chunks/entries/endpoints/api/p/_slug_/memory/_id_/undo/_server.ts.js-DILraLKg.js +57 -0
- package/build/server/chunks/entries/endpoints/api/p/_slug_/running/_server.ts.js-DysLWyt1.js +79 -0
- package/build/server/chunks/entries/endpoints/api/p/_slug_/suggestions/_server.ts.js-B8HQNn05.js +53 -0
- package/build/server/chunks/entries/endpoints/api/p/_slug_/templates/_id_/cover/_server.ts.js-DCJqd-KE.js +59 -0
- package/build/server/chunks/entries/endpoints/api/p/_slug_/uploads/_id_/_server.ts.js-DJh0dkU7.js +44 -0
- package/build/server/chunks/entries/endpoints/api/p/_slug_/uploads/_server.ts.js-CQi0je7g.js +72 -0
- package/build/server/chunks/entries/endpoints/logout/_server.ts.js-iwUOTHUJ.js +46 -0
- package/build/server/chunks/entries/fallbacks/error.svelte.js-BjT9T-qE.js +22 -0
- package/build/server/chunks/entries/hooks.server.js-CA451orY.js +1956 -0
- package/build/server/chunks/entries/pages/_layout.server.ts.js-DeA1Se1v.js +34 -0
- package/build/server/chunks/entries/pages/_layout.svelte.js-Cc0HS5vE.js +77 -0
- package/build/server/chunks/entries/pages/_page.server.ts.js-BP9VmKmv.js +20 -0
- package/build/server/chunks/entries/pages/_page.svelte.js-BP2EdQl3.js +5 -0
- package/build/server/chunks/entries/pages/admin/_page.server.ts.js-BGy54zg7.js +310 -0
- package/build/server/chunks/entries/pages/admin/_page.svelte.js-DC0lzbwL.js +2092 -0
- package/build/server/chunks/entries/pages/login/_page.server.ts.js-to8Vy4NV.js +42 -0
- package/build/server/chunks/entries/pages/login/_page.svelte.js-CRFRcLqG.js +74 -0
- package/build/server/chunks/entries/pages/p/_slug_/_layout.server.ts.js-BATtKhxU.js +50 -0
- package/build/server/chunks/entries/pages/p/_slug_/_layout.svelte.js-B4A4RVlj.js +1897 -0
- package/build/server/chunks/entries/pages/p/_slug_/_page.server.ts.js-CwhG-rBA.js +71 -0
- package/build/server/chunks/entries/pages/p/_slug_/_page.svelte.js-v85HZSJv.js +132 -0
- package/build/server/chunks/entries/pages/p/_slug_/automations/_page.server.ts.js-BYjEh_94.js +269 -0
- package/build/server/chunks/entries/pages/p/_slug_/automations/_page.svelte.js-C9MxplNZ.js +423 -0
- package/build/server/chunks/entries/pages/p/_slug_/c/_id_/_page.server.ts.js-DqYn7Ov8.js +68 -0
- package/build/server/chunks/entries/pages/p/_slug_/c/_id_/_page.svelte.js-DO1qyELK.js +2072 -0
- package/build/server/chunks/entries/pages/p/_slug_/f/_folder_/_page.server.ts.js-DK68gPIS.js +101 -0
- package/build/server/chunks/entries/pages/p/_slug_/f/_folder_/_page.svelte.js-a31Wj0H5.js +321 -0
- package/build/server/chunks/entries/pages/p/_slug_/images/_page.server.ts.js-DYwxYJjv.js +145 -0
- package/build/server/chunks/entries/pages/p/_slug_/images/_page.svelte.js-H3zU7YA6.js +526 -0
- package/build/server/chunks/entries/pages/p/_slug_/memory/_page.server.ts.js-C6jVrFqG.js +99 -0
- package/build/server/chunks/entries/pages/p/_slug_/memory/_page.svelte.js-D54hFXGF.js +902 -0
- package/build/server/chunks/entries/pages/p/_slug_/settings/_page.server.ts.js-BvhbrusJ.js +106 -0
- package/build/server/chunks/entries/pages/p/_slug_/settings/_page.svelte.js-K9Rx0fue.js +581 -0
- package/build/server/chunks/entries/pages/p/_slug_/skills/_page.server.ts.js-X_toxkHr.js +45 -0
- package/build/server/chunks/entries/pages/p/_slug_/skills/_page.svelte.js-9BpNF-xF.js +132 -0
- package/build/server/chunks/entries/pages/p/_slug_/welcome/_page.server.ts.js-1d4vkOo-.js +129 -0
- package/build/server/chunks/entries/pages/p/_slug_/welcome/_page@.svelte.js-32N16gxF.js +223 -0
- package/build/server/chunks/entries/pages/profiles/_page.server.ts.js-CYu6Uj8H.js +32 -0
- package/build/server/chunks/entries/pages/profiles/_page.svelte.js-Bhw4E_wV.js +89 -0
- package/build/server/chunks/handler-CsXFmZYe.js +1735 -0
- package/build/server/chunks/index.js-kWlRiTFB.js +3700 -0
- package/build/server/chunks/manifest.js-BU_jyr1-.js +314 -0
- package/build/server/chunks/nodes/0.js-D4qm-LVJ.js +42 -0
- package/build/server/chunks/nodes/1.js-Fjtm11_Q.js +9 -0
- package/build/server/chunks/nodes/10.js-C0jWz6L_.js +45 -0
- package/build/server/chunks/nodes/11.js-CvxSawBf.js +45 -0
- package/build/server/chunks/nodes/12.js-CFwkqqPw.js +45 -0
- package/build/server/chunks/nodes/13.js-8e3_MY_4.js +45 -0
- package/build/server/chunks/nodes/14.js-dFhmLvor.js +45 -0
- package/build/server/chunks/nodes/15.js-alFwV-ia.js +45 -0
- package/build/server/chunks/nodes/2.js-DlqVofm5.js +46 -0
- package/build/server/chunks/nodes/3.js-B11kFzfi.js +45 -0
- package/build/server/chunks/nodes/4.js-CJOa-BdF.js +46 -0
- package/build/server/chunks/nodes/5.js-BiasAa82.js +50 -0
- package/build/server/chunks/nodes/6.js-vEMr5YOn.js +47 -0
- package/build/server/chunks/nodes/7.js-BwwcgtyP.js +45 -0
- package/build/server/chunks/nodes/8.js-Mqkjlq-6.js +45 -0
- package/build/server/chunks/nodes/9.js-DtRpQ_En.js +45 -0
- package/build/shims.js +33 -0
- package/dist/chunks/chunk-45BRG6A7.js +85 -0
- package/dist/chunks/chunk-CL6JQXXZ.js +38 -0
- package/dist/chunks/chunk-KZL3QNDA.js +14397 -0
- package/dist/chunks/chunk-N4H4AYCQ.js +20 -0
- package/dist/chunks/chunk-W4U7L4LF.js +47 -0
- package/dist/chunks/io-DMGTB3B7.js +12 -0
- package/dist/chunks/node-4RSVEEU6.js +2233 -0
- package/dist/chunks/node-BBTNNFRQ.js +20 -0
- package/dist/chunks/openai-LNQCFHTY.js +21690 -0
- package/dist/chunks/run-6LM42GJD.js +22287 -0
- package/dist/chunks/sdk-UNMKBESV.js +53 -0
- package/dist/chunks/sdk-Z2WD4F5K.js +30854 -0
- package/dist/chunks/zod-H7KMPIPH.js +19934 -0
- package/dist/cli.js +130 -0
- package/package.json +102 -0
- package/packages/core/drizzle/0000_init.sql +123 -0
- package/packages/core/drizzle/0001_triggers.sql +82 -0
- package/packages/core/drizzle/0002_default_preset.sql +1 -0
- package/packages/core/drizzle/0003_trigger_summary.sql +2 -0
- package/packages/core/drizzle/0004_skill_toggles.sql +1 -0
- package/packages/core/drizzle/0005_media.sql +21 -0
- package/packages/core/drizzle/0006_attachments.sql +25 -0
- package/packages/core/drizzle/0007_folders.sql +35 -0
- package/packages/core/drizzle/0008_avatars.sql +26 -0
- package/packages/core/drizzle/0009_subagents.sql +28 -0
- package/packages/core/drizzle/0010_soul.sql +1 -0
- package/packages/core/drizzle/0011_claude_plan.sql +1 -0
- package/packages/core/drizzle/0012_model_switch.sql +4 -0
- package/packages/core/drizzle/0013_nolune_format.sql +1 -0
- package/packages/core/drizzle/0014_nolune_rename.sql +3 -0
- package/packages/core/drizzle/0015_learn_from_chats.sql +2 -0
- package/packages/core/drizzle/0016_memory_changes.sql +19 -0
- package/packages/core/drizzle/0017_member_person_note.sql +1 -0
- package/packages/core/drizzle/meta/0000_snapshot.json +809 -0
- package/packages/core/drizzle/meta/0001_snapshot.json +1354 -0
- package/packages/core/drizzle/meta/0002_snapshot.json +1362 -0
- package/packages/core/drizzle/meta/0003_snapshot.json +1376 -0
- package/packages/core/drizzle/meta/0004_snapshot.json +1384 -0
- package/packages/core/drizzle/meta/0005_snapshot.json +1523 -0
- package/packages/core/drizzle/meta/0006_snapshot.json +1679 -0
- package/packages/core/drizzle/meta/0007_snapshot.json +1921 -0
- package/packages/core/drizzle/meta/0008_snapshot.json +1929 -0
- package/packages/core/drizzle/meta/0009_snapshot.json +2109 -0
- package/packages/core/drizzle/meta/0010_snapshot.json +2117 -0
- package/packages/core/drizzle/meta/0011_snapshot.json +2124 -0
- package/packages/core/drizzle/meta/0012_snapshot.json +2138 -0
- package/packages/core/drizzle/meta/0013_snapshot.json +2145 -0
- package/packages/core/drizzle/meta/0014_snapshot.json +2145 -0
- package/packages/core/drizzle/meta/0015_snapshot.json +2160 -0
- package/packages/core/drizzle/meta/0016_snapshot.json +2286 -0
- package/packages/core/drizzle/meta/0017_snapshot.json +2293 -0
- package/packages/core/drizzle/meta/_journal.json +132 -0
- package/packages/core/image-templates/app-icon/TEMPLATE.md +37 -0
- package/packages/core/image-templates/app-icon/cover.webp +0 -0
- package/packages/core/image-templates/coloring-page/TEMPLATE.md +14 -0
- package/packages/core/image-templates/coloring-page/cover.webp +0 -0
- package/packages/core/image-templates/concept-art/TEMPLATE.md +46 -0
- package/packages/core/image-templates/concept-art/cover.webp +0 -0
- package/packages/core/image-templates/couple-portrait/TEMPLATE.md +35 -0
- package/packages/core/image-templates/couple-portrait/cover.webp +0 -0
- package/packages/core/image-templates/dream-bouquet/TEMPLATE.md +36 -0
- package/packages/core/image-templates/dream-bouquet/cover.webp +0 -0
- package/packages/core/image-templates/family-crest/TEMPLATE.md +38 -0
- package/packages/core/image-templates/family-crest/cover.webp +0 -0
- package/packages/core/image-templates/nail-art/TEMPLATE.md +32 -0
- package/packages/core/image-templates/nail-art/cover.webp +0 -0
- package/packages/core/image-templates/outfit-board/TEMPLATE.md +46 -0
- package/packages/core/image-templates/outfit-board/cover.webp +0 -0
- package/packages/core/image-templates/party-invitation/TEMPLATE.md +49 -0
- package/packages/core/image-templates/party-invitation/cover.webp +0 -0
- package/packages/core/image-templates/photo-booth/TEMPLATE.md +33 -0
- package/packages/core/image-templates/photo-booth/cover.webp +0 -0
- package/packages/core/image-templates/scribble/TEMPLATE.md +29 -0
- package/packages/core/image-templates/scribble/cover.webp +0 -0
- package/packages/core/image-templates/sprite-sheet/TEMPLATE.md +45 -0
- package/packages/core/image-templates/sprite-sheet/cover.webp +0 -0
- package/packages/core/image-templates/sticker-pack/TEMPLATE.md +37 -0
- package/packages/core/image-templates/sticker-pack/cover.webp +0 -0
- package/packages/core/image-templates/storybook-page/TEMPLATE.md +34 -0
- package/packages/core/image-templates/storybook-page/cover.webp +0 -0
- package/packages/core/image-templates/tattoo/TEMPLATE.md +44 -0
- package/packages/core/image-templates/tattoo/cover.webp +0 -0
- package/packages/core/image-templates/tileable-texture/TEMPLATE.md +34 -0
- package/packages/core/image-templates/tileable-texture/cover.webp +0 -0
- package/packages/core/image-templates/tiny-world/TEMPLATE.md +15 -0
- package/packages/core/image-templates/tiny-world/cover.webp +0 -0
- package/packages/core/image-templates/trip-postcard/TEMPLATE.md +21 -0
- package/packages/core/image-templates/trip-postcard/cover.webp +0 -0
- package/packages/core/image-templates/wanted-poster/TEMPLATE.md +27 -0
- package/packages/core/image-templates/wanted-poster/cover.webp +0 -0
- package/packages/core/skills/automations/SKILL.md +91 -0
- package/packages/core/skills/generate-images/SKILL.md +115 -0
- package/packages/core/skills/nolune/SKILL.md +281 -0
- package/packages/core/skills/subagents/SKILL.md +91 -0
- package/packages/core/skills/view-images/SKILL.md +88 -0
|
@@ -0,0 +1,1956 @@
|
|
|
1
|
+
import { d as building } from '../chunks/internal.js-CPnM6pod.js';
|
|
2
|
+
import { z as installCliShim, A as recoverAfterRestart, B as startScheduler, D as paths, E as viewImage, V as ViewLimitError, F as profileSkillsDir, G as createSkill, H as getProfileBySlug, I as listProfileSkills, J as scanSkills, K as setSkillsEnabled, L as addPreset, M as effectiveContextWindow, N as isProvider$1, O as listPresets, P as isCustomProvider, Q as splitModel, R as editPreset, S as removePreset, U as setDefaultPreset, W as getDefaultPreset, X as generatePassword, Y as createUser, Z as setPassword, _ as setAdmin, $ as deleteUser, a0 as listUsers, r as readConfig, a1 as updateConfig, a2 as findCustomProvider, a3 as removeCustomProvider, a4 as listCustomProviders, a5 as API_KEYS, a6 as isApiKeyProvider, a7 as removeApiKey, a8 as apiKeyStatuses, a9 as claudeExecutable, aa as codexExecutable, ab as imageGenerationStatus, ac as embeddingStatus, ad as parseEmbeddingSetting, ae as saveEmbeddingSetting, af as embeddingProblem, ag as initConfig, g as getDb, ah as configExists, ai as listSubagents, aj as getConversation, ak as subagentLogPath, al as requestSubagentStop, am as steerSubagent, an as subagentResult, ao as EFFORTS, ap as runSubagent, aq as resolvePreset, ar as getTrigger, as as queueWake, at as MAX_SOUL_CHARS, au as writeSoul, av as readSoulFile, aw as MAX_PINNED_CHARS, ax as setLearnFromChats, ay as mergeProfileNotes, az as moveProfileNote, aA as removeMemoryNote, aB as writeMemoryNote, aC as forgetMemoryFact, aD as replaceInMemory, aE as factLines, aF as addMemoryFact, aG as readMemoryNote, aH as searchMemory, aI as listMemoryFiles, aJ as membersWithNotes, aK as profileMemoryDir, aL as isPinnedNote, aM as formatLocalTime, aN as updateTrigger, aO as describeWhen, aP as deleteTrigger, aQ as setTriggerEnabled, aR as queueRun, aS as getPreset, aT as getProfile, aU as listRuns, aV as listProfiles, aW as listTriggers, aX as createTrigger, aY as setProfileAvatar, aZ as providerFor, a_ as chatGptPlanStatus, a$ as signOutChatGpt, b0 as listChatGptModels, b1 as checkCustomProvider, b2 as CustomProviderError, b3 as normalizeApiKey, b4 as checkApiKey, b5 as saveApiKey, b6 as ApiKeyError, b7 as claudePlanStatus, b8 as claudeSignInCommand, b9 as MAX_MEDIA_BYTES, ba as parseImageSize, bb as configuredImageModel, bc as generateImages, bd as inspectImage, be as findSubagent, bf as findTrigger, bg as parseRunAt, bh as isFinished, bi as webhookUrl, bj as saveCustomProvider, bk as startChatGptSignIn, bl as cliCommand, bm as IMAGE_BACKGROUNDS, bn as IMAGE_FORMATS, bo as cancelChatGptSignIn, bp as parseImageModel } from '../chunks/src.js-Cb-pJk2c.js';
|
|
3
|
+
import { A as AVATARS } from '../chunks/avatars.js-CZXD-JBu.js';
|
|
4
|
+
import { g as getAuth, s as svelteKitHandler } from '../chunks/auth.js-avakWenI.js';
|
|
5
|
+
import { c as categoryOf, M as MEMORY_CATEGORIES } from '../chunks/memory-categories.js-BMxcWbJ1.js';
|
|
6
|
+
import { t as translations } from '../chunks/i18n.js-gmnYop5e.js';
|
|
7
|
+
import { p as parsePreferences, P as PREFERENCES_COOKIE, m as matchLocale } from '../chunks/preferences.svelte.js-CzoLtrIH.js';
|
|
8
|
+
import { v as error, A as redirect } from '../chunks/utils.js-rQQrRQUR.js';
|
|
9
|
+
import { rmSync, mkdirSync, chmodSync, existsSync, writeFileSync, unlinkSync } from 'node:fs';
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { dirname, resolve, join, extname, isAbsolute } from 'node:path';
|
|
12
|
+
import { pathToFileURL } from 'node:url';
|
|
13
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
14
|
+
import { parseArgs, format } from 'node:util';
|
|
15
|
+
import { createServer, connect } from 'node:net';
|
|
16
|
+
import { setTimeout } from 'node:timers/promises';
|
|
17
|
+
import { createInterface } from 'node:readline/promises';
|
|
18
|
+
import '../chunks/rolldown-runtime.js-n5G0F_TW.js';
|
|
19
|
+
import 'node:module';
|
|
20
|
+
import '../chunks/media-refs.js-CTbNjDi5.js';
|
|
21
|
+
import '../chunks/usage.js-BzKKyzUN.js';
|
|
22
|
+
import '../chunks/memory-export.js-B-0sQxo9.js';
|
|
23
|
+
import '../chunks/articles.js-DmiBPIor.js';
|
|
24
|
+
import '../chunks/schedule.js-22hng-Kw.js';
|
|
25
|
+
import 'node:crypto';
|
|
26
|
+
import 'better-sqlite3';
|
|
27
|
+
import 'node:events';
|
|
28
|
+
import 'node:readline';
|
|
29
|
+
import 'node:zlib';
|
|
30
|
+
import 'node:dns';
|
|
31
|
+
import 'node:http';
|
|
32
|
+
import 'node:https';
|
|
33
|
+
import 'node:stream/promises';
|
|
34
|
+
import 'node:string_decoder';
|
|
35
|
+
import '../chunks/shared.js-1FwmeXhQ.js';
|
|
36
|
+
import '../chunks/uneval.js-C7SIrMEV.js';
|
|
37
|
+
import '../chunks/internal2.js-BJdu5v6t.js';
|
|
38
|
+
import '../chunks/server.js-XxNf6kVC.js';
|
|
39
|
+
import '../chunks/factory.js-B2lDZWU5.js';
|
|
40
|
+
import '../chunks/zod.js-DkbjBCP6.js';
|
|
41
|
+
import '../chunks/routing.js-CQ7vk27s.js';
|
|
42
|
+
import 'node:fs/promises';
|
|
43
|
+
|
|
44
|
+
//#region packages/cli/src/io.ts
|
|
45
|
+
function createIo(host) {
|
|
46
|
+
return {
|
|
47
|
+
...host,
|
|
48
|
+
log: (...args) => host.stdout(`${format(...args)}\n`),
|
|
49
|
+
error: (...args) => host.stderr(`${format(...args)}\n`)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** A mistake in how the command was called, or something it can't do, in words for the caller. */
|
|
53
|
+
function fail$1(message) {
|
|
54
|
+
throw new Error(message);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region packages/cli/src/protocol.ts
|
|
58
|
+
/**
|
|
59
|
+
* Commands that always run in a process of their own: they prompt at a terminal, run the
|
|
60
|
+
* gateway or manage its service.
|
|
61
|
+
*/
|
|
62
|
+
var LOCAL_ONLY = /* @__PURE__ */ new Set([
|
|
63
|
+
"setup",
|
|
64
|
+
"start",
|
|
65
|
+
"service",
|
|
66
|
+
"init"
|
|
67
|
+
]);
|
|
68
|
+
/** Larger messages end the connection: stdin is the only big one, and notes are far smaller. */
|
|
69
|
+
var MAX_MESSAGE_CHARS = 16777216;
|
|
70
|
+
/** Sends a message, unless the other side has gone. */
|
|
71
|
+
function send(socket, message) {
|
|
72
|
+
if (socket.writable) socket.write(`${JSON.stringify(message)}\n`);
|
|
73
|
+
}
|
|
74
|
+
/** Calls `onMessage` with each message as it arrives. Anything malformed ends the connection. */
|
|
75
|
+
function receive(socket, onMessage) {
|
|
76
|
+
let buffer = "";
|
|
77
|
+
socket.setEncoding("utf8");
|
|
78
|
+
socket.on("data", (chunk) => {
|
|
79
|
+
buffer += chunk;
|
|
80
|
+
for (let end = buffer.indexOf("\n"); end !== -1; end = buffer.indexOf("\n")) {
|
|
81
|
+
if (socket.destroyed) return;
|
|
82
|
+
const line = buffer.slice(0, end);
|
|
83
|
+
buffer = buffer.slice(end + 1);
|
|
84
|
+
let message;
|
|
85
|
+
try {
|
|
86
|
+
message = JSON.parse(line);
|
|
87
|
+
} catch {
|
|
88
|
+
socket.destroy();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (typeof message !== "object" || message === null) {
|
|
92
|
+
socket.destroy();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
onMessage(message);
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.error("[nolune] a malformed message on the nolune command socket:", err);
|
|
99
|
+
socket.destroy();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (buffer.length > MAX_MESSAGE_CHARS) socket.destroy();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region packages/cli/src/agent.ts
|
|
108
|
+
var AGENT_HELP = `Subagents (in agent commands: agents that work on a task in the background, in a
|
|
109
|
+
conversation of their own that starts with only the task)
|
|
110
|
+
nolune agent run [<id>] --prompt "<task>" [--preset NAME] [--effort LEVEL]
|
|
111
|
+
start a subagent, or give one that finished more work;
|
|
112
|
+
prints its id and its log file (--prompt - reads stdin).
|
|
113
|
+
It uses this chat's model and reasoning unless given:
|
|
114
|
+
--preset takes a name from \`nolune preset list\`, --effort
|
|
115
|
+
one of ${EFFORTS.join(", ")}
|
|
116
|
+
nolune agent watch <id> wait until it's done and print its last message; run
|
|
117
|
+
it with run_in_background to be told when it's done
|
|
118
|
+
nolune agent steer <id> --prompt "<message>"
|
|
119
|
+
message a subagent while it works
|
|
120
|
+
nolune agent stop <id>
|
|
121
|
+
nolune agent list`;
|
|
122
|
+
var WATCH_POLL_MS = 1e3;
|
|
123
|
+
function parentId(io) {
|
|
124
|
+
const id = io.env.NOLUNE_CONVERSATION_ID;
|
|
125
|
+
if (!id) throw new Error("`nolune agent` only works in the agent's commands: subagents belong to the conversation that starts them.");
|
|
126
|
+
return id;
|
|
127
|
+
}
|
|
128
|
+
async function promptFrom(io, value, usage) {
|
|
129
|
+
const text = (value === "-" ? await io.readStdin() : value)?.trim();
|
|
130
|
+
if (!text) throw new Error(`usage: ${usage}`);
|
|
131
|
+
return text;
|
|
132
|
+
}
|
|
133
|
+
function name(positionals, usage) {
|
|
134
|
+
const given = positionals[0];
|
|
135
|
+
if (!given) throw new Error(`usage: ${usage}`);
|
|
136
|
+
return given;
|
|
137
|
+
}
|
|
138
|
+
function subagent(parent, id) {
|
|
139
|
+
const found = findSubagent(parent, id);
|
|
140
|
+
if (!found) throw new Error(`this conversation has no subagent "${id}". \`nolune agent list\` shows them.`);
|
|
141
|
+
return found;
|
|
142
|
+
}
|
|
143
|
+
/** The exit code: `watch` fails with 1 when the subagent failed or was stopped. */
|
|
144
|
+
async function agentCommand(io, action, args) {
|
|
145
|
+
const { values, positionals } = parseArgs({
|
|
146
|
+
args,
|
|
147
|
+
allowPositionals: true,
|
|
148
|
+
options: {
|
|
149
|
+
prompt: { type: "string" },
|
|
150
|
+
preset: { type: "string" },
|
|
151
|
+
effort: { type: "string" }
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
switch (action) {
|
|
155
|
+
case "run": {
|
|
156
|
+
const prompt = await promptFrom(io, values.prompt, "nolune agent run [<id>] --prompt \"<task>\" [--preset NAME] [--effort LEVEL] (--prompt - reads stdin)");
|
|
157
|
+
if (values.effort !== void 0 && !EFFORTS.includes(values.effort)) throw new Error(`--effort must be one of ${EFFORTS.join(", ")}.`);
|
|
158
|
+
const { subagent: s, conversation, created } = runSubagent({
|
|
159
|
+
parentId: parentId(io),
|
|
160
|
+
name: positionals[0],
|
|
161
|
+
prompt,
|
|
162
|
+
presetId: values.preset ? resolvePreset(values.preset)?.id : void 0,
|
|
163
|
+
effort: values.effort
|
|
164
|
+
});
|
|
165
|
+
const model = `${conversation.presetName}, reasoning ${conversation.effort}`;
|
|
166
|
+
io.log(created ? `Started subagent ${s.name} (${model}).` : `Gave ${s.name} more work (${model}).`);
|
|
167
|
+
const log = subagentLogPath(s);
|
|
168
|
+
if (log) io.log(`Log: ${log} (what it says and runs as it works, without its reasoning; check it with tail)`);
|
|
169
|
+
io.log(`To be told when it's done, run \`nolune agent watch ${s.name}\` with run_in_background: its last message becomes that command's output. Steer it while it works with \`nolune agent steer ${s.name} --prompt "..."\`.`);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
case "watch": {
|
|
173
|
+
const parent = parentId(io);
|
|
174
|
+
const id = name(positionals, "nolune agent watch <id>");
|
|
175
|
+
for (;;) {
|
|
176
|
+
const result = subagentResult(subagent(parent, id));
|
|
177
|
+
if (result) {
|
|
178
|
+
io.log(result.text);
|
|
179
|
+
return result.ok ? 0 : 1;
|
|
180
|
+
}
|
|
181
|
+
await setTimeout(WATCH_POLL_MS, void 0, { signal: io.signal });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
case "steer": {
|
|
185
|
+
const usage = "nolune agent steer <id> --prompt \"<message>\" (or --prompt - to read stdin)";
|
|
186
|
+
const id = name(positionals, usage);
|
|
187
|
+
const text = await promptFrom(io, values.prompt, usage);
|
|
188
|
+
const s = steerSubagent({
|
|
189
|
+
parentId: parentId(io),
|
|
190
|
+
name: id,
|
|
191
|
+
text
|
|
192
|
+
});
|
|
193
|
+
io.log(`Sent ${s.name} your message; it reads it at its next step.`);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
case "stop": {
|
|
197
|
+
const s = requestSubagentStop({
|
|
198
|
+
parentId: parentId(io),
|
|
199
|
+
name: name(positionals, "nolune agent stop <id>")
|
|
200
|
+
});
|
|
201
|
+
io.log(`Stopping ${s.name}.`);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
case "list":
|
|
205
|
+
case void 0: {
|
|
206
|
+
const all = listSubagents(parentId(io));
|
|
207
|
+
if (!all.length) {
|
|
208
|
+
io.log("This conversation has no subagents.");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
for (const s of all) {
|
|
212
|
+
const conv = getConversation(s.conversationId);
|
|
213
|
+
const status = s.error && s.status !== "done" ? `${s.status} (${s.error})` : s.status;
|
|
214
|
+
io.log(`${s.name} ${status}`);
|
|
215
|
+
if (conv?.title) io.log(` ${conv.title}`);
|
|
216
|
+
if (conv) io.log(` ${conv.presetName}, reasoning ${conv.effort}`);
|
|
217
|
+
const log = subagentLogPath(s);
|
|
218
|
+
if (log) io.log(` log: ${log}`);
|
|
219
|
+
}
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
default: throw new Error("usage: nolune agent run|watch|steer|stop|list. See `nolune help`.");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region packages/cli/src/generate.ts
|
|
227
|
+
/** Read when shown: the gateway runs for days, and the image model can change meanwhile. */
|
|
228
|
+
function generateHelp() {
|
|
229
|
+
return `Pictures (model ${configuredImageModel()}; change it with \`nolune config set image-model\`)
|
|
230
|
+
nolune generate image <PROMPT | -> [--image FILE]... [--size square|portrait|landscape|auto|WxH]
|
|
231
|
+
[--quality Q] [--background auto|transparent|opaque] [--format png|jpeg|webp]
|
|
232
|
+
[--count N] [--model PROVIDER/MODEL] [--out DIR|FILE] [--dry-run]
|
|
233
|
+
make pictures from a prompt, or change the --image ones; \`-\` reads the prompt from stdin`;
|
|
234
|
+
}
|
|
235
|
+
var OPTIONS$1 = {
|
|
236
|
+
image: {
|
|
237
|
+
type: "string",
|
|
238
|
+
short: "i",
|
|
239
|
+
multiple: true
|
|
240
|
+
},
|
|
241
|
+
size: { type: "string" },
|
|
242
|
+
quality: { type: "string" },
|
|
243
|
+
background: { type: "string" },
|
|
244
|
+
format: { type: "string" },
|
|
245
|
+
count: {
|
|
246
|
+
type: "string",
|
|
247
|
+
short: "n"
|
|
248
|
+
},
|
|
249
|
+
model: { type: "string" },
|
|
250
|
+
out: {
|
|
251
|
+
type: "string",
|
|
252
|
+
short: "o"
|
|
253
|
+
},
|
|
254
|
+
"dry-run": { type: "boolean" }
|
|
255
|
+
};
|
|
256
|
+
function oneOf(value, allowed, flag) {
|
|
257
|
+
if (value === void 0) return void 0;
|
|
258
|
+
const v = value.trim().toLowerCase();
|
|
259
|
+
if (!allowed.includes(v)) throw new Error(`--${flag} is one of ${allowed.join(", ")}.`);
|
|
260
|
+
return v;
|
|
261
|
+
}
|
|
262
|
+
function expandHome(path) {
|
|
263
|
+
if (path === "~") return homedir();
|
|
264
|
+
return path.startsWith("~/") ? join(homedir(), path.slice(2)) : path;
|
|
265
|
+
}
|
|
266
|
+
/** The first few words of the prompt, for the file name. */
|
|
267
|
+
function slug(text) {
|
|
268
|
+
return text.toLowerCase().normalize("NFKD").replace(/[^a-z0-9\s-]/g, "").trim().split(/[\s-]+/).slice(0, 5).join("-") || "image";
|
|
269
|
+
}
|
|
270
|
+
function stamp(now) {
|
|
271
|
+
const p = (n) => String(n).padStart(2, "0");
|
|
272
|
+
return `${now.getFullYear()}-${p(now.getMonth() + 1)}-${p(now.getDate())}-${p(now.getHours())}${p(now.getMinutes())}${p(now.getSeconds())}`;
|
|
273
|
+
}
|
|
274
|
+
/** Where each picture goes: `--out` as a file (one picture) or a folder, else `images/`. */
|
|
275
|
+
function outputPaths(io, out, count, base, format) {
|
|
276
|
+
const ext = format === "jpeg" ? "jpg" : format;
|
|
277
|
+
let dir;
|
|
278
|
+
if (out && /\.(png|jpe?g|webp)$/i.test(out)) {
|
|
279
|
+
const file = resolve(io.cwd, expandHome(out));
|
|
280
|
+
if (count === 1) return {
|
|
281
|
+
dir: resolve(file, ".."),
|
|
282
|
+
files: [file]
|
|
283
|
+
};
|
|
284
|
+
dir = resolve(file, "..");
|
|
285
|
+
base = file.slice(dir.length + 1, -extname(file).length);
|
|
286
|
+
} else if (out) dir = resolve(io.cwd, expandHome(out));
|
|
287
|
+
else {
|
|
288
|
+
const profileDir = io.env.NOLUNE_PROFILE_DIR;
|
|
289
|
+
dir = profileDir && isAbsolute(profileDir) ? join(profileDir, "images") : io.cwd;
|
|
290
|
+
}
|
|
291
|
+
const files = Array.from({ length: count }, (_, i) => join(dir, `${base}${count > 1 ? `-${i + 1}` : ""}.${ext}`));
|
|
292
|
+
return {
|
|
293
|
+
dir,
|
|
294
|
+
files
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function formatBytes(bytes) {
|
|
298
|
+
return bytes >= 1048576 ? `${(bytes / 1048576).toFixed(1)} MB` : `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
|
299
|
+
}
|
|
300
|
+
async function image(io, args) {
|
|
301
|
+
const { values, positionals } = parseArgs({
|
|
302
|
+
args,
|
|
303
|
+
allowPositionals: true,
|
|
304
|
+
options: OPTIONS$1
|
|
305
|
+
});
|
|
306
|
+
let prompt = positionals.join(" ").trim();
|
|
307
|
+
if (prompt === "-") prompt = (await io.readStdin()).trim();
|
|
308
|
+
if (!prompt) throw new Error("say what to make: nolune generate image \"<prompt>\"");
|
|
309
|
+
const inputs = (values.image ?? []).map((path) => resolve(io.cwd, expandHome(path)));
|
|
310
|
+
const count = values.count === void 0 ? 1 : Number(values.count);
|
|
311
|
+
if (!Number.isInteger(count) || count < 1 || count > 4) throw new Error(`--count is between 1 and 4.`);
|
|
312
|
+
const background = oneOf(values.background, IMAGE_BACKGROUNDS, "background");
|
|
313
|
+
const format = oneOf(values.format, IMAGE_FORMATS, "format");
|
|
314
|
+
const size = values.size ? parseImageSize(values.size) : "auto";
|
|
315
|
+
const quality = values.quality?.trim().toLowerCase() || void 0;
|
|
316
|
+
if (values["dry-run"]) {
|
|
317
|
+
const sizeText = typeof size === "object" ? `${size.width}x${size.height}` : size;
|
|
318
|
+
io.log(`Model: ${values.model?.trim() || configuredImageModel()}`);
|
|
319
|
+
io.log(`Size: ${sizeText}, quality: ${quality ?? "default"}, background: ${background ?? "default"}, format: ${format ?? "png"}, count: ${count}`);
|
|
320
|
+
if (inputs.length) io.log(`Images: ${inputs.join(", ")}`);
|
|
321
|
+
io.log(`Prompt:\n${prompt}`);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const result = await generateImages({
|
|
325
|
+
prompt,
|
|
326
|
+
images: inputs,
|
|
327
|
+
model: values.model,
|
|
328
|
+
size,
|
|
329
|
+
quality,
|
|
330
|
+
background,
|
|
331
|
+
format,
|
|
332
|
+
count,
|
|
333
|
+
signal: io.signal,
|
|
334
|
+
onStart: (model) => {
|
|
335
|
+
const from = inputs.length ? ` from ${inputs.length} image${inputs.length === 1 ? "" : "s"}` : "";
|
|
336
|
+
const what = count === 1 ? "a picture" : `${count} pictures`;
|
|
337
|
+
io.log(`Making ${what} with ${model}${from}. This can take a minute or two.`);
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
const base = `${stamp(/* @__PURE__ */ new Date())}-${slug(prompt)}`;
|
|
341
|
+
const { dir, files } = outputPaths(io, values.out, result.images.length, base, result.images[0].format);
|
|
342
|
+
mkdirSync(dir, { recursive: true });
|
|
343
|
+
for (const [i, picture] of result.images.entries()) {
|
|
344
|
+
writeFileSync(files[i], picture.data);
|
|
345
|
+
const info = inspectImage(picture.data);
|
|
346
|
+
const details = [
|
|
347
|
+
info ? `${info.width}×${info.height}` : null,
|
|
348
|
+
picture.format.toUpperCase(),
|
|
349
|
+
formatBytes(picture.data.length)
|
|
350
|
+
].filter(Boolean);
|
|
351
|
+
io.log(`Saved ${files[i]} (${details.join(", ")})`);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
async function generateCommand(io, action, args) {
|
|
355
|
+
if (action === "image") return image(io, args);
|
|
356
|
+
throw new Error("usage: nolune generate image <prompt> [options]. See `nolune help`.");
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region packages/cli/src/input.ts
|
|
360
|
+
async function ask(io, question, defaultValue = "") {
|
|
361
|
+
if (!io.stdinIsTTY) return defaultValue;
|
|
362
|
+
const rl = createInterface({
|
|
363
|
+
input: process.stdin,
|
|
364
|
+
output: process.stdout
|
|
365
|
+
});
|
|
366
|
+
try {
|
|
367
|
+
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
368
|
+
return (await rl.question(`${question}${suffix}: `)).trim() || defaultValue;
|
|
369
|
+
} finally {
|
|
370
|
+
rl.close();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/** Like ask(), but doesn't echo what's typed or pasted (API keys). */
|
|
374
|
+
async function askHidden(io, question) {
|
|
375
|
+
if (!io.stdinIsTTY) return (await io.readStdin()).trim();
|
|
376
|
+
const stdin = process.stdin;
|
|
377
|
+
return new Promise((resolve, reject) => {
|
|
378
|
+
process.stdout.write(`${question}: `);
|
|
379
|
+
let value = "";
|
|
380
|
+
const cleanup = () => {
|
|
381
|
+
stdin.off("data", onData);
|
|
382
|
+
stdin.setRawMode(false);
|
|
383
|
+
stdin.pause();
|
|
384
|
+
process.stdout.write("\n");
|
|
385
|
+
};
|
|
386
|
+
const onData = (chunk) => {
|
|
387
|
+
for (const ch of chunk) {
|
|
388
|
+
if (ch === "\r" || ch === "\n") {
|
|
389
|
+
cleanup();
|
|
390
|
+
resolve(value.trim());
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
if (ch === "") {
|
|
394
|
+
cleanup();
|
|
395
|
+
reject(/* @__PURE__ */ new Error("Cancelled"));
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (ch === "" || ch === "\b") value = value.slice(0, -1);
|
|
399
|
+
else value += ch;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
stdin.setRawMode(true);
|
|
403
|
+
stdin.setEncoding("utf8");
|
|
404
|
+
stdin.resume();
|
|
405
|
+
stdin.on("data", onData);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
//#endregion
|
|
409
|
+
//#region packages/cli/src/plans.ts
|
|
410
|
+
async function confirm(io, question) {
|
|
411
|
+
return /^y/i.test(await ask(io, `${question} (yes/no)`, "yes"));
|
|
412
|
+
}
|
|
413
|
+
/** Runs a program on this terminal, for the person at it; returns its exit code. */
|
|
414
|
+
function runOnTerminal(command, args, env = process.env) {
|
|
415
|
+
return spawnSync(command, args, {
|
|
416
|
+
stdio: "inherit",
|
|
417
|
+
env
|
|
418
|
+
}).status ?? 1;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Fails unless Claude Code is here and signed in to a plan; says who it's signed in as. With
|
|
422
|
+
* `guide`, at a terminal, it first offers what's missing: Anthropic's installer, then Claude
|
|
423
|
+
* Code's own sign-in, asking before each. nolune never sees the sign-in: Claude Code keeps it.
|
|
424
|
+
*/
|
|
425
|
+
async function requireClaudePlan(io, guide = false) {
|
|
426
|
+
let status = await claudePlanStatus();
|
|
427
|
+
if (guide && io.stdinIsTTY && !status.installed) {
|
|
428
|
+
io.log("Chats on the Claude plan run through Claude Code, which isn't installed here.");
|
|
429
|
+
if (await confirm(io, `Install it with Anthropic's installer (curl -fsSL https://claude.ai/install.sh | bash)?`)) {
|
|
430
|
+
if (runOnTerminal("bash", ["-c", "curl -fsSL https://claude.ai/install.sh | bash"]) !== 0) fail$1("Claude Code's installer failed. See https://code.claude.com/docs/en/setup");
|
|
431
|
+
status = await claudePlanStatus();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (guide && io.stdinIsTTY && status.installed && status.account && status.problem) {
|
|
435
|
+
io.log(status.problem.split(". ")[0].replace(/\.?$/, "."));
|
|
436
|
+
if (await confirm(io, "Sign in to your Claude plan now? Claude Code opens its sign-in page")) {
|
|
437
|
+
const { command, args, env } = claudeSignInCommand(status.path ?? "claude");
|
|
438
|
+
runOnTerminal(command, args, env);
|
|
439
|
+
status = await claudePlanStatus();
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (status.problem || !status.account) fail$1(status.problem ?? "Claude Code didn't answer.");
|
|
443
|
+
io.log(`Claude Code (${status.path}): ${status.signedIn}`);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Signs Codex in with ChatGPT: prints where to go and a one-time code, then waits for someone to
|
|
447
|
+
* enter it, on any device. It asks nothing here, so it also works from the agent's commands.
|
|
448
|
+
* Stops when the command is stopped, even while Codex is still starting.
|
|
449
|
+
*/
|
|
450
|
+
async function signInWithChatGpt(io) {
|
|
451
|
+
io.signal.throwIfAborted();
|
|
452
|
+
const stop = () => cancelChatGptSignIn();
|
|
453
|
+
io.signal.addEventListener("abort", stop, { once: true });
|
|
454
|
+
try {
|
|
455
|
+
const signIn = await startChatGptSignIn();
|
|
456
|
+
io.log(`To sign in with ChatGPT, on any device:
|
|
457
|
+
1. Open ${signIn.verificationUrl} and sign in to ChatGPT
|
|
458
|
+
2. Enter this code: ${signIn.userCode}
|
|
459
|
+
The code works for 15 minutes. Enter it only if you started this sign-in. Waiting…`);
|
|
460
|
+
await signIn.done;
|
|
461
|
+
} finally {
|
|
462
|
+
io.signal.removeEventListener("abort", stop);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Fails unless Codex is here and signed in with ChatGPT; says who it's signed in as. With
|
|
467
|
+
* `guide`, it first does what's missing: at a terminal, it offers OpenAI's installer, asking
|
|
468
|
+
* first; then it signs in with ChatGPT. nolune never sees the sign-in: Codex keeps it.
|
|
469
|
+
*/
|
|
470
|
+
async function requireChatGptPlan(io, guide = false) {
|
|
471
|
+
let status = await chatGptPlanStatus();
|
|
472
|
+
if (guide && io.stdinIsTTY && !status.installed) {
|
|
473
|
+
io.log("Chats on the ChatGPT plan run through OpenAI's Codex, which isn't installed here.");
|
|
474
|
+
if (await confirm(io, `Install it with npm (npm install -g @openai/codex)?`)) {
|
|
475
|
+
if (runOnTerminal("bash", ["-c", "npm install -g @openai/codex"]) !== 0) fail$1("Codex's installer failed. See https://developers.openai.com/codex/cli");
|
|
476
|
+
status = await chatGptPlanStatus();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
if (guide && status.installed && !status.account) {
|
|
480
|
+
if (status.problem) io.log(status.problem.split(". ")[0].replace(/\.?$/, "."));
|
|
481
|
+
await signInWithChatGpt(io);
|
|
482
|
+
status = await chatGptPlanStatus();
|
|
483
|
+
}
|
|
484
|
+
if (status.problem || !status.signedIn) fail$1(status.problem ?? "Codex didn't answer.");
|
|
485
|
+
io.log(`Codex (${status.path}): ${status.signedIn}`);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* `nolune <plan> setup`: installs the plan's agent and signs it in where needed, then says who it's
|
|
489
|
+
* signed in as.
|
|
490
|
+
*/
|
|
491
|
+
function setUpPlan(io, plan) {
|
|
492
|
+
return plan === "claude-plan" ? requireClaudePlan(io, true) : requireChatGptPlan(io, true);
|
|
493
|
+
}
|
|
494
|
+
/** `nolune claude-plan …` and `nolune chatgpt-plan …`. */
|
|
495
|
+
async function planCommand(io, plan, action) {
|
|
496
|
+
switch (action) {
|
|
497
|
+
case "status": return plan === "claude-plan" ? requireClaudePlan(io) : requireChatGptPlan(io);
|
|
498
|
+
case "setup":
|
|
499
|
+
if (plan === "claude-plan" && !io.stdinIsTTY) fail$1("`nolune claude-plan setup` asks questions: run it in a terminal on this computer.");
|
|
500
|
+
return setUpPlan(io, plan);
|
|
501
|
+
}
|
|
502
|
+
if (plan === "chatgpt-plan") {
|
|
503
|
+
if (action === "logout") {
|
|
504
|
+
const { signedIn } = await chatGptPlanStatus();
|
|
505
|
+
await signOutChatGpt();
|
|
506
|
+
io.log(signedIn ? `Signed out (was ${signedIn}). Chats on chatgpt-plan presets stop until someone signs in again.` : "Not signed in.");
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (action === "models") {
|
|
510
|
+
for (const m of await listChatGptModels()) if (m.listed) io.log(`${m.id}\t${m.name}${m.isDefault ? " (default)" : ""}`);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
fail$1("usage: nolune chatgpt-plan status|setup|logout|models");
|
|
514
|
+
}
|
|
515
|
+
fail$1("usage: nolune claude-plan status|setup");
|
|
516
|
+
}
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region packages/cli/src/profile.ts
|
|
519
|
+
var PROFILE_HELP = `Profiles and skills
|
|
520
|
+
nolune profile list slug, name and avatar of every profile
|
|
521
|
+
nolune profile avatar [<name>] [--profile SLUG]
|
|
522
|
+
show or change the assistant's avatar in the web chat:
|
|
523
|
+
${AVATARS.join(", ")}`;
|
|
524
|
+
/** The profile `--profile` names, else the one the agent's command runs in (NOLUNE_PROFILE). */
|
|
525
|
+
function profileFor(io, flag) {
|
|
526
|
+
const slug = flag || io.env.NOLUNE_PROFILE;
|
|
527
|
+
if (!slug) throw new Error("which profile? Pass --profile <slug>. See `nolune profile list`.");
|
|
528
|
+
const found = getProfileBySlug(slug);
|
|
529
|
+
if (!found) throw new Error(`no profile with slug "${slug}". See \`nolune profile list\`.`);
|
|
530
|
+
return found;
|
|
531
|
+
}
|
|
532
|
+
function profileCommand(io, action, args) {
|
|
533
|
+
if (action === "list") {
|
|
534
|
+
for (const p of listProfiles()) io.log(`${p.slug}\t${p.name}\t${p.avatar}`);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
if (action !== "avatar") throw new Error("usage: nolune profile list|avatar");
|
|
538
|
+
const { values, positionals } = parseArgs({
|
|
539
|
+
args,
|
|
540
|
+
allowPositionals: true,
|
|
541
|
+
options: { profile: { type: "string" } }
|
|
542
|
+
});
|
|
543
|
+
const profile = profileFor(io, values.profile);
|
|
544
|
+
const [name] = positionals;
|
|
545
|
+
if (!name) {
|
|
546
|
+
io.log(profile.avatar);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const avatar = setProfileAvatar(profile.id, name.trim().toLowerCase());
|
|
550
|
+
io.log(avatar === profile.avatar ? `${profile.name}'s avatar is already the ${avatar}.` : `${profile.name}'s avatar is now the ${avatar}. Open pages show it in a few seconds.`);
|
|
551
|
+
}
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region packages/cli/src/memory.ts
|
|
554
|
+
var MEMORY_HELP = `Memory (short notes in fixed categories; the agent reads the ones it needs)
|
|
555
|
+
nolune memory [list] [--profile SLUG] the notes, how many facts each holds, and whose they are
|
|
556
|
+
nolune memory search <words>... find facts in every note, best match first
|
|
557
|
+
nolune memory show <topic>... print notes (a topic is home, people/anna, …)
|
|
558
|
+
nolune memory add <topic> <fact> add one fact; the note is created if needed
|
|
559
|
+
nolune memory replace <topic> <old> <new> change text that appears once in the note
|
|
560
|
+
nolune memory forget <topic> <text> remove the one line that contains <text>
|
|
561
|
+
nolune memory write <topic> [text] replace the whole note (the text, or stdin)
|
|
562
|
+
nolune memory rm <topic>
|
|
563
|
+
nolune memory mv <topic> <new-topic>
|
|
564
|
+
nolune memory merge <topic> <into-topic> put one note into another about the same thing
|
|
565
|
+
nolune memory learning [on|off] whether nolune also saves what it learns by itself,
|
|
566
|
+
looking over each chat once it goes quiet
|
|
567
|
+
Categories: ${MEMORY_CATEGORIES.map((c) => c === "people" || c === "projects" ? `${c}/<name>` : c).join(", ")}.
|
|
568
|
+
Facts go only into these; a note from before them can be read and rewritten until it's moved.
|
|
569
|
+
The note core is pinned: every new chat starts with it, so it holds at most ${MAX_PINNED_CHARS} characters.`;
|
|
570
|
+
/**
|
|
571
|
+
* `--profile` is picked out by hand: facts are free text and may start with a dash, which an
|
|
572
|
+
* option parser would take for an option. `nolune soul` does the same.
|
|
573
|
+
*/
|
|
574
|
+
function splitProfile(args) {
|
|
575
|
+
let profile;
|
|
576
|
+
const words = [];
|
|
577
|
+
for (let i = 0; i < args.length; i++) {
|
|
578
|
+
const arg = args[i];
|
|
579
|
+
if (arg === "--") {
|
|
580
|
+
words.push(...args.slice(i + 1));
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
if (arg === "--profile") profile = args[++i];
|
|
584
|
+
else if (arg.startsWith("--profile=")) profile = arg.slice(10);
|
|
585
|
+
else words.push(arg);
|
|
586
|
+
}
|
|
587
|
+
return {
|
|
588
|
+
profile,
|
|
589
|
+
words
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
function need(words, count, usage) {
|
|
593
|
+
if (words.length < count) throw new Error(`usage: nolune memory ${usage}`);
|
|
594
|
+
}
|
|
595
|
+
function plural(n, one, many) {
|
|
596
|
+
return `${n} ${n === 1 ? one : many}`;
|
|
597
|
+
}
|
|
598
|
+
async function memoryCommand(io, args) {
|
|
599
|
+
const { profile: flag, words } = splitProfile(args);
|
|
600
|
+
const [action = "list", ...rest] = words;
|
|
601
|
+
if (action === "help") {
|
|
602
|
+
io.log(MEMORY_HELP);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
const profile = profileFor(io, flag);
|
|
606
|
+
const slug = profile.slug;
|
|
607
|
+
switch (action) {
|
|
608
|
+
case "list": {
|
|
609
|
+
const files = listMemoryFiles(slug);
|
|
610
|
+
if (!files.length) {
|
|
611
|
+
io.log(`No notes yet for ${profile.name}. Start one with: nolune memory add <topic> "<fact>"`);
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
const members = membersWithNotes(profile);
|
|
615
|
+
const whose = new Map(members.flatMap((m) => m.note ? [[m.note, m.name]] : []));
|
|
616
|
+
io.log(`Notes for ${profile.name} (${profileMemoryDir(slug)}):`);
|
|
617
|
+
const width = Math.max(...files.map((f) => f.path.length));
|
|
618
|
+
for (const f of files) {
|
|
619
|
+
const about = isPinnedNote(f.path) ? " (pinned: in every new chat)" : whose.has(f.path) ? ` (${whose.get(f.path)}'s note)` : categoryOf(f.path) ? "" : " (from before the categories: move it into one)";
|
|
620
|
+
io.log(` ${f.path.padEnd(width)} ${plural(f.facts.length, "fact", "facts").padEnd(9)} changed ${formatLocalTime(new Date(f.updatedAt))}${about}`);
|
|
621
|
+
}
|
|
622
|
+
const waiting = members.filter((m) => !m.note || !files.some((f) => f.path === m.note));
|
|
623
|
+
for (const m of waiting) io.log(m.note ? ` ${m.name}'s note ${m.note} is started when there is something to write.` : ` Which note is ${m.name}'s isn't known yet: maybe ${m.candidates.map((c) => c.path).join(", ")}. Link it in the profile's settings.`);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
case "search": {
|
|
627
|
+
need(rest, 1, "search <words>...");
|
|
628
|
+
const query = rest.join(" ");
|
|
629
|
+
const hits = await searchMemory(slug, query);
|
|
630
|
+
if (!hits.length) {
|
|
631
|
+
io.log(`Nothing in ${profile.name}'s memory matches "${query}". Try other words (or another language), or read a note with \`nolune memory show <topic>\`.`);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
for (const hit of hits) io.log(`${hit.path}:${hit.line} ${hit.text}${hit.heading ? ` (${hit.heading})` : ""}`);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
case "show":
|
|
638
|
+
need(rest, 1, "show <topic>...");
|
|
639
|
+
for (const [i, topic] of rest.entries()) {
|
|
640
|
+
const note = readMemoryNote(slug, topic);
|
|
641
|
+
if (rest.length > 1) io.log(`${i ? "\n" : ""}==> ${note.path} <==`);
|
|
642
|
+
io.stdout(note.text.endsWith("\n") ? note.text : `${note.text}\n`);
|
|
643
|
+
}
|
|
644
|
+
return;
|
|
645
|
+
case "add": {
|
|
646
|
+
need(rest, 2, "add <topic> <fact>");
|
|
647
|
+
const [topic, ...fact] = rest;
|
|
648
|
+
const lines = factLines(fact.join(" "));
|
|
649
|
+
const results = (lines.length ? lines : [""]).map((line) => addMemoryFact(slug, topic, line));
|
|
650
|
+
const { path } = results[0];
|
|
651
|
+
const saved = results.filter((r) => !r.duplicate).length;
|
|
652
|
+
const verb = results.some((r) => r.created) ? "Started" : "Saved to";
|
|
653
|
+
if (!saved) io.log(`${path} already has ${results.length === 1 ? "that" : "those"}.`);
|
|
654
|
+
else if (results.length === 1) io.log(`${verb} ${path}.`);
|
|
655
|
+
else {
|
|
656
|
+
const had = results.length - saved;
|
|
657
|
+
io.log(`${verb} ${path}: ${plural(saved, "fact", "facts")}${had ? `, and ${had} it already had` : ""}.`);
|
|
658
|
+
}
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
case "replace": {
|
|
662
|
+
need(rest, 3, "replace <topic> <old text> <new text>");
|
|
663
|
+
const { path } = replaceInMemory(slug, rest[0], rest[1], rest[2]);
|
|
664
|
+
io.log(`Updated ${path}.`);
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
case "forget": {
|
|
668
|
+
need(rest, 2, "forget <topic> <text>");
|
|
669
|
+
const [topic, ...text] = rest;
|
|
670
|
+
const { path, removed } = forgetMemoryFact(slug, topic, text.join(" "));
|
|
671
|
+
io.log(`Removed from ${path}: ${removed}`);
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
case "write": {
|
|
675
|
+
need(rest, 1, "write <topic> [text] (without text, the note is read from stdin)");
|
|
676
|
+
const [topic, ...text] = rest;
|
|
677
|
+
if (!text.length && io.stdinIsTTY) throw new Error("give the note as text, or pipe it in: nolune memory write <topic> < note.md");
|
|
678
|
+
const { path, created } = writeMemoryNote(slug, topic, text.length ? text.join(" ") : await io.readStdin());
|
|
679
|
+
io.log(`${created ? "Created" : "Rewrote"} ${path}.`);
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
case "rm":
|
|
683
|
+
need(rest, 1, "rm <topic>");
|
|
684
|
+
io.log(`Deleted ${removeMemoryNote(slug, rest[0]).path}.`);
|
|
685
|
+
return;
|
|
686
|
+
case "mv": {
|
|
687
|
+
need(rest, 2, "mv <topic> <new topic>");
|
|
688
|
+
const moved = moveProfileNote(profile, rest[0], rest[1]);
|
|
689
|
+
io.log(`Renamed ${moved.from} to ${moved.to}.`);
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
case "merge": {
|
|
693
|
+
need(rest, 2, "merge <topic> <into topic>");
|
|
694
|
+
const merged = mergeProfileNotes(profile, rest[0], rest[1]);
|
|
695
|
+
io.log(merged.merged ? `Merged ${merged.from} into ${merged.into}: ${plural(merged.added, "part", "parts")} it didn't have.` : `There was no ${merged.into} yet, so ${merged.from} was renamed to it.`);
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
case "learning": {
|
|
699
|
+
const [value] = rest;
|
|
700
|
+
if (value !== void 0 && value !== "on" && value !== "off") throw new Error("usage: nolune memory learning [on|off]");
|
|
701
|
+
const on = value === void 0 ? profile.learnFromChats : value === "on";
|
|
702
|
+
if (value !== void 0) setLearnFromChats(profile.id, on);
|
|
703
|
+
io.log(on ? `nolune looks over ${profile.name}'s chats once they go quiet and saves what's worth remembering.` : `nolune saves to ${profile.name}'s memory only when it thinks of it in a chat.`);
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
default: throw new Error(`unknown memory command "${action}". See \`nolune memory help\`.`);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
//#endregion
|
|
710
|
+
//#region packages/cli/src/soul.ts
|
|
711
|
+
var SOUL_HELP = `Soul (who nolune is for a profile: character, values, tone; at most ${MAX_SOUL_CHARS} characters)
|
|
712
|
+
nolune soul [show] [--profile SLUG] print it
|
|
713
|
+
nolune soul write [text] replace it (the text, or stdin); every chat gets it
|
|
714
|
+
from its next message
|
|
715
|
+
nolune soul rm remove it`;
|
|
716
|
+
async function soulCommand(io, args) {
|
|
717
|
+
const { profile: flag, words } = splitProfile(args);
|
|
718
|
+
const [action = "show", ...rest] = words;
|
|
719
|
+
if (action === "help") {
|
|
720
|
+
io.log(SOUL_HELP);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
const profile = profileFor(io, flag);
|
|
724
|
+
switch (action) {
|
|
725
|
+
case "show": {
|
|
726
|
+
const text = readSoulFile(profile.slug);
|
|
727
|
+
if (!text) {
|
|
728
|
+
io.log(`${profile.name} has no soul yet. Start one with: nolune soul write < soul.md`);
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
io.log(text);
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
case "write": {
|
|
735
|
+
if (!rest.length && io.stdinIsTTY) throw new Error("give the soul as text, or pipe it in: nolune soul write < soul.md");
|
|
736
|
+
const text = rest.length ? rest.join(" ") : await io.readStdin();
|
|
737
|
+
if (!text.trim()) throw new Error("the soul is empty. To remove it, use `nolune soul rm`.");
|
|
738
|
+
writeSoul(profile.slug, text);
|
|
739
|
+
io.log(`Saved the soul of ${profile.name}. Every chat gets it from its next message.`);
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
case "rm":
|
|
743
|
+
writeSoul(profile.slug, "");
|
|
744
|
+
io.log(`Removed the soul of ${profile.name}.`);
|
|
745
|
+
return;
|
|
746
|
+
default: throw new Error(`unknown soul command "${action}". See \`nolune soul help\`.`);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region packages/cli/src/triggers.ts
|
|
751
|
+
var TRIGGER_HELP = `Automations (results show up as notifications in the web UI)
|
|
752
|
+
nolune trigger add <name> WHEN WHAT [--summary S] [--icon I] [--preset NAME] [--effort LEVEL]
|
|
753
|
+
[--profile SLUG]
|
|
754
|
+
WHEN: --cron "<min hour day month weekday>" (local time) | --at "YYYY-MM-DD HH:MM"
|
|
755
|
+
| --in 30m|2h|1d | --webhook
|
|
756
|
+
WHAT: --prompt "<what the agent should do>" | --script "<shell command, no model>"
|
|
757
|
+
--summary: one plain sentence the family sees on the Automations page
|
|
758
|
+
--icon: a Lucide icon name for it, like umbrella
|
|
759
|
+
nolune trigger list [--profile SLUG]
|
|
760
|
+
nolune trigger show|run|pause|resume|rm <name|id>
|
|
761
|
+
nolune trigger edit <name|id> [--name N] [--summary S] [--icon I] [WHEN] [WHAT] [--preset NAME]
|
|
762
|
+
[--effort LEVEL]
|
|
763
|
+
nolune wake <message> [--title T] [--profile SLUG]
|
|
764
|
+
start a background agent run now; trigger scripts call this (\`nolune wake -\` reads stdin)`;
|
|
765
|
+
var OPTIONS = {
|
|
766
|
+
cron: { type: "string" },
|
|
767
|
+
at: { type: "string" },
|
|
768
|
+
in: { type: "string" },
|
|
769
|
+
webhook: { type: "boolean" },
|
|
770
|
+
prompt: { type: "string" },
|
|
771
|
+
script: { type: "string" },
|
|
772
|
+
name: { type: "string" },
|
|
773
|
+
summary: { type: "string" },
|
|
774
|
+
icon: { type: "string" },
|
|
775
|
+
title: { type: "string" },
|
|
776
|
+
preset: { type: "string" },
|
|
777
|
+
effort: { type: "string" },
|
|
778
|
+
profile: { type: "string" }
|
|
779
|
+
};
|
|
780
|
+
function parse(args) {
|
|
781
|
+
return parseArgs({
|
|
782
|
+
args,
|
|
783
|
+
allowPositionals: true,
|
|
784
|
+
options: OPTIONS
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
function optionalProfile(io, flag) {
|
|
788
|
+
return flag || io.env.NOLUNE_PROFILE ? profileFor(io, flag) : void 0;
|
|
789
|
+
}
|
|
790
|
+
function whenFrom(values) {
|
|
791
|
+
if ([
|
|
792
|
+
values.cron,
|
|
793
|
+
values.at,
|
|
794
|
+
values.in,
|
|
795
|
+
values.webhook
|
|
796
|
+
].filter((v) => v !== void 0).length > 1) throw new Error("give only one of --cron, --at, --in and --webhook");
|
|
797
|
+
if (values.cron !== void 0) return {
|
|
798
|
+
kind: "cron",
|
|
799
|
+
cron: values.cron
|
|
800
|
+
};
|
|
801
|
+
if (values.at !== void 0) return {
|
|
802
|
+
kind: "once",
|
|
803
|
+
runAt: parseRunAt(values.at)
|
|
804
|
+
};
|
|
805
|
+
if (values.in !== void 0) return {
|
|
806
|
+
kind: "once",
|
|
807
|
+
runAt: parseRunAt(values.in)
|
|
808
|
+
};
|
|
809
|
+
if (values.webhook) return { kind: "webhook" };
|
|
810
|
+
}
|
|
811
|
+
function whatFrom(values) {
|
|
812
|
+
if (values.prompt !== void 0 && values.script !== void 0) throw new Error("give either --prompt or --script, not both");
|
|
813
|
+
if (values.prompt !== void 0) return {
|
|
814
|
+
action: "agent",
|
|
815
|
+
prompt: values.prompt
|
|
816
|
+
};
|
|
817
|
+
if (values.script !== void 0) return {
|
|
818
|
+
action: "script",
|
|
819
|
+
command: values.script
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function effortFrom(values) {
|
|
823
|
+
if (values.effort === void 0) return void 0;
|
|
824
|
+
if (!EFFORTS.includes(values.effort)) throw new Error(`--effort must be one of ${EFFORTS.join(", ")}`);
|
|
825
|
+
return values.effort;
|
|
826
|
+
}
|
|
827
|
+
function shortId(t) {
|
|
828
|
+
return t.id.slice(0, 8);
|
|
829
|
+
}
|
|
830
|
+
function status(t) {
|
|
831
|
+
if (isFinished(t)) return "done";
|
|
832
|
+
if (!t.enabled) return "paused";
|
|
833
|
+
if (t.nextRunAt) return `next ${formatLocalTime(t.nextRunAt)}`;
|
|
834
|
+
return "waiting for its webhook";
|
|
835
|
+
}
|
|
836
|
+
function printWebhook(io, t) {
|
|
837
|
+
if (!t.webhookToken) return;
|
|
838
|
+
const url = webhookUrl(t.webhookToken);
|
|
839
|
+
io.log(`Webhook URL (keep it secret: anyone with it can start a run):
|
|
840
|
+
${url}
|
|
841
|
+
Send JSON; form-encoded and text/plain bodies are refused (cross-site protection), e.g.:
|
|
842
|
+
curl -X POST -H 'content-type: application/json' -d '{"text":"hello"}' '${url}'`);
|
|
843
|
+
}
|
|
844
|
+
function describeWhat(t) {
|
|
845
|
+
return t.action === "agent" ? "wakes the agent with its prompt" : `runs \`${t.command}\``;
|
|
846
|
+
}
|
|
847
|
+
function triggerCommand(io, action, args) {
|
|
848
|
+
const { values, positionals } = parse(args);
|
|
849
|
+
const ref = () => {
|
|
850
|
+
if (!positionals[0]) throw new Error("missing <name|id>. See `nolune trigger list`.");
|
|
851
|
+
return findTrigger(positionals[0], optionalProfile(io, values.profile)?.id);
|
|
852
|
+
};
|
|
853
|
+
switch (action) {
|
|
854
|
+
case void 0:
|
|
855
|
+
case "help":
|
|
856
|
+
io.log(TRIGGER_HELP);
|
|
857
|
+
return;
|
|
858
|
+
case "add": {
|
|
859
|
+
const name = positionals[0];
|
|
860
|
+
if (!name) throw new Error("missing <name>. See `nolune help`.");
|
|
861
|
+
const when = whenFrom(values);
|
|
862
|
+
if (!when) throw new Error("say when: --cron, --at, --in or --webhook");
|
|
863
|
+
const what = whatFrom(values);
|
|
864
|
+
if (!what) throw new Error("say what: --prompt or --script");
|
|
865
|
+
const profile = profileFor(io, values.profile);
|
|
866
|
+
const preset = resolvePreset(values.preset, io.env.NOLUNE_CONVERSATION_ID);
|
|
867
|
+
const t = createTrigger({
|
|
868
|
+
profileId: profile.id,
|
|
869
|
+
name,
|
|
870
|
+
summary: values.summary,
|
|
871
|
+
icon: values.icon,
|
|
872
|
+
when,
|
|
873
|
+
what,
|
|
874
|
+
presetId: preset?.id ?? null,
|
|
875
|
+
effort: effortFrom(values)
|
|
876
|
+
});
|
|
877
|
+
io.log(`Added "${t.name}" (${shortId(t)}) to ${profile.slug}: ${describeWhen(t)}, ${describeWhat(t)}.`);
|
|
878
|
+
if (t.nextRunAt) io.log(`Next run: ${formatLocalTime(t.nextRunAt)}`);
|
|
879
|
+
printWebhook(io, t);
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
case "list": {
|
|
883
|
+
const profile = optionalProfile(io, values.profile);
|
|
884
|
+
const slugs = new Map(listProfiles().map((p) => [p.id, p.slug]));
|
|
885
|
+
const triggers = listTriggers(profile?.id);
|
|
886
|
+
if (!triggers.length) io.log("No triggers.");
|
|
887
|
+
for (const t of triggers) {
|
|
888
|
+
const where = profile ? "" : `${slugs.get(t.profileId)}\t`;
|
|
889
|
+
io.log(`${shortId(t)}\t${where}${t.name}\t${describeWhen(t)}\t${t.action === "agent" ? "prompt" : "script"}\t${status(t)}`);
|
|
890
|
+
}
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
case "show": {
|
|
894
|
+
const t = ref();
|
|
895
|
+
const preset = t.presetId ? getPreset(t.presetId) : void 0;
|
|
896
|
+
io.log(`${t.name} (${t.id})
|
|
897
|
+
summary ${t.summary ?? "(none: the Automations page shows only the name)"}
|
|
898
|
+
icon ${t.icon ?? "(none)"}
|
|
899
|
+
profile ${getProfile(t.profileId)?.slug ?? "?"}
|
|
900
|
+
when ${describeWhen(t)} (${status(t)})
|
|
901
|
+
${t.action === "agent" ? `prompt ${t.prompt}` : `script ${t.command}`}
|
|
902
|
+
model ${preset?.name ?? "default preset"}, reasoning ${t.effort}`);
|
|
903
|
+
printWebhook(io, t);
|
|
904
|
+
const runs = listRuns(t.id, 10);
|
|
905
|
+
io.log(runs.length ? "Recent runs:" : "No runs yet.");
|
|
906
|
+
for (const run of runs) {
|
|
907
|
+
const firstLine = run.status === "failed" && run.output ? `: ${run.output.split("\n")[0]}` : "";
|
|
908
|
+
io.log(` ${formatLocalTime(run.createdAt)}\t${run.action}\t${run.source}\t${run.status}${firstLine}`);
|
|
909
|
+
}
|
|
910
|
+
const lastScript = runs.find((r) => r.action === "script" && r.output);
|
|
911
|
+
if (lastScript) io.log(`Output of the last script run:\n${lastScript.output}`);
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
case "run": {
|
|
915
|
+
const t = ref();
|
|
916
|
+
queueRun(t, "manual");
|
|
917
|
+
io.log(`Queued "${t.name}". The gateway starts it within a few seconds.`);
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
case "pause":
|
|
921
|
+
case "resume": {
|
|
922
|
+
const t = setTriggerEnabled(ref().id, action === "resume");
|
|
923
|
+
io.log(`"${t.name}" is ${action === "resume" ? `on (${status(t)})` : "paused"}.`);
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
case "rm": {
|
|
927
|
+
const t = ref();
|
|
928
|
+
deleteTrigger(t.id);
|
|
929
|
+
io.log(`Removed "${t.name}".`);
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
case "edit": {
|
|
933
|
+
const current = ref();
|
|
934
|
+
const preset = values.preset ? resolvePreset(values.preset) : void 0;
|
|
935
|
+
const t = updateTrigger(current.id, {
|
|
936
|
+
name: values.name,
|
|
937
|
+
summary: values.summary,
|
|
938
|
+
icon: values.icon,
|
|
939
|
+
when: whenFrom(values),
|
|
940
|
+
what: whatFrom(values),
|
|
941
|
+
presetId: preset?.id,
|
|
942
|
+
effort: effortFrom(values)
|
|
943
|
+
});
|
|
944
|
+
io.log(`Updated "${t.name}": ${describeWhen(t)}, ${describeWhat(t)} (${status(t)}).`);
|
|
945
|
+
if (t.webhookToken && !current.webhookToken) printWebhook(io, t);
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
default: throw new Error("usage: nolune trigger help|add|list|show|run|pause|resume|rm|edit");
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
/** Queues a background agent run. Inside a trigger's script, the run belongs to that trigger. */
|
|
952
|
+
async function wakeCommand(io, args) {
|
|
953
|
+
const { values, positionals } = parse(args);
|
|
954
|
+
const given = positionals.join(" ").trim();
|
|
955
|
+
const text = given === "-" ? (io.stdinIsTTY ? "" : await io.readStdin()).trim() : given;
|
|
956
|
+
if (!text) throw new Error("usage: nolune wake <what happened and what to do> (or - to read stdin)");
|
|
957
|
+
const t = io.env.NOLUNE_TRIGGER_ID ? getTrigger(io.env.NOLUNE_TRIGGER_ID) : void 0;
|
|
958
|
+
const profileId = t?.profileId ?? profileFor(io, values.profile).id;
|
|
959
|
+
const preset = values.preset || !t ? resolvePreset(values.preset, io.env.NOLUNE_CONVERSATION_ID) : void 0;
|
|
960
|
+
const run = queueWake({
|
|
961
|
+
profileId,
|
|
962
|
+
triggerId: t?.id,
|
|
963
|
+
text,
|
|
964
|
+
title: values.title,
|
|
965
|
+
presetId: preset?.id,
|
|
966
|
+
effort: effortFrom(values)
|
|
967
|
+
});
|
|
968
|
+
io.log(`Woke nolune ("${run.title}"). Its reply shows up as a notification.`);
|
|
969
|
+
}
|
|
970
|
+
//#endregion
|
|
971
|
+
//#region packages/cli/src/service.ts
|
|
972
|
+
/** macOS LaunchAgent: runs as the logged-in user, so commands get their home folder and files. */
|
|
973
|
+
var LABEL = "dev.nolune.gateway";
|
|
974
|
+
var plistPath = join(homedir(), "Library", "LaunchAgents", `${LABEL}.plist`);
|
|
975
|
+
var logFile = join(paths.logs, "gateway.log");
|
|
976
|
+
function target() {
|
|
977
|
+
return `gui/${process.getuid?.() ?? 501}/${LABEL}`;
|
|
978
|
+
}
|
|
979
|
+
function requireMac() {
|
|
980
|
+
if (process.platform !== "darwin") throw new Error("`nolune service` manages a macOS LaunchAgent. On other systems run `nolune start` under your own process manager (e.g. a systemd user unit).");
|
|
981
|
+
}
|
|
982
|
+
function launchctl(...args) {
|
|
983
|
+
return spawnSync("launchctl", args, { encoding: "utf8" });
|
|
984
|
+
}
|
|
985
|
+
function escapeXml(text) {
|
|
986
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
987
|
+
}
|
|
988
|
+
function renderPlist() {
|
|
989
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
990
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
991
|
+
<plist version="1.0">
|
|
992
|
+
<dict>
|
|
993
|
+
<key>Label</key>
|
|
994
|
+
<string>${LABEL}</string>
|
|
995
|
+
<key>ProgramArguments</key>
|
|
996
|
+
<array>
|
|
997
|
+
${[...cliCommand(), "start"].map((a) => `\t\t<string>${escapeXml(a)}</string>`).join("\n")}
|
|
998
|
+
</array>
|
|
999
|
+
<key>EnvironmentVariables</key>
|
|
1000
|
+
<dict>
|
|
1001
|
+
<key>NOLUNE_HOME</key>
|
|
1002
|
+
<string>${escapeXml(paths.home)}</string>
|
|
1003
|
+
</dict>
|
|
1004
|
+
<key>WorkingDirectory</key>
|
|
1005
|
+
<string>${escapeXml(paths.home)}</string>
|
|
1006
|
+
<key>RunAtLoad</key>
|
|
1007
|
+
<true/>
|
|
1008
|
+
<key>KeepAlive</key>
|
|
1009
|
+
<true/>
|
|
1010
|
+
<key>ThrottleInterval</key>
|
|
1011
|
+
<integer>10</integer>
|
|
1012
|
+
<key>StandardOutPath</key>
|
|
1013
|
+
<string>${escapeXml(logFile)}</string>
|
|
1014
|
+
<key>StandardErrorPath</key>
|
|
1015
|
+
<string>${escapeXml(logFile)}</string>
|
|
1016
|
+
</dict>
|
|
1017
|
+
</plist>
|
|
1018
|
+
`;
|
|
1019
|
+
}
|
|
1020
|
+
async function installService() {
|
|
1021
|
+
requireMac();
|
|
1022
|
+
mkdirSync(dirname(plistPath), { recursive: true });
|
|
1023
|
+
mkdirSync(paths.logs, { recursive: true });
|
|
1024
|
+
writeFileSync(plistPath, renderPlist());
|
|
1025
|
+
launchctl("bootout", target());
|
|
1026
|
+
for (let attempt = 0;; attempt++) {
|
|
1027
|
+
const result = launchctl("bootstrap", `gui/${process.getuid?.() ?? 501}`, plistPath);
|
|
1028
|
+
if (result.status === 0) return plistPath;
|
|
1029
|
+
if (attempt >= 10) throw new Error(`launchctl bootstrap failed: ${result.stderr.trim()}`);
|
|
1030
|
+
await setTimeout(300);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
function uninstallService() {
|
|
1034
|
+
requireMac();
|
|
1035
|
+
launchctl("bootout", target());
|
|
1036
|
+
if (existsSync(plistPath)) unlinkSync(plistPath);
|
|
1037
|
+
}
|
|
1038
|
+
function restartService() {
|
|
1039
|
+
requireMac();
|
|
1040
|
+
if (launchctl("kickstart", "-k", target()).status !== 0) throw new Error("The service is not loaded. Run `nolune service install` first.");
|
|
1041
|
+
}
|
|
1042
|
+
function serviceStatus() {
|
|
1043
|
+
requireMac();
|
|
1044
|
+
const result = launchctl("print", target());
|
|
1045
|
+
const pid = /\bpid = (\d+)/.exec(result.stdout ?? "")?.[1];
|
|
1046
|
+
return {
|
|
1047
|
+
installed: existsSync(plistPath),
|
|
1048
|
+
loaded: result.status === 0,
|
|
1049
|
+
pid: pid ? Number(pid) : null
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region packages/cli/src/run.ts
|
|
1054
|
+
/** Built when shown, like generateHelp(): the gateway serves it for as long as it runs. */
|
|
1055
|
+
var help = () => `nolune - a family agent that runs on this computer
|
|
1056
|
+
|
|
1057
|
+
Getting started
|
|
1058
|
+
nolune setup interactive first-time setup (your account, public URL);
|
|
1059
|
+
the model comes after: a new profile's welcome on the
|
|
1060
|
+
web asks for one, or use key set and preset add below
|
|
1061
|
+
nolune start run the gateway in the foreground
|
|
1062
|
+
nolune service install|uninstall|restart|status|logs [-f]
|
|
1063
|
+
run it in the background at login (macOS)
|
|
1064
|
+
|
|
1065
|
+
Settings (${paths.home})
|
|
1066
|
+
nolune config show address, port and what's configured
|
|
1067
|
+
nolune config set <host|port|origin> <value> origin = the public URL people open
|
|
1068
|
+
nolune config set image-model <provider/model> for pictures, e.g. openai/gpt-image-2.5-flare
|
|
1069
|
+
nolune config set embeddings <auto|off|provider/model>
|
|
1070
|
+
what memory search finds meaning with: auto uses the
|
|
1071
|
+
OpenAI key, else OpenRouter's; the provider is openai,
|
|
1072
|
+
openrouter or custom-openai (a custom provider's model,
|
|
1073
|
+
like custom-openai/ollama/nomic-embed-text)
|
|
1074
|
+
nolune config set claude-path <path> the Claude Code that claude-plan chats run, and the
|
|
1075
|
+
nolune config set codex-path <path> Codex that chatgpt-plan chats run (found on the PATH
|
|
1076
|
+
and in their usual folders otherwise)
|
|
1077
|
+
nolune key set <anthropic|openai|openrouter> [key]
|
|
1078
|
+
store an API key (prompts if omitted) after checking
|
|
1079
|
+
it; OpenAI's runs GPT chats and makes pictures. Admins
|
|
1080
|
+
can also do this on the web, under Models & keys
|
|
1081
|
+
nolune key rm <anthropic|openai|openrouter> remove a stored key (the environment's is used, if set)
|
|
1082
|
+
nolune env set <NAME> <value> extra env var for agent commands (e.g. FIRECRAWL_API_KEY)
|
|
1083
|
+
nolune env rm <NAME> | nolune env list
|
|
1084
|
+
|
|
1085
|
+
Custom providers (model servers of your own: Ollama, LM Studio, oMLX, vLLM, llama.cpp...)
|
|
1086
|
+
nolune provider add <name> <url> [--api openai|anthropic] [--key K]
|
|
1087
|
+
add one, through its OpenAI API (the default) or its
|
|
1088
|
+
Anthropic API, or change the address and key of the
|
|
1089
|
+
one of that name; nolune asks it for its models first,
|
|
1090
|
+
and for its key at a terminal when it wants one. The
|
|
1091
|
+
address is the server's, like http://localhost:11434.
|
|
1092
|
+
A server that speaks both can be added once for each
|
|
1093
|
+
nolune provider rm <name|id> presets on it stop working until they're moved
|
|
1094
|
+
nolune provider list
|
|
1095
|
+
|
|
1096
|
+
Plans (chats on your own subscription instead of an API key)
|
|
1097
|
+
claude-plan: a Claude Pro or Max plan, through Claude Code on this computer, signed in to your
|
|
1098
|
+
Claude account. chatgpt-plan: a ChatGPT Plus, Pro or Business plan, through OpenAI's Codex on
|
|
1099
|
+
this computer, signed in with ChatGPT. nolune never sees either sign-in: the agent keeps it.
|
|
1100
|
+
Plan limits assume one person's ordinary use: keep busy automations and subagents on an API key.
|
|
1101
|
+
nolune <plan> status which Claude Code or Codex nolune runs, and who it's
|
|
1102
|
+
signed in as
|
|
1103
|
+
nolune <plan> setup install it and sign in, where needed. Installing asks
|
|
1104
|
+
first, in a terminal; claude-plan signs in there too,
|
|
1105
|
+
chatgpt-plan with a link and a code for any device
|
|
1106
|
+
nolune chatgpt-plan logout sign Codex out; chats on chatgpt-plan presets stop
|
|
1107
|
+
until someone signs in again
|
|
1108
|
+
nolune chatgpt-plan models the models the plan offers, for \`nolune preset add\`
|
|
1109
|
+
|
|
1110
|
+
Users (web sign-up is disabled; this is the only way to add people)
|
|
1111
|
+
nolune user create <name> <email> [--password P] [--admin]
|
|
1112
|
+
nolune user passwd <name|email> [--password P]
|
|
1113
|
+
nolune user admin <name|email> [--off]
|
|
1114
|
+
nolune user rm <name|email>
|
|
1115
|
+
nolune user list
|
|
1116
|
+
|
|
1117
|
+
Model presets (shared by all profiles)
|
|
1118
|
+
nolune preset add <model> [--provider anthropic|openai|openrouter|claude-plan|chatgpt-plan|<custom>]
|
|
1119
|
+
[--name N] [--context-window TOKENS]
|
|
1120
|
+
the provider checks the model id first (anthropic
|
|
1121
|
+
unless given); OpenAI models other than the
|
|
1122
|
+
flagships need --context-window. OpenRouter's ids
|
|
1123
|
+
name their maker (anthropic/claude-sonnet-5), and the
|
|
1124
|
+
model must be able to call tools. A custom provider
|
|
1125
|
+
(by its name) lists its models; its model must call
|
|
1126
|
+
tools too, which shows at its first reply, and
|
|
1127
|
+
pictures and PDFs reach it as paths. The plans check
|
|
1128
|
+
their agent's sign-in instead, and chatgpt-plan the
|
|
1129
|
+
models Codex offers
|
|
1130
|
+
nolune preset edit <name|id> [--provider P] [--model M] [--name N]
|
|
1131
|
+
[--context-window TOKENS|auto]
|
|
1132
|
+
change what's given; a new model is checked like
|
|
1133
|
+
add's. Chats already on the preset keep what they had
|
|
1134
|
+
nolune preset rm <name|id>
|
|
1135
|
+
nolune preset default <name|id> the model new chats start with
|
|
1136
|
+
nolune preset list
|
|
1137
|
+
|
|
1138
|
+
${PROFILE_HELP}
|
|
1139
|
+
nolune skill new <name> [--description D] [--profile SLUG | --global]
|
|
1140
|
+
nolune skill list [--profile SLUG]
|
|
1141
|
+
nolune skill enable <name>... [--profile SLUG]
|
|
1142
|
+
nolune skill disable <name>... [--profile SLUG] leave out of the profile's new chats
|
|
1143
|
+
|
|
1144
|
+
${TRIGGER_HELP}
|
|
1145
|
+
|
|
1146
|
+
${MEMORY_HELP}
|
|
1147
|
+
|
|
1148
|
+
${SOUL_HELP}
|
|
1149
|
+
|
|
1150
|
+
${generateHelp()}
|
|
1151
|
+
|
|
1152
|
+
Inside agent commands (NOLUNE_PROFILE is set, so --profile can be left out)
|
|
1153
|
+
nolune view <image>... show images to the agent: they're attached to the
|
|
1154
|
+
command's result (HEIC and big photos are converted)
|
|
1155
|
+
|
|
1156
|
+
${AGENT_HELP}`;
|
|
1157
|
+
function positional(args, index, name) {
|
|
1158
|
+
const value = args[index];
|
|
1159
|
+
if (!value) fail$1(`missing <${name}>. See \`nolune help\`.`);
|
|
1160
|
+
return value;
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Checks a pasted key with its provider and saves it. A key the provider rejects isn't saved; one
|
|
1164
|
+
* it couldn't be asked about is, with a warning, so setup works while the provider is unreachable.
|
|
1165
|
+
*/
|
|
1166
|
+
async function storeApiKey(io, provider, pasted) {
|
|
1167
|
+
const { label } = API_KEYS[provider];
|
|
1168
|
+
let key;
|
|
1169
|
+
try {
|
|
1170
|
+
key = normalizeApiKey(pasted);
|
|
1171
|
+
} catch (err) {
|
|
1172
|
+
fail$1(err.message);
|
|
1173
|
+
}
|
|
1174
|
+
try {
|
|
1175
|
+
const warning = await checkApiKey(provider, key);
|
|
1176
|
+
saveApiKey(provider, key);
|
|
1177
|
+
io.log(`Saved the ${label} API key.${warning ? ` ${warning}` : ""}`);
|
|
1178
|
+
} catch (err) {
|
|
1179
|
+
if (!(err instanceof ApiKeyError) || err.reason !== "unchecked") fail$1(err.message);
|
|
1180
|
+
saveApiKey(provider, key);
|
|
1181
|
+
io.log(`Saved the ${label} API key without checking it. ${err.message}`);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Checks a custom provider's server by asking it for its models, and saves it (adds it, or changes
|
|
1186
|
+
* the one of that name): its id and the models it serves. One that wants a key gets asked for it
|
|
1187
|
+
* at a terminal; one that can't be reached is saved with a warning, so setup works before the
|
|
1188
|
+
* server runs.
|
|
1189
|
+
*/
|
|
1190
|
+
async function storeCustomProvider(io, name, url, api, given) {
|
|
1191
|
+
let key = given?.trim() || null;
|
|
1192
|
+
const known = findCustomProvider(name);
|
|
1193
|
+
if (known && api && api !== known.api) fail$1(`${known.name} speaks ${known.api === "openai" ? "OpenAI's" : "Anthropic's"} API. Add the other one under another name.`);
|
|
1194
|
+
let found;
|
|
1195
|
+
try {
|
|
1196
|
+
try {
|
|
1197
|
+
found = await checkCustomProvider(url, key);
|
|
1198
|
+
} catch (err) {
|
|
1199
|
+
if (!(err instanceof CustomProviderError) || err.reason !== "key" || key || !io.stdinIsTTY) throw err;
|
|
1200
|
+
key = await askHidden(io, `Its API key`) || null;
|
|
1201
|
+
if (!key) throw err;
|
|
1202
|
+
found = await checkCustomProvider(url, key);
|
|
1203
|
+
}
|
|
1204
|
+
} catch (err) {
|
|
1205
|
+
if (!(err instanceof CustomProviderError) || err.reason !== "unreachable") fail$1(err.message);
|
|
1206
|
+
const id = saveOrFail(known, name, url, api, key);
|
|
1207
|
+
io.log(`Saved ${findCustomProvider(id)?.name} without checking it. ${err.message}`);
|
|
1208
|
+
return {
|
|
1209
|
+
id,
|
|
1210
|
+
models: []
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
const id = saveOrFail(known, name, url, api, key);
|
|
1214
|
+
const saved = findCustomProvider(id);
|
|
1215
|
+
const some = found.models.slice(0, 8).join(", ");
|
|
1216
|
+
const serves = found.models.length ? ` It serves ${some}${found.models.length > 8 ? ` and ${found.models.length - 8} more` : ""}.` : "";
|
|
1217
|
+
io.log(`${known ? "Changed" : "Added"} ${saved.name} at ${saved.url}, through its ${saved.api === "openai" ? "OpenAI" : "Anthropic"} API.${serves}${found.warning ? ` ${found.warning}` : ""}`);
|
|
1218
|
+
return {
|
|
1219
|
+
id,
|
|
1220
|
+
models: found.models
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
function saveOrFail(known, name, url, api, key) {
|
|
1224
|
+
try {
|
|
1225
|
+
return saveCustomProvider({
|
|
1226
|
+
id: known?.id,
|
|
1227
|
+
name: known?.name ?? name,
|
|
1228
|
+
api,
|
|
1229
|
+
url,
|
|
1230
|
+
key
|
|
1231
|
+
});
|
|
1232
|
+
} catch (err) {
|
|
1233
|
+
fail$1(err.message);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* A preset's provider and model as typed: a custom provider by its name or id, its model kept as
|
|
1238
|
+
* `<id>/<model>`. nolune's own providers as they are.
|
|
1239
|
+
*/
|
|
1240
|
+
function presetTarget(provider, model) {
|
|
1241
|
+
if (!provider || isProvider$1(provider)) return {
|
|
1242
|
+
provider,
|
|
1243
|
+
model
|
|
1244
|
+
};
|
|
1245
|
+
const custom = findCustomProvider(provider);
|
|
1246
|
+
if (!custom) {
|
|
1247
|
+
const names = listCustomProviders().map((c) => c.name);
|
|
1248
|
+
fail$1(`no provider "${provider}". It's anthropic, openai, openrouter, claude-plan, chatgpt-plan${names.length ? `, or a custom provider: ${names.join(", ")}` : ", or a custom provider added with `nolune provider add <name> <url>`"}.`);
|
|
1249
|
+
}
|
|
1250
|
+
const bare = model.startsWith(`${custom.id}/`) ? model.slice(custom.id.length + 1) : model;
|
|
1251
|
+
return {
|
|
1252
|
+
provider: providerFor(custom.api),
|
|
1253
|
+
model: `${custom.id}/${bare}`
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
/** A preset's model for people: a custom provider's by its name. */
|
|
1257
|
+
function presetSource(provider, model) {
|
|
1258
|
+
const on = isCustomProvider(provider) ? splitModel(model) : null;
|
|
1259
|
+
const custom = on?.provider ? findCustomProvider(on.provider) : void 0;
|
|
1260
|
+
return custom && on ? `${custom.name}/${on.model}` : `${provider}/${model}`;
|
|
1261
|
+
}
|
|
1262
|
+
function requireInit() {
|
|
1263
|
+
if (!configExists()) fail$1("not set up yet. Run `nolune setup` first.");
|
|
1264
|
+
}
|
|
1265
|
+
function resolveProfileSlug(io, flag) {
|
|
1266
|
+
const slug = flag || io.env.NOLUNE_PROFILE;
|
|
1267
|
+
if (!slug) fail$1("which profile? Pass --profile <slug> (or --global for a global skill).");
|
|
1268
|
+
if (!getProfileBySlug(slug)) fail$1(`no profile with slug "${slug}". See \`nolune profile list\`.`);
|
|
1269
|
+
return slug;
|
|
1270
|
+
}
|
|
1271
|
+
function formatTokens(n) {
|
|
1272
|
+
if (n == null) return "?";
|
|
1273
|
+
return n >= 1e6 ? `${n / 1e6}M` : n >= 1e3 ? `${Math.round(n / 1e3)}K` : String(n);
|
|
1274
|
+
}
|
|
1275
|
+
function listenAddress() {
|
|
1276
|
+
const config = readConfig();
|
|
1277
|
+
const port = config.port ?? 5780;
|
|
1278
|
+
return {
|
|
1279
|
+
host: config.host ?? "127.0.0.1",
|
|
1280
|
+
port,
|
|
1281
|
+
origin: config.origin ?? `http://localhost:${port}`
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
function fullDiskAccessHint() {
|
|
1285
|
+
return `To let the agent reach Documents, Desktop, Downloads, Photos and Mail, give Full Disk Access to
|
|
1286
|
+
${process.execPath}
|
|
1287
|
+
in System Settings > Privacy & Security > Full Disk Access (click +, press Cmd+Shift+G, paste the path).
|
|
1288
|
+
Note: this applies to every script run with that node binary.`;
|
|
1289
|
+
}
|
|
1290
|
+
async function setup(io, args) {
|
|
1291
|
+
const { values } = parseArgs({
|
|
1292
|
+
args,
|
|
1293
|
+
options: {
|
|
1294
|
+
name: { type: "string" },
|
|
1295
|
+
email: { type: "string" },
|
|
1296
|
+
password: { type: "string" },
|
|
1297
|
+
origin: { type: "string" },
|
|
1298
|
+
port: { type: "string" },
|
|
1299
|
+
url: { type: "string" },
|
|
1300
|
+
api: { type: "string" }
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
const { created } = initConfig();
|
|
1304
|
+
getDb();
|
|
1305
|
+
installCliShim();
|
|
1306
|
+
io.log(created ? `Created ${paths.home}` : `Using ${paths.home}`);
|
|
1307
|
+
const admin = listUsers().find((u) => u.isAdmin);
|
|
1308
|
+
if (admin) io.log(`Admin account: ${admin.name} <${admin.email}>`);
|
|
1309
|
+
else {
|
|
1310
|
+
const name = values.name ?? await ask(io, "Your name (the agent sees it on your messages)");
|
|
1311
|
+
const email = values.email ?? await ask(io, "Your email (to sign in)");
|
|
1312
|
+
const password = values.password ?? generatePassword();
|
|
1313
|
+
await createUser({
|
|
1314
|
+
name,
|
|
1315
|
+
email,
|
|
1316
|
+
password,
|
|
1317
|
+
isAdmin: true
|
|
1318
|
+
});
|
|
1319
|
+
io.log(`Created your account. Password: ${values.password ? "(as given)" : password}`);
|
|
1320
|
+
}
|
|
1321
|
+
const current = listenAddress();
|
|
1322
|
+
const port = values.port ? Number(values.port) : current.port;
|
|
1323
|
+
const origin = values.origin ?? await ask(io, "Public URL people will open (leave as is for this computer only)", readConfig().origin ?? `http://localhost:${port}`);
|
|
1324
|
+
updateConfig((c) => {
|
|
1325
|
+
c.port = port;
|
|
1326
|
+
c.origin = origin;
|
|
1327
|
+
});
|
|
1328
|
+
io.log(`
|
|
1329
|
+
Done. Next:
|
|
1330
|
+
nolune service install run the gateway in the background (or \`nolune start\` to try it)
|
|
1331
|
+
nolune user create Anna anna@example.com add family members
|
|
1332
|
+
open ${origin}
|
|
1333
|
+
|
|
1334
|
+
Chats need a model: sign in and make a profile, and its welcome asks for one (a key or a plan,
|
|
1335
|
+
then the model). Or add one under Models & keys, or with \`nolune key set\` and \`nolune preset add\`.
|
|
1336
|
+
|
|
1337
|
+
The gateway listens on http://${current.host}:${port}. To reach it from outside your home, point a
|
|
1338
|
+
tunnel at that address (Tailscale Funnel, Cloudflare Tunnel, or your own VPS) and set its URL with
|
|
1339
|
+
\`nolune config set origin https://...\`.
|
|
1340
|
+
|
|
1341
|
+
${fullDiskAccessHint()}`);
|
|
1342
|
+
}
|
|
1343
|
+
/** Runs the gateway in this process, so it only makes sense in a process of its own. */
|
|
1344
|
+
async function start(io) {
|
|
1345
|
+
requireInit();
|
|
1346
|
+
if (!existsSync(paths.server)) fail$1(`no server build at ${paths.server}. In a source checkout, run \`pnpm build\` first.`);
|
|
1347
|
+
const { host, port, origin } = listenAddress();
|
|
1348
|
+
process.env.HOST ??= host;
|
|
1349
|
+
process.env.PORT ??= String(port);
|
|
1350
|
+
process.env.ORIGIN ??= origin;
|
|
1351
|
+
process.env.BODY_SIZE_LIMIT ??= String(MAX_MEDIA_BYTES + 1048576);
|
|
1352
|
+
io.log(`nolune gateway: ${process.env.ORIGIN} (listening on ${process.env.HOST}:${process.env.PORT})`);
|
|
1353
|
+
await import(
|
|
1354
|
+
/* @vite-ignore */
|
|
1355
|
+
pathToFileURL(paths.server).href
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
async function service(io, action, args) {
|
|
1359
|
+
switch (action) {
|
|
1360
|
+
case "install": {
|
|
1361
|
+
requireInit();
|
|
1362
|
+
if (!existsSync(paths.server)) fail$1("no server build. In a source checkout, run `pnpm build` first.");
|
|
1363
|
+
if (args.includes("--dry-run")) {
|
|
1364
|
+
io.log(renderPlist());
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
const plist = await installService();
|
|
1368
|
+
const { origin } = listenAddress();
|
|
1369
|
+
io.log(`Installed ${plist}
|
|
1370
|
+
The gateway starts now and at every login: ${origin}
|
|
1371
|
+
Logs: ${logFile}
|
|
1372
|
+
It runs with ${process.execPath}; run \`nolune service install\` again after switching Node versions.
|
|
1373
|
+
|
|
1374
|
+
${fullDiskAccessHint()}`);
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
case "uninstall":
|
|
1378
|
+
uninstallService();
|
|
1379
|
+
io.log("Removed the background service.");
|
|
1380
|
+
return;
|
|
1381
|
+
case "restart":
|
|
1382
|
+
restartService();
|
|
1383
|
+
io.log("Restarted.");
|
|
1384
|
+
return;
|
|
1385
|
+
case "status": {
|
|
1386
|
+
const status = serviceStatus();
|
|
1387
|
+
if (!status.installed) io.log("Not installed. Run `nolune service install`.");
|
|
1388
|
+
else if (!status.loaded) io.log("Installed but not loaded. Run `nolune service install`.");
|
|
1389
|
+
else io.log(status.pid ? `Running (pid ${status.pid}).` : "Loaded, not running. See `nolune service logs`.");
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
case "logs": {
|
|
1393
|
+
if (!existsSync(logFile)) fail$1(`no log yet at ${logFile}`);
|
|
1394
|
+
const follow = args.includes("-f") || args.includes("--follow");
|
|
1395
|
+
spawn("tail", [
|
|
1396
|
+
"-n",
|
|
1397
|
+
"100",
|
|
1398
|
+
...follow ? ["-f"] : [],
|
|
1399
|
+
logFile
|
|
1400
|
+
], { stdio: "inherit" });
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
default: fail$1("usage: nolune service install|uninstall|restart|status|logs [-f]");
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Runs `nolune` with these arguments and returns its exit code. Everything it reads and writes
|
|
1408
|
+
* besides its arguments and nolune's own files goes through `io`. An error ends it with its message
|
|
1409
|
+
* and exit code 1.
|
|
1410
|
+
*/
|
|
1411
|
+
async function runCli(argv, io) {
|
|
1412
|
+
try {
|
|
1413
|
+
return await command(io, argv) ?? 0;
|
|
1414
|
+
} catch (err) {
|
|
1415
|
+
io.error(`nolune: ${err instanceof Error ? err.message : String(err)}`);
|
|
1416
|
+
return 1;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
async function command(io, argv) {
|
|
1420
|
+
const [group, action, ...rest] = argv;
|
|
1421
|
+
switch (group) {
|
|
1422
|
+
case void 0:
|
|
1423
|
+
case "help":
|
|
1424
|
+
case "--help":
|
|
1425
|
+
case "-h":
|
|
1426
|
+
io.log(help());
|
|
1427
|
+
return;
|
|
1428
|
+
case "setup": return setup(io, argv.slice(1));
|
|
1429
|
+
case "start": return start(io);
|
|
1430
|
+
case "service": return service(io, action, rest);
|
|
1431
|
+
case "init": {
|
|
1432
|
+
const { created } = initConfig();
|
|
1433
|
+
getDb();
|
|
1434
|
+
const shim = installCliShim();
|
|
1435
|
+
io.log(created ? `Created ${paths.config}` : `Config already exists: ${paths.config}`);
|
|
1436
|
+
io.log(`Database ready: ${paths.db}`);
|
|
1437
|
+
io.log(`Agent shim: ${shim}`);
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
case "config": {
|
|
1441
|
+
requireInit();
|
|
1442
|
+
if (action === void 0) {
|
|
1443
|
+
const config = readConfig();
|
|
1444
|
+
const { host, port, origin } = listenAddress();
|
|
1445
|
+
const row = (name, value) => io.log(`${name.padEnd(13)} ${value}`);
|
|
1446
|
+
row("home", paths.home);
|
|
1447
|
+
row("listen", `http://${host}:${port}`);
|
|
1448
|
+
row("origin", origin);
|
|
1449
|
+
for (const key of apiKeyStatuses()) {
|
|
1450
|
+
const where = key.source === "config" ? "key set" : key.source === "env" ? `key from ${key.env}` : "";
|
|
1451
|
+
const shown = where ? `${where}${key.hint ? ` (…${key.hint})` : ""}` : `no key (nolune key set ${key.provider})`;
|
|
1452
|
+
row(key.provider, shown);
|
|
1453
|
+
}
|
|
1454
|
+
const customs = listCustomProviders();
|
|
1455
|
+
row("custom", customs.length ? customs.map((c) => `${c.name} ${c.url} (${c.api}${c.hasKey ? ", with a key" : ""})`).join(", ") : "none (nolune provider add <name> <url>)");
|
|
1456
|
+
const claude = claudeExecutable();
|
|
1457
|
+
row("claude", claude ? `Claude Code at ${claude} (nolune claude-plan status checks its sign-in)` : "no Claude Code found (nolune claude-plan setup installs it)");
|
|
1458
|
+
const codex = codexExecutable();
|
|
1459
|
+
row("codex", codex ? `Codex at ${codex} (nolune chatgpt-plan status checks its sign-in)` : "no Codex found (nolune chatgpt-plan setup installs it)");
|
|
1460
|
+
const images = imageGenerationStatus();
|
|
1461
|
+
row("images", `${images.model}${images.problem ? ` (${images.problem})` : ""}`);
|
|
1462
|
+
row("embeddings", embeddingStatus());
|
|
1463
|
+
row("env", Object.keys(config.commandEnv ?? {}).join(", ") || "-");
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
if (action !== "set") fail$1("usage: nolune config [set <host|port|origin|image-model|embeddings|claude-path|codex-path> <value>]");
|
|
1467
|
+
const key = positional(rest, 0, "host|port|origin|image-model|embeddings|claude-path|codex-path");
|
|
1468
|
+
if (key === "embeddings") {
|
|
1469
|
+
let setting;
|
|
1470
|
+
try {
|
|
1471
|
+
setting = parseEmbeddingSetting(positional(rest, 1, "auto|off|provider/model"));
|
|
1472
|
+
} catch (err) {
|
|
1473
|
+
fail$1(err.message);
|
|
1474
|
+
}
|
|
1475
|
+
saveEmbeddingSetting(setting);
|
|
1476
|
+
const problem = await embeddingProblem();
|
|
1477
|
+
io.log(`Memory search by meaning: ${embeddingStatus()}.${problem ? ` It didn't answer: ${problem}` : ""}`);
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
const value = positional(rest, 1, "value");
|
|
1481
|
+
updateConfig((c) => {
|
|
1482
|
+
if (key === "port") {
|
|
1483
|
+
const port = Number(value);
|
|
1484
|
+
if (!Number.isInteger(port) || port <= 0) fail$1("port must be a number");
|
|
1485
|
+
c.port = port;
|
|
1486
|
+
} else if (key === "host") c.host = value;
|
|
1487
|
+
else if (key === "origin") c.origin = value.replace(/\/+$/, "");
|
|
1488
|
+
else if (key === "image-model") {
|
|
1489
|
+
const current = parseImageModel(c.imageModel || "openai/gpt-image-2.5-flare");
|
|
1490
|
+
const { provider, model } = parseImageModel(value, current.provider);
|
|
1491
|
+
c.imageModel = `${provider}/${model}`;
|
|
1492
|
+
} else if (key === "claude-path") c.claudePath = value;
|
|
1493
|
+
else if (key === "codex-path") c.codexPath = value;
|
|
1494
|
+
else fail$1("you can set host, port, origin, image-model, embeddings, claude-path or codex-path");
|
|
1495
|
+
});
|
|
1496
|
+
if (key === "claude-path") {
|
|
1497
|
+
await requireClaudePlan(io);
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
if (key === "codex-path") {
|
|
1501
|
+
await requireChatGptPlan(io);
|
|
1502
|
+
return;
|
|
1503
|
+
}
|
|
1504
|
+
if (key === "image-model") {
|
|
1505
|
+
const { model, problem } = imageGenerationStatus();
|
|
1506
|
+
io.log(`Pictures are now made with ${model}.${problem ? ` ${problem}` : ""}`);
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
io.log(`Set ${key}. Run \`nolune service restart\` if the service is running.`);
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
case "key": {
|
|
1513
|
+
requireInit();
|
|
1514
|
+
const provider = rest[0] ?? "";
|
|
1515
|
+
const names = Object.keys(API_KEYS).join("|");
|
|
1516
|
+
if (action !== "set" && action !== "rm" || !isApiKeyProvider(provider)) fail$1(`usage: nolune key set <${names}> [key] | nolune key rm <${names}> (your own servers: nolune provider add)`);
|
|
1517
|
+
const { label, env } = API_KEYS[provider];
|
|
1518
|
+
if (action === "rm") {
|
|
1519
|
+
removeApiKey(provider);
|
|
1520
|
+
const fallback = io.env[env] ? ` nolune uses ${env} from the environment now.` : "";
|
|
1521
|
+
io.log(`Removed the ${label} API key.${fallback}`);
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
const key = rest[1] || await askHidden(io, `${label} API key`);
|
|
1525
|
+
if (!key) fail$1("no key given");
|
|
1526
|
+
await storeApiKey(io, provider, key);
|
|
1527
|
+
return;
|
|
1528
|
+
}
|
|
1529
|
+
case "provider": {
|
|
1530
|
+
requireInit();
|
|
1531
|
+
const { values, positionals } = parseArgs({
|
|
1532
|
+
args: rest,
|
|
1533
|
+
allowPositionals: true,
|
|
1534
|
+
options: {
|
|
1535
|
+
key: { type: "string" },
|
|
1536
|
+
api: { type: "string" }
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
if (action === "add") {
|
|
1540
|
+
const name = positional(positionals, 0, "name");
|
|
1541
|
+
const url = positional(positionals, 1, "url");
|
|
1542
|
+
const api = values.api;
|
|
1543
|
+
if (api !== void 0 && api !== "openai" && api !== "anthropic") fail$1("--api is openai or anthropic");
|
|
1544
|
+
await storeCustomProvider(io, name, url, api, values.key ?? null);
|
|
1545
|
+
} else if (action === "rm") {
|
|
1546
|
+
const which = positional(positionals, 0, "name|id");
|
|
1547
|
+
const custom = findCustomProvider(which);
|
|
1548
|
+
if (!custom) fail$1(`no custom provider "${which}". See \`nolune provider list\`.`);
|
|
1549
|
+
const on = listPresets().filter((p) => isCustomProvider(p.provider) && splitModel(p.model).provider === custom.id);
|
|
1550
|
+
removeCustomProvider(custom.id);
|
|
1551
|
+
io.log(`Removed ${custom.name}.${on.length ? ` Chats on ${on.map((p) => `"${p.name}"`).join(", ")} stop working until they're moved to another model.` : ""}`);
|
|
1552
|
+
} else if (action === "list") for (const c of listCustomProviders()) {
|
|
1553
|
+
const key = c.hasKey ? `key${c.hint ? ` …${c.hint}` : ""}` : "no key";
|
|
1554
|
+
io.log(`${c.name}\t${c.id}\t${c.api}\t${c.url}\t${key}`);
|
|
1555
|
+
}
|
|
1556
|
+
else fail$1("usage: nolune provider add <name> <url> [--api openai|anthropic] [--key K] | nolune provider rm <name|id> | nolune provider list");
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
case "claude-plan":
|
|
1560
|
+
case "chatgpt-plan": return planCommand(io, group, action);
|
|
1561
|
+
case "env":
|
|
1562
|
+
requireInit();
|
|
1563
|
+
if (action === "list") for (const name of Object.keys(readConfig().commandEnv ?? {})) io.log(name);
|
|
1564
|
+
else if (action === "set") {
|
|
1565
|
+
const name = positional(rest, 0, "NAME");
|
|
1566
|
+
const value = rest[1] ?? await askHidden(io, name);
|
|
1567
|
+
if (!value) fail$1("no value given");
|
|
1568
|
+
updateConfig((c) => {
|
|
1569
|
+
c.commandEnv = {
|
|
1570
|
+
...c.commandEnv,
|
|
1571
|
+
[name]: value
|
|
1572
|
+
};
|
|
1573
|
+
});
|
|
1574
|
+
io.log(`Set ${name} for agent commands.`);
|
|
1575
|
+
} else if (action === "rm") {
|
|
1576
|
+
const name = positional(rest, 0, "NAME");
|
|
1577
|
+
updateConfig((c) => {
|
|
1578
|
+
if (c.commandEnv) delete c.commandEnv[name];
|
|
1579
|
+
});
|
|
1580
|
+
io.log(`Removed ${name}.`);
|
|
1581
|
+
} else fail$1("usage: nolune env set|rm|list");
|
|
1582
|
+
return;
|
|
1583
|
+
case "user": {
|
|
1584
|
+
requireInit();
|
|
1585
|
+
const { values, positionals } = parseArgs({
|
|
1586
|
+
args: rest,
|
|
1587
|
+
allowPositionals: true,
|
|
1588
|
+
options: {
|
|
1589
|
+
password: { type: "string" },
|
|
1590
|
+
admin: { type: "boolean" },
|
|
1591
|
+
off: { type: "boolean" }
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
if (action === "create") {
|
|
1595
|
+
const name = positional(positionals, 0, "name");
|
|
1596
|
+
const email = positional(positionals, 1, "email");
|
|
1597
|
+
const password = values.password ?? generatePassword();
|
|
1598
|
+
await createUser({
|
|
1599
|
+
name,
|
|
1600
|
+
email,
|
|
1601
|
+
password,
|
|
1602
|
+
isAdmin: values.admin
|
|
1603
|
+
});
|
|
1604
|
+
io.log(`Created ${name} <${email}>${values.admin ? " (admin)" : ""}.`);
|
|
1605
|
+
if (!values.password) io.log(`Password: ${password}`);
|
|
1606
|
+
} else if (action === "passwd") {
|
|
1607
|
+
const who = positional(positionals, 0, "name|email");
|
|
1608
|
+
const password = values.password ?? generatePassword();
|
|
1609
|
+
await setPassword(who, password);
|
|
1610
|
+
io.log(`Password changed for ${who}.`);
|
|
1611
|
+
if (!values.password) io.log(`Password: ${password}`);
|
|
1612
|
+
} else if (action === "admin") {
|
|
1613
|
+
const who = positional(positionals, 0, "name|email");
|
|
1614
|
+
setAdmin(who, !values.off);
|
|
1615
|
+
io.log(`${who} is ${values.off ? "no longer" : "now"} an admin.`);
|
|
1616
|
+
} else if (action === "rm") {
|
|
1617
|
+
const who = positional(positionals, 0, "name|email");
|
|
1618
|
+
deleteUser(who);
|
|
1619
|
+
io.log(`Deleted ${who}.`);
|
|
1620
|
+
} else if (action === "list") for (const u of listUsers()) io.log(`${u.name}\t${u.email}${u.isAdmin ? " admin" : ""}`);
|
|
1621
|
+
else fail$1("usage: nolune user create|passwd|admin|rm|list");
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
case "preset": {
|
|
1625
|
+
requireInit();
|
|
1626
|
+
const { values, positionals } = parseArgs({
|
|
1627
|
+
args: rest,
|
|
1628
|
+
allowPositionals: true,
|
|
1629
|
+
options: {
|
|
1630
|
+
provider: { type: "string" },
|
|
1631
|
+
model: { type: "string" },
|
|
1632
|
+
name: { type: "string" },
|
|
1633
|
+
"context-window": { type: "string" }
|
|
1634
|
+
}
|
|
1635
|
+
});
|
|
1636
|
+
if (action === "add") {
|
|
1637
|
+
const { provider, model } = presetTarget(values.provider, positional(positionals, 0, "model"));
|
|
1638
|
+
const cw = values["context-window"];
|
|
1639
|
+
const preset = await addPreset({
|
|
1640
|
+
provider,
|
|
1641
|
+
model,
|
|
1642
|
+
name: values.name,
|
|
1643
|
+
contextWindow: cw ? Number(cw) : null
|
|
1644
|
+
});
|
|
1645
|
+
io.log(`Added "${preset.name}" (context ${formatTokens(effectiveContextWindow(preset))}).`);
|
|
1646
|
+
} else if (action === "edit") {
|
|
1647
|
+
const cw = values["context-window"];
|
|
1648
|
+
const which = positional(positionals, 0, "name|id");
|
|
1649
|
+
let { provider, model } = {
|
|
1650
|
+
provider: values.provider,
|
|
1651
|
+
model: values.model
|
|
1652
|
+
};
|
|
1653
|
+
if (provider && !isProvider$1(provider)) {
|
|
1654
|
+
const old = listPresets().find((p) => p.id === which || p.name === which);
|
|
1655
|
+
const id = old && isCustomProvider(old.provider) ? splitModel(old.model).model : old?.model;
|
|
1656
|
+
({provider, model} = presetTarget(provider, model ?? id ?? ""));
|
|
1657
|
+
}
|
|
1658
|
+
const preset = await editPreset(which, {
|
|
1659
|
+
provider,
|
|
1660
|
+
model,
|
|
1661
|
+
name: values.name,
|
|
1662
|
+
contextWindow: cw === void 0 ? void 0 : cw === "auto" ? null : Number(cw)
|
|
1663
|
+
});
|
|
1664
|
+
io.log(`Saved "${preset.name}" (${presetSource(preset.provider, preset.model)}, context ${formatTokens(effectiveContextWindow(preset))}). Chats already on it keep what they had.`);
|
|
1665
|
+
} else if (action === "rm") {
|
|
1666
|
+
removePreset(positional(positionals, 0, "name|id"));
|
|
1667
|
+
io.log("Removed. Existing conversations keep working.");
|
|
1668
|
+
} else if (action === "default") {
|
|
1669
|
+
const preset = setDefaultPreset(positional(positionals, 0, "name|id"));
|
|
1670
|
+
io.log(`"${preset.name}" is now the default. New chats start with it.`);
|
|
1671
|
+
} else if (action === "list") {
|
|
1672
|
+
const defaultId = getDefaultPreset()?.id;
|
|
1673
|
+
for (const p of listPresets()) {
|
|
1674
|
+
const override = p.contextWindow ? " (override)" : "";
|
|
1675
|
+
const isDefault = p.id === defaultId ? " default" : "";
|
|
1676
|
+
io.log(`${p.name}\t${presetSource(p.provider, p.model)}\tcontext ${formatTokens(effectiveContextWindow(p))}${override}\t${p.id}${isDefault}`);
|
|
1677
|
+
}
|
|
1678
|
+
} else fail$1("usage: nolune preset add|edit|rm|default|list");
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
case "profile":
|
|
1682
|
+
requireInit();
|
|
1683
|
+
return profileCommand(io, action, rest);
|
|
1684
|
+
case "skill": {
|
|
1685
|
+
const { values, positionals } = parseArgs({
|
|
1686
|
+
args: rest,
|
|
1687
|
+
allowPositionals: true,
|
|
1688
|
+
options: {
|
|
1689
|
+
description: {
|
|
1690
|
+
type: "string",
|
|
1691
|
+
short: "d"
|
|
1692
|
+
},
|
|
1693
|
+
profile: { type: "string" },
|
|
1694
|
+
global: { type: "boolean" }
|
|
1695
|
+
}
|
|
1696
|
+
});
|
|
1697
|
+
if (action === "new") {
|
|
1698
|
+
const name = positional(positionals, 0, "name");
|
|
1699
|
+
const slug = values.global ? null : resolveProfileSlug(io, values.profile);
|
|
1700
|
+
const dir = slug ? profileSkillsDir(slug) : paths.globalSkills;
|
|
1701
|
+
const location = createSkill(dir, name, values.description ?? "");
|
|
1702
|
+
io.log(`Created ${location}`);
|
|
1703
|
+
if (slug && getProfileBySlug(slug)?.disabledSkills.includes(name)) io.log(`"${name}" is turned off in this profile, so new chats won't list it. Turn it on with \`nolune skill enable ${name}\`.`);
|
|
1704
|
+
} else if (action === "list") {
|
|
1705
|
+
const slug = values.profile || io.env.NOLUNE_PROFILE;
|
|
1706
|
+
const profile = slug ? getProfileBySlug(slug) : void 0;
|
|
1707
|
+
const { skills, warnings } = listProfileSkills(slug ? profileSkillsDir(slug) : "/nonexistent", profile?.disabledSkills ?? []);
|
|
1708
|
+
for (const s of skills) {
|
|
1709
|
+
const state = profile ? `${s.enabled ? "on" : "off"}\t` : "";
|
|
1710
|
+
io.log(`${s.name}\t${state}${s.scope}\t~${s.tokens} tokens\t${s.location}\n ${s.description}`);
|
|
1711
|
+
}
|
|
1712
|
+
for (const w of warnings) io.error(`warning: ${w}`);
|
|
1713
|
+
if (!skills.length) io.log("No skills.");
|
|
1714
|
+
else if (profile) {
|
|
1715
|
+
const on = skills.filter((s) => s.enabled);
|
|
1716
|
+
const tokens = on.reduce((n, s) => n + s.tokens, 0);
|
|
1717
|
+
io.log(`\n${on.length} of ${skills.length} on in ${profile.name}, about ${formatTokens(tokens)} tokens in every new chat.`);
|
|
1718
|
+
}
|
|
1719
|
+
} else if (action === "enable" || action === "disable") {
|
|
1720
|
+
if (values.global) fail$1("skills are turned on and off per profile. Pass --profile <slug>.");
|
|
1721
|
+
const profile = getProfileBySlug(resolveProfileSlug(io, values.profile));
|
|
1722
|
+
if (!positionals.length) fail$1("missing <name>. See `nolune help`.");
|
|
1723
|
+
const known = new Set(scanSkills(profileSkillsDir(profile.slug)).skills.map((s) => s.name));
|
|
1724
|
+
const unknown = positionals.filter((name) => !known.has(name));
|
|
1725
|
+
if (unknown.length) fail$1(`no skill named ${unknown.join(", ")}. See \`nolune skill list\`.`);
|
|
1726
|
+
setSkillsEnabled(profile.id, positionals, action === "enable");
|
|
1727
|
+
io.log(`${positionals.join(", ")}: ${action === "enable" ? "on" : "off"} for new chats in ${profile.name}.`);
|
|
1728
|
+
} else fail$1("usage: nolune skill new|list|enable|disable");
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
case "trigger":
|
|
1732
|
+
requireInit();
|
|
1733
|
+
return triggerCommand(io, action, rest);
|
|
1734
|
+
case "memory":
|
|
1735
|
+
requireInit();
|
|
1736
|
+
return memoryCommand(io, argv.slice(1));
|
|
1737
|
+
case "soul":
|
|
1738
|
+
requireInit();
|
|
1739
|
+
return soulCommand(io, argv.slice(1));
|
|
1740
|
+
case "wake":
|
|
1741
|
+
requireInit();
|
|
1742
|
+
return wakeCommand(io, argv.slice(1));
|
|
1743
|
+
case "agent":
|
|
1744
|
+
requireInit();
|
|
1745
|
+
return agentCommand(io, action, rest);
|
|
1746
|
+
case "generate": return generateCommand(io, action, rest);
|
|
1747
|
+
case "view": {
|
|
1748
|
+
const dir = io.env.NOLUNE_VIEW_DIR;
|
|
1749
|
+
if (!dir) fail$1("`nolune view` only works in the agent's commands: it shows images to the agent.");
|
|
1750
|
+
const files = argv.slice(1);
|
|
1751
|
+
if (!files.length) fail$1("usage: nolune view <image>...");
|
|
1752
|
+
let failed = false;
|
|
1753
|
+
for (const [i, file] of files.entries()) try {
|
|
1754
|
+
io.log(await viewImage(file, dir, io.cwd));
|
|
1755
|
+
} catch (err) {
|
|
1756
|
+
failed = true;
|
|
1757
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1758
|
+
io.error(`nolune: can't show ${file}: ${message.replace(/\.+$/, "")}.`);
|
|
1759
|
+
if (err instanceof ViewLimitError) {
|
|
1760
|
+
const rest = files.slice(i + 1);
|
|
1761
|
+
if (rest.length) io.error(`nolune: not shown either: ${rest.join(" ")}`);
|
|
1762
|
+
break;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
return failed ? 1 : 0;
|
|
1766
|
+
}
|
|
1767
|
+
default: fail$1(`unknown command "${group}". See \`nolune help\`.`);
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
//#endregion
|
|
1771
|
+
//#region packages/cli/src/serve.ts
|
|
1772
|
+
function isRun(message) {
|
|
1773
|
+
return message.type === "run" && Array.isArray(message.argv) && message.argv.every((arg) => typeof arg === "string") && typeof message.cwd === "string" && isAbsolute(message.cwd) && typeof message.env === "object" && message.env !== null;
|
|
1774
|
+
}
|
|
1775
|
+
/** One connection, one command. The client hanging up stops it (io.signal). */
|
|
1776
|
+
function handle$1(socket, run) {
|
|
1777
|
+
const abort = new AbortController();
|
|
1778
|
+
let started = false;
|
|
1779
|
+
let answerStdin;
|
|
1780
|
+
let stdin;
|
|
1781
|
+
socket.on("error", () => {});
|
|
1782
|
+
socket.on("close", () => abort.abort(/* @__PURE__ */ new Error("the command was stopped")));
|
|
1783
|
+
receive(socket, (message) => {
|
|
1784
|
+
if (message.type === "stdin") {
|
|
1785
|
+
answerStdin?.(typeof message.data === "string" ? message.data : "");
|
|
1786
|
+
return;
|
|
1787
|
+
}
|
|
1788
|
+
if (started || !isRun(message)) {
|
|
1789
|
+
socket.destroy();
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
started = true;
|
|
1793
|
+
if (message.protocol !== 1 || LOCAL_ONLY.has(message.argv[0] ?? "")) {
|
|
1794
|
+
send(socket, {
|
|
1795
|
+
type: "decline",
|
|
1796
|
+
reason: message.protocol !== 1 ? "another protocol version" : "runs locally"
|
|
1797
|
+
});
|
|
1798
|
+
socket.end();
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
const io = createIo({
|
|
1802
|
+
stdout: (data) => send(socket, {
|
|
1803
|
+
type: "stdout",
|
|
1804
|
+
data
|
|
1805
|
+
}),
|
|
1806
|
+
stderr: (data) => send(socket, {
|
|
1807
|
+
type: "stderr",
|
|
1808
|
+
data
|
|
1809
|
+
}),
|
|
1810
|
+
env: message.env,
|
|
1811
|
+
cwd: message.cwd,
|
|
1812
|
+
stdinIsTTY: false,
|
|
1813
|
+
readStdin: () => stdin ??= new Promise((resolve, reject) => {
|
|
1814
|
+
if (abort.signal.aborted) return reject(abort.signal.reason);
|
|
1815
|
+
answerStdin = resolve;
|
|
1816
|
+
abort.signal.addEventListener("abort", () => reject(abort.signal.reason), { once: true });
|
|
1817
|
+
send(socket, { type: "stdin" });
|
|
1818
|
+
}),
|
|
1819
|
+
signal: abort.signal
|
|
1820
|
+
});
|
|
1821
|
+
run(message.argv, io).catch((err) => {
|
|
1822
|
+
console.error("[nolune] a CLI command failed in the gateway:", err);
|
|
1823
|
+
return 1;
|
|
1824
|
+
}).then((code) => {
|
|
1825
|
+
send(socket, {
|
|
1826
|
+
type: "exit",
|
|
1827
|
+
code
|
|
1828
|
+
});
|
|
1829
|
+
socket.end();
|
|
1830
|
+
});
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
/** Whether something already answers on the socket: another gateway on the same nolune home. */
|
|
1834
|
+
function answers(socketPath) {
|
|
1835
|
+
return new Promise((resolve) => {
|
|
1836
|
+
const probe = connect(socketPath);
|
|
1837
|
+
probe.on("connect", () => {
|
|
1838
|
+
probe.destroy();
|
|
1839
|
+
resolve(true);
|
|
1840
|
+
});
|
|
1841
|
+
probe.on("error", () => resolve(false));
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Serves `nolune` commands on the socket, calling `run()` for the code to run each with (the latest,
|
|
1846
|
+
* after `pnpm dev` reloads it). Resolves with the server, or null when another gateway already
|
|
1847
|
+
* serves this nolune home or the socket can't be made; the CLI then runs commands itself.
|
|
1848
|
+
*/
|
|
1849
|
+
async function serveCommands(socketPath, run) {
|
|
1850
|
+
if (await answers(socketPath)) {
|
|
1851
|
+
console.log(`[nolune] another gateway already runs nolune commands on ${socketPath}`);
|
|
1852
|
+
return null;
|
|
1853
|
+
}
|
|
1854
|
+
const server = createServer((socket) => handle$1(socket, run()));
|
|
1855
|
+
try {
|
|
1856
|
+
const dir = dirname(socketPath);
|
|
1857
|
+
mkdirSync(dir, {
|
|
1858
|
+
recursive: true,
|
|
1859
|
+
mode: 448
|
|
1860
|
+
});
|
|
1861
|
+
chmodSync(dir, 448);
|
|
1862
|
+
rmSync(socketPath, { force: true });
|
|
1863
|
+
await new Promise((resolve, reject) => {
|
|
1864
|
+
server.once("error", reject);
|
|
1865
|
+
server.listen(socketPath, () => {
|
|
1866
|
+
server.off("error", reject);
|
|
1867
|
+
resolve();
|
|
1868
|
+
});
|
|
1869
|
+
});
|
|
1870
|
+
chmodSync(socketPath, 384);
|
|
1871
|
+
} catch (err) {
|
|
1872
|
+
console.error(`[nolune] couldn't run nolune commands on ${socketPath}; the CLI runs them itself:`, err);
|
|
1873
|
+
server.close();
|
|
1874
|
+
return null;
|
|
1875
|
+
}
|
|
1876
|
+
server.on("error", (err) => console.error("[nolune] the nolune command socket failed:", err));
|
|
1877
|
+
server.unref();
|
|
1878
|
+
return server;
|
|
1879
|
+
}
|
|
1880
|
+
var holder = globalThis;
|
|
1881
|
+
/**
|
|
1882
|
+
* The gateway's own command socket (paths.cliSocket), once per process. When `pnpm dev` reloads
|
|
1883
|
+
* this module, the running server keeps going with the new code.
|
|
1884
|
+
*/
|
|
1885
|
+
function serveGatewayCommands() {
|
|
1886
|
+
if (holder.__noluneCommands) {
|
|
1887
|
+
holder.__noluneCommands.run = runCli;
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
const state = holder.__noluneCommands = { run: runCli };
|
|
1891
|
+
serveCommands(paths.cliSocket, () => state.run).then((server) => {
|
|
1892
|
+
if (!server) return;
|
|
1893
|
+
const connections = /* @__PURE__ */ new Set();
|
|
1894
|
+
server.on("connection", (socket) => {
|
|
1895
|
+
connections.add(socket);
|
|
1896
|
+
socket.on("close", () => connections.delete(socket));
|
|
1897
|
+
});
|
|
1898
|
+
process.once("sveltekit:shutdown", () => {
|
|
1899
|
+
server.close();
|
|
1900
|
+
for (const socket of connections) socket.destroy();
|
|
1901
|
+
});
|
|
1902
|
+
process.once("exit", () => rmSync(paths.cliSocket, { force: true }));
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
//#endregion
|
|
1906
|
+
//#region src/hooks.server.ts
|
|
1907
|
+
var init = () => {
|
|
1908
|
+
installCliShim();
|
|
1909
|
+
recoverAfterRestart();
|
|
1910
|
+
startScheduler();
|
|
1911
|
+
serveGatewayCommands();
|
|
1912
|
+
};
|
|
1913
|
+
/** Webhook URLs carry their own secret token instead of a login. */
|
|
1914
|
+
var PUBLIC_PATHS = [
|
|
1915
|
+
"/login",
|
|
1916
|
+
"/api/auth/",
|
|
1917
|
+
"/api/hooks/"
|
|
1918
|
+
];
|
|
1919
|
+
/**
|
|
1920
|
+
* `nolune start` raises adapter-node's body limit so attachments can be uploaded. Every other route
|
|
1921
|
+
* keeps a small one, including the public ones that read a body before checking anything.
|
|
1922
|
+
*/
|
|
1923
|
+
var UPLOAD_PATH = /^\/api\/p\/[^/]+\/uploads$/;
|
|
1924
|
+
var MAX_BODY_BYTES = 1048576;
|
|
1925
|
+
function bodyTooLarge(request, path) {
|
|
1926
|
+
if (UPLOAD_PATH.test(path)) return false;
|
|
1927
|
+
const length = request.headers.get("content-length");
|
|
1928
|
+
if (length === null) return request.headers.has("transfer-encoding");
|
|
1929
|
+
return Number(length) > MAX_BODY_BYTES;
|
|
1930
|
+
}
|
|
1931
|
+
var handle = async ({ event, resolve }) => {
|
|
1932
|
+
const { language } = parsePreferences(event.cookies.get(PREFERENCES_COOKIE));
|
|
1933
|
+
const locale = language === "auto" ? matchLocale(event.request.headers.get("accept-language")) : language;
|
|
1934
|
+
event.locals.locale = locale;
|
|
1935
|
+
if (bodyTooLarge(event.request, event.url.pathname)) error(413, "Request body too large");
|
|
1936
|
+
const auth = getAuth();
|
|
1937
|
+
const session = await auth.api.getSession({ headers: event.request.headers });
|
|
1938
|
+
if (session) {
|
|
1939
|
+
event.locals.session = session.session;
|
|
1940
|
+
event.locals.user = session.user;
|
|
1941
|
+
}
|
|
1942
|
+
const path = event.url.pathname;
|
|
1943
|
+
if (!event.locals.user && !PUBLIC_PATHS.some((p) => path === p || path.startsWith(p))) {
|
|
1944
|
+
if (path.startsWith("/api/")) error(401, translations(locale).m.errors.notSignedIn);
|
|
1945
|
+
redirect(303, "/login");
|
|
1946
|
+
}
|
|
1947
|
+
return svelteKitHandler({
|
|
1948
|
+
event,
|
|
1949
|
+
resolve: (event) => resolve(event, { transformPageChunk: ({ html }) => html.replace("%nolune.lang%", locale) }),
|
|
1950
|
+
auth,
|
|
1951
|
+
building
|
|
1952
|
+
});
|
|
1953
|
+
};
|
|
1954
|
+
|
|
1955
|
+
export { handle, init };
|
|
1956
|
+
//# sourceMappingURL=hooks.server.js-CA451orY.js.map
|