nolo-cli 0.259.0-alpha.1 → 0.261.0-alpha.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 (320) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-MTM4BJK3.js → _executeModel-PODMRXJJ.js} +97 -83
  3. package/accountResolver-NGICIMEE.js +1 -1
  4. package/{action-C6IQAKN4.js → action-NJTYNXXR.js} +12 -10
  5. package/{addContentAction-53364YDW.js → addContentAction-RUPXLROG.js} +14 -13
  6. package/{addDialogAgentAction-U5DD5EN5.js → addDialogAgentAction-57EJ2UBC.js} +20 -24
  7. package/{agentDeleteCommand-53NN3VSK.js → agentDeleteCommand-DRFCOTYP.js} +185 -147
  8. package/{agentEmailCommands-KOGGIT6I.js → agentEmailCommands-FHENHUBF.js} +143 -127
  9. package/{agentGrantCommands-L6O2HVJI.js → agentGrantCommands-BMVKNYIY.js} +9 -6
  10. package/{agentListCommands-62UYUQDI.js → agentListCommands-W66W5K3V.js} +88 -69
  11. package/{agentMachineCommands-W6TNJXEA.js → agentMachineCommands-C3BUBCXU.js} +69 -60
  12. package/{agentProviderCommands-QLTABYR7.js → agentProviderCommands-VIWKP7DM.js} +11 -8
  13. package/{agentPullCommand-2EYJ5ENC.js → agentPullCommand-5SNSXOY7.js} +10 -7
  14. package/agentRecordCommands-DYMHWTID.js +210 -0
  15. package/agentRun-QVFG3CI4.js +250 -0
  16. package/agentRunCommand-YV4V5HSL.js +248 -0
  17. package/{agentRunControl-LXMADX3N.js → agentRunControl-RGBHKPKJ.js} +19 -12
  18. package/{agentRuntimeLocal-YGNJMQW3.js → agentRuntimeLocal-LVEMOYS2.js} +62 -49
  19. package/{agentSlice-3HHYUQLM.js → agentSlice-OJCM7OUX.js} +15 -18
  20. package/appConfigCommands-ZUXQLE7L.js +417 -0
  21. package/{appDeleteCommands-5COJ6CSG.js → appDeleteCommands-L5UKUMXY.js} +68 -58
  22. package/{appDeployCommands-3JPAT3XO.js → appDeployCommands-KX2BRQUW.js} +74 -59
  23. package/{appDeployStatusCommands-RHZKF3G4.js → appDeployStatusCommands-7LHRSWW7.js} +68 -58
  24. package/{appGetCommands-73DXOAQW.js → appGetCommands-F7SDFCUK.js} +74 -58
  25. package/{appListCommands-HD5LOQ3G.js → appListCommands-U4NJKSMZ.js} +74 -58
  26. package/appMigrateCommands-JAPOLYSW.js +230 -0
  27. package/appSourceCommands-TLXPWXUH.js +279 -0
  28. package/authCommand-AU3GZBZ2.js +65 -0
  29. package/{authCommands-T5FODCEG.js → authCommands-JKBWMUQ4.js} +20 -17
  30. package/{builtinSkillRegistry-EDHD2UHU.js → builtinSkillRegistry-6XUWMAV5.js} +8 -6
  31. package/{chromeOpsCommands-3SSTDFRF.js → chromeOpsCommands-F47WYQWF.js} +68 -18
  32. package/{chunk-5YS6QHGT.js → chunk-2FGFY72B.js} +9 -9
  33. package/{chunk-MJBLXJMP.js → chunk-2I4R6ZRV.js} +12 -9
  34. package/{chunk-FXEPZKNJ.js → chunk-2MIZHEND.js} +506 -64
  35. package/{chunk-TLE77UJ5.js → chunk-2OROOEOQ.js} +0 -1
  36. package/{chunk-6RSNVJGO.js → chunk-2ZBPWX7N.js} +4 -4
  37. package/chunk-35JIFLIG.js +30 -0
  38. package/{chunk-7OVOZRZF.js → chunk-3B7OTHDW.js} +23 -379
  39. package/{chunk-DNNPARJK.js → chunk-3QMN3T6L.js} +50 -37
  40. package/{chunk-DMPZMYH4.js → chunk-3R4AYHJR.js} +13 -1
  41. package/{chunk-XNNBXUEM.js → chunk-3TII7WCF.js} +5 -5
  42. package/{chunk-223KZUJ6.js → chunk-4HZCBA4Q.js} +18 -15
  43. package/{chunk-C5A54QS7.js → chunk-4INJGWE3.js} +18 -5
  44. package/chunk-4IVMDQBA.js +261 -0
  45. package/chunk-4Y6CZ2N4.js +82 -0
  46. package/{chunk-KZ4A7EIV.js → chunk-56OAS5RZ.js} +1 -1
  47. package/{chunk-KQHEGELM.js → chunk-63G7JWEA.js} +16 -6
  48. package/{chunk-4EACJPZI.js → chunk-6BBXJGIQ.js} +51 -42
  49. package/chunk-72VWN4VK.js +51 -0
  50. package/chunk-7LR2IFUH.js +100 -0
  51. package/{chunk-S73EPYNC.js → chunk-7LS5ATRP.js} +20 -6
  52. package/{chunk-XPETQ4MR.js → chunk-7X4BFUJV.js} +24 -10
  53. package/{chunk-KHYSFS3W.js → chunk-A454UXB6.js} +148 -73
  54. package/chunk-A4O76A6V.js +432 -0
  55. package/chunk-AMNZPQCY.js +635 -0
  56. package/{chunk-4MXYCQBS.js → chunk-AQNWWJLH.js} +2 -56
  57. package/{chunk-LHCGKAFO.js → chunk-BKP325XS.js} +184 -112
  58. package/{chunk-PENRYZ4D.js → chunk-BPB3T5EU.js} +4 -7
  59. package/{chunk-U6QNVOR5.js → chunk-BUGLH2A7.js} +130 -6
  60. package/{chunk-2JHGUL5K.js → chunk-BVYHE6QD.js} +2 -2
  61. package/{chunk-KXOPLLFP.js → chunk-CA7LGAHV.js} +69 -9
  62. package/{chunk-2FZVXOFX.js → chunk-CEIWXKHP.js} +112 -200
  63. package/{chunk-Y2TCTNUD.js → chunk-CK2LMTYO.js} +4 -4
  64. package/{chunk-AIFQKNPP.js → chunk-CL33RFD7.js} +1 -1
  65. package/{chunk-57V4PADY.js → chunk-CNYPQYXT.js} +781 -449
  66. package/{chunk-P4R5KXU7.js → chunk-CW6LRDSF.js} +5 -5
  67. package/chunk-D3ONA3FP.js +762 -0
  68. package/{chunk-PIVTQRX6.js → chunk-DDKA6V6X.js} +111 -12
  69. package/chunk-DLXL4NSL.js +1179 -0
  70. package/{chunk-EJQE5HB7.js → chunk-DSBRIUX5.js} +4 -2
  71. package/{chunk-XRGBJHZX.js → chunk-E36V7MPY.js} +9 -5
  72. package/{chunk-4YPH5KRA.js → chunk-EDKMRDET.js} +1 -1
  73. package/{chunk-DBJODIZ6.js → chunk-EQOWWSNQ.js} +19 -27
  74. package/chunk-ER6NTALN.js +34 -0
  75. package/{chunk-L4XST72F.js → chunk-ERCSHBUD.js} +16027 -17392
  76. package/chunk-EUHMI5KG.js +101 -0
  77. package/{chunk-YQLAFJRQ.js → chunk-FBNVJ2TO.js} +1 -1
  78. package/{chunk-Q2EERN52.js → chunk-FF5ZRKW7.js} +12 -7
  79. package/{chunk-6XIE5ZGI.js → chunk-FGFJUFPS.js} +5 -6
  80. package/chunk-FI4DPLR7.js +902 -0
  81. package/{chunk-HDKMVYNJ.js → chunk-FNLT7NKG.js} +7 -11
  82. package/{chunk-JCQ3WCQ3.js → chunk-FOC4TORM.js} +69 -3
  83. package/chunk-FP46RAJQ.js +58 -0
  84. package/{chunk-JPXACKSW.js → chunk-G22P2J7O.js} +30 -81
  85. package/{chunk-7WHCIA5V.js → chunk-G5IAIGGD.js} +3 -8
  86. package/{chunk-FZENZCIA.js → chunk-GEC4CHS2.js} +19 -12
  87. package/chunk-GF4LYNNZ.js +25 -0
  88. package/{chunk-IYLUK67R.js → chunk-GH6SS2DZ.js} +25 -8
  89. package/chunk-HAZ6UVH4.js +368 -0
  90. package/{chunk-OKAXQFON.js → chunk-HB4J5HA6.js} +4 -4
  91. package/{chunk-324FWHUA.js → chunk-HHXF57CL.js} +12 -3
  92. package/chunk-HJTI7RZV.js +94 -0
  93. package/{chunk-HQUGB2HM.js → chunk-HMFKYZKP.js} +62 -50
  94. package/{chunk-Q2MPKE4B.js → chunk-HVRG27HI.js} +76 -26
  95. package/{chunk-46FETNLF.js → chunk-IN4B6Z2D.js} +7 -6
  96. package/chunk-IV6VUVLJ.js +88 -0
  97. package/{chunk-LLUBUHNT.js → chunk-IWWJSSST.js} +5 -9
  98. package/{chunk-7BIJFGKS.js → chunk-J22PFCQN.js} +106 -52
  99. package/chunk-J42X32PV.js +472 -0
  100. package/{chunk-LCBAMY2M.js → chunk-JKVOKKMQ.js} +0 -7
  101. package/{chunk-KT7S7ANZ.js → chunk-JPYOHIHX.js} +9 -9
  102. package/{chunk-R7XWZDOH.js → chunk-JUMQJSQF.js} +1423 -282
  103. package/{chunk-KVMLM5VD.js → chunk-KAHYBAEN.js} +211 -472
  104. package/{chunk-KLMBM6P6.js → chunk-KALCFXQO.js} +2454 -1115
  105. package/chunk-KDDXC2IH.js +148 -0
  106. package/chunk-KGKTN2NX.js +25 -0
  107. package/chunk-KGWE224L.js +246 -0
  108. package/{chunk-OYUMJMC5.js → chunk-KSV6T4AH.js} +6 -1
  109. package/{chunk-P27E22MA.js → chunk-L43DGEPZ.js} +1 -1
  110. package/{chunk-5BIDJVNX.js → chunk-L45P4JTE.js} +180 -31
  111. package/chunk-LHCIIUCX.js +222 -0
  112. package/{chunk-CBIGMWMI.js → chunk-LHJB4BXJ.js} +1 -1
  113. package/{chunk-TRRXYFTR.js → chunk-LOFRSJX2.js} +1 -0
  114. package/{chunk-SQL7YNED.js → chunk-LPXBBC32.js} +71 -5
  115. package/{chunk-BIDSIRTS.js → chunk-LTCZOOAM.js} +11 -17
  116. package/chunk-LUTSMSIL.js +425 -0
  117. package/chunk-LXP53WGF.js +168 -0
  118. package/{chunk-2CT2J3O6.js → chunk-M7VNNPVX.js} +2493 -4055
  119. package/chunk-MDAYRIP7.js +1889 -0
  120. package/{chunk-6B2OBX5B.js → chunk-MMXHIHJZ.js} +15 -47
  121. package/{chunk-HPDLPEUG.js → chunk-MPWQI36J.js} +267 -234
  122. package/chunk-MRACVEPZ.js +7 -0
  123. package/{chunk-ZYPXOQS2.js → chunk-MSFKHPA6.js} +1 -1
  124. package/chunk-NHLLXINQ.js +8 -0
  125. package/{chunk-QXTEEEIN.js → chunk-NJCTPWJU.js} +8 -8
  126. package/chunk-NLS7F5DW.js +1697 -0
  127. package/{chunk-FP37ELBT.js → chunk-NTBTVKKB.js} +17 -25
  128. package/{chunk-JLZJL3WC.js → chunk-O77F26YB.js} +370 -39
  129. package/{chunk-LVZVSLKO.js → chunk-O7ZY6SUK.js} +5 -22
  130. package/{chunk-YN23INFZ.js → chunk-OIOMBPCA.js} +23 -2
  131. package/{chunk-CJOOF4L5.js → chunk-OSZNERNW.js} +17 -14
  132. package/{chunk-JZO7KUF3.js → chunk-P4I55ASV.js} +313 -275
  133. package/{chunk-2C5VN7NH.js → chunk-P4XAHM4B.js} +1 -1
  134. package/chunk-PL5RKESU.js +40 -0
  135. package/chunk-Q5FJJ6XI.js +103 -0
  136. package/{chunk-WS36XPJD.js → chunk-Q5IXZF3S.js} +82 -6
  137. package/{createAgentAutomationAction-GRZ6XY7Q.js → chunk-QKM55LP2.js} +3 -160
  138. package/{chunk-WSLL7VV4.js → chunk-QXWXRBOL.js} +9 -9
  139. package/{chunk-MXA54TQM.js → chunk-QZYQ3Y3G.js} +1 -1
  140. package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
  141. package/{chunk-5RGU3J7P.js → chunk-REAE2SZK.js} +0 -1
  142. package/chunk-RF576RYE.js +117 -0
  143. package/chunk-RI7SXDJW.js +1317 -0
  144. package/{chunk-FEIVARWR.js → chunk-RIOAPUGV.js} +238 -25
  145. package/{chunk-BZLGPM5B.js → chunk-RNLKWUVY.js} +7 -12
  146. package/{chunk-J7JRCOIW.js → chunk-RWXHGPWJ.js} +1 -1
  147. package/{chunk-J55F3IEZ.js → chunk-SARJZIGR.js} +1 -1
  148. package/chunk-SJFL32RD.js +356 -0
  149. package/{chunk-6SOWMEAY.js → chunk-SR57FDTX.js} +2 -258
  150. package/{chunk-MPGR4ZNR.js → chunk-SRVLHMES.js} +46 -42
  151. package/{chunk-CEKRIR22.js → chunk-SU4NCTW4.js} +1 -1
  152. package/{chunk-RD3QLZQV.js → chunk-SWJRX4M5.js} +324 -2
  153. package/{chunk-R3TUHCSJ.js → chunk-T3Y2NA4H.js} +8 -3
  154. package/{chunk-53W5BXLN.js → chunk-TCOHWKDM.js} +54 -55
  155. package/{chunk-KWNVPY6M.js → chunk-TJXO66M2.js} +8 -5
  156. package/{chunk-QIGQFON2.js → chunk-TXMFSGRY.js} +1 -1
  157. package/{chunk-ADYWV732.js → chunk-U5PSCTMR.js} +264 -177
  158. package/{chunk-UUCYUN6Y.js → chunk-UB7NV7NN.js} +1 -1
  159. package/{chunk-QGFLVQ6E.js → chunk-UBOTXA3Z.js} +4 -14
  160. package/{chunk-6YX2RAQN.js → chunk-UEZL3RBG.js} +89 -164
  161. package/{chunk-NCFKHYDM.js → chunk-UJL23HBL.js} +774 -119
  162. package/chunk-ULPU4C43.js +1710 -0
  163. package/{chunk-UA3QTA2S.js → chunk-VC3MAT33.js} +4442 -2570
  164. package/{chunk-VNHZJEQN.js → chunk-VCESLFF4.js} +3 -3
  165. package/chunk-VOO3YQQP.js +17157 -0
  166. package/{chunk-Y2GWUBNS.js → chunk-VZDSNDUD.js} +279 -149
  167. package/{chunk-6BMTKYAO.js → chunk-W2Z5E2R7.js} +126 -698
  168. package/{chunk-4ZCTKB27.js → chunk-W5GKF5ZW.js} +1 -0
  169. package/chunk-WEEB2JKA.js +443 -0
  170. package/{chunk-NUHQO3RB.js → chunk-WIVVNJUS.js} +1 -1
  171. package/chunk-WMBJDXMY.js +408 -0
  172. package/chunk-WSQLCWLQ.js +201 -0
  173. package/{chunk-OOVOAG4Q.js → chunk-WY6DMHMG.js} +1 -1
  174. package/{chunk-6K32PBRY.js → chunk-XJW6SLBZ.js} +3 -3
  175. package/{chunk-MNFUKRRU.js → chunk-XKNDVHF5.js} +7 -7
  176. package/{chunk-MHKPUGPD.js → chunk-XREMPMNK.js} +20 -4
  177. package/chunk-XT6C2QZW.js +46 -0
  178. package/chunk-XUDXQT7R.js +790 -0
  179. package/{chunk-ZEZC7IIM.js → chunk-YFSM2366.js} +35 -35
  180. package/{chunk-RIWKZT7E.js → chunk-YRPIUIEQ.js} +11 -9
  181. package/{chunk-U35UUM5K.js → chunk-YVOUSIIA.js} +1 -1
  182. package/{chunk-6VEO7Z3Y.js → chunk-Z27AH6A5.js} +6 -6
  183. package/chunk-Z3KTXWWB.js +76 -0
  184. package/{chunk-UWWOWTW2.js → chunk-Z7EP5HDL.js} +1 -1
  185. package/{chunk-YFEK7ACQ.js → chunk-ZB2E724W.js} +4 -4
  186. package/{chunk-YLAHYLDQ.js → chunk-ZC3CMUKU.js} +2 -89
  187. package/{chunk-5P3PPQVP.js → chunk-ZQAADXSF.js} +1 -1
  188. package/{cliAgentConfigHelpers-BXHQ3PXP.js → cliAgentConfigHelpers-BJJEXHSZ.js} +20 -14
  189. package/{cliAuthorityBrokerClient-TFNXJLXL.js → cliAuthorityBrokerClient-3SKOA7OZ.js} +3 -1
  190. package/cliAuthorityBrokerProcess-VIJEKQSX.js +34 -0
  191. package/{cliEnvHelpers-CNMP3RDX.js → cliEnvHelpers-NDMKN4X2.js} +6 -3
  192. package/{cliExecutor-K6FDZTQ2.js → cliExecutor-Z62UBJ5S.js} +12 -6
  193. package/cliLocalAgentRecordReader-KCZS2MZU.js +113 -0
  194. package/cloudAutomationCommands-2WQUGQSW.js +310 -0
  195. package/{commandRegistry-IFYQLPGM.js → commandRegistry-C64JBZJ3.js} +288 -121
  196. package/{contentThunks-QCFCD2X3.js → contentThunks-G3HEIRXC.js} +45 -43
  197. package/{cooldownCommands-WDOI5VD7.js → cooldownCommands-FPAFS7XG.js} +1 -1
  198. package/createAgentAutomationAction-DSBL3X3A.js +172 -0
  199. package/createDialogAction-OHFUHC53.js +86 -0
  200. package/{createPageAction-QCVBMP4C.js → createPageAction-E6JZSZLU.js} +49 -45
  201. package/{db-VR74ADGC.js → db-KTQ3LL2Q.js} +3 -3
  202. package/{dbSlice-RWPSVHBC.js → dbSlice-U3GPLEL3.js} +21 -16
  203. package/deleteDbKey-DRXKWJX5.js +86 -0
  204. package/{dialogCommands-4IEQUALS.js → dialogCommands-4EX2OTIC.js} +80 -66
  205. package/{dialogMessageRecord-OAV77LT7.js → dialogMessageRecord-2HJTEXQX.js} +1 -1
  206. package/dialogNotifyCommand-4SCE2Z2R.js +44 -0
  207. package/dialogPortabilityCommands-ZSFFHRX4.js +3036 -0
  208. package/{dialogSlice-XFYID6KE.js → dialogSlice-PRZCIJCH.js} +43 -42
  209. package/{dialogTraceCommand-Y67NRFCV.js → dialogTraceCommand-RKB76OVX.js} +84 -70
  210. package/{dialogUsageCommand-WJ3U6KZU.js → dialogUsageCommand-BP7HMRYP.js} +7 -4
  211. package/{docCreateCommands-QLRIWRQE.js → docCreateCommands-JGPNGIZ7.js} +68 -59
  212. package/{docDeleteCommands-XPRYA532.js → docDeleteCommands-XRJTNRDH.js} +68 -59
  213. package/{docReadCommands-EXQI7ETH.js → docReadCommands-6GFO4ARS.js} +67 -58
  214. package/{docStore-MWFUKZL2.js → docStore-QRLIWFTU.js} +16 -17
  215. package/{docUpdateCommands-EFBFQV77.js → docUpdateCommands-W2GXMUXW.js} +68 -59
  216. package/{ebookDownloaderAgentCommand-DYSKF5ZY.js → ebookDownloaderAgentCommand-2DHPGEOQ.js} +14 -17
  217. package/{fetchMessages-TQEUZD7H.js → fetchMessages-RGPIYEPZ.js} +2 -2
  218. package/{getPricing-5BLZRPTM.js → getPricing-BK6CUBAE.js} +8 -4
  219. package/{handleSendMessageAction-GG3TR62X.js → handleSendMessageAction-DHGWURJZ.js} +265 -119
  220. package/{hostCredentialCreate-26S6DDJ5.js → hostCredentialCreate-FPUZ7RMI.js} +138 -122
  221. package/index.js +36 -22
  222. package/{keys-RWF7UCB4.js → keys-FXEGMKSG.js} +2 -2
  223. package/localAutomationCommands-ZMU22RQJ.js +198 -0
  224. package/localAutomationRuntime-MU5FGJ3V.js +60 -0
  225. package/{localDialogRead-BJJT3TF5.js → localDialogRead-W2EVXISA.js} +2 -2
  226. package/{localRuntimeAdapter-VREWZWPC.js → localRuntimeAdapter-YBXQBV4G.js} +136 -119
  227. package/localRuntimeAuthority-LDXMEDO5.js +44 -0
  228. package/{localRuntimeDb-ZJFGNHML.js → localRuntimeDb-6TQZDLNU.js} +1 -1
  229. package/{machineCommands-CL5XK5UC.js → machineCommands-57RTUYRV.js} +251 -357
  230. package/{machineInfo-LWHTEBHJ.js → machineInfo-BJIU3WQ5.js} +4 -2
  231. package/machineWsRunDispatch-VBKV3FFE.js +227 -0
  232. package/{mcpLocalAuthorizeCommand-RBXJDE6J.js → mcpLocalAuthorizeCommand-J76SOJVZ.js} +40 -22
  233. package/mcpLocalManageCommands-USETIMHB.js +212 -0
  234. package/{memberThunks-43B7UYC5.js → memberThunks-7UERUEMI.js} +102 -22
  235. package/{memoryCommands-BC6REPQB.js → memoryCommands-N7NHEE55.js} +25 -34
  236. package/{models-ZX2BYIMB.js → models-TOXYINNM.js} +3 -2
  237. package/{offlineMarxistsAgentCommand-XVXUE6G5.js → offlineMarxistsAgentCommand-WZBJBCPZ.js} +16 -22
  238. package/package.json +3 -3
  239. package/parityCommands-LYDLWSLK.js +613 -0
  240. package/{projectArchive-OC63TWTD.js → projectArchive-KCNQDVWJ.js} +49 -45
  241. package/{providerPresetApply-NTJUINI6.js → providerPresetApply-IRJ56XIZ.js} +12 -16
  242. package/{providerRegistry-W45SLUV6.js → providerRegistry-26PAUYH2.js} +3 -13
  243. package/{read-KG6INYUT.js → read-SPSQ6NLR.js} +11 -10
  244. package/{readDocTool-N3GA52JR.js → readDocTool-ENUL2GNL.js} +5 -1
  245. package/{readlineWorkspace-2NO6D6IZ.js → readlineWorkspace-MKS7TAEF.js} +927 -573
  246. package/{rememberExplicit-CPAPONSI.js → rememberExplicit-7KX4HXQC.js} +4 -4
  247. package/remove-TNNDO635.js +32 -0
  248. package/{removeDialogAgentAction-EEVSOQOJ.js → removeDialogAgentAction-POPUZ3WU.js} +22 -26
  249. package/{runAgentClientLoop-U7V32UTD.js → runAgentClientLoop-KVILXQNI.js} +117 -82
  250. package/{runtimeDoctorCommands-V3M3JTUV.js → runtimeDoctorCommands-4J2DP4LZ.js} +23 -16
  251. package/{secretCommands-KVVZS7A6.js → secretCommands-CSTQYB6T.js} +2 -2
  252. package/{setDialogExtraReferencesAction-DNO5POHA.js → setDialogExtraReferencesAction-35THMVBP.js} +16 -17
  253. package/{setPrimaryDialogAgentAction-QABBEO4C.js → setPrimaryDialogAgentAction-WLXBNIG7.js} +23 -27
  254. package/{settingThunks-DVKG4X4S.js → settingThunks-6Y5U5M5N.js} +170 -497
  255. package/{skillDiscovery-5GEGWJ6N.js → skillDiscovery-IUEZZG2B.js} +3 -3
  256. package/{spaceCommands-7QKXKBDQ.js → spaceCommands-LXNJBO2U.js} +293 -58
  257. package/spacePruneCommand-2ITUFYBM.js +233 -0
  258. package/{store-Z53ICFL3.js → store-WSAVTR32.js} +3 -1
  259. package/{streamAgentChatTurn-UAGFOXNJ.js → streamAgentChatTurn-EY6MFKCA.js} +225 -137
  260. package/{switchDialogAgentAction-KYWJSGOO.js → switchDialogAgentAction-TG6BQRDA.js} +19 -23
  261. package/{tableCommands-EFA754RE.js → tableCommands-35G34R4B.js} +28 -49
  262. package/{toolApiClient-N5PYW2R3.js → toolApiClient-MPQIFYXP.js} +15 -4
  263. package/{tools-2Q2LBDUC.js → tools-CSLTRRUR.js} +73 -63
  264. package/{tuiRestart-4QDWLHYZ.js → tuiRestart-ALR4Q3JM.js} +20 -13
  265. package/tuiSummaryLlmCaller-3Y3JEXJK.js +52 -0
  266. package/{updateCommands-GJGRS6JK.js → updateCommands-GHQVP6Z5.js} +13 -8
  267. package/{updateDialogTitleAction-GGNTTI5L.js → updateDialogTitleAction-LFAWF5EW.js} +57 -58
  268. package/{usageCommand-WI6SQOPB.js → usageCommand-5VKW6T4C.js} +6 -8
  269. package/{usageRebuildCommand-WQRLLZAT.js → usageRebuildCommand-VUQETFMW.js} +11 -15
  270. package/{windowsSelfUpdate-C7LGVWYX.js → windowsSelfUpdate-SXSVXK4X.js} +2 -2
  271. package/workContext-ZAW6VXT7.js +18 -0
  272. package/workContextQueryProjection-CACY5VFE.js +23 -0
  273. package/{workloadLifecycle-DYX5ZMAT.js → workloadLifecycle-P2SJVV3S.js} +1 -1
  274. package/agentFavoriteCommands-7LOP3HUD.js +0 -186
  275. package/agentRecordCommands-TPE7NSZ6.js +0 -194
  276. package/agentRunCommand-DMVGBPLI.js +0 -232
  277. package/authCommand-V6EOMZX6.js +0 -79
  278. package/chunk-2MBTWINN.js +0 -89
  279. package/chunk-523DITKR.js +0 -32
  280. package/chunk-BUDVRYES.js +0 -2213
  281. package/chunk-BZMDWGQQ.js +0 -47
  282. package/chunk-GAHJLSDO.js +0 -107
  283. package/chunk-GYX6XTAI.js +0 -84
  284. package/chunk-HNUWUO75.js +0 -93
  285. package/chunk-HSBHS6KT.js +0 -33401
  286. package/chunk-KG27JIG4.js +0 -136
  287. package/chunk-OB4FBZXJ.js +0 -364
  288. package/chunk-OKH74FML.js +0 -3746
  289. package/chunk-OLZBQWZU.js +0 -6
  290. package/chunk-OOV5JN25.js +0 -1317
  291. package/chunk-OQFOE4SJ.js +0 -405
  292. package/chunk-PXYBUFDB.js +0 -53
  293. package/chunk-R3FZHW4Q.js +0 -103
  294. package/chunk-R3MV2GII.js +0 -106
  295. package/chunk-SCAC3NM5.js +0 -11751
  296. package/chunk-SR4FE5VD.js +0 -9
  297. package/chunk-SYTHYBMI.js +0 -3558
  298. package/chunk-UKZX3NHN.js +0 -48
  299. package/chunk-UVLYNWIE.js +0 -74
  300. package/chunk-VQX5JJNI.js +0 -861
  301. package/chunk-X4O7FJF5.js +0 -160
  302. package/chunk-YJPK35HB.js +0 -175
  303. package/chunk-YNIYE47Z.js +0 -105
  304. package/chunk-Z4PCXPUE.js +0 -127
  305. package/chunk-ZR5IVL4N.js +0 -862
  306. package/chunk-ZTHAJU3O.js +0 -2537
  307. package/cliAuthorityBrokerProcess-5ZFBTHLB.js +0 -22
  308. package/cliLocalAgentRecordReader-34UKRBLY.js +0 -104
  309. package/createDialogAction-ZAJERW62.js +0 -82
  310. package/deleteFile-ECU6FU5C.js +0 -55
  311. package/dialogNotifyCommand-IASQGEMW.js +0 -36
  312. package/localRuntimeAuthority-UF2DAQ3F.js +0 -28
  313. package/machineWsRunDispatch-TBVOYOAH.js +0 -209
  314. package/markdownToSlate-PXYAIBVL.js +0 -8
  315. package/tuiSummaryLlmCaller-HROLGN4F.js +0 -45
  316. package/webapi-QVV65DQF.js +0 -2487
  317. package/workContext-Y3ADAPZU.js +0 -14
  318. package/{chunk-USGHJSGO.js → chunk-GX2MFKF3.js} +3 -3
  319. package/{chunk-PHREU2KZ.js → chunk-WX266G2C.js} +0 -0
  320. package/{chunk-DXWGFL2Z.js → chunk-YY7IGJMN.js} +3 -3
