nolo-cli 0.228.0-alpha.2 → 0.228.0

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 (235) hide show
  1. package/README.md +3 -5
  2. package/{_executeModel-VYCHHZVT.js → _executeModel-GIFVXKDT.js} +88 -83
  3. package/{accountResolver-QETKNC7T.js → accountResolver-NGICIMEE.js} +1 -1
  4. package/{action-GDZDXPMB.js → action-WZTKEF5H.js} +9 -6
  5. package/{addContentAction-7RO4AMRI.js → addContentAction-MLI6GOBV.js} +14 -13
  6. package/{addDialogAgentAction-EVYBGTXB.js → addDialogAgentAction-ARGQM22H.js} +17 -16
  7. package/{agentDeleteCommand-QWQKT54A.js → agentDeleteCommand-UF7XVELS.js} +118 -111
  8. package/{agentEmailCommands-EISMBIRE.js → agentEmailCommands-SFHRPQYC.js} +118 -107
  9. package/{agentListCommands-4WLG32IW.js → agentListCommands-IXKBP3W5.js} +208 -177
  10. package/{agentMachineCommands-DC6NKWTU.js → agentMachineCommands-7NX6PWQ6.js} +55 -48
  11. package/{agentProviderCommands-STI3DQ6A.js → agentProviderCommands-C5T7C5KZ.js} +2 -2
  12. package/{agentPullCommand-KHV4EELF.js → agentPullCommand-4EQZYHU4.js} +1 -1
  13. package/agentRecordCommands-IUNX6XD6.js +188 -0
  14. package/{agentRunCommand-QM7ETUTX.js → agentRunCommand-LCR4XADM.js} +125 -111
  15. package/{agentRunControl-MBG4U6SL.js → agentRunControl-RN2P6AOD.js} +11 -9
  16. package/{agentRuntimeLocal-HOXKWCYO.js → agentRuntimeLocal-LVXPQ7QA.js} +56 -43
  17. package/{agentSlice-UG76KEBH.js → agentSlice-ZGMOH6TE.js} +15 -14
  18. package/{appDeleteCommands-WWCC6WA5.js → appDeleteCommands-BESCJOQM.js} +55 -48
  19. package/{appDeployCommands-AU4IUN33.js → appDeployCommands-LPTR6IOX.js} +55 -48
  20. package/{appDeployStatusCommands-STUW7WXL.js → appDeployStatusCommands-BZ7KZ5RD.js} +55 -48
  21. package/{appGetCommands-BGTLIQ4K.js → appGetCommands-EDWGJV4S.js} +55 -48
  22. package/{appListCommands-CUCPRUXW.js → appListCommands-OPRWYPM6.js} +55 -48
  23. package/{authCommand-OZ2KTP4Z.js → authCommand-3C3RN4OU.js} +25 -19
  24. package/{authCommands-55OGQGCR.js → authCommands-ZMVEDCQD.js} +12 -6
  25. package/{builtinSkillRegistry-BAE2LDXF.js → builtinSkillRegistry-VRCMQ77Q.js} +7 -7
  26. package/{chromeCommands-G5UDKVSV.js → chromeCommands-O4IIKTBD.js} +384 -7
  27. package/{chromeOpsCommands-WAA45NCS.js → chromeOpsCommands-NZITLHWO.js} +3 -3
  28. package/{chunk-VQ5N5GSV.js → chunk-2BKNICGK.js} +4 -4
  29. package/{chunk-QYB23WUH.js → chunk-2FK2KZSL.js} +1 -1
  30. package/chunk-2SXN7LAY.js +15 -0
  31. package/{chunk-3VZLEKV2.js → chunk-3DJJ4CFG.js} +11 -11
  32. package/{chunk-TSPMLCWI.js → chunk-4IQN6FWY.js} +5 -5
  33. package/{chunk-XAG3FWBE.js → chunk-4OXPN3WC.js} +6 -6
  34. package/chunk-4ZCTKB27.js +31 -0
  35. package/chunk-53W5BXLN.js +340 -0
  36. package/{chunk-42OKN2LI.js → chunk-5HUO7SEX.js} +9 -107
  37. package/chunk-6ASGEP5D.js +21 -0
  38. package/{chunk-MJI3UAXN.js → chunk-6CXQ3YNJ.js} +40 -36
  39. package/{chunk-G7IUT2V3.js → chunk-6MTVACLN.js} +365 -64
  40. package/{chunk-ZOHO6MOF.js → chunk-6RSNVJGO.js} +2 -99
  41. package/{chunk-XSW4EXQV.js → chunk-6TVYUQRM.js} +55 -18
  42. package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
  43. package/{chunk-7Z6EW7AH.js → chunk-6XVPMGXK.js} +97 -11
  44. package/{chunk-ALAES342.js → chunk-73PZD7JZ.js} +9 -5
  45. package/{chunk-TCZ2VJZQ.js → chunk-7UVVLYKC.js} +9 -9
  46. package/{chunk-S6FDXXZV.js → chunk-ADOOL3PG.js} +2 -2
  47. package/{chunk-OWKNSIXL.js → chunk-AEZBAFC6.js} +334 -77
  48. package/{chunk-PWTNI4N7.js → chunk-ANUP75N2.js} +22 -0
  49. package/{chunk-RG2DGNL6.js → chunk-ARFCL53U.js} +5 -5
  50. package/{chunk-SRCCSTIM.js → chunk-AS6L5KSD.js} +4 -4
  51. package/{chunk-WFDNADFX.js → chunk-BAH3BAUZ.js} +8 -8
  52. package/{chunk-N5Z2V73W.js → chunk-BFKJ2RS3.js} +1 -1
  53. package/{chunk-F6Z6ZCUV.js → chunk-BVEDT6DM.js} +3 -3
  54. package/chunk-C5A54QS7.js +108 -0
  55. package/{chunk-CD3RU7XL.js → chunk-CD2DK5JA.js} +120 -14
  56. package/{chunk-BP5ZJ6B4.js → chunk-CD64YXRB.js} +1 -1
  57. package/{chunk-VP3BINY7.js → chunk-CIGCTSBF.js} +31 -1
  58. package/{chunk-TQEKUOTI.js → chunk-CIUZXD5D.js} +12 -12
  59. package/{chunk-EVGU5P4U.js → chunk-CO6E7YK6.js} +1 -1
  60. package/{chunk-VMJVAJ6W.js → chunk-CTIEJRTP.js} +28 -4
  61. package/{chunk-7JGMNKKG.js → chunk-CTWCZKNS.js} +29 -8
  62. package/{chunk-YFLVRVYK.js → chunk-D25ONVOH.js} +1 -1
  63. package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
  64. package/{chunk-262R3XNN.js → chunk-E5RYFR7E.js} +334 -103
  65. package/{chunk-OQHIVPG4.js → chunk-E6A5NHDH.js} +4 -1
  66. package/{chunk-HSSBDZLD.js → chunk-EDT65EUE.js} +6 -6
  67. package/{chunk-YVFH2MFB.js → chunk-EQZQUQ33.js} +7 -7
  68. package/{chunk-HBRDSQ3M.js → chunk-ESN4WNWU.js} +3 -2
  69. package/{chunk-2YGBI2XB.js → chunk-FE7G6DSP.js} +11 -1
  70. package/{chunk-547ENH5T.js → chunk-FFFKAOJN.js} +4 -4
  71. package/{chunk-5ZUOVCKT.js → chunk-FGHEF6WI.js} +3 -1
  72. package/{chunk-GAYNXB6T.js → chunk-FTWAOKFU.js} +756 -333
  73. package/chunk-GAHJLSDO.js +107 -0
  74. package/{chunk-2X7WFDT6.js → chunk-GX6DITLQ.js} +1 -1
  75. package/{chunk-HXB4VDGK.js → chunk-HCCQEMTK.js} +28 -28
  76. package/{chunk-CMMI3DAT.js → chunk-HZDK56EK.js} +33 -26
  77. package/{chunk-OTKSESZR.js → chunk-IIOSZAJX.js} +4 -4
  78. package/chunk-IIRJ4P4I.js +24 -0
  79. package/{chunk-OJ45MEEI.js → chunk-IJZC2KIJ.js} +1 -1
  80. package/{chunk-MNEZUL5S.js → chunk-ITBX27W6.js} +92 -31
  81. package/{chunk-LYD6C7OU.js → chunk-J2VIGDJN.js} +6 -6
  82. package/{chunk-M3OZRQNH.js → chunk-JEWMQR6J.js} +1 -1
  83. package/{chunk-6QHKRARD.js → chunk-JFRJEPFI.js} +29 -5
  84. package/{chunk-S6K5F3KP.js → chunk-JP2BH4NC.js} +1 -1
  85. package/{chunk-EGHP7KOY.js → chunk-JU7VN4LF.js} +38 -29
  86. package/{chunk-RTHFJZ6M.js → chunk-K26XPZRB.js} +2 -2
  87. package/{chunk-ZYKJBRZ3.js → chunk-K7VIXYTZ.js} +1 -3
  88. package/chunk-KK3FCYZM.js +647 -0
  89. package/chunk-KLAMJNKQ.js +33394 -0
  90. package/{chunk-4JVNURX4.js → chunk-KQHEGELM.js} +68 -16
  91. package/chunk-KXOPLLFP.js +190 -0
  92. package/{chunk-MZG5CETE.js → chunk-KZ5OD2MO.js} +4 -4
  93. package/{chunk-ILHQ2AXT.js → chunk-KZAT2M2V.js} +14 -8
  94. package/chunk-LHCGKAFO.js +739 -0
  95. package/{chunk-HF7BLF3F.js → chunk-LMGFVH65.js} +107 -104
  96. package/{chunk-QRGDJA4B.js → chunk-LTVEOOZL.js} +19 -6
  97. package/{chunk-L32W3PRP.js → chunk-MAA42MMV.js} +233 -17
  98. package/{chunk-ATEKLSLR.js → chunk-MTM4LRVG.js} +14 -9
  99. package/chunk-MVOZ22RZ.js +26 -0
  100. package/{chunk-U2HBB7RS.js → chunk-MYYNZG2M.js} +132 -32
  101. package/{chunk-DBUR22G5.js → chunk-MZVCFV3T.js} +19 -15
  102. package/{chunk-WCFFRBL5.js → chunk-N74XL3NI.js} +9 -9
  103. package/{chunk-VS276URX.js → chunk-NEG5LYK5.js} +1 -1
  104. package/{chunk-RBPUNSG5.js → chunk-OAZP4TSA.js} +18 -108
  105. package/{chunk-4QYJPWHH.js → chunk-ODBYGVO2.js} +232 -10
  106. package/{chunk-M4SFKP5L.js → chunk-OHUYN3YU.js} +3 -3
  107. package/{chunk-HYLRQDEE.js → chunk-OLGFIQN2.js} +6 -6
  108. package/{chunk-M3JEW6N6.js → chunk-OYUMJMC5.js} +15 -0
  109. package/chunk-P27E22MA.js +203 -0
  110. package/{chunk-BIWI5M4E.js → chunk-PBPXXMWZ.js} +1 -1
  111. package/{chunk-OBSEKCVK.js → chunk-PQ63BDV3.js} +210 -51
  112. package/{chunk-4I2MXV5Q.js → chunk-PVFYPUIM.js} +2 -0
  113. package/{chunk-XFXFPUO7.js → chunk-QMNVV3YM.js} +10 -37
  114. package/{chunk-CNMY2XM6.js → chunk-R5NRFXGD.js} +5 -5
  115. package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
  116. package/{chunk-4WVJLODK.js → chunk-RHBD22LV.js} +9 -4
  117. package/{chunk-45CAVC35.js → chunk-RMWDKLBE.js} +1489 -286
  118. package/{chunk-ZEVQHCLM.js → chunk-RR3MB26M.js} +2 -2
  119. package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
  120. package/{chunk-DLXMMTGM.js → chunk-SCMYAGQE.js} +1067 -705
  121. package/{chunk-YKY4OVOX.js → chunk-SPU3L3OR.js} +17 -170
  122. package/chunk-SR4FE5VD.js +9 -0
  123. package/{chunk-DUUDXSLX.js → chunk-SX6AWTNK.js} +28 -4
  124. package/{chunk-ZH3KXFHS.js → chunk-TMRJGSK2.js} +1 -1
  125. package/{chunk-S2NTVGA2.js → chunk-U35UUM5K.js} +2 -1
  126. package/{chunk-PPJYZRSQ.js → chunk-U5LOKQ2R.js} +30 -14
  127. package/{chunk-UAIHKQIA.js → chunk-U6RD332P.js} +18 -2
  128. package/{chunk-3U44JB3O.js → chunk-UF6J7NXV.js} +1 -1
  129. package/{chunk-5YMA6DDZ.js → chunk-UHW6SCVK.js} +1 -1
  130. package/chunk-UOUMPHS5.js +103 -0
  131. package/{chunk-HHFGE2WF.js → chunk-UPOW5HTG.js} +5 -5
  132. package/{chunk-DEA37IUY.js → chunk-V4IYI3SB.js} +2 -2
  133. package/{chunk-XTJKU3Z4.js → chunk-VKCPKCSS.js} +66 -92
  134. package/{chunk-HGDKT2D6.js → chunk-VTHWBTRE.js} +177 -1
  135. package/{chunk-OBIC6EG7.js → chunk-VUHKG4KS.js} +3 -3
  136. package/{chunk-EEOOBRA7.js → chunk-W3HSD32M.js} +13 -6
  137. package/{chunk-P2ZLUIW2.js → chunk-W6T4FNZP.js} +351 -26
  138. package/chunk-WDWZPASX.js +29 -0
  139. package/{chunk-R6Z5S5GA.js → chunk-WQDTSK5U.js} +51 -14
  140. package/{chunk-X3E6EHJW.js → chunk-X22AUZKL.js} +149 -165
  141. package/{chunk-4ZGPHFLE.js → chunk-X3OZ655T.js} +2 -2
  142. package/{chunk-RRDRQOEC.js → chunk-XCA4WHX5.js} +95 -77
  143. package/{chunk-TI2EPRHE.js → chunk-XJSEST7D.js} +3 -3
  144. package/{chunk-3QIYD3VM.js → chunk-XNTZD4AE.js} +870 -1068
  145. package/chunk-XSRSAU3O.js +133 -0
  146. package/{chunk-7FEP5USX.js → chunk-Y4NPF2UN.js} +3 -3
  147. package/{chunk-FJSNBZXR.js → chunk-YDRRGVT5.js} +1 -1
  148. package/{chunk-7BCG67EI.js → chunk-YFW4H6DL.js} +405 -338
  149. package/{chunk-JQZRSXS5.js → chunk-YGDYYFRX.js} +9 -13
  150. package/{chunk-4N6G2CKP.js → chunk-YHNUDTU4.js} +49 -3
  151. package/chunk-YJPK35HB.js +175 -0
  152. package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
  153. package/{chunk-FPBJM2BW.js → chunk-Z7KE4K3H.js} +195 -126
  154. package/{chunk-DGYCDA6W.js → chunk-ZM5AZTQG.js} +20 -13
  155. package/{chunk-CBUZ6DKA.js → chunk-ZQ6K57FJ.js} +1 -1
  156. package/{cliAgentConfigHelpers-BTRHMPW2.js → cliAgentConfigHelpers-37ZNEY5Y.js} +9 -9
  157. package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
  158. package/{cliLocalAgentRecordReader-H3HYQRRR.js → cliLocalAgentRecordReader-MCQVRWBR.js} +58 -47
  159. package/{commandRegistry-FVYPE2IN.js → commandRegistry-NTH5IAN5.js} +104 -92
  160. package/{contentThunks-GNFPG32S.js → contentThunks-SPXTX5U2.js} +38 -36
  161. package/{cooldownCommands-YB5H5BBK.js → cooldownCommands-TIFCHCUN.js} +1 -1
  162. package/{createAgentAutomationAction-PB4QIFQ4.js → createAgentAutomationAction-KUQKCOXB.js} +38 -36
  163. package/{createDialogAction-EVTOPY7A.js → createDialogAction-HJN5U3XS.js} +39 -37
  164. package/{createPageAction-2UYF2IDZ.js → createPageAction-ZAHRDOAU.js} +43 -41
  165. package/{db-M7FU2GNK.js → db-CMUTP3W5.js} +2 -2
  166. package/{dbSlice-XRUZOGSU.js → dbSlice-656PMWR2.js} +13 -12
  167. package/{deleteFile-6URDHYRB.js → deleteFile-ZCQESEEQ.js} +10 -7
  168. package/{dialogCommands-6SZD4TYP.js → dialogCommands-KZTZLWPZ.js} +60 -54
  169. package/dialogMessageRecord-OAV77LT7.js +7 -0
  170. package/{dialogNotifyCommand-SHGPCU22.js → dialogNotifyCommand-PST75COP.js} +11 -11
  171. package/{dialogSlice-5EQ2A6LY.js → dialogSlice-BXIERQHO.js} +39 -37
  172. package/{dialogUsageCommand-W2WCSGKF.js → dialogUsageCommand-6RW2FY6K.js} +5 -5
  173. package/{docCreateCommands-25E6PGN3.js → docCreateCommands-26HJ5NAY.js} +54 -47
  174. package/{docDeleteCommands-F7ZVGEHW.js → docDeleteCommands-UAOHH5XK.js} +56 -49
  175. package/{docReadCommands-JY2E5XEN.js → docReadCommands-4ADG7YE6.js} +54 -47
  176. package/{docStore-OKKIKLT3.js → docStore-FZ75HWP2.js} +15 -14
  177. package/{docUpdateCommands-OZ4CUSIQ.js → docUpdateCommands-OGFJZENF.js} +54 -47
  178. package/fetchMessages-TQEUZD7H.js +1 -1
  179. package/{getPricing-LF5C4XSI.js → getPricing-FCHYVRJU.js} +4 -4
  180. package/{handleSendMessageAction-LNT7SZND.js → handleSendMessageAction-KP6GGBFY.js} +82 -78
  181. package/{hostCredentialCreate-XUU2CSHI.js → hostCredentialCreate-23TX56G7.js} +117 -105
  182. package/index.js +8 -8
  183. package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
  184. package/{localDialogRead-CCOCVGAP.js → localDialogRead-CIOTQM5T.js} +1 -1
  185. package/{localRuntimeAdapter-IBSTMSX7.js → localRuntimeAdapter-MTUWOYPN.js} +124 -111
  186. package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-TYHQCTZN.js} +5 -3
  187. package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-BO7IVWAZ.js} +1 -1
  188. package/{machineCommands-HSQHDHOT.js → machineCommands-4WJUJQHW.js} +241 -321
  189. package/{machineWsRunDispatch-L6H7J66T.js → machineWsRunDispatch-V3U4JM67.js} +113 -102
  190. package/markdownToSlate-KIYM7B3P.js +8 -0
  191. package/mcpLocalAuthorizeCommand-TI656UWC.js +106 -0
  192. package/{memberThunks-7Y3OYSJQ.js → memberThunks-JFYC4Z5L.js} +20 -15
  193. package/{models-H5NNZRLH.js → models-EP7VG6N2.js} +2 -2
  194. package/{overlay-BBQZXGYI.js → overlay-JA3SPVUS.js} +5 -3
  195. package/package.json +1 -1
  196. package/{projectArchive-FQO654Z3.js → projectArchive-NU2Z5HOR.js} +45 -43
  197. package/{providerPresetApply-WHAMP2D5.js → providerPresetApply-4H7YP5D7.js} +6 -6
  198. package/{providerRegistry-ZI2KORJ7.js → providerRegistry-F3UPOTIY.js} +6 -6
  199. package/{read-TYMBGEXO.js → read-BRZHXUJ6.js} +9 -8
  200. package/{readDocTool-SKQVHBLO.js → readDocTool-N7RVFQEE.js} +1 -1
  201. package/{readlineWorkspace-7U272DSA.js → readlineWorkspace-T56MRMS5.js} +6423 -3669
  202. package/rememberExplicit-CPAPONSI.js +15 -0
  203. package/{removeDialogAgentAction-F5QE2O2B.js → removeDialogAgentAction-J7XU7OUX.js} +19 -18
  204. package/{runAgentClientLoop-AF4JQIJ7.js → runAgentClientLoop-O2GRCGRZ.js} +96 -76
  205. package/{runtimeDoctorCommands-RRKPBGVO.js → runtimeDoctorCommands-RDRJXMXC.js} +8 -8
  206. package/{secretCommands-KZWBZIYS.js → secretCommands-2FEMRUFM.js} +3 -3
  207. package/{setDialogExtraReferencesAction-72L27ERM.js → setDialogExtraReferencesAction-Q4V2ZZW2.js} +16 -15
  208. package/{setPrimaryDialogAgentAction-GJJDUSGJ.js → setPrimaryDialogAgentAction-742H5S6T.js} +19 -18
  209. package/{settingThunks-ZRGWVGZD.js → settingThunks-T4FXSV6M.js} +185 -66
  210. package/{skillDiscovery-BHHPCUHZ.js → skillDiscovery-MDDKPTW3.js} +4 -3
  211. package/{spaceCommands-5VNWMDBE.js → spaceCommands-W5TAVFDT.js} +58 -51
  212. package/{streamAgentChatTurn-YSPEFY4K.js → streamAgentChatTurn-OWDJMU5E.js} +234 -177
  213. package/{switchDialogAgentAction-IIJBPND3.js → switchDialogAgentAction-HLDLHRRA.js} +17 -16
  214. package/{tableCommands-FTAOCBTX.js → tableCommands-44GC4N6J.js} +8 -5
  215. package/{toolApiClient-OGQEBQVX.js → toolApiClient-N5PYW2R3.js} +8 -6
  216. package/{tools-M35PTIFB.js → tools-O7SGGVA3.js} +65 -62
  217. package/{tuiRestart-2IL37YIB.js → tuiRestart-EOGC2BYY.js} +10 -10
  218. package/{tuiSummaryLlmCaller-W2QN4VAC.js → tuiSummaryLlmCaller-TM5BU73J.js} +16 -15
  219. package/{updateCommands-CPATDG6J.js → updateCommands-FBYA5WVG.js} +3 -3
  220. package/{updateDialogTitleAction-IMIRJRQQ.js → updateDialogTitleAction-EXSZGTLL.js} +40 -38
  221. package/{usageCommand-2BF74MKF.js → usageCommand-L4OFWXEU.js} +2 -2
  222. package/{usageRebuildCommand-UHB55BQM.js → usageRebuildCommand-7JR33UHS.js} +3 -3
  223. package/webapi-QVV65DQF.js +2487 -0
  224. package/{windowsSelfUpdate-ZFD6J5HF.js → windowsSelfUpdate-M4V77OUB.js} +2 -2
  225. package/workContext-Y3ADAPZU.js +14 -0
  226. package/workContextAccess-VU5I4LKZ.js +11 -0
  227. package/workContextWriteNotice-YCSSMHN4.js +7 -0
  228. package/{workloadLifecycle-HFJIN5IZ.js → workloadLifecycle-ZCSQCHG3.js} +2 -2
  229. package/agentRecordCommands-IZYUVHME.js +0 -177
  230. package/chunk-5ZMIIR23.js +0 -265
  231. package/chunk-62HXNQVV.js +0 -134
  232. package/chunk-TUSTONB3.js +0 -81
  233. package/chunk-ZXF6D3I6.js +0 -359
  234. package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
  235. /package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
