nolo-cli 0.149.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-OW3H7ICR.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-A6XBQZBN.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-DQPUIMAC.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-O4RUQUMT.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-ZUEK6A6C.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-YAQJJDC2.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-ATLTFRYJ.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-TXH4IWJL.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-MST6R3E4.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-TZZ2WRBL.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-UASIEDKM.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-DXHL7G2L.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-HTVYCXBP.js → chunk-SMENBO3M.js} +354 -120
  123. package/{chunk-OMRJYNCI.js → chunk-SSFDFOVT.js} +26 -31
  124. package/chunk-SW4S4XYB.js +1794 -0
  125. package/{chunk-TB3MIBRC.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-ID7LNBWR.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-3DAVPNFT.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-2KBOXZQC.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-5UGTB26P.js → createAgentAutomationAction-QOPOLCRK.js} +53 -44
  167. package/createDialogAction-MZ66VY5Q.js +76 -0
  168. package/{createPageAction-CDLDKPRM.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-N3YB65G5.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-E3CEOV5Q.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-DQAD5ERJ.js → handleSendMessageAction-DVG5U26T.js} +422 -118
  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-HAP75VSG.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-7BC66QSX.js → readlineWorkspace-RIE62QVZ.js} +5022 -921
  200. package/{removeDialogAgentAction-OSYNZRX7.js → removeDialogAgentAction-E2H3OZU6.js} +29 -28
  201. package/{runAgentClientLoop-6E6UC3CE.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-3UXPYFNX.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-UPFV7TDT.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-VCA76W6B.js +0 -134
  222. package/agentRunCommand-YNLDKVR7.js +0 -161
  223. package/browser-image-compression-MFDTD7K6.js +0 -1763
  224. package/chatQueueReduxAdapter-TJRMXMYA.js +0 -186
  225. package/chromeOpsCommands-IXRLN57H.js +0 -289
  226. package/chunk-36KZDDO5.js +0 -2415
  227. package/chunk-ACQD6YI2.js +0 -25363
  228. package/chunk-CQ3WA2NE.js +0 -299
  229. package/chunk-CYSYR67N.js +0 -93
  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-PZZTFEKK.js +0 -34
  239. package/chunk-URMS4XY2.js +0 -10
  240. package/chunk-UV6VISQJ.js +0 -20
  241. package/chunk-VJVNU77E.js +0 -83
  242. package/chunk-XYJSY4KG.js +0 -13807
  243. package/chunk-Y5GCAMGP.js +0 -9
  244. package/chunk-YPREESF4.js +0 -225
  245. package/contentThunks-BDIQRZR6.js +0 -73
  246. package/createDialogAction-B7VGVEVU.js +0 -66
  247. package/dialogCommands-G7YBVAMC.js +0 -102
  248. package/levelLazyShim-GZBKODGI.js +0 -7
  249. package/machineWsRunDispatch-L32G7C4P.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-MKYDMWA4.js +0 -111
  255. package/tuiSummaryLlmCaller-3YFNHCTW.js +0 -128
  256. package/{chunk-SV5IJK6K.js → chunk-NBTY7YJF.js} +3 -3
  257. package/{chunk-2SYTUTLI.js → chunk-YBNHPX4S.js} +3 -3
  258. package/{offlineMarxistsAgentCommand-HGXZV4XJ.js → offlineMarxistsAgentCommand-2QTHJCHV.js} +4 -4
@@ -2,154 +2,178 @@ import {
2
2
  buildMachinePermissionPromptBlock,
3
3
  handleConnectorRunMessage,
4
4
  resolveMachineRunPermissionPolicy
5
- } from "./chunk-UASIEDKM.js";
5
+ } from "./chunk-LTRUTOHX.js";
6
6
  import {
7
+ MAX_CONNECTOR_TIMER_DELAY_MS,
8
+ clampConnectorTimerDelayMs,
7
9
  isConnectorWebSocketAuthError,
8
10
  isConnectorWebSocketRetryableError,
11
+ resolveConnectorProbeTimeoutMs,
9
12
  resolveConnectorWebSocketTarget
10
- } from "./chunk-ALXHV7NK.js";
11
- import "./chunk-XYJSY4KG.js";
12
- import "./chunk-I4OPU5TK.js";
13
- import "./chunk-YUNJN43V.js";
14
- import "./chunk-62IL3KQV.js";
13
+ } from "./chunk-2GGXHQIW.js";
14
+ import "./chunk-FJMRBOPO.js";
15
+ import "./chunk-XS47QOFV.js";
16
+ import "./chunk-6MXDOUMH.js";
17
+ import "./chunk-SW4S4XYB.js";
18
+ import "./chunk-VP3BINY7.js";
19
+ import "./chunk-UUPR3TD7.js";
20
+ import "./chunk-NBTY7YJF.js";
21
+ import "./chunk-VL5KOY2C.js";
15
22
  import {
16
23
  detectMachineInfo
17
- } from "./chunk-ESHYE7WU.js";
18
- import "./chunk-EADNWBAZ.js";
19
- import "./chunk-OTGFTBLI.js";
20
- import "./chunk-SV5IJK6K.js";
21
- import "./chunk-CFT5HBGW.js";
22
- import "./chunk-ZOVKKMF6.js";
23
- import "./chunk-GLKOYSRU.js";
24
- import "./chunk-4XEYAFLY.js";
25
- import "./chunk-JBTJAPUF.js";
26
- import "./chunk-O2OWEFII.js";
24
+ } from "./chunk-S73EPYNC.js";
25
+ import "./chunk-ZEZC7IIM.js";
26
+ import "./chunk-VIWDGTDA.js";
27
+ import "./chunk-6MJNEXUU.js";
28
+ import "./chunk-BU2YQBV4.js";
29
+ import "./chunk-XRUSXPCQ.js";
27
30
  import "./chunk-ATNTHIZI.js";
28
- import "./chunk-3DAVPNFT.js";
31
+ import "./chunk-KFHQQ3NO.js";
32
+ import "./chunk-Z7OJUX6S.js";
29
33
  import "./chunk-HS7MLR74.js";
30
- import "./chunk-ID7LNBWR.js";
31
- import "./chunk-DY7ANLKG.js";
32
- import "./chunk-5UTFL4QJ.js";
33
- import "./chunk-KQHGZWSV.js";
34
- import "./chunk-ATLTFRYJ.js";
34
+ import "./chunk-Y2DXOPSO.js";
35
+ import "./chunk-JKMLSTZK.js";
36
+ import "./chunk-I2ZMGXXF.js";
37
+ import "./chunk-OXME3PEE.js";
38
+ import "./chunk-ES633ZS5.js";
35
39
  import "./chunk-NF64D32W.js";