@@ -1,56 +1,298 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
+ getOrCreateSharedStore,
4
+ isCliProviderAgentConfig,
3
5
  summarizeEndpoint
4
- } from "./chunk-UA3QTA2S.js";
6
+ } from "./chunk-VC3MAT33.js";
7
+ import {
8
+ attachExecutionStoppedPromise,
9
+ getExecutionStoppedPromise
10
+ } from "./chunk-JUMQJSQF.js";
11
+ import {
12
+ isCursorOAuthAgent
13
+ } from "./chunk-VIWDGTDA.js";
5
14
  import {
6
15
  clipMultilineText
7
- } from "./chunk-VQX5JJNI.js";
16
+ } from "./chunk-ULPU4C43.js";
17
+ import {
18
+ withQueueLock
19
+ } from "./chunk-7X4BFUJV.js";
20
+ import {
21
+ DialogTurnBusyError,
22
+ acquireLocalDialogTurnLease,
23
+ propagateLocalDialogTurnAuthority,
24
+ resolveLocalDialogTurnAuthority,
25
+ sanitizeDialogTurnIdentifier,
26
+ startDialogTurnHeartbeat
27
+ } from "./chunk-XUDXQT7R.js";
8
28
  import {
29
+ isDialogTurnRef
30
+ } from "./chunk-EUHMI5KG.js";
31
+ import {
32
+ createLocalWorkspaceToolExecutors,
33
+ executeLocalToolWithPolicy,
34
+ isPathInsideRoot,
9
35
  runLocalAgentTurn
10
- } from "./chunk-57V4PADY.js";
36
+ } from "./chunk-CNYPQYXT.js";
11
37
  import {
12
38
  resolveLocalRuntimeEnvFromPolicy
13
- } from "./chunk-USGHJSGO.js";
39
+ } from "./chunk-GX2MFKF3.js";
14
40
  import {
15
41
  asRecordOrEmpty
16
42
  } from "./chunk-KX6YBIHG.js";
