nolo-cli 0.264.0-alpha.2 → 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 (538) 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-HXEO5DNV.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-LYPJYBE5.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-U7OULUMF.js → chunk-53v9g0np.js} +49 -64
  46. package/chunk-572mg6q5.js +19 -0
  47. package/{chunk-QAW6BEWQ.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-NEZRAW5K.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-4UNN45DS.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-XOSLNRT3.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-ENNFT77C.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-EODBQPRM.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-QAU6KM2U.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-PDSXYHNI.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-EBH4RFJ6.js → chunk-dh69vqbd.js} +6390 -6496
  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-MALPQFGT.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-LTQ6ECCF.js → chunk-g35f20d1.js} +450 -414
  154. package/{chunk-3L2WKC3W.js → chunk-g5fhtjqg.js} +13 -16
  155. package/{chunk-DBEOW57U.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-7422ZLGL.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-T3MWVUBE.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-2SFASHDS.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-ZH5FGDMI.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-ZCMAKAZM.js → chunk-pkhqb0fs.js} +118 -59
  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-KOUWITHH.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-FHGUFT2X.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-OKPOQGQJ.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-COJD2KPZ.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-RVB5OG2X.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-YQNZNR2Y.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-S5FVPYKT.js +0 -523
  339. package/agentEmailCommands-ZEFMGVKM.js +0 -742
  340. package/agentRecordCommands-JZ35AC5A.js +0 -211
  341. package/agentRun-UIO43TUG.js +0 -251
  342. package/agentRunCommand-ATLKKD6O.js +0 -249
  343. package/agentRunControl-U2MV74WR.js +0 -211
  344. package/agentRuntimeLocal-P4MMGIR6.js +0 -189
  345. package/agentSlice-HHNKNNYM.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-4RUQ2PFX.js +0 -432
  369. package/chunk-4SN6J65J.js +0 -38
  370. package/chunk-5MMAK75Q.js +0 -15
  371. package/chunk-6NYQHXMV.js +0 -1737
  372. package/chunk-6R4IY46J.js +0 -14
  373. package/chunk-7E6YXSFZ.js +0 -441
  374. package/chunk-7K4J76JQ.js +0 -917
  375. package/chunk-7LR2IFUH.js +0 -100
  376. package/chunk-AETZ7AD6.js +0 -274
  377. package/chunk-ATNTHIZI.js +0 -13
  378. package/chunk-BPB3T5EU.js +0 -791
  379. package/chunk-BV3FLP2L.js +0 -133
  380. package/chunk-BVYHE6QD.js +0 -110
  381. package/chunk-BWJLEN6X.js +0 -1388
  382. package/chunk-CHOZJMJS.js +0 -78
  383. package/chunk-D2LTQAGN.js +0 -464
  384. package/chunk-DALXH7BG.js +0 -3392
  385. package/chunk-DBCWXGOC.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-G22P2J7O.js +0 -1775
  395. package/chunk-HEVRQGGH.js +0 -106
  396. package/chunk-HHXF57CL.js +0 -180
  397. package/chunk-HI5RS2O4.js +0 -2109
  398. package/chunk-HJTI7RZV.js +0 -94
  399. package/chunk-HRWRIPTB.js +0 -531
  400. package/chunk-HYCVEESH.js +0 -2824
  401. package/chunk-I42VC5KR.js +0 -15
  402. package/chunk-IB5AR52X.js +0 -15
  403. package/chunk-IIRJ4P4I.js +0 -24
  404. package/chunk-IT3ZZRJE.js +0 -12
  405. package/chunk-IV6VUVLJ.js +0 -88
  406. package/chunk-J42X32PV.js +0 -472
  407. package/chunk-JDMWYVUF.js +0 -449
  408. package/chunk-JKVOKKMQ.js +0 -53
  409. package/chunk-JRTNUU5Z.js +0 -54
  410. package/chunk-K7HLFORE.js +0 -226
  411. package/chunk-KGBASAB5.js +0 -74
  412. package/chunk-KGKTN2NX.js +0 -25
  413. package/chunk-KX6YBIHG.js +0 -8
  414. package/chunk-KYHNSSL2.js +0 -62
  415. package/chunk-KZO2MTVM.js +0 -140
  416. package/chunk-LKZPX6YH.js +0 -0
  417. package/chunk-LLP2NDED.js +0 -201
  418. package/chunk-LOFRSJX2.js +0 -47
  419. package/chunk-M75RM77T.js +0 -3970
  420. package/chunk-MDAYRIP7.js +0 -1889
  421. package/chunk-MI6HRMCK.js +0 -25
  422. package/chunk-MTNQNLSE.js +0 -1029
  423. package/chunk-NH4PUEWK.js +0 -762
  424. package/chunk-NHLLXINQ.js +0 -8
  425. package/chunk-NTUNHTJV.js +0 -40
  426. package/chunk-OJKUU3LP.js +0 -67
  427. package/chunk-OQH3TAB7.js +0 -299
  428. package/chunk-P62DHV4F.js +0 -443
  429. package/chunk-PHIERFHT.js +0 -574
  430. package/chunk-PKDFU6MY.js +0 -102
  431. package/chunk-PL5RKESU.js +0 -40
  432. package/chunk-PSJJBBWV.js +0 -42
  433. package/chunk-QKM55LP2.js +0 -739
  434. package/chunk-QQ56R7KS.js +0 -88
  435. package/chunk-QYPE3TS3.js +0 -43
  436. package/chunk-REAE2SZK.js +0 -62
  437. package/chunk-RGQ4UUWZ.js +0 -208
  438. package/chunk-RIRFHJTW.js +0 -353
  439. package/chunk-RYMLMTPZ.js +0 -547
  440. package/chunk-SSGTV4FC.js +0 -303
  441. package/chunk-SVKWZ3EG.js +0 -607
  442. package/chunk-T7KODHYS.js +0 -317
  443. package/chunk-TGVVE5BA.js +0 -3085
  444. package/chunk-TKLBBR7P.js +0 -779
  445. package/chunk-TZXPT53C.js +0 -8
  446. package/chunk-U67V476Y.js +0 -35
  447. package/chunk-UEILX4EV.js +0 -15
  448. package/chunk-VIWDGTDA.js +0 -8
  449. package/chunk-VXUQWCEZ.js +0 -138
  450. package/chunk-W5GKF5ZW.js +0 -32
  451. package/chunk-WDWZPASX.js +0 -29
  452. package/chunk-WX266G2C.js +0 -9594
  453. package/chunk-YCITCYSJ.js +0 -356
  454. package/chunk-Z3KTXWWB.js +0 -76
  455. package/chunk-ZC3CMUKU.js +0 -322
  456. package/chunk-ZSZBHRLP.js +0 -1710
  457. package/chunk-ZV7ZY46L.js +0 -1343
  458. package/cliAgentConfigHelpers-WB2S7PDO.js +0 -47
  459. package/cliAuthorityBrokerClient-3SKOA7OZ.js +0 -23
  460. package/cliAuthorityBrokerProcess-BMBVXPKU.js +0 -24
  461. package/cliAuthorityStoreDriver-6FE3BJNB.js +0 -20
  462. package/cliEnvHelpers-7V5ZWUJA.js +0 -34
  463. package/cliExecutor-N3445G2Z.js +0 -45
  464. package/cliLocalAgentRecordReader-QKKRK53P.js +0 -113
  465. package/cloudAutomationCommands-S52NKCLL.js +0 -310
  466. package/contentThunks-ERA42OXW.js +0 -100
  467. package/cooldownCommands-ZFDAL4MR.js +0 -79
  468. package/createAgentAutomationAction-DMD2VDPI.js +0 -173
  469. package/createDialogAction-3SPOJQAK.js +0 -87
  470. package/createPageAction-AVXUMZVT.js +0 -91
  471. package/cursorProvider-2RACMEMF.js +0 -6123
  472. package/db-LTHLW7QA.js +0 -178
  473. package/dbSlice-WNUHTF4C.js +0 -76
  474. package/deleteDbKey-KV6MYBAI.js +0 -87
  475. package/desktopFolderProjects-4POAMVJN.js +0 -45
  476. package/dialogCommands-4MOLJW4G.js +0 -165
  477. package/dialogMessageRecord-2HJTEXQX.js +0 -7
  478. package/dialogNotifyCommand-YL2GFKLO.js +0 -45
  479. package/dialogSlice-Q7H2YVNO.js +0 -200
  480. package/dialogUsageCommand-IO2BQKL2.js +0 -31
  481. package/docCreateCommands-OYLRBK2M.js +0 -255
  482. package/docDeleteCommands-3NF6QPJU.js +0 -226
  483. package/docReadCommands-CBAERJAP.js +0 -184
  484. package/docStore-GWPFDV6Y.js +0 -89
  485. package/docUpdateCommands-BAMCGX6F.js +0 -326
  486. package/ebookDownloaderAgentCommand-NOIZ6U7Y.js +0 -675
  487. package/fetchMessages-P7FSCSXV.js +0 -19
  488. package/getPricing-KNXVEIUI.js +0 -40
  489. package/hostCredentialCreate-2VEYBXJV.js +0 -402
  490. package/i18n-SAK6DDY4.js +0 -51
  491. package/keys-FXEGMKSG.js +0 -183
  492. package/legacyMigration-TF4SYJCZ.js +0 -19
  493. package/levelAuthorityStore-L5SVDM5O.js +0 -10
  494. package/localAutomationCommands-XSK7SM7I.js +0 -199
  495. package/localAutomationRuntime-5WBO7HGQ.js +0 -61
  496. package/localRecall-BDYKXB46.js +0 -17
  497. package/localRuntimeAdapter-Y6H6XRIH.js +0 -310
  498. package/localRuntimeAuthority-Q5C2KWGF.js +0 -45
  499. package/localRuntimeDb-MM3DINZM.js +0 -12
  500. package/machineInfo-HNPJHQFU.js +0 -14
  501. package/machineWsRunDispatch-Y5SJGCEE.js +0 -228
  502. package/models-TOXYINNM.js +0 -10
  503. package/oauthTokenStore-RUYNYALS.js +0 -24
  504. package/overlay-JA3SPVUS.js +0 -15
  505. package/parityCommands-5OCBPVES.js +0 -613
  506. package/processSpawn-6GEO77KV.js +0 -11
  507. package/profileConfig-KOWK4HOG.js +0 -49
  508. package/projectArchive-WE3VVPZ2.js +0 -132
  509. package/providerPresetApply-YCVSP2WX.js +0 -235
  510. package/providerRegistry-26PAUYH2.js +0 -24
  511. package/read-D4WYJQJQ.js +0 -32
  512. package/readDocTool-3S3OQFOH.js +0 -22
  513. package/rememberExplicit-ZPI6KK5M.js +0 -16
  514. package/remove-AHRMUDMH.js +0 -32
  515. package/removeDialogAgentAction-AALRBFSA.js +0 -81
  516. package/secretCommands-2PSS3QNZ.js +0 -24
  517. package/setDialogExtraReferencesAction-SLHQ3GYL.js +0 -39
  518. package/setPrimaryDialogAgentAction-XKCSGJ7M.js +0 -96
  519. package/skillDiscovery-IUEZZG2B.js +0 -29
  520. package/skillSummaryMarker-62UW7HI7.js +0 -9
  521. package/slateToRenderMarkdown-R3X74MCX.js +0 -7
  522. package/slateUtils-ESQAJ6RN.js +0 -19
  523. package/store-WSAVTR32.js +0 -50
  524. package/switchDialogAgentAction-YJIWQGIR.js +0 -70
  525. package/tombstones-FQQMEDOW.js +0 -32
  526. package/toolApiClient-FVXTIIEN.js +0 -42
  527. package/tools-WN4AVSNS.js +0 -147
  528. package/tuiRestart-LU2BDLAW.js +0 -50
  529. package/tuiSummaryLlmCaller-Z2ZVBIGN.js +0 -53
  530. package/updateCommands-4QP7WJLA.js +0 -63
  531. package/usageCommand-AZX7D3LB.js +0 -31
  532. package/usageRebuildCommand-XV5QQCHK.js +0 -623
  533. package/userDataMerge-HT2ZVHBJ.js +0 -13
  534. package/windowsSelfUpdate-5OFKSW6Y.js +0 -14
  535. package/workContext-ZAW6VXT7.js +0 -18
  536. package/workContextAccess-VU5I4LKZ.js +0 -11
  537. package/workContextWriteNotice-YCSSMHN4.js +0 -7
  538. /package/{chunk-BYXBJQAS.js → chunk-0bcc25vg.js} +0 -0