36
40
  import {
37
- CORE_DRAIN_REASON
38
- } from "./chunk-3L2WKC3W.js";
39
- import "./chunk-4JMDLJAD.js";
40
- import "./chunk-OMRJYNCI.js";
41
- import "./chunk-CPUFH46E.js";
42
- import "./chunk-YRRASA5Q.js";
41
+ CORE_DRAIN_REASON,
42
+ parsePositiveFiniteNumberOrFallback
43
+ } from "./chunk-XPWGOTBQ.js";
44
+ import "./chunk-ZIWPQEFU.js";
45
+ import "./chunk-CBHGZRCE.js";
46
+ import "./chunk-SCMHQUMK.js";
47
+ import "./chunk-RSHPU4PD.js";
48
+ import "./chunk-VIDPVFP3.js";
49
+ import "./chunk-5MM7NNO6.js";
50
+ import "./chunk-IA7TRNNR.js";
51
+ import "./chunk-AGIM7IMJ.js";
43
52
  import "./chunk-63W5N6P3.js";
44
53
  import "./chunk-VF4K2QE6.js";
45
- import "./chunk-TXH4IWJL.js";
46
- import "./chunk-6FGTMQCL.js";
47
- import "./chunk-XPRWFQQK.js";
48
- import "./chunk-UQNS32WZ.js";
49
- import "./chunk-MEYIRKDN.js";
50
- import "./chunk-36KZDDO5.js";
51
- import "./chunk-ZJ7UHBJS.js";
52
- import "./chunk-ACQD6YI2.js";
54
+ import "./chunk-GQN2WLAI.js";
55
+ import "./chunk-ILU2NPWY.js";
56
+ import "./chunk-SSFDFOVT.js";
57
+ import "./chunk-F32Z66T4.js";
58
+ import "./chunk-EYWJT7A2.js";
59
+ import "./chunk-ZKZ5X2HS.js";
60
+ import "./chunk-556RW72X.js";
53
61
  import "./chunk-523DITKR.js";
54
- import "./chunk-YYLHWIW6.js";
55
- import "./chunk-6O4IK4V2.js";
56
- import "./chunk-TZZ2WRBL.js";
57
- import "./chunk-Z4CSIXYP.js";
62
+ import "./chunk-UKZX3NHN.js";
63
+ import "./chunk-OFFL4DCR.js";
64
+ import "./chunk-QYPE3TS3.js";
65
+ import "./chunk-IZ7OJB6K.js";
66
+ import "./chunk-4JH2UMJR.js";
67
+ import "./chunk-ZJ7UHBJS.js";
68
+ import "./chunk-BYXBJQAS.js";
69
+ import "./chunk-PLSVXHSA.js";
58
70
  import "./chunk-5RGU3J7P.js";
59
- import "./chunk-M76ECQRD.js";
60
- import "./chunk-B6SAMB33.js";
71
+ import "./chunk-OWYYDMGJ.js";
72
+ import "./chunk-ZRAU6T47.js";
73
+ import "./chunk-4LCOCOR5.js";
61
74
  import "./chunk-YDH3FDFQ.js";
62
- import "./chunk-MX574M24.js";
63
- import "./chunk-4DPP773Q.js";
64
- import "./chunk-VIDPVFP3.js";
65
- import "./chunk-AGGIDPCZ.js";
66
- import "./chunk-CU3QB4HW.js";
67
- import "./chunk-B2XUQXQX.js";
68
- import "./chunk-6TPOEJMQ.js";
69
- import "./chunk-AUDNYVRC.js";
70
- import "./chunk-KHCLMKZZ.js";
75
+ import "./chunk-QFEW2ULV.js";
76
+ import "./chunk-XI7DGLUK.js";
77
+ import "./chunk-EDX5XSJM.js";
78
+ import "./chunk-UAD2WT54.js";
79
+ import "./chunk-74RAWNQN.js";
80
+ import "./chunk-3PVYUPXK.js";
81
+ import "./chunk-A4MW3YZL.js";
82
+ import "./chunk-AIZE5TDM.js";
83
+ import "./chunk-4YRTZIVN.js";
84
+ import "./chunk-UEILX4EV.js";
85
+ import "./chunk-IJERIUXS.js";
86
+ import "./chunk-6Q7UTJKR.js";
87
+ import "./chunk-QQ56R7KS.js";
88
+ import "./chunk-OW765XBU.js";
89
+ import "./chunk-SEJ5OS6F.js";
90
+ import "./chunk-D2MDMY2M.js";
91
+ import "./chunk-HIQ4GF53.js";
92
+ import "./chunk-JZX2XLKC.js";
93
+ import "./chunk-EUGTFFO6.js";
94
+ import "./chunk-XETG4RIX.js";
95
+ import "./chunk-GKXCHNTE.js";
71
96
  import {
97
+ NEW_TEXT_FIELD_ALIASES,
72
98
  PATH_FIELD_ALIASES,
73
- createLocalWorkspaceToolExecutors
74
- } from "./chunk-4H22P2JV.js";
75
- import "./chunk-P6GMCCAT.js";
99
+ createLocalWorkspaceToolExecutors,
100
+ resolveRequestedWorkspacePath
101
+ } from "./chunk-AUIJZACN.js";
102
+ import "./chunk-GQV5KHJU.js";
76
103
  import "./chunk-ZNFJWEN4.js";
77
- import "./chunk-QXGPFY6J.js";
78
- import "./chunk-GMZLP5DV.js";
79
- import "./chunk-OHOVNO7I.js";
104
+ import "./chunk-LGN377P3.js";
105
+ import "./chunk-HNUWUO75.js";
106
+ import "./chunk-CHOZJMJS.js";
107
+ import "./chunk-PWTNI4N7.js";
108
+ import "./chunk-UOKFKFPO.js";
80
109
  import "./chunk-5ZUL4CUO.js";
81
- import "./chunk-CQ3WA2NE.js";
82
- import "./chunk-PQWU42UQ.js";
110
+ import "./chunk-GCKHQECX.js";
111
+ import "./chunk-G6OOUQWJ.js";
112
+ import "./chunk-56GBUMO5.js";
113
+ import "./chunk-WJZOQR2J.js";
114
+ import "./chunk-WD4XYDYC.js";
115
+ import "./chunk-3SZA4U64.js";
116
+ import "./chunk-QLQ573SU.js";
117
+ import "./chunk-3MZAGMYY.js";
83
118
  import "./chunk-2MBTWINN.js";
