nolune 0.4.2 → 0.5.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.
Files changed (821) hide show
  1. package/DESIGN.md +646 -38
  2. package/README.md +21 -11
  3. package/dist/chunks/chunk-2Z3QOLXA.js +19934 -0
  4. package/dist/chunks/chunk-GVHJYXT4.js +114 -0
  5. package/dist/chunks/run-T6CARDLK.js +44015 -0
  6. package/dist/chunks/zod-EQ7NYDR4.js +524 -0
  7. package/dist/cli.js +2 -2
  8. package/package.json +1 -1
  9. package/packages/core/drizzle/0022_push_devices.sql +12 -0
  10. package/packages/core/drizzle/meta/0022_snapshot.json +2509 -0
  11. package/packages/core/drizzle/meta/_journal.json +7 -0
  12. package/packages/core/skills/generate-images/SKILL.md +7 -2
  13. package/packages/core/skills/nolune/SKILL.md +34 -8
  14. package/packages/web/build/client/_app/immutable/assets/0.DULk3KZs.css +2 -0
  15. package/packages/web/build/client/_app/immutable/assets/0.DULk3KZs.css.br +0 -0
  16. package/packages/web/build/client/_app/immutable/assets/0.DULk3KZs.css.gz +0 -0
  17. package/packages/web/build/client/_app/immutable/chunks/-T7ZeXhr.js +1 -0
  18. package/packages/web/build/client/_app/immutable/chunks/-T7ZeXhr.js.br +0 -0
  19. package/packages/web/build/client/_app/immutable/chunks/-T7ZeXhr.js.gz +0 -0
  20. package/packages/web/build/client/_app/immutable/chunks/-m4jXt43.js +1 -0
  21. package/packages/web/build/client/_app/immutable/chunks/-m4jXt43.js.br +0 -0
  22. package/packages/web/build/client/_app/immutable/chunks/-m4jXt43.js.gz +0 -0
  23. package/packages/web/build/client/_app/immutable/chunks/-t-e-QXp.js +1 -0
  24. package/packages/web/build/client/_app/immutable/chunks/-t-e-QXp.js.br +0 -0
  25. package/packages/web/build/client/_app/immutable/chunks/-t-e-QXp.js.gz +0 -0
  26. package/packages/web/build/client/_app/immutable/chunks/6KlB8cSf.js +5 -0
  27. package/packages/web/build/client/_app/immutable/chunks/6KlB8cSf.js.br +0 -0
  28. package/packages/web/build/client/_app/immutable/chunks/6KlB8cSf.js.gz +0 -0
  29. package/packages/web/build/client/_app/immutable/chunks/B3B6Llhi.js +1 -0
  30. package/packages/web/build/client/_app/immutable/chunks/B3B6Llhi.js.br +0 -0
  31. package/packages/web/build/client/_app/immutable/chunks/B3B6Llhi.js.gz +0 -0
  32. package/packages/web/build/client/_app/immutable/chunks/BCGP0kNs.js +1 -0
  33. package/packages/web/build/client/_app/immutable/chunks/BCGP0kNs.js.br +0 -0
  34. package/packages/web/build/client/_app/immutable/chunks/BCGP0kNs.js.gz +0 -0
  35. package/packages/web/build/client/_app/immutable/chunks/BFZMinfc.js +1 -0
  36. package/packages/web/build/client/_app/immutable/chunks/BFZMinfc.js.br +4 -0
  37. package/packages/web/build/client/_app/immutable/chunks/BFZMinfc.js.gz +0 -0
  38. package/packages/web/build/client/_app/immutable/chunks/BKUKYer_.js +1 -0
  39. package/packages/web/build/client/_app/immutable/chunks/BKUKYer_.js.br +0 -0
  40. package/packages/web/build/client/_app/immutable/chunks/BKUKYer_.js.gz +0 -0
  41. package/packages/web/build/client/_app/immutable/chunks/BWdxhuCi.js +1 -0
  42. package/packages/web/build/client/_app/immutable/chunks/BWdxhuCi.js.br +0 -0
  43. package/packages/web/build/client/_app/immutable/chunks/BWdxhuCi.js.gz +0 -0
  44. package/packages/web/build/client/_app/immutable/chunks/BWmU4kw5.js +1 -0
  45. package/packages/web/build/client/_app/immutable/chunks/BWmU4kw5.js.br +0 -0
  46. package/packages/web/build/client/_app/immutable/chunks/BWmU4kw5.js.gz +0 -0
  47. package/packages/web/build/client/_app/immutable/chunks/BZj87B8z.js +1 -0
  48. package/packages/web/build/client/_app/immutable/chunks/BZj87B8z.js.br +0 -0
  49. package/packages/web/build/client/_app/immutable/chunks/BZj87B8z.js.gz +0 -0
  50. package/packages/web/build/client/_app/immutable/chunks/BcdKO4vp.js +1 -0
  51. package/packages/web/build/client/_app/immutable/chunks/BcdKO4vp.js.br +0 -0
  52. package/packages/web/build/client/_app/immutable/chunks/BcdKO4vp.js.gz +0 -0
  53. package/packages/web/build/client/_app/immutable/chunks/Bko4hWj0.js +1 -0
  54. package/packages/web/build/client/_app/immutable/chunks/Bko4hWj0.js.br +0 -0
  55. package/packages/web/build/client/_app/immutable/chunks/Bko4hWj0.js.gz +0 -0
  56. package/packages/web/build/client/_app/immutable/chunks/BlA-9xoX.js +1 -0
  57. package/packages/web/build/client/_app/immutable/chunks/BlA-9xoX.js.br +0 -0
  58. package/packages/web/build/client/_app/immutable/chunks/BlA-9xoX.js.gz +0 -0
  59. package/packages/web/build/client/_app/immutable/chunks/Bs1LQH6_.js +1 -0
  60. package/packages/web/build/client/_app/immutable/chunks/Bs1LQH6_.js.br +0 -0
  61. package/packages/web/build/client/_app/immutable/chunks/Bs1LQH6_.js.gz +0 -0
  62. package/packages/web/build/client/_app/immutable/chunks/BzgcyIJE.js +318 -0
  63. package/packages/web/build/client/_app/immutable/chunks/BzgcyIJE.js.br +0 -0
  64. package/packages/web/build/client/_app/immutable/chunks/BzgcyIJE.js.gz +0 -0
  65. package/packages/web/build/client/_app/immutable/chunks/C4cO3_55.js +1 -0
  66. package/packages/web/build/client/_app/immutable/chunks/C4cO3_55.js.br +0 -0
  67. package/packages/web/build/client/_app/immutable/chunks/C4cO3_55.js.gz +0 -0
  68. package/packages/web/build/client/_app/immutable/chunks/C6Tl8wAY.js +1 -0
  69. package/packages/web/build/client/_app/immutable/chunks/C6Tl8wAY.js.br +0 -0
  70. package/packages/web/build/client/_app/immutable/chunks/C6Tl8wAY.js.gz +0 -0
  71. package/packages/web/build/client/_app/immutable/chunks/CCmHEbQf.js +1 -0
  72. package/packages/web/build/client/_app/immutable/chunks/CCmHEbQf.js.br +0 -0
  73. package/packages/web/build/client/_app/immutable/chunks/CCmHEbQf.js.gz +0 -0
  74. package/packages/web/build/client/_app/immutable/chunks/CIF1K2JS.js +1 -0
  75. package/packages/web/build/client/_app/immutable/chunks/CIF1K2JS.js.br +1 -0
  76. package/packages/web/build/client/_app/immutable/chunks/CIF1K2JS.js.gz +0 -0
  77. package/packages/web/build/client/_app/immutable/chunks/CJc_Xs9A.js +1 -0
  78. package/packages/web/build/client/_app/immutable/chunks/CJc_Xs9A.js.br +0 -0
  79. package/packages/web/build/client/_app/immutable/chunks/CJc_Xs9A.js.gz +0 -0
  80. package/packages/web/build/client/_app/immutable/chunks/CNP2DAoA.js +1 -0
  81. package/packages/web/build/client/_app/immutable/chunks/CNP2DAoA.js.br +0 -0
  82. package/packages/web/build/client/_app/immutable/chunks/CNP2DAoA.js.gz +0 -0
  83. package/packages/web/build/client/_app/immutable/chunks/CQaGupfC.js +1 -0
  84. package/packages/web/build/client/_app/immutable/chunks/CQaGupfC.js.br +0 -0
  85. package/packages/web/build/client/_app/immutable/chunks/CQaGupfC.js.gz +0 -0
  86. package/packages/web/build/client/_app/immutable/chunks/CSNLU-Se.js +1 -0
  87. package/packages/web/build/client/_app/immutable/chunks/CSNLU-Se.js.br +0 -0
  88. package/packages/web/build/client/_app/immutable/chunks/CSNLU-Se.js.gz +0 -0
  89. package/packages/web/build/client/_app/immutable/chunks/CYw-rJle.js +1 -0
  90. package/packages/web/build/client/_app/immutable/chunks/CYw-rJle.js.br +0 -0
  91. package/packages/web/build/client/_app/immutable/chunks/CYw-rJle.js.gz +0 -0
  92. package/packages/web/build/client/_app/immutable/chunks/CfX0J3Px.js +1 -0
  93. package/packages/web/build/client/_app/immutable/chunks/CfX0J3Px.js.br +0 -0
  94. package/packages/web/build/client/_app/immutable/chunks/CfX0J3Px.js.gz +0 -0
  95. package/packages/web/build/client/_app/immutable/chunks/CmdxZV_y.js +1 -0
  96. package/packages/web/build/client/_app/immutable/chunks/CmdxZV_y.js.br +0 -0
  97. package/packages/web/build/client/_app/immutable/chunks/CmdxZV_y.js.gz +0 -0
  98. package/packages/web/build/client/_app/immutable/chunks/CvOA2Iag.js +1 -0
  99. package/packages/web/build/client/_app/immutable/chunks/CvOA2Iag.js.br +0 -0
  100. package/packages/web/build/client/_app/immutable/chunks/CvOA2Iag.js.gz +0 -0
  101. package/packages/web/build/client/_app/immutable/chunks/D0gG26QQ.js +1 -0
  102. package/packages/web/build/client/_app/immutable/chunks/D0gG26QQ.js.br +0 -0
  103. package/packages/web/build/client/_app/immutable/chunks/D0gG26QQ.js.gz +0 -0
  104. package/packages/web/build/client/_app/immutable/chunks/D6PEWnLY.js +1 -0
  105. package/packages/web/build/client/_app/immutable/chunks/D6PEWnLY.js.br +0 -0
  106. package/packages/web/build/client/_app/immutable/chunks/D6PEWnLY.js.gz +0 -0
  107. package/packages/web/build/client/_app/immutable/chunks/D8bTY0ZV.js +2 -0
  108. package/packages/web/build/client/_app/immutable/chunks/D8bTY0ZV.js.br +0 -0
  109. package/packages/web/build/client/_app/immutable/chunks/D8bTY0ZV.js.gz +0 -0
  110. package/packages/web/build/client/_app/immutable/chunks/DGKGn3_0.js +1 -0
  111. package/packages/web/build/client/_app/immutable/chunks/DGKGn3_0.js.br +0 -0
  112. package/packages/web/build/client/_app/immutable/chunks/DGKGn3_0.js.gz +0 -0
  113. package/packages/web/build/client/_app/immutable/chunks/DKl5azdQ.js +1 -0
  114. package/packages/web/build/client/_app/immutable/chunks/DKl5azdQ.js.br +0 -0
  115. package/packages/web/build/client/_app/immutable/chunks/DKl5azdQ.js.gz +0 -0
  116. package/packages/web/build/client/_app/immutable/chunks/DPZkYMz9.js +1 -0
  117. package/packages/web/build/client/_app/immutable/chunks/DPZkYMz9.js.br +0 -0
  118. package/packages/web/build/client/_app/immutable/chunks/DPZkYMz9.js.gz +0 -0
  119. package/packages/web/build/client/_app/immutable/chunks/DPgw3MzI.js +1 -0
  120. package/packages/web/build/client/_app/immutable/chunks/DPgw3MzI.js.br +3 -0
  121. package/packages/web/build/client/_app/immutable/chunks/DPgw3MzI.js.gz +0 -0
  122. package/packages/web/build/client/_app/immutable/chunks/DSVv-e0J.js +1 -0
  123. package/packages/web/build/client/_app/immutable/chunks/DSVv-e0J.js.br +0 -0
  124. package/packages/web/build/client/_app/immutable/chunks/DSVv-e0J.js.gz +0 -0
  125. package/packages/web/build/client/_app/immutable/chunks/DXdes0UR.js +1 -0
  126. package/packages/web/build/client/_app/immutable/chunks/DXdes0UR.js.br +0 -0
  127. package/packages/web/build/client/_app/immutable/chunks/DXdes0UR.js.gz +0 -0
  128. package/packages/web/build/client/_app/immutable/chunks/DYmn9wN5.js +1 -0
  129. package/packages/web/build/client/_app/immutable/chunks/DYmn9wN5.js.br +0 -0
  130. package/packages/web/build/client/_app/immutable/chunks/DYmn9wN5.js.gz +0 -0
  131. package/packages/web/build/client/_app/immutable/chunks/Dc0QudS7.js +1 -0
  132. package/packages/web/build/client/_app/immutable/chunks/Dc0QudS7.js.br +0 -0
  133. package/packages/web/build/client/_app/immutable/chunks/Dc0QudS7.js.gz +0 -0
  134. package/packages/web/build/client/_app/immutable/chunks/DfP_G-hn.js +1 -0
  135. package/packages/web/build/client/_app/immutable/chunks/DfP_G-hn.js.br +0 -0
  136. package/packages/web/build/client/_app/immutable/chunks/DfP_G-hn.js.gz +0 -0
  137. package/packages/web/build/client/_app/immutable/chunks/Dnh1jMGS.js +1 -0
  138. package/packages/web/build/client/_app/immutable/chunks/Dnh1jMGS.js.br +0 -0
  139. package/packages/web/build/client/_app/immutable/chunks/Dnh1jMGS.js.gz +0 -0
  140. package/packages/web/build/client/_app/immutable/chunks/DyPIfbpZ.js +1 -0
  141. package/packages/web/build/client/_app/immutable/chunks/DyPIfbpZ.js.br +0 -0
  142. package/packages/web/build/client/_app/immutable/chunks/DyPIfbpZ.js.gz +0 -0
  143. package/packages/web/build/client/_app/immutable/chunks/FhfC59KT.js +31 -0
  144. package/packages/web/build/client/_app/immutable/chunks/FhfC59KT.js.br +0 -0
  145. package/packages/web/build/client/_app/immutable/chunks/FhfC59KT.js.gz +0 -0
  146. package/packages/web/build/client/_app/immutable/chunks/Gj_6ZTkx.js +1 -0
  147. package/packages/web/build/client/_app/immutable/chunks/Gj_6ZTkx.js.br +0 -0
  148. package/packages/web/build/client/_app/immutable/chunks/Gj_6ZTkx.js.gz +0 -0
  149. package/packages/web/build/client/_app/immutable/chunks/Hzat7i06.js +1 -0
  150. package/packages/web/build/client/_app/immutable/chunks/Hzat7i06.js.br +0 -0
  151. package/packages/web/build/client/_app/immutable/chunks/Hzat7i06.js.gz +0 -0
  152. package/packages/web/build/client/_app/immutable/chunks/MVtmBSNF.js +67 -0
  153. package/packages/web/build/client/_app/immutable/chunks/MVtmBSNF.js.br +0 -0
  154. package/packages/web/build/client/_app/immutable/chunks/MVtmBSNF.js.gz +0 -0
  155. package/packages/web/build/client/_app/immutable/chunks/NtbSeYL-.js +1 -0
  156. package/packages/web/build/client/_app/immutable/chunks/NtbSeYL-.js.br +0 -0
  157. package/packages/web/build/client/_app/immutable/chunks/NtbSeYL-.js.gz +0 -0
  158. package/packages/web/build/client/_app/immutable/chunks/VRhCLClG.js +1 -0
  159. package/packages/web/build/client/_app/immutable/chunks/VRhCLClG.js.br +0 -0
  160. package/packages/web/build/client/_app/immutable/chunks/VRhCLClG.js.gz +0 -0
  161. package/packages/web/build/client/_app/immutable/chunks/WW5jjSM9.js +9 -0
  162. package/packages/web/build/client/_app/immutable/chunks/WW5jjSM9.js.br +0 -0
  163. package/packages/web/build/client/_app/immutable/chunks/WW5jjSM9.js.gz +0 -0
  164. package/packages/web/build/client/_app/immutable/chunks/ZpFlM0Kw.js +1 -0
  165. package/packages/web/build/client/_app/immutable/chunks/ZpFlM0Kw.js.br +0 -0
  166. package/packages/web/build/client/_app/immutable/chunks/ZpFlM0Kw.js.gz +0 -0
  167. package/packages/web/build/client/_app/immutable/chunks/_Qz9RYYh.js +1 -0
  168. package/packages/web/build/client/_app/immutable/chunks/_Qz9RYYh.js.br +0 -0
  169. package/packages/web/build/client/_app/immutable/chunks/_Qz9RYYh.js.gz +0 -0
  170. package/packages/web/build/client/_app/immutable/chunks/cDcNOj8_.js +5 -0
  171. package/packages/web/build/client/_app/immutable/chunks/cDcNOj8_.js.br +0 -0
  172. package/packages/web/build/client/_app/immutable/chunks/cDcNOj8_.js.gz +0 -0
  173. package/packages/web/build/client/_app/immutable/chunks/e3XXXJrc.js +1 -0
  174. package/packages/web/build/client/_app/immutable/chunks/e3XXXJrc.js.br +0 -0
  175. package/packages/web/build/client/_app/immutable/chunks/e3XXXJrc.js.gz +0 -0
  176. package/packages/web/build/client/_app/immutable/chunks/ecw0Iv8U.js +1 -0
  177. package/packages/web/build/client/_app/immutable/chunks/ecw0Iv8U.js.br +0 -0
  178. package/packages/web/build/client/_app/immutable/chunks/ecw0Iv8U.js.gz +0 -0
  179. package/packages/web/build/client/_app/immutable/chunks/elzEok9o.js +1 -0
  180. package/packages/web/build/client/_app/immutable/chunks/elzEok9o.js.br +0 -0
  181. package/packages/web/build/client/_app/immutable/chunks/elzEok9o.js.gz +0 -0
  182. package/packages/web/build/client/_app/immutable/chunks/jnnHsUzT.js +1 -0
  183. package/packages/web/build/client/_app/immutable/chunks/jnnHsUzT.js.br +0 -0
  184. package/packages/web/build/client/_app/immutable/chunks/jnnHsUzT.js.gz +0 -0
  185. package/packages/web/build/client/_app/immutable/chunks/mlLGBvD8.js +1 -0
  186. package/packages/web/build/client/_app/immutable/chunks/mlLGBvD8.js.br +0 -0
  187. package/packages/web/build/client/_app/immutable/chunks/mlLGBvD8.js.gz +0 -0
  188. package/packages/web/build/client/_app/immutable/chunks/zvVYLG7o.js +1 -0
  189. package/packages/web/build/client/_app/immutable/chunks/zvVYLG7o.js.br +0 -0
  190. package/packages/web/build/client/_app/immutable/chunks/zvVYLG7o.js.gz +0 -0
  191. package/packages/web/build/client/_app/immutable/entry/app.wrMwybtS.js +2 -0
  192. package/packages/web/build/client/_app/immutable/entry/app.wrMwybtS.js.br +0 -0
  193. package/packages/web/build/client/_app/immutable/entry/app.wrMwybtS.js.gz +0 -0
  194. package/packages/web/build/client/_app/immutable/entry/start.CPCGo-Uj.js +1 -0
  195. package/packages/web/build/client/_app/immutable/entry/start.CPCGo-Uj.js.br +0 -0
  196. package/packages/web/build/client/_app/immutable/entry/start.CPCGo-Uj.js.gz +0 -0
  197. package/packages/web/build/client/_app/immutable/nodes/0.C03cafHn.js +1 -0
  198. package/packages/web/build/client/_app/immutable/nodes/0.C03cafHn.js.br +0 -0
  199. package/packages/web/build/client/_app/immutable/nodes/0.C03cafHn.js.gz +0 -0
  200. package/packages/web/build/client/_app/immutable/nodes/1.CWR3XYMD.js +1 -0
  201. package/packages/web/build/client/_app/immutable/nodes/1.CWR3XYMD.js.br +0 -0
  202. package/packages/web/build/client/_app/immutable/nodes/1.CWR3XYMD.js.gz +0 -0
  203. package/packages/web/build/client/_app/immutable/nodes/10.qH98q4DH.js +1 -0
  204. package/packages/web/build/client/_app/immutable/nodes/10.qH98q4DH.js.br +0 -0
  205. package/packages/web/build/client/_app/immutable/nodes/10.qH98q4DH.js.gz +0 -0
  206. package/packages/web/build/client/_app/immutable/nodes/11.DI96zs4C.js +1 -0
  207. package/packages/web/build/client/_app/immutable/nodes/11.DI96zs4C.js.br +0 -0
  208. package/packages/web/build/client/_app/immutable/nodes/11.DI96zs4C.js.gz +0 -0
  209. package/packages/web/build/client/_app/immutable/nodes/12.N3gJTkel.js +4 -0
  210. package/packages/web/build/client/_app/immutable/nodes/12.N3gJTkel.js.br +0 -0
  211. package/packages/web/build/client/_app/immutable/nodes/12.N3gJTkel.js.gz +0 -0
  212. package/packages/web/build/client/_app/immutable/nodes/13.Dn1hta1C.js +1 -0
  213. package/packages/web/build/client/_app/immutable/nodes/13.Dn1hta1C.js.br +0 -0
  214. package/packages/web/build/client/_app/immutable/nodes/13.Dn1hta1C.js.gz +0 -0
  215. package/packages/web/build/client/_app/immutable/nodes/14.UtsylriY.js +1 -0
  216. package/packages/web/build/client/_app/immutable/nodes/14.UtsylriY.js.br +0 -0
  217. package/packages/web/build/client/_app/immutable/nodes/14.UtsylriY.js.gz +0 -0
  218. package/packages/web/build/client/_app/immutable/nodes/15.DuVSd8ZF.js +2 -0
  219. package/packages/web/build/client/_app/immutable/nodes/15.DuVSd8ZF.js.br +0 -0
  220. package/packages/web/build/client/_app/immutable/nodes/15.DuVSd8ZF.js.gz +0 -0
  221. package/packages/web/build/client/_app/immutable/nodes/16.DSoLdBKL.js +1 -0
  222. package/packages/web/build/client/_app/immutable/nodes/16.DSoLdBKL.js.br +0 -0
  223. package/packages/web/build/client/_app/immutable/nodes/16.DSoLdBKL.js.gz +0 -0
  224. package/packages/web/build/client/_app/immutable/nodes/17.D9YL6jeJ.js +1 -0
  225. package/packages/web/build/client/_app/immutable/nodes/17.D9YL6jeJ.js.br +0 -0
  226. package/packages/web/build/client/_app/immutable/nodes/17.D9YL6jeJ.js.gz +0 -0
  227. package/packages/web/build/client/_app/immutable/nodes/18.DoPpdnnh.js +46 -0
  228. package/packages/web/build/client/_app/immutable/nodes/18.DoPpdnnh.js.br +0 -0
  229. package/packages/web/build/client/_app/immutable/nodes/18.DoPpdnnh.js.gz +0 -0
  230. package/packages/web/build/client/_app/immutable/nodes/19.BvaulYxf.js +1 -0
  231. package/packages/web/build/client/_app/immutable/nodes/19.BvaulYxf.js.br +0 -0
  232. package/packages/web/build/client/_app/immutable/nodes/19.BvaulYxf.js.gz +0 -0
  233. package/packages/web/build/client/_app/immutable/nodes/2.ZqlN-6n5.js +1 -0
  234. package/packages/web/build/client/_app/immutable/nodes/2.ZqlN-6n5.js.br +0 -0
  235. package/packages/web/build/client/_app/immutable/nodes/2.ZqlN-6n5.js.gz +0 -0
  236. package/packages/web/build/client/_app/immutable/nodes/4.DJOvi0c1.js +2 -0
  237. package/packages/web/build/client/_app/immutable/nodes/4.DJOvi0c1.js.br +0 -0
  238. package/packages/web/build/client/_app/immutable/nodes/4.DJOvi0c1.js.gz +0 -0
  239. package/packages/web/build/client/_app/immutable/nodes/5.CAnPk4C8.js +1 -0
  240. package/packages/web/build/client/_app/immutable/nodes/5.CAnPk4C8.js.br +0 -0
  241. package/packages/web/build/client/_app/immutable/nodes/5.CAnPk4C8.js.gz +0 -0
  242. package/packages/web/build/client/_app/immutable/nodes/6.CIysiBab.js +1 -0
  243. package/packages/web/build/client/_app/immutable/nodes/6.CIysiBab.js.br +0 -0
  244. package/packages/web/build/client/_app/immutable/nodes/6.CIysiBab.js.gz +0 -0
  245. package/packages/web/build/client/_app/immutable/nodes/7.DuQJ21i5.js +2 -0
  246. package/packages/web/build/client/_app/immutable/nodes/7.DuQJ21i5.js.br +0 -0
  247. package/packages/web/build/client/_app/immutable/nodes/7.DuQJ21i5.js.gz +0 -0
  248. package/packages/web/build/client/_app/immutable/nodes/8._IrSFGxl.js +1 -0
  249. package/packages/web/build/client/_app/immutable/nodes/8._IrSFGxl.js.br +0 -0
  250. package/packages/web/build/client/_app/immutable/nodes/8._IrSFGxl.js.gz +0 -0
  251. package/packages/web/build/client/_app/immutable/nodes/9.BoILuwTb.js +1 -0
  252. package/packages/web/build/client/_app/immutable/nodes/9.BoILuwTb.js.br +0 -0
  253. package/packages/web/build/client/_app/immutable/nodes/9.BoILuwTb.js.gz +0 -0
  254. package/packages/web/build/client/_app/version.json +1 -1
  255. package/packages/web/build/client/_app/version.json.br +0 -0
  256. package/packages/web/build/client/_app/version.json.gz +0 -0
  257. package/packages/web/build/handler.js +4 -4
  258. package/packages/web/build/index.js +4 -4
  259. package/packages/web/build/server/chunks/chunks/AssistantAvatar.js-DGlsgi7z.js +294 -0
  260. package/packages/web/build/server/chunks/chunks/AvatarPicker.js-XTQF_UST.js +136 -0
  261. package/packages/web/build/server/chunks/chunks/Composer.js-C4Q5YhRX.js +333 -0
  262. package/packages/web/build/server/chunks/chunks/ComposerDock.js-CRI5LWWB.js +58 -0
  263. package/packages/web/build/server/chunks/chunks/CopyButton.js-SR984SrX.js +81 -0
  264. package/packages/web/build/server/chunks/chunks/DotGrid.js-CWRXVEb4.js +108 -0
  265. package/packages/web/build/server/chunks/chunks/MemoryChangeItem.js-B1-E6mZa.js +2588 -0
  266. package/packages/web/build/server/chunks/chunks/ModelMenu.js-BswEpZ7k.js +685 -0
  267. package/packages/web/build/server/chunks/chunks/MoveToFolderMenu.js-BdW9Uaat.js +288 -0
  268. package/packages/web/build/server/chunks/chunks/NewChatForm.js-CxYVWSbF.js +307 -0
  269. package/packages/web/build/server/chunks/chunks/NewFolderDialog.js-DV411psA.js +192 -0
  270. package/packages/web/build/server/chunks/chunks/Notifications.js-D7SKD3ep.js +763 -0
  271. package/packages/web/build/server/chunks/chunks/PageHeader.js-DB4EEFTc.js +59 -0
  272. package/packages/web/build/server/chunks/chunks/PlanUsageBars.js-D8Eleq6Q.js +112 -0
  273. package/packages/web/build/server/chunks/chunks/RenameFolderDialog.js-DSG_xVfk.js +258 -0
  274. package/packages/web/build/server/chunks/chunks/StepIcon.js-DpKQExeE.js +38 -0
  275. package/packages/web/build/server/chunks/chunks/TopBar.js-CkDZmzNy.js +34 -0
  276. package/packages/web/build/server/chunks/chunks/TypedText.js-DVJ5Mwz5.js +62 -0
  277. package/packages/web/build/server/chunks/chunks/UserAvatar.js-BsTLEA-P.js +24 -0
  278. package/packages/web/build/server/chunks/chunks/UserMenu.js-DqCTpnGv.js +1538 -0
  279. package/packages/web/build/server/chunks/chunks/access.js-Bc8_sZDj.js +40 -0
  280. package/packages/web/build/server/chunks/chunks/accounts.js-aR68_MW1.js +26 -0
  281. package/packages/web/build/server/chunks/chunks/alert-dialog.js-D3L83uTu.js +505 -0
  282. package/packages/web/build/server/chunks/chunks/auth.js-BHa-Asx6.js +20064 -0
  283. package/packages/web/build/server/chunks/chunks/badge.js-CjFqRIj1.js +38 -0
  284. package/packages/web/build/server/chunks/chunks/camera.js-D3gRnx0_.js +19 -0
  285. package/packages/web/build/server/chunks/chunks/check.js-CHv2s_6d.js +15 -0
  286. package/packages/web/build/server/chunks/chunks/chevron-left.js-BcvkQVtM.js +15 -0
  287. package/packages/web/build/server/chunks/chunks/chevron-right.js-DzLiifpv.js +15 -0
  288. package/packages/web/build/server/chunks/chunks/chevrons-up-down.js-BWbLBrI0.js +15 -0
  289. package/packages/web/build/server/chunks/chunks/client.js-CuuQ6sEm.js +120 -0
  290. package/packages/web/build/server/chunks/chunks/clock.js-C-HZL7Pg.js +19 -0
  291. package/packages/web/build/server/chunks/chunks/coerce.js--dAQMwMO.js +8477 -0
  292. package/packages/web/build/server/chunks/chunks/collapsible.js-Bsi7-LzP.js +410 -0
  293. package/packages/web/build/server/chunks/chunks/command.js-D1P6tWs_.js +2231 -0
  294. package/packages/web/build/server/chunks/chunks/dialog.js-CNQ9oO2i.js +544 -0
  295. package/packages/web/build/server/chunks/chunks/dist.js-BChjdQWw.js +600 -0
  296. package/packages/web/build/server/chunks/chunks/dist2.js-OGEwQhP2.js +347 -0
  297. package/packages/web/build/server/chunks/chunks/dist3.js-GCNglsxk.js +19547 -0
  298. package/packages/web/build/server/chunks/chunks/download.js-g5Zex0Ki.js +19 -0
  299. package/packages/web/build/server/chunks/chunks/dropdown-menu.js-ByTPapWV.js +2396 -0
  300. package/packages/web/build/server/chunks/chunks/eraser.js-BGsPXSVI.js +15 -0
  301. package/packages/web/build/server/chunks/chunks/factory.js-QXghIu-T.js +2344 -0
  302. package/packages/web/build/server/chunks/chunks/folder-input.js-BWEIyi5h.js +19 -0
  303. package/packages/web/build/server/chunks/chunks/forms.js-DXdLhuzV.js +4052 -0
  304. package/packages/web/build/server/chunks/chunks/hidden-input.js-D-pfBMGf.js +47 -0
  305. package/packages/web/build/server/chunks/chunks/i18n.js-BZZzsqBQ.js +7344 -0
  306. package/packages/web/build/server/chunks/chunks/internal2.js-B7E35Mx2.js +1135 -0
  307. package/packages/web/build/server/chunks/chunks/ios.js-l0sNRNKZ.js +2 -0
  308. package/packages/web/build/server/chunks/chunks/list-collapse.js-wr1x_75W.js +21 -0
  309. package/packages/web/build/server/chunks/chunks/message-circle.js-UIIxXLtJ.js +15 -0
  310. package/packages/web/build/server/chunks/chunks/moon-star.js-BOv5MTcx.js +34 -0
  311. package/packages/web/build/server/chunks/chunks/motion.js-Eb3VaPkg.js +224 -0
  312. package/packages/web/build/server/chunks/chunks/paths.js-1-UPDGPq.js +19 -0
  313. package/packages/web/build/server/chunks/chunks/pencil.js-6eXKzw_Q.js +15 -0
  314. package/packages/web/build/server/chunks/chunks/plan-usage.svelte.js-CuVZYFIH.js +27 -0
  315. package/packages/web/build/server/chunks/chunks/plus.js-hM6l9ZvI.js +15 -0
  316. package/packages/web/build/server/chunks/chunks/sdk.js-Jx-nl9-6.js +42918 -0
  317. package/packages/web/build/server/chunks/chunks/select.js-DgGiDgtK.js +1965 -0
  318. package/packages/web/build/server/chunks/chunks/sidebar.js-DUTrVu1q.js +1498 -0
  319. package/packages/web/build/server/chunks/chunks/square-pen.js-2IC3Ov9B.js +20 -0
  320. package/packages/web/build/server/chunks/chunks/src.js-Bu47UzGA.js +42241 -0
  321. package/packages/web/build/server/chunks/chunks/state.js-BDW-kCxK.js +67 -0
  322. package/packages/web/build/server/chunks/chunks/switch.js-CcCr8r73.js +283 -0
  323. package/packages/web/build/server/chunks/chunks/terminal.js-0nH1Urqj.js +15 -0
  324. package/packages/web/build/server/chunks/chunks/textarea.js-DrNDuzH0.js +25 -0
  325. package/packages/web/build/server/chunks/chunks/tooltip.js-BUHfS2s1.js +5863 -0
  326. package/packages/web/build/server/chunks/chunks/usage.js-CFIwucxh.js +35 -0
  327. package/packages/web/build/server/chunks/chunks/utils2.js-Bv3WV9KM.js +1167 -0
  328. package/packages/web/build/server/chunks/chunks/zod.js-C7kpxJbl.js +10352 -0
  329. package/packages/web/build/server/chunks/chunks/zod2.js-jXrj9_sA.js +5 -0
  330. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/commands/_server.ts.js-AiHWj9BP.js +56 -0
  331. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/compact/_server.ts.js-CdDWlnWx.js +54 -0
  332. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/continue/_server.ts.js-CIw_lPWw.js +47 -0
  333. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/effort/_server.ts.js-DJxJCFVo.js +48 -0
  334. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/events/_server.ts.js-GJSOUX2B.js +75 -0
  335. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/folder/_server.ts.js-acu3JmZw.js +56 -0
  336. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/media/_mediaId_/_server.ts.js-DmoV7hAM.js +53 -0
  337. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/messages/_server.ts.js-DPZ8sBEW.js +59 -0
  338. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/preset/_server.ts.js-D0h03np8.js +52 -0
  339. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/stop/_server.ts.js-qoemXIUD.js +45 -0
  340. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/tools/_server.ts.js-BZ7dOPSq.js +53 -0
  341. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/typing/_server.ts.js-RiPln9Z2.js +51 -0
  342. package/packages/web/build/server/chunks/entries/endpoints/api/card/changes/_id_/keep/_server.ts.js-R3a-E4ph.js +60 -0
  343. package/packages/web/build/server/chunks/entries/endpoints/api/chatgpt/sign-in/_server.ts.js-B_gczX7s.js +75 -0
  344. package/packages/web/build/server/chunks/entries/endpoints/api/events/_server.ts.js-BLUSf7eq.js +89 -0
  345. package/packages/web/build/server/chunks/entries/endpoints/api/hooks/_token_/_server.ts.js-Dn8ZB3CZ.js +51 -0
  346. package/packages/web/build/server/chunks/entries/endpoints/api/me/_server.ts.js-BigyjUb8.js +54 -0
  347. package/packages/web/build/server/chunks/entries/endpoints/api/me/picture/_server.ts.js-J8AVqX9B.js +62 -0
  348. package/packages/web/build/server/chunks/entries/endpoints/api/models/_server.ts.js-Cy70hos4.js +58 -0
  349. package/packages/web/build/server/chunks/entries/endpoints/api/nolune-plan/sign-in/_server.ts.js-BQBQLWMH.js +78 -0
  350. package/packages/web/build/server/chunks/entries/endpoints/api/nolune-plan/usage/_server.ts.js-CAHMJrv6.js +49 -0
  351. package/packages/web/build/server/chunks/entries/endpoints/api/notifications/_id_/continue/_server.ts.js-CYufOf7V.js +52 -0
  352. package/packages/web/build/server/chunks/entries/endpoints/api/notifications/_id_/dismiss/_server.ts.js-DDXgX8EQ.js +44 -0
  353. package/packages/web/build/server/chunks/entries/endpoints/api/notifications/clear/_server.ts.js-C8D5SaBB.js +45 -0
  354. package/packages/web/build/server/chunks/entries/endpoints/api/notifications/seen/_server.ts.js-CmFihzXG.js +45 -0
  355. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/folders/_folder_/files/_file_/_server.ts.js-DmB-SYRI.js +57 -0
  356. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/folders/_server.ts.js-DA2LPUyz.js +59 -0
  357. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/memory/_id_/undo/_server.ts.js-C1K08ki4.js +60 -0
  358. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/running/_server.ts.js-Chvh2Pw1.js +81 -0
  359. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/suggestions/_server.ts.js-B13MLE7D.js +55 -0
  360. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/templates/_id_/cover/_server.ts.js-CAPOP4Q3.js +61 -0
  361. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/uploads/_id_/_server.ts.js-CKja4UsR.js +46 -0
  362. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/uploads/_server.ts.js-D8-cbVFS.js +73 -0
  363. package/packages/web/build/server/chunks/entries/endpoints/api/pictures/_sha256_/_server.ts.js-C6OoKajT.js +56 -0
  364. package/packages/web/build/server/chunks/entries/endpoints/api/push/_server.ts.js-BruJg4gM.js +63 -0
  365. package/packages/web/build/server/chunks/entries/endpoints/logout/_server.ts.js-BHSczN0h.js +47 -0
  366. package/packages/web/build/server/chunks/entries/fallbacks/error.svelte.js-BJkanGNl.js +22 -0
  367. package/packages/web/build/server/chunks/entries/hooks.server.js-C4WGmbf7.js +3364 -0
  368. package/packages/web/build/server/chunks/entries/pages/_layout.server.ts.js-BN9m-MUo.js +41 -0
  369. package/packages/web/build/server/chunks/entries/pages/_layout.svelte.js-BhmPXj5G.js +77 -0
  370. package/packages/web/build/server/chunks/entries/pages/_page.server.ts.js-aD8-DxcB.js +27 -0
  371. package/packages/web/build/server/chunks/entries/pages/admin/_page.server.ts.js-DDWGphfE.js +414 -0
  372. package/packages/web/build/server/chunks/entries/pages/admin/_page.svelte.js-DrwxO8tQ.js +2716 -0
  373. package/packages/web/build/server/chunks/entries/pages/admin/people/_page.server.ts.js-XJCFN-l9.js +130 -0
  374. package/packages/web/build/server/chunks/entries/pages/admin/people/_page.svelte.js-er390AlN.js +574 -0
  375. package/packages/web/build/server/chunks/entries/pages/admin/services/_page.server.ts.js-DfIQKK2d.js +175 -0
  376. package/packages/web/build/server/chunks/entries/pages/admin/services/_page.svelte.js-perrcaXx.js +675 -0
  377. package/packages/web/build/server/chunks/entries/pages/card/_page.server.ts.js-UcD3iNh3.js +75 -0
  378. package/packages/web/build/server/chunks/entries/pages/card/_page.svelte.js-BNDNS7-g.js +372 -0
  379. package/packages/web/build/server/chunks/entries/pages/invite/_token_/_page.server.ts.js-B83TDko3.js +63 -0
  380. package/packages/web/build/server/chunks/entries/pages/invite/_token_/_page.svelte.js-CT2unkSi.js +125 -0
  381. package/packages/web/build/server/chunks/entries/pages/login/_page.server.ts.js--9KWSQLx.js +42 -0
  382. package/packages/web/build/server/chunks/entries/pages/login/_page.svelte.js-bf7wuA8L.js +76 -0
  383. package/packages/web/build/server/chunks/entries/pages/p/_slug_/_layout.server.ts.js-Dl3w-Y7I.js +53 -0
  384. package/packages/web/build/server/chunks/entries/pages/p/_slug_/_layout.svelte.js-CNCloQYf.js +1900 -0
  385. package/packages/web/build/server/chunks/entries/pages/p/_slug_/_page.server.ts.js-B3x-CZMx.js +79 -0
  386. package/packages/web/build/server/chunks/entries/pages/p/_slug_/_page.svelte.js-CnqzMupQ.js +153 -0
  387. package/packages/web/build/server/chunks/entries/pages/p/_slug_/automations/_page.server.ts.js-CV_m_HCg.js +269 -0
  388. package/packages/web/build/server/chunks/entries/pages/p/_slug_/automations/_page.svelte.js-DhY5s_40.js +414 -0
  389. package/packages/web/build/server/chunks/entries/pages/p/_slug_/c/_id_/_page.server.ts.js-wYKN6lb3.js +73 -0
  390. package/packages/web/build/server/chunks/entries/pages/p/_slug_/c/_id_/_page.svelte.js-xD1T9jMW.js +2755 -0
  391. package/packages/web/build/server/chunks/entries/pages/p/_slug_/f/_folder_/_page.server.ts.js-Gh78T_bH.js +103 -0
  392. package/packages/web/build/server/chunks/entries/pages/p/_slug_/f/_folder_/_page.svelte.js-W1ryj9DM.js +324 -0
  393. package/packages/web/build/server/chunks/entries/pages/p/_slug_/images/_page.server.ts.js-CI5UWZ0d.js +145 -0
  394. package/packages/web/build/server/chunks/entries/pages/p/_slug_/images/_page.svelte.js-CEfEI03g.js +513 -0
  395. package/packages/web/build/server/chunks/entries/pages/p/_slug_/memory/_page.server.ts.js-BEkqoeUR.js +113 -0
  396. package/packages/web/build/server/chunks/entries/pages/p/_slug_/memory/_page.svelte.js-DUr7iE9i.js +968 -0
  397. package/packages/web/build/server/chunks/entries/pages/p/_slug_/settings/_page.server.ts.js-Bjop3S9r.js +106 -0
  398. package/packages/web/build/server/chunks/entries/pages/p/_slug_/settings/_page.svelte.js-Ny6srewv.js +584 -0
  399. package/packages/web/build/server/chunks/entries/pages/p/_slug_/skills/_page.server.ts.js-DXe-ohav.js +45 -0
  400. package/packages/web/build/server/chunks/entries/pages/p/_slug_/skills/_page.svelte.js-Br1vobhN.js +132 -0
  401. package/packages/web/build/server/chunks/entries/pages/p/_slug_/welcome/_page.server.ts.js-0y-f4aJN.js +142 -0
  402. package/packages/web/build/server/chunks/entries/pages/p/_slug_/welcome/_page@.svelte.js-ChwZMckN.js +223 -0
  403. package/packages/web/build/server/chunks/entries/pages/profiles/_page.server.ts.js-Ts9M-2R0.js +47 -0
  404. package/packages/web/build/server/chunks/entries/pages/profiles/_page.svelte.js-_2ZYFPia.js +240 -0
  405. package/packages/web/build/server/chunks/handler-DkbKGuC0.js +1735 -0
  406. package/packages/web/build/server/chunks/index.js-BQ0Wgj5y.js +3700 -0
  407. package/packages/web/build/server/chunks/manifest.js-Ck76X-OV.js +430 -0
  408. package/packages/web/build/server/chunks/nodes/0.js-w3taO02L.js +45 -0
  409. package/packages/web/build/server/chunks/nodes/1.js-B4rS-Nr4.js +9 -0
  410. package/packages/web/build/server/chunks/nodes/10.js-BwZTPp0S.js +49 -0
  411. package/packages/web/build/server/chunks/nodes/11.js-qSjyiDmo.js +47 -0
  412. package/packages/web/build/server/chunks/nodes/12.js-jbCKu7ga.js +47 -0
  413. package/packages/web/build/server/chunks/nodes/13.js-CZEdZ_hD.js +47 -0
  414. package/packages/web/build/server/chunks/nodes/14.js-DcD_Vq2R.js +47 -0
  415. package/packages/web/build/server/chunks/nodes/15.js-B8IQPNRE.js +47 -0
  416. package/packages/web/build/server/chunks/nodes/16.js-VXfZziQK.js +47 -0
  417. package/packages/web/build/server/chunks/nodes/17.js-BL39UN7w.js +47 -0
  418. package/packages/web/build/server/chunks/nodes/18.js-VJymHX_u.js +47 -0
  419. package/packages/web/build/server/chunks/nodes/19.js-B1of8TNz.js +47 -0
  420. package/packages/web/build/server/chunks/nodes/2.js-DlV6j3uQ.js +49 -0
  421. package/packages/web/build/server/chunks/nodes/3.js-sB_r_B1G.js +48 -0
  422. package/packages/web/build/server/chunks/nodes/4.js-DQ2MGOGW.js +48 -0
  423. package/packages/web/build/server/chunks/nodes/5.js-CT57kDXb.js +49 -0
  424. package/packages/web/build/server/chunks/nodes/6.js-hoEEVixu.js +47 -0
  425. package/packages/web/build/server/chunks/nodes/7.js-B0_5AXwS.js +47 -0
  426. package/packages/web/build/server/chunks/nodes/8.js-CmCff-1l.js +52 -0
  427. package/packages/web/build/server/chunks/nodes/9.js-B1syTbHJ.js +51 -0
  428. package/dist/chunks/chunk-SAHRBQRY.js +0 -110
  429. package/dist/chunks/run-XM7YIEAW.js +0 -24454
  430. package/dist/chunks/zod-H7KMPIPH.js +0 -19934
  431. package/packages/web/build/client/_app/immutable/assets/0.DTnuPoms.css +0 -2
  432. package/packages/web/build/client/_app/immutable/assets/0.DTnuPoms.css.br +0 -0
  433. package/packages/web/build/client/_app/immutable/assets/0.DTnuPoms.css.gz +0 -0
  434. package/packages/web/build/client/_app/immutable/chunks/AwlnAPt_.js +0 -31
  435. package/packages/web/build/client/_app/immutable/chunks/AwlnAPt_.js.br +0 -0
  436. package/packages/web/build/client/_app/immutable/chunks/AwlnAPt_.js.gz +0 -0
  437. package/packages/web/build/client/_app/immutable/chunks/B0psERp-.js +0 -1
  438. package/packages/web/build/client/_app/immutable/chunks/B0psERp-.js.br +0 -0
  439. package/packages/web/build/client/_app/immutable/chunks/B0psERp-.js.gz +0 -0
  440. package/packages/web/build/client/_app/immutable/chunks/B4dOTQGI.js +0 -1
  441. package/packages/web/build/client/_app/immutable/chunks/B4dOTQGI.js.br +0 -2
  442. package/packages/web/build/client/_app/immutable/chunks/B4dOTQGI.js.gz +0 -0
  443. package/packages/web/build/client/_app/immutable/chunks/B6dKebLF.js +0 -1
  444. package/packages/web/build/client/_app/immutable/chunks/B6dKebLF.js.br +0 -0
  445. package/packages/web/build/client/_app/immutable/chunks/B6dKebLF.js.gz +0 -0
  446. package/packages/web/build/client/_app/immutable/chunks/B7tXsaud.js +0 -1
  447. package/packages/web/build/client/_app/immutable/chunks/B7tXsaud.js.br +0 -0
  448. package/packages/web/build/client/_app/immutable/chunks/B7tXsaud.js.gz +0 -0
  449. package/packages/web/build/client/_app/immutable/chunks/BCb2FcX-.js +0 -1
  450. package/packages/web/build/client/_app/immutable/chunks/BCb2FcX-.js.br +0 -0
  451. package/packages/web/build/client/_app/immutable/chunks/BCb2FcX-.js.gz +0 -0
  452. package/packages/web/build/client/_app/immutable/chunks/BEHPE67f.js +0 -1
  453. package/packages/web/build/client/_app/immutable/chunks/BEHPE67f.js.br +0 -2
  454. package/packages/web/build/client/_app/immutable/chunks/BEHPE67f.js.gz +0 -0
  455. package/packages/web/build/client/_app/immutable/chunks/BGRx4LH4.js +0 -1
  456. package/packages/web/build/client/_app/immutable/chunks/BGRx4LH4.js.br +0 -1
  457. package/packages/web/build/client/_app/immutable/chunks/BGRx4LH4.js.gz +0 -0
  458. package/packages/web/build/client/_app/immutable/chunks/BQcXnbnC.js +0 -1
  459. package/packages/web/build/client/_app/immutable/chunks/BQcXnbnC.js.br +0 -0
  460. package/packages/web/build/client/_app/immutable/chunks/BQcXnbnC.js.gz +0 -0
  461. package/packages/web/build/client/_app/immutable/chunks/BU1lfrAt.js +0 -1
  462. package/packages/web/build/client/_app/immutable/chunks/BU1lfrAt.js.br +0 -0
  463. package/packages/web/build/client/_app/immutable/chunks/BU1lfrAt.js.gz +0 -0
  464. package/packages/web/build/client/_app/immutable/chunks/BUCG0TDu.js +0 -1
  465. package/packages/web/build/client/_app/immutable/chunks/BUCG0TDu.js.br +0 -0
  466. package/packages/web/build/client/_app/immutable/chunks/BUCG0TDu.js.gz +0 -0
  467. package/packages/web/build/client/_app/immutable/chunks/BVy43h-D.js +0 -1
  468. package/packages/web/build/client/_app/immutable/chunks/BVy43h-D.js.br +0 -0
  469. package/packages/web/build/client/_app/immutable/chunks/BVy43h-D.js.gz +0 -0
  470. package/packages/web/build/client/_app/immutable/chunks/BhOcmMP6.js +0 -67
  471. package/packages/web/build/client/_app/immutable/chunks/BhOcmMP6.js.br +0 -0
  472. package/packages/web/build/client/_app/immutable/chunks/BhOcmMP6.js.gz +0 -0
  473. package/packages/web/build/client/_app/immutable/chunks/BnPnx1BS.js +0 -1
  474. package/packages/web/build/client/_app/immutable/chunks/BnPnx1BS.js.br +0 -0
  475. package/packages/web/build/client/_app/immutable/chunks/BnPnx1BS.js.gz +0 -0
  476. package/packages/web/build/client/_app/immutable/chunks/BtJh6BW0.js +0 -1
  477. package/packages/web/build/client/_app/immutable/chunks/BtJh6BW0.js.br +0 -0
  478. package/packages/web/build/client/_app/immutable/chunks/BtJh6BW0.js.gz +0 -0
  479. package/packages/web/build/client/_app/immutable/chunks/C238of6k.js +0 -1
  480. package/packages/web/build/client/_app/immutable/chunks/C238of6k.js.br +0 -0
  481. package/packages/web/build/client/_app/immutable/chunks/C238of6k.js.gz +0 -0
  482. package/packages/web/build/client/_app/immutable/chunks/C3AiOJdj.js +0 -5
  483. package/packages/web/build/client/_app/immutable/chunks/C3AiOJdj.js.br +0 -0
  484. package/packages/web/build/client/_app/immutable/chunks/C3AiOJdj.js.gz +0 -0
  485. package/packages/web/build/client/_app/immutable/chunks/C4Xqr7Fj.js +0 -1
  486. package/packages/web/build/client/_app/immutable/chunks/C4Xqr7Fj.js.br +0 -0
  487. package/packages/web/build/client/_app/immutable/chunks/C4Xqr7Fj.js.gz +0 -0
  488. package/packages/web/build/client/_app/immutable/chunks/C5iI_OsH.js +0 -1
  489. package/packages/web/build/client/_app/immutable/chunks/C5iI_OsH.js.br +0 -0
  490. package/packages/web/build/client/_app/immutable/chunks/C5iI_OsH.js.gz +0 -0
  491. package/packages/web/build/client/_app/immutable/chunks/CA_XVn89.js +0 -1
  492. package/packages/web/build/client/_app/immutable/chunks/CA_XVn89.js.br +0 -2
  493. package/packages/web/build/client/_app/immutable/chunks/CA_XVn89.js.gz +0 -0
  494. package/packages/web/build/client/_app/immutable/chunks/CAz7hU5S.js +0 -1
  495. package/packages/web/build/client/_app/immutable/chunks/CAz7hU5S.js.br +0 -0
  496. package/packages/web/build/client/_app/immutable/chunks/CAz7hU5S.js.gz +0 -0
  497. package/packages/web/build/client/_app/immutable/chunks/CCibcuvE.js +0 -1
  498. package/packages/web/build/client/_app/immutable/chunks/CCibcuvE.js.br +0 -0
  499. package/packages/web/build/client/_app/immutable/chunks/CCibcuvE.js.gz +0 -0
  500. package/packages/web/build/client/_app/immutable/chunks/CE2DpKar.js +0 -2
  501. package/packages/web/build/client/_app/immutable/chunks/CE2DpKar.js.br +0 -0
  502. package/packages/web/build/client/_app/immutable/chunks/CE2DpKar.js.gz +0 -0
  503. package/packages/web/build/client/_app/immutable/chunks/CGiFplSA.js +0 -1
  504. package/packages/web/build/client/_app/immutable/chunks/CGiFplSA.js.br +0 -0
  505. package/packages/web/build/client/_app/immutable/chunks/CGiFplSA.js.gz +0 -0
  506. package/packages/web/build/client/_app/immutable/chunks/CQSR9BkJ.js +0 -1
  507. package/packages/web/build/client/_app/immutable/chunks/CQSR9BkJ.js.br +0 -0
  508. package/packages/web/build/client/_app/immutable/chunks/CQSR9BkJ.js.gz +0 -0
  509. package/packages/web/build/client/_app/immutable/chunks/CXS58JOV.js +0 -1
  510. package/packages/web/build/client/_app/immutable/chunks/CXS58JOV.js.br +0 -0
  511. package/packages/web/build/client/_app/immutable/chunks/CXS58JOV.js.gz +0 -0
  512. package/packages/web/build/client/_app/immutable/chunks/C_rGKciz.js +0 -9
  513. package/packages/web/build/client/_app/immutable/chunks/C_rGKciz.js.br +0 -0
  514. package/packages/web/build/client/_app/immutable/chunks/C_rGKciz.js.gz +0 -0
  515. package/packages/web/build/client/_app/immutable/chunks/CaahyXtC.js +0 -1
  516. package/packages/web/build/client/_app/immutable/chunks/CaahyXtC.js.br +0 -0
  517. package/packages/web/build/client/_app/immutable/chunks/CaahyXtC.js.gz +0 -0
  518. package/packages/web/build/client/_app/immutable/chunks/CfHYzoiD.js +0 -1
  519. package/packages/web/build/client/_app/immutable/chunks/CfHYzoiD.js.br +0 -0
  520. package/packages/web/build/client/_app/immutable/chunks/CfHYzoiD.js.gz +0 -0
  521. package/packages/web/build/client/_app/immutable/chunks/ClEpdm9X.js +0 -1
  522. package/packages/web/build/client/_app/immutable/chunks/ClEpdm9X.js.br +0 -3
  523. package/packages/web/build/client/_app/immutable/chunks/ClEpdm9X.js.gz +0 -0
  524. package/packages/web/build/client/_app/immutable/chunks/ClSwhmjL.js +0 -1
  525. package/packages/web/build/client/_app/immutable/chunks/ClSwhmjL.js.br +0 -0
  526. package/packages/web/build/client/_app/immutable/chunks/ClSwhmjL.js.gz +0 -0
  527. package/packages/web/build/client/_app/immutable/chunks/ClppYdjP.js +0 -1
  528. package/packages/web/build/client/_app/immutable/chunks/ClppYdjP.js.br +0 -0
  529. package/packages/web/build/client/_app/immutable/chunks/ClppYdjP.js.gz +0 -0
  530. package/packages/web/build/client/_app/immutable/chunks/CmM-4RFG.js +0 -1
  531. package/packages/web/build/client/_app/immutable/chunks/CmM-4RFG.js.br +0 -0
  532. package/packages/web/build/client/_app/immutable/chunks/CmM-4RFG.js.gz +0 -0
  533. package/packages/web/build/client/_app/immutable/chunks/CpXfakoi.js +0 -1
  534. package/packages/web/build/client/_app/immutable/chunks/CpXfakoi.js.br +0 -0
  535. package/packages/web/build/client/_app/immutable/chunks/CpXfakoi.js.gz +0 -0
  536. package/packages/web/build/client/_app/immutable/chunks/CrCk-NyX.js +0 -1
  537. package/packages/web/build/client/_app/immutable/chunks/CrCk-NyX.js.br +0 -0
  538. package/packages/web/build/client/_app/immutable/chunks/CrCk-NyX.js.gz +0 -0
  539. package/packages/web/build/client/_app/immutable/chunks/CywApwhc.js +0 -1
  540. package/packages/web/build/client/_app/immutable/chunks/CywApwhc.js.br +0 -0
  541. package/packages/web/build/client/_app/immutable/chunks/CywApwhc.js.gz +0 -0
  542. package/packages/web/build/client/_app/immutable/chunks/D31s_g8n.js +0 -5
  543. package/packages/web/build/client/_app/immutable/chunks/D31s_g8n.js.br +0 -0
  544. package/packages/web/build/client/_app/immutable/chunks/D31s_g8n.js.gz +0 -0
  545. package/packages/web/build/client/_app/immutable/chunks/DDRoGIP9.js +0 -1
  546. package/packages/web/build/client/_app/immutable/chunks/DDRoGIP9.js.br +0 -0
  547. package/packages/web/build/client/_app/immutable/chunks/DDRoGIP9.js.gz +0 -0
  548. package/packages/web/build/client/_app/immutable/chunks/DGcS8KSS.js +0 -1
  549. package/packages/web/build/client/_app/immutable/chunks/DGcS8KSS.js.br +0 -0
  550. package/packages/web/build/client/_app/immutable/chunks/DGcS8KSS.js.gz +0 -0
  551. package/packages/web/build/client/_app/immutable/chunks/DK1UHLR-.js +0 -1
  552. package/packages/web/build/client/_app/immutable/chunks/DK1UHLR-.js.br +0 -0
  553. package/packages/web/build/client/_app/immutable/chunks/DK1UHLR-.js.gz +0 -0
  554. package/packages/web/build/client/_app/immutable/chunks/DZk-gkAU.js +0 -1
  555. package/packages/web/build/client/_app/immutable/chunks/DZk-gkAU.js.br +0 -0
  556. package/packages/web/build/client/_app/immutable/chunks/DZk-gkAU.js.gz +0 -0
  557. package/packages/web/build/client/_app/immutable/chunks/DeP17kbD.js +0 -318
  558. package/packages/web/build/client/_app/immutable/chunks/DeP17kbD.js.br +0 -0
  559. package/packages/web/build/client/_app/immutable/chunks/DeP17kbD.js.gz +0 -0
  560. package/packages/web/build/client/_app/immutable/chunks/DelhG4NG.js +0 -1
  561. package/packages/web/build/client/_app/immutable/chunks/DelhG4NG.js.br +0 -0
  562. package/packages/web/build/client/_app/immutable/chunks/DelhG4NG.js.gz +0 -0
  563. package/packages/web/build/client/_app/immutable/chunks/DmAdEzQs.js +0 -1
  564. package/packages/web/build/client/_app/immutable/chunks/DmAdEzQs.js.br +0 -0
  565. package/packages/web/build/client/_app/immutable/chunks/DmAdEzQs.js.gz +0 -0
  566. package/packages/web/build/client/_app/immutable/chunks/DuG8sfLq.js +0 -1
  567. package/packages/web/build/client/_app/immutable/chunks/DuG8sfLq.js.br +0 -0
  568. package/packages/web/build/client/_app/immutable/chunks/DuG8sfLq.js.gz +0 -0
  569. package/packages/web/build/client/_app/immutable/chunks/GTRzOEzD.js +0 -1
  570. package/packages/web/build/client/_app/immutable/chunks/GTRzOEzD.js.br +0 -0
  571. package/packages/web/build/client/_app/immutable/chunks/GTRzOEzD.js.gz +0 -0
  572. package/packages/web/build/client/_app/immutable/chunks/IjF4KE1B.js +0 -1
  573. package/packages/web/build/client/_app/immutable/chunks/IjF4KE1B.js.br +0 -0
  574. package/packages/web/build/client/_app/immutable/chunks/IjF4KE1B.js.gz +0 -0
  575. package/packages/web/build/client/_app/immutable/chunks/MApZQR0b.js +0 -1
  576. package/packages/web/build/client/_app/immutable/chunks/MApZQR0b.js.br +0 -0
  577. package/packages/web/build/client/_app/immutable/chunks/MApZQR0b.js.gz +0 -0
  578. package/packages/web/build/client/_app/immutable/chunks/N3oV-8Ie.js +0 -1
  579. package/packages/web/build/client/_app/immutable/chunks/N3oV-8Ie.js.br +0 -0
  580. package/packages/web/build/client/_app/immutable/chunks/N3oV-8Ie.js.gz +0 -0
  581. package/packages/web/build/client/_app/immutable/chunks/iiqQqDMt.js +0 -1
  582. package/packages/web/build/client/_app/immutable/chunks/iiqQqDMt.js.br +0 -0
  583. package/packages/web/build/client/_app/immutable/chunks/iiqQqDMt.js.gz +0 -0
  584. package/packages/web/build/client/_app/immutable/chunks/k3ZB4WVm.js +0 -1
  585. package/packages/web/build/client/_app/immutable/chunks/k3ZB4WVm.js.br +0 -0
  586. package/packages/web/build/client/_app/immutable/chunks/k3ZB4WVm.js.gz +0 -0
  587. package/packages/web/build/client/_app/immutable/chunks/pAzEohwE.js +0 -1
  588. package/packages/web/build/client/_app/immutable/chunks/pAzEohwE.js.br +0 -2
  589. package/packages/web/build/client/_app/immutable/chunks/pAzEohwE.js.gz +0 -0
  590. package/packages/web/build/client/_app/immutable/chunks/vmc6srO5.js +0 -1
  591. package/packages/web/build/client/_app/immutable/chunks/vmc6srO5.js.br +0 -2
  592. package/packages/web/build/client/_app/immutable/chunks/vmc6srO5.js.gz +0 -0
  593. package/packages/web/build/client/_app/immutable/chunks/ypBpP4nr.js +0 -1
  594. package/packages/web/build/client/_app/immutable/chunks/ypBpP4nr.js.br +0 -0
  595. package/packages/web/build/client/_app/immutable/chunks/ypBpP4nr.js.gz +0 -0
  596. package/packages/web/build/client/_app/immutable/entry/app.D9io9O7v.js +0 -2
  597. package/packages/web/build/client/_app/immutable/entry/app.D9io9O7v.js.br +0 -0
  598. package/packages/web/build/client/_app/immutable/entry/app.D9io9O7v.js.gz +0 -0
  599. package/packages/web/build/client/_app/immutable/entry/start.BgaOwPMP.js +0 -1
  600. package/packages/web/build/client/_app/immutable/entry/start.BgaOwPMP.js.br +0 -1
  601. package/packages/web/build/client/_app/immutable/entry/start.BgaOwPMP.js.gz +0 -0
  602. package/packages/web/build/client/_app/immutable/nodes/0.C9CR-5kd.js +0 -1
  603. package/packages/web/build/client/_app/immutable/nodes/0.C9CR-5kd.js.br +0 -0
  604. package/packages/web/build/client/_app/immutable/nodes/0.C9CR-5kd.js.gz +0 -0
  605. package/packages/web/build/client/_app/immutable/nodes/1.DikBrROv.js +0 -1
  606. package/packages/web/build/client/_app/immutable/nodes/1.DikBrROv.js.br +0 -0
  607. package/packages/web/build/client/_app/immutable/nodes/1.DikBrROv.js.gz +0 -0
  608. package/packages/web/build/client/_app/immutable/nodes/10.3t9WnHvs.js +0 -1
  609. package/packages/web/build/client/_app/immutable/nodes/10.3t9WnHvs.js.br +0 -0
  610. package/packages/web/build/client/_app/immutable/nodes/10.3t9WnHvs.js.gz +0 -0
  611. package/packages/web/build/client/_app/immutable/nodes/11.Op2wvZXP.js +0 -4
  612. package/packages/web/build/client/_app/immutable/nodes/11.Op2wvZXP.js.br +0 -0
  613. package/packages/web/build/client/_app/immutable/nodes/11.Op2wvZXP.js.gz +0 -0
  614. package/packages/web/build/client/_app/immutable/nodes/12.CjrjNFKj.js +0 -1
  615. package/packages/web/build/client/_app/immutable/nodes/12.CjrjNFKj.js.br +0 -0
  616. package/packages/web/build/client/_app/immutable/nodes/12.CjrjNFKj.js.gz +0 -0
  617. package/packages/web/build/client/_app/immutable/nodes/13.CiddqUIq.js +0 -1
  618. package/packages/web/build/client/_app/immutable/nodes/13.CiddqUIq.js.br +0 -0
  619. package/packages/web/build/client/_app/immutable/nodes/13.CiddqUIq.js.gz +0 -0
  620. package/packages/web/build/client/_app/immutable/nodes/14.D189pX_R.js +0 -2
  621. package/packages/web/build/client/_app/immutable/nodes/14.D189pX_R.js.br +0 -0
  622. package/packages/web/build/client/_app/immutable/nodes/14.D189pX_R.js.gz +0 -0
  623. package/packages/web/build/client/_app/immutable/nodes/15.L9U9QVzo.js +0 -1
  624. package/packages/web/build/client/_app/immutable/nodes/15.L9U9QVzo.js.br +0 -0
  625. package/packages/web/build/client/_app/immutable/nodes/15.L9U9QVzo.js.gz +0 -0
  626. package/packages/web/build/client/_app/immutable/nodes/16.DSMrlY8n.js +0 -1
  627. package/packages/web/build/client/_app/immutable/nodes/16.DSMrlY8n.js.br +0 -0
  628. package/packages/web/build/client/_app/immutable/nodes/16.DSMrlY8n.js.gz +0 -0
  629. package/packages/web/build/client/_app/immutable/nodes/17.Bbk_u6OJ.js +0 -46
  630. package/packages/web/build/client/_app/immutable/nodes/17.Bbk_u6OJ.js.br +0 -0
  631. package/packages/web/build/client/_app/immutable/nodes/17.Bbk_u6OJ.js.gz +0 -0
  632. package/packages/web/build/client/_app/immutable/nodes/18.DV_cA_3-.js +0 -1
  633. package/packages/web/build/client/_app/immutable/nodes/18.DV_cA_3-.js.br +0 -0
  634. package/packages/web/build/client/_app/immutable/nodes/18.DV_cA_3-.js.gz +0 -0
  635. package/packages/web/build/client/_app/immutable/nodes/2.DJvpS8CT.js +0 -1
  636. package/packages/web/build/client/_app/immutable/nodes/2.DJvpS8CT.js.br +0 -0
  637. package/packages/web/build/client/_app/immutable/nodes/2.DJvpS8CT.js.gz +0 -0
  638. package/packages/web/build/client/_app/immutable/nodes/4.v0gFXgkE.js +0 -2
  639. package/packages/web/build/client/_app/immutable/nodes/4.v0gFXgkE.js.br +0 -0
  640. package/packages/web/build/client/_app/immutable/nodes/4.v0gFXgkE.js.gz +0 -0
  641. package/packages/web/build/client/_app/immutable/nodes/5.CvNd-aT1.js +0 -1
  642. package/packages/web/build/client/_app/immutable/nodes/5.CvNd-aT1.js.br +0 -0
  643. package/packages/web/build/client/_app/immutable/nodes/5.CvNd-aT1.js.gz +0 -0
  644. package/packages/web/build/client/_app/immutable/nodes/6.Cwb-H-e-.js +0 -2
  645. package/packages/web/build/client/_app/immutable/nodes/6.Cwb-H-e-.js.br +0 -0
  646. package/packages/web/build/client/_app/immutable/nodes/6.Cwb-H-e-.js.gz +0 -0
  647. package/packages/web/build/client/_app/immutable/nodes/7.BesKsRyM.js +0 -1
  648. package/packages/web/build/client/_app/immutable/nodes/7.BesKsRyM.js.br +0 -0
  649. package/packages/web/build/client/_app/immutable/nodes/7.BesKsRyM.js.gz +0 -0
  650. package/packages/web/build/client/_app/immutable/nodes/8.IWTTmi0T.js +0 -1
  651. package/packages/web/build/client/_app/immutable/nodes/8.IWTTmi0T.js.br +0 -0
  652. package/packages/web/build/client/_app/immutable/nodes/8.IWTTmi0T.js.gz +0 -0
  653. package/packages/web/build/client/_app/immutable/nodes/9.BksbXEiN.js +0 -1
  654. package/packages/web/build/client/_app/immutable/nodes/9.BksbXEiN.js.br +0 -0
  655. package/packages/web/build/client/_app/immutable/nodes/9.BksbXEiN.js.gz +0 -0
  656. package/packages/web/build/server/chunks/chunks/AssistantAvatar.js-BOElnrYl.js +0 -294
  657. package/packages/web/build/server/chunks/chunks/AvatarPicker.js-CLhSkMaB.js +0 -136
  658. package/packages/web/build/server/chunks/chunks/Composer.js-BbcT-FLv.js +0 -333
  659. package/packages/web/build/server/chunks/chunks/ComposerDock.js-B26-qji-.js +0 -58
  660. package/packages/web/build/server/chunks/chunks/CopyButton.js-Bg6aJO9i.js +0 -81
  661. package/packages/web/build/server/chunks/chunks/DotGrid.js-DEty8Ftx.js +0 -108
  662. package/packages/web/build/server/chunks/chunks/MemoryChangeItem.js-XSzCkKCr.js +0 -2588
  663. package/packages/web/build/server/chunks/chunks/ModelMenu.js-DyvxWk4C.js +0 -650
  664. package/packages/web/build/server/chunks/chunks/MoveToFolderMenu.js-BkRCW9eh.js +0 -288
  665. package/packages/web/build/server/chunks/chunks/NewChatForm.js-40tqChFh.js +0 -307
  666. package/packages/web/build/server/chunks/chunks/NewFolderDialog.js-C6CjVSY0.js +0 -192
  667. package/packages/web/build/server/chunks/chunks/Notifications.js-CQqL8zeJ.js +0 -762
  668. package/packages/web/build/server/chunks/chunks/PageHeader.js-BgCv8CGm.js +0 -59
  669. package/packages/web/build/server/chunks/chunks/RenameFolderDialog.js-BgF-2T2D.js +0 -258
  670. package/packages/web/build/server/chunks/chunks/StepIcon.js-ClUo5irL.js +0 -38
  671. package/packages/web/build/server/chunks/chunks/TopBar.js-nYKfnv4T.js +0 -34
  672. package/packages/web/build/server/chunks/chunks/TypedText.js-DM0Ozjdc.js +0 -62
  673. package/packages/web/build/server/chunks/chunks/UserAvatar.js-DKnmWp86.js +0 -24
  674. package/packages/web/build/server/chunks/chunks/UserMenu.js-CLVbCOpM.js +0 -1499
  675. package/packages/web/build/server/chunks/chunks/access.js-CMaS81rW.js +0 -40
  676. package/packages/web/build/server/chunks/chunks/accounts.js--GU4-Jf5.js +0 -26
  677. package/packages/web/build/server/chunks/chunks/alert-dialog.js-CZD6TyzD.js +0 -505
  678. package/packages/web/build/server/chunks/chunks/auth.js-CjtH41kh.js +0 -20064
  679. package/packages/web/build/server/chunks/chunks/badge.js-DhrZz9tJ.js +0 -38
  680. package/packages/web/build/server/chunks/chunks/camera.js-DMildJpv.js +0 -19
  681. package/packages/web/build/server/chunks/chunks/check.js-CgqvmEKJ.js +0 -15
  682. package/packages/web/build/server/chunks/chunks/chevron-left.js-DrLivp1c.js +0 -15
  683. package/packages/web/build/server/chunks/chunks/chevron-right.js-BVi8OuAb.js +0 -15
  684. package/packages/web/build/server/chunks/chunks/chevrons-up-down.js-BKkCIwCT.js +0 -15
  685. package/packages/web/build/server/chunks/chunks/client.js-Dg5neIp5.js +0 -120
  686. package/packages/web/build/server/chunks/chunks/clock.js-BK9UDxCS.js +0 -19
  687. package/packages/web/build/server/chunks/chunks/collapsible.js-QcUf1Ekr.js +0 -410
  688. package/packages/web/build/server/chunks/chunks/command.js-qzkTIb4n.js +0 -2231
  689. package/packages/web/build/server/chunks/chunks/dialog.js-DATXmio9.js +0 -544
  690. package/packages/web/build/server/chunks/chunks/dist.js-CHzkIw-w.js +0 -600
  691. package/packages/web/build/server/chunks/chunks/dist2.js-BypRVH9n.js +0 -347
  692. package/packages/web/build/server/chunks/chunks/dist3.js-uSfOYmy-.js +0 -19547
  693. package/packages/web/build/server/chunks/chunks/download.js-CrFy9e4X.js +0 -19
  694. package/packages/web/build/server/chunks/chunks/dropdown-menu.js-BMbh502s.js +0 -2396
  695. package/packages/web/build/server/chunks/chunks/eraser.js-BU4dlvFH.js +0 -15
  696. package/packages/web/build/server/chunks/chunks/factory.js-CQLK42R-.js +0 -2344
  697. package/packages/web/build/server/chunks/chunks/folder-input.js-DkjPvOkW.js +0 -19
  698. package/packages/web/build/server/chunks/chunks/forms.js-JM_GpxQF.js +0 -4052
  699. package/packages/web/build/server/chunks/chunks/hidden-input.js-CIt9W_5y.js +0 -47
  700. package/packages/web/build/server/chunks/chunks/i18n.js-Cakuk6U0.js +0 -6543
  701. package/packages/web/build/server/chunks/chunks/internal2.js-CM6RC5j4.js +0 -1135
  702. package/packages/web/build/server/chunks/chunks/key-round.js-BFVR2_CE.js +0 -20
  703. package/packages/web/build/server/chunks/chunks/message-circle.js-D49Sk0Wt.js +0 -15
  704. package/packages/web/build/server/chunks/chunks/motion.js-BGVcte_O.js +0 -224
  705. package/packages/web/build/server/chunks/chunks/paths.js-vTKfgV_W.js +0 -19
  706. package/packages/web/build/server/chunks/chunks/pencil.js-DrsRjIqk.js +0 -15
  707. package/packages/web/build/server/chunks/chunks/plus.js-E-pmHa3v.js +0 -15
  708. package/packages/web/build/server/chunks/chunks/sdk.js-B2ztN1Lk.js +0 -42918
  709. package/packages/web/build/server/chunks/chunks/select.js-CADiX1B7.js +0 -1965
  710. package/packages/web/build/server/chunks/chunks/shield-check.js-CifO8sPn.js +0 -29
  711. package/packages/web/build/server/chunks/chunks/sidebar.js-CjZAbET4.js +0 -1498
  712. package/packages/web/build/server/chunks/chunks/square-pen.js-CMKwoVdr.js +0 -20
  713. package/packages/web/build/server/chunks/chunks/src.js-DlynI0hv.js +0 -27000
  714. package/packages/web/build/server/chunks/chunks/state.js-DjG_xJ6v.js +0 -67
  715. package/packages/web/build/server/chunks/chunks/switch.js-BykxjriZ.js +0 -283
  716. package/packages/web/build/server/chunks/chunks/terminal.js-D6dBIpDn.js +0 -15
  717. package/packages/web/build/server/chunks/chunks/textarea.js-B5-NW0l1.js +0 -25
  718. package/packages/web/build/server/chunks/chunks/tooltip.js-CefNT6DH.js +0 -5863
  719. package/packages/web/build/server/chunks/chunks/usage.js-DNQuJpUU.js +0 -27
  720. package/packages/web/build/server/chunks/chunks/utils2.js-D1jvsxxx.js +0 -1167
  721. package/packages/web/build/server/chunks/chunks/zod.js-CWybfdic.js +0 -18824
  722. package/packages/web/build/server/chunks/chunks/zod2.js-D_b3bp3T.js +0 -4
  723. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/commands/_server.ts.js-DkJz0GER.js +0 -53
  724. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/continue/_server.ts.js-DwqrktqL.js +0 -44
  725. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/effort/_server.ts.js-BmjT-Ztn.js +0 -45
  726. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/events/_server.ts.js-B5EB81bi.js +0 -72
  727. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/folder/_server.ts.js-Dw0QpRlp.js +0 -53
  728. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/media/_mediaId_/_server.ts.js-Bx0OedB1.js +0 -51
  729. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/messages/_server.ts.js-DDYKj9gS.js +0 -56
  730. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/preset/_server.ts.js-DEJaoQV0.js +0 -49
  731. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/stop/_server.ts.js-Dw7fPXTJ.js +0 -42
  732. package/packages/web/build/server/chunks/entries/endpoints/api/c/_id_/typing/_server.ts.js-KhlfQb5X.js +0 -48
  733. package/packages/web/build/server/chunks/entries/endpoints/api/card/changes/_id_/keep/_server.ts.js-CpO5Tw0v.js +0 -57
  734. package/packages/web/build/server/chunks/entries/endpoints/api/chatgpt/sign-in/_server.ts.js-CGa-3Tfb.js +0 -72
  735. package/packages/web/build/server/chunks/entries/endpoints/api/events/_server.ts.js-BBNo5Duy.js +0 -83
  736. package/packages/web/build/server/chunks/entries/endpoints/api/hooks/_token_/_server.ts.js-DB0HkrPc.js +0 -48
  737. package/packages/web/build/server/chunks/entries/endpoints/api/me/_server.ts.js-b6-lm_Ed.js +0 -51
  738. package/packages/web/build/server/chunks/entries/endpoints/api/me/picture/_server.ts.js-CXaSRFEH.js +0 -59
  739. package/packages/web/build/server/chunks/entries/endpoints/api/models/_server.ts.js-lvH7AJAs.js +0 -55
  740. package/packages/web/build/server/chunks/entries/endpoints/api/notifications/_id_/continue/_server.ts.js-DApMRDk0.js +0 -49
  741. package/packages/web/build/server/chunks/entries/endpoints/api/notifications/_id_/dismiss/_server.ts.js-CrvUxZUu.js +0 -41
  742. package/packages/web/build/server/chunks/entries/endpoints/api/notifications/clear/_server.ts.js-UXu_qsCl.js +0 -42
  743. package/packages/web/build/server/chunks/entries/endpoints/api/notifications/seen/_server.ts.js-DtA3xn3g.js +0 -42
  744. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/folders/_folder_/files/_file_/_server.ts.js-DysFASqZ.js +0 -55
  745. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/folders/_server.ts.js-BDEdyBpH.js +0 -56
  746. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/memory/_id_/undo/_server.ts.js-BZEyhdCW.js +0 -57
  747. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/running/_server.ts.js-NEH54dIz.js +0 -78
  748. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/suggestions/_server.ts.js-BhqMxAjp.js +0 -52
  749. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/templates/_id_/cover/_server.ts.js-rw9q81We.js +0 -58
  750. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/uploads/_id_/_server.ts.js-B9fQriGr.js +0 -43
  751. package/packages/web/build/server/chunks/entries/endpoints/api/p/_slug_/uploads/_server.ts.js-D4v_ixwU.js +0 -71
  752. package/packages/web/build/server/chunks/entries/endpoints/api/pictures/_sha256_/_server.ts.js-YGGiBW89.js +0 -54
  753. package/packages/web/build/server/chunks/entries/endpoints/logout/_server.ts.js-D85x_95g.js +0 -45
  754. package/packages/web/build/server/chunks/entries/fallbacks/error.svelte.js-Cb-94Mjg.js +0 -22
  755. package/packages/web/build/server/chunks/entries/hooks.server.js-b1SYQXEi.js +0 -2983
  756. package/packages/web/build/server/chunks/entries/pages/_layout.server.ts.js-vgQ7FD_z.js +0 -41
  757. package/packages/web/build/server/chunks/entries/pages/_layout.svelte.js-BhzEqF95.js +0 -77
  758. package/packages/web/build/server/chunks/entries/pages/_page.server.ts.js-BybKXqua.js +0 -27
  759. package/packages/web/build/server/chunks/entries/pages/admin/_page.server.ts.js-Co8N9XsI.js +0 -345
  760. package/packages/web/build/server/chunks/entries/pages/admin/_page.svelte.js-C9m37bww.js +0 -2307
  761. package/packages/web/build/server/chunks/entries/pages/admin/people/_page.server.ts.js-DsxljIFN.js +0 -130
  762. package/packages/web/build/server/chunks/entries/pages/admin/people/_page.svelte.js-CL25VFst.js +0 -574
  763. package/packages/web/build/server/chunks/entries/pages/card/_page.server.ts.js-fZyd9NoG.js +0 -75
  764. package/packages/web/build/server/chunks/entries/pages/card/_page.svelte.js-BtRHLxTx.js +0 -372
  765. package/packages/web/build/server/chunks/entries/pages/invite/_token_/_page.server.ts.js-B8OQFrQp.js +0 -63
  766. package/packages/web/build/server/chunks/entries/pages/invite/_token_/_page.svelte.js-hd2quW3N.js +0 -125
  767. package/packages/web/build/server/chunks/entries/pages/login/_page.server.ts.js-DOcT1tgp.js +0 -42
  768. package/packages/web/build/server/chunks/entries/pages/login/_page.svelte.js-C5Auxspy.js +0 -74
  769. package/packages/web/build/server/chunks/entries/pages/p/_slug_/_layout.server.ts.js-BvbpH7aa.js +0 -53
  770. package/packages/web/build/server/chunks/entries/pages/p/_slug_/_layout.svelte.js-B10sZUKN.js +0 -1900
  771. package/packages/web/build/server/chunks/entries/pages/p/_slug_/_page.server.ts.js-C3Y9wk8O.js +0 -78
  772. package/packages/web/build/server/chunks/entries/pages/p/_slug_/_page.svelte.js-CoRMdrPQ.js +0 -152
  773. package/packages/web/build/server/chunks/entries/pages/p/_slug_/automations/_page.server.ts.js-BbMLCUDA.js +0 -269
  774. package/packages/web/build/server/chunks/entries/pages/p/_slug_/automations/_page.svelte.js-DPU6YXHJ.js +0 -414
  775. package/packages/web/build/server/chunks/entries/pages/p/_slug_/c/_id_/_page.server.ts.js-DRgVXOxV.js +0 -73
  776. package/packages/web/build/server/chunks/entries/pages/p/_slug_/c/_id_/_page.svelte.js-Ck3wDf_F.js +0 -2392
  777. package/packages/web/build/server/chunks/entries/pages/p/_slug_/f/_folder_/_page.server.ts.js-DJVR3n50.js +0 -102
  778. package/packages/web/build/server/chunks/entries/pages/p/_slug_/f/_folder_/_page.svelte.js-CLG-0wVy.js +0 -323
  779. package/packages/web/build/server/chunks/entries/pages/p/_slug_/images/_page.server.ts.js-BbBFc7eX.js +0 -145
  780. package/packages/web/build/server/chunks/entries/pages/p/_slug_/images/_page.svelte.js-Ta37_M_i.js +0 -513
  781. package/packages/web/build/server/chunks/entries/pages/p/_slug_/memory/_page.server.ts.js-CkQszCsV.js +0 -113
  782. package/packages/web/build/server/chunks/entries/pages/p/_slug_/memory/_page.svelte.js-DxgpLCGC.js +0 -968
  783. package/packages/web/build/server/chunks/entries/pages/p/_slug_/settings/_page.server.ts.js-ryYts05B.js +0 -106
  784. package/packages/web/build/server/chunks/entries/pages/p/_slug_/settings/_page.svelte.js-BvTcTRJQ.js +0 -584
  785. package/packages/web/build/server/chunks/entries/pages/p/_slug_/skills/_page.server.ts.js-BzVe8LHd.js +0 -45
  786. package/packages/web/build/server/chunks/entries/pages/p/_slug_/skills/_page.svelte.js-CJHcqQH5.js +0 -132
  787. package/packages/web/build/server/chunks/entries/pages/p/_slug_/welcome/_page.server.ts.js-onzZAX1Z.js +0 -134
  788. package/packages/web/build/server/chunks/entries/pages/p/_slug_/welcome/_page@.svelte.js-BnGdU_h4.js +0 -223
  789. package/packages/web/build/server/chunks/entries/pages/profiles/_page.server.ts.js-hGcjHBhU.js +0 -47
  790. package/packages/web/build/server/chunks/entries/pages/profiles/_page.svelte.js-BzuBRwOF.js +0 -240
  791. package/packages/web/build/server/chunks/handler-D2eW2iLl.js +0 -1735
  792. package/packages/web/build/server/chunks/index.js-DqF1GLH4.js +0 -3700
  793. package/packages/web/build/server/chunks/manifest.js-B7llprKy.js +0 -387
  794. package/packages/web/build/server/chunks/nodes/0.js-CIzCXL5D.js +0 -42
  795. package/packages/web/build/server/chunks/nodes/1.js-DRjbmxYH.js +0 -9
  796. package/packages/web/build/server/chunks/nodes/10.js-CDm72w6Y.js +0 -44
  797. package/packages/web/build/server/chunks/nodes/11.js-OnJr6Cw4.js +0 -44
  798. package/packages/web/build/server/chunks/nodes/12.js-CSZo_AVI.js +0 -44
  799. package/packages/web/build/server/chunks/nodes/13.js-B4R788aB.js +0 -44
  800. package/packages/web/build/server/chunks/nodes/14.js-l-KO8B-h.js +0 -44
  801. package/packages/web/build/server/chunks/nodes/15.js-CAtECzGW.js +0 -44
  802. package/packages/web/build/server/chunks/nodes/16.js-CmTEXhAq.js +0 -44
  803. package/packages/web/build/server/chunks/nodes/17.js-Gg-NPBzB.js +0 -44
  804. package/packages/web/build/server/chunks/nodes/18.js-BLTnO9SS.js +0 -44
  805. package/packages/web/build/server/chunks/nodes/2.js-CDq1qE_r.js +0 -46
  806. package/packages/web/build/server/chunks/nodes/3.js-BVsDtBU2.js +0 -45
  807. package/packages/web/build/server/chunks/nodes/4.js-Cpe8-dWC.js +0 -45
  808. package/packages/web/build/server/chunks/nodes/5.js-DFdbH2Du.js +0 -46
  809. package/packages/web/build/server/chunks/nodes/6.js-yJdLU7lq.js +0 -44
  810. package/packages/web/build/server/chunks/nodes/7.js-BoganRn1.js +0 -50
  811. package/packages/web/build/server/chunks/nodes/8.js-Diubq0AZ.js +0 -49
  812. package/packages/web/build/server/chunks/nodes/9.js-DXoagKbS.js +0 -46
  813. /package/packages/web/build/client/_app/immutable/assets/{11.DZmZHLub.css → 12.DZmZHLub.css} +0 -0
  814. /package/packages/web/build/client/_app/immutable/assets/{11.DZmZHLub.css.br → 12.DZmZHLub.css.br} +0 -0
  815. /package/packages/web/build/client/_app/immutable/assets/{11.DZmZHLub.css.gz → 12.DZmZHLub.css.gz} +0 -0
  816. /package/packages/web/build/client/_app/immutable/assets/{13.DiHYpJ-g.css → 14.DiHYpJ-g.css} +0 -0
  817. /package/packages/web/build/client/_app/immutable/assets/{13.DiHYpJ-g.css.br → 14.DiHYpJ-g.css.br} +0 -0
  818. /package/packages/web/build/client/_app/immutable/assets/{13.DiHYpJ-g.css.gz → 14.DiHYpJ-g.css.gz} +0 -0
  819. /package/packages/web/build/client/_app/immutable/assets/{17.D8mCg27h.css → 18.D8mCg27h.css} +0 -0
  820. /package/packages/web/build/client/_app/immutable/assets/{17.D8mCg27h.css.br → 18.D8mCg27h.css.br} +0 -0
  821. /package/packages/web/build/client/_app/immutable/assets/{17.D8mCg27h.css.gz → 18.D8mCg27h.css.gz} +0 -0
