nolo-cli 0.148.0-alpha.1 → 0.151.0-alpha.2

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 (258) hide show
  1. package/{_executeModel-NFJAMAGJ.js → _executeModel-XHAFJ2MM.js} +134 -91
  2. package/accountResolver-7RYB4D2P.js +300 -0
  3. package/action-SXJD5N5R.js +23 -0
  4. package/{addContentAction-B2DRF7P6.js → addContentAction-ZV774PHH.js} +20 -14
  5. package/{addDialogAgentAction-2P2FLTLD.js → addDialogAgentAction-A6SMKAGH.js} +26 -22
  6. package/{agentDeleteCommand-7IDWF6E3.js → agentDeleteCommand-DPUUS56Z.js} +181 -93
  7. package/{agentEmailCommands-4KW33JII.js → agentEmailCommands-V4P5EFLP.js} +132 -112
  8. package/{agentGrantCommands-M3XFO6EN.js → agentGrantCommands-HOJ3JBBQ.js} +3 -3
  9. package/agentListCommands-TWFLUYIZ.js +802 -0
  10. package/{agentMachineCommands-CMQR4RQ4.js → agentMachineCommands-MELPAZZI.js} +58 -62
  11. package/{agentProviderCommands-YK2BIIXZ.js → agentProviderCommands-HL6MBLCL.js} +149 -2
  12. package/{agentPullCommand-HF4A42D4.js → agentPullCommand-FA43RBRU.js} +7 -7
  13. package/agentRecordCommands-FSWSSQIO.js +154 -0
  14. package/agentRunCommand-GDBJVOAT.js +183 -0
  15. package/{agentRunControl-2SKCR4SB.js → agentRunControl-IFM7IGMG.js} +10 -2
  16. package/{agentRuntimeLocal-AK2QVJHY.js → agentRuntimeLocal-KKSQJMTE.js} +47 -50
  17. package/{agentSlice-OZ33K224.js → agentSlice-YO2ZLJMD.js} +23 -16
  18. package/{appDeleteCommands-N3XEVVYC.js → appDeleteCommands-4PL4KYRN.js} +58 -59
  19. package/{appDeployCommands-AWFIXYVW.js → appDeployCommands-EEEXCEB6.js} +67 -63
  20. package/{appDeployStatusCommands-CZRON2FO.js → appDeployStatusCommands-35ZX7T66.js} +56 -56
  21. package/{appGetCommands-XQIUY4TD.js → appGetCommands-WFCHXJWF.js} +56 -56
  22. package/{appListCommands-NNG4H36Y.js → appListCommands-XY2U6DPF.js} +57 -59
  23. package/{authCommand-UBJ4EWYZ.js → authCommand-QYN47CQD.js} +371 -68
  24. package/{authCommands-H6WKKCRW.js → authCommands-77CHYBGF.js} +12 -9
  25. package/{builtinSkillRegistry-ZMF6YGNO.js → builtinSkillRegistry-TDQ6JB2E.js} +13 -11
  26. package/{chromeCommands-2N6MEWRU.js → chromeCommands-OBBNJCLS.js} +314 -13
  27. package/chromeOpsCommands-3Z34RKSE.js +472 -0
  28. package/{chunk-ALXHV7NK.js → chunk-2GGXHQIW.js} +43 -4
  29. package/{localRuntimeAuthority-5W6IJRAD.js → chunk-2IXDJNZI.js} +154 -75
  30. package/{chunk-IVZJWTDI.js → chunk-36OMEXXR.js} +89 -21
  31. package/{chunk-H6A6X4EK.js → chunk-3MZAGMYY.js} +16 -0
  32. package/chunk-3PVYUPXK.js +40 -0
  33. package/chunk-3SZA4U64.js +1192 -0
  34. package/{chunk-GNMAFAIS.js → chunk-44WXLHFI.js} +1 -1
  35. package/{chunk-AGGIDPCZ.js → chunk-4JH2UMJR.js} +6 -0
  36. package/chunk-4LCOCOR5.js +50 -0
  37. package/chunk-4YRTZIVN.js +871 -0
  38. package/chunk-556RW72X.js +14110 -0
  39. package/{chunk-N7J63Q6C.js → chunk-56GBUMO5.js} +10 -1
  40. package/{chunk-W7XHHYWM.js → chunk-5BHQICF2.js} +5 -1
  41. package/{chunk-XUWRURDF.js → chunk-5EBLANFT.js} +1 -1
  42. package/{chunk-3AH7LNUB.js → chunk-5EMSBTQ6.js} +33 -14
  43. package/{chunk-YRRASA5Q.js → chunk-5MM7NNO6.js} +113 -52
  44. package/chunk-5MMAK75Q.js +15 -0
  45. package/{chunk-M5PVFLD4.js → chunk-64K7WX26.js} +90 -21
  46. package/{chunk-AKG5W4LG.js → chunk-6CCFTVBP.js} +76 -221
  47. package/chunk-6MJNEXUU.js +614 -0
  48. package/{chunk-62IL3KQV.js → chunk-6MXDOUMH.js} +15 -3
  49. package/{chunk-QOKAKDPE.js → chunk-6Q7UTJKR.js} +6 -94
  50. package/chunk-6QDYSCPW.js +223 -0
  51. package/{chunk-HYZIYH2H.js → chunk-74RAWNQN.js} +56 -63
  52. package/chunk-7DPNBQSV.js +9 -0
  53. package/chunk-7MOXKPHC.js +119 -0
  54. package/{chunk-523WHFSL.js → chunk-7XKL25PW.js} +1973 -754
  55. package/{chunk-IAESIMK7.js → chunk-A4MW3YZL.js} +10 -14
  56. package/chunk-AGIM7IMJ.js +147 -0
  57. package/{chunk-7CHC4W22.js → chunk-AIZE5TDM.js} +3 -3
  58. package/{chunk-P4BX6FFU.js → chunk-AOCM7HPT.js} +214 -51
  59. package/{chunk-5GVBDNTO.js → chunk-AU7AXHUL.js} +1 -1
  60. package/{chunk-4H22P2JV.js → chunk-AUIJZACN.js} +2073 -1275
  61. package/{chunk-CIF4X6ZM.js → chunk-AWVFQMOV.js} +25 -3
  62. package/{chunk-RYZINGPM.js → chunk-BPMPOFWP.js} +347 -235
  63. package/{chunk-YUNJN43V.js → chunk-BU2YQBV4.js} +215 -28
  64. package/{chunk-XPRWFQQK.js → chunk-CBHGZRCE.js} +38 -12
  65. package/{chunk-Y3PMXGLH.js → chunk-CHCS6XPJ.js} +365 -144
  66. package/chunk-CHOZJMJS.js +78 -0
  67. package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
  68. package/{chunk-3SV7RM24.js → chunk-D2QN6CTI.js} +117 -72
  69. package/{chunk-5TEEECZM.js → chunk-E2AKSW7L.js} +10 -7
  70. package/{chunk-RSEEDUMS.js → chunk-EDX5XSJM.js} +2 -2
  71. package/{chunk-BKWMNZ2X.js → chunk-ES633ZS5.js} +280 -98
  72. package/{chunk-QDSINZM3.js → chunk-EUGTFFO6.js} +2 -23
  73. package/{chunk-UNYJU5L6.js → chunk-EYLGAEB4.js} +5 -1
  74. package/{chunk-CU3QB4HW.js → chunk-EYWJT7A2.js} +12 -12
  75. package/{chunk-BNGW5ASC.js → chunk-EZVK3N5L.js} +66 -18
  76. package/{chunk-6FGTMQCL.js → chunk-F32Z66T4.js} +6 -10
  77. package/chunk-FJMRBOPO.js +11507 -0
  78. package/{chunk-ZOVKKMF6.js → chunk-FY4SDK2E.js} +1 -1
  79. package/chunk-G6OOUQWJ.js +417 -0
  80. package/{chunk-PQWU42UQ.js → chunk-GCKHQECX.js} +6 -6
  81. package/chunk-GKXCHNTE.js +15 -0
  82. package/{chunk-T7F46O36.js → chunk-GQN2WLAI.js} +20 -11
  83. package/{chunk-P6GMCCAT.js → chunk-GQV5KHJU.js} +78 -12
  84. package/{chunk-B2XUQXQX.js → chunk-HIQ4GF53.js} +191 -68
  85. package/{chunk-YUWMM4US.js → chunk-HKX3ULQB.js} +34 -22
  86. package/{chunk-GMZLP5DV.js → chunk-HNUWUO75.js} +30 -19
  87. package/{chunk-5UTFL4QJ.js → chunk-I2ZMGXXF.js} +10 -5
  88. package/chunk-I42VC5KR.js +15 -0
  89. package/{chunk-3BXNTXYI.js → chunk-I4SN4NUQ.js} +1199 -56
  90. package/chunk-IA7TRNNR.js +11 -0
  91. package/{chunk-WIWM4FE3.js → chunk-IJERIUXS.js} +55 -748
  92. package/{chunk-CPUFH46E.js → chunk-ILU2NPWY.js} +10 -10
  93. package/{chunk-SLLGJZDT.js → chunk-ISQL4V7C.js} +4 -4
  94. package/chunk-IT3ZZRJE.js +12 -0
  95. package/{chunk-LPVCRQMM.js → chunk-IZ7OJB6K.js} +20 -16
  96. package/{chunk-DY7ANLKG.js → chunk-JKMLSTZK.js} +43 -12
  97. package/{chunk-6TPOEJMQ.js → chunk-JZX2XLKC.js} +64 -23
  98. package/{chunk-27ONFIEY.js → chunk-K2AER7RX.js} +19 -12
  99. package/{chunk-O2OWEFII.js → chunk-KFHQQ3NO.js} +1 -1
  100. package/{chunk-QXGPFY6J.js → chunk-LGN377P3.js} +27 -17
  101. package/{chunk-L36OWPP3.js → chunk-LIQJTQRN.js} +118 -139
  102. package/{chunk-FWQEKRTD.js → chunk-LTRUTOHX.js} +36 -31
  103. package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
  104. package/{chunk-5J3PYNUP.js → chunk-NYYFIKHI.js} +17 -3
  105. package/{chunk-6O4IK4V2.js → chunk-OFFL4DCR.js} +1 -1
  106. package/{chunk-B6SAMB33.js → chunk-OWYYDMGJ.js} +209 -9
  107. package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
  108. package/{chunk-CTUQJVQM.js → chunk-P5QACQDK.js} +1 -1
  109. package/{chunk-DIXLJWCD.js → chunk-PCKVQXYV.js} +274 -93
  110. package/{chunk-4JMDLJAD.js → chunk-PJNFNEJE.js} +114 -37
  111. package/{chunk-Z4CSIXYP.js → chunk-PLSVXHSA.js} +3 -3
  112. package/{chunk-BIDGLJQ3.js → chunk-PLXDDGBK.js} +45 -8
  113. package/chunk-PWTNI4N7.js +47 -0
  114. package/chunk-QFEW2ULV.js +42 -0
  115. package/{chunk-RGNEEJ3Y.js → chunk-QLQ573SU.js} +35 -9
  116. package/chunk-QQ56R7KS.js +88 -0
  117. package/chunk-QYPE3TS3.js +43 -0
  118. package/{chunk-4DPP773Q.js → chunk-RSHPU4PD.js} +59 -11
  119. package/chunk-RVWMAFIT.js +134 -0
  120. package/{chunk-ESHYE7WU.js → chunk-S73EPYNC.js} +10 -7
  121. package/{chunk-UQNS32WZ.js → chunk-SCMHQUMK.js} +1 -1
  122. package/{chunk-T767MPHB.js → chunk-SMENBO3M.js} +354 -120
  123. package/{chunk-PCVVZ2MH.js → chunk-SSFDFOVT.js} +26 -31
  124. package/chunk-SW4S4XYB.js +1794 -0
  125. package/{chunk-HUFPWXFW.js → chunk-T6X3D7NB.js} +572 -430
  126. package/chunk-TY3TIUJK.js +89 -0
  127. package/{chunk-X2QRZXZH.js → chunk-TYJ5XFEA.js} +4 -4
  128. package/{chunk-ALFH24P3.js → chunk-TYYRSFBG.js} +197 -155
  129. package/{chunk-7KVZ5LDQ.js → chunk-UBUH2TCC.js} +18 -4
  130. package/chunk-UEILX4EV.js +15 -0
  131. package/chunk-UHTDNB5Y.js +140 -0
  132. package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
  133. package/{chunk-OHOVNO7I.js → chunk-UOKFKFPO.js} +6 -3
  134. package/{chunk-XISEYOGH.js → chunk-USHQX6VT.js} +5 -5
  135. package/chunk-UUPR3TD7.js +53 -0
  136. package/{chunk-HDLLCBRF.js → chunk-VEA7H5FG.js} +2 -2
  137. package/chunk-VHGD6FHV.js +116 -0
  138. package/chunk-VIWDGTDA.js +8 -0
  139. package/{chunk-GOH6RW6F.js → chunk-VJXHL6MH.js} +34 -11
  140. package/{chunk-4XEYAFLY.js → chunk-VL5KOY2C.js} +623 -94
  141. package/{chunk-EADNWBAZ.js → chunk-VP3BINY7.js} +13 -0
  142. package/{chunk-EOARMOVD.js → chunk-W4S6OTSC.js} +6 -3
  143. package/chunk-WD4XYDYC.js +567 -0
  144. package/chunk-WJZOQR2J.js +151 -0
  145. package/{chunk-AUDNYVRC.js → chunk-XETG4RIX.js} +5 -5
  146. package/{chunk-MX574M24.js → chunk-XI7DGLUK.js} +4 -4
  147. package/{chunk-3L2WKC3W.js → chunk-XPWGOTBQ.js} +8 -1
  148. package/chunk-XRUSXPCQ.js +514 -0
  149. package/{chunk-I4OPU5TK.js → chunk-XS47QOFV.js} +273 -11
  150. package/{chunk-S5XGT6GB.js → chunk-XZNCX52W.js} +30 -9
  151. package/{chunk-2JMMBU6V.js → chunk-Y2DXOPSO.js} +1920 -644
  152. package/{chunk-5OA5HMTL.js → chunk-YLMMECCH.js} +1 -1
  153. package/{chunk-CFT5HBGW.js → chunk-YVLQXTUB.js} +448 -12
  154. package/chunk-YVPQATSC.js +709 -0
  155. package/{chunk-DCFPQW22.js → chunk-Z7OJUX6S.js} +122 -107
  156. package/chunk-ZEZC7IIM.js +126 -0
  157. package/{chunk-ALGORS6Y.js → chunk-ZF6526IQ.js} +43 -8
  158. package/chunk-ZIWPQEFU.js +165 -0
  159. package/chunk-ZKZ5X2HS.js +7012 -0
  160. package/chunk-ZRAU6T47.js +56 -0
  161. package/{cliExecutor-AWYR3T33.js → cliExecutor-BWBF2MTI.js} +4 -3
  162. package/{clipboardy-BX4NMYHE.js → clipboardy-GCO3GT3I.js} +3 -8
  163. package/{commandRegistry-YOEQUA7T.js → commandRegistry-XN7C5GHO.js} +183 -107
  164. package/contentThunks-5L7YQI3S.js +84 -0
  165. package/{cooldownCommands-ZLEPIB4A.js → cooldownCommands-JFKTYS2D.js} +2 -2
  166. package/{createAgentAutomationAction-5EJL6ROU.js → createAgentAutomationAction-QOPOLCRK.js} +53 -44
  167. package/createDialogAction-MZ66VY5Q.js +76 -0
  168. package/{createPageAction-75ELC64R.js → createPageAction-VQDJIXMY.js} +65 -54
  169. package/cursorProvider-YGGNMVWX.js +6123 -0
  170. package/{db-VQSAOWAO.js → db-2QOTXYGH.js} +11 -5
  171. package/{dbSlice-DQ32LYTJ.js → dbSlice-J37OGIXH.js} +19 -13
  172. package/{deleteFile-NX6QHCWZ.js → deleteFile-6JWDDRVP.js} +10 -6
  173. package/dialogCommands-YZLSJB6X.js +113 -0
  174. package/{dialogSlice-KSXPGJB2.js → dialogSlice-6RODVYCK.js} +53 -39
  175. package/{docCreateCommands-ZSLGVBZT.js → docCreateCommands-JB2RRMRJ.js} +54 -57
  176. package/{docDeleteCommands-5N4GVZBG.js → docDeleteCommands-AQENULNM.js} +56 -58
  177. package/{docReadCommands-YJSAA7AV.js → docReadCommands-DYD25YLQ.js} +53 -56
  178. package/{docStore-AROBVRCR.js → docStore-ZZA3OPM5.js} +25 -16
  179. package/{docUpdateCommands-WEMLSW6W.js → docUpdateCommands-3GVS23QL.js} +54 -57
  180. package/{fetchMessages-67MEFPZR.js → fetchMessages-IIJWQ3HR.js} +5 -4
  181. package/{getPricing-NMMFT3YI.js → getPricing-FKK3F5EJ.js} +11 -9
  182. package/{handleSendMessageAction-EGNWHAUB.js → handleSendMessageAction-DVG5U26T.js} +619 -165
  183. package/index.js +11 -7
  184. package/{lib-FRRS27KN.js → lib-4YTWAGY7.js} +581 -248
  185. package/{localDialogRead-EBRS242U.js → localDialogRead-FSOMOPDZ.js} +2 -2
  186. package/localRuntimeAdapter-HXRHFKRC.js +244 -0
  187. package/localRuntimeAuthority-JDAD7CB6.js +16 -0
  188. package/{localRuntimeDb-3LRMNLCM.js → localRuntimeDb-CVC62PM5.js} +1 -1
  189. package/{machineCommands-ARZYKGGE.js → machineCommands-5KBF4RCC.js} +503 -161
  190. package/{machineInfo-66ZFUMLE.js → machineInfo-UKPTZO5Y.js} +2 -2
  191. package/machineWsRunDispatch-4OQDEDOR.js +169 -0
  192. package/{memberThunks-5ZXPR63F.js → memberThunks-66DH6ABQ.js} +25 -18
  193. package/{models-ZPU5EDF4.js → models-LAS4B2B5.js} +2 -2
  194. package/package.json +1 -1
  195. package/{providerPresetApply-DD6NGWW6.js → providerPresetApply-MY66I6NT.js} +10 -10
  196. package/{providerRegistry-XDRLMYGJ.js → providerRegistry-QOE2FT57.js} +13 -9
  197. package/{read-EPTJRAEF.js → read-DC4NUGN6.js} +12 -8
  198. package/{readDocTool-W4NDXNEX.js → readDocTool-NCJ5NT25.js} +1 -1
  199. package/{readlineWorkspace-3XOFVARF.js → readlineWorkspace-RIE62QVZ.js} +5022 -921
  200. package/{removeDialogAgentAction-OSYNZRX7.js → removeDialogAgentAction-E2H3OZU6.js} +29 -28
  201. package/{runAgentClientLoop-UMF7VZYZ.js → runAgentClientLoop-KLUUXBZS.js} +154 -97
  202. package/{runtimeDoctorCommands-ID23PNNZ.js → runtimeDoctorCommands-GIOGC5SC.js} +17 -17
  203. package/secretCommands-ZXZRLR3R.js +700 -0
  204. package/setDialogExtraReferencesAction-SITRPMYU.js +37 -0
  205. package/{setPrimaryDialogAgentAction-WZ7KI3YA.js → setPrimaryDialogAgentAction-U7N45TGC.js} +30 -29
  206. package/{chunk-SONWNI3L.js → settingThunks-Y7SVJOMZ.js} +223 -928
  207. package/{skillDiscovery-ZBU76COE.js → skillDiscovery-QC35EQY4.js} +2 -2
  208. package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
  209. package/{spaceCommands-UJOVU4XI.js → spaceCommands-ZR5BR3GX.js} +59 -59
  210. package/{streamAgentChatTurn-GYGMYOSM.js → streamAgentChatTurn-MN2SSPGA.js} +309 -165
  211. package/{switchDialogAgentAction-GMR7WN3P.js → switchDialogAgentAction-OMGBD3N2.js} +26 -22
  212. package/{tableCommands-G7RV3RU3.js → tableCommands-U3QDY4L6.js} +19 -17
  213. package/{toolApiClient-CVGWM4PN.js → toolApiClient-7WSJJJBV.js} +6 -5
  214. package/tools-W2MOLERY.js +124 -0
  215. package/tuiSummaryLlmCaller-BM3VSTBU.js +130 -0
  216. package/{updateCommands-4EHDLF5J.js → updateCommands-NQXAGFM7.js} +3 -3
  217. package/{updateDialogTitleAction-4U5W4AMH.js → updateDialogTitleAction-Z4JX6REN.js} +102 -57
  218. package/workloadLifecycle-36DXRZKU.js +320 -0
  219. package/action-GI44T4DR.js +0 -31
  220. package/agentListCommands-IW3GQVUP.js +0 -427
  221. package/agentRecordCommands-4YBSYPIY.js +0 -134
  222. package/agentRunCommand-5MU5X5OT.js +0 -161
  223. package/browser-image-compression-MFDTD7K6.js +0 -1763
  224. package/chatQueueReduxAdapter-HVHA2HPM.js +0 -186
  225. package/chromeOpsCommands-IXRLN57H.js +0 -289
  226. package/chunk-42Z3EMC4.js +0 -25363
  227. package/chunk-CQ3WA2NE.js +0 -299
  228. package/chunk-CYSYR67N.js +0 -93
  229. package/chunk-IAG4FHOJ.js +0 -34
  230. package/chunk-JBTJAPUF.js +0 -35
  231. package/chunk-K2CSUCHJ.js +0 -620
  232. package/chunk-LTRXGFMS.js +0 -83
  233. package/chunk-M76ECQRD.js +0 -13658
  234. package/chunk-MEYIRKDN.js +0 -8967
  235. package/chunk-OCZKATRC.js +0 -129
  236. package/chunk-OTGFTBLI.js +0 -13
  237. package/chunk-PUOC4YRO.js +0 -394
  238. package/chunk-QU5A4LYX.js +0 -2415
  239. package/chunk-URMS4XY2.js +0 -10
  240. package/chunk-UV6VISQJ.js +0 -20
  241. package/chunk-VJVNU77E.js +0 -83
  242. package/chunk-WRMKCKZ3.js +0 -13807
  243. package/chunk-Y5GCAMGP.js +0 -9
  244. package/chunk-YPREESF4.js +0 -225
  245. package/contentThunks-AK2F3KNC.js +0 -73
  246. package/createDialogAction-F5WEWA47.js +0 -66
  247. package/dialogCommands-G7YBVAMC.js +0 -102
  248. package/levelLazyShim-GZBKODGI.js +0 -7
  249. package/machineWsRunDispatch-I7F4L532.js +0 -149
  250. package/serverStoreFactory-YMXDF4NI.js +0 -20
  251. package/setDialogExtraReferencesAction-M32UYNCG.js +0 -30
  252. package/settingSlice-Q6EKL7EQ.js +0 -204
  253. package/syncMapping-N6RGXGBW.js +0 -437
  254. package/tools-DU4JXVAV.js +0 -111
  255. package/tuiSummaryLlmCaller-3YFNHCTW.js +0 -128
  256. package/{chunk-SV5IJK6K.js → chunk-NBTY7YJF.js} +3 -3
  257. package/{chunk-2SYTUTLI.js → chunk-YBNHPX4S.js} +3 -3
  258. package/{offlineMarxistsAgentCommand-HGXZV4XJ.js → offlineMarxistsAgentCommand-2QTHJCHV.js} +4 -4
