nolo-cli 0.227.0-alpha.1 → 0.227.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 (258) hide show
  1. package/README.md +3 -5
  2. package/{_executeModel-JKQGZ3HU.js → _executeModel-CXOFYVHC.js} +93 -87
  3. package/{action-CK64LS6S.js → action-R2EIXR7I.js} +11 -8
  4. package/{addContentAction-CARFID6E.js → addContentAction-W6JVLQ6H.js} +17 -16
  5. package/{addDialogAgentAction-APLZLFW5.js → addDialogAgentAction-LVNKMXKZ.js} +20 -19
  6. package/{agentDeleteCommand-NVR2V2HH.js → agentDeleteCommand-VFSZPEQ5.js} +145 -137
  7. package/{agentEmailCommands-UCVOWD3S.js → agentEmailCommands-KRUIF4EH.js} +149 -137
  8. package/{agentFavoriteCommands-4PDOP3GW.js → agentFavoriteCommands-7LOP3HUD.js} +6 -6
  9. package/{agentGrantCommands-FLCEXLUH.js → agentGrantCommands-L6O2HVJI.js} +7 -7
  10. package/agentListCommands-TDFOLWN3.js +644 -0
  11. package/{agentMachineCommands-V3DGEJU4.js → agentMachineCommands-PSH7Q5PF.js} +76 -67
  12. package/{agentProviderCommands-7QBFRFRK.js → agentProviderCommands-C5T7C5KZ.js} +7 -7
  13. package/{agentPullCommand-E6JBGBVG.js → agentPullCommand-QQQZSC6S.js} +7 -7
  14. package/agentRecordCommands-KCKCW2QU.js +188 -0
  15. package/agentRunCommand-EF2T2QWD.js +223 -0
  16. package/{agentRunControl-SNZZ5XP4.js → agentRunControl-CSMSJFFB.js} +25 -17
  17. package/{agentRuntimeLocal-GOX2DIY7.js → agentRuntimeLocal-6QXQS3TS.js} +64 -50
  18. package/{agentSlice-N7H2FRJA.js → agentSlice-IZ5ANAF7.js} +19 -18
  19. package/{appDeleteCommands-LZDN26FU.js → appDeleteCommands-4M7ETEEG.js} +68 -59
  20. package/{appDeployCommands-6IO6TTZH.js → appDeployCommands-2VJ2NDW5.js} +68 -59
  21. package/{appDeployStatusCommands-FG3LX24J.js → appDeployStatusCommands-LDFSWOPQ.js} +68 -59
  22. package/{appGetCommands-NAKVDVD4.js → appGetCommands-RHVNOPT4.js} +68 -59
  23. package/{appListCommands-KL56RN73.js → appListCommands-U3XEVTL4.js} +68 -59
  24. package/{authCommand-AUN5MXV2.js → authCommand-PVZ45QRO.js} +36 -31
  25. package/{authCommands-D2IPS6ES.js → authCommands-6AUYO65N.js} +18 -13
  26. package/{builtinSkillRegistry-UQGLKRYP.js → builtinSkillRegistry-LRVAQCPW.js} +6 -6
  27. package/{chromeCommands-G5UDKVSV.js → chromeCommands-S7AW3AOD.js} +383 -6
  28. package/{chromeOpsCommands-UJWN5HWH.js → chromeOpsCommands-TBPM6MR4.js} +8 -8
  29. package/{chunk-ABGULE7H.js → chunk-22YUCKMK.js} +16 -16
  30. package/{chunk-P2ZLUIW2.js → chunk-2BSLGODA.js} +350 -25
  31. package/{chunk-GOLPOTG5.js → chunk-2COM7SAH.js} +4 -4
  32. package/{chunk-ULAQPRHX.js → chunk-2FK2KZSL.js} +1 -1
  33. package/{chunk-PLPLH2XZ.js → chunk-2IPR4PBB.js} +2 -2
  34. package/chunk-2SXN7LAY.js +15 -0
  35. package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
  36. package/{chunk-7Z3WUZ4Q.js → chunk-3YYFU6H7.js} +74 -46
  37. package/{chunk-C2B7M567.js → chunk-4OXPN3WC.js} +17 -6
  38. package/chunk-4TVOZGOS.js +62 -0
  39. package/chunk-4ZCTKB27.js +31 -0
  40. package/chunk-53AEDFBL.js +33394 -0
  41. package/chunk-53W5BXLN.js +340 -0
  42. package/{chunk-OXA5GWHU.js → chunk-56O2J2Y4.js} +3 -3
  43. package/{chunk-IAJJYHIB.js → chunk-56PB7FEN.js} +8 -8
  44. package/{chunk-JWXITTQB.js → chunk-5HUO7SEX.js} +9 -107
  45. package/{chunk-AGP3YSEC.js → chunk-5PASH2MB.js} +46 -1
  46. package/{chunk-PHOSZT3E.js → chunk-5UAKGCQG.js} +1 -1
  47. package/{chunk-5RKRXQ2H.js → chunk-5VVP7DW3.js} +20 -13
  48. package/chunk-6ASGEP5D.js +21 -0
  49. package/chunk-6PXFEPHL.js +103 -0
  50. package/chunk-6RSNVJGO.js +279 -0
  51. package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
  52. package/{chunk-KMRKZNGT.js → chunk-6YYTTLJV.js} +14 -13
  53. package/{chunk-VREDDN25.js → chunk-76HAJUOJ.js} +14 -9
  54. package/{chunk-FKEZOMIF.js → chunk-7DXFOL5B.js} +1410 -768
  55. package/{chunk-LA7JYAKF.js → chunk-AKPKOI5Z.js} +6 -6
  56. package/{chunk-PWTNI4N7.js → chunk-ANUP75N2.js} +22 -0
  57. package/{chunk-F5AY2UZL.js → chunk-AO6T7U62.js} +592 -68
  58. package/{chunk-LJSNEV7M.js → chunk-AS6L5KSD.js} +8 -8
  59. package/{chunk-GOQ6ZVTN.js → chunk-AVSZ6PBM.js} +5 -5
  60. package/chunk-BIDSIRTS.js +307 -0
  61. package/chunk-C5A54QS7.js +108 -0
  62. package/{chunk-KYH7XW3K.js → chunk-CD2DK5JA.js} +135 -14
  63. package/{chunk-G6HJUMST.js → chunk-CJQBWHNM.js} +2 -2
  64. package/{chunk-EVGU5P4U.js → chunk-CO6E7YK6.js} +1 -1
  65. package/{chunk-ZYA2YDB6.js → chunk-CT5JXREL.js} +17 -17
  66. package/{chunk-VPAZ6BEN.js → chunk-CTWCZKNS.js} +42 -17
  67. package/{chunk-4OKTPFNX.js → chunk-CX2LYFZQ.js} +107 -66
  68. package/{chunk-YFLVRVYK.js → chunk-DLT2DN4M.js} +1 -1
  69. package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
  70. package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
  71. package/{chunk-OQHIVPG4.js → chunk-E6A5NHDH.js} +4 -1
  72. package/{chunk-IX2BXN2K.js → chunk-EDT65EUE.js} +6 -6
  73. package/{chunk-VP3BINY7.js → chunk-EQZZASCD.js} +31 -1
  74. package/{chunk-45LZIYXB.js → chunk-ESN4WNWU.js} +3 -2
  75. package/{chunk-M3JEW6N6.js → chunk-F26GAEH3.js} +10 -0
  76. package/{chunk-CVERLOJM.js → chunk-F4XIS5DL.js} +1215 -1431
  77. package/chunk-FDZ2GBWO.js +166 -0
  78. package/chunk-FGHEF6WI.js +34 -0
  79. package/{chunk-CSW7IPVD.js → chunk-FMYNIAI6.js} +61 -24
  80. package/{chunk-VIHDJ3FK.js → chunk-FNT5VENS.js} +15 -15
  81. package/{chunk-PMDVQBGA.js → chunk-GAHJLSDO.js} +14 -7
  82. package/{chunk-GRXSJR2Z.js → chunk-GVTFSLNI.js} +112 -109
  83. package/{chunk-UN7HIYMH.js → chunk-GX6DITLQ.js} +1 -1
  84. package/{chunk-3VFYQH3I.js → chunk-HIDVLMZC.js} +203 -156
  85. package/{chunk-5LQDHFBN.js → chunk-IDFGIROZ.js} +20 -17
  86. package/{chunk-UCFPVYP7.js → chunk-IFWXH7LH.js} +1 -1
  87. package/{chunk-LXTC53TN.js → chunk-J45ACAOQ.js} +815 -361
  88. package/{chunk-S6K5F3KP.js → chunk-JP2BH4NC.js} +1 -1
  89. package/{chunk-X2KRQP7V.js → chunk-JV5FHHF7.js} +1 -1
  90. package/{chunk-6EDAMVG6.js → chunk-K26XPZRB.js} +11 -11
  91. package/{chunk-RU6DULV4.js → chunk-KB5RQRSJ.js} +1 -1
  92. package/{chunk-T43K75CK.js → chunk-KC2QVCI7.js} +24 -178
  93. package/chunk-KK3FCYZM.js +647 -0
  94. package/{chunk-XZODOEKU.js → chunk-KMDHRVS7.js} +29 -5
  95. package/{chunk-4JVNURX4.js → chunk-KQHEGELM.js} +68 -16
  96. package/{chunk-UAPNPNSG.js → chunk-KW72WVHO.js} +2085 -1046
  97. package/{chunk-ILHQ2AXT.js → chunk-KZAT2M2V.js} +14 -8
  98. package/{chunk-L42CBKBZ.js → chunk-KZKMH374.js} +3 -3
  99. package/{chunk-ZI5SZ3MV.js → chunk-L6BLA6BT.js} +40 -31
  100. package/{chunk-AK5O76CC.js → chunk-LC5CVWP2.js} +3 -3
  101. package/{chunk-N5Z2V73W.js → chunk-LELADM5Q.js} +1 -1
  102. package/chunk-LHCGKAFO.js +739 -0
  103. package/{chunk-YOT437BH.js → chunk-LOF2EFUE.js} +203 -123
  104. package/{chunk-YQETUZ5V.js → chunk-LTVEOOZL.js} +29 -16
  105. package/{chunk-T2BEPTAG.js → chunk-MAA42MMV.js} +272 -26
  106. package/{chunk-NAOO4PVX.js → chunk-MECW2HJG.js} +16 -16
  107. package/{chunk-5HL4KC4A.js → chunk-MEDPR36J.js} +62 -87
  108. package/chunk-MVOZ22RZ.js +26 -0
  109. package/{chunk-YPPKC6FL.js → chunk-MYYNZG2M.js} +140 -40
  110. package/{chunk-UVUVQVZ6.js → chunk-MZVCFV3T.js} +19 -15
  111. package/{chunk-CQVGR3MX.js → chunk-N7MXFYLU.js} +7 -7
  112. package/{chunk-IC2I373Q.js → chunk-NEG5LYK5.js} +4 -4
  113. package/chunk-NJJK3PDA.js +133 -0
  114. package/{chunk-OB6DVWPF.js → chunk-OGZE6BZG.js} +331 -99
  115. package/{chunk-M3Y4IBIR.js → chunk-OHUYN3YU.js} +6 -6
  116. package/chunk-P27E22MA.js +203 -0
  117. package/{chunk-SFTTXGPM.js → chunk-PDAXMBLW.js} +35 -28
  118. package/{chunk-OBSEKCVK.js → chunk-PQ63BDV3.js} +210 -51
  119. package/{chunk-EUCFKKDM.js → chunk-PVFYPUIM.js} +40 -10
  120. package/{chunk-SRG5CNLC.js → chunk-QIVE5WJE.js} +8 -8
  121. package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
  122. package/{chunk-5RKUPJYL.js → chunk-QLUYDJST.js} +11 -3
  123. package/{chunk-7Z6EW7AH.js → chunk-QOURTDZL.js} +97 -11
  124. package/{chunk-VZW34YUL.js → chunk-QWSH3UAQ.js} +8 -5
  125. package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
  126. package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
  127. package/{chunk-SW6OD4KE.js → chunk-RDPAIR67.js} +351 -18
  128. package/{chunk-NO3VBWTL.js → chunk-RXTZB2DH.js} +4 -4
  129. package/{chunk-AXYH4734.js → chunk-S25VJYXV.js} +21 -15
  130. package/{chunk-MWHOH4RJ.js → chunk-SESKIWB4.js} +6 -6
  131. package/{chunk-GUVXQSFZ.js → chunk-SF4GMDZO.js} +18 -108
  132. package/{chunk-TINJKQSO.js → chunk-SQRKAYQW.js} +25 -25
  133. package/chunk-SR4FE5VD.js +9 -0
  134. package/{chunk-3HTP4WZQ.js → chunk-SX6AWTNK.js} +46 -8
  135. package/{chunk-4WVJLODK.js → chunk-T23G6PXQ.js} +8 -3
  136. package/{chunk-CLCXHIBS.js → chunk-T4QY3HZ5.js} +1 -1
  137. package/{chunk-HVUDBOQG.js → chunk-TB5KTLNB.js} +9 -6
  138. package/{chunk-KRRE4A7D.js → chunk-TKE4OJ4B.js} +280 -56
  139. package/{chunk-S2NTVGA2.js → chunk-U35UUM5K.js} +2 -1
  140. package/{chunk-PPJYZRSQ.js → chunk-U5LOKQ2R.js} +30 -14
  141. package/{chunk-CKT6QUE2.js → chunk-UHW6SCVK.js} +1 -1
  142. package/{chunk-T5N6NHAT.js → chunk-UPOW5HTG.js} +6 -6
  143. package/{chunk-WJP4TH6U.js → chunk-VEVLLBFK.js} +2 -2
  144. package/{chunk-HGDKT2D6.js → chunk-VTHWBTRE.js} +177 -1
  145. package/{chunk-KJAAPGBE.js → chunk-VUHKG4KS.js} +6 -6
  146. package/{chunk-TOKPHZ55.js → chunk-W3HSD32M.js} +17 -10
  147. package/{chunk-2SKTCNWO.js → chunk-W5OJBZLZ.js} +4 -4
  148. package/chunk-WBSJAIZP.js +170 -0
  149. package/chunk-WDWZPASX.js +29 -0
  150. package/chunk-WFGNWWJI.js +326 -0
  151. package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
  152. package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
  153. package/{chunk-HYKGIXNO.js → chunk-XGWRH3OF.js} +114 -29
  154. package/{chunk-XIEYGCN6.js → chunk-XKV53E4E.js} +460 -117
  155. package/{chunk-JHF6VLVL.js → chunk-XYRTC2Y3.js} +155 -170
  156. package/{chunk-L5I543VB.js → chunk-YGDYYFRX.js} +20 -24
  157. package/{chunk-ZADGPNTV.js → chunk-YHWMKGOX.js} +77 -103
  158. package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
  159. package/chunk-Z6YTCDU4.js +24 -0
  160. package/{chunk-PVAWNHP5.js → chunk-ZP26NIZE.js} +647 -387
  161. package/{chunk-2G3YSVO6.js → chunk-ZQ6K57FJ.js} +3 -3
  162. package/{cliAgentConfigHelpers-QVSQYTKC.js → cliAgentConfigHelpers-37ZNEY5Y.js} +16 -16
  163. package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
  164. package/{cliEnvHelpers-D6HMC46Z.js → cliEnvHelpers-CNMP3RDX.js} +2 -2
  165. package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
  166. package/cliLocalAgentRecordReader-53773JID.js +102 -0
  167. package/{commandRegistry-TKR6OWXP.js → commandRegistry-RJUO2VOD.js} +113 -101
  168. package/{contentThunks-BQWRPCTM.js → contentThunks-4EFHLUTB.js} +44 -41
  169. package/{cooldownCommands-FZYQOWI5.js → cooldownCommands-QL6DWGVU.js} +3 -3
  170. package/{createAgentAutomationAction-GFI6SJZV.js → createAgentAutomationAction-ZFFGJ7CZ.js} +44 -41
  171. package/{createDialogAction-MMBIHFFU.js → createDialogAction-SDUGVTPS.js} +45 -43
  172. package/{createPageAction-EEYUE5FB.js → createPageAction-NNM3OFLY.js} +49 -46
  173. package/{db-CS4ZJQKV.js → db-6NRZLEW2.js} +10 -7
  174. package/{dbSlice-X4Z4E4QU.js → dbSlice-5MQ3ELID.js} +16 -15
  175. package/{deleteFile-QOOP2UK7.js → deleteFile-VCCHS72Y.js} +12 -9
  176. package/{dialogCommands-OXBQ73DD.js → dialogCommands-SJK5KWXU.js} +73 -66
  177. package/dialogMessageRecord-OAV77LT7.js +7 -0
  178. package/{dialogNotifyCommand-VWS5G4OO.js → dialogNotifyCommand-PST75COP.js} +19 -19
  179. package/{dialogSlice-KGYIABDY.js → dialogSlice-2KLMHECR.js} +44 -41
  180. package/{dialogUsageCommand-FEWCN7IA.js → dialogUsageCommand-BZPKR3DW.js} +8 -8
  181. package/{docCreateCommands-LS32VKY3.js → docCreateCommands-K7CDL2HY.js} +66 -57
  182. package/{docDeleteCommands-JTYR5RPH.js → docDeleteCommands-ZEY5YCSP.js} +69 -60
  183. package/{docReadCommands-E5LTVKWN.js → docReadCommands-A4ROLIQG.js} +66 -57
  184. package/{docStore-TVS2FNER.js → docStore-A4O6YJAM.js} +19 -18
  185. package/{docUpdateCommands-I3J3JDZ2.js → docUpdateCommands-6HTFQY4O.js} +66 -57
  186. package/{fetchMessages-Q3INLN5F.js → fetchMessages-TQEUZD7H.js} +3 -3
  187. package/{getPricing-VNGFM4PN.js → getPricing-FCHYVRJU.js} +6 -6
  188. package/{handleSendMessageAction-SSON36TJ.js → handleSendMessageAction-6WEFYBUC.js} +87 -82
  189. package/{hostCredentialCreate-WTW4THJF.js → hostCredentialCreate-WOWCNOYM.js} +136 -123
  190. package/index.js +54 -16
  191. package/keys-RWF7UCB4.js +1 -1
  192. package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
  193. package/{localDialogRead-V36DX2Q2.js → localDialogRead-3T2KMCRC.js} +2 -2
  194. package/{localRuntimeAdapter-MI2JGXSF.js → localRuntimeAdapter-7EDBDRYW.js} +147 -133
  195. package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-7DKIT7UH.js} +4 -2
  196. package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-5WZ4RJJO.js} +1 -1
  197. package/{machineCommands-3LROJZDK.js → machineCommands-XRPC67LL.js} +290 -354
  198. package/machineWsRunDispatch-SOGFW472.js +203 -0
  199. package/markdownToSlate-KIYM7B3P.js +8 -0
  200. package/mcpLocalAuthorizeCommand-VOJARP3M.js +106 -0
  201. package/{memberThunks-CFEPHAND.js → memberThunks-KC3WJGL3.js} +26 -21
  202. package/{memoryCommands-JQMEJO7J.js → memoryCommands-BC6REPQB.js} +6 -6
  203. package/{models-H5NNZRLH.js → models-EP7VG6N2.js} +2 -2
  204. package/{overlay-THLKYIWY.js → overlay-JA3SPVUS.js} +7 -3
  205. package/package.json +1 -1
  206. package/{projectArchive-3X54XFVN.js → projectArchive-GDVPIZX2.js} +50 -47
  207. package/{providerPresetApply-FO36N5TX.js → providerPresetApply-4H7YP5D7.js} +9 -9
  208. package/{providerRegistry-U2BSFE6K.js → providerRegistry-F3UPOTIY.js} +9 -9
  209. package/{read-KA3L2V7O.js → read-T7VU2IMO.js} +11 -10
  210. package/{readDocTool-AMAZAPAW.js → readDocTool-BPQ3QJSD.js} +1 -1
  211. package/{readlineWorkspace-Z3YUH4SX.js → readlineWorkspace-OWQIIUGH.js} +9406 -6791
  212. package/rememberExplicit-CPAPONSI.js +15 -0
  213. package/{removeDialogAgentAction-JQOJSUM7.js → removeDialogAgentAction-FEUUVMYC.js} +23 -22
  214. package/{runAgentClientLoop-4FCFLMDJ.js → runAgentClientLoop-SJREK2B7.js} +107 -86
  215. package/{runtimeDoctorCommands-CXOCVDPU.js → runtimeDoctorCommands-XQD4MN4I.js} +19 -19
  216. package/{secretCommands-GGUAWAE7.js → secretCommands-LH7QTJO2.js} +3 -3
  217. package/{setDialogExtraReferencesAction-YXQTGXIN.js → setDialogExtraReferencesAction-JSTQJPXL.js} +19 -18
  218. package/{setPrimaryDialogAgentAction-YNLB66WE.js → setPrimaryDialogAgentAction-Z2BQE3IY.js} +23 -22
  219. package/{settingThunks-E6N7RSSS.js → settingThunks-C2YWCNYI.js} +186 -67
  220. package/{skillDiscovery-B5V23AXP.js → skillDiscovery-MDDKPTW3.js} +4 -3
  221. package/{spaceCommands-DB5DKC2J.js → spaceCommands-YRBQ52PG.js} +71 -62
  222. package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
  223. package/{streamAgentChatTurn-FCBGMD4D.js → streamAgentChatTurn-NCA4BKDZ.js} +244 -185
  224. package/{switchDialogAgentAction-LAHLUECU.js → switchDialogAgentAction-G7XVAOGH.js} +20 -19
  225. package/{tableCommands-VNSXHAMG.js → tableCommands-UHEA5QNL.js} +14 -11
  226. package/{toolApiClient-OGQEBQVX.js → toolApiClient-N5PYW2R3.js} +8 -6
  227. package/{tools-6JD36D6K.js → tools-6WQVUGKV.js} +74 -70
  228. package/tuiRestart-3J7LRMPR.js +41 -0
  229. package/{tuiSummaryLlmCaller-UHZIPGAX.js → tuiSummaryLlmCaller-2J6NG53N.js} +24 -23
  230. package/{updateCommands-KZ54HCU5.js → updateCommands-5OYND6EF.js} +8 -6
  231. package/{updateDialogTitleAction-RV3EUEN3.js → updateDialogTitleAction-QCSN3RYO.js} +46 -43
  232. package/{usageCommand-KFVV6UL3.js → usageCommand-SK7JTEPC.js} +3 -3
  233. package/{usageRebuildCommand-HHFSNK46.js → usageRebuildCommand-DF3HUP6F.js} +4 -4
  234. package/webapi-QVV65DQF.js +2487 -0
  235. package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-HIYNL3VR.js} +2 -2
  236. package/workContext-Y3ADAPZU.js +14 -0
  237. package/workContextAccess-UZHDLBUR.js +11 -0
  238. package/workContextWriteNotice-YCSSMHN4.js +7 -0
  239. package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-ZCSQCHG3.js} +9 -9
  240. package/agentListCommands-C65UESYM.js +0 -1004
  241. package/agentRecordCommands-6RCJS2EY.js +0 -176
  242. package/agentRunCommand-P3GRKXKS.js +0 -208
  243. package/chunk-2WZXXAQD.js +0 -57
  244. package/chunk-5ZMIIR23.js +0 -265
  245. package/chunk-62HXNQVV.js +0 -134
  246. package/chunk-BJF2MHJ3.js +0 -118
  247. package/chunk-KEPOVMF4.js +0 -91
  248. package/chunk-PXKF5CV4.js +0 -357
  249. package/chunk-WACI5I6V.js +0 -147
  250. package/chunk-YGILMZ7N.js +0 -81
  251. package/cliLocalAgentRecordReader-SPKAJYME.js +0 -90
  252. package/machineWsRunDispatch-BUUJRUUB.js +0 -191
  253. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +4 -4
  254. package/{chunk-VXL2FZTP.js → chunk-HXER7YJF.js} +3 -3
  255. package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
  256. package/{chunk-SSGTV4FC.js → chunk-USGHJSGO.js} +5 -5
  257. package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
  258. package/{offlineMarxistsAgentCommand-AGA2X5E4.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +5 -5
@@ -1,29 +1,225 @@
1
- import {
2
- resolveRuntimeAuthToken,
3
- resolveRuntimeServerUrl
4
- } from "./chunk-UN7HIYMH.js";
5
1
  import {
6
2
  isAgentRunTerminalStatus,
7
3
  normalizeRunTitle,
8
4
  shortAgentKey
9
- } from "./chunk-AXYH4734.js";
5
+ } from "./chunk-S25VJYXV.js";
10
6
  import {
11
7
  findPowerShellExecutable
12
- } from "./chunk-HVUDBOQG.js";
8
+ } from "./chunk-TB5KTLNB.js";
13
9
  import {
14
10
  AUTH_ERROR_PATTERNS
15
11
  } from "./chunk-EWQ3HGNZ.js";
