nolo-cli 0.265.0-alpha.1 → 0.266.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (539) hide show
  1. package/{chunk-LXP53WGF.js → chunk-05wkntba.js} +44 -40
  2. package/{chunk-XFYFMTOM.js → chunk-08ts2q1n.js} +9 -11
  3. package/{chromeCommands-MVEEIY4R.js → chunk-0a3m1n6h.js} +182 -238
  4. package/chunk-0gfvc7g8.js +13 -0
  5. package/{chunk-CF7PE763.js → chunk-0h0sncy4.js} +3 -4
  6. package/{chunk-3UH7SS4W.js → chunk-0nsxwrge.js} +232 -241
  7. package/chunk-0ra8cne4.js +11 -0
  8. package/{chunk-MRACVEPZ.js → chunk-0sgwk7am.js} +1 -3
  9. package/{chunk-PEXGRTTQ.js → chunk-0tsfn0dk.js} +44 -45
  10. package/{chunk-WOAZVUSN.js → chunk-0y8cbwzy.js} +26 -30
  11. package/chunk-12gz55kk.js +6 -0
  12. package/{chunk-GLKOYSRU.js → chunk-186gshgw.js} +3 -6
  13. package/chunk-19w4ss38.js +44 -0
  14. package/{chunk-RF576RYE.js → chunk-1cakzp6r.js} +23 -23
  15. package/chunk-1fbfwbzp.js +27 -0
  16. package/{chunk-4IVMDQBA.js → chunk-1fv9k8zt.js} +103 -68
  17. package/{chunk-Q5FJJ6XI.js → chunk-1js4cdzp.js} +11 -19
  18. package/{chunk-YECCIUYU.js → chunk-1nhx0er5.js} +63 -63
  19. package/chunk-1p152b7g.js +12 -0
  20. package/{chunk-LBPW6OCD.js → chunk-1ynbq3yr.js} +322 -353
  21. package/{chunk-6UBGXX2W.js → chunk-1zrg4h5n.js} +3 -4
  22. package/{chunk-Y5GCAMGP.js → chunk-2g6zsfq8.js} +1 -3
  23. package/chunk-2hekb0eh.js +17 -0
  24. package/chunk-2pj6qzq5.js +12 -0
  25. package/chunk-2tvd4jyp.js +226 -0
  26. package/chunk-2ygg7azv.js +846 -0
  27. package/chunk-33405wtv.js +50 -0
  28. package/chunk-34axejtd.js +30 -0
  29. package/{tableCommands-FCPDULSU.js → chunk-3700dvt3.js} +224 -276
  30. package/{pdf-KE3QI2V7.js → chunk-3j08t1nm.js} +12505 -10133
  31. package/chunk-3j9gq18v.js +111 -0
  32. package/{chunk-2QKIWEZS.js → chunk-3qfpcdkm.js} +486 -505
  33. package/{settingThunks-PNC7ZISV.js → chunk-3r2x7h64.js} +189 -272
  34. package/{agentGrantCommands-2VLLXGIU.js → chunk-3tbj5fxt.js} +61 -56
  35. package/chunk-40whhjj5.js +168 -0
  36. package/chunk-4301919y.js +7 -0
  37. package/chunk-43adz39e.js +77 -0
  38. package/{chunk-5ZUL4CUO.js → chunk-49v3zc4g.js} +1 -3
  39. package/chunk-4dd7mxkb.js +72 -0
  40. package/{chunk-BKP325XS.js → chunk-4hapfzpq.js} +66 -62
  41. package/chunk-4mm7dz0m.js +95 -0
  42. package/chunk-4pqxempz.js +440 -0
  43. package/chunk-4x9zf5pv.js +10 -0
  44. package/{chunk-CA7LGAHV.js → chunk-511q8qzv.js} +66 -57
  45. package/{chunk-S52BPZ7A.js → chunk-53v9g0np.js} +49 -64
  46. package/chunk-572mg6q5.js +19 -0
  47. package/{chunk-DXDCL3Z6.js → chunk-57eyhmwr.js} +17173 -16165
  48. package/chunk-5hsr0zjm.js +156 -0
  49. package/chunk-5k883yyd.js +20 -0
  50. package/chunk-5m0wsee4.js +639 -0
  51. package/{memberThunks-IPS3SLOF.js → chunk-5r1sq2gt.js} +299 -373
  52. package/chunk-648rq4np.js +255 -0
  53. package/{chunk-IYRZKHA6.js → chunk-666yjw5c.js} +63 -86
  54. package/{chunk-4O22PGNQ.js → chunk-6cdcbmtp.js} +19 -19
  55. package/chunk-6dbyqcf7.js +59 -0
  56. package/{agentProviderCommands-2W3VXDLV.js → chunk-6e8mgp1x.js} +82 -105
  57. package/chunk-6n0pw7sx.js +44 -0
  58. package/chunk-6q1b7381.js +361 -0
  59. package/chunk-6sj756ry.js +23 -0
  60. package/{chunk-XGYQCBWS.js → chunk-6t7a7zck.js} +14785 -14454
  61. package/chunk-6yarwtxh.js +776 -0
  62. package/chunk-708h542p.js +18 -0
  63. package/chunk-76f076t8.js +266 -0
  64. package/chunk-782rrrwv.js +523 -0
  65. package/{workloadLifecycle-P2SJVV3S.js → chunk-7gk330wp.js} +77 -84
  66. package/{chunk-EZKIRVLJ.js → chunk-7ks60vxy.js} +146 -128
  67. package/{chunk-FI4DPLR7.js → chunk-7mrqbxe8.js} +342 -228
  68. package/chunk-7sztayrd.js +169 -0
  69. package/chunk-7vgt2mxz.js +15 -0
  70. package/{localFirstLog-OIETGK66.js → chunk-7z8y4k6y.js} +0 -2
  71. package/{chunk-KDDXC2IH.js → chunk-82htft2m.js} +49 -11
  72. package/{updateDialogTitleAction-OPAZF5VC.js → chunk-88vrtxxg.js} +65 -137
  73. package/{chunk-LS5KAVFQ.js → chunk-8dtjbp79.js} +293 -229
  74. package/chunk-8fajbkaz.js +50 -0
  75. package/chunk-8m1ebxpw.js +65 -0
  76. package/{accountResolver-JYG5L7YP.js → chunk-8mgfeg0w.js} +37 -30
  77. package/{chunk-LPXBBC32.js → chunk-8myksy35.js} +156 -160
  78. package/{chunk-BMQ2MJUK.js → chunk-8nrj7dc7.js} +75 -66
  79. package/{commandRegistry-XPLM5SWC.js → chunk-8t8x64ec.js} +228 -286
  80. package/chunk-8yj4pq79.js +458 -0
  81. package/{chunk-5MKPNTJP.js → chunk-8z6pepcx.js} +43 -48
  82. package/{chunk-UYQILGDR.js → chunk-90egc9vb.js} +122 -102
  83. package/{chunk-Z6LVL5MC.js → chunk-91q5dc5r.js} +10 -14
  84. package/{chunk-U6VC4MU4.js → chunk-96jtrqk1.js} +2 -4
  85. package/{chunk-H57T64RA.js → chunk-996j61av.js} +28 -31
  86. package/{chunk-Q6FKWH66.js → chunk-9cxgb9jy.js} +137 -243
  87. package/{chunk-2ZBPWX7N.js → chunk-9q1gbmet.js} +62 -104
  88. package/chunk-9qtjh73q.js +344 -0
  89. package/{chunk-SR57FDTX.js → chunk-9raka469.js} +72 -155
  90. package/{chunk-V6K5U4YE.js → chunk-9vh4v046.js} +32 -41
  91. package/{chunk-AGIM7IMJ.js → chunk-9yr1fy7j.js} +14 -49
  92. package/{chunk-FGFJUFPS.js → chunk-a16x0wt6.js} +11 -18
  93. package/chunk-a5b2rvzs.js +131 -0
  94. package/{chunk-7DPNBQSV.js → chunk-a7bz6nc3.js} +3 -4
  95. package/chunk-ac85azv9.js +29 -0
  96. package/{chunk-VXL2FZTP.js → chunk-ahhbkad4.js} +16 -20
  97. package/{chunk-37DGW762.js → chunk-anhksj2j.js} +16 -29
  98. package/{cliAuthorityBrokerServer-27C5YBYP.js → chunk-atvmx76t.js} +180 -186
  99. package/{chunk-E6A5NHDH.js → chunk-av2mzeqz.js} +16 -17
  100. package/chunk-avbwrb0z.js +614 -0
  101. package/chunk-avr6rqe5.js +544 -0
  102. package/{workContextQueryProjection-CACY5VFE.js → chunk-axx60d5a.js} +7 -7
  103. package/{chunk-EWQ3HGNZ.js → chunk-b00vzjkb.js} +30 -23
  104. package/chunk-b0m6ezxr.js +132 -0
  105. package/chunk-bbd5mgdt.js +47 -0
  106. package/chunk-bcecft0r.js +28 -0
  107. package/chunk-beyr4pyp.js +33 -0
  108. package/{chunk-BR3GT6MR.js → chunk-bge0cagn.js} +7 -18
  109. package/{offlineMarxistsAgentCommand-MFURGWHL.js → chunk-bh53zg3t.js} +33 -43
  110. package/chunk-bmx1cw89.js +37 -0
  111. package/chunk-br2195h4.js +22 -0
  112. package/chunk-bsqkwveq.js +56 -0
  113. package/{chunk-DZJWSGCV.js → chunk-c09s2z1m.js} +139 -98
  114. package/chunk-c235kypv.js +24636 -0
  115. package/{chunk-2JMYAH5O.js → chunk-c30j6pyh.js} +213 -256
  116. package/chunk-c3v6r6sq.js +29 -0
  117. package/{chunk-NACE7NWO.js → chunk-c5z7qspt.js} +1177 -1196
  118. package/{chunk-GWB6AGME.js → chunk-c6jvz0mp.js} +34 -50
  119. package/{chunk-PRJ473FK.js → chunk-cd6h9qqs.js} +14 -12
  120. package/chunk-cdt0amyy.js +37 -0
  121. package/{chunk-2AJLG6PY.js → chunk-cfh6tfc3.js} +73 -86
  122. package/{chunk-WIVVNJUS.js → chunk-ch4ck1yz.js} +38 -68
  123. package/chunk-chtvrtp5.js +55 -0
  124. package/{chunk-EYLGAEB4.js → chunk-ckvz7abv.js} +170 -165
  125. package/{chunk-YZMNK53S.js → chunk-csf18m5w.js} +32 -25
  126. package/{chunk-C36L6ZID.js → chunk-cwnvf8dt.js} +2 -10
  127. package/chunk-cy7thb6n.js +19877 -0
  128. package/{dialogPortabilityCommands-YQJNB2KL.js → chunk-d61q9nah.js} +439 -487
  129. package/chunk-d6xdy0gp.js +142 -0
  130. package/{chunk-SCEPD46O.js → chunk-dh69vqbd.js} +6386 -6498
  131. package/{chunk-KJ4J2XQB.js → chunk-dj4ggbc6.js} +17 -19
  132. package/{chunk-LISC7BD4.js → chunk-djrrhbk3.js} +29 -37
  133. package/chunk-drqzzzvr.js +822 -0
  134. package/chunk-e1n7edjk.js +33 -0
  135. package/chunk-e3atr4hk.js +59 -0
  136. package/chunk-e9bn2aav.js +13 -0
  137. package/chunk-ed396rfq.js +87 -0
  138. package/chunk-eha8ggh6.js +10 -0
  139. package/{chunk-B7CTVEUV.js → chunk-ek122zzt.js} +893 -948
  140. package/chunk-epnmvek4.js +22 -0
  141. package/{chunk-S25VJYXV.js → chunk-eqzvk3xm.js} +69 -80
  142. package/chunk-ex34n71b.js +2874 -0
  143. package/{chunk-56OAS5RZ.js → chunk-f3ad6q4h.js} +7 -11
  144. package/{chunk-3PVYUPXK.js → chunk-f8jepva1.js} +6 -7
  145. package/{chunk-GH34JXNV.js → chunk-f9yvy9t9.js} +114 -92
  146. package/chunk-fbdz4f0j.js +90 -0
  147. package/{chunk-J44TXB4J.js → chunk-fcsc2day.js} +216 -164
  148. package/chunk-fevdhnbh.js +19 -0
  149. package/chunk-fkrgqq8w.js +3300 -0
  150. package/{chunk-TSBJVMNW.js → chunk-fs3bvh2p.js} +42 -57
  151. package/chunk-fvwzyhah.js +134 -0
  152. package/chunk-g0mpxdp9.js +101 -0
  153. package/{chunk-JGUHOA42.js → chunk-g35f20d1.js} +450 -414
  154. package/{chunk-3L2WKC3W.js → chunk-g5fhtjqg.js} +13 -16
  155. package/{chunk-APOIIIB4.js → chunk-gcq01td7.js} +270 -227
  156. package/{chunk-ADMRXWXJ.js → chunk-ge97b11r.js} +121 -42
  157. package/chunk-ghjtgbkw.js +180 -0
  158. package/chunk-gkra36c1.js +16 -0
  159. package/chunk-gmz86t60.js +1000 -0
  160. package/{localDialogRead-GWGWSL5K.js → chunk-gszpesze.js} +5 -12
  161. package/chunk-gvsfec9m.js +16536 -0
  162. package/{chunk-QSJ3HFEF.js → chunk-h1hzmqph.js} +1 -3
  163. package/chunk-h30dg154.js +17 -0
  164. package/chunk-h3hkb7cw.js +241 -0
  165. package/chunk-h40py996.js +28 -0
  166. package/{chunk-47T3QP4V.js → chunk-h60gnewh.js} +112 -116
  167. package/{agentPullCommand-XEGOUYQT.js → chunk-hkwsv9xf.js} +33 -45
  168. package/chunk-hnyg0gwj.js +28 -0
  169. package/{chunk-KSV6T4AH.js → chunk-hqqqph5w.js} +12 -4
  170. package/{chunk-YQJEXXDK.js → chunk-hrngs1wy.js} +157 -246
  171. package/{chunk-LRLLWD4P.js → chunk-htf69s94.js} +14 -12
  172. package/chunk-j0yxesh3.js +83 -0
  173. package/{chunk-VF4K2QE6.js → chunk-j22t9g05.js} +3 -6
  174. package/{chunk-3R4AYHJR.js → chunk-j4a8m2zn.js} +5 -34
  175. package/chunk-j9p4jnwg.js +27 -0
  176. package/{chunk-R72QWIFO.js → chunk-jdycmfsm.js} +9 -9
  177. package/chunk-jdyvrne0.js +52 -0
  178. package/{spacePruneCommand-YKIEUIDQ.js → chunk-je0b66qf.js} +44 -62
  179. package/{chunk-HNMXYYJR.js → chunk-jec44fkj.js} +3 -4
  180. package/{chunk-526GLZJE.js → chunk-jf1ex00r.js} +107 -73
  181. package/chunk-jgqdec9b.js +31 -0
  182. package/{chunk-56GBUMO5.js → chunk-jkw9n4h5.js} +16 -25
  183. package/{chunk-BY2CHBIZ.js → chunk-jmnzdwjt.js} +867 -965
  184. package/chunk-jqq57s0a.js +58 -0
  185. package/{chunk-OKUSDVRS.js → chunk-jtkn5aj6.js} +27 -38
  186. package/chunk-jwvzn9r0.js +316 -0
  187. package/chunk-k1re0fc7.js +107 -0
  188. package/chunk-k2ep3rb2.js +103 -0
  189. package/{chunk-JEXVIMYZ.js → chunk-k6ycb24w.js} +5 -8
  190. package/{chunk-RI7SXDJW.js → chunk-kawvydbk.js} +383 -195
  191. package/chunk-kf2ghpzh.js +10 -0
  192. package/{chunk-S6FAHQDH.js → chunk-kgah9e46.js} +28 -59
  193. package/{chunk-6A6CTCMC.js → chunk-kjjepkvc.js} +71 -82
  194. package/chunk-kn4dgg4j.js +4113 -0
  195. package/{chunk-2LFYMWM3.js → chunk-kn5p91n8.js} +43 -53
  196. package/{chunk-MVOZ22RZ.js → chunk-kntqrbwc.js} +8 -12
  197. package/{chunk-I6YIA2TY.js → chunk-kq3vr7mx.js} +25 -20
  198. package/chunk-kz1x1d8n.js +15 -0
  199. package/{mcpLocalAuthorizeCommand-IKOFKY5U.js → chunk-m22e7tt2.js} +53 -71
  200. package/{chunk-ZNFJWEN4.js → chunk-m32rwr4d.js} +11 -8
  201. package/chunk-m39e9m18.js +93 -0
  202. package/{chunk-4D4QD7FT.js → chunk-m5518371.js} +64 -56
  203. package/{chunk-LHTXSC2E.js → chunk-mb5hnfyp.js} +9 -11
  204. package/chunk-mexet11v.js +11 -0
  205. package/chunk-mg2hgfgh.js +185 -0
  206. package/chunk-mmdhm4kx.js +10317 -0
  207. package/chunk-mz002yz8.js +2821 -0
  208. package/chunk-mzadqnyq.js +56 -0
  209. package/{chunk-VIDPVFP3.js → chunk-n3r1ebdm.js} +5 -6
  210. package/chunk-n438qea7.js +33 -0
  211. package/chunk-n5ffnhnb.js +93 -0
  212. package/chunk-nbvd87fy.js +9 -0
  213. package/{chunk-E36V7MPY.js → chunk-ndej7jc9.js} +53 -43
  214. package/{chunk-B767MA64.js → chunk-nen6rwe4.js} +62 -22
  215. package/chunk-nf06tr3v.js +16 -0
  216. package/chunk-ng8z355q.js +16 -0
  217. package/{chunk-4MEKE5D3.js → chunk-nhtxfv8k.js} +78 -63
  218. package/{runAgentClientLoop-ELTV5MSJ.js → chunk-nj62jscj.js} +132 -214
  219. package/{chunk-GBWGPTA7.js → chunk-nkryrkyp.js} +16 -19
  220. package/chunk-nmesxem8.js +197 -0
  221. package/{chunk-YR4J7RFS.js → chunk-nmq0qwbn.js} +117 -164
  222. package/chunk-nph8brvw.js +7 -0
  223. package/chunk-nr8fees9.js +10 -0
  224. package/{chunk-DFI7MVCQ.js → chunk-nvewvf7h.js} +1441 -1427
  225. package/{chunk-G7Y4GXTY.js → chunk-nyamhphs.js} +70 -79
  226. package/chunk-nz1c8tcg.js +111 -0
  227. package/{chunk-GPLUFN2E.js → chunk-nzc5yffh.js} +176 -217
  228. package/{chunk-G3SUCT4W.js → chunk-p1vg4bx8.js} +2 -4
  229. package/chunk-p3k3abe8.js +202 -0
  230. package/chunk-p4zy30q5.js +8 -0
  231. package/{chunk-ZJACPM5O.js → chunk-p6se1rx0.js} +102 -102
  232. package/chunk-p9dpshev.js +6968 -0
  233. package/chunk-pa42wxr0.js +116 -0
  234. package/{chunk-TA5QI4MM.js → chunk-paxthgqp.js} +56 -107
  235. package/{readlineWorkspace-5EASNOQ4.js → chunk-pb35s8d9.js} +5395 -5786
  236. package/{chunk-XT6C2QZW.js → chunk-pbebzbcq.js} +8 -8
  237. package/chunk-pbx7e1mb.js +11 -0
  238. package/chunk-pe5czfn9.js +8 -0
  239. package/chunk-pextk1j4.js +62 -0
  240. package/chunk-pf5rywc6.js +575 -0
  241. package/chunk-pjfhd3fz.js +136 -0
  242. package/chunk-pkhqb0fs.js +243 -0
  243. package/chunk-pm5xb9jh.js +26 -0
  244. package/{chunk-Y3KGWZKF.js → chunk-ppdmmdkx.js} +110 -97
  245. package/chunk-pqp6y2hs.js +9 -0
  246. package/{chunk-QHEN7NZ7.js → chunk-ptz8fm2n.js} +12 -17
  247. package/{chunk-EUHMI5KG.js → chunk-pwqnvbt7.js} +65 -46
  248. package/chunk-pzr31nz7.js +12 -0
  249. package/{chunk-WWC7I6TA.js → chunk-q3cx89sw.js} +2 -4
  250. package/chunk-q5pe7be3.js +78 -0
  251. package/{chunk-ZHWTBHT3.js → chunk-q6zqbxp2.js} +418 -409
  252. package/chunk-q7r0e1p3.js +15 -0
  253. package/chunk-q8t2fecd.js +6 -0
  254. package/{chunk-2QAZCYOM.js → chunk-q94zx4d0.js} +721 -753
  255. package/{runtimeDoctorCommands-52MBG5JN.js → chunk-qarz1az1.js} +65 -85
  256. package/{chunk-4INJGWE3.js → chunk-qdcvr25b.js} +72 -53
  257. package/{streamAgentChatTurn-BL3ESUEN.js → chunk-qxs27wfg.js} +1079 -1475
  258. package/{chunk-GIXWVN2W.js → chunk-r06ycjjr.js} +50 -47
  259. package/{chunk-63W5N6P3.js → chunk-r20jw5hb.js} +57 -38
  260. package/{chunk-I5BYFTYK.js → chunk-r7sfwdka.js} +1201 -1142
  261. package/{chunk-UMADT6B2.js → chunk-r9sp1yyb.js} +6 -8
  262. package/{handleSendMessageAction-VQP5HT5I.js → chunk-rbd2vgb3.js} +627 -757
  263. package/chunk-rc37js46.js +12 -0
  264. package/{chunk-5YI447UL.js → chunk-rmngk6r3.js} +67 -76
  265. package/chunk-rnhbnbrq.js +15 -0
  266. package/{chunk-WRHVVIGI.js → chunk-rsfnmrt5.js} +111 -131
  267. package/{chunk-YFSM2366.js → chunk-rvvn2rhj.js} +28 -22
  268. package/{chunk-4Y6CZ2N4.js → chunk-s0fpz7ht.js} +37 -33
  269. package/{chunk-VI4SWTUO.js → chunk-s1cqzb2r.js} +77 -65
  270. package/{chunk-6QDYSCPW.js → chunk-s8q81tda.js} +73 -65
  271. package/chunk-s9hy639e.js +6 -0
  272. package/{chunk-R5GO3YZP.js → chunk-s9vbwme8.js} +115 -106
  273. package/chunk-sger1m1b.js +20 -0
  274. package/chunk-spe6crvk.js +60 -0
  275. package/chunk-spwsrvh9.js +70 -0
  276. package/chunk-sr05zpk7.js +573 -0
  277. package/{chunk-M2EJHDJP.js → chunk-srncrd3f.js} +1 -12
  278. package/{chunk-QXHFIX7W.js → chunk-sry80bpx.js} +71 -53
  279. package/{chunk-PSCNXBYA.js → chunk-t6q69p83.js} +3 -4
  280. package/{chunk-UAD2WT54.js → chunk-t714r4q0.js} +9 -28
  281. package/chunk-t7vbraqe.js +42 -0
  282. package/{chunk-CVMMWN6P.js → chunk-td7653rr.js} +10 -20
  283. package/{chunk-3BQDF4QB.js → chunk-tmytcetz.js} +17 -21
  284. package/{chunk-AMWMV56B.js → chunk-tta4prwg.js} +16 -15
  285. package/chunk-tvh8azgq.js +4829 -0
  286. package/{chunk-ID4G2MAR.js → chunk-v08kbfm8.js} +10 -11
  287. package/{chunk-IHU2ZFCQ.js → chunk-v1x702q8.js} +801 -852
  288. package/{chunk-KHCLMKZZ.js → chunk-v39fea91.js} +576 -247
  289. package/{chunk-OW765XBU.js → chunk-vejtd8p2.js} +3 -4
  290. package/chunk-vep7zkha.js +368 -0
  291. package/chunk-vfwn1k7n.js +142 -0
  292. package/chunk-vg68vxhx.js +20 -0
  293. package/chunk-vgcqgnsm.js +31 -0
  294. package/{chunk-NF64D32W.js → chunk-vnzyjdea.js} +1 -3
  295. package/{chunk-ZCLSM5AK.js → chunk-vqgtw1px.js} +800 -717
  296. package/chunk-vv1gr5xz.js +76 -0
  297. package/{spaceCommands-Z2CTQD6G.js → chunk-w1qeadpq.js} +176 -242
  298. package/chunk-w468ez1p.js +13 -0
  299. package/chunk-w49s0t79.js +14 -0
  300. package/{mcpLocalManageCommands-KUDZQRM4.js → chunk-w58zhfbn.js} +91 -93
  301. package/chunk-w5b74aq6.js +11 -0
  302. package/chunk-w7y41qyw.js +117 -0
  303. package/chunk-w820gg1w.js +4165 -0
  304. package/{chunk-DBJAJ4UD.js → chunk-wdsmaqmt.js} +399 -453
  305. package/{chunk-3EUW3WEO.js → chunk-wfvvnmmj.js} +1 -3
  306. package/{chunk-QY4NZCDA.js → chunk-wkr04bhk.js} +432 -651
  307. package/{chunk-KUG52IAP.js → chunk-ws402twv.js} +1 -3
  308. package/chunk-wzwh311q.js +164 -0
  309. package/{runtimeModeArgs-X7DL7PUN.js → chunk-x5vtgvwn.js} +6 -5
  310. package/{agentMachineCommands-AXPZRHUY.js → chunk-x8h2csmq.js} +152 -195
  311. package/{chunk-BAZCS5XG.js → chunk-x9zfjnrc.js} +59 -47
  312. package/{chunk-WTIJKWCI.js → chunk-xcarc2rf.js} +50 -56
  313. package/chunk-xf33gz0a.js +8 -0
  314. package/{chunk-PVFYPUIM.js → chunk-y7b3gwx1.js} +78 -71
  315. package/{memoryCommands-SVLAVFCV.js → chunk-y7sphmnh.js} +119 -95
  316. package/{agentListCommands-436FHOIT.js → chunk-ycvaafhc.js} +260 -374
  317. package/chunk-yd7zprb0.js +9 -0
  318. package/chunk-yfz3d27k.js +40 -0
  319. package/{chunk-MKR6KDD3.js → chunk-ykv9g3m4.js} +141 -125
  320. package/chunk-ystjgb9e.js +544 -0
  321. package/chunk-yysxn7ep.js +12 -0
  322. package/{chunk-AL3TYDIF.js → chunk-z17eyawk.js} +18 -16
  323. package/{machineCommands-LHJMILRA.js → chunk-z17q416p.js} +442 -563
  324. package/chunk-z1n98pcf.js +12 -0
  325. package/{dialogTraceCommand-HWXGIGZX.js → chunk-z566jx5r.js} +292 -397
  326. package/chunk-zjxd6942.js +6 -0
  327. package/{versionChangeNotice-RFABJGJE.js → chunk-zk11x9y5.js} +7 -9
  328. package/{chunk-TEFD5E2D.js → chunk-zt73yc33.js} +48 -51
  329. package/chunk-zvs2fra1.js +5 -0
  330. package/{chunk-SVFFKLMR.js → chunk-zwee84rh.js} +117 -141
  331. package/chunk-zxgfqv72.js +8 -0
  332. package/index.js +53 -69
  333. package/package.json +4 -4
  334. package/_executeModel-B3ENLKM4.js +0 -341
  335. package/action-UK3HXGXF.js +0 -30
  336. package/addContentAction-CAKFVBDM.js +0 -38
  337. package/addDialogAgentAction-KLJ2YWWM.js +0 -77
  338. package/agentDeleteCommand-R4LKLXQR.js +0 -523
  339. package/agentEmailCommands-SUEXVAY4.js +0 -742
  340. package/agentRecordCommands-NE4OPX5K.js +0 -211
  341. package/agentRun-NSNLIOM7.js +0 -251
  342. package/agentRunCommand-T6QTKMCJ.js +0 -249
  343. package/agentRunControl-U2MV74WR.js +0 -211
  344. package/agentRuntimeLocal-P4MMGIR6.js +0 -189
  345. package/agentSlice-FZJZONCT.js +0 -52
  346. package/appConfigCommands-W4JQHMOJ.js +0 -417
  347. package/appDeleteCommands-IXR47IAV.js +0 -183
  348. package/appDeployCommands-LB6DHDF4.js +0 -232
  349. package/appDeployStatusCommands-UQ6MJL6D.js +0 -204
  350. package/appGetCommands-M5JCTDDQ.js +0 -185
  351. package/appListCommands-TE3ZHE3I.js +0 -186
  352. package/appMigrateCommands-FOXH6R4B.js +0 -230
  353. package/appSourceCommands-3ACYB6I7.js +0 -279
  354. package/authCommand-I5OBJP5S.js +0 -66
  355. package/authCommands-I6KCGOCN.js +0 -54
  356. package/builtinSkillRegistry-MIXYSZUU.js +0 -35
  357. package/chromeOpsCommands-IZRCYDSW.js +0 -579
  358. package/chunk-24BICQPB.js +0 -25
  359. package/chunk-2E4BYAUE.js +0 -69
  360. package/chunk-2O72G3U2.js +0 -17157
  361. package/chunk-2OROOEOQ.js +0 -229
  362. package/chunk-2R6M34JP.js +0 -27225
  363. package/chunk-2SXN7LAY.js +0 -15
  364. package/chunk-35JIFLIG.js +0 -30
  365. package/chunk-3VXVE2LF.js +0 -12
  366. package/chunk-4DBTBNTX.js +0 -477
  367. package/chunk-4JH2UMJR.js +0 -40
  368. package/chunk-4SN6J65J.js +0 -38
  369. package/chunk-4TDUT2LC.js +0 -441
  370. package/chunk-5MMAK75Q.js +0 -15
  371. package/chunk-6NYQHXMV.js +0 -1737
  372. package/chunk-6R4IY46J.js +0 -14
  373. package/chunk-7K4J76JQ.js +0 -917
  374. package/chunk-7LR2IFUH.js +0 -100
  375. package/chunk-AETZ7AD6.js +0 -274
  376. package/chunk-ATNTHIZI.js +0 -13
  377. package/chunk-BPB3T5EU.js +0 -791
  378. package/chunk-BV3FLP2L.js +0 -133
  379. package/chunk-BVYHE6QD.js +0 -110
  380. package/chunk-BWJLEN6X.js +0 -1388
  381. package/chunk-CHOZJMJS.js +0 -78
  382. package/chunk-CYS6HOJ2.js +0 -1710
  383. package/chunk-D2LTQAGN.js +0 -464
  384. package/chunk-DALXH7BG.js +0 -3392
  385. package/chunk-DKEOYC4L.js +0 -15210
  386. package/chunk-DLXL4NSL.js +0 -1179
  387. package/chunk-DSBRIUX5.js +0 -23
  388. package/chunk-DWLEOOGR.js +0 -8
  389. package/chunk-E2KZNP6C.js +0 -13
  390. package/chunk-E5JV4DCB.js +0 -272
  391. package/chunk-EUGTFFO6.js +0 -42
  392. package/chunk-FBNVJ2TO.js +0 -294
  393. package/chunk-FGXG6OLW.js +0 -34
  394. package/chunk-FRFFUKGH.js +0 -3085
  395. package/chunk-G22P2J7O.js +0 -1775
  396. package/chunk-G5KDYBTG.js +0 -432
  397. package/chunk-GBXRKW26.js +0 -613
  398. package/chunk-HEVRQGGH.js +0 -106
  399. package/chunk-HHXF57CL.js +0 -180
  400. package/chunk-HI5RS2O4.js +0 -2109
  401. package/chunk-HJTI7RZV.js +0 -94
  402. package/chunk-HRWRIPTB.js +0 -531
  403. package/chunk-HYCVEESH.js +0 -2824
  404. package/chunk-I42VC5KR.js +0 -15
  405. package/chunk-IB5AR52X.js +0 -15
  406. package/chunk-IIRJ4P4I.js +0 -24
  407. package/chunk-IT3ZZRJE.js +0 -12
  408. package/chunk-IV6VUVLJ.js +0 -88
  409. package/chunk-J42X32PV.js +0 -472
  410. package/chunk-JDMWYVUF.js +0 -449
  411. package/chunk-JKVOKKMQ.js +0 -53
  412. package/chunk-JRTNUU5Z.js +0 -54
  413. package/chunk-K7HLFORE.js +0 -226
  414. package/chunk-KGBASAB5.js +0 -74
  415. package/chunk-KGKTN2NX.js +0 -25
  416. package/chunk-KX6YBIHG.js +0 -8
  417. package/chunk-KYHNSSL2.js +0 -62
  418. package/chunk-KZO2MTVM.js +0 -140
  419. package/chunk-L2DHCG6C.js +0 -779
  420. package/chunk-LKZPX6YH.js +0 -0
  421. package/chunk-LLP2NDED.js +0 -201
  422. package/chunk-LOFRSJX2.js +0 -47
  423. package/chunk-M75RM77T.js +0 -3970
  424. package/chunk-MDAYRIP7.js +0 -1889
  425. package/chunk-MI6HRMCK.js +0 -25
  426. package/chunk-MTNQNLSE.js +0 -1029
  427. package/chunk-NH4PUEWK.js +0 -762
  428. package/chunk-NHLLXINQ.js +0 -8
  429. package/chunk-NTUNHTJV.js +0 -40
  430. package/chunk-OJKUU3LP.js +0 -67
  431. package/chunk-OQH3TAB7.js +0 -299
  432. package/chunk-P62DHV4F.js +0 -443
  433. package/chunk-PHIERFHT.js +0 -574
  434. package/chunk-PKDFU6MY.js +0 -102
  435. package/chunk-PL5RKESU.js +0 -40
  436. package/chunk-PSJJBBWV.js +0 -42
  437. package/chunk-QKM55LP2.js +0 -739
  438. package/chunk-QQ56R7KS.js +0 -88
  439. package/chunk-QYPE3TS3.js +0 -43
  440. package/chunk-REAE2SZK.js +0 -62
  441. package/chunk-RGQ4UUWZ.js +0 -208
  442. package/chunk-RIRFHJTW.js +0 -353
  443. package/chunk-RYMLMTPZ.js +0 -547
  444. package/chunk-SSGTV4FC.js +0 -303
  445. package/chunk-SVKWZ3EG.js +0 -607
  446. package/chunk-T7KODHYS.js +0 -317
  447. package/chunk-TZXPT53C.js +0 -8
  448. package/chunk-U67V476Y.js +0 -35
  449. package/chunk-UEILX4EV.js +0 -15
  450. package/chunk-VIWDGTDA.js +0 -8
  451. package/chunk-VXUQWCEZ.js +0 -138
  452. package/chunk-W5GKF5ZW.js +0 -32
  453. package/chunk-WDWZPASX.js +0 -29
  454. package/chunk-WX266G2C.js +0 -9594
  455. package/chunk-YCITCYSJ.js +0 -356
  456. package/chunk-Z3KTXWWB.js +0 -76
  457. package/chunk-ZC3CMUKU.js +0 -322
  458. package/chunk-ZV7ZY46L.js +0 -1343
  459. package/cliAgentConfigHelpers-WB2S7PDO.js +0 -47
  460. package/cliAuthorityBrokerClient-3SKOA7OZ.js +0 -23
  461. package/cliAuthorityBrokerProcess-BMBVXPKU.js +0 -24
  462. package/cliAuthorityStoreDriver-6FE3BJNB.js +0 -20
  463. package/cliEnvHelpers-7V5ZWUJA.js +0 -34
  464. package/cliExecutor-N3445G2Z.js +0 -45
  465. package/cliLocalAgentRecordReader-QKKRK53P.js +0 -113
  466. package/cloudAutomationCommands-S52NKCLL.js +0 -310
  467. package/contentThunks-RK6MJWBY.js +0 -100
  468. package/cooldownCommands-ZFDAL4MR.js +0 -79
  469. package/createAgentAutomationAction-KN7XLCU2.js +0 -173
  470. package/createDialogAction-KAG6DBVM.js +0 -87
  471. package/createPageAction-7XNPH76L.js +0 -91
  472. package/cursorProvider-2RACMEMF.js +0 -6123
  473. package/db-LTHLW7QA.js +0 -178
  474. package/dbSlice-WNUHTF4C.js +0 -76
  475. package/deleteDbKey-MUCJP6DK.js +0 -87
  476. package/desktopFolderProjects-4POAMVJN.js +0 -45
  477. package/dialogCommands-4MOLJW4G.js +0 -165
  478. package/dialogMessageRecord-2HJTEXQX.js +0 -7
  479. package/dialogNotifyCommand-YL2GFKLO.js +0 -45
  480. package/dialogSlice-BD6WOOD3.js +0 -200
  481. package/dialogUsageCommand-IO2BQKL2.js +0 -31
  482. package/docCreateCommands-OYLRBK2M.js +0 -255
  483. package/docDeleteCommands-3NF6QPJU.js +0 -226
  484. package/docReadCommands-CBAERJAP.js +0 -184
  485. package/docStore-RK4CD4QN.js +0 -89
  486. package/docUpdateCommands-BAMCGX6F.js +0 -326
  487. package/ebookDownloaderAgentCommand-NOIZ6U7Y.js +0 -675
  488. package/fetchMessages-P7FSCSXV.js +0 -19
  489. package/getPricing-KNXVEIUI.js +0 -40
  490. package/hostCredentialCreate-CPIWBALC.js +0 -402
  491. package/i18n-SAK6DDY4.js +0 -51
  492. package/keys-FXEGMKSG.js +0 -183
  493. package/legacyMigration-TF4SYJCZ.js +0 -19
  494. package/levelAuthorityStore-L5SVDM5O.js +0 -10
  495. package/localAutomationCommands-WPYIYTDP.js +0 -199
  496. package/localAutomationRuntime-M7WWU6WY.js +0 -61
  497. package/localRecall-BDYKXB46.js +0 -17
  498. package/localRuntimeAdapter-SNE2NUDN.js +0 -310
  499. package/localRuntimeAuthority-Q5C2KWGF.js +0 -45
  500. package/localRuntimeDb-MM3DINZM.js +0 -12
  501. package/machineInfo-HNPJHQFU.js +0 -14
  502. package/machineWsRunDispatch-VHEIHXWY.js +0 -228
  503. package/models-TOXYINNM.js +0 -10
  504. package/oauthTokenStore-RUYNYALS.js +0 -24
  505. package/overlay-JA3SPVUS.js +0 -15
  506. package/parityCommands-5OCBPVES.js +0 -613
  507. package/processSpawn-6GEO77KV.js +0 -11
  508. package/profileConfig-KOWK4HOG.js +0 -49
  509. package/projectArchive-HUET56SH.js +0 -132
  510. package/providerPresetApply-YCVSP2WX.js +0 -235
  511. package/providerRegistry-26PAUYH2.js +0 -24
  512. package/read-D4WYJQJQ.js +0 -32
  513. package/readDocTool-3S3OQFOH.js +0 -22
  514. package/rememberExplicit-ZPI6KK5M.js +0 -16
  515. package/remove-AHRMUDMH.js +0 -32
  516. package/removeDialogAgentAction-AALRBFSA.js +0 -81
  517. package/secretCommands-2PSS3QNZ.js +0 -24
  518. package/setDialogExtraReferencesAction-SLHQ3GYL.js +0 -39
  519. package/setPrimaryDialogAgentAction-XKCSGJ7M.js +0 -96
  520. package/skillDiscovery-IUEZZG2B.js +0 -29
  521. package/skillSummaryMarker-62UW7HI7.js +0 -9
  522. package/slateToRenderMarkdown-R3X74MCX.js +0 -7
  523. package/slateUtils-ESQAJ6RN.js +0 -19
  524. package/store-WSAVTR32.js +0 -50
  525. package/switchDialogAgentAction-YJIWQGIR.js +0 -70
  526. package/tombstones-FQQMEDOW.js +0 -32
  527. package/toolApiClient-FVXTIIEN.js +0 -42
  528. package/tools-KB6CJ2KT.js +0 -147
  529. package/tuiRestart-LU2BDLAW.js +0 -50
  530. package/tuiSummaryLlmCaller-Z2ZVBIGN.js +0 -53
  531. package/updateCommands-4QP7WJLA.js +0 -63
  532. package/usageCommand-AZX7D3LB.js +0 -31
  533. package/usageRebuildCommand-XV5QQCHK.js +0 -623
  534. package/userDataMerge-HT2ZVHBJ.js +0 -13
  535. package/windowsSelfUpdate-5OFKSW6Y.js +0 -14
  536. package/workContext-ZAW6VXT7.js +0 -18
  537. package/workContextAccess-VU5I4LKZ.js +0 -11
  538. package/workContextWriteNotice-YCSSMHN4.js +0 -7
  539. /package/{chunk-BYXBJQAS.js → chunk-0bcc25vg.js} +0 -0