@@ -2,7 +2,7 @@ import {
2
2
  resolveCliAuthorityBrokerEndpoint,
3
3
  resolveCliAuthorityBrokerHealthPath,
4
4
  resolveCliAuthorityBrokerMetadataPath
5
- } from "./chunk-BFU6C242.js";
5
+ } from "./chunk-NMFV26UG.js";
6
6
  import {
7
7
  createCliAuthorityBrokerClient,
8
8
  createCliAuthorityBrokerSocketInvoker,
@@ -10,19 +10,15 @@ import {
10
10
  } from "./chunk-EXAJ6DCR.js";
11
11
  import {
12
12
  createLegacyServerDb,
13
- createLevelAuthorityStore
14
- } from "./chunk-CIF4X6ZM.js";
15
- import {
13
+ createLevelAuthorityStore,
16
14
  isLevelLockError
17
- } from "./chunk-URMS4XY2.js";
18
- import "./chunk-UV6VISQJ.js";
19
- import {
20
- resolveNoloHome
21
- } from "./chunk-GLKOYSRU.js";
15
+ } from "./chunk-AWVFQMOV.js";
22
16
  import {
23
17
  toErrorMessage
24
18
  } from "./chunk-HNMXYYJR.js";
25
- import "./chunk-4VNS5WPM.js";
19
+ import {
20
+ resolveNoloHome
21
+ } from "./chunk-GLKOYSRU.js";
26
22
 
