nolo-cli 0.228.0-alpha.2 → 0.228.1

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 (260) hide show
  1. package/README.md +3 -5
  2. package/{_executeModel-VYCHHZVT.js → _executeModel-AKCTHGMP.js} +89 -83
  3. package/{accountResolver-QETKNC7T.js → accountResolver-NGICIMEE.js} +1 -1
  4. package/{action-GDZDXPMB.js → action-C6IQAKN4.js} +8 -5
  5. package/{addContentAction-7RO4AMRI.js → addContentAction-53364YDW.js} +13 -12
  6. package/{addDialogAgentAction-EVYBGTXB.js → addDialogAgentAction-U5DD5EN5.js} +16 -15
  7. package/{agentDeleteCommand-QWQKT54A.js → agentDeleteCommand-2E5FAGUO.js} +128 -115
  8. package/{agentEmailCommands-EISMBIRE.js → agentEmailCommands-UGZZAH7E.js} +128 -111
  9. package/{agentListCommands-4WLG32IW.js → agentListCommands-JCTW3J2K.js} +398 -179
  10. package/{agentMachineCommands-DC6NKWTU.js → agentMachineCommands-QPG5ZXF4.js} +58 -47
  11. package/{agentProviderCommands-STI3DQ6A.js → agentProviderCommands-QLTABYR7.js} +2 -2
  12. package/{agentPullCommand-KHV4EELF.js → agentPullCommand-2EYJ5ENC.js} +1 -1
  13. package/agentRecordCommands-4NTVR6MZ.js +194 -0
  14. package/agentRunCommand-VHF34PYC.js +232 -0
  15. package/{agentRunControl-MBG4U6SL.js → agentRunControl-QYTXUQGY.js} +14 -9
  16. package/{agentRuntimeLocal-HOXKWCYO.js → agentRuntimeLocal-U54AKHXH.js} +58 -43
  17. package/{agentSlice-UG76KEBH.js → agentSlice-4JGDEXWK.js} +14 -13
  18. package/{appDeleteCommands-WWCC6WA5.js → appDeleteCommands-XBE5QJ6P.js} +58 -47
  19. package/{appDeployCommands-AU4IUN33.js → appDeployCommands-QIYLXXGA.js} +58 -47
  20. package/{appDeployStatusCommands-STUW7WXL.js → appDeployStatusCommands-JXS6ZQZZ.js} +58 -47
  21. package/{appGetCommands-BGTLIQ4K.js → appGetCommands-SZS7SJPK.js} +58 -47
  22. package/{appListCommands-CUCPRUXW.js → appListCommands-B3GBJSNV.js} +58 -47
  23. package/{authCommand-OZ2KTP4Z.js → authCommand-V6EOMZX6.js} +25 -19
  24. package/{authCommands-55OGQGCR.js → authCommands-T5FODCEG.js} +12 -6
  25. package/{builtinSkillRegistry-BAE2LDXF.js → builtinSkillRegistry-ZQC3IIO2.js} +8 -7
  26. package/{chromeCommands-G5UDKVSV.js → chromeCommands-O4IIKTBD.js} +384 -7
  27. package/{chromeOpsCommands-WAA45NCS.js → chromeOpsCommands-OFX7ZGKP.js} +3 -3
  28. package/{chunk-DBUR22G5.js → chunk-223KZUJ6.js} +19 -15
  29. package/{chunk-3U44JB3O.js → chunk-2C5VN7NH.js} +1 -1
  30. package/{chunk-PWTNI4N7.js → chunk-2E4BYAUE.js} +22 -0
  31. package/{chunk-L32W3PRP.js → chunk-2FZVXOFX.js} +234 -18
  32. package/{chunk-HBRDSQ3M.js → chunk-2JHGUL5K.js} +3 -2
  33. package/chunk-2SXN7LAY.js +15 -0
  34. package/chunk-3A5NNQCN.js +64 -0
  35. package/chunk-3F2FRLIO.js +372 -0
  36. package/{chunk-DEA37IUY.js → chunk-46FETNLF.js} +2 -2
  37. package/{chunk-ZEVQHCLM.js → chunk-4GYVS4PM.js} +8 -6
  38. package/{chunk-CBUZ6DKA.js → chunk-4YPH5KRA.js} +1 -1
  39. package/chunk-4ZCTKB27.js +31 -0
  40. package/chunk-53W5BXLN.js +340 -0
  41. package/{chunk-7FEP5USX.js → chunk-5AYP5QBB.js} +5 -5
  42. package/{chunk-XAG3FWBE.js → chunk-5ISNPTQH.js} +5 -5
  43. package/{chunk-EVGU5P4U.js → chunk-5P3PPQVP.js} +1 -1
  44. package/{chunk-XSW4EXQV.js → chunk-6BMTKYAO.js} +55 -18
  45. package/chunk-6PAHSSD2.js +33401 -0
  46. package/{chunk-ZOHO6MOF.js → chunk-6RSNVJGO.js} +2 -99
  47. package/{chunk-7JGMNKKG.js → chunk-6SOWMEAY.js} +30 -9
  48. package/{chunk-RG2DGNL6.js → chunk-6VEO7Z3Y.js} +3 -3
  49. package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
  50. package/{chunk-DGYCDA6W.js → chunk-7BIJFGKS.js} +36 -17
  51. package/{chunk-WFDNADFX.js → chunk-7OVOZRZF.js} +8 -8
  52. package/{chunk-WCFFRBL5.js → chunk-7PON4LBY.js} +45 -27
  53. package/{chunk-QRGDJA4B.js → chunk-7WHCIA5V.js} +33 -7
  54. package/{chunk-CMMI3DAT.js → chunk-ADYWV732.js} +59 -30
  55. package/{chunk-QYB23WUH.js → chunk-AIFQKNPP.js} +1 -1
  56. package/{chunk-HGDKT2D6.js → chunk-BPB3T5EU.js} +174 -1
  57. package/{chunk-DUUDXSLX.js → chunk-BZLGPM5B.js} +28 -4
  58. package/{chunk-ATEKLSLR.js → chunk-BZMDWGQQ.js} +14 -9
  59. package/chunk-C5A54QS7.js +108 -0
  60. package/{chunk-S6K5F3KP.js → chunk-CEKRIR22.js} +1 -1
  61. package/{chunk-42OKN2LI.js → chunk-D634SL2Y.js} +9 -107
  62. package/{chunk-DLXMMTGM.js → chunk-DHRPLRIR.js} +1283 -786
  63. package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
  64. package/{chunk-OBIC6EG7.js → chunk-DNNPARJK.js} +9 -5
  65. package/{chunk-X3E6EHJW.js → chunk-E3LSO6EI.js} +292 -207
  66. package/{chunk-OQHIVPG4.js → chunk-E6A5NHDH.js} +4 -1
  67. package/chunk-EHFBP6IK.js +791 -0
  68. package/chunk-EJQE5HB7.js +21 -0
  69. package/{chunk-VQ5N5GSV.js → chunk-EL5NRJHI.js} +4 -4
  70. package/chunk-EUGTFFO6.js +42 -0
  71. package/{chunk-7BCG67EI.js → chunk-EVHTYVD2.js} +1199 -442
  72. package/{chunk-6XRPBZRS.js → chunk-EYLGAEB4.js} +0 -134
  73. package/{chunk-262R3XNN.js → chunk-FEIVARWR.js} +377 -112
  74. package/{chunk-3VZLEKV2.js → chunk-FLBJ7IJI.js} +14 -14
  75. package/{chunk-EEOOBRA7.js → chunk-FXEPZKNJ.js} +13 -6
  76. package/{chunk-XTJKU3Z4.js → chunk-FYAMUU55.js} +677 -140
  77. package/{chunk-M3OZRQNH.js → chunk-FZANZZ63.js} +1 -1
  78. package/chunk-GAHJLSDO.js +107 -0
  79. package/{chunk-WWTSEBDF.js → chunk-GIXWVN2W.js} +1 -1
  80. package/{chunk-4N6G2CKP.js → chunk-HDKMVYNJ.js} +47 -1
  81. package/chunk-HEVRQGGH.js +106 -0
  82. package/{chunk-BIWI5M4E.js → chunk-HFHJPHFK.js} +1 -1
  83. package/{chunk-R6Z5S5GA.js → chunk-HPDLPEUG.js} +60 -17
  84. package/{chunk-YKY4OVOX.js → chunk-HQUGB2HM.js} +17 -170
  85. package/chunk-IIRJ4P4I.js +24 -0
  86. package/chunk-IVK2KT3H.js +209 -0
  87. package/{chunk-ALAES342.js → chunk-IYLUK67R.js} +9 -5
  88. package/{chunk-N5Z2V73W.js → chunk-J55F3IEZ.js} +1 -1
  89. package/{chunk-S6FDXXZV.js → chunk-J7JRCOIW.js} +2 -2
  90. package/{chunk-OWKNSIXL.js → chunk-JAKRY74O.js} +470 -83
  91. package/{chunk-VS276URX.js → chunk-JCQ3WCQ3.js} +4 -2
  92. package/chunk-JLZJL3WC.js +988 -0
  93. package/{chunk-OBSEKCVK.js → chunk-JPXACKSW.js} +219 -52
  94. package/{chunk-OTKSESZR.js → chunk-KDBDOXOM.js} +138 -54
  95. package/{chunk-VP3BINY7.js → chunk-KDDHQMSH.js} +31 -1
  96. package/{chunk-RBPUNSG5.js → chunk-KG27JIG4.js} +18 -108
  97. package/{chunk-4WVJLODK.js → chunk-KHYSFS3W.js} +88 -7
  98. package/{chunk-TCZ2VJZQ.js → chunk-KKIQAVDR.js} +9 -9
  99. package/{chunk-4JVNURX4.js → chunk-KQHEGELM.js} +68 -16
  100. package/chunk-KXOPLLFP.js +190 -0
  101. package/{chunk-HS7MLR74.js → chunk-KZ4A7EIV.js} +3 -5
  102. package/{chunk-HYLRQDEE.js → chunk-LLUBUHNT.js} +6 -6
  103. package/{chunk-QJTZ76CP.js → chunk-LS5KAVFQ.js} +1 -0
  104. package/{chunk-RTHFJZ6M.js → chunk-LVZVSLKO.js} +29 -9
  105. package/{chunk-TI2EPRHE.js → chunk-MNFUKRRU.js} +3 -3
  106. package/chunk-MVOZ22RZ.js +26 -0
  107. package/{chunk-CNMY2XM6.js → chunk-O3A2CHAL.js} +6 -6
  108. package/{chunk-TSPMLCWI.js → chunk-OB4FBZXJ.js} +5 -5
  109. package/{chunk-LYD6C7OU.js → chunk-OJSJJKHF.js} +6 -6
  110. package/{chunk-M4SFKP5L.js → chunk-OKAXQFON.js} +3 -3
  111. package/{chunk-CD3RU7XL.js → chunk-OKH74FML.js} +121 -14
  112. package/{chunk-U2HBB7RS.js → chunk-OOV5JN25.js} +130 -30
  113. package/{chunk-ZH3KXFHS.js → chunk-OOVOAG4Q.js} +1 -1
  114. package/chunk-OQFOE4SJ.js +405 -0
  115. package/{chunk-M3JEW6N6.js → chunk-OYUMJMC5.js} +15 -0
  116. package/chunk-P27E22MA.js +203 -0
  117. package/{chunk-SRCCSTIM.js → chunk-P4R5KXU7.js} +4 -4
  118. package/{chunk-FJ23FZXF.js → chunk-PHREU2KZ.js} +5 -3
  119. package/{chunk-HSSBDZLD.js → chunk-PIVTQRX6.js} +43 -13
  120. package/{chunk-XFXFPUO7.js → chunk-PJL7OJRC.js} +13 -39
  121. package/{chunk-RRDRQOEC.js → chunk-PNLDLUMO.js} +276 -303
  122. package/{chunk-4I2MXV5Q.js → chunk-PVFYPUIM.js} +2 -0
  123. package/{chunk-HHFGE2WF.js → chunk-QGFLVQ6E.js} +5 -5
  124. package/{chunk-EGHP7KOY.js → chunk-QONAOHVW.js} +38 -29
  125. package/chunk-R3FZHW4Q.js +103 -0
  126. package/{chunk-ZYKJBRZ3.js → chunk-R3MV2GII.js} +1 -47
  127. package/chunk-R72QWIFO.js +50 -0
  128. package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
  129. package/{chunk-ILHQ2AXT.js → chunk-RIWKZT7E.js} +36 -8
  130. package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
  131. package/{chunk-45CAVC35.js → chunk-S7H4KTMB.js} +2568 -337
  132. package/{chunk-OJ45MEEI.js → chunk-SA356NGW.js} +1 -1
  133. package/{chunk-F6Z6ZCUV.js → chunk-SCAC3NM5.js} +3 -3
  134. package/{chunk-YVFH2MFB.js → chunk-SLUN7W6S.js} +7 -7
  135. package/chunk-SQL7YNED.js +650 -0
  136. package/chunk-SR4FE5VD.js +9 -0
  137. package/{chunk-HF7BLF3F.js → chunk-SSOR2EDT.js} +107 -104
  138. package/chunk-TRRXYFTR.js +46 -0
  139. package/{chunk-3QIYD3VM.js → chunk-TUOHSUK5.js} +20068 -18402
  140. package/chunk-TYJCIA2O.js +835 -0
  141. package/{chunk-S2NTVGA2.js → chunk-U35UUM5K.js} +2 -1
  142. package/{chunk-GAYNXB6T.js → chunk-U3BUWDUP.js} +1031 -2155
  143. package/{chunk-BP5ZJ6B4.js → chunk-U6QNVOR5.js} +1 -1
  144. package/{chunk-UAIHKQIA.js → chunk-U6RD332P.js} +18 -2
  145. package/chunk-UAF5VQCE.js +77 -0
  146. package/{chunk-TQEKUOTI.js → chunk-UFGUJ2IH.js} +12 -12
  147. package/{chunk-VMJVAJ6W.js → chunk-UP7KBWLE.js} +109 -33
  148. package/{chunk-2X7WFDT6.js → chunk-UUCYUN6Y.js} +1 -1
  149. package/{chunk-5YMA6DDZ.js → chunk-UZKBVQUX.js} +1 -1
  150. package/chunk-V5TI7HJH.js +133 -0
  151. package/{chunk-WFGNWWJI.js → chunk-VH7UO6E5.js} +252 -114
  152. package/{chunk-MNEZUL5S.js → chunk-VJFDG3ZG.js} +63 -94
  153. package/{chunk-G7IUT2V3.js → chunk-WC3J5SL2.js} +635 -350
  154. package/{chunk-HXB4VDGK.js → chunk-WD5547ZF.js} +33 -30
  155. package/chunk-WDWZPASX.js +29 -0
  156. package/{chunk-4ZGPHFLE.js → chunk-WS36XPJD.js} +2 -2
  157. package/{chunk-6QHKRARD.js → chunk-WSLL7VV4.js} +29 -5
  158. package/chunk-XRGBJHZX.js +136 -0
  159. package/{chunk-MZG5CETE.js → chunk-Y2KWJTOZ.js} +4 -4
  160. package/{dialogUsageCommand-W2WCSGKF.js → chunk-Y2TCTNUD.js} +27 -20
  161. package/chunk-YJPK35HB.js +175 -0
  162. package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
  163. package/{chunk-547ENH5T.js → chunk-YN23INFZ.js} +4 -4
  164. package/{chunk-4QYJPWHH.js → chunk-YXK3GJF5.js} +232 -10
  165. package/{chunk-MJI3UAXN.js → chunk-Z2OWAYMI.js} +77 -51
  166. package/{chunk-7Z6EW7AH.js → chunk-ZTHAJU3O.js} +106 -14
  167. package/{chunk-YFLVRVYK.js → chunk-ZYPXOQS2.js} +1 -1
  168. package/{cliAgentConfigHelpers-BTRHMPW2.js → cliAgentConfigHelpers-BXHQ3PXP.js} +9 -9
  169. package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-TFNXJLXL.js} +1 -1
  170. package/cliAuthorityBrokerProcess-5ZFBTHLB.js +22 -0
  171. package/cliLocalAgentRecordReader-47PXMHPH.js +104 -0
  172. package/{commandRegistry-FVYPE2IN.js → commandRegistry-CTMPAQH2.js} +111 -162
  173. package/{contentThunks-GNFPG32S.js → contentThunks-CAHIIZO5.js} +38 -36
  174. package/{cooldownCommands-YB5H5BBK.js → cooldownCommands-WDOI5VD7.js} +3 -3
  175. package/{createAgentAutomationAction-PB4QIFQ4.js → createAgentAutomationAction-M25XZSPD.js} +38 -36
  176. package/{createDialogAction-EVTOPY7A.js → createDialogAction-4SN7FKI7.js} +39 -37
  177. package/{createPageAction-2UYF2IDZ.js → createPageAction-N7QPDN3M.js} +43 -41
  178. package/{db-M7FU2GNK.js → db-VR74ADGC.js} +7 -2
  179. package/{dbSlice-XRUZOGSU.js → dbSlice-RWPSVHBC.js} +12 -11
  180. package/{deleteFile-6URDHYRB.js → deleteFile-ECU6FU5C.js} +15 -7
  181. package/{dialogCommands-6SZD4TYP.js → dialogCommands-BBHWCKDP.js} +69 -53
  182. package/dialogMessageRecord-OAV77LT7.js +7 -0
  183. package/{dialogNotifyCommand-SHGPCU22.js → dialogNotifyCommand-IASQGEMW.js} +11 -11
  184. package/{dialogSlice-5EQ2A6LY.js → dialogSlice-JI3J22RV.js} +39 -37
  185. package/dialogTraceCommand-EW2KK6A4.js +961 -0
  186. package/dialogUsageCommand-WJ3U6KZU.js +27 -0
  187. package/{docCreateCommands-25E6PGN3.js → docCreateCommands-QSX3X5U4.js} +57 -46
  188. package/{docDeleteCommands-F7ZVGEHW.js → docDeleteCommands-63JBG2HQ.js} +59 -48
  189. package/{docReadCommands-JY2E5XEN.js → docReadCommands-CQFKRQUI.js} +57 -46
  190. package/{docStore-OKKIKLT3.js → docStore-XLBKGGNM.js} +14 -13
  191. package/{docUpdateCommands-OZ4CUSIQ.js → docUpdateCommands-534LUK25.js} +57 -46
  192. package/ebookDownloaderAgentCommand-DYSKF5ZY.js +677 -0
  193. package/fetchMessages-TQEUZD7H.js +1 -1
  194. package/{getPricing-LF5C4XSI.js → getPricing-5BLZRPTM.js} +4 -4
  195. package/{handleSendMessageAction-LNT7SZND.js → handleSendMessageAction-Q2VMEVOR.js} +127 -81
  196. package/{hostCredentialCreate-XUU2CSHI.js → hostCredentialCreate-C57T7YPE.js} +127 -109
  197. package/index.js +23 -11
  198. package/{localDialogRead-CCOCVGAP.js → localDialogRead-BJJT3TF5.js} +1 -1
  199. package/{localRuntimeAdapter-IBSTMSX7.js → localRuntimeAdapter-OALZPFZU.js} +134 -115
  200. package/localRuntimeAuthority-UF2DAQ3F.js +28 -0
  201. package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-ZJFGNHML.js} +1 -1
  202. package/{machineCommands-HSQHDHOT.js → machineCommands-N6IVWRZT.js} +262 -325
  203. package/machineWsRunDispatch-PDWYB33B.js +209 -0
  204. package/markdownToSlate-PXYAIBVL.js +8 -0
  205. package/mcpLocalAuthorizeCommand-KYI4EGF5.js +110 -0
  206. package/{memberThunks-7Y3OYSJQ.js → memberThunks-43B7UYC5.js} +21 -16
  207. package/{models-H5NNZRLH.js → models-ZX2BYIMB.js} +2 -2
  208. package/{overlay-BBQZXGYI.js → overlay-JA3SPVUS.js} +5 -3
  209. package/package.json +2 -1
  210. package/{projectArchive-FQO654Z3.js → projectArchive-TJNW5DLM.js} +46 -44
  211. package/{providerPresetApply-WHAMP2D5.js → providerPresetApply-NTJUINI6.js} +36 -17
  212. package/{providerRegistry-ZI2KORJ7.js → providerRegistry-W45SLUV6.js} +6 -6
  213. package/{read-TYMBGEXO.js → read-KG6INYUT.js} +13 -7
  214. package/{readDocTool-SKQVHBLO.js → readDocTool-N3GA52JR.js} +1 -1
  215. package/{readlineWorkspace-7U272DSA.js → readlineWorkspace-PJZJVGA5.js} +7486 -4492
  216. package/rememberExplicit-CPAPONSI.js +15 -0
  217. package/{removeDialogAgentAction-F5QE2O2B.js → removeDialogAgentAction-EEVSOQOJ.js} +18 -17
  218. package/{runAgentClientLoop-AF4JQIJ7.js → runAgentClientLoop-3VC5TCDW.js} +107 -76
  219. package/{runtimeDoctorCommands-RRKPBGVO.js → runtimeDoctorCommands-V3M3JTUV.js} +14 -11
  220. package/{secretCommands-KZWBZIYS.js → secretCommands-KVVZS7A6.js} +3 -3
  221. package/{setDialogExtraReferencesAction-72L27ERM.js → setDialogExtraReferencesAction-DNO5POHA.js} +15 -14
  222. package/{setPrimaryDialogAgentAction-GJJDUSGJ.js → setPrimaryDialogAgentAction-QABBEO4C.js} +18 -17
  223. package/{settingThunks-ZRGWVGZD.js → settingThunks-DVKG4X4S.js} +181 -66
  224. package/{skillDiscovery-BHHPCUHZ.js → skillDiscovery-ZMJH36AK.js} +4 -3
  225. package/{spaceCommands-5VNWMDBE.js → spaceCommands-AGGZXPY3.js} +235 -87
  226. package/{streamAgentChatTurn-YSPEFY4K.js → streamAgentChatTurn-4GTLL2OF.js} +242 -169
  227. package/{switchDialogAgentAction-IIJBPND3.js → switchDialogAgentAction-KYWJSGOO.js} +16 -15
  228. package/{tableCommands-FTAOCBTX.js → tableCommands-EFA754RE.js} +7 -4
  229. package/{toolApiClient-OGQEBQVX.js → toolApiClient-N5PYW2R3.js} +8 -6
  230. package/{tools-M35PTIFB.js → tools-5AGPOPLW.js} +69 -65
  231. package/{tuiRestart-2IL37YIB.js → tuiRestart-77E7PL4R.js} +11 -10
  232. package/{tuiSummaryLlmCaller-W2QN4VAC.js → tuiSummaryLlmCaller-HROLGN4F.js} +16 -15
  233. package/{updateCommands-CPATDG6J.js → updateCommands-GJGRS6JK.js} +3 -3
  234. package/{updateDialogTitleAction-IMIRJRQQ.js → updateDialogTitleAction-5OSEDGRK.js} +40 -38
  235. package/{usageCommand-2BF74MKF.js → usageCommand-WI6SQOPB.js} +2 -2
  236. package/{usageRebuildCommand-UHB55BQM.js → usageRebuildCommand-WQRLLZAT.js} +3 -3
  237. package/webapi-QVV65DQF.js +2487 -0
  238. package/{windowsSelfUpdate-ZFD6J5HF.js → windowsSelfUpdate-C7LGVWYX.js} +2 -2
  239. package/workContext-Y3ADAPZU.js +14 -0
  240. package/workContextAccess-VU5I4LKZ.js +11 -0
  241. package/workContextWriteNotice-YCSSMHN4.js +7 -0
  242. package/{workloadLifecycle-HFJIN5IZ.js → workloadLifecycle-P2SJVV3S.js} +2 -2
  243. package/agentRecordCommands-IZYUVHME.js +0 -177
  244. package/agentRunCommand-QM7ETUTX.js +0 -209
  245. package/chunk-2YGBI2XB.js +0 -30
  246. package/chunk-5ZMIIR23.js +0 -265
  247. package/chunk-5ZUOVCKT.js +0 -32
  248. package/chunk-62HXNQVV.js +0 -134
  249. package/chunk-FJSNBZXR.js +0 -142
  250. package/chunk-FPBJM2BW.js +0 -689
  251. package/chunk-JQZRSXS5.js +0 -90
  252. package/chunk-P2ZLUIW2.js +0 -795
  253. package/chunk-PPJYZRSQ.js +0 -160
  254. package/chunk-TUSTONB3.js +0 -81
  255. package/chunk-ZXF6D3I6.js +0 -359
  256. package/cliLocalAgentRecordReader-H3HYQRRR.js +0 -91
  257. package/lib-OT5OTXRU.js +0 -21046
  258. package/localRuntimeAuthority-IBJAT62G.js +0 -16
  259. package/machineWsRunDispatch-L6H7J66T.js +0 -192
  260. package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