@@ -1,21 +1,301 @@
1
- import {
2
- isRecord
3
- } from "./chunk-KUG52IAP.js";
4
1
  import {
5
2
  resolveNoloStateDir
6
- } from "./chunk-6UBGXX2W.js";
3
+ } from "./chunk-1zrg4h5n.js";
4
+ import {
5
+ isRecord
6
+ } from "./chunk-ws402twv.js";
7
7
  import {
8
8
  toErrorMessage
9
- } from "./chunk-HNMXYYJR.js";
9
+ } from "./chunk-jec44fkj.js";
10
10
  import {
11
11
  asOptionalFiniteNumber
12
- } from "./chunk-WWC7I6TA.js";
12
+ } from "./chunk-q3cx89sw.js";
13
13
  import {
14
14
  asOptionalPositiveFiniteNumber
15
- } from "./chunk-U6VC4MU4.js";
15
+ } from "./chunk-96jtrqk1.js";
16
16
  import {
17
17
  asOptionalTrimmedString
18
- } from "./chunk-G3SUCT4W.js";
18
+ } from "./chunk-p1vg4bx8.js";
19
+
20
+ // packages/agent-runtime/workspaceShell.ts
21
+ import { AsyncLocalStorage } from "node:async_hooks";
22
+ import { createWriteStream, mkdirSync as mkdirSync2, rmSync } from "node:fs";
23
+ import { dirname, join as join3, resolve as resolve2 } from "node:path";
24
+ import { spawn as spawnChildProcess } from "node:child_process";
25
+ import { randomUUID as randomUUID2 } from "node:crypto";
26
+ import { tmpdir } from "node:os";
27
+
28
+ // packages/agent-runtime/runtimeCompat.ts
29
+ import { existsSync, readdirSync, statSync } from "node:fs";
30
+ import { join } from "node:path";
31
+ import { spawn } from "node:child_process";
32
+ var IS_WINDOWS = process.platform === "win32";
33
+ function isExecutableFile(candidate) {
34
+ if (!existsSync(candidate))
35
+ return false;
36
+ try {
37
+ return statSync(candidate).isFile();
38
+ } catch {
39
+ return false;
40
+ }
41
+ }
42
+ function resolveExecutableOnPath(name) {
43
+ if (IS_WINDOWS && !/\.[a-z]+$/i.test(name)) {
44
+ const exts = (process.env.PATHEXT || ".EXE;.CMD;.BAT").split(";").filter(Boolean);
45
+ for (const ext of exts) {
46
+ const found = resolveExecutableOnPath(name + ext);
47
+ if (found)
48
+ return found;
49
+ }
50
+ return null;
51
+ }
52
+ const pathEnv = process.env.PATH ?? "";
53
+ const sep = pathEnv.includes(";") && IS_WINDOWS ? ";" : ":";
54
+ const pathDirs = pathEnv.split(sep).filter(Boolean);
55
+ const fallbackDirs = IS_WINDOWS ? [] : [
56
+ "/opt/homebrew/bin",
57
+ "/usr/local/bin",
58
+ "/usr/bin",
59
+ "/bin",
60
+ `${process.env.HOME ?? ""}/.local/bin`
61
+ ].filter(Boolean);
62
+ for (const dir of [...pathDirs, ...fallbackDirs]) {
63
+ const candidate = join(dir, name);
64
+ if (isExecutableFile(candidate))
65
+ return candidate;
66
+ }
67
+ return null;
68
+ }
69
+ function createGlob(pattern) {
70
+ const regex = globToRegExp(pattern);
71
+ return {
72
+ match(path) {
73
+ return regex.test(path);
74
+ },
75
+ scanSync(opts) {
76
+ const dot = opts.dot ?? false;
77
+ const results = [];
78
+ walkDir(opts.cwd, "", dot, results);
79
+ return results.filter((rel) => regex.test(rel));
80
+ }
81
+ };
82
+ }
83
+ function walkDir(dir, prefix, dot, out) {
84
+ let entries;
85
+ try {
86
+ entries = readdirSync(dir, { withFileTypes: true, encoding: "utf8" });
87
+ } catch {
88
+ return;
89
+ }
90
+ for (const entry of entries) {
91
+ const name = String(entry.name);
92
+ if (!dot && name.startsWith("."))
93
+ continue;
94
+ const rel = prefix ? `${prefix}/${name}` : name;
95
+ const full = join(dir, name);
96
+ if (entry.isDirectory()) {
97
+ walkDir(full, rel, dot, out);
98
+ } else if (entry.isFile()) {
99
+ out.push(rel);
100
+ }
101
+ }
102
+ }
103
+ function globToRegExp(pattern) {
104
+ const trailingDir = pattern.endsWith("/");
105
+ const src = trailingDir ? pattern.slice(0, -1) : pattern;
106
+ const anchored = src.startsWith("/");
107
+ const body = anchored ? src.slice(1) : src;
108
+ let regex = "^";
109
+ if (!anchored)
110
+ regex += "(?:.*/)?";
111
+ regex += convertBody(body);
112
+ if (trailingDir) {
113
+ regex += "(?:/.*)?";
114
+ }
115
+ regex += "$";
116
+ return new RegExp(regex);
117
+ }
118
+ function convertBody(p) {
119
+ let out = "";
120
+ let i = 0;
121
+ while (i < p.length) {
122
+ const c = p[i];
123
+ if (c === "*") {
124
+ if (p[i + 1] === "*") {
125
+ i += 2;
126
+ if (p[i] === "/") {
127
+ out += "(?:.*/)?";
128
+ i += 1;
129
+ } else {
130
+ out += ".*";
131
+ }
132
+ } else {
133
+ out += "[^/]*";
134
+ i += 1;
135
+ }
136
+ } else if (c === "?") {
137
+ out += "[^/]";
138
+ i += 1;
139
+ } else if (c === "[") {
140
+ out += "[";
141
+ i += 1;
142
+ if (p[i] === "!") {
143
+ out += "^";
144
+ i += 1;
145
+ }
146
+ while (i < p.length && p[i] !== "]") {
147
+ out += p[i] === "\\" ? "\\\\" : p[i];
148
+ i += 1;
149
+ }
150
+ if (p[i] === "]") {
151
+ out += "]";
152
+ i += 1;
153
+ }
154
+ } else if (c === "{") {
155
+ let depth = 1;
156
+ let j = i + 1;
157
+ let bodyStr = "";
158
+ while (j < p.length && depth > 0) {
159
+ if (p[j] === "{")
160
+ depth += 1;
161
+ else if (p[j] === "}")
162
+ depth -= 1;
163
+ if (depth > 0)
164
+ bodyStr += p[j];
165
+ j += 1;
166
+ }
167
+ const alts = bodyStr.split(",").map((alt) => convertBody(alt));
168
+ out += `(?:${alts.join("|")})`;
169
+ i = j;
170
+ } else {
171
+ out += escapeRegexChar(c);
172
+ i += 1;
173
+ }
174
+ }
175
+ return out;
176
+ }
177
+ function escapeRegexChar(c) {
178
+ if ("\\^$.|+()".includes(c)) {
179
+ return `\\${c}`;
180
+ }
181
+ return c;
182
+ }
183
+ function spawnToWebStreams(options) {
184
+ const [command, ...args] = options.cmd;
185
+ const child = spawn(command, args, {
186
+ env: options.env,
187
+ stdio: ["ignore", "pipe", "pipe"]
188
+ });
189
+ const exited = new Promise((resolve) => {
190
+ child.on("exit", (code) => resolve(code ?? 1));
191
+ child.on("error", () => resolve(127));
192
+ });
193
+ const toWeb = (stream) => {
194
+ if (!stream)
195
+ return null;
196
+ return stream.toWeb?.() ?? new ReadableStream({
197
+ start(controller) {
198
+ stream.on("data", (chunk) => controller.enqueue(new Uint8Array(chunk)));
199
+ stream.on("end", () => controller.close());
200
+ stream.on("error", (e) => controller.error(e));
201
+ }
202
+ });
203
+ };
204
+ return {
205
+ stdout: toWeb(child.stdout),
206
+ stderr: toWeb(child.stderr),
207
+ exited
208
+ };
209
+ }
210
+
211
+ // packages/agent-runtime/windowsPowerShellAlias.ts
212
+ import { lstatSync, readlinkSync, statSync as statSync2 } from "node:fs";
213
+ import { execFileSync } from "node:child_process";
214
+ import { win32 } from "node:path";
215
+ var VERSION_COMMAND = "$PSVersionTable.PSVersion.Major";
216
+ function defaultIsAlias(path) {
217
+ return lstatSync(path).isSymbolicLink();
218
+ }
219
+ function defaultResolveTarget(path) {
220
+ const target = win32.resolve(win32.dirname(path), readlinkSync(path));
221
+ if (win32.basename(target).toLowerCase() !== "pwsh.exe" || !statSync2(target).isFile()) {
222
+ throw new Error("Store alias does not point to a PowerShell executable");
223
+ }
224
+ return target;
225
+ }
226
+ function defaultProbe(path) {
227
+ return execFileSync(path, [
228
+ "-NoLogo",
229
+ "-NoProfile",
230
+ "-NonInteractive",
231
+ "-Command",
232
+ VERSION_COMMAND
233
+ ], { encoding: "utf8", timeout: 3000, windowsHide: true, stdio: ["ignore", "pipe", "ignore"] });
234
+ }
235
+ function resolveWindowsStoreAliasRoot(options = {}) {
236
+ if ((options.platform ?? process.platform) !== "win32")
237
+ return null;
238
+ const env = options.env ?? process.env;
239
+ if (!env.LOCALAPPDATA)
240
+ return null;
241
+ return win32.resolve(env.LOCALAPPDATA, "Microsoft", "WindowsApps");
242
+ }
243
+ function isWindowsStoreAliasPath(path, options = {}) {
244
+ if (!path)
245
+ return false;
246
+ const root = resolveWindowsStoreAliasRoot(options);
247
+ if (!root)
248
+ return false;
249
+ const relative = win32.relative(root, win32.resolve(path));
250
+ if (relative === "")
251
+ return true;
252
+ return relative !== ".." && !relative.startsWith("..\\") && !win32.isAbsolute(relative);
253
+ }
254
+ function resolveWindowsPowerShellAliasTarget(path, options = {}) {
255
+ const platform = options.platform ?? process.platform;
256
+ const env = options.env ?? process.env;
257
+ if (!isWindowsStoreAliasPath(path, { platform, env }))
258
+ return null;
259
+ const isAlias = options.isAlias ?? defaultIsAlias;
260
+ const resolveTarget = options.resolveTarget ?? defaultResolveTarget;
261
+ const probe = options.probe ?? defaultProbe;
262
+ try {
263
+ if (!isAlias(path))
264
+ return null;
265
+ const target = resolveTarget(path);
266
+ const major = probe(target).trim();
267
+ if (/^\d+$/.test(major) && Number(major) >= 7)
268
+ return target;
269
+ return null;
270
+ } catch {
271
+ return null;
272
+ }
273
+ }
274
+ function findWindowsPowerShellAlias(options = {}) {
275
+ const platform = options.platform ?? process.platform;
276
+ const env = options.env ?? process.env;
277
+ const root = resolveWindowsStoreAliasRoot({ platform, env });
278
+ if (!root)
279
+ return null;
280
+ const dirs = [...(env.PATH ?? "").split(";"), root];
281
+ const visited = new Set;
282
+ for (const dir of dirs) {
283
+ if (!dir.trim())
284
+ continue;
285
+ const relative = win32.relative(root, win32.resolve(dir));
286
+ if (relative === ".." || relative.startsWith("..\\") || win32.isAbsolute(relative))
287
+ continue;
288
+ const candidate = win32.join(dir, "pwsh.exe");
289
+ const key = candidate.toLowerCase();
290
+ if (visited.has(key))
291
+ continue;
292
+ visited.add(key);
293
+ const target = resolveWindowsPowerShellAliasTarget(candidate, options);
294
+ if (target)
295
+ return target;
296
+ }
297
+ return null;
298
+ }
19
299
 