@@ -1,18 +1,18 @@
1
- import {
2
- resolveRuntimeAuthToken,
3
- resolveRuntimeServerUrl
4
- } from "./chunk-2X7WFDT6.js";
5
1
  import {
6
2
  isAgentRunTerminalStatus,
7
3
  normalizeRunTitle,
8
4
  shortAgentKey
9
- } from "./chunk-OOJNQK6V.js";
5
+ } from "./chunk-S25VJYXV.js";
10
6
  import {
11
7
  findPowerShellExecutable
12
- } from "./chunk-VMJVAJ6W.js";
8
+ } from "./chunk-CTIEJRTP.js";
13
9
  import {
14
10
  AUTH_ERROR_PATTERNS
15
11
  } from "./chunk-EWQ3HGNZ.js";
12
+ import {
13
+ resolveRuntimeAuthToken,
14
+ resolveRuntimeServerUrl
15
+ } from "./chunk-GX6DITLQ.js";
16
16
  import {
17
17
  AGENT_RUN_PROTOCOL,
18
18
  HOST_RUNTIME_CONTENT_IDENTITY,
@@ -26,9 +26,200 @@ import {
26
26
  isRecord
27
27
  } from "./chunk-KUG52IAP.js";
28
28
 
29
+ // packages/cli/mcp/mcpApprovalTransport.ts
30
+ import { randomUUID, createHash } from "node:crypto";
31
+
32
+ // packages/cli/client/inheritedApprovalChannel.ts
33
+ function sendInheritedApproval(channel, kind, message, failed) {
34
+ if (channel.connected === false || !channel.send) {
35
+ failed();
36
+ return;
37
+ }
38
+ try {
39
+ channel.send({ kind, ...message }, (error) => {
40
+ if (error) failed();
41
+ });
42
+ } catch {
43
+ failed();
44
+ }
45
+ }
46
+ function bindInheritedApprovalLifetime(channel, close, signal) {
47
+ for (const event of ["disconnect", "exit", "error"]) channel.on(event, close);
48
+ signal?.addEventListener("abort", close, { once: true });
49
+ return () => {
50
+ for (const event of ["disconnect", "exit", "error"]) channel.removeListener(event, close);
51
+ signal?.removeEventListener("abort", close);
52
+ };
53
+ }
54
+
55
+ // packages/cli/mcp/mcpApprovalTransport.ts
56
+ var KIND = "nolo.mcp-approval.v1";
57
+ var TTL = 6e4;
58
+ var MAX = 256;
59
+ function canonical(value) {
60
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
61
+ if (value && typeof value === "object") return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`).join(",")}}`;
62
+ return JSON.stringify(value);
63
+ }
64
+ function snapshot(preview) {
65
+ return createHash("sha256").update(JSON.stringify(preview)).digest("hex");
66
+ }
67
+ function valid(preview, binding) {
68
+ const b = preview?.binding;
69
+ return b && b.authenticatedUserId === binding.ownerUserId && b.agentKey === binding.agentKey && typeof b.dialogId === "string" && b.dialogId.length > 0 && b.placement?.kind === "local" && typeof b.connectionId === "string" && Number.isInteger(b.connectionRevision) && b.connectionRevision > 0 && typeof b.catalogRevision === "string" && typeof b.toolName === "string" && /^[a-f0-9]{64}$/.test(b.argumentsDigest) && preview.arguments && typeof preview.arguments === "object" && !Array.isArray(preview.arguments) && createHash("sha256").update(canonical(preview.arguments)).digest("hex") === b.argumentsDigest && Number.isFinite(preview.expiresAt) && preview.expiresAt > Date.now() && preview.expiresAt <= Date.now() + TTL;
70
+ }
71
+ function attachMcpApprovalHost(channel, host) {
72
+ const binding = Object.freeze({ ...host.binding });
73
+ let closed = false;
74
+ let count = 0;
75
+ const seen = /* @__PURE__ */ new Set();
76
+ const active = /* @__PURE__ */ new Map();
77
+ const send2 = (message) => sendInheritedApproval(channel, KIND, message, close);
78
+ let unbind = () => {
79
+ };
80
+ const close = () => {
81
+ if (closed) return;
82
+ closed = true;
83
+ for (const controller of active.values()) controller.abort();
84
+ active.clear();
85
+ sendInheritedApproval(channel, KIND, { type: "revoke" }, () => {
86
+ });
87
+ channel.removeListener("message", receive);
88
+ unbind();
89
+ };
90
+ const receive = (m) => {
91
+ if (closed || m?.kind !== KIND) return;
92
+ if (m.type === "hello") {
93
+ send2({ type: "binding", binding });
94
+ return;
95
+ }
96
+ if (m.type === "cancel") {
97
+ active.get(m.id)?.abort();
98
+ return;
99
+ }
100
+ if (m.type !== "request") return;
101
+ if (++count > MAX || typeof m.id !== "string" || seen.has(m.id)) {
102
+ close();
103
+ return;
104
+ }
105
+ seen.add(m.id);
106
+ let preview;
107
+ try {
108
+ if (typeof m.snapshot !== "string" || JSON.stringify(m.preview).length > 262144) throw new Error("invalid preview");
109
+ preview = structuredClone(m.preview);
110
+ if (m.runId !== binding.runId || !valid(preview, binding) || snapshot(preview) !== m.snapshot) throw new Error("binding mismatch");
111
+ } catch {
112
+ send2({ type: "decision", id: m.id, runId: binding.runId, snapshot: m.snapshot, decision: "deny" });
113
+ return;
114
+ }
115
+ const controller = new AbortController();
116
+ active.set(m.id, controller);
117
+ const timer = setTimeout(() => controller.abort(), Math.max(0, preview.expiresAt - Date.now()));
118
+ void new Promise((resolve2) => {
119
+ controller.signal.addEventListener("abort", () => resolve2("deny"), { once: true });
120
+ Promise.resolve().then(() => closed || controller.signal.aborted ? "deny" : host.confirm(preview, controller.signal, { runId: binding.runId, requestId: m.id })).then(resolve2, () => resolve2("unavailable"));
121
+ }).then((decision) => {
122
+ clearTimeout(timer);
123
+ active.delete(m.id);
124
+ if (!closed) send2({
125
+ type: "decision",
126
+ id: m.id,
127
+ runId: binding.runId,
128
+ snapshot: m.snapshot,
129
+ decision: !controller.signal.aborted && Date.now() < preview.expiresAt ? decision : "deny"
130
+ });
131
+ });
132
+ };
133
+ channel.on("message", receive);
134
+ unbind = bindInheritedApprovalLifetime(channel, close, host.signal);
135
+ if (host.signal.aborted || channel.connected === false) close();
136
+ return close;
137
+ }
138
+ function createMcpApprovalChild(channel) {
139
+ const lifetime = new AbortController();
140
+ let binding;
141
+ let count = 0;
142
+ let closed = false;
143
+ const pending = /* @__PURE__ */ new Map();
144
+ const readyResolvers = /* @__PURE__ */ new Set();
145
+ let unbind = () => {
146
+ };
147
+ const close = () => {
148
+ if (closed) return;
149
+ closed = true;
150
+ lifetime.abort();
151
+ for (const entry of pending.values()) entry.finish("unavailable");
152
+ for (const resolve2 of readyResolvers) resolve2();
153
+ readyResolvers.clear();
154
+ channel.removeListener("message", receive);
155
+ unbind();
156
+ };
157
+ const send2 = (message) => sendInheritedApproval(channel, KIND, message, close);
158
+ const receive = (m) => {
159
+ if (closed || m?.kind !== KIND) return;
160
+ if (m.type === "revoke") {
161
+ close();
162
+ return;
163
+ }
164
+ if (m.type === "binding") {
165
+ if (binding || !m.binding || typeof m.binding.runId !== "string" || typeof m.binding.ownerUserId !== "string" || typeof m.binding.agentKey !== "string") {
166
+ close();
167
+ return;
168
+ }
169
+ binding = Object.freeze({ ...m.binding });
170
+ for (const resolve2 of readyResolvers) resolve2();
171
+ readyResolvers.clear();
172
+ return;
173
+ }
174
+ if (m.type !== "decision") return;
175
+ const entry = pending.get(m.id);
176
+ if (!entry) return;
177
+ const matches = binding && m.runId === binding.runId && m.snapshot === entry.snapshot && Date.now() < entry.expiresAt;
178
+ entry.finish(!matches ? "deny" : m.decision === "approve" ? "approve" : m.decision === "unavailable" ? "unavailable" : "deny");
179
+ };
180
+ channel.on("message", receive);
181
+ unbind = bindInheritedApprovalLifetime(channel, close);
182
+ send2({ type: "hello" });
183
+ const confirm = async (input, signal) => {
184
+ if (closed || signal.aborted || ++count > MAX) return "unavailable";
185
+ if (!binding) await new Promise((resolve2) => {
186
+ const done = () => {
187
+ clearTimeout(timer);
188
+ readyResolvers.delete(done);
189
+ signal.removeEventListener("abort", done);
190
+ resolve2();
191
+ };
192
+ const timer = setTimeout(done, Math.max(0, Math.min(TTL, input.expiresAt - Date.now())));
193
+ readyResolvers.add(done);
194
+ signal.addEventListener("abort", done, { once: true });
195
+ });
196
+ if (closed || !binding) return "unavailable";
197
+ if (signal.aborted || !valid(input, binding)) return "deny";
198
+ const preview = structuredClone(input), id = randomUUID(), digest = snapshot(preview);
199
+ return new Promise((resolve2) => {
200
+ const abort = () => {
201
+ send2({ type: "cancel", id });
202
+ finish("deny");
203
+ };
204
+ const timer = setTimeout(abort, Math.max(0, preview.expiresAt - Date.now()));
205
+ const finish = (value) => {
206
+ if (!pending.delete(id)) return;
207
+ clearTimeout(timer);
208
+ signal.removeEventListener("abort", abort);
209
+ resolve2(value);
210
+ };
211
+ pending.set(id, { finish, snapshot: digest, expiresAt: preview.expiresAt });
212
+ signal.addEventListener("abort", abort, { once: true });
213
+ if (signal.aborted) abort();
214
+ else send2({ type: "request", id, runId: binding.runId, snapshot: digest, preview });
215
+ });
216
+ };
217
+ return { confirm, signal: lifetime.signal, close };
218
+ }
219
+
29
220
  // packages/cli/client/originShellApprovalTransport.ts
30
221
  import { realpathSync } from "node:fs";
31
- import { randomUUID } from "node:crypto";
222
+ import { randomUUID as randomUUID2 } from "node:crypto";
32
223
 
33
224
  // packages/cli/client/originShellApprovalBridge.ts
34
225
  import { isAbsolute } from "node:path";
@@ -45,7 +236,7 @@ function createOriginShellApprovalBridge(deps) {
45
236
  }
46
237
  const requests = /* @__PURE__ */ new Map();
47
238
  const fail = (reason) => ({ ok: false, reason });
48
- const snapshot = (request) => ({ ok: true, request: { ...request } });
239
+ const snapshot2 = (request) => ({ ok: true, request: { ...request } });
49
240
  const validIdentity = (call) => {
50
241
  try {
51
242
  return IDENTITY_KEYS.every((key) => typeof call[key] === "string" && call[key].trim().length > 0 && call[key] === binding[key]) && isAbsolute(call.workspaceRoot) && deps.resolveWorkspace(call.workspaceRoot) === binding.workspaceRoot;
@@ -71,7 +262,7 @@ function createOriginShellApprovalBridge(deps) {
71
262
  const request = requests.get(id);
72
263
  if (!request) return fail("unknown_request");
73
264
  if (!CALL_KEYS.every((key) => request[key] === call[key])) return fail("call_mismatch");
74
- return snapshot(request);
265
+ return snapshot2(request);
75
266
  };
76
267
  return {
77
268
  request(call) {
@@ -99,7 +290,7 @@ function createOriginShellApprovalBridge(deps) {
99
290
  state: "pending"
100
291
  };
101
292
  requests.set(requestId, request);
102
- return snapshot(request);
293
+ return snapshot2(request);
103
294
  },
104
295
  decide(id, call, decision) {
105
296
  const result = lookup(id, call);
@@ -113,7 +304,7 @@ function createOriginShellApprovalBridge(deps) {
113
304
  state: decision === "approve" ? "approved" : "denied"
114
305
  };
115
306
  requests.set(id, request);
116
- return snapshot(request);
307
+ return snapshot2(request);
117
308
  },
118
309
  revoke() {
119
310
  for (const [id, request] of requests) {
@@ -129,15 +320,15 @@ function createOriginShellApprovalBridge(deps) {
129
320
  if (result.request.state !== "approved") return fail(result.request.state);
130
321
  const request = { ...result.request, state: "consumed" };
131
322
  requests.set(id, request);
132
- return snapshot(request);
323
+ return snapshot2(request);
133
324
  }
134
325
  };
135
326
  }
136
327
 
137
328
  // packages/cli/client/originShellApprovalTransport.ts
138
- var KIND = "nolo.shell-approval.v1";
139
- var MAX = 256;
140
- var TTL = 6e4;
329
+ var KIND2 = "nolo.shell-approval.v1";
330
+ var MAX2 = 256;
331
+ var TTL2 = 6e4;
141
332
  var NOTICE = "Executes with this local user's reachable permissions; workspace is NOT a directory sandbox.";
142
333
  function payloadCall(payload, binding) {
143
334
  if (typeof payload !== "string" || payload.length > 262144) throw new Error("Invalid approval payload");
@@ -149,17 +340,25 @@ function payloadCall(payload, binding) {
149
340
  }
150
341
  function send(channel, message) {
151
342
  if (channel.connected === false || !channel.send) throw new Error("Approval channel disconnected");
152
- channel.send({ kind: KIND, ...message });
343
+ channel.send({ kind: KIND2, ...message });
344
+ }
345
+ var liveApprovalHosts = /* @__PURE__ */ new Set();
346
+ function hasLiveShellApprovalHosts() {
347
+ return liveApprovalHosts.size > 0;
153
348
  }
154
349
  function attachShellApprovalHost(channel, host) {
155
350
  const binding = Object.freeze({ ...host.binding });
156
351
  const bridge = createOriginShellApprovalBridge({ binding, resolveWorkspace: realpathSync });
352
+ const connection = {};
157
353
  let closed = false;
158
354
  let count = 0;
159
355
  const active = /* @__PURE__ */ new Set();
356
+ let unbindLifetime = () => {
357
+ };
160
358
  const close = () => {
161
359
  if (closed) return;
162
360
  closed = true;
361
+ liveApprovalHosts.delete(connection);
163
362
  bridge.revoke();
164
363
  for (const controller of active) controller.abort();
165
364
  active.clear();
@@ -168,13 +367,10 @@ function attachShellApprovalHost(channel, host) {
168
367
  } catch {
169
368
  }
170
369
  channel.removeListener("message", receive);
171
- channel.removeListener("disconnect", close);
172
- channel.removeListener("exit", close);
173
- channel.removeListener("error", close);
174
- host.signal.removeEventListener("abort", close);
370
+ unbindLifetime();
175
371
  };
176
372
  const receive = (message) => {
177
- if (closed || message?.kind !== KIND) return;
373
+ if (closed || message?.kind !== KIND2) return;
178
374
  if (message.type === "hello") {
179
375
  try {
180
376
  send(channel, { type: "binding", binding });
@@ -184,7 +380,7 @@ function attachShellApprovalHost(channel, host) {
184
380
  return;
185
381
  }
186
382
  if (message.type !== "request") return;
187
- if (++count > MAX || typeof message.id !== "string" || message.id.length > 100) {
383
+ if (++count > MAX2 || typeof message.id !== "string" || message.id.length > 100) {
188
384
  close();
189
385
  return;
190
386
  }
@@ -241,14 +437,12 @@ function attachShellApprovalHost(channel, host) {
241
437
  })();
242
438
  };
243
439
  channel.on("message", receive);
244
- channel.on("disconnect", close);
245
- channel.on("exit", close);
246
- channel.on("error", close);
247
- host.signal.addEventListener("abort", close, { once: true });
248
- if (host.signal.aborted) close();
440
+ unbindLifetime = bindInheritedApprovalLifetime(channel, close, host.signal);
441
+ liveApprovalHosts.add(connection);
442
+ if (host.signal.aborted || channel.connected === false) close();
249
443
  return close;
250
444
  }
251
- function createShellApprovalChild(channel, timeoutMs = TTL) {
445
+ function createShellApprovalChild(channel, timeoutMs = TTL2) {
252
446
  let closed = false;
253
447
  let binding;
254
448
  let count = 0;
@@ -267,7 +461,7 @@ function createShellApprovalChild(channel, timeoutMs = TTL) {
267
461
  channel.removeListener("disconnect", close);
268
462
  };
269
463
  const receive = (message) => {
270
- if (closed || message?.kind !== KIND) return;
464
+ if (closed || message?.kind !== KIND2) return;
271
465
  if (message.type === "revoke") {
272
466
  close();
273
467
  return;
@@ -285,7 +479,7 @@ function createShellApprovalChild(channel, timeoutMs = TTL) {
285
479
  if (!entry) return;
286
480
  pending.delete(message.id);
287
481
  clearTimeout(entry.timer);
288
- if (!binding || message.runId !== binding.runId || message.approved !== true || typeof message.ticket !== "string" || !Number.isFinite(message.expiresAt) || message.expiresAt <= Date.now() || message.expiresAt > Date.now() + TTL || tickets.has(message.ticket)) {
482
+ if (!binding || message.runId !== binding.runId || message.approved !== true || typeof message.ticket !== "string" || !Number.isFinite(message.expiresAt) || message.expiresAt <= Date.now() || message.expiresAt > Date.now() + TTL2 || tickets.has(message.ticket)) {
289
483
  entry.reject(new Error("Shell approval denied"));
290
484
  return;
291
485
  }
@@ -303,17 +497,17 @@ function createShellApprovalChild(channel, timeoutMs = TTL) {
303
497
  close,
304
498
  authority: {
305
499
  async request(payload) {
306
- if (++count > MAX) throw new Error("Shell approval capacity exceeded");
307
- const deadline = Date.now() + Math.min(timeoutMs, TTL);
500
+ if (++count > MAX2) throw new Error("Shell approval capacity exceeded");
501
+ const deadline = Date.now() + Math.min(timeoutMs, TTL2);
308
502
  while (!binding && !closed && Date.now() < deadline) await new Promise((resolve2) => setTimeout(resolve2, 5));
309
503
  if (closed || !binding) throw new Error("Shell approval unavailable");
310
504
  payloadCall(payload, binding);
311
- const id = randomUUID();
505
+ const id = randomUUID2();
312
506
  return new Promise((resolve2, reject) => {
313
507
  const timer = setTimeout(() => {
314
508
  pending.delete(id);
315
509
  reject(new Error("Shell approval timeout"));
316
- }, Math.min(timeoutMs, TTL));
510
+ }, Math.min(timeoutMs, TTL2));
317
511
  pending.set(id, { payload, resolve: resolve2, reject, timer });
318
512
  try {
319
513
  send(channel, { type: "request", id, runId: binding.runId, payload });
@@ -456,7 +650,7 @@ function redactLogLines(lines, options = {}) {
456
650
  import { hostname as nodeHostname, homedir as nodeHomedir } from "node:os";
457
651
  import { dirname, isAbsolute as isAbsolute2, join as join2, resolve } from "node:path";
458
652
  import * as nodeFs2 from "node:fs";
459
- import { randomUUID as randomUUID2, createHash } from "node:crypto";
653
+ import { randomUUID as randomUUID3, createHash as createHash2 } from "node:crypto";
460
654
  import { execFileSync as nodeExecFileSync, spawn as nodeSpawn } from "node:child_process";
461
655
 
462
656
  // packages/cli/client/hostMemory.ts
@@ -705,7 +899,7 @@ var HostMemoryAdmissionError = class extends Error {
705
899
  };
706
900
  function assertHostMemoryAdmission(deps = {}) {
707
901
  const readMem = deps.readHostMemory ?? readHostMemory;
708
- const snapshot = readMem(deps.hostMemoryDeps);
902
+ const snapshot2 = readMem(deps.hostMemoryDeps);
709
903
  const minAvailableMb = deps.minAvailableMb ?? LOCAL_AGENT_RUN_MIN_AVAILABLE_MB;
710
904
  const startupWindowMs = deps.startupWindowMs ?? STARTUP_WINDOW_MS;
711
905
  const reservedMbPerRun = deps.reservedMbPerRun ?? STARTUP_WINDOW_RESERVED_MB_PER_RUN;
@@ -713,7 +907,7 @@ function assertHostMemoryAdmission(deps = {}) {
713
907
  for (const [name, value] of Object.entries({ minAvailableMb, startupWindowMs, reservedMbPerRun, now })) {
714
908
  if (typeof value !== "number" || !Number.isFinite(value) || value < 0) throw new Error(`Invalid ${name}`);
715
909
  }
716
- if (!snapshot) {
910
+ if (!snapshot2) {
717
911
  throw new HostMemoryAdmissionError(
718
912
  `[host-memory-admission] \u65E0\u6CD5\u6D4B\u5B9A\u672C\u673A\u53EF\u7528\u5185\u5B58\uFF08\u5FEB\u7167\u4E3A null\uFF09\uFF0C\u62D2\u7EDD\u672C\u5730 fork\u3002\u9700\u786E\u4FDD /proc/meminfo \u6216 OS \u5185\u5B58\u6307\u6807\u53EF\u8BFB\u3002`,
719
913
  {
@@ -727,19 +921,19 @@ function assertHostMemoryAdmission(deps = {}) {
727
921
  }
728
922
  );
729
923
  }
730
- if (!["cgroup", "proc-meminfo", "os"].includes(snapshot.source)) throw new Error("Unknown host memory source");
924
+ if (!["cgroup", "proc-meminfo", "os"].includes(snapshot2.source)) throw new Error("Unknown host memory source");
731
925
  let effectiveAvailableMb = null;
732
926
  let limitingSource = "host";
733
- if (snapshot.source === "cgroup") {
734
- const cgroupAvail = snapshot.availableMb;
735
- const hostAvail = snapshot.hostAvailableMb;
927
+ if (snapshot2.source === "cgroup") {
928
+ const cgroupAvail = snapshot2.availableMb;
929
+ const hostAvail = snapshot2.hostAvailableMb;
736
930
  if (cgroupAvail === null || typeof cgroupAvail !== "number" || Number.isNaN(cgroupAvail) || !Number.isFinite(cgroupAvail) || cgroupAvail < 0) {
737
931
  throw new HostMemoryAdmissionError(
738
932
  `[host-memory-admission] cgroup \u914D\u989D\u5185\u5B58\u5360\u7528\u672A\u77E5\u6216\u65E0\u6548\uFF0C\u62D2\u7EDD\u65E0\u58F0\u5F53\u5145\u8DB3\u3002`,
739
933
  {
740
934
  effectiveAvailableMb: null,
741
935
  requiredMinMb: minAvailableMb,
742
- source: snapshot.source,
936
+ source: snapshot2.source,
743
937
  limitingSource: "cgroup",
744
938
  activeStartupRuns: 0,
745
939
  reservedStartupMb: 0,
@@ -751,7 +945,7 @@ function assertHostMemoryAdmission(deps = {}) {
751
945
  throw new HostMemoryAdmissionError("[host-memory-admission] \u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u672A\u77E5\u6216\u65E0\u6548\uFF0C\u62D2\u7EDD\u672C\u5730 fork\u3002", {
752
946
  effectiveAvailableMb: null,
753
947
  requiredMinMb: minAvailableMb,
754
- source: snapshot.source,
948
+ source: snapshot2.source,
755
949
  limitingSource: "host",
756
950
  activeStartupRuns: 0,
757
951
  reservedStartupMb: 0,
@@ -771,13 +965,13 @@ function assertHostMemoryAdmission(deps = {}) {
771
965
  limitingSource = "cgroup";
772
966
  }
773
967
  } else {
774
- if (snapshot.availableMb === null || typeof snapshot.availableMb !== "number" || Number.isNaN(snapshot.availableMb) || !Number.isFinite(snapshot.availableMb) || snapshot.availableMb < 0) {
968
+ if (snapshot2.availableMb === null || typeof snapshot2.availableMb !== "number" || Number.isNaN(snapshot2.availableMb) || !Number.isFinite(snapshot2.availableMb) || snapshot2.availableMb < 0) {
775
969
  throw new HostMemoryAdmissionError(
776
970
  `[host-memory-admission] \u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u672A\u77E5\u6216\u65E0\u6548\uFF0C\u62D2\u7EDD\u65E0\u58F0\u5F53\u5145\u8DB3\u3002`,
777
971
  {
778
972
  effectiveAvailableMb: null,
779
973
  requiredMinMb: minAvailableMb,
780
- source: snapshot.source,
974
+ source: snapshot2.source,
781
975
  limitingSource: "host",
782
976
  activeStartupRuns: 0,
783
977
  reservedStartupMb: 0,
@@ -785,7 +979,7 @@ function assertHostMemoryAdmission(deps = {}) {
785
979
  }
786
980
  );
787
981
  }
788
- effectiveAvailableMb = snapshot.availableMb;
982
+ effectiveAvailableMb = snapshot2.availableMb;
789
983
  limitingSource = "host";
790
984
  }
791
985
  let activeStartupRuns = 0;
@@ -797,7 +991,7 @@ function assertHostMemoryAdmission(deps = {}) {
797
991
  {
798
992
  effectiveAvailableMb,
799
993
  requiredMinMb: minAvailableMb,
800
- source: snapshot.source,
994
+ source: snapshot2.source,
801
995
  limitingSource,
802
996
  activeStartupRuns: 0,
803
997
  reservedStartupMb: 0,
@@ -812,7 +1006,7 @@ function assertHostMemoryAdmission(deps = {}) {
812
1006
  {
813
1007
  effectiveAvailableMb,
814
1008
  requiredMinMb: minAvailableMb,
815
- source: snapshot.source,
1009
+ source: snapshot2.source,
816
1010
  limitingSource,
817
1011
  activeStartupRuns: 0,
818
1012
  reservedStartupMb: 0,
@@ -828,7 +1022,7 @@ function assertHostMemoryAdmission(deps = {}) {
828
1022
  {
829
1023
  effectiveAvailableMb,
830
1024
  requiredMinMb: minAvailableMb,
831
- source: snapshot.source,
1025
+ source: snapshot2.source,
832
1026
  limitingSource,
833
1027
  activeStartupRuns: 0,
834
1028
  reservedStartupMb: 0,
@@ -850,7 +1044,7 @@ function assertHostMemoryAdmission(deps = {}) {
850
1044
  {
851
1045
  effectiveAvailableMb: netAvailableMb,
852
1046
  requiredMinMb: minAvailableMb,
853
- source: snapshot.source,
1047
+ source: snapshot2.source,
854
1048
  limitingSource,
855
1049
  activeStartupRuns,
856
1050
  reservedStartupMb,
@@ -863,7 +1057,7 @@ function assertHostMemoryAdmission(deps = {}) {
863
1057
  effectiveAvailableMb: netAvailableMb,
864
1058
  requiredMinMb: minAvailableMb,
865
1059
  activeStartupRuns,
866
- snapshot
1060
+ snapshot: snapshot2
867
1061
  };
868
1062
  }
869
1063
 
@@ -2027,6 +2221,42 @@ function listRunRecords(deps = {}) {
2027
2221
  (a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime()
2028
2222
  );
2029
2223
  }
2224
+ function listRecentRunRecords(deps = {}) {
2225
+ const limit = deps.limit ?? 400;
2226
+ if (!Number.isFinite(limit) || limit <= 0) return [];
2227
+ const fs = deps.fs ?? nodeFs2;
2228
+ const dir = resolveRunsDir(deps.env, deps.homedir);
2229
+ let entries = [];
2230
+ try {
2231
+ entries = fs.readdirSync(dir);
2232
+ } catch {
2233
+ return [];
2234
+ }
2235
+ const timestampedRuns = [];
2236
+ const customRuns = [];
2237
+ for (const entry of entries) {
2238
+ if (!entry.endsWith(".json") || entry.startsWith("acked-") || entry.startsWith("busy-ack-") || entry.endsWith(".isolation.json") || entry.includes(".result.")) {
2239
+ continue;
2240
+ }
2241
+ if (entry.startsWith("run-")) {
2242
+ timestampedRuns.push(entry);
2243
+ } else {
2244
+ customRuns.push(entry);
2245
+ }
2246
+ }
2247
+ timestampedRuns.sort((a, b) => a < b ? 1 : a > b ? -1 : 0);
2248
+ const candidates = timestampedRuns.length >= limit ? timestampedRuns : [...timestampedRuns, ...customRuns.sort((a, b) => a < b ? 1 : a > b ? -1 : 0)];
2249
+ const records = [];
2250
+ for (const entry of candidates) {
2251
+ if (records.length >= limit) break;
2252
+ const runId = entry.slice(0, -".json".length);
2253
+ const record = readRunRecord(runId, deps);
2254
+ if (record) records.push(record);
2255
+ }
2256
+ return records.sort(
2257
+ (a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime()
2258
+ );
2259
+ }
2030
2260
  async function listRunRecordsAsync(deps = {}) {
2031
2261
  const dir = resolveRunsDir(deps.env, deps.homedir);
2032
2262
  let entries;
@@ -2159,7 +2389,7 @@ async function gcRunRecords(deps = {}, options = {}) {
2159
2389
  if (artifact.publisher !== "run-result-v1" || !/^[A-Za-z0-9._-]+$/.test(record.runId) || !["pending", "bak"].includes(artifact.kind) || !new RegExp(`^${uuid}\\.${artifact.kind}$`).test(name) || artifact.path !== join2(runsDirForLegacy, prefix + name)) throw new Error("unsafe artifact ownership");
2160
2390
  if (!fs.existsSync(artifact.path)) continue;
2161
2391
  const stat = fs.lstatSync?.(artifact.path);
2162
- if (!stat || !stat.isFile() || stat.isSymbolicLink() || fs.realpathSync?.(artifact.path) !== resolve(artifact.path) || String(stat.dev) !== artifact.dev || String(stat.ino) !== artifact.ino || createHash("sha256").update(fs.readFileSync(artifact.path)).digest("hex") !== artifact.sha256) {
2392
+ if (!stat || !stat.isFile() || stat.isSymbolicLink() || fs.realpathSync?.(artifact.path) !== resolve(artifact.path) || String(stat.dev) !== artifact.dev || String(stat.ino) !== artifact.ino || createHash2("sha256").update(fs.readFileSync(artifact.path)).digest("hex") !== artifact.sha256) {
2163
2393
  throw new Error("artifact identity changed");
2164
2394
  }
2165
2395
  if (!tryUnlinkFile(fs, artifact.path)) artifactsOk = false;
@@ -2341,11 +2571,11 @@ function localWriterRecovery(record) {
2341
2571
  function revokePreparedWriterLaunch(runId, attemptId, deps = {}) {
2342
2572
  if (!/^[A-Za-z0-9_-]+$/.test(runId) || !attemptId) return "blocked";
2343
2573
  return withRunRecordLock("local-writer-admission", deps, () => {
2344
- const snapshot = readRunRecord(runId, deps);
2345
- if (!snapshot) return "blocked";
2574
+ const snapshot2 = readRunRecord(runId, deps);
2575
+ if (!snapshot2) return "blocked";
2346
2576
  return withRunRecordLock(runId, deps, () => {
2347
2577
  const latest = readRunRecord(runId, deps);
2348
- if (!latest || JSON.stringify(latest) !== JSON.stringify(snapshot)) return "blocked";
2578
+ if (!latest || JSON.stringify(latest) !== JSON.stringify(snapshot2)) return "blocked";
2349
2579
  const launch = latest.writerLaunch;
2350
2580
  if (launch?.protocol !== "fenced-launch-v1" || launch.attemptId !== attemptId) return "blocked";
2351
2581
  if (launch.phase === "revoked") return latest.localWriterClaim?.state === "released" ? "already-revoked" : "blocked";
@@ -2364,10 +2594,10 @@ function localWriterStillOwns(record, deps) {
2364
2594
  const observed = e?.state === "known" && e.owner.state === "verified" ? nativeOwner(record.pid, deps) : void 0;
2365
2595
  const reused = observed?.state === "verified" && e?.state === "known" && e.owner.state === "verified" && (observed.startedAt !== e.owner.startedAt || (observed.linux?.bootId !== e.owner.linux?.bootId || observed.linux?.startTicks !== e.owner.linux?.startTicks));
2366
2596
  if (!isPidGone(record.pid, deps) && !reused) return true;
2367
- const snapshot = JSON.stringify(record);
2597
+ const snapshot2 = JSON.stringify(record);
2368
2598
  const released = withRunRecordLock(record.runId, deps, () => {
2369
2599
  const latest = readRunRecord(record.runId, deps);
2370
- if (!latest || JSON.stringify(latest) !== snapshot) return false;
2600
+ if (!latest || JSON.stringify(latest) !== snapshot2) return false;
2371
2601
  latest.localWriterClaim.state = "released";
2372
2602
  writeRunRecord(latest, deps);
2373
2603
  return true;
@@ -2376,14 +2606,14 @@ function localWriterStillOwns(record, deps) {
2376
2606
  }
2377
2607
  function acquireLocalWriterClaim(runId, cwd, deps) {
2378
2608
  const fs = deps.fs ?? nodeFs2;
2379
- const canonical = String((fs.realpathSync ?? nodeFs2.realpathSync)(cwd));
2380
- const worktree = trustedLocalWorktree(canonical, deps);
2609
+ const canonical2 = String((fs.realpathSync ?? nodeFs2.realpathSync)(cwd));
2610
+ const worktree = trustedLocalWorktree(canonical2, deps);
2381
2611
  const acquired = withRunRecordLock("local-writer-admission", deps, () => {
2382
2612
  const updated = withRunRecordLock(runId, deps, () => {
2383
2613
  const record = readRunRecord(runId, deps);
2384
2614
  if (!record) throw new Error(`[local-writer-resource] missing run ${runId}`);
2385
2615
  if (record.writerLaunch?.phase === "revoked") throw new Error("[local-writer-resource] claim attempt revoked");
2386
- record.localWriterClaim = { cwd: canonical, ...worktree ? { worktree } : {}, state: "held" };
2616
+ record.localWriterClaim = { cwd: canonical2, ...worktree ? { worktree } : {}, state: "held" };
2387
2617
  if (record.writerLaunch && record.execution?.state === "known" && record.execution.owner.state === "verified" && record.pid === process.pid) {
2388
2618
  record.writerLaunch.phase = "granted";
2389
2619
  }
@@ -2394,7 +2624,7 @@ function acquireLocalWriterClaim(runId, cwd, deps) {
2394
2624
  return true;
2395
2625
  }, { strict: true, requireDeadOwner: true });
2396
2626
  if (!acquired) throw new Error("[local-writer-resource] admission lock busy; no child spawned");
2397
- return canonical;
2627
+ return canonical2;
2398
2628
  }
2399
2629
  function nativeOwner(pid, deps) {
2400
2630
  const first = probeProcessStartTime(pid, deps);
@@ -2494,19 +2724,19 @@ function resolveLocalContinuation(record, deps = {}) {
2494
2724
  }
2495
2725
  function registerLocalForegroundWriter(cwd, policy, agentKey, deps = {}) {
2496
2726
  const fs = deps.fs ?? nodeFs2;
2497
- const canonical = String((fs.realpathSync ?? nodeFs2.realpathSync)(cwd));
2727
+ const canonical2 = String((fs.realpathSync ?? nodeFs2.realpathSync)(cwd));
2498
2728
  const owner = nativeOwner(process.pid, deps);
2499
2729
  if (owner.state !== "verified" || policy.readOnly || !policy.hostWritesAuthorized) {
2500
2730
  throw new Error("[local-writer-resource] foreground native identity/authorization unknown");
2501
2731
  }
2502
2732
  const runId = defaultGenerateRunId();
2503
2733
  fs.mkdirSync(resolveRunsDir(deps.env, deps.homedir), { recursive: true });
2504
- const worktree = trustedLocalWorktree(canonical, deps);
2734
+ const worktree = trustedLocalWorktree(canonical2, deps);
2505
2735
  const record = {
2506
2736
  runId,
2507
2737
  agentKey,
2508
- writerLaunch: { protocol: "fenced-launch-v1", attemptId: randomUUID2(), phase: "prepared" },
2509
- cwd: canonical,
2738
+ writerLaunch: { protocol: "fenced-launch-v1", attemptId: randomUUID3(), phase: "prepared" },
2739
+ cwd: canonical2,
2510
2740
  startedAt: (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString(),
2511
2741
  status: "running",
2512
2742
  logPath: resolveRunLogPath(runId, deps.env, deps.homedir),
@@ -2517,7 +2747,7 @@ function registerLocalForegroundWriter(cwd, policy, agentKey, deps = {}) {
2517
2747
  state: "known",
2518
2748
  kind: "host-local",
2519
2749
  runtimeKey: "local",
2520
- canonicalCwd: canonical,
2750
+ canonicalCwd: canonical2,
2521
2751
  device: { kind: "localhost", hostname: nodeHostname(), platform: process.platform },
2522
2752
  ...worktree ? { worktree } : {},
2523
2753
  permissions: {
@@ -2532,7 +2762,7 @@ function registerLocalForegroundWriter(cwd, policy, agentKey, deps = {}) {
2532
2762
  };
2533
2763
  writeRunRecord(record, deps);
2534
2764
  try {
2535
- acquireLocalWriterClaim(runId, canonical, deps);
2765
+ acquireLocalWriterClaim(runId, canonical2, deps);
2536
2766
  } catch (error) {
2537
2767
  finalizeRunRecord(runId, { status: "failed", exitCode: 1, note: String(error) }, deps);
2538
2768
  throw error;
@@ -2551,10 +2781,13 @@ function releaseUnspawnedLocalWriterClaim(runId, deps) {
2551
2781
  }, { strict: true });
2552
2782
  if (!released) throw new Error(`[local-writer-resource] release lock busy: ${runId}`);
2553
2783
  }
2784
+ var startupPhaseOrder = { spawn: 0, initializing: 1, protocol_validated: 2, model: 3 };
2554
2785
  async function recordRunStartup(runId, phase, deps = {}) {
2555
2786
  const attempt = () => withRunRecordLock(runId, deps, () => {
2556
2787
  const record = readRunRecord(runId, deps);
2557
2788
  if (!record || isRunTerminalStatus(record.status)) return true;
2789
+ if (record.pid != null && record.pid !== process.pid) return true;
2790
+ if (record.startup && startupPhaseOrder[record.startup.phase] >= startupPhaseOrder[phase]) return true;
2558
2791
  record.startup = { protocol: AGENT_RUN_PROTOCOL, phase };
2559
2792
  writeRunRecord(record, deps);
2560
2793
  return true;
@@ -2671,7 +2904,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
2671
2904
  ...title ? { title } : {},
2672
2905
  cwd: canonicalCwd ?? input.cwd,
2673
2906
  execution,
2674
- ...executionRequest ? { writerLaunch: { protocol: "fenced-launch-v1", attemptId: randomUUID2(), phase: "prepared" } } : {},
2907
+ ...executionRequest ? { writerLaunch: { protocol: "fenced-launch-v1", attemptId: randomUUID3(), phase: "prepared" } } : {},
2675
2908
  ...executionRequest ? (() => {
2676
2909
  const parent = nativeOwner(process.pid, resolvedDeps);
2677
2910
  return parent.state === "verified" ? { ownerPublication: { state: "pending", parent } } : {};
@@ -2767,7 +3000,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
2767
3000
  detached: true,
2768
3001
  // Detached on Windows means no console; hide the one its children would create.
2769
3002
  windowsHide: true,
2770
- stdio: deps.shellApprovalHost ? ["ignore", logFd, logFd, "ipc"] : ["ignore", logFd, logFd]
3003
+ stdio: deps.shellApprovalHost || deps.mcpApprovalHost ? ["ignore", logFd, logFd, "ipc"] : ["ignore", logFd, logFd]
2771
3004
  });
2772
3005
  } catch (error) {
2773
3006
  try {
@@ -2871,6 +3104,15 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
2871
3104
  throw new Error(`[host-memory-reservation] child ${proc.pid}, run ${runId}: association failed: ${error}`);
2872
3105
  }
2873
3106
  }
3107
+ if (deps.mcpApprovalHost) {
3108
+ attachMcpApprovalHost(proc, { ...deps.mcpApprovalHost, binding: {
3109
+ ...deps.mcpApprovalHost.binding,
3110
+ runId,
3111
+ agentKey: input.agentKey,
3112
+ workspaceRoot: nodeFs2.realpathSync(input.cwd ?? process.cwd())
3113
+ } });
3114
+ proc.channel?.unref?.();
3115
+ }
2874
3116
  if (deps.shellApprovalHost) {
2875
3117
  attachShellApprovalHost(proc, { ...deps.shellApprovalHost, binding: {
2876
3118
  ...deps.shellApprovalHost.binding,
@@ -2962,6 +3204,9 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
2962
3204
  const settled = withRunRecordLock(runId, deps, () => {
2963
3205
  const record2 = readRunRecord(runId, deps);
2964
3206
  if (!record2) return { kind: "not_found" };
3207
+ if (options.expectedPid != null && record2.pid != null && record2.pid !== options.expectedPid) {
3208
+ return { kind: "kept", record: record2 };
3209
+ }
2965
3210
  const orphanCorrection = options.allowOverOrphaned === true && record2.status === "orphaned" && (update.status === "done" || update.status === "failed");
2966
3211
  if (isAgentRunTerminalStatus(record2.status) && !orphanCorrection) {
2967
3212
  if (update.processExit) {
@@ -3022,7 +3267,7 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
3022
3267
  kind,
3023
3268
  dev: String(stat.dev),
3024
3269
  ino: String(stat.ino),
3025
- sha256: createHash("sha256").update(fs.readFileSync(path)).digest("hex")
3270
+ sha256: createHash2("sha256").update(fs.readFileSync(path)).digest("hex")
3026
3271
  };
3027
3272
  record2.resultArtifacts = [...(record2.resultArtifacts ?? []).filter((a) => a.path !== path), artifact];
3028
3273
  };
@@ -3053,7 +3298,7 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
3053
3298
  update.lastAssistantText ?? ""
3054
3299
  );
3055
3300
  if (typeof fs.renameSync !== "function") throw new Error("atomic result publication requires renameSync");
3056
- pendingResultFile = `${resultFile}.${randomUUID2()}.pending`;
3301
+ pendingResultFile = `${resultFile}.${randomUUID3()}.pending`;
3057
3302
  try {
3058
3303
  fs.writeFileSync(pendingResultFile, content, { encoding: "utf8", flag: "wx" });
3059
3304
  stagingComplete = true;
@@ -3062,7 +3307,7 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
3062
3307
  }
3063
3308
  if (fs.existsSync(resultFile)) {
3064
3309
  const previous = fs.readFileSync(resultFile);
3065
- const backup = `${resultFile}.${randomUUID2()}.bak`;
3310
+ const backup = `${resultFile}.${randomUUID3()}.bak`;
3066
3311
  backupFile = backup;
3067
3312
  try {
3068
3313
  fs.writeFileSync(backup, previous, { flag: "wx" });
@@ -3110,8 +3355,11 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
3110
3355
  }
3111
3356
  var AUTHORITATIVE_SETTLE_MAX_ATTEMPTS = 4;
3112
3357
  var AUTHORITATIVE_SETTLE_RETRY_DELAY_MS = 15;
3113
- async function settleRunTerminalAuthoritatively(runId, update, deps = {}, transition = transitionRunToTerminal) {
3114
- const attempt = () => transition(runId, update, deps, { allowOverOrphaned: true });
3358
+ async function settleRunTerminalAuthoritatively(runId, update, deps = {}, transition = transitionRunToTerminal, options = {}) {
3359
+ const attempt = () => transition(runId, update, deps, {
3360
+ allowOverOrphaned: true,
3361
+ ...options.expectedPid != null ? { expectedPid: options.expectedPid } : {}
3362
+ });
3115
3363
  let result = attempt();
3116
3364
  for (let attemptNo = 1; result?.kind === "contended" && attemptNo < AUTHORITATIVE_SETTLE_MAX_ATTEMPTS; attemptNo += 1) {
3117
3365
  await (deps.sleep ?? defaultSleep)(AUTHORITATIVE_SETTLE_RETRY_DELAY_MS);
@@ -3122,9 +3370,15 @@ async function settleRunTerminalAuthoritatively(runId, update, deps = {}, transi
3122
3370
  `[nolo] authoritative settlement for run ${runId} lost the record lock ${AUTHORITATIVE_SETTLE_MAX_ATTEMPTS} times; durable record still ${result.record.status} \u2014 terminal status pending reconcile, child outcome (exitCode/dialogId/credits/DoD) may be lost`
3123
3371
  );
3124
3372
  } else if (result?.kind === "kept" && result.record.status !== update.status) {
3125
- console.warn(
3126
- `[nolo] run ${runId} already terminal (${result.record.status}); keeping the durable outcome over intended ${update.status}`
3127
- );
3373
+ if (options.expectedPid != null && result.record.pid != null && result.record.pid !== options.expectedPid) {
3374
+ console.warn(
3375
+ `[nolo] run ${runId} belongs to PID ${result.record.pid}, not ${options.expectedPid}; keeping the durable record (${result.record.status}) over intended ${update.status}`
3376
+ );
3377
+ } else {
3378
+ console.warn(
3379
+ `[nolo] run ${runId} already terminal (${result.record.status}); keeping the durable outcome over intended ${update.status}`
3380
+ );
3381
+ }
3128
3382
  }
3129
3383
  return result ?? { kind: "not_found" };
3130
3384
  }
@@ -3731,6 +3985,8 @@ async function runAgentRecoverPreparedWriterCommand(args, deps) {
3731
3985
  }
3732
3986
 
3733
3987
  export {
3988
+ createMcpApprovalChild,
3989
+ hasLiveShellApprovalHosts,
3734
3990
  createShellApprovalChild,
3735
3991
  TAIL_LINES_MAX,
3736
3992
  readHostMemory,
@@ -3776,6 +4032,7 @@ export {
3776
4032
  readRunRecord,
3777
4033
  backfillRunRecordParentDialog,
3778
4034
  listRunRecords,
4035
+ listRecentRunRecords,
3779
4036
  listRunRecordsAsync,
3780
4037
  findRunRecordByPid,
3781
4038
  findRunRecord,