@@ -0,0 +1,405 @@
1
+ import {
2
+ createLegacyServerDb,
3
+ isLevelLockError
4
+ } from "./chunk-TRRXYFTR.js";
5
+ import {
6
+ startCliAuthorityBrokerProcess
7
+ } from "./chunk-JLZJL3WC.js";
8
+ import {
9
+ loadCliAuthorityBrokerTls
10
+ } from "./chunk-3A5NNQCN.js";
11
+ import {
12
+ createCliAuthorityBrokerClient,
13
+ createCliAuthorityBrokerSocketInvoker,
14
+ isCliAuthorityBrokerTimeoutError,
15
+ isCliAuthorityBrokerUnavailableError
16
+ } from "./chunk-SQL7YNED.js";
17
+ import {
18
+ resolveCliAuthorityBrokerEndpoint,
19
+ resolveCliAuthorityBrokerHealthPath,
20
+ resolveCliAuthorityBrokerMetadataPath
21
+ } from "./chunk-CVMMWN6P.js";
22
+ import {
23
+ resolveNoloHome
24
+ } from "./chunk-GLKOYSRU.js";
25
+ import {
26
+ toErrorMessage
27
+ } from "./chunk-HNMXYYJR.js";
28
+
29
+ // packages/cli/localRuntimeAuthority.ts
30
+ import fs from "node:fs";
31
+ import { randomUUID } from "node:crypto";
32
+ import path from "node:path";
33
+ function ensureDbParentDir(dbPath) {
34
+ fs.mkdirSync(path.dirname(dbPath), { recursive: true });
35
+ }
36
+ function findCliAuthorityCorruption(error) {
37
+ const seen = /* @__PURE__ */ new Set();
38
+ let current = error;
39
+ while (current && !seen.has(current)) {
40
+ seen.add(current);
41
+ if (current.code === "LEVEL_CORRUPTION" || /Corruption:|missing files/i.test(toErrorMessage(current))) return current;
42
+ current = current.cause;
43
+ }
44
+ return void 0;
45
+ }
46
+ function throwCliAuthorityStartupError(error) {
47
+ const corruption = findCliAuthorityCorruption(error);
48
+ if (corruption) {
49
+ throw new Error(`Local authority database corruption: ${toErrorMessage(corruption)}`, { cause: error });
50
+ }
51
+ throw error;
52
+ }
53
+ function isCliAuthorityLockError(error) {
54
+ if (findCliAuthorityCorruption(error)) return false;
55
+ const seen = /* @__PURE__ */ new Set();
56
+ let current = error;
57
+ while (current && !seen.has(current)) {
58
+ seen.add(current);
59
+ if (isLevelLockError(current)) return true;
60
+ current = current.cause;
61
+ }
62
+ return /EADDRINUSE|Failed to listen/i.test(toErrorMessage(error));
63
+ }
64
+ async function sleep(ms) {
65
+ await new Promise((resolve) => setTimeout(resolve, ms));
66
+ }
67
+ function resolveCliLocalRuntimeDbPath(options = {}) {
68
+ return path.join(
69
+ resolveNoloHome({
70
+ env: options.env,
71
+ homeDir: options.homeDir
72
+ }),
73
+ "data",
74
+ "leveldb"
75
+ );
76
+ }
77
+ var DEFAULT_ATTACH_BACKOFF_MS = [100, 200, 400, 800];
78
+ var DEFAULT_ATTACH_RETRY_BUDGET_MS = 9e3;
79
+ function findOwnerPid(error) {
80
+ const seen = /* @__PURE__ */ new Set();
81
+ let current = error;
82
+ while (current && typeof current === "object" && !seen.has(current)) {
83
+ seen.add(current);
84
+ const pid = current.ownerPid;
85
+ if (typeof pid === "number" && Number.isInteger(pid) && pid > 0) {
86
+ return pid;
87
+ }
88
+ current = current.cause;
89
+ }
90
+ return void 0;
91
+ }
92
+ function isTransientBrokerOpenError(error) {
93
+ return isCliAuthorityBrokerUnavailableError(error) || isCliAuthorityBrokerTimeoutError(error);
94
+ }
95
+ var defaultCliAuthorityBrokerConnectDeps = {
96
+ createClient: (options) => createCliAuthorityBrokerClient(options),
97
+ startBroker: startCliAuthorityBrokerProcess,
98
+ sleep,
99
+ useFastPath: true
100
+ };
101
+ function verifyBrokerDatabase(args, liveLocation) {
102
+ const expected = fs.existsSync(args.dbPath) ? fs.realpathSync(args.dbPath) : path.join(fs.realpathSync(path.dirname(args.dbPath)), path.basename(args.dbPath));
103
+ if (typeof liveLocation !== "string" || fs.realpathSync(liveLocation) !== expected) {
104
+ throw new Error(`Authority broker at ${args.endpoint} does not match the requested database ${args.dbPath}`);
105
+ }
106
+ }
107
+ function findLegacyBrokerOwner(args) {
108
+ try {
109
+ const metadata = JSON.parse(fs.readFileSync(args.metadataPath, "utf8"));
110
+ const owner = JSON.parse(fs.readFileSync(`${args.dbPath}.owner`, "utf8"));
111
+ if (metadata.transportSecurity !== void 0 || metadata.supervisorPid !== void 0 || metadata.endpoint !== args.endpoint || !Number.isInteger(metadata.pid) || metadata.pid <= 0 || owner.pid !== metadata.pid || fs.realpathSync(metadata.location) !== fs.realpathSync(args.dbPath)) return void 0;
112
+ process.kill(metadata.pid, 0);
113
+ return metadata.pid;
114
+ } catch {
115
+ return void 0;
116
+ }
117
+ }
118
+ async function connectCliAuthorityBroker(args) {
119
+ const deps = {
120
+ ...defaultCliAuthorityBrokerConnectDeps,
121
+ ...args.deps
122
+ };
123
+ async function connectClient() {
124
+ const invoke = createCliAuthorityBrokerSocketInvoker({ endpoint: args.endpoint, tls: args.tls });
125
+ const client2 = deps.createClient({
126
+ endpoint: args.endpoint,
127
+ invoke: async (request) => {
128
+ if (request.type !== "status" || !deps.verifyBroker) return invoke(request);
129
+ const response = await invoke({ type: "status", includeLocation: true });
130
+ if (response.ok && response.result.type === "status") deps.verifyBroker(args, response.result.location);
131
+ return response;
132
+ }
133
+ });
134
+ const backoffSchedule = deps.attachBackoffMs?.length ? deps.attachBackoffMs : DEFAULT_ATTACH_BACKOFF_MS;
135
+ const retryBudgetMs = deps.attachRetryBudgetMs ?? DEFAULT_ATTACH_RETRY_BUDGET_MS;
136
+ let waitedMs = 0;
137
+ let backoffStep = 0;
138
+ let lastAttachError;
139
+ const waitBackoff = async () => {
140
+ if (waitedMs >= retryBudgetMs) return false;
141
+ const delay = backoffSchedule[Math.min(backoffStep, backoffSchedule.length - 1)];
142
+ if (waitedMs > 0 && waitedMs + delay > retryBudgetMs) return false;
143
+ backoffStep += 1;
144
+ const startedAt = Date.now();
145
+ await deps.sleep(delay);
146
+ waitedMs += Math.max(delay, Date.now() - startedAt);
147
+ return true;
148
+ };
149
+ async function attachToExistingBroker(attempts) {
150
+ for (let attempt = 0; attempt < attempts; attempt += 1) {
151
+ if (!await waitBackoff()) return false;
152
+ const probeStartedAt = Date.now();
153
+ try {
154
+ await client2.open();
155
+ return true;
156
+ } catch (error) {
157
+ waitedMs += Date.now() - probeStartedAt;
158
+ if (!isTransientBrokerOpenError(error)) throw error;
159
+ lastAttachError = error;
160
+ }
161
+ }
162
+ return false;
163
+ }
164
+ if (deps.useFastPath) {
165
+ try {
166
+ await client2.open();
167
+ return client2;
168
+ } catch (error) {
169
+ if (!isTransientBrokerOpenError(error)) throw error;
170
+ lastAttachError = error;
171
+ }
172
+ }
173
+ try {
174
+ await deps.startBroker({
175
+ endpoint: args.endpoint,
176
+ metadataPath: args.metadataPath,
177
+ healthPath: args.healthPath,
178
+ dbPath: args.dbPath
179
+ });
180
+ await client2.open();
181
+ return client2;
182
+ } catch (error) {
183
+ if (!isCliAuthorityLockError(error)) throwCliAuthorityStartupError(error);
184
+ if (await attachToExistingBroker(5)) {
185
+ return client2;
186
+ }
187
+ let lastError = error;
188
+ while (await waitBackoff()) {
189
+ try {
190
+ await deps.startBroker({
191
+ endpoint: args.endpoint,
192
+ metadataPath: args.metadataPath,
193
+ healthPath: args.healthPath,
194
+ dbPath: args.dbPath
195
+ });
196
+ await client2.open();
197
+ return client2;
198
+ } catch (retryError) {
199
+ lastError = retryError;
200
+ if (isCliAuthorityLockError(retryError)) {
201
+ if (await attachToExistingBroker(2)) {
202
+ return client2;
203
+ }
204
+ continue;
205
+ }
206
+ if (isTransientBrokerOpenError(retryError)) {
207
+ lastAttachError = retryError;
208
+ continue;
209
+ }
210
+ throwCliAuthorityStartupError(retryError);
211
+ }
212
+ }
213
+ const lastMessage = toErrorMessage(lastError);
214
+ const attachCause = lastAttachError instanceof Error ? lastAttachError.cause : void 0;
215
+ const attachMessage = lastAttachError ? [toErrorMessage(lastAttachError), ...attachCause ? [toErrorMessage(attachCause)] : []].join(" / ") : "";
216
+ const portInUse = lastError !== null && typeof lastError === "object" && "code" in lastError && lastError.code === "EADDRINUSE" || /EADDRINUSE/i.test(lastMessage);
217
+ const ownerPid = findOwnerPid(lastError);
218
+ const legacyOwner = args.tls ? findLegacyBrokerOwner(args) : void 0;
219
+ if (legacyOwner !== void 0) {
220
+ throw new Error(`CLI authority broker upgrade requires exit of the previous Nolo process (PID ${legacyOwner}). Close its Nolo window or let it finish, then retry. The new broker will reopen the same database.`, {
221
+ cause: lastError
222
+ });
223
+ }
224
+ let detail = "";
225
+ if (portInUse) {
226
+ detail = `: 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`;
227
+ } else {
228
+ const parts = [
229
+ ownerPid !== void 0 ? `ownerPid=${ownerPid}` : void 0,
230
+ lastMessage || void 0,
231
+ attachMessage && attachMessage !== lastMessage ? `attach=${attachMessage}` : void 0
232
+ ].filter(Boolean);
233
+ if (parts.length > 0) {
234
+ detail = `: ${parts.join("; ")}`;
235
+ }
236
+ }
237
+ throw new Error(`CLI authority broker could not attach or take ownership for ${args.endpoint}${detail}`, {
238
+ cause: lastError
239
+ });
240
+ }
241
+ }
242
+ let client = await connectClient();
243
+ let reconnecting = null;
244
+ async function reconnect() {
245
+ reconnecting ??= connectClient();
246
+ try {
247
+ client = await reconnecting;
248
+ return client;
249
+ } finally {
250
+ reconnecting = null;
251
+ }
252
+ }
253
+ async function runWithSelfHealing(operation) {
254
+ try {
255
+ return await operation(client);
256
+ } catch (error) {
257
+ if (!isCliAuthorityBrokerUnavailableError(error)) throw error;
258
+ const recoveredClient = await reconnect();
259
+ return operation(recoveredClient);
260
+ }
261
+ }
262
+ return {
263
+ get location() {
264
+ return client.location;
265
+ },
266
+ get status() {
267
+ return client.status;
268
+ },
269
+ open: () => runWithSelfHealing((activeClient) => activeClient.open()),
270
+ close: () => runWithSelfHealing((activeClient) => activeClient.close()),
271
+ get: (key) => runWithSelfHealing((activeClient) => activeClient.get(key)),
272
+ conditionalPut: (key, expectedRevision, value) => runWithSelfHealing((activeClient) => {
273
+ if (!activeClient.conditionalPut) {
274
+ throw new Error("CLI authority broker does not support conditionalPut");
275
+ }
276
+ return activeClient.conditionalPut(key, expectedRevision, value);
277
+ }),
278
+ put: (key, value) => runWithSelfHealing((activeClient) => activeClient.put(key, value)),
279
+ del: (key) => runWithSelfHealing((activeClient) => activeClient.del(key)),
280
+ batchWrite: (ops) => runWithSelfHealing((activeClient) => activeClient.batchWrite(ops)),
281
+ createBatch() {
282
+ const ops = [];
283
+ return {
284
+ put(key, value) {
285
+ ops.push({ type: "put", key, value });
286
+ },
287
+ del(key) {
288
+ ops.push({ type: "del", key });
289
+ },
290
+ write: () => runWithSelfHealing((activeClient) => activeClient.batchWrite(ops))
291
+ };
292
+ },
293
+ iterator(options = {}) {
294
+ return async function* iterate() {
295
+ let activeOptions = options;
296
+ let lastYieldedKey;
297
+ let skipResumeKey = false;
298
+ let recovered = false;
299
+ while (true) {
300
+ try {
301
+ for await (const entry of client.iterator(activeOptions)) {
302
+ if (skipResumeKey && entry[0] === lastYieldedKey) {
303
+ skipResumeKey = false;
304
+ continue;
305
+ }
306
+ skipResumeKey = false;
307
+ lastYieldedKey = entry[0];
308
+ yield entry;
309
+ }
310
+ return;
311
+ } catch (error) {
312
+ if (recovered || !isCliAuthorityBrokerUnavailableError(error)) {
313
+ throw error;
314
+ }
315
+ recovered = true;
316
+ await reconnect();
317
+ if (lastYieldedKey === void 0) {
318
+ activeOptions = options;
319
+ continue;
320
+ }
321
+ if (options.reverse) {
322
+ activeOptions = {
323
+ ...options,
324
+ lt: lastYieldedKey
325
+ };
326
+ continue;
327
+ }
328
+ activeOptions = {
329
+ ...options,
330
+ gte: lastYieldedKey
331
+ };
332
+ skipResumeKey = true;
333
+ }
334
+ }
335
+ }();
336
+ }
337
+ };
338
+ }
339
+ async function getDefaultCliLocalRuntimeAuthority(options = {}) {
340
+ const ambientNoloHome = process.env.NOLO_HOME?.trim();
341
+ const ambientBrokerPort = process.env.NOLO_CLI_AUTHORITY_BROKER_PORT?.trim();
342
+ const env = {
343
+ ...ambientNoloHome ? { NOLO_HOME: ambientNoloHome } : {},
344
+ ...ambientBrokerPort ? { NOLO_CLI_AUTHORITY_BROKER_PORT: ambientBrokerPort } : {},
345
+ ...options.env ?? process.env
346
+ };
347
+ const dbPath = resolveCliLocalRuntimeDbPath({
348
+ env,
349
+ homeDir: options.homeDir
350
+ });
351
+ ensureDbParentDir(dbPath);
352
+ const endpoint = resolveCliAuthorityBrokerEndpoint({
353
+ transport: "tcp",
354
+ env,
355
+ homeDir: options.homeDir
356
+ });
357
+ const metadataPath = resolveCliAuthorityBrokerMetadataPath({
358
+ transport: "tcp",
359
+ env,
360
+ homeDir: options.homeDir
361
+ });
362
+ const healthPath = resolveCliAuthorityBrokerHealthPath({
363
+ transport: "tcp",
364
+ env,
365
+ homeDir: options.homeDir
366
+ });
367
+ return connectCliAuthorityBroker({
368
+ endpoint,
369
+ metadataPath,
370
+ healthPath,
371
+ dbPath,
372
+ tls: await loadCliAuthorityBrokerTls(metadataPath),
373
+ deps: { verifyBroker: verifyBrokerDatabase }
374
+ });
375
+ }
376
+ async function getDefaultCliLocalRuntimeDb(options = {}) {
377
+ const authorityStore = await getDefaultCliLocalRuntimeAuthority(options);
378
+ return createLegacyServerDb(authorityStore);
379
+ }
380
+ function createCliLocalMcpConnectionRevisionWriter(authority, authenticatedUserId) {
381
+ if (!authenticatedUserId) throw new Error("Local MCP connection owner is required");
382
+ const prefix = `mcp-private:v1:${encodeURIComponent(authenticatedUserId)}:connection:`;
383
+ const conditionalPut = authority.conditionalPut?.bind(authority);
384
+ if (!conditionalPut) throw new Error("CLI authority broker does not support conditionalPut");
385
+ return {
386
+ async create(value) {
387
+ const id = randomUUID();
388
+ const result = await conditionalPut(prefix + id, null, { ...value, revision: 1 });
389
+ return { id, ...result };
390
+ },
391
+ async update(id, expectedRevision, value) {
392
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id) || !Number.isSafeInteger(expectedRevision) || expectedRevision < 1 || expectedRevision >= Number.MAX_SAFE_INTEGER) {
393
+ throw new Error("Invalid local MCP connection identity or revision");
394
+ }
395
+ return conditionalPut(prefix + id, expectedRevision, { ...value, revision: expectedRevision + 1 });
396
+ }
397
+ };
398
+ }
399
+
400
+ export {
401
+ connectCliAuthorityBroker,
402
+ getDefaultCliLocalRuntimeAuthority,
403
+ getDefaultCliLocalRuntimeDb,
404
+ createCliLocalMcpConnectionRevisionWriter
405
+ };
@@ -14,6 +14,21 @@ var authRoutes = {
14
14
  method: "POST",
15
15
  createPath: () => `${API_VERSION}/users/signup`
16
16
  },