20
300
  // packages/agent-runtime/processTask.ts
21
301
  var PROCESS_TASK_TERMINAL_STATUSES = [
@@ -31,18 +311,19 @@ function reportedTaskStatus(source, exitCode) {
31
311
  return "stopped";
32
312
  }
33
313
  if (source === "exited") {
34
- return exitCode !== void 0 && exitCode !== 0 ? "failed" : "exited";
314
+ return exitCode !== undefined && exitCode !== 0 ? "failed" : "exited";
35
315
  }
36
316
  if (source === "started" || source === "promoted") {
37
317
  return "running";
38
318
  }
39
319
  return source;
40
320
  }
41
- var DEFAULT_TASK_EVENT_RETENTION_MS = 5 * 60 * 1e3;
321
+ var DEFAULT_TASK_EVENT_RETENTION_MS = 5 * 60 * 1000;
42
322
  var DEFAULT_MAX_TASK_EVENTS_TASKS = 200;
43
- var ProcessTaskEventLog = class {
44
- events = /* @__PURE__ */ new Map();
45
- terminalTasks = /* @__PURE__ */ new Map();
323
+
324
+ class ProcessTaskEventLog {
325
+ events = new Map;
326
+ terminalTasks = new Map;
46
327
  retentionMs;
47
328
  maxTasks;
48
329
  now;
@@ -53,7 +334,6 @@ var ProcessTaskEventLog = class {
53
334
  this.maxTasks = options?.maxTasks ?? DEFAULT_MAX_TASK_EVENTS_TASKS;
54
335
  this.now = options?.now ?? Date.now;
55
336
  }
56
- /** Append one event; assigns the next monotonic seq for the task. */
57
337
  append(input) {
58
338
  const currentTime = this.now();
59
339
  const list = this.events.get(input.taskId) ?? [];
@@ -64,7 +344,7 @@ var ProcessTaskEventLog = class {
64
344
  type: input.type,
65
345
  pid: input.pid,
66
346
  createdAt: currentTime,
67
- ...input.exitCode !== void 0 ? { exitCode: input.exitCode } : {}
347
+ ...input.exitCode !== undefined ? { exitCode: input.exitCode } : {}
68
348
  });
69
349
  list.push(event);
70
350
  this.events.set(input.taskId, list);
@@ -74,24 +354,9 @@ var ProcessTaskEventLog = class {
74
354
  this.evict(currentTime);
75
355
  return { ...event };
76
356
  }
77
- /**
78
- * All events of the task with `seq > cursor` (default 0 = from the start).
79
- *
80
- * NOTE for cursor consumers (Phase 1 taskWait/taskLogs): an empty array is
81
- * ambiguous — it means either "no new events yet" or "the whole task was
82
- * evicted" (retention is per-taskId, never partial, so a cursor can never
83
- * land in a hole). Do NOT treat empty as "still running and idle": pair the
84
- * read with `hasTask(taskId)` to tell the two apart, otherwise a wait loop
85
- * can hang forever on an evicted task. Eviction only ever happens after a
86
- * terminal event plus the retention delay, so a live task is always readable.
87
- */
88
357
  read(taskId, cursor = 0) {
89
358
  return (this.events.get(taskId) ?? []).filter((event) => event.seq > cursor).map((event) => ({ ...event }));
90
359
  }
91
- /**
92
- * Whether the task's event trail is still retained. Lets a cursor consumer
93
- * disambiguate the empty result of `read()` (see its note).
94
- */
95
360
  hasTask(taskId) {
96
361
  return this.events.has(taskId);
97
362
  }
@@ -137,7 +402,7 @@ var ProcessTaskEventLog = class {
137
402
  }
138
403
  }
139
404
  }
140
- };
405
+ }
141
406
 
142
407
  // packages/agent-runtime/processRegistry.ts