@@ -1,148 +1,540 @@
1
1
  import {
2
- MACHINE_SHELL_LOCAL_REFUSAL_MESSAGE,
2
+ parseSkillDocProtocol,
3
+ parseExternalSkillMarkdown
4
+ } from "./chunk-v39fea91.js";
5
+ import {
6
+ RuntimeProtocolMismatchError,
7
+ validateAgentRunProtocol,
8
+ RuntimeVersionMismatchError,
9
+ resolveAuthToken3
10
+ } from "./chunk-cfh6tfc3.js";
11
+ import {
12
+ exitCliFromWatchdog
13
+ } from "./chunk-ndej7jc9.js";
14
+ import {
15
+ isQuotaExhaustedError2
16
+ } from "./chunk-b00vzjkb.js";
17
+ import {
18
+ unknownLocalRunAcceptance,
19
+ inspectLocalRunWorkspace,
20
+ shouldPrintLocalRunSummary,
21
+ formatLocalRunSummary,
22
+ captureLocalRunBase,
3
23
  attachLocalCommandObservations,
4
24
  buildModelLayerOverride,
5
- captureLocalRunBase,
6
- formatLocalRunSummary,
7
- inspectLocalRunWorkspace,
8
25
  resolveCliMemory,
9
26
  resolveCliWorkContext,
10
- runAgentTurn,
11
- shouldPrintLocalRunSummary,
12
- unknownLocalRunAcceptance
13
- } from "./chunk-4UNN45DS.js";
27
+ MACHINE_SHELL_LOCAL_REFUSAL_MESSAGE2,
28
+ runAgentTurn2
29
+ } from "./chunk-6t7a7zck.js";
14
30
  import {
15
- getReadableCliDb
16
- } from "./chunk-LRLLWD4P.js";
31
+ createMcpApprovalChild,
32
+ createShellApprovalChild,
33
+ getRunResultHeaderMeta,
34
+ isHistoryIntegrityFailure,
35
+ resolveRunsDir2,
36
+ resolveRunQueuePath2,
37
+ popSingleQueueMessage2,
38
+ reportRunProcessIdentity2,
39
+ createRunActivityTracker2,
40
+ readRunRecord2,
41
+ awaitLocalWriterChild2,
42
+ registerLocalForegroundWriter2,
43
+ recordRunStartup2,
44
+ spawnLocalBackgroundRun2,
45
+ transitionRunToTerminal2,
46
+ settleRunTerminalAuthoritatively2
47
+ } from "./chunk-r7sfwdka.js";
17
48
  import {
18
- INSTABOX_RUN_CONFIG_ENV,
19
- buildLocalRunEnv,
20
- hashInstaboxDeliveryManifest,
21
- isFullstackCodingAgentRef,
22
- isInstaboxBillingPolicy,
49
+ workspaceChildEnv
50
+ } from "./chunk-q94zx4d0.js";
51
+ import {
52
+ resolveBoundMachineId,
23
53
  normalizeCliRunImages,
24
- parseAgentRunArgs,
25
54
  readFlagValue,
26
- resolveBoundMachineId,
55
+ isFullstackCodingAgentRef,
27
56
  resolveRawAgentInput,
28
- resolveServerUrl,
57
+ resolveServerUrl2,
58
+ buildLocalRunEnv,
59
+ writeUsage,
60
+ parseAgentRunArgs,
61
+ hashInstaboxDeliveryManifest,
29
62
  validateInstaboxWorkspaceSelection,
30
- writeUsage
31
- } from "./chunk-QAW6BEWQ.js";
63
+ INSTABOX_RUN_CONFIG_ENV,
64
+ isInstaboxBillingPolicy
65
+ } from "./chunk-57eyhmwr.js";
32
66
  import {
33
- CliProviderQuotaError
34
- } from "./chunk-DALXH7BG.js";
67
+ readCacheReadInputTokensOrNull
68
+ } from "./chunk-vqgtw1px.js";
35
69
  import {
36
- parsePositiveFiniteNumberOrFallback
37
- } from "./chunk-Y5GCAMGP.js";
70
+ t2
71
+ } from "./chunk-kn4dgg4j.js";
38
72
  import {
73
+ renderTurnContextBlocksWithScope,
74
+ partitionScopedBlocks,
75
+ buildMemoryOverlayLayer,
76
+ buildMemoryUseGuidanceLayer,
77
+ readAgentsMdLayerFromDisk,
39
78
  readDbRecord,
40
79
  resolveAgentRecordFromHybridStore
41
- } from "./chunk-7K4J76JQ.js";
80
+ } from "./chunk-cy7thb6n.js";
42
81
  import {
43
- awaitLocalWriterChild,
44
- createMcpApprovalChild,
45
- createRunActivityTracker,
46
- createShellApprovalChild,
47
- getRunResultHeaderMeta,
48
- isHistoryIntegrityFailure,
49
- popSingleQueueMessage,
50
- readRunRecord,
51
- recordRunStartup,
52
- registerLocalForegroundWriter,
53
- reportRunProcessIdentity,
54
- resolveRunQueuePath,
55
- resolveRunsDir,
56
- settleRunTerminalAuthoritatively,
57
- spawnLocalBackgroundRun,
58
- transitionRunToTerminal
59
- } from "./chunk-I5BYFTYK.js";
60
- import {
61
- buildSkillDiscoveryContextLayer
62
- } from "./chunk-WIVVNJUS.js";
63
- import {
64
- readAgentsMdLayerFromDisk
65
- } from "./chunk-2R6M34JP.js";
66
- import {
67
- readCacheReadInputTokensOrNull
68
- } from "./chunk-ZCLSM5AK.js";
82
+ BUILTIN_NOLO_AGENT_KEY3
83
+ } from "./chunk-6q1b7381.js";
69
84
  import {
70
85
  normalizeRuntimeToolPolicyOverride,
71
86
  resolveEffectiveRuntimeToolPolicy
72
- } from "./chunk-SSGTV4FC.js";
87
+ } from "./chunk-2ygg7azv.js";
73
88
  import {
74
- workspaceChildEnv
75
- } from "./chunk-2QAZCYOM.js";
76
- import {
77
- isQuotaExhaustedError
78
- } from "./chunk-EWQ3HGNZ.js";
79
- import {
80
- parseExternalSkillMarkdown,
81
- parseSkillDocProtocol
82
- } from "./chunk-AETZ7AD6.js";
89
+ isSubtaskRun
90
+ } from "./chunk-fs3bvh2p.js";
83
91
  import {
84
92
  isLocalCliAgentKey
85
- } from "./chunk-BR3GT6MR.js";
93
+ } from "./chunk-bge0cagn.js";
86
94
  import {
87
- isSubtaskRun
88
- } from "./chunk-TSBJVMNW.js";
95
+ CliProviderQuotaError2
96
+ } from "./chunk-tvh8azgq.js";
89
97
  import {
90
- BUILTIN_NOLO_AGENT_KEY
91
- } from "./chunk-4DBTBNTX.js";
98
+ buildSkillDiscoveryContextLayer2
99
+ } from "./chunk-ch4ck1yz.js";
92
100
  import {
93
- buildMemoryOverlayLayer,
94
- buildMemoryUseGuidanceLayer,
95
- partitionScopedBlocks,
96
- renderTurnContextBlocksWithScope
97
- } from "./chunk-FBNVJ2TO.js";
101
+ parsePositiveFiniteNumberOrFallback
102
+ } from "./chunk-2g6zsfq8.js";
98
103
  import {
99
- exitCliFromWatchdog
100
- } from "./chunk-E36V7MPY.js";
104
+ getReadableCliDb
105
+ } from "./chunk-htf69s94.js";
101
106
  import {
102
107
  toErrorMessage
103
- } from "./chunk-HNMXYYJR.js";
104
- import {
105
- RuntimeProtocolMismatchError,
106
- RuntimeVersionMismatchError,
107
- resolveAuthToken,
108
- validateAgentRunProtocol
109
- } from "./chunk-2AJLG6PY.js";
108
+ } from "./chunk-jec44fkj.js";
110
109
  import {
111
110
  asOptionalTrimmedString
112
- } from "./chunk-G3SUCT4W.js";
113
- import {
114
- t
115
- } from "./chunk-M75RM77T.js";
111
+ } from "./chunk-p1vg4bx8.js";
112
+
113
+ // packages/cli/client/terminalProgramStatus.ts
114
+ var TERMINAL_PROGRAM_STATUS_APP = "nolo";
115
+ var KNOWN_STATES = new Set([
116
+ "idle",
117
+ "working",
118
+ "blocked",
119
+ "done",
120
+ "error"
121
+ ]);
122
+ var KNOWN_KINDS = new Set([
123
+ "permission",
124
+ "question",
125
+ "auth"
126
+ ]);
127
+ function encodeTerminalProgramStatus(report) {
128
+ const state = report?.state;
129
+ if (typeof state !== "string" || !KNOWN_STATES.has(state))
130
+ return null;
131
+ const pairs = [`state=${state}`, `app=${TERMINAL_PROGRAM_STATUS_APP}`];
132
+ if (state === "blocked" && typeof report.kind === "string" && KNOWN_KINDS.has(report.kind)) {
133
+ pairs.push(`kind=${report.kind}`);
134
+ }
135
+ return `\x1B]7501;${pairs.join(":")}\x1B\\`;
136
+ }
137
+ function emitTerminalProgramStatus(output, report) {
138
+ if (!output || typeof output.write !== "function")
139
+ return false;
140
+ if (output.isTTY !== true)
141
+ return false;
142
+ const sequence = encodeTerminalProgramStatus(report);
143
+ if (sequence === null)
144
+ return false;
145
+ try {
146
+ output.write(sequence);
147
+ return true;
148
+ } catch {
149
+ return false;
150
+ }
151
+ }
152
+
153
+ // packages/cli/agentRunPrompts.ts
154
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
155
+ import { dirname, extname, isAbsolute, join, relative as relativePath, resolve, sep } from "node:path";
156
+ function workflowRefToCandidatePath(cwd, ref) {
157
+ const normalized = ref.trim();
158
+ if (!normalized)
159
+ return "";
160
+ if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
161
+ const directPath = resolve(cwd, normalized);
162
+ if (existsSync(directPath))
163
+ return directPath;
164
+ }
165
+ const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
166
+ return resolve(cwd, "docs", "workflows", `${fileName}.md`);
167
+ }
168
+ var SKILL_SEARCH_DIRS = [
169
+ ".agents/skills"
170
+ ];
171
+ function skillRefToCandidatePath(cwd, ref) {
172
+ const normalized = ref.trim();
173
+ if (!normalized)
174
+ return "";
175
+ if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
176
+ const directPath = resolve(cwd, normalized);
177
+ if (existsSync(directPath))
178
+ return directPath;
179
+ }
180
+ const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
181
+ for (const dir of SKILL_SEARCH_DIRS) {
182
+ const skillMdPath = resolve(cwd, dir, fileName, "SKILL.md");
183
+ if (existsSync(skillMdPath))
184
+ return skillMdPath;
185
+ }
186
+ return resolve(cwd, ".agents", "skills", fileName, "SKILL.md");
187
+ }
188
+ async function resolveWorkflowReference(ref, cwd = process.cwd()) {
189
+ const path = workflowRefToCandidatePath(cwd, ref);
190
+ if (!path || !existsSync(path)) {
191
+ throw new Error(`Workflow reference not found: ${ref}`);
192
+ }
193
+ const markdown = readFileSync(path, "utf8");
194
+ const parsed = parseSkillDocProtocol(markdown);
195
+ return {
196
+ ref,
197
+ content: parsed.content,
198
+ ...parsed.meta?.workflowConfig ? { config: parsed.meta.workflowConfig } : {}
199
+ };
200
+ }
201
+ function inlineRelativeRefs(body, skillDir) {
202
+ const refPattern = /\[([^\]]+)\]\((\.\/[^)]+|[^)]+\/[^)]+)\)/g;
203
+ const normalizedSkillDir = resolve(skillDir) + sep;
204
+ return body.replace(refPattern, (match, label, relPath) => {
205
+ const cleaned = relPath.trim();
206
+ if (!cleaned.startsWith("./") && !cleaned.startsWith("../"))
207
+ return match;
208
+ const absPath = resolve(skillDir, cleaned);
209
+ const relative = relativePath(normalizedSkillDir, absPath);
210
+ if (relative.startsWith("..") || isAbsolute(relative))
211
+ return match;
212
+ if (!existsSync(absPath) || !absPath.endsWith(".md"))
213
+ return match;
214
+ const refContent = readFileSync(absPath, "utf8");
215
+ return `
216
+
217
+ ### ${label}
218
+
219
+ ${refContent}
220
+
221
+ `;
222
+ });
223
+ }
224
+ function listSkillScripts(skillDir) {
225
+ const scriptsDir = join(skillDir, "scripts");
226
+ if (!existsSync(scriptsDir) || !statSync(scriptsDir).isDirectory())
227
+ return null;
228
+ const entries = readdirSync(scriptsDir).filter((e) => !e.startsWith("."));
229
+ if (entries.length === 0)
230
+ return null;
231
+ return [
232
+ "",
233
+ "--- Available scripts (use execShell/readFile to access) ---",
234
+ ...entries.map((e) => `- scripts/${e}`)
235
+ ].join(`
236
+ `);
237
+ }
238
+ async function resolveSkillReference(ref, options = {}) {
239
+ const isDbKey = /^(page|doc)-[0-9a-z]+-/i.test(ref);
240
+ let markdown = "";
241
+ let skillDir;
242
+ let filePath;
243
+ if (isDbKey) {
244
+ if (!options.readDbRecord) {
245
+ throw new Error("skill dbKey requires server access");
246
+ }
247
+ const record = await options.readDbRecord(ref);
248
+ const contentText = record?.content ?? record?.prompt ?? record?.text;
249
+ if (contentText === undefined || contentText === null || contentText === "") {
250
+ throw new Error(`Skill reference has no content: ${ref}`);
251
+ }
252
+ markdown = String(contentText);
253
+ } else {
254
+ const cwd = options.cwd ?? process.cwd();
255
+ const path = skillRefToCandidatePath(cwd, ref);
256
+ if (!path || !existsSync(path)) {
257
+ throw new Error(`Skill reference not found: ${ref}`);
258
+ }
259
+ markdown = readFileSync(path, "utf8");
260
+ filePath = path;
261
+ skillDir = dirname(path);
262
+ }
263
+ const parsed = parseSkillDocProtocol(markdown);
264
+ const name = parsed.meta?.skillConfig?.name;
265
+ const promptPatch = parsed.meta?.skillConfig?.promptPatch;
266
+ const externalParsed = parseExternalSkillMarkdown(markdown);
267
+ const allowedTools = externalParsed.allowedTools;
268
+ const effectiveName = name ?? externalParsed.name;
269
+ let effectiveContent = parsed.content;
270
+ if (skillDir) {
271
+ effectiveContent = inlineRelativeRefs(effectiveContent, skillDir);
272
+ const scriptsHint = listSkillScripts(skillDir);
273
+ if (scriptsHint)
274
+ effectiveContent += scriptsHint;
275
+ }
276
+ return {
277
+ ref,
278
+ content: effectiveContent,
279
+ ...effectiveName ? { name: effectiveName } : {},
280
+ ...promptPatch ? { promptPatch } : {},
281
+ ...allowedTools && allowedTools.length > 0 ? { allowedTools } : {},
282
+ ...skillDir ? { skillDir } : {}
283
+ };
284
+ }
285
+ function buildSkillContextBlocks(skills) {
286
+ if (!skills || !skills.length)
287
+ return [];
288
+ const seen = new Set;
289
+ const blocks = [];
290
+ for (const skill of skills) {
291
+ const dedupKey = skill.name ?? skill.ref;
292
+ if (seen.has(dedupKey))
293
+ continue;
294
+ seen.add(dedupKey);
295
+ const header = `## ${dedupKey}`;
296
+ const patch = skill.promptPatch ? `${skill.promptPatch}
297
+ ` : "";
298
+ blocks.push(`${header}
299
+ ${patch}${skill.content}`);
300
+ }
301
+ return blocks;
302
+ }
303
+ var OUTPUT_FORMAT_GUIDANCE = [
304
+ "Output format guidance:",
305
+ "- Use semantic Markdown by default.",
306
+ "- Use tables for genuinely multi-column structured data.",
307
+ "- Use $...$ or $$...$$ for mathematical expressions.",
308
+ "- Use ```mermaid fenced blocks for process flows, sequences, state transitions, class/entity relations and architecture — they render as diagrams; skip when a sentence or list explains it better.",
309
+ "- Use language-tagged fenced blocks for code.",
310
+ "- Do not add tables or Mermaid for decoration; when complex syntax is uncertain, prefer plain Markdown or text.",
311
+ ""
312
+ ].join(`
313
+ `);
314
+ function prependOutputFormatGuidance(message) {
315
+ if (message.startsWith(OUTPUT_FORMAT_GUIDANCE))
316
+ return message;
317
+ return `${OUTPUT_FORMAT_GUIDANCE}${message}`;
318
+ }
319
+ function prependWorkflowReferencePrompt(message, workflow) {
320
+ if (!workflow)
321
+ return message;
322
+ const config = workflow.config;
323
+ return [
324
+ "AI-native workflow reference:",
325
+ "- This reference is guidance for the agent, not a central workflow engine.",
326
+ `- ref: ${workflow.ref}`,
327
+ ...config?.id ? [`- id: ${config.id}`] : [],
328
+ ...config?.name ? [`- name: ${config.name}`] : [],
329
+ ...config?.defaultAgent ? [`- suggested defaultAgent: ${config.defaultAgent}`] : [],
330
+ ...config?.inputs?.length ? [`- inputs: ${config.inputs.join(", ")}`] : [],
331
+ ...config?.recommendedTools?.length ? [`- recommendedTools: ${config.recommendedTools.join(", ")}`] : [],
332
+ ...config?.requiredTools?.length ? [`- requiredTools: ${config.requiredTools.join(", ")}`] : [],
333
+ ...config?.requiredOutputs?.length ? [`- requiredOutputs: ${config.requiredOutputs.join(", ")}`] : [],
334
+ ...config?.gates?.length ? [`- gates: ${config.gates.join(", ")}`] : [],
335
+ ...config?.contextStrategy ? [`- contextStrategy: ${config.contextStrategy}`] : [],
336
+ ...config?.failureProtocol ? [`- failureProtocol: ${config.failureProtocol}`] : [],
337
+ "",
338
+ "Reference body:",
339
+ workflow.content,
340
+ "",
341
+ "User task:",
342
+ message
343
+ ].join(`
344
+ `);
345
+ }
346
+ function prependFeatureWorktreeInstruction(message, enabled) {
347
+ if (!enabled)
348
+ return message;
349
+ return [
350
+ "Local execution rule:",
351
+ "- You are running in the current git checkout with shell access.",
352
+ "- For read-only checks, smoke tests, or answering questions, stay in the current directory.",
353
+ "- Before developing a new feature or making non-trivial code changes, create a separate git worktree yourself with git worktree and do the edits there.",
354
+ "- Commit and push only when the user explicitly asks or the task requires it.",
355
+ "",
356
+ "User task:",
357
+ message
358
+ ].join(`
359
+ `);
360
+ }
361
+ function prependSubjectDialogMarker(message, subjectDialogKey) {
362
+ if (!subjectDialogKey)
363
+ return message;
364
+ return [
365
+ `Subject dialog for this run: ${subjectDialogKey}`,
366
+ "If the user asks to evaluate the referenced dialog, call readDialog with this id/key first.",
367
+ "",
368
+ message
369
+ ].join(`
370
+ `);
371
+ }
372
+ function normalizeCliImageInput(input) {
373
+ if (/^(https?:|data:|file:)/i.test(input))
374
+ return input;
375
+ const absolutePath = resolve(input);
376
+ if (!existsSync(absolutePath))
377
+ return input;
378
+ const base64 = readFileSync(absolutePath).toString("base64");
379
+ return `data:${imageMimeTypeForPath(absolutePath)};base64,${base64}`;
380
+ }
381
+ function imageMimeTypeForPath(path) {
382
+ switch (extname(path).toLowerCase()) {
383
+ case ".jpg":
384
+ case ".jpeg":
385
+ return "image/jpeg";
386
+ case ".webp":
387
+ return "image/webp";
388
+ case ".gif":
389
+ return "image/gif";
390
+ default:
391
+ return "image/png";
392
+ }
393
+ }
394
+
395
+ // packages/agent-runtime/hostEnvironment.ts
396
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
397
+ import os from "node:os";
398
+ function parseLinuxOsRelease(content) {
399
+ let prettyName;
400
+ let name;
401
+ let version;
402
+ for (const line of content.split(`
403
+ `)) {
404
+ const trimmed = line.trim();
405
+ if (!trimmed || trimmed.startsWith("#"))
406
+ continue;
407
+ const eqIdx = trimmed.indexOf("=");
408
+ if (eqIdx === -1)
409
+ continue;
410
+ const key = trimmed.slice(0, eqIdx).trim();
411
+ let val = trimmed.slice(eqIdx + 1).trim();
412
+ if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
413
+ val = val.slice(1, -1);
414
+ }
415
+ if (key === "PRETTY_NAME") {
416
+ prettyName = val;
417
+ } else if (key === "NAME") {
418
+ name = val;
419
+ } else if (key === "VERSION") {
420
+ version = val;
421
+ }
422
+ }
423
+ if (prettyName)
424
+ return prettyName;
425
+ if (name && version)
426
+ return `${name} ${version}`;
427
+ return name;
428
+ }
429
+ function probeHostEnvironment(options) {
430
+ const platform = options?.platform ?? process.platform;
431
+ const arch = options?.arch ?? os.arch();
432
+ const release = options?.release ?? os.release();
433
+ const env = options?.env ?? process.env;
434
+ let osName = `${platform} ${release}`;
435
+ if (platform === "linux") {
436
+ let osReleaseText = options?.osReleaseContent;
437
+ if (osReleaseText === undefined) {
438
+ try {
439
+ if (existsSync2("/etc/os-release")) {
440
+ osReleaseText = readFileSync2("/etc/os-release", "utf8");
441
+ } else if (existsSync2("/usr/lib/os-release")) {
442
+ osReleaseText = readFileSync2("/usr/lib/os-release", "utf8");
443
+ }
444
+ } catch {}
445
+ }
446
+ if (osReleaseText) {
447
+ const parsed = parseLinuxOsRelease(osReleaseText);
448
+ if (parsed) {
449
+ osName = parsed;
450
+ } else {
451
+ osName = `Linux ${release}`;
452
+ }
453
+ } else {
454
+ osName = `Linux ${release}`;
455
+ }
456
+ } else if (platform === "darwin") {
457
+ osName = `macOS (${release})`;
458
+ } else if (platform === "win32") {
459
+ osName = `Windows (${release})`;
460
+ }
461
+ const desktop = env.XDG_CURRENT_DESKTOP || env.XDG_SESSION_DESKTOP || env.DESKTOP_SESSION || undefined;
462
+ const sessionType = env.XDG_SESSION_TYPE || undefined;
463
+ const shell = env.SHELL || (platform === "win32" ? env.COMSPEC || "PowerShell" : undefined);
464
+ return {
465
+ platform,
466
+ osName,
467
+ arch,
468
+ desktop,
469
+ sessionType,
470
+ shell
471
+ };
472
+ }
473
+ function formatHostEnvironmentContent(details) {
474
+ const lines = ["--- 宿主环境(Host Environment)---"];
475
+ lines.push(`操作系统: ${details.osName} (${details.arch})`);
476
+ if (details.desktop || details.sessionType) {
477
+ const desktopParts = [];
478
+ if (details.desktop)
479
+ desktopParts.push(details.desktop);
480
+ if (details.sessionType)
481
+ desktopParts.push(details.sessionType);
482
+ lines.push(`桌面环境: ${desktopParts.join(" / ")}`);
483
+ }
484
+ if (details.shell) {
485
+ lines.push(`默认 Shell: ${details.shell}`);
486
+ }
487
+ return lines.join(`
488
+ `);
489
+ }
490
+ var cachedLayer = null;
491
+ function buildHostEnvironmentLayer(options) {
492
+ if (!options && cachedLayer) {
493
+ return cachedLayer;
494
+ }
495
+ const details = probeHostEnvironment(options);
496
+ const content = formatHostEnvironmentContent(details);
497
+ const layer = {
498
+ id: "host-environment",
499
+ owner: "runtime",
500
+ cacheScope: "session",
501
+ content
502
+ };
503
+ if (!options) {
504
+ cachedLayer = layer;
505
+ }
506
+ return layer;
507
+ }
116
508
 
