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
package/chunk-P2ZLUIW2.js DELETED
@@ -1,795 +0,0 @@
1
- import {
2
- Level,
3
- createLegacyServerDb,
4
- createLevelAuthorityStore,
5
- isLevelLockError
6
- } from "./chunk-ZYKJBRZ3.js";
7
- import {
8
- createCliAuthorityBrokerClient,
9
- createCliAuthorityBrokerSocketInvoker,
10
- isCliAuthorityBrokerUnavailableError
11
- } from "./chunk-5ZMIIR23.js";
12
- import {
13
- resolveCliAuthorityBrokerEndpoint,
14
- resolveCliAuthorityBrokerHealthPath,
15
- resolveCliAuthorityBrokerMetadataPath
16
- } from "./chunk-CVMMWN6P.js";
17
- import {
18
- resolveNoloHome
19
- } from "./chunk-GLKOYSRU.js";
20
- import {
21
- toErrorMessage
22
- } from "./chunk-HNMXYYJR.js";
23
-
24
- // packages/cli/localRuntimeAuthority.ts
25
- import fs4 from "node:fs";
26
- import path4 from "node:path";
27
-
28
- // packages/database-engine/cliAuthorityBrokerServer.ts
29
- import fs3 from "node:fs";
30
- import path3 from "node:path";
31
- import { createServer } from "node:net";
32
-
33
- // packages/database-engine/levelDbCorruptionRecovery.ts
34
- import fs from "node:fs";
35
- import path from "node:path";
36
- var CORRUPTION_CODE = "LEVEL_CORRUPTION";
37
- var CORRUPTION_MESSAGE = /Corruption:|missing files/i;
38
- var levelClassWithRepair = Level;
39
- function isLevelCorruptionError(error) {
40
- const seen = /* @__PURE__ */ new Set();
41
- let current = error;
42
- while (current && !seen.has(current)) {
43
- seen.add(current);
44
- if (current.code === CORRUPTION_CODE) return true;
45
- if (CORRUPTION_MESSAGE.test(toErrorMessage(current))) return true;
46
- current = current.cause;
47
- }
48
- return false;
49
- }
50
- function formatUtcStamp(now) {
51
- return new Date(now).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "").replace("T", "-");
52
- }
53
- function resolveBackupPath(dbPath, now) {
54
- const base = `${dbPath}.corrupt-${formatUtcStamp(now)}`;
55
- let candidate = base;
56
- for (let index = 2; fs.existsSync(candidate); index += 1) {
57
- candidate = `${base}-${index}`;
58
- }
59
- return candidate;
60
- }
61
- async function repairLevelDatabase(dbPath) {
62
- await levelClassWithRepair.repair(dbPath);
63
- }
64
- async function recoverCorruptedLevelDb(options) {
65
- const { dbPath } = options;
66
- const log = options.log ?? ((message) => console.warn(message));
67
- const repair = options.repair ?? repairLevelDatabase;
68
- const backupPath = resolveBackupPath(dbPath, (options.now ?? Date.now)());
69
- fs.renameSync(dbPath, backupPath);
70
- try {
71
- fs.cpSync(backupPath, dbPath, { recursive: true, preserveTimestamps: true });
72
- await repair(dbPath);
73
- } catch (error) {
74
- try {
75
- fs.rmSync(dbPath, { recursive: true, force: true });
76
- fs.renameSync(backupPath, dbPath);
77
- } catch (rollbackError) {
78
- throw Object.assign(
79
- new Error(
80
- `Failed to repair the local database at ${dbPath} and could not restore the original. The untouched copy is at ${backupPath}; stop every Nolo process before retrying. Do not delete ${path.join(dbPath, "LOCK")} and do not reinstall Nolo: ${toErrorMessage(error)}`,
81
- { cause: new AggregateError([error, rollbackError], "LevelDB repair and rollback both failed") }
82
- ),
83
- { code: CORRUPTION_CODE, backupPath }
84
- );
85
- }
86
- throw Object.assign(
87
- new Error(
88
- `Failed to repair the local database at ${dbPath}; the original database was restored unchanged. Stop every Nolo process and run the CLI again. Do not delete ${path.join(dbPath, "LOCK")} and do not reinstall Nolo: ${toErrorMessage(error)}`,
89
- { cause: error }
90
- ),
91
- { code: CORRUPTION_CODE, backupPath }
92
- );
93
- }
94
- log(
95
- `[nolo] local database corruption detected; preserved original at ${backupPath} and repaired a copy.`
96
- );
97
- return { backupPath };
98
- }
99
-
100
- // packages/database-engine/levelDbOwnershipLock.ts
101
- import fs2 from "node:fs";
102
- import path2 from "node:path";
103
- var LOCKED_CODE = "LEVEL_LOCKED";
104
- var UNWRITTEN_LOCK_GRACE_MS = 5e3;
105
- function createLockError(lockPath, ownerPid) {
106
- const detail = ownerPid === void 0 ? `the lock file ${lockPath} exists but its owner process is unknown` : `it is held by process ${ownerPid}`;
107
- return Object.assign(
108
- new Error(
109
- `CLI authority database is already open by another process: ${detail} (${lockPath}). Wait for that process to exit, or stop it before starting Nolo again.`
110
- ),
111
- { code: LOCKED_CODE, lockPath, ownerPid }
112
- );
113
- }
114
- function isProcessAlive(pid) {
115
- try {
116
- process.kill(pid, 0);
117
- return true;
118
- } catch (error) {
119
- return error.code === "EPERM";
120
- }
121
- }
122
- function readLockHolder(lockPath) {
123
- let raw;
124
- try {
125
- raw = fs2.readFileSync(lockPath, "utf8");
126
- } catch (error) {
127
- if (error.code === "ENOENT") return void 0;
128
- throw error;
129
- }
130
- let pid;
131
- try {
132
- const parsed = JSON.parse(raw);
133
- if (typeof parsed.pid === "number" && Number.isInteger(parsed.pid) && parsed.pid > 0) {
134
- pid = parsed.pid;
135
- }
136
- } catch {
137
- }
138
- let mtimeMs = Date.now();
139
- try {
140
- mtimeMs = fs2.statSync(lockPath).mtimeMs;
141
- } catch {
142
- }
143
- return { pid, mtimeMs };
144
- }
145
- function acquireLevelDbOwnershipLock(dbPath) {
146
- const lockPath = `${dbPath}.owner`;
147
- fs2.mkdirSync(path2.dirname(lockPath), { recursive: true });
148
- const content = `${JSON.stringify({ pid: process.pid, startedAt: (/* @__PURE__ */ new Date()).toISOString() })}
149
- `;
150
- for (let attempt = 0; attempt < 3; attempt += 1) {
151
- let fd;
152
- try {
153
- fd = fs2.openSync(lockPath, "wx", 420);
154
- } catch (error) {
155
- if (error.code !== "EEXIST") throw error;
156
- const holder = readLockHolder(lockPath);
157
- if (!holder) continue;
158
- if (holder.pid !== void 0 && isProcessAlive(holder.pid)) {
159
- throw createLockError(lockPath, holder.pid);
160
- }
161
- if (holder.pid === void 0 && Date.now() - holder.mtimeMs < UNWRITTEN_LOCK_GRACE_MS) {
162
- throw createLockError(lockPath);
163
- }
164
- const quarantine = `${lockPath}.stale-${process.pid}-${Date.now()}`;
165
- try {
166
- fs2.renameSync(lockPath, quarantine);
167
- fs2.rmSync(quarantine, { force: true });
168
- } catch (renameError) {
169
- if (renameError.code !== "ENOENT") throw renameError;
170
- }
171
- continue;
172
- }
173
- try {
174
- fs2.writeSync(fd, content);
175
- } catch (error) {
176
- try {
177
- fs2.closeSync(fd);
178
- } catch {
179
- }
180
- try {
181
- fs2.rmSync(lockPath, { force: true });
182
- } catch {
183
- }
184
- throw error;
185
- }
186
- let released = false;
187
- return {
188
- lockPath,
189
- release() {
190
- if (released) return;
191
- released = true;
192
- try {
193
- fs2.closeSync(fd);
194
- } catch {
195
- }
196
- try {
197
- fs2.rmSync(lockPath, { force: true });
198
- } catch {
199
- }
200
- }
201
- };
202
- }
203
- throw createLockError(lockPath);
204
- }
205
-
206
- // packages/database-engine/cliAuthorityBrokerServer.ts
207
- var brokerRegistry = /* @__PURE__ */ new Map();
208
- var databaseOwners = /* @__PURE__ */ new Map();
209
- var DEFAULT_ITERATOR_LIMIT = 200;
210
- function resolveBrokerListenTarget(endpoint) {
211
- if (endpoint.startsWith("unix://")) {
212
- return { kind: "unix", path: endpoint.slice("unix://".length) };
213
- }
214
- if (endpoint.startsWith("tcp://")) {
215
- const url = new URL(endpoint);
216
- return {
217
- kind: "tcp",
218
- host: url.hostname,
219
- port: Number(url.port)
220
- };
221
- }
222
- throw new Error(`Unsupported CLI authority broker endpoint: ${endpoint}`);
223
- }
224
- function buildListeningEndpoint(server, target) {
225
- if (target.kind === "unix") {
226
- return `unix://${target.path}`;
227
- }
228
- const address = server.address();
229
- if (!address || typeof address === "string") {
230
- return `tcp://${target.host}:${target.port}`;
231
- }
232
- const info = address;
233
- return `tcp://${target.host}:${info.port}`;
234
- }
235
- function ensureParentDir(filePath) {
236
- fs3.mkdirSync(path3.dirname(filePath), { recursive: true });
237
- }
238
- function writeJsonFile(filePath, data) {
239
- if (!filePath) return;
240
- ensureParentDir(filePath);
241
- fs3.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}
242
- `, "utf8");
243
- }
244
- function removeFileIfPresent(filePath) {
245
- if (!filePath) return;
246
- try {
247
- fs3.rmSync(filePath, { force: true });
248
- } catch {
249
- }
250
- }
251
- async function buildIteratorPage(store, request) {
252
- const rows = [];
253
- for await (const entry of store.iterator(request.options ?? {})) {
254
- rows.push(entry);
255
- }
256
- const startIndex = request.cursor ? rows.findIndex(([key]) => key === request.cursor) + 1 : 0;
257
- const limit = request.limit ?? DEFAULT_ITERATOR_LIMIT;
258
- const entries = rows.slice(startIndex, startIndex + limit);
259
- const lastEntry = entries.at(-1) ?? null;
260
- return {
261
- entries,
262
- nextCursor: lastEntry ? lastEntry[0] : null,
263
- done: startIndex + entries.length >= rows.length
264
- };
265
- }
266
- function createErrorResponse(error) {
267
- if (typeof error === "object" && error !== null && typeof error.code === "string" && typeof error.message === "string") {
268
- return {
269
- ok: false,
270
- error: {
271
- code: error.code,
272
- message: error.message,
273
- retryable: error.retryable === true
274
- }
275
- };
276
- }
277
- return {
278
- ok: false,
279
- error: {
280
- code: "BROKER_INTERNAL_ERROR",
281
- message: toErrorMessage(error)
282
- }
283
- };
284
- }
285
- async function dispatchCliAuthorityBrokerRequest(store, request) {
286
- try {
287
- switch (request.type) {
288
- case "status":
289
- return { ok: true, result: { type: "status" } };
290
- case "open":
291
- await store.open();
292
- return { ok: true, result: { type: "open" } };
293
- case "close":
294
- return { ok: true, result: { type: "close" } };
295
- case "get":
296
- return { ok: true, result: { type: "get", value: await store.get(request.key) } };
297
- case "put":
298
- await store.put(request.key, request.value);
299
- return { ok: true, result: { type: "put" } };
300
- case "del":
301
- await store.del(request.key);
302
- return { ok: true, result: { type: "del" } };
303
- case "batchWrite":
304
- await store.batchWrite(request.ops);
305
- return { ok: true, result: { type: "batchWrite" } };
306
- case "iterator":
307
- return {
308
- ok: true,
309
- result: {
310
- type: "iterator",
311
- page: await buildIteratorPage(store, request)
312
- }
313
- };
314
- }
315
- } catch (error) {
316
- return createErrorResponse(error);
317
- }
318
- }
319
- async function openAuthorityStoreWithCorruptionRecovery(options, track) {
320
- let attemptStore;
321
- try {
322
- attemptStore = await options.createStore();
323
- track(attemptStore);
324
- await attemptStore.open();
325
- return attemptStore;
326
- } catch (error) {
327
- if (!options.dbPath || !isLevelCorruptionError(error)) throw error;
328
- if (attemptStore) {
329
- try {
330
- await attemptStore.close();
331
- } catch (closeError) {
332
- throw Object.assign(
333
- new Error(
334
- `LevelDB corruption detected at ${options.dbPath}, but the failed database handle could not be closed; on-disk files were left untouched. Stop every Nolo process and retry: ${toErrorMessage(closeError)}`,
335
- { cause: closeError }
336
- ),
337
- { code: "LEVEL_CORRUPTION" }
338
- );
339
- }
340
- track(void 0);
341
- attemptStore = void 0;
342
- }
343
- const { backupPath } = await recoverCorruptedLevelDb({
344
- dbPath: options.dbPath,
345
- now: options.now
346
- });
347
- try {
348
- attemptStore = await options.createStore();
349
- track(attemptStore);
350
- await attemptStore.open();
351
- return attemptStore;
352
- } catch (retryError) {
353
- throw Object.assign(
354
- new Error(
355
- `Local database corruption at ${options.dbPath} was preserved at ${backupPath}, but reopening the repaired copy failed: ${toErrorMessage(retryError)}. Do not reinstall Nolo and do not delete ${path3.join(options.dbPath, "LOCK")}; the preserved original database is at ${backupPath}.`,
356
- { cause: retryError }
357
- ),
358
- { code: "LEVEL_CORRUPTION", backupPath }
359
- );
360
- }
361
- }
362
- }
363
- async function createBrokerHandle(options) {
364
- const target = resolveBrokerListenTarget(options.endpoint);
365
- const socketMode = (options.transportMode ?? "socket") === "socket";
366
- let store;
367
- let ownershipLock;
368
- const sockets = /* @__PURE__ */ new Set();
369
- const server = createServer((socket) => {
370
- sockets.add(socket);
371
- socket.once("close", () => sockets.delete(socket));
372
- socket.on("error", () => {
373
- });
374
- if (!storeReady || !store) {
375
- socket.once("data", () => {
376
- socket.end(`${JSON.stringify({ ok: false, error: { code: "BROKER_UNAVAILABLE", message: "CLI authority broker is starting", retryable: true } })}
377
- `);
378
- });
379
- return;
380
- }
381
- bindSocketRequestHandler({ socket, store });
382
- });
383
- let storeReady = false;
384
- try {
385
- if (socketMode) {
386
- if (target.kind === "unix") ensureParentDir(target.path);
387
- await new Promise((resolve, reject) => {
388
- server.once("error", reject);
389
- const onListening = () => {
390
- server.off("error", reject);
391
- resolve();
392
- };
393
- if (target.kind === "unix") server.listen(target.path, onListening);
394
- else server.listen(target.port, target.host, onListening);
395
- });
396
- server.unref();
397
- }
398
- if (options.dbPath) {
399
- ownershipLock = acquireLevelDbOwnershipLock(options.dbPath);
400
- }
401
- store = await openAuthorityStoreWithCorruptionRecovery(options, (created) => {
402
- store = created;
403
- });
404
- storeReady = true;
405
- const readyStore = store;
406
- const now = options.now ?? Date.now;
407
- const listeningEndpoint = (options.transportMode ?? "socket") === "socket" ? buildListeningEndpoint(server, target) : options.endpoint;
408
- writeJsonFile(options.metadataPath, {
409
- pid: process.pid,
410
- endpoint: listeningEndpoint,
411
- location: readyStore.location ?? listeningEndpoint,
412
- startedAt: new Date(now()).toISOString()
413
- });
414
- writeJsonFile(options.healthPath, {
415
- ok: true,
416
- pid: process.pid,
417
- endpoint: listeningEndpoint,
418
- checkedAt: new Date(now()).toISOString()
419
- });
420
- let closing;
421
- return {
422
- endpoint: options.endpoint,
423
- listeningEndpoint,
424
- authorityStore: readyStore,
425
- request(request) {
426
- return dispatchCliAuthorityBrokerRequest(readyStore, request);
427
- },
428
- async close() {
429
- closing ??= (async () => {
430
- storeReady = false;
431
- for (const socket of sockets) socket.destroy();
432
- if (server.listening) {
433
- await new Promise((resolve, reject) => {
434
- server.close((error) => error ? reject(error) : resolve());
435
- });
436
- }
437
- await readyStore.close();
438
- brokerRegistry.delete(options.endpoint);
439
- releaseDatabaseOwnership(options);
440
- ownershipLock?.release();
441
- ownershipLock = void 0;
442
- removeFileIfPresent(options.metadataPath);
443
- removeFileIfPresent(options.healthPath);
444
- })().catch((error) => {
445
- closing = void 0;
446
- throw error;
447
- });
448
- return closing;
449
- }
450
- };
451
- } catch (error) {
452
- storeReady = false;
453
- for (const socket of sockets) socket.destroy();
454
- if (server.listening) {
455
- await new Promise((resolve) => server.close(() => resolve()));
456
- }
457
- if (store) {
458
- try {
459
- await store.close();
460
- } catch (closeError) {
461
- throw Object.assign(new AggregateError([error, closeError], "Broker startup failed and the native authority store could not close"), { retainAuthorityOwnership: true });
462
- }
463
- }
464
- ownershipLock?.release();
465
- throw error;
466
- }
467
- }
468
- function bindSocketRequestHandler(args) {
469
- let buffer = "";
470
- args.socket.setEncoding("utf8");
471
- args.socket.on("data", async (chunk) => {
472
- buffer += chunk;
473
- if (!buffer.includes("\n")) return;
474
- const [rawRequest] = buffer.split("\n");
475
- buffer = "";
476
- let response;
477
- try {
478
- response = await dispatchCliAuthorityBrokerRequest(
479
- args.store,
480
- JSON.parse(rawRequest)
481
- );
482
- } catch (error) {
483
- response = createErrorResponse(error);
484
- }
485
- args.socket.end(`${JSON.stringify(response)}
486
- `);
487
- });
488
- }
489
- function canonicalDatabasePath(dbPath) {
490
- const absolute = path3.resolve(dbPath);
491
- try {
492
- return fs3.realpathSync(absolute);
493
- } catch (error) {
494
- if (error.code !== "ENOENT") throw error;
495
- const parent = path3.dirname(absolute);
496
- if (parent === absolute) throw error;
497
- return path3.join(canonicalDatabasePath(parent), path3.basename(absolute));
498
- }
499
- }
500
- function releaseDatabaseOwnership(options) {
501
- if (!options.dbPath) return;
502
- const identity = options.dbPath;
503
- if (databaseOwners.get(identity) === options.endpoint) databaseOwners.delete(identity);
504
- }
505
- function getOrCreateCliAuthorityBrokerServer(options) {
506
- options = { ...options, dbPath: options.dbPath ? canonicalDatabasePath(options.dbPath) : void 0 };
507
- const existing = brokerRegistry.get(options.endpoint);
508
- if (existing) {
509
- if (options.dbPath && databaseOwners.get(options.dbPath) !== options.endpoint) {
510
- return Promise.reject(new Error(`CLI authority endpoint ${options.endpoint} already owns another database`));
511
- }
512
- return existing;
513
- }
514
- if (options.dbPath) {
515
- const identity = canonicalDatabasePath(options.dbPath);
516
- const owner = databaseOwners.get(identity);
517
- if (owner) {
518
- return Promise.reject(Object.assign(new Error(`CLI authority database already owned by ${owner}`), { code: "LEVEL_LOCKED" }));
519
- }
520
- databaseOwners.set(identity, options.endpoint);
521
- }
522
- const pending = createBrokerHandle(options).catch((error) => {
523
- if (!error?.retainAuthorityOwnership) releaseDatabaseOwnership(options);
524
- brokerRegistry.delete(options.endpoint);
525
- throw error;
526
- });
527
- brokerRegistry.set(options.endpoint, pending);
528
- return pending;
529
- }
530
-
531
- // packages/cli/localRuntimeAuthority.ts
532
- function ensureDbParentDir(dbPath) {
533
- fs4.mkdirSync(path4.dirname(dbPath), { recursive: true });
534
- }
535
- function findCliAuthorityCorruption(error) {
536
- const seen = /* @__PURE__ */ new Set();
537
- let current = error;
538
- while (current && !seen.has(current)) {
539
- seen.add(current);
540
- if (current.code === "LEVEL_CORRUPTION" || /Corruption:|missing files/i.test(toErrorMessage(current))) return current;
541
- current = current.cause;
542
- }
543
- return void 0;
544
- }
545
- function throwCliAuthorityStartupError(error) {
546
- const corruption = findCliAuthorityCorruption(error);
547
- if (corruption) {
548
- throw new Error(`Local authority database corruption: ${toErrorMessage(corruption)}`, { cause: error });
549
- }
550
- throw error;
551
- }
552
- function isCliAuthorityLockError(error) {
553
- if (findCliAuthorityCorruption(error)) return false;
554
- const seen = /* @__PURE__ */ new Set();
555
- let current = error;
556
- while (current && !seen.has(current)) {
557
- seen.add(current);
558
- if (isLevelLockError(current)) return true;
559
- current = current.cause;
560
- }
561
- return /EADDRINUSE|Failed to listen/i.test(toErrorMessage(error));
562
- }
563
- async function sleep(ms) {
564
- await new Promise((resolve) => setTimeout(resolve, ms));
565
- }
566
- function resolveCliLocalRuntimeDbPath(options = {}) {
567
- return path4.join(
568
- resolveNoloHome({
569
- env: options.env,
570
- homeDir: options.homeDir
571
- }),
572
- "data",
573
- "leveldb"
574
- );
575
- }
576
- var defaultCliAuthorityBrokerConnectDeps = {
577
- createClient: (options) => createCliAuthorityBrokerClient(options),
578
- startBroker: (options) => getOrCreateCliAuthorityBrokerServer(options),
579
- sleep,
580
- useFastPath: true
581
- };
582
- async function connectCliAuthorityBroker(args) {
583
- const deps = {
584
- ...defaultCliAuthorityBrokerConnectDeps,
585
- ...args.deps
586
- };
587
- async function connectClient() {
588
- const client2 = deps.createClient({
589
- endpoint: args.endpoint,
590
- invoke: createCliAuthorityBrokerSocketInvoker({ endpoint: args.endpoint })
591
- });
592
- async function attachToExistingBroker(attempts) {
593
- for (let attempt = 0; attempt < attempts; attempt += 1) {
594
- await deps.sleep(100);
595
- try {
596
- await client2.open();
597
- return true;
598
- } catch (error) {
599
- if (!isCliAuthorityBrokerUnavailableError(error)) throw error;
600
- }
601
- }
602
- return false;
603
- }
604
- if (deps.useFastPath) {
605
- try {
606
- await client2.open();
607
- return client2;
608
- } catch (error) {
609
- if (!isCliAuthorityBrokerUnavailableError(error)) throw error;
610
- }
611
- }
612
- try {
613
- await deps.startBroker({
614
- endpoint: args.endpoint,
615
- metadataPath: args.metadataPath,
616
- healthPath: args.healthPath,
617
- dbPath: args.dbPath,
618
- createStore: () => createLevelAuthorityStore(args.dbPath)
619
- });
620
- await client2.open();
621
- return client2;
622
- } catch (error) {
623
- if (!isCliAuthorityLockError(error)) throwCliAuthorityStartupError(error);
624
- if (await attachToExistingBroker(5)) {
625
- return client2;
626
- }
627
- let lastError = error;
628
- for (let attempt = 0; attempt < 5; attempt += 1) {
629
- await deps.sleep(100);
630
- try {
631
- await deps.startBroker({
632
- endpoint: args.endpoint,
633
- metadataPath: args.metadataPath,
634
- healthPath: args.healthPath,
635
- dbPath: args.dbPath,
636
- createStore: () => createLevelAuthorityStore(args.dbPath)
637
- });
638
- await client2.open();
639
- return client2;
640
- } catch (retryError) {
641
- lastError = retryError;
642
- if (isCliAuthorityLockError(retryError)) {
643
- if (await attachToExistingBroker(2)) {
644
- return client2;
645
- }
646
- continue;
647
- }
648
- if (isCliAuthorityBrokerUnavailableError(retryError)) {
649
- continue;
650
- }
651
- throwCliAuthorityStartupError(retryError);
652
- }
653
- }
654
- const lastMessage = toErrorMessage(lastError);
655
- const portInUse = lastError !== null && typeof lastError === "object" && "code" in lastError && lastError.code === "EADDRINUSE" || /EADDRINUSE/i.test(lastMessage);
656
- 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` : "";
657
- throw new Error(`CLI authority broker could not attach or take ownership for ${args.endpoint}${detail}`, {
658
- cause: lastError
659
- });
660
- }
661
- }
662
- let client = await connectClient();
663
- let reconnecting = null;
664
- async function reconnect() {
665
- reconnecting ??= connectClient();
666
- try {
667
- client = await reconnecting;
668
- return client;
669
- } finally {
670
- reconnecting = null;
671
- }
672
- }
673
- async function runWithSelfHealing(operation) {
674
- try {
675
- return await operation(client);
676
- } catch (error) {
677
- if (!isCliAuthorityBrokerUnavailableError(error)) throw error;
678
- const recoveredClient = await reconnect();
679
- return operation(recoveredClient);
680
- }
681
- }
682
- return {
683
- get location() {
684
- return client.location;
685
- },
686
- get status() {
687
- return client.status;
688
- },
689
- open: () => runWithSelfHealing((activeClient) => activeClient.open()),
690
- close: () => runWithSelfHealing((activeClient) => activeClient.close()),
691
- get: (key) => runWithSelfHealing((activeClient) => activeClient.get(key)),
692
- put: (key, value) => runWithSelfHealing((activeClient) => activeClient.put(key, value)),
693
- del: (key) => runWithSelfHealing((activeClient) => activeClient.del(key)),
694
- batchWrite: (ops) => runWithSelfHealing((activeClient) => activeClient.batchWrite(ops)),
695
- createBatch() {
696
- const ops = [];
697
- return {
698
- put(key, value) {
699
- ops.push({ type: "put", key, value });
700
- },
701
- del(key) {
702
- ops.push({ type: "del", key });
703
- },
704
- write: () => runWithSelfHealing((activeClient) => activeClient.batchWrite(ops))
705
- };
706
- },
707
- iterator(options = {}) {
708
- return async function* iterate() {
709
- let activeOptions = options;
710
- let lastYieldedKey;
711
- let skipResumeKey = false;
712
- let recovered = false;
713
- while (true) {
714
- try {
715
- for await (const entry of client.iterator(activeOptions)) {
716
- if (skipResumeKey && entry[0] === lastYieldedKey) {
717
- skipResumeKey = false;
718
- continue;
719
- }
720
- skipResumeKey = false;
721
- lastYieldedKey = entry[0];
722
- yield entry;
723
- }
724
- return;
725
- } catch (error) {
726
- if (recovered || !isCliAuthorityBrokerUnavailableError(error)) {
727
- throw error;
728
- }
729
- recovered = true;
730
- await reconnect();
731
- if (lastYieldedKey === void 0) {
732
- activeOptions = options;
733
- continue;
734
- }
735
- if (options.reverse) {
736
- activeOptions = {
737
- ...options,
738
- lt: lastYieldedKey
739
- };
740
- continue;
741
- }
742
- activeOptions = {
743
- ...options,
744
- gte: lastYieldedKey
745
- };
746
- skipResumeKey = true;
747
- }
748
- }
749
- }();
750
- }
751
- };
752
- }
753
- async function getDefaultCliLocalRuntimeAuthority(options = {}) {
754
- const ambientNoloHome = process.env.NOLO_HOME?.trim();
755
- const env = {
756
- ...ambientNoloHome ? { NOLO_HOME: ambientNoloHome } : {},
757
- ...options.env ?? process.env
758
- };
759
- const dbPath = resolveCliLocalRuntimeDbPath({
760
- env,
761
- homeDir: options.homeDir
762
- });
763
- ensureDbParentDir(dbPath);
764
- const endpoint = resolveCliAuthorityBrokerEndpoint({
765
- transport: "tcp",
766
- env,
767
- homeDir: options.homeDir
768
- });
769
- const metadataPath = resolveCliAuthorityBrokerMetadataPath({
770
- transport: "tcp",
771
- env,
772
- homeDir: options.homeDir
773
- });
774
- const healthPath = resolveCliAuthorityBrokerHealthPath({
775
- transport: "tcp",
776
- env,
777
- homeDir: options.homeDir
778
- });
779
- return connectCliAuthorityBroker({
780
- endpoint,
781
- metadataPath,
782
- healthPath,
783
- dbPath
784
- });
785
- }
786
- async function getDefaultCliLocalRuntimeDb(options = {}) {
787
- const authorityStore = await getDefaultCliLocalRuntimeAuthority(options);
788
- return createLegacyServerDb(authorityStore);
789
- }
790
-
791
- export {
792
- connectCliAuthorityBroker,
793
- getDefaultCliLocalRuntimeAuthority,
794
- getDefaultCliLocalRuntimeDb
795
- };