43
+ import {
44
+ toErrorMessage
45
+ } from "./chunk-HNMXYYJR.js";
46
+ import {
47
+ resolveLocalUserId
48
+ } from "./chunk-UBOTXA3Z.js";
17
49
  import {
18
50
  applyToolSurfaceConstraints
19
- } from "./chunk-JCQ3WCQ3.js";
51
+ } from "./chunk-FOC4TORM.js";
20
52
  import {
21
53
  ownedAgentKey
22
54
  } from "./chunk-M2EJHDJP.js";
23
55
  import {
24
56
  asTrimmedNonEmptyStringArray
25
57
  } from "./chunk-I42VC5KR.js";
58
+ import {
59
+ asTrimmedString
60
+ } from "./chunk-3EUW3WEO.js";
26
61
  import {
27
62
  asOptionalPositiveFiniteNumber
28
63
  } from "./chunk-U6VC4MU4.js";
64
+ import {
65
+ isRecord
66
+ } from "./chunk-KUG52IAP.js";
29
67
  import {
30
68
  parseUserIdFromAuthToken
31
- } from "./chunk-BIDSIRTS.js";
69
+ } from "./chunk-LTCZOOAM.js";
32
70
  import {
33
71
  DEFAULT_NOLO_SERVER_URL
34
- } from "./chunk-OLZBQWZU.js";
72
+ } from "./chunk-RF576RYE.js";
73
+ import {
74
+ asOptionalTrimmedString
75
+ } from "./chunk-G3SUCT4W.js";
35
76
  import {
36
77
  readPipeText,
37
78
  spawnProcess
38
79
  } from "./chunk-4O22PGNQ.js";
