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
@@ -1,6 +1,12 @@
1
+ import {
2
+ createClientLogger
3
+ } from "./chunk-QQ56R7KS.js";
1
4
  import {
2
5
  isLevelNotFoundError
3
6
  } from "./chunk-OW765XBU.js";
7
+ import {
8
+ isAbortError
9
+ } from "./chunk-7DPNBQSV.js";
4
10
  import {
5
11
  API_ENDPOINTS,
6
12
  NOLO_CLUSTER_SERVERS,
@@ -20,97 +26,6 @@ var isDevelopment = !isProduction;
20
26
  var getIsDesktopApp = () => (typeof process !== "undefined" ? process.env?.NOLO_DESKTOP : processEnv?.NOLO_DESKTOP) === "1" || typeof window !== "undefined" && window.__NOLO_DESKTOP__ === true;
21
27
  var isDesktopApp = getIsDesktopApp();
22
28
 
23
- // packages/core/clientLogger.ts
24
- var LOG_LEVELS = {
25
- debug: 10,
26
- info: 20,
27
- warn: 30,
28
- error: 40
29
- };
30
- var serializeValue = (value, seen = /* @__PURE__ */ new WeakSet()) => {
31
- if (value instanceof Error) {
32
- return {
33
- name: value.name,
34
- message: value.message,
35
- ...value.stack ? { stack: value.stack } : {}
36
- };
37
- }
38
- if (typeof value !== "object" || value === null) {
39
- if (typeof value === "bigint") {
40
- return value.toString();
41
- }
42
- return value;
43
- }
44
- if (seen.has(value)) {
45
- return "[Circular]";
46
- }
47
- seen.add(value);
48
- try {
49
- if (Array.isArray(value)) {
50
- return value.map((item) => serializeValue(item, seen));
51
- }
52
- return Object.fromEntries(
53
- Object.entries(value).map(([key, item]) => [key, serializeValue(item, seen)])
54
- );
55
- } finally {
56
- seen.delete(value);
57
- }
58
- };
59
- var getLogLevel = () => {
60
- const configured = typeof process !== "undefined" && typeof process.env?.NOLO_LOG_LEVEL === "string" ? process.env.NOLO_LOG_LEVEL : "info";
61
- return LOG_LEVELS[configured] ?? LOG_LEVELS.info;
62
- };
63
- var writeLog = (level, name, fields, message) => {
64
- if (LOG_LEVELS[level] < getLogLevel()) {
65
- return;
66
- }
67
- const serializedFields = serializeValue(fields);
68
- const payload = {
69
- level,
70
- ...name ? { name } : {},
71
- ...serializedFields,
72
- ...message ? { msg: message } : {}
73
- };
74
- const output = JSON.stringify(payload);
75
- const isNodeRuntime = typeof process !== "undefined" && typeof process.stderr?.write === "function";
76
- if (isNodeRuntime) {
77
- process.stderr.write(`${output}
78
- `);
79
- return;
80
- }
81
- const consoleMethod = console[level] ?? console.log;
82
- if (Object.keys(fields).length === 0 && message) {
83
- consoleMethod(`[${name}] ${message}`);
84
- } else {
85
- consoleMethod(output);
86
- }
87
- };
88
- var parseArgs = (first, second) => {
89
- if (typeof first === "string") {
90
- return { fields: {}, message: first };
91
- }
92
- return { fields: first ?? {}, message: second };
93
- };
94
- var createClientLogger = (name, parentFields = {}) => {
95
- const log = (level, first, second) => {
96
- const { fields, message } = parseArgs(first, second);
97
- writeLog(level, name, { ...parentFields, ...fields }, message);
98
- };
99
- return {
100
- debug: (first, second) => log("debug", first, second),
101
- info: (first, second) => log("info", first, second),
102
- warn: (first, second) => log("warn", first, second),
103
- error: (first, second) => log("error", first, second),
104
- child: (fields) => createClientLogger(name, { ...parentFields, ...fields })
105
- };
106
- };
107
-
108
- // packages/core/abortError.ts
109
- function isAbortError(error) {
110
- if (!error || typeof error !== "object") return false;
111
- return error.name === "AbortError";
112
- }
113
-
114
29
  // packages/app/utils/retryFetch.ts
115
30
  var TRANSIENT_READ_RETRY_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
116
31
  var DEFAULT_RETRY_DELAYS_MS = [300, 1e3];
@@ -258,11 +173,8 @@ var normalizeTimeFields = (data) => ({
258
173
  });
259
174
 
260
175
  export {
261
- isProduction,
262
176
  isDevelopment,
263
177
  getIsDesktopApp,
264
- createClientLogger,
265
- isAbortError,
266
178
  logger,
267
179
  getAllServers,
268
180
  fetchFromClientDb,
@@ -0,0 +1,223 @@
1
+ // packages/cli/secretScan.ts
2
+ var INLINE_WAIVER_MARKER = "secret-scan:allow";
3
+ var INLINE_WAIVER_MIN_REASON_CHARS = 3;
4
+ var ASSIGNMENT_KEYS = [
5
+ { label: "password", keys: "password|passwd", min: 8 },
6
+ { label: "psk", keys: "psk", min: 8 },
7
+ { label: "api key", keys: "api[_-]?key|apikey", min: 12 },
8
+ { label: "token", keys: "token|secret", min: 12 }
9
+ ];
10
+ var ASSIGNMENT_PATTERNS = ASSIGNMENT_KEYS.map(
11
+ ({ label, keys, min }) => ({
12
+ label,
13
+ // 反向引用 \1 让引号成对成为必要条件:半截引号不算。值里允许空格与逗号——
14
+ // 写成带空格的口令是常见形态,旧的字符类会把这种值截成半截从而整条漏掉。
15
+ quoted: new RegExp(
16
+ `\\b(?:${keys})\\s*[:=]\\s*(["'])([^"']{${min},})\\1`,
17
+ "i"
18
+ ),
19
+ // 不带引号时只取到分隔符为止,是否算密钥交给 looksLikeBareSecret 判。
20
+ bare: new RegExp(
21
+ `\\b(?:${keys})\\s*[:=]\\s*([^\\s"',#]{${min},})`,
22
+ "i"
23
+ )
24
+ })
25
+ );
26
+ var PRIVATE_KEY_PATTERN = /-----BEGIN [A-Z ]*PRIVATE KEY-----/;
27
+ var EXPRESSION_CHARS = /[?(){};|&<>$]/;
28
+ var CONSTANT_CASE = /^[A-Z][A-Z0-9_]*$/;
29
+ var CAMEL_CASE = /^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]+)+$/;
30
+ var PROPERTY_SEGMENT = /^[A-Za-z_$][\w$]*$/;
31
+ var NAME_FORM_MAX_CHARS = 48;
32
+ var PROPERTY_SEGMENT_MAX_CHARS = 24;
33
+ function looksLikeDottedName(value) {
34
+ const segments = value.split(".");
35
+ if (segments.length < 2) return false;
36
+ return segments.every(
37
+ (segment) => PROPERTY_SEGMENT.test(segment) && (segment.length <= PROPERTY_SEGMENT_MAX_CHARS || CONSTANT_CASE.test(segment) && segment.includes("_"))
38
+ );
39
+ }
40
+ function stripTrailingMarkdownFence(value) {
41
+ return value.replace(/`+$/, "");
42
+ }
43
+ function looksLikeBareSecret(rawValue) {
44
+ const value = stripTrailingMarkdownFence(rawValue);
45
+ if (EXPRESSION_CHARS.test(value)) return false;
46
+ if (CONSTANT_CASE.test(value) && value.includes("_")) return false;
47
+ if (looksLikeDottedName(value)) return false;
48
+ if (value.length > NAME_FORM_MAX_CHARS) {
49
+ return /\d/.test(value);
50
+ }
51
+ if (CAMEL_CASE.test(value)) return false;
52
+ return true;
53
+ }
54
+ function redactedPreview(label, valueLength) {
55
+ return valueLength === null ? `<redacted:${label}>` : `<redacted:${label} len=${valueLength}>`;
56
+ }
57
+ function collectLineCandidates(line) {
58
+ const candidates = [];
59
+ for (const { label, quoted, bare } of ASSIGNMENT_PATTERNS) {
60
+ const quotedMatch = quoted.exec(line);
61
+ if (quotedMatch) {
62
+ candidates.push({
63
+ label,
64
+ preview: redactedPreview(label, quotedMatch[2].length),
65
+ endIndex: quotedMatch.index + quotedMatch[0].length,
66
+ isPrivateKey: false
67
+ });
68
+ continue;
69
+ }
70
+ const bareMatch = bare.exec(line);
71
+ if (bareMatch && looksLikeBareSecret(bareMatch[1])) {
72
+ candidates.push({
73
+ label,
74
+ preview: redactedPreview(
75
+ label,
76
+ stripTrailingMarkdownFence(bareMatch[1]).length
77
+ ),
78
+ endIndex: bareMatch.index + bareMatch[0].length,
79
+ isPrivateKey: false
80
+ });
81
+ }
82
+ }
83
+ const privateKeyMatch = PRIVATE_KEY_PATTERN.exec(line);
84
+ if (privateKeyMatch) {
85
+ candidates.push({
86
+ label: "private key",
87
+ preview: redactedPreview("private key", null),
88
+ endIndex: privateKeyMatch.index + privateKeyMatch[0].length,
89
+ isPrivateKey: true
90
+ });
91
+ }
92
+ return candidates;
93
+ }
94
+ var INLINE_WAIVER_PATTERN = new RegExp(
95
+ `//\\s*${INLINE_WAIVER_MARKER.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s+--[ \\t]+(.*)$`,
96
+ "g"
97
+ );
98
+ var NEVER_WAIVABLE_EXTENSION = /\.(?:json|json5|ya?ml|snap|lock|pem|key|crt|cer|txt|csv|md|markdown|example|sample)$/i;
99
+ var NEVER_WAIVABLE_ENV_FILE = /\.env(\.[^/]*)?$/i;
100
+ var NEVER_WAIVABLE_TOP_DIRS = /* @__PURE__ */ new Set(["scripts"]);
101
+ var SOURCE_EXTENSION = /\.(?:[cm]?[jt]sx?)$/i;
102
+ var TEST_FILE_NAME = /\.(?:test|spec)\.[cm]?[jt]sx?$/i;
103
+ var TEST_PATH_SEGMENTS = /* @__PURE__ */ new Set([
104
+ "__tests__",
105
+ "__mocks__",
106
+ "__fixtures__",
107
+ "e2e",
108
+ "test",
109
+ "tests",
110
+ "fixtures"
111
+ ]);
112
+ function decodeGitCQuoting(text) {
113
+ if (!text.startsWith('"')) return text;
114
+ const body = text.endsWith('"') ? text.slice(1, -1) : text.slice(1);
115
+ const bytes = [];
116
+ for (let index = 0; index < body.length; index += 1) {
117
+ const char = body[index];
118
+ if (char !== "\\") {
119
+ bytes.push(char.charCodeAt(0));
120
+ continue;
121
+ }
122
+ const next = body[index + 1] ?? "";
123
+ if (next >= "0" && next <= "7") {
124
+ let octal = "";
125
+ while (octal.length < 3 && /[0-7]/.test(body[index + 1 + octal.length] ?? "")) {
126
+ octal += body[index + 1 + octal.length];
127
+ }
128
+ const byte = Number.parseInt(octal, 8);
129
+ if (!Number.isFinite(byte) || byte > 255) return null;
130
+ bytes.push(byte);
131
+ index += octal.length;
132
+ continue;
133
+ }
134
+ index += 1;
135
+ if (next === "n") bytes.push(10);
136
+ else if (next === "t") bytes.push(9);
137
+ else if (next === "r") bytes.push(13);
138
+ else bytes.push(next.charCodeAt(0));
139
+ }
140
+ return new TextDecoder().decode(Uint8Array.from(bytes));
141
+ }
142
+ function normalizeRepoPath(rawPath) {
143
+ const unquoted = decodeGitCQuoting(rawPath.replace(/[\t ]+$/, ""));
144
+ if (unquoted === null) return null;
145
+ const normalized = unquoted.replace(/\\/g, "/").replace(/\/{2,}/g, "/").replace(/^\.\//, "");
146
+ if (!normalized) return null;
147
+ if (normalized.startsWith("/") || /^[a-z]:/i.test(normalized)) return null;
148
+ if (normalized.includes("..")) return null;
149
+ if (/[\x00-\x1f\x7f]/.test(normalized)) return null;
150
+ return normalized;
151
+ }
152
+ function isWaivableTestPath(rawPath) {
153
+ if (!rawPath) return false;
154
+ const path = normalizeRepoPath(rawPath);
155
+ if (path === null) return false;
156
+ const lower = path.toLowerCase();
157
+ const segments = lower.split("/");
158
+ const topDir = segments[0] ?? "";
159
+ if (NEVER_WAIVABLE_TOP_DIRS.has(topDir)) return false;
160
+ if (NEVER_WAIVABLE_EXTENSION.test(lower)) return false;
161
+ if (NEVER_WAIVABLE_ENV_FILE.test(lower)) return false;
162
+ if (!SOURCE_EXTENSION.test(lower)) return false;
163
+ const baseName = segments[segments.length - 1] ?? "";
164
+ if (TEST_FILE_NAME.test(baseName)) return true;
165
+ return segments.some((segment) => TEST_PATH_SEGMENTS.has(segment));
166
+ }
167
+ function resolveInlineWaiver(line, candidates) {
168
+ if (candidates.length !== 1) return null;
169
+ const candidate = candidates[0];
170
+ if (candidate.isPrivateKey) return null;
171
+ let reason = null;
172
+ let markerIndex = -1;
173
+ INLINE_WAIVER_PATTERN.lastIndex = 0;
174
+ for (let match = INLINE_WAIVER_PATTERN.exec(line); match !== null; match = INLINE_WAIVER_PATTERN.exec(line)) {
175
+ reason = match[1].trim();
176
+ markerIndex = match.index;
177
+ }
178
+ if (markerIndex < 0 || reason === null) return null;
179
+ if (markerIndex <= candidate.endIndex) return null;
180
+ if (reason.length < INLINE_WAIVER_MIN_REASON_CHARS) return null;
181
+ return reason;
182
+ }
183
+ function findPotentialSecrets(text, options = {}) {
184
+ const findings = [];
185
+ const mayWaive = options.allowInlineWaiver === true && isWaivableTestPath(options.filePath);
186
+ text.split(/\r?\n/).forEach((line, index) => {
187
+ const lineNumber = index + 1;
188
+ const candidates = collectLineCandidates(line);
189
+ if (candidates.length === 0) return;
190
+ if (mayWaive) {
191
+ const reason = resolveInlineWaiver(line, candidates);
192
+ if (reason !== null) {
193
+ findings.push({
194
+ label: candidates[0].label,
195
+ line: lineNumber,
196
+ preview: candidates[0].preview,
197
+ waived: true,
198
+ waiverReason: reason
199
+ });
200
+ return;
201
+ }
202
+ }
203
+ for (const candidate of candidates) {
204
+ findings.push({
205
+ label: candidate.label,
206
+ line: lineNumber,
207
+ preview: candidate.preview
208
+ });
209
+ }
210
+ });
211
+ return findings;
212
+ }
213
+ function formatSecretFindings(findings) {
214
+ return findings.map((finding) => {
215
+ const waivedTag = finding.waived ? ` [waived: ${finding.waiverReason}]` : "";
216
+ return ` line ${finding.line} (${finding.label}): ${finding.preview}${waivedTag}`;
217
+ }).join("\n");
218
+ }
219
+
220
+ export {
221
+ findPotentialSecrets,
222
+ formatSecretFindings
223
+ };
@@ -1,25 +1,21 @@
1
1
  import {
2
- loadFileFromIndexedDb,
3
- removeAction,
4
- saveFileToIndexedDb
5
- } from "./chunk-7CHC4W22.js";
6
- import {
7
- fileKey,
8
- getFileIdFromKey,
9
- ulid
10
- } from "./chunk-3AH7LNUB.js";
2
+ isMediaFile,
3
+ resolveFileCategory
4
+ } from "./chunk-3PVYUPXK.js";
11
5
  import {
12
6
  readAction,
13
7
  readRequestManager,
14
8
  resolveAgentReadServers
15
- } from "./chunk-IAESIMK7.js";
9
+ } from "./chunk-A4MW3YZL.js";
16
10
  import {
17
- asyncThunkCreator,
18
- buildCreateSlice,
11
+ loadFileFromIndexedDb,
12
+ removeAction,
13
+ saveFileToIndexedDb
14
+ } from "./chunk-AIZE5TDM.js";
15
+ import {
16
+ beginWriteAck,
19
17
  compareRemoteRecordsByComparableTime,
20
- createEntityAdapter,
21
18
  getRuntimeServerContext,
22
- noloDeleteRequest,
23
19
  pickBestSettledRemoteRecord,
24
20
  planAuthorityReadServers,
25
21
  resolveAuthorityReplicationServers,
@@ -32,16 +28,27 @@ import {
32
28
  shouldReplaceLocalWithRemoteRecord,
33
29
  shouldReplicateLocalRecord,
34
30
  uploadToCurrentServer
35
- } from "./chunk-WIWM4FE3.js";
31
+ } from "./chunk-4YRTZIVN.js";
32
+ import {
33
+ asyncThunkCreator,
34
+ buildCreateSlice,
35
+ createEntityAdapter,
36
+ noloDeleteRequest
37
+ } from "./chunk-IJERIUXS.js";
36
38
  import {
37
39
  fetchFromClientDb,
38
40
  fetchFromServer,
39
41
  logger,
40
42
  normalizeTimeFields
41
- } from "./chunk-QOKAKDPE.js";
43
+ } from "./chunk-6Q7UTJKR.js";
42
44
  import {
43
45
  isTombstoneRecord
44
- } from "./chunk-GBRG75BQ.js";
46
+ } from "./chunk-D2MDMY2M.js";
47
+ import {
48
+ fileKey,
49
+ getFileIdFromKey,
50
+ ulid
51
+ } from "./chunk-5EMSBTQ6.js";
45
52
  import {
46
53
  isRecord
47
54
  } from "./chunk-KUG52IAP.js";