143
408
  function toProcessTaskView(record) {
@@ -146,16 +411,16 @@ function toProcessTaskView(record) {
146
411
  taskId: record.taskId,
147
412
  pid: record.pid,
148
413
  pgid: record.pgid,
149
- command: record.command.length > 240 ? `${record.command.slice(0, 239).replace(/[\uD800-\uDBFF]$/, "")}\u2026` : record.command,
414
+ command: record.command.length > 240 ? `${record.command.slice(0, 239).replace(/[\uD800-\uDBFF]$/, "")}…` : record.command,
150
415
  label: record.label,
151
416
  ...record.owner ? { ownerDialogId: record.owner.dialogId } : {},
152
417
  startedAt: record.startedAt,
153
418
  status: record.status,
154
- ...record.exitCode !== void 0 ? { exitCode: record.exitCode } : {},
419
+ ...record.exitCode !== undefined ? { exitCode: record.exitCode } : {},
155
420
  persist: record.persist,
156
421
  promoted: record.promoted,
157
422
  transient: record.transient,
158
- ...capsule?.durationMs !== void 0 ? { durationMs: capsule.durationMs } : {},
423
+ ...capsule?.durationMs !== undefined ? { durationMs: capsule.durationMs } : {},
159
424
  ...capsule?.spill ? { outputRef: capsule.spill.displayPath } : {}
160
425
  };
161
426
  }
@@ -164,36 +429,23 @@ function mintTaskId(pid) {
164
429
  taskIdCounter += 1;
165
430
  return `ptask-${pid}-${Date.now().toString(36)}-${taskIdCounter.toString(36)}`;
166
431
  }