39
80
  import {
40
81
  t
41
- } from "./chunk-FEIVARWR.js";
42
- import {
43
- toErrorMessage
44
- } from "./chunk-HNMXYYJR.js";
45
- import {
46
- asTrimmedString
47
- } from "./chunk-3EUW3WEO.js";
48
- import {
49
- isRecord
50
- } from "./chunk-KUG52IAP.js";
82
+ } from "./chunk-RIOAPUGV.js";
83
+
84
+ // packages/cli/machineWsRunDispatch.ts
85
+ import { randomUUID } from "node:crypto";
86
+ import { readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
87
+ import { join as join4, resolve as resolve2 } from "node:path";
88
+
89
+ // packages/cli/connectorInstanceLock.ts
51
90
  import {
52
- asOptionalTrimmedString
53
- } from "./chunk-G3SUCT4W.js";
91
+ closeSync,
92
+ mkdirSync,
93
+ openSync,
94
+ readFileSync,
95
+ renameSync,
96
+ statSync,
97
+ unlinkSync,
98
+ writeFileSync
99
+ } from "node:fs";
100
+ import { homedir } from "node:os";
101
+ import { join } from "node:path";
102
+ function resolveConnectorStateDir(args = {}) {
103
+ const homeDir = args.homeDir?.trim();
104
+ if (homeDir) return join(homeDir, ".nolo", "connector");
105
+ const noloHome = args.noloHome?.trim() || process.env.NOLO_HOME?.trim();
106
+ if (noloHome) return join(noloHome, "connector");
107
+ return join(homedir(), ".nolo", "connector");
108
+ }
109
+ function sanitizeMachineId(machineId) {
110
+ const safe = String(machineId ?? "").replace(/[^A-Za-z0-9._-]/g, "_");
111
+ return safe || "unknown";
112
+ }
113
+ function connectorInstanceLockPath(args) {
114
+ return join(resolveConnectorStateDir(args), `${sanitizeMachineId(args.machineId)}.lock`);
115
+ }
116
+ function connectorAliveSignalPath(args) {
117
+ return join(resolveConnectorStateDir(args), `${sanitizeMachineId(args.machineId)}.alive`);
118
+ }
119
+ function isProcessAlive(pid) {
120
+ if (!Number.isInteger(pid) || pid <= 0) return false;
121
+ try {
122
+ process.kill(pid, 0);
123
+ return true;
124
+ } catch (error) {
125
+ return error?.code === "EPERM";
126
+ }
127
+ }
128
+ function readLockPid(lockPath) {
129
+ let raw;
130
+ try {
131
+ raw = readFileSync(lockPath, "utf8");
132
+ } catch {
133
+ return null;
134
+ }
135
+ try {
136
+ const parsed = JSON.parse(raw);
137
+ const pid = Number(parsed?.pid);
138
+ return Number.isInteger(pid) && pid > 0 ? pid : null;
139
+ } catch {
140
+ return null;
141
+ }
142
+ }
143
+ function isEexist(error) {
144
+ return error?.code === "EEXIST";
145
+ }
146
+ var CONNECTOR_LOCK_CORRUPT_RECLAIM_SECONDS = 300;
147
+ function inspectCorruptLock(lockPath, now = Date.now()) {
148
+ try {
149
+ const stat = statSync(lockPath);
150
+ const ageMs = now - stat.mtimeMs;
151
+ return ageMs > CONNECTOR_LOCK_CORRUPT_RECLAIM_SECONDS * 1e3 ? "expired" : "fresh";
152
+ } catch (error) {
153
+ const code = error?.code;
154
+ if (code === "ENOENT") return "gone";
155
+ return "fresh";
156
+ }
157
+ }
158
+ function acquireConnectorInstanceLock(args) {
159
+ const lockPath = connectorInstanceLockPath(args);
160
+ mkdirSync(resolveConnectorStateDir(args), { recursive: true });
161
+ let reclaimed;
162
+ for (let attempt = 0; attempt < 2; attempt += 1) {
163
+ let fd = null;
164
+ try {
165
+ fd = openSync(lockPath, "wx");
166
+ } catch (error) {
167
+ if (!isEexist(error)) throw error;
168
+ const ownerPid2 = readLockPid(lockPath);
169
+ if (ownerPid2 !== null) {
170
+ if (isProcessAlive(ownerPid2)) {
171
+ return { ok: false, pid: ownerPid2 };
172
+ }
173
+ try {
174
+ unlinkSync(lockPath);
175
+ } catch {
176
+ }
177
+ continue;
178
+ }
179
+ const state = inspectCorruptLock(lockPath);
180
+ if (state === "gone") {
181
+ continue;
182
+ }
183
+ if (state === "fresh") {
184
+ return { ok: false, pid: 0 };
185
+ }
186
+ try {
187
+ unlinkSync(lockPath);
188
+ } catch {
189
+ }
190
+ reclaimed = "corrupt";
191
+ continue;
192
+ }
193
+ try {
194
+ writeFileSync(fd, JSON.stringify({ pid: process.pid, startedAt: Date.now() }), "utf8");
195
+ } finally {
196
+ closeSync(fd);
197
+ }
198
+ return {
199
+ ok: true,
200
+ release: () => releaseConnectorInstanceLock(lockPath),
201
+ ...reclaimed ? { reclaimed } : {}
202
+ };
203
+ }
204
+ const ownerPid = readLockPid(lockPath);
205
+ return { ok: false, pid: ownerPid ?? 0 };
206
+ }
207
+ function releaseConnectorInstanceLock(lockPath) {
208
+ const ownerPid = readLockPid(lockPath);
209
+ if (ownerPid !== process.pid) return;
210
+ try {
211
+ unlinkSync(lockPath);
212
+ } catch {
213
+ }
214
+ }
215
+ function markConnectorAlive(args) {
216
+ const path = connectorAliveSignalPath(args);
217
+ try {
218
+ mkdirSync(resolveConnectorStateDir(args), { recursive: true });
219
+ const tmpPath = `${path}.${process.pid}.tmp`;
220
+ writeFileSync(tmpPath, String(Date.now()), "utf8");
221
+ try {
222
+ renameSync(tmpPath, path);
223
+ } catch (error) {
224
+ try {
225
+ unlinkSync(tmpPath);
226
+ } catch {
227
+ }
228
+ throw error;
229
+ }
230
+ } catch {
231
+ }
232
+ }
233
+ function clearConnectorAlive(args) {
234
+ try {
235
+ unlinkSync(connectorAliveSignalPath(args));
236
+ } catch {
237
+ }
238
+ }
239
+ function withConnectorAliveSignal(sendHeartbeat, args) {
240
+ return async () => {
241
+ const result = await sendHeartbeat();
242
+ markConnectorAlive(args);
243
+ return result;
244
+ };
245
+ }
246
+
247
+ // packages/agent-runtime/connectorWorkspaceRequest.ts
248
+ function isConnectorWorkspacePathHint(value) {
249
+ return typeof value === "string" && value.trim().length > 0 && !value.includes("\0");
250
+ }
251
+ function isConnectorWorkspaceRequest(value) {
252
+ if (!value || typeof value !== "object") return false;
253
+ const request = value;
254
+ return request.mode === "strict" && isConnectorWorkspacePathHint(request.path);
255
+ }
256
+
257
+ // packages/cli/connectorWorkspaceCwd.ts
258
+ import { realpathSync, statSync as statSync2 } from "node:fs";
259
+ import { isAbsolute } from "node:path";
260
+ var ConnectorWorkspaceError = class extends Error {
261
+ constructor(code, message) {
262
+ super(message);
263
+ this.code = code;
264
+ this.name = "ConnectorWorkspaceError";
265
+ }
266
+ };
267
+ function realDirectory(path) {
268
+ if (!isAbsolute(path)) throw new ConnectorWorkspaceError("workspace_path_unauthorized", "Workspace directory must be absolute.");
269
+ try {
270
+ const real = realpathSync(path);
271
+ if (statSync2(real).isDirectory()) return real;
272
+ } catch (err) {
273
+ const code = err.code;
274
+ if (code !== "ENOENT" && code !== "ENOTDIR") {
275
+ throw new ConnectorWorkspaceError("workspace_path_unauthorized", "Workspace directory could not be authorized.");
276
+ }
277
+ }
278
+ throw new ConnectorWorkspaceError("workspace_path_missing", "Workspace directory does not exist or is not a directory.");
279
+ }
280
+ function connectorWorkspaceIsWithinRoots(realCwd, roots) {
281
+ return roots.map((root) => {
282
+ try {
283
+ return realDirectory(root);
284
+ } catch {
285
+ return null;
286
+ }
287
+ }).some((root) => root !== null && isPathInsideRoot(root, realCwd));
288
+ }
289
+ function resolveAuthorizedConnectorWorkspaceCwd(path, roots) {
290
+ const realCwd = realDirectory(path);
291
+ if (!connectorWorkspaceIsWithinRoots(realCwd, roots)) {
292
+ throw new ConnectorWorkspaceError("workspace_path_unauthorized", "Workspace directory is outside authorized roots.");
293
+ }
294
+ return realCwd;
295
+ }
54
296
 
55
297
  // packages/ai/agent/machineRunPermissions.ts