84
- import "./chunk-N7J63Q6C.js";
85
- import "./chunk-K2CSUCHJ.js";
86
- import "./chunk-PUOC4YRO.js";
87
- import "./chunk-RGNEEJ3Y.js";
88
- import "./chunk-H6A6X4EK.js";
89
- import "./chunk-S5XGT6GB.js";
90
- import "./chunk-27ONFIEY.js";
91
- import "./chunk-AKG5W4LG.js";
92
- import "./chunk-RYZINGPM.js";
93
- import "./chunk-PSCNXBYA.js";
94
- import "./chunk-L36OWPP3.js";
95
- import "./chunk-BYXBJQAS.js";
119
+ import "./chunk-6CCFTVBP.js";
120
+ import "./chunk-BPMPOFWP.js";
121
+ import "./chunk-5MMAK75Q.js";
96
122
  import "./chunk-DWLEOOGR.js";
97
- import "./chunk-7KVZ5LDQ.js";
123
+ import "./chunk-LIQJTQRN.js";
124
+ import "./chunk-UHTDNB5Y.js";
125
+ import "./chunk-KX6YBIHG.js";
126
+ import "./chunk-7DPNBQSV.js";
127
+ import "./chunk-5EBLANFT.js";
128
+ import "./chunk-NYYFIKHI.js";
129
+ import "./chunk-EZVK3N5L.js";
130
+ import "./chunk-M2EJHDJP.js";
131
+ import "./chunk-5EMSBTQ6.js";
132
+ import "./chunk-I42VC5KR.js";
133
+ import "./chunk-U6VC4MU4.js";
134
+ import "./chunk-TYYRSFBG.js";
135
+ import "./chunk-XZNCX52W.js";
136
+ import "./chunk-WWC7I6TA.js";
137
+ import "./chunk-YVLQXTUB.js";
138
+ import "./chunk-PJNFNEJE.js";
139
+ import "./chunk-PSCNXBYA.js";
140
+ import "./chunk-K2AER7RX.js";
141
+ import "./chunk-UBUH2TCC.js";
142
+ import "./chunk-I4SN4NUQ.js";
143
+ import "./chunk-5BHQICF2.js";
144
+ import {
145
+ isRecord
146
+ } from "./chunk-KUG52IAP.js";
147
+ import {
148
+ asTrimmedString
149
+ } from "./chunk-3EUW3WEO.js";
98
150
  import {
99
151
  toErrorMessage
100
152
  } from "./chunk-HNMXYYJR.js";
101
- import "./chunk-3BXNTXYI.js";
102
- import "./chunk-W7XHHYWM.js";
103
- import "./chunk-RSEEDUMS.js";
104
- import "./chunk-UAD2WT54.js";
105
- import "./chunk-ZWQUWF6W.js";
106
- import "./chunk-HDLLCBRF.js";
107
- import "./chunk-4VJAC32I.js";
108
- import "./chunk-XUWRURDF.js";
109
- import "./chunk-5J3PYNUP.js";
110
- import "./chunk-UNYJU5L6.js";
153
+ import "./chunk-FY4SDK2E.js";
154
+ import "./chunk-GLKOYSRU.js";
155
+ import "./chunk-EYLGAEB4.js";
111
156
  import {
112
157
  isCompiledBinary
113
158
  } from "./chunk-A7GB5UGH.js";
114
159
  import {
115
160
  DEFAULT_NOLO_SERVER_URL
116
161
  } from "./chunk-OLZBQWZU.js";
117
- import "./chunk-TNIX77YM.js";
118
- import "./chunk-Y6ROFCZO.js";
119
- import "./chunk-CYSYR67N.js";
120
- import "./chunk-Y3PMXGLH.js";
121
- import "./chunk-SONWNI3L.js";
122
- import {
123
- parsePositiveFiniteNumberOrFallback
124
- } from "./chunk-Y5GCAMGP.js";
125
- import "./chunk-QDSINZM3.js";
126
- import "./chunk-KX6YBIHG.js";
127
- import "./chunk-HYZIYH2H.js";
128
- import "./chunk-7CHC4W22.js";
129
- import "./chunk-3AH7LNUB.js";
130
- import "./chunk-WWC7I6TA.js";
131
- import "./chunk-QSJ3HFEF.js";
132
- import "./chunk-IAESIMK7.js";
133
- import "./chunk-WIWM4FE3.js";
134
- import "./chunk-QOKAKDPE.js";
135
- import "./chunk-SEJ5OS6F.js";
136
- import "./chunk-OW765XBU.js";
137
- import "./chunk-GBRG75BQ.js";
138
- import {
139
- isRecord
140
- } from "./chunk-KUG52IAP.js";
141
- import "./chunk-BNGW5ASC.js";
142
- import "./chunk-M2EJHDJP.js";
143
- import {
144
- asTrimmedString
145
- } from "./chunk-3EUW3WEO.js";
146
- import "./chunk-U6VC4MU4.js";
147
162
  import "./chunk-LCBAMY2M.js";
148
163
  import "./chunk-4SN6J65J.js";
149
164
  import {
150
165
  normalizeServerOrigin
151
166
  } from "./chunk-CF7PE763.js";
152
167
  import "./chunk-G3SUCT4W.js";
168
+ import "./chunk-TNIX77YM.js";
169
+ import "./chunk-Y6ROFCZO.js";
170
+ import "./chunk-RVWMAFIT.js";
171
+ import "./chunk-CHCS6XPJ.js";
172
+ import "./chunk-QSJ3HFEF.js";
173
+ import "./chunk-ZWQUWF6W.js";
174
+ import "./chunk-KHCLMKZZ.js";
175
+ import "./chunk-VEA7H5FG.js";
176
+ import "./chunk-4VJAC32I.js";
153
177
  import "./chunk-4VNS5WPM.js";
154
178
 
155
179
  // packages/connector-experimental/heartbeatLoop.ts
@@ -371,16 +395,104 @@ async function runMachineWatchCommand(deps) {
371
395
  }
372
396
 
373
397
  // packages/cli/machineToolInvokeDispatch.ts