@@ -1,2983 +0,0 @@
1
- import { d as building } from '../chunks/internal.js-BAV8263N.js';
2
- import { z as installCliShim, A as recoverAfterRestart, B as startScheduler, D as startUpdateChecks, E as paths, F as viewImage, V as ViewLimitError, G as profileSkillsDir, H as createSkill, I as getProfileBySlug, J as listProfileSkills, K as scanSkills, L as setSkillsEnabled, M as addPreset, N as effectiveContextWindow, O as isProvider$1, P as listPresets, Q as isCustomProvider, R as splitModel, S as editPreset, U as removePreset, W as setDefaultPreset, X as getDefaultPreset, Y as generatePassword, Z as createUser, _ as setPassword, $ as setAdmin, a0 as deleteUser, a1 as createInvite, a2 as publicOrigin, r as readConfig, a3 as listUsers, a4 as userPictureFile, a5 as updateConfig, a6 as findCustomProvider, a7 as removeCustomProvider, a8 as listCustomProviders, a9 as API_KEYS, aa as isApiKeyProvider, ab as removeApiKey, ac as apiKeyStatuses, ad as claudeExecutable, ae as chatGptPlanStatus, af as imageGenerationStatus, ag as embeddingStatus, ah as describeCommandSafety, ai as describeUpdates, aj as isCommandMode, ak as saveCommandMode, al as findPreset, am as saveSafetyPreset, an as forgetRelease, ao as parseEmbeddingSetting, ap as saveEmbeddingSetting, aq as embeddingProblem, ar as initConfig, g as getDb, as as configExists, at as listSubagents, au as getConversation, av as subagentLogPath, aw as requestSubagentStop, ax as steerSubagent, ay as subagentResult, az as EFFORTS, aA as runSubagent, aB as resolvePreset, aC as getTrigger, aD as queueWake, aE as MAX_SOUL_CHARS, aF as writeSoul, aG as readSoulFile, aH as MAX_CARD_CHARS, aI as cardOf, aJ as cardFiles, aK as findUser, aL as readCard, aM as MAX_PINNED_CHARS, aN as setLearnFromChats, aO as mergeProfileNotes, aP as moveProfileNote, aQ as removeMemoryNote, aR as writeMemoryNote, aS as forgetInCard, aT as forgetMemoryFact, aU as replaceInCard, aV as replaceInMemory, aW as factLines, aX as addToCard, aY as addMemoryFact, aZ as profileCard, a_ as readMemoryNote, a$ as profileCards, b0 as searchMemory, b1 as listMemoryFiles, b2 as membersWithNotes, b3 as profileMemoryDir, b4 as isPinnedNote, b5 as formatLocalTime, b6 as updateTrigger, b7 as describeWhen, b8 as deleteTrigger, b9 as setTriggerEnabled, ba as queueRun, bb as getPreset, bc as getProfile, bd as listRuns, be as listProfiles, bf as listTriggers, bg as createTrigger, bh as setProfileAvatar, bi as providerFor, bj as signOutChatGpt, bk as listChatGptModels, bl as checkCustomProvider, bm as CustomProviderError, bn as normalizeApiKey, bo as checkApiKey, bp as saveApiKey, bq as ApiKeyError, br as claudePlanStatus, bs as claudeSignInCommand, bt as appManaged, bu as MAX_MEDIA_BYTES, bv as WEB_RECENT, bw as searchWeb, bx as readWebPage, by as parseImageSize, bz as configuredImageModel, bA as generateImages, bB as inspectImage, bC as findSubagent, bD as checkCardWrite, bE as recordAgentCardChanges, bF as findTrigger, bG as parseRunAt, bH as isFinished, bI as webhookUrl, bJ as saveCustomProvider, bK as IMAGE_BACKGROUNDS, bL as IMAGE_FORMATS, bM as startChatGptSignIn, bN as cancelChatGptSignIn, bO as finishChatGptSignIn, bP as chatGptSignInState, bQ as cliCommand, bR as parseImageModel } from '../chunks/src.js-DlynI0hv.js';
3
- import { A as AVATARS } from '../chunks/avatars.js-qKyBQC6I.js';
4
- import { g as getAuth, s as svelteKitHandler } from '../chunks/auth.js-CjtH41kh.js';
5
- import { i as isCardPath, a as categoryOf, M as MEMORY_CATEGORIES } from '../chunks/memory-categories.js-DDXxnICw.js';
6
- import { t as translations } from '../chunks/i18n.js-Cakuk6U0.js';
7
- import { p as parsePreferences, P as PREFERENCES_COOKIE, m as matchLocale } from '../chunks/preferences.svelte.js-B5ab6njf.js';
8
- import { v as error, A as redirect } from '../chunks/utils.js-CLRDf9Jk.js';
9
- import { rmSync, mkdirSync, chmodSync, existsSync, writeFileSync, unlinkSync, readFileSync } from 'node:fs';
10
- import { userInfo, tmpdir, homedir } from 'node:os';
11
- import { dirname, resolve, join, extname, isAbsolute } from 'node:path';
12
- import { pathToFileURL } from 'node:url';
13
- import http from 'node:http';
14
- import { spawn, spawnSync } from 'node:child_process';
15
- import { parseArgs, format } from 'node:util';
16
- import { createServer, connect } from 'node:net';
17
- import { Duplex } from 'node:stream';
18
- import { setTimeout as setTimeout$1 } from 'node:timers/promises';
19
- import { createInterface } from 'node:readline/promises';
20
- import http2 from 'node:http2';
21
- import '../chunks/rolldown-runtime.js-DAzahgG2.js';
22
- import 'node:module';
23
- import '../chunks/media-refs.js-q0nPxUYL.js';
24
- import '../chunks/usage.js-DNQuJpUU.js';
25
- import '../chunks/memory-export.js-JzBYtuXI.js';
26
- import '../chunks/articles.js-DI9tx0xR.js';
27
- import '../chunks/schedule.js-CGJAo63f.js';
28
- import 'node:crypto';
29
- import 'better-sqlite3';
30
- import 'node:dns';
31
- import 'node:https';
32
- import 'node:stream/promises';
33
- import 'node:zlib';
34
- import 'node:events';
35
- import 'node:string_decoder';
36
- import '../chunks/shared.js-1MmsW0Qq.js';
37
- import '../chunks/uneval.js-NmnccxCg.js';
38
- import '../chunks/internal2.js-CM6RC5j4.js';
39
- import '../chunks/server.js-BAHAkSRU.js';
40
- import '../chunks/factory.js-CQLK42R-.js';
41
- import '../chunks/zod.js-CWybfdic.js';
42
- import '../chunks/routing.js-BuS-2pZB.js';
43
- import 'node:fs/promises';
44
-
45
- //#region ../cli/src/io.ts
46
- function createIo(host) {
47
- return {
48
- ...host,
49
- log: (...args) => host.stdout(`${format(...args)}\n`),
50
- error: (...args) => host.stderr(`${format(...args)}\n`)
51
- };
52
- }
53
- /** A mistake in how the command was called, or something it can't do, in words for the caller. */
54
- function fail$1(message) {
55
- throw new Error(message);
56
- }
57
- //#endregion
58
- //#region ../cli/src/protocol.ts
59
- /**
60
- * Commands that always run in a process of their own: they prompt at a terminal, run the
61
- * gateway or manage its service.
62
- */
63
- var LOCAL_ONLY = /* @__PURE__ */ new Set([
64
- "setup",
65
- "start",
66
- "service",
67
- "init"
68
- ]);
69
- /** Larger messages end the connection: stdin is the only big one, and notes are far smaller. */
70
- var MAX_MESSAGE_CHARS = 16777216;
71
- /** Sends a message, unless the other side has gone. */
72
- function send(socket, message) {
73
- if (socket.writable) socket.write(`${JSON.stringify(message)}\n`);
74
- }
75
- /** Calls `onMessage` with each message as it arrives. Anything malformed ends the connection. */
76
- function receive(socket, onMessage) {
77
- let buffer = "";
78
- socket.setEncoding("utf8");
79
- socket.on("data", (chunk) => {
80
- buffer += chunk;
81
- for (let end = buffer.indexOf("\n"); end !== -1; end = buffer.indexOf("\n")) {
82
- if (socket.destroyed) return;
83
- const line = buffer.slice(0, end);
84
- buffer = buffer.slice(end + 1);
85
- let message;
86
- try {
87
- message = JSON.parse(line);
88
- } catch {
89
- socket.destroy();
90
- return;
91
- }
92
- if (typeof message !== "object" || message === null) {
93
- socket.destroy();
94
- return;
95
- }
96
- try {
97
- onMessage(message);
98
- } catch (err) {
99
- console.error("[nolune] a malformed message on the nolune command socket:", err);
100
- socket.destroy();
101
- return;
102
- }
103
- }
104
- if (buffer.length > MAX_MESSAGE_CHARS) socket.destroy();
105
- });
106
- }
107
- //#endregion
108
- //#region ../cli/src/agent.ts
109
- var AGENT_HELP = `Subagents (in agent commands: agents that work on a task in the background, in a
110
- conversation of their own that starts with only the task)
111
- nolune agent run [<id>] --prompt "<task>" [--preset NAME] [--effort LEVEL]
112
- start a subagent, or give one that finished more work;
113
- prints its id and its log file (--prompt - reads stdin).
114
- It uses this chat's model and reasoning unless given:
115
- --preset takes a name from \`nolune preset list\`, --effort
116
- one of ${EFFORTS.join(", ")}
117
- nolune agent watch <id> wait until it's done and print its last message; run
118
- it with run_in_background to be told when it's done
119
- nolune agent steer <id> --prompt "<message>"
120
- message a subagent while it works
121
- nolune agent stop <id>
122
- nolune agent list`;
123
- var WATCH_POLL_MS = 1e3;
124
- function parentId(io) {
125
- const id = io.env.NOLUNE_CONVERSATION_ID;
126
- if (!id) throw new Error("`nolune agent` only works in the agent's commands: subagents belong to the conversation that starts them.");
127
- return id;
128
- }
129
- async function promptFrom(io, value, usage) {
130
- const text = (value === "-" ? await io.readStdin() : value)?.trim();
131
- if (!text) throw new Error(`usage: ${usage}`);
132
- return text;
133
- }
134
- function name(positionals, usage) {
135
- const given = positionals[0];
136
- if (!given) throw new Error(`usage: ${usage}`);
137
- return given;
138
- }
139
- function subagent(parent, id) {
140
- const found = findSubagent(parent, id);
141
- if (!found) throw new Error(`this conversation has no subagent "${id}". \`nolune agent list\` shows them.`);
142
- return found;
143
- }
144
- /** The exit code: `watch` fails with 1 when the subagent failed or was stopped. */
145
- async function agentCommand(io, action, args) {
146
- const { values, positionals } = parseArgs({
147
- args,
148
- allowPositionals: true,
149
- options: {
150
- prompt: { type: "string" },
151
- preset: { type: "string" },
152
- effort: { type: "string" }
153
- }
154
- });
155
- switch (action) {
156
- case "run": {
157
- const prompt = await promptFrom(io, values.prompt, "nolune agent run [<id>] --prompt \"<task>\" [--preset NAME] [--effort LEVEL] (--prompt - reads stdin)");
158
- if (values.effort !== void 0 && !EFFORTS.includes(values.effort)) throw new Error(`--effort must be one of ${EFFORTS.join(", ")}.`);
159
- const { subagent: s, conversation, created } = runSubagent({
160
- parentId: parentId(io),
161
- name: positionals[0],
162
- prompt,
163
- presetId: values.preset ? resolvePreset(values.preset)?.id : void 0,
164
- effort: values.effort
165
- });
166
- const model = `${conversation.presetName}, reasoning ${conversation.effort}`;
167
- io.log(created ? `Started subagent ${s.name} (${model}).` : `Gave ${s.name} more work (${model}).`);
168
- const log = subagentLogPath(s);
169
- if (log) io.log(`Log: ${log} (what it says and runs as it works, without its reasoning; check it with tail)`);
170
- 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 "..."\`.`);
171
- return;
172
- }
173
- case "watch": {
174
- const parent = parentId(io);
175
- const id = name(positionals, "nolune agent watch <id>");
176
- for (;;) {
177
- const result = subagentResult(subagent(parent, id));
178
- if (result) {
179
- io.log(result.text);
180
- return result.ok ? 0 : 1;
181
- }
182
- await setTimeout$1(WATCH_POLL_MS, void 0, { signal: io.signal });
183
- }
184
- }
185
- case "steer": {
186
- const usage = "nolune agent steer <id> --prompt \"<message>\" (or --prompt - to read stdin)";
187
- const id = name(positionals, usage);
188
- const text = await promptFrom(io, values.prompt, usage);
189
- const s = steerSubagent({
190
- parentId: parentId(io),
191
- name: id,
192
- text
193
- });
194
- io.log(`Sent ${s.name} your message; it reads it at its next step.`);
195
- return;
196
- }
197
- case "stop": {
198
- const s = requestSubagentStop({
199
- parentId: parentId(io),
200
- name: name(positionals, "nolune agent stop <id>")
201
- });
202
- io.log(`Stopping ${s.name}.`);
203
- return;
204
- }
205
- case "list":
206
- case void 0: {
207
- const all = listSubagents(parentId(io));
208
- if (!all.length) {
209
- io.log("This conversation has no subagents.");
210
- return;
211
- }
212
- for (const s of all) {
213
- const conv = getConversation(s.conversationId);
214
- const status = s.error && s.status !== "done" ? `${s.status} (${s.error})` : s.status;
215
- io.log(`${s.name} ${status}`);
216
- if (conv?.title) io.log(` ${conv.title}`);
217
- if (conv) io.log(` ${conv.presetName}, reasoning ${conv.effort}`);
218
- const log = subagentLogPath(s);
219
- if (log) io.log(` log: ${log}`);
220
- }
221
- return;
222
- }
223
- default: throw new Error("usage: nolune agent run|watch|steer|stop|list. See `nolune help`.");
224
- }
225
- }
226
- //#endregion
227
- //#region ../cli/src/card.ts
228
- var CARD_HELP = `Cards (a note per user that goes with them into all their profiles; at most ${MAX_CARD_CHARS} characters)
229
- nolune card [<name|email>] print someone's card, or list everyone's
230
- People edit their own card on its page in the web app; in a chat, nolune changes one with
231
- nolune memory, only from what its owner says about themselves.`;
232
- function cardCommand(io, args) {
233
- const [who] = args;
234
- if (who === "help") {
235
- io.log(CARD_HELP);
236
- return;
237
- }
238
- if (!who) {
239
- const users = listUsers();
240
- if (!users.length) {
241
- io.log("No users yet.");
242
- return;
243
- }
244
- const cards = users.map((u) => cardOf(u.id));
245
- const files = new Map(cardFiles(cards).map((file) => [file.path, file]));
246
- const width = Math.max(...cards.map((card) => card.path.length));
247
- for (const card of cards) {
248
- const facts = files.get(card.path)?.facts.length ?? 0;
249
- io.log(` ${card.path.padEnd(width)} ${facts ? `${facts} fact${facts === 1 ? "" : "s"}` : "empty"} (${card.owner})`);
250
- }
251
- return;
252
- }
253
- const found = findUser(who.trim());
254
- if (!found) throw new Error(`No user "${who}"`);
255
- const card = cardOf(found.id);
256
- const note = readCard(card);
257
- if (!note?.text.trim()) {
258
- io.log(`${card.owner}'s card (${card.path}) is empty so far.`);
259
- return;
260
- }
261
- io.stdout(note.text.endsWith("\n") ? note.text : `${note.text}\n`);
262
- }
263
- //#endregion
264
- //#region ../cli/src/generate.ts
265
- /** Read when shown: the gateway runs for days, and the image model can change meanwhile. */
266
- function generateHelp() {
267
- return `Pictures (model ${configuredImageModel()}; change it with \`nolune config set image-model\`)
268
- nolune generate image <PROMPT | -> [--image FILE]... [--size square|portrait|landscape|auto|WxH]
269
- [--quality Q] [--background auto|transparent|opaque] [--format png|jpeg|webp]
270
- [--count N] [--model PROVIDER/MODEL] [--out DIR|FILE] [--dry-run]
271
- make pictures from a prompt, or change the --image ones; \`-\` reads the prompt from stdin`;
272
- }
273
- var OPTIONS$1 = {
274
- image: {
275
- type: "string",
276
- short: "i",
277
- multiple: true
278
- },
279
- size: { type: "string" },
280
- quality: { type: "string" },
281
- background: { type: "string" },
282
- format: { type: "string" },
283
- count: {
284
- type: "string",
285
- short: "n"
286
- },
287
- model: { type: "string" },
288
- out: {
289
- type: "string",
290
- short: "o"
291
- },
292
- "dry-run": { type: "boolean" }
293
- };
294
- function oneOf(value, allowed, flag) {
295
- if (value === void 0) return void 0;
296
- const v = value.trim().toLowerCase();
297
- if (!allowed.includes(v)) throw new Error(`--${flag} is one of ${allowed.join(", ")}.`);
298
- return v;
299
- }
300
- function expandHome$1(path) {
301
- if (path === "~") return homedir();
302
- return path.startsWith("~/") ? join(homedir(), path.slice(2)) : path;
303
- }
304
- /** The first few words of the prompt, for the file name. */
305
- function slug(text) {
306
- return text.toLowerCase().normalize("NFKD").replace(/[^a-z0-9\s-]/g, "").trim().split(/[\s-]+/).slice(0, 5).join("-") || "image";
307
- }
308
- function stamp(now) {
309
- const p = (n) => String(n).padStart(2, "0");
310
- return `${now.getFullYear()}-${p(now.getMonth() + 1)}-${p(now.getDate())}-${p(now.getHours())}${p(now.getMinutes())}${p(now.getSeconds())}`;
311
- }
312
- /** Where each picture goes: `--out` as a file (one picture) or a folder, else `images/`. */
313
- function outputPaths(io, out, count, base, format) {
314
- const ext = format === "jpeg" ? "jpg" : format;
315
- let dir;
316
- if (out && /\.(png|jpe?g|webp)$/i.test(out)) {
317
- const file = resolve(io.cwd, expandHome$1(out));
318
- if (count === 1) return {
319
- dir: resolve(file, ".."),
320
- files: [file]
321
- };
322
- dir = resolve(file, "..");
323
- base = file.slice(dir.length + 1, -extname(file).length);
324
- } else if (out) dir = resolve(io.cwd, expandHome$1(out));
325
- else {
326
- const profileDir = io.env.NOLUNE_PROFILE_DIR;
327
- dir = profileDir && isAbsolute(profileDir) ? join(profileDir, "images") : io.cwd;
328
- }
329
- const files = Array.from({ length: count }, (_, i) => join(dir, `${base}${count > 1 ? `-${i + 1}` : ""}.${ext}`));
330
- return {
331
- dir,
332
- files
333
- };
334
- }
335
- function formatBytes(bytes) {
336
- return bytes >= 1048576 ? `${(bytes / 1048576).toFixed(1)} MB` : `${Math.max(1, Math.round(bytes / 1024))} KB`;
337
- }
338
- async function image(io, args) {
339
- const { values, positionals } = parseArgs({
340
- args,
341
- allowPositionals: true,
342
- options: OPTIONS$1
343
- });
344
- let prompt = positionals.join(" ").trim();
345
- if (prompt === "-") prompt = (await io.readStdin()).trim();
346
- if (!prompt) throw new Error("say what to make: nolune generate image \"<prompt>\"");
347
- const inputs = (values.image ?? []).map((path) => resolve(io.cwd, expandHome$1(path)));
348
- const count = values.count === void 0 ? 1 : Number(values.count);
349
- if (!Number.isInteger(count) || count < 1 || count > 4) throw new Error(`--count is between 1 and 4.`);
350
- const background = oneOf(values.background, IMAGE_BACKGROUNDS, "background");
351
- const format = oneOf(values.format, IMAGE_FORMATS, "format");
352
- const size = values.size ? parseImageSize(values.size) : "auto";
353
- const quality = values.quality?.trim().toLowerCase() || void 0;
354
- if (values["dry-run"]) {
355
- const sizeText = typeof size === "object" ? `${size.width}x${size.height}` : size;
356
- io.log(`Model: ${values.model?.trim() || configuredImageModel()}`);
357
- io.log(`Size: ${sizeText}, quality: ${quality ?? "default"}, background: ${background ?? "default"}, format: ${format ?? "png"}, count: ${count}`);
358
- if (inputs.length) io.log(`Images: ${inputs.join(", ")}`);
359
- io.log(`Prompt:\n${prompt}`);
360
- return;
361
- }
362
- const result = await generateImages({
363
- prompt,
364
- images: inputs,
365
- model: values.model,
366
- size,
367
- quality,
368
- background,
369
- format,
370
- count,
371
- signal: io.signal,
372
- onStart: (model) => {
373
- const from = inputs.length ? ` from ${inputs.length} image${inputs.length === 1 ? "" : "s"}` : "";
374
- const what = count === 1 ? "a picture" : `${count} pictures`;
375
- io.log(`Making ${what} with ${model}${from}. This can take a minute or two.`);
376
- }
377
- });
378
- const base = `${stamp(/* @__PURE__ */ new Date())}-${slug(prompt)}`;
379
- const { dir, files } = outputPaths(io, values.out, result.images.length, base, result.images[0].format);
380
- mkdirSync(dir, { recursive: true });
381
- for (const [i, picture] of result.images.entries()) {
382
- writeFileSync(files[i], picture.data);
383
- const info = inspectImage(picture.data);
384
- const details = [
385
- info ? `${info.width}×${info.height}` : null,
386
- picture.format.toUpperCase(),
387
- formatBytes(picture.data.length)
388
- ].filter(Boolean);
389
- io.log(`Saved ${files[i]} (${details.join(", ")})`);
390
- }
391
- }
392
- async function generateCommand(io, action, args) {
393
- if (action === "image") return image(io, args);
394
- throw new Error("usage: nolune generate image <prompt> [options]. See `nolune help`.");
395
- }
396
- //#endregion
397
- //#region ../cli/src/input.ts
398
- async function ask(io, question, defaultValue = "") {
399
- if (!io.stdinIsTTY) return defaultValue;
400
- const rl = createInterface({
401
- input: process.stdin,
402
- output: process.stdout
403
- });
404
- try {
405
- const suffix = defaultValue ? ` [${defaultValue}]` : "";
406
- return (await rl.question(`${question}${suffix}: `)).trim() || defaultValue;
407
- } finally {
408
- rl.close();
409
- }
410
- }
411
- /** Like ask(), but doesn't echo what's typed or pasted (API keys). */
412
- async function askHidden(io, question) {
413
- if (!io.stdinIsTTY) return (await io.readStdin()).trim();
414
- const stdin = process.stdin;
415
- return new Promise((resolve, reject) => {
416
- process.stdout.write(`${question}: `);
417
- let value = "";
418
- const cleanup = () => {
419
- stdin.off("data", onData);
420
- stdin.setRawMode(false);
421
- stdin.pause();
422
- process.stdout.write("\n");
423
- };
424
- const onData = (chunk) => {
425
- for (const ch of chunk) {
426
- if (ch === "\r" || ch === "\n") {
427
- cleanup();
428
- resolve(value.trim());
429
- return;
430
- }
431
- if (ch === "") {
432
- cleanup();
433
- reject(/* @__PURE__ */ new Error("Cancelled"));
434
- return;
435
- }
436
- if (ch === "" || ch === "\b") value = value.slice(0, -1);
437
- else value += ch;
438
- }
439
- };
440
- stdin.setRawMode(true);
441
- stdin.setEncoding("utf8");
442
- stdin.resume();
443
- stdin.on("data", onData);
444
- });
445
- }
446
- //#endregion
447
- //#region ../cli/src/plans.ts
448
- async function confirm(io, question) {
449
- return /^y/i.test(await ask(io, `${question} (yes/no)`, "yes"));
450
- }
451
- /** Runs a program on this terminal, for the person at it; returns its exit code. */
452
- function runOnTerminal(command, args, env = process.env) {
453
- return spawnSync(command, args, {
454
- stdio: "inherit",
455
- env
456
- }).status ?? 1;
457
- }
458
- /**
459
- * Fails unless Claude Code is here and signed in to a plan; says who it's signed in as. With
460
- * `guide`, at a terminal, it first offers what's missing: Anthropic's installer, then Claude
461
- * Code's own sign-in, asking before each. nolune never sees the sign-in: Claude Code keeps it.
462
- */
463
- async function requireClaudePlan(io, guide = false) {
464
- let status = await claudePlanStatus();
465
- if (guide && io.stdinIsTTY && !status.installed) {
466
- io.log("Chats on the Claude plan run through Claude Code, which isn't installed here.");
467
- if (await confirm(io, `Install it with Anthropic's installer (curl -fsSL https://claude.ai/install.sh | bash)?`)) {
468
- 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");
469
- status = await claudePlanStatus();
470
- }
471
- }
472
- if (guide && io.stdinIsTTY && status.installed && status.account && status.problem) {
473
- io.log(status.problem.split(". ")[0].replace(/\.?$/, "."));
474
- if (await confirm(io, "Sign in to your Claude plan now? Claude Code opens its sign-in page")) {
475
- const { command, args, env } = claudeSignInCommand(status.path ?? "claude");
476
- runOnTerminal(command, args, env);
477
- status = await claudePlanStatus();
478
- }
479
- }
480
- if (status.problem || !status.account) fail$1(status.problem ?? "Claude Code didn't answer.");
481
- io.log(`Claude Code (${status.path}): ${status.signedIn}`);
482
- }
483
- /** Opens `url` in this computer's browser, where there's one to open; it's printed either way. */
484
- function openBrowser(url) {
485
- const command = process.platform === "darwin" ? "open" : process.platform === "linux" ? "xdg-open" : null;
486
- if (!command) return;
487
- try {
488
- const child = spawn(command, [url], {
489
- stdio: "ignore",
490
- detached: true
491
- });
492
- child.on("error", () => {});
493
- child.unref();
494
- } catch {}
495
- }
496
- /** At a terminal, takes the address a sign-in ended on, pasted, until the sign-in is over. */
497
- async function takePasted(io, signal) {
498
- const rl = createInterface({
499
- input: process.stdin,
500
- output: process.stdout
501
- });
502
- try {
503
- while (!signal.aborted) {
504
- const address = (await rl.question("", { signal })).trim();
505
- if (!address) continue;
506
- try {
507
- await finishChatGptSignIn(address);
508
- return;
509
- } catch (err) {
510
- if (chatGptSignInState().pending) io.log(err.message);
511
- }
512
- }
513
- } catch {} finally {
514
- rl.close();
515
- }
516
- }
517
- /**
518
- * Signs in with ChatGPT: prints OpenAI's sign-in page, opens it in this computer's browser at a
519
- * terminal, and waits for the browser to come back. A browser on another device ends on an address
520
- * that doesn't load, which can be pasted here at a terminal, or else under Models & keys, where
521
- * this sign-in shows too. Stops when the command is stopped.
522
- */
523
- async function signInWithChatGpt(io, anotherAccount) {
524
- io.signal.throwIfAborted();
525
- const stop = () => cancelChatGptSignIn();
526
- io.signal.addEventListener("abort", stop, { once: true });
527
- const reading = new AbortController();
528
- try {
529
- const signIn = await startChatGptSignIn({ anotherAccount });
530
- io.log(`To sign in with ChatGPT, open this in a browser and allow nolune to use your plan:
531
-
532
- ${signIn.url}
533
- `);
534
- if (io.stdinIsTTY) {
535
- openBrowser(signIn.url);
536
- io.log("In a browser on another device, the page ChatGPT sends you back to won't load: copy its address and paste it here. Waiting…");
537
- takePasted(io, reading.signal);
538
- } else io.log("Open it in a browser on this computer. On another device, the page ChatGPT sends you back to won't load: paste its address under Models & keys on nolune's admin page, where this sign-in shows too. Waiting…");
539
- await signIn.done;
540
- } finally {
541
- reading.abort();
542
- io.signal.removeEventListener("abort", stop);
543
- }
544
- }
545
- /**
546
- * Fails unless someone is signed in with ChatGPT and OpenAI takes the sign-in; says who. With
547
- * `guide`, it first signs in when that's missing or doesn't work, or with `anotherAccount`.
548
- */
549
- async function requireChatGptPlan(io, opts = {}) {
550
- let status = await chatGptPlanStatus({ check: true });
551
- if (opts.guide && (opts.anotherAccount || status.problem)) {
552
- if (status.problem) io.log(status.problem.split(". ")[0].replace(/\.?$/, "."));
553
- await signInWithChatGpt(io, !!opts.anotherAccount);
554
- status = await chatGptPlanStatus({ check: true });
555
- }
556
- if (status.problem || !status.signedIn) fail$1(status.problem ?? "Nobody is signed in with ChatGPT.");
557
- io.log(`ChatGPT plan: ${status.signedIn}`);
558
- }
559
- /**
560
- * `nolune <plan> setup`: installs the plan's agent and signs it in where needed, then says who it's
561
- * signed in as.
562
- */
563
- function setUpPlan(io, plan, args) {
564
- if (plan === "claude-plan") return requireClaudePlan(io, true);
565
- const anotherAccount = args.includes("--another-account");
566
- const unknown = args.find((arg) => arg !== "--another-account");
567
- if (unknown) fail$1(`unknown option ${unknown}. usage: nolune chatgpt-plan setup [--another-account]`);
568
- return requireChatGptPlan(io, {
569
- guide: true,
570
- anotherAccount
571
- });
572
- }
573
- /** `nolune claude-plan …` and `nolune chatgpt-plan …`. */
574
- async function planCommand(io, plan, action, args = []) {
575
- switch (action) {
576
- case "status": return plan === "claude-plan" ? requireClaudePlan(io) : requireChatGptPlan(io);
577
- case "setup":
578
- if (plan === "claude-plan" && !io.stdinIsTTY) fail$1("`nolune claude-plan setup` asks questions: run it in a terminal on this computer.");
579
- return setUpPlan(io, plan, args);
580
- }
581
- if (plan === "chatgpt-plan") {
582
- if (action === "logout") {
583
- const { signedIn } = await chatGptPlanStatus();
584
- const told = await signOutChatGpt();
585
- io.log(signedIn ? `Signed out (was ${signedIn}).${told ? "" : " OpenAI couldn't be told: to be sure, disconnect nolune in ChatGPT's settings."} Chats on chatgpt-plan presets stop until someone signs in again.` : "Not signed in.");
586
- return;
587
- }
588
- if (action === "models") {
589
- for (const m of await listChatGptModels()) if (m.listed) io.log(`${m.id}\t${m.name}`);
590
- return;
591
- }
592
- fail$1("usage: nolune chatgpt-plan status|setup [--another-account]|logout|models");
593
- }
594
- fail$1("usage: nolune claude-plan status|setup");
595
- }
596
- //#endregion
597
- //#region ../cli/src/profile.ts
598
- var PROFILE_HELP = `Profiles and skills
599
- nolune profile list slug, name and avatar of every profile
600
- nolune profile avatar [<name>] [--profile SLUG]
601
- show or change the assistant's avatar in the web chat:
602
- ${AVATARS.join(", ")}`;
603
- /** The profile `--profile` names, else the one the agent's command runs in (NOLUNE_PROFILE). */
604
- function profileFor(io, flag) {
605
- const slug = flag || io.env.NOLUNE_PROFILE;
606
- if (!slug) throw new Error("which profile? Pass --profile <slug>. See `nolune profile list`.");
607
- const found = getProfileBySlug(slug);
608
- if (!found) throw new Error(`no profile with slug "${slug}". See \`nolune profile list\`.`);
609
- return found;
610
- }
611
- function profileCommand(io, action, args) {
612
- if (action === "list") {
613
- for (const p of listProfiles()) io.log(`${p.slug}\t${p.name}\t${p.avatar}`);
614
- return;
615
- }
616
- if (action !== "avatar") throw new Error("usage: nolune profile list|avatar");
617
- const { values, positionals } = parseArgs({
618
- args,
619
- allowPositionals: true,
620
- options: { profile: { type: "string" } }
621
- });
622
- const profile = profileFor(io, values.profile);
623
- const [name] = positionals;
624
- if (!name) {
625
- io.log(profile.avatar);
626
- return;
627
- }
628
- const avatar = setProfileAvatar(profile.id, name.trim().toLowerCase());
629
- 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.`);
630
- }
631
- //#endregion
632
- //#region ../cli/src/memory.ts
633
- var MEMORY_HELP = `Memory (short notes in fixed categories; the agent reads the ones it needs)
634
- nolune memory [list] [--profile SLUG] the notes, how many facts each holds, and whose they are
635
- nolune memory search <words>... find facts in every note, best match first
636
- nolune memory show <topic>... print notes (a topic is home, people/anna, …)
637
- nolune memory add <topic> <fact> add one fact; the note is created if needed
638
- nolune memory replace <topic> <old> <new> change text that appears once in the note
639
- nolune memory forget <topic> <text> remove the one line that contains <text>
640
- nolune memory write <topic> [text] replace the whole note (the text, or stdin)
641
- nolune memory rm <topic>
642
- nolune memory mv <topic> <new-topic>
643
- nolune memory merge <topic> <into-topic> put one note into another about the same thing
644
- nolune memory learning [on|off] whether nolune also saves what it learns by itself,
645
- looking over each chat once it goes quiet
646
- Categories: ${MEMORY_CATEGORIES.map((c) => c === "people" || c === "projects" ? `${c}/<name>` : c).join(", ")}.
647
- Facts go only into these; a note from before them can be read and rewritten until it's moved.
648
- The note core is pinned: every new chat starts with it, so it holds at most ${MAX_PINNED_CHARS} characters.
649
- Each member also has a card, cards/<name>: a note about them that goes with them into all their
650
- profiles (at most ${MAX_CARD_CHARS} characters). show, search, add, replace and forget work on it; a change
651
- is refused unless its owner wrote one of the messages the agent is answering.`;
652
- /**
653
- * `--profile` is picked out by hand: facts are free text and may start with a dash, which an
654
- * option parser would take for an option. `nolune soul` does the same.
655
- */
656
- function splitProfile(args) {
657
- let profile;
658
- const words = [];
659
- for (let i = 0; i < args.length; i++) {
660
- const arg = args[i];
661
- if (arg === "--") {
662
- words.push(...args.slice(i + 1));
663
- break;
664
- }
665
- if (arg === "--profile") profile = args[++i];
666
- else if (arg.startsWith("--profile=")) profile = arg.slice(10);
667
- else words.push(arg);
668
- }
669
- return {
670
- profile,
671
- words
672
- };
673
- }
674
- function need(words, count, usage) {
675
- if (words.length < count) throw new Error(`usage: nolune memory ${usage}`);
676
- }
677
- function plural(n, one, many) {
678
- return `${n} ${n === 1 ? one : many}`;
679
- }
680
- /** Why `nolune memory <action>` doesn't take a card. */
681
- function notOnCards(action, topics) {
682
- const card = topics.find(isCardPath);
683
- if (!card) return;
684
- throw new Error(action === "write" ? `${card} is a card: change it a fact at a time with add, replace and forget. Only its owner rewrites it, on its page.` : `${card} is a card, which isn't ${action === "rm" ? "deleted" : "moved or merged"}: change it a fact at a time with add, replace and forget.`);
685
- }
686
- /** A card of the profile's, after checking the agent of this chat may change it. */
687
- function writableCard(io, profile, topic) {
688
- const card = profileCard(profile, topic);
689
- checkCardWrite(card, {
690
- profileId: profile.id,
691
- conversationId: io.env.NOLUNE_CONVERSATION_ID
692
- });
693
- return card;
694
- }
695
- /** Records the agent's change to a card for its owner, when it runs in a chat. */
696
- function recordCardChange(io, profile, change) {
697
- const conversationId = io.env.NOLUNE_CONVERSATION_ID;
698
- if (conversationId) recordAgentCardChanges({
699
- profileId: profile.id,
700
- conversationId
701
- }, [change]);
702
- }
703
- async function memoryCommand(io, args) {
704
- const { profile: flag, words } = splitProfile(args);
705
- const [action = "list", ...rest] = words;
706
- if (action === "help") {
707
- io.log(MEMORY_HELP);
708
- return;
709
- }
710
- const profile = profileFor(io, flag);
711
- const slug = profile.slug;
712
- switch (action) {
713
- case "list": {
714
- const files = listMemoryFiles(slug);
715
- if (!files.length) {
716
- io.log(`No notes yet for ${profile.name}. Start one with: nolune memory add <topic> "<fact>"`);
717
- listCards(io, profileCards(profile.id));
718
- return;
719
- }
720
- const members = membersWithNotes(profile);
721
- const whose = new Map(members.flatMap((m) => m.note ? [[m.note, m.name]] : []));
722
- io.log(`Notes for ${profile.name} (${profileMemoryDir(slug)}):`);
723
- const width = Math.max(...files.map((f) => f.path.length));
724
- for (const f of files) {
725
- 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)";
726
- io.log(` ${f.path.padEnd(width)} ${plural(f.facts.length, "fact", "facts").padEnd(9)} changed ${formatLocalTime(new Date(f.updatedAt))}${about}`);
727
- }
728
- const waiting = members.filter((m) => !m.note || !files.some((f) => f.path === m.note));
729
- 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.`);
730
- listCards(io, profileCards(profile.id));
731
- return;
732
- }
733
- case "search": {
734
- need(rest, 1, "search <words>...");
735
- const query = rest.join(" ");
736
- const cards = profileCards(profile.id).map((card) => card.path);
737
- const hits = await searchMemory(slug, query, 20, cards);
738
- if (!hits.length) {
739
- 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>\`.`);
740
- return;
741
- }
742
- for (const hit of hits) io.log(`${hit.path}:${hit.line} ${hit.text}${hit.heading ? ` (${hit.heading})` : ""}`);
743
- return;
744
- }
745
- case "show":
746
- need(rest, 1, "show <topic>...");
747
- for (const [i, topic] of rest.entries()) {
748
- const note = isCardPath(topic) ? cardNote(profileCard(profile, topic)) : readMemoryNote(slug, topic);
749
- if (rest.length > 1) io.log(`${i ? "\n" : ""}==> ${note.path} <==`);
750
- io.stdout(note.text.endsWith("\n") ? note.text : `${note.text}\n`);
751
- }
752
- return;
753
- case "add": {
754
- need(rest, 2, "add <topic> <fact>");
755
- const [topic, ...fact] = rest;
756
- const card = isCardPath(topic) ? writableCard(io, profile, topic) : null;
757
- const lines = factLines(fact.join(" "));
758
- const results = (lines.length ? lines : [""]).map((line) => card ? addToCard(card, line) : addMemoryFact(slug, topic, line));
759
- if (card) for (const r of results.filter((r) => !r.duplicate)) recordCardChange(io, profile, {
760
- op: "add",
761
- note: r.path,
762
- line: r.line
763
- });
764
- const { path } = results[0];
765
- const saved = results.filter((r) => !r.duplicate).length;
766
- const verb = results.some((r) => r.created) ? "Started" : "Saved to";
767
- if (!saved) io.log(`${path} already has ${results.length === 1 ? "that" : "those"}.`);
768
- else if (results.length === 1) io.log(`${verb} ${path}.`);
769
- else {
770
- const had = results.length - saved;
771
- io.log(`${verb} ${path}: ${plural(saved, "fact", "facts")}${had ? `, and ${had} it already had` : ""}.`);
772
- }
773
- return;
774
- }
775
- case "replace": {
776
- need(rest, 3, "replace <topic> <old text> <new text>");
777
- if (isCardPath(rest[0])) {
778
- const card = writableCard(io, profile, rest[0]);
779
- const replaced = replaceInCard(card, rest[1], rest[2]);
780
- recordCardChange(io, profile, {
781
- op: "replace",
782
- note: replaced.path,
783
- line: replaced.after,
784
- before: replaced.before
785
- });
786
- io.log(`Updated ${replaced.path}, ${card.owner}'s card.`);
787
- return;
788
- }
789
- const { path } = replaceInMemory(slug, rest[0], rest[1], rest[2]);
790
- io.log(`Updated ${path}.`);
791
- return;
792
- }
793
- case "forget": {
794
- need(rest, 2, "forget <topic> <text>");
795
- const [topic, ...text] = rest;
796
- const { path, removed } = isCardPath(topic) ? forgetInCard(writableCard(io, profile, topic), text.join(" ")) : forgetMemoryFact(slug, topic, text.join(" "));
797
- io.log(`Removed from ${path}: ${removed}`);
798
- return;
799
- }
800
- case "write": {
801
- need(rest, 1, "write <topic> [text] (without text, the note is read from stdin)");
802
- notOnCards("write", rest.slice(0, 1));
803
- const [topic, ...text] = rest;
804
- if (!text.length && io.stdinIsTTY) throw new Error("give the note as text, or pipe it in: nolune memory write <topic> < note.md");
805
- const { path, created } = writeMemoryNote(slug, topic, text.length ? text.join(" ") : await io.readStdin());
806
- io.log(`${created ? "Created" : "Rewrote"} ${path}.`);
807
- return;
808
- }
809
- case "rm":
810
- need(rest, 1, "rm <topic>");
811
- notOnCards("rm", rest.slice(0, 1));
812
- io.log(`Deleted ${removeMemoryNote(slug, rest[0]).path}.`);
813
- return;
814
- case "mv": {
815
- need(rest, 2, "mv <topic> <new topic>");
816
- notOnCards("mv", rest.slice(0, 2));
817
- const moved = moveProfileNote(profile, rest[0], rest[1]);
818
- io.log(`Renamed ${moved.from} to ${moved.to}.`);
819
- return;
820
- }
821
- case "merge": {
822
- need(rest, 2, "merge <topic> <into topic>");
823
- notOnCards("merge", rest.slice(0, 2));
824
- const merged = mergeProfileNotes(profile, rest[0], rest[1]);
825
- 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.`);
826
- return;
827
- }
828
- case "learning": {
829
- const [value] = rest;
830
- if (value !== void 0 && value !== "on" && value !== "off") throw new Error("usage: nolune memory learning [on|off]");
831
- const on = value === void 0 ? profile.learnFromChats : value === "on";
832
- if (value !== void 0) setLearnFromChats(profile.id, on);
833
- 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.`);
834
- return;
835
- }
836
- default: throw new Error(`unknown memory command "${action}". See \`nolune memory help\`.`);
837
- }
838
- }
839
- /** A card as `show` prints it: an empty one says so. */
840
- function cardNote(card) {
841
- return readCard(card) ?? {
842
- path: card.path,
843
- text: `# ${card.owner}\n\n(${card.owner}'s card is empty so far.)\n`
844
- };
845
- }
846
- /** The members' cards, after a profile's notes. */
847
- function listCards(io, cards) {
848
- if (!cards.length) return;
849
- const files = new Map(cardFiles(cards).map((file) => [file.path, file]));
850
- io.log(`Cards, which go with each member into all their profiles (${paths.cards}), at most ${MAX_CARD_CHARS} characters each:`);
851
- const width = Math.max(...cards.map((card) => card.path.length));
852
- for (const card of cards) {
853
- const file = files.get(card.path);
854
- const facts = file?.facts.length ?? 0;
855
- io.log(` ${card.path.padEnd(width)} ${plural(facts, "fact", "facts").padEnd(9)} ${file && facts ? `changed ${formatLocalTime(new Date(file.updatedAt))} ` : ""}(${card.owner}'s)`);
856
- }
857
- }
858
- //#endregion
859
- //#region ../relay/src/headers.ts
860
- /** Connection-specific headers, which HTTP/2 forbids and every proxy drops. */
861
- var HOP_BY_HOP = /* @__PURE__ */ new Set([
862
- "connection",
863
- "keep-alive",
864
- "proxy-connection",
865
- "transfer-encoding",
866
- "upgrade",
867
- "te",
868
- "trailer",
869
- "host",
870
- "http2-settings",
871
- "expect"
872
- ]);
873
- /**
874
- * A request's or answer's headers as they go on to the next hop, HTTP/1.1 or HTTP/2: without the
875
- * connection-specific ones (and those the Connection header names) or HTTP/2's pseudo-headers.
876
- */
877
- function endToEnd(headers) {
878
- const listed = new Set(String(headers.connection ?? "").split(",").map((token) => token.trim().toLowerCase()));
879
- const kept = {};
880
- for (const [name, value] of Object.entries(headers)) {
881
- if (value === void 0 || name.startsWith(":") || HOP_BY_HOP.has(name) || listed.has(name)) continue;
882
- kept[name] = value;
883
- }
884
- return kept;
885
- }
886
- //#endregion
887
- //#region ../relay/src/protocol.ts
888
- /** Where a gateway opens its WebSocket, on the relay's own host. */
889
- var CONNECT_PATH = "/api/connect";
890
- /** Registration, status and release: `POST` here, `GET` and `DELETE` on `<path>/<name>`. */
891
- var GATEWAYS_PATH = "/api/gateways";
892
- /** Why the relay closed a gateway's WebSocket (application close codes, 4000-4999). */
893
- var CLOSE = {
894
- /** No gateway of that name, or the wrong token. */
895
- unknown: 4001,
896
- /** The gateway speaks another RELAY_PROTOCOL. */
897
- protocol: 4002,
898
- /** Another connection with the same name and token took over. */
899
- replaced: 4003,
900
- /** The gateway gave its name back (`DELETE /api/gateways/<name>`), or the operator removed it. */
901
- released: 4004,
902
- /** The relay's operator blocked the gateway; the reason is the close reason. */
903
- blocked: 4005
904
- };
905
- /**
906
- * A gateway's name, the first label of its address: 3 to 32 lowercase letters, digits and dashes,
907
- * starting and ending with a letter or digit. No `--`, so no name reads as punycode (`xn--`).
908
- */
909
- function isValidName(name) {
910
- return /^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$/.test(name) && !name.includes("--");
911
- }
912
- //#endregion
913
- //#region ../relay/src/stream.ts
914
- var OPEN = 1;
915
- /** Past this much unsent, writes wait for the socket to catch up. */
916
- var HIGH_WATER_MARK = 1048576;
917
- /**
918
- * Binary messages become the stream's bytes; text messages go to `onText` (protocol messages, never
919
- * part of the stream). Reading can't pause the socket, but it needn't: HTTP/2's flow control
920
- * bounds what the other side sends. Writing waits while the socket has too much unsent. Ending or
921
- * destroying the stream closes the socket, and the socket closing ends the stream's reading side.
922
- */
923
- function webSocketStream(socket, onText) {
924
- socket.binaryType = "arraybuffer";
925
- const whenDrained = (callback) => {
926
- if (socket.readyState !== OPEN) return callback(/* @__PURE__ */ new Error("the WebSocket closed"));
927
- if (socket.bufferedAmount < HIGH_WATER_MARK) return callback();
928
- setTimeout(() => whenDrained(callback), 5);
929
- };
930
- const stream = new Duplex({
931
- read() {},
932
- write(chunk, _encoding, callback) {
933
- if (socket.readyState !== OPEN) return callback(/* @__PURE__ */ new Error("the WebSocket closed"));
934
- socket.send(chunk);
935
- whenDrained(callback);
936
- },
937
- final(callback) {
938
- socket.close(1e3);
939
- callback();
940
- },
941
- destroy(err, callback) {
942
- if (socket.readyState === OPEN) socket.close(err ? 1011 : 1e3);
943
- callback(err);
944
- }
945
- });
946
- socket.addEventListener("message", ({ data }) => {
947
- if (typeof data === "string") onText?.(data);
948
- else if (data instanceof ArrayBuffer) stream.push(Buffer.from(data));
949
- });
950
- socket.addEventListener("close", () => stream.push(null));
951
- return stream;
952
- }
953
- //#endregion
954
- //#region ../cli/src/relay.ts
955
- var RELAY_HELP = `Reaching nolune from anywhere (no tunnel, port forwarding or domain of your own)
956
- nolune relay enable [--name NAME] get a public address through nolune's relay, like
957
- https://NAME.nolune.family (a random name without
958
- --name). It passes the family's traffic to this
959
- computer, and could see it, as any tunnel could.
960
- --server URL uses a relay of your own
961
- nolune relay status the address, and whether the gateway is connected
962
- nolune relay disable stop using the relay and give the address back`;
963
- var NAME_RULE = "a name has 3 to 32 lowercase letters, digits and single dashes, and starts and ends with a letter or digit";
964
- var RESTART_HINT = "Restart the gateway to apply it: `nolune service restart`, or stop `nolune start` and run it again.";
965
- /** The relay couldn't be reached at all: no answer, rather than a refusal. */
966
- var RelayUnreachable = class extends Error {};
967
- /** What the relay said when it refused, and its status. */
968
- var RelayRefusal = class extends Error {
969
- status;
970
- constructor(message, status) {
971
- super(message);
972
- this.status = status;
973
- }
974
- };
975
- function size(bytes) {
976
- const gb = bytes / 1024 ** 3;
977
- if (gb >= 1) return `${gb >= 10 ? Math.round(gb) : Number(gb.toFixed(1))} GB`;
978
- return `${Math.round(bytes / 1024 ** 2)} MB`;
979
- }
980
- /** A request to the relay's API, with its error in words when it refuses. */
981
- async function relayApi(server, path, init = {}) {
982
- let res;
983
- try {
984
- res = await fetch(new URL(path, server), {
985
- ...init,
986
- signal: AbortSignal.timeout(15e3)
987
- });
988
- } catch (err) {
989
- const cause = err.cause?.message;
990
- throw new RelayUnreachable(`couldn't reach the relay at ${server} (${cause ?? err.message})`, { cause: err });
991
- }
992
- if (res.status === 204) return void 0;
993
- const body = await res.json().catch(() => null);
994
- if (!res.ok || !body) throw new RelayRefusal(body?.error ?? `the relay at ${server} answered ${res.status}`, res.status);
995
- return body;
996
- }
997
- function registerGateway(server, name) {
998
- return relayApi(server, GATEWAYS_PATH, {
999
- method: "POST",
1000
- headers: { "content-type": "application/json" },
1001
- body: JSON.stringify(name ? { name } : {})
1002
- });
1003
- }
1004
- function gatewayPath(relay) {
1005
- return `${GATEWAYS_PATH}/${encodeURIComponent(relay.name)}`;
1006
- }
1007
- function gatewayStatus(relay) {
1008
- return relayApi(relay.server, gatewayPath(relay), { headers: { authorization: `Bearer ${relay.token}` } });
1009
- }
1010
- function releaseGateway(relay) {
1011
- return relayApi(relay.server, gatewayPath(relay), {
1012
- method: "DELETE",
1013
- headers: { authorization: `Bearer ${relay.token}` }
1014
- });
1015
- }
1016
- /**
1017
- * Gets an address from the relay and keeps it in config.json, unless there's one already (from
1018
- * this relay, and with this name when one is asked for) that the relay still knows. A new name
1019
- * gives the old one back; an address the relay forgot is asked for again.
1020
- */
1021
- async function enableRelay(io, opts = {}) {
1022
- const current = readConfig().relay;
1023
- const server = (opts.server || io.env.NOLUNE_RELAY_SERVER || current?.server || "https://relay.nolune.dev").replace(/\/+$/, "");
1024
- let name = opts.name?.trim().toLowerCase() || void 0;
1025
- if (name !== void 0 && !isValidName(name)) fail$1(NAME_RULE);
1026
- if (current && current.server === server && (name === void 0 || name === current.name)) {
1027
- if (await gatewayStatus(current).then(() => true, (err) => !(err instanceof RelayRefusal && err.status === 401))) return {
1028
- relay: current,
1029
- created: false
1030
- };
1031
- name = current.name;
1032
- }
1033
- const registration = await registerGateway(server, name);
1034
- const relay = {
1035
- server,
1036
- name: registration.name,
1037
- url: registration.url,
1038
- token: registration.token
1039
- };
1040
- updateConfig((c) => {
1041
- c.relay = relay;
1042
- });
1043
- if (current && (current.server !== server || current.name !== relay.name)) await releaseGateway(current).catch(() => {});
1044
- return {
1045
- relay,
1046
- created: true
1047
- };
1048
- }
1049
- async function relayCommand(io, action, args) {
1050
- switch (action) {
1051
- case "enable": {
1052
- const { values } = parseArgs({
1053
- args,
1054
- options: {
1055
- name: { type: "string" },
1056
- server: { type: "string" }
1057
- }
1058
- });
1059
- const { relay, created } = await enableRelay(io, values);
1060
- if (!created) {
1061
- io.log(`The relay is already on: ${relay.url}`);
1062
- return;
1063
- }
1064
- io.log(`nolune's address: ${relay.url}
1065
- ${RESTART_HINT} Then open the address on any device: everyone signs in with their own account.
1066
-
1067
- The relay passes traffic between browsers and this computer, and could see it, as any tunnel
1068
- could. \`nolune relay disable\` stops using it.`);
1069
- return;
1070
- }
1071
- case "status": {
1072
- const relay = readConfig().relay;
1073
- if (!relay) {
1074
- io.log(`The relay is off; nolune's address is ${publicOrigin(readConfig())}.
1075
- \`nolune relay enable\` gives it one that works from anywhere.`);
1076
- return;
1077
- }
1078
- io.log(`Address ${relay.url}`);
1079
- io.log(`Relay ${relay.server}`);
1080
- let status;
1081
- try {
1082
- status = await gatewayStatus(relay);
1083
- } catch (err) {
1084
- io.log(err instanceof RelayRefusal && err.status === 401 ? "Gateway the relay doesn't know this address any more: nolune asks for it again when it connects, or `nolune relay enable` now" : `Gateway unknown: ${err.message}`);
1085
- return;
1086
- }
1087
- const { online, traffic, blocked } = status;
1088
- io.log(`Gateway ${online ? "connected" : "not connected: is nolune running? (`nolune service status`)"}`);
1089
- if (traffic) {
1090
- const limit = traffic.limit === null ? "" : ` of ${size(traffic.limit)}`;
1091
- const over = traffic.limit !== null && traffic.bytes >= traffic.limit;
1092
- io.log(`Traffic ${size(traffic.bytes)}${limit} this month${over ? ": used up, so the address doesn't work until the 1st" : ""}`);
1093
- }
1094
- if (blocked) io.log(`Blocked by the relay: ${blocked}`);
1095
- return;
1096
- }
1097
- case "disable": {
1098
- const relay = readConfig().relay;
1099
- if (!relay) {
1100
- io.log("The relay is already off.");
1101
- return;
1102
- }
1103
- let note = "";
1104
- try {
1105
- await releaseGateway(relay);
1106
- } catch (err) {
1107
- note = `\nThe relay couldn't be told (${err.message}), but only this computer had the address's token, so nothing else can use it.`;
1108
- }
1109
- const config = updateConfig((c) => {
1110
- delete c.relay;
1111
- });
1112
- io.log(`Stopped using the relay: ${relay.url} no longer leads here, and nolune's address is ${publicOrigin(config)}.
1113
- ${RESTART_HINT}${note}`);
1114
- return;
1115
- }
1116
- default: fail$1("usage: nolune relay enable [--name NAME] [--server URL] | status | disable");
1117
- }
1118
- }
1119
- var READY_TIMEOUT_MS = 3e4;
1120
- var PING_MS = 3e4;
1121
- var PING_TIMEOUT_MS = 15e3;
1122
- var MAX_BACKOFF_MS = 6e4;
1123
- /** When the relay doesn't know the gateway and it couldn't get its name back: try again later. */
1124
- var UNKNOWN_RETRY_MS = 3e5;
1125
- /** Asking for the name again counts as a registration, which the relay limits: once an hour. */
1126
- var RECLAIM_EVERY_MS = 36e5;
1127
- /** As the relay's (packages/relay/src/relay.ts): uploads don't crawl over a long distance. */
1128
- var STREAM_WINDOW_BYTES = 1048576;
1129
- var SESSION_WINDOW_BYTES = 16777216;
1130
- /**
1131
- * Keeps the gateway connected to the relay while it runs, reconnecting whenever the connection
1132
- * drops (after a moment, then less often while the relay can't be reached), and passes every
1133
- * request to the gateway's own web server at `target`. `log` gets a line when it connects, and
1134
- * once when it loses the connection or can't get one, rather than at every try.
1135
- */
1136
- function connectRelay(relay, target, log) {
1137
- const agent = new http.Agent({ keepAlive: true });
1138
- const hello = {
1139
- type: "hello",
1140
- protocol: 1,
1141
- name: relay.name,
1142
- token: relay.token
1143
- };
1144
- let stopped = false;
1145
- let retry;
1146
- let endAttempt;
1147
- let failures = 0;
1148
- let reported = false;
1149
- let wasOnline = false;
1150
- let reclaimedAt = 0;
1151
- /** config.json's address, when it's still the one this connection is for. */
1152
- const sameAddress = (c) => c?.server === relay.server && c.name === relay.name;
1153
- /**
1154
- * The relay doesn't know the address: it let the name go while nolune was away for months (or
1155
- * its operator removed it). Asks for the same name again, and keeps the new token in
1156
- * config.json. When someone else has the name now, nolune stops using it, so nothing opens their
1157
- * nolune for this one: 'stop'. 'later' when the relay couldn't be asked, or was asked lately.
1158
- */
1159
- async function reclaim() {
1160
- const current = readConfig().relay;
1161
- if (!sameAddress(current)) {
1162
- log("the relay address in config.json changed, so nolune stopped using this one. " + RESTART_HINT);
1163
- return "stop";
1164
- }
1165
- if (current.token !== hello.token) {
1166
- hello.token = current.token;
1167
- return "back";
1168
- }
1169
- if (Date.now() - reclaimedAt < RECLAIM_EVERY_MS) return "later";
1170
- reclaimedAt = Date.now();
1171
- try {
1172
- const registration = await registerGateway(relay.server, relay.name);
1173
- hello.token = registration.token;
1174
- updateConfig((c) => {
1175
- if (sameAddress(c.relay)) c.relay = {
1176
- ...c.relay,
1177
- token: registration.token
1178
- };
1179
- });
1180
- log(`the relay had let ${relay.url} go while nolune was away, so nolune asked for it again`);
1181
- return "back";
1182
- } catch (err) {
1183
- if (err instanceof RelayRefusal && err.status === 409) {
1184
- updateConfig((c) => {
1185
- if (sameAddress(c.relay)) delete c.relay;
1186
- });
1187
- log(`the relay let ${relay.url} go while nolune was away, and someone else has it now, so nolune stopped using it. \`nolune relay enable\` gets a new address; then restart nolune.`);
1188
- return "stop";
1189
- }
1190
- if (!reported) log(`the relay doesn't know this address (${relay.name}) any more, and nolune couldn't ask for it again (${err.message}). It tries again every hour, or run \`nolune relay enable\` and restart nolune.`);
1191
- reported = true;
1192
- return "later";
1193
- }
1194
- }
1195
- /** Passes one request to the web server, and its answer back, both streamed. */
1196
- function forward(stream, headers) {
1197
- const request = http.request({
1198
- host: target.host,
1199
- port: target.port,
1200
- agent,
1201
- method: headers[":method"],
1202
- path: headers[":path"],
1203
- headers: {
1204
- ...endToEnd(headers),
1205
- host: headers[":authority"]
1206
- }
1207
- });
1208
- let answered = false;
1209
- request.on("response", (response) => {
1210
- response.on("end", () => answered = true);
1211
- if (stream.destroyed) return void response.destroy();
1212
- try {
1213
- stream.respond({
1214
- ":status": response.statusCode ?? 502,
1215
- ...endToEnd(response.headers)
1216
- });
1217
- } catch {
1218
- response.destroy();
1219
- stream.close(http2.constants.NGHTTP2_INTERNAL_ERROR);
1220
- return;
1221
- }
1222
- response.pipe(stream);
1223
- });
1224
- request.on("error", () => {
1225
- if (!stream.destroyed) stream.close(http2.constants.NGHTTP2_INTERNAL_ERROR);
1226
- });
1227
- stream.on("error", () => {});
1228
- stream.on("close", () => {
1229
- if (!answered) request.destroy();
1230
- });
1231
- stream.pipe(request);
1232
- }
1233
- function retryIn(ms) {
1234
- retry = setTimeout(attempt, ms);
1235
- }
1236
- function attempt() {
1237
- if (stopped) return;
1238
- const socket = new WebSocket(new URL(CONNECT_PATH, relay.server.replace(/^http/, "ws")));
1239
- let session;
1240
- let ended = false;
1241
- let pinging;
1242
- const waiting = setTimeout(() => end(), READY_TIMEOUT_MS);
1243
- const stream = webSocketStream(socket, (text) => {
1244
- let message;
1245
- try {
1246
- message = JSON.parse(text);
1247
- } catch {
1248
- return;
1249
- }
1250
- if (message.type !== "ready" || session) return;
1251
- clearTimeout(waiting);
1252
- const server = http2.createServer({
1253
- settings: {
1254
- initialWindowSize: STREAM_WINDOW_BYTES,
1255
- maxConcurrentStreams: 256
1256
- },
1257
- maxSessionMemory: 64
1258
- });
1259
- server.on("stream", forward);
1260
- server.on("session", (created) => {
1261
- session = created;
1262
- created.on("error", () => {});
1263
- created.on("close", () => end());
1264
- created.once("connect", () => created.setLocalWindowSize(SESSION_WINDOW_BYTES));
1265
- });
1266
- server.emit("connection", stream);
1267
- pinging = setInterval(ping, PING_MS);
1268
- log(wasOnline ? "connected to the relay again" : `nolune is reachable at ${message.url}`);
1269
- wasOnline = true;
1270
- failures = 0;
1271
- reported = false;
1272
- });
1273
- /** A connection whose network went away never closes by itself: it stops answering. */
1274
- function ping() {
1275
- if (!session || session.destroyed) return;
1276
- const timeout = setTimeout(() => end(), PING_TIMEOUT_MS);
1277
- session.ping((err) => {
1278
- clearTimeout(timeout);
1279
- if (err) end();
1280
- });
1281
- }
1282
- function end(code, reason) {
1283
- if (ended) return;
1284
- ended = true;
1285
- clearTimeout(waiting);
1286
- clearInterval(pinging);
1287
- const connected = session !== void 0;
1288
- session?.destroy();
1289
- stream.destroy();
1290
- if (socket.readyState === WebSocket.CONNECTING || socket.readyState === WebSocket.OPEN) socket.close();
1291
- if (endAttempt === end) endAttempt = void 0;
1292
- if (stopped) return;
1293
- if (code === CLOSE.replaced) return log("another nolune connected to the relay with this address and took it over, so this one stopped using it. Only one computer can have an address.");
1294
- if (code === CLOSE.released) return log("the relay address was given back, so nolune stopped using it. `nolune relay enable` gets a new one.");
1295
- if (code === CLOSE.blocked) return log(`the relay blocked this address (${reason}), so nolune stopped using it.`);
1296
- if (code === CLOSE.protocol) return log(`the relay needs a newer nolune (${reason}): update nolune and restart it.`);
1297
- if (code === CLOSE.unknown) {
1298
- reclaim().catch(() => "later").then((outcome) => {
1299
- if (stopped || outcome === "stop") return;
1300
- retryIn(outcome === "back" ? 0 : UNKNOWN_RETRY_MS);
1301
- });
1302
- return;
1303
- }
1304
- if (connected) {
1305
- log("lost the connection to the relay; reconnecting");
1306
- return retryIn(1e3);
1307
- }
1308
- failures++;
1309
- if (!reported) log(`can't reach the relay at ${relay.server}; trying again`);
1310
- reported = true;
1311
- retryIn(Math.min(MAX_BACKOFF_MS, 1e3 * 2 ** failures) * (.5 + Math.random() / 2));
1312
- }
1313
- endAttempt = end;
1314
- socket.addEventListener("open", () => socket.send(JSON.stringify(hello)));
1315
- socket.addEventListener("close", (event) => end(event.code, event.reason));
1316
- socket.addEventListener("error", () => end());
1317
- }
1318
- attempt();
1319
- return { close() {
1320
- stopped = true;
1321
- clearTimeout(retry);
1322
- endAttempt?.();
1323
- agent.destroy();
1324
- } };
1325
- }
1326
- //#endregion
1327
- //#region ../cli/src/soul.ts
1328
- var SOUL_HELP = `Soul (who nolune is for a profile: character, values, tone; at most ${MAX_SOUL_CHARS} characters)
1329
- nolune soul [show] [--profile SLUG] print it
1330
- nolune soul write [text] replace it (the text, or stdin); every chat gets it
1331
- from its next message
1332
- nolune soul rm remove it`;
1333
- async function soulCommand(io, args) {
1334
- const { profile: flag, words } = splitProfile(args);
1335
- const [action = "show", ...rest] = words;
1336
- if (action === "help") {
1337
- io.log(SOUL_HELP);
1338
- return;
1339
- }
1340
- const profile = profileFor(io, flag);
1341
- switch (action) {
1342
- case "show": {
1343
- const text = readSoulFile(profile.slug);
1344
- if (!text) {
1345
- io.log(`${profile.name} has no soul yet. Start one with: nolune soul write < soul.md`);
1346
- return;
1347
- }
1348
- io.log(text);
1349
- return;
1350
- }
1351
- case "write": {
1352
- if (!rest.length && io.stdinIsTTY) throw new Error("give the soul as text, or pipe it in: nolune soul write < soul.md");
1353
- const text = rest.length ? rest.join(" ") : await io.readStdin();
1354
- if (!text.trim()) throw new Error("the soul is empty. To remove it, use `nolune soul rm`.");
1355
- writeSoul(profile.slug, text);
1356
- io.log(`Saved the soul of ${profile.name}. Every chat gets it from its next message.`);
1357
- return;
1358
- }
1359
- case "rm":
1360
- writeSoul(profile.slug, "");
1361
- io.log(`Removed the soul of ${profile.name}.`);
1362
- return;
1363
- default: throw new Error(`unknown soul command "${action}". See \`nolune soul help\`.`);
1364
- }
1365
- }
1366
- //#endregion
1367
- //#region ../cli/src/triggers.ts
1368
- var TRIGGER_HELP = `Automations (results show up as notifications in the web UI)
1369
- nolune trigger add <name> WHEN WHAT [--summary S] [--icon I] [--preset NAME] [--effort LEVEL]
1370
- [--profile SLUG]
1371
- WHEN: --cron "<min hour day month weekday>" (local time) | --at "YYYY-MM-DD HH:MM"
1372
- | --in 30m|2h|1d | --webhook
1373
- WHAT: --prompt "<what the agent should do>" | --script "<shell command, no model>"
1374
- --summary: one plain sentence the family sees on the Automations page
1375
- --icon: a Lucide icon name for it, like umbrella
1376
- nolune trigger list [--profile SLUG]
1377
- nolune trigger show|run|pause|resume|rm <name|id>
1378
- nolune trigger edit <name|id> [--name N] [--summary S] [--icon I] [WHEN] [WHAT] [--preset NAME]
1379
- [--effort LEVEL]
1380
- nolune wake <message> [--title T] [--profile SLUG]
1381
- start a background agent run now; trigger scripts call this (\`nolune wake -\` reads stdin)`;
1382
- var OPTIONS = {
1383
- cron: { type: "string" },
1384
- at: { type: "string" },
1385
- in: { type: "string" },
1386
- webhook: { type: "boolean" },
1387
- prompt: { type: "string" },
1388
- script: { type: "string" },
1389
- name: { type: "string" },
1390
- summary: { type: "string" },
1391
- icon: { type: "string" },
1392
- title: { type: "string" },
1393
- preset: { type: "string" },
1394
- effort: { type: "string" },
1395
- profile: { type: "string" }
1396
- };
1397
- function parse(args) {
1398
- return parseArgs({
1399
- args,
1400
- allowPositionals: true,
1401
- options: OPTIONS
1402
- });
1403
- }
1404
- function optionalProfile(io, flag) {
1405
- return flag || io.env.NOLUNE_PROFILE ? profileFor(io, flag) : void 0;
1406
- }
1407
- function whenFrom(values) {
1408
- if ([
1409
- values.cron,
1410
- values.at,
1411
- values.in,
1412
- values.webhook
1413
- ].filter((v) => v !== void 0).length > 1) throw new Error("give only one of --cron, --at, --in and --webhook");
1414
- if (values.cron !== void 0) return {
1415
- kind: "cron",
1416
- cron: values.cron
1417
- };
1418
- if (values.at !== void 0) return {
1419
- kind: "once",
1420
- runAt: parseRunAt(values.at)
1421
- };
1422
- if (values.in !== void 0) return {
1423
- kind: "once",
1424
- runAt: parseRunAt(values.in)
1425
- };
1426
- if (values.webhook) return { kind: "webhook" };
1427
- }
1428
- function whatFrom(values) {
1429
- if (values.prompt !== void 0 && values.script !== void 0) throw new Error("give either --prompt or --script, not both");
1430
- if (values.prompt !== void 0) return {
1431
- action: "agent",
1432
- prompt: values.prompt
1433
- };
1434
- if (values.script !== void 0) return {
1435
- action: "script",
1436
- command: values.script
1437
- };
1438
- }
1439
- function effortFrom(values) {
1440
- if (values.effort === void 0) return void 0;
1441
- if (!EFFORTS.includes(values.effort)) throw new Error(`--effort must be one of ${EFFORTS.join(", ")}`);
1442
- return values.effort;
1443
- }
1444
- function shortId(t) {
1445
- return t.id.slice(0, 8);
1446
- }
1447
- function status(t) {
1448
- if (isFinished(t)) return "done";
1449
- if (!t.enabled) return "paused";
1450
- if (t.nextRunAt) return `next ${formatLocalTime(t.nextRunAt)}`;
1451
- return "waiting for its webhook";
1452
- }
1453
- function printWebhook(io, t) {
1454
- if (!t.webhookToken) return;
1455
- const url = webhookUrl(t.webhookToken);
1456
- io.log(`Webhook URL (keep it secret: anyone with it can start a run):
1457
- ${url}
1458
- Send JSON; form-encoded and text/plain bodies are refused (cross-site protection), e.g.:
1459
- curl -X POST -H 'content-type: application/json' -d '{"text":"hello"}' '${url}'`);
1460
- }
1461
- function describeWhat(t) {
1462
- return t.action === "agent" ? "wakes the agent with its prompt" : `runs \`${t.command}\``;
1463
- }
1464
- function triggerCommand(io, action, args) {
1465
- const { values, positionals } = parse(args);
1466
- const ref = () => {
1467
- if (!positionals[0]) throw new Error("missing <name|id>. See `nolune trigger list`.");
1468
- return findTrigger(positionals[0], optionalProfile(io, values.profile)?.id);
1469
- };
1470
- switch (action) {
1471
- case void 0:
1472
- case "help":
1473
- io.log(TRIGGER_HELP);
1474
- return;
1475
- case "add": {
1476
- const name = positionals[0];
1477
- if (!name) throw new Error("missing <name>. See `nolune help`.");
1478
- const when = whenFrom(values);
1479
- if (!when) throw new Error("say when: --cron, --at, --in or --webhook");
1480
- const what = whatFrom(values);
1481
- if (!what) throw new Error("say what: --prompt or --script");
1482
- const profile = profileFor(io, values.profile);
1483
- const preset = resolvePreset(values.preset, io.env.NOLUNE_CONVERSATION_ID);
1484
- const t = createTrigger({
1485
- profileId: profile.id,
1486
- name,
1487
- summary: values.summary,
1488
- icon: values.icon,
1489
- when,
1490
- what,
1491
- presetId: preset?.id ?? null,
1492
- effort: effortFrom(values)
1493
- });
1494
- io.log(`Added "${t.name}" (${shortId(t)}) to ${profile.slug}: ${describeWhen(t)}, ${describeWhat(t)}.`);
1495
- if (t.nextRunAt) io.log(`Next run: ${formatLocalTime(t.nextRunAt)}`);
1496
- printWebhook(io, t);
1497
- return;
1498
- }
1499
- case "list": {
1500
- const profile = optionalProfile(io, values.profile);
1501
- const slugs = new Map(listProfiles().map((p) => [p.id, p.slug]));
1502
- const triggers = listTriggers(profile?.id);
1503
- if (!triggers.length) io.log("No triggers.");
1504
- for (const t of triggers) {
1505
- const where = profile ? "" : `${slugs.get(t.profileId)}\t`;
1506
- io.log(`${shortId(t)}\t${where}${t.name}\t${describeWhen(t)}\t${t.action === "agent" ? "prompt" : "script"}\t${status(t)}`);
1507
- }
1508
- return;
1509
- }
1510
- case "show": {
1511
- const t = ref();
1512
- const preset = t.presetId ? getPreset(t.presetId) : void 0;
1513
- io.log(`${t.name} (${t.id})
1514
- summary ${t.summary ?? "(none: the Automations page shows only the name)"}
1515
- icon ${t.icon ?? "(none)"}
1516
- profile ${getProfile(t.profileId)?.slug ?? "?"}
1517
- when ${describeWhen(t)} (${status(t)})
1518
- ${t.action === "agent" ? `prompt ${t.prompt}` : `script ${t.command}`}
1519
- model ${preset?.name ?? "default preset"}, reasoning ${t.effort}`);
1520
- printWebhook(io, t);
1521
- const runs = listRuns(t.id, 10);
1522
- io.log(runs.length ? "Recent runs:" : "No runs yet.");
1523
- for (const run of runs) {
1524
- const firstLine = run.status === "failed" && run.output ? `: ${run.output.split("\n")[0]}` : "";
1525
- io.log(` ${formatLocalTime(run.createdAt)}\t${run.action}\t${run.source}\t${run.status}${firstLine}`);
1526
- }
1527
- const lastScript = runs.find((r) => r.action === "script" && r.output);
1528
- if (lastScript) io.log(`Output of the last script run:\n${lastScript.output}`);
1529
- return;
1530
- }
1531
- case "run": {
1532
- const t = ref();
1533
- queueRun(t, "manual");
1534
- io.log(`Queued "${t.name}". The gateway starts it within a few seconds.`);
1535
- return;
1536
- }
1537
- case "pause":
1538
- case "resume": {
1539
- const t = setTriggerEnabled(ref().id, action === "resume");
1540
- io.log(`"${t.name}" is ${action === "resume" ? `on (${status(t)})` : "paused"}.`);
1541
- return;
1542
- }
1543
- case "rm": {
1544
- const t = ref();
1545
- deleteTrigger(t.id);
1546
- io.log(`Removed "${t.name}".`);
1547
- return;
1548
- }
1549
- case "edit": {
1550
- const current = ref();
1551
- const preset = values.preset ? resolvePreset(values.preset) : void 0;
1552
- const t = updateTrigger(current.id, {
1553
- name: values.name,
1554
- summary: values.summary,
1555
- icon: values.icon,
1556
- when: whenFrom(values),
1557
- what: whatFrom(values),
1558
- presetId: preset?.id,
1559
- effort: effortFrom(values)
1560
- });
1561
- io.log(`Updated "${t.name}": ${describeWhen(t)}, ${describeWhat(t)} (${status(t)}).`);
1562
- if (t.webhookToken && !current.webhookToken) printWebhook(io, t);
1563
- return;
1564
- }
1565
- default: throw new Error("usage: nolune trigger help|add|list|show|run|pause|resume|rm|edit");
1566
- }
1567
- }
1568
- /** Queues a background agent run. Inside a trigger's script, the run belongs to that trigger. */
1569
- async function wakeCommand(io, args) {
1570
- const { values, positionals } = parse(args);
1571
- const given = positionals.join(" ").trim();
1572
- const text = given === "-" ? (io.stdinIsTTY ? "" : await io.readStdin()).trim() : given;
1573
- if (!text) throw new Error("usage: nolune wake <what happened and what to do> (or - to read stdin)");
1574
- const t = io.env.NOLUNE_TRIGGER_ID ? getTrigger(io.env.NOLUNE_TRIGGER_ID) : void 0;
1575
- const profileId = t?.profileId ?? profileFor(io, values.profile).id;
1576
- const preset = values.preset || !t ? resolvePreset(values.preset, io.env.NOLUNE_CONVERSATION_ID) : void 0;
1577
- const run = queueWake({
1578
- profileId,
1579
- triggerId: t?.id,
1580
- text,
1581
- title: values.title,
1582
- presetId: preset?.id,
1583
- effort: effortFrom(values)
1584
- });
1585
- io.log(`Woke nolune ("${run.title}"). Its reply shows up as a notification.`);
1586
- }
1587
- //#endregion
1588
- //#region ../cli/src/service.ts
1589
- var logFile = join(paths.logs, "gateway.log");
1590
- /** macOS LaunchAgent: runs as the logged-in user, so commands get their home folder and files. */
1591
- var LABEL = "dev.nolune.gateway";
1592
- var plistPath = join(homedir(), "Library", "LaunchAgents", `${LABEL}.plist`);
1593
- function target() {
1594
- return `gui/${process.getuid?.() ?? 501}/${LABEL}`;
1595
- }
1596
- function launchctl(...args) {
1597
- return spawnSync("launchctl", args, { encoding: "utf8" });
1598
- }
1599
- function escapeXml(text) {
1600
- return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1601
- }
1602
- function renderPlist() {
1603
- return `<?xml version="1.0" encoding="UTF-8"?>
1604
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1605
- <plist version="1.0">
1606
- <dict>
1607
- <key>Label</key>
1608
- <string>${LABEL}</string>
1609
- <key>ProgramArguments</key>
1610
- <array>
1611
- ${[...cliCommand(), "start"].map((a) => `\t\t<string>${escapeXml(a)}</string>`).join("\n")}
1612
- </array>
1613
- <key>EnvironmentVariables</key>
1614
- <dict>
1615
- <key>NOLUNE_HOME</key>
1616
- <string>${escapeXml(paths.home)}</string>
1617
- </dict>
1618
- <key>WorkingDirectory</key>
1619
- <string>${escapeXml(paths.home)}</string>
1620
- <key>RunAtLoad</key>
1621
- <true/>
1622
- <key>KeepAlive</key>
1623
- <true/>
1624
- <key>ThrottleInterval</key>
1625
- <integer>10</integer>
1626
- <key>StandardOutPath</key>
1627
- <string>${escapeXml(logFile)}</string>
1628
- <key>StandardErrorPath</key>
1629
- <string>${escapeXml(logFile)}</string>
1630
- </dict>
1631
- </plist>
1632
- `;
1633
- }
1634
- var launchAgent = {
1635
- file: plistPath,
1636
- render: renderPlist,
1637
- async install() {
1638
- mkdirSync(dirname(plistPath), { recursive: true });
1639
- mkdirSync(paths.logs, { recursive: true });
1640
- writeFileSync(plistPath, renderPlist());
1641
- launchctl("bootout", target());
1642
- for (let attempt = 0;; attempt++) {
1643
- const result = launchctl("bootstrap", `gui/${process.getuid?.() ?? 501}`, plistPath);
1644
- if (result.status === 0) return false;
1645
- if (attempt >= 10) throw new Error(`launchctl bootstrap failed: ${result.stderr.trim()}`);
1646
- await setTimeout$1(300);
1647
- }
1648
- },
1649
- uninstall() {
1650
- launchctl("bootout", target());
1651
- if (existsSync(plistPath)) unlinkSync(plistPath);
1652
- },
1653
- restart() {
1654
- if (launchctl("kickstart", "-k", target()).status !== 0) throw new Error("The service is not loaded. Run `nolune service install` first.");
1655
- },
1656
- status() {
1657
- const result = launchctl("print", target());
1658
- const pid = /\bpid = (\d+)/.exec(result.stdout ?? "")?.[1];
1659
- return {
1660
- installed: existsSync(plistPath),
1661
- loaded: result.status === 0,
1662
- pid: pid ? Number(pid) : null
1663
- };
1664
- }
1665
- };
1666
- /**
1667
- * Linux: a systemd user service, so like the LaunchAgent it runs as this user. systemd runs a
1668
- * user's services from their first login to their last logout, or from boot when they linger
1669
- * (`loginctl enable-linger`), which install turns on when logind lets it.
1670
- */
1671
- var UNIT = "nolune.service";
1672
- var configHome = process.env.XDG_CONFIG_HOME;
1673
- var unitPath = join(configHome && isAbsolute(configHome) ? configHome : join(homedir(), ".config"), "systemd", "user", UNIT);
1674
- /** `%` starts a specifier in a unit file (`%h` is the home folder), so a literal one is doubled. */
1675
- function unitValue(text) {
1676
- return text.replace(/%/g, "%%");
1677
- }
1678
- /** One quoted word, as an Environment= assignment is. */
1679
- function unitWord(text) {
1680
- return `"${unitValue(text).replace(/[\\"]/g, "\\$&")}"`;
1681
- }
1682
- /**
1683
- * ExecStart=: the program's path is taken as it is (systemd refuses one with quotes or
1684
- * backslashes), while its arguments expand `$NAME`, so a literal `$` in them is `$$`.
1685
- */
1686
- function execLine([program, ...args]) {
1687
- return [unitWord(program), ...args.map((a) => unitWord(a).replace(/\$/g, () => "$$"))].join(" ");
1688
- }
1689
- /** Type=exec and append: need systemd 240 (2018) or later. */
1690
- function renderUnit() {
1691
- return `[Unit]
1692
- Description=nolune gateway
1693
-
1694
- [Service]
1695
- Type=exec
1696
- ExecStart=${execLine([...cliCommand(), "start"])}
1697
- Environment=${unitWord(`NOLUNE_HOME=${paths.home}`)}
1698
- WorkingDirectory=${unitValue(paths.home)}
1699
- Restart=always
1700
- RestartSec=10
1701
- StandardOutput=append:${unitValue(logFile)}
1702
- StandardError=append:${unitValue(logFile)}
1703
-
1704
- [Install]
1705
- WantedBy=default.target
1706
- `;
1707
- }
1708
- /** Runs `systemctl --user`, failing when there's no systemd user manager to talk to. */
1709
- function systemctl(...args) {
1710
- const result = spawnSync("systemctl", ["--user", ...args], { encoding: "utf8" });
1711
- const unreachable = result.error ? "there is no systemctl" : /Failed to connect to .*bus|not been booted with systemd/.test(result.stderr) ? result.stderr.trim().split("\n")[0] : null;
1712
- if (unreachable) throw new Error(`\`nolune service\` runs nolune as a systemd user service, and this user's systemd can't be reached (${unreachable}). Log in as this user directly, not with su or sudo, or run \`nolune start\` under your own process manager.`);
1713
- return result;
1714
- }
1715
- function systemctlOrFail(...args) {
1716
- const result = systemctl(...args);
1717
- if (result.status !== 0) throw new Error(`systemctl --user ${args.join(" ")} failed: ${result.stderr.trim()}`);
1718
- }
1719
- function lingering() {
1720
- return existsSync(join("/var/lib/systemd/linger", userInfo().username));
1721
- }
1722
- var systemdUnit = {
1723
- file: unitPath,
1724
- render: renderUnit,
1725
- async install() {
1726
- systemctl("show-environment");
1727
- mkdirSync(dirname(unitPath), { recursive: true });
1728
- mkdirSync(paths.logs, { recursive: true });
1729
- writeFileSync(unitPath, renderUnit());
1730
- systemctlOrFail("daemon-reload");
1731
- systemctlOrFail("enable", UNIT);
1732
- systemctlOrFail("restart", UNIT);
1733
- if (lingering()) return true;
1734
- return spawnSync("loginctl", ["enable-linger", "--no-ask-password"]).status === 0;
1735
- },
1736
- uninstall() {
1737
- systemctl("disable", "--now", UNIT);
1738
- if (existsSync(unitPath)) unlinkSync(unitPath);
1739
- systemctl("daemon-reload");
1740
- systemctl("reset-failed", UNIT);
1741
- },
1742
- restart() {
1743
- const result = systemctl("restart", UNIT);
1744
- if (result.status === 0) return;
1745
- if (!existsSync(unitPath)) throw new Error("The service is not installed. Run `nolune service install` first.");
1746
- throw new Error(`systemctl --user restart ${UNIT} failed: ${result.stderr.trim()}`);
1747
- },
1748
- status() {
1749
- const { stdout } = systemctl("show", UNIT, "--property=ActiveState,MainPID");
1750
- const state = /^ActiveState=(.*)$/m.exec(stdout)?.[1];
1751
- const pid = Number(/^MainPID=(\d+)$/m.exec(stdout)?.[1] ?? 0);
1752
- return {
1753
- installed: existsSync(unitPath),
1754
- loaded: state !== void 0 && state !== "inactive",
1755
- pid: state === "active" && pid > 0 ? pid : null
1756
- };
1757
- }
1758
- };
1759
- /**
1760
- * nolune.app's: the app runs `Nolune --gateway` as its child while it's open, which keeps
1761
- * `nolune start` running and writes its own pid here. SIGHUP has it start the gateway again.
1762
- */
1763
- var appPidFile = join(paths.home, "gateway.pid");
1764
- /** The app's gateway keeper, when it's running. */
1765
- function appKeeperPid(pidFile = appPidFile) {
1766
- let pid;
1767
- try {
1768
- pid = Number(readFileSync(pidFile, "utf8").trim());
1769
- } catch {
1770
- return null;
1771
- }
1772
- if (!Number.isInteger(pid) || pid <= 0) return null;
1773
- const ps = spawnSync("ps", [
1774
- "-p",
1775
- String(pid),
1776
- "-o",
1777
- "comm="
1778
- ], { encoding: "utf8" });
1779
- return ps.status === 0 && /(^|\/)Nolune$/.test(ps.stdout.trim()) ? pid : null;
1780
- }
1781
- function runByApp() {
1782
- throw new Error("the nolune app runs the gateway while it is open.");
1783
- }
1784
- var appGateway = {
1785
- file: appPidFile,
1786
- render: runByApp,
1787
- install: runByApp,
1788
- uninstall: runByApp,
1789
- restart() {
1790
- const pid = appKeeperPid();
1791
- if (pid === null) throw new Error("nolune isn't running. Open the nolune app.");
1792
- process.kill(pid, "SIGHUP");
1793
- },
1794
- status() {
1795
- const pid = appKeeperPid();
1796
- return {
1797
- installed: true,
1798
- loaded: pid !== null,
1799
- pid
1800
- };
1801
- }
1802
- };
1803
- function manager() {
1804
- if (process.platform === "darwin") return appManaged() ? appGateway : launchAgent;
1805
- if (process.platform === "linux") return systemdUnit;
1806
- throw new Error("`nolune service` runs nolune in the background on macOS (a LaunchAgent) and Linux (a systemd user service). Here, run `nolune start` under your own process manager.");
1807
- }
1808
- /** The LaunchAgent's plist or the systemd unit that `install` writes here. */
1809
- function renderServiceFile() {
1810
- return manager().render();
1811
- }
1812
- async function installService() {
1813
- const service = manager();
1814
- return {
1815
- file: service.file,
1816
- atBoot: await service.install()
1817
- };
1818
- }
1819
- function uninstallService() {
1820
- manager().uninstall();
1821
- }
1822
- function restartService() {
1823
- manager().restart();
1824
- }
1825
- function serviceStatus() {
1826
- return manager().status();
1827
- }
1828
- //#endregion
1829
- //#region ../cli/src/web.ts
1830
- var WEB_HELP = `The web (through Firecrawl: its free tier, limited per day, until \`nolune key set firecrawl\`)
1831
- nolune web search <query> [--limit N] [--news] [--recent day|week|month|year] [--country CC]
1832
- the top results' titles, addresses and snippets
1833
- (5 unless --limit, at most 20); --news for news
1834
- articles, --country as someone there sees them (de)
1835
- nolune web read <url> [--out FILE] a page's main text (or a PDF's) as Markdown; a long
1836
- one is saved whole to a file, whose path it prints`;
1837
- /** More than this and the page goes to a file: a command's output is cut at 30 KB. */
1838
- var MAX_PRINTED = 2e4;
1839
- function expandHome(path) {
1840
- if (path === "~") return homedir();
1841
- return path.startsWith("~/") ? join(homedir(), path.slice(2)) : path;
1842
- }
1843
- async function search(io, args) {
1844
- const { values, positionals } = parseArgs({
1845
- args,
1846
- allowPositionals: true,
1847
- options: {
1848
- limit: {
1849
- type: "string",
1850
- short: "n"
1851
- },
1852
- news: { type: "boolean" },
1853
- recent: { type: "string" },
1854
- country: { type: "string" }
1855
- }
1856
- });
1857
- const query = positionals.join(" ").trim();
1858
- if (!query) throw new Error("say what to look for: nolune web search \"<query>\"");
1859
- const limit = values.limit === void 0 ? 5 : Number(values.limit);
1860
- if (!Number.isInteger(limit) || limit < 1 || limit > 20) throw new Error(`--limit is between 1 and 20.`);
1861
- const recent = values.recent?.trim().toLowerCase();
1862
- if (recent !== void 0 && !Object.hasOwn(WEB_RECENT, recent)) throw new Error(`--recent is one of ${Object.keys(WEB_RECENT).join(", ")}.`);
1863
- const country = values.country?.trim();
1864
- if (country !== void 0 && !/^[a-z]{2}$/i.test(country)) throw new Error("--country is a two-letter country code, like de or us.");
1865
- const { results, warning } = await searchWeb(query, {
1866
- limit,
1867
- news: values.news,
1868
- recent,
1869
- country,
1870
- env: io.env,
1871
- signal: io.signal
1872
- });
1873
- if (warning) io.log(`Firecrawl: ${warning}`);
1874
- if (!results.length) {
1875
- io.log(`No results for "${query}".`);
1876
- return;
1877
- }
1878
- io.log(results.map((r, i) => {
1879
- const text = [r.text, r.date && `(${r.date})`].filter(Boolean).join(" ");
1880
- return `${i + 1}. ${r.title}\n ${r.url}${text ? `\n ${text}` : ""}`;
1881
- }).join("\n\n"));
1882
- }
1883
- /** A name for the page's file: when it was read, and its address in a few words. */
1884
- function fileName(url, now) {
1885
- const p = (n) => String(n).padStart(2, "0");
1886
- const stamp = `${now.getFullYear()}-${p(now.getMonth() + 1)}-${p(now.getDate())}-${p(now.getHours())}${p(now.getMinutes())}${p(now.getSeconds())}`;
1887
- const { hostname, pathname } = new URL(url);
1888
- return `${stamp}-${`${hostname.replace(/^www\./, "")} ${pathname}`.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/, "") || "page"}.md`;
1889
- }
1890
- function pageText(page) {
1891
- return `${page.title ? `# ${page.title}\n` : ""}${page.url}\n\n${page.markdown}\n`;
1892
- }
1893
- async function read(io, args) {
1894
- const { values, positionals } = parseArgs({
1895
- args,
1896
- allowPositionals: true,
1897
- options: { out: {
1898
- type: "string",
1899
- short: "o"
1900
- } }
1901
- });
1902
- if (positionals.length !== 1) throw new Error("usage: nolune web read <url> [--out FILE]");
1903
- const page = await readWebPage(positionals[0], {
1904
- env: io.env,
1905
- signal: io.signal
1906
- });
1907
- if (page.warning) io.log(`Firecrawl: ${page.warning}`);
1908
- if (page.status) io.log(`The page answered ${page.status}; this is what it showed.`);
1909
- if (!page.markdown) {
1910
- io.log(`${page.url} has no text Firecrawl could read.`);
1911
- return;
1912
- }
1913
- const text = pageText(page);
1914
- if (values.out) {
1915
- const file = resolve(io.cwd, expandHome(values.out));
1916
- mkdirSync(dirname(file), { recursive: true });
1917
- writeFileSync(file, text);
1918
- io.log(`Saved ${page.url} (${text.length} characters) to ${file}`);
1919
- return;
1920
- }
1921
- if (text.length <= MAX_PRINTED) {
1922
- io.stdout(text);
1923
- return;
1924
- }
1925
- const dir = join(io.env.TMPDIR || tmpdir(), "nolune-web");
1926
- const file = join(dir, fileName(page.url, /* @__PURE__ */ new Date()));
1927
- mkdirSync(dir, { recursive: true });
1928
- writeFileSync(file, text);
1929
- const cut = text.lastIndexOf("\n", MAX_PRINTED);
1930
- const shown = text.slice(0, cut > MAX_PRINTED / 2 ? cut : MAX_PRINTED);
1931
- io.log(`${shown}\n\n[${text.length - shown.length} more characters. The whole page is in ${file}: grep it, or read on with sed -n.]`);
1932
- }
1933
- async function webCommand(io, action, args) {
1934
- if (action === "search") return search(io, args);
1935
- if (action === "read") return read(io, args);
1936
- throw new Error("usage: nolune web search <query> | nolune web read <url>. See `nolune help`.");
1937
- }
1938
- //#endregion
1939
- //#region ../cli/src/run.ts
1940
- /** Built when shown, like generateHelp(): the gateway serves it for as long as it runs. */
1941
- var help = () => `nolune - a family agent that runs on this computer
1942
-
1943
- Getting started
1944
- nolune setup interactive first-time setup (your account, and the
1945
- address the family opens: nolune's relay, this
1946
- computer, or your own URL); the model comes after: a
1947
- new profile's welcome on the web asks for one, or use
1948
- key set and preset add below
1949
- nolune start run the gateway in the foreground
1950
- nolune service install|uninstall|restart|status|logs [-f]
1951
- run it in the background (macOS, or Linux with systemd)
1952
-
1953
- ${RELAY_HELP}
1954
-
1955
- Settings (${paths.home})
1956
- nolune config show address, port and what's configured
1957
- nolune config set <host|port|origin> <value> origin = the public URL people open (the relay's
1958
- address is used instead while the relay is on)
1959
- nolune config set image-model <provider/model> for pictures, e.g. openai/gpt-image-2.5-flare
1960
- nolune config set embeddings <auto|off|provider/model>
1961
- what memory search finds meaning with: auto uses the
1962
- OpenAI key, else OpenRouter's; the provider is openai,
1963
- openrouter or custom-openai (a custom provider's model,
1964
- like custom-openai/ollama/nomic-embed-text)
1965
- nolune config set claude-path <path> the Claude Code that claude-plan chats run (found on
1966
- the PATH and in its usual folders otherwise)
1967
- nolune config set command-mode <auto|unrestricted>
1968
- auto (the default): a model checks each command the
1969
- agent runs and blocks what could do harm nobody asked
1970
- for; unrestricted runs them unchecked (not
1971
- recommended). Not from the agent's own commands
1972
- nolune config set safety-model <preset|chat> the preset whose model does auto mode's checks, or
1973
- chat for each chat's own model (the default)
1974
- nolune config set update-check <on|off> on (the default): the gateway asks GitHub once a
1975
- day for nolune's newest release, and admins see when
1976
- there's one
1977
- nolune key set <anthropic|openai|openrouter|xai|firecrawl> [key]
1978
- store an API key (prompts if omitted) after checking
1979
- it; OpenAI's runs GPT chats and makes pictures, xAI's
1980
- runs Grok, Firecrawl's lifts the web search's daily
1981
- limit. Admins can also do this on the web, under
1982
- Models & keys
1983
- nolune key rm <anthropic|openai|openrouter|xai|firecrawl>
1984
- remove a stored key (the environment's is used, if set)
1985
- nolune env set <NAME> <value> extra env var for agent commands (e.g. HASS_TOKEN)
1986
- nolune env rm <NAME> | nolune env list
1987
-
1988
- Custom providers (model servers of your own: Ollama, LM Studio, oMLX, vLLM, llama.cpp...)
1989
- nolune provider add <name> <url> [--api openai|anthropic] [--key K]
1990
- add one, through its OpenAI API (the default) or its
1991
- Anthropic API, or change the address and key of the
1992
- one of that name; nolune asks it for its models first,
1993
- and for its key at a terminal when it wants one. The
1994
- address is the server's, like http://localhost:11434.
1995
- A server that speaks both can be added once for each
1996
- nolune provider rm <name|id> presets on it stop working until they're moved
1997
- nolune provider list
1998
-
1999
- Plans (chats on your own subscription instead of an API key)
2000
- claude-plan: a Claude Pro or Max plan, through Claude Code on this computer, signed in to your
2001
- Claude account; Claude Code keeps the sign-in. chatgpt-plan: a ChatGPT Plus or Pro plan, signed
2002
- in with ChatGPT (Sign in with ChatGPT), which nolune keeps in ~/.nolune/chatgpt.json.
2003
- Plan limits assume one person's ordinary use: keep busy automations and subagents on an API key.
2004
- nolune <plan> status who it's signed in as (and which Claude Code runs)
2005
- nolune claude-plan setup install Claude Code and sign in, where needed,
2006
- asking first, in a terminal
2007
- nolune chatgpt-plan setup [--another-account] sign in with ChatGPT in a browser, where needed; from
2008
- another device, paste the address it ends on. Signs
2009
- in to the account used last unless told otherwise
2010
- nolune chatgpt-plan logout sign out; chats on chatgpt-plan presets stop until
2011
- someone signs in again
2012
- nolune chatgpt-plan models the models the plan offers, for \`nolune preset add\`
2013
-
2014
- Users (there's no sign-up page: admins add people here, or on the People page)
2015
- nolune user create <name> <email> [--password P] [--admin]
2016
- nolune user invite [name] a link to send, where they make their own account
2017
- (once, within 7 days); name: who it's for
2018
- nolune user passwd <name|email> [--password P]
2019
- nolune user admin <name|email> [--off]
2020
- nolune user rm <name|email>
2021
- nolune user list name, email, admin, and their picture's
2022
- file if they have one
2023
-
2024
- Model presets (shared by all profiles)
2025
- nolune preset add <model> [--provider anthropic|openai|openrouter|xai|claude-plan|chatgpt-plan|<custom>]
2026
- [--name N] [--context-window TOKENS]
2027
- the provider checks the model id first (anthropic
2028
- unless given); OpenAI models other than the
2029
- flagships need --context-window. OpenRouter's ids
2030
- name their maker (anthropic/claude-sonnet-5), and the
2031
- model must be able to call tools. xAI's are Grok's
2032
- (grok-4.7), and it lists them with their windows. A
2033
- custom provider (by its name) lists its models; its
2034
- model must call tools too, which shows at its first
2035
- reply, and pictures and PDFs reach it as paths. The
2036
- plans check their sign-in instead, and chatgpt-plan
2037
- the models the plan offers
2038
- nolune preset edit <name|id> [--provider P] [--model M] [--name N]
2039
- [--context-window TOKENS|auto]
2040
- change what's given; a new model is checked like
2041
- add's. Chats already on the preset keep what they had
2042
- nolune preset rm <name|id>
2043
- nolune preset default <name|id> the model new chats start with
2044
- nolune preset list
2045
-
2046
- ${PROFILE_HELP}
2047
- nolune skill new <name> [--description D] [--profile SLUG | --global]
2048
- nolune skill list [--profile SLUG]
2049
- nolune skill enable <name>... [--profile SLUG]
2050
- nolune skill disable <name>... [--profile SLUG] leave out of the profile's new chats
2051
-
2052
- ${TRIGGER_HELP}
2053
-
2054
- ${MEMORY_HELP}
2055
-
2056
- ${CARD_HELP}
2057
-
2058
- ${SOUL_HELP}
2059
-
2060
- ${generateHelp()}
2061
-
2062
- ${WEB_HELP}
2063
-
2064
- Inside agent commands (NOLUNE_PROFILE is set, so --profile can be left out)
2065
- nolune view <image>... show images to the agent: they're attached to the
2066
- command's result (HEIC and big photos are converted)
2067
-
2068
- ${AGENT_HELP}`;
2069
- function positional(args, index, name) {
2070
- const value = args[index];
2071
- if (!value) fail$1(`missing <${name}>. See \`nolune help\`.`);
2072
- return value;
2073
- }
2074
- /**
2075
- * Checks a pasted key with its provider and saves it. A key the provider rejects isn't saved; one
2076
- * it couldn't be asked about is, with a warning, so setup works while the provider is unreachable.
2077
- */
2078
- async function storeApiKey(io, provider, pasted) {
2079
- const { label } = API_KEYS[provider];
2080
- let key;
2081
- try {
2082
- key = normalizeApiKey(pasted);
2083
- } catch (err) {
2084
- fail$1(err.message);
2085
- }
2086
- try {
2087
- const warning = await checkApiKey(provider, key);
2088
- saveApiKey(provider, key);
2089
- io.log(`Saved the ${label} API key.${warning ? ` ${warning}` : ""}`);
2090
- } catch (err) {
2091
- if (!(err instanceof ApiKeyError) || err.reason !== "unchecked") fail$1(err.message);
2092
- saveApiKey(provider, key);
2093
- io.log(`Saved the ${label} API key without checking it. ${err.message}`);
2094
- }
2095
- }
2096
- /**
2097
- * Checks a custom provider's server by asking it for its models, and saves it (adds it, or changes
2098
- * the one of that name): its id and the models it serves. One that wants a key gets asked for it
2099
- * at a terminal; one that can't be reached is saved with a warning, so setup works before the
2100
- * server runs.
2101
- */
2102
- async function storeCustomProvider(io, name, url, api, given) {
2103
- let key = given?.trim() || null;
2104
- const known = findCustomProvider(name);
2105
- 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.`);
2106
- let found;
2107
- try {
2108
- try {
2109
- found = await checkCustomProvider(url, key);
2110
- } catch (err) {
2111
- if (!(err instanceof CustomProviderError) || err.reason !== "key" || key || !io.stdinIsTTY) throw err;
2112
- key = await askHidden(io, `Its API key`) || null;
2113
- if (!key) throw err;
2114
- found = await checkCustomProvider(url, key);
2115
- }
2116
- } catch (err) {
2117
- if (!(err instanceof CustomProviderError) || err.reason !== "unreachable") fail$1(err.message);
2118
- const id = saveOrFail(known, name, url, api, key);
2119
- io.log(`Saved ${findCustomProvider(id)?.name} without checking it. ${err.message}`);
2120
- return {
2121
- id,
2122
- models: []
2123
- };
2124
- }
2125
- const id = saveOrFail(known, name, url, api, key);
2126
- const saved = findCustomProvider(id);
2127
- const some = found.models.slice(0, 8).join(", ");
2128
- const serves = found.models.length ? ` It serves ${some}${found.models.length > 8 ? ` and ${found.models.length - 8} more` : ""}.` : "";
2129
- io.log(`${known ? "Changed" : "Added"} ${saved.name} at ${saved.url}, through its ${saved.api === "openai" ? "OpenAI" : "Anthropic"} API.${serves}${found.warning ? ` ${found.warning}` : ""}`);
2130
- return {
2131
- id,
2132
- models: found.models
2133
- };
2134
- }
2135
- function saveOrFail(known, name, url, api, key) {
2136
- try {
2137
- return saveCustomProvider({
2138
- id: known?.id,
2139
- name: known?.name ?? name,
2140
- api,
2141
- url,
2142
- key
2143
- });
2144
- } catch (err) {
2145
- fail$1(err.message);
2146
- }
2147
- }
2148
- /**
2149
- * A preset's provider and model as typed: a custom provider by its name or id, its model kept as
2150
- * `<id>/<model>`. nolune's own providers as they are.
2151
- */
2152
- function presetTarget(provider, model) {
2153
- if (!provider || isProvider$1(provider)) return {
2154
- provider,
2155
- model
2156
- };
2157
- const custom = findCustomProvider(provider);
2158
- if (!custom) {
2159
- const names = listCustomProviders().map((c) => c.name);
2160
- fail$1(`no provider "${provider}". It's anthropic, openai, openrouter, xai, claude-plan, chatgpt-plan${names.length ? `, or a custom provider: ${names.join(", ")}` : ", or a custom provider added with `nolune provider add <name> <url>`"}.`);
2161
- }
2162
- const bare = model.startsWith(`${custom.id}/`) ? model.slice(custom.id.length + 1) : model;
2163
- return {
2164
- provider: providerFor(custom.api),
2165
- model: `${custom.id}/${bare}`
2166
- };
2167
- }
2168
- /** A preset's model for people: a custom provider's by its name. */
2169
- function presetSource(provider, model) {
2170
- const on = isCustomProvider(provider) ? splitModel(model) : null;
2171
- const custom = on?.provider ? findCustomProvider(on.provider) : void 0;
2172
- return custom && on ? `${custom.name}/${on.model}` : `${provider}/${model}`;
2173
- }
2174
- function requireInit() {
2175
- if (!configExists()) fail$1("not set up yet. Run `nolune setup` first.");
2176
- }
2177
- function resolveProfileSlug(io, flag) {
2178
- const slug = flag || io.env.NOLUNE_PROFILE;
2179
- if (!slug) fail$1("which profile? Pass --profile <slug> (or --global for a global skill).");
2180
- if (!getProfileBySlug(slug)) fail$1(`no profile with slug "${slug}". See \`nolune profile list\`.`);
2181
- return slug;
2182
- }
2183
- function formatTokens(n) {
2184
- if (n == null) return "?";
2185
- return n >= 1e6 ? `${n / 1e6}M` : n >= 1e3 ? `${Math.round(n / 1e3)}K` : String(n);
2186
- }
2187
- function listenAddress() {
2188
- const config = readConfig();
2189
- return {
2190
- host: config.host ?? "127.0.0.1",
2191
- port: config.port ?? 5780,
2192
- origin: publicOrigin(config)
2193
- };
2194
- }
2195
- /** macOS keeps background processes out of these folders; elsewhere there's nothing to say. */
2196
- function fullDiskAccessHint() {
2197
- if (process.platform !== "darwin") return "";
2198
- if (appManaged()) return "\n\nTo let the agent reach Documents, Desktop, Downloads, Photos and Mail, turn on nolune in System Settings > Privacy & Security > Full Disk Access.";
2199
- return `\n\nTo let the agent reach Documents, Desktop, Downloads, Photos and Mail, give Full Disk Access to
2200
- ${process.execPath}
2201
- in System Settings > Privacy & Security > Full Disk Access (click +, press Cmd+Shift+G, paste the path).
2202
- Note: this applies to every script run with that node binary.`;
2203
- }
2204
- async function setup(io, args) {
2205
- const { values } = parseArgs({
2206
- args,
2207
- options: {
2208
- name: { type: "string" },
2209
- email: { type: "string" },
2210
- password: { type: "string" },
2211
- origin: { type: "string" },
2212
- port: { type: "string" },
2213
- relay: { type: "boolean" },
2214
- "relay-name": { type: "string" },
2215
- url: { type: "string" },
2216
- api: { type: "string" }
2217
- },
2218
- allowNegative: true
2219
- });
2220
- const { created } = initConfig();
2221
- getDb();
2222
- installCliShim();
2223
- io.log(created ? `Created ${paths.home}` : `Using ${paths.home}`);
2224
- const admin = listUsers().find((u) => u.isAdmin);
2225
- if (admin) io.log(`Admin account: ${admin.name} <${admin.email}>`);
2226
- else {
2227
- const name = values.name ?? await ask(io, "Your name (the agent sees it on your messages)");
2228
- const email = values.email ?? await ask(io, "Your email (to sign in)");
2229
- const password = values.password ?? generatePassword();
2230
- await createUser({
2231
- name,
2232
- email,
2233
- password,
2234
- isAdmin: true
2235
- });
2236
- io.log(`Created your account. Password: ${values.password ? "(as given)" : password}`);
2237
- }
2238
- const current = listenAddress();
2239
- const port = values.port ? Number(values.port) : current.port;
2240
- updateConfig((c) => {
2241
- c.port = port;
2242
- });
2243
- const relay = values.origin === void 0 && await setupRelay(io, values);
2244
- if (!relay) {
2245
- const origin = values.origin ?? await ask(io, "Public URL people will open (leave as is for this computer only)", readConfig().origin ?? `http://localhost:${port}`);
2246
- updateConfig((c) => {
2247
- c.origin = origin;
2248
- });
2249
- }
2250
- const origin = publicOrigin(readConfig());
2251
- const reach = relay ? `Family members open that address on any device, at home or away, while the gateway runs. The
2252
- relay passes traffic between their browsers and this computer, and could see it, as any tunnel
2253
- could: \`nolune relay disable\` stops using it.` : `The gateway listens on http://${current.host}:${port}. To reach it from outside your home, run
2254
- \`nolune relay enable\` for an address through nolune's relay, or point a tunnel of your own at
2255
- it (Tailscale Funnel, Cloudflare Tunnel, or a VPS) and set its URL with
2256
- \`nolune config set origin https://...\`.`;
2257
- io.log(`
2258
- Done. Next:
2259
- nolune service install run the gateway in the background (or \`nolune start\` to try it)
2260
- nolune user invite Anna a link for a family member (or People, in the web UI)
2261
- open ${origin}
2262
-
2263
- Chats need a model: sign in and make a profile, and its welcome asks for one (a key or a plan,
2264
- then the model). Or add one under Models & keys, or with \`nolune key set\` and \`nolune preset add\`.
2265
-
2266
- ${reach}${fullDiskAccessHint()}`);
2267
- }
2268
- /**
2269
- * Setup's question of how the family reaches nolune: through the relay unless they'd rather not
2270
- * (`--relay` / `--no-relay` answer it; without a terminal and without either, it's no). Returns
2271
- * whether nolune has a relay address, which it keeps once it has one. One it can't get leaves the
2272
- * choice to the origin.
2273
- */
2274
- async function setupRelay(io, values) {
2275
- const existing = readConfig().relay;
2276
- if (existing) {
2277
- io.log(`Address (through nolune's relay): ${existing.url}`);
2278
- return true;
2279
- }
2280
- let wanted = values.relay;
2281
- if (wanted === void 0 && io.stdinIsTTY) {
2282
- io.log(`
2283
- How will your family open nolune? nolune's relay gives it an address like
2284
- https://smiths.nolune.family that works on any device, at home or away, with no tunnel or
2285
- port forwarding. It passes their traffic to this computer, and could see it, as any tunnel
2286
- could. Or keep nolune to this computer, or give a URL of your own.`);
2287
- wanted = /^y/i.test(await ask(io, "Use the relay? (y/n)", "y"));
2288
- }
2289
- if (!wanted) return false;
2290
- let name = values["relay-name"];
2291
- for (let tries = 0;; tries++) {
2292
- if (name === void 0 && io.stdinIsTTY) name = await ask(io, "A name for the address, like smiths (letters, digits and dashes; empty for a random one)");
2293
- try {
2294
- const { relay } = await enableRelay(io, { name });
2295
- io.log(`Address: ${relay.url}`);
2296
- return true;
2297
- } catch (err) {
2298
- io.error(`nolune: ${err.message}`);
2299
- if (!io.stdinIsTTY || tries >= 2 || err instanceof RelayUnreachable) {
2300
- io.log("Leaving the relay off for now: `nolune relay enable` turns it on later.");
2301
- return false;
2302
- }
2303
- name = void 0;
2304
- }
2305
- }
2306
- }
2307
- /** Runs the gateway in this process, so it only makes sense in a process of its own. */
2308
- async function start(io) {
2309
- requireInit();
2310
- if (!existsSync(paths.server)) fail$1(`no server build at ${paths.server}. In a source checkout, run \`pnpm build\` first.`);
2311
- const { host, port, origin } = listenAddress();
2312
- process.env.HOST ??= host;
2313
- process.env.PORT ??= String(port);
2314
- process.env.ORIGIN ??= origin;
2315
- const { relay } = readConfig();
2316
- process.env.BODY_SIZE_LIMIT ??= String(MAX_MEDIA_BYTES + 1048576);
2317
- io.log(`nolune gateway: ${process.env.ORIGIN} (listening on ${process.env.HOST}:${process.env.PORT})`);
2318
- await import(
2319
- /* @vite-ignore */
2320
- pathToFileURL(paths.server).href
2321
- );
2322
- if (relay) {
2323
- const listening = process.env.HOST;
2324
- const link = connectRelay(relay, {
2325
- host: !listening || listening === "0.0.0.0" || listening === "::" ? "127.0.0.1" : listening,
2326
- port: Number(process.env.PORT)
2327
- }, (message) => io.log(`[nolune] relay: ${message}`));
2328
- for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => link.close());
2329
- }
2330
- }
2331
- async function service(io, action, args) {
2332
- switch (action) {
2333
- case "install": {
2334
- if (appManaged()) fail$1("the nolune app runs the gateway while it is open.");
2335
- requireInit();
2336
- if (!existsSync(paths.server)) fail$1("no server build. In a source checkout, run `pnpm build` first.");
2337
- if (args.includes("--dry-run")) {
2338
- io.log(renderServiceFile());
2339
- return;
2340
- }
2341
- const { file, atBoot } = await installService();
2342
- const { origin } = listenAddress();
2343
- const linger = atBoot || process.platform !== "linux" ? "" : `\n\nIt stops when you log out. To keep it running whenever this computer is on, run
2344
- sudo loginctl enable-linger ${userInfo().username}`;
2345
- io.log(`Installed ${file}
2346
- The gateway starts now and ${atBoot ? "whenever this computer starts" : "at every login"}: ${origin}
2347
- Logs: ${logFile}
2348
- It runs with ${process.execPath}; run \`nolune service install\` again after switching Node versions.${fullDiskAccessHint()}${linger}`);
2349
- return;
2350
- }
2351
- case "uninstall":
2352
- if (appManaged()) fail$1("the nolune app runs the gateway while it is open. Quit it from the menu bar, and turn it off under System Settings > General > Login Items so it stays closed.");
2353
- uninstallService();
2354
- io.log("Removed the background service.");
2355
- return;
2356
- case "restart":
2357
- restartService();
2358
- io.log("Restarted.");
2359
- return;
2360
- case "status": {
2361
- const status = serviceStatus();
2362
- if (appManaged() && !status.loaded) io.log("Not running. Open the nolune app.");
2363
- else if (!status.installed) io.log("Not installed. Run `nolune service install`.");
2364
- else if (!status.loaded) io.log("Installed but not loaded. Run `nolune service install`.");
2365
- else io.log(status.pid ? `Running (pid ${status.pid}).` : "Loaded, not running. See `nolune service logs`.");
2366
- return;
2367
- }
2368
- case "logs": {
2369
- if (!existsSync(logFile)) fail$1(`no log yet at ${logFile}`);
2370
- const follow = args.includes("-f") || args.includes("--follow");
2371
- spawn("tail", [
2372
- "-n",
2373
- "100",
2374
- ...follow ? ["-f"] : [],
2375
- logFile
2376
- ], { stdio: "inherit" });
2377
- return;
2378
- }
2379
- default: fail$1("usage: nolune service install|uninstall|restart|status|logs [-f]");
2380
- }
2381
- }
2382
- /**
2383
- * Runs `nolune` with these arguments and returns its exit code. Everything it reads and writes
2384
- * besides its arguments and nolune's own files goes through `io`. An error ends it with its message
2385
- * and exit code 1.
2386
- */
2387
- async function runCli(argv, io) {
2388
- try {
2389
- return await command(io, argv) ?? 0;
2390
- } catch (err) {
2391
- io.error(`nolune: ${err instanceof Error ? err.message : String(err)}`);
2392
- return 1;
2393
- }
2394
- }
2395
- async function command(io, argv) {
2396
- const [group, action, ...rest] = argv;
2397
- switch (group) {
2398
- case void 0:
2399
- case "help":
2400
- case "--help":
2401
- case "-h":
2402
- io.log(help());
2403
- return;
2404
- case "setup": return setup(io, argv.slice(1));
2405
- case "start": return start(io);
2406
- case "service": return service(io, action, rest);
2407
- case "relay":
2408
- requireInit();
2409
- return relayCommand(io, action, rest);
2410
- case "init": {
2411
- const { created } = initConfig();
2412
- getDb();
2413
- const shim = installCliShim();
2414
- io.log(created ? `Created ${paths.config}` : `Config already exists: ${paths.config}`);
2415
- io.log(`Database ready: ${paths.db}`);
2416
- io.log(`Agent shim: ${shim}`);
2417
- return;
2418
- }
2419
- case "config": {
2420
- requireInit();
2421
- if (action === void 0) {
2422
- const config = readConfig();
2423
- const { host, port, origin } = listenAddress();
2424
- const row = (name, value) => io.log(`${name.padEnd(13)} ${value}`);
2425
- row("home", paths.home);
2426
- row("listen", `http://${host}:${port}`);
2427
- row("origin", origin);
2428
- row("relay", config.relay ? `on, through ${config.relay.server} (nolune relay status)` : "off (nolune relay enable gives nolune an address that works from anywhere)");
2429
- for (const key of apiKeyStatuses()) {
2430
- const where = key.source === "config" ? "key set" : key.source === "env" ? `key from ${key.env}` : "";
2431
- const shown = where ? `${where}${key.hint ? ` (…${key.hint})` : ""}` : key.optional ? `no key: the free tier, limited per day (nolune key set ${key.provider})` : `no key (nolune key set ${key.provider})`;
2432
- row(key.provider, shown);
2433
- }
2434
- const customs = listCustomProviders();
2435
- 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>)");
2436
- const claude = claudeExecutable();
2437
- 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)");
2438
- const chatgpt = await chatGptPlanStatus();
2439
- row("chatgpt", chatgpt.signedIn ? `${chatgpt.signedIn} (nolune chatgpt-plan status checks it)` : "not signed in (nolune chatgpt-plan setup signs in)");
2440
- const images = imageGenerationStatus();
2441
- row("images", `${images.model}${images.problem ? ` (${images.problem})` : ""}`);
2442
- row("embeddings", embeddingStatus());
2443
- row("commands", describeCommandSafety());
2444
- row("env", Object.keys(config.commandEnv ?? {}).join(", ") || "-");
2445
- row("version", describeUpdates());
2446
- return;
2447
- }
2448
- if (action !== "set") fail$1("usage: nolune config [set <host|port|origin|image-model|embeddings|claude-path|command-mode|safety-model|update-check> <value>]");
2449
- const key = positional(rest, 0, "host|port|origin|image-model|embeddings|claude-path|command-mode|safety-model|update-check");
2450
- if (key === "command-mode" || key === "safety-model") {
2451
- if (io.env.NOLUNE_CONVERSATION_ID) fail$1("the agent can't change how its own commands are checked. Someone can, at this computer's terminal or on the Models & keys page.");
2452
- if (key === "command-mode") {
2453
- const mode = positional(rest, 1, "auto|unrestricted");
2454
- if (!isCommandMode(mode)) fail$1("command-mode is auto or unrestricted");
2455
- saveCommandMode(mode);
2456
- } else {
2457
- const which = positional(rest, 1, "preset|chat");
2458
- let id = null;
2459
- if (which !== "chat") try {
2460
- id = findPreset(which).id;
2461
- } catch (err) {
2462
- fail$1(`${err.message}. \`nolune preset list\` shows them.`);
2463
- }
2464
- saveSafetyPreset(id);
2465
- }
2466
- io.log(`Commands: ${describeCommandSafety()}.`);
2467
- return;
2468
- }
2469
- if (key === "update-check") {
2470
- const on = positional(rest, 1, "on|off");
2471
- if (on !== "on" && on !== "off") fail$1("update-check is on or off");
2472
- updateConfig((c) => {
2473
- if (on === "on") delete c.updateCheck;
2474
- else c.updateCheck = false;
2475
- });
2476
- if (on === "off") forgetRelease();
2477
- io.log(on === "on" ? "nolune will look for a new release within the hour, then once a day." : "nolune won’t look for new releases.");
2478
- return;
2479
- }
2480
- if (key === "embeddings") {
2481
- let setting;
2482
- try {
2483
- setting = parseEmbeddingSetting(positional(rest, 1, "auto|off|provider/model"));
2484
- } catch (err) {
2485
- fail$1(err.message);
2486
- }
2487
- saveEmbeddingSetting(setting);
2488
- const problem = await embeddingProblem();
2489
- io.log(`Memory search by meaning: ${embeddingStatus()}.${problem ? ` It didn't answer: ${problem}` : ""}`);
2490
- return;
2491
- }
2492
- const value = positional(rest, 1, "value");
2493
- updateConfig((c) => {
2494
- if (key === "port") {
2495
- const port = Number(value);
2496
- if (!Number.isInteger(port) || port <= 0) fail$1("port must be a number");
2497
- c.port = port;
2498
- } else if (key === "host") c.host = value;
2499
- else if (key === "origin") c.origin = value.replace(/\/+$/, "");
2500
- else if (key === "image-model") {
2501
- const current = parseImageModel(c.imageModel || "openai/gpt-image-2.5-flare");
2502
- const { provider, model } = parseImageModel(value, current.provider);
2503
- c.imageModel = `${provider}/${model}`;
2504
- } else if (key === "claude-path") c.claudePath = value;
2505
- else fail$1("you can set host, port, origin, image-model, embeddings, claude-path, command-mode, safety-model or update-check");
2506
- });
2507
- if (key === "claude-path") {
2508
- await requireClaudePlan(io);
2509
- return;
2510
- }
2511
- if (key === "image-model") {
2512
- const { model, problem } = imageGenerationStatus();
2513
- io.log(`Pictures are now made with ${model}.${problem ? ` ${problem}` : ""}`);
2514
- return;
2515
- }
2516
- const relayNote = key === "origin" && readConfig().relay ? ` While the relay is on, nolune's address stays ${readConfig().relay?.url}; \`nolune relay disable\` switches to this one.` : "";
2517
- io.log(`Set ${key}. Run \`nolune service restart\` if the service is running.${relayNote}`);
2518
- return;
2519
- }
2520
- case "key": {
2521
- requireInit();
2522
- const provider = rest[0] ?? "";
2523
- const names = Object.keys(API_KEYS).join("|");
2524
- 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)`);
2525
- const { label, env } = API_KEYS[provider];
2526
- if (action === "rm") {
2527
- removeApiKey(provider);
2528
- const fallback = io.env[env] ? ` nolune uses ${env} from the environment now.` : "";
2529
- io.log(`Removed the ${label} API key.${fallback}`);
2530
- return;
2531
- }
2532
- const key = rest[1] || await askHidden(io, `${label} API key`);
2533
- if (!key) fail$1("no key given");
2534
- await storeApiKey(io, provider, key);
2535
- return;
2536
- }
2537
- case "provider": {
2538
- requireInit();
2539
- const { values, positionals } = parseArgs({
2540
- args: rest,
2541
- allowPositionals: true,
2542
- options: {
2543
- key: { type: "string" },
2544
- api: { type: "string" }
2545
- }
2546
- });
2547
- if (action === "add") {
2548
- const name = positional(positionals, 0, "name");
2549
- const url = positional(positionals, 1, "url");
2550
- const api = values.api;
2551
- if (api !== void 0 && api !== "openai" && api !== "anthropic") fail$1("--api is openai or anthropic");
2552
- await storeCustomProvider(io, name, url, api, values.key ?? null);
2553
- } else if (action === "rm") {
2554
- const which = positional(positionals, 0, "name|id");
2555
- const custom = findCustomProvider(which);
2556
- if (!custom) fail$1(`no custom provider "${which}". See \`nolune provider list\`.`);
2557
- const on = listPresets().filter((p) => isCustomProvider(p.provider) && splitModel(p.model).provider === custom.id);
2558
- removeCustomProvider(custom.id);
2559
- io.log(`Removed ${custom.name}.${on.length ? ` Chats on ${on.map((p) => `"${p.name}"`).join(", ")} stop working until they're moved to another model.` : ""}`);
2560
- } else if (action === "list") for (const c of listCustomProviders()) {
2561
- const key = c.hasKey ? `key${c.hint ? ` …${c.hint}` : ""}` : "no key";
2562
- io.log(`${c.name}\t${c.id}\t${c.api}\t${c.url}\t${key}`);
2563
- }
2564
- else fail$1("usage: nolune provider add <name> <url> [--api openai|anthropic] [--key K] | nolune provider rm <name|id> | nolune provider list");
2565
- return;
2566
- }
2567
- case "claude-plan":
2568
- case "chatgpt-plan": return planCommand(io, group, action, rest);
2569
- case "env":
2570
- requireInit();
2571
- if (action === "list") for (const name of Object.keys(readConfig().commandEnv ?? {})) io.log(name);
2572
- else if (action === "set") {
2573
- const name = positional(rest, 0, "NAME");
2574
- const value = rest[1] ?? await askHidden(io, name);
2575
- if (!value) fail$1("no value given");
2576
- updateConfig((c) => {
2577
- c.commandEnv = {
2578
- ...c.commandEnv,
2579
- [name]: value
2580
- };
2581
- });
2582
- io.log(`Set ${name} for agent commands.`);
2583
- } else if (action === "rm") {
2584
- const name = positional(rest, 0, "NAME");
2585
- updateConfig((c) => {
2586
- if (c.commandEnv) delete c.commandEnv[name];
2587
- });
2588
- io.log(`Removed ${name}.`);
2589
- } else fail$1("usage: nolune env set|rm|list");
2590
- return;
2591
- case "user": {
2592
- requireInit();
2593
- const { values, positionals } = parseArgs({
2594
- args: rest,
2595
- allowPositionals: true,
2596
- options: {
2597
- password: { type: "string" },
2598
- admin: { type: "boolean" },
2599
- off: { type: "boolean" }
2600
- }
2601
- });
2602
- if (action === "create") {
2603
- const name = positional(positionals, 0, "name");
2604
- const email = positional(positionals, 1, "email");
2605
- const password = values.password ?? generatePassword();
2606
- await createUser({
2607
- name,
2608
- email,
2609
- password,
2610
- isAdmin: values.admin
2611
- });
2612
- io.log(`Created ${name} <${email}>${values.admin ? " (admin)" : ""}.`);
2613
- if (!values.password) io.log(`Password: ${password}`);
2614
- } else if (action === "passwd") {
2615
- const who = positional(positionals, 0, "name|email");
2616
- const password = values.password ?? generatePassword();
2617
- await setPassword(who, password);
2618
- io.log(`Password changed for ${who}.`);
2619
- if (!values.password) io.log(`Password: ${password}`);
2620
- } else if (action === "admin") {
2621
- const who = positional(positionals, 0, "name|email");
2622
- setAdmin(who, !values.off);
2623
- io.log(`${who} is ${values.off ? "no longer" : "now"} an admin.`);
2624
- } else if (action === "rm") {
2625
- const who = positional(positionals, 0, "name|email");
2626
- deleteUser(who);
2627
- io.log(`Deleted ${who}.`);
2628
- } else if (action === "invite") {
2629
- const { token } = createInvite({ name: positionals[0] });
2630
- io.log(`${publicOrigin(readConfig())}/invite/${token}`);
2631
- io.log(`Works once, within 7 days. Take it back on the People page.`);
2632
- } else if (action === "list") for (const u of listUsers()) {
2633
- const picture = u.picture ? userPictureFile(u.picture) : null;
2634
- const fields = [
2635
- u.name,
2636
- u.email,
2637
- u.isAdmin && "admin",
2638
- picture?.path
2639
- ];
2640
- io.log(fields.filter(Boolean).join(" "));
2641
- }
2642
- else fail$1("usage: nolune user create|invite|passwd|admin|rm|list");
2643
- return;
2644
- }
2645
- case "preset": {
2646
- requireInit();
2647
- const { values, positionals } = parseArgs({
2648
- args: rest,
2649
- allowPositionals: true,
2650
- options: {
2651
- provider: { type: "string" },
2652
- model: { type: "string" },
2653
- name: { type: "string" },
2654
- "context-window": { type: "string" }
2655
- }
2656
- });
2657
- if (action === "add") {
2658
- const { provider, model } = presetTarget(values.provider, positional(positionals, 0, "model"));
2659
- const cw = values["context-window"];
2660
- const preset = await addPreset({
2661
- provider,
2662
- model,
2663
- name: values.name,
2664
- contextWindow: cw ? Number(cw) : null
2665
- });
2666
- io.log(`Added "${preset.name}" (context ${formatTokens(effectiveContextWindow(preset))}).`);
2667
- } else if (action === "edit") {
2668
- const cw = values["context-window"];
2669
- const which = positional(positionals, 0, "name|id");
2670
- let { provider, model } = {
2671
- provider: values.provider,
2672
- model: values.model
2673
- };
2674
- if (provider && !isProvider$1(provider)) {
2675
- const old = listPresets().find((p) => p.id === which || p.name === which);
2676
- const id = old && isCustomProvider(old.provider) ? splitModel(old.model).model : old?.model;
2677
- ({provider, model} = presetTarget(provider, model ?? id ?? ""));
2678
- }
2679
- const preset = await editPreset(which, {
2680
- provider,
2681
- model,
2682
- name: values.name,
2683
- contextWindow: cw === void 0 ? void 0 : cw === "auto" ? null : Number(cw)
2684
- });
2685
- io.log(`Saved "${preset.name}" (${presetSource(preset.provider, preset.model)}, context ${formatTokens(effectiveContextWindow(preset))}). Chats already on it keep what they had.`);
2686
- } else if (action === "rm") {
2687
- removePreset(positional(positionals, 0, "name|id"));
2688
- io.log("Removed. Existing conversations keep working.");
2689
- } else if (action === "default") {
2690
- const preset = setDefaultPreset(positional(positionals, 0, "name|id"));
2691
- io.log(`"${preset.name}" is now the default. New chats start with it.`);
2692
- } else if (action === "list") {
2693
- const defaultId = getDefaultPreset()?.id;
2694
- for (const p of listPresets()) {
2695
- const override = p.contextWindow ? " (override)" : "";
2696
- const isDefault = p.id === defaultId ? " default" : "";
2697
- io.log(`${p.name}\t${presetSource(p.provider, p.model)}\tcontext ${formatTokens(effectiveContextWindow(p))}${override}\t${p.id}${isDefault}`);
2698
- }
2699
- } else fail$1("usage: nolune preset add|edit|rm|default|list");
2700
- return;
2701
- }
2702
- case "profile":
2703
- requireInit();
2704
- return profileCommand(io, action, rest);
2705
- case "skill": {
2706
- const { values, positionals } = parseArgs({
2707
- args: rest,
2708
- allowPositionals: true,
2709
- options: {
2710
- description: {
2711
- type: "string",
2712
- short: "d"
2713
- },
2714
- profile: { type: "string" },
2715
- global: { type: "boolean" }
2716
- }
2717
- });
2718
- if (action === "new") {
2719
- const name = positional(positionals, 0, "name");
2720
- const slug = values.global ? null : resolveProfileSlug(io, values.profile);
2721
- const dir = slug ? profileSkillsDir(slug) : paths.globalSkills;
2722
- const location = createSkill(dir, name, values.description ?? "");
2723
- io.log(`Created ${location}`);
2724
- 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}\`.`);
2725
- } else if (action === "list") {
2726
- const slug = values.profile || io.env.NOLUNE_PROFILE;
2727
- const profile = slug ? getProfileBySlug(slug) : void 0;
2728
- const { skills, warnings } = listProfileSkills(slug ? profileSkillsDir(slug) : "/nonexistent", profile?.disabledSkills ?? []);
2729
- for (const s of skills) {
2730
- const state = profile ? `${s.enabled ? "on" : "off"}\t` : "";
2731
- io.log(`${s.name}\t${state}${s.scope}\t~${s.tokens} tokens\t${s.location}\n ${s.description}`);
2732
- }
2733
- for (const w of warnings) io.error(`warning: ${w}`);
2734
- if (!skills.length) io.log("No skills.");
2735
- else if (profile) {
2736
- const on = skills.filter((s) => s.enabled);
2737
- const tokens = on.reduce((n, s) => n + s.tokens, 0);
2738
- io.log(`\n${on.length} of ${skills.length} on in ${profile.name}, about ${formatTokens(tokens)} tokens in every new chat.`);
2739
- }
2740
- } else if (action === "enable" || action === "disable") {
2741
- if (values.global) fail$1("skills are turned on and off per profile. Pass --profile <slug>.");
2742
- const profile = getProfileBySlug(resolveProfileSlug(io, values.profile));
2743
- if (!positionals.length) fail$1("missing <name>. See `nolune help`.");
2744
- const known = new Set(scanSkills(profileSkillsDir(profile.slug)).skills.map((s) => s.name));
2745
- const unknown = positionals.filter((name) => !known.has(name));
2746
- if (unknown.length) fail$1(`no skill named ${unknown.join(", ")}. See \`nolune skill list\`.`);
2747
- setSkillsEnabled(profile.id, positionals, action === "enable");
2748
- io.log(`${positionals.join(", ")}: ${action === "enable" ? "on" : "off"} for new chats in ${profile.name}.`);
2749
- } else fail$1("usage: nolune skill new|list|enable|disable");
2750
- return;
2751
- }
2752
- case "trigger":
2753
- requireInit();
2754
- return triggerCommand(io, action, rest);
2755
- case "memory":
2756
- requireInit();
2757
- return memoryCommand(io, argv.slice(1));
2758
- case "card":
2759
- requireInit();
2760
- return cardCommand(io, argv.slice(1));
2761
- case "soul":
2762
- requireInit();
2763
- return soulCommand(io, argv.slice(1));
2764
- case "wake":
2765
- requireInit();
2766
- return wakeCommand(io, argv.slice(1));
2767
- case "agent":
2768
- requireInit();
2769
- return agentCommand(io, action, rest);
2770
- case "generate": return generateCommand(io, action, rest);
2771
- case "web": return webCommand(io, action, rest);
2772
- case "view": {
2773
- const dir = io.env.NOLUNE_VIEW_DIR;
2774
- if (!dir) fail$1("`nolune view` only works in the agent's commands: it shows images to the agent.");
2775
- const files = argv.slice(1);
2776
- if (!files.length) fail$1("usage: nolune view <image>...");
2777
- let failed = false;
2778
- for (const [i, file] of files.entries()) try {
2779
- io.log(await viewImage(file, dir, io.cwd));
2780
- } catch (err) {
2781
- failed = true;
2782
- const message = err instanceof Error ? err.message : String(err);
2783
- io.error(`nolune: can't show ${file}: ${message.replace(/\.+$/, "")}.`);
2784
- if (err instanceof ViewLimitError) {
2785
- const rest = files.slice(i + 1);
2786
- if (rest.length) io.error(`nolune: not shown either: ${rest.join(" ")}`);
2787
- break;
2788
- }
2789
- }
2790
- return failed ? 1 : 0;
2791
- }
2792
- default: fail$1(`unknown command "${group}". See \`nolune help\`.`);
2793
- }
2794
- }
2795
- //#endregion
2796
- //#region ../cli/src/serve.ts
2797
- function isRun(message) {
2798
- 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;
2799
- }
2800
- /** One connection, one command. The client hanging up stops it (io.signal). */
2801
- function handle$1(socket, run) {
2802
- const abort = new AbortController();
2803
- let started = false;
2804
- let answerStdin;
2805
- let stdin;
2806
- socket.on("error", () => {});
2807
- socket.on("close", () => abort.abort(/* @__PURE__ */ new Error("the command was stopped")));
2808
- receive(socket, (message) => {
2809
- if (message.type === "stdin") {
2810
- answerStdin?.(typeof message.data === "string" ? message.data : "");
2811
- return;
2812
- }
2813
- if (started || !isRun(message)) {
2814
- socket.destroy();
2815
- return;
2816
- }
2817
- started = true;
2818
- if (message.protocol !== 1 || LOCAL_ONLY.has(message.argv[0] ?? "")) {
2819
- send(socket, {
2820
- type: "decline",
2821
- reason: message.protocol !== 1 ? "another protocol version" : "runs locally"
2822
- });
2823
- socket.end();
2824
- return;
2825
- }
2826
- const io = createIo({
2827
- stdout: (data) => send(socket, {
2828
- type: "stdout",
2829
- data
2830
- }),
2831
- stderr: (data) => send(socket, {
2832
- type: "stderr",
2833
- data
2834
- }),
2835
- env: message.env,
2836
- cwd: message.cwd,
2837
- stdinIsTTY: false,
2838
- readStdin: () => stdin ??= new Promise((resolve, reject) => {
2839
- if (abort.signal.aborted) return reject(abort.signal.reason);
2840
- answerStdin = resolve;
2841
- abort.signal.addEventListener("abort", () => reject(abort.signal.reason), { once: true });
2842
- send(socket, { type: "stdin" });
2843
- }),
2844
- signal: abort.signal
2845
- });
2846
- run(message.argv, io).catch((err) => {
2847
- console.error("[nolune] a CLI command failed in the gateway:", err);
2848
- return 1;
2849
- }).then((code) => {
2850
- send(socket, {
2851
- type: "exit",
2852
- code
2853
- });
2854
- socket.end();
2855
- });
2856
- });
2857
- }
2858
- /** Whether something already answers on the socket: another gateway on the same nolune home. */
2859
- function answers(socketPath) {
2860
- return new Promise((resolve) => {
2861
- const probe = connect(socketPath);
2862
- probe.on("connect", () => {
2863
- probe.destroy();
2864
- resolve(true);
2865
- });
2866
- probe.on("error", () => resolve(false));
2867
- });
2868
- }
2869
- /**
2870
- * Serves `nolune` commands on the socket, calling `run()` for the code to run each with (the latest,
2871
- * after `pnpm dev` reloads it). Resolves with the server, or null when another gateway already
2872
- * serves this nolune home or the socket can't be made; the CLI then runs commands itself.
2873
- */
2874
- async function serveCommands(socketPath, run) {
2875
- if (await answers(socketPath)) {
2876
- console.log(`[nolune] another gateway already runs nolune commands on ${socketPath}`);
2877
- return null;
2878
- }
2879
- const server = createServer((socket) => handle$1(socket, run()));
2880
- try {
2881
- const dir = dirname(socketPath);
2882
- mkdirSync(dir, {
2883
- recursive: true,
2884
- mode: 448
2885
- });
2886
- chmodSync(dir, 448);
2887
- rmSync(socketPath, { force: true });
2888
- await new Promise((resolve, reject) => {
2889
- server.once("error", reject);
2890
- server.listen(socketPath, () => {
2891
- server.off("error", reject);
2892
- resolve();
2893
- });
2894
- });
2895
- chmodSync(socketPath, 384);
2896
- } catch (err) {
2897
- console.error(`[nolune] couldn't run nolune commands on ${socketPath}; the CLI runs them itself:`, err);
2898
- server.close();
2899
- return null;
2900
- }
2901
- server.on("error", (err) => console.error("[nolune] the nolune command socket failed:", err));
2902
- server.unref();
2903
- return server;
2904
- }
2905
- var holder = globalThis;
2906
- /**
2907
- * The gateway's own command socket (paths.cliSocket), once per process. When `pnpm dev` reloads
2908
- * this module, the running server keeps going with the new code.
2909
- */
2910
- function serveGatewayCommands() {
2911
- if (holder.__noluneCommands) {
2912
- holder.__noluneCommands.run = runCli;
2913
- return;
2914
- }
2915
- const state = holder.__noluneCommands = { run: runCli };
2916
- serveCommands(paths.cliSocket, () => state.run).then((server) => {
2917
- if (!server) return;
2918
- const connections = /* @__PURE__ */ new Set();
2919
- server.on("connection", (socket) => {
2920
- connections.add(socket);
2921
- socket.on("close", () => connections.delete(socket));
2922
- });
2923
- process.once("sveltekit:shutdown", () => {
2924
- server.close();
2925
- for (const socket of connections) socket.destroy();
2926
- });
2927
- process.once("exit", () => rmSync(paths.cliSocket, { force: true }));
2928
- });
2929
- }
2930
- //#endregion
2931
- //#region src/hooks.server.ts
2932
- var init = () => {
2933
- installCliShim();
2934
- recoverAfterRestart();
2935
- startScheduler();
2936
- startUpdateChecks();
2937
- serveGatewayCommands();
2938
- };
2939
- /** Webhook URLs and invite links carry their own secret token instead of a login. */
2940
- var PUBLIC_PATHS = [
2941
- "/login",
2942
- "/api/auth/",
2943
- "/api/hooks/",
2944
- "/invite/"
2945
- ];
2946
- /**
2947
- * `nolune start` raises adapter-node's body limit so attachments can be uploaded. Every other route
2948
- * keeps a small one, including the public ones that read a body before checking anything.
2949
- */
2950
- var UPLOAD_PATH = /^\/api\/p\/[^/]+\/uploads$/;
2951
- var MAX_BODY_BYTES = 1048576;
2952
- function bodyTooLarge(request, path) {
2953
- if (UPLOAD_PATH.test(path)) return false;
2954
- const length = request.headers.get("content-length");
2955
- if (length === null) return request.headers.has("transfer-encoding");
2956
- return Number(length) > MAX_BODY_BYTES;
2957
- }
2958
- var handle = async ({ event, resolve }) => {
2959
- const { language } = parsePreferences(event.cookies.get(PREFERENCES_COOKIE));
2960
- const locale = language === "auto" ? matchLocale(event.request.headers.get("accept-language")) : language;
2961
- event.locals.locale = locale;
2962
- if (bodyTooLarge(event.request, event.url.pathname)) error(413, "Request body too large");
2963
- const auth = getAuth();
2964
- const session = await auth.api.getSession({ headers: event.request.headers });
2965
- if (session) {
2966
- event.locals.session = session.session;
2967
- event.locals.user = session.user;
2968
- }
2969
- const path = event.url.pathname;
2970
- if (!event.locals.user && !PUBLIC_PATHS.some((p) => path === p || path.startsWith(p))) {
2971
- if (path.startsWith("/api/")) error(401, translations(locale).m.errors.notSignedIn);
2972
- redirect(303, "/login");
2973
- }
2974
- return svelteKitHandler({
2975
- event,
2976
- resolve: (event) => resolve(event, { transformPageChunk: ({ html }) => html.replace("%nolune.lang%", locale) }),
2977
- auth,
2978
- building
2979
- });
2980
- };
2981
-
2982
- export { handle, init };
2983
- //# sourceMappingURL=hooks.server.js-b1SYQXEi.js.map