117
509
  // packages/cli/agentRunCommand.ts
118
510
  import { createHash } from "node:crypto";
119
511
 
120
512
  // packages/cli/client/instaboxRunConfigWrite.ts
121
513
  import { randomUUID } from "node:crypto";
122
- import { lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
123
- import { isAbsolute, join, normalize, resolve } from "node:path";
124
- var InstaboxRunConfigWriteError = class extends Error {
514
+ import { lstatSync, mkdirSync, readFileSync as readFileSync3, writeFileSync } from "node:fs";
515
+ import { isAbsolute as isAbsolute2, join as join2, normalize, resolve as resolve2 } from "node:path";
516
+ class InstaboxRunConfigWriteError extends Error {
125
517
  code;
126
518
  constructor(code, message) {
127
519
  super(`instabox_run_config_write:${code}: ${message}`);
128
520
  this.name = "InstaboxRunConfigWriteError";
129
521
  this.code = `instabox_run_config_write:${code}`;
130
522
  }
131
- };
523
+ }
132
524
  var fail = (code, msg) => {
133
525
  throw new InstaboxRunConfigWriteError(code, msg);
134
526
  };
135
527
  function writeInstaboxRunConfig(options) {
136
528
  const { workspaceMode, artifactDir, manifestPath, allowRemoteRelease } = options;
137
529
  if (workspaceMode !== "empty" && workspaceMode !== "snapshot") {
138
- fail("invalid_workspace_mode", 'workspaceMode \u5FC5\u987B\u662F "empty" \u6216 "snapshot"');
530
+ fail("invalid_workspace_mode", 'workspaceMode 必须是 "empty" 或 "snapshot"');
139
531
  }
140
532
  const trimmedArtifactDir = artifactDir?.trim();
141
533
  if (!trimmedArtifactDir) {
142
- fail("missing_artifact_dir", "artifactDir \u5FC5\u987B\u662F\u975E\u7A7A\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u672A\u914D\u7F6E\u6216\u9ED8\u8BA4\u5747\u88AB\u62D2\u7EDD");
534
+ fail("missing_artifact_dir", "artifactDir 必须是非空绝对路径,未配置或默认均被拒绝");
143
535
  }
144
- if (!isAbsolute(trimmedArtifactDir) || trimmedArtifactDir.includes("\0") || trimmedArtifactDir.split("/").includes("..")) {
145
- fail("invalid_artifact_dir", `artifactDir \u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u7EDD\u5BF9\u8DEF\u5F84\u4E14\u4E0D\u80FD\u5305\u542B .. \u6216\u7A7A\u5B57\u7B26: "${trimmedArtifactDir}"`);
536
+ if (!isAbsolute2(trimmedArtifactDir) || trimmedArtifactDir.includes("\x00") || trimmedArtifactDir.split("/").includes("..")) {
537
+ fail("invalid_artifact_dir", `artifactDir 必须为合法的绝对路径且不能包含 .. 或空字符: "${trimmedArtifactDir}"`);
146
538
  }
147
539
  const approvalId = `appr-${randomUUID()}`;
148
540
  const bindingId = `bind-${randomUUID()}`;
@@ -155,27 +547,21 @@ function writeInstaboxRunConfig(options) {
155
547
  if (workspaceMode === "snapshot") {
156
548
  const rawPath = manifestPath ? manifestPath.trim() : "";
157
549
  if (!rawPath) {
158
- fail("missing_manifest_path", 'workspaceMode \u4E3A "snapshot" \u65F6\u5FC5\u987B\u63D0\u4F9B manifest \u6587\u4EF6\u8DEF\u5F84');
550
+ fail("missing_manifest_path", 'workspaceMode 为 "snapshot" 时必须提供 manifest 文件路径');
159
551
  }
160
- const resolvedManifestPath = resolve(rawPath);
552
+ const resolvedManifestPath = resolve2(rawPath);
161
553
  let rawText = "";
162
554
  try {
163
- const reader = options.readTextFile ?? ((p) => readFileSync(p, "utf8"));
555
+ const reader = options.readTextFile ?? ((p) => readFileSync3(p, "utf8"));
164
556
  rawText = reader(resolvedManifestPath);
165
557
  } catch (err) {
166
- fail(
167
- "manifest_read_failed",
168
- `\u8BFB\u53D6 manifest \u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
169
- );
558
+ fail("manifest_read_failed", `读取 manifest 文件失败: ${err instanceof Error ? err.message : String(err)}`);
170
559
  }
171
560
  let parsedManifest;
172
561
  try {
173
562
  parsedManifest = JSON.parse(rawText);
174
563
  } catch (err) {
175
- fail(
176
- "invalid_manifest_json",
177
- `manifest \u6587\u4EF6 JSON \u89E3\u6790\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
178
- );
564
+ fail("invalid_manifest_json", `manifest 文件 JSON 解析失败: ${err instanceof Error ? err.message : String(err)}`);
179
565
  }
180
566
  try {
181
567
  manifestSha256 = hashInstaboxDeliveryManifest(parsedManifest);
@@ -188,27 +574,24 @@ function writeInstaboxRunConfig(options) {
188
574
  }
189
575
  });
190
576
  } catch (err) {
191
- fail(
192
- "invalid_manifest_selection",
193
- `manifest \u6821\u9A8C\u672A\u901A\u8FC7: ${err instanceof Error ? err.message : String(err)}`
194
- );
577
+ fail("invalid_manifest_selection", `manifest 校验未通过: ${err instanceof Error ? err.message : String(err)}`);
195
578
  }
196
579
  manifest = parsedManifest;
197
580
  allowedPaths = parsedManifest.files.map((f) => f.path);
198
581
  } else {
199
582
  if (manifestPath && manifestPath.trim()) {
200
- fail("unexpected_manifest", 'workspaceMode \u4E3A "empty" \u65F6\u4E0D\u5F97\u63D0\u4F9B manifest');
583
+ fail("unexpected_manifest", 'workspaceMode 为 "empty" 时不得提供 manifest');
201
584
  }
202
585
  }
203
586
  const rawBillingPolicy = options.billingPolicy ?? (options.allowPaid ? "allow-paid" : "free-only");
204
587
  if (!isInstaboxBillingPolicy(rawBillingPolicy)) {
205
- fail("invalid_billing_policy", `billingPolicy \u5FC5\u987B\u4E3A "free-only" \u6216 "allow-paid"\uFF0C\u6536\u5230 "${rawBillingPolicy}"`);
588
+ fail("invalid_billing_policy", `billingPolicy 必须为 "free-only" 或 "allow-paid",收到 "${rawBillingPolicy}"`);
206
589
  }
207
590
  const billingPolicy = rawBillingPolicy;
208
591
  const env = options.env ?? process.env;
209
592
  const isPaid = options.isPaidAccount === true || options.account?.isPaid === true || options.account?.kind === "paid" || options.account?.accountKind === "paid" || env?.INSTABOX_ACCOUNT_KIND === "paid" || env?.INSTABOX_ACCOUNT_TYPE === "paid" || env?.INSTABOX_PAID_ACCOUNT === "true" || env?.INSTABOX_PAID_ACCOUNT === "1";
210
593
  if (isPaid && billingPolicy !== "allow-paid") {
211
- fail("paid_account_disallowed", "\u4ED8\u8D39 Instabox \u8D26\u53F7\u9700\u663E\u5F0F --instabox-allow-paid");
594
+ fail("paid_account_disallowed", "付费 Instabox 账号需显式 --instabox-allow-paid");
212
595
  }
213
596
  const config = {
214
597
  bindingId,
@@ -226,31 +609,32 @@ function writeInstaboxRunConfig(options) {
226
609
  config.manifest = manifest;
227
610
  config.manifestSha256 = manifestSha256;
228
611
  }
229
- const runsDir = options.runsDir ?? resolveRunsDir(env);
230
- const normalizedRunsDir = normalize(resolve(runsDir));
612
+ const runsDir = options.runsDir ?? resolveRunsDir2(env);
613
+ const normalizedRunsDir = normalize(resolve2(runsDir));
231
614
  try {
232
615
  mkdirSync(normalizedRunsDir, { recursive: true, mode: 448 });
233
616
  } catch (err) {
234
- fail("mkdir_failed", `\u521B\u5EFA runs \u76EE\u5F55\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
617
+ fail("mkdir_failed", `创建 runs 目录失败: ${err instanceof Error ? err.message : String(err)}`);
235
618
  }
236
619
  const fileName = `instabox-run-${randomUUID()}.json`;
237
- const targetPath = join(normalizedRunsDir, fileName);
620
+ const targetPath = join2(normalizedRunsDir, fileName);
238
621
  try {
239
622
  writeFileSync(targetPath, JSON.stringify(config, null, 2), {
240
623
  flag: "wx",
241
624
  mode: 384
242
625
  });
243
626
  } catch (err) {
244
- fail("file_write_failed", `\u72EC\u5360\u521B\u5EFA\u53D7\u63A7\u914D\u7F6E\u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
627
+ fail("file_write_failed", `独占创建受控配置文件失败: ${err instanceof Error ? err.message : String(err)}`);
245
628
  }
246
629
  try {
247
630
  const stats = lstatSync(targetPath);
248
631
  if (stats.isSymbolicLink() || !stats.isFile()) {
249
- fail("symlink_rejected", `\u914D\u7F6E\u6587\u4EF6\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\u6216\u975E\u5E38\u89C4\u6587\u4EF6: ${targetPath}`);
632
+ fail("symlink_rejected", `配置文件不能是符号链接或非常规文件: ${targetPath}`);
250
633
  }
251
634
  } catch (err) {
252
- if (err instanceof InstaboxRunConfigWriteError) throw err;
253
- fail("file_stat_failed", `\u68C0\u9A8C\u914D\u7F6E\u6587\u4EF6\u72B6\u6001\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
635
+ if (err instanceof InstaboxRunConfigWriteError)
636
+ throw err;
637
+ fail("file_stat_failed", `检验配置文件状态失败: ${err instanceof Error ? err.message : String(err)}`);
254
638
  }
255
639
  process.env[INSTABOX_RUN_CONFIG_ENV] = targetPath;
256
640
  if (options.env) {
@@ -259,201 +643,64 @@ function writeInstaboxRunConfig(options) {
259
643
  return { configPath: targetPath, config };
260
644
  }
261
645
 
262
- // packages/cli/client/terminalProgramStatus.ts
263
- var TERMINAL_PROGRAM_STATUS_APP = "nolo";
264
- var KNOWN_STATES = /* @__PURE__ */ new Set([
265
- "idle",
266
- "working",
267
- "blocked",
268
- "done",
269
- "error"
270
- ]);
271
- var KNOWN_KINDS = /* @__PURE__ */ new Set([
272
- "permission",
273
- "question",
274
- "auth"
275
- ]);
276
- function encodeTerminalProgramStatus(report) {
277
- const state = report?.state;
278
- if (typeof state !== "string" || !KNOWN_STATES.has(state)) return null;
279
- const pairs = [`state=${state}`, `app=${TERMINAL_PROGRAM_STATUS_APP}`];
280
- if (state === "blocked" && typeof report.kind === "string" && KNOWN_KINDS.has(report.kind)) {
281
- pairs.push(`kind=${report.kind}`);
282
- }
283
- return `\x1B]7501;${pairs.join(":")}\x1B\\`;
284
- }
285
- function emitTerminalProgramStatus(output, report) {
286
- if (!output || typeof output.write !== "function") return false;
287
- if (output.isTTY !== true) return false;
288
- const sequence = encodeTerminalProgramStatus(report);
289
- if (sequence === null) return false;
290
- try {
291
- output.write(sequence);
292
- return true;
293
- } catch {
294
- return false;
295
- }
296
- }
297
-
298
646
  // packages/cli/client/terminalRunStatus.ts
299
- var FAILED_EMPTY_ASSISTANT_REASONS = /* @__PURE__ */ new Set([
647
+ var FAILED_EMPTY_ASSISTANT_REASONS = new Set([
300
648
  "length_truncated",
301
649
  "stream_truncated",
302
650
  "repetition_loop",
303
651
  "stagnant_tool_calls"
304
- ]);
305
- var isRunResultStalledOrTruncated = (result) => !result.emptyAssistantOutputUsable && FAILED_EMPTY_ASSISTANT_REASONS.has(result.emptyAssistantFallbackReason ?? "");
306
- function resolveTerminalProgramStatusState(input) {
307
- if (input.interrupted) return "idle";
308
- if (input.stalledOrTruncated || input.exitCode !== 0) return "error";
309
- return "done";
310
- }
311
-
312
- // packages/cli/client/oneShotTerminalStatus.ts
313
- function resolveOneShotTerminalState(result) {
314
- return resolveTerminalProgramStatusState({
315
- exitCode: result.exitCode,
316
- interrupted: result.streamInterrupted,
317
- stalledOrTruncated: result.stalledOrTruncated
318
- });
319
- }
320
- function createOneShotTerminalStatus(output) {
321
- let last;
322
- let terminal = false;
323
- const report = (state) => {
324
- if (!output || terminal || last === state) return;
325
- last = state;
326
- if (state === "done" || state === "error") terminal = true;
327
- emitTerminalProgramStatus(output, { state });
328
- };
329
- return {
330
- working: () => report("working"),
331
- settle: (result) => report(resolveOneShotTerminalState(result)),
332
- fail: () => report("error")
333
- };
334
- }
335
-
336
- // packages/cli/agentRunCommand.ts
337
- import * as nodeFs from "node:fs";
338
-
339
- // packages/cli/client/autoModelRouter.ts
340
- var CLI_AUTO_ROUTE_AGENT_KEY = BUILTIN_NOLO_AGENT_KEY;
341
-
342
- // packages/agent-runtime/hostEnvironment.ts
343
- import { existsSync, readFileSync as readFileSync2 } from "node:fs";
344
- import os from "node:os";
345
- function parseLinuxOsRelease(content) {
346
- let prettyName;
347
- let name;
348
- let version;
349
- for (const line of content.split("\n")) {
350
- const trimmed = line.trim();
351
- if (!trimmed || trimmed.startsWith("#")) continue;
352
- const eqIdx = trimmed.indexOf("=");
353
- if (eqIdx === -1) continue;
354
- const key = trimmed.slice(0, eqIdx).trim();
355
- let val = trimmed.slice(eqIdx + 1).trim();
356
- if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
357
- val = val.slice(1, -1);
358
- }
359
- if (key === "PRETTY_NAME") {
360
- prettyName = val;
361
- } else if (key === "NAME") {
362
- name = val;
363
- } else if (key === "VERSION") {
364
- version = val;
365
- }
366
- }
367
- if (prettyName) return prettyName;
368
- if (name && version) return `${name} ${version}`;
369
- return name;
370
- }
371
- function probeHostEnvironment(options) {
372
- const platform = options?.platform ?? process.platform;
373
- const arch = options?.arch ?? os.arch();
374
- const release = options?.release ?? os.release();
375
- const env = options?.env ?? process.env;
376
- let osName = `${platform} ${release}`;
377
- if (platform === "linux") {
378
- let osReleaseText = options?.osReleaseContent;
379
- if (osReleaseText === void 0) {
380
- try {
381
- if (existsSync("/etc/os-release")) {
382
- osReleaseText = readFileSync2("/etc/os-release", "utf8");
383
- } else if (existsSync("/usr/lib/os-release")) {
384
- osReleaseText = readFileSync2("/usr/lib/os-release", "utf8");
385
- }
386
- } catch {
387
- }
388
- }
389
- if (osReleaseText) {
390
- const parsed = parseLinuxOsRelease(osReleaseText);
391
- if (parsed) {
392
- osName = parsed;
393
- } else {
394
- osName = `Linux ${release}`;
395
- }
396
- } else {
397
- osName = `Linux ${release}`;
398
- }
399
- } else if (platform === "darwin") {
400
- osName = `macOS (${release})`;
401
- } else if (platform === "win32") {
402
- osName = `Windows (${release})`;
403
- }
404
- const desktop = env.XDG_CURRENT_DESKTOP || env.XDG_SESSION_DESKTOP || env.DESKTOP_SESSION || void 0;
405
- const sessionType = env.XDG_SESSION_TYPE || void 0;
406
- const shell = env.SHELL || (platform === "win32" ? env.COMSPEC || "PowerShell" : void 0);
407
- return {
408
- platform,
409
- osName,
410
- arch,
411
- desktop,
412
- sessionType,
413
- shell
414
- };
415
- }
416
- function formatHostEnvironmentContent(details) {
417
- const lines = ["--- \u5BBF\u4E3B\u73AF\u5883\uFF08Host Environment\uFF09---"];
418
- lines.push(`\u64CD\u4F5C\u7CFB\u7EDF: ${details.osName} (${details.arch})`);
419
- if (details.desktop || details.sessionType) {
420
- const desktopParts = [];
421
- if (details.desktop) desktopParts.push(details.desktop);
422
- if (details.sessionType) desktopParts.push(details.sessionType);
423
- lines.push(`\u684C\u9762\u73AF\u5883: ${desktopParts.join(" / ")}`);
424
- }
425
- if (details.shell) {
426
- lines.push(`\u9ED8\u8BA4 Shell: ${details.shell}`);
427
- }
428
- return lines.join("\n");
652
+ ]);
653
+ var isRunResultStalledOrTruncated = (result) => !result.emptyAssistantOutputUsable && FAILED_EMPTY_ASSISTANT_REASONS.has(result.emptyAssistantFallbackReason ?? "");
654
+ function resolveTerminalProgramStatusState(input) {
655
+ if (input.interrupted)
656
+ return "idle";
657
+ if (input.stalledOrTruncated || input.exitCode !== 0)
658
+ return "error";
659
+ return "done";
429
660
  }
430
- var cachedLayer = null;
431
- function buildHostEnvironmentLayer(options) {
432
- if (!options && cachedLayer) {
433
- return cachedLayer;
434
- }
435
- const details = probeHostEnvironment(options);
436
- const content = formatHostEnvironmentContent(details);
437
- const layer = {
438
- id: "host-environment",
439
- owner: "runtime",
440
- cacheScope: "session",
441
- content
661
+
662
+ // packages/cli/client/oneShotTerminalStatus.ts
663
+ function resolveOneShotTerminalState(result) {
664
+ return resolveTerminalProgramStatusState({
665
+ exitCode: result.exitCode,
666
+ interrupted: result.streamInterrupted,
667
+ stalledOrTruncated: result.stalledOrTruncated
668
+ });
669
+ }
670
+ function createOneShotTerminalStatus(output) {
671
+ let last;
672
+ let terminal = false;
673
+ const report = (state) => {
674
+ if (!output || terminal || last === state)
675
+ return;
676
+ last = state;
677
+ if (state === "done" || state === "error")
678
+ terminal = true;
679
+ emitTerminalProgramStatus(output, { state });
680
+ };
681
+ return {
682
+ working: () => report("working"),
683
+ settle: (result) => report(resolveOneShotTerminalState(result)),
684
+ fail: () => report("error")
442
685
  };
443
- if (!options) {
444
- cachedLayer = layer;
445
- }
446
- return layer;
447
686
  }
448
687
 
688
+ // packages/cli/agentRunCommand.ts
689
+ import * as nodeFs from "node:fs";
690
+
691
+ // packages/cli/client/autoModelRouter.ts
692
+ var CLI_AUTO_ROUTE_AGENT_KEY = BUILTIN_NOLO_AGENT_KEY3;
693
+
449
694
  // packages/ai/token/cacheRunSummary.ts
450
- var finiteCount = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : void 0;
695
+ var finiteCount = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : undefined;
451
696
  var isUsageObject = (usage) => Boolean(usage) && typeof usage === "object";
452
697
  var readInputTokens = (usage) => finiteCount(usage.input_tokens) ?? finiteCount(usage.prompt_tokens) ?? 0;
453
698
  var readOutputTokens = (usage) => finiteCount(usage.output_tokens) ?? finiteCount(usage.completion_tokens);
454
699
  var computeCacheHitRatio = (inputTokens, cachedTokens) => {
455
- if (cachedTokens === null) return null;
456
- if (!Number.isFinite(inputTokens) || inputTokens <= 0) return 0;
700
+ if (cachedTokens === null)
701
+ return null;
702
+ if (!Number.isFinite(inputTokens) || inputTokens <= 0)
703
+ return 0;
457
704
  return Math.round(cachedTokens / inputTokens * 1e4) / 1e4;
458
705
  };
459
706
  var withRatio = (inputTokens, cachedTokens, outputTokens) => ({
@@ -463,16 +710,15 @@ var withRatio = (inputTokens, cachedTokens, outputTokens) => ({
463
710
  ...typeof outputTokens === "number" && Number.isFinite(outputTokens) ? { output_tokens: Math.max(0, Math.floor(outputTokens)) } : {}
464
711
  });
465
712
  var summarizeCacheUsage = (usage) => {
466
- if (!isUsageObject(usage)) return void 0;
467
- if (Object.keys(usage).length === 0) return void 0;
468
- return withRatio(
469
- readInputTokens(usage),
470
- readCacheReadInputTokensOrNull(usage),
471
- readOutputTokens(usage)
472
- );
713
+ if (!isUsageObject(usage))
714
+ return;
715
+ if (Object.keys(usage).length === 0)
716
+ return;
717
+ return withRatio(readInputTokens(usage), readCacheReadInputTokensOrNull(usage), readOutputTokens(usage));
473
718
  };
474
719
  var summarizeCacheUsageRecords = (records) => {
475
- if (!records || records.length === 0) return void 0;
720
+ if (!records || records.length === 0)
721
+ return;
476
722
  let inputTokens = 0;
477
723
  let cachedTokens = 0;
478
724
  let outputTokens = 0;
@@ -480,7 +726,8 @@ var summarizeCacheUsageRecords = (records) => {
480
726
  let sawUsage = false;
481
727
  for (const record of records) {
482
728
  const summary = summarizeCacheUsage(record?.usage);
483
- if (!summary) continue;
729
+ if (!summary)
730
+ continue;
484
731
  sawUsage = true;
485
732
  inputTokens += summary.input_tokens;
486
733
  cachedTokens = cachedTokens === null || summary.cached_tokens === null ? null : cachedTokens + summary.cached_tokens;
@@ -489,12 +736,15 @@ var summarizeCacheUsageRecords = (records) => {
489
736
  outputTokens += summary.output_tokens;
490
737
  }
491
738
  }
492
- if (!sawUsage) return void 0;
493
- return withRatio(inputTokens, cachedTokens, sawOutput ? outputTokens : void 0);
739
+ if (!sawUsage)
740
+ return;
741
+ return withRatio(inputTokens, cachedTokens, sawOutput ? outputTokens : undefined);
494
742
  };
495
743
  var mergeCacheUsageSummaries = (left, right) => {
496
- if (!left) return right;
497
- if (!right) return left;
744
+ if (!left)
745
+ return right;
746
+ if (!right)
747
+ return left;
498
748
  const inputTokens = left.input_tokens + right.input_tokens;
499
749
  const cachedTokens = left.cached_tokens === null || right.cached_tokens === null ? null : left.cached_tokens + right.cached_tokens;
500
750
  const outputTokens = typeof left.output_tokens === "number" && typeof right.output_tokens === "number" ? left.output_tokens + right.output_tokens : typeof left.output_tokens === "number" ? left.output_tokens : right.output_tokens;
@@ -503,11 +753,14 @@ var mergeCacheUsageSummaries = (left, right) => {
503
753
 
504
754
  // packages/cli/agentRunDoD.ts
505
755
  import { spawnSync as nodeSpawnSync } from "node:child_process";
506
- var DOD_COMMAND_TIMEOUT_MS = 12e4;
756
+ var DOD_COMMAND_TIMEOUT_MS = 120000;
507
757
  function extractTailLines(text, count) {
508
- if (!text) return [];
509
- const lines = String(text).split("\n");
510
- while (lines.length > 0 && lines[lines.length - 1].trim() === "") lines.pop();
758
+ if (!text)
759
+ return [];
760
+ const lines = String(text).split(`
761
+ `);
762
+ while (lines.length > 0 && lines[lines.length - 1].trim() === "")
763
+ lines.pop();
511
764
  return lines.slice(-count);
512
765
  }
513
766
  function executeDoDCommand(cmd, cwd, deps = {}) {
@@ -556,228 +809,10 @@ function executeDoDCommand(cmd, cwd, deps = {}) {
556
809
  }
557
810
  }
558
811
  function runDoDCommands(commands, cwd, deps = {}) {
559
- if (!commands || commands.length === 0) return void 0;
812
+ if (!commands || commands.length === 0)
813
+ return;
560
814
  return commands.map((cmd) => executeDoDCommand(cmd, cwd, deps));
561
815
  }
562
-
563
- // packages/cli/agentRunPrompts.ts
564
- import { existsSync as existsSync2, readFileSync as readFileSync3, readdirSync, statSync } from "node:fs";
565
- import { dirname, extname, isAbsolute as isAbsolute2, join as join2, relative as relativePath, resolve as resolve2, sep } from "node:path";
566
- function workflowRefToCandidatePath(cwd, ref) {
567
- const normalized = ref.trim();
568
- if (!normalized) return "";
569
- if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
570
- const directPath = resolve2(cwd, normalized);
571
- if (existsSync2(directPath)) return directPath;
572
- }
573
- const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
574
- return resolve2(cwd, "docs", "workflows", `${fileName}.md`);
575
- }
576
- var SKILL_SEARCH_DIRS = [
577
- ".agents/skills"
578
- ];
579
- function skillRefToCandidatePath(cwd, ref) {
580
- const normalized = ref.trim();
581
- if (!normalized) return "";
582
- if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
583
- const directPath = resolve2(cwd, normalized);
584
- if (existsSync2(directPath)) return directPath;
585
- }
586
- const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
587
- for (const dir of SKILL_SEARCH_DIRS) {
588
- const skillMdPath = resolve2(cwd, dir, fileName, "SKILL.md");
589
- if (existsSync2(skillMdPath)) return skillMdPath;
590
- }
591
- return resolve2(cwd, ".agents", "skills", fileName, "SKILL.md");
592
- }
593
- async function resolveWorkflowReference(ref, cwd = process.cwd()) {
594
- const path = workflowRefToCandidatePath(cwd, ref);
595
- if (!path || !existsSync2(path)) {
596
- throw new Error(`Workflow reference not found: ${ref}`);
597
- }
598
- const markdown = readFileSync3(path, "utf8");
599
- const parsed = parseSkillDocProtocol(markdown);
600
- return {
601
- ref,
602
- content: parsed.content,
603
- ...parsed.meta?.workflowConfig ? { config: parsed.meta.workflowConfig } : {}
604
- };
605
- }
606
- function inlineRelativeRefs(body, skillDir) {
607
- const refPattern = /\[([^\]]+)\]\((\.\/[^)]+|[^)]+\/[^)]+)\)/g;
608
- const normalizedSkillDir = resolve2(skillDir) + sep;
609
- return body.replace(refPattern, (match, label, relPath) => {
610
- const cleaned = relPath.trim();
611
- if (!cleaned.startsWith("./") && !cleaned.startsWith("../")) return match;
612
- const absPath = resolve2(skillDir, cleaned);
613
- const relative = relativePath(normalizedSkillDir, absPath);
614
- if (relative.startsWith("..") || isAbsolute2(relative)) return match;
615
- if (!existsSync2(absPath) || !absPath.endsWith(".md")) return match;
616
- const refContent = readFileSync3(absPath, "utf8");
617
- return `
618
-
619
- ### ${label}
620
-
621
- ${refContent}
622
-
623
- `;
624
- });
625
- }
626
- function listSkillScripts(skillDir) {
627
- const scriptsDir = join2(skillDir, "scripts");
628
- if (!existsSync2(scriptsDir) || !statSync(scriptsDir).isDirectory()) return null;
629
- const entries = readdirSync(scriptsDir).filter((e) => !e.startsWith("."));
630
- if (entries.length === 0) return null;
631
- return [
632
- "",
633
- "--- Available scripts (use execShell/readFile to access) ---",
634
- ...entries.map((e) => `- scripts/${e}`)
635
- ].join("\n");
636
- }
637
- async function resolveSkillReference(ref, options = {}) {
638
- const isDbKey = /^(page|doc)-[0-9a-z]+-/i.test(ref);
639
- let markdown = "";
640
- let skillDir;
641
- let filePath;
642
- if (isDbKey) {
643
- if (!options.readDbRecord) {
644
- throw new Error("skill dbKey requires server access");
645
- }
646
- const record = await options.readDbRecord(ref);
647
- const contentText = record?.content ?? record?.prompt ?? record?.text;
648
- if (contentText === void 0 || contentText === null || contentText === "") {
649
- throw new Error(`Skill reference has no content: ${ref}`);
650
- }
651
- markdown = String(contentText);
652
- } else {
653
- const cwd = options.cwd ?? process.cwd();
654
- const path = skillRefToCandidatePath(cwd, ref);
655
- if (!path || !existsSync2(path)) {
656
- throw new Error(`Skill reference not found: ${ref}`);
657
- }
658
- markdown = readFileSync3(path, "utf8");
659
- filePath = path;
660
- skillDir = dirname(path);
661
- }
662
- const parsed = parseSkillDocProtocol(markdown);
663
- const name = parsed.meta?.skillConfig?.name;
664
- const promptPatch = parsed.meta?.skillConfig?.promptPatch;
665
- const externalParsed = parseExternalSkillMarkdown(markdown);
666
- const allowedTools = externalParsed.allowedTools;
667
- const effectiveName = name ?? externalParsed.name;
668
- let effectiveContent = parsed.content;
669
- if (skillDir) {
670
- effectiveContent = inlineRelativeRefs(effectiveContent, skillDir);
671
- const scriptsHint = listSkillScripts(skillDir);
672
- if (scriptsHint) effectiveContent += scriptsHint;
673
- }
674
- return {
675
- ref,
676
- content: effectiveContent,
677
- ...effectiveName ? { name: effectiveName } : {},
678
- ...promptPatch ? { promptPatch } : {},
679
- ...allowedTools && allowedTools.length > 0 ? { allowedTools } : {},
680
- ...skillDir ? { skillDir } : {}
681
- };
682
- }
683
- function buildSkillContextBlocks(skills) {
684
- if (!skills || !skills.length) return [];
685
- const seen = /* @__PURE__ */ new Set();
686
- const blocks = [];
687
- for (const skill of skills) {
688
- const dedupKey = skill.name ?? skill.ref;
689
- if (seen.has(dedupKey)) continue;
690
- seen.add(dedupKey);
691
- const header = `## ${dedupKey}`;
692
- const patch = skill.promptPatch ? `${skill.promptPatch}
693
- ` : "";
694
- blocks.push(`${header}
695
- ${patch}${skill.content}`);
696
- }
697
- return blocks;
698
- }
699
- var OUTPUT_FORMAT_GUIDANCE = [
700
- "Output format guidance:",
701
- "- Use semantic Markdown by default.",
702
- "- Use tables for genuinely multi-column structured data.",
703
- "- Use $...$ or $$...$$ for mathematical expressions.",
704
- "- Use ```mermaid fenced blocks for process flows, sequences, state transitions, class/entity relations and architecture \u2014 they render as diagrams; skip when a sentence or list explains it better.",
705
- "- Use language-tagged fenced blocks for code.",
706
- "- Do not add tables or Mermaid for decoration; when complex syntax is uncertain, prefer plain Markdown or text.",
707
- ""
708
- ].join("\n");
709
- function prependOutputFormatGuidance(message) {
710
- if (message.startsWith(OUTPUT_FORMAT_GUIDANCE)) return message;
711
- return `${OUTPUT_FORMAT_GUIDANCE}${message}`;
712
- }
713
- function prependWorkflowReferencePrompt(message, workflow) {
714
- if (!workflow) return message;
715
- const config = workflow.config;
716
- return [
717
- "AI-native workflow reference:",
718
- "- This reference is guidance for the agent, not a central workflow engine.",
719
- `- ref: ${workflow.ref}`,
720
- ...config?.id ? [`- id: ${config.id}`] : [],
721
- ...config?.name ? [`- name: ${config.name}`] : [],
722
- ...config?.defaultAgent ? [`- suggested defaultAgent: ${config.defaultAgent}`] : [],
723
- ...config?.inputs?.length ? [`- inputs: ${config.inputs.join(", ")}`] : [],
724
- ...config?.recommendedTools?.length ? [`- recommendedTools: ${config.recommendedTools.join(", ")}`] : [],
725
- ...config?.requiredTools?.length ? [`- requiredTools: ${config.requiredTools.join(", ")}`] : [],
726
- ...config?.requiredOutputs?.length ? [`- requiredOutputs: ${config.requiredOutputs.join(", ")}`] : [],
727
- ...config?.gates?.length ? [`- gates: ${config.gates.join(", ")}`] : [],
728
- ...config?.contextStrategy ? [`- contextStrategy: ${config.contextStrategy}`] : [],
729
- ...config?.failureProtocol ? [`- failureProtocol: ${config.failureProtocol}`] : [],
730
- "",
731
- "Reference body:",
732
- workflow.content,
733
- "",
734
- "User task:",
735
- message
736
- ].join("\n");
737
- }
738
- function prependFeatureWorktreeInstruction(message, enabled) {
739
- if (!enabled) return message;
740
- return [
741
- "Local execution rule:",
742
- "- You are running in the current git checkout with shell access.",
743
- "- For read-only checks, smoke tests, or answering questions, stay in the current directory.",
744
- "- Before developing a new feature or making non-trivial code changes, create a separate git worktree yourself with git worktree and do the edits there.",
745
- "- Commit and push only when the user explicitly asks or the task requires it.",
746
- "",
747
- "User task:",
748
- message
749
- ].join("\n");
750
- }
751
- function prependSubjectDialogMarker(message, subjectDialogKey) {
752
- if (!subjectDialogKey) return message;
753
- return [
754
- `Subject dialog for this run: ${subjectDialogKey}`,
755
- "If the user asks to evaluate the referenced dialog, call readDialog with this id/key first.",
756
- "",
757
- message
758
- ].join("\n");
759
- }
760
- function normalizeCliImageInput(input) {
761
- if (/^(https?:|data:|file:)/i.test(input)) return input;
762
- const absolutePath = resolve2(input);
763
- if (!existsSync2(absolutePath)) return input;
764
- const base64 = readFileSync3(absolutePath).toString("base64");
765
- return `data:${imageMimeTypeForPath(absolutePath)};base64,${base64}`;
766
- }
767
- function imageMimeTypeForPath(path) {
768
- switch (extname(path).toLowerCase()) {
769
- case ".jpg":
770
- case ".jpeg":
771
- return "image/jpeg";
772
- case ".webp":
773
- return "image/webp";
774
- case ".gif":
775
- return "image/gif";
776
- default:
777
- return "image/png";
778
- }
779
- }
780
-
781
816
  // packages/cli/agentRunCommand.ts
782
817
  function resolvePositiveMs(value, fallback) {
783
818
  return parsePositiveFiniteNumberOrFallback(value, fallback);
@@ -799,7 +834,8 @@ function resolveRunOutcome(input) {
799
834
  }
800
835
  var resolveRunSettlementNote = (result) => {
801
836
  const reason = result.emptyAssistantFallbackReason;
802
- if (!reason || !FAILED_EMPTY_ASSISTANT_REASONS.has(reason)) return {};
837
+ if (!reason || !FAILED_EMPTY_ASSISTANT_REASONS.has(reason))
838
+ return {};
803
839
  if (result.emptyAssistantOutputUsable) {
804
840
  return { note: `output complete but stream lacked finish frame: ${reason}` };
805
841
  }
@@ -807,7 +843,7 @@ var resolveRunSettlementNote = (result) => {
807
843
  };
808
844
  async function resolveAgentRunAgentKey(args) {
809
845
  if (!args.agentInput.trim() || args.agentInput.startsWith("agent-")) {
810
- return void 0;
846
+ return;
811
847
  }
812
848
  const db = await getReadableCliDb(args.output);
813
849
  const resolved = await resolveAgentRecordFromHybridStore({
@@ -829,9 +865,9 @@ async function resolveAgentBoundMachineIdFromRecord(args) {
829
865
  db,
830
866
  fetchImpl: fetch
831
867
  }).catch(() => null);
832
- return resolveBoundMachineId(record) || void 0;
868
+ return resolveBoundMachineId(record) || undefined;
833
869
  }
834
- async function runAgentRunCommand(args, deps) {
870
+ async function runAgentRunCommand2(args, deps) {
835
871
  if (args.includes("--help") || args.includes("-h")) {
836
872
  writeUsage(deps.output ?? process.stdout, deps.commandPath);
837
873
  return 0;
@@ -840,30 +876,36 @@ async function runAgentRunCommand(args, deps) {
840
876
  const runId = env.NOLO_AGENT_RUN_ID;
841
877
  const controlDeps = { env, homedir: deps.homedir, fs: deps.fs, now: deps.now };
842
878
  const failStartup = async (error) => {
843
- if (!runId) return;
844
- const record = readRunRecord(runId, controlDeps);
845
- if (record?.status !== "running" || record.pid != null && record.pid !== process.pid) return;
846
- const result = await settleRunTerminalAuthoritatively(runId, {
879
+ if (!runId)
880
+ return;
881
+ const record = readRunRecord2(runId, controlDeps);
882
+ if (record?.status !== "running" || record.pid != null && record.pid !== process.pid)
883
+ return;
884
+ const result = await settleRunTerminalAuthoritatively2(runId, {
847
885
  status: "failed",
848
886
  exitCode: 1,
849
887
  failureReason: error instanceof RuntimeProtocolMismatchError ? "runtime_protocol_mismatch" : error instanceof RuntimeVersionMismatchError ? "runtime_version_mismatch" : "startup_failed",
850
888
  note: error ? toErrorMessage(error) : "Child initialization returned without terminal result"
851
- }, controlDeps, (id, update, d, opts) => transitionRunToTerminal(id, update, d, {
889
+ }, controlDeps, (id, update, d, opts) => transitionRunToTerminal2(id, update, d, {
852
890
  ...opts?.expectedPid != null ? { expectedPid: opts.expectedPid } : {}
853
891
  }), { expectedPid: process.pid });
854
- if (result.kind === "contended") throw new Error(`Startup settlement lock busy: ${runId}`);
892
+ if (result.kind === "contended")
893
+ throw new Error(`Startup settlement lock busy: ${runId}`);
855
894
  };
856
895
  try {
857
896
  if (runId) {
858
- const record = readRunRecord(runId, controlDeps);
859
- if (record?.pid != null && record.pid !== process.pid) throw new Error(`Run ${runId} belongs to PID ${record.pid}, not ${process.pid}`);
860
- if (!record) throw new Error("[local-writer-resource] missing child binding");
861
- await recordRunStartup(runId, "initializing", controlDeps);
897
+ const record = readRunRecord2(runId, controlDeps);
898
+ if (record?.pid != null && record.pid !== process.pid)
899
+ throw new Error(`Run ${runId} belongs to PID ${record.pid}, not ${process.pid}`);
900
+ if (!record)
901
+ throw new Error("[local-writer-resource] missing child binding");
902
+ await recordRunStartup2(runId, "initializing", controlDeps);
862
903
  validateAgentRunProtocol(env.NOLO_AGENT_RUN_PROTOCOL);
863
- await recordRunStartup(runId, "protocol_validated", controlDeps);
904
+ await recordRunStartup2(runId, "protocol_validated", controlDeps);
864
905
  }
865
906
  const code = await runAgentRunCommandImpl(args, deps);
866
- if (runId) await failStartup();
907
+ if (runId)
908
+ await failStartup();
867
909
  return code;
868
910
  } catch (error) {
869
911
  await failStartup(error);
@@ -888,14 +930,14 @@ async function runAgentRunCommandImpl(args, deps) {
888
930
  writeUsage(output, deps.commandPath);
889
931
  return 1;
890
932
  }
891
- const rawRunner = deps.runner ?? runAgentTurn;
933
+ const rawRunner = deps.runner ?? runAgentTurn2;
892
934
  let modelPhaseRecorded = false;
893
- const watchdogAbort = new AbortController();
935
+ const watchdogAbort = new AbortController;
894
936
  let activeRunner;
895
937
  const runner = (options) => {
896
938
  activeRunner = Promise.resolve().then(async () => {
897
939
  if (env.NOLO_AGENT_RUN_ID && !modelPhaseRecorded) {
898
- await recordRunStartup(env.NOLO_AGENT_RUN_ID, "model", { env, homedir: deps.homedir, fs: deps.fs, now: deps.now });
940
+ await recordRunStartup2(env.NOLO_AGENT_RUN_ID, "model", { env, homedir: deps.homedir, fs: deps.fs, now: deps.now });
899
941
  modelPhaseRecorded = true;
900
942
  }
901
943
  return rawRunner({ ...options, abortSignal: watchdogAbort.signal });
@@ -907,17 +949,19 @@ async function runAgentRunCommandImpl(args, deps) {
907
949
  };
908
950
  const stopWatchdogRunner = async () => {
909
951
  watchdogAbort.abort(new Error("watchdog_stop"));
910
- if (!activeRunner) return true;
952
+ if (!activeRunner)
953
+ return true;
911
954
  let timer;
912
955
  try {
913
956
  return await Promise.race([
914
957
  activeRunner.then(() => true, () => true),
915
- new Promise((resolve3) => {
916
- timer = setTimeout(() => resolve3(false), 100);
958
+ new Promise((resolve) => {
959
+ timer = setTimeout(() => resolve(false), 100);
917
960
  })
918
961
  ]);
919
962
  } finally {
920
- if (timer) clearTimeout(timer);
963
+ if (timer)
964
+ clearTimeout(timer);
921
965
  }
922
966
  };
923
967
  const nowMs = () => deps.now ? deps.now().getTime() : Date.now();
@@ -931,19 +975,18 @@ async function runAgentRunCommandImpl(args, deps) {
931
975
  ...parsed.blockedToolNames ? { blockedToolNames: parsed.blockedToolNames } : {},
932
976
  provenance: "cli-command-authorized"
933
977
  });
934
- const locatedExecution = hasRegistry ? readRunRecord(childRunId, { env, homedir: deps.homedir, fs: deps.fs })?.execution : void 0;
978
+ const locatedExecution = hasRegistry ? readRunRecord2(childRunId, { env, homedir: deps.homedir, fs: deps.fs })?.execution : undefined;
935
979
  if (hasRegistry && (parsed.runtimeKey?.trim() === "local" || locatedExecution?.state === "known")) {
936
980
  const implicitReadonlyHost = !parsed.runtimeKey && args.includes("--read-only") && locatedExecution?.state === "known" && locatedExecution.runtimeKey === "local" && locatedExecution.permissions.readOnly;
937
- if (parsed.runtimeKey?.trim() !== "local" && !implicitReadonlyHost) throw new Error("[local-writer-resource] child binding runtime mismatch");
938
- const { blockedToolNames } = await awaitLocalWriterChild(childRunId, parsed.cwd ?? process.cwd(), hostPolicy(), { env, homedir: deps.homedir, fs: deps.fs });
981
+ if (parsed.runtimeKey?.trim() !== "local" && !implicitReadonlyHost)
982
+ throw new Error("[local-writer-resource] child binding runtime mismatch");
983
+ const { blockedToolNames } = await awaitLocalWriterChild2(childRunId, parsed.cwd ?? process.cwd(), hostPolicy(), { env, homedir: deps.homedir, fs: deps.fs });
939
984
  parsed.blockedToolNames = blockedToolNames;
940
985
  }
941
- if (hasRegistry && parsed.runtimeKey?.trim() !== "local" && locatedExecution?.state !== "known") reportRunProcessIdentity(childRunId, { env, homedir: deps.homedir, fs: deps.fs, now: deps.now });
986
+ if (hasRegistry && parsed.runtimeKey?.trim() !== "local" && locatedExecution?.state !== "known")
987
+ reportRunProcessIdentity2(childRunId, { env, homedir: deps.homedir, fs: deps.fs, now: deps.now });
942
988
  const processExit = deps.processExit ?? ((code) => process.exit(code));
943
- const stallTimeoutMs = resolvePositiveMs(
944
- deps.stallTimeoutMs ?? env.NOLO_LOCAL_RUN_STALL_TIMEOUT_MS,
945
- 5 * 6e4
946
- );
989
+ const stallTimeoutMs = resolvePositiveMs(deps.stallTimeoutMs ?? env.NOLO_LOCAL_RUN_STALL_TIMEOUT_MS, 5 * 60000);
947
990
  const stallEnvExplicitlySet = typeof env.NOLO_LOCAL_RUN_STALL_TIMEOUT_MS === "string" && env.NOLO_LOCAL_RUN_STALL_TIMEOUT_MS.trim().length > 0;
948
991
  const armStallWatchdog = hasRegistry || stallEnvExplicitlySet;
949
992
  const armTimeoutWatchdog = typeof parsed.timeoutMs === "number" && parsed.timeoutMs > 0;
@@ -951,28 +994,28 @@ async function runAgentRunCommandImpl(args, deps) {
951
994
  let stalled = false;
952
995
  let timeoutTimer;
953
996
  let stallTimer;
954
- const activityTracker = armStallWatchdog ? createRunActivityTracker(childRunId ?? "__foreground__", {
997
+ const activityTracker = armStallWatchdog ? createRunActivityTracker2(childRunId ?? "__foreground__", {
955
998
  env,
956
999
  homedir: deps.homedir,
957
1000
  fs: deps.fs,
958
1001
  now: deps.now
959
- }) : void 0;
1002
+ }) : undefined;
960
1003
  const clearWatchdogs = () => {
961
- if (timeoutTimer !== void 0) clearTimeout(timeoutTimer);
962
- if (stallTimer !== void 0) clearInterval(stallTimer);
1004
+ if (timeoutTimer !== undefined)
1005
+ clearTimeout(timeoutTimer);
1006
+ if (stallTimer !== undefined)
1007
+ clearInterval(stallTimer);
963
1008
  activityTracker?.flush();
964
1009
  activityTracker?.dispose();
965
1010
  };
966
1011
  let rejectOnWatchdogFailure;
967
1012
  const watchdogFailure = armStallWatchdog || armTimeoutWatchdog ? new Promise((_, reject) => {
968
1013
  rejectOnWatchdogFailure = reject;
969
- }) : void 0;
970
- const terminalStatus = createOneShotTerminalStatus(
971
- parsed.eventsMode || parsed.background || hasRegistry ? null : deps.output ? deps.output : {
972
- write: (chunk) => process.stdout.write(chunk),
973
- isTTY: process.stdout.isTTY === true
974
- }
975
- );
1014
+ }) : undefined;
1015
+ const terminalStatus = createOneShotTerminalStatus(parsed.eventsMode || parsed.background || hasRegistry ? null : deps.output ? deps.output : {
1016
+ write: (chunk) => process.stdout.write(chunk),
1017
+ isTTY: process.stdout.isTTY === true
1018
+ });
976
1019
  const raceWithWatchdog = (work) => {
977
1020
  const raced = watchdogFailure ? Promise.race([work, watchdogFailure]) : work;
978
1021
  return raced.catch((error) => {
@@ -983,33 +1026,27 @@ async function runAgentRunCommandImpl(args, deps) {
983
1026
  const exitFromWatchdog = async (code) => {
984
1027
  try {
985
1028
  await exitCliFromWatchdog(code, processExit, stopWatchdogRunner);
986
- } catch {
987
- }
1029
+ } catch {}
988
1030
  };
989
1031
  const finalizeWatchdogOutcome = async (outcome, note, extra) => {
990
- if (!hasRegistry) return;
1032
+ if (!hasRegistry)
1033
+ return;
991
1034
  const currentActivity = activityTracker?.getActivity();
992
1035
  const rawToolCount = extra?.toolCallCount ?? currentActivity?.counters?.toolCalls;
993
- const toolCallCount = typeof rawToolCount === "number" && rawToolCount > 0 ? rawToolCount : void 0;
994
- await settleRunTerminalAuthoritatively(
995
- childRunId,
996
- {
997
- status: outcome.status,
998
- exitCode: outcome.exitCode,
999
- note,
1000
- ...extra?.failureReason ? { failureReason: extra.failureReason } : {},
1001
- ...toolCallCount !== void 0 ? { toolCallCount } : {},
1002
- ...extra?.lastAssistantText ? { lastAssistantText: extra.lastAssistantText } : {}
1003
- },
1004
- { env, homedir: deps.homedir, fs: deps.fs, now: deps.now, sleep: deps.sleep },
1005
- // Test seam: stubbed transitions keep their single-attempt semantics.
1006
- deps.transitionRunToTerminal,
1007
- { expectedPid: process.pid }
1008
- );
1036
+ const toolCallCount = typeof rawToolCount === "number" && rawToolCount > 0 ? rawToolCount : undefined;
1037
+ await settleRunTerminalAuthoritatively2(childRunId, {
1038
+ status: outcome.status,
1039
+ exitCode: outcome.exitCode,
1040
+ note,
1041
+ ...extra?.failureReason ? { failureReason: extra.failureReason } : {},
1042
+ ...toolCallCount !== undefined ? { toolCallCount } : {},
1043
+ ...extra?.lastAssistantText ? { lastAssistantText: extra.lastAssistantText } : {}
1044
+ }, { env, homedir: deps.homedir, fs: deps.fs, now: deps.now, sleep: deps.sleep }, deps.transitionRunToTerminal, { expectedPid: process.pid });
1009
1045
  };
1010
1046
  if (armStallWatchdog) {
1011
1047
  stallTimer = setInterval(async () => {
1012
- if (timedOut || stalled) return;
1048
+ if (timedOut || stalled)
1049
+ return;
1013
1050
  const activity = activityTracker?.getActivity();
1014
1051
  if (activity?.inFlight?.kind === "tool") {
1015
1052
  return;
@@ -1057,33 +1094,36 @@ async function runAgentRunCommandImpl(args, deps) {
1057
1094
  const instaboxRuntimeLocal = typeof parsed.runtimeKey === "string" && parsed.runtimeKey.trim() === "instabox";
1058
1095
  const hostRuntimeLocal = typeof parsed.runtimeKey === "string" && parsed.runtimeKey.trim() === "local" || !parsed.runtimeKey && args.includes("--read-only") && locatedExecution?.state === "known" && locatedExecution.runtimeKey === "local" && locatedExecution.permissions.readOnly;
1059
1096
  if (hostRuntimeLocal && !args.includes("--read-only") && !args.includes("--allow-host-writes")) {
1060
- output.write(t("agentRun.hostWriteGuard"));
1097
+ output.write(t2("agentRun.hostWriteGuard"));
1061
1098
  return 1;
1062
1099
  }
1063
1100
  const isLocalRun = (dockerRuntimeLocal || instaboxRuntimeLocal || hostRuntimeLocal || !parsed.runtimeKey) && (parsed.runtimeMode === "local" || hostRuntimeLocal || !parsed.runtimeMode && (fullstackLocal || explicitLocalCli || args.includes("--dangerously-allow-shell")));
1064
1101
  if (wantsFallbackSuggestions && !isLocalRun) {
1065
- output.write("[nolo] --fallback-agent (suggestions) is only supported for local CLI runs (use --local)\n");
1102
+ output.write(`[nolo] --fallback-agent (suggestions) is only supported for local CLI runs (use --local)
1103
+ `);
1066
1104
  return 1;
1067
1105
  }
1068
1106
  let effectiveMessage = parsed.message;
1069
1107
  if (wantsFallbackSuggestions) {
1070
1108
  effectiveMessage = `${parsed.message}
1071
1109
 
1072
- [Quota fallback context for agent decision: If this execution for ${parsed.agentKey} hits subscription quota, YOU (the agent) must decide the next agent to use. Do not rely on automatic wrapper. Reason based on the specific task (complexity, length, domain), agent strengths, cost, previous attempt results. Suggested alternatives: ${parsed.fallbackAgentKeys.join(", ")}. Update the task row with attempt history and dispatch the chosen next (via startAgentRun \u5F02\u6B65\u6D3E\u53D1)).]`;
1110
+ [Quota fallback context for agent decision: If this execution for ${parsed.agentKey} hits subscription quota, YOU (the agent) must decide the next agent to use. Do not rely on automatic wrapper. Reason based on the specific task (complexity, length, domain), agent strengths, cost, previous attempt results. Suggested alternatives: ${parsed.fallbackAgentKeys.join(", ")}. Update the task row with attempt history and dispatch the chosen next (via startAgentRun 异步派发)).]`;
1073
1111
  }
1074
1112
  const resolvedAgentKey = parsed.runtimeMode !== "local" && !hostRuntimeLocal ? await (deps.resolveAgentRunAgentKey ?? resolveAgentRunAgentKey)({
1075
1113
  agentInput: resolveRawAgentInput(args, deps.commandPath) ?? parsed.agentKey,
1076
1114
  cliArgs: args,
1077
1115
  env,
1078
1116
  output
1079
- }).catch(() => void 0) : void 0;
1117
+ }).catch(() => {
1118
+ return;
1119
+ }) : undefined;
1080
1120
  const agentKey = resolvedAgentKey ?? parsed.agentKey;
1081
1121
  let machineShellOverride;
1082
1122
  if (parsed.machineShell) {
1083
1123
  const envRuntimeMode = env.NOLO_RUNTIME_MODE;
1084
- const requestedRuntimeMode = parsed.runtimeMode ? parsed.runtimeMode : envRuntimeMode === "local" || envRuntimeMode === "server" || envRuntimeMode === "auto" ? envRuntimeMode : void 0;
1124
+ const requestedRuntimeMode = parsed.runtimeMode ? parsed.runtimeMode : envRuntimeMode === "local" || envRuntimeMode === "server" || envRuntimeMode === "auto" ? envRuntimeMode : undefined;
1085
1125
  if (requestedRuntimeMode === "local") {
1086
- output.write(MACHINE_SHELL_LOCAL_REFUSAL_MESSAGE);
1126
+ output.write(MACHINE_SHELL_LOCAL_REFUSAL_MESSAGE2);
1087
1127
  return 1;
1088
1128
  }
1089
1129
  const machineId = await (deps.resolveAgentBoundMachineId ?? resolveAgentBoundMachineIdFromRecord)({
@@ -1091,26 +1131,22 @@ async function runAgentRunCommandImpl(args, deps) {
1091
1131
  cliArgs: args,
1092
1132
  env,
1093
1133
  output
1094
- }).catch(() => void 0);
1134
+ }).catch(() => {
1135
+ return;
1136
+ });
1095
1137
  if (!machineId) {
1096
- output.write(
1097
- `[nolo] --machine-shell requires ${agentKey} to be bound to a machine (runtimeBinding.machineId); none found.
1098
- [nolo] bind it with \`nolo agent bind-current ${agentKey}\` on the target computer, then retry.
1099
- `
1100
- );
1138
+ output.write(`[nolo] --machine-shell requires ${agentKey} to be bound to a machine (runtimeBinding.machineId); none found.
1139
+ ` + `[nolo] bind it with \`nolo agent bind-current ${agentKey}\` on the target computer, then retry.
1140
+ `);
1101
1141
  return 1;
1102
1142
  }
1103
- machineShellOverride = normalizeRuntimeToolPolicyOverride(
1104
- MACHINE_SHELL_REQUESTED_POLICY
1105
- );
1143
+ machineShellOverride = normalizeRuntimeToolPolicyOverride(MACHINE_SHELL_REQUESTED_POLICY);
1106
1144
  const baselinePolicy = resolveEffectiveRuntimeToolPolicy({
1107
1145
  agentConfig: { runtimeToolPolicy: machineShellOverride },
1108
1146
  host: "web"
1109
1147
  });
1110
- output.write(
1111
- `[nolo] machine-shell: dispatch=server(required) machine=${machineId} runtimeTools=${(machineShellOverride?.runtimeTools ?? []).join(",") || "-"} sandbox=${baselinePolicy?.isolation?.mode ?? "-"} approval=${baselinePolicy?.shell?.commandPolicy ?? "-"} networkPolicy=${baselinePolicy?.shell?.networkPolicy ?? "-"} policySource=web-runtime-safety-baseline
1112
- `
1113
- );
1148
+ output.write(`[nolo] machine-shell: dispatch=server(required) machine=${machineId}` + ` runtimeTools=${(machineShellOverride?.runtimeTools ?? []).join(",") || "-"}` + ` sandbox=${baselinePolicy?.isolation?.mode ?? "-"}` + ` approval=${baselinePolicy?.shell?.commandPolicy ?? "-"}` + ` networkPolicy=${baselinePolicy?.shell?.networkPolicy ?? "-"}` + ` policySource=web-runtime-safety-baseline
1149
+ `);
1114
1150
  }
1115
1151
  let effectiveAgentKey = agentKey;
1116
1152
  let modelOverride = null;
@@ -1118,32 +1154,26 @@ async function runAgentRunCommandImpl(args, deps) {
1118
1154
  if (autoRouteRequested) {
1119
1155
  const hasExplicitAgent = Boolean(readFlagValue(args, "--agent"));
1120
1156
  if (hasExplicitAgent) {
1121
- modelOverride = buildModelLayerOverride(
1122
- await readDbRecord({
1123
- dbKey: agentKey,
1124
- authToken: resolveAuthToken(args, env),
1125
- serverUrl: resolveServerUrl(env),
1126
- fetchImpl: fetch
1127
- }).catch(() => null)
1128
- );
1157
+ modelOverride = buildModelLayerOverride(await readDbRecord({
1158
+ dbKey: agentKey,
1159
+ authToken: resolveAuthToken3(args, env),
1160
+ serverUrl: resolveServerUrl2(env),
1161
+ fetchImpl: fetch
1162
+ }).catch(() => null));
1129
1163
  }
1130
1164
  if (hasExplicitAgent && !modelOverride) {
1131
- output.write(
1132
- t("agentRun.autoRouteOverrideFailed")
1133
- );
1165
+ output.write(t2("agentRun.autoRouteOverrideFailed"));
1134
1166
  } else {
1135
1167
  effectiveAgentKey = CLI_AUTO_ROUTE_AGENT_KEY;
1136
1168
  if (modelOverride) {
1137
- output.write(t("agentRun.autoRouteModelOverride", agentKey));
1169
+ output.write(t2("agentRun.autoRouteModelOverride", agentKey));
1138
1170
  }
1139
1171
  }
1140
1172
  }
1141
1173
  let workflowReference;
1142
1174
  if (parsed.workflowRef) {
1143
1175
  try {
1144
- workflowReference = await (deps.resolveWorkflowReference ?? resolveWorkflowReference)(
1145
- parsed.workflowRef
1146
- );
1176
+ workflowReference = await (deps.resolveWorkflowReference ?? resolveWorkflowReference)(parsed.workflowRef);
1147
1177
  } catch (error) {
1148
1178
  output.write(`[nolo] ${toErrorMessage(error)}
1149
1179
  `);
@@ -1154,8 +1184,8 @@ async function runAgentRunCommandImpl(args, deps) {
1154
1184
  let skillAllowedToolOverride;
1155
1185
  if (parsed.skillRefs?.length) {
1156
1186
  const skills = [];
1157
- const authToken = resolveAuthToken(args, env);
1158
- const serverUrl = resolveServerUrl(env);
1187
+ const authToken = resolveAuthToken3(args, env);
1188
+ const serverUrl = resolveServerUrl2(env);
1159
1189
  for (const ref of parsed.skillRefs) {
1160
1190
  try {
1161
1191
  const resolved = await resolveSkillReference(ref, {
@@ -1177,23 +1207,21 @@ async function runAgentRunCommandImpl(args, deps) {
1177
1207
  }
1178
1208
  }
1179
1209
  skillReferences = skills;
1180
- const skillToolLists = skills.map((s) => s.allowedTools).filter((t2) => !!t2 && t2.length > 0);
1210
+ const skillToolLists = skills.map((s) => s.allowedTools).filter((t) => !!t && t.length > 0);
1181
1211
  if (skillToolLists.length > 0) {
1182
- const skillAllowed = skillToolLists.reduce(
1183
- (acc, tools) => acc.filter((t2) => tools.includes(t2))
1184
- );
1212
+ const skillAllowed = skillToolLists.reduce((acc, tools) => acc.filter((t) => tools.includes(t)));
1185
1213
  if (skillAllowed.length === 0) {
1186
1214
  output.write(`[nolo] warning: attached skills declare incompatible allowed-tools; this run has no tools
1187
1215
  `);
1188
1216
  }
1189
- skillAllowedToolOverride = parsed.allowedToolNames?.length ? parsed.allowedToolNames.filter((t2) => skillAllowed.includes(t2)) : skillAllowed;
1217
+ skillAllowedToolOverride = parsed.allowedToolNames?.length ? parsed.allowedToolNames.filter((t) => skillAllowed.includes(t)) : skillAllowed;
1190
1218
  }
1191
1219
  }
1192
1220
  let localRuntimeCwd = parsed.cwd;
1193
1221
  if (!localRuntimeCwd && (parsed.runtimeMode === "local" || hostRuntimeLocal)) {
1194
1222
  localRuntimeCwd = process.cwd();
1195
1223
  }
1196
- const acceptanceCwd = localRuntimeCwd && (parsed.runtimeMode === "local" || hostRuntimeLocal) ? localRuntimeCwd : void 0;
1224
+ const acceptanceCwd = localRuntimeCwd && (parsed.runtimeMode === "local" || hostRuntimeLocal) ? localRuntimeCwd : undefined;
1197
1225
  const acceptanceBase = acceptanceCwd ? await (deps.captureLocalRunBase ?? captureLocalRunBase)(acceptanceCwd, deps.localRunBaseCaptureOptions) : null;
1198
1226
  let finalWorkspaceInspection;
1199
1227
  if (parsed.runtimeKey === "instabox") {
@@ -1207,7 +1235,7 @@ async function runAgentRunCommandImpl(args, deps) {
1207
1235
  env
1208
1236
  });
1209
1237
  } catch (err) {
1210
- output.write(t("agentRun.instaboxConfigFailed", toErrorMessage(err)));
1238
+ output.write(t2("agentRun.instaboxConfigFailed", toErrorMessage(err)));
1211
1239
  return 1;
1212
1240
  }
1213
1241
  }
@@ -1216,41 +1244,37 @@ async function runAgentRunCommandImpl(args, deps) {
1216
1244
  allowShell: parsed.allowShell
1217
1245
  });
1218
1246
  if (parsed.background && isLocalRun) {
1219
- const { runId, pid, logPath } = await (deps.spawnLocalBackgroundRun ?? spawnLocalBackgroundRun)(
1220
- {
1221
- rawArgs: args,
1222
- commandPath: deps.commandPath,
1223
- cliEntrypointPath: deps.cliEntrypointPath,
1224
- agentKey,
1225
- cwd: localRuntimeCwd,
1226
- ...hostRuntimeLocal ? { localExecution: {
1227
- runtimeKey: "local",
1228
- hostWritesAuthorized: args.includes("--allow-host-writes"),
1229
- readOnly: args.includes("--read-only"),
1230
- ...parsed.allowedToolNames ? { allowedToolNames: parsed.allowedToolNames } : {},
1231
- ...parsed.blockedToolNames ? { blockedToolNames: parsed.blockedToolNames } : {},
1232
- provenance: "cli-command-authorized"
1233
- } } : {},
1234
- // Explicit host target is authorized above; read-only retains its existing tool restrictions.
1235
- ...hostRuntimeLocal && !args.includes("--read-only") ? { claimLocalWrites: true } : {},
1236
- msgFile: readFlagValue(args, "--msg-file"),
1237
- message: parsed.message,
1238
- timeoutMs: parsed.timeoutMs,
1239
- ...parsed.ephemeral ? { ephemeral: true } : {},
1240
- ...parsed.dodCommands?.length ? { dodCommands: parsed.dodCommands } : {},
1241
- output
1242
- },
1243
- {
1244
- env,
1245
- homedir: deps.homedir,
1246
- spawn: deps.spawn,
1247
- fs: deps.fs,
1248
- now: deps.now,
1249
- generateRunId: deps.generateRunId,
1250
- shellApprovalHost: deps.shellApprovalHost,
1251
- mcpApprovalHost: deps.mcpApprovalHost
1252
- }
1253
- );
1247
+ const { runId, pid, logPath } = await (deps.spawnLocalBackgroundRun ?? spawnLocalBackgroundRun2)({
1248
+ rawArgs: args,
1249
+ commandPath: deps.commandPath,
1250
+ cliEntrypointPath: deps.cliEntrypointPath,
1251
+ agentKey,
1252
+ cwd: localRuntimeCwd,
1253
+ ...hostRuntimeLocal ? { localExecution: {
1254
+ runtimeKey: "local",
1255
+ hostWritesAuthorized: args.includes("--allow-host-writes"),
1256
+ readOnly: args.includes("--read-only"),
1257
+ ...parsed.allowedToolNames ? { allowedToolNames: parsed.allowedToolNames } : {},
1258
+ ...parsed.blockedToolNames ? { blockedToolNames: parsed.blockedToolNames } : {},
1259
+ provenance: "cli-command-authorized"
1260
+ } } : {},
1261
+ ...hostRuntimeLocal && !args.includes("--read-only") ? { claimLocalWrites: true } : {},
1262
+ msgFile: readFlagValue(args, "--msg-file"),
1263
+ message: parsed.message,
1264
+ timeoutMs: parsed.timeoutMs,
1265
+ ...parsed.ephemeral ? { ephemeral: true } : {},
1266
+ ...parsed.dodCommands?.length ? { dodCommands: parsed.dodCommands } : {},
1267
+ output
1268
+ }, {
1269
+ env,
1270
+ homedir: deps.homedir,
1271
+ spawn: deps.spawn,
1272
+ fs: deps.fs,
1273
+ now: deps.now,
1274
+ generateRunId: deps.generateRunId,
1275
+ shellApprovalHost: deps.shellApprovalHost,
1276
+ mcpApprovalHost: deps.mcpApprovalHost
1277
+ });
1254
1278
  output.write(`[nolo] runId=${runId}
1255
1279
  `);
1256
1280
  output.write(`[nolo] pid=${pid ?? "-"}
@@ -1268,12 +1292,12 @@ async function runAgentRunCommandImpl(args, deps) {
1268
1292
  const scopedLayers = [];
1269
1293
  const skillContentBlocks = [];
1270
1294
  if (hostRuntimeLocal && !parsed.background) {
1271
- const policy = { ...hostPolicy(), ...skillAllowedToolOverride !== void 0 ? { allowedToolNames: skillAllowedToolOverride } : {} };
1295
+ const policy = { ...hostPolicy(), ...skillAllowedToolOverride !== undefined ? { allowedToolNames: skillAllowedToolOverride } : {} };
1272
1296
  if (hasRegistry) {
1273
- const { blockedToolNames } = await awaitLocalWriterChild(childRunId, localRuntimeCwd, policy, { env, homedir: deps.homedir, fs: deps.fs });
1297
+ const { blockedToolNames } = await awaitLocalWriterChild2(childRunId, localRuntimeCwd, policy, { env, homedir: deps.homedir, fs: deps.fs });
1274
1298
  parsed.blockedToolNames = blockedToolNames;
1275
1299
  } else if (!policy.readOnly) {
1276
- childRunId = registerLocalForegroundWriter(localRuntimeCwd, policy, agentKey, { env, homedir: deps.homedir, fs: deps.fs, now: deps.now });
1300
+ childRunId = registerLocalForegroundWriter2(localRuntimeCwd, policy, agentKey, { env, homedir: deps.homedir, fs: deps.fs, now: deps.now });
1277
1301
  hasRegistry = true;
1278
1302
  }
1279
1303
  }
@@ -1291,15 +1315,16 @@ async function runAgentRunCommandImpl(args, deps) {
1291
1315
  });
1292
1316
  if (!isSubtask) {
1293
1317
  const agentsMdLayer = readAgentsMdLayerFromDisk(cliCwd);
1294
- if (agentsMdLayer) scopedLayers.push(agentsMdLayer);
1318
+ if (agentsMdLayer)
1319
+ scopedLayers.push(agentsMdLayer);
1295
1320
  skillContentBlocks.push(...buildSkillContextBlocks(skillReferences));
1296
- scopedLayers.push(buildSkillDiscoveryContextLayer(cliCwd));
1321
+ scopedLayers.push(buildSkillDiscoveryContextLayer2(cliCwd));
1297
1322
  scopedLayers.push(buildHostEnvironmentLayer());
1298
1323
  if (!deps.memoryRecallDisabled) {
1299
1324
  try {
1300
1325
  memoryPromptBlock = await resolveCliMemory({
1301
- serverUrl: resolveServerUrl(env),
1302
- authToken: resolveAuthToken(args, env),
1326
+ serverUrl: resolveServerUrl2(env),
1327
+ authToken: resolveAuthToken3(args, env),
1303
1328
  agentKey: effectiveAgentKey,
1304
1329
  userInput: effectiveMessage,
1305
1330
  ...parsed.spaceId ? { spaceId: parsed.spaceId } : {},
@@ -1312,39 +1337,26 @@ async function runAgentRunCommandImpl(args, deps) {
1312
1337
  const workContextBlock = !deps.memoryRecallDisabled && parsed.continueDialogId && !parsed.ephemeral ? await recallVerifiedLocalWork(parsed.continueDialogId) : null;
1313
1338
  memoryOverlayLayer = buildMemoryOverlayLayer({ promptBlock: memoryPromptBlock });
1314
1339
  memoryUseGuidanceLayer = buildMemoryUseGuidanceLayer({ promptBlock: memoryPromptBlock });
1315
- contextBlockScopes.push(
1316
- ...partitionScopedBlocks([
1317
- ...renderTurnContextBlocksWithScope([
1318
- ...scopedLayers,
1319
- memoryUseGuidanceLayer
1320
- ]),
1321
- ...skillContentBlocks.map((content) => content.trim()).filter((content) => content.length > 0).map((content) => ({ content, cacheScope: "turn" })),
1322
- ...renderTurnContextBlocksWithScope([memoryOverlayLayer]),
1323
- ...workContextBlock ? [{ content: workContextBlock, cacheScope: "turn" }] : []
1324
- ])
1325
- );
1340
+ contextBlockScopes.push(...partitionScopedBlocks([
1341
+ ...renderTurnContextBlocksWithScope([
1342
+ ...scopedLayers,
1343
+ memoryUseGuidanceLayer
1344
+ ]),
1345
+ ...skillContentBlocks.map((content) => content.trim()).filter((content) => content.length > 0).map((content) => ({ content, cacheScope: "turn" })),
1346
+ ...renderTurnContextBlocksWithScope([memoryOverlayLayer]),
1347
+ ...workContextBlock ? [{ content: workContextBlock, cacheScope: "turn" }] : []
1348
+ ]));
1326
1349
  extraContextBlocks.push(...contextBlockScopes.map((block) => block.content));
1327
1350
  }
1328
- const runRecordParentDialogId = !parsed.parentDialogId && typeof childRunId === "string" && childRunId.length > 0 ? asOptionalTrimmedString(
1329
- (deps.readRunRecord ?? readRunRecord)(childRunId, {
1330
- env,
1331
- homedir: deps.homedir,
1332
- fs: deps.fs
1333
- })?.parentDialogId
1334
- ) : void 0;
1351
+ const runRecordParentDialogId = !parsed.parentDialogId && typeof childRunId === "string" && childRunId.length > 0 ? asOptionalTrimmedString((deps.readRunRecord ?? readRunRecord2)(childRunId, {
1352
+ env,
1353
+ homedir: deps.homedir,
1354
+ fs: deps.fs
1355
+ })?.parentDialogId) : undefined;
1335
1356
  const effectiveParentDialogId = parsed.parentDialogId ?? runRecordParentDialogId;
1336
- const formatTurnMessage = (msg) => prependWorkflowReferencePrompt(
1337
- prependSubjectDialogMarker(
1338
- prependFeatureWorktreeInstruction(
1339
- prependOutputFormatGuidance(msg),
1340
- parsed.injectFeatureWorktreeInstruction
1341
- ),
1342
- parsed.subjectDialogKey
1343
- ),
1344
- workflowReference
1345
- );
1346
- const mcpApprovalChild = process.connected && typeof process.send === "function" ? createMcpApprovalChild(process) : void 0;
1347
- const shellApprovalChild = process.connected && typeof process.send === "function" ? createShellApprovalChild(process) : void 0;
1357
+ const formatTurnMessage = (msg) => prependWorkflowReferencePrompt(prependSubjectDialogMarker(prependFeatureWorktreeInstruction(prependOutputFormatGuidance(msg), parsed.injectFeatureWorktreeInstruction), parsed.subjectDialogKey), workflowReference);
1358
+ const mcpApprovalChild = process.connected && typeof process.send === "function" ? createMcpApprovalChild(process) : undefined;
1359
+ const shellApprovalChild = process.connected && typeof process.send === "function" ? createShellApprovalChild(process) : undefined;
1348
1360
  try {
1349
1361
  const imageUrls = await normalizeCliRunImages(parsed.imageUrls, normalizeCliImageInput);
1350
1362
  const buildRunOptions = (targetAgentKey, turnMessage = effectiveMessage, turnScopes = contextBlockScopes) => ({
@@ -1362,13 +1374,8 @@ async function runAgentRunCommandImpl(args, deps) {
1362
1374
  } } : {},
1363
1375
  agentName: targetAgentKey,
1364
1376
  agentKey: targetAgentKey,
1365
- // 当前执行链未提供可靠的最终展示能力,按约定使用 unknown(只注入行为段,不猜
1366
- // 宽/窄屏;`stdout.isTTY` 只说明是不是终端,说明不了宽度)。这不表示宿主永远
1367
- // 无法获得尺寸:将来接入时应传展示能力,不应由调用方拼接准则文本。
1368
- // 放在 buildRunOptions 这个唯一构造点上,首轮 / quota fallback / 队列 drain
1369
- // 三处 runner(...) 调用自动一致;远端分支走 server 线,不读该字段。
1370
1377
  responseViewport: "unknown",
1371
- serverUrl: resolveServerUrl(env),
1378
+ serverUrl: resolveServerUrl2(env),
1372
1379
  message: formatTurnMessage(turnMessage),
1373
1380
  imageUrls,
1374
1381
  scriptDir: deps.scriptDir,
@@ -1376,16 +1383,7 @@ async function runAgentRunCommandImpl(args, deps) {
1376
1383
  output,
1377
1384
  ...deps.localRuntimeAdapterFactory ? { localRuntimeAdapterFactory: deps.localRuntimeAdapterFactory } : {},
1378
1385
  ...localRuntimeCwd ? { localRuntimeCwd } : {},
1379
- // `--machine-shell` 强制锁定 server 派发:绑定校验通过后 runtimeMode 一律为
1380
- // "server"(+ requireRemoteDispatch 在派发层再兜一次),既不给 auto→local 早退
1381
- // 留口子,也不受 NOLO_RUNTIME_MODE=local 覆盖(resolveRequestedRuntimeMode 以
1382
- // options.runtimeMode 优先)。这是在唯一构造 runner 参数的入口做的,quota
1383
- // fallback / 重试等复用 buildRunOptions 的路径同样被锁住。
1384
- // 非 machine-shell 时保留本地通道判定:显式 runtimeMode 优先,其次
1385
- // docker/host 本地目标在本地 run 上回落 runtimeMode=local。
1386
1386
  ...parsed.machineShell ? { runtimeMode: "server", requireRemoteDispatch: true } : parsed.runtimeMode ? { runtimeMode: parsed.runtimeMode } : (dockerRuntimeLocal || instaboxRuntimeLocal || hostRuntimeLocal) && isLocalRun ? { runtimeMode: "local" } : {},
1387
- // runtimeKey 与 machine-shell 的组合已在 parseAgentRunArgs 入口显式拒绝,
1388
- // 这里直接透传即可(不再静默丢弃参数)。
1389
1387
  ...parsed.runtimeKey ? { runtimeKey: parsed.runtimeKey } : {},
1390
1388
  ...parsed.dockerWorkspaceMode ? { dockerWorkspaceMode: parsed.dockerWorkspaceMode } : {},
1391
1389
  ...parsed.continueDialogId ? { continueDialogId: parsed.continueDialogId } : {},
@@ -1397,7 +1395,7 @@ async function runAgentRunCommandImpl(args, deps) {
1397
1395
  ...parsed.parentWakeOnTerminal ? { parentWakeOnTerminal: true } : {},
1398
1396
  ...parsed.subjectDialogKey ? { subjectDialogKey: parsed.subjectDialogKey } : {},
1399
1397
  ...parsed.subjectRefs?.length ? { subjectRefs: parsed.subjectRefs } : {},
1400
- ...skillAllowedToolOverride !== void 0 ? { allowedToolNames: skillAllowedToolOverride } : parsed.allowedToolNames?.length ? { allowedToolNames: parsed.allowedToolNames } : {},
1398
+ ...skillAllowedToolOverride !== undefined ? { allowedToolNames: skillAllowedToolOverride } : parsed.allowedToolNames?.length ? { allowedToolNames: parsed.allowedToolNames } : {},
1401
1399
  ...parsed.blockedToolNames?.length ? { blockedToolNames: parsed.blockedToolNames } : {},
1402
1400
  ...machineShellOverride ? { runtimeToolPolicyOverride: machineShellOverride } : {},
1403
1401
  ...activityTracker ? {
@@ -1415,57 +1413,48 @@ async function runAgentRunCommandImpl(args, deps) {
1415
1413
  });
1416
1414
  const freshWorkRecall = !deps.memoryRecallDisabled && !isSubtask && !parsed.continueDialogId && !parsed.ephemeral && !parsed.background && !parsed.spaceId ? { freshLocalWorkRecallQuery: effectiveMessage } : {};
1417
1415
  terminalStatus.working();
1418
- let result = await raceWithWatchdog(
1419
- runner({
1420
- ...buildRunOptions(effectiveAgentKey),
1421
- ...freshWorkRecall,
1422
- ...parsed.freshDialog ? { freshDialog: true } : {},
1423
- ...modelOverride ? { modelOverride } : {},
1424
- // `--reasoning-effort`:本次 run 的有效推理档覆盖(内存生效,不写回记录)。
1425
- ...parsed.reasoningEffort ? { reasoningEffortOverride: parsed.reasoningEffort } : {}
1426
- })
1427
- );
1416
+ let result = await raceWithWatchdog(runner({
1417
+ ...buildRunOptions(effectiveAgentKey),
1418
+ ...freshWorkRecall,
1419
+ ...parsed.freshDialog ? { freshDialog: true } : {},
1420
+ ...modelOverride ? { modelOverride } : {},
1421
+ ...parsed.reasoningEffort ? {
1422
+ reasoningEffortOverride: parsed.reasoningEffort,
1423
+ reasoningEffortOrigin: parsed.reasoningEffortExplicit ? "explicit" : "difficulty"
1424
+ } : {}
1425
+ }));
1428
1426
  clearWatchdogs();
1429
1427
  const runCommandObservations = [...getRunResultHeaderMeta(result).commandObservations ?? []];
1430
1428
  let runCreditsTotal = result.turnCredits;
1431
1429
  let runCacheUsage = summarizeCacheUsageRecords(result.usageRecords);
1432
- if (result.exitCode !== 0 && isQuotaExhaustedError(result.localError) && isLocalRun && parsed.fallbackAgentKeys && parsed.fallbackAgentKeys.length > 0) {
1430
+ if (result.exitCode !== 0 && isQuotaExhaustedError2(result.localError) && isLocalRun && parsed.fallbackAgentKeys && parsed.fallbackAgentKeys.length > 0) {
1433
1431
  const fallbackAgentKey = parsed.fallbackAgentKeys[0];
1434
- output.write(
1435
- `[nolo] quota exhausted on ${agentKey}, falling back to ${fallbackAgentKey}
1436
- `
1437
- );
1438
- const fallbackWorkBlock = result.dialogId && freshWorkRecall.freshLocalWorkRecallQuery !== void 0 ? await recallVerifiedLocalWork(result.dialogId) : null;
1432
+ output.write(`[nolo] quota exhausted on ${agentKey}, falling back to ${fallbackAgentKey}
1433
+ `);
1434
+ const fallbackWorkBlock = result.dialogId && freshWorkRecall.freshLocalWorkRecallQuery !== undefined ? await recallVerifiedLocalWork(result.dialogId) : null;
1439
1435
  const fallbackScopes = fallbackWorkBlock ? [...contextBlockScopes, { content: fallbackWorkBlock, cacheScope: "turn" }] : contextBlockScopes;
1440
- const fallbackResult = await raceWithWatchdog(
1441
- runner({
1442
- ...buildRunOptions(fallbackAgentKey, effectiveMessage, fallbackScopes),
1443
- ...result.dialogId ? { continueDialogId: result.dialogId } : freshWorkRecall
1444
- })
1445
- );
1436
+ const fallbackResult = await raceWithWatchdog(runner({
1437
+ ...buildRunOptions(fallbackAgentKey, effectiveMessage, fallbackScopes),
1438
+ ...result.dialogId ? { continueDialogId: result.dialogId } : freshWorkRecall
1439
+ }));
1446
1440
  clearWatchdogs();
1447
1441
  runCommandObservations.push(...getRunResultHeaderMeta(fallbackResult).commandObservations ?? []);
1448
1442
  if (fallbackResult.exitCode === 0) {
1449
1443
  result = fallbackResult;
1450
1444
  }
1451
- if (fallbackResult.turnCredits !== void 0) {
1445
+ if (fallbackResult.turnCredits !== undefined) {
1452
1446
  runCreditsTotal = (runCreditsTotal ?? 0) + fallbackResult.turnCredits;
1453
1447
  }
1454
- runCacheUsage = mergeCacheUsageSummaries(
1455
- runCacheUsage,
1456
- summarizeCacheUsageRecords(fallbackResult.usageRecords)
1457
- );
1448
+ runCacheUsage = mergeCacheUsageSummaries(runCacheUsage, summarizeCacheUsageRecords(fallbackResult.usageRecords));
1458
1449
  if (fallbackResult.exitCode !== 0) {
1459
1450
  result = {
1460
1451
  ...fallbackResult,
1461
1452
  ...fallbackResult.dialogId || result.dialogId ? { dialogId: fallbackResult.dialogId ?? result.dialogId } : {}
1462
1453
  };
1463
- output.write(
1464
- `[nolo] fallback to ${fallbackAgentKey} also failed: ${fallbackResult.localError instanceof Error ? fallbackResult.localError.message : String(fallbackResult.localError ?? "unknown error")}
1465
- `
1466
- );
1454
+ output.write(`[nolo] fallback to ${fallbackAgentKey} also failed: ${fallbackResult.localError instanceof Error ? fallbackResult.localError.message : String(fallbackResult.localError ?? "unknown error")}
1455
+ `);
1467
1456
  }
1468
- } else if (result.localError instanceof CliProviderQuotaError) {
1457
+ } else if (result.localError instanceof CliProviderQuotaError2) {
1469
1458
  output.write(`
1470
1459
  [nolo] Quota limit hit for ${parsed.agentKey} (CliProviderQuotaError).
1471
1460
  `);
@@ -1476,12 +1465,12 @@ async function runAgentRunCommandImpl(args, deps) {
1476
1465
  output.write(`As the orchestrating agent, decide next based on task and re-dispatch (update task state with this attempt).
1477
1466
  `);
1478
1467
  }
1479
- const queueFilePath = parsed.queueFile ?? (childRunId ? resolveRunQueuePath(childRunId, env, deps.homedir) : void 0);
1468
+ const queueFilePath = parsed.queueFile ?? (childRunId ? resolveRunQueuePath2(childRunId, env, deps.homedir) : undefined);
1480
1469
  const queueFs = deps.fs ?? nodeFs;
1481
1470
  if (queueFilePath && queueFs.existsSync(queueFilePath) && result.dialogId && result.exitCode === 0) {
1482
1471
  const MAX_DRAIN_TURNS = 200;
1483
1472
  let drainTurns = 0;
1484
- const popSingle = deps.popSingleQueueMessage ?? popSingleQueueMessage;
1473
+ const popSingle = deps.popSingleQueueMessage ?? popSingleQueueMessage2;
1485
1474
  while (drainTurns < MAX_DRAIN_TURNS && queueFs.existsSync(queueFilePath)) {
1486
1475
  const nextEntry = await popSingle(queueFilePath, deps);
1487
1476
  if (!nextEntry) {
@@ -1489,25 +1478,22 @@ async function runAgentRunCommandImpl(args, deps) {
1489
1478
  }
1490
1479
  drainTurns += 1;
1491
1480
  try {
1492
- const turnResult = await raceWithWatchdog(
1493
- runner({
1494
- ...buildRunOptions(effectiveAgentKey, nextEntry.text),
1495
- continueDialogId: result.dialogId,
1496
- ...modelOverride ? { modelOverride } : {},
1497
- // `--reasoning-effort`:本次 run 的有效推理档覆盖(内存生效,不写回记录)。
1498
- ...parsed.reasoningEffort ? { reasoningEffortOverride: parsed.reasoningEffort } : {}
1499
- })
1500
- );
1481
+ const turnResult = await raceWithWatchdog(runner({
1482
+ ...buildRunOptions(effectiveAgentKey, nextEntry.text),
1483
+ continueDialogId: result.dialogId,
1484
+ ...modelOverride ? { modelOverride } : {},
1485
+ ...parsed.reasoningEffort ? {
1486
+ reasoningEffortOverride: parsed.reasoningEffort,
1487
+ reasoningEffortOrigin: parsed.reasoningEffortExplicit ? "explicit" : "difficulty"
1488
+ } : {}
1489
+ }));
1501
1490
  clearWatchdogs();
1502
1491
  runCommandObservations.push(...getRunResultHeaderMeta(turnResult).commandObservations ?? []);
1503
1492
  result = turnResult;
1504
- if (turnResult.turnCredits !== void 0) {
1493
+ if (turnResult.turnCredits !== undefined) {
1505
1494
  runCreditsTotal = (runCreditsTotal ?? 0) + turnResult.turnCredits;
1506
1495
  }
1507
- runCacheUsage = mergeCacheUsageSummaries(
1508
- runCacheUsage,
1509
- summarizeCacheUsageRecords(turnResult.usageRecords)
1510
- );
1496
+ runCacheUsage = mergeCacheUsageSummaries(runCacheUsage, summarizeCacheUsageRecords(turnResult.usageRecords));
1511
1497
  if (result.exitCode !== 0) {
1512
1498
  break;
1513
1499
  }
@@ -1523,9 +1509,7 @@ async function runAgentRunCommandImpl(args, deps) {
1523
1509
  }
1524
1510
  }
1525
1511
  if (drainTurns >= MAX_DRAIN_TURNS) {
1526
- console.error(
1527
- `[nolo] Warning: queue drain loop reached defensive limit of ${MAX_DRAIN_TURNS} turns, stopping.`
1528
- );
1512
+ console.error(`[nolo] Warning: queue drain loop reached defensive limit of ${MAX_DRAIN_TURNS} turns, stopping.`);
1529
1513
  }
1530
1514
  }
1531
1515
  if (result.dialogId) {
@@ -1544,22 +1528,21 @@ async function runAgentRunCommandImpl(args, deps) {
1544
1528
  if (acceptanceCwd || shouldPrintLocalRunSummary({ parsed, localRuntimeCwd })) {
1545
1529
  try {
1546
1530
  const inspect = deps.inspectLocalRunWorkspace ?? inspectLocalRunWorkspace;
1547
- const inspection = await inspect(localRuntimeCwd, {}, acceptanceCwd ? acceptanceBase : void 0);
1531
+ const inspection = await inspect(localRuntimeCwd, {}, acceptanceCwd ? acceptanceBase : undefined);
1548
1532
  finalWorkspaceInspection = inspection;
1549
- if (shouldPrintLocalRunSummary({ parsed, localRuntimeCwd })) output.write(formatLocalRunSummary({
1550
- dialogId: result.dialogId,
1551
- inspection
1552
- }));
1533
+ if (shouldPrintLocalRunSummary({ parsed, localRuntimeCwd }))
1534
+ output.write(formatLocalRunSummary({
1535
+ dialogId: result.dialogId,
1536
+ inspection
1537
+ }));
1553
1538
  } catch (error) {
1554
- output.write(
1555
- `
1539
+ output.write(`
1556
1540
  [nolo] local run summary unavailable: ${toErrorMessage(error)}
1557
- `
1558
- );
1541
+ `);
1559
1542
  }
1560
1543
  }
1561
1544
  if (typeof childRunId === "string" && childRunId.length > 0) {
1562
- const childRecordForDoD = (deps.readRunRecord ?? readRunRecord)(childRunId, {
1545
+ const childRecordForDoD = (deps.readRunRecord ?? readRunRecord2)(childRunId, {
1563
1546
  env,
1564
1547
  homedir: deps.homedir,
1565
1548
  fs: deps.fs
@@ -1573,11 +1556,7 @@ async function runAgentRunCommandImpl(args, deps) {
1573
1556
  });
1574
1557
  let dodResults;
1575
1558
  try {
1576
- dodResults = (deps.runDoDCommands ?? runDoDCommands)(
1577
- childRecordForDoD?.dodCommands,
1578
- childRecordForDoD?.cwd,
1579
- { env }
1580
- );
1559
+ dodResults = (deps.runDoDCommands ?? runDoDCommands)(childRecordForDoD?.dodCommands, childRecordForDoD?.cwd, { env });
1581
1560
  } catch (dodError) {
1582
1561
  console.warn(`[nolo] DoD verification failed to run for ${childRunId}:`, dodError);
1583
1562
  }
@@ -1588,7 +1567,7 @@ async function runAgentRunCommandImpl(args, deps) {
1588
1567
  failureReason = "stalled";
1589
1568
  } else if (result.localError && isHistoryIntegrityFailure(toErrorMessage(result.localError))) {
1590
1569
  failureReason = "history_integrity";
1591
- } else if (result.localError && isQuotaExhaustedError(result.localError)) {
1570
+ } else if (result.localError && isQuotaExhaustedError2(result.localError)) {
1592
1571
  failureReason = "provider_rate_limited";
1593
1572
  } else if (result.localError) {
1594
1573
  const errMsg = toErrorMessage(result.localError).toLowerCase();
@@ -1604,11 +1583,9 @@ async function runAgentRunCommandImpl(args, deps) {
1604
1583
  toolCallCount = rawToolCount;
1605
1584
  }
1606
1585
  }
1607
- const acceptance = acceptanceCwd ? finalWorkspaceInspection?.acceptance ?? unknownLocalRunAcceptance(acceptanceCwd, acceptanceBase) : void 0;
1586
+ const acceptance = acceptanceCwd ? finalWorkspaceInspection?.acceptance ?? unknownLocalRunAcceptance(acceptanceCwd, acceptanceBase) : undefined;
1608
1587
  if (acceptance && dodResults?.length) {
1609
1588
  acceptance.checks.observations = dodResults.map((check, index) => ({
1610
- // Command lines/output can contain credentials. Persist only a digest
1611
- // here; the pre-existing registry is the execution evidence reference.
1612
1589
  commandFingerprint: `sha256:${createHash("sha256").update(check.command).digest("hex")}`,
1613
1590
  cwd: childRecordForDoD?.cwd || process.cwd(),
1614
1591
  exitCode: check.exitCode,
@@ -1616,44 +1593,30 @@ async function runAgentRunCommandImpl(args, deps) {
1616
1593
  versionBinding: "unknown"
1617
1594
  }));
1618
1595
  }
1619
- if (acceptance) attachLocalCommandObservations(
1620
- acceptance,
1621
- runCommandObservations,
1622
- `${childRunId}.result.md`
1623
- );
1596
+ if (acceptance)
1597
+ attachLocalCommandObservations(acceptance, runCommandObservations, `${childRunId}.result.md`);
1624
1598
  let settlement;
1625
1599
  try {
1626
- settlement = await settleRunTerminalAuthoritatively(
1627
- childRunId,
1628
- {
1629
- status: outcome.status,
1630
- exitCode: outcome.exitCode,
1631
- dialogId: result.dialogId,
1632
- ...dodResults ? { dodResults } : {},
1633
- // run 级累计的平台积分(主轮 + fallback + drain 轮):dock 行据此显示
1634
- // 「⚡ x.xx」,让派发任务的消耗可见。undefined = 全程无平台计费。
1635
- ...runCreditsTotal !== void 0 ? { credits: runCreditsTotal } : {},
1636
- // run 级缓存命中汇总:只进 .result.md 的 front matter(cached_tokens
1637
- // 为 null 表示 provider 未报缓存指标,与「命中 0」严格区分)。
1638
- ...runCacheUsage ? { cacheUsage: runCacheUsage } : {},
1639
- ...failureReason ? { failureReason } : {},
1640
- ...toolCallCount !== void 0 ? { toolCallCount } : {},
1641
- ...acceptance ? { acceptance } : {},
1642
- ...result.finalText ? { lastAssistantText: result.finalText } : {},
1643
- // 仅用于 .result.md 头(front matter):旁路读取,不改 result 形状。
1644
- ...getRunResultHeaderMeta(result),
1645
- ...truncationNote
1646
- },
1647
- {
1648
- env,
1649
- homedir: deps.homedir,
1650
- fs: deps.fs,
1651
- now: deps.now,
1652
- sleep: deps.sleep
1653
- },
1654
- deps.transitionRunToTerminal,
1655
- { expectedPid: process.pid }
1656
- );
1600
+ settlement = await settleRunTerminalAuthoritatively2(childRunId, {
1601
+ status: outcome.status,
1602
+ exitCode: outcome.exitCode,
1603
+ dialogId: result.dialogId,
1604
+ ...dodResults ? { dodResults } : {},
1605
+ ...runCreditsTotal !== undefined ? { credits: runCreditsTotal } : {},
1606
+ ...runCacheUsage ? { cacheUsage: runCacheUsage } : {},
1607
+ ...failureReason ? { failureReason } : {},
1608
+ ...toolCallCount !== undefined ? { toolCallCount } : {},
1609
+ ...acceptance ? { acceptance } : {},
1610
+ ...result.finalText ? { lastAssistantText: result.finalText } : {},
1611
+ ...getRunResultHeaderMeta(result),
1612
+ ...truncationNote
1613
+ }, {
1614
+ env,
1615
+ homedir: deps.homedir,
1616
+ fs: deps.fs,
1617
+ now: deps.now,
1618
+ sleep: deps.sleep
1619
+ }, deps.transitionRunToTerminal, { expectedPid: process.pid });
1657
1620
  } catch (error) {
1658
1621
  terminalStatus.fail();
1659
1622
  output.write(`[nolo] terminal settlement failed: ${error instanceof Error ? error.message : String(error)}
@@ -1676,22 +1639,8 @@ async function runAgentRunCommandImpl(args, deps) {
1676
1639
  } finally {
1677
1640
  mcpApprovalChild?.close();
1678
1641
  shellApprovalChild?.close();
1679
- if ((shellApprovalChild || mcpApprovalChild) && process.connected) process.disconnect();
1642
+ if ((shellApprovalChild || mcpApprovalChild) && process.connected)
1643
+ process.disconnect();
1680
1644
  }
1681
1645
  }
1682
-
1683
- export {
1684
- emitTerminalProgramStatus,
1685
- resolveWorkflowReference,
1686
- resolveSkillReference,
1687
- buildSkillContextBlocks,
1688
- prependSubjectDialogMarker,
1689
- normalizeCliImageInput,
1690
- buildHostEnvironmentLayer,
1691
- FAILED_EMPTY_ASSISTANT_REASONS,
1692
- isRunResultStalledOrTruncated,
1693
- resolveTerminalProgramStatusState,
1694
- resolveRunOutcome,
1695
- resolveRunSettlementNote,
1696
- runAgentRunCommand
1697
- };
1646
+ export { emitTerminalProgramStatus, resolveSkillReference, buildSkillContextBlocks, buildHostEnvironmentLayer, isRunResultStalledOrTruncated, resolveTerminalProgramStatusState, runAgentRunCommand2 };