167
- var ProcessRegistry = class {
168
- processes = /* @__PURE__ */ new Map();
169
- byTaskId = /* @__PURE__ */ new Map();
170
- liveOutputs = /* @__PURE__ */ new Map();
432
+
433
+ class ProcessRegistry {
434
+ processes = new Map;
435
+ byTaskId = new Map;
436
+ liveOutputs = new Map;
171
437
  eventLog;
172
- terminalListeners = /* @__PURE__ */ new Set();
173
- backgroundListeners = /* @__PURE__ */ new Set();
438
+ terminalListeners = new Set;
439
+ backgroundListeners = new Set;
174
440
  constructor(eventLogOptions) {
175
441
  this.eventLog = new ProcessTaskEventLog(eventLogOptions);
176
442
  }
177
- /**
178
- * Subscribe to terminal transitions (markExited / kill). Fired synchronously
179
- * at the same instant the terminal event is appended to the task event log,
180
- * so consumers (TUI pending-notice buffer) observe the same ordering as the
181
- * audit stream. Each task fires at most once: markExited is gated on the
182
- * "running" status, kill()/stopAll() on the same guard, and late close
183
- * events after a user stop are already suppressed by the status check.
184
- *
185
- * Returns an unsubscribe function. Registration does NOT replay terminal
186
- * states for tasks that already terminated before subscription (no
187
- * backfill): the event log keeps the audit trail, and replaying would
188
- * double-notify tasks the previous session already surfaced.
189
- */
190
443
  onProcessTerminal(listener) {
191
444
  this.terminalListeners.add(listener);
192
445
  return () => {
193
446
  this.terminalListeners.delete(listener);
194
447
  };
195
448
  }
196
- /** Payload-free invalidation for the listBackground() view; no replay. */
197
449
  onBackgroundChange(listener) {
198
450
  this.backgroundListeners.add(listener);
199
451
  return () => {
@@ -204,23 +456,16 @@ var ProcessRegistry = class {
204
456
  for (const listener of [...this.backgroundListeners]) {
205
457
  try {
206
458
  listener();
207
- } catch {
208
- }
459
+ } catch {}
209
460
  }
210
461
  }
211
- /** Emit a terminal notice synchronously; listener errors must not break registry callers. */
212
462
  emitTerminal(notice) {
213
463
  for (const listener of [...this.terminalListeners]) {
214
464
  try {
215
465
  listener(notice);
216
- } catch {
217
- }
466
+ } catch {}
218
467
  }
219
468
  }
220
- /**
221
- * Pre-register an envelope right after a successful spawn and emit the
222
- * `started` event. Returns the stored record (with its stable taskId).
223
- */
224
469
  add(proc) {
225
470
  const record = {
226
471
  taskId: proc.taskId ?? mintTaskId(proc.pid),
@@ -244,93 +489,69 @@ var ProcessRegistry = class {
244
489
  this.processes.set(proc.pid, record);
245
490
  this.byTaskId.set(record.taskId, proc.pid);
246
491
  this.eventLog.append({ taskId: record.taskId, pid: proc.pid, type: "started" });
247
- if (!record.transient) this.emitBackgroundChange();
492
+ if (!record.transient)
493
+ this.emitBackgroundChange();
248
494
  return { ...record };
249
495
  }
250
496
  list() {
251
497
  return Array.from(this.processes.values()).map((proc) => ({ ...proc }));
252
498
  }
253
- /**
254
- * User-visible view: only real background tasks — entries registered by
255
- * launchProcess (background from birth) plus envelopes promoted to
256
- * background by timeout detach. Transient foreground grace-period envelopes
257
- * (workspaceShell pre-registration, not yet promoted) are excluded so the
258
- * status line, /procs and /stop keep behaving exactly as before Phase 0.
259
- * Audit/internal consumers that need the full truth use list() instead.
260
- */
261
499
  listBackground() {
262
500
  return Array.from(this.processes.values()).filter((proc) => !proc.transient).map((proc) => ({ ...proc }));
263
501
  }
264
502
  get(pid) {
265
503
  const item = this.processes.get(pid);
266
- return item ? { ...item } : void 0;
504
+ return item ? { ...item } : undefined;
267
505
  }
268
506
  getTaskId(pid) {
269
507
  return this.processes.get(pid)?.taskId;
270
508
  }
271
509
  getByTaskId(taskId) {
272
510
  const pid = this.byTaskId.get(taskId);
273
- if (pid === void 0) return void 0;
511
+ if (pid === undefined)
512
+ return;
274
513
  const item = this.processes.get(pid);
275
- if (!item || item.taskId !== taskId) return void 0;
514
+ if (!item || item.taskId !== taskId)
515
+ return;
276
516
  return { ...item };
277
517
  }
278
- /**
279
- * Attach a live stdout/stderr output handle to a tracked task (kept outside
280
- * RegisteredProcess so list()/get() clones and JSON views stay payload-free).
281
- */
282
518
  attachLiveOutput(taskId, liveOutput) {
283
- if (!this.byTaskId.has(taskId)) return;
519
+ if (!this.byTaskId.has(taskId))
520
+ return;
284
521
  this.liveOutputs.set(taskId, liveOutput);
285
522
  }
286
523
  getLiveOutput(taskId) {
287
524
  return this.liveOutputs.get(taskId);
288
525
  }
289
- /** Append-only lifecycle events of a task with `seq > cursor` (ascending). */
290
526
  getTaskEvents(taskId, cursor = 0) {
291
527
  return this.eventLog.read(taskId, cursor);
292
528
  }
293
529
  latestTaskSeq(taskId) {
294
530
  return this.eventLog.latestSeq(taskId);
295
531
  }
296
- /**
297
- * Whether the task's event trail is still retained. Cursor consumers MUST
298
- * pair this with getTaskEvents(): an empty read means either "no new events"
299
- * or "the whole trail was evicted" (§1.1), and only this call tells them
300
- * apart — without it a wait loop hangs forever on an evicted task.
301
- */
302
532
  hasTaskEvents(taskId) {
303
533
  return this.eventLog.hasTask(taskId);
304
534
  }
305
- /**
306
- * Timeout-detach promotion: mark the pre-registered envelope as a background
307
- * task. Same record, same taskId, no re-execution, no second registration.
308
- */
309
535
  promote(pid) {
310
536
  const item = this.processes.get(pid);
311
- if (!item) return void 0;
537
+ if (!item)
538
+ return;
312
539
  if (!item.promoted) {
313
540
  const wasTransient = item.transient;
314
541
  item.promoted = true;
315
542
  item.transient = false;
316
543
  this.eventLog.append({ taskId: item.taskId, pid, type: "promoted" });
317
- if (wasTransient) this.emitBackgroundChange();
544
+ if (wasTransient)
545
+ this.emitBackgroundChange();
318
546
  }
319
547
  return { ...item };
320
548
  }
321
- /**
322
- * Terminate a background process group and update its status to "stopped".
323
- *
324
- * Invariant (§1.3): Transient foreground envelopes (workspaceShell grace
325
- * period before timeout detach) are NOT stoppable through this entry point;
326
- * their lifecycle belongs to the foreground runner (abort/timeout). Calling
327
- * kill() on a transient entry does not signal the process, does not emit a
328
- * "killed" event, and returns false.
329
- */
330
549
  kill(pid, signal = "SIGTERM") {
331
550
  const item = this.processes.get(pid);
332
- if (!item) return false;
333
- if (item.transient) return false;
551
+ if (!item)
552
+ return false;
553
+ if (item.transient)
554
+ return false;
334
555
  if (item.status === "running") {
335
556
  try {
336
557
  if (process.platform === "win32") {
@@ -341,13 +562,13 @@ var ProcessRegistry = class {
341
562
  } catch {
342
563
  try {
343
564
  process.kill(item.pid, signal);
344
- } catch {
345
- }
565
+ } catch {}
346
566
  }
347
567
  item.status = "stopped";
348
568
  item.endedAt = Date.now();
349
569
  this.liveOutputs.get(item.taskId)?.markClosed();
350
- if (!item.transient) this.emitBackgroundChange();
570
+ if (!item.transient)
571
+ this.emitBackgroundChange();
351
572
  this.eventLog.append({ taskId: item.taskId, pid, type: "killed" });
352
573
  this.emitTerminal({
353
574
  taskId: item.taskId,
@@ -363,7 +584,8 @@ var ProcessRegistry = class {
363
584
  }
364
585
  stopAll(signal = "SIGTERM", opts) {
365
586
  for (const item of this.processes.values()) {
366
- if (opts?.backgroundOnly && item.transient) continue;
587
+ if (opts?.backgroundOnly && item.transient)
588
+ continue;
367
589
  if (item.status === "running" && (opts?.includePersist || !item.persist)) {
368
590
  try {
369
591
  if (process.platform === "win32") {
@@ -374,358 +596,97 @@ var ProcessRegistry = class {
374
596
  } catch {
375
597
  try {
376
598
  process.kill(item.pid, signal);
377
- } catch {
378
- }
599
+ } catch {}
379
600
  }
380
601
  item.status = "stopped";
381
- item.endedAt = Date.now();
382
- this.liveOutputs.get(item.taskId)?.markClosed();
383
- if (!item.transient) this.emitBackgroundChange();
384
- this.eventLog.append({ taskId: item.taskId, pid: item.pid, type: "killed" });
385
- this.emitTerminal({
386
- taskId: item.taskId,
387
- pid: item.pid,
388
- label: item.label,
389
- command: item.command,
390
- status: "stopped",
391
- promoted: item.promoted
392
- });
393
- }
394
- }
395
- }
396
- markExited(pid, exitCode, resultCapsule, expectedTaskId) {
397
- const item = this.processes.get(pid);
398
- if (expectedTaskId !== void 0 && item !== void 0 && item.taskId !== expectedTaskId) {
399
- return;
400
- }
401
- if (item && item.status === "running") {
402
- item.exitCode = exitCode;
403
- if (resultCapsule) item.resultCapsule = resultCapsule;
404
- item.status = exitCode === 0 ? "exited" : "failed";
405
- item.endedAt = Date.now();
406
- this.liveOutputs.get(item.taskId)?.markClosed();
407
- if (!item.transient) this.emitBackgroundChange();
408
- this.eventLog.append({
409
- taskId: item.taskId,
410
- pid,
411
- type: "exited",
412
- exitCode
413
- });
414
- this.emitTerminal({
415
- taskId: item.taskId,
416
- pid,
417
- label: item.label,
418
- command: item.command,
419
- status: item.status,
420
- exitCode,
421
- promoted: item.promoted,
422
- ...item.resultCapsule ? { resultCapsule: item.resultCapsule } : {}
423
- });
424
- }
425
- }
426
- /**
427
- * Grace-period completion: the command ended before detach promotion, so the
428
- * envelope is transient by design — record the final event, then drop the
429
- * envelope entirely ("不留痕是结果"). The event stream keeps the audit trail.
430
- * No-op for already-promoted envelopes (their lifecycle is owned by
431
- * markExited after detach).
432
- */
433
- completeTransient(pid, exitCode) {
434
- const item = this.processes.get(pid);
435
- if (!item || item.promoted) return;
436
- this.eventLog.append({ taskId: item.taskId, pid, type: "exited", exitCode });
437
- this.liveOutputs.get(item.taskId)?.markClosed();
438
- this.liveOutputs.delete(item.taskId);
439
- this.processes.delete(pid);
440
- this.byTaskId.delete(item.taskId);
441
- }
442
- /** Drop an envelope without emitting events (spawn/registration failure paths). */
443
- remove(pid) {
444
- const item = this.processes.get(pid);
445
- if (!item) return false;
446
- this.liveOutputs.get(item.taskId)?.markClosed();
447
- this.liveOutputs.delete(item.taskId);
448
- this.processes.delete(pid);
449
- this.byTaskId.delete(item.taskId);
450
- if (!item.transient) this.emitBackgroundChange();
451
- return true;
452
- }
453
- clear() {
454
- for (const liveOutput of this.liveOutputs.values()) {
455
- liveOutput.markClosed();
456
- }
457
- this.liveOutputs.clear();
458
- this.processes.clear();
459
- this.byTaskId.clear();
460
- this.eventLog.clear();
461
- this.terminalListeners.clear();
462
- this.backgroundListeners.clear();
463
- }
464
- };
465
- var registry = null;
466
- function getProcessRegistry() {
467
- if (!registry) {
468
- registry = new ProcessRegistry();
469
- }
470
- return registry;
471
- }
472
-
473
- // packages/agent-runtime/workspaceShell.ts
474
- import { AsyncLocalStorage } from "node:async_hooks";
475
- import { createWriteStream, mkdirSync as mkdirSync2, rmSync } from "node:fs";
476
- import { dirname, join as join3, resolve as resolve2 } from "node:path";
477
- import { spawn as spawnChildProcess } from "node:child_process";
478
- import { randomUUID as randomUUID2 } from "node:crypto";
479
- import { tmpdir } from "node:os";
480
-
481
- // packages/agent-runtime/runtimeCompat.ts
482
- import { existsSync, readdirSync, statSync } from "node:fs";
483
- import { join } from "node:path";
484
- import { spawn } from "node:child_process";
485
- var IS_WINDOWS = process.platform === "win32";
486
- function isExecutableFile(candidate) {
487
- if (!existsSync(candidate)) return false;
488
- try {
489
- return statSync(candidate).isFile();
490
- } catch {
491
- return false;
492
- }
493
- }
494
- function resolveExecutableOnPath(name) {
495
- if (IS_WINDOWS && !/\.[a-z]+$/i.test(name)) {
496
- const exts = (process.env.PATHEXT || ".EXE;.CMD;.BAT").split(";").filter(Boolean);
497
- for (const ext of exts) {
498
- const found = resolveExecutableOnPath(name + ext);
499
- if (found) return found;
500
- }
501
- return null;
502
- }
503
- const pathEnv = process.env.PATH ?? "";
504
- const sep = pathEnv.includes(";") && IS_WINDOWS ? ";" : ":";
505
- const pathDirs = pathEnv.split(sep).filter(Boolean);
506
- const fallbackDirs = IS_WINDOWS ? [] : [
507
- "/opt/homebrew/bin",
508
- "/usr/local/bin",
509
- "/usr/bin",
510
- "/bin",
511
- `${process.env.HOME ?? ""}/.local/bin`
512
- ].filter(Boolean);
513
- for (const dir of [...pathDirs, ...fallbackDirs]) {
514
- const candidate = join(dir, name);
515
- if (isExecutableFile(candidate)) return candidate;
516
- }
517
- return null;
518
- }
519
- function createGlob(pattern) {
520
- const regex = globToRegExp(pattern);
521
- return {
522
- match(path) {
523
- return regex.test(path);
524
- },
525
- scanSync(opts) {
526
- const dot = opts.dot ?? false;
527
- const results = [];
528
- walkDir(opts.cwd, "", dot, results);
529
- return results.filter((rel) => regex.test(rel));
530
- }
531
- };
532
- }
533
- function walkDir(dir, prefix, dot, out) {
534
- let entries;
535
- try {
536
- entries = readdirSync(dir, { withFileTypes: true, encoding: "utf8" });
537
- } catch {
538
- return;
539
- }
540
- for (const entry of entries) {
541
- const name = String(entry.name);
542
- if (!dot && name.startsWith(".")) continue;
543
- const rel = prefix ? `${prefix}/${name}` : name;
544
- const full = join(dir, name);
545
- if (entry.isDirectory()) {
546
- walkDir(full, rel, dot, out);
547
- } else if (entry.isFile()) {
548
- out.push(rel);
549
- }
550
- }
551
- }
552
- function globToRegExp(pattern) {
553
- const trailingDir = pattern.endsWith("/");
554
- const src = trailingDir ? pattern.slice(0, -1) : pattern;
555
- const anchored = src.startsWith("/");
556
- const body = anchored ? src.slice(1) : src;
557
- let regex = "^";
558
- if (!anchored) regex += "(?:.*/)?";
559
- regex += convertBody(body);
560
- if (trailingDir) {
561
- regex += "(?:/.*)?";
562
- }
563
- regex += "$";
564
- return new RegExp(regex);
565
- }
566
- function convertBody(p) {
567
- let out = "";
568
- let i = 0;
569
- while (i < p.length) {
570
- const c = p[i];
571
- if (c === "*") {
572
- if (p[i + 1] === "*") {
573
- i += 2;
574
- if (p[i] === "/") {
575
- out += "(?:.*/)?";
576
- i += 1;
577
- } else {
578
- out += ".*";
579
- }
580
- } else {
581
- out += "[^/]*";
582
- i += 1;
583
- }
584
- } else if (c === "?") {
585
- out += "[^/]";
586
- i += 1;
587
- } else if (c === "[") {
588
- out += "[";
589
- i += 1;
590
- if (p[i] === "!") {
591
- out += "^";
592
- i += 1;
593
- }
594
- while (i < p.length && p[i] !== "]") {
595
- out += p[i] === "\\" ? "\\\\" : p[i];
596
- i += 1;
597
- }
598
- if (p[i] === "]") {
599
- out += "]";
600
- i += 1;
601
- }
602
- } else if (c === "{") {
603
- let depth = 1;
604
- let j = i + 1;
605
- let bodyStr = "";
606
- while (j < p.length && depth > 0) {
607
- if (p[j] === "{") depth += 1;
608
- else if (p[j] === "}") depth -= 1;
609
- if (depth > 0) bodyStr += p[j];
610
- j += 1;
602
+ item.endedAt = Date.now();
603
+ this.liveOutputs.get(item.taskId)?.markClosed();
604
+ if (!item.transient)
605
+ this.emitBackgroundChange();
606
+ this.eventLog.append({ taskId: item.taskId, pid: item.pid, type: "killed" });
607
+ this.emitTerminal({
608
+ taskId: item.taskId,
609
+ pid: item.pid,
610
+ label: item.label,
611
+ command: item.command,
612
+ status: "stopped",
613
+ promoted: item.promoted
614
+ });
611
615
  }
612
- const alts = bodyStr.split(",").map((alt) => convertBody(alt));
613
- out += `(?:${alts.join("|")})`;
614
- i = j;
615
- } else {
616
- out += escapeRegexChar(c);
617
- i += 1;
618
616
  }
619
617
  }
620
- return out;
621
- }
622
- function escapeRegexChar(c) {
623
- if ("\\^$.|+()".includes(c)) {
624
- return `\\${c}`;
618
+ markExited(pid, exitCode, resultCapsule, expectedTaskId) {
619
+ const item = this.processes.get(pid);
620
+ if (expectedTaskId !== undefined && item !== undefined && item.taskId !== expectedTaskId) {
621
+ return;
622
+ }
623
+ if (item && item.status === "running") {
624
+ item.exitCode = exitCode;
625
+ if (resultCapsule)
626
+ item.resultCapsule = resultCapsule;
627
+ item.status = exitCode === 0 ? "exited" : "failed";
628
+ item.endedAt = Date.now();
629
+ this.liveOutputs.get(item.taskId)?.markClosed();
630
+ if (!item.transient)
631
+ this.emitBackgroundChange();
632
+ this.eventLog.append({
633
+ taskId: item.taskId,
634
+ pid,
635
+ type: "exited",
636
+ exitCode
637
+ });
638
+ this.emitTerminal({
639
+ taskId: item.taskId,
640
+ pid,
641
+ label: item.label,
642
+ command: item.command,
643
+ status: item.status,
644
+ exitCode,
645
+ promoted: item.promoted,
646
+ ...item.resultCapsule ? { resultCapsule: item.resultCapsule } : {}
647
+ });
648
+ }
625
649
  }
626
- return c;
627
- }
628
- function spawnToWebStreams(options) {
629
- const [command, ...args] = options.cmd;
630
- const child = spawn(command, args, {
631
- env: options.env,
632
- stdio: ["ignore", "pipe", "pipe"]
633
- });
634
- const exited = new Promise((resolve3) => {
635
- child.on("exit", (code) => resolve3(code ?? 1));
636
- child.on("error", () => resolve3(127));
637
- });
638
- const toWeb = (stream) => {
639
- if (!stream) return null;
640
- return stream.toWeb?.() ?? new ReadableStream({
641
- start(controller) {
642
- stream.on("data", (chunk) => controller.enqueue(new Uint8Array(chunk)));
643
- stream.on("end", () => controller.close());
644
- stream.on("error", (e) => controller.error(e));
645
- }
646
- });
647
- };
648
- return {
649
- stdout: toWeb(child.stdout),
650
- stderr: toWeb(child.stderr),
651
- exited
652
- };
653
- }
654
-
655
- // packages/agent-runtime/windowsPowerShellAlias.ts
656
- import { lstatSync, readlinkSync, statSync as statSync2 } from "node:fs";
657
- import { execFileSync } from "node:child_process";
658
- import { win32 } from "node:path";
659
- var VERSION_COMMAND = "$PSVersionTable.PSVersion.Major";
660
- function defaultIsAlias(path) {
661
- return lstatSync(path).isSymbolicLink();
662
- }
663
- function defaultResolveTarget(path) {
664
- const target = win32.resolve(win32.dirname(path), readlinkSync(path));
665
- if (win32.basename(target).toLowerCase() !== "pwsh.exe" || !statSync2(target).isFile()) {
666
- throw new Error("Store alias does not point to a PowerShell executable");
650
+ completeTransient(pid, exitCode) {
651
+ const item = this.processes.get(pid);
652
+ if (!item || item.promoted)
653
+ return;
654
+ this.eventLog.append({ taskId: item.taskId, pid, type: "exited", exitCode });
655
+ this.liveOutputs.get(item.taskId)?.markClosed();
656
+ this.liveOutputs.delete(item.taskId);
657
+ this.processes.delete(pid);
658
+ this.byTaskId.delete(item.taskId);
667
659
  }
668
- return target;
669
- }
670
- function defaultProbe(path) {
671
- return execFileSync(path, [
672
- "-NoLogo",
673
- "-NoProfile",
674
- "-NonInteractive",
675
- "-Command",
676
- VERSION_COMMAND
677
- ], { encoding: "utf8", timeout: 3e3, windowsHide: true, stdio: ["ignore", "pipe", "ignore"] });
678
- }
679
- function resolveWindowsStoreAliasRoot(options = {}) {
680
- if ((options.platform ?? process.platform) !== "win32") return null;
681
- const env = options.env ?? process.env;
682
- if (!env.LOCALAPPDATA) return null;
683
- return win32.resolve(env.LOCALAPPDATA, "Microsoft", "WindowsApps");
684
- }
685
- function isWindowsStoreAliasPath(path, options = {}) {
686
- if (!path) return false;
687
- const root = resolveWindowsStoreAliasRoot(options);
688
- if (!root) return false;
689
- const relative3 = win32.relative(root, win32.resolve(path));
690
- if (relative3 === "") return true;
691
- return relative3 !== ".." && !relative3.startsWith("..\\") && !win32.isAbsolute(relative3);
692
- }
693
- function resolveWindowsPowerShellAliasTarget(path, options = {}) {
694
- const platform = options.platform ?? process.platform;
695
- const env = options.env ?? process.env;
696
- if (!isWindowsStoreAliasPath(path, { platform, env })) return null;
697
- const isAlias = options.isAlias ?? defaultIsAlias;
698
- const resolveTarget = options.resolveTarget ?? defaultResolveTarget;
699
- const probe = options.probe ?? defaultProbe;
700
- try {
701
- if (!isAlias(path)) return null;
702
- const target = resolveTarget(path);
703
- const major = probe(target).trim();
704
- if (/^\d+$/.test(major) && Number(major) >= 7) return target;
705
- return null;
706
- } catch {
707
- return null;
660
+ remove(pid) {
661
+ const item = this.processes.get(pid);
662
+ if (!item)
663
+ return false;
664
+ this.liveOutputs.get(item.taskId)?.markClosed();
665
+ this.liveOutputs.delete(item.taskId);
666
+ this.processes.delete(pid);
667
+ this.byTaskId.delete(item.taskId);
668
+ if (!item.transient)
669
+ this.emitBackgroundChange();
670
+ return true;
671
+ }
672
+ clear() {
673
+ for (const liveOutput of this.liveOutputs.values()) {
674
+ liveOutput.markClosed();
675
+ }
676
+ this.liveOutputs.clear();
677
+ this.processes.clear();
678
+ this.byTaskId.clear();
679
+ this.eventLog.clear();
680
+ this.terminalListeners.clear();
681
+ this.backgroundListeners.clear();
708
682
  }
709
683
  }
710
- function findWindowsPowerShellAlias(options = {}) {
711
- const platform = options.platform ?? process.platform;
712
- const env = options.env ?? process.env;
713
- const root = resolveWindowsStoreAliasRoot({ platform, env });
714
- if (!root) return null;
715
- const dirs = [...(env.PATH ?? "").split(";"), root];
716
- const visited = /* @__PURE__ */ new Set();
717
- for (const dir of dirs) {
718
- if (!dir.trim()) continue;
719
- const relative3 = win32.relative(root, win32.resolve(dir));
720
- if (relative3 === ".." || relative3.startsWith("..\\") || win32.isAbsolute(relative3)) continue;
721
- const candidate = win32.join(dir, "pwsh.exe");
722
- const key = candidate.toLowerCase();
723
- if (visited.has(key)) continue;
724
- visited.add(key);
725
- const target = resolveWindowsPowerShellAliasTarget(candidate, options);
726
- if (target) return target;
684
+ var registry = null;
685
+ function getProcessRegistry() {
686
+ if (!registry) {
687
+ registry = new ProcessRegistry;
727
688
  }
728
- return null;
689
+ return registry;
729
690
  }
730
691
 
731
692
  // packages/agent-runtime/processTaskResult.ts
@@ -738,17 +699,19 @@ import { createHash, randomUUID } from "node:crypto";
738
699
  import { constants, copyFileSync, createReadStream, existsSync as existsSync2, mkdirSync, readdirSync as readdirSync2, renameSync, statSync as statSync3, unlinkSync, utimesSync, writeFileSync } from "node:fs";
739
700
  import { isAbsolute, join as join2, relative } from "node:path";
740
701
  var DEFAULT_MAX_SPILL_DIR_BYTES = 50 * 1024 * 1024;
741
- var DEFAULT_SPILL_TTL_MS = 24 * 60 * 60 * 1e3;
742
- var SPILL_CLEANUP_THROTTLE_MS = 60 * 1e3;
702
+ var DEFAULT_SPILL_TTL_MS = 24 * 60 * 60 * 1000;
703
+ var SPILL_CLEANUP_THROTTLE_MS = 60 * 1000;
743
704
  var SPILL_THROTTLE_MAX_DIRS = 64;
744
- var lastSpillCleanupAtMsByDir = /* @__PURE__ */ new Map();
745
- var MIN_SPILL_TTL_MS = 60 * 1e3;
705
+ var lastSpillCleanupAtMsByDir = new Map;
706
+ var MIN_SPILL_TTL_MS = 60 * 1000;
746
707
  var MIN_SPILL_DIR_BYTES = 1 * 1024 * 1024;
747
708
  function parseBoundedPositiveInt(raw, min) {
748
709
  const trimmed = raw?.trim();
749
- if (!trimmed || !/^[0-9]+$/.test(trimmed)) return void 0;
710
+ if (!trimmed || !/^[0-9]+$/.test(trimmed))
711
+ return;
750
712
  const parsed = Number.parseInt(trimmed, 10);
751
- if (!Number.isSafeInteger(parsed) || parsed < min) return void 0;
713
+ if (!Number.isSafeInteger(parsed) || parsed < min)
714
+ return;
752
715
  return parsed;
753
716
  }
754
717
  function resolveConfiguredSpillDir(env = process.env) {
@@ -756,7 +719,7 @@ function resolveConfiguredSpillDir(env = process.env) {
756
719
  if (configured && isAbsolute(configured)) {
757
720
  return configured;
758
721
  }
759
- return void 0;
722
+ return;
760
723
  }
761
724
  function resolveSpillRetentionDefaults(env = process.env) {
762
725
  return {
@@ -778,23 +741,24 @@ function resolveSpillDirectory(options) {
778
741
  return resolveNoloStateDir("spills");
779
742
  }
780
743
  function countLines(text) {
781
- if (!text) return 0;
744
+ if (!text)
745
+ return 0;
782
746
  let lines = 1;
783
- for (let i = 0; i < text.length; i++) {
747
+ for (let i = 0;i < text.length; i++) {
784
748
  if (text.charCodeAt(i) === 10) {
785
749
  lines++;
786
750
  }
787
751
  }
788
752
  return lines;
789
753
  }
790
- var SPILL_PUBLICATION_GRACE_MS = 6e4;
754
+ var SPILL_PUBLICATION_GRACE_MS = 60000;
791
755
  async function hashFileStreaming(path) {
792
756
  const hash = createHash("sha256");
793
- await new Promise((resolve3, reject) => {
757
+ await new Promise((resolve, reject) => {
794
758
  const stream = createReadStream(path);
795
759
  stream.on("data", (chunk) => hash.update(chunk));
796
760
  stream.on("error", reject);
797
- stream.on("end", () => resolve3());
761
+ stream.on("end", () => resolve());
798
762
  });
799
763
  return hash.digest("hex");
800
764
  }
@@ -820,7 +784,7 @@ async function promoteToolSpillFile(sourcePath, options) {
820
784
  };
821
785
  const preservedIfPresent = () => {
822
786
  try {
823
- return ops.exists(sourcePath) ? sourcePath : void 0;
787
+ return ops.exists(sourcePath) ? sourcePath : undefined;
824
788
  } catch {
825
789
  return sourcePath;
826
790
  }
@@ -832,7 +796,8 @@ async function promoteToolSpillFile(sourcePath, options) {
832
796
  const preservedPath = preservedIfPresent();
833
797
  return preservedPath ? { ok: false, reason: "unverified", preservedPath } : { ok: false, reason: "missing" };
834
798
  }
835
- if (size <= 0) return { ok: false, reason: "empty" };
799
+ if (size <= 0)
800
+ return { ok: false, reason: "empty" };
836
801
  let expectedHash = "";
837
802
  try {
838
803
  expectedHash = await ops.hashFile(sourcePath);
@@ -841,15 +806,11 @@ async function promoteToolSpillFile(sourcePath, options) {
841
806
  return preservedPath ? { ok: false, reason: "unverified", preservedPath } : { ok: false, reason: "missing" };
842
807
  }
843
808
  const workspaceRoot = options?.workspaceRoot;
844
- const candidateDirs = Array.from(
845
- new Set(
846
- [
847
- resolveSpillDirectory({ workspaceRoot }),
848
- workspaceRoot ? join2(workspaceRoot, ".nolo", "spills") : void 0,
849
- resolveNoloStateDir("spills")
850
- ].filter((dir) => Boolean(dir))
851
- )
852
- );
809
+ const candidateDirs = Array.from(new Set([
810
+ resolveSpillDirectory({ workspaceRoot }),
811
+ workspaceRoot ? join2(workspaceRoot, ".nolo", "spills") : undefined,
812
+ resolveNoloStateDir("spills")
813
+ ].filter((dir) => Boolean(dir))));
853
814
  for (const dir of candidateDirs) {
854
815
  const id = ops.randomId();
855
816
  const final = join2(dir, `spill-execshell-${id}.log`);
@@ -862,35 +823,34 @@ async function promoteToolSpillFile(sourcePath, options) {
862
823
  ops.rename(sourcePath, stage);
863
824
  stageOwnedByMove = true;
864
825
  } catch (error) {
865
- if (error?.code !== "EXDEV") throw error;
826
+ if (error?.code !== "EXDEV")
827
+ throw error;
866
828
  ops.copyExclusive(sourcePath, stage);
867
829
  stageOwnedByCopy = true;
868
830
  }
869
831
  const actualHash = await ops.hashFile(stage);
870
- if (actualHash !== expectedHash) throw new Error("spill verification failed");
832
+ if (actualHash !== expectedHash)
833
+ throw new Error("spill verification failed");
871
834
  ops.touch(stage, ops.now());
872
835
  ops.rename(stage, final);
873
836
  if (ops.exists(sourcePath)) {
874
837
  try {
875
838
  ops.unlink(sourcePath);
876
- } catch {
877
- }
839
+ } catch {}
878
840
  }
879
841
  try {
880
842
  ops.cleanup(dir);
881
- } catch {
882
- }
843
+ } catch {}
883
844
  const displayPath = workspaceRoot && isAbsolute(workspaceRoot) ? (() => {
884
845
  const rel = relative(workspaceRoot, final);
885
- return rel !== ".." && !rel.startsWith("../") && !rel.startsWith("..\\") && !isAbsolute(rel) ? rel : final;
846
+ return rel !== ".." && !rel.startsWith(".." + "/") && !rel.startsWith(".." + "\\") && !isAbsolute(rel) ? rel : final;
886
847
  })() : final;
887
848
  return { ok: true, spillPath: final, displayPath };
888
849
  } catch {
889
850
  if (stageOwnedByCopy) {
890
851
  try {
891
852
  ops.unlink(stage);
892
- } catch {
893
- }
853
+ } catch {}
894
854
  continue;
895
855
  }
896
856
  if (stageOwnedByMove) {
@@ -910,16 +870,18 @@ async function promoteToolSpillFile(sourcePath, options) {
910
870
  };
911
871
  }
912
872
  function cleanupExpiredSpills(spillDir, options) {
913
- if (!existsSync2(spillDir)) return;
873
+ if (!existsSync2(spillDir))
874
+ return;
914
875
  const throttleMs = options?.throttleMs ?? 0;
915
876
  if (throttleMs > 0) {
916
- const now2 = Date.now();
877
+ const now = Date.now();
917
878
  const last = lastSpillCleanupAtMsByDir.get(spillDir);
918
- if (last !== void 0 && now2 - last < throttleMs) return;
879
+ if (last !== undefined && now - last < throttleMs)
880
+ return;
919
881
  if (lastSpillCleanupAtMsByDir.size >= SPILL_THROTTLE_MAX_DIRS) {
920
882
  lastSpillCleanupAtMsByDir.clear();
921
883
  }
922
- lastSpillCleanupAtMsByDir.set(spillDir, now2);
884
+ lastSpillCleanupAtMsByDir.set(spillDir, now);
923
885
  }
924
886
  const envDefaults = resolveSpillRetentionDefaults();
925
887
  const maxAge = options?.maxAgeMs ?? envDefaults.maxAgeMs;
@@ -929,10 +891,12 @@ function cleanupExpiredSpills(spillDir, options) {
929
891
  const entries = readdirSync2(spillDir, { withFileTypes: true });
930
892
  const spillFiles = [];
931
893
  for (const entry of entries) {
932
- if (!entry.isFile()) continue;
894
+ if (!entry.isFile())
895
+ continue;
933
896
  const isSpillLog = entry.name.startsWith("spill-") && entry.name.endsWith(".log");
934
897
  const isOrphanTmp = entry.name.startsWith(".spill-") && entry.name.endsWith(".tmp");
935
- if (!isSpillLog && !isOrphanTmp) continue;
898
+ if (!isSpillLog && !isOrphanTmp)
899
+ continue;
936
900
  const fullPath = join2(spillDir, entry.name);
937
901
  try {
938
902
  const stats = statSync3(fullPath);
@@ -948,24 +912,23 @@ function cleanupExpiredSpills(spillDir, options) {
948
912
  protectedByPublication
949
913
  });
950
914
  }
951
- } catch {
952
- }
915
+ } catch {}
953
916
  }
954
917
  let totalSize = spillFiles.reduce((acc, file) => acc + file.size, 0);
955
918
  if (totalSize > maxBytes) {
956
919
  spillFiles.sort((a, b) => a.mtimeMs - b.mtimeMs);
957
920
  for (const file of spillFiles) {
958
- if (totalSize <= maxBytes) break;
959
- if (file.protectedByPublication) continue;
921
+ if (totalSize <= maxBytes)
922
+ break;
923
+ if (file.protectedByPublication)
924
+ continue;
960
925
  try {
961
926
  unlinkSync(file.fullPath);
962
927
  totalSize -= file.size;
963
- } catch {
964
- }
928
+ } catch {}
965
929
  }
966
930
  }
967
- } catch {
968
- }
931
+ } catch {}
969
932
  }
970
933
  function spillToolOutput(options) {
971
934
  const { content, workspaceRoot } = options;
@@ -988,10 +951,9 @@ function spillToolOutput(options) {
988
951
  const totalLines = countLines(content);
989
952
  if (existsSync2(spillPath)) {
990
953
  try {
991
- const now = /* @__PURE__ */ new Date();
954
+ const now = new Date;
992
955
  utimesSync(spillPath, now, now);
993
- } catch {
994
- }
956
+ } catch {}
995
957
  } else {
996
958
  writeFileSync(tmpPath, content, "utf-8");
997
959
  renameSync(tmpPath, spillPath);
@@ -1014,7 +976,7 @@ function spillToolOutput(options) {
1014
976
  }
1015
977
  function formatToolOverflowMarker(args) {
1016
978
  const { spillRef, totalChars, totalLines, omittedChars } = args;
1017
- const omittedNote = omittedChars !== void 0 && omittedChars > 0 ? ` omitted: ${omittedChars} chars;` : "";
979
+ const omittedNote = omittedChars !== undefined && omittedChars > 0 ? ` omitted: ${omittedChars} chars;` : "";
1018
980
  return `
1019
981
 
1020
982
  [TOOL-OVERFLOW: full output spilled to ${spillRef} (total: ${totalChars} chars, ${totalLines} lines;${omittedNote} inspect via readFile or grep)]
@@ -1033,10 +995,14 @@ function isSpilledToolOutput(text) {
1033
995
  return MARKER.test(text) && text.length <= PREVIEW_CHARS * 2 + 2048;
1034
996
  }
1035
997
  function formatSpilledToolOutput(args) {
1036
- const headLines = args.head.split("\n").slice(0, HEAD_LINES);
1037
- const tailLines = args.tail.split("\n").slice(-TAIL_LINES);
1038
- const head = headLines.join("\n").slice(0, PREVIEW_CHARS);
1039
- const tail = tailLines.join("\n").slice(-PREVIEW_CHARS);
998
+ const headLines = args.head.split(`
999
+ `).slice(0, HEAD_LINES);
1000
+ const tailLines = args.tail.split(`
1001
+ `).slice(-TAIL_LINES);
1002
+ const head = headLines.join(`
1003
+ `).slice(0, PREVIEW_CHARS);
1004
+ const tail = tailLines.join(`
1005
+ `).slice(-PREVIEW_CHARS);
1040
1006
  const omitted = Math.max(0, args.totalLines - headLines.length - tailLines.length);
1041
1007
  return `${head}
1042
1008
 
@@ -1045,10 +1011,12 @@ function formatSpilledToolOutput(args) {
1045
1011
  ${tail}`;
1046
1012
  }
1047
1013
  function spillLargeToolOutput(content, toolName, workspaceRoot) {
1048
- if (isSpilledToolOutput(content)) return content;
1014
+ if (isSpilledToolOutput(content))
1015
+ return content;
1049
1016
  const byteLength = Buffer.byteLength(content);
1050
1017
  const totalLines = countLines(content);
1051
- if (byteLength <= TOOL_OUTPUT_SPILL_BYTES && totalLines <= TOOL_OUTPUT_SPILL_LINES) return content;
1018
+ if (byteLength <= TOOL_OUTPUT_SPILL_BYTES && totalLines <= TOOL_OUTPUT_SPILL_LINES)
1019
+ return content;
1052
1020
  try {
1053
1021
  const spill = spillToolOutput({ content, toolName, workspaceRoot });
1054
1022
  return formatSpilledToolOutput({ head: content, tail: content, totalLines, byteLength, displayPath: spill.displayPath });
@@ -1058,17 +1026,20 @@ function spillLargeToolOutput(content, toolName, workspaceRoot) {
1058
1026
  }
1059
1027
 
1060
1028
  // packages/agent-runtime/processTaskResult.ts
1061
- var PROCESS_RESULT_CAPSULE_TAIL_CHARS = 4e3;
1062
- var PROCESS_RESULT_CAPSULE_SPILL_THRESHOLD_CHARS = 2e4;
1029
+ var PROCESS_RESULT_CAPSULE_TAIL_CHARS = 4000;
1030
+ var PROCESS_RESULT_CAPSULE_SPILL_THRESHOLD_CHARS = 20000;
1063
1031
  function tailText(value, maxChars) {
1064
- if (value.length <= maxChars) return { text: value, truncated: false };
1032
+ if (value.length <= maxChars)
1033
+ return { text: value, truncated: false };
1065
1034
  return { text: value.slice(-maxChars), truncated: true };
1066
1035
  }
1067
1036
  function reuseStreamSpill(text, workspaceRoot) {
1068
1037
  const displayPath = /Full output saved to ([^\n]+?)\]/.exec(text)?.[1];
1069
- if (!displayPath) return void 0;
1070
- const path = isAbsolute2(displayPath) ? displayPath : workspaceRoot ? resolve(workspaceRoot, displayPath) : void 0;
1071
- if (!path) return void 0;
1038
+ if (!displayPath)
1039
+ return;
1040
+ const path = isAbsolute2(displayPath) ? displayPath : workspaceRoot ? resolve(workspaceRoot, displayPath) : undefined;
1041
+ if (!path)
1042
+ return;
1072
1043
  const fd = openSync(path, "r");
1073
1044
  try {
1074
1045
  const buffer = Buffer.alloc(64 * 1024);
@@ -1076,9 +1047,13 @@ function reuseStreamSpill(text, workspaceRoot) {
1076
1047
  let totalChars = 0, newlines = 0;
1077
1048
  const count = (chunk) => {
1078
1049
  totalChars += chunk.length;
1079
- for (let i = chunk.indexOf("\n"); i >= 0; i = chunk.indexOf("\n", i + 1)) newlines++;
1050
+ for (let i = chunk.indexOf(`
1051
+ `);i >= 0; i = chunk.indexOf(`
1052
+ `, i + 1))
1053
+ newlines++;
1080
1054
  };
1081
- for (let bytes; (bytes = readSync(fd, buffer, 0, buffer.length, null)) > 0; ) count(decoder.write(buffer.subarray(0, bytes)));
1055
+ for (let bytes;(bytes = readSync(fd, buffer, 0, buffer.length, null)) > 0; )
1056
+ count(decoder.write(buffer.subarray(0, bytes)));
1082
1057
  count(decoder.end());
1083
1058
  return { displayPath, totalChars, totalLines: totalChars ? newlines + 1 : 0 };
1084
1059
  } finally {
@@ -1095,8 +1070,8 @@ function buildProcessTaskResultCapsule(args) {
1095
1070
  const stdout = typeof args.stdout === "string" ? args.stdout : "";
1096
1071
  const stderr = typeof args.stderr === "string" ? args.stderr : "";
1097
1072
  const exitCode = args.exitCode;
1098
- const captureError = args.captureError?.trim() || void 0;
1099
- const durationMs = typeof args.startedAt === "number" && Number.isFinite(args.startedAt) ? Math.max(0, (args.endedAt ?? Date.now()) - args.startedAt) : void 0;
1073
+ const captureError = args.captureError?.trim() || undefined;
1074
+ const durationMs = typeof args.startedAt === "number" && Number.isFinite(args.startedAt) ? Math.max(0, (args.endedAt ?? Date.now()) - args.startedAt) : undefined;
1100
1075
  const stdoutProvenance = args.streamProvenance?.stdout;
1101
1076
  const stderrProvenance = args.streamProvenance?.stderr;
1102
1077
  const ringEvicted = Boolean(stdoutProvenance?.evicted || stderrProvenance?.evicted);
@@ -1113,7 +1088,8 @@ function buildProcessTaskResultCapsule(args) {
1113
1088
  if (isSpilledToolOutput(stdout) || isSpilledToolOutput(stderr)) {
1114
1089
  streamSpills = {};
1115
1090
  for (const [name, text] of [["stdout", stdout], ["stderr", stderr]]) {
1116
- if (!text) continue;
1091
+ if (!text)
1092
+ continue;
1117
1093
  try {
1118
1094
  if (isSpilledToolOutput(text)) {
1119
1095
  streamSpills[name] = reuseStreamSpill(text, args.workspaceRoot);
@@ -1121,8 +1097,7 @@ function buildProcessTaskResultCapsule(args) {
1121
1097
  const result = spillToolOutput({ content: text, toolName: "execShell", workspaceRoot: args.workspaceRoot });
1122
1098
  streamSpills[name] = { displayPath: result.displayPath, totalChars: result.totalChars, totalLines: result.totalLines };
1123
1099
  }
1124
- } catch {
1125
- }
1100
+ } catch {}
1126
1101
  }
1127
1102
  const primary = streamSpills.stdout ?? streamSpills.stderr;
1128
1103
  if (primary) {
@@ -1138,26 +1113,24 @@ function buildProcessTaskResultCapsule(args) {
1138
1113
  content: [
1139
1114
  formatCapsuleStream("stdout", stdout),
1140
1115
  formatCapsuleStream("stderr", stderr)
1141
- ].filter(Boolean).join("\n\n"),
1116
+ ].filter(Boolean).join(`
1117
+
1118
+ `),
1142
1119
  toolName: "execShell",
1143
- ...args.workspaceRoot !== void 0 ? { workspaceRoot: args.workspaceRoot } : {}
1120
+ ...args.workspaceRoot !== undefined ? { workspaceRoot: args.workspaceRoot } : {}
1144
1121
  });
1145
1122
  spill = {
1146
1123
  displayPath: result.displayPath,
1147
- // Prefer the caller's live provenance counters: they count every
1148
- // byte of the original stream, while the buffered content above may
1149
- // be a capped prefix of it.
1150
1124
  totalChars: (stdoutProvenance?.totalChars ?? stdout.length) + (stderrProvenance?.totalChars ?? stderr.length),
1151
1125
  totalLines: (stdoutProvenance?.totalLines ?? countLines(stdout)) + (stderrProvenance?.totalLines ?? countLines(stderr))
1152
1126
  };
1153
- } catch {
1154
- }
1127
+ } catch {}
1155
1128
  }
1156
1129
  return {
1157
1130
  stdout: stdoutTail.text,
1158
1131
  stderr: stderrTail.text,
1159
1132
  exitCode,
1160
- ...durationMs !== void 0 ? { durationMs } : {},
1133
+ ...durationMs !== undefined ? { durationMs } : {},
1161
1134
  ...captureError ? { captureError } : {},
1162
1135
  truncated,
1163
1136
  ...spill ? { spill } : {},
@@ -1166,8 +1139,8 @@ function buildProcessTaskResultCapsule(args) {
1166
1139
  }
1167
1140
 
1168
1141
  // packages/agent-runtime/workspaceShell.ts
1169
- var confidentialShell = new AsyncLocalStorage();
1170
- var shellChildEnvironment = new AsyncLocalStorage();
1142
+ var confidentialShell = new AsyncLocalStorage;
1143
+ var shellChildEnvironment = new AsyncLocalStorage;
1171
1144
  function withShellChildEnvironment(env, run) {
1172
1145
  return shellChildEnvironment.run(env, run);
1173
1146
  }
@@ -1196,19 +1169,22 @@ function workspaceChildEnv(env = process.env, platform = process.platform) {
1196
1169
  }
1197
1170
  var EXEC_SHELL_TIMEOUT_ENV = "NOLO_EXEC_SHELL_TIMEOUT_MS";
1198
1171
  var EXEC_SHELL_DETACH_ENV = "NOLO_EXEC_SHELL_DETACH_MS";
1199
- var DEFAULT_EXEC_SHELL_DETACH_MS = 12e4;
1172
+ var DEFAULT_EXEC_SHELL_DETACH_MS = 120000;
1200
1173
  function readTrimmedString(value) {
1201
1174
  return asOptionalTrimmedString(value);
1202
1175
  }
1203
1176
  function extractActivityRefs(rawRefs) {
1204
- if (!Array.isArray(rawRefs)) return void 0;
1177
+ if (!Array.isArray(rawRefs))
1178
+ return;
1205
1179
  const refs = rawRefs.flatMap((entry) => {
1206
1180
  if (typeof entry === "string" && entry.trim()) {
1207
1181
  return [{ type: "file", path: entry.trim() }];
1208
1182
  }
1209
- if (!isRecord(entry)) return [];
1183
+ if (!isRecord(entry))
1184
+ return [];
1210
1185
  const path = readTrimmedString(entry.path);
1211
- if (path) return [{ type: "file", path }];
1186
+ if (path)
1187
+ return [{ type: "file", path }];
1212
1188
  const terminalId = readTrimmedString(entry.id);
1213
1189
  const terminalLabel = readTrimmedString(entry.label);
1214
1190
  if (entry.type === "terminal" || terminalId || terminalLabel) {
@@ -1225,12 +1201,14 @@ function extractActivityRefs(rawRefs) {
1225
1201
  }
1226
1202
  return [];
1227
1203
  });
1228
- return refs.length ? refs : void 0;
1204
+ return refs.length ? refs : undefined;
1229
1205
  }
1230
1206
  function extractActivityAction(rawAction) {
1231
- if (!isRecord(rawAction)) return void 0;
1207
+ if (!isRecord(rawAction))
1208
+ return;
1232
1209
  const title = readTrimmedString(rawAction.title);
1233
- if (!title) return void 0;
1210
+ if (!title)
1211
+ return;
1234
1212
  const kind = readTrimmedString(rawAction.kind);
1235
1213
  const detail = readTrimmedString(rawAction.detail);
1236
1214
  const refs = extractActivityRefs(rawAction.refs);
@@ -1242,27 +1220,32 @@ function extractActivityAction(rawAction) {
1242
1220
  };
1243
1221
  }
1244
1222
  function extractActivityPhase(rawPhase) {
1245
- if (!isRecord(rawPhase)) return void 0;
1223
+ if (!isRecord(rawPhase))
1224
+ return;
1246
1225
  const title = readTrimmedString(rawPhase.title);
1247
- if (!title) return void 0;
1226
+ if (!title)
1227
+ return;
1248
1228
  const id = readTrimmedString(rawPhase.id) || title.toLowerCase().replace(/\s+/g, "-");
1249
1229
  const index = asOptionalFiniteNumber(rawPhase.index);
1250
1230
  const total = asOptionalFiniteNumber(rawPhase.total);
1251
- const status = rawPhase.status === "pending" || rawPhase.status === "running" || rawPhase.status === "success" || rawPhase.status === "failed" ? rawPhase.status : void 0;
1231
+ const status = rawPhase.status === "pending" || rawPhase.status === "running" || rawPhase.status === "success" || rawPhase.status === "failed" ? rawPhase.status : undefined;
1252
1232
  return {
1253
1233
  id,
1254
1234
  title,
1255
- ...index !== void 0 ? { index } : {},
1256
- ...total !== void 0 ? { total } : {},
1235
+ ...index !== undefined ? { index } : {},
1236
+ ...total !== undefined ? { total } : {},
1257
1237
  ...status ? { status } : {}
1258
1238
  };
1259
1239
  }
1260
1240
  function extractActivityPlan(rawPlan) {
1261
- if (!isRecord(rawPlan)) return void 0;
1262
- if (!Array.isArray(rawPlan.phases)) return void 0;
1241
+ if (!isRecord(rawPlan))
1242
+ return;
1243
+ if (!Array.isArray(rawPlan.phases))
1244
+ return;
1263
1245
  const phases = rawPlan.phases.flatMap((entry, index) => {
1264
1246
  const phase = extractActivityPhase(entry);
1265
- if (!phase) return [];
1247
+ if (!phase)
1248
+ return [];
1266
1249
  return [{
1267
1250
  id: phase.id,
1268
1251
  title: phase.title,
@@ -1270,7 +1253,8 @@ function extractActivityPlan(rawPlan) {
1270
1253
  ...phase.status ? { status: phase.status } : {}
1271
1254
  }];
1272
1255
  });
1273
- if (phases.length === 0) return void 0;
1256
+ if (phases.length === 0)
1257
+ return;
1274
1258
  const title = readTrimmedString(rawPlan.title);
1275
1259
  return {
1276
1260
  ...title ? { title } : {},
@@ -1279,13 +1263,15 @@ function extractActivityPlan(rawPlan) {
1279
1263
  }
1280
1264
  function extractActivity(parsed) {
1281
1265
  const raw = parsed._activity;
1282
- if (!isRecord(raw)) return void 0;
1266
+ if (!isRecord(raw))
1267
+ return;
1283
1268
  const nestedAction = extractActivityAction(raw.action);
1284
1269
  const legacyAction = extractActivityAction(raw);
1285
1270
  const action = nestedAction || legacyAction;
1286
1271
  const phase = extractActivityPhase(raw.phase);
1287
1272
  const plan = extractActivityPlan(raw.plan);
1288
- if (!action && !plan) return void 0;
1273
+ if (!action && !plan)
1274
+ return;
1289
1275
  return {
1290
1276
  ...action ? action : {},
1291
1277
  ...phase ? { phase } : {},
@@ -1311,8 +1297,6 @@ function wrapPowerShellCommand(command, shellKind = "pwsh") {
1311
1297
  "[Console]::InputEncoding=[System.Text.Encoding]::UTF8",
1312
1298
  "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8",
1313
1299
  "$OutputEncoding=[System.Text.Encoding]::UTF8",
1314
- // $PSStyle only exists on PowerShell 7+; injecting it on 5.1 makes every
1315
- // command emit a PropertyNotFound error on stderr.
1316
1300
  ...shellKind === "pwsh" ? ["$PSStyle.OutputRendering='PlainText'"] : [],
1317
1301
  command
1318
1302
  ].join("; ");
@@ -1327,14 +1311,18 @@ function selectPowerShellExecutable(deps = {}) {
1327
1311
  const isAliasPath = deps.isAliasPath ?? ((path) => isWindowsStoreAliasPath(path, { platform, env }));
1328
1312
  const pathHit = resolveOnPath("pwsh");
1329
1313
  const aliasTarget = pathHit ? resolveAliasTarget(pathHit) : null;
1330
- if (aliasTarget) return aliasTarget;
1331
- if (pathHit && !isAliasPath(pathHit)) return pathHit;
1314
+ if (aliasTarget)
1315
+ return aliasTarget;
1316
+ if (pathHit && !isAliasPath(pathHit))
1317
+ return pathHit;
1332
1318
  const alias = (deps.findAlias ?? (() => findWindowsPowerShellAlias({ platform, env })))();
1333
- if (alias) return alias;
1319
+ if (alias)
1320
+ return alias;
1334
1321
  return resolveOnPath("powershell.exe") ?? resolveOnPath("powershell");
1335
1322
  }
1336
1323
  function findPowerShellExecutable() {
1337
- if (cachedPowerShellExecutable !== void 0) return cachedPowerShellExecutable;
1324
+ if (cachedPowerShellExecutable !== undefined)
1325
+ return cachedPowerShellExecutable;
1338
1326
  cachedPowerShellExecutable = selectPowerShellExecutable();
1339
1327
  return cachedPowerShellExecutable;
1340
1328
  }
@@ -1357,21 +1345,23 @@ function resolveShellLoginMode() {
1357
1345
  return "fast";
1358
1346
  }
1359
1347
  function buildBashCommand(command, options) {
1360
- if (cachedBashExecutable === void 0) {
1348
+ if (cachedBashExecutable === undefined) {
1361
1349
  cachedBashExecutable = resolveExecutableOnPath("bash") || resolveExecutableOnPath("sh");
1362
1350
  }
1363
- if (!cachedBashExecutable) throw new Error("bash/sh is not available on this machine.");
1351
+ if (!cachedBashExecutable)
1352
+ throw new Error("bash/sh is not available on this machine.");
1364
1353
  const isLogin = options?.login ?? resolveShellLoginMode() === "login";
1365
1354
  return [cachedBashExecutable, isLogin ? "-lc" : "-c", command];
1366
1355
  }
1367
1356
  function buildWorkspaceShellPlan(args) {
1368
1357
  if (args.shell === "bash") {
1369
- const argv2 = buildBashCommand(args.command, { login: args.login });
1370
- return { argv: argv2, resolvedShell: "bash", executable: argv2[0] ?? "bash" };
1358
+ const argv = buildBashCommand(args.command, { login: args.login });
1359
+ return { argv, resolvedShell: "bash", executable: argv[0] ?? "bash" };
1371
1360
  }
1372
1361
  if (args.shell === "powershell" || process.platform === "win32") {
1373
1362
  const executable = findPowerShellExecutable();
1374
- if (!executable) throw new Error("PowerShell is not available on this machine.");
1363
+ if (!executable)
1364
+ throw new Error("PowerShell is not available on this machine.");
1375
1365
  return {
1376
1366
  argv: buildPowerShellSpawnArgs({ executable, command: args.command }),
1377
1367
  resolvedShell: "powershell",
@@ -1408,7 +1398,8 @@ function buildWorkspaceShellEscapeBlockedResult(args) {
1408
1398
  `command: ${args.command}`,
1409
1399
  "Use paths relative to the authorized folder only.",
1410
1400
  "exitCode: 126"
1411
- ].join("\n"),
1401
+ ].join(`
1402
+ `),
1412
1403
  metadata: {
1413
1404
  exitCode: 126,
1414
1405
  workspaceShellEscapeBlocked: true,
@@ -1418,14 +1409,18 @@ function buildWorkspaceShellEscapeBlockedResult(args) {
1418
1409
  }
1419
1410
  function extractInteractiveGhAuthCommand(command) {
1420
1411
  const tokens = tokenizeShellPrefix(command);
1421
- if (tokens[0] !== "gh" || tokens[1] !== "auth") return null;
1412
+ if (tokens[0] !== "gh" || tokens[1] !== "auth")
1413
+ return null;
1422
1414
  const subcommand = tokens[2];
1423
- if (subcommand !== "login" && subcommand !== "refresh") return null;
1424
- if (tokens.includes("--help")) return null;
1415
+ if (subcommand !== "login" && subcommand !== "refresh")
1416
+ return null;
1417
+ if (tokens.includes("--help"))
1418
+ return null;
1425
1419
  const result = ["gh", "auth", subcommand];
1426
- for (let index = 3; index < tokens.length; index += 1) {
1420
+ for (let index = 3;index < tokens.length; index += 1) {
1427
1421
  const token = tokens[index];
1428
- if (!token) continue;
1422
+ if (!token)
1423
+ continue;
1429
1424
  if (token === "-h" || token === "--hostname" || token === "-s" || token === "--scopes" || token === "--remove-scopes" || token === "-r") {
1430
1425
  const value = tokens[index + 1];
1431
1426
  if (value) {
@@ -1453,7 +1448,8 @@ function buildInteractiveCommandBlockedResult(command) {
1453
1448
  `command: ${command}`,
1454
1449
  "Run this in the current TUI terminal, then resume the agent turn.",
1455
1450
  "exitCode: 130"
1456
- ].join("\n"),
1451
+ ].join(`
1452
+ `),
1457
1453
  metadata: {
1458
1454
  exitCode: 130,
1459
1455
  timedOut: false,
@@ -1473,9 +1469,11 @@ function buildInteractiveCommandBlockedResult(command) {
1473
1469
  }
1474
1470
  function resolveExecShellTimeoutMs(override) {
1475
1471
  const fromOverride = asOptionalPositiveFiniteNumber(override);
1476
- if (fromOverride !== void 0) return fromOverride;
1472
+ if (fromOverride !== undefined)
1473
+ return fromOverride;
1477
1474
  const raw = process.env[EXEC_SHELL_TIMEOUT_ENV];
1478
- if (raw === void 0) return void 0;
1475
+ if (raw === undefined)
1476
+ return;
1479
1477
  return asOptionalPositiveFiniteNumber(Number(raw));
1480
1478
  }
1481
1479
  function resolveDetachMs(override) {
@@ -1483,13 +1481,16 @@ function resolveDetachMs(override) {
1483
1481
  return override;
1484
1482
  }
1485
1483
  const raw = process.env[EXEC_SHELL_DETACH_ENV];
1486
- if (raw === void 0) return DEFAULT_EXEC_SHELL_DETACH_MS;
1484
+ if (raw === undefined)
1485
+ return DEFAULT_EXEC_SHELL_DETACH_MS;
1487
1486
  const parsed = asOptionalPositiveFiniteNumber(Number(raw));
1488
- return parsed === void 0 ? DEFAULT_EXEC_SHELL_DETACH_MS : parsed;
1487
+ return parsed === undefined ? DEFAULT_EXEC_SHELL_DETACH_MS : parsed;
1489
1488
  }
1490
- function truncateToolOutput(value, limit = 2e4, options) {
1491
- if (isSpilledToolOutput(value)) return value;
1492
- if (value.length <= limit) return value;
1489
+ function truncateToolOutput(value, limit = 20000, options) {
1490
+ if (isSpilledToolOutput(value))
1491
+ return value;
1492
+ if (value.length <= limit)
1493
+ return value;
1493
1494
  let spillNote = "";
1494
1495
  let spillPathOnly = "";
1495
1496
  try {
@@ -1500,20 +1501,21 @@ function truncateToolOutput(value, limit = 2e4, options) {
1500
1501
  });
1501
1502
  spillNote = `; spillFile=${spill.displayPath}; totalLines=${spill.totalLines}; hint=read a range, not the whole spill (readFile lines=A-B or sed -n 'A,Bp'); a full read re-injects ${spill.totalChars} chars`;
1502
1503
  spillPathOnly = `; spillFile=${spill.displayPath}`;
1503
- } catch {
1504
- }
1504
+ } catch {}
1505
1505
  const approxMarkerLen = 40 + spillNote.length;
1506
1506
  if (limit <= approxMarkerLen) {
1507
1507
  const notice = `[... truncated ${value.length} chars]`;
1508
1508
  const withFullNote = `[... truncated ${value.length} chars${spillNote} ...]`;
1509
- if (withFullNote.length <= limit) return withFullNote;
1509
+ if (withFullNote.length <= limit)
1510
+ return withFullNote;
1510
1511
  const withPath = `[... truncated ${value.length} chars${spillPathOnly} ...]`;
1511
- if (withPath.length <= limit) return withPath;
1512
+ if (withPath.length <= limit)
1513
+ return withPath;
1512
1514
  if (notice.length <= limit) {
1513
1515
  const pathOmitted = " [... path omitted]";
1514
1516
  return notice.length + pathOmitted.length <= limit ? notice + pathOmitted : notice;
1515
1517
  }
1516
- return limit <= 0 ? "" : "\u2026";
1518
+ return limit <= 0 ? "" : "…";
1517
1519
  }
1518
1520
  const remaining = limit - approxMarkerLen;
1519
1521
  const headSize = Math.floor(remaining * 0.3);
@@ -1531,11 +1533,11 @@ var DEFAULT_MAX_STREAM_BUFFER_BYTES = 5 * 1024 * 1024;
1531
1533
  function removeSpillFile(path) {
1532
1534
  try {
1533
1535
  rmSync(path, { force: true });
1534
- } catch {
1535
- }
1536
+ } catch {}
1536
1537
  }
1537
1538
  function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BYTES, capture) {
1538
- if (!stream) return Promise.resolve("");
1539
+ if (!stream)
1540
+ return Promise.resolve("");
1539
1541
  const options = typeof maxBytesOrOptions === "number" ? { maxBytes: maxBytesOrOptions } : maxBytesOrOptions ?? {};
1540
1542
  const maxBytes = typeof options.maxBytes === "number" && Number.isFinite(options.maxBytes) && options.maxBytes >= 0 ? options.maxBytes : DEFAULT_MAX_STREAM_BUFFER_BYTES;
1541
1543
  const spillPath = asOptionalTrimmedString(options.spillPath);
@@ -1550,7 +1552,8 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1550
1552
  let settled = false;
1551
1553
  let captureResolved = false;
1552
1554
  const resolveCapture = (text) => {
1553
- if (captureResolved) return;
1555
+ if (captureResolved)
1556
+ return;
1554
1557
  captureResolved = true;
1555
1558
  capture?.stopSignal.removeEventListener("abort", stopCapture);
1556
1559
  resolveStream(text);
@@ -1566,15 +1569,16 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1566
1569
  let spillSettlement;
1567
1570
  const formatLimit = maxBytes >= 1024 * 1024 ? `${Math.round(maxBytes / (1024 * 1024))}MB` : `${Math.round(maxBytes / 1024)}KB`;
1568
1571
  const resumeSourceIfPaused = () => {
1569
- if (!sourcePausedForSpill) return;
1572
+ if (!sourcePausedForSpill)
1573
+ return;
1570
1574
  sourcePausedForSpill = false;
1571
1575
  try {
1572
1576
  stream.resume?.();
1573
- } catch {
1574
- }
1577
+ } catch {}
1575
1578
  };
1576
1579
  const markSpillFailed = (error) => {
1577
- if (spillSettlement || spillState === "failed") return;
1580
+ if (spillSettlement || spillState === "failed")
1581
+ return;
1578
1582
  spillState = "failed";
1579
1583
  if (!spillError) {
1580
1584
  spillError = toErrorMessage(error);
@@ -1584,14 +1588,14 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1584
1588
  if (sink) {
1585
1589
  try {
1586
1590
  sink.destroy?.();
1587
- } catch {
1588
- }
1591
+ } catch {}
1589
1592
  }
1590
1593
  resumeSourceIfPaused();
1591
1594
  };
1592
1595
  const writeToSink = (buf) => {
1593
1596
  const sink = spillSink;
1594
- if (!sink || spillState !== "open") return;
1597
+ if (!sink || spillState !== "open")
1598
+ return;
1595
1599
  if (sink.destroyed === true) {
1596
1600
  markSpillFailed(new Error("spill writable closed before finish"));
1597
1601
  return;
@@ -1613,21 +1617,24 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1613
1617
  }
1614
1618
  };
1615
1619
  const openSpill = (headChunks, crossingChunk) => {
1616
- if (!spillPath || spillState !== "idle") return;
1620
+ if (!spillPath || spillState !== "idle")
1621
+ return;
1617
1622
  let sink;
1618
1623
  try {
1619
1624
  mkdirSync2(dirname(spillPath), { recursive: true });
1620
1625
  sink = createSink(spillPath);
1621
1626
  sink.on("error", (error) => markSpillFailed(error));
1622
1627
  sink.on("drain", () => {
1623
- if (settled) return;
1628
+ if (settled)
1629
+ return;
1624
1630
  resumeSourceIfPaused();
1625
1631
  });
1626
1632
  sink.on("finish", () => {
1627
1633
  sinkFinished = true;
1628
1634
  });
1629
1635
  sink.on("close", () => {
1630
- if (sinkFinished || spillState !== "open") return;
1636
+ if (sinkFinished || spillState !== "open")
1637
+ return;
1631
1638
  markSpillFailed(new Error("spill writable closed before finish"));
1632
1639
  });
1633
1640
  } catch (error) {
@@ -1638,11 +1645,13 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1638
1645
  }
1639
1646
  spillSink = sink;
1640
1647
  spillState = "open";
1641
- for (const head of headChunks) writeToSink(head);
1648
+ for (const head of headChunks)
1649
+ writeToSink(head);
1642
1650
  writeToSink(crossingChunk);
1643
1651
  };
1644
1652
  const settleSpillRetention = () => {
1645
- if (spillSettlement) return spillSettlement;
1653
+ if (spillSettlement)
1654
+ return spillSettlement;
1646
1655
  spillSettlement = Promise.resolve().then(async () => {
1647
1656
  if (!spillPath || spillRetention === "keep") {
1648
1657
  if (spillPath && spillRetention === "keep" && spillState === "ok") {
@@ -1667,20 +1676,23 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1667
1676
  return spillSettlement;
1668
1677
  };
1669
1678
  const finalize = (wasTruncated) => {
1670
- if (settled) return;
1679
+ if (settled)
1680
+ return;
1671
1681
  settled = true;
1672
1682
  const truncatedNow = wasTruncated || truncated;
1673
1683
  const baseText = Buffer.concat(chunks).toString("utf8");
1674
1684
  const done = async () => {
1675
- if (captureResolved) return;
1685
+ if (captureResolved)
1686
+ return;
1676
1687
  await settleSpillRetention();
1677
- if (captureResolved) return;
1688
+ if (captureResolved)
1689
+ return;
1678
1690
  if (options.suppressIncomplete && (!sourceEnded || truncatedNow)) {
1679
1691
  resolveCapture("[incomplete confidential output withheld]");
1680
1692
  return;
1681
1693
  }
1682
1694
  let text = baseText;
1683
- if (truncatedNow && spillRetainedPath && sourceEnded && options.maxLines !== void 0) {
1695
+ if (truncatedNow && spillRetainedPath && sourceEnded && options.maxLines !== undefined) {
1684
1696
  resolveCapture(formatSpilledToolOutput({
1685
1697
  head: baseText,
1686
1698
  tail: tail.toString("utf8"),
@@ -1695,9 +1707,7 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1695
1707
  if (spillRetainedPath && sourceEnded) {
1696
1708
  notes.push(`full output: ${spillRetainedPath}`);
1697
1709
  } else if (spillPath) {
1698
- notes.push(
1699
- spillState === "failed" ? `spill failed${spillError ? ` (${spillError})` : ""}; output incomplete` : `spill output not retained; output incomplete`
1700
- );
1710
+ notes.push(spillState === "failed" ? `spill failed${spillError ? ` (${spillError})` : ""}; output incomplete` : `spill output not retained; output incomplete`);
1701
1711
  }
1702
1712
  text += `
1703
1713
 
@@ -1708,19 +1718,20 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1708
1718
  };
1709
1719
  const sink = spillSink;
1710
1720
  if (!sink || spillState !== "open") {
1711
- void done();
1721
+ done();
1712
1722
  return;
1713
1723
  }
1714
1724
  let closed = false;
1715
1725
  const settleSink = (failed, error) => {
1716
- if (closed) return;
1726
+ if (closed)
1727
+ return;
1717
1728
  closed = true;
1718
1729
  if (failed) {
1719
1730
  markSpillFailed(error ?? new Error("spill write failed"));
1720
1731
  } else if (spillState === "open") {
1721
1732
  spillState = "ok";
1722
1733
  }
1723
- void done();
1734
+ done();
1724
1735
  };
1725
1736
  if (sink.destroyed === true) {
1726
1737
  settleSink(true, new Error("spill writable closed before finish"));
@@ -1738,7 +1749,8 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1738
1749
  }
1739
1750
  };
1740
1751
  const stopCapture = () => {
1741
- if (captureResolved) return;
1752
+ if (captureResolved)
1753
+ return;
1742
1754
  settled = true;
1743
1755
  const reason = "capture incomplete: post-exit drain grace exceeded";
1744
1756
  const snapshot = Buffer.concat(chunks).toString("utf8");
@@ -1746,22 +1758,24 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1746
1758
  capture?.onIncomplete(reason);
1747
1759
  if (!spillSettlement) {
1748
1760
  markSpillFailed(new Error(reason));
1749
- void settleSpillRetention();
1761
+ settleSpillRetention();
1750
1762
  }
1751
- resolveCapture(
1752
- options.suppressIncomplete ? "[incomplete confidential output withheld]" : `${snapshot}
1763
+ resolveCapture(options.suppressIncomplete ? "[incomplete confidential output withheld]" : `${snapshot}
1753
1764
 
1754
- [${reason}]`
1755
- );
1765
+ [${reason}]`);
1756
1766
  };
1757
1767
  capture?.stopSignal.addEventListener("abort", stopCapture, { once: true });
1758
- if (capture?.stopSignal.aborted) stopCapture();
1768
+ if (capture?.stopSignal.aborted)
1769
+ stopCapture();
1759
1770
  stream.on("data", (chunk) => {
1760
- if (settled) return;
1771
+ if (settled)
1772
+ return;
1761
1773
  const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
1762
1774
  observedBytes += buf.length;
1763
- for (const byte of buf) if (byte === 10) observedLines++;
1764
- if (options.maxLines !== void 0) {
1775
+ for (const byte of buf)
1776
+ if (byte === 10)
1777
+ observedLines++;
1778
+ if (options.maxLines !== undefined) {
1765
1779
  tail = Buffer.concat([tail, buf.subarray(Math.max(0, buf.length - maxBytes))]).subarray(-maxBytes);
1766
1780
  }
1767
1781
  if (truncated) {
@@ -1783,22 +1797,23 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1783
1797
  chunks.push(buf);
1784
1798
  });
1785
1799
  stream.on("error", (error) => {
1786
- if (settled) return;
1800
+ if (settled)
1801
+ return;
1787
1802
  settled = true;
1788
1803
  const sink = spillSink;
1789
1804
  spillSink = null;
1790
- if (!spillError) spillError = toErrorMessage(error);
1805
+ if (!spillError)
1806
+ spillError = toErrorMessage(error);
1791
1807
  if (spillState !== "failed" && spillState !== "disabled") {
1792
1808
  spillState = "failed";
1793
1809
  }
1794
1810
  if (sink) {
1795
1811
  try {
1796
1812
  sink.destroy?.();
1797
- } catch {
1798
- }
1813
+ } catch {}
1799
1814
  }
1800
1815
  resumeSourceIfPaused();
1801
- void settleSpillRetention();
1816
+ settleSpillRetention();
1802
1817
  captureResolved = true;
1803
1818
  capture?.stopSignal.removeEventListener("abort", stopCapture);
1804
1819
  chunks.length = 0;
@@ -1813,16 +1828,19 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
1813
1828
  }
1814
1829
  function deriveLabel(command) {
1815
1830
  const trimmed = command.trim();
1816
- if (!trimmed) return "process";
1831
+ if (!trimmed)
1832
+ return "process";
1817
1833
  const tokens = trimmed.split(/\s+/);
1818
1834
  const lastToken = tokens[tokens.length - 1] ?? trimmed;
1819
1835
  const labelCandidate = lastToken.split(/[/\\]/).pop() || lastToken;
1820
1836
  return labelCandidate || trimmed;
1821
1837
  }
1822
1838
  function isSpawnFailureError(error) {
1823
- if (!error || typeof error !== "object") return false;
1839
+ if (!error || typeof error !== "object")
1840
+ return false;
1824
1841
  const err = error;
1825
- if (err.code === "ENOENT") return true;
1842
+ if (err.code === "ENOENT")
1843
+ return true;
1826
1844
  const message = toErrorMessage(error).toLowerCase();
1827
1845
  return message.includes("enoent") || message.includes("executable not found") || message.includes("spawn") && message.includes("not found");
1828
1846
  }
@@ -1835,21 +1853,17 @@ function spawnFailedCommandResult(error, outputLimit) {
1835
1853
  exitCode: 127,
1836
1854
  timedOut: false,
1837
1855
  spawnFailed: true,
1838
- content: truncateToolOutput(
1839
- [`stderr:
1840
- ${stderr.trim()}`, "exitCode: 127"].filter(Boolean).join("\n\n"),
1841
- outputLimit
1842
- )
1856
+ content: truncateToolOutput([`stderr:
1857
+ ${stderr.trim()}`, "exitCode: 127"].filter(Boolean).join(`
1858
+
1859
+ `), outputLimit)
1843
1860
  };
1844
1861
  }
1845
1862
  function stdoutPromiseResult(promise) {
1846
- return promise.then(
1847
- (value) => ({ value }),
1848
- (error) => ({
1849
- value: "",
1850
- error: error instanceof Error ? error.message : String(error)
1851
- })
1852
- );
1863
+ return promise.then((value) => ({ value }), (error) => ({
1864
+ value: "",
1865
+ error: error instanceof Error ? error.message : String(error)
1866
+ }));
1853
1867
  }
1854
1868
  async function runWorkspaceCommand(args) {
1855
1869
  const timeoutMs = asOptionalPositiveFiniteNumber(args.timeoutMs);
@@ -1864,17 +1878,15 @@ async function runWorkspaceCommand(args) {
1864
1878
  cwd: resolve2(args.workspaceRoot),
1865
1879
  env: workspaceChildEnv({ ...process.env, ...shellChildEnvironment.getStore() }),
1866
1880
  stdio: [
1867
- args.stdin === void 0 ? "ignore" : "pipe",
1881
+ args.stdin === undefined ? "ignore" : "pipe",
1868
1882
  "pipe",
1869
1883
  "pipe",
1870
1884
  ...confidential ? ["pipe"] : []
1871
1885
  ],
1872
1886
  detached,
1873
- // Windows: a child spawned from a console-less parent (e.g. a detached run) would
1874
- // otherwise get its own flashing console window per command.
1875
1887
  windowsHide: true
1876
1888
  });
1877
- if (args.stdin !== void 0 && proc.stdin) {
1889
+ if (args.stdin !== undefined && proc.stdin) {
1878
1890
  proc.stdin.write(args.stdin);
1879
1891
  proc.stdin.end();
1880
1892
  }
@@ -1886,18 +1898,13 @@ async function runWorkspaceCommand(args) {
1886
1898
  fd.end(confidential.bwrapArgs);
1887
1899
  }
1888
1900
  const label = args.label?.trim() || deriveLabel(args.command.join(" "));
1889
- const registry2 = getProcessRegistry();
1901
+ const registry = getProcessRegistry();
1890
1902
  if (typeof proc.pid === "number") {
1891
- registry2.add({
1903
+ registry.add({
1892
1904
  pid: proc.pid,
1893
1905
  pgid: proc.pid,
1894
1906
  command: args.command.join(" "),
1895
1907
  label,
1896
- // Foreground grace-period envelope: not a user-visible background task
1897
- // until promote() flips the marker on timeout detach (see
1898
- // listBackground). Keeps the status line / /procs / /stop semantics
1899
- // identical to pre-Phase-0. Ownership rides along so the promoted record
1900
- // stays attributable without any terminal-time inference.
1901
1908
  transient: true,
1902
1909
  owner: args.owner ?? null
1903
1910
  });
@@ -1910,8 +1917,7 @@ async function runWorkspaceCommand(args) {
1910
1917
  if (typeof proc.pid === "number") {
1911
1918
  try {
1912
1919
  process.kill(-proc.pid, signal);
1913
- } catch {
1914
- }
1920
+ } catch {}
1915
1921
  }
1916
1922
  };
1917
1923
  if (detached) {
@@ -1920,12 +1926,13 @@ async function runWorkspaceCommand(args) {
1920
1926
  process.once("SIGINT", cleanupChildOnHostSignal);
1921
1927
  }
1922
1928
  const detachSignalCleanup = () => {
1923
- if (!detached) return;
1929
+ if (!detached)
1930
+ return;
1924
1931
  process.removeListener("SIGHUP", cleanupChildOnHostSignal);
1925
1932
  process.removeListener("SIGTERM", cleanupChildOnHostSignal);
1926
1933
  process.removeListener("SIGINT", cleanupChildOnHostSignal);
1927
1934
  };
1928
- const captureCutoff = new AbortController();
1935
+ const captureCutoff = new AbortController;
1929
1936
  const captureOptions = (suffix) => ({
1930
1937
  maxBytes: TOOL_OUTPUT_SPILL_BYTES,
1931
1938
  maxLines: TOOL_OUTPUT_SPILL_LINES,
@@ -1937,24 +1944,20 @@ async function runWorkspaceCommand(args) {
1937
1944
  });
1938
1945
  let stdoutIncomplete;
1939
1946
  let stderrIncomplete;
1940
- const stdoutCapture = stdoutPromiseResult(
1941
- readNodeStream(proc.stdout, captureOptions(""), {
1942
- stopSignal: captureCutoff.signal,
1943
- onIncomplete: (reason) => {
1944
- stdoutIncomplete = reason;
1945
- }
1946
- })
1947
- ).then((result) => ({ ...result, value: confidential ? confidential.redact(result.value) : result.value, error: result.error || stdoutIncomplete }));
1948
- const stderrCapture = stdoutPromiseResult(
1949
- readNodeStream(proc.stderr, captureOptions("-stderr"), {
1950
- stopSignal: captureCutoff.signal,
1951
- onIncomplete: (reason) => {
1952
- stderrIncomplete = reason;
1953
- }
1954
- })
1955
- ).then((result) => ({ ...result, value: confidential ? confidential.redact(result.value) : result.value, error: result.error || stderrIncomplete }));
1947
+ const stdoutCapture = stdoutPromiseResult(readNodeStream(proc.stdout, captureOptions(""), {
1948
+ stopSignal: captureCutoff.signal,
1949
+ onIncomplete: (reason) => {
1950
+ stdoutIncomplete = reason;
1951
+ }
1952
+ })).then((result) => ({ ...result, value: confidential ? confidential.redact(result.value) : result.value, error: result.error || stdoutIncomplete }));
1953
+ const stderrCapture = stdoutPromiseResult(readNodeStream(proc.stderr, captureOptions("-stderr"), {
1954
+ stopSignal: captureCutoff.signal,
1955
+ onIncomplete: (reason) => {
1956
+ stderrIncomplete = reason;
1957
+ }
1958
+ })).then((result) => ({ ...result, value: confidential ? confidential.redact(result.value) : result.value, error: result.error || stderrIncomplete }));
1956
1959
  const exitPromise = processExitPromise.then(async (code) => {
1957
- const drainTimer = setTimeout(() => captureCutoff.abort(), 2e3);
1960
+ const drainTimer = setTimeout(() => captureCutoff.abort(), 2000);
1958
1961
  try {
1959
1962
  await Promise.all([stdoutCapture, stderrCapture]);
1960
1963
  return code;
@@ -1967,21 +1970,21 @@ async function runWorkspaceCommand(args) {
1967
1970
  let timeout;
1968
1971
  let forceKillTimer;
1969
1972
  const cleanupTerminationTimers = () => {
1970
- if (timeout) clearTimeout(timeout);
1971
- if (forceKillTimer) clearTimeout(forceKillTimer);
1973
+ if (timeout)
1974
+ clearTimeout(timeout);
1975
+ if (forceKillTimer)
1976
+ clearTimeout(forceKillTimer);
1972
1977
  };
1973
1978
  const killChild = (signal) => {
1974
1979
  if (detached && typeof proc.pid === "number") {
1975
1980
  try {
1976
1981
  process.kill(-proc.pid, signal);
1977
1982
  return;
1978
- } catch {
1979
- }
1983
+ } catch {}
1980
1984
  }
1981
1985
  try {
1982
1986
  proc.kill(signal);
1983
- } catch {
1984
- }
1987
+ } catch {}
1985
1988
  };
1986
1989
  const onProcessExit = () => {
1987
1990
  processExited = true;
@@ -1991,12 +1994,15 @@ async function runWorkspaceCommand(args) {
1991
1994
  proc.once("exit", onProcessExit);
1992
1995
  proc.once("error", onProcessExit);
1993
1996
  const terminate = (reason) => {
1994
- if (processExited || terminationReason) return;
1997
+ if (processExited || terminationReason)
1998
+ return;
1995
1999
  terminationReason = reason;
1996
- if (timeout) clearTimeout(timeout);
2000
+ if (timeout)
2001
+ clearTimeout(timeout);
1997
2002
  killChild("SIGTERM");
1998
2003
  forceKillTimer = setTimeout(() => {
1999
- if (!processExited) killChild("SIGKILL");
2004
+ if (!processExited)
2005
+ killChild("SIGKILL");
2000
2006
  }, 500);
2001
2007
  };
2002
2008
  let detachTimer;
@@ -2023,10 +2029,11 @@ async function runWorkspaceCommand(args) {
2023
2029
  exitPromise,
2024
2030
  new Promise((resolveTimeout) => {
2025
2031
  timeout = setTimeout(() => {
2026
- if (processExited) return;
2027
- const aborted2 = args.abortSignal?.aborted === true;
2028
- terminate(aborted2 ? "abort" : "timeout");
2029
- resolveTimeout(aborted2 ? abortResult : timeoutResult);
2032
+ if (processExited)
2033
+ return;
2034
+ const aborted = args.abortSignal?.aborted === true;
2035
+ terminate(aborted ? "abort" : "timeout");
2036
+ resolveTimeout(aborted ? abortResult : timeoutResult);
2030
2037
  }, Math.max(0, timeoutMs - (Date.now() - spawnedAt)));
2031
2038
  })
2032
2039
  ]) : exitPromise;
@@ -2042,19 +2049,21 @@ async function runWorkspaceCommand(args) {
2042
2049
  raceWinner = await Promise.race(raceCandidates);
2043
2050
  } catch (error) {
2044
2051
  cleanupTerminationTimers();
2045
- if (detachTimer) clearTimeout(detachTimer);
2052
+ if (detachTimer)
2053
+ clearTimeout(detachTimer);
2046
2054
  if (abortListener && args.abortSignal) {
2047
2055
  args.abortSignal.removeEventListener("abort", abortListener);
2048
2056
  }
2049
2057
  if (typeof proc.pid === "number") {
2050
- registry2.remove(proc.pid);
2058
+ registry.remove(proc.pid);
2051
2059
  }
2052
2060
  if (isSpawnFailureError(error)) {
2053
2061
  return spawnFailedCommandResult(error, args.outputLimit);
2054
2062
  }
2055
2063
  throw error;
2056
2064
  }
2057
- if (detachTimer) clearTimeout(detachTimer);
2065
+ if (detachTimer)
2066
+ clearTimeout(detachTimer);
2058
2067
  if (abortListener && args.abortSignal) {
2059
2068
  args.abortSignal.removeEventListener("abort", abortListener);
2060
2069
  }
@@ -2065,18 +2074,16 @@ async function runWorkspaceCommand(args) {
2065
2074
  terminate(aborted ? "abort" : "timeout");
2066
2075
  try {
2067
2076
  await exitPromise;
2068
- } catch {
2069
- } finally {
2077
+ } catch {} finally {
2070
2078
  cleanupTerminationTimers();
2071
2079
  }
2072
2080
  }
2073
2081
  if (detachedProcess) {
2074
- exitPromise.catch(() => {
2075
- });
2082
+ exitPromise.catch(() => {});
2076
2083
  const pid = typeof proc.pid === "number" ? proc.pid : 0;
2077
2084
  const pgid = pid;
2078
- const promoted = registry2.promote(pid);
2079
- const envelope = promoted ?? registry2.add({
2085
+ const promoted = registry.promote(pid);
2086
+ const envelope = promoted ?? registry.add({
2080
2087
  pid,
2081
2088
  pgid,
2082
2089
  command: args.command.join(" "),
@@ -2085,39 +2092,35 @@ async function runWorkspaceCommand(args) {
2085
2092
  owner: args.owner ?? null
2086
2093
  });
2087
2094
  const taskId = envelope.taskId;
2088
- void exitPromise.then(() => {
2095
+ exitPromise.then(() => {
2089
2096
  detachSignalCleanup();
2090
- const exitCode2 = terminationReason === "abort" ? 130 : terminationReason === "timeout" ? 124 : proc.exitCode ?? 1;
2091
- void (async () => {
2097
+ const exitCode = terminationReason === "abort" ? 130 : terminationReason === "timeout" ? 124 : proc.exitCode ?? 1;
2098
+ (async () => {
2092
2099
  const [stdoutResult, stderrResult] = await Promise.all([
2093
2100
  stdoutCapture,
2094
2101
  stderrCapture
2095
2102
  ]);
2096
- const stdout2 = stdoutResult.value;
2097
- const stderr2 = stderrResult.value;
2103
+ const stdout = stdoutResult.value;
2104
+ const stderr = stderrResult.value;
2098
2105
  let capsule;
2099
- const terminalStderr = terminationReason === "abort" ? `${stderr2.trim() ? `${stderr2.trim()}
2106
+ const terminalStderr = terminationReason === "abort" ? `${stderr.trim() ? `${stderr.trim()}
2100
2107
  ` : ""}command aborted by signal
2101
- ` : terminationReason === "timeout" ? `${stderr2.trim() ? `${stderr2.trim()}
2108
+ ` : terminationReason === "timeout" ? `${stderr.trim() ? `${stderr.trim()}
2102
2109
  ` : ""}command timed out after ${timeoutMs}ms
2103
- ` : stderr2;
2110
+ ` : stderr;
2104
2111
  try {
2105
2112
  capsule = buildProcessTaskResultCapsule({
2106
- stdout: stdout2,
2113
+ stdout,
2107
2114
  stderr: terminalStderr,
2108
- exitCode: exitCode2,
2109
- // Duration is measured from the registry envelope's startedAt
2110
- // (spawn moment), not from the detach moment.
2111
- startedAt: registry2.get(pid)?.startedAt,
2115
+ exitCode,
2116
+ startedAt: registry.get(pid)?.startedAt,
2112
2117
  workspaceRoot: args.workspaceRoot,
2113
2118
  captureError: [stdoutResult.error, stderrResult.error].filter(Boolean).join("; ")
2114
2119
  });
2115
- } catch {
2116
- }
2117
- registry2.markExited(pid, exitCode2, capsule);
2120
+ } catch {}
2121
+ registry.markExited(pid, exitCode, capsule);
2118
2122
  })();
2119
- }, () => {
2120
- });
2123
+ }, () => {});
2121
2124
  const immediate = effectiveDetachMs === 0;
2122
2125
  const reason = immediate ? `command looks long-running; moved to background immediately (pid=${pid}, label=${label})` : `command detached to background after ${effectiveDetachMs}ms (pid=${pid}, label=${label})`;
2123
2126
  return {
@@ -2137,10 +2140,7 @@ Use listProcesses to inspect or stop it.`,
2137
2140
  taskId,
2138
2141
  status: "running",
2139
2142
  ...immediate ? { reason: "long-running-command" } : {},
2140
- // 近场行动约束:这条回执正好出现在模型决定「继续还是收尾」的位置。
2141
- // 同类规则在静态提示词里已重复 5 处(并行块/工具描述/工具指引/回复准则),
2142
- // 但都沉在数万 token 之前,容易被「回执已收到、先汇报」的局部惯性盖过。
2143
- turnAction: "This task is tracked. Do NOT end this turn to wait if any other independent authorized work remains \u2014 invoke tools for it now. End the turn only when no independent work is left."
2143
+ turnAction: "This task is tracked. Do NOT end this turn to wait if any other independent authorized work remains — invoke tools for it now. End the turn only when no independent work is left."
2144
2144
  })
2145
2145
  };
2146
2146
  }
@@ -2155,7 +2155,7 @@ Use listProcesses to inspect or stop it.`,
2155
2155
  ` : stderrCaptureResult.value;
2156
2156
  const exitCode = aborted ? 130 : timedOut ? 124 : Number(raceWinner);
2157
2157
  if (typeof proc.pid === "number") {
2158
- registry2.completeTransient(proc.pid, exitCode);
2158
+ registry.completeTransient(proc.pid, exitCode);
2159
2159
  }
2160
2160
  const stderr = aborted ? `${rawStderr.trim() ? `${rawStderr.trim()}
2161
2161
  ` : ""}command aborted by signal
@@ -2168,51 +2168,19 @@ Use listProcesses to inspect or stop it.`,
2168
2168
  exitCode,
2169
2169
  timedOut,
2170
2170
  aborted,
2171
- content: truncateToolOutput(
2172
- [
2173
- stdout.trim() ? `stdout:
2171
+ content: truncateToolOutput([
2172
+ stdout.trim() ? `stdout:
2174
2173
  ${stdout.trim()}` : "",
2175
- stderr.trim() ? `stderr:
2174
+ stderr.trim() ? `stderr:
2176
2175
  ${stderr.trim()}` : "",
2177
- `exitCode: ${exitCode}`
2178
- ].filter(Boolean).join("\n\n"),
2179
- args.outputLimit,
2180
- {
2181
- toolName: "execShell",
2182
- workspaceRoot: args.workspaceRoot
2183
- }
2184
- )
2176
+ `exitCode: ${exitCode}`
2177
+ ].filter(Boolean).join(`
2178
+
2179
+ `), args.outputLimit, {
2180
+ toolName: "execShell",
2181
+ workspaceRoot: args.workspaceRoot
2182
+ })
2185
2183
  };
2186
2184
  }
2187
2185
 
2188
- export {
2189
- resolveExecutableOnPath,
2190
- createGlob,
2191
- spawnToWebStreams,
2192
- isProcessTaskTerminalStatus,
2193
- reportedTaskStatus,
2194
- toProcessTaskView,
2195
- getProcessRegistry,
2196
- countLines,
2197
- spillToolOutput,
2198
- formatToolOverflowMarker,
2199
- TOOL_OUTPUT_SPILL_BYTES,
2200
- TOOL_OUTPUT_SPILL_LINES,
2201
- isSpilledToolOutput,
2202
- spillLargeToolOutput,
2203
- buildProcessTaskResultCapsule,
2204
- withShellChildEnvironment,
2205
- workspaceChildEnv,
2206
- extractActivity,
2207
- findPowerShellExecutable,
2208
- buildWorkspaceShellPlan,
2209
- buildWorkspaceShellCommand,
2210
- findWorkspaceShellEscapeToken,
2211
- buildWorkspaceShellEscapeBlockedResult,
2212
- extractInteractiveGhAuthCommand,
2213
- buildInteractiveCommandBlockedResult,
2214
- resolveExecShellTimeoutMs,
2215
- truncateToolOutput,
2216
- deriveLabel,
2217
- runWorkspaceCommand
2218
- };
2186
+ export { resolveExecutableOnPath, createGlob, spawnToWebStreams, isProcessTaskTerminalStatus, reportedTaskStatus, toProcessTaskView, getProcessRegistry, countLines, spillToolOutput, formatToolOverflowMarker, TOOL_OUTPUT_SPILL_BYTES, TOOL_OUTPUT_SPILL_LINES, isSpilledToolOutput, spillLargeToolOutput, buildProcessTaskResultCapsule, withShellChildEnvironment, workspaceChildEnv, extractActivity, findPowerShellExecutable, buildWorkspaceShellPlan, buildWorkspaceShellCommand, findWorkspaceShellEscapeToken, buildWorkspaceShellEscapeBlockedResult, extractInteractiveGhAuthCommand, buildInteractiveCommandBlockedResult, resolveExecShellTimeoutMs, truncateToolOutput, deriveLabel, runWorkspaceCommand };