374
- import { lstat, realpath } from "node:fs/promises";
375
- import { dirname as dirname2, isAbsolute as isAbsolute2, relative as relative2, resolve as resolve2, sep } from "node:path";
376
- var MACHINE_TOOL_INVOKE_V1_TOOL_NAMES = ["readFile", "globFiles"];
398
+ import { appendFile, lstat, mkdir, realpath, stat } from "node:fs/promises";
399
+ import { homedir as homedir2 } from "node:os";
400
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join2, relative as relative2, resolve as resolve2, sep } from "node:path";
401
+
402
+ // packages/agent-runtime/machineToolGrants.ts
403
+ function isRecord2(value) {
404
+ return typeof value === "object" && value !== null && !Array.isArray(value);
405
+ }
406
+ function normalizeMachineToolGrants(raw) {
407
+ if (!isRecord2(raw)) return void 0;
408
+ const grants = {};
409
+ for (const [rawKey, rawEntry] of Object.entries(raw)) {
410
+ const agentKey = rawKey.trim();
411
+ if (!agentKey) continue;
412
+ if (!isRecord2(rawEntry)) continue;
413
+ if (typeof rawEntry.write !== "boolean") continue;
414
+ grants[agentKey] = { write: rawEntry.write };
415
+ }
416
+ return Object.keys(grants).length > 0 ? grants : void 0;
417
+ }
418
+
419
+ // packages/cli/machineToolInvokeDispatch.ts
420
+ var MACHINE_TOOL_INVOKE_V1_READ_ONLY_TOOL_NAMES = ["readFile", "globFiles"];
421
+ var READ_ONLY_TOOL_NAME_SET = new Set(MACHINE_TOOL_INVOKE_V1_READ_ONLY_TOOL_NAMES);
422
+ var MACHINE_TOOL_INVOKE_V1_TOOL_NAMES = [
423
+ "readFile",
424
+ "globFiles",
425
+ "writeFile",
426
+ "editFile"
427
+ ];
377
428
  var V1_ALLOWED_TOOL_NAMES = new Set(MACHINE_TOOL_INVOKE_V1_TOOL_NAMES);
378
429
  var DEFAULT_TOOL_INVOKE_TIMEOUT_MS = 3e4;
379
430
  var TOOL_RESULT_MESSAGE_MAX_CHARS = 1e6;
380
- var TOOL_NOT_ALLOWED_MESSAGE = "tool not allowed in v1 (read-only)";
431
+ var TOOL_NOT_ALLOWED_MESSAGE = "tool not allowed in v1 (allowlisted read/write file tools only)";
381
432
  var TOOL_PAYLOAD_MALFORMED_MESSAGE = "malformed tool.invoke payload (payload object required)";
382
433
  var TOOL_ARGS_MALFORMED_MESSAGE = "malformed tool.invoke args (args object required)";