16
12
  import {
17
- isRecord
18
- } from "./chunk-KUG52IAP.js";
13
+ resolveRuntimeAuthToken,
14
+ resolveRuntimeServerUrl
15
+ } from "./chunk-GX6DITLQ.js";
19
16
  import {
17
+ AGENT_RUN_PROTOCOL,
18
+ HOST_RUNTIME_CONTENT_IDENTITY,
19
+ RuntimeVersionMismatchError,
20
+ getHostRuntimeExecutable,
20
21
  isCompiledBinary,
21
- resolveCliEntrypointPath
22
- } from "./chunk-WACI5I6V.js";
22
+ resolveCliEntrypointPath,
23
+ resolveExactRuntimeEntrypoint
24
+ } from "./chunk-BIDSIRTS.js";
25
+ import {
26
+ isRecord
27
+ } from "./chunk-KUG52IAP.js";
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
+ }
23
219
 
24
220
  // packages/cli/client/originShellApprovalTransport.ts
25
221
  import { realpathSync } from "node:fs";
26
- import { randomUUID } from "node:crypto";
222
+ import { randomUUID as randomUUID2 } from "node:crypto";
27
223
 
28
224
  // packages/cli/client/originShellApprovalBridge.ts
29
225
  import { isAbsolute } from "node:path";
