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