56
298
  var DEFAULT_POLICY = {
@@ -75,7 +317,7 @@ function resolveMachineRunPermissionPolicy(agentConfig) {
75
317
  return {
76
318
  mode,
77
319
  allowFilesystemRead: raw.allowFilesystemRead !== false,
78
- allowFilesystemWrite: true,
320
+ allowFilesystemWrite: raw.allowFilesystemWrite !== false,
79
321
  allowShell: raw.allowShell !== false,
80
322
  writableRoots: normalizeWritableRoots(raw.writableRoots)
81
323
  };
@@ -139,7 +381,7 @@ function resolveConnectorRunCwd(args) {
139
381
  var RUN_GIT_TIMEOUT_MS = 1e4;
140
382
  async function runGit(args, cwd, options = {}) {
141
383
  const proc = spawnProcess({
142
- cmd: ["git", ...args],
384
+ cmd: options.workspaceOnly ? ["git", "--literal-pathspecs", "-c", "core.fsmonitor=false", "-c", "core.hooksPath=", ...args] : ["git", ...args],
143
385
  cwd,
144
386
  stdout: "pipe",
145
387
  stderr: "pipe",
@@ -153,14 +395,14 @@ async function runGit(args, cwd, options = {}) {
153
395
  readPipeText(proc.stderr),
154
396
  // 超时保险丝:该路径历史上出过「进程不退出」类挂死(见上);超时 kill 后流关闭、
155
397
  // Promise.all 收敛,-1 与真实非零退出一样走「无数据」降级。
156
- new Promise((resolve2) => {
398
+ new Promise((resolve3) => {
157
399
  const timer = setTimeout(() => {
158
400
  proc.kill();
159
- resolve2(-1);
401
+ resolve3(-1);
160
402
  }, RUN_GIT_TIMEOUT_MS);
161
403
  void proc.exited.then((code) => {
162
404
  clearTimeout(timer);
163
- resolve2(code);
405
+ resolve3(code);
164
406
  });
165
407
  })
166
408
  ]);
@@ -176,17 +418,22 @@ function parseStatusChangedFiles(statusShort) {
176
418
  return trimmedMatch?.[1]?.trim() ?? "";
177
419
  }).map((line) => line.includes(" -> ") ? line.split(" -> ").at(-1) ?? line : line).filter(Boolean))];
178
420
  }
179
- async function readConnectorGitHead(cwd) {
180
- return runGit(["rev-parse", "HEAD"], cwd);
421
+ async function readConnectorGitHead(cwd, options) {
422
+ return runGit(["rev-parse", "HEAD"], cwd, options);
181
423
  }
182
424
  async function collectConnectorRunArtifact(args) {
183
425
  const collectedAt = (/* @__PURE__ */ new Date()).toISOString();
184
426
  try {
427
+ const scope = args.workspaceOnly ? ["--", "."] : [];
428
+ const submoduleOptions = args.workspaceOnly ? ["--ignore-submodules=all"] : [];
429
+ const untrackedOptions = args.workspaceOnly ? ["--untracked-files=all"] : [];
430
+ const diffOptions = args.workspaceOnly ? ["--no-ext-diff", "--no-textconv", ...submoduleOptions] : [];
431
+ const options = { workspaceOnly: args.workspaceOnly };
185
432
  const [headSha, statusShort, diffStat, patchText] = await Promise.all([
186
- readConnectorGitHead(args.cwd),
187
- runGit(["status", "--short"], args.cwd, { trim: false }),
188
- runGit(["diff", "--stat"], args.cwd),
189
- runGit(["diff", "--no-color", "--unified=3"], args.cwd)
433
+ readConnectorGitHead(args.cwd, options),
434
+ runGit(["status", "--short", ...submoduleOptions, ...untrackedOptions, ...scope], args.cwd, { ...options, trim: false }),
435
+ runGit(["diff", "--stat", ...diffOptions, ...scope], args.cwd, options),
436
+ runGit(["diff", "--no-color", "--unified=3", ...diffOptions, ...scope], args.cwd, options)
190
437
  ]);
191
438
  const patchPreview = patchText ? clipMultilineText(patchText, MAX_PATCH_PREVIEW_CHARS) || void 0 : void 0;
192
439
  return {
@@ -215,8 +462,8 @@ async function collectConnectorRunArtifact(args) {
215
462
 
216
463
  // packages/cli/machineWsPromptMaterialization.ts
217
464
  import { createHash } from "node:crypto";
218
- import { mkdirSync, writeFileSync } from "node:fs";
219
- import { join } from "node:path";
465
+ import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
466
+ import { join as join2 } from "node:path";
220
467
  var CLOUD_PROMPT_PAGE_READ_COMMAND = "bun packages/cli/index.ts doc read";
221
468
  function byteLength(value) {
222
469
  return Buffer.byteLength(value, "utf8");
@@ -240,10 +487,10 @@ function materializeLargeConnectorPrompt(args) {
240
487
  promptRef: null
241
488
  };
242
489
  }
243
- const promptDir = join(args.cwd, ".nolo", "agent-prompts");
244
- mkdirSync(promptDir, { recursive: true });
245
- const promptRef = join(promptDir, `${args.requestId}-${promptHash}.md`);
246
- writeFileSync(promptRef, args.prompt, "utf8");
490
+ const promptDir = join2(args.cwd, ".nolo", "agent-prompts");
491
+ mkdirSync2(promptDir, { recursive: true });
492
+ const promptRef = join2(promptDir, `${args.requestId}-${promptHash}.md`);
493
+ writeFileSync2(promptRef, args.prompt, "utf8");
247
494
  return {
248
495
  prompt: [
249
496
  "A large Nolo runtime prompt has been materialized outside this command argument.",
@@ -279,6 +526,12 @@ function readRuntimePromptPageMeta(parsed) {
279
526
  }
280
527
 
281
528
  // packages/cli/machineWsRunDispatchPurity.ts
529
+ var WindowsConnectorCliFencingUnsupportedError = class extends Error {
530
+ code = "connector_windows_cli_fencing_unsupported";
531
+ constructor() {
532
+ super("Windows Connector CLI process-tree isolation is not enabled; Windows Job Object support is required for dialog turns.");
533
+ }
534
+ };
282
535
  function logConnectorRun(message, fields = {}) {
283
536
  console.error(`[nolo-connector] ${message} ${JSON.stringify(fields)}`);
284
537
  }
@@ -365,6 +618,26 @@ function runtimeWorkspacePermissionPolicy(runtimePolicy, runtimeEnv, cwd) {
365
618
  writableRoots: [cwd]
366
619
  };
367
620
  }
621
+ var STRICT_READ_TOOLS = ["readFile"];
622
+ var STRICT_WRITE_TOOLS = ["writeFile", "editFile"];
623
+ function strictConnectorWorkspacePolicy(machine, runtime, cwd) {
624
+ const runtimeTools = Array.isArray(runtime?.runtimeTools) ? runtime.runtimeTools : [];
625
+ const withinRuntimeRoots = (roots) => roots === void 0 || Array.isArray(roots) && connectorWorkspaceIsWithinRoots(cwd, roots);
626
+ const allowFilesystemWrite = machine.allowFilesystemWrite && connectorWorkspaceIsWithinRoots(cwd, machine.writableRoots) && withinRuntimeRoots(runtime?.workspace?.writableRoots) && STRICT_WRITE_TOOLS.some((tool) => runtimeTools.includes(tool));
627
+ return {
628
+ mode: allowFilesystemWrite ? "full_access" : "read_only",
629
+ allowFilesystemRead: machine.allowFilesystemRead && withinRuntimeRoots(runtime?.workspace?.readableRoots),
630
+ allowFilesystemWrite,
631
+ allowShell: false,
632
+ writableRoots: allowFilesystemWrite ? [cwd] : []
633
+ };
634
+ }
635
+ function strictConnectorWorkspaceToolNames(permission, runtime) {
636
+ return [
637
+ ...permission.allowFilesystemRead ? STRICT_READ_TOOLS : [],
638
+ ...permission.allowFilesystemWrite ? STRICT_WRITE_TOOLS.filter((tool) => tool !== "editFile" || permission.allowFilesystemRead) : []
639
+ ].filter((tool) => Array.isArray(runtime?.runtimeTools) && runtime.runtimeTools.includes(tool));
640
+ }
368
641
  function scopePermissionPolicyToRuntimeWorkspace(policy, runtimePolicy, cwd) {
369
642
  if (!requestsLocalWorkspaceRuntime(runtimePolicy)) return policy;
370
643
  return {
@@ -445,6 +718,31 @@ function buildArtifactProgress(args) {
445
718
  updatedAt: Date.now()
446
719
  };
447
720
  }
721
+ function createStrictConnectorWorkspaceExecutor(cwd, env, toolNames) {
722
+ const executors = createLocalWorkspaceToolExecutors({
723
+ workspaceRoot: cwd,
724
+ confirmExternalFileAccess: async () => false,
725
+ denyExternalReadSpills: true
726
+ });
727
+ const allowedExecutors = Object.fromEntries(Object.entries(executors).filter(([name]) => toolNames.includes(name)));
728
+ return (call, opts) => executeLocalToolWithPolicy({
729
+ env,
730
+ call,
731
+ runToolNames: toolNames,
732
+ agentToolNames: toolNames,
733
+ executors: allowedExecutors,
734
+ workspaceRoot: cwd,
735
+ abortSignal: opts?.abortSignal
736
+ });
737
+ }
738
+ function normalizeConnectorLocalAgentConfig(config) {
739
+ const { apiSource, provider } = config;
740
+ return {
741
+ ...config,
742
+ apiSource: typeof apiSource === "string" ? apiSource : "platform",
743
+ provider: typeof provider === "string" ? provider : typeof apiSource === "string" ? apiSource : "openai"
744
+ };
745
+ }
448
746
  async function defaultRunConnectorLocalRuntimeAgent(args) {
449
747
  const obj = asRecordOrEmpty(args.parsed);
450
748
  const payload = asRecordOrEmpty(obj.payload);
@@ -452,7 +750,9 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
452
750
  const agentKey = typeof agentKeyRaw === "string" ? agentKeyRaw : "";
453
751
  const agentConfigRaw = readField(payload, "agentConfig");
454
752
  const payloadAgentConfig = asRecordOrEmpty(agentConfigRaw);
455
- const policy = runtimePolicyFromConnectorPayload(args.parsed);
753
+ const runtimePolicy = runtimePolicyFromConnectorPayload(args.parsed);
754
+ const strictNames = args.strictPermission ? strictConnectorWorkspaceToolNames(args.strictPermission, runtimePolicy) : void 0;
755
+ const policy = strictNames ? { ...runtimePolicy, runtimeTools: strictNames, agentTools: [], workspace: { mode: "current", cwd: args.cwd }, shell: { enabled: false } } : runtimePolicy;
456
756
  const candidateToolNames = mergeToolNames(
457
757
  readField(payloadAgentConfig, "toolNames"),
458
758
  readField(payloadAgentConfig, "tools"),
@@ -460,23 +760,20 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
460
760
  policy?.runtimeTools
461
761
  );
462
762
  const runtimeContext = asRecordOrEmpty(readField(payload, "runtimeContext"));
463
- const constrainedSurface = applyToolSurfaceConstraints(
763
+ const requestedSurface = applyToolSurfaceConstraints(
464
764
  { explicitToolNames: candidateToolNames, injectedToolNames: [], finalToolNames: candidateToolNames },
465
765
  {
466
766
  allowedToolNames: Array.isArray(readField(runtimeContext, "allowedToolNames")) ? readField(runtimeContext, "allowedToolNames") : void 0,
467
767
  blockedToolNames: Array.isArray(readField(runtimeContext, "blockedToolNames")) ? readField(runtimeContext, "blockedToolNames") : void 0
468
768
  }
469
769
  );
770
+ const constrainedSurface = strictNames ? applyToolSurfaceConstraints(requestedSurface, { allowedToolNames: strictNames }) : requestedSurface;
470
771
  const toolNames = constrainedSurface.finalToolNames;
471
- const apiSourceRaw = readField(payloadAgentConfig, "apiSource");
472
- const providerRaw = readField(payloadAgentConfig, "provider");
473
772
  const agentRecord = {
474
- ...payloadAgentConfig,
773
+ ...normalizeConnectorLocalAgentConfig(payloadAgentConfig),
475
774
  dbKey: agentKey,
476
775
  id: agentKey,
477
776
  key: agentKey,
478
- apiSource: typeof apiSourceRaw === "string" ? apiSourceRaw : "platform",
479
- provider: typeof providerRaw === "string" ? providerRaw : typeof apiSourceRaw === "string" ? apiSourceRaw : "openai",
480
777
  toolNames,
481
778
  runScopedToolSurface: constrainedSurface,
482
779
  ...policy ? { runtimeToolPolicy: policy } : {}
@@ -500,32 +797,84 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
500
797
  cwd: args.cwd,
501
798
  ...summarizeRuntimePolicyForLogs(policy)
502
799
  });
503
- const adapter = createCliLocalRuntimeAdapter({
800
+ if (args.dialogTurnLease && !args.sharedStore) {
801
+ throw new Error("Connector dialog turn lease requires a shared record store");
802
+ }
803
+ const leaseRef = args.dialogTurnLease?.dialogRef;
804
+ const leasedDialogKey = leaseRef && `dialog-${leaseRef.userId}-${leaseRef.dialogId}`;
805
+ const persistentStore = args.sharedStore ?? await getOrCreateSharedStore({
504
806
  env,
505
807
  cwd: args.cwd,
506
- fetchImpl: args.fetchImpl ?? fetch,
507
- store: {
508
- read: async (key) => store.get(key) ?? null,
509
- write: async (key, value) => {
808
+ fetchImpl: args.fetchImpl ?? fetch
809
+ });
810
+ const isAgentOverrideKey = (key) => store.has(key) || key.startsWith("agent-");
811
+ const compositeStore = propagateLocalDialogTurnAuthority(persistentStore, {
812
+ read: async (key, options) => {
813
+ if (store.has(key)) return store.get(key) ?? null;
814
+ return persistentStore.read(key, key === leasedDialogKey ? { ...options, remote: false } : options);
815
+ },
816
+ write: async (key, value) => {
817
+ if (isAgentOverrideKey(key)) {
510
818
  store.set(key, value);
511
819
  return value;
512
- },
513
- batch: async (ops) => {
514
- for (const op of ops) {
515
- if (op.type === "put") store.set(op.key, op.value);
820
+ }
821
+ return persistentStore.write(key, value);
822
+ },
823
+ batch: async (ops) => {
824
+ const persistentOps = [];
825
+ for (const op of ops) {
826
+ if (op.type === "put" && isAgentOverrideKey(op.key)) {
827
+ store.set(op.key, op.value);
828
+ } else {
829
+ persistentOps.push(op);
516
830
  }
517
- },
518
- iterator: async function* (options) {
519
- const keys = [...store.keys()].sort();
520
- for (const key of keys) {
521
- if (key < options.gte) continue;
522
- if (options.lte && key > options.lte) continue;
523
- if (options.lt && key >= options.lt) continue;
831
+ }
832
+ if (persistentOps.length > 0) {
833
+ await persistentStore.batch(persistentOps);
834
+ }
835
+ },
836
+ iterator: async function* (options) {
837
+ const yielded = /* @__PURE__ */ new Set();
838
+ for await (const [key, value] of persistentStore.iterator(options)) {
839
+ yielded.add(key);
840
+ if (store.has(key)) {
524
841
  yield [key, store.get(key)];
842
+ } else {
843
+ yield [key, value];
525
844
  }
526
845
  }
527
- }
846
+ const keys = [...store.keys()].sort();
847
+ for (const key of keys) {
848
+ if (yielded.has(key)) continue;
849
+ if (key < options.gte) continue;
850
+ if (options.lte && key > options.lte) continue;
851
+ if (options.lt && key >= options.lt) continue;
852
+ yield [key, store.get(key)];
853
+ }
854
+ },
855
+ ...typeof persistentStore.conditionalPut === "function" ? {
856
+ conditionalPut: (key, expectedRevision, value) => {
857
+ if (isAgentOverrideKey(key)) {
858
+ throw new Error("conditionalPut is not supported for agent override keys");
859
+ }
860
+ return persistentStore.conditionalPut(key, expectedRevision, value);
861
+ }
862
+ } : {}
528
863
  });
864
+ const baseAdapter = createCliLocalRuntimeAdapter({
865
+ env,
866
+ cwd: args.cwd,
867
+ fetchImpl: args.fetchImpl ?? fetch,
868
+ store: compositeStore
869
+ });
870
+ const withStrictAdapter = strictNames ? { ...baseAdapter, executeTool: createStrictConnectorWorkspaceExecutor(args.cwd, env, toolNames) } : baseAdapter;
871
+ const adapter = args.dialogTurnLease ? {
872
+ ...withStrictAdapter,
873
+ saveTurn: (input) => withStrictAdapter.saveTurn({
874
+ ...input,
875
+ cliDialogTurn: args.dialogTurnLease
876
+ })
877
+ } : withStrictAdapter;
529
878
  let toolCallCount = 0;
530
879
  let toolResultCount = 0;
531
880
  const lastToolNames = [];
@@ -540,14 +889,38 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
540
889
  };
541
890
  const userInputRaw = readField(payload, "userInput");
542
891
  const continueDialogIdRaw = readField(payload, "continueDialogId");
892
+ const pending = /* @__PURE__ */ new Set();
893
+ const track = (operation) => {
894
+ const stopped2 = operation.then((value) => getExecutionStoppedPromise(value), (error) => getExecutionStoppedPromise(error) ?? Promise.resolve());
895
+ pending.add(stopped2);
896
+ void stopped2.then(() => pending.delete(stopped2), () => {
897
+ });
898
+ return operation;
899
+ };
900
+ const trackedAdapter = {
901
+ ...adapter,
902
+ resolveProvider: async (...params) => {
903
+ const provider = await adapter.resolveProvider(...params);
904
+ if (args.blockLocalCli && provider.transport === "local-cli") {
905
+ throw new WindowsConnectorCliFencingUnsupportedError();
906
+ }
907
+ return { ...provider, complete: (...input) => track(provider.complete(...input)) };
908
+ },
909
+ executeTool: (...params) => track(adapter.executeTool(...params))
910
+ };
543
911
  const result = await runLocalAgentTurn({
544
- adapter,
912
+ adapter: trackedAdapter,
545
913
  userLanguage: args.runtimeEnv.NOLO_LANG ?? null,
546
914
  agentRef: agentKey,
547
915
  input: typeof userInputRaw === "string" ? userInputRaw : "",
548
- continueDialogId: typeof continueDialogIdRaw === "string" ? continueDialogIdRaw : void 0,
916
+ continueDialogId: typeof continueDialogIdRaw === "string" ? continueDialogIdRaw : args.onStreamEvent ? args.dialogTurnLease?.dialogRef.dialogId : void 0,
549
917
  ...args.abortSignal ? { abortSignal: args.abortSignal } : {},
918
+ ...args.onStreamEvent ? {
919
+ onTextDelta: (content) => args.onStreamEvent?.({ type: "text", content }),
920
+ onReasoningDelta: (content) => args.onStreamEvent?.({ type: "reasoning", content })
921
+ } : {},
550
922
  onToolEvent: (event) => {
923
+ args.onStreamEvent?.({ type: event.type, toolCallId: event.toolCallId, toolName: event.toolName });
551
924
  if (event.type === "tool-call") toolCallCount += 1;
552
925
  if (event.type === "tool-result") toolResultCount += 1;
553
926
  noteToolName(event.toolName);
@@ -567,11 +940,24 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
567
940
  updatedAt: Date.now()
568
941
  });
569
942
  }
943
+ }).catch((error) => {
944
+ if (!pending.size) throw error;
945
+ const stopped2 = Promise.all(pending).then(() => {
946
+ });
947
+ void stopped2.catch(() => {
948
+ });
949
+ throw attachExecutionStoppedPromise(error instanceof Error ? error : new Error(String(error)), stopped2);
570
950
  });
571
- return {
951
+ const outcome = {
572
952
  ...result,
573
953
  runtimeWorkspaceRoot: runtimeWorkspaceRootFromTrace(result.trace) ?? runtimeWorkspaceRoot
574
954
  };
955
+ if (!pending.size) return outcome;
956
+ const stopped = Promise.all(pending).then(() => {
957
+ });
958
+ void stopped.catch(() => {
959
+ });
960
+ return attachExecutionStoppedPromise(outcome, stopped);
575
961
  }
576
962
  function normalizeConnectorRunTimeoutMs(value) {
577
963
  const finite = asOptionalPositiveFiniteNumber(value);
@@ -621,14 +1007,14 @@ function extractMultimodalUserInput(userInput) {
621
1007
 
622
1008
  // packages/cli/chatgptWebImageLocalJob.ts
623
1009
  import {
624
- mkdirSync as mkdirSync2,
625
- readFileSync,
626
- statSync,
627
- unlinkSync,
628
- writeFileSync as writeFileSync2
1010
+ mkdirSync as mkdirSync3,
1011
+ readFileSync as readFileSync2,
1012
+ statSync as statSync3,
1013
+ unlinkSync as unlinkSync2,
1014
+ writeFileSync as writeFileSync3
629
1015
  } from "node:fs";
630
- import { homedir } from "node:os";
631
- import { basename, dirname, join as join2 } from "node:path";
1016
+ import { homedir as homedir2 } from "node:os";
1017
+ import { basename, dirname, join as join3 } from "node:path";
632
1018
  var CHATGPT_WEB_IMAGE_LOCAL_JOB = "chatgptWebImageGenerate";
633
1019
  function readChatgptWebImageLocalJobMeta(payload) {
634
1020
  if (!isRecord(payload)) return null;
@@ -644,15 +1030,15 @@ function readChatgptWebImageLocalJobMeta(payload) {
644
1030
  };
645
1031
  }
646
1032
  function defaultLockPath(home) {
647
- return join2(home, ".nolo", "chatgpt-web-image.lock");
1033
+ return join3(home, ".nolo", "chatgpt-web-image.lock");
648
1034
  }
649
1035
  function defaultOutDir(home) {
650
- return join2(home, "nolo-image-lab", "out");
1036
+ return join3(home, "nolo-image-lab", "out");
651
1037
  }
652
1038
  function acquireChatgptWebImageLock(lockPath) {
653
- mkdirSync2(dirname(lockPath), { recursive: true });
1039
+ mkdirSync3(dirname(lockPath), { recursive: true });
654
1040
  try {
655
- writeFileSync2(lockPath, `${process.pid}
1041
+ writeFileSync3(lockPath, `${process.pid}
656
1042
  ${Date.now()}
657
1043
  `, { flag: "wx" });
658
1044
  } catch (error) {
@@ -664,7 +1050,7 @@ ${Date.now()}
664
1050
  }
665
1051
  return () => {
666
1052
  try {
667
- unlinkSync(lockPath);
1053
+ unlinkSync2(lockPath);
668
1054
  } catch {
669
1055
  }
670
1056
  };
@@ -708,7 +1094,7 @@ async function runOracleGenerateImage(args) {
708
1094
  function assertOutputImage(outPath) {
709
1095
  let st;
710
1096
  try {
711
- st = statSync(outPath);
1097
+ st = statSync3(outPath);
712
1098
  } catch {
713
1099
  throw new Error(t("chatgptWebImage.noOutputFile", outPath));
714
1100
  }
@@ -717,7 +1103,7 @@ function assertOutputImage(outPath) {
717
1103
  }
718
1104
  }
719
1105
  async function uploadPngToNoloFs(args) {
720
- const bytes = readFileSync(args.outPath);
1106
+ const bytes = readFileSync2(args.outPath);
721
1107
  const form = new FormData();
722
1108
  const fileName = basename(args.outPath) || "chatgpt-web.png";
723
1109
  form.append(
@@ -770,14 +1156,14 @@ async function runChatgptWebImageLocalJob(input, deps = {}) {
770
1156
  if (!prompt) {
771
1157
  throw new Error(t("chatgptWebImage.missingPrompt"));
772
1158
  }
773
- const home = (deps.homedir ?? homedir)();
1159
+ const home = (deps.homedir ?? homedir2)();
774
1160
  const lockPath = deps.lockPath ?? defaultLockPath(home);
775
1161
  const outDir = deps.outDir ?? defaultOutDir(home);
776
1162
  const release = acquireChatgptWebImageLock(lockPath);
777
1163
  try {
778
- mkdirSync2(outDir, { recursive: true });
1164
+ mkdirSync3(outDir, { recursive: true });
779
1165
  const stamp = (deps.now ?? Date.now)();
780
- const outPath = join2(outDir, `chatgpt-web-${stamp}.png`);
1166
+ const outPath = join3(outDir, `chatgpt-web-${stamp}.png`);
781
1167
  await runOracleGenerateImage({
782
1168
  prompt,
783
1169
  outPath,
@@ -823,7 +1209,70 @@ async function runChatgptWebImageLocalJob(input, deps = {}) {
823
1209
 
824
1210
  // packages/cli/machineWsRunDispatch.ts
825
1211
  var activeRunAbortControllers = /* @__PURE__ */ new Map();
826
- async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv, fetchImpl, deps = {}) {
1212
+ var pendingLeaseReleases = /* @__PURE__ */ new Map();
1213
+ var maxPendingLeaseReleases = 1024;
1214
+ function __setConnectorLeaseRecoveryCapacityForTest(capacity) {
1215
+ maxPendingLeaseReleases = capacity;
1216
+ }
1217
+ var pendingLeaseReleaseCount = 0;
1218
+ var releaseKey = (file, { userId, dialogId }) => JSON.stringify([file, userId, dialogId]);
1219
+ function readPendingReleases(file) {
1220
+ let raw;
1221
+ try {
1222
+ raw = readFileSync3(file, "utf8");
1223
+ } catch (error) {
1224
+ if (error.code === "ENOENT") return [];
1225
+ throw error;
1226
+ }
1227
+ const value = JSON.parse(raw);
1228
+ if (!Array.isArray(value)) throw new Error("Invalid Connector pending lease release file");
1229
+ return value.filter((entry) => isRecord(entry) && isDialogTurnRef(entry.dialogRef) && typeof entry.runToken === "string" && entry.runToken.length > 0);
1230
+ }
1231
+ async function updatePendingReleases(file, update) {
1232
+ try {
1233
+ await withQueueLock(file, () => {
1234
+ const entries = readPendingReleases(file);
1235
+ const next = update(entries);
1236
+ if (entries === next || !entries.length && !next.length) return;
1237
+ const temp = `${file}.${randomUUID()}.tmp`;
1238
+ writeFileSync4(temp, JSON.stringify(next), { encoding: "utf8", mode: 384, flag: "wx" });
1239
+ renameSync2(temp, file);
1240
+ });
1241
+ } catch (error) {
1242
+ logConnectorRun("agent.run.recovery.file_error", { error: toErrorMessage(error) });
1243
+ }
1244
+ }
1245
+ async function endConnectorTurn(authority, dialogRef, runToken, reason) {
1246
+ const { status } = await authority.endDialogTurn({ dialogRef, runToken, reason });
1247
+ if (status !== "ended" && status !== "already_idle" && status !== "token_mismatch") {
1248
+ throw new Error(`Connector turn release rejected (${status})`);
1249
+ }
1250
+ }
1251
+ async function recoverPendingLeaseReleases(authority, dialogRef, file) {
1252
+ const key = releaseKey(file, dialogRef);
1253
+ const cached = pendingLeaseReleases.get(key);
1254
+ const tokens = new Set(cached);
1255
+ try {
1256
+ for (const entry of readPendingReleases(file)) {
1257
+ if (releaseKey(file, entry.dialogRef) === key) tokens.add(entry.runToken);
1258
+ }
1259
+ } catch (error) {
1260
+ logConnectorRun("agent.run.recovery.file_error", { error: toErrorMessage(error) });
1261
+ }
1262
+ const cleared = /* @__PURE__ */ new Set();
1263
+ for (const token of tokens) {
1264
+ try {
1265
+ await endConnectorTurn(authority, dialogRef, token, "pending_release_recovery");
1266
+ cleared.add(token);
1267
+ if (cached?.delete(token)) pendingLeaseReleaseCount--;
1268
+ } catch {
1269
+ }
1270
+ }
1271
+ if (cached && !cached.size && pendingLeaseReleases.get(key) === cached) pendingLeaseReleases.delete(key);
1272
+ if (cleared.size) await updatePendingReleases(file, (entries) => entries.filter((entry) => releaseKey(file, entry.dialogRef) !== key || !cleared.has(entry.runToken)));
1273
+ }
1274
+ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv, fetchImpl, deps = {}, sessionSignal) {
1275
+ if (sessionSignal?.aborted) return;
827
1276
  let parsed;
828
1277
  try {
829
1278
  parsed = JSON.parse(message);
@@ -833,17 +1282,21 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
833
1282
  if (!isRecord(parsed) || typeof parsed.requestId !== "string") return;
834
1283
  const requestId = parsed.requestId;
835
1284
  if (parsed.type === "agent.run.cancel") {
836
- const controller = activeRunAbortControllers.get(requestId);
837
- if (controller) {
838
- controller.abort(new Error("agent.run.cancel received from server"));
1285
+ const run = activeRunAbortControllers.get(requestId);
1286
+ if (run && run.sessionSignal === sessionSignal) {
1287
+ run.controller.abort(new Error("agent.run.cancel received from server"));
839
1288
  }
840
1289
  return;
841
1290
  }
842
- if (parsed.type !== "agent.run") return;
1291
+ const strictFrame = parsed.type === "agent.run.strict-workspace";
1292
+ if (parsed.type !== "agent.run" && !strictFrame) return;
843
1293
  const payload = asRecordOrEmpty(parsed.payload);
844
1294
  const agentConfig = asRecordOrEmpty(payload.agentConfig);
845
1295
  const runAbortController = new AbortController();
846
- activeRunAbortControllers.set(requestId, runAbortController);
1296
+ const activeRun = { controller: runAbortController, sessionSignal };
1297
+ activeRunAbortControllers.set(requestId, activeRun);
1298
+ const abortRunOnDisconnect = () => runAbortController.abort(sessionSignal?.reason);
1299
+ sessionSignal?.addEventListener("abort", abortRunOnDisconnect, { once: true });
847
1300
  const sendProgress = (progress) => {
848
1301
  send(JSON.stringify({
849
1302
  type: "agent.run.progress",
@@ -860,9 +1313,49 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
860
1313
  const readRuntimePromptPageMeta2 = deps.readRuntimePromptPageMeta ?? readRuntimePromptPageMeta;
861
1314
  const runConnectorLocalRuntimeAgent = deps.runConnectorLocalRuntimeAgent ?? defaultRunConnectorLocalRuntimeAgent;
862
1315
  const runChatgptWebImageLocalJob2 = deps.runChatgptWebImageLocalJob ?? runChatgptWebImageLocalJob;
1316
+ let pendingReleaseFile;
1317
+ let executionStopped;
1318
+ let connectorTurnAuthority;
1319
+ let connectorTurnLease;
1320
+ let connectorTurnHeartbeat;
1321
+ let terminalMessage;
1322
+ const stageTerminalResult = (body) => {
1323
+ terminalMessage = JSON.stringify({ type: "agent.run.result", requestId, ...body });
1324
+ };
1325
+ const releaseConnectorTurnLeaseWithRecovery = async (authority, { dialogRef, runToken }) => {
1326
+ const reason = runAbortController.signal.aborted ? "connector_aborted" : "connector_finally";
1327
+ for (let attempt = 1; ; attempt++) {
1328
+ try {
1329
+ await endConnectorTurn(authority, dialogRef, runToken, reason);
1330
+ return;
1331
+ } catch (error) {
1332
+ if (attempt === 3) {
1333
+ if (pendingReleaseFile) {
1334
+ const file = pendingReleaseFile;
1335
+ const key = releaseKey(file, dialogRef);
1336
+ const tokens = pendingLeaseReleases.get(key) ?? /* @__PURE__ */ new Set();
1337
+ if (!tokens.has(runToken) && pendingLeaseReleaseCount < maxPendingLeaseReleases) {
1338
+ tokens.add(runToken);
1339
+ pendingLeaseReleases.set(key, tokens);
1340
+ pendingLeaseReleaseCount++;
1341
+ }
1342
+ await updatePendingReleases(file, (entries) => entries.some((entry) => releaseKey(file, entry.dialogRef) === key && entry.runToken === runToken) ? entries : [...entries, { dialogRef, runToken }]);
1343
+ }
1344
+ throw error;
1345
+ }
1346
+ await new Promise((resolve3) => setTimeout(resolve3, 15 * attempt));
1347
+ }
1348
+ }
1349
+ };
863
1350
  try {
1351
+ const strictRequest = payload.workspaceRequest;
1352
+ if ((strictFrame || strictRequest !== void 0) && !isConnectorWorkspaceRequest(strictRequest)) {
1353
+ throw new ConnectorWorkspaceError("workspace_path_unauthorized", "Invalid strict workspace request.");
1354
+ }
1355
+ const workspaceRequest = isConnectorWorkspaceRequest(strictRequest) ? strictRequest : void 0;
864
1356
  const chatgptWebImageJob = readChatgptWebImageLocalJobMeta(payload);
865
1357
  if (chatgptWebImageJob) {
1358
+ if (workspaceRequest) throw new ConnectorWorkspaceError("workspace_execution_unsupported", "Local jobs cannot honor strict workspaces.");
866
1359
  logConnectorRun("agent.run.local-job.start", {
867
1360
  requestId,
868
1361
  localJob: "chatgptWebImageGenerate",
@@ -876,9 +1369,7 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
876
1369
  serverBase: chatgptWebImageJob.serverBase
877
1370
  });
878
1371
  const galleryRawData = jobResult.rawData;
879
- send(JSON.stringify({
880
- type: "agent.run.result",
881
- requestId,
1372
+ stageTerminalResult({
882
1373
  result: {
883
1374
  content: JSON.stringify(galleryRawData),
884
1375
  model: "chatgpt-web",
@@ -889,7 +1380,7 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
889
1380
  imageCount: galleryRawData.imageCount
890
1381
  }
891
1382
  }
892
- }));
1383
+ });
893
1384
  return;
894
1385
  }
895
1386
  const machinePermissionPolicy = resolveMachineRunPermissionPolicy2(agentConfig);
@@ -898,7 +1389,98 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
898
1389
  const userInput = extractedInput.text;
899
1390
  const connectorImageUrls = extractedInput.imageUrls;
900
1391
  const timeout = normalizeConnectorRunTimeoutMs(payload.timeoutMs);
901
- let cwd = resolveConnectorRunCwd2({ env: runtimeEnv, policy: machinePermissionPolicy });
1392
+ const hostRoot = runtimeEnv.NOLO_CONNECTOR_WORKDIR;
1393
+ const cwd = workspaceRequest ? resolveAuthorizedConnectorWorkspaceCwd(workspaceRequest.path, hostRoot ? [hostRoot] : machinePermissionPolicy.writableRoots) : resolveConnectorRunCwd2({ env: runtimeEnv, policy: machinePermissionPolicy });
1394
+ const strictPermission = workspaceRequest ? strictConnectorWorkspacePolicy(machinePermissionPolicy, runtimePolicy, cwd) : void 0;
1395
+ const effectiveRuntimeEnv = withForwardedUserAuthToken(runtimeEnv, parsed);
1396
+ const metaRecord = asRecordOrEmpty(readField2(payload, "meta"));
1397
+ const targetDialogId = asOptionalTrimmedString(readField2(payload, "continueDialogId")) ?? asOptionalTrimmedString(readField2(payload, "dialogId")) ?? asOptionalTrimmedString(readField2(metaRecord, "continueDialogId")) ?? asOptionalTrimmedString(readField2(metaRecord, "dialogId"));
1398
+ const targetUserId = resolveLocalUserId(effectiveRuntimeEnv);
1399
+ const dialogRef = { userId: targetUserId, dialogId: targetDialogId };
1400
+ const requiresLocalLease = isDialogTurnRef(dialogRef);
1401
+ const blockLocalCli = (deps.platform ?? process.platform) === "win32" && requiresLocalLease;
1402
+ if (blockLocalCli && isCliProviderAgentConfig(normalizeConnectorLocalAgentConfig(agentConfig))) {
1403
+ throw new WindowsConnectorCliFencingUnsupportedError();
1404
+ }
1405
+ if (strictPermission && (isCliProviderAgentConfig(agentConfig) || isCursorOAuthAgent({ apiKeyRef: asOptionalTrimmedString(agentConfig.apiKeyRef) }))) {
1406
+ throw new ConnectorWorkspaceError("workspace_execution_unsupported", "Provider cannot enforce strict workspace permissions.");
1407
+ }
1408
+ let connectorSharedStore = deps.sharedStore;
1409
+ const acquireConnectorTurnIfNeeded = async (keepTurnActive = false) => {
1410
+ if (!requiresLocalLease) {
1411
+ return true;
1412
+ }
1413
+ let authority = deps.dialogTurnAuthority;
1414
+ if (!authority && deps.getDialogTurnAuthority) {
1415
+ authority = await deps.getDialogTurnAuthority({ env: effectiveRuntimeEnv });
1416
+ }
1417
+ if (!authority) {
1418
+ connectorSharedStore ??= await getOrCreateSharedStore({
1419
+ env: effectiveRuntimeEnv,
1420
+ cwd,
1421
+ fetchImpl
1422
+ });
1423
+ authority = resolveLocalDialogTurnAuthority(connectorSharedStore);
1424
+ }
1425
+ connectorTurnAuthority = authority;
1426
+ const runId = sanitizeDialogTurnIdentifier(
1427
+ asOptionalTrimmedString(readField2(payload, "runId")) ?? `conn-${requestId}`,
1428
+ "conn"
1429
+ );
1430
+ pendingReleaseFile = resolve2(deps.pendingLeaseReleaseFilePath ?? join4(
1431
+ resolveConnectorStateDir({ noloHome: effectiveRuntimeEnv.NOLO_HOME }),
1432
+ "connector-pending-lease-releases.json"
1433
+ ));
1434
+ await recoverPendingLeaseReleases(authority, dialogRef, pendingReleaseFile);
1435
+ runAbortController.signal.throwIfAborted();
1436
+ const acquired = await acquireLocalDialogTurnLease({
1437
+ authority,
1438
+ dialogRef,
1439
+ runId,
1440
+ holder: `connector:${requestId}:${randomUUID()}`,
1441
+ holderKind: "connector",
1442
+ commandId: `commit-${runId}`
1443
+ });
1444
+ if (!acquired.ok) {
1445
+ if (acquired.status === "busy") {
1446
+ stageTerminalResult({
1447
+ error: `Dialog is busy (activeRunId=${acquired.activeTurn.runId})`,
1448
+ errorCode: "dialog_busy",
1449
+ activeRunId: acquired.activeTurn.runId,
1450
+ activeTurn: acquired.activeTurn,
1451
+ dialogBusy: {
1452
+ dialogRef,
1453
+ dialogRevision: acquired.dialogRevision,
1454
+ activeRunId: acquired.activeTurn.runId,
1455
+ activeTurn: acquired.activeTurn
1456
+ }
1457
+ });
1458
+ return false;
1459
+ }
1460
+ throw new Error(`Dialog turn rejected (${acquired.status})`);
1461
+ }
1462
+ connectorTurnLease = acquired.lease;
1463
+ if (keepTurnActive) connectorTurnLease.keepTurnActive = true;
1464
+ connectorTurnHeartbeat = startDialogTurnHeartbeat({
1465
+ authority,
1466
+ dialogRef,
1467
+ runToken: acquired.lease.runToken,
1468
+ intervalMs: deps.dialogTurnHeartbeatIntervalMs,
1469
+ onLeaseLost: () => runAbortController.abort(new Error("Local Connector dialog turn lease lost"))
1470
+ });
1471
+ if (keepTurnActive && connectorSharedStore && resolveLocalDialogTurnAuthority(connectorSharedStore) === authority) {
1472
+ const dialogKey = `dialog-${targetUserId}-${targetDialogId}`;
1473
+ if (!await connectorSharedStore.read(dialogKey, { remote: false })) {
1474
+ await connectorSharedStore.read(dialogKey);
1475
+ const state = await authority.getDialogTurnState({ dialogRef });
1476
+ if (!("ok" in state && state.ok) || state.activeTurn?.runId !== acquired.activeTurn.runId || state.activeTurn.holder !== acquired.activeTurn.holder || state.activeTurn.startedAt !== acquired.activeTurn.startedAt) {
1477
+ throw new Error("Dialog turn lease lost during Connector header hydration");
1478
+ }
1479
+ connectorTurnLease.baseRevision = state.dialogRevision;
1480
+ }
1481
+ }
1482
+ return true;
1483
+ };
902
1484
  let runContent = "";
903
1485
  let runModel = (() => {
904
1486
  const value = readField2(agentConfig, "model");
@@ -918,7 +1500,12 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
918
1500
  cwd
919
1501
  );
920
1502
  assertMachineRunAllowed2(userInput, effectivePermissionPolicy);
1503
+ if (!await acquireConnectorTurnIfNeeded()) {
1504
+ return;
1505
+ }
1506
+ runAbortController.signal.throwIfAborted();
921
1507
  baseSha = await readConnectorGitHead2(artifactCwd);
1508
+ runAbortController.signal.throwIfAborted();
922
1509
  const providerRaw = readField2(agentConfig, "cliProvider");
923
1510
  const fallbackProvider = readField2(agentConfig, "provider");
924
1511
  const provider = asOptionalTrimmedString(providerRaw) ?? asOptionalTrimmedString(fallbackProvider) ?? "copilot";
@@ -973,26 +1560,28 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
973
1560
  updatedAt: Date.now()
974
1561
  });
975
1562
  }, 15e3);
976
- const effectiveRuntimeEnv = withForwardedUserAuthToken(runtimeEnv, parsed);
1563
+ const effectiveRuntimeEnv2 = withForwardedUserAuthToken(runtimeEnv, parsed);
977
1564
  const reasoningEffortRaw = readField2(agentConfig, "reasoning_effort");
978
1565
  const reasoningEffortFallback = readField2(agentConfig, "reasoningEffort");
979
1566
  const reasoningEffort = typeof reasoningEffortRaw === "string" && reasoningEffortRaw || typeof reasoningEffortFallback === "string" && reasoningEffortFallback || void 0;
980
1567
  const modelValue = readField2(agentConfig, "model");
981
1568
  const result2 = await executeCli(finalProvider, materializedPrompt.prompt, {
1569
+ signal: runAbortController.signal,
982
1570
  model: typeof modelValue === "string" ? modelValue : void 0,
983
1571
  timeout,
984
1572
  cwd,
985
1573
  yolo: true,
986
1574
  ...reasoningEffort ? { reasoningEffort } : {},
987
1575
  env: {
988
- NOLO_SERVER: effectiveRuntimeEnv.NOLO_SERVER || effectiveRuntimeEnv.NOLO_SERVER_URL || effectiveRuntimeEnv.BASE_URL,
989
- NOLO_SERVER_URL: effectiveRuntimeEnv.NOLO_SERVER_URL || effectiveRuntimeEnv.NOLO_SERVER || effectiveRuntimeEnv.BASE_URL,
990
- BASE_URL: effectiveRuntimeEnv.BASE_URL || effectiveRuntimeEnv.NOLO_SERVER || effectiveRuntimeEnv.NOLO_SERVER_URL,
991
- AUTH_TOKEN: effectiveRuntimeEnv.AUTH_TOKEN || effectiveRuntimeEnv.AUTH || effectiveRuntimeEnv.NOLO_MACHINE_API_KEY,
992
- NOLO_MACHINE_API_KEY: effectiveRuntimeEnv.NOLO_MACHINE_API_KEY || effectiveRuntimeEnv.AUTH_TOKEN || effectiveRuntimeEnv.AUTH
1576
+ NOLO_SERVER: effectiveRuntimeEnv2.NOLO_SERVER || effectiveRuntimeEnv2.NOLO_SERVER_URL || effectiveRuntimeEnv2.BASE_URL,
1577
+ NOLO_SERVER_URL: effectiveRuntimeEnv2.NOLO_SERVER_URL || effectiveRuntimeEnv2.NOLO_SERVER || effectiveRuntimeEnv2.BASE_URL,
1578
+ BASE_URL: effectiveRuntimeEnv2.BASE_URL || effectiveRuntimeEnv2.NOLO_SERVER || effectiveRuntimeEnv2.NOLO_SERVER_URL,
1579
+ AUTH_TOKEN: effectiveRuntimeEnv2.AUTH_TOKEN || effectiveRuntimeEnv2.AUTH || effectiveRuntimeEnv2.NOLO_MACHINE_API_KEY,
1580
+ NOLO_MACHINE_API_KEY: effectiveRuntimeEnv2.NOLO_MACHINE_API_KEY || effectiveRuntimeEnv2.AUTH_TOKEN || effectiveRuntimeEnv2.AUTH
993
1581
  },
994
1582
  ...connectorImageUrls.length > 0 ? { imageInputs: connectorImageUrls.map((url) => ({ source: url })) } : {}
995
1583
  }).finally(() => clearInterval(heartbeat));
1584
+ executionStopped = getExecutionStoppedPromise(result2);
996
1585
  logConnectorRun("agent.run.cli.result", {
997
1586
  requestId,
998
1587
  provider: finalProvider,
@@ -1015,19 +1604,17 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
1015
1604
  workspaceKind: "current"
1016
1605
  });
1017
1606
  if (artifactProgress2) sendProgress(artifactProgress2);
1018
- send(JSON.stringify({
1019
- type: "agent.run.result",
1020
- requestId,
1607
+ stageTerminalResult({
1021
1608
  result: {
1022
1609
  content: runContent,
1023
1610
  model: runModel,
1024
1611
  trace: runTrace,
1025
1612
  artifacts: artifacts2
1026
1613
  }
1027
- }));
1614
+ });
1028
1615
  return;
1029
1616
  }
1030
- if (!requestsLocalWorkspaceRuntime(runtimePolicy) && !isMachineBoundLocalCustomProvider(agentConfig)) {
1617
+ if (!strictPermission && !requestsLocalWorkspaceRuntime(runtimePolicy) && !isMachineBoundLocalCustomProvider(agentConfig)) {
1031
1618
  throw new Error("Connector can only execute non-CLI agents when runtimeToolPolicySnapshot requests a local workspace runtime.");
1032
1619
  }
1033
1620
  logConnectorRun("agent.run.local-runtime.start", {
@@ -1039,34 +1626,57 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
1039
1626
  runtimePolicy: Boolean(runtimePolicy),
1040
1627
  ...summarizeAgentConfigForLogs(agentConfig)
1041
1628
  });
1042
- baseSha = await readConnectorGitHead2(cwd);
1629
+ if (strictPermission || payload.stream === true) {
1630
+ assertMachineRunAllowed2(userInput, strictPermission ?? machinePermissionPolicy);
1631
+ }
1632
+ if (!await acquireConnectorTurnIfNeeded(true)) {
1633
+ return;
1634
+ }
1635
+ runAbortController.signal.throwIfAborted();
1636
+ const streamLease = payload.stream === true ? connectorTurnLease : void 0;
1637
+ if (streamLease) {
1638
+ send(JSON.stringify({ type: "agent.run.accepted", requestId, dialogId: streamLease.dialogRef.dialogId }));
1639
+ }
1640
+ if (!strictPermission || strictPermission.allowFilesystemRead) {
1641
+ baseSha = await readConnectorGitHead2(cwd, strictPermission ? { workspaceOnly: true } : void 0);
1642
+ }
1643
+ runAbortController.signal.throwIfAborted();
1043
1644
  const result = await runConnectorLocalRuntimeAgent({
1044
1645
  parsed,
1045
- runtimeEnv: withForwardedUserAuthToken(runtimeEnv, parsed),
1646
+ blockLocalCli,
1647
+ runtimeEnv: effectiveRuntimeEnv,
1046
1648
  cwd,
1047
1649
  fetchImpl,
1650
+ ...strictPermission ? { strictPermission } : {},
1651
+ ...connectorTurnLease ? { dialogTurnLease: connectorTurnLease } : {},
1652
+ ...connectorSharedStore ? { sharedStore: connectorSharedStore } : {},
1048
1653
  onProgress: sendProgress,
1654
+ ...streamLease ? { onStreamEvent: (event) => {
1655
+ if (!runAbortController.signal.aborted) {
1656
+ send(JSON.stringify({ type: "agent.run.delta", requestId, event }));
1657
+ }
1658
+ } } : {},
1049
1659
  abortSignal: runAbortController.signal
1050
1660
  });
1661
+ executionStopped = getExecutionStoppedPromise(result);
1051
1662
  runContent = result.content;
1052
1663
  runModel = result.model;
1053
1664
  runTrace = result.trace ?? [];
1054
- artifactCwd = result.runtimeWorkspaceRoot ?? cwd;
1055
- const artifacts = await collectConnectorRunArtifact2({
1665
+ artifactCwd = strictPermission ? cwd : result.runtimeWorkspaceRoot ?? cwd;
1666
+ const artifacts = !strictPermission || strictPermission.allowFilesystemRead ? await collectConnectorRunArtifact2({
1056
1667
  cwd: artifactCwd,
1057
1668
  baseSha,
1058
- exitStatus: "completed"
1059
- });
1060
- const artifactProgress = buildArtifactProgress({
1669
+ exitStatus: "completed",
1670
+ ...strictPermission ? { workspaceOnly: true } : {}
1671
+ }) : void 0;
1672
+ const artifactProgress = artifacts && buildArtifactProgress({
1061
1673
  artifacts,
1062
1674
  runtimePolicy,
1063
1675
  workspaceRoot: artifactCwd,
1064
1676
  workspaceKind: "current"
1065
1677
  });
1066
1678
  if (artifactProgress) sendProgress(artifactProgress);
1067
- send(JSON.stringify({
1068
- type: "agent.run.result",
1069
- requestId,
1679
+ stageTerminalResult({
1070
1680
  result: {
1071
1681
  content: runContent,
1072
1682
  model: runModel,
@@ -1084,8 +1694,11 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
1084
1694
  emptyAssistantFallbackReason: result.emptyAssistantFallbackReason,
1085
1695
  usage: result.usage
1086
1696
  }
1087
- }));
1697
+ });
1088
1698
  } catch (error) {
1699
+ const errorStopped = getExecutionStoppedPromise(error);
1700
+ if (errorStopped) executionStopped = executionStopped ? Promise.all([executionStopped, errorStopped]).then(() => {
1701
+ }) : errorStopped;
1089
1702
  logConnectorRun("agent.run.error", {
1090
1703
  requestId,
1091
1704
  agentKey: readField2(payload, "agentKey"),
@@ -1094,15 +1707,52 @@ async function handleConnectorRunMessage(message, send, executeCli, runtimeEnv,
1094
1707
  error: toErrorMessage(error)
1095
1708
  });
1096
1709
  const cancelled = runAbortController.signal.aborted;
1097
- send(JSON.stringify({
1098
- type: "agent.run.result",
1099
- requestId,
1710
+ stageTerminalResult({
1100
1711
  error: toErrorMessage(error),
1712
+ ...error instanceof ConnectorWorkspaceError ? { errorCode: error.code } : {},
1713
+ ...error instanceof WindowsConnectorCliFencingUnsupportedError ? { ok: false, errorCode: error.code } : {},
1714
+ ...error instanceof DialogTurnBusyError ? {
1715
+ errorCode: error.errorCode,
1716
+ activeRunId: error.activeTurn.runId,
1717
+ activeTurn: error.activeTurn,
1718
+ dialogBusy: {
1719
+ dialogRef: error.dialogRef,
1720
+ dialogRevision: error.dialogRevision,
1721
+ activeRunId: error.activeTurn.runId,
1722
+ activeTurn: error.activeTurn
1723
+ }
1724
+ } : {},
1101
1725
  ...cancelled ? { cancelled: true } : {}
1102
- }));
1726
+ });
1103
1727
  } finally {
1104
- if (activeRunAbortControllers.get(requestId) === runAbortController) {
1105
- activeRunAbortControllers.delete(requestId);
1728
+ try {
1729
+ connectorTurnHeartbeat?.stop();
1730
+ const authority = connectorTurnAuthority;
1731
+ const lease = connectorTurnLease;
1732
+ if (lease && authority) {
1733
+ const release = () => releaseConnectorTurnLeaseWithRecovery(authority, lease);
1734
+ const reportReleaseError = (error) => logConnectorRun("agent.run.settlement.error", { requestId, error: toErrorMessage(error) });
1735
+ if (executionStopped) {
1736
+ void executionStopped.then(release).catch(reportReleaseError);
1737
+ } else {
1738
+ try {
1739
+ await release();
1740
+ } catch (error) {
1741
+ reportReleaseError(error);
1742
+ stageTerminalResult({
1743
+ ok: false,
1744
+ error: "Failed to release the local Connector dialog turn lease after 3 attempts",
1745
+ errorCode: "connector_local_turn_release_failed"
1746
+ });
1747
+ }
1748
+ }
1749
+ }
1750
+ if (terminalMessage !== void 0) send(terminalMessage);
1751
+ } finally {
1752
+ sessionSignal?.removeEventListener("abort", abortRunOnDisconnect);
1753
+ if (activeRunAbortControllers.get(requestId) === activeRun) {
1754
+ activeRunAbortControllers.delete(requestId);
1755
+ }
1106
1756
  }
1107
1757
  }
1108
1758
  }
@@ -1115,6 +1765,10 @@ function readField2(record, key) {
1115
1765
  }
1116
1766
 
1117
1767
  export {
1768
+ CONNECTOR_LOCK_CORRUPT_RECLAIM_SECONDS,
1769
+ acquireConnectorInstanceLock,
1770
+ clearConnectorAlive,
1771
+ withConnectorAliveSignal,
1118
1772
  resolveMachineRunPermissionPolicy,
1119
1773
  buildMachinePermissionPromptBlock,
1120
1774
  summarizeAgentConfigForLogs,
@@ -1128,5 +1782,6 @@ export {
1128
1782
  buildArtifactProgress,
1129
1783
  defaultRunConnectorLocalRuntimeAgent,
1130
1784
  extractMultimodalUserInput,
1785
+ __setConnectorLeaseRecoveryCapacityForTest,
1131
1786
  handleConnectorRunMessage
1132
1787
  };