27
23
  // packages/cli/localRuntimeAuthority.ts
28
24
  import fs2 from "node:fs";
@@ -33,6 +29,7 @@ import fs from "node:fs";
33
29
  import path from "node:path";
34
30
  import { createServer } from "node:net";
35
31
  var brokerRegistry = /* @__PURE__ */ new Map();
32
+ var databaseOwners = /* @__PURE__ */ new Map();
36
33
  var DEFAULT_ITERATOR_LIMIT = 200;
37
34
  function resolveBrokerListenTarget(endpoint) {
38
35
  if (endpoint.startsWith("unix://")) {
@@ -118,7 +115,6 @@ async function dispatchCliAuthorityBrokerRequest(store, request) {
118
115
  await store.open();
119
116
  return { ok: true, result: { type: "open" } };
120
117
  case "close":
121
- await store.close();
122
118
  return { ok: true, result: { type: "close" } };
123
119
  case "get":
124
120
  return { ok: true, result: { type: "get", value: await store.get(request.key) } };
@@ -146,77 +142,100 @@ async function dispatchCliAuthorityBrokerRequest(store, request) {
146
142
  }
147
143
  async function createBrokerHandle(options) {
148
144
  const target = resolveBrokerListenTarget(options.endpoint);
149
- if (target.kind === "unix") {
150
- ensureParentDir(target.path);
151
- removeFileIfPresent(target.path);
152
- }
153
- const store = await options.createStore();
154
- await store.open();
145
+ const socketMode = (options.transportMode ?? "socket") === "socket";
146
+ let store;
147
+ const sockets = /* @__PURE__ */ new Set();
155
148
  const server = createServer((socket) => {
149
+ sockets.add(socket);
150
+ socket.once("close", () => sockets.delete(socket));
151
+ socket.on("error", () => {
152
+ });
153
+ if (!storeReady || !store) {
154
+ socket.once("data", () => {
155
+ socket.end(`${JSON.stringify({ ok: false, error: { code: "BROKER_UNAVAILABLE", message: "CLI authority broker is starting", retryable: true } })}
156
+ `);
157
+ });
158
+ return;
159
+ }
156
160
  bindSocketRequestHandler({ socket, store });
157
161
  });
158
- if ((options.transportMode ?? "socket") === "socket") {
159
- try {
162
+ let storeReady = false;
163
+ try {
164
+ if (socketMode) {
165
+ if (target.kind === "unix") ensureParentDir(target.path);
160
166
  await new Promise((resolve, reject) => {
161
167
  server.once("error", reject);
162
- if (target.kind === "unix") {
163
- server.listen(target.path, () => {
164
- server.off("error", reject);
165
- resolve();
166
- });
167
- return;
168
- }
169
- server.listen(target.port, target.host, () => {
168
+ const onListening = () => {
170
169
  server.off("error", reject);
171
170
  resolve();
172
- });
171
+ };
172
+ if (target.kind === "unix") server.listen(target.path, onListening);
173
+ else server.listen(target.port, target.host, onListening);
173
174
  });
174
175
  server.unref();
175
- } catch (error) {
176
- await store.close().catch(() => {
177
- });
178
- throw error;
179
176
  }
180
- }
181
- const now = options.now ?? Date.now;
182
- const listeningEndpoint = (options.transportMode ?? "socket") === "socket" ? buildListeningEndpoint(server, target) : options.endpoint;
183
- writeJsonFile(options.metadataPath, {
184
- pid: process.pid,
185
- endpoint: listeningEndpoint,
186
- location: store.location ?? listeningEndpoint,
187
- startedAt: new Date(now()).toISOString()
188
- });
189
- writeJsonFile(options.healthPath, {
190
- ok: true,
191
- pid: process.pid,
192
- endpoint: listeningEndpoint,
193
- checkedAt: new Date(now()).toISOString()
194
- });
195
- let closed = false;
196
- return {
197
- endpoint: options.endpoint,
198
- listeningEndpoint,
199
- authorityStore: store,
200
- request(request) {
201
- return dispatchCliAuthorityBrokerRequest(store, request);
202
- },
203
- async close() {
204
- if (closed) return;
205
- closed = true;
206
- brokerRegistry.delete(options.endpoint);
207
- if ((options.transportMode ?? "socket") === "socket") {
208
- await new Promise((resolve, reject) => {
209
- server.close((error) => error ? reject(error) : resolve());
177
+ store = await options.createStore();
178
+ await store.open();
179
+ storeReady = true;
180
+ const readyStore = store;
181
+ const now = options.now ?? Date.now;
182
+ const listeningEndpoint = (options.transportMode ?? "socket") === "socket" ? buildListeningEndpoint(server, target) : options.endpoint;
183
+ writeJsonFile(options.metadataPath, {
184
+ pid: process.pid,
185
+ endpoint: listeningEndpoint,
186
+ location: readyStore.location ?? listeningEndpoint,
187
+ startedAt: new Date(now()).toISOString()
188
+ });
189
+ writeJsonFile(options.healthPath, {
190
+ ok: true,
191
+ pid: process.pid,
192
+ endpoint: listeningEndpoint,
193
+ checkedAt: new Date(now()).toISOString()
194
+ });
195
+ let closing;
196
+ return {
197
+ endpoint: options.endpoint,
198
+ listeningEndpoint,
199
+ authorityStore: readyStore,
200
+ request(request) {
201
+ return dispatchCliAuthorityBrokerRequest(readyStore, request);
202
+ },
203
+ async close() {
204
+ closing ??= (async () => {
205
+ storeReady = false;
206
+ for (const socket of sockets) socket.destroy();
207
+ if (server.listening) {
208
+ await new Promise((resolve, reject) => {
209
+ server.close((error) => error ? reject(error) : resolve());
210
+ });
211
+ }
212
+ await readyStore.close();
213
+ brokerRegistry.delete(options.endpoint);
214
+ releaseDatabaseOwnership(options);
215
+ removeFileIfPresent(options.metadataPath);
216
+ removeFileIfPresent(options.healthPath);
217
+ })().catch((error) => {
218
+ closing = void 0;
219
+ throw error;
210
220
  });
221
+ return closing;
211
222
  }
212
- await store.close();
213
- if (target.kind === "unix") {
214
- removeFileIfPresent(target.path);
223
+ };
224
+ } catch (error) {
225
+ storeReady = false;
226
+ for (const socket of sockets) socket.destroy();
227
+ if (server.listening) {
228
+ await new Promise((resolve) => server.close(() => resolve()));
229
+ }
230
+ if (store) {
231
+ try {
232
+ await store.close();
233
+ } catch (closeError) {
234
+ throw Object.assign(new AggregateError([error, closeError], "Broker startup failed and the native authority store could not close"), { retainAuthorityOwnership: true });
215
235
  }
216
- removeFileIfPresent(options.metadataPath);
217
- removeFileIfPresent(options.healthPath);
218
236
  }
219
- };
237
+ throw error;
238
+ }
220
239
  }
221
240
  function bindSocketRequestHandler(args) {
222
241
  let buffer = "";
@@ -239,10 +258,41 @@ function bindSocketRequestHandler(args) {
239
258
  `);
240
259
  });
241
260
  }
261
+ function canonicalDatabasePath(dbPath) {
262
+ const absolute = path.resolve(dbPath);
263
+ try {
264
+ return fs.realpathSync(absolute);
265
+ } catch (error) {
266
+ if (error.code !== "ENOENT") throw error;
267
+ const parent = path.dirname(absolute);
268
+ if (parent === absolute) throw error;
269
+ return path.join(canonicalDatabasePath(parent), path.basename(absolute));
270
+ }
271
+ }
272
+ function releaseDatabaseOwnership(options) {
273
+ if (!options.dbPath) return;
274
+ const identity = options.dbPath;
275
+ if (databaseOwners.get(identity) === options.endpoint) databaseOwners.delete(identity);
276
+ }
242
277
  function getOrCreateCliAuthorityBrokerServer(options) {
278
+ options = { ...options, dbPath: options.dbPath ? canonicalDatabasePath(options.dbPath) : void 0 };
243
279
  const existing = brokerRegistry.get(options.endpoint);
244
- if (existing) return existing;
280
+ if (existing) {
281
+ if (options.dbPath && databaseOwners.get(options.dbPath) !== options.endpoint) {
282
+ return Promise.reject(new Error(`CLI authority endpoint ${options.endpoint} already owns another database`));
283
+ }
284
+ return existing;
285
+ }
286
+ if (options.dbPath) {
287
+ const identity = canonicalDatabasePath(options.dbPath);
288
+ const owner = databaseOwners.get(identity);
289
+ if (owner) {
290
+ return Promise.reject(Object.assign(new Error(`CLI authority database already owned by ${owner}`), { code: "LEVEL_LOCKED" }));
291
+ }
292
+ databaseOwners.set(identity, options.endpoint);
293
+ }
245
294
  const pending = createBrokerHandle(options).catch((error) => {
295
+ if (!error?.retainAuthorityOwnership) releaseDatabaseOwnership(options);
246
296
  brokerRegistry.delete(options.endpoint);
247
297
  throw error;
248
298
  });
@@ -254,10 +304,33 @@ function getOrCreateCliAuthorityBrokerServer(options) {
254
304
  function ensureDbParentDir(dbPath) {
255
305
  fs2.mkdirSync(path2.dirname(dbPath), { recursive: true });
256
306
  }
307
+ function findCliAuthorityCorruption(error) {
308
+ const seen = /* @__PURE__ */ new Set();
309
+ let current = error;
310
+ while (current && !seen.has(current)) {
311
+ seen.add(current);
312
+ if (current.code === "LEVEL_CORRUPTION" || /Corruption:|missing files/i.test(toErrorMessage(current))) return current;
313
+ current = current.cause;
314
+ }
315
+ return void 0;
316
+ }
317
+ function throwCliAuthorityStartupError(error) {
318
+ const corruption = findCliAuthorityCorruption(error);
319
+ if (corruption) {
320
+ throw new Error(`Local authority database corruption: ${toErrorMessage(corruption)}`, { cause: error });
321
+ }
322
+ throw error;
323
+ }
257
324
  function isCliAuthorityLockError(error) {
258
- if (isLevelLockError(error)) return true;
259
- const message = toErrorMessage(error);
260
- return /Database failed to open|EADDRINUSE|Failed to listen/i.test(message);
325
+ if (findCliAuthorityCorruption(error)) return false;
326
+ const seen = /* @__PURE__ */ new Set();
327
+ let current = error;
328
+ while (current && !seen.has(current)) {
329
+ seen.add(current);
330
+ if (isLevelLockError(current)) return true;
331
+ current = current.cause;
332
+ }
333
+ return /EADDRINUSE|Failed to listen/i.test(toErrorMessage(error));
261
334
  }
262
335
  async function sleep(ms) {
263
336
  await new Promise((resolve) => setTimeout(resolve, ms));
@@ -313,12 +386,13 @@ async function connectCliAuthorityBroker(args) {
313
386
  endpoint: args.endpoint,
314
387
  metadataPath: args.metadataPath,
315
388
  healthPath: args.healthPath,
389
+ dbPath: args.dbPath,
316
390
  createStore: () => createLevelAuthorityStore(args.dbPath)
317
391
  });
318
392
  await client2.open();
319
393
  return client2;
320
394
  } catch (error) {
321
- if (!isCliAuthorityLockError(error)) throw error;
395
+ if (!isCliAuthorityLockError(error)) throwCliAuthorityStartupError(error);
322
396
  if (await attachToExistingBroker(5)) {
323
397
  return client2;
324
398
  }
@@ -330,6 +404,7 @@ async function connectCliAuthorityBroker(args) {
330
404
  endpoint: args.endpoint,
331
405
  metadataPath: args.metadataPath,
332
406
  healthPath: args.healthPath,
407
+ dbPath: args.dbPath,
333
408
  createStore: () => createLevelAuthorityStore(args.dbPath)
334
409
  });
335
410
  await client2.open();
@@ -345,10 +420,13 @@ async function connectCliAuthorityBroker(args) {
345
420
  if (isCliAuthorityBrokerUnavailableError(retryError)) {
346
421
  continue;
347
422
  }
348
- throw retryError;
423
+ throwCliAuthorityStartupError(retryError);
349
424
  }
350
425
  }
351
- throw new Error(`CLI authority broker could not attach or take ownership for ${args.endpoint}`, {
426
+ const lastMessage = toErrorMessage(lastError);
427
+ const portInUse = lastError !== null && typeof lastError === "object" && "code" in lastError && lastError.code === "EADDRINUSE" || /EADDRINUSE/i.test(lastMessage);
428
+ const detail = portInUse ? `: EADDRINUSE (${lastMessage}). The broker endpoint is already in use; check the process using it or set NOLO_CLI_AUTHORITY_BROKER_PORT to a free port for all local CLI processes` : "";
429
+ throw new Error(`CLI authority broker could not attach or take ownership for ${args.endpoint}${detail}`, {
352
430
  cause: lastError
353
431
  });
354
432
  }
@@ -481,6 +559,7 @@ async function getDefaultCliLocalRuntimeDb(options = {}) {
481
559
  const authorityStore = await getDefaultCliLocalRuntimeAuthority(options);
482
560
  return createLegacyServerDb(authorityStore);
483
561
  }
562
+
484
563
  export {
485
564
  connectCliAuthorityBroker,
486
565
  getDefaultCliLocalRuntimeAuthority,
@@ -1,15 +1,34 @@
1
+ import {
2
+ _appendRetiredStateBatch,
3
+ loadMemoryVNextCatalog
4
+ } from "./chunk-TY3TIUJK.js";
1
5
  import {
2
6
  resolveMachineId
3
- } from "./chunk-ESHYE7WU.js";
7
+ } from "./chunk-S73EPYNC.js";
8
+ import {
9
+ createMemoryKey,
10
+ createMemoryOwnerIndexKey,
11
+ createMemorySubjectKindIndexKey,
12
+ memoryOwnerRange
13
+ } from "./chunk-5EMSBTQ6.js";
14
+ import {
15
+ asTrimmedNonEmptyStringArray
16
+ } from "./chunk-I42VC5KR.js";
17
+ import {
18
+ asTrimmedString
19
+ } from "./chunk-3EUW3WEO.js";
4
20
  import {
5
21
  getDefaultCliLocalRuntimeDb
6
- } from "./chunk-ZOVKKMF6.js";
22
+ } from "./chunk-FY4SDK2E.js";
7
23
  import {
8
24
  resolveAuthTokenFromEnv
9
25
  } from "./chunk-A7GB5UGH.js";
10
26
  import {
11
27
  DEFAULT_NOLO_SERVER_URL
12
28
  } from "./chunk-OLZBQWZU.js";
29
+ import {
30
+ normalizeServerOrigin
31
+ } from "./chunk-CF7PE763.js";
13
32
  import {
14
33
  buildCliRuntimeEnv,
15
34
  clearProfileAuthToken,
@@ -19,19 +38,6 @@ import {
19
38
  loadProfileConfig,
20
39
  saveDefaultProfile
21
40
  } from "./chunk-TNIX77YM.js";
22
- import {
23
- asTrimmedNonEmptyStringArray,
24
- createMemoryKey,
25
- createMemoryOwnerIndexKey,
26
- createMemorySubjectKindIndexKey,
27
- memoryOwnerRange
28
- } from "./chunk-3AH7LNUB.js";
29
- import {
30
- asTrimmedString
31
- } from "./chunk-3EUW3WEO.js";
32
- import {
33
- normalizeServerOrigin
34
- } from "./chunk-CF7PE763.js";
35
41
 
36
42
  // packages/cli/authCommands.ts
37
43
  import { createInterface } from "node:readline/promises";
@@ -39,6 +45,29 @@ import { stdin as input, stdout as output } from "node:process";
39
45
  import { spawn } from "node:child_process";
40
46
 
41
47
  // packages/ai/memory/delete.ts
48
+ var VNEXT_STATE_ID_PREFIX = "vnext-state-";
49
+ var toVNextMemoryItem = (state, owner) => ({
50
+ id: `${VNEXT_STATE_ID_PREFIX}${state.id}`,
51
+ ownerType: owner.ownerType,
52
+ ownerId: owner.ownerId,
53
+ visibility: "private",
54
+ subjectType: "user",
55
+ subjectId: owner.ownerId,
56
+ kind: "semantic",
57
+ content: state.text.trim(),
58
+ createdAt: state.createdAt,
59
+ lastActivatedAt: state.createdAt,
60
+ activationCount: 1,
61
+ importance: 0.9,
62
+ confidence: 0.9,
63
+ resident: state.facet === "preference" || state.facet === "style"
64
+ });
65
+ var matchesVNextFilters = (state, idSet, contentSub) => {
66
+ if (!idSet && !contentSub) return false;
67
+ if (idSet && !idSet.has(`${VNEXT_STATE_ID_PREFIX}${state.id}`)) return false;
68
+ if (contentSub && !state.text.toLowerCase().includes(contentSub)) return false;
69
+ return true;
70
+ };
42
71
  function hasExplicitDeleteFilters(filters) {
43
72
  return Boolean(
44
73
  filters.ids && filters.ids.length > 0 || typeof filters.contentSubstring === "string" && filters.contentSubstring.trim().length > 0 || filters.tags && filters.tags.length > 0 || typeof filters.sourceDialogId === "string" && filters.sourceDialogId.trim().length > 0 || typeof filters.patternKeyPrefix === "string" && filters.patternKeyPrefix.trim().length > 0 || filters.facets && filters.facets.length > 0 || typeof filters.subjectId === "string" && filters.subjectId.trim().length > 0
@@ -127,8 +156,32 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
127
156
  matchedItems.push(item);
128
157
  if (matchedItems.length >= limit) break;
129
158
  }
159
+ const idSet = normalizeSet(filters.ids);
160
+ const contentSub = asTrimmedString(filters.contentSubstring).toLowerCase();
161
+ const vnextStateIdsToRetire = [];
162
+ const vnextStatesToRetire = [];
163
+ const vnextMatchedItems = [];
164
+ let vnextPrincipalId = null;
165
+ const hasScopingFilters = Boolean(
166
+ normalizeSet(filters.kinds) || normalizeSet(filters.facets) || normalizeSet(filters.tags) || asTrimmedString(filters.subjectType) || asTrimmedString(filters.subjectId) || asTrimmedString(filters.patternKeyPrefix) || asTrimmedString(filters.sourceDialogId)
167
+ );
168
+ const canMatchVNext = !hasScopingFilters && (contentSub.length > 0 || idSet !== null && [...idSet].some((id) => id.startsWith(VNEXT_STATE_ID_PREFIX)));
169
+ if (canMatchVNext) {
170
+ vnextPrincipalId = `${owner.ownerType}:${encodeURIComponent(owner.ownerId)}`;
171
+ const catalog = await loadMemoryVNextCatalog(db, vnextPrincipalId);
172
+ for (const state of catalog.states) {
173
+ if (matchedItems.length >= limit) break;
174
+ if (state.retiredAt) continue;
175
+ if (!matchesVNextFilters(state, idSet, contentSub)) continue;
176
+ vnextStateIdsToRetire.push(state.id);
177
+ vnextStatesToRetire.push(state);
178
+ const projected = toVNextMemoryItem(state, owner);
179
+ vnextMatchedItems.push(projected);
180
+ matchedItems.push(projected);
181
+ }
182
+ }
130
183
  if (matchedItems.length === 0) {
131
- return { deletedCount: 0, deletedIds: [], matchedItems: [] };
184
+ return { deletedCount: 0, deletedIds: [], retiredIds: [], matchedItems: [] };
132
185
  }
133
186
  const token = generateMemoryDeletionToken(
134
187
  owner.ownerId,
@@ -138,23 +191,38 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
138
191
  return {
139
192
  deletedCount: 0,
140
193
  deletedIds: [],
194
+ retiredIds: [],
141
195
  matchedItems,
142
196
  deletionToken: token
143
197
  };
144
198
  }
145
199
  if (filters.deletionToken && filters.deletionToken !== token) {
146
200
  throw new Error(
147
- "deletionToken mismatch: memory dataset changed since preview; please rerun dry-run preview before confirming."
201
+ "deletionToken mismatch: target set differs from preview; preview exact intended targets again."
148
202
  );
149
203
  }
150
- const batch = db.batch();
151
- for (const item of matchedItems) {
152
- deleteMemoryItemWithIndexesInBatch(batch, item);
204
+ const vnextMatchedIdSet = new Set(
205
+ vnextStateIdsToRetire.map((stateId) => `${VNEXT_STATE_ID_PREFIX}${stateId}`)
206
+ );
207
+ const legacyItems = matchedItems.filter((item) => !vnextMatchedIdSet.has(item.id));
208
+ const shouldRetireVNext = vnextStatesToRetire.length > 0;
209
+ if (legacyItems.length > 0 || shouldRetireVNext) {
210
+ const batch = db.batch();
211
+ for (const item of legacyItems) {
212
+ deleteMemoryItemWithIndexesInBatch(batch, item);
213
+ }
214
+ if (shouldRetireVNext) {
215
+ const nowIso = (/* @__PURE__ */ new Date()).toISOString();
216
+ for (const state of vnextStatesToRetire) {
217
+ _appendRetiredStateBatch(batch, { ...state, retiredAt: nowIso });
218
+ }
219
+ }
220
+ await batch.write();
153
221
  }
154
- await batch.write();
155
222
  return {
156
223
  deletedCount: matchedItems.length,
157
224
  deletedIds: matchedItems.map((item) => item.id),
225
+ retiredIds: vnextMatchedItems.map((item) => item.id),
158
226
  matchedItems,
159
227
  deletionToken: token
160
228
  };
@@ -78,6 +78,20 @@ function clampCooldownDeadline(at, now) {
78
78
  const max = now + MAX_COOLDOWN_MS;
79
79
  return Math.min(Math.max(at, min), max);
80
80
  }
81
+ function shouldClearCooldownFromQuota(entry, quota, now) {
82
+ if (!(typeof entry.nextAvailableAt === "number" && entry.nextAvailableAt > now)) return false;
83
+ if (typeof entry.markedAt !== "number" || !Number.isFinite(entry.markedAt)) return false;
84
+ if (!quota || !(quota.observedAt > entry.markedAt)) return false;
85
+ const subscriptionWindows = quota.windows.filter((window) => window.scope === "5h" || window.scope === "7d");
86
+ if (subscriptionWindows.length === 0) return false;
87
+ if (quota.windows.some((window) => window.scope !== "5h" && window.scope !== "7d" && (window.remaining === 0 || typeof window.utilization === "number" && window.utilization >= 0.95))) return false;
88
+ return subscriptionWindows.every((window) => {
89
+ const hasUtilization = typeof window.utilization === "number";
90
+ const hasRemaining = typeof window.remaining === "number";
91
+ if (!hasUtilization && !hasRemaining) return false;
92
+ return (!hasUtilization || window.utilization < 0.95) && (!hasRemaining || window.remaining > 0);
93
+ });
94
+ }
81
95
  function isAgentUnavailableNow(agent, now = Date.now()) {
82
96
  const at = agent?.nextAvailableAt;
83
97
  return typeof at === "number" && Number.isFinite(at) && at > now;
@@ -214,10 +228,12 @@ function resolveCredentialKeyWithFallback(agent) {
214
228
  export {
215
229
  QUOTA_ERROR_PATTERNS,
216
230
  isQuotaExhaustedError,
231
+ shouldClearCooldownFromQuota,
217
232
  isAgentUnavailableNow,
218
233
  isQuotaLimited403Body,
219
234
  resolveAvailabilityAction,
220
235
  mergeAvailabilityDeadline,
236
+ PROBE_INTERVAL_MS,
221
237
  resolveCooldownGate,
222
238
  resolveCredentialKeyWithFallback
223
239
  };
@@ -0,0 +1,40 @@
1
+ // packages/app/utils/fileUtils.ts
2
+ var fileConstructor = typeof globalThis !== "undefined" && typeof globalThis.File === "function" ? globalThis.File : void 0;
3
+ var isImageMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("image/");
4
+ var IMAGE_FILE_NAME_RE = /\.(avif|bmp|gif|heic|heif|ico|jpe?g|png|svg|tiff?|webp)$/i;
5
+ var VIDEO_FILE_NAME_RE = /\.(avi|m4v|mkv|mov|mp4|mpeg|mpg|webm)$/i;
6
+ var AUDIO_FILE_NAME_RE = /\.(aac|flac|m4a|mp3|ogg|wav|weba)$/i;
7
+ var DOCUMENT_FILE_NAME_RE = /\.(csv|doc|docx|md|odt|pdf|ppt|pptx|rtf|txt|xls|xlsx)$/i;
8
+ var isImageFileName = (value) => typeof value === "string" && IMAGE_FILE_NAME_RE.test(value.trim());
9
+ var isVideoMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("video/");
10
+ var isAudioMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("audio/");
11
+ var isPdfMimeType = (value) => typeof value === "string" && value.toLowerCase() === "application/pdf";
12
+ var isDocumentMimeType = (value) => {
13
+ if (typeof value !== "string") return false;
14
+ const normalized = value.toLowerCase();
15
+ return isPdfMimeType(normalized) || normalized === "text/plain" || normalized === "text/markdown" || normalized === "text/csv" || normalized === "application/msword" || normalized === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || normalized === "application/vnd.ms-powerpoint" || normalized === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || normalized === "application/vnd.ms-excel" || normalized === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || normalized === "application/rtf" || normalized === "application/vnd.oasis.opendocument.text";
16
+ };
17
+ var resolveFileCategory = ({
18
+ mimeType,
19
+ fileName
20
+ }) => {
21
+ if (isImageMimeType(mimeType) || isImageFileName(fileName)) return "image";
22
+ if (isVideoMimeType(mimeType) || typeof fileName === "string" && VIDEO_FILE_NAME_RE.test(fileName.trim())) {
23
+ return "video";
24
+ }
25
+ if (isAudioMimeType(mimeType) || typeof fileName === "string" && AUDIO_FILE_NAME_RE.test(fileName.trim())) {
26
+ return "audio";
27
+ }
28
+ if (isDocumentMimeType(mimeType) || typeof fileName === "string" && DOCUMENT_FILE_NAME_RE.test(fileName.trim())) {
29
+ return "document";
30
+ }
31
+ return "other";
32
+ };
33
+ var MEDIA_EXTENSION_RE = /\.(aac|avi|flac|m4a|m4v|mkv|mov|mp3|mp4|mpeg|mpg|ogg|wav|weba|webm)$/i;
34
+ var isMediaFile = (file) => file.type.toLowerCase().startsWith("audio/") || file.type.toLowerCase().startsWith("video/") || MEDIA_EXTENSION_RE.test(file.name.trim());
35
+ var MAX_MEDIA_FILE_SIZE = 120 * 1024 * 1024;
36
+
37
+ export {
38
+ resolveFileCategory,
39
+ isMediaFile
40
+ };