@@ -260,12 +267,14 @@ var writeAction = async (writeConfig, thunkApi) => {
260
267
  `Invalid data type "${data.type}" for writeAction with key ${customKey}. Proceeding anyway.`
261
268
  );
262
269
  }
270
+ let writeAck = null;
263
271
  try {
264
272
  const willSaveData = normalizeTimeFields({
265
273
  ...data,
266
274
  dbKey: customKey,
267
275
  userId: recordUserId
268
276
  });
277
+ writeAck = beginWriteAck(customKey);
269
278
  await saveToClientDb(clientDb, customKey, willSaveData);
270
279
  const servers = resolveAuthorityReplicationServers({
271
280
  currentServer,
@@ -283,8 +292,14 @@ var writeAction = async (writeConfig, thunkApi) => {
283
292
  logger.debug(
284
293
  `[writeAction] Initiating background sync for key: ${customKey} to ${servers.length} servers.`
285
294
  );
286
- scheduleWriteReplication(servers, serverWriteConfig, state);
295
+ const replication = scheduleWriteReplication(
296
+ servers,
297
+ serverWriteConfig,
298
+ state
299
+ );
300
+ writeAck.settleWithReplication(replication);
287
301
  } else {
302
+ writeAck.markNotReplicated();
288
303
  logger.warn(
289
304
  { customKey },
290
305
  "[writeAction] No available servers, data only saved locally."
@@ -292,6 +307,7 @@ var writeAction = async (writeConfig, thunkApi) => {
292
307
  }
293
308
  return willSaveData;
294
309
  } catch (error) {
310
+ writeAck?.markAborted();
295
311
  const errorMessage = `Write action failed for ${customKey}: ${error?.message || "Unknown error"}`;
296
312
  logger.error({ error }, "[writeAction] Error");
297
313
  actionToast.error(`Failed to save data for ${customKey}.`);
@@ -461,39 +477,6 @@ var upsertAction = async (upsertConfig, thunkApi) => {
461
477
  }
462
478
  };
463
479
 
464
- // packages/app/utils/fileUtils.ts
465
- var fileConstructor = typeof globalThis !== "undefined" && typeof globalThis.File === "function" ? globalThis.File : void 0;
466
- var isImageMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("image/");
467
- var IMAGE_FILE_NAME_RE = /\.(avif|bmp|gif|heic|heif|ico|jpe?g|png|svg|tiff?|webp)$/i;
468
- var VIDEO_FILE_NAME_RE = /\.(avi|m4v|mkv|mov|mp4|mpeg|mpg|webm)$/i;
469
- var AUDIO_FILE_NAME_RE = /\.(aac|flac|m4a|mp3|ogg|wav|weba)$/i;
470
- var DOCUMENT_FILE_NAME_RE = /\.(csv|doc|docx|md|odt|pdf|ppt|pptx|rtf|txt|xls|xlsx)$/i;
471
- var isImageFileName = (value) => typeof value === "string" && IMAGE_FILE_NAME_RE.test(value.trim());
472
- var isVideoMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("video/");
473
- var isAudioMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("audio/");
474
- var isPdfMimeType = (value) => typeof value === "string" && value.toLowerCase() === "application/pdf";
475
- var isDocumentMimeType = (value) => {
476
- if (typeof value !== "string") return false;
477
- const normalized = value.toLowerCase();
478
- 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";
479
- };
480
- var resolveFileCategory = ({
481
- mimeType,
482
- fileName
483
- }) => {
484
- if (isImageMimeType(mimeType) || isImageFileName(fileName)) return "image";
485
- if (isVideoMimeType(mimeType) || typeof fileName === "string" && VIDEO_FILE_NAME_RE.test(fileName.trim())) {
486
- return "video";
487
- }
488
- if (isAudioMimeType(mimeType) || typeof fileName === "string" && AUDIO_FILE_NAME_RE.test(fileName.trim())) {
489
- return "audio";
490
- }
491
- if (isDocumentMimeType(mimeType) || typeof fileName === "string" && DOCUMENT_FILE_NAME_RE.test(fileName.trim())) {
492
- return "document";
493
- }
494
- return "other";
495
- };
496
-
497
480
  // packages/database/actions/upload.ts
498
481
  var saveToClientDb2 = async (clientDb, dbKey, metadata) => {
499
482
  if (!clientDb) {
@@ -518,7 +501,7 @@ var uploadFileAction = async (uploadConfig, thunkApi) => {
518
501
  const { db: clientDb } = thunkApi.extra;
519
502
  const state = thunkApi.getState();
520
503
  const { currentServer, syncServers, currentUserId } = getRuntimeServerContext(state);
521
- const { file, customKey } = uploadConfig;
504
+ const { file, customKey, onProgress, signal } = uploadConfig;
522
505
  const userId = uploadConfig.userId || currentUserId;
523
506
  if (!file) {
524
507
  const errorMsg = "Invalid arguments for uploadFileAction: file is required.";
@@ -554,13 +537,19 @@ var uploadFileAction = async (uploadConfig, thunkApi) => {
554
537
  userId
555
538
  });
556
539
  await saveToClientDb2(clientDb, finalDbKey, fileMetadata);
557
- try {
558
- await saveFileToIndexedDb(fileId, file);
559
- } catch (err) {
560
- logger.warn(
561
- { err, fileId },
562
- "[uploadFileAction] Failed to cache file locally."
563
- );
540
+ const cacheLocally = async () => {
541
+ try {
542
+ await saveFileToIndexedDb(fileId, file);
543
+ } catch (err) {
544
+ logger.warn(
545
+ { err, fileId },
546
+ "[uploadFileAction] Failed to cache file locally."
547
+ );
548
+ }
549
+ };
550
+ const localCachePromise = isMediaFile(file) ? cacheLocally() : null;
551
+ if (!localCachePromise) {
552
+ await cacheLocally();
564
553
  }
565
554
  const tenantId = userId || "default";
566
555
  const uploadReplicationConfig = {
@@ -580,8 +569,13 @@ var uploadFileAction = async (uploadConfig, thunkApi) => {
580
569
  const primaryUploadSucceeded = await uploadToCurrentServer({
581
570
  currentServer: primaryUploadServer,
582
571
  uploadConfig: uploadReplicationConfig,
583
- state
572
+ state,
573
+ ...onProgress ? { onProgress } : {},
574
+ ...signal ? { signal } : {}
584
575
  });
576
+ if (localCachePromise) {
577
+ await localCachePromise;
578
+ }
585
579
  if (primaryUploadServer && !primaryUploadSucceeded) {
586
580
  throw new Error(`Primary upload failed on authority server ${primaryUploadServer}`);
587
581
  }
@@ -712,7 +706,7 @@ var dbSlice = createSliceWithThunks({
712
706
  // 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
713
707
  read: create.asyncThunk(
714
708
  async (payload, thunkApi) => {
715
- const { readAction: readAction2 } = await import("./read-EPTJRAEF.js");
709
+ const { readAction: readAction2 } = await import("./read-DC4NUGN6.js");
716
710
  return readAction2(payload, thunkApi);
717
711
  },
718
712
  {
@@ -786,7 +780,7 @@ var dbSlice = createSliceWithThunks({
786
780
  // 这里改成动态 import,运行期才解析,彻底断开这条边。
787
781
  share: create.asyncThunk(
788
782
  async (config, thunkApi) => {
789
- const { shareResourceAction } = await import("./action-GI44T4DR.js");
783
+ const { shareResourceAction } = await import("./action-SXJD5N5R.js");
790
784
  return shareResourceAction(config, thunkApi);
791
785
  }
792
786
  ),
@@ -822,7 +816,6 @@ var dbSlice_default = dbSlice.reducer;
822
816
  export {
823
817
  readAndWaitAction,
824
818
  toTimestampMs,
825
- resolveFileCategory,
826
819
  uploadFileAction,
827
820
  readFileContentAction,
828
821
  dbAdapter,
@@ -0,0 +1,9 @@
1
+ // packages/core/abortError.ts
2
+ function isAbortError(error) {
3
+ if (!error || typeof error !== "object") return false;
4
+ return error.name === "AbortError";
5
+ }
6
+
7
+ export {
8
+ isAbortError
9
+ };
@@ -0,0 +1,119 @@
1
+ import {
2
+ fetchReferenceContents,
3
+ resolveReferenceAssets
4
+ } from "./chunk-SMENBO3M.js";
5
+ import {
6
+ updateTokensAction
7
+ } from "./chunk-556RW72X.js";
8
+ import {
9
+ applyUpdateTokensFulfilled
10
+ } from "./chunk-OWYYDMGJ.js";
11
+ import {
12
+ extractReasoningFromResponseOutput,
13
+ extractTextFromResponseOutput,
14
+ extractToolCallsFromResponseOutput
15
+ } from "./chunk-3SZA4U64.js";
16
+ import {
17
+ isRecord
18
+ } from "./chunk-KUG52IAP.js";
19
+
20
+ // packages/ai/agent/fetchAgentContexts.ts
21
+ async function fetchAgentContexts(references, dispatch) {
22
+ if (!Array.isArray(references)) {
23
+ return { botInstructionsContext: "", botKnowledgeContext: "" };
24
+ }
25
+ const { references: normalizedRefs, contentByKey } = await resolveReferenceAssets(references, dispatch);
26
+ const instructionKeys = /* @__PURE__ */ new Set();
27
+ const knowledgeKeys = /* @__PURE__ */ new Set();
28
+ normalizedRefs.forEach((ref) => {
29
+ if (!ref.dbKey) return;
30
+ ref.type === "instruction" ? instructionKeys.add(ref.dbKey) : knowledgeKeys.add(ref.dbKey);
31
+ });
32
+ const [instructionsMap, knowledgeMap] = await Promise.all([
33
+ fetchReferenceContents(Array.from(instructionKeys), dispatch, {
34
+ preloaded: contentByKey
35
+ }),
36
+ fetchReferenceContents(Array.from(knowledgeKeys), dispatch, {
37
+ preloaded: contentByKey
38
+ })
39
+ ]);
40
+ return {
41
+ botInstructionsContext: Array.from(instructionsMap.values()).join(""),
42
+ botKnowledgeContext: Array.from(knowledgeMap.values()).join("")
43
+ };
44
+ }
45
+
46
+ // packages/ai/agent/updateAgentTokens.ts
47
+ async function updateAgentTokens(args, thunkApi) {
48
+ const observedAt = Date.now();
49
+ const payload = await updateTokensAction(args, thunkApi);
50
+ if (args?.dialogKey && payload) {
51
+ applyUpdateTokensFulfilled({
52
+ observedAt,
53
+ authoritative: args?.contextUsageAuthoritative !== false && (args?.usageRecord?.usage ?? args?.usage)?.billing_estimated !== true,
54
+ dialogKey: args.dialogKey,
55
+ input_tokens: payload.input_tokens,
56
+ output_tokens: payload.output_tokens,
57
+ cost: payload.cost
58
+ });
59
+ }
60
+ return payload;
61
+ }
62
+
63
+ // packages/integrations/openai/responsesJsonToChatCompletions.ts
64
+ var isChatCompletionsShapedJson = (value) => isRecord(value) && Array.isArray(value.choices);
65
+ var isExplicitNonCompletedStatus = (status) => typeof status === "string" && status.trim().toLowerCase() !== "completed";
66
+ var asTokenCount = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
67
+ var projectChatUsage = (raw) => {
68
+ if (!isRecord(raw)) return null;
69
+ const usage = { ...raw };
70
+ if (asTokenCount(usage.prompt_tokens) === void 0) {
71
+ const inputTokens = asTokenCount(raw.input_tokens);
72
+ if (inputTokens !== void 0) usage.prompt_tokens = inputTokens;
73
+ }
74
+ if (asTokenCount(usage.completion_tokens) === void 0) {
75
+ const outputTokens = asTokenCount(raw.output_tokens);
76
+ if (outputTokens !== void 0) usage.completion_tokens = outputTokens;
77
+ }
78
+ if (asTokenCount(usage.total_tokens) === void 0) {
79
+ const prompt = asTokenCount(usage.prompt_tokens);
80
+ const completion = asTokenCount(usage.completion_tokens);
81
+ if (prompt !== void 0 && completion !== void 0) {
82
+ usage.total_tokens = prompt + completion;
83
+ }
84
+ }
85
+ return usage;
86
+ };
87
+ var responsesJsonToChatCompletions = (parsed) => {
88
+ if (!isRecord(parsed)) return null;
89
+ if (isChatCompletionsShapedJson(parsed)) return null;
90
+ if (parsed.error !== void 0 && parsed.error !== null) return null;
91
+ if (isExplicitNonCompletedStatus(parsed.status)) return null;
92
+ if (!Array.isArray(parsed.output)) return null;
93
+ const content = extractTextFromResponseOutput(parsed);
94
+ const reasoningContent = extractReasoningFromResponseOutput(parsed);
95
+ const toolCalls = extractToolCallsFromResponseOutput(parsed);
96
+ const usage = projectChatUsage(parsed.usage);
97
+ return {
98
+ object: "chat.completion",
99
+ choices: [
100
+ {
101
+ index: 0,
102
+ finish_reason: toolCalls.length > 0 ? "tool_calls" : "stop",
103
+ message: {
104
+ role: "assistant",
105
+ content,
106
+ ...reasoningContent ? { reasoning_content: reasoningContent } : {},
107
+ ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
108
+ }
109
+ }
110
+ ],
111
+ ...usage ? { usage } : {}
112
+ };
113
+ };
114
+
115
+ export {
116
+ fetchAgentContexts,
117
+ updateAgentTokens,
118
+ responsesJsonToChatCompletions
119
+ };