17
+ github: {
18
+ start: { path: `${API_VERSION}/users/github/start`, method: "POST", createPath: () => `${API_VERSION}/users/github/start` },
19
+ callback: { path: `${API_VERSION}/users/github/callback`, method: "GET", createPath: () => `${API_VERSION}/users/github/callback` },
20
+ complete: { path: `${API_VERSION}/users/github/complete`, method: "POST", createPath: () => `${API_VERSION}/users/github/complete` }
21
+ },
22
+ google: {
23
+ start: { path: `${API_VERSION}/users/google/start`, method: "POST", createPath: () => `${API_VERSION}/users/google/start` },
24
+ callback: { path: `${API_VERSION}/users/google/callback`, method: "GET", createPath: () => `${API_VERSION}/users/google/callback` },
25
+ complete: { path: `${API_VERSION}/users/google/complete`, method: "POST", createPath: () => `${API_VERSION}/users/google/complete` },
26
+ bindConfirm: { path: `${API_VERSION}/users/google/bind/confirm`, method: "POST", createPath: () => `${API_VERSION}/users/google/bind/confirm` },
27
+ binding: { path: `${API_VERSION}/users/google/binding`, method: "GET", createPath: () => `${API_VERSION}/users/google/binding` },
28
+ sessionLogout: { path: `${API_VERSION}/users/google/session/logout`, method: "POST", createPath: () => `${API_VERSION}/users/google/session/logout` },
29
+ sessionRevokeStart: { path: `${API_VERSION}/users/google/session-revoke/start`, method: "POST", createPath: () => `${API_VERSION}/users/google/session-revoke/start` },
30
+ sessionRevokeConfirm: { path: `${API_VERSION}/users/google/session-revoke/confirm`, method: "POST", createPath: () => `${API_VERSION}/users/google/session-revoke/confirm` }
31
+ },
17
32
  users: {
18
33
  cliLoginStart: {
19
34
  path: `${API_VERSION}/users/cli-login/start`,
@@ -0,0 +1,203 @@
1
+ import {
2
+ parseUserIdFromAuthToken,
3
+ resolveAuthToken,
4
+ resolveServerUrl
5
+ } from "./chunk-BIDSIRTS.js";
6
+
7
+ // packages/cli/subscriptionQuotaRefresh.ts
8
+ import {
9
+ mkdirSync,
10
+ readFileSync,
11
+ renameSync,
12
+ writeFileSync
13
+ } from "node:fs";
14
+ import { dirname, join } from "node:path";
15
+ var CATALOG_QUOTA_REFRESH_TIMEOUT_MS = 2e3;
16
+ var FRESH_QUOTA_TTL_MS = 45e3;
17
+ var CACHE_ENTRY_RETENTION_MS = 10 * 6e4;
18
+ var EMPTY_REFRESH_BACKOFF_MS = 5 * 6e4;
19
+ var lastRefreshEmptyAt = 0;
20
+ function hasPendingReset(quota, now) {
21
+ if (!quota || !Array.isArray(quota.windows)) return false;
22
+ const observedAt = typeof quota.observedAt === "number" && Number.isFinite(quota.observedAt) ? quota.observedAt : void 0;
23
+ return quota.windows.some((win) => {
24
+ if (typeof win?.resetAt !== "number" || !Number.isFinite(win.resetAt)) {
25
+ return false;
26
+ }
27
+ if (win.resetAt > now) return false;
28
+ if (observedAt !== void 0 && observedAt < win.resetAt) return true;
29
+ return typeof win.utilization === "number" && win.utilization >= 1 || win.remaining === 0;
30
+ });
31
+ }
32
+ function quotaSnapshotIsFresh(quota, now) {
33
+ const observedAt = quota?.observedAt;
34
+ if (typeof observedAt !== "number" || !Number.isFinite(observedAt)) return false;
35
+ if (now - observedAt >= FRESH_QUOTA_TTL_MS) return false;
36
+ return !hasPendingReset(quota, now);
37
+ }
38
+ function resolveQuotaCachePath(env, hasCustomFetch) {
39
+ const explicitNoloHome = env.NOLO_HOME?.trim();
40
+ const noloHome = explicitNoloHome || (!hasCustomFetch && env.HOME?.trim() ? `${env.HOME.trim()}/.nolo` : "");
41
+ return noloHome ? join(noloHome, "cache", "subscription-quota-refresh.json") : void 0;
42
+ }
43
+ function readQuotaDiskCache(cachePath) {
44
+ if (!cachePath) return {};
45
+ try {
46
+ const parsed = JSON.parse(readFileSync(cachePath, "utf8"));
47
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
48
+ } catch {
49
+ return {};
50
+ }
51
+ }
52
+ function writeQuotaDiskCache(cachePath, cacheKey, quotas, wholeBatch, checkedKeys, now) {
53
+ if (!cachePath) return;
54
+ try {
55
+ const current = readQuotaDiskCache(cachePath);
56
+ const prevScope = current[cacheKey] ?? {};
57
+ const mergedQuotas = {};
58
+ for (const [k, v] of Object.entries(prevScope.quotas ?? {})) {
59
+ if (v && typeof v.observedAt === "number" && Number.isFinite(v.observedAt) && now - v.observedAt < CACHE_ENTRY_RETENTION_MS) {
60
+ mergedQuotas[k] = v;
61
+ }
62
+ }
63
+ for (const [k, v] of Object.entries(quotas)) {
64
+ if (v && Array.isArray(v.windows)) {
65
+ mergedQuotas[k] = v;
66
+ }
67
+ }
68
+ const prevBatchFresh = typeof prevScope.lastBatchRefreshAt === "number" && now - prevScope.lastBatchRefreshAt < FRESH_QUOTA_TTL_MS;
69
+ const mergedCheckedKeys = wholeBatch ? Array.from(
70
+ /* @__PURE__ */ new Set([
71
+ ...prevBatchFresh && Array.isArray(prevScope.checkedKeys) ? prevScope.checkedKeys : [],
72
+ ...checkedKeys
73
+ ])
74
+ ) : prevScope.checkedKeys;
75
+ current[cacheKey] = {
76
+ lastBatchRefreshAt: wholeBatch ? now : prevScope.lastBatchRefreshAt,
77
+ ...mergedCheckedKeys ? { checkedKeys: mergedCheckedKeys } : {},
78
+ quotas: mergedQuotas
79
+ };
80
+ mkdirSync(dirname(cachePath), { recursive: true });
81
+ const tmpPath = `${cachePath}.tmp-${process.pid}-${Date.now()}`;
82
+ writeFileSync(tmpPath, JSON.stringify(current), "utf8");
83
+ renameSync(tmpPath, cachePath);
84
+ } catch {
85
+ }
86
+ }
87
+ function pickNewerQuota(a, b) {
88
+ if (!a) return b;
89
+ if (!b) return a;
90
+ const ta = typeof a.observedAt === "number" && Number.isFinite(a.observedAt) ? a.observedAt : -1;
91
+ const tb = typeof b.observedAt === "number" && Number.isFinite(b.observedAt) ? b.observedAt : -1;
92
+ return tb > ta ? b : a;
93
+ }
94
+ async function refreshSubscriptionQuotas(args) {
95
+ const fresh = {};
96
+ try {
97
+ const now = Date.now();
98
+ const env = args.env ?? process.env;
99
+ const authToken = resolveAuthToken(args.cliArgs ?? [], env);
100
+ if (!authToken) return fresh;
101
+ const wholeBatch = !args.onlyKeys || args.onlyKeys.length === 0;
102
+ const serverUrl = resolveServerUrl(args.cliArgs ?? [], env);
103
+ const cachePath = resolveQuotaCachePath(
104
+ env,
105
+ Boolean(args.fetchImpl && args.fetchImpl !== fetch)
106
+ );
107
+ const userId = parseUserIdFromAuthToken(authToken) ?? "anon";
108
+ const cacheKey = `${serverUrl}::${userId}`;
109
+ const diskCache = !args.forceRefresh ? readQuotaDiskCache(cachePath) : {};
110
+ const scopeCache = diskCache[cacheKey];
111
+ const targetEntries = args.entries.filter(
112
+ (entry) => entry.probeable !== false && (!args.onlyKeys || args.onlyKeys.includes(entry.key))
113
+ );
114
+ const staleTargetKeys = [];
115
+ if (!args.forceRefresh) {
116
+ const batchWindowFresh = wholeBatch && typeof scopeCache?.lastBatchRefreshAt === "number" && now - scopeCache.lastBatchRefreshAt < FRESH_QUOTA_TTL_MS;
117
+ const checkedKeySet = batchWindowFresh ? new Set(Array.isArray(scopeCache?.checkedKeys) ? scopeCache.checkedKeys : []) : null;
118
+ for (const entry of targetEntries) {
119
+ const cachedQuota = scopeCache?.quotas?.[entry.key];
120
+ const bestQuota = pickNewerQuota(entry.quota, cachedQuota);
121
+ if (hasPendingReset(bestQuota, now)) {
122
+ staleTargetKeys.push(entry.key);
123
+ continue;
124
+ }
125
+ if (quotaSnapshotIsFresh(bestQuota, now)) {
126
+ if (cachedQuota && bestQuota === cachedQuota && (!entry.quota || typeof entry.quota.observedAt !== "number" || !Number.isFinite(entry.quota.observedAt) || cachedQuota.observedAt > entry.quota.observedAt)) {
127
+ fresh[entry.key] = cachedQuota;
128
+ }
129
+ continue;
130
+ }
131
+ if (checkedKeySet?.has(entry.key)) {
132
+ continue;
133
+ }
134
+ staleTargetKeys.push(entry.key);
135
+ }
136
+ if (staleTargetKeys.length === 0) return fresh;
137
+ if (wholeBatch && lastRefreshEmptyAt && now - lastRefreshEmptyAt < EMPTY_REFRESH_BACKOFF_MS) {
138
+ return fresh;
139
+ }
140
+ }
141
+ const requestAgentKeys = args.onlyKeys && args.onlyKeys.length > 0 ? args.onlyKeys : !args.forceRefresh && staleTargetKeys.length > 0 && staleTargetKeys.length < targetEntries.length ? staleTargetKeys : void 0;
142
+ const isFullBatchProbe = wholeBatch && !requestAgentKeys;
143
+ const fetchImpl = args.fetchImpl ?? fetch;
144
+ const refreshPromise = (async () => {
145
+ const res = await fetchImpl(
146
+ `${serverUrl}/api/agents/quota/refresh`,
147
+ {
148
+ method: "POST",
149
+ headers: {
150
+ "Content-Type": "application/json",
151
+ Authorization: `Bearer ${authToken}`
152
+ },
153
+ body: JSON.stringify(
154
+ requestAgentKeys && requestAgentKeys.length > 0 ? { agentKeys: requestAgentKeys } : {}
155
+ ),
156
+ signal: AbortSignal.timeout(CATALOG_QUOTA_REFRESH_TIMEOUT_MS)
157
+ }
158
+ );
159
+ if (!res.ok) return;
160
+ const payload = await res.json().catch(() => null);
161
+ const quotas = payload?.quotas;
162
+ if (!quotas || typeof quotas !== "object") return;
163
+ const probed = typeof payload?.probed === "number" ? payload.probed : 0;
164
+ const completedAt = Date.now();
165
+ if (probed === 0 && Object.keys(quotas).length === 0) {
166
+ if (isFullBatchProbe) lastRefreshEmptyAt = completedAt;
167
+ return;
168
+ }
169
+ if (wholeBatch) lastRefreshEmptyAt = 0;
170
+ writeQuotaDiskCache(
171
+ cachePath,
172
+ cacheKey,
173
+ quotas,
174
+ wholeBatch,
175
+ requestAgentKeys ?? targetEntries.map((entry) => entry.key),
176
+ completedAt
177
+ );
178
+ for (const entry of args.entries) {
179
+ const quota = quotas[entry.key];
180
+ if (quota && Array.isArray(quota.windows)) {
181
+ fresh[entry.key] = quota;
182
+ }
183
+ }
184
+ })();
185
+ let timer;
186
+ await Promise.race([
187
+ refreshPromise,
188
+ new Promise((resolve) => {
189
+ timer = setTimeout(resolve, CATALOG_QUOTA_REFRESH_TIMEOUT_MS);
190
+ })
191
+ ]).catch(() => {
192
+ });
193
+ if (timer) clearTimeout(timer);
194
+ refreshPromise.catch(() => {
195
+ });
196
+ } catch {
197
+ }
198
+ return fresh;
199
+ }
200
+
201
+ export {
202
+ refreshSubscriptionQuotas
203
+ };
@@ -7,17 +7,17 @@ import {
7
7
  import {
8
8
  asOptionalPositiveFiniteNumber
9
9
  } from "./chunk-U6VC4MU4.js";
10
- import {
11
- getModelConfig
12
- } from "./chunk-CD3RU7XL.js";
13
10
  import {
14
11
  asOptionalFiniteNumber
15
12
  } from "./chunk-WWC7I6TA.js";
13
+ import {
14
+ getModelConfig
15
+ } from "./chunk-OKH74FML.js";
16
16
  import {
17
17
  isPlatformHostedImageModel,
18
18
  isPlatformManagedProvider,
19
19
  resolvePlatformEffectiveModel
20
- } from "./chunk-OBSEKCVK.js";
20
+ } from "./chunk-JPXACKSW.js";
21
21
 
22
22
  // packages/ai/llm/getPricing.ts
23
23
  var MAX_OUTPUT_TOKENS = 8192;
@@ -7405,9 +7405,7 @@ function findAndReplace(tree, list2, options) {
7405
7405
  if (typeof value === "string") {
7406
7406
  value = value.length > 0 ? { type: "text", value } : void 0;
7407
7407
  }
7408
- if (value === false) {
7409
- find.lastIndex = position2 + 1;
7410
- } else {
7408
+ if (value !== false) {
7411
7409
  if (start !== position2) {
7412
7410
  add({ type: "text", value: node2.value.slice(start, position2) });
7413
7411
  }
@@ -7419,6 +7417,10 @@ function findAndReplace(tree, list2, options) {
7419
7417
  start = position2 + match[0].length;
7420
7418
  change = true;
7421
7419
  }
7420
+ if (value === false || match[0].length === 0) {
7421
+ const code2 = node2.value.codePointAt(position2) || 0;
7422
+ find.lastIndex = position2 + (/[uv]/.test(find.flags) && code2 > 65535 ? 2 : 1);
7423
+ }
7422
7424
  if (!find.global) {
7423
7425
  break;
7424
7426
  }