@qwen-code/qwen-code 0.22.2-preview.1 → 0.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (437) hide show
  1. package/bundled/computer-use/SKILL.md +3 -3
  2. package/bundled/goal-draft/SKILL.md +109 -0
  3. package/bundled/qc-helper/docs/configuration/settings.md +37 -36
  4. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  5. package/bundled/qc-helper/docs/features/channels/dws.md +2 -0
  6. package/bundled/qc-helper/docs/features/channels/overview.md +34 -3
  7. package/bundled/qc-helper/docs/features/code-review.md +3 -3
  8. package/bundled/qc-helper/docs/features/commands.md +2 -1
  9. package/bundled/qc-helper/docs/features/computer-use.md +2 -2
  10. package/bundled/qc-helper/docs/features/goals.md +58 -0
  11. package/bundled/qc-helper/docs/features/headless.md +13 -11
  12. package/bundled/qc-helper/docs/features/status-line.md +3 -3
  13. package/bundled/qc-helper/docs/features/tool-use-summaries.md +1 -1
  14. package/bundled/qc-helper/docs/qwen-serve.md +1 -1
  15. package/bundled/review/SKILL.md +81 -31
  16. package/bundled/review/references/persistence.md +7 -3
  17. package/bundled/review/references/posting.md +10 -4
  18. package/chunks/MaxSizedBox-X42SXBJH.js +110 -0
  19. package/chunks/{StandaloneSessionPicker-5D2L22SF.js → StandaloneSessionPicker-2FJAOLGG.js} +81 -83
  20. package/chunks/{acpAgent-4DCKLA32.js → acpAgent-2ZMIJAFV.js} +1153 -357
  21. package/chunks/{agent-B4AFZL6H.js → agent-X5WX3L2I.js} +44 -46
  22. package/chunks/agent-headless-IZM25LJA.js +85 -0
  23. package/chunks/{anthropicContentGenerator-U76GTVB6.js → anthropicContentGenerator-YVTB6QX7.js} +46 -50
  24. package/chunks/{artifact-tool-XDJCZZCF.js → artifact-tool-XSMPHZBT.js} +11 -3
  25. package/chunks/{askUserQuestion-ZXXERLEV.js → askUserQuestion-4SWJY65V.js} +2 -2
  26. package/chunks/bridge-ME6QXZNA.js +119 -0
  27. package/chunks/{channel-management-service-HXXS3HOZ.js → channel-management-service-HQ6KDS7C.js} +6 -6
  28. package/chunks/channel-settings-store-PEOI7XCG.js +120 -0
  29. package/chunks/{channel-worker-group-EVDC2P4K.js → channel-worker-group-6NA6BBZV.js} +8 -7
  30. package/chunks/{channel-worker-manager-IJJZHGEI.js → channel-worker-manager-NEZ2J6RK.js} +10 -8
  31. package/chunks/{channel-worker-supervisor-YSKB5GVB.js → channel-worker-supervisor-FKU7DIHJ.js} +6 -5
  32. package/chunks/{chunk-7QGEJI7M.js → chunk-23RFD54N.js} +1 -1
  33. package/chunks/{chunk-JLU3FPQR.js → chunk-2HYKTO7V.js} +5 -5
  34. package/chunks/chunk-2LNNVAUV.js +1584 -0
  35. package/chunks/{chunk-FJAITR4L.js → chunk-2OBKDPZZ.js} +2 -2
  36. package/chunks/{chunk-JSY43GMI.js → chunk-2OUD5T67.js} +185 -174
  37. package/chunks/{chunk-LJP2BBMK.js → chunk-2SXSLSQE.js} +4 -4
  38. package/chunks/chunk-2TNL5KPM.js +49 -0
  39. package/chunks/{chunk-XMSMTU6H.js → chunk-2YOHKHYR.js} +4 -4
  40. package/chunks/{chunk-MCKJTBZN.js → chunk-36GSQ3MM.js} +2 -2
  41. package/chunks/chunk-36LGBEM6.js +130 -0
  42. package/chunks/{chunk-ZWKGZB2K.js → chunk-3JXM2CVW.js} +3 -3
  43. package/chunks/{chunk-X3XGCJ32.js → chunk-3SZC4VP4.js} +28 -111
  44. package/chunks/{chunk-ILPXSKGQ.js → chunk-3WK3QDNV.js} +2 -2
  45. package/chunks/{chunk-IKN3IUJP.js → chunk-3XKLXHGK.js} +17 -9
  46. package/chunks/{chunk-ZLTEQYNC.js → chunk-42IDLQWS.js} +26 -20
  47. package/chunks/chunk-4CMJKUND.js +95 -0
  48. package/chunks/{chunk-77TOMRBG.js → chunk-4K7KNVWH.js} +3 -3
  49. package/chunks/{chunk-SQPOJ4ZI.js → chunk-4NDLQAY2.js} +27 -270
  50. package/chunks/{chunk-V3GINY6K.js → chunk-4QHPPXK2.js} +16 -8
  51. package/chunks/{chunk-VBF4KZRQ.js → chunk-4TT3IVGA.js} +1 -1
  52. package/chunks/{chunk-IOGKXPL3.js → chunk-4VPCTGH6.js} +6 -6
  53. package/chunks/chunk-4VQBQLIZ.js +293 -0
  54. package/chunks/{chunk-UCSV2IZW.js → chunk-62GQFYID.js} +3 -3
  55. package/chunks/{chunk-SLEWBQWM.js → chunk-6DIGWMGT.js} +2 -2
  56. package/chunks/{chunk-BRVWYMKV.js → chunk-6MBXY6WM.js} +1 -1
  57. package/chunks/{chunk-PVBT5QPD.js → chunk-6PJOTWAN.js} +1 -1
  58. package/chunks/{chunk-WZ3QKPMQ.js → chunk-6X7EU5TI.js} +19 -31
  59. package/chunks/{chunk-KQYW2GB5.js → chunk-6ZPDLGHN.js} +6 -6
  60. package/chunks/{chunk-AKQA3WCH.js → chunk-734C6JGI.js} +723 -3399
  61. package/chunks/{chunk-F7M6ZFGU.js → chunk-73RM4POK.js} +8 -8
  62. package/chunks/{chunk-ELY4QVIB.js → chunk-7EQQR46F.js} +1 -1
  63. package/chunks/{chunk-KGJGEEVR.js → chunk-7FA2II6K.js} +10 -1
  64. package/chunks/chunk-7J6OTNGO.js +424 -0
  65. package/chunks/{chunk-LWLEPXKK.js → chunk-7LOELM2I.js} +19 -2
  66. package/chunks/{chunk-DIMEPKCW.js → chunk-7S226YTK.js} +1 -1
  67. package/chunks/{chunk-AWFZDYSD.js → chunk-7T52W4SW.js} +1 -1
  68. package/chunks/{chunk-3JKUX4PB.js → chunk-7VMIMAVB.js} +9 -9
  69. package/chunks/{chunk-2MHGD7EE.js → chunk-A3LWD5MK.js} +1 -1
  70. package/chunks/{chunk-E4I5MVBR.js → chunk-ABS25QER.js} +1 -1
  71. package/chunks/{chunk-TDQBVEPK.js → chunk-AIAOIFY4.js} +10 -8
  72. package/chunks/{chunk-NEZZHGEI.js → chunk-AYFA7MZV.js} +6 -6
  73. package/chunks/{chunk-FVDQ5E67.js → chunk-B466ZSHZ.js} +3 -3
  74. package/chunks/{chunk-6US7BF3G.js → chunk-B5PHIJGI.js} +183 -5
  75. package/chunks/{chunk-4TPAG3O7.js → chunk-BFPESSTR.js} +1 -1
  76. package/chunks/{chunk-WBT3STGU.js → chunk-BKWNKLZB.js} +20 -20
  77. package/chunks/{chunk-T45CL2NT.js → chunk-BOWFGCEU.js} +3 -3
  78. package/chunks/{chunk-IPQA4SR5.js → chunk-BWORX6FA.js} +1 -1
  79. package/chunks/{chunk-BKDAF7ES.js → chunk-BXDAPVQU.js} +2 -2
  80. package/chunks/{chunk-ZEADBZLO.js → chunk-C2X7KY45.js} +3 -3
  81. package/chunks/{chunk-PTQF7WRA.js → chunk-C3PEFRKD.js} +6 -6
  82. package/chunks/{chunk-7OBH4AM2.js → chunk-CAJTKR6W.js} +5 -5
  83. package/chunks/{chunk-2FN2HNTI.js → chunk-CFJY4DGX.js} +2 -2
  84. package/chunks/{chunk-SUE2ZMUH.js → chunk-CIZCL2MW.js} +49 -31
  85. package/chunks/{chunk-W2WRNJKX.js → chunk-CLWO3B77.js} +6 -6
  86. package/chunks/{chunk-U45D46O5.js → chunk-CMHFCLBU.js} +1 -1
  87. package/chunks/{chunk-LRKMQPMD.js → chunk-CQH5KTKC.js} +1 -1
  88. package/chunks/{chunk-JECO75XD.js → chunk-D5LUXLUH.js} +2 -2
  89. package/chunks/chunk-DJBQCO2E.js +842 -0
  90. package/chunks/{chunk-BQBUZDDH.js → chunk-DJECZIJX.js} +42 -42
  91. package/chunks/{chunk-GTUZ3R6I.js → chunk-DJEZ55D4.js} +351 -113
  92. package/chunks/{chunk-HPECDZ6X.js → chunk-DJPASAUV.js} +3866 -1077
  93. package/chunks/{chunk-VYWCFWI5.js → chunk-DMLVSW7L.js} +542 -654
  94. package/chunks/{chunk-EB4VDXNI.js → chunk-DYXFD5RO.js} +182 -3
  95. package/chunks/{chunk-ZKAZP2ZG.js → chunk-EB6QRGHM.js} +3 -3
  96. package/chunks/{chunk-UWICO5KN.js → chunk-EFWRMA2I.js} +3 -3
  97. package/chunks/{chunk-3UZCLCXR.js → chunk-EKSCLBBF.js} +3 -3
  98. package/chunks/{chunk-ALTQLFEG.js → chunk-EQSBPBZ3.js} +5 -194
  99. package/chunks/{chunk-624NHDGB.js → chunk-ERFDKH32.js} +11 -0
  100. package/chunks/{chunk-4K44OMLI.js → chunk-FROAFEFB.js} +3 -3
  101. package/chunks/{chunk-MZS7GEC7.js → chunk-FTF2YIZ5.js} +1 -1
  102. package/chunks/{chunk-Z7VOMGDC.js → chunk-FTJMWDND.js} +0 -24
  103. package/chunks/{chunk-ZJG323IA.js → chunk-G6FECKTJ.js} +7 -5
  104. package/chunks/{chunk-TMGAS5TO.js → chunk-GBJBJ4HX.js} +26 -4
  105. package/chunks/{chunk-UCQOSV6A.js → chunk-GPGU4S2N.js} +3 -3
  106. package/chunks/{chunk-BHTJAO36.js → chunk-GVIVASYK.js} +7 -7
  107. package/chunks/chunk-H72BQNM3.js +645 -0
  108. package/chunks/{chunk-Z4X5MTRT.js → chunk-HCOBAG2L.js} +2 -4
  109. package/chunks/{chunk-FCSWZAS3.js → chunk-HP5LR5HL.js} +5 -5
  110. package/chunks/{chunk-7JPW6IYH.js → chunk-HVC3PNVC.js} +1 -1
  111. package/chunks/{chunk-OI2DR6QB.js → chunk-I6LYRJPB.js} +3 -3
  112. package/chunks/{chunk-E55H6BZ7.js → chunk-ICURCKIU.js} +1335 -119
  113. package/chunks/{chunk-PAJGKZAA.js → chunk-ISKH4QX3.js} +14 -12
  114. package/chunks/{chunk-AYVIGUUK.js → chunk-JB4JIVTJ.js} +1 -1
  115. package/chunks/{chunk-FN5C6C7G.js → chunk-JHYH6PYQ.js} +192 -478
  116. package/chunks/{chunk-T6OODF2U.js → chunk-JWALNCLT.js} +1 -1
  117. package/chunks/{chunk-SKNVVYIJ.js → chunk-K5KXUXWC.js} +3 -3
  118. package/chunks/{chunk-XUX6O2ZT.js → chunk-KID24ZFN.js} +4 -1
  119. package/chunks/{chunk-I6DY753S.js → chunk-KJO2LBUK.js} +944 -18
  120. package/chunks/{chunk-5T4LWWNX.js → chunk-KYWTPLBJ.js} +18 -21
  121. package/chunks/{chunk-CZFQ62RM.js → chunk-LHBUKJG2.js} +4 -4
  122. package/chunks/{chunk-TOF4UZHH.js → chunk-LUEHOUHM.js} +3 -3
  123. package/chunks/{chunk-2YDYDDE2.js → chunk-M3QRM3DE.js} +3 -3
  124. package/chunks/{chunk-GNMJNDZE.js → chunk-M6FOJXW3.js} +1 -1
  125. package/chunks/{chunk-ZGWDHSUM.js → chunk-MF7HCQWZ.js} +4 -4
  126. package/chunks/{chunk-66GIFJ63.js → chunk-MK2GIB46.js} +1 -1
  127. package/chunks/{chunk-TFV4RXPU.js → chunk-MO3FC2WT.js} +1 -1
  128. package/chunks/{chunk-TR7G7XFQ.js → chunk-MPNBVAEU.js} +5 -5
  129. package/chunks/{chunk-K3LPAED5.js → chunk-MQM5PJML.js} +24 -4
  130. package/chunks/{chunk-3WBMPR3S.js → chunk-MSBO7X2W.js} +1 -1
  131. package/chunks/{chunk-5PA6UEYA.js → chunk-MZCJWS5Y.js} +1 -1
  132. package/chunks/{chunk-BGXZBI5B.js → chunk-N4X7G4J2.js} +2 -1
  133. package/chunks/{chunk-27ONXAFY.js → chunk-NIFYWDYN.js} +1 -1
  134. package/chunks/{chunk-AP7WZONS.js → chunk-NMOD2FXQ.js} +19 -9
  135. package/chunks/{chunk-IJVDHPKD.js → chunk-NU7RKEZR.js} +2 -2
  136. package/chunks/{chunk-5URK47RN.js → chunk-NV55WWD6.js} +11595 -10375
  137. package/chunks/{chunk-HABT2Z7R.js → chunk-OU5APVWO.js} +4 -4
  138. package/chunks/{chunk-QR4AHMGQ.js → chunk-P2G476QN.js} +13 -13
  139. package/chunks/{chunk-5SM2AK65.js → chunk-PADPMMYM.js} +5 -5
  140. package/chunks/{chunk-RRKNX553.js → chunk-PDQGMSZK.js} +1 -1
  141. package/chunks/{chunk-GTUKW3I6.js → chunk-PPKZ7JOE.js} +1 -1
  142. package/chunks/{chunk-SAH4BD2J.js → chunk-PQEISIKS.js} +67 -0
  143. package/chunks/{chunk-XIRDDFRS.js → chunk-PZ66FRIC.js} +2644 -2296
  144. package/chunks/{chunk-H3HZ4AWW.js → chunk-Q2MSPKIJ.js} +1 -1
  145. package/chunks/{chunk-WEGXPP5E.js → chunk-QFCDF5PL.js} +1 -1
  146. package/chunks/{chunk-OF2DPXUS.js → chunk-QYMAKPY5.js} +119 -24
  147. package/chunks/{chunk-JVPFTDBK.js → chunk-RFIDDFAL.js} +1 -1
  148. package/chunks/chunk-RKFGE7JH.js +93 -0
  149. package/chunks/{chunk-CPPYZHBN.js → chunk-RU7BK6B3.js} +1 -1
  150. package/chunks/chunk-SEONHUS3.js +275 -0
  151. package/chunks/{chunk-DEYPMJPD.js → chunk-SMPR7SPO.js} +1 -1
  152. package/chunks/chunk-SS4MRMKE.js +3525 -0
  153. package/chunks/{chunk-BPMVPWBT.js → chunk-SS5SDCD3.js} +6 -6
  154. package/chunks/{chunk-J3CBIEDS.js → chunk-ST5MDGH3.js} +32 -15
  155. package/chunks/{chunk-J5352S3S.js → chunk-ST5V3ZOC.js} +3 -3
  156. package/chunks/{chunk-7CWEZQ6T.js → chunk-STUJ7IMZ.js} +0 -77
  157. package/chunks/{chunk-4K7NQDCG.js → chunk-T4EFG2P5.js} +18 -9
  158. package/chunks/{chunk-TWSKM647.js → chunk-T7KMERIX.js} +1 -1
  159. package/chunks/{chunk-5CMWFBML.js → chunk-TEBDFQBZ.js} +1 -1
  160. package/chunks/{chunk-EC5BONC3.js → chunk-TPI7O7HR.js} +1 -1
  161. package/chunks/{chunk-T2CRBIDJ.js → chunk-TTX2JUE6.js} +1 -1
  162. package/chunks/{chunk-VOEMVOM4.js → chunk-TVC6HQ2U.js} +2 -2
  163. package/chunks/{chunk-WXDZZFH3.js → chunk-TZBSGJ6C.js} +6 -6
  164. package/chunks/chunk-U54AYGEC.js +337 -0
  165. package/chunks/{chunk-2NNTE2ED.js → chunk-UHQFIS7N.js} +15 -0
  166. package/chunks/{chunk-76WGY6LW.js → chunk-URE3QBBB.js} +3 -3
  167. package/chunks/{chunk-KOJ6MHD5.js → chunk-UTLCH2FK.js} +1 -1
  168. package/chunks/{chunk-7DPKPBOQ.js → chunk-V2NDP3I4.js} +2 -2
  169. package/chunks/{chunk-FJWICLG7.js → chunk-V4264FEG.js} +9 -9
  170. package/chunks/{chunk-XR7OIAQF.js → chunk-V5J4J5TP.js} +2 -2
  171. package/chunks/{chunk-7UJTY5V3.js → chunk-V7EESTJV.js} +1 -1
  172. package/chunks/{chunk-Z6L3C4VF.js → chunk-VBCPNIQD.js} +39 -39
  173. package/chunks/{chunk-ATLGYSYH.js → chunk-VGIFXISB.js} +4 -4
  174. package/chunks/{chunk-X2UOOG5V.js → chunk-VQUGEVGR.js} +1 -1
  175. package/chunks/{chunk-XJS54K4A.js → chunk-VTHREBQM.js} +2 -2
  176. package/chunks/{chunk-AA7VBRBG.js → chunk-W3JH33JE.js} +8 -8
  177. package/chunks/{chunk-FPH6TXD3.js → chunk-WAOIHTJS.js} +1 -1
  178. package/chunks/{chunk-CDUN63IN.js → chunk-WGY3AVGM.js} +3 -3
  179. package/chunks/{chunk-JLGFGPZJ.js → chunk-WNPDGUJO.js} +22 -3
  180. package/chunks/{chunk-O3BUXIPM.js → chunk-WXEA74YB.js} +3 -3
  181. package/chunks/{chunk-YRLW2MSX.js → chunk-XBVNNDPK.js} +11 -4
  182. package/chunks/{chunk-VL4YX3FH.js → chunk-XF63PKEN.js} +1 -1
  183. package/chunks/{chunk-R7G7GKOX.js → chunk-XHF7WQ6B.js} +3 -3
  184. package/chunks/{chunk-3FSBMAYD.js → chunk-XQFT3QUF.js} +1 -1
  185. package/chunks/{chunk-3D6PDLNJ.js → chunk-XSG6G3G6.js} +49 -32
  186. package/chunks/{chunk-5JCZ3UKB.js → chunk-Y5S7LBOZ.js} +44 -7
  187. package/chunks/{chunk-OLS3MAXQ.js → chunk-YLSQLSH7.js} +15 -9
  188. package/chunks/{chunk-2SERYG4T.js → chunk-YTDVNSUQ.js} +1 -1
  189. package/chunks/{chunk-KPF2K55D.js → chunk-ZEYFMJQA.js} +39 -8
  190. package/chunks/{chunk-OT4YKUUV.js → chunk-ZU4UDIWX.js} +2 -2
  191. package/chunks/chunk-ZWJDJ6RU.js +2597 -0
  192. package/chunks/{chunk-R3T33BG5.js → chunk-ZYMLPEZQ.js} +3 -3
  193. package/chunks/{chunk-DID6IRGC.js → chunk-ZZMSC3RG.js} +56 -39
  194. package/chunks/{chunk-L436XFLJ.js → chunk-ZZUKP7HV.js} +1 -1
  195. package/chunks/config-utils-R6M3TA34.js +113 -0
  196. package/chunks/contextCommand-ZCAP23J6.js +106 -0
  197. package/chunks/{core-runtime-CEJRHCRF.js → core-runtime-AXB6SK5D.js} +59 -61
  198. package/chunks/{create-sub-session-RVHSWVAP.js → create-sub-session-23ITIELI.js} +3 -3
  199. package/chunks/{create-sub-session-DFZVIG56.js → create-sub-session-4QNE64MR.js} +164 -85
  200. package/chunks/{cron-create-IJGVR5R2.js → cron-create-KJ4IY6PP.js} +57 -10
  201. package/chunks/{cron-delete-4N5BI6GL.js → cron-delete-MBLQCAYY.js} +4 -4
  202. package/chunks/{cron-list-2CATIPUX.js → cron-list-DWH2PQ47.js} +4 -4
  203. package/chunks/{daemon-NAYK4XXU.js → daemon-3GNHB3M2.js} +523 -8
  204. package/chunks/{daemon-git-worktree-guard-L6ZUFKF7.js → daemon-git-worktree-guard-IVAJJWYK.js} +56 -58
  205. package/chunks/daemon-status-provider-K3SJ5C2U.js +117 -0
  206. package/chunks/daemon-trust-policy-DOR3YG62.js +112 -0
  207. package/chunks/{daemon-trust-policy-monitor-2G3EKQEU.js → daemon-trust-policy-monitor-KGGROSIV.js} +64 -66
  208. package/chunks/deferred-core-runtime-WOYLUQQ7.js +114 -0
  209. package/chunks/{display-image-6KHQNEAE.js → display-image-BE7I6ZB6.js} +5 -5
  210. package/chunks/{dist-DJBNNPLN.js → dist-4WXLCBDR.js} +1 -1
  211. package/chunks/{dist-TJUDJTCB.js → dist-5VXFRTWU.js} +280 -48
  212. package/chunks/{dist-6H6RZ5H6.js → dist-6BPYWHVD.js} +89 -65
  213. package/chunks/{dist-ZBVOXSKF.js → dist-GFN5DCBX.js} +74 -65
  214. package/chunks/{dist-SATKXKUR.js → dist-HZNT6GQS.js} +1 -1
  215. package/chunks/{dist-FVJZSIO4.js → dist-LVZCXVPF.js} +72 -20
  216. package/chunks/{dist-7CKN54NL.js → dist-N6W6E753.js} +71 -64
  217. package/chunks/{dist-4Q7NTUNB.js → dist-NSV4NBPK.js} +31 -14
  218. package/chunks/{dist-UQUFZDIY.js → dist-SWQMYP2Q.js} +18 -16
  219. package/chunks/earlyInputCapture-OHBEVO4K.js +107 -0
  220. package/chunks/{edit-ZERGX3RV.js → edit-LEQLAGPZ.js} +45 -47
  221. package/chunks/{en-6MDBWMTG.js → en-YLXBXM4Z.js} +2 -1
  222. package/chunks/{enter-worktree-UOZ6ZTP7.js → enter-worktree-35QCAAFP.js} +7 -7
  223. package/chunks/{enterPlanMode-W2RP3P5B.js → enterPlanMode-ONQN3WHE.js} +47 -49
  224. package/chunks/{environment-ZBJ23YVR.js → environment-UANTR7A4.js} +60 -62
  225. package/chunks/errors-WAK6KFBC.js +113 -0
  226. package/chunks/{exit-worktree-G2QATUCV.js → exit-worktree-XQD6D543.js} +7 -7
  227. package/chunks/exitPlanMode-UEYBG6P5.js +83 -0
  228. package/chunks/{fast-path-4MWBCEUF.js → fast-path-WUL7UZ6H.js} +7 -7
  229. package/chunks/{fast-path-settings-XMFBYFUH.js → fast-path-settings-XH426LUU.js} +3 -3
  230. package/chunks/{glob-DKTNG32L.js → glob-Y54QUWDY.js} +44 -46
  231. package/chunks/{goal-tools-CNVXMSZD.js → goal-tools-PTD3MBA7.js} +10 -8
  232. package/chunks/{grep-3NLSS32D.js → grep-5GPICQBU.js} +6 -6
  233. package/chunks/handleAutoUpdate-FP3NWNSG.js +109 -0
  234. package/chunks/i18n-INIU5X7A.js +124 -0
  235. package/chunks/{image-gen-63NN2H5N.js → image-gen-J6FDGUZP.js} +8 -10
  236. package/chunks/initializer-TYODV6GE.js +113 -0
  237. package/chunks/installationInfo-AAPKYDSZ.js +107 -0
  238. package/chunks/{keychain-token-storage-3MGFRYGM.js → keychain-token-storage-37XPR34V.js} +2 -2
  239. package/chunks/list-TUODDN6J.js +116 -0
  240. package/chunks/{list-agents-EXRSHIDJ.js → list-agents-DI3YFTDT.js} +2 -2
  241. package/chunks/{gemini-X5GQHQYF.js → llm-NSAVK5V3.js} +117 -114
  242. package/chunks/{geminiContentGenerator-UDSWXZXL.js → llm-content-generator-AY2QKXHE.js} +29 -29
  243. package/chunks/loadedSettingsAdapter-KJCLZ3C4.js +110 -0
  244. package/chunks/{loggingContentGenerator-73C7TKDK.js → loggingContentGenerator-DSFQHXIF.js} +328 -37
  245. package/chunks/{loop-wakeup-XBPB2BRO.js → loop-wakeup-XJFONSQ7.js} +5 -5
  246. package/chunks/{ls-WFONAND2.js → ls-3VAT2J7A.js} +4 -4
  247. package/chunks/{lsp-DUKPDUXN.js → lsp-5W7IRUBH.js} +2 -2
  248. package/chunks/{managed-npm-update-H2KOLQZU.js → managed-npm-update-TSWENTK5.js} +57 -59
  249. package/chunks/mcp-MWSAPFOL.js +110 -0
  250. package/chunks/{monitor-TGCMNJJH.js → monitor-RW4GWJHB.js} +44 -46
  251. package/chunks/nonInteractiveCli-JXKL343Q.js +185 -0
  252. package/chunks/{notebook-edit-YEUNZYDX.js → notebook-edit-CQNYS5OR.js} +45 -47
  253. package/chunks/{open-with-auth-4UI3KHUR.js → open-with-auth-YN3QZHVM.js} +1 -1
  254. package/chunks/{openaiContentGenerator-J7LD4VSL.js → openaiContentGenerator-J6QIF7EX.js} +26 -28
  255. package/chunks/pidfile-QOIQZFT2.js +111 -0
  256. package/chunks/process-registry-OAEG6WGC.js +662 -0
  257. package/chunks/{processUtils-ZHFC7CSL.js → processUtils-GPHNANKZ.js} +2 -2
  258. package/chunks/prompt-terminal-ledger-FOMFTYOM.js +105 -0
  259. package/chunks/{qwenContentGenerator-YEWWK3JQ.js → qwenContentGenerator-WWDXPYQI.js} +49 -51
  260. package/chunks/{qwenOAuth2-JIYAWXTW.js → qwenOAuth2-OF5WRBQT.js} +7 -9
  261. package/chunks/{read-file-ZQI3WPVK.js → read-file-FQUQHC6N.js} +13 -13
  262. package/chunks/{read-mcp-resource-7A7NFSFL.js → read-mcp-resource-XD257PGJ.js} +2 -2
  263. package/chunks/{record-artifact-CPJ4IJSD.js → record-artifact-VW23GS4F.js} +4 -4
  264. package/chunks/{report-findings-VFM5DENC.js → report-findings-AO5VYFLR.js} +9 -5
  265. package/chunks/{request-shutdown-6IW46GD7.js → request-shutdown-BCLA3JV2.js} +7 -7
  266. package/chunks/resumeHistoryUtils-NSGF3UCB.js +118 -0
  267. package/chunks/ripGrep-4CAT6SKV.js +39 -0
  268. package/chunks/{run-qwen-serve-WHWU7NZ6.js → run-qwen-serve-5X6IDZER.js} +371 -357
  269. package/chunks/{runtime-E7BSPWQP.js → runtime-HK27GMPF.js} +69 -71
  270. package/chunks/scheduled-tasks-MN2ZZ5P6.js +127 -0
  271. package/chunks/{scheduler-TJPATFOM.js → scheduler-WD4MHMO5.js} +58 -60
  272. package/chunks/{sdk-exporters-http-XXSKBD2C.js → sdk-exporters-http-TTU2CHBU.js} +2 -2
  273. package/chunks/{sdk-impl-VPNBLV7I.js → sdk-impl-UUMVYMAL.js} +11 -5
  274. package/chunks/{send-message-OXZK6USO.js → send-message-AJ4OCUBV.js} +25 -9
  275. package/chunks/serve-2XCHPPGG.js +118 -0
  276. package/chunks/{server-AXCN7QBJ.js → server-GO2N5DH7.js} +6080 -4964
  277. package/chunks/{session-HO4US3AG.js → session-IFNHTUBT.js} +112 -112
  278. package/chunks/session-pr-refresh-I3UBWMVP.js +364 -0
  279. package/chunks/{settings-B2PFJJN4.js → settings-L6N54CU6.js} +63 -65
  280. package/chunks/{shell-7XMSANI3.js → shell-4Y5LLW6N.js} +44 -46
  281. package/chunks/{skill-NL3VH562.js → skill-YOWTRAKQ.js} +68 -24
  282. package/chunks/skill-settings-ZL4JY5UE.js +118 -0
  283. package/chunks/spawnChannel-ZST6XJVJ.js +112 -0
  284. package/chunks/standalone-update-THVU3OKY.js +118 -0
  285. package/chunks/{startInteractiveUI-G2XKSCQ7.js → startInteractiveUI-XDFSHBZD.js} +3076 -2475
  286. package/chunks/{stdioHelpers-7A2EE64Z.js → stdioHelpers-AY6XCDY2.js} +3 -1
  287. package/chunks/{syntheticOutput-5AJ444QT.js → syntheticOutput-ML43GEFN.js} +3 -3
  288. package/chunks/{task-create-TY7P6UHG.js → task-create-QN4LYRSE.js} +11 -11
  289. package/chunks/{task-list-BELMPA75.js → task-list-JPLGK45U.js} +5 -5
  290. package/chunks/{task-stop-U3S3KZG2.js → task-stop-CXEH5L2D.js} +2 -2
  291. package/chunks/{task-update-O4IGDPCK.js → task-update-IWEOJFV2.js} +11 -11
  292. package/chunks/{team-create-IYBUOORE.js → team-create-OOPXCDBA.js} +44 -46
  293. package/chunks/{team-delete-YWFXX77L.js → team-delete-RZVVSGCY.js} +5 -5
  294. package/chunks/{team-plan-approval-YKU57LBM.js → team-plan-approval-DSX5EWAT.js} +44 -46
  295. package/chunks/terminal-image-renderer-KS25G33E.js +114 -0
  296. package/chunks/theme-manager-YMZNG45F.js +102 -0
  297. package/chunks/{todoWrite-435EO2CS.js → todoWrite-WDJNQEMW.js} +43 -25
  298. package/chunks/{tool-search-4Q3KASIQ.js → tool-search-J5Q6U7DN.js} +22 -22
  299. package/chunks/total-session-admission-PVN64JVV.js +114 -0
  300. package/chunks/trustedFolders-FATSC4YI.js +122 -0
  301. package/chunks/{types-WYCFCEHR.js → types-HKLPXZB3.js} +1 -3
  302. package/chunks/{update-relaunch-4DC2KKFS.js → update-relaunch-SIKHLHVR.js} +6 -6
  303. package/chunks/updateCheck-D3YG2WCD.js +118 -0
  304. package/chunks/useAutoAcceptIndicator-ILINOSAS.js +120 -0
  305. package/chunks/{validateNonInterActiveAuth-YAE4YPO3.js → validateNonInterActiveAuth-JUDQP6V4.js} +105 -105
  306. package/chunks/{version-QFP7OGWX.js → version-C63GDDWN.js} +1 -1
  307. package/chunks/{web-fetch-6T23IK6Q.js → web-fetch-FOQZMNSC.js} +16 -18
  308. package/chunks/{web-search-WBWTCZK2.js → web-search-PUJTBFUC.js} +9 -11
  309. package/chunks/{web-shell-static-A6QMUNNV.js → web-shell-static-HNB4FDOE.js} +2 -2
  310. package/chunks/{workflow-FMAA3D4R.js → workflow-Y5IPINVH.js} +128 -94
  311. package/chunks/workspace-providers-status-IJ4VHFMB.js +114 -0
  312. package/chunks/{workspace-registration-store-CMMX7EPX.js → workspace-registration-store-SMJWI2AI.js} +1 -1
  313. package/chunks/workspace-registry-BTGZIMPK.js +123 -0
  314. package/chunks/workspace-service-SIN67ITC.js +126 -0
  315. package/chunks/workspace-skills-status-F3RKCUIX.js +113 -0
  316. package/chunks/{workspace-trust-reconciler-PJDQUTJL.js → workspace-trust-reconciler-PLIDLJZX.js} +72 -72
  317. package/chunks/write-file-PAIGB33C.js +88 -0
  318. package/chunks/{zh-TW-MV4FWFB6.js → zh-TW-RPTMRTHG.js} +2 -1
  319. package/chunks/{zh-X3WGU6SI.js → zh-UNY63FR3.js} +2 -1
  320. package/chunks/{zoom-image-WVYVFRXF.js → zoom-image-LYQD7BQA.js} +13 -13
  321. package/cli.js +16 -16
  322. package/locales/en.js +2 -0
  323. package/locales/zh-TW.js +2 -0
  324. package/locales/zh.js +2 -0
  325. package/package.json +3 -3
  326. package/web-shell/assets/{abnfDiagram-VCTEODGH-d-8xa8uz.js → abnfDiagram-VCTEODGH-TRCMSA_6.js} +1 -1
  327. package/web-shell/assets/{arc-BhB7CrGK.js → arc-D9Uls5b3.js} +1 -1
  328. package/web-shell/assets/{architectureDiagram-5GKGNRK7-BDCd_IcJ.js → architectureDiagram-5GKGNRK7-Bwb8jPXg.js} +1 -1
  329. package/web-shell/assets/{blockDiagram-NRAW4CY4-C-AHu6mi.js → blockDiagram-NRAW4CY4-DHj71TSX.js} +1 -1
  330. package/web-shell/assets/{c4Diagram-UCG6FXSJ-CFjQt0vl.js → c4Diagram-UCG6FXSJ-uKBBdbyr.js} +1 -1
  331. package/web-shell/assets/channel-CXjVLaBa.js +1 -0
  332. package/web-shell/assets/{chunk-2Q5K7J3B-DRjwqaDq.js → chunk-2Q5K7J3B-BZd0Phrl.js} +1 -1
  333. package/web-shell/assets/{chunk-5VM5RSS4-eHM9noJE.js → chunk-5VM5RSS4-7KNeNBqN.js} +1 -1
  334. package/web-shell/assets/{chunk-F27PBJKO-CcSWUYn1.js → chunk-F27PBJKO-BeboS7Fi.js} +1 -1
  335. package/web-shell/assets/{chunk-G27WJ6UU-DNr-RF5S.js → chunk-G27WJ6UU-RV3JONoj.js} +1 -1
  336. package/web-shell/assets/{chunk-JWPE2WC7-rVJHoNF8.js → chunk-JWPE2WC7-Yw9FCFsP.js} +1 -1
  337. package/web-shell/assets/{chunk-LCL6LL3I-B2aX0Gzy.js → chunk-LCL6LL3I-GIMnydDe.js} +1 -1
  338. package/web-shell/assets/{chunk-POPQ4Y6H-DVp07n32.js → chunk-POPQ4Y6H-Cfrux7bL.js} +1 -1
  339. package/web-shell/assets/{chunk-SVP7TREG-C6QB_KUr.js → chunk-SVP7TREG-BlvIN0CO.js} +1 -1
  340. package/web-shell/assets/{chunk-XXDRQBXY-CLVxDNCy.js → chunk-XXDRQBXY-DMs7Rr4t.js} +1 -1
  341. package/web-shell/assets/classDiagram-DTDB5LWJ-DANEijO3.js +1 -0
  342. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DANEijO3.js +1 -0
  343. package/web-shell/assets/{cose-bilkent-JH36ORCC-B_aKX3A3.js → cose-bilkent-JH36ORCC-DNGqTNwI.js} +1 -1
  344. package/web-shell/assets/{cynefin-OW5HDTMX-BBw2pPUa.js → cynefin-OW5HDTMX-CojMpaoH.js} +1 -1
  345. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-WWPiBTwk.js → cynefinDiagram-5FMLGOSQ-DF07YXGo.js} +1 -1
  346. package/web-shell/assets/{dagre-3AP2YEHR-CPtIdka-.js → dagre-3AP2YEHR-17-4WtCH.js} +1 -1
  347. package/web-shell/assets/{diagram-S7CK7UJ4-Dj5og1Xi.js → diagram-S7CK7UJ4-G3Wuyz9m.js} +1 -1
  348. package/web-shell/assets/{diagram-UQ7AKVKN-CC_x70YC.js → diagram-UQ7AKVKN-nyWIKZ8P.js} +1 -1
  349. package/web-shell/assets/{diagram-VSXAHHWV-rXMfsO4n.js → diagram-VSXAHHWV-tKHhmYSC.js} +1 -1
  350. package/web-shell/assets/{diagram-VX7I27RA-DEmLYQbh.js → diagram-VX7I27RA-CpDf1hYk.js} +1 -1
  351. package/web-shell/assets/{diagram-Z3DM3KII-B0ys6Vxx.js → diagram-Z3DM3KII-Cah2IFXG.js} +1 -1
  352. package/web-shell/assets/{ebnfDiagram-PWID7BFC-Bq6y6lKH.js → ebnfDiagram-PWID7BFC-DNaCkgxy.js} +1 -1
  353. package/web-shell/assets/{erDiagram-SSCWMZ5O-l69JeBZ4.js → erDiagram-SSCWMZ5O-CAdRgcf1.js} +1 -1
  354. package/web-shell/assets/{flowDiagram-A5DVABFB-Cm-EzGY4.js → flowDiagram-A5DVABFB-CMUJAShL.js} +1 -1
  355. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-BRS9ZOp7.js → ganttDiagram-EL5Y4UJY-o-_MUNey.js} +1 -1
  356. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DAMRKgLk.js → gitGraphDiagram-WWUBYQGX-_aG-2Z7O.js} +1 -1
  357. package/web-shell/assets/{index-Bncx8E8M.js → index-BK_NKxiJ.js} +1 -1
  358. package/web-shell/assets/index-Ci-z4zWY.js +1913 -0
  359. package/web-shell/assets/index-LDlXZRHA.css +36 -0
  360. package/web-shell/assets/{infoDiagram-RXCK75RN-DasffaZp.js → infoDiagram-RXCK75RN-qJPeZbGP.js} +1 -1
  361. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-CmRUt3C-.js → ishikawaDiagram-5VMMS53U-7Om4vNo1.js} +1 -1
  362. package/web-shell/assets/{journeyDiagram-EYS64GPL-DzhE_c1Z.js → journeyDiagram-EYS64GPL-BNtXqmBW.js} +1 -1
  363. package/web-shell/assets/{kanban-definition-3QL26DDD-BH5b6nn3.js → kanban-definition-3QL26DDD-COgFec8P.js} +1 -1
  364. package/web-shell/assets/{layout-BxoLK-LY.js → layout-B9n81PC9.js} +1 -1
  365. package/web-shell/assets/{linear-CqDPvVI7.js → linear-Bb6nXZQq.js} +1 -1
  366. package/web-shell/assets/{mermaid.core-DBoN4plo.js → mermaid.core-Cgrm3JVT.js} +6 -6
  367. package/web-shell/assets/{mindmap-definition-FBJOCRG2-DJJtXPEM.js → mindmap-definition-FBJOCRG2-TKwLTjnG.js} +1 -1
  368. package/web-shell/assets/{pegDiagram-XKGWAZYB-DmgPXP5l.js → pegDiagram-XKGWAZYB-BJPuvlpi.js} +1 -1
  369. package/web-shell/assets/{pieDiagram-E7YTZNPT-1ezjzcI5.js → pieDiagram-E7YTZNPT-D01VkNsW.js} +1 -1
  370. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-ChKARz3k.js → quadrantDiagram-AXDQQJYC-C4hHsiv-.js} +1 -1
  371. package/web-shell/assets/{railroadDiagram-O6MQD6OU-k7mNB_QT.js → railroadDiagram-O6MQD6OU-CuEO4xK2.js} +1 -1
  372. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-B0XFsii0.js → requirementDiagram-EFPCY7ZU-D5J_vIo5.js} +1 -1
  373. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-repJ2Ukk.js → sankeyDiagram-P5KCCOFB-DQKY223V.js} +1 -1
  374. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-D0gUSKGu.js → sequenceDiagram-WJ2MYXX4-D27YV_cm.js} +1 -1
  375. package/web-shell/assets/{sizeCapture-X5ZJPWSS-CE463F74.js → sizeCapture-X5ZJPWSS-TJg8UcwV.js} +1 -1
  376. package/web-shell/assets/{stateDiagram-HBIQ2CUA-003zYtJa.js → stateDiagram-HBIQ2CUA-CmnPzUIx.js} +1 -1
  377. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DNKPyrDc.js +1 -0
  378. package/web-shell/assets/{swimlanes-XN3QIQJK-DBj8MFpu.js → swimlanes-XN3QIQJK-ByeP3_Nu.js} +1 -1
  379. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-ZL1HPC6w.js +8 -0
  380. package/web-shell/assets/{timeline-definition-24CTP7MA-D2aCh4a9.js → timeline-definition-24CTP7MA-BsFA5juR.js} +1 -1
  381. package/web-shell/assets/{vennDiagram-4TSXK5OY-BHMfWBpl.js → vennDiagram-4TSXK5OY-DREP2ECo.js} +1 -1
  382. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-RdHAj66j.js → wardleyDiagram-VM6X3IG4-iyd9lKi2.js} +1 -1
  383. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BgJWOvq0.js → xychartDiagram-S5SC5T6Z-CVr1_j9q.js} +1 -1
  384. package/web-shell/index.html +3 -3
  385. package/chunks/MaxSizedBox-BFVLZP2E.js +0 -112
  386. package/chunks/agent-headless-UCBCS4V4.js +0 -87
  387. package/chunks/bridge-FRNYLYY7.js +0 -119
  388. package/chunks/channel-settings-store-IV4KDL7N.js +0 -117
  389. package/chunks/chunk-I6VVOZDK.js +0 -202
  390. package/chunks/chunk-JS73NNWF.js +0 -30
  391. package/chunks/chunk-K2OJUPOE.js +0 -78
  392. package/chunks/chunk-P3QQPMQA.js +0 -19
  393. package/chunks/chunk-SDVF6A42.js +0 -945
  394. package/chunks/chunk-VGHZT6JR.js +0 -51
  395. package/chunks/config-utils-PMX4QZ5Y.js +0 -113
  396. package/chunks/contextCommand-NZRLVAFC.js +0 -108
  397. package/chunks/daemon-status-provider-FTTYZEKN.js +0 -118
  398. package/chunks/daemon-trust-policy-WMGFPA3Z.js +0 -114
  399. package/chunks/deferred-core-runtime-BUFEFYNA.js +0 -116
  400. package/chunks/earlyInputCapture-ROPLMXA7.js +0 -109
  401. package/chunks/errors-U5KNAADB.js +0 -115
  402. package/chunks/exitPlanMode-VFJ5R5DD.js +0 -85
  403. package/chunks/handleAutoUpdate-W4BUYFT7.js +0 -111
  404. package/chunks/i18n-KX7FEKJJ.js +0 -126
  405. package/chunks/initializer-SNVVLS7Y.js +0 -115
  406. package/chunks/installationInfo-D4XGQNHJ.js +0 -109
  407. package/chunks/list-WYECMLXZ.js +0 -118
  408. package/chunks/loadedSettingsAdapter-5WZBXBCR.js +0 -112
  409. package/chunks/mcp-CBWAROY3.js +0 -112
  410. package/chunks/nonInteractiveCli-O232UUV7.js +0 -185
  411. package/chunks/pidfile-MSPQ255Y.js +0 -113
  412. package/chunks/process-registry-PMJOA5CO.js +0 -172
  413. package/chunks/prompt-terminal-ledger-YPGMNDXT.js +0 -107
  414. package/chunks/resumeHistoryUtils-35D4KAVT.js +0 -120
  415. package/chunks/ripGrep-46N4FLOS.js +0 -39
  416. package/chunks/serve-WQ54UIYG.js +0 -120
  417. package/chunks/skill-settings-SKMN5YXC.js +0 -120
  418. package/chunks/spawnChannel-NE43EEO3.js +0 -113
  419. package/chunks/standalone-update-XOCWGXAH.js +0 -120
  420. package/chunks/terminal-image-renderer-NREKYTAD.js +0 -116
  421. package/chunks/theme-manager-IJS6OICX.js +0 -104
  422. package/chunks/total-session-admission-L5RPEFZ2.js +0 -114
  423. package/chunks/trustedFolders-OILZCHRD.js +0 -124
  424. package/chunks/updateCheck-AK4COHNK.js +0 -120
  425. package/chunks/useAutoAcceptIndicator-O2N2Q6KG.js +0 -122
  426. package/chunks/workspace-providers-status-OCFEWIPQ.js +0 -116
  427. package/chunks/workspace-registry-WJLZPRTG.js +0 -123
  428. package/chunks/workspace-service-5ZOBMMIB.js +0 -131
  429. package/chunks/workspace-skills-status-B6NJZD4B.js +0 -115
  430. package/chunks/write-file-B2RNX6SU.js +0 -90
  431. package/web-shell/assets/channel-CU-Zyv0r.js +0 -1
  432. package/web-shell/assets/classDiagram-DTDB5LWJ-C0J2_LKs.js +0 -1
  433. package/web-shell/assets/classDiagram-v2-JRS7N3AN-C0J2_LKs.js +0 -1
  434. package/web-shell/assets/index-C-XlQn24.css +0 -5
  435. package/web-shell/assets/index-gdvMN4J1.js +0 -1860
  436. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-2uACDdJN.js +0 -1
  437. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-C4JJkavU.js +0 -8