@@ -40,7 +236,7 @@ function createOriginShellApprovalBridge(deps) {
40
236
  }
41
237
  const requests = /* @__PURE__ */ new Map();
42
238
  const fail = (reason) => ({ ok: false, reason });
43
- const snapshot = (request) => ({ ok: true, request: { ...request } });
239
+ const snapshot2 = (request) => ({ ok: true, request: { ...request } });
44
240
  const validIdentity = (call) => {
45
241
  try {
46
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;
@@ -66,7 +262,7 @@ function createOriginShellApprovalBridge(deps) {
66
262
  const request = requests.get(id);
67
263
  if (!request) return fail("unknown_request");
68
264
  if (!CALL_KEYS.every((key) => request[key] === call[key])) return fail("call_mismatch");
69
- return snapshot(request);
265
+ return snapshot2(request);
70
266
  };
71
267
  return {
72
268
  request(call) {
@@ -94,7 +290,7 @@ function createOriginShellApprovalBridge(deps) {
94
290
  state: "pending"
95
291
  };
96
292
  requests.set(requestId, request);
97
- return snapshot(request);
293
+ return snapshot2(request);
98
294
  },
99
295
  decide(id, call, decision) {
100
296
  const result = lookup(id, call);
@@ -108,7 +304,7 @@ function createOriginShellApprovalBridge(deps) {
108
304
  state: decision === "approve" ? "approved" : "denied"
109
305
  };
110
306
  requests.set(id, request);
111
- return snapshot(request);
307
+ return snapshot2(request);
112
308
  },
113
309
  revoke() {
114
310
  for (const [id, request] of requests) {
@@ -124,15 +320,15 @@ function createOriginShellApprovalBridge(deps) {
124
320
  if (result.request.state !== "approved") return fail(result.request.state);
125
321
  const request = { ...result.request, state: "consumed" };
126
322
  requests.set(id, request);
127
- return snapshot(request);
323
+ return snapshot2(request);
128
324
  }
129
325
  };
130
326
  }
131
327
 
132
328
  // packages/cli/client/originShellApprovalTransport.ts
133
- var KIND = "nolo.shell-approval.v1";
134
- var MAX = 256;
135
- var TTL = 6e4;
329
+ var KIND2 = "nolo.shell-approval.v1";
330
+ var MAX2 = 256;
331
+ var TTL2 = 6e4;
136
332
  var NOTICE = "Executes with this local user's reachable permissions; workspace is NOT a directory sandbox.";
137
333
  function payloadCall(payload, binding) {
138
334
  if (typeof payload !== "string" || payload.length > 262144) throw new Error("Invalid approval payload");
@@ -144,17 +340,25 @@ function payloadCall(payload, binding) {
144
340
  }
145
341
  function send(channel, message) {
146
342
  if (channel.connected === false || !channel.send) throw new Error("Approval channel disconnected");
147
- 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;
148
348
  }
149
349
  function attachShellApprovalHost(channel, host) {
150
350
  const binding = Object.freeze({ ...host.binding });
151
351
  const bridge = createOriginShellApprovalBridge({ binding, resolveWorkspace: realpathSync });
352
+ const connection = {};
152
353
  let closed = false;
153
354
  let count = 0;
154
355
  const active = /* @__PURE__ */ new Set();
356
+ let unbindLifetime = () => {
357
+ };
155
358
  const close = () => {
156
359
  if (closed) return;
157
360
  closed = true;
361
+ liveApprovalHosts.delete(connection);
158
362
  bridge.revoke();
159
363
  for (const controller of active) controller.abort();
160
364
  active.clear();
@@ -163,13 +367,10 @@ function attachShellApprovalHost(channel, host) {
163
367
  } catch {
164
368
  }
165
369
  channel.removeListener("message", receive);
166
- channel.removeListener("disconnect", close);
167
- channel.removeListener("exit", close);
168
- channel.removeListener("error", close);
169
- host.signal.removeEventListener("abort", close);
370
+ unbindLifetime();
170
371
  };
171
372
  const receive = (message) => {
172
- if (closed || message?.kind !== KIND) return;
373
+ if (closed || message?.kind !== KIND2) return;
173
374
  if (message.type === "hello") {
174
375
  try {
175
376
  send(channel, { type: "binding", binding });
@@ -179,7 +380,7 @@ function attachShellApprovalHost(channel, host) {
179
380
  return;
180
381
  }
181
382
  if (message.type !== "request") return;
182
- if (++count > MAX || typeof message.id !== "string" || message.id.length > 100) {
383
+ if (++count > MAX2 || typeof message.id !== "string" || message.id.length > 100) {
183
384
  close();
184
385
  return;
185
386
  }
@@ -236,14 +437,12 @@ function attachShellApprovalHost(channel, host) {
236
437
  })();
237
438
  };
238
439
  channel.on("message", receive);
239
- channel.on("disconnect", close);
240
- channel.on("exit", close);
241
- channel.on("error", close);
242
- host.signal.addEventListener("abort", close, { once: true });
243
- 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();
244
443
  return close;
245
444
  }
246
- function createShellApprovalChild(channel, timeoutMs = TTL) {
445
+ function createShellApprovalChild(channel, timeoutMs = TTL2) {
247
446
  let closed = false;
248
447
  let binding;
249
448
  let count = 0;
@@ -262,7 +461,7 @@ function createShellApprovalChild(channel, timeoutMs = TTL) {
262
461
  channel.removeListener("disconnect", close);
263
462
  };
264
463
  const receive = (message) => {
265
- if (closed || message?.kind !== KIND) return;
464
+ if (closed || message?.kind !== KIND2) return;
266
465
  if (message.type === "revoke") {
267
466
  close();
268
467
  return;
@@ -280,7 +479,7 @@ function createShellApprovalChild(channel, timeoutMs = TTL) {
280
479
  if (!entry) return;
281
480
  pending.delete(message.id);
282
481
  clearTimeout(entry.timer);
283
- 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)) {
284
483
  entry.reject(new Error("Shell approval denied"));
285
484
  return;
286
485
  }
@@ -298,17 +497,17 @@ function createShellApprovalChild(channel, timeoutMs = TTL) {
298
497
  close,
299
498
  authority: {
300
499
  async request(payload) {
301
- if (++count > MAX) throw new Error("Shell approval capacity exceeded");
302
- 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);
303
502
  while (!binding && !closed && Date.now() < deadline) await new Promise((resolve2) => setTimeout(resolve2, 5));
304
503
  if (closed || !binding) throw new Error("Shell approval unavailable");
305
504
  payloadCall(payload, binding);
306
- const id = randomUUID();
505
+ const id = randomUUID2();
307
506
  return new Promise((resolve2, reject) => {
308
507
  const timer = setTimeout(() => {
309
508
  pending.delete(id);
310
509
  reject(new Error("Shell approval timeout"));
311
- }, Math.min(timeoutMs, TTL));
510
+ }, Math.min(timeoutMs, TTL2));
312
511
  pending.set(id, { payload, resolve: resolve2, reject, timer });
313
512
  try {
314
513
  send(channel, { type: "request", id, runId: binding.runId, payload });
@@ -451,7 +650,7 @@ function redactLogLines(lines, options = {}) {
451
650
  import { hostname as nodeHostname, homedir as nodeHomedir } from "node:os";
452
651
  import { dirname, isAbsolute as isAbsolute2, join as join2, resolve } from "node:path";
453
652
  import * as nodeFs2 from "node:fs";
454
- import { randomUUID as randomUUID2, createHash } from "node:crypto";
653
+ import { randomUUID as randomUUID3, createHash as createHash2 } from "node:crypto";
455
654
  import { execFileSync as nodeExecFileSync, spawn as nodeSpawn } from "node:child_process";
456
655
 
457
656
  // packages/cli/client/hostMemory.ts
@@ -700,7 +899,7 @@ var HostMemoryAdmissionError = class extends Error {
700
899
  };
701
900
  function assertHostMemoryAdmission(deps = {}) {
702
901
  const readMem = deps.readHostMemory ?? readHostMemory;
703
- const snapshot = readMem(deps.hostMemoryDeps);
902
+ const snapshot2 = readMem(deps.hostMemoryDeps);
704
903
  const minAvailableMb = deps.minAvailableMb ?? LOCAL_AGENT_RUN_MIN_AVAILABLE_MB;
705
904
  const startupWindowMs = deps.startupWindowMs ?? STARTUP_WINDOW_MS;
706
905
  const reservedMbPerRun = deps.reservedMbPerRun ?? STARTUP_WINDOW_RESERVED_MB_PER_RUN;
@@ -708,7 +907,7 @@ function assertHostMemoryAdmission(deps = {}) {
708
907
  for (const [name, value] of Object.entries({ minAvailableMb, startupWindowMs, reservedMbPerRun, now })) {
709
908
  if (typeof value !== "number" || !Number.isFinite(value) || value < 0) throw new Error(`Invalid ${name}`);
710
909
  }
711
- if (!snapshot) {
910
+ if (!snapshot2) {
712
911
  throw new HostMemoryAdmissionError(
713
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`,
714
913
  {
@@ -722,19 +921,19 @@ function assertHostMemoryAdmission(deps = {}) {
722
921
  }
723
922
  );
724
923
  }
725
- 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");
726
925
  let effectiveAvailableMb = null;
727
926
  let limitingSource = "host";
728
- if (snapshot.source === "cgroup") {
729
- const cgroupAvail = snapshot.availableMb;
730
- const hostAvail = snapshot.hostAvailableMb;
927
+ if (snapshot2.source === "cgroup") {
928
+ const cgroupAvail = snapshot2.availableMb;
929
+ const hostAvail = snapshot2.hostAvailableMb;
731
930
  if (cgroupAvail === null || typeof cgroupAvail !== "number" || Number.isNaN(cgroupAvail) || !Number.isFinite(cgroupAvail) || cgroupAvail < 0) {
732
931
  throw new HostMemoryAdmissionError(
733
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`,
734
933
  {
735
934
  effectiveAvailableMb: null,
736
935
  requiredMinMb: minAvailableMb,
737
- source: snapshot.source,
936
+ source: snapshot2.source,
738
937
  limitingSource: "cgroup",
739
938
  activeStartupRuns: 0,
740
939
  reservedStartupMb: 0,
@@ -746,7 +945,7 @@ function assertHostMemoryAdmission(deps = {}) {
746
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", {
747
946
  effectiveAvailableMb: null,
748
947
  requiredMinMb: minAvailableMb,
749
- source: snapshot.source,
948
+ source: snapshot2.source,
750
949
  limitingSource: "host",
751
950
  activeStartupRuns: 0,
752
951
  reservedStartupMb: 0,
@@ -766,13 +965,13 @@ function assertHostMemoryAdmission(deps = {}) {
766
965
  limitingSource = "cgroup";
767
966
  }
768
967
  } else {
769
- 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) {
770
969
  throw new HostMemoryAdmissionError(
771
970
  `[host-memory-admission] \u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u672A\u77E5\u6216\u65E0\u6548\uFF0C\u62D2\u7EDD\u65E0\u58F0\u5F53\u5145\u8DB3\u3002`,
772
971
  {
773
972
  effectiveAvailableMb: null,
774
973
  requiredMinMb: minAvailableMb,
775
- source: snapshot.source,
974
+ source: snapshot2.source,
776
975
  limitingSource: "host",
777
976
  activeStartupRuns: 0,
778
977
  reservedStartupMb: 0,
@@ -780,7 +979,7 @@ function assertHostMemoryAdmission(deps = {}) {
780
979
  }
781
980
  );
782
981
  }
783
- effectiveAvailableMb = snapshot.availableMb;
982
+ effectiveAvailableMb = snapshot2.availableMb;
784
983
  limitingSource = "host";
785
984
  }
786
985
  let activeStartupRuns = 0;
@@ -792,7 +991,7 @@ function assertHostMemoryAdmission(deps = {}) {
792
991
  {
793
992
  effectiveAvailableMb,
794
993
  requiredMinMb: minAvailableMb,
795
- source: snapshot.source,
994
+ source: snapshot2.source,
796
995
  limitingSource,
797
996
  activeStartupRuns: 0,
798
997
  reservedStartupMb: 0,
@@ -807,7 +1006,7 @@ function assertHostMemoryAdmission(deps = {}) {
807
1006
  {
808
1007
  effectiveAvailableMb,
809
1008
  requiredMinMb: minAvailableMb,
810
- source: snapshot.source,
1009
+ source: snapshot2.source,
811
1010
  limitingSource,
812
1011
  activeStartupRuns: 0,
813
1012
  reservedStartupMb: 0,
@@ -823,7 +1022,7 @@ function assertHostMemoryAdmission(deps = {}) {
823
1022
  {
824
1023
  effectiveAvailableMb,
825
1024
  requiredMinMb: minAvailableMb,
826
- source: snapshot.source,
1025
+ source: snapshot2.source,
827
1026
  limitingSource,
828
1027
  activeStartupRuns: 0,
829
1028
  reservedStartupMb: 0,
@@ -845,7 +1044,7 @@ function assertHostMemoryAdmission(deps = {}) {
845
1044
  {
846
1045
  effectiveAvailableMb: netAvailableMb,
847
1046
  requiredMinMb: minAvailableMb,
848
- source: snapshot.source,
1047
+ source: snapshot2.source,
849
1048
  limitingSource,
850
1049
  activeStartupRuns,
851
1050
  reservedStartupMb,
@@ -858,7 +1057,7 @@ function assertHostMemoryAdmission(deps = {}) {
858
1057
  effectiveAvailableMb: netAvailableMb,
859
1058
  requiredMinMb: minAvailableMb,
860
1059
  activeStartupRuns,
861
- snapshot
1060
+ snapshot: snapshot2
862
1061
  };
863
1062
  }
864
1063
 
@@ -2022,6 +2221,70 @@ function listRunRecords(deps = {}) {
2022
2221
  (a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime()
2023
2222
  );
2024
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
+ }
2260
+ async function listRunRecordsAsync(deps = {}) {
2261
+ const dir = resolveRunsDir(deps.env, deps.homedir);
2262
+ let entries;
2263
+ try {
2264
+ entries = await nodeFs2.promises.readdir(dir);
2265
+ } catch {
2266
+ return [];
2267
+ }
2268
+ const records = new Array(entries.length);
2269
+ let next = 0;
2270
+ const readNext = async () => {
2271
+ while (next < entries.length) {
2272
+ const index = next++;
2273
+ const entry = entries[index];
2274
+ if (!entry.endsWith(".json")) continue;
2275
+ const path = resolveRunRecordPath(entry.slice(0, -5), deps.env, deps.homedir);
2276
+ for (let attempt = 0; attempt < 2; attempt++) {
2277
+ try {
2278
+ records[index] = JSON.parse(await nodeFs2.promises.readFile(path, "utf8"));
2279
+ break;
2280
+ } catch {
2281
+ }
2282
+ }
2283
+ }
2284
+ };
2285
+ await Promise.all(Array.from({ length: Math.min(16, entries.length) }, readNext));
2286
+ return records.filter((record) => Boolean(record)).sort((a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime());
2287
+ }
2025
2288
  function findRunRecordByPid(pid, deps = {}) {
2026
2289
  return listRunRecords(deps).find((record) => record.pid === pid);
2027
2290
  }
@@ -2126,7 +2389,7 @@ async function gcRunRecords(deps = {}, options = {}) {
2126
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");
2127
2390
  if (!fs.existsSync(artifact.path)) continue;
2128
2391
  const stat = fs.lstatSync?.(artifact.path);
2129
- 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) {
2130
2393
  throw new Error("artifact identity changed");
2131
2394
  }
2132
2395
  if (!tryUnlinkFile(fs, artifact.path)) artifactsOk = false;
@@ -2215,38 +2478,22 @@ function rewriteMsgFileArg(args, messagePath) {
2215
2478
  return result;
2216
2479
  }
2217
2480
  function resolveValidCliEntrypoint(cliEntrypointPath, fs = nodeFs2) {
2218
- if (cliEntrypointPath && fs.existsSync(cliEntrypointPath)) {
2219
- return cliEntrypointPath;
2220
- }
2221
- const fallback = resolveCliEntrypointPath();
2222
- if (fs.existsSync(fallback)) {
2223
- return fallback;
2224
- }
2225
- const candidates = [
2226
- join2(dirname(fallback), "cli", "index.ts"),
2227
- join2(dirname(fallback), "cli", "index.js"),
2228
- join2(dirname(fallback), "..", "packages", "cli", "index.ts"),
2229
- join2(dirname(fallback), "..", "packages", "cli", "index.js"),
2230
- join2(dirname(fallback), "..", "index.js")
2231
- ];
2232
- for (const cand of candidates) {
2233
- if (fs.existsSync(cand)) {
2234
- return cand;
2235
- }
2236
- }
2237
- return fallback;
2481
+ const entrypoint = cliEntrypointPath ?? resolveCliEntrypointPath();
2482
+ if (!fs.existsSync(entrypoint)) throw new RuntimeVersionMismatchError("runtime entrypoint missing");
2483
+ return fs === nodeFs2 ? resolveExactRuntimeEntrypoint(entrypoint) : String(fs.realpathSync?.(entrypoint) ?? entrypoint);
2238
2484
  }
2239
2485
  function buildAgentRunChildCommand(options, deps = {}) {
2240
2486
  const fs = deps.fs ?? nodeFs2;
2241
- const execPath = process.execPath;
2487
+ const execPath = getHostRuntimeExecutable();
2242
2488
  const commandParts = options.commandPath ?? [];
2243
2489
  let strippedArgs = stripBackgroundFlag(options.rawArgs);
2244
2490
  if (options.messagePath) {
2245
2491
  strippedArgs = rewriteMsgFileArg(strippedArgs, options.messagePath);
2246
2492
  }
2247
2493
  strippedArgs = absolutizeSkillArgs(strippedArgs);
2248
- if (isCompiledBinary() || options.cliEntrypointPath === execPath) {
2249
- return { execPath, childArgs: [...commandParts, ...strippedArgs] };
2494
+ if (isCompiledBinary() || options.cliEntrypointPath === process.execPath || options.cliEntrypointPath === execPath) {
2495
+ const fixed = resolveValidCliEntrypoint(isCompiledBinary() ? execPath : options.cliEntrypointPath ?? execPath, fs);
2496
+ return { execPath: fixed, childArgs: [...commandParts, ...strippedArgs] };
2250
2497
  }
2251
2498
  const entrypoint = resolveValidCliEntrypoint(options.cliEntrypointPath, fs);
2252
2499
  if (entrypoint === execPath) {
@@ -2324,11 +2571,11 @@ function localWriterRecovery(record) {
2324
2571
  function revokePreparedWriterLaunch(runId, attemptId, deps = {}) {
2325
2572
  if (!/^[A-Za-z0-9_-]+$/.test(runId) || !attemptId) return "blocked";
2326
2573
  return withRunRecordLock("local-writer-admission", deps, () => {
2327
- const snapshot = readRunRecord(runId, deps);
2328
- if (!snapshot) return "blocked";
2574
+ const snapshot2 = readRunRecord(runId, deps);
2575
+ if (!snapshot2) return "blocked";
2329
2576
  return withRunRecordLock(runId, deps, () => {
2330
2577
  const latest = readRunRecord(runId, deps);
2331
- if (!latest || JSON.stringify(latest) !== JSON.stringify(snapshot)) return "blocked";
2578
+ if (!latest || JSON.stringify(latest) !== JSON.stringify(snapshot2)) return "blocked";
2332
2579
  const launch = latest.writerLaunch;
2333
2580
  if (launch?.protocol !== "fenced-launch-v1" || launch.attemptId !== attemptId) return "blocked";
2334
2581
  if (launch.phase === "revoked") return latest.localWriterClaim?.state === "released" ? "already-revoked" : "blocked";
@@ -2347,10 +2594,10 @@ function localWriterStillOwns(record, deps) {
2347
2594
  const observed = e?.state === "known" && e.owner.state === "verified" ? nativeOwner(record.pid, deps) : void 0;
2348
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));
2349
2596
  if (!isPidGone(record.pid, deps) && !reused) return true;
2350
- const snapshot = JSON.stringify(record);
2597
+ const snapshot2 = JSON.stringify(record);
2351
2598
  const released = withRunRecordLock(record.runId, deps, () => {
2352
2599
  const latest = readRunRecord(record.runId, deps);
2353
- if (!latest || JSON.stringify(latest) !== snapshot) return false;
2600
+ if (!latest || JSON.stringify(latest) !== snapshot2) return false;
2354
2601
  latest.localWriterClaim.state = "released";
2355
2602
  writeRunRecord(latest, deps);
2356
2603
  return true;
@@ -2359,14 +2606,14 @@ function localWriterStillOwns(record, deps) {
2359
2606
  }
2360
2607
  function acquireLocalWriterClaim(runId, cwd, deps) {
2361
2608
  const fs = deps.fs ?? nodeFs2;
2362
- const canonical = String((fs.realpathSync ?? nodeFs2.realpathSync)(cwd));
2363
- const worktree = trustedLocalWorktree(canonical, deps);
2609
+ const canonical2 = String((fs.realpathSync ?? nodeFs2.realpathSync)(cwd));
2610
+ const worktree = trustedLocalWorktree(canonical2, deps);
2364
2611
  const acquired = withRunRecordLock("local-writer-admission", deps, () => {
2365
2612
  const updated = withRunRecordLock(runId, deps, () => {
2366
2613
  const record = readRunRecord(runId, deps);
2367
2614
  if (!record) throw new Error(`[local-writer-resource] missing run ${runId}`);
2368
2615
  if (record.writerLaunch?.phase === "revoked") throw new Error("[local-writer-resource] claim attempt revoked");
2369
- record.localWriterClaim = { cwd: canonical, ...worktree ? { worktree } : {}, state: "held" };
2616
+ record.localWriterClaim = { cwd: canonical2, ...worktree ? { worktree } : {}, state: "held" };
2370
2617
  if (record.writerLaunch && record.execution?.state === "known" && record.execution.owner.state === "verified" && record.pid === process.pid) {
2371
2618
  record.writerLaunch.phase = "granted";
2372
2619
  }
@@ -2377,7 +2624,7 @@ function acquireLocalWriterClaim(runId, cwd, deps) {
2377
2624
  return true;
2378
2625
  }, { strict: true, requireDeadOwner: true });
2379
2626
  if (!acquired) throw new Error("[local-writer-resource] admission lock busy; no child spawned");
2380
- return canonical;
2627
+ return canonical2;
2381
2628
  }
2382
2629
  function nativeOwner(pid, deps) {
2383
2630
  const first = probeProcessStartTime(pid, deps);
@@ -2477,19 +2724,19 @@ function resolveLocalContinuation(record, deps = {}) {
2477
2724
  }
2478
2725
  function registerLocalForegroundWriter(cwd, policy, agentKey, deps = {}) {
2479
2726
  const fs = deps.fs ?? nodeFs2;
2480
- const canonical = String((fs.realpathSync ?? nodeFs2.realpathSync)(cwd));
2727
+ const canonical2 = String((fs.realpathSync ?? nodeFs2.realpathSync)(cwd));
2481
2728
  const owner = nativeOwner(process.pid, deps);
2482
2729
  if (owner.state !== "verified" || policy.readOnly || !policy.hostWritesAuthorized) {
2483
2730
  throw new Error("[local-writer-resource] foreground native identity/authorization unknown");
2484
2731
  }
2485
2732
  const runId = defaultGenerateRunId();
2486
2733
  fs.mkdirSync(resolveRunsDir(deps.env, deps.homedir), { recursive: true });
2487
- const worktree = trustedLocalWorktree(canonical, deps);
2734
+ const worktree = trustedLocalWorktree(canonical2, deps);
2488
2735
  const record = {
2489
2736
  runId,
2490
2737
  agentKey,
2491
- writerLaunch: { protocol: "fenced-launch-v1", attemptId: randomUUID2(), phase: "prepared" },
2492
- cwd: canonical,
2738
+ writerLaunch: { protocol: "fenced-launch-v1", attemptId: randomUUID3(), phase: "prepared" },
2739
+ cwd: canonical2,
2493
2740
  startedAt: (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString(),
2494
2741
  status: "running",
2495
2742
  logPath: resolveRunLogPath(runId, deps.env, deps.homedir),
@@ -2500,7 +2747,7 @@ function registerLocalForegroundWriter(cwd, policy, agentKey, deps = {}) {
2500
2747
  state: "known",
2501
2748
  kind: "host-local",
2502
2749
  runtimeKey: "local",
2503
- canonicalCwd: canonical,
2750
+ canonicalCwd: canonical2,
2504
2751
  device: { kind: "localhost", hostname: nodeHostname(), platform: process.platform },
2505
2752
  ...worktree ? { worktree } : {},
2506
2753
  permissions: {
@@ -2515,7 +2762,7 @@ function registerLocalForegroundWriter(cwd, policy, agentKey, deps = {}) {
2515
2762
  };
2516
2763
  writeRunRecord(record, deps);
2517
2764
  try {
2518
- acquireLocalWriterClaim(runId, canonical, deps);
2765
+ acquireLocalWriterClaim(runId, canonical2, deps);
2519
2766
  } catch (error) {
2520
2767
  finalizeRunRecord(runId, { status: "failed", exitCode: 1, note: String(error) }, deps);
2521
2768
  throw error;
@@ -2534,6 +2781,48 @@ function releaseUnspawnedLocalWriterClaim(runId, deps) {
2534
2781
  }, { strict: true });
2535
2782
  if (!released) throw new Error(`[local-writer-resource] release lock busy: ${runId}`);
2536
2783
  }
2784
+ async function recordRunStartup(runId, phase, deps = {}) {
2785
+ const attempt = () => withRunRecordLock(runId, deps, () => {
2786
+ const record = readRunRecord(runId, deps);
2787
+ if (!record || isRunTerminalStatus(record.status)) return true;
2788
+ record.startup = { protocol: AGENT_RUN_PROTOCOL, phase };
2789
+ writeRunRecord(record, deps);
2790
+ return true;
2791
+ }, { strict: true });
2792
+ const deadline = Date.now() + 2e3;
2793
+ while (!attempt()) {
2794
+ if (Date.now() >= deadline) throw new Error(`Startup evidence lock busy: ${runId}`);
2795
+ await new Promise((resolve2) => setTimeout(resolve2, 20));
2796
+ }
2797
+ }
2798
+ async function settleBackgroundProcessExit(runId, code, signal, deps = {}) {
2799
+ const deadline = Date.now() + 2e3;
2800
+ while (true) {
2801
+ const settled = withRunRecordLock(runId, deps, () => {
2802
+ const record = readRunRecord(runId, deps);
2803
+ if (!record) return true;
2804
+ if (isRunTerminalStatus(record.status)) {
2805
+ record.processExit = { code, signal };
2806
+ writeRunRecord(record, deps);
2807
+ return true;
2808
+ }
2809
+ return false;
2810
+ }, { strict: true });
2811
+ if (settled === true) return;
2812
+ if (settled === false) {
2813
+ const result = transitionRunToTerminal(runId, {
2814
+ status: signal === "SIGTERM" || signal === "SIGKILL" ? "killed" : "failed",
2815
+ exitCode: code ?? 1,
2816
+ processExit: { code, signal },
2817
+ failureReason: signal === "SIGTERM" || signal === "SIGKILL" ? "cancelled" : "startup_failed",
2818
+ note: `Child exited without terminal result (code=${code}, signal=${signal})`
2819
+ }, deps);
2820
+ if (result.kind !== "contended") return;
2821
+ }
2822
+ if (Date.now() >= deadline) throw new Error(`Process exit settlement lock busy: ${runId}`);
2823
+ await (deps.sleep ?? defaultSleep)(20);
2824
+ }
2825
+ }
2537
2826
  async function spawnLocalBackgroundRun(input, deps = {}) {
2538
2827
  const homedir = deps.homedir ?? nodeHomedir;
2539
2828
  const env = deps.env ?? (deps.homedir ? { ...process.env, NOLO_HOME: join2(homedir(), ".nolo") } : process.env);
@@ -2606,12 +2895,13 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
2606
2895
  ...input.evidenceScope ? { evidenceScope: input.evidenceScope } : {},
2607
2896
  ...input.dispatchSpeedProvenance ? { dispatchSpeedProvenance: input.dispatchSpeedProvenance } : {},
2608
2897
  runId,
2898
+ startup: { protocol: AGENT_RUN_PROTOCOL, phase: "spawn" },
2609
2899
  agentKey: input.agentKey,
2610
2900
  agentName: input.agentName?.trim() || shortAgentKey(input.agentKey),
2611
2901
  ...title ? { title } : {},
2612
2902
  cwd: canonicalCwd ?? input.cwd,
2613
2903
  execution,
2614
- ...executionRequest ? { writerLaunch: { protocol: "fenced-launch-v1", attemptId: randomUUID2(), phase: "prepared" } } : {},
2904
+ ...executionRequest ? { writerLaunch: { protocol: "fenced-launch-v1", attemptId: randomUUID3(), phase: "prepared" } } : {},
2615
2905
  ...executionRequest ? (() => {
2616
2906
  const parent = nativeOwner(process.pid, resolvedDeps);
2617
2907
  return parent.state === "verified" ? { ownerPublication: { state: "pending", parent } } : {};
@@ -2636,17 +2926,32 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
2636
2926
  const rawArgsWithQueue = (input.rawArgs ?? []).some(
2637
2927
  (arg) => arg === "--queue-file" || arg.startsWith("--queue-file=")
2638
2928
  ) ? input.rawArgs : [...input.rawArgs ?? [], "--queue-file", queuePath];
2639
- const { execPath, childArgs } = buildAgentRunChildCommand(
2640
- {
2641
- rawArgs: rawArgsWithQueue,
2642
- commandPath: input.commandPath,
2643
- cliEntrypointPath: input.cliEntrypointPath,
2644
- messagePath
2645
- },
2646
- deps
2647
- );
2929
+ let childCommand;
2930
+ try {
2931
+ childCommand = buildAgentRunChildCommand(
2932
+ {
2933
+ rawArgs: rawArgsWithQueue,
2934
+ commandPath: input.commandPath,
2935
+ cliEntrypointPath: input.cliEntrypointPath,
2936
+ messagePath
2937
+ },
2938
+ deps
2939
+ );
2940
+ } catch (error) {
2941
+ const result = await settleRunTerminalAuthoritatively(runId, {
2942
+ status: "failed",
2943
+ exitCode: 1,
2944
+ failureReason: error instanceof RuntimeVersionMismatchError ? "runtime_version_mismatch" : "startup_failed",
2945
+ note: String(error)
2946
+ }, resolvedDeps, (id, update, d) => transitionRunToTerminal(id, update, d));
2947
+ if (result.kind === "contended") throw new Error(`Startup settlement lock busy: ${runId}; ${error}`);
2948
+ throw error;
2949
+ }
2950
+ const { execPath, childArgs } = childCommand;
2648
2951
  const childEnv = {
2649
2952
  ...env,
2953
+ NOLO_AGENT_RUN_PROTOCOL: AGENT_RUN_PROTOCOL,
2954
+ NOLO_AGENT_RUN_CONTENT_IDENTITY: HOST_RUNTIME_CONTENT_IDENTITY,
2650
2955
  NOLO_AGENT_RUN_CHILD: "1",
2651
2956
  NOLO_AGENT_RUN_ID: runId,
2652
2957
  ...record.writerLaunch ? { NOLO_WRITER_LAUNCH_ATTEMPT: record.writerLaunch.attemptId } : {}
@@ -2692,31 +2997,49 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
2692
2997
  detached: true,
2693
2998
  // Detached on Windows means no console; hide the one its children would create.
2694
2999
  windowsHide: true,
2695
- stdio: deps.shellApprovalHost ? ["ignore", logFd, logFd, "ipc"] : ["ignore", logFd, logFd]
3000
+ stdio: deps.shellApprovalHost || deps.mcpApprovalHost ? ["ignore", logFd, logFd, "ipc"] : ["ignore", logFd, logFd]
2696
3001
  });
2697
3002
  } catch (error) {
2698
3003
  try {
2699
3004
  reservation?.release("spawn_sync_failed");
2700
3005
  if (input.claimLocalWrites) releaseUnspawnedLocalWriterClaim(runId, resolvedDeps);
2701
3006
  } finally {
2702
- finalizeRunRecord(runId, { status: "failed", exitCode: 1, note: String(error) }, resolvedDeps);
3007
+ finalizeRunRecord(runId, { status: "failed", exitCode: 1, failureReason: error instanceof RuntimeVersionMismatchError ? "runtime_version_mismatch" : "startup_failed", note: String(error) }, resolvedDeps);
2703
3008
  }
2704
3009
  throw error;
2705
3010
  } finally {
2706
3011
  fs.closeSync?.(logFd);
2707
3012
  }
2708
3013
  proc.once?.("error", (error) => {
3014
+ let note = String(error);
2709
3015
  try {
2710
3016
  reservation.release("child_error");
2711
3017
  } catch (releaseError) {
2712
- finalizeRunRecord(runId, {
2713
- status: "failed",
2714
- exitCode: 1,
2715
- note: `${error}; reservation release failed: ${releaseError}`
2716
- }, resolvedDeps);
2717
- return;
3018
+ note += `; reservation release failed: ${releaseError}`;
3019
+ }
3020
+ void settleRunTerminalAuthoritatively(runId, {
3021
+ status: "failed",
3022
+ exitCode: 1,
3023
+ failureReason: "startup_failed",
3024
+ note
3025
+ }, resolvedDeps, (id, update, d) => transitionRunToTerminal(id, update, d)).then((result) => {
3026
+ if (result.kind === "contended") throw new Error(`Startup settlement lock busy: ${runId}`);
3027
+ }).catch((error2) => {
3028
+ input.output?.write(`[nolo] background error settlement failed: ${error2}
3029
+ `);
3030
+ });
3031
+ });
3032
+ proc.once?.("exit", (code, signal) => {
3033
+ void settleBackgroundProcessExit(runId, code, signal, resolvedDeps).catch((error) => {
3034
+ input.output?.write(`[nolo] background exit settlement failed: ${error}
3035
+ `);
3036
+ });
3037
+ try {
3038
+ reservation.release("child_exit");
3039
+ } catch (error) {
3040
+ input.output?.write(`[nolo] reservation release failed: ${error}
3041
+ `);
2718
3042
  }
2719
- finalizeRunRecord(runId, { status: "failed", exitCode: 1, note: String(error) }, resolvedDeps);
2720
3043
  });
2721
3044
  const hostMemoryNotice = emitHostMemoryNotice(hostMemory, input.output);
2722
3045
  if (typeof proc.pid === "number") {
@@ -2778,6 +3101,15 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
2778
3101
  throw new Error(`[host-memory-reservation] child ${proc.pid}, run ${runId}: association failed: ${error}`);
2779
3102
  }
2780
3103
  }
3104
+ if (deps.mcpApprovalHost) {
3105
+ attachMcpApprovalHost(proc, { ...deps.mcpApprovalHost, binding: {
3106
+ ...deps.mcpApprovalHost.binding,
3107
+ runId,
3108
+ agentKey: input.agentKey,
3109
+ workspaceRoot: nodeFs2.realpathSync(input.cwd ?? process.cwd())
3110
+ } });
3111
+ proc.channel?.unref?.();
3112
+ }
2781
3113
  if (deps.shellApprovalHost) {
2782
3114
  attachShellApprovalHost(proc, { ...deps.shellApprovalHost, binding: {
2783
3115
  ...deps.shellApprovalHost.binding,
@@ -2871,10 +3203,15 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
2871
3203
  if (!record2) return { kind: "not_found" };
2872
3204
  const orphanCorrection = options.allowOverOrphaned === true && record2.status === "orphaned" && (update.status === "done" || update.status === "failed");
2873
3205
  if (isAgentRunTerminalStatus(record2.status) && !orphanCorrection) {
3206
+ if (update.processExit) {
3207
+ record2.processExit = update.processExit;
3208
+ writeRunRecord(record2, deps);
3209
+ }
2874
3210
  return { kind: "kept", record: record2 };
2875
3211
  }
2876
3212
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
2877
3213
  record2.status = update.status;
3214
+ if (update.processExit) record2.processExit = update.processExit;
2878
3215
  if (typeof update.exitCode === "number") record2.exitCode = update.exitCode;
2879
3216
  if (update.dialogId) record2.dialogId = update.dialogId;
2880
3217
  if (typeof update.credits === "number" && Number.isFinite(update.credits)) {
@@ -2924,11 +3261,11 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
2924
3261
  kind,
2925
3262
  dev: String(stat.dev),
2926
3263
  ino: String(stat.ino),
2927
- sha256: createHash("sha256").update(fs.readFileSync(path)).digest("hex")
3264
+ sha256: createHash2("sha256").update(fs.readFileSync(path)).digest("hex")
2928
3265
  };
2929
3266
  record2.resultArtifacts = [...(record2.resultArtifacts ?? []).filter((a) => a.path !== path), artifact];
2930
3267
  };
2931
- if (typeof update.lastAssistantText === "string" && update.lastAssistantText || update.acceptance?.checks.observations?.length) {
3268
+ if (typeof update.lastAssistantText === "string" && update.lastAssistantText || update.acceptance?.checks.observations?.length || update.failureReason === "startup_failed" || update.failureReason === "runtime_protocol_mismatch" || update.failureReason === "runtime_version_mismatch") {
2932
3269
  try {
2933
3270
  const fs = deps.fs ?? nodeFs2;
2934
3271
  const resultFile = join2(resolveRunsDir(deps.env, deps.homedir), `${runId}.result.md`);
@@ -2955,7 +3292,7 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
2955
3292
  update.lastAssistantText ?? ""
2956
3293
  );
2957
3294
  if (typeof fs.renameSync !== "function") throw new Error("atomic result publication requires renameSync");
2958
- pendingResultFile = `${resultFile}.${randomUUID2()}.pending`;
3295
+ pendingResultFile = `${resultFile}.${randomUUID3()}.pending`;
2959
3296
  try {
2960
3297
  fs.writeFileSync(pendingResultFile, content, { encoding: "utf8", flag: "wx" });
2961
3298
  stagingComplete = true;
@@ -2964,7 +3301,7 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
2964
3301
  }
2965
3302
  if (fs.existsSync(resultFile)) {
2966
3303
  const previous = fs.readFileSync(resultFile);
2967
- const backup = `${resultFile}.${randomUUID2()}.bak`;
3304
+ const backup = `${resultFile}.${randomUUID3()}.bak`;
2968
3305
  backupFile = backup;
2969
3306
  try {
2970
3307
  fs.writeFileSync(backup, previous, { flag: "wx" });
@@ -3633,6 +3970,8 @@ async function runAgentRecoverPreparedWriterCommand(args, deps) {
3633
3970
  }
3634
3971
 
3635
3972
  export {
3973
+ createMcpApprovalChild,
3974
+ hasLiveShellApprovalHosts,
3636
3975
  createShellApprovalChild,
3637
3976
  TAIL_LINES_MAX,
3638
3977
  readHostMemory,
@@ -3678,6 +4017,8 @@ export {
3678
4017
  readRunRecord,
3679
4018
  backfillRunRecordParentDialog,
3680
4019
  listRunRecords,
4020
+ listRecentRunRecords,
4021
+ listRunRecordsAsync,
3681
4022
  findRunRecordByPid,
3682
4023
  findRunRecord,
3683
4024
  DEFAULT_LIST_LIMIT,
@@ -3695,6 +4036,8 @@ export {
3695
4036
  awaitLocalWriterChild,
3696
4037
  resolveLocalContinuation,
3697
4038
  registerLocalForegroundWriter,
4039
+ recordRunStartup,
4040
+ settleBackgroundProcessExit,
3698
4041
  spawnLocalBackgroundRun,
3699
4042
  ackRunRecord,
3700
4043
  DEFAULT_ACK_LEASE_TTL_MS,