434
+ var GRANT_DIMENSION_BY_TOOL = {
435
+ writeFile: "write",
436
+ editFile: "write"
437
+ };
438
+ var MACHINE_TOOL_INVOKE_V1_WRITE_TOOL_NAMES = Object.keys(GRANT_DIMENSION_BY_TOOL);
439
+ function grantDimensionForTool(toolName) {
440
+ return Object.hasOwn(GRANT_DIMENSION_BY_TOOL, toolName) ? GRANT_DIMENSION_BY_TOOL[toolName] : void 0;
441
+ }
442
+ var AUDIT_TARGET_MAX_CHARS = 200;
443
+ function machineToolNotGrantedMessage(toolName, agentKey) {
444
+ const dimension = grantDimensionForTool(toolName);
445
+ if (!dimension) {
446
+ return `tool not granted on this machine: ${toolName} is not a registered machine tool (no grant dimension) (NOLO_MACHINE_TOOL_GRANTS)`;
447
+ }
448
+ return agentKey ? `tool not granted on this machine: ${toolName} requires ${dimension} grant for agent ${agentKey} (NOLO_MACHINE_TOOL_GRANTS)` : `tool not granted on this machine: ${toolName} requires an agentKey with ${dimension} grant (NOLO_MACHINE_TOOL_GRANTS)`;
449
+ }
450
+ function isMachineToolGranted(grants, toolName, agentKey) {
451
+ if (READ_ONLY_TOOL_NAME_SET.has(toolName)) return true;
452
+ const dimension = grantDimensionForTool(toolName);
453
+ if (!dimension) return false;
454
+ const normalizedAgentKey = typeof agentKey === "string" ? agentKey.trim() : "";
455
+ if (!normalizedAgentKey || !grants) return false;
456
+ if (!Object.prototype.hasOwnProperty.call(grants, normalizedAgentKey)) return false;
457
+ const entry = grants[normalizedAgentKey];
458
+ if (!isRecord3(entry)) return false;
459
+ return Object.hasOwn(entry, dimension) && entry[dimension] === true;
460
+ }
461
+ function resolveMachineToolAuditLogPath() {
462
+ const noloHome = process.env.NOLO_HOME?.trim();
463
+ const base = noloHome ? noloHome : join2(homedir2(), ".nolo");
464
+ return join2(base, "logs", "machine-tool-audit.jsonl");
465
+ }
466
+ function auditTargetFor(executorArgs) {
467
+ const target = extractMachineToolRequestPath(executorArgs) ?? "";
468
+ return target.length > AUDIT_TARGET_MAX_CHARS ? target.slice(0, AUDIT_TARGET_MAX_CHARS) : target;
469
+ }
470
+ function machineToolOutcomeFailed(outcome) {
471
+ const metadata = outcome.metadata;
472
+ if (!isRecord3(metadata)) return false;
473
+ if (metadata.timedOut === true) return true;
474
+ if (metadata.aborted === true) return true;
475
+ const exitCode = metadata.exitCode;
476
+ return typeof exitCode === "number" && exitCode !== 0;
477
+ }
478
+ async function appendMachineToolAudit(entry) {
479
+ try {
480
+ const logPath = resolveMachineToolAuditLogPath();
481
+ await mkdir(dirname2(logPath), { recursive: true });
482
+ await appendFile(
483
+ logPath,
484
+ `${JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), agentKey: entry.agentKey ?? null, tool: entry.tool, target: entry.target, ok: entry.ok })}
485
+ `,
486
+ "utf8"
487
+ );
488
+ } catch (error) {
489
+ console.warn(`[nolo] machine tool audit write failed: ${toMessage(error)}`);
490
+ }
491
+ }
383
492
  function createMachineToolInvokeHandlers(args) {
493
+ const grants = normalizeMachineToolGrants(
494
+ args.grants ?? readMachineToolGrants(args.env ?? process.env)
495
+ );
384
496
  const executors = (args.createToolExecutors ?? createLocalWorkspaceToolExecutors)({
385
497
  workspaceRoot: args.workspaceRoot,
386
498
  // v1 硬 containment:localWorkspaceTools 在无确认回调时对工作区外路径
@@ -396,7 +508,7 @@ function createMachineToolInvokeHandlers(args) {
396
508
  readFileNoLedger: true
397
509
  });
398
510
  const executorMap = executors;
399
- const invokeWithTimeout = async (toolName, executorArgs, timeoutMs, workspaceRoot) => {
511
+ const invokeWithTimeout = async (toolName, executorArgs, timeoutMs, workspaceRoot, agentKey) => {
400
512
  const call = {
401
513
  id: "machine-tool-invoke",
402
514
  name: toolName,
@@ -410,7 +522,11 @@ function createMachineToolInvokeHandlers(args) {
410
522
  });
411
523
  if (preflightError) return { error: preflightError };
412
524
  }
525
+ const deleteGuardError = await machinePureDeleteGuard(toolName, executorArgs, workspaceRoot);
526
+ if (deleteGuardError) return { error: deleteGuardError };
413
527
  let timer = null;
528
+ const audited = grantDimensionForTool(toolName) !== void 0;
529
+ let auditOk = false;
414
530
  try {
415
531
  const outcome = await Promise.race([
416
532
  executorMap[toolName](call),
@@ -419,6 +535,7 @@ function createMachineToolInvokeHandlers(args) {
419
535
  })
420
536
  ]);
421
537
  const content = typeof outcome?.content === "string" ? outcome.content : "";
538
+ auditOk = !machineToolOutcomeFailed(outcome);
422
539
  if (content.length > TOOL_RESULT_MESSAGE_MAX_CHARS) {
423
540
  return {
424
541
  result: content.slice(0, TOOL_RESULT_MESSAGE_MAX_CHARS) + `
@@ -431,14 +548,25 @@ function createMachineToolInvokeHandlers(args) {
431
548
  return { error: toMessage(error) };
432
549
  } finally {
433
550
  if (timer) clearTimeout(timer);
551
+ if (audited) {
552
+ await appendMachineToolAudit({
553
+ agentKey,
554
+ tool: toolName,
555
+ target: auditTargetFor(executorArgs),
556
+ ok: auditOk
557
+ });
558
+ }
434
559
  }
435
560
  };
436
- const invokeMachineTool = async (requestId, toolName, toolArgs, timeoutMs) => {
561
+ const invokeMachineTool = async (requestId, toolName, toolArgs, timeoutMs, agentKey) => {
437
562
  if (!V1_ALLOWED_TOOL_NAMES.has(toolName)) {
438
563
  return { error: TOOL_NOT_ALLOWED_MESSAGE };
439
564
  }
565
+ if (!isMachineToolGranted(grants, toolName, agentKey)) {
566
+ return { error: machineToolNotGrantedMessage(toolName, agentKey) };
567
+ }
440
568
  const resolvedTimeout = resolveTimeoutMs(timeoutMs);
441
- return invokeWithTimeout(toolName, toolArgs, resolvedTimeout, args.workspaceRoot);
569
+ return invokeWithTimeout(toolName, toolArgs, resolvedTimeout, args.workspaceRoot, agentKey);
442
570
  };
443
571
  return {
444
572
  handleToolInvokeMessage: async (message, send) => {
@@ -451,7 +579,7 @@ function createMachineToolInvokeHandlers(args) {
451
579
  );
452
580
  return JSON.stringify({ type: "tool.result", requestId, error: TOOL_PAYLOAD_MALFORMED_MESSAGE });
453
581
  }
454
- if (!isRecord2(payload.args)) {
582
+ if (!isRecord3(payload.args)) {
455
583
  send(
456
584
  JSON.stringify({ type: "tool.result", requestId, error: TOOL_ARGS_MALFORMED_MESSAGE })
457
585
  );
@@ -461,7 +589,8 @@ function createMachineToolInvokeHandlers(args) {
461
589
  requestId,
462
590
  payload.tool,
463
591
  payload.args,
464
- payload.timeoutMs
592
+ payload.timeoutMs,
593
+ payload.agentKey
465
594
  );
466
595
  send(
467
596
  JSON.stringify(
@@ -490,7 +619,7 @@ function isLexicallyInsideRoot(root, targetPath) {
490
619
  }
491
620
  async function machinePathPreflight(args) {
492
621
  const workspaceRoot = resolve2(args.workspaceRoot);
493
- const lexicalPath = resolve2(workspaceRoot, args.request);
622
+ const lexicalPath = resolveRequestedWorkspacePath(workspaceRoot, args.request);
494
623
  if (!isLexicallyInsideRoot(workspaceRoot, lexicalPath)) {
495
624
  return `path outside workspace root: ${args.request}`;
496
625
  }
@@ -499,11 +628,19 @@ async function machinePathPreflight(args) {
499
628
  while (true) {
500
629
  const stats = await lstat(current).catch(() => void 0);
501
630
  if (!stats) {
502
- return null;
631
+ const parent = resolve2(current, "..");
632
+ if (parent === current) return null;
633
+ return await ancestorContainmentPreflight({
634
+ workspaceRoot,
635
+ ancestor: parent,
636
+ request: args.request
637
+ });
503
638
  }
504
639
  if (!stats.isSymbolicLink()) break;
505
640
  const target = await realpath(current).catch(() => void 0);
506
- if (!target) return null;
641
+ if (!target) {
642
+ return `path outside workspace root after symlink resolution: ${args.request}`;
643
+ }
507
644
  symlinks.push({ link: current, target });
508
645
  current = resolve2(current, "..");
509
646
  if (current === dirname2(current)) break;
@@ -519,6 +656,76 @@ async function machinePathPreflight(args) {
519
656
  }
520
657
  return null;
521
658
  }
659
+ async function ancestorContainmentPreflight(args) {
660
+ const workspaceRoot = resolve2(args.workspaceRoot);
661
+ let existing = args.ancestor;
662
+ while (true) {
663
+ const stats = await lstat(existing).catch(() => void 0);
664
+ if (stats) break;
665
+ const parent = resolve2(existing, "..");
666
+ if (parent === existing) return null;
667
+ existing = parent;
668
+ }
669
+ try {
670
+ const [realExisting, realRoot] = await Promise.all([realpath(existing), realpath(workspaceRoot)]);
671
+ if (!isLexicallyInsideRoot(realRoot, realExisting)) {
672
+ return `path outside workspace root after symlink resolution: ${args.request}`;
673
+ }
674
+ } catch {
675
+ return `path outside workspace root after symlink resolution: ${args.request}`;
676
+ }
677
+ return null;
678
+ }
679
+ var WRITEFILE_DELETE_GUARD_MESSAGE = "writeFile blocked: refusing to overwrite an existing non-empty file with empty content (data-deletion guard). Use editFile with the exact oldText to remove specific text, or write the intended content explicitly.";
680
+ var WRITEFILE_DIRECTORY_TARGET_MESSAGE = "writeFile blocked: target path is an existing directory, not a file (refusing to write; nothing was modified).";
681
+ var EDITFILE_DELETE_GUARD_MESSAGE = "editFile blocked: refusing to replace matched text with an empty newText (data-deletion guard). Provide the intended replacement text.";
682
+ function extractMachineToolStringField(executorArgs, aliases) {
683
+ const rawArgs = typeof executorArgs === "string" ? executorArgs : executorArgs !== void 0 && executorArgs !== null ? JSON.stringify(executorArgs) : null;
684
+ if (rawArgs === null) return void 0;
685
+ let parsed;
686
+ try {
687
+ parsed = JSON.parse(rawArgs);
688
+ } catch {
689
+ return void 0;
690
+ }
691
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
692
+ for (const key of aliases) {
693
+ const value = parsed[key];
694
+ if (typeof value === "string") return value;
695
+ }
696
+ return void 0;
697
+ }
698
+ function writeFileUninspectableTargetMessage(code) {
699
+ return `writeFile blocked: target cannot be inspected (${code}); refusing to write (fail closed \u2014 only a missing target counts as a new file).`;
700
+ }
701
+ function fsErrorCode(error) {
702
+ if (!error || typeof error !== "object") return void 0;
703
+ const code = error.code;
704
+ return typeof code === "string" ? code : void 0;
705
+ }
706
+ async function machinePureDeleteGuard(toolName, executorArgs, workspaceRoot) {
707
+ if (toolName === "writeFile") {
708
+ const content = extractMachineToolStringField(executorArgs, ["content"]);
709
+ if (content === void 0 || content.trim() !== "") return null;
710
+ const requestPath = extractMachineToolRequestPath(executorArgs);
711
+ if (requestPath === null) return null;
712
+ let stats;
713
+ try {
714
+ stats = await stat(resolveRequestedWorkspacePath(workspaceRoot, requestPath));
715
+ } catch (error) {
716
+ if (fsErrorCode(error) === "ENOENT") return null;
717
+ return writeFileUninspectableTargetMessage(fsErrorCode(error) ?? "unknown");
718
+ }
719
+ if (stats.isDirectory()) return WRITEFILE_DIRECTORY_TARGET_MESSAGE;
720
+ return stats.size > 0 ? WRITEFILE_DELETE_GUARD_MESSAGE : null;
721
+ }
722
+ if (toolName === "editFile") {
723
+ const newText = extractMachineToolStringField(executorArgs, NEW_TEXT_FIELD_ALIASES);
724
+ if (newText !== void 0 && newText.trim() === "") return EDITFILE_DELETE_GUARD_MESSAGE;
725
+ return null;
726
+ }
727
+ return null;
728
+ }
522
729
  function extractMachineToolRequestPath(executorArgs) {
523
730
  const rawArgs = typeof executorArgs === "string" ? executorArgs : executorArgs !== void 0 && executorArgs !== null ? JSON.stringify(executorArgs) : null;
524
731
  if (rawArgs === null) return null;
@@ -542,9 +749,9 @@ function parseToolInvokeFrame(message) {
542
749
  } catch {
543
750
  return null;
544
751
  }
545
- if (!isRecord2(parsed) || parsed.type !== "tool.invoke") return null;
752
+ if (!isRecord3(parsed) || parsed.type !== "tool.invoke") return null;
546
753
  if (typeof parsed.requestId !== "string" || parsed.requestId.length === 0) return null;
547
- if (!isRecord2(parsed.payload)) {
754
+ if (!isRecord3(parsed.payload)) {
548
755
  return {
549
756
  requestId: parsed.requestId,
550
757
  payload: { tool: "", args: {}, timeoutMs: void 0 },
@@ -557,23 +764,46 @@ function parseToolInvokeFrame(message) {
557
764
  payload: {
558
765
  tool: typeof payload.tool === "string" ? payload.tool : "",
559
766
  args: payload.args,
560
- timeoutMs: payload.timeoutMs
767
+ timeoutMs: payload.timeoutMs,
768
+ agentKey: typeof payload.agentKey === "string" && payload.agentKey.length > 0 ? payload.agentKey : void 0
561
769
  }
562
770
  };
563
771
  }
564
- function isRecord2(value) {
772
+ function isRecord3(value) {
565
773
  return typeof value === "object" && value !== null && !Array.isArray(value);
566
774
  }
567
775
 
568
776
  // packages/cli/machineWsSession.ts
569
777
  var CONNECTOR_WS_KEEPALIVE_MS = 25e3;
778
+ var DEFAULT_CONNECTOR_TEARDOWN_TIMEOUT_MS = 2e3;
779
+ function resolveTeardownTimeoutMs(env) {
780
+ return clampConnectorTimerDelayMs(
781
+ parsePositiveFiniteNumberOrFallback(
782
+ env.NOLO_CONNECT_TEARDOWN_TIMEOUT_MS,
783
+ DEFAULT_CONNECTOR_TEARDOWN_TIMEOUT_MS
784
+ )
785
+ );
786
+ }
787
+ async function settleWithinTimeout(promises, timeoutMs) {
788
+ let timer = null;
789
+ try {
790
+ const outcome = await Promise.race([
791
+ Promise.allSettled(promises).then(() => "settled"),
792
+ new Promise((resolve3) => {
793
+ timer = setTimeout(() => resolve3("timeout"), timeoutMs);
794
+ })
795
+ ]);
796
+ return { timedOut: outcome === "timeout" };
797
+ } finally {
798
+ if (timer) clearTimeout(timer);
799
+ }
800
+ }
570
801
  function buildConnectorKeepaliveMessage() {
571
802
  return JSON.stringify({ type: "connector.keepalive", sentAt: Date.now() });
572
803
  }
573
804
  function resolveHeartbeatIntervalMs2(env) {
574
- return parsePositiveFiniteNumberOrFallback(
575
- env.NOLO_CONNECT_HEARTBEAT_MS,
576
- 3e4
805
+ return clampConnectorTimerDelayMs(
806
+ parsePositiveFiniteNumberOrFallback(env.NOLO_CONNECT_HEARTBEAT_MS, 3e4)
577
807
  );
578
808
  }
579
809
  async function defaultConnectWebSocket(url, options) {
@@ -604,6 +834,7 @@ async function defaultConnectWebSocket(url, options) {
604
834
  }
605
835
  };
606
836
  options.signal?.addEventListener("abort", handleAbort, { once: true });
837
+ options.teardownSignal?.addEventListener("abort", handleAbort, { once: true });
607
838
  ws.addEventListener(
608
839
  "open",
609
840
  () => {
@@ -613,8 +844,13 @@ async function defaultConnectWebSocket(url, options) {
613
844
  ws.send(buildConnectorKeepaliveMessage());
614
845
  } catch {
615
846
  clearKeepalive();
847
+ try {
848
+ ws.close();
849
+ } catch {
850
+ resolve3();
851
+ }
616
852
  }
617
- }, CONNECTOR_WS_KEEPALIVE_MS);
853
+ }, options.keepaliveMs ?? CONNECTOR_WS_KEEPALIVE_MS);
618
854
  },
619
855
  { once: true }
620
856
  );
@@ -648,8 +884,19 @@ async function defaultConnectWebSocket(url, options) {
648
884
  async function runMachineWsSession(options) {
649
885
  const sentMessages = [];
650
886
  const heartbeatAbort = new AbortController();
887
+ const teardownAbort = new AbortController();
888
+ const teardownTimeoutMs = resolveTeardownTimeoutMs(options.env);
651
889
  let heartbeatLoopPromise = null;
652
890
  let websocketPromise = null;
891
+ const settleTeardown = async () => {
892
+ const { timedOut } = await settleWithinTimeout(
893
+ [websocketPromise, heartbeatLoopPromise].filter(Boolean),
894
+ teardownTimeoutMs
895
+ );
896
+ if (timedOut) {
897
+ teardownAbort.abort();
898
+ }
899
+ };
653
900
  try {
654
901
  if (options.signal?.aborted) {
655
902
  return { exitCode: 0 };
@@ -673,11 +920,13 @@ async function runMachineWsSession(options) {
673
920
  serverUrl: options.serverUrl,
674
921
  machineId: options.machine.machineId,
675
922
  connectorSurface: "cli",
676
- headers: { Authorization: `Bearer ${options.authToken}` }
923
+ headers: { Authorization: `Bearer ${options.authToken}` },
924
+ probeTimeoutMs: resolveConnectorProbeTimeoutMs(options.env)
677
925
  });
678
926
  websocketPromise = options.connectWebSocket(wsTarget, {
679
927
  headers: { Authorization: `Bearer ${options.authToken}` },
680
928
  signal: options.signal,
929
+ teardownSignal: teardownAbort.signal,
681
930
  sentMessages,
682
931
  onMessage: (message) => options.onMessage(message, (response) => {
683
932
  sentMessages.push(response);
@@ -694,16 +943,14 @@ async function runMachineWsSession(options) {
694
943
  [websocketPromise, heartbeatMonitorPromise, abortPromise].filter(Boolean)
695
944
  );
696
945
  heartbeatAbort.abort();
697
- await Promise.allSettled([websocketPromise, heartbeatLoopPromise]);
946
+ await settleTeardown();
698
947
  if (raceResult === "aborted") {
699
948
  return { exitCode: 0 };
700
949
  }
701
950
  return { exitCode: 0 };
702
951
  } catch (error) {
703
952
  heartbeatAbort.abort();
704
- await Promise.allSettled(
705
- [websocketPromise, heartbeatLoopPromise].filter(Boolean)
706
- );
953
+ await settleTeardown();
707
954
  if (isConnectorWebSocketAuthError(error)) {
708
955
  options.output.write(
709
956
  `[nolo] Connector websocket auth failed: ${error.message}. Re-register this machine or update NOLO_MACHINE_API_KEY.
@@ -806,6 +1053,43 @@ async function handleMachineWsMessageDemux(message, send, handlers, runConnector
806
1053
  }
807
1054
  await runConnectorMessage();
808
1055
  }
1056
+ function readMachineToolGrants(env) {
1057
+ const raw = env.NOLO_MACHINE_TOOL_GRANTS?.trim();
1058
+ if (!raw) return void 0;
1059
+ let parsed;
1060
+ try {
1061
+ parsed = JSON.parse(raw);
1062
+ } catch (error) {
1063
+ warnMalformedMachineToolGrantsOnce(
1064
+ `json:${raw}`,
1065
+ `[nolo] NOLO_MACHINE_TOOL_GRANTS is not valid JSON, ignoring it: ${error instanceof Error ? error.message : String(error)}`
1066
+ );
1067
+ return void 0;
1068
+ }
1069
+ if (!isRecord(parsed)) {
1070
+ warnMalformedMachineToolGrantsOnce(
1071
+ `shape:${raw}`,
1072
+ "[nolo] NOLO_MACHINE_TOOL_GRANTS must be a JSON object, ignoring it"
1073
+ );
1074
+ return void 0;
1075
+ }
1076
+ return parsed;
1077
+ }
1078
+ var warnedMalformedMachineToolGrants = /* @__PURE__ */ new Set();
1079
+ function warnMalformedMachineToolGrantsOnce(dedupeKey, message) {
1080
+ if (warnedMalformedMachineToolGrants.has(dedupeKey)) return;
1081
+ warnedMalformedMachineToolGrants.add(dedupeKey);
1082
+ console.warn(message);
1083
+ }
1084
+ function __resetMalformedMachineToolGrantsWarningsForTests() {
1085
+ warnedMalformedMachineToolGrants.clear();
1086
+ }
1087
+ function appendToolGrantsToWsUrl(wsUrl, grants) {
1088
+ if (!grants) return wsUrl;
1089
+ const target = new URL(wsUrl);
1090
+ target.searchParams.set("toolGrants", JSON.stringify(grants));
1091
+ return target.toString();
1092
+ }
809
1093
  function resolveAuthToken2(env) {
810
1094
  return env.AUTH_TOKEN || env.AUTH || "";
811
1095
  }
@@ -854,11 +1138,60 @@ async function sleepWithAbort(ms, sleep, signal) {
854
1138
  ]);
855
1139
  }
856
1140
  function resolveConnectorReconnectDelayMs(env) {
857
- const raw = Number(env.NOLO_CONNECT_RECONNECT_MS ?? "");
858
- return Number.isFinite(raw) && raw >= 0 ? raw : 5e3;
1141
+ const rawValue = env.NOLO_CONNECT_RECONNECT_MS;
1142
+ if (rawValue === void 0 || rawValue.trim() === "") return 5e3;
1143
+ const raw = Number(rawValue);
1144
+ if (!Number.isFinite(raw) || raw < 0) return 5e3;
1145
+ return Math.min(raw, MAX_CONNECTOR_TIMER_DELAY_MS);
1146
+ }
1147
+ var DEFAULT_CONNECTOR_HEARTBEAT_TIMEOUT_MS = 1e4;
1148
+ function resolveConnectorHeartbeatTimeoutMs(env) {
1149
+ return clampConnectorTimerDelayMs(
1150
+ parsePositiveFiniteNumberOrFallback(
1151
+ env.NOLO_CONNECT_HEARTBEAT_TIMEOUT_MS,
1152
+ DEFAULT_CONNECTOR_HEARTBEAT_TIMEOUT_MS
1153
+ )
1154
+ );
1155
+ }
1156
+ async function postMachineHeartbeat(args) {
1157
+ const { fetchImpl, serverUrl, authToken, machine, timeoutMs } = args;
1158
+ const controller = new AbortController();
1159
+ const startedAt = Date.now();
1160
+ let timer = null;
1161
+ const timeoutPromise = new Promise((_resolve, reject) => {
1162
+ timer = setTimeout(() => {
1163
+ controller.abort();
1164
+ reject(
1165
+ new Error(
1166
+ `heartbeat timed out after ${Date.now() - startedAt}ms (NOLO_CONNECT_HEARTBEAT_TIMEOUT_MS=${timeoutMs})`
1167
+ )
1168
+ );
1169
+ }, timeoutMs);
1170
+ });
1171
+ try {
1172
+ const res = await Promise.race([
1173
+ fetchImpl(`${serverUrl}/api/machines/heartbeat`, {
1174
+ method: "POST",
1175
+ headers: {
1176
+ Authorization: `Bearer ${authToken}`,
1177
+ "Content-Type": "application/json"
1178
+ },
1179
+ body: JSON.stringify(machine),
1180
+ signal: controller.signal
1181
+ }),
1182
+ timeoutPromise
1183
+ ]);
1184
+ if (!res.ok) {
1185
+ const text = await res.text().catch(() => "");
1186
+ throw new Error(`HTTP ${res.status}
1187
+ ${text}`);
1188
+ }
1189
+ } finally {
1190
+ if (timer) clearTimeout(timer);
1191
+ }
859
1192
  }
860
1193
  async function defaultExecuteCli(provider, prompt, options) {
861
- const { executeCli } = await import("./cliExecutor-AWYR3T33.js");
1194
+ const { executeCli } = await import("./cliExecutor-BWBF2MTI.js");
862
1195
  return executeCli(provider, prompt, options);
863
1196
  }
864
1197
  function detectLaunchableMachineInfo() {
@@ -928,21 +1261,13 @@ async function runMachineConnectCommand(args, deps = {}) {
928
1261
  });
929
1262
  }
930
1263
  const machine = (deps.machineInfo ?? detectLaunchableMachineInfo)();
931
- const sendHeartbeat = async () => {
932
- const res = await fetchImpl(`${serverUrl}/api/machines/heartbeat`, {
933
- method: "POST",
934
- headers: {
935
- Authorization: `Bearer ${authToken}`,
936
- "Content-Type": "application/json"
937
- },
938
- body: JSON.stringify(machine)
939
- });
940
- if (!res.ok) {
941
- const text = await res.text().catch(() => "");
942
- throw new Error(`HTTP ${res.status}
943
- ${text}`);
944
- }
945
- };
1264
+ const sendHeartbeat = () => postMachineHeartbeat({
1265
+ fetchImpl,
1266
+ serverUrl,
1267
+ authToken,
1268
+ machine,
1269
+ timeoutMs: resolveConnectorHeartbeatTimeoutMs(env)
1270
+ });
946
1271
  if (hasFlag(args, "--ws")) {
947
1272
  const validateWorkspaceLinks = deps.validateWorkspaceLinks ?? (() => []);
948
1273
  if (!await checkConnectorWorkspaceLinks(process.cwd(), output, validateWorkspaceLinks)) {
@@ -951,8 +1276,15 @@ ${text}`);
951
1276
  const maxAttempts = deps.maxConnectorAttempts ?? Infinity;
952
1277
  const sleep = deps.sleep ?? defaultSleep2;
953
1278
  const reconnectDelayMs = resolveConnectorReconnectDelayMs(env);
1279
+ const toolGrants = readMachineToolGrants(env);
954
1280
  const toolInvokeHandlers = createMachineToolInvokeHandlers({
955
- workspaceRoot: process.cwd()
1281
+ workspaceRoot: process.cwd(),
1282
+ // M2 修复:机器侧授权复核与握手上报共用同一来源——本次 `deps.env ??
1283
+ // process.env`。grants 快照与 WS URL 上报的那份逐字节相同;未配置时也
1284
+ // 显式传 env,工厂不再回落到 process.env(调用方经 deps.env 注入环境时
1285
+ // 两端曾不一致)。
1286
+ env,
1287
+ ...toolGrants ? { grants: toolGrants } : {}
956
1288
  });
957
1289
  for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
958
1290
  if (deps.signal?.aborted) {
@@ -969,10 +1301,13 @@ ${text}`);
969
1301
  connectWebSocket: deps.connectWebSocket ?? defaultConnectWebSocket,
970
1302
  serverUrl,
971
1303
  authToken,
972
- resolveConnectorWebSocketTarget: (options) => resolveConnectorWebSocketTarget({
973
- ...options,
974
- fetchImpl
975
- }),
1304
+ resolveConnectorWebSocketTarget: async (options) => appendToolGrantsToWsUrl(
1305
+ await resolveConnectorWebSocketTarget({
1306
+ ...options,
1307
+ fetchImpl
1308
+ }),
1309
+ toolGrants
1310
+ ),
976
1311
  onMessage: (message, send) => handleMachineWsMessageDemux(
977
1312
  message,
978
1313
  send,
@@ -1002,7 +1337,10 @@ ${text}`);
1002
1337
  return 0;
1003
1338
  }
1004
1339
  if (attempt >= maxAttempts) return exitCode;
1005
- const retryDelayMs = sessionResult.retryAfterMs ?? reconnectDelayMs;
1340
+ const retryDelayMs = Math.min(
1341
+ sessionResult.retryAfterMs ?? reconnectDelayMs,
1342
+ MAX_CONNECTOR_TIMER_DELAY_MS
1343
+ );
1006
1344
  const reconnectContext = sessionResult.reconnectReason === CORE_DRAIN_REASON ? " during core draining" : "";
1007
1345
  output.write(
1008
1346
  `[nolo] Connector websocket disconnected${reconnectContext}. Reconnecting in ${retryDelayMs}ms.
@@ -1028,7 +1366,11 @@ ${text}`);
1028
1366
  });
1029
1367
  }
1030
1368
  export {
1369
+ __resetMalformedMachineToolGrantsWarningsForTests,
1031
1370
  formatMachineStatus,
1371
+ postMachineHeartbeat,
1372
+ readMachineToolGrants,
1373
+ resolveConnectorHeartbeatTimeoutMs,
1032
1374
  runMachineConnectCommand,
1033
1375
  runMachineStatusCommand
1034
1376
  };