@@ -1,14 +1,19 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- MissingCliEntryError
5
- } from "./chunk-XUX6O2ZT.js";
4
+ NdJsonQueueLimitError,
5
+ ndJsonStream,
6
+ validateNdJsonStreamLimits
7
+ } from "./chunk-H72BQNM3.js";
6
8
  import {
7
- redactLogCredentials
8
- } from "./chunk-M5GB774H.js";
9
+ MissingCliEntryError
10
+ } from "./chunk-KID24ZFN.js";
9
11
  import {
10
12
  EXTERNAL_TOOL_GUARD_TOKEN_ENV
11
13
  } from "./chunk-3VUENPWF.js";
14
+ import {
15
+ redactLogCredentials
16
+ } from "./chunk-M5GB774H.js";
12
17
  import {
13
18
  CLIENT_METHODS,
14
19
  zCreateTerminalRequest,
@@ -35,636 +40,28 @@ import * as os from "node:os";
35
40
  import { Readable, Writable } from "node:stream";
36
41
  import { getHeapStatistics } from "node:v8";
37
42
 
38
- // packages/acp-bridge/src/ndJsonStream.ts
39
- init_esbuild_shims();
40
- import { createHash } from "node:crypto";
41
- import { inspect } from "node:util";
42
- var NdJsonFrameTooLargeError = class extends Error {
43
- constructor(direction, limitBytes, observedBytes) {
44
- super(
45
- `NDJSON ${direction} frame exceeds ${limitBytes} bytes (observed ${observedBytes} bytes)`
46
- );
47
- this.direction = direction;
48
- this.limitBytes = limitBytes;
49
- this.observedBytes = observedBytes;
50
- this.name = "NdJsonFrameTooLargeError";
51
- }
52
- static {
53
- __name(this, "NdJsonFrameTooLargeError");
54
- }
55
- code = "ndjson_frame_too_large";
56
- };
57
- var NdJsonQueueLimitError = class extends Error {
58
- constructor(maxQueuedMessages, maxQueuedBytes, requiredBytes, availableBytes) {
59
- super(
60
- `NDJSON decoded queue is full (required ${requiredBytes} bytes, available ${availableBytes} bytes)`
61
- );
62
- this.maxQueuedMessages = maxQueuedMessages;
63
- this.maxQueuedBytes = maxQueuedBytes;
64
- this.requiredBytes = requiredBytes;
65
- this.availableBytes = availableBytes;
66
- this.name = "NdJsonQueueLimitError";
67
- }
68
- static {
69
- __name(this, "NdJsonQueueLimitError");
70
- }
71
- code = "ndjson_queue_limit_exceeded";
72
- };
73
- var NdJsonIncompleteFrameError = class extends Error {
74
- constructor(observedBytes) {
75
- super(`NDJSON input ended with an incomplete ${observedBytes}-byte frame`);
76
- this.observedBytes = observedBytes;
77
- this.name = "NdJsonIncompleteFrameError";
78
- }
79
- static {
80
- __name(this, "NdJsonIncompleteFrameError");
81
- }
82
- code = "ndjson_incomplete_frame";
83
- };
84
- var NdJsonUnexpectedEofError = class extends Error {
85
- static {
86
- __name(this, "NdJsonUnexpectedEofError");
87
- }
88
- code = "ndjson_unexpected_eof";
89
- constructor() {
90
- super("NDJSON input ended while the bounded transport was active");
91
- this.name = "NdJsonUnexpectedEofError";
92
- }
93
- };
94
- var NdJsonInvalidMessageError = class extends Error {
95
- constructor(code, observedBytes) {
96
- super(`NDJSON input contains an invalid ${observedBytes}-byte message`);
97
- this.code = code;
98
- this.observedBytes = observedBytes;
99
- this.name = "NdJsonInvalidMessageError";
100
- }
101
- static {
102
- __name(this, "NdJsonInvalidMessageError");
103
- }
104
- };
105
- var MAX_JSON_RPC_METHOD_BYTES = 1024;
106
- var MAX_JSON_RPC_ID_BYTES = 256;
107
- var MAX_JSON_RPC_ERROR_MESSAGE_BYTES = 1024;
108
- var MAX_JSON_DEPTH = 64;
109
- var MAX_JSON_NODES = 1e4;
110
- var MAX_JSON_ARRAY_LENGTH = 4096;
111
- function ndJsonStream(output, input, hooks, limits, validateInboundMessage, fatalCleanEof = false) {
112
- const textEncoder = new TextEncoder();
113
- const textDecoder = new TextDecoder();
114
- if (limits) validateNdJsonStreamLimits(limits);
115
- const outboundRequests = limits ? new BoundedOutstandingRequestLedger(limits) : void 0;
116
- const inboundRequests = limits ? new BoundedInboundRequestLedger(limits) : void 0;
117
- const readable = limits ? createBoundedReadable(
118
- input,
119
- textDecoder,
120
- hooks,
121
- limits,
122
- outboundRequests,
123
- inboundRequests,
124
- validateInboundMessage,
125
- fatalCleanEof
126
- ) : createLegacyReadable(input, textDecoder, hooks);
127
- const writable = new WritableStream({
128
- async write(message) {
129
- let writer;
130
- let expectedResponseId;
131
- try {
132
- const content = JSON.stringify(message);
133
- const payload = textEncoder.encode(content);
134
- const frameBytes = payload.byteLength + 1;
135
- if (limits && frameBytes > limits.maxFrameBytes) {
136
- throw new NdJsonFrameTooLargeError(
137
- "sent",
138
- limits.maxFrameBytes,
139
- frameBytes
140
- );
141
- }
142
- const frame = new Uint8Array(frameBytes);
143
- frame.set(payload);
144
- frame[payload.byteLength] = 10;
145
- if (outboundRequests && isJsonRpcRequestMessage(message)) {
146
- outboundRequests.admit(message.id, frameBytes);
147
- expectedResponseId = message.id;
148
- }
149
- writer = output.getWriter();
150
- await writer.write(frame);
151
- inboundRequests?.release(message);
152
- callHook(hooks?.onMessageSent, payload.byteLength);
153
- callHook(hooks?.onMessageObserved, {
154
- direction: "sent",
155
- bytes: payload.byteLength,
156
- message
157
- });
158
- } catch (error) {
159
- if (expectedResponseId !== void 0) {
160
- outboundRequests?.discard(expectedResponseId);
161
- }
162
- if (limits) callHook(hooks?.onTransportError, error);
163
- throw error;
164
- } finally {
165
- writer?.releaseLock();
166
- }
167
- }
168
- });
169
- return { readable, writable };
170
- }
171
- __name(ndJsonStream, "ndJsonStream");
172
- function createLegacyReadable(input, textDecoder, hooks) {
173
- return new ReadableStream({
174
- async start(controller) {
175
- const pending = [];
176
- const reader = input.getReader();
177
- try {
178
- while (true) {
179
- const { value, done } = await reader.read();
180
- if (done) break;
181
- if (!value) continue;
182
- readLegacyChunk(value, pending, controller, textDecoder, hooks);
183
- }
184
- } finally {
185
- reader.releaseLock();
186
- controller.close();
187
- }
188
- }
189
- });
190
- }
191
- __name(createLegacyReadable, "createLegacyReadable");
192
- function createBoundedReadable(input, textDecoder, hooks, limits, outboundRequests, inboundRequests, validateInboundMessage, fatalCleanEof) {
193
- const pending = new BoundedFrameBuffer(limits.maxFrameBytes);
194
- const minimumQueueCharge = Math.ceil(
195
- limits.maxQueuedBytes / limits.maxQueuedMessages
196
- );
197
- let nextQueueCharge = minimumQueueCharge;
198
- let reader;
199
- let canceled = false;
200
- return new ReadableStream(
201
- {
202
- start(controller) {
203
- reader = input.getReader();
204
- void pumpBoundedInput(
205
- reader,
206
- pending,
207
- controller,
208
- textDecoder,
209
- hooks,
210
- limits,
211
- outboundRequests,
212
- inboundRequests,
213
- validateInboundMessage,
214
- fatalCleanEof,
215
- minimumQueueCharge,
216
- (charge) => {
217
- nextQueueCharge = charge;
218
- },
219
- () => canceled
220
- );
221
- },
222
- async cancel(reason) {
223
- canceled = true;
224
- pending.clear();
225
- if (reader) await cancelReader(reader, reason);
226
- }
227
- },
228
- {
229
- highWaterMark: limits.maxQueuedBytes,
230
- size: /* @__PURE__ */ __name(() => nextQueueCharge, "size")
231
- }
232
- );
233
- }
234
- __name(createBoundedReadable, "createBoundedReadable");
235
- async function pumpBoundedInput(reader, pending, controller, textDecoder, hooks, limits, outboundRequests, inboundRequests, validateInboundMessage, fatalCleanEof, minimumQueueCharge, setNextQueueCharge, isCanceled) {
236
- try {
237
- while (true) {
238
- const result = await reader.read();
239
- if (result.done) {
240
- if (isCanceled()) return;
241
- if (pending.byteLength > 0) {
242
- throw new NdJsonIncompleteFrameError(pending.byteLength);
243
- }
244
- if (fatalCleanEof) throw new NdJsonUnexpectedEofError();
245
- controller.close();
246
- return;
247
- }
248
- if (!result.value) continue;
249
- readBoundedChunk(
250
- result.value,
251
- pending,
252
- controller,
253
- textDecoder,
254
- hooks,
255
- limits,
256
- outboundRequests,
257
- inboundRequests,
258
- validateInboundMessage,
259
- minimumQueueCharge,
260
- setNextQueueCharge
261
- );
262
- }
263
- } catch (error) {
264
- if (isCanceled()) return;
265
- pending.clear();
266
- callHook(hooks?.onTransportError, error);
267
- await cancelReader(reader, error);
268
- if (!isCanceled()) controller.close();
269
- } finally {
270
- pending.clear();
271
- outboundRequests.clear();
272
- inboundRequests.clear();
273
- reader.releaseLock();
274
- }
275
- }
276
- __name(pumpBoundedInput, "pumpBoundedInput");
277
- function readLegacyChunk(chunk, pending, controller, textDecoder, hooks) {
278
- let start = 0;
279
- let newline = chunk.indexOf(10, start);
280
- while (newline !== -1) {
281
- const lineBytes = takeLegacyLineBytes(
282
- pending,
283
- chunk.subarray(start, newline)
284
- );
285
- handleLegacyLine(lineBytes, controller, textDecoder, hooks);
286
- start = newline + 1;
287
- newline = chunk.indexOf(10, start);
288
- }
289
- if (start < chunk.length) {
290
- pending.push(chunk.subarray(start));
291
- }
292
- }
293
- __name(readLegacyChunk, "readLegacyChunk");
294
- function readBoundedChunk(chunk, pending, controller, textDecoder, hooks, limits, outboundRequests, inboundRequests, validateInboundMessage, minimumQueueCharge, setNextQueueCharge) {
295
- let start = 0;
296
- let newline = chunk.indexOf(10, start);
297
- while (newline !== -1) {
298
- const current = chunk.subarray(start, newline);
299
- const frameBytes = pending.byteLength + current.byteLength + 1;
300
- assertFrameSize("received", limits.maxFrameBytes, frameBytes);
301
- if (pending.isJsonWhitespaceLine(current)) {
302
- pending.clear();
303
- start = newline + 1;
304
- newline = chunk.indexOf(10, start);
305
- continue;
306
- }
307
- const queueCharge = Math.max(frameBytes, minimumQueueCharge);
308
- const availableBytes = controller.desiredSize;
309
- if (availableBytes === null || queueCharge > availableBytes) {
310
- throw new NdJsonQueueLimitError(
311
- limits.maxQueuedMessages,
312
- limits.maxQueuedBytes,
313
- queueCharge,
314
- Math.max(0, availableBytes ?? 0)
315
- );
316
- }
317
- setNextQueueCharge(queueCharge);
318
- handleBoundedLine(
319
- pending.take(current),
320
- controller,
321
- textDecoder,
322
- hooks,
323
- outboundRequests,
324
- inboundRequests,
325
- validateInboundMessage
326
- );
327
- start = newline + 1;
328
- newline = chunk.indexOf(10, start);
329
- }
330
- if (start < chunk.length) pending.append(chunk.subarray(start));
331
- }
332
- __name(readBoundedChunk, "readBoundedChunk");
333
- function takeLegacyLineBytes(pending, current) {
334
- if (pending.length === 0) return current;
335
- const totalLength = pending.reduce((sum, part) => sum + part.byteLength, 0) + current.byteLength;
336
- const line = new Uint8Array(totalLength);
337
- let offset = 0;
338
- for (const part of pending) {
339
- line.set(part, offset);
340
- offset += part.byteLength;
341
- }
342
- line.set(current, offset);
343
- pending.length = 0;
344
- return line;
345
- }
346
- __name(takeLegacyLineBytes, "takeLegacyLineBytes");
347
- function handleLegacyLine(lineBytes, controller, textDecoder, hooks) {
348
- const line = textDecoder.decode(lineBytes);
349
- const trimmedLine = line.trim();
350
- if (!trimmedLine) return;
351
- try {
352
- const message = JSON.parse(trimmedLine);
353
- controller.enqueue(message);
354
- reportReceivedMessage(lineBytes, message, hooks);
355
- } catch (err) {
356
- console.error("Failed to parse JSON message:", trimmedLine, err);
357
- }
358
- }
359
- __name(handleLegacyLine, "handleLegacyLine");
360
- function handleBoundedLine(lineBytes, controller, textDecoder, hooks, outboundRequests, inboundRequests, validateInboundMessage) {
361
- const line = textDecoder.decode(lineBytes);
362
- const trimmedLine = line.trim();
363
- if (!trimmedLine) return;
364
- let parsed;
365
- try {
366
- parsed = JSON.parse(trimmedLine);
367
- } catch {
368
- throw logBoundedInvalidMessage("ndjson_parse_error", lineBytes);
369
- }
370
- if (!isJsonRpcMessage(parsed)) {
371
- throw logBoundedInvalidMessage("ndjson_invalid_message", lineBytes);
372
- }
373
- const isResponse = isJsonRpcResponseMessage(parsed);
374
- if (!isResponse && !hasBoundedJsonStructure(parsed) || validateInboundMessage && !validateInboundMessage(parsed)) {
375
- throw logBoundedInvalidMessage("ndjson_invalid_message", lineBytes);
376
- }
377
- if (isJsonRpcResponseMessage(parsed) && !outboundRequests?.consumeResponse(parsed.id)) {
378
- throw logBoundedInvalidMessage("ndjson_invalid_message", lineBytes);
379
- }
380
- inboundRequests?.admit(parsed, lineBytes.byteLength + 1);
381
- const message = installBoundedLogRedaction(parsed);
382
- controller.enqueue(message);
383
- reportReceivedMessage(lineBytes, message, hooks);
384
- }
385
- __name(handleBoundedLine, "handleBoundedLine");
386
- function installBoundedLogRedaction(message) {
387
- Object.defineProperty(message, inspect.custom, {
388
- configurable: false,
389
- enumerable: false,
390
- value: inspectBoundedJsonRpcMessage,
391
- writable: false
392
- });
393
- return message;
394
- }
395
- __name(installBoundedLogRedaction, "installBoundedLogRedaction");
396
- function inspectBoundedJsonRpcMessage() {
397
- return {
398
- jsonrpc: "2.0",
399
- messageType: "method" in this ? "id" in this ? "request" : "notification" : "response",
400
- payloadOmitted: true
401
- };
402
- }
403
- __name(inspectBoundedJsonRpcMessage, "inspectBoundedJsonRpcMessage");
404
- function isJsonRpcMessage(value) {
405
- if (!isRecord(value) || value["jsonrpc"] !== "2.0") return false;
406
- const hasMethod = Object.hasOwn(value, "method");
407
- const hasId = Object.hasOwn(value, "id");
408
- if (hasMethod) {
409
- return typeof value["method"] === "string" && Buffer.byteLength(value["method"]) <= MAX_JSON_RPC_METHOD_BYTES && (!hasId || isJsonRpcId(value["id"]));
410
- }
411
- if (!hasId || !isJsonRpcId(value["id"])) return false;
412
- const hasResult = Object.hasOwn(value, "result");
413
- const hasError = Object.hasOwn(value, "error");
414
- if (hasResult === hasError) return false;
415
- if (!hasError) return true;
416
- const error = value["error"];
417
- return isRecord(error) && typeof error["code"] === "number" && Number.isFinite(error["code"]) && typeof error["message"] === "string" && Buffer.byteLength(error["message"]) <= MAX_JSON_RPC_ERROR_MESSAGE_BYTES;
418
- }
419
- __name(isJsonRpcMessage, "isJsonRpcMessage");
420
- function isRecord(value) {
421
- return typeof value === "object" && value !== null && !Array.isArray(value);
422
- }
423
- __name(isRecord, "isRecord");
424
- function hasBoundedJsonStructure(value) {
425
- const stack = [{ value, depth: 1 }];
426
- let nodes = 0;
427
- while (stack.length > 0) {
428
- const current = stack.pop();
429
- nodes++;
430
- if (nodes > MAX_JSON_NODES || current.depth > MAX_JSON_DEPTH) return false;
431
- if (Array.isArray(current.value)) {
432
- if (current.value.length > MAX_JSON_ARRAY_LENGTH) return false;
433
- for (let index = current.value.length - 1; index >= 0; index--) {
434
- if (nodes + stack.length >= MAX_JSON_NODES || current.depth + 1 > MAX_JSON_DEPTH) {
435
- return false;
436
- }
437
- stack.push({
438
- value: current.value[index],
439
- depth: current.depth + 1
440
- });
441
- }
442
- } else if (isRecord(current.value)) {
443
- for (const key in current.value) {
444
- if (!Object.hasOwn(current.value, key)) continue;
445
- if (nodes + stack.length >= MAX_JSON_NODES || current.depth + 1 > MAX_JSON_DEPTH) {
446
- return false;
447
- }
448
- stack.push({
449
- value: current.value[key],
450
- depth: current.depth + 1
451
- });
452
- }
453
- }
454
- }
455
- return true;
456
- }
457
- __name(hasBoundedJsonStructure, "hasBoundedJsonStructure");
458
- function isJsonRpcId(value) {
459
- return value === null || typeof value === "string" && Buffer.byteLength(value) <= MAX_JSON_RPC_ID_BYTES || typeof value === "number" && Number.isFinite(value);
460
- }
461
- __name(isJsonRpcId, "isJsonRpcId");
462
- function isJsonRpcRequestMessage(value) {
463
- return "method" in value && "id" in value && typeof value.method === "string" && isJsonRpcId(value.id);
464
- }
465
- __name(isJsonRpcRequestMessage, "isJsonRpcRequestMessage");
466
- function isJsonRpcResponseMessage(value) {
467
- return !("method" in value) && "id" in value;
468
- }
469
- __name(isJsonRpcResponseMessage, "isJsonRpcResponseMessage");
470
- var BoundedInboundRequestLedger = class {
471
- constructor(limits) {
472
- this.limits = limits;
473
- }
474
- static {
475
- __name(this, "BoundedInboundRequestLedger");
476
- }
477
- requests = /* @__PURE__ */ new Map();
478
- retainedBytes = 0;
479
- admit(message, frameBytes) {
480
- if (!isJsonRpcRequestMessage(message)) return;
481
- const availableBytes = Math.max(
482
- 0,
483
- this.limits.maxQueuedBytes - this.retainedBytes
484
- );
485
- if (this.requests.has(message.id) || this.requests.size >= this.limits.maxQueuedMessages || frameBytes > availableBytes) {
486
- throw new NdJsonQueueLimitError(
487
- this.limits.maxQueuedMessages,
488
- this.limits.maxQueuedBytes,
489
- frameBytes,
490
- this.requests.has(message.id) ? 0 : availableBytes
491
- );
492
- }
493
- this.requests.set(message.id, frameBytes);
494
- this.retainedBytes += frameBytes;
495
- }
496
- release(message) {
497
- if (!isJsonRpcResponseMessage(message)) return;
498
- const frameBytes = this.requests.get(message.id);
499
- if (frameBytes === void 0) return;
500
- this.requests.delete(message.id);
501
- this.retainedBytes -= frameBytes;
502
- }
503
- clear() {
504
- this.requests.clear();
505
- this.retainedBytes = 0;
506
- }
507
- };
508
- var BoundedOutstandingRequestLedger = class {
509
- constructor(limits) {
510
- this.limits = limits;
511
- }
512
- static {
513
- __name(this, "BoundedOutstandingRequestLedger");
514
- }
515
- requests = /* @__PURE__ */ new Map();
516
- retainedBytes = 0;
517
- admit(id, frameBytes) {
518
- const availableBytes = Math.max(
519
- 0,
520
- this.limits.maxQueuedBytes - this.retainedBytes
521
- );
522
- if (this.requests.has(id) || this.requests.size >= this.limits.maxQueuedMessages || frameBytes > availableBytes) {
523
- throw new NdJsonQueueLimitError(
524
- this.limits.maxQueuedMessages,
525
- this.limits.maxQueuedBytes,
526
- frameBytes,
527
- this.requests.has(id) ? 0 : availableBytes
528
- );
529
- }
530
- this.requests.set(id, frameBytes);
531
- this.retainedBytes += frameBytes;
532
- }
533
- consumeResponse(id) {
534
- return this.discard(id);
535
- }
536
- discard(id) {
537
- const frameBytes = this.requests.get(id);
538
- if (frameBytes === void 0) return false;
539
- this.requests.delete(id);
540
- this.retainedBytes -= frameBytes;
541
- return true;
542
- }
543
- clear() {
544
- this.requests.clear();
545
- this.retainedBytes = 0;
546
- }
547
- };
548
- function logBoundedInvalidMessage(errorKind, lineBytes) {
549
- const bytes = jsonPayloadByteLength(lineBytes);
550
- const digest = createHash("sha256").update(lineBytes.subarray(0, bytes)).digest("hex");
551
- console.error("Failed to parse JSON message:", {
552
- errorKind,
553
- bytes,
554
- sha256: digest,
555
- payloadOmitted: true
556
- });
557
- return new NdJsonInvalidMessageError(errorKind, bytes);
558
- }
559
- __name(logBoundedInvalidMessage, "logBoundedInvalidMessage");
560
- function reportReceivedMessage(lineBytes, message, hooks) {
561
- const bytes = jsonPayloadByteLength(lineBytes);
562
- callHook(hooks?.onMessageReceived, bytes);
563
- callHook(hooks?.onMessageObserved, {
564
- direction: "received",
565
- bytes,
566
- message
567
- });
568
- }
569
- __name(reportReceivedMessage, "reportReceivedMessage");
570
- function jsonPayloadByteLength(lineBytes) {
571
- return lineBytes[lineBytes.byteLength - 1] === 13 ? lineBytes.byteLength - 1 : lineBytes.byteLength;
572
- }
573
- __name(jsonPayloadByteLength, "jsonPayloadByteLength");
574
- function validateNdJsonStreamLimits(limits) {
575
- const values = [
576
- ["maxFrameBytes", limits.maxFrameBytes],
577
- ["maxQueuedMessages", limits.maxQueuedMessages],
578
- ["maxQueuedBytes", limits.maxQueuedBytes]
579
- ];
580
- for (const [name, value] of values) {
581
- if (!Number.isSafeInteger(value) || value <= 0) {
582
- throw new RangeError(`${name} must be a positive safe integer`);
583
- }
584
- }
585
- }
586
- __name(validateNdJsonStreamLimits, "validateNdJsonStreamLimits");
587
- function assertFrameSize(direction, limitBytes, observedBytes) {
588
- if (observedBytes > limitBytes) {
589
- throw new NdJsonFrameTooLargeError(direction, limitBytes, observedBytes);
590
- }
591
- }
592
- __name(assertFrameSize, "assertFrameSize");
593
- async function cancelReader(reader, reason) {
594
- try {
595
- await reader.cancel(reason);
596
- } catch {
597
- }
598
- }
599
- __name(cancelReader, "cancelReader");
600
- function callHook(hook, value) {
601
- try {
602
- hook?.(value);
603
- } catch {
604
- }
605
- }
606
- __name(callHook, "callHook");
607
- var BoundedFrameBuffer = class {
608
- constructor(maxFrameBytes) {
609
- this.maxFrameBytes = maxFrameBytes;
610
- }
611
- static {
612
- __name(this, "BoundedFrameBuffer");
613
- }
614
- buffer;
615
- length = 0;
616
- get byteLength() {
617
- return this.length;
618
- }
619
- append(bytes) {
620
- const requiredBytes = this.length + bytes.byteLength;
621
- assertFrameSize("received", this.maxFrameBytes, requiredBytes);
622
- if (requiredBytes === 0) return;
623
- if (!this.buffer || this.buffer.byteLength < requiredBytes) {
624
- const doubledCapacity = Math.min(
625
- this.maxFrameBytes,
626
- Math.max(1024, (this.buffer?.byteLength ?? 0) * 2)
627
- );
628
- const next = new Uint8Array(Math.max(requiredBytes, doubledCapacity));
629
- if (this.buffer) next.set(this.buffer.subarray(0, this.length));
630
- this.buffer = next;
631
- }
632
- this.buffer.set(bytes, this.length);
633
- this.length = requiredBytes;
634
- }
635
- take(current) {
636
- if (this.length === 0) return current;
637
- const line = new Uint8Array(this.length + current.byteLength);
638
- line.set(this.buffer.subarray(0, this.length));
639
- line.set(current, this.length);
640
- this.clear();
641
- return line;
642
- }
643
- isJsonWhitespaceLine(current) {
644
- if (this.buffer) {
645
- for (let index = 0; index < this.length; index++) {
646
- if (!isJsonWhitespaceByte(this.buffer[index])) return false;
647
- }
648
- }
649
- for (const byte of current) {
650
- if (!isJsonWhitespaceByte(byte)) return false;
651
- }
652
- return true;
653
- }
654
- clear() {
655
- this.buffer = void 0;
656
- this.length = 0;
657
- }
658
- };
659
- function isJsonWhitespaceByte(byte) {
660
- return byte === 32 || byte === 9 || byte === 13;
661
- }
662
- __name(isJsonWhitespaceByte, "isJsonWhitespaceByte");
663
-
664
43
  // packages/acp-bridge/src/process-registry.ts
665
44
  init_esbuild_shims();
45
+ import {
46
+ execFile,
47
+ spawnSync
48
+ } from "node:child_process";
666
49
  var TERM_GRACE_MS = 5e3;
667
50
  var EXIT_DEADLINE_MS = 1e4;
51
+ var PROCESS_QUERY_TIMEOUT_MS = 2e3;
52
+ var PROCESS_QUERY_MAX_BUFFER = 8 * 1024 * 1024;
53
+ var PROCESS_POLL_MS = 50;
54
+ var PROCESS_STATE_POLL_MS = 250;
55
+ var MAX_OWNED_PROCESSES = 256;
56
+ var MAX_OWNERSHIP_DEPTH = 8;
57
+ var POSIX_PS = "/bin/ps";
58
+ var WINDOWS_TASKKILL = `${process.env["SystemRoot"] || "C:\\Windows"}\\System32\\taskkill.exe`;
59
+ var STRING_EXEC_OPTIONS = {
60
+ encoding: "utf8",
61
+ maxBuffer: PROCESS_QUERY_MAX_BUFFER,
62
+ timeout: PROCESS_QUERY_TIMEOUT_MS,
63
+ windowsHide: true
64
+ };
668
65
  var ProcessRegistry = class {
669
66
  static {
670
67
  __name(this, "ProcessRegistry");
@@ -681,14 +78,18 @@ var ProcessRegistry = class {
681
78
  this.reservations.add(token);
682
79
  let settled = false;
683
80
  return {
684
- attach: /* @__PURE__ */ __name((child) => {
81
+ attach: /* @__PURE__ */ __name((child, options) => {
685
82
  if (settled || !this.reservations.delete(token)) {
686
83
  throw new Error("ACP process reservation is no longer active");
687
84
  }
688
85
  settled = true;
689
- const tracked = new TrackedChild(child, () => {
690
- this.children.delete(tracked);
691
- });
86
+ const tracked = new TrackedChild(
87
+ child,
88
+ options?.ownsProcessTree === true,
89
+ () => {
90
+ this.children.delete(tracked);
91
+ }
92
+ );
692
93
  this.children.add(tracked);
693
94
  if (this.draining) void tracked.terminate().catch(() => {
694
95
  });
@@ -718,7 +119,15 @@ var ProcessRegistry = class {
718
119
  }
719
120
  killAllSync() {
720
121
  this.draining = true;
721
- for (const child of this.children) child.killSync();
122
+ let processTable;
123
+ if (process.platform !== "win32" && [...this.children].some((child) => child.needsProcessTreeSnapshot)) {
124
+ try {
125
+ processTable = parseProcessTable(queryProcessTableSync());
126
+ } catch {
127
+ processTable = null;
128
+ }
129
+ }
130
+ for (const child of this.children) child.killSync(processTable);
722
131
  }
723
132
  get activeProcessCount() {
724
133
  return this.children.size;
@@ -731,30 +140,34 @@ var ProcessRegistry = class {
731
140
  * here, while neither is visible in `activeProcessCount` until its child is
732
141
  * attached.
733
142
  *
734
- * A child leaves this count when it *exits*, not when `terminate()` starts,
735
- * so a channel swap is counted twice while the old process is still winding
736
- * down. That is deliberate: its memory is still resident.
143
+ * A direct child leaves this count when its root exits. A tree-owned child
144
+ * under explicit teardown remains committed until its known tree is gone,
145
+ * so a channel swap includes memory still held by descendants.
737
146
  */
738
147
  get committedProcessCount() {
739
148
  return this.children.size + this.reservations.size;
740
149
  }
741
150
  };
742
151
  var TrackedChild = class {
743
- constructor(child, onExit) {
152
+ constructor(child, ownsProcessTree, onRelease) {
744
153
  this.child = child;
745
- this.onExit = onExit;
154
+ this.ownsProcessTree = ownsProcessTree;
155
+ this.onRelease = onRelease;
156
+ this.rememberRoot();
746
157
  this.exited = new Promise((resolve) => {
747
158
  const finish = /* @__PURE__ */ __name((info) => {
748
159
  if (this.exitedSettled) return;
749
160
  this.exitedSettled = true;
750
- this.onExit();
161
+ this.exitInfo = info;
751
162
  resolve(info);
163
+ this.handleRootExit();
752
164
  }, "finish");
753
165
  child.once("exit", (exitCode, signalCode) => {
754
166
  finish({ exitCode, signalCode });
755
167
  });
756
168
  child.once("spawn", () => {
757
169
  this.spawnConfirmed = true;
170
+ this.rememberRoot();
758
171
  });
759
172
  child.once("error", () => {
760
173
  if (!this.spawnConfirmed) finish(void 0);
@@ -765,21 +178,116 @@ var TrackedChild = class {
765
178
  __name(this, "TrackedChild");
766
179
  }
767
180
  exited;
181
+ knownGroups = /* @__PURE__ */ new Set();
182
+ cleanupProofError;
183
+ exitInfo;
768
184
  exitedSettled = false;
185
+ forceKillRequested = false;
186
+ released = false;
187
+ releasePollTimer;
188
+ releaseStateCheckInFlight = false;
769
189
  spawnConfirmed = false;
770
190
  terminatePromise;
191
+ terminating = false;
192
+ terminationSettled = false;
771
193
  terminate() {
772
- this.terminatePromise ??= this.terminateOnce();
194
+ if (this.terminatePromise) return this.terminatePromise;
195
+ this.terminating = true;
196
+ if (this.releasePollTimer) {
197
+ clearTimeout(this.releasePollTimer);
198
+ this.releasePollTimer = void 0;
199
+ }
200
+ const termination = this.ownsProcessTree ? this.terminateTree() : this.terminateDirectChild();
201
+ this.terminatePromise = termination.finally(() => {
202
+ this.terminationSettled = true;
203
+ if (this.ownsProcessTree && this.exitedSettled && !this.released) {
204
+ this.releaseWhenGroupsExit();
205
+ }
206
+ });
773
207
  return this.terminatePromise;
774
208
  }
775
- killSync() {
209
+ get needsProcessTreeSnapshot() {
210
+ return this.ownsProcessTree && !this.forceKillRequested && !this.rootHasExited && !this.released;
211
+ }
212
+ killSync(processTable) {
213
+ if (!this.ownsProcessTree) {
214
+ this.killDirectChildSync();
215
+ return;
216
+ }
217
+ if (this.released) return;
218
+ const firstForceKill = !this.forceKillRequested;
219
+ this.forceKillRequested = true;
220
+ const rootPid = this.rootPid;
221
+ if (!rootPid) {
222
+ this.killDirectChildSync();
223
+ return;
224
+ }
225
+ if (process.platform === "win32") {
226
+ if (!firstForceKill) return;
227
+ if (!taskkillSync(rootPid)) this.killDirectChildSync();
228
+ return;
229
+ }
230
+ if (firstForceKill && !this.rootHasExited) {
231
+ if (processTable === void 0) this.mergeSynchronousSnapshot();
232
+ else if (processTable !== null) {
233
+ this.mergeSnapshot(collectOwnership(processTable, rootPid));
234
+ }
235
+ }
236
+ const rootSignalled = this.signalKnownGroups("SIGKILL");
237
+ this.signalDirectRootIfNeeded("SIGKILL", rootSignalled);
238
+ if (this.exitedSettled && this.survivingGroups().length === 0) {
239
+ this.release();
240
+ }
241
+ }
242
+ get rootPid() {
243
+ const pid = this.child.pid;
244
+ return typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0 ? pid : void 0;
245
+ }
246
+ get rootHasExited() {
247
+ return this.exitedSettled || this.child.exitCode !== null || this.child.signalCode !== null;
248
+ }
249
+ rememberRoot() {
250
+ if (!this.ownsProcessTree) return;
251
+ const rootPid = this.rootPid;
252
+ if (!rootPid) return;
253
+ if (process.platform !== "win32") this.knownGroups.add(rootPid);
254
+ }
255
+ handleRootExit() {
256
+ if (!this.ownsProcessTree) {
257
+ this.release();
258
+ return;
259
+ }
260
+ if (this.terminating && !this.terminationSettled) return;
261
+ if (process.platform !== "win32") {
262
+ this.forceKillRequested = true;
263
+ this.signalKnownGroups("SIGKILL");
264
+ this.releaseWhenGroupsExit();
265
+ return;
266
+ }
267
+ this.release();
268
+ }
269
+ release() {
270
+ if (this.released) return;
271
+ this.released = true;
272
+ if (this.releasePollTimer) clearTimeout(this.releasePollTimer);
273
+ this.onRelease();
274
+ }
275
+ killDirectChildSync() {
776
276
  if (this.exitedSettled) return;
777
277
  try {
778
278
  this.child.kill("SIGKILL");
779
279
  } catch {
780
280
  }
781
281
  }
782
- async terminateOnce() {
282
+ signalDirectRootIfNeeded(signal, rootGroupSignalled) {
283
+ const rootPid = this.rootPid;
284
+ if (!rootPid || this.exitedSettled || rootGroupSignalled) return;
285
+ try {
286
+ this.child.kill(signal);
287
+ } catch {
288
+ }
289
+ }
290
+ async terminateDirectChild() {
783
291
  if (this.exitedSettled) return;
784
292
  try {
785
293
  this.child.kill("SIGTERM");
@@ -789,7 +297,10 @@ var TrackedChild = class {
789
297
  let hardKillTimer;
790
298
  let deadlineTimer;
791
299
  const deadline = new Promise((_, reject) => {
792
- hardKillTimer = setTimeout(() => this.killSync(), TERM_GRACE_MS);
300
+ hardKillTimer = setTimeout(
301
+ () => this.killDirectChildSync(),
302
+ TERM_GRACE_MS
303
+ );
793
304
  hardKillTimer.unref();
794
305
  deadlineTimer = setTimeout(() => {
795
306
  reject(
@@ -802,17 +313,394 @@ var TrackedChild = class {
802
313
  });
803
314
  try {
804
315
  const exitInfo = await Promise.race([this.exited, deadline]);
805
- if (exitInfo && (exitInfo.exitCode !== 0 || exitInfo.signalCode !== null)) {
806
- throw new Error(
807
- `ACP child pid=${this.child.pid ?? "unknown"} exited uncleanly during shutdown (code=${exitInfo.exitCode ?? "none"}, signal=${exitInfo.signalCode ?? "none"})`
808
- );
809
- }
316
+ this.throwForUncleanExit(exitInfo);
810
317
  } finally {
811
318
  if (hardKillTimer) clearTimeout(hardKillTimer);
812
319
  if (deadlineTimer) clearTimeout(deadlineTimer);
813
320
  }
814
321
  }
322
+ async terminateTree() {
323
+ if (this.exitedSettled && (process.platform === "win32" || this.released)) {
324
+ return;
325
+ }
326
+ const rootPid = this.rootPid;
327
+ if (!rootPid) {
328
+ await this.terminateDirectChild();
329
+ return;
330
+ }
331
+ if (process.platform === "win32") {
332
+ await this.terminateWindowsTree(rootPid);
333
+ return;
334
+ }
335
+ await this.terminatePosixTree(rootPid);
336
+ }
337
+ async terminatePosixTree(rootPid) {
338
+ const startedAt = Date.now();
339
+ if (!this.rootHasExited) {
340
+ await this.mergeAsynchronousSnapshot(rootPid, true);
341
+ }
342
+ let escalated = this.forceKillRequested;
343
+ let rootSignalled = this.signalKnownGroups(
344
+ escalated ? "SIGKILL" : "SIGTERM"
345
+ );
346
+ this.signalDirectRootIfNeeded(
347
+ escalated ? "SIGKILL" : "SIGTERM",
348
+ rootSignalled
349
+ );
350
+ const graceDeadline = Math.min(
351
+ startedAt + EXIT_DEADLINE_MS,
352
+ Date.now() + TERM_GRACE_MS
353
+ );
354
+ const exitDeadline = startedAt + EXIT_DEADLINE_MS;
355
+ let nextStateCheckAt = 0;
356
+ while (true) {
357
+ let survivingGroups = this.survivingGroups();
358
+ let now = Date.now();
359
+ if (this.exitedSettled && escalated && survivingGroups.length > 0 && now < exitDeadline && now >= nextStateCheckAt) {
360
+ await this.pruneTerminalGroups(survivingGroups, exitDeadline - now);
361
+ nextStateCheckAt = Date.now() + PROCESS_STATE_POLL_MS;
362
+ survivingGroups = this.survivingGroups();
363
+ now = Date.now();
364
+ }
365
+ if (this.exitedSettled && survivingGroups.length === 0) {
366
+ this.release();
367
+ if (this.cleanupProofError) throw this.cleanupProofError;
368
+ this.throwForUncleanExit(this.exitInfo);
369
+ return;
370
+ }
371
+ if (!escalated && (this.forceKillRequested || now >= graceDeadline)) {
372
+ if (!this.rootHasExited && this.knownGroups.has(rootPid)) {
373
+ await this.mergeAsynchronousSnapshot(rootPid, false);
374
+ }
375
+ escalated = true;
376
+ rootSignalled = this.signalKnownGroups("SIGKILL");
377
+ this.signalDirectRootIfNeeded("SIGKILL", rootSignalled);
378
+ continue;
379
+ }
380
+ if (now >= exitDeadline) {
381
+ const groups = survivingGroups.join(",") || "none";
382
+ const proof = this.cleanupProofError ? `; ${this.cleanupProofError.message}` : "";
383
+ throw new Error(
384
+ `ACP child pid=${rootPid} did not exit with its owned process groups within ${EXIT_DEADLINE_MS}ms (surviving pgids=${groups})${proof}`
385
+ );
386
+ }
387
+ await delay(
388
+ Math.min(
389
+ PROCESS_POLL_MS,
390
+ (escalated ? exitDeadline : graceDeadline) - now
391
+ )
392
+ );
393
+ if (this.forceKillRequested) escalated = true;
394
+ }
395
+ }
396
+ async terminateWindowsTree(rootPid) {
397
+ const startedAt = Date.now();
398
+ let treeKillError;
399
+ try {
400
+ await taskkill(rootPid);
401
+ } catch (error) {
402
+ treeKillError = toError(error);
403
+ this.killDirectChildSync();
404
+ }
405
+ const remainingMs = Math.max(
406
+ 1,
407
+ EXIT_DEADLINE_MS - (Date.now() - startedAt)
408
+ );
409
+ const exitInfo = await waitForPromise(this.exited, remainingMs).catch(
410
+ () => {
411
+ throw new Error(
412
+ `ACP child pid=${rootPid} did not exit within ${EXIT_DEADLINE_MS}ms` + (treeKillError ? `; ${treeKillError.message}` : "")
413
+ );
414
+ }
415
+ );
416
+ this.release();
417
+ if (treeKillError) {
418
+ throw new Error(
419
+ `ACP child pid=${rootPid} process-tree cleanup failed: ${treeKillError.message}`
420
+ );
421
+ }
422
+ this.throwForUncleanExit(exitInfo);
423
+ }
424
+ async mergeAsynchronousSnapshot(rootPid, initial) {
425
+ try {
426
+ const table = parseProcessTable(await queryProcessTable());
427
+ if (this.rootHasExited) {
428
+ if (initial && !this.forceKillRequested) {
429
+ this.recordCleanupProofError(
430
+ `ACP child pid=${rootPid} exited before its initial process-tree snapshot completed`
431
+ );
432
+ }
433
+ return;
434
+ }
435
+ const snapshot = collectOwnership(table, rootPid);
436
+ this.mergeSnapshot(snapshot);
437
+ if (snapshot.truncated) {
438
+ this.recordCleanupProofError(
439
+ `ACP child pid=${rootPid} process-tree snapshot exceeded ${MAX_OWNED_PROCESSES} processes or depth ${MAX_OWNERSHIP_DEPTH}`
440
+ );
441
+ }
442
+ if (initial && !snapshot.rootSeen) {
443
+ this.recordCleanupProofError(
444
+ `ACP child pid=${rootPid} was absent from the initial process-tree snapshot`
445
+ );
446
+ } else if (initial && !snapshot.rootIsGroupLeader) {
447
+ this.recordCleanupProofError(
448
+ `ACP child pid=${rootPid} was not an isolated process-group leader`
449
+ );
450
+ }
451
+ } catch (error) {
452
+ this.recordCleanupProofError(
453
+ `ACP child pid=${rootPid} process-tree snapshot failed: ${toError(error).message}`
454
+ );
455
+ }
456
+ }
457
+ mergeSynchronousSnapshot() {
458
+ const rootPid = this.rootPid;
459
+ if (!rootPid || process.platform === "win32" || this.rootHasExited) return;
460
+ try {
461
+ const table = parseProcessTable(queryProcessTableSync());
462
+ this.mergeSnapshot(collectOwnership(table, rootPid));
463
+ } catch {
464
+ }
465
+ }
466
+ mergeSnapshot(snapshot) {
467
+ if (!snapshot.rootIsGroupLeader) {
468
+ const rootPid = this.rootPid;
469
+ if (snapshot.rootSeen && rootPid) this.knownGroups.delete(rootPid);
470
+ return;
471
+ }
472
+ for (const group of snapshot.groups) this.knownGroups.add(group);
473
+ }
474
+ signalKnownGroups(signal) {
475
+ const rootPid = this.rootPid;
476
+ let rootSignalled = false;
477
+ const groups = [...this.knownGroups].sort((left, right) => {
478
+ if (left === rootPid) return 1;
479
+ if (right === rootPid) return -1;
480
+ return right - left;
481
+ });
482
+ for (const group of groups) {
483
+ try {
484
+ process.kill(-group, signal);
485
+ if (group === rootPid) rootSignalled = true;
486
+ } catch (error) {
487
+ if (isErrno(error, "ESRCH")) {
488
+ this.knownGroups.delete(group);
489
+ continue;
490
+ }
491
+ this.recordCleanupProofError(
492
+ `ACP child pid=${rootPid ?? "unknown"} could not send ${signal} to pgid=${group}: ${toError(error).message}`
493
+ );
494
+ }
495
+ }
496
+ return rootSignalled;
497
+ }
498
+ survivingGroups() {
499
+ const surviving = [];
500
+ for (const group of this.knownGroups) {
501
+ try {
502
+ process.kill(-group, 0);
503
+ surviving.push(group);
504
+ } catch (error) {
505
+ if (isErrno(error, "ESRCH")) {
506
+ this.knownGroups.delete(group);
507
+ continue;
508
+ }
509
+ surviving.push(group);
510
+ if (!isErrno(error, "EPERM")) {
511
+ this.recordCleanupProofError(
512
+ `ACP child pid=${this.rootPid ?? "unknown"} could not inspect pgid=${group}: ${toError(error).message}`
513
+ );
514
+ }
515
+ }
516
+ }
517
+ return surviving;
518
+ }
519
+ recordCleanupProofError(message) {
520
+ this.cleanupProofError ??= new Error(message);
521
+ }
522
+ async pruneTerminalGroups(groups, timeoutMs = PROCESS_QUERY_TIMEOUT_MS) {
523
+ try {
524
+ const table = parseProcessTable(await queryProcessTable(timeoutMs));
525
+ const targets = new Set(groups);
526
+ const terminalGroups = /* @__PURE__ */ new Set();
527
+ const liveGroups = /* @__PURE__ */ new Set();
528
+ for (const row of table.rowsByPid.values()) {
529
+ if (!targets.has(row.pgid)) continue;
530
+ if (row.terminal) terminalGroups.add(row.pgid);
531
+ else liveGroups.add(row.pgid);
532
+ }
533
+ for (const group of terminalGroups) {
534
+ if (!liveGroups.has(group)) this.knownGroups.delete(group);
535
+ }
536
+ } catch {
537
+ }
538
+ }
539
+ releaseWhenGroupsExit() {
540
+ if (this.released || this.releasePollTimer || this.releaseStateCheckInFlight || this.terminating && !this.terminationSettled) {
541
+ return;
542
+ }
543
+ const survivingGroups = this.survivingGroups();
544
+ if (survivingGroups.length === 0) {
545
+ this.release();
546
+ return;
547
+ }
548
+ this.releaseStateCheckInFlight = true;
549
+ void this.pruneTerminalGroups(survivingGroups).finally(() => {
550
+ this.releaseStateCheckInFlight = false;
551
+ if (this.released) return;
552
+ if (this.terminating && !this.terminationSettled) return;
553
+ if (this.survivingGroups().length === 0) {
554
+ this.release();
555
+ return;
556
+ }
557
+ this.releasePollTimer = setTimeout(() => {
558
+ this.releasePollTimer = void 0;
559
+ this.releaseWhenGroupsExit();
560
+ }, PROCESS_STATE_POLL_MS);
561
+ this.releasePollTimer.unref();
562
+ });
563
+ }
564
+ throwForUncleanExit(exitInfo) {
565
+ if (exitInfo && (exitInfo.exitCode !== 0 || exitInfo.signalCode !== null)) {
566
+ throw new Error(
567
+ `ACP child pid=${this.child.pid ?? "unknown"} exited uncleanly during shutdown (code=${exitInfo.exitCode ?? "none"}, signal=${exitInfo.signalCode ?? "none"})`
568
+ );
569
+ }
570
+ }
815
571
  };
572
+ function parseProcessTable(stdout) {
573
+ const rowsByPid = /* @__PURE__ */ new Map();
574
+ const childrenByParent = /* @__PURE__ */ new Map();
575
+ for (const line of stdout.split("\n")) {
576
+ const match = line.trim().match(/^(\d+)\s+(\d+)\s+(\d+)(?:\s+(\S+)(?:\s+(\d+))?)?$/u);
577
+ if (!match) continue;
578
+ const pid = Number.parseInt(match[1], 10);
579
+ const ppid = Number.parseInt(match[2], 10);
580
+ const pgid = Number.parseInt(match[3], 10);
581
+ const state = match[4];
582
+ const threadCount = match[5] ? Number.parseInt(match[5], 10) : void 0;
583
+ if (!Number.isSafeInteger(pid) || !Number.isSafeInteger(ppid) || !Number.isSafeInteger(pgid) || pid <= 0 || ppid < 0 || pgid <= 0) {
584
+ continue;
585
+ }
586
+ const terminal = state?.startsWith("X") === true || state?.startsWith("Z") === true && (process.platform !== "linux" || threadCount === 1);
587
+ rowsByPid.set(pid, { pgid, terminal });
588
+ const children = childrenByParent.get(ppid);
589
+ if (children) children.push(pid);
590
+ else childrenByParent.set(ppid, [pid]);
591
+ }
592
+ if (rowsByPid.size === 0) {
593
+ throw new Error("process-table query returned no parseable rows");
594
+ }
595
+ return { childrenByParent, rowsByPid };
596
+ }
597
+ __name(parseProcessTable, "parseProcessTable");
598
+ function collectOwnership(table, rootPid) {
599
+ const groups = /* @__PURE__ */ new Set();
600
+ const visited = /* @__PURE__ */ new Set();
601
+ const queue = [{ depth: 0, pid: rootPid }];
602
+ let truncated = false;
603
+ while (queue.length > 0) {
604
+ const current = queue.shift();
605
+ if (visited.has(current.pid)) continue;
606
+ if (visited.size >= MAX_OWNED_PROCESSES) {
607
+ truncated = true;
608
+ break;
609
+ }
610
+ visited.add(current.pid);
611
+ const row = table.rowsByPid.get(current.pid);
612
+ if (row) groups.add(row.pgid);
613
+ const children = table.childrenByParent.get(current.pid) ?? [];
614
+ if (current.depth >= MAX_OWNERSHIP_DEPTH) {
615
+ if (children.length > 0) truncated = true;
616
+ continue;
617
+ }
618
+ for (const pid of children) {
619
+ queue.push({ depth: current.depth + 1, pid });
620
+ }
621
+ }
622
+ const root = table.rowsByPid.get(rootPid);
623
+ return {
624
+ groups,
625
+ rootIsGroupLeader: root?.pgid === rootPid,
626
+ rootSeen: root !== void 0,
627
+ truncated
628
+ };
629
+ }
630
+ __name(collectOwnership, "collectOwnership");
631
+ function queryProcessTable(timeoutMs = PROCESS_QUERY_TIMEOUT_MS) {
632
+ return runExecFile(POSIX_PS, posixPsArgs(), {
633
+ ...STRING_EXEC_OPTIONS,
634
+ timeout: Math.max(1, Math.min(PROCESS_QUERY_TIMEOUT_MS, timeoutMs))
635
+ });
636
+ }
637
+ __name(queryProcessTable, "queryProcessTable");
638
+ function queryProcessTableSync() {
639
+ const result = spawnSync(POSIX_PS, posixPsArgs(), STRING_EXEC_OPTIONS);
640
+ if (result.error) throw result.error;
641
+ if (result.status !== 0) {
642
+ throw new Error(`ps exited with status ${result.status ?? "unknown"}`);
643
+ }
644
+ return result.stdout;
645
+ }
646
+ __name(queryProcessTableSync, "queryProcessTableSync");
647
+ function posixPsArgs() {
648
+ const columns = process.platform === "linux" ? "pid=,ppid=,pgid=,state=,nlwp=" : "pid=,ppid=,pgid=,state=";
649
+ return ["-A", "-o", columns];
650
+ }
651
+ __name(posixPsArgs, "posixPsArgs");
652
+ function taskkill(rootPid) {
653
+ return runExecFile(
654
+ WINDOWS_TASKKILL,
655
+ ["/f", "/t", "/pid", String(rootPid)],
656
+ STRING_EXEC_OPTIONS
657
+ );
658
+ }
659
+ __name(taskkill, "taskkill");
660
+ function taskkillSync(rootPid) {
661
+ try {
662
+ const result = spawnSync(
663
+ WINDOWS_TASKKILL,
664
+ ["/f", "/t", "/pid", String(rootPid)],
665
+ STRING_EXEC_OPTIONS
666
+ );
667
+ return !result.error && result.status === 0;
668
+ } catch {
669
+ return false;
670
+ }
671
+ }
672
+ __name(taskkillSync, "taskkillSync");
673
+ function runExecFile(file, args, options) {
674
+ return new Promise((resolve, reject) => {
675
+ execFile(file, args, options, (error, stdout) => {
676
+ if (error) reject(error);
677
+ else resolve(stdout);
678
+ });
679
+ });
680
+ }
681
+ __name(runExecFile, "runExecFile");
682
+ function waitForPromise(promise, timeoutMs) {
683
+ let timer;
684
+ const timeout = new Promise((_, reject) => {
685
+ timer = setTimeout(() => reject(new Error("deadline exceeded")), timeoutMs);
686
+ });
687
+ return Promise.race([promise, timeout]).finally(() => {
688
+ if (timer) clearTimeout(timer);
689
+ });
690
+ }
691
+ __name(waitForPromise, "waitForPromise");
692
+ function delay(ms) {
693
+ return new Promise((resolve) => setTimeout(resolve, Math.max(1, ms)));
694
+ }
695
+ __name(delay, "delay");
696
+ function isErrno(error, code) {
697
+ return error !== null && typeof error === "object" && "code" in error && error.code === code;
698
+ }
699
+ __name(isErrno, "isErrno");
700
+ function toError(error) {
701
+ return error instanceof Error ? error : new Error(String(error));
702
+ }
703
+ __name(toError, "toError");
816
704
 
817
705
  // packages/acp-bridge/src/json-string-bytes.ts
818
706
  init_esbuild_shims();
@@ -1174,6 +1062,7 @@ function createSpawnChannelFactory(options = {}) {
1174
1062
  {
1175
1063
  cwd: workspaceCwd,
1176
1064
  stdio: ["pipe", "pipe", "pipe"],
1065
+ detached: process.platform !== "win32",
1177
1066
  windowsHide: true,
1178
1067
  env: childEnv
1179
1068
  }
@@ -1182,7 +1071,7 @@ function createSpawnChannelFactory(options = {}) {
1182
1071
  reservation.cancel();
1183
1072
  throw error;
1184
1073
  }
1185
- const trackedChild = reservation.attach(child);
1074
+ const trackedChild = reservation.attach(child, { ownsProcessTree: true });
1186
1075
  if (child.stderr) {
1187
1076
  const prefix = `[serve pid=${child.pid} cwd=${workspaceCwd}] `;
1188
1077
  const forwarder = createStderrForwarder({
@@ -1301,7 +1190,6 @@ function scrubChildEnv(source, scrubbed, overrides) {
1301
1190
  __name(scrubChildEnv, "scrubChildEnv");
1302
1191
 
1303
1192
  export {
1304
- ndJsonStream,
1305
1193
  DAEMON_ACP_NDJSON_LIMITS,
1306
1194
  getAcpMemoryArgs,
1307
1195
  createStderrForwarder,
@@ -1311,11 +1199,11 @@ export {
1311
1199
  };
1312
1200
  /**
1313
1201
  * @license
1314
- * Copyright 2026 Qwen Team
1202
+ * Copyright 2025 Qwen Team
1315
1203
  * SPDX-License-Identifier: Apache-2.0
1316
1204
  */
1317
1205
  /**
1318
1206
  * @license
1319
- * Copyright 2025 Qwen Team
1207
+ * Copyright 2026 Qwen Team
1320
1208
  * SPDX-License-Identifier: Apache-2.0
1321
1209
  */