@qwen-code/qwen-code 0.23.2 → 0.23.3-nightly.20260911.aaa6a32aae

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 (419) hide show
  1. package/README.md +35 -15
  2. package/bundled/computer-use/SKILL.md +1 -1
  3. package/bundled/goal-draft/SKILL.md +10 -10
  4. package/bundled/qc-helper/docs/configuration/model-providers.md +66 -28
  5. package/bundled/qc-helper/docs/configuration/settings.md +8 -3
  6. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  7. package/bundled/qc-helper/docs/features/channels/dingtalk.md +0 -20
  8. package/bundled/qc-helper/docs/features/channels/dws.md +7 -1
  9. package/bundled/qc-helper/docs/features/channels/overview.md +5 -6
  10. package/bundled/qc-helper/docs/features/commands.md +62 -9
  11. package/bundled/qc-helper/docs/features/computer-use.md +1 -1
  12. package/bundled/qc-helper/docs/features/cross-session-protocol.md +338 -0
  13. package/bundled/qc-helper/docs/features/goals.md +22 -18
  14. package/bundled/qc-helper/docs/features/hooks.md +28 -22
  15. package/bundled/qc-helper/docs/features/sub-agents.md +27 -0
  16. package/bundled/qc-helper/docs/qwen-serve.md +23 -6
  17. package/bundled/review/SKILL.md +93 -80
  18. package/bundled/review/references/persistence.md +2 -0
  19. package/bundled/review/references/posting.md +31 -14
  20. package/bundled/workflow-authoring/SKILL.md +410 -0
  21. package/bundled/workflow-creator/SKILL.md +1 -1
  22. package/chunks/{MaxSizedBox-4C3BKKKY.js → MaxSizedBox-7C5XTBZI.js} +64 -53
  23. package/chunks/{StandaloneSessionPicker-TXVF65YW.js → StandaloneSessionPicker-IGTT3ZRX.js} +88 -76
  24. package/chunks/{acp-startup-profiler-KEU6VAYR.js → acp-startup-profiler-RUQNTNU5.js} +2 -2
  25. package/chunks/acp-subagent-executor-IUHVNVVO.js +140 -0
  26. package/chunks/{acpAgent-H5XBKGB4.js → acpAgent-W43WM2K4.js} +957 -243
  27. package/chunks/{agent-T5LEFJIU.js → agent-2XMXC5JW.js} +48 -38
  28. package/chunks/{agent-headless-VZKSRH36.js → agent-headless-2HHBVCP6.js} +48 -38
  29. package/chunks/{anthropicContentGenerator-PRJWWVYJ.js → anthropicContentGenerator-7RI3MPIW.js} +69 -36
  30. package/chunks/{artifact-tool-G5LHNECG.js → artifact-tool-HHVHCPNG.js} +59 -109
  31. package/chunks/{askUserQuestion-I5W5S3D6.js → askUserQuestion-RFMXTD3B.js} +2 -2
  32. package/chunks/{bridge-AOX5IY44.js → bridge-ID6N4IH5.js} +69 -58
  33. package/chunks/{ca-KC2AISNS.js → ca-MX3WCEEG.js} +1 -1
  34. package/chunks/{channel-management-service-MWQGHPAS.js → channel-management-service-ASCXI7FR.js} +6 -6
  35. package/chunks/{channel-settings-store-XZCGDGHW.js → channel-settings-store-TPJFQAZY.js} +76 -65
  36. package/chunks/{channel-worker-group-SQ5FRWOH.js → channel-worker-group-JR6JOELM.js} +9 -9
  37. package/chunks/{channel-worker-manager-TU4ZNWOE.js → channel-worker-manager-AVKJEZFL.js} +19 -10
  38. package/chunks/{channel-worker-supervisor-EMITFMCP.js → channel-worker-supervisor-OOYY7BAQ.js} +7 -7
  39. package/chunks/{chunk-4WMGYG3F.js → chunk-22FWWGSM.js} +2 -2
  40. package/chunks/{chunk-LWX4WDFF.js → chunk-2S5RIGZJ.js} +43 -15
  41. package/chunks/{chunk-CLKE4IY3.js → chunk-2SZH22YO.js} +1 -1
  42. package/chunks/{chunk-HJ5UJQQL.js → chunk-2UKKQGRA.js} +3639 -1804
  43. package/chunks/{chunk-MWIO7MF6.js → chunk-2WSLXP3W.js} +4 -0
  44. package/chunks/{chunk-HNLMYDQE.js → chunk-33LYAC4R.js} +10 -6
  45. package/chunks/{chunk-VBLAI2HA.js → chunk-3FPYT6QC.js} +0 -31
  46. package/chunks/{chunk-F53KKZUD.js → chunk-3LMDSCLU.js} +158 -10
  47. package/chunks/{chunk-WXFCI3O5.js → chunk-3MAUPOZ4.js} +2 -2
  48. package/chunks/{chunk-CRZBDVP2.js → chunk-432JQKIO.js} +10 -10
  49. package/chunks/{chunk-IRGDIDGJ.js → chunk-43RQ552L.js} +364 -84
  50. package/chunks/{chunk-PFKGV6PO.js → chunk-465USTVK.js} +9 -15
  51. package/chunks/{chunk-WG7BL3FY.js → chunk-473RJLIH.js} +1 -1
  52. package/chunks/{chunk-J3VZF2AL.js → chunk-4O2AXZXU.js} +2 -2
  53. package/chunks/{chunk-N6S3NUYJ.js → chunk-55VOWZ4C.js} +1 -1
  54. package/chunks/{chunk-OWCFKIFQ.js → chunk-5CZMWDJI.js} +2 -2
  55. package/chunks/{chunk-7NDZKE2M.js → chunk-5MUIHID6.js} +5 -5
  56. package/chunks/{chunk-RM244SCQ.js → chunk-5Z74GE4N.js} +1 -1
  57. package/chunks/{chunk-G5VOXCRX.js → chunk-6375QMAO.js} +2 -2
  58. package/chunks/{chunk-3LPJ776W.js → chunk-63GQZKXL.js} +164 -31
  59. package/chunks/{chunk-O2FEO2CB.js → chunk-6GDELAVL.js} +18 -2
  60. package/chunks/{chunk-7PD7ZMX5.js → chunk-6HI2I3OM.js} +168 -6
  61. package/chunks/{chunk-CALNF3Z3.js → chunk-7C57HCOR.js} +1 -1
  62. package/chunks/{chunk-UYDQYDW2.js → chunk-7IBS746B.js} +1 -1
  63. package/chunks/{chunk-AUTUFD5X.js → chunk-ABNX6E6K.js} +1 -1
  64. package/chunks/chunk-ACHCT36C.js +28 -0
  65. package/chunks/{chunk-2WC3Y7YY.js → chunk-AEY27Z35.js} +401 -23
  66. package/chunks/{chunk-AO2VMS72.js → chunk-AQFRRH73.js} +3 -3
  67. package/chunks/{chunk-PDN7FJZV.js → chunk-ASWEMQIZ.js} +4 -4
  68. package/chunks/chunk-AYEJOTIU.js +43 -0
  69. package/chunks/{chunk-QFJZAY7W.js → chunk-BKFRA4F5.js} +5 -5
  70. package/chunks/{chunk-KCF2436G.js → chunk-BNLW5N6U.js} +4 -4
  71. package/chunks/{chunk-GOKAOSCN.js → chunk-BRFOZEPA.js} +2 -2
  72. package/chunks/{process-registry-OAEG6WGC.js → chunk-BYUAT5OC.js} +1 -0
  73. package/chunks/chunk-C5CECJ46.js +340 -0
  74. package/chunks/{chunk-NOO4QFXM.js → chunk-C75BXMPM.js} +1 -3
  75. package/chunks/chunk-CAAMI77K.js +937 -0
  76. package/chunks/{chunk-QTB4VP4K.js → chunk-CBGHRAWM.js} +304 -23
  77. package/chunks/chunk-CF5KXZZX.js +150 -0
  78. package/chunks/chunk-CFMZLE3L.js +75 -0
  79. package/chunks/{chunk-TGNNLRC3.js → chunk-CJ3DHN5I.js} +1 -0
  80. package/chunks/{chunk-ERXNTINK.js → chunk-CQZJYGRX.js} +1 -1
  81. package/chunks/{chunk-WBU2PIZ5.js → chunk-CSDKDHWV.js} +23 -16
  82. package/chunks/{chunk-2EKVPSIJ.js → chunk-D754KKNZ.js} +9 -2
  83. package/chunks/{chunk-E6TI726I.js → chunk-DGC7BKEZ.js} +1 -1
  84. package/chunks/{chunk-7SVM3RP2.js → chunk-DMMOQWRF.js} +4 -6
  85. package/chunks/{chunk-J3TJH52D.js → chunk-DOTF2PF2.js} +1 -1
  86. package/chunks/{chunk-2BMXHB6N.js → chunk-DWBNQR53.js} +7 -7
  87. package/chunks/{chunk-ZN5TKAVR.js → chunk-E5LTUWKZ.js} +3 -3
  88. package/chunks/chunk-EGW3ZP6Y.js +32 -0
  89. package/chunks/chunk-ELRMZTPF.js +374 -0
  90. package/chunks/{chunk-RNAJVXUG.js → chunk-ENAUXRPG.js} +6 -6
  91. package/chunks/{chunk-WXD7INFV.js → chunk-EO4U2X47.js} +10 -8
  92. package/chunks/{chunk-WDVV3LRM.js → chunk-EPVEPTI3.js} +45 -152
  93. package/chunks/chunk-ERU3SDXT.js +27 -0
  94. package/chunks/{chunk-4HOEU2OR.js → chunk-EWJTAP3Y.js} +1 -19
  95. package/chunks/{chunk-GSFV5RQW.js → chunk-EYN3G5XD.js} +328 -4
  96. package/chunks/{chunk-QB3KS3N3.js → chunk-FGROOEKM.js} +5 -40
  97. package/chunks/{chunk-TOOOLHVS.js → chunk-FH5AVEWJ.js} +3 -3
  98. package/chunks/{chunk-DAI65CMX.js → chunk-FJZWRNEW.js} +1 -1
  99. package/chunks/{chunk-GNY7B3CA.js → chunk-FUQK5ZNL.js} +1 -1
  100. package/chunks/{chunk-GOEVQADN.js → chunk-GDIPPCW6.js} +330 -175
  101. package/chunks/{chunk-ALMR3E6Q.js → chunk-GDWE23OR.js} +3 -3
  102. package/chunks/{chunk-LNYV4GXX.js → chunk-GSKX53AN.js} +0 -139
  103. package/chunks/{chunk-ELD3OBPU.js → chunk-GWOVD63C.js} +3 -3
  104. package/chunks/{chunk-IWABUX6T.js → chunk-GX5FF2IE.js} +6 -6
  105. package/chunks/{chunk-22GORRNY.js → chunk-GZMNHAYC.js} +1 -1
  106. package/chunks/{chunk-YZTGGCEE.js → chunk-H3TFIFX3.js} +1 -1
  107. package/chunks/{chunk-6G4V7SE4.js → chunk-HG46TTAG.js} +1 -1
  108. package/chunks/{chunk-FETY36NQ.js → chunk-HGEUHUEV.js} +1 -1
  109. package/chunks/{chunk-KEPC5BOL.js → chunk-IBRQG2MP.js} +12 -15
  110. package/chunks/{chunk-OXR34GCD.js → chunk-IILWL3KY.js} +2054 -146
  111. package/chunks/{chunk-IW6RQPQB.js → chunk-IJOS26LH.js} +1 -3
  112. package/chunks/{chunk-ORFIYTI2.js → chunk-IK2MWJP5.js} +1 -1
  113. package/chunks/{chunk-CMWU6P4D.js → chunk-IRJRB3OD.js} +1 -1
  114. package/chunks/{chunk-QHLHE2OT.js → chunk-IUN5ZMFY.js} +1 -1
  115. package/chunks/{chunk-LYT2OU7D.js → chunk-IXXV6BVB.js} +172 -6
  116. package/chunks/{chunk-R3JIDRUL.js → chunk-J6H4JP25.js} +4 -4
  117. package/chunks/{chunk-NB3NDQQK.js → chunk-J6SBP5G2.js} +1 -1
  118. package/chunks/{chunk-TRQNRP2H.js → chunk-J7LBAKDH.js} +46 -3
  119. package/chunks/{chunk-67XTVRVB.js → chunk-JJFHISXU.js} +30 -25
  120. package/chunks/chunk-JL6APGBX.js +43 -0
  121. package/chunks/{chunk-NX7ZTXFF.js → chunk-JSKEW4E7.js} +2 -1
  122. package/chunks/{chunk-BK7D2JR6.js → chunk-JVTXAA35.js} +3 -3
  123. package/chunks/chunk-K2OJUPOE.js +78 -0
  124. package/chunks/{chunk-G3ZUMSFS.js → chunk-K3U6VB3O.js} +6 -6
  125. package/chunks/{chunk-4I3WFI3U.js → chunk-K4KWLF7Q.js} +12 -12
  126. package/chunks/{chunk-WXPPUPHM.js → chunk-KWFFJ6AK.js} +1 -1
  127. package/chunks/{chunk-46MMBZHI.js → chunk-KZYOFJ6V.js} +4 -4
  128. package/chunks/{chunk-ULZECEIP.js → chunk-LDQHA6L4.js} +2 -20
  129. package/chunks/{chunk-7LTCFO6T.js → chunk-LQBAFO5D.js} +6 -5
  130. package/chunks/{chunk-SOA4HKRJ.js → chunk-LT2XFADM.js} +2 -2
  131. package/chunks/{chunk-JYGIJA4W.js → chunk-LWWRJRCD.js} +1 -1
  132. package/chunks/{chunk-YQGW3M6Z.js → chunk-MFQWRBFB.js} +5 -5
  133. package/chunks/{chunk-TODNHE76.js → chunk-MUFGTWQH.js} +5 -5
  134. package/chunks/{chunk-5DQ4YTIZ.js → chunk-MV5XRRML.js} +3 -3
  135. package/chunks/{chunk-IR6JKBAP.js → chunk-NOUK63IR.js} +2 -2
  136. package/chunks/{chunk-XQ4RDO5B.js → chunk-NV77SEX3.js} +1 -1
  137. package/chunks/{chunk-OFVAS4AR.js → chunk-NWDPOFJI.js} +2 -2
  138. package/chunks/chunk-NY6OPAPS.js +820 -0
  139. package/chunks/{chunk-WDN64MVT.js → chunk-O5VX66FB.js} +127 -18
  140. package/chunks/{chunk-MV5DTLJV.js → chunk-OHCR4O3U.js} +1 -1
  141. package/chunks/{chunk-LEAOJ43M.js → chunk-OKOPKQ2X.js} +1310 -2107
  142. package/chunks/{chunk-B25JYXZE.js → chunk-ONLJBOI2.js} +971 -17
  143. package/chunks/{chunk-QQK4L3UU.js → chunk-OWUAZXXN.js} +132 -26
  144. package/chunks/{chunk-R457KFV7.js → chunk-P42IUOAO.js} +3 -3
  145. package/chunks/{chunk-LUNC5KCL.js → chunk-PRELUGCQ.js} +214 -39
  146. package/chunks/{chunk-5OZUKLL7.js → chunk-QSMQKTXV.js} +4 -4
  147. package/chunks/{chunk-FAJPLSYF.js → chunk-QTQYLQ5A.js} +85 -81
  148. package/chunks/{chunk-CALTQWTZ.js → chunk-QVZDV4ZS.js} +2 -2
  149. package/chunks/{chunk-J6MB5ZHZ.js → chunk-QZW6WRB7.js} +2 -1
  150. package/chunks/{chunk-KFECPHLV.js → chunk-RBWAGV73.js} +3 -3
  151. package/chunks/{chunk-4VY3ITHR.js → chunk-RF5RQRTD.js} +3 -3
  152. package/chunks/{chunk-HIXUUCGY.js → chunk-RPMXMR6U.js} +2 -2
  153. package/chunks/{chunk-3OAXF3UK.js → chunk-RRQEZBL2.js} +3756 -1343
  154. package/chunks/{chunk-4ALNJDHL.js → chunk-RSGEAWFJ.js} +19 -1
  155. package/chunks/{chunk-5BH2AIEY.js → chunk-RUE62UH6.js} +2 -2
  156. package/chunks/{chunk-PQEISIKS.js → chunk-SAH4BD2J.js} +0 -67
  157. package/chunks/{chunk-A7EFXK7P.js → chunk-SAOJHRWY.js} +2 -2
  158. package/chunks/{chunk-JO77FGNZ.js → chunk-SDUIETBG.js} +19 -7
  159. package/chunks/{chunk-6RZX2HIH.js → chunk-TBEXLLAO.js} +2 -2
  160. package/chunks/{chunk-PSPAM24S.js → chunk-TBSCTWKF.js} +6 -0
  161. package/chunks/{chunk-HRPFBHW7.js → chunk-TPKQIA7G.js} +1 -0
  162. package/chunks/{chunk-XDNFODER.js → chunk-TUIW5LLK.js} +1 -1
  163. package/chunks/{chunk-APXIW2TF.js → chunk-TVV5FA3G.js} +4 -4
  164. package/chunks/chunk-U6H3XTFA.js +95 -0
  165. package/chunks/{chunk-S5QR6CB5.js → chunk-UKMWZ5NS.js} +108 -887
  166. package/chunks/{chunk-U6REWGVR.js → chunk-VG2BRSEK.js} +2 -2
  167. package/chunks/chunk-VGBOJH2D.js +127 -0
  168. package/chunks/chunk-VGY2RGXL.js +100 -0
  169. package/chunks/{chunk-ZP5XDLSA.js → chunk-VLWG3EHY.js} +12 -12
  170. package/chunks/{chunk-4JNHNVAZ.js → chunk-W547PYQ7.js} +9 -4
  171. package/chunks/{chunk-7VEYUF3N.js → chunk-W5ZQMAEM.js} +1 -1
  172. package/chunks/{chunk-QAZ2MGYT.js → chunk-W7JJLUSB.js} +2 -2
  173. package/chunks/{chunk-CCBTNJB4.js → chunk-W7Q7XDQI.js} +39 -27
  174. package/chunks/{chunk-DARWOZY6.js → chunk-WD6YQI5M.js} +1 -1
  175. package/chunks/{chunk-F2NYVASI.js → chunk-WXAWG3JS.js} +30 -13
  176. package/chunks/{chunk-NPKCVSXX.js → chunk-XB5JRCAM.js} +11 -9
  177. package/chunks/{chunk-XSOXPG2L.js → chunk-XE46RQFI.js} +136 -8
  178. package/chunks/{chunk-QTNCGZHQ.js → chunk-XX5HQLCZ.js} +16 -0
  179. package/chunks/{chunk-2Z3T52OC.js → chunk-Y5TM7SBV.js} +7 -2
  180. package/chunks/chunk-YC6XOB5N.js +691 -0
  181. package/chunks/{chunk-CWVZBIZJ.js → chunk-YDW4ERSS.js} +1 -1
  182. package/chunks/{chunk-TRWQQBVH.js → chunk-YGCTOXUT.js} +10 -24
  183. package/chunks/{chunk-WK7P62DV.js → chunk-YKC67ZEF.js} +6 -6
  184. package/chunks/{chunk-KA5HR3G2.js → chunk-YKM6MITI.js} +5 -5
  185. package/chunks/{chunk-X7LFJF5D.js → chunk-YM6KUQ2S.js} +36 -84
  186. package/chunks/{chunk-HZ2HUXX7.js → chunk-YS2ZJSOA.js} +29 -12
  187. package/chunks/{chunk-G37O7YO6.js → chunk-ZAWM6KRF.js} +3 -3
  188. package/chunks/{chunk-H3Q3RSKZ.js → chunk-ZFIWHBJ3.js} +1 -1
  189. package/chunks/{chunk-XBVNNDPK.js → chunk-ZHKTKHMO.js} +8 -1
  190. package/chunks/{chunk-YLOHCA6I.js → chunk-ZKWO4CF4.js} +2 -2
  191. package/chunks/{chunk-VJJXG73H.js → chunk-ZMQL5BL5.js} +21 -6
  192. package/chunks/{chunk-FGHPZGOP.js → chunk-ZMUYBOYB.js} +39 -55
  193. package/chunks/{chunk-FV4DM2M4.js → chunk-ZNI3YJHS.js} +26 -6
  194. package/chunks/{chunk-565U2ANU.js → chunk-ZTTC7T4X.js} +1 -1
  195. package/chunks/{chunk-7OCIQNKX.js → chunk-ZW2EUO2A.js} +1 -1
  196. package/chunks/codex-subagent-executor-26XOHVKH.js +585 -0
  197. package/chunks/{config-utils-GPLIABL2.js → config-utils-JUG3MOYN.js} +68 -57
  198. package/chunks/{contextCommand-NCUQUDBY.js → contextCommand-6K3POZFA.js} +65 -54
  199. package/chunks/{core-runtime-WKYKWVYU.js → core-runtime-XQFZLA2V.js} +66 -55
  200. package/chunks/{create-sub-session-TGIX63YU.js → create-sub-session-4UJ6RM6W.js} +5 -2
  201. package/chunks/{create-sub-session-PPLXB3JJ.js → create-sub-session-T4IYIOC7.js} +178 -91
  202. package/chunks/{cron-create-GTPVMJCF.js → cron-create-6466RWSO.js} +2 -2
  203. package/chunks/{cron-delete-ZBK27Z4K.js → cron-delete-W4QUWHOA.js} +2 -2
  204. package/chunks/{cron-list-KTFKFDKC.js → cron-list-Q5LJ5PZE.js} +2 -2
  205. package/chunks/{daemon-2CKIAO3I.js → daemon-PHPJUXDZ.js} +4 -2
  206. package/chunks/{daemon-git-worktree-guard-73ZWOLKL.js → daemon-git-worktree-guard-5WEMZ64U.js} +65 -54
  207. package/chunks/{daemon-status-provider-OK7VONJG.js → daemon-status-provider-GMD7QD4T.js} +74 -63
  208. package/chunks/{daemon-trust-policy-CAUCREG2.js → daemon-trust-policy-IPBZES2Z.js} +71 -60
  209. package/chunks/{daemon-trust-policy-monitor-3Y36OOEQ.js → daemon-trust-policy-monitor-MHYEN7X7.js} +71 -60
  210. package/chunks/{de-UU2YTO37.js → de-OOLZAU2U.js} +1 -1
  211. package/chunks/{deferred-core-runtime-Q7WFWYD3.js → deferred-core-runtime-CY43FZNZ.js} +63 -52
  212. package/chunks/{discovery-XP4RMDUM.js → discovery-5KUEPR65.js} +2 -2
  213. package/chunks/{display-image-CTNHJRZC.js → display-image-6AZIHP3J.js} +3 -3
  214. package/chunks/{dist-F34J4FZX.js → dist-2QYIVNS6.js} +2 -5
  215. package/chunks/{dist-6YDUH3BB.js → dist-GIMQXYLI.js} +10 -631
  216. package/chunks/{dist-NP7QKLVG.js → dist-GUB7QRYA.js} +3 -6
  217. package/chunks/{dist-Y5KC3IHW.js → dist-L45UB6DG.js} +233 -35
  218. package/chunks/{dist-XLV33CLY.js → dist-MPUZZOG5.js} +5 -18
  219. package/chunks/{dist-ZDNJK74R.js → dist-PA7WPFVE.js} +6 -37
  220. package/chunks/{dist-F6JLAJLE.js → dist-T6DDPDLQ.js} +16 -36
  221. package/chunks/{dist-BNQVF565.js → dist-TFGETXFN.js} +14 -37
  222. package/chunks/{dist-UFTFGI6I.js → dist-VDLSBCLM.js} +2 -6
  223. package/chunks/{edit-YJD6IETK.js → edit-6NUP5IPX.js} +48 -38
  224. package/chunks/{en-YJNRUQG4.js → en-ZSZW3PZX.js} +4 -1
  225. package/chunks/{enter-worktree-YFTKHXHZ.js → enter-worktree-EETDMJRF.js} +5 -5
  226. package/chunks/{enterPlanMode-EFPVTWIH.js → enterPlanMode-AZHYHEII.js} +48 -38
  227. package/chunks/{environment-HP3AXFTB.js → environment-ON6GIQ4F.js} +66 -55
  228. package/chunks/{errors-22ON46G7.js → errors-DQE63SCC.js} +65 -54
  229. package/chunks/exec-66WQIVYU.js +505 -0
  230. package/chunks/{exit-worktree-NF2XEMES.js → exit-worktree-DIPJ6S55.js} +5 -5
  231. package/chunks/{exitPlanMode-MOQUNCBH.js → exitPlanMode-NHBV6LAI.js} +48 -38
  232. package/chunks/{fast-path-2X7BPMXX.js → fast-path-EPJSUZZC.js} +7 -7
  233. package/chunks/{fast-path-settings-SATXY3PD.js → fast-path-settings-XDYX7X5Z.js} +2 -2
  234. package/chunks/{fr-HKNWVXRJ.js → fr-JJWM2HUS.js} +1 -1
  235. package/chunks/{glob-Y7ACIB3P.js → glob-MNEXQ2NV.js} +51 -41
  236. package/chunks/{goal-tools-DABMICUC.js → goal-tools-D2A4QBCJ.js} +54 -40
  237. package/chunks/{grep-BLHF2S5D.js → grep-EFWPV3MM.js} +2 -2
  238. package/chunks/{handleAutoUpdate-MCAMHYDI.js → handleAutoUpdate-2RY3OQA6.js} +67 -56
  239. package/chunks/{i18n-C3GDCALP.js → i18n-HTHDB3I7.js} +64 -53
  240. package/chunks/{image-gen-XP4NNIYG.js → image-gen-2PHED3P4.js} +8 -6
  241. package/chunks/{initializer-4URDQL2G.js → initializer-JEVLJCQA.js} +71 -60
  242. package/chunks/{installationInfo-LBOL6SBV.js → installationInfo-ITRB6J4L.js} +63 -52
  243. package/chunks/{ja-GJS5RZGU.js → ja-L67TXFDJ.js} +1 -1
  244. package/chunks/list-KOUIMHT5.js +133 -0
  245. package/chunks/{list-agents-2CXPGJUE.js → list-agents-IY4NEWLP.js} +17 -7
  246. package/chunks/{llm-2KPNSAVY.js → llm-F7WHGESY.js} +132 -120
  247. package/chunks/{llm-content-generator-GR3FOHLB.js → llm-content-generator-NYQ2NAVA.js} +6 -5
  248. package/chunks/{loadedSettingsAdapter-DVKROEJD.js → loadedSettingsAdapter-HZUAX5CX.js} +71 -60
  249. package/chunks/{loggingContentGenerator-P4K6K5W4.js → loggingContentGenerator-WMNU7C5J.js} +70 -59
  250. package/chunks/{loop-wakeup-HL6XOWI4.js → loop-wakeup-ANX25YW2.js} +3 -3
  251. package/chunks/{ls-YV7RKLKY.js → ls-4XCMJNZF.js} +4 -4
  252. package/chunks/{lsp-NO3AMRZT.js → lsp-K5E2Y64R.js} +1 -1
  253. package/chunks/{managed-npm-update-VWBKHNIN.js → managed-npm-update-EJJB65QI.js} +63 -52
  254. package/chunks/mcp-I73R6HS3.js +127 -0
  255. package/chunks/{monitor-A255TNZR.js → monitor-T56GJNA4.js} +50 -40
  256. package/chunks/{nonInteractiveCli-LXGIKQAT.js → nonInteractiveCli-CKHHJ423.js} +120 -109
  257. package/chunks/{notebook-edit-5UYHS2DM.js → notebook-edit-W5TU3EZ3.js} +48 -38
  258. package/chunks/openai-WX26N5OJ.js +47 -0
  259. package/chunks/{openaiContentGenerator-A6MAMEO5.js → openaiContentGenerator-TH6YAWAH.js} +33 -25
  260. package/chunks/openaiResponsesContentGenerator-EWLWQPKS.js +1738 -0
  261. package/chunks/{pidfile-B7DZC4TP.js → pidfile-RCC6TCEM.js} +63 -52
  262. package/chunks/process-registry-X6ZCASEN.js +10 -0
  263. package/chunks/{processUtils-BPZ2MCZS.js → processUtils-DQDQBRMC.js} +2 -2
  264. package/chunks/{prompt-terminal-ledger-FYYTAOXS.js → prompt-terminal-ledger-2LXWAGWU.js} +64 -53
  265. package/chunks/{pt-FXMYXEUV.js → pt-77SBDL4B.js} +1 -1
  266. package/chunks/{qwenContentGenerator-4IOJFD4S.js → qwenContentGenerator-LG65Z2YV.js} +61 -49
  267. package/chunks/{qwenOAuth2-KX6LVYQ3.js → qwenOAuth2-PJ63CCFD.js} +7 -5
  268. package/chunks/{read-file-A4H4O3VQ.js → read-file-72HMRUT4.js} +12 -9
  269. package/chunks/{read-mcp-resource-D3N75DGF.js → read-mcp-resource-NPF44YSC.js} +1 -1
  270. package/chunks/{record-artifact-Q5CRGJTP.js → record-artifact-MDXCCW2J.js} +3 -3
  271. package/chunks/record-source-VJLKDGGR.js +22 -0
  272. package/chunks/{report-findings-TJ34R7QK.js → report-findings-CZTYMZTC.js} +4 -4
  273. package/chunks/{request-shutdown-LRKMTBAD.js → request-shutdown-KOZHPVZU.js} +5 -5
  274. package/chunks/{resumeHistoryUtils-YQQ43E4N.js → resumeHistoryUtils-S2Q3M3EH.js} +69 -58
  275. package/chunks/{ripGrep-W32NWFTA.js → ripGrep-B2I3L5CO.js} +17 -13
  276. package/chunks/{ru-RMHURE5U.js → ru-UYWHKWF2.js} +1 -1
  277. package/chunks/{run-qwen-serve-WBSWWIRV.js → run-qwen-serve-AOPYFCVP.js} +305 -132
  278. package/chunks/{runtime-VRVBX2E5.js → runtime-TZMHKZAP.js} +77 -66
  279. package/chunks/{scheduled-tasks-D65KJDA3.js → scheduled-tasks-7RL6ZOYT.js} +72 -60
  280. package/chunks/{scheduler-M2YPN7Z7.js → scheduler-D6RLOFNU.js} +65 -54
  281. package/chunks/{sdk-exporters-grpc-MXTVSE3C.js → sdk-exporters-grpc-Y2ZUQDUQ.js} +2 -2
  282. package/chunks/{sdk-exporters-http-7R2ARBPV.js → sdk-exporters-http-VWTF4W6K.js} +3 -3
  283. package/chunks/{sdk-impl-YOLO7LV4.js → sdk-impl-G6FVTBQZ.js} +9 -9
  284. package/chunks/{send-message-76BKWKFZ.js → send-message-MMZVSS7P.js} +12 -9
  285. package/chunks/{serve-BE3H2P6P.js → serve-HWWDYI37.js} +72 -61
  286. package/chunks/{server-FLY5JERG.js → server-MD2X5U5L.js} +3156 -564
  287. package/chunks/{session-JVN62R5K.js → session-AFUMFNN7.js} +124 -113
  288. package/chunks/{session-attachments-root-7ACGLHXA.js → session-attachments-root-QPN3YWTY.js} +63 -52
  289. package/chunks/{session-pr-refresh-TQS57SDK.js → session-pr-refresh-4Y2ANMJX.js} +72 -60
  290. package/chunks/{settings-D44YMZFT.js → settings-QQRQ2LR7.js} +74 -63
  291. package/chunks/{shell-3VE6I4V5.js → shell-NUYUYMVI.js} +48 -38
  292. package/chunks/{skill-FHEGRRZU.js → skill-KHLDVOXW.js} +68 -30
  293. package/chunks/{skill-settings-VHEJMBFL.js → skill-settings-INLEGDEZ.js} +70 -59
  294. package/chunks/{spawnChannel-T6MX2ZDN.js → spawnChannel-KBGZHW2G.js} +67 -56
  295. package/chunks/{standalone-update-QUGHFMCS.js → standalone-update-3QP5NDVJ.js} +65 -54
  296. package/chunks/{start-opentui-ui-IHIIZ2LE.js → start-opentui-ui-VBT3XDWN.js} +2682 -2153
  297. package/chunks/{startInteractiveUI-LR7K2ARZ.js → startInteractiveUI-AZHKCHMR.js} +1562 -2317
  298. package/chunks/{syntheticOutput-D2P5V6RG.js → syntheticOutput-KRASPDE3.js} +2 -2
  299. package/chunks/{task-create-MWXJFRRM.js → task-create-TNXNT7ZD.js} +8 -8
  300. package/chunks/{task-list-EYO3FE57.js → task-list-FHNIJDKT.js} +1 -1
  301. package/chunks/{task-stop-BFSKRTGV.js → task-stop-MG4ZMTEI.js} +1 -1
  302. package/chunks/{task-update-2JJJRHMT.js → task-update-4HU62CJT.js} +8 -8
  303. package/chunks/{team-create-GY3VFY47.js → team-create-K5DNSJXR.js} +50 -40
  304. package/chunks/{team-delete-IQZ6XGFI.js → team-delete-2T44GUNN.js} +1 -1
  305. package/chunks/{team-plan-approval-BQPGZOT5.js → team-plan-approval-2ZNAQT2A.js} +48 -38
  306. package/chunks/{terminal-image-renderer-YNYW5CQG.js → terminal-image-renderer-23CW4A6Q.js} +65 -54
  307. package/chunks/{theme-manager-U6CIK3GM.js → theme-manager-G2333AMH.js} +63 -52
  308. package/chunks/{todoWrite-5ERKFWAK.js → todoWrite-BO2GR5MN.js} +4 -4
  309. package/chunks/{tool-search-XI3QWD5I.js → tool-search-MKQCKXN5.js} +22 -15
  310. package/chunks/{total-session-admission-3SNSJJ32.js → total-session-admission-ENKTM2KX.js} +69 -58
  311. package/chunks/{trustedFolders-OVAQKNV5.js → trustedFolders-2ETDL7OD.js} +64 -53
  312. package/chunks/{update-relaunch-XV5O74E3.js → update-relaunch-FMVNN5KA.js} +5 -5
  313. package/chunks/{updateCheck-CHUYWD6L.js → updateCheck-KWRV5KLJ.js} +66 -55
  314. package/chunks/{useAutoAcceptIndicator-VKSVIXZC.js → useAutoAcceptIndicator-7AUXAIQF.js} +73 -62
  315. package/chunks/{validateNonInterActiveAuth-ZNUTD3E5.js → validateNonInterActiveAuth-NETKLLDV.js} +117 -106
  316. package/chunks/{version-EK7VAGSI.js → version-DACNN2ZM.js} +1 -1
  317. package/chunks/{web-fetch-24KZO763.js → web-fetch-CIVCRET4.js} +16 -12
  318. package/chunks/{web-search-CRNXKZ2X.js → web-search-GOHZRGMM.js} +389 -327
  319. package/chunks/{web-shell-static-BFDESDD4.js → web-shell-static-T7UGLVE4.js} +2 -7
  320. package/chunks/workflow-IL2FOALZ.js +1324 -0
  321. package/chunks/workspace-providers-status-YGXL6N5U.js +131 -0
  322. package/chunks/{workspace-registration-store-HKLJEDQX.js → workspace-registration-store-E4IAOFFZ.js} +3 -1
  323. package/chunks/{workspace-registry-7RDDOBLN.js → workspace-registry-KX6BIBYK.js} +69 -58
  324. package/chunks/{workspace-runtime-coordinator-LEPDPXJO.js → workspace-runtime-coordinator-2KYYGDDR.js} +72 -59
  325. package/chunks/{workspace-service-5IFDCNN3.js → workspace-service-5Q6LWBYR.js} +76 -65
  326. package/chunks/{workspace-skills-status-FJ3HNH4H.js → workspace-skills-status-PJZTFPVV.js} +72 -61
  327. package/chunks/{workspace-trust-reconciler-PQFHIWLR.js → workspace-trust-reconciler-HS6PWNEA.js} +77 -66
  328. package/chunks/{write-file-ERG67ZFX.js → write-file-JB3DRM7O.js} +50 -40
  329. package/chunks/{zh-VBFCRQBL.js → zh-7UJA4ICT.js} +4 -1
  330. package/chunks/{zh-TW-N2TBF2F2.js → zh-TW-RV24PWUI.js} +4 -1
  331. package/chunks/{zoom-image-WQYEC3SR.js → zoom-image-AVHQFOOQ.js} +12 -9
  332. package/cli.js +16 -16
  333. package/codeModeHost.js +4425 -0
  334. package/export-transcript-document.css +1 -0
  335. package/export-transcript-document.js +164 -165
  336. package/locales/ca.js +2 -2
  337. package/locales/de.js +2 -2
  338. package/locales/en.js +5 -2
  339. package/locales/fr.js +2 -2
  340. package/locales/ja.js +2 -2
  341. package/locales/pt.js +2 -2
  342. package/locales/ru.js +2 -2
  343. package/locales/zh-TW.js +5 -2
  344. package/locales/zh.js +5 -2
  345. package/package.json +6 -4
  346. package/web-shell/assets/{abnfDiagram-VCTEODGH-BRLgQbnT.js → abnfDiagram-VCTEODGH-BH2nK5Z_.js} +1 -1
  347. package/web-shell/assets/{arc-qAF9_XsR.js → arc-CUUQ6krv.js} +1 -1
  348. package/web-shell/assets/{architectureDiagram-5GKGNRK7-BorUttEz.js → architectureDiagram-5GKGNRK7-CJjiRuGx.js} +1 -1
  349. package/web-shell/assets/{blockDiagram-NRAW4CY4-Bj0qZVxu.js → blockDiagram-NRAW4CY4-GCDyU9ZX.js} +1 -1
  350. package/web-shell/assets/{c4Diagram-UCG6FXSJ-BTqJis32.js → c4Diagram-UCG6FXSJ-C68MiN6h.js} +1 -1
  351. package/web-shell/assets/channel-DauVlmdF.js +1 -0
  352. package/web-shell/assets/{chunk-2Q5K7J3B-RrQ5X8m-.js → chunk-2Q5K7J3B-_8B6frXZ.js} +1 -1
  353. package/web-shell/assets/{chunk-5VM5RSS4-uUjDl8wO.js → chunk-5VM5RSS4-CroSinX7.js} +1 -1
  354. package/web-shell/assets/{chunk-F27PBJKO-C3JhpyzI.js → chunk-F27PBJKO-CGn4Z0Fx.js} +1 -1
  355. package/web-shell/assets/{chunk-G27WJ6UU-C8ZNFs7F.js → chunk-G27WJ6UU-BI5nLQcf.js} +1 -1
  356. package/web-shell/assets/{chunk-JWPE2WC7-DNpXtEOs.js → chunk-JWPE2WC7-CYJH0FuH.js} +1 -1
  357. package/web-shell/assets/{chunk-LCL6LL3I-DagA2ZLw.js → chunk-LCL6LL3I-DjWZUqA1.js} +1 -1
  358. package/web-shell/assets/{chunk-POPQ4Y6H-R23uH7Xm.js → chunk-POPQ4Y6H-DcTkIHm8.js} +1 -1
  359. package/web-shell/assets/{chunk-SVP7TREG-Qz9RN_BR.js → chunk-SVP7TREG-E8sZT5uK.js} +1 -1
  360. package/web-shell/assets/{chunk-XXDRQBXY-jYb1_hni.js → chunk-XXDRQBXY-CurjPKw_.js} +1 -1
  361. package/web-shell/assets/classDiagram-DTDB5LWJ-BuIh7bj1.js +1 -0
  362. package/web-shell/assets/classDiagram-v2-JRS7N3AN-BuIh7bj1.js +1 -0
  363. package/web-shell/assets/{cose-bilkent-JH36ORCC-Cv2OunpE.js → cose-bilkent-JH36ORCC-CJEnNhth.js} +1 -1
  364. package/web-shell/assets/{cynefin-OW5HDTMX-LH42KFJx.js → cynefin-OW5HDTMX-jwEkm0yw.js} +1 -1
  365. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-Dha4_OoR.js → cynefinDiagram-5FMLGOSQ-B-OVQ6AO.js} +1 -1
  366. package/web-shell/assets/{dagre-3AP2YEHR-Br5lnUKD.js → dagre-3AP2YEHR-CKKK9WNR.js} +1 -1
  367. package/web-shell/assets/{diagram-S7CK7UJ4-dpKq2bBX.js → diagram-S7CK7UJ4-D486veFQ.js} +1 -1
  368. package/web-shell/assets/{diagram-UQ7AKVKN-BAgHWpXr.js → diagram-UQ7AKVKN-C3GujqHv.js} +1 -1
  369. package/web-shell/assets/{diagram-VSXAHHWV-GRRzpyE2.js → diagram-VSXAHHWV-BrOTDwuU.js} +1 -1
  370. package/web-shell/assets/{diagram-VX7I27RA-BNFiaYpG.js → diagram-VX7I27RA-C4D9kWE3.js} +1 -1
  371. package/web-shell/assets/{diagram-Z3DM3KII-BisZzB_h.js → diagram-Z3DM3KII-7rAManT0.js} +1 -1
  372. package/web-shell/assets/{ebnfDiagram-PWID7BFC-B1xbwycf.js → ebnfDiagram-PWID7BFC-CqVzKOdr.js} +1 -1
  373. package/web-shell/assets/{erDiagram-SSCWMZ5O-CQMzbGE5.js → erDiagram-SSCWMZ5O-D2s08fc_.js} +1 -1
  374. package/web-shell/assets/{flowDiagram-A5DVABFB-CZ_Zondl.js → flowDiagram-A5DVABFB-CrKtBxB2.js} +1 -1
  375. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-BTh2ShxS.js → ganttDiagram-EL5Y4UJY-CD1CKdlt.js} +1 -1
  376. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-oHOB-Uxt.js → gitGraphDiagram-WWUBYQGX-CHDXdVNn.js} +1 -1
  377. package/web-shell/assets/index-D8tzgUOC.css +36 -0
  378. package/web-shell/assets/{index-DWoFMu5x.js → index-DWz95m74.js} +1 -1
  379. package/web-shell/assets/index-cDFf68Wd.js +2204 -0
  380. package/web-shell/assets/{infoDiagram-RXCK75RN-C0QpudbG.js → infoDiagram-RXCK75RN-Cr1oLCwe.js} +1 -1
  381. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-a6B741uT.js → ishikawaDiagram-5VMMS53U--RghV1mm.js} +1 -1
  382. package/web-shell/assets/{journeyDiagram-EYS64GPL-Dbht9ICp.js → journeyDiagram-EYS64GPL-MN1ZkGW8.js} +1 -1
  383. package/web-shell/assets/{kanban-definition-3QL26DDD-D4OFR8-h.js → kanban-definition-3QL26DDD-DL05VTn0.js} +1 -1
  384. package/web-shell/assets/{layout-Dvdh5jRH.js → layout-D_TvQzvn.js} +1 -1
  385. package/web-shell/assets/{linear-Dvc6KIW2.js → linear-B_0OH6XF.js} +1 -1
  386. package/web-shell/assets/{mermaid.core-CB36RfIb.js → mermaid.core-B9Nklh9I.js} +6 -6
  387. package/web-shell/assets/{mindmap-definition-FBJOCRG2-Fmqo1CjP.js → mindmap-definition-FBJOCRG2-CevIQ0LR.js} +1 -1
  388. package/web-shell/assets/{pegDiagram-XKGWAZYB-CCxYBoA4.js → pegDiagram-XKGWAZYB-DQ8PIv0d.js} +1 -1
  389. package/web-shell/assets/{pieDiagram-E7YTZNPT-BVHKQFzt.js → pieDiagram-E7YTZNPT-BVTV1pPe.js} +1 -1
  390. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-l95IznwR.js → quadrantDiagram-AXDQQJYC-DHN6nhpe.js} +1 -1
  391. package/web-shell/assets/qwen-code-notification-BRVagufF.png +0 -0
  392. package/web-shell/assets/{railroadDiagram-O6MQD6OU-BlLdRdXp.js → railroadDiagram-O6MQD6OU-8HOyX0u-.js} +1 -1
  393. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BkDLBR5w.js → requirementDiagram-EFPCY7ZU-9W4_14i8.js} +1 -1
  394. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-jAIqRp65.js → sankeyDiagram-P5KCCOFB-DSUBB2XP.js} +1 -1
  395. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-f-soZYPr.js → sequenceDiagram-WJ2MYXX4-DD3jH6Jn.js} +1 -1
  396. package/web-shell/assets/{sizeCapture-X5ZJPWSS-BzOuAfB2.js → sizeCapture-X5ZJPWSS-RAFTU3Cz.js} +1 -1
  397. package/web-shell/assets/{stateDiagram-HBIQ2CUA-BPLSs12r.js → stateDiagram-HBIQ2CUA-Drk-oZ2x.js} +1 -1
  398. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-QzYteVIm.js +1 -0
  399. package/web-shell/assets/{swimlanes-XN3QIQJK-D-9E_RIR.js → swimlanes-XN3QIQJK-Cy2nlOGx.js} +1 -1
  400. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-xTr-HG26.js +8 -0
  401. package/web-shell/assets/{timeline-definition-24CTP7MA-CT56K-gV.js → timeline-definition-24CTP7MA-B7outYof.js} +1 -1
  402. package/web-shell/assets/{vennDiagram-4TSXK5OY-B-vi4IyO.js → vennDiagram-4TSXK5OY-Di_u1Ic6.js} +1 -1
  403. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-C9O7Ju98.js → wardleyDiagram-VM6X3IG4-DYocuCAM.js} +1 -1
  404. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-6d8w3jg2.js → xychartDiagram-S5SC5T6Z-AADDse54.js} +1 -1
  405. package/web-shell/index.html +29 -5
  406. package/chunks/chunk-V7RNNPGC.js +0 -44
  407. package/chunks/list-JOGBAC2R.js +0 -122
  408. package/chunks/mcp-6YYNSYLK.js +0 -116
  409. package/chunks/workflow-HD5NYMW5.js +0 -2907
  410. package/chunks/workspace-providers-status-MAM42IZS.js +0 -120
  411. package/web-shell/assets/channel-COIuCrVH.js +0 -1
  412. package/web-shell/assets/classDiagram-DTDB5LWJ-DoX6OYqu.js +0 -1
  413. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DoX6OYqu.js +0 -1
  414. package/web-shell/assets/index-CI1ysIEv.js +0 -2154
  415. package/web-shell/assets/index-CpxXGH-8.css +0 -36
  416. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-IRul-LaT.js +0 -1
  417. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D6lgKepA.js +0 -8
  418. package/chunks/{chunk-JA5CBKRP.js → chunk-7NXSVSFB.js} +0 -0
  419. package/chunks/{open-with-auth-6MVIHMXB.js → open-with-auth-XFCCJOO6.js} +3 -3
@@ -0,0 +1,820 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ ProcessRegistry
5
+ } from "./chunk-BYUAT5OC.js";
6
+ import {
7
+ createStderrForwarder
8
+ } from "./chunk-YKM6MITI.js";
9
+ import {
10
+ ClientSideConnection,
11
+ PROTOCOL_VERSION,
12
+ RequestError,
13
+ ndJsonStream
14
+ } from "./chunk-IJOS26LH.js";
15
+ import {
16
+ AgentEventEmitter,
17
+ renderSubagentSystemPrompt
18
+ } from "./chunk-2UKKQGRA.js";
19
+ import {
20
+ sanitizeChildEnv
21
+ } from "./chunk-65I7S4Z3.js";
22
+ import {
23
+ createDebugLogger
24
+ } from "./chunk-ZAFYHRVY.js";
25
+ import {
26
+ init_esbuild_shims
27
+ } from "./chunk-5O2XNYP6.js";
28
+ import {
29
+ __name
30
+ } from "./chunk-J2S4EL5Y.js";
31
+
32
+ // packages/cli/src/external-agents/acp-subagent-executor.ts
33
+ init_esbuild_shims();
34
+ import { spawn } from "node:child_process";
35
+ import { Readable, Writable } from "node:stream";
36
+
37
+ // packages/core/src/subagent-runtime.ts
38
+ init_esbuild_shims();
39
+
40
+ // packages/cli/src/external-agents/acp-subagent-executor.ts
41
+ var INIT_TIMEOUT_MS = 1e4;
42
+ var debugLogger = createDebugLogger("EXTERNAL_AGENT");
43
+ function externalModelLabel(command) {
44
+ return `external-acp:${command.split(/[\\/]/).pop() ?? command}`;
45
+ }
46
+ __name(externalModelLabel, "externalModelLabel");
47
+ function isRecord(value) {
48
+ return typeof value === "object" && value !== null && !Array.isArray(value);
49
+ }
50
+ __name(isRecord, "isRecord");
51
+ var EXTERNAL_ACTION_PROMPT_MAX = 300;
52
+ function stripControlChars(value) {
53
+ let out = "";
54
+ for (const ch of value) {
55
+ const code = ch.codePointAt(0) ?? 0;
56
+ out += code >= 32 && code !== 127 && !(code >= 128 && code <= 159) ? ch : " ";
57
+ }
58
+ return out;
59
+ }
60
+ __name(stripControlChars, "stripControlChars");
61
+ function describeExternalAction(toolCall) {
62
+ const title = stripControlChars(
63
+ toolCall.title ?? toolCall.kind ?? "External action"
64
+ );
65
+ const raw = toolCall.rawInput;
66
+ if (!isRecord(raw)) return title;
67
+ const detail = stripControlChars(JSON.stringify(raw));
68
+ const rendered = `${title}: ${detail}`;
69
+ return rendered.length > EXTERNAL_ACTION_PROMPT_MAX ? `${rendered.slice(0, EXTERNAL_ACTION_PROMPT_MAX)}\u2026` : rendered;
70
+ }
71
+ __name(describeExternalAction, "describeExternalAction");
72
+ function assertExternalAgentSpawnPlatformSupported(platform = process.platform) {
73
+ if (platform === "win32") {
74
+ throw new Error(
75
+ "External agents are not supported on Windows in this release: the executor spawn is POSIX-only. An npm-installed adapter resolves to a `.cmd` launcher that cannot be spawned without a shell, and the process-tree reaping is POSIX-specific. Run the external agent on macOS/Linux (or WSL). Windows support is a tracked follow-up."
76
+ );
77
+ }
78
+ }
79
+ __name(assertExternalAgentSpawnPlatformSupported, "assertExternalAgentSpawnPlatformSupported");
80
+ function resolvePermissionMode(permissionMode, approvalMode) {
81
+ switch ((approvalMode ?? permissionMode ?? "").trim().toLowerCase()) {
82
+ case "auto":
83
+ case "acceptedits":
84
+ case "auto-edit":
85
+ return "acceptEdits";
86
+ case "plan":
87
+ return "plan";
88
+ case "bypasspermissions":
89
+ case "bypass":
90
+ case "yolo":
91
+ return "bypass";
92
+ default:
93
+ return "default";
94
+ }
95
+ }
96
+ __name(resolvePermissionMode, "resolvePermissionMode");
97
+ var POLICY_MODE_ALIASES = {
98
+ bypass: ["bypassPermissions", "yolo"],
99
+ acceptEdits: ["acceptEdits", "auto-edit", "auto"],
100
+ plan: ["plan"],
101
+ default: ["default"]
102
+ };
103
+ function selectPeerModeId(policy, availableModeIds) {
104
+ return POLICY_MODE_ALIASES[policy].find(
105
+ (id) => availableModeIds.includes(id)
106
+ );
107
+ }
108
+ __name(selectPeerModeId, "selectPeerModeId");
109
+ function optionKindForOutcome(outcome) {
110
+ switch (outcome) {
111
+ case "proceed_once" /* ProceedOnce */:
112
+ case "proceed_once_and_switch_to_default" /* ProceedOnceAndSwitchToDefault */:
113
+ return "allow_once";
114
+ case "proceed_always" /* ProceedAlways */:
115
+ case "proceed_always_server" /* ProceedAlwaysServer */:
116
+ case "proceed_always_tool" /* ProceedAlwaysTool */:
117
+ case "proceed_always_project" /* ProceedAlwaysProject */:
118
+ case "proceed_always_user" /* ProceedAlwaysUser */:
119
+ return "allow_always";
120
+ case "modify_with_editor" /* ModifyWithEditor */:
121
+ case "cancel" /* Cancel */:
122
+ case "restore_previous" /* RestorePrevious */:
123
+ return "reject_once";
124
+ default: {
125
+ const exhaustive = outcome;
126
+ void exhaustive;
127
+ return "reject_once";
128
+ }
129
+ }
130
+ }
131
+ __name(optionKindForOutcome, "optionKindForOutcome");
132
+ function selectPermissionOption(options, outcome) {
133
+ if (outcome === "cancel" /* Cancel */) return void 0;
134
+ if (new Set(options.map((option) => option.optionId)).size !== options.length) {
135
+ return void 0;
136
+ }
137
+ const kind = optionKindForOutcome(outcome);
138
+ return (options.find((option) => option.kind === kind) ?? (kind === "allow_always" ? options.find((option) => option.kind === "allow_once") : void 0) ?? options.find((option) => option.kind === "reject_once") ?? options.find((option) => option.kind === "reject_always"))?.optionId;
139
+ }
140
+ __name(selectPermissionOption, "selectPermissionOption");
141
+ function selectRejectOption(options) {
142
+ if (new Set(options.map((option) => option.optionId)).size !== options.length) {
143
+ return void 0;
144
+ }
145
+ return (options.find((option) => option.kind === "reject_once") ?? options.find((option) => option.kind === "reject_always"))?.optionId;
146
+ }
147
+ __name(selectRejectOption, "selectRejectOption");
148
+ function isExpectedExternalAgentCleanupExit(error) {
149
+ return error instanceof Error && /^ACP child pid=\d+ exited uncleanly during shutdown \(code=[^,]+, signal=[^)]+\)$/.test(
150
+ error.message
151
+ );
152
+ }
153
+ __name(isExpectedExternalAgentCleanupExit, "isExpectedExternalAgentCleanupExit");
154
+ function isUnprovenExternalAgentTreeExit(error) {
155
+ return error instanceof Error && /^ACP child pid=\d+ exited before its initial process-tree snapshot completed$/.test(
156
+ error.message
157
+ );
158
+ }
159
+ __name(isUnprovenExternalAgentTreeExit, "isUnprovenExternalAgentTreeExit");
160
+ var ExternalAgentTimeoutError = class extends Error {
161
+ static {
162
+ __name(this, "ExternalAgentTimeoutError");
163
+ }
164
+ constructor(timeoutMs) {
165
+ super(`External ACP operation timed out after ${timeoutMs}ms`);
166
+ this.name = "ExternalAgentTimeoutError";
167
+ }
168
+ };
169
+ var AcpSubagentExecutor = class _AcpSubagentExecutor {
170
+ constructor(params, child, emitter) {
171
+ this.params = params;
172
+ this.child = child;
173
+ this.emitter = emitter;
174
+ this.coreView = {
175
+ getEventEmitter: /* @__PURE__ */ __name(() => emitter, "getEventEmitter"),
176
+ modelConfig: {
177
+ ...params.modelConfig,
178
+ model: externalModelLabel(params.spec.command)
179
+ }
180
+ };
181
+ void child.exited.then(
182
+ () => this.fail(new Error(`external agent "${params.name}" exited`)),
183
+ (error) => this.fail(error)
184
+ );
185
+ }
186
+ static {
187
+ __name(this, "AcpSubagentExecutor");
188
+ }
189
+ connection;
190
+ sessionId = "";
191
+ finalText = "";
192
+ thoughtText = "";
193
+ terminateMode = "ERROR" /* ERROR */;
194
+ round = 0;
195
+ durationMs = 0;
196
+ turnStartedAt = 0;
197
+ toolCalls = 0;
198
+ toolSucceeded = 0;
199
+ toolFailed = 0;
200
+ executing = false;
201
+ started = false;
202
+ disposed = false;
203
+ cancelled = false;
204
+ disposePromise;
205
+ provider;
206
+ pendingPermissions = /* @__PURE__ */ new Map();
207
+ tools = /* @__PURE__ */ new Map();
208
+ toolNames = /* @__PURE__ */ new Map();
209
+ finishedTools = /* @__PURE__ */ new Set();
210
+ failure = new AbortController();
211
+ coreView;
212
+ static async create(params) {
213
+ assertExternalAgentSpawnPlatformSupported();
214
+ if (params.runConfig.max_turns !== void 0) {
215
+ throw new Error("External ACP agents cannot enforce max_turns.");
216
+ }
217
+ const minutes = params.runConfig.max_time_minutes;
218
+ if (minutes !== void 0 && (!Number.isFinite(minutes) || minutes <= 0 || minutes * 6e4 > 2147483647)) {
219
+ throw new Error(
220
+ "External ACP max_time_minutes must be positive, finite, and within the Node timer range."
221
+ );
222
+ }
223
+ const child = spawn(params.spec.command, params.spec.args ?? [], {
224
+ cwd: params.runtimeContext.getTargetDir(),
225
+ stdio: ["pipe", "pipe", "pipe"],
226
+ detached: process.platform !== "win32",
227
+ windowsHide: true,
228
+ env: sanitizeChildEnv(process.env)
229
+ });
230
+ const tracked = new ProcessRegistry().reserve().attach(child, { ownsProcessTree: true });
231
+ const executor = new _AcpSubagentExecutor(
232
+ params,
233
+ tracked,
234
+ params.eventEmitter ?? new AgentEventEmitter()
235
+ );
236
+ child.on("error", (error) => executor.fail(error));
237
+ child.stdin.on("error", (error) => executor.fail(error));
238
+ child.stdout.on("error", (error) => executor.fail(error));
239
+ const forwarder = createStderrForwarder({
240
+ prefix: `[external-agent ${params.name}] `
241
+ });
242
+ child.stderr.setEncoding("utf8");
243
+ child.stderr.on("data", forwarder.onData);
244
+ child.stderr.on("end", forwarder.onEnd);
245
+ child.stderr.on("error", () => {
246
+ });
247
+ try {
248
+ executor.connection = new ClientSideConnection(
249
+ () => executor.buildClient(),
250
+ ndJsonStream(
251
+ Writable.toWeb(child.stdin),
252
+ Readable.toWeb(child.stdout)
253
+ )
254
+ );
255
+ void executor.connection.closed.then(
256
+ () => executor.fail(new Error("External ACP connection closed"))
257
+ );
258
+ await executor.wait(executor.connect(), INIT_TIMEOUT_MS);
259
+ return executor;
260
+ } catch (error) {
261
+ await executor.dispose();
262
+ throw error;
263
+ }
264
+ }
265
+ buildClient() {
266
+ return {
267
+ sessionUpdate: /* @__PURE__ */ __name(async (params) => this.onSessionUpdate(params), "sessionUpdate"),
268
+ requestPermission: /* @__PURE__ */ __name((params) => this.onRequestPermission(params), "requestPermission"),
269
+ readTextFile: /* @__PURE__ */ __name(async () => {
270
+ throw RequestError.methodNotFound("fs/read_text_file");
271
+ }, "readTextFile"),
272
+ writeTextFile: /* @__PURE__ */ __name(async () => {
273
+ throw RequestError.methodNotFound("fs/write_text_file");
274
+ }, "writeTextFile"),
275
+ extMethod: /* @__PURE__ */ __name(async (method) => {
276
+ throw RequestError.methodNotFound(method);
277
+ }, "extMethod"),
278
+ extNotification: /* @__PURE__ */ __name(async () => {
279
+ }, "extNotification")
280
+ };
281
+ }
282
+ async connect() {
283
+ const initialized = await this.connection.initialize({
284
+ protocolVersion: PROTOCOL_VERSION,
285
+ clientCapabilities: { fs: { readTextFile: false, writeTextFile: false } }
286
+ });
287
+ if (initialized.protocolVersion !== PROTOCOL_VERSION) {
288
+ throw new Error("Unsupported external ACP protocol version");
289
+ }
290
+ const session = await this.connection.newSession({
291
+ cwd: this.params.runtimeContext.getTargetDir(),
292
+ mcpServers: []
293
+ });
294
+ if (!session.sessionId)
295
+ throw new Error("External ACP agent returned no sessionId");
296
+ this.sessionId = session.sessionId;
297
+ const policy = resolvePermissionMode(
298
+ this.params.permissionMode,
299
+ this.params.approvalMode
300
+ );
301
+ const availableIds = session.modes?.availableModes.map((mode) => mode.id) ?? [];
302
+ const modeId = selectPeerModeId(policy, availableIds);
303
+ if (!modeId) {
304
+ throw new Error(
305
+ `External ACP agent does not advertise any mode for the host's ${policy} approval policy (advertised: ${availableIds.join(", ") || "none"})`
306
+ );
307
+ }
308
+ await this.connection.setSessionMode({ sessionId: this.sessionId, modeId });
309
+ }
310
+ fail(error) {
311
+ this.failure.abort(error);
312
+ this.drainPermissions();
313
+ }
314
+ async wait(operation, timeoutMs, signal) {
315
+ let timer;
316
+ let onFailure = /* @__PURE__ */ __name(() => {
317
+ }, "onFailure");
318
+ let onAbort = /* @__PURE__ */ __name(() => {
319
+ }, "onAbort");
320
+ const stopped = new Promise((_resolve, reject) => {
321
+ onFailure = /* @__PURE__ */ __name(() => reject(this.failure.signal.reason), "onFailure");
322
+ onAbort = /* @__PURE__ */ __name(() => reject(signal?.reason ?? new Error("External agent cancelled")), "onAbort");
323
+ this.failure.signal.addEventListener("abort", onFailure, { once: true });
324
+ signal?.addEventListener("abort", onAbort, { once: true });
325
+ if (this.failure.signal.aborted) onFailure();
326
+ if (signal?.aborted) onAbort();
327
+ if (timeoutMs !== void 0) {
328
+ timer = setTimeout(
329
+ () => reject(new ExternalAgentTimeoutError(timeoutMs)),
330
+ timeoutMs
331
+ );
332
+ }
333
+ });
334
+ try {
335
+ return await Promise.race([operation, stopped]);
336
+ } finally {
337
+ clearTimeout(timer);
338
+ this.failure.signal.removeEventListener("abort", onFailure);
339
+ signal?.removeEventListener("abort", onAbort);
340
+ }
341
+ }
342
+ async execute(context, signal, options = {}) {
343
+ if (context.get("initial_messages_override") !== void 0) {
344
+ throw new Error(
345
+ "External ACP agents cannot import in-process conversation history"
346
+ );
347
+ }
348
+ const continuation = this.started;
349
+ const system = continuation ? "" : renderSubagentSystemPrompt(
350
+ this.params.promptConfig,
351
+ context,
352
+ this.params.runtimeContext
353
+ );
354
+ const task = String(context.get("task_prompt") ?? "Get Started!");
355
+ await this.runTurn(
356
+ [
357
+ ...system ? [{ type: "text", text: system }] : [],
358
+ { type: "text", text: task }
359
+ ],
360
+ signal,
361
+ options,
362
+ continuation ? [task] : void 0
363
+ );
364
+ }
365
+ async executeExternalInputs(inputs, signal, options = {}) {
366
+ if (inputs.length === 0) return;
367
+ await this.runTurn(this.inputPrompt(inputs), signal, options, inputs);
368
+ }
369
+ inputPrompt(inputs) {
370
+ return inputs.map((input) => ({
371
+ type: "text",
372
+ text: typeof input === "string" ? input : input.text
373
+ }));
374
+ }
375
+ emitInputs(inputs) {
376
+ for (const input of inputs) {
377
+ this.emitter.emit("external_message" /* EXTERNAL_MESSAGE */, {
378
+ subagentId: this.id,
379
+ kind: typeof input === "string" ? "message" : input.kind,
380
+ text: typeof input === "string" ? input : input.text,
381
+ timestamp: Date.now()
382
+ });
383
+ }
384
+ }
385
+ async runTurn(prompt, signal, options = {}, inputs) {
386
+ if (this.executing)
387
+ throw new Error("External ACP agents do not support concurrent turns");
388
+ if (this.disposed || this.failure.signal.aborted)
389
+ throw new Error("External ACP agent is closed");
390
+ this.executing = true;
391
+ this.started = true;
392
+ this.cancelled = false;
393
+ this.finalText = "";
394
+ this.thoughtText = "";
395
+ this.terminateMode = "ERROR" /* ERROR */;
396
+ if (options.resetStats !== false) {
397
+ this.round = this.durationMs = this.toolCalls = this.toolSucceeded = this.toolFailed = 0;
398
+ }
399
+ this.tools.clear();
400
+ this.toolNames.clear();
401
+ this.finishedTools.clear();
402
+ this.turnStartedAt = Date.now();
403
+ const timeoutMs = this.params.runConfig.max_time_minutes === void 0 ? void 0 : this.params.runConfig.max_time_minutes * 6e4;
404
+ const cancel = /* @__PURE__ */ __name(() => {
405
+ this.cancelled = true;
406
+ this.drainPermissions();
407
+ void this.connection.cancel({ sessionId: this.sessionId }).catch(() => {
408
+ });
409
+ }, "cancel");
410
+ signal?.addEventListener("abort", cancel, { once: true });
411
+ let timedOut = false;
412
+ try {
413
+ this.emitter.emit("start" /* START */, {
414
+ subagentId: this.id,
415
+ name: this.params.name,
416
+ model: this.coreView.modelConfig.model,
417
+ tools: [],
418
+ timestamp: Date.now()
419
+ });
420
+ if (signal?.aborted) {
421
+ this.terminateMode = "CANCELLED" /* CANCELLED */;
422
+ return;
423
+ }
424
+ const entryRound = this.round;
425
+ let next = prompt;
426
+ do {
427
+ this.round++;
428
+ const remaining = timeoutMs === void 0 ? void 0 : Math.max(
429
+ 0,
430
+ timeoutMs - this.durationMs - (Date.now() - this.turnStartedAt)
431
+ );
432
+ if (remaining !== void 0 && remaining <= 0) {
433
+ this.terminateMode = "TIMEOUT" /* TIMEOUT */;
434
+ break;
435
+ }
436
+ if (inputs && this.round === entryRound + 1) this.emitInputs(inputs);
437
+ const result = await this.wait(
438
+ this.connection.prompt({ sessionId: this.sessionId, prompt: next }),
439
+ remaining,
440
+ signal
441
+ );
442
+ this.terminateMode = this.stopMode(result.stopReason);
443
+ if (this.terminateMode !== "GOAL" /* GOAL */) break;
444
+ if (signal?.aborted) {
445
+ this.terminateMode = "CANCELLED" /* CANCELLED */;
446
+ break;
447
+ }
448
+ const remainingNext = timeoutMs === void 0 ? void 0 : Math.max(
449
+ 0,
450
+ timeoutMs - this.durationMs - (Date.now() - this.turnStartedAt)
451
+ );
452
+ if (remainingNext !== void 0 && remainingNext <= 0) {
453
+ this.terminateMode = "TIMEOUT" /* TIMEOUT */;
454
+ break;
455
+ }
456
+ const queued = this.provider?.() ?? [];
457
+ if (queued.length === 0) break;
458
+ this.emitter.emit("round_text" /* ROUND_TEXT */, {
459
+ subagentId: this.id,
460
+ round: this.round,
461
+ text: this.finalText,
462
+ thoughtText: this.thoughtText,
463
+ timestamp: Date.now()
464
+ });
465
+ this.finalText = "";
466
+ this.thoughtText = "";
467
+ this.emitInputs(queued);
468
+ next = this.inputPrompt(queued);
469
+ } while (!signal?.aborted);
470
+ if (signal?.aborted) this.terminateMode = "CANCELLED" /* CANCELLED */;
471
+ } catch (error) {
472
+ timedOut = error instanceof ExternalAgentTimeoutError;
473
+ this.terminateMode = signal?.aborted ? "CANCELLED" /* CANCELLED */ : timedOut ? "TIMEOUT" /* TIMEOUT */ : "ERROR" /* ERROR */;
474
+ if (this.emitter.rawListeners("error" /* ERROR */).length > 0 && !signal?.aborted) {
475
+ this.emitter.emit("error" /* ERROR */, {
476
+ subagentId: this.id,
477
+ error: error instanceof Error ? error.message : String(error),
478
+ timestamp: Date.now()
479
+ });
480
+ }
481
+ await this.dispose();
482
+ if (!signal?.aborted && !timedOut) throw error;
483
+ } finally {
484
+ signal?.removeEventListener("abort", cancel);
485
+ this.durationMs += Date.now() - this.turnStartedAt;
486
+ this.executing = false;
487
+ this.drainPermissions();
488
+ this.emitter.emit("round_text" /* ROUND_TEXT */, {
489
+ subagentId: this.id,
490
+ round: this.round,
491
+ text: this.finalText,
492
+ thoughtText: this.thoughtText,
493
+ timestamp: Date.now()
494
+ });
495
+ this.flushOpenTools();
496
+ this.emitter.emit("finish" /* FINISH */, {
497
+ subagentId: this.id,
498
+ terminateReason: this.terminateMode,
499
+ rounds: this.round,
500
+ totalDurationMs: this.durationMs,
501
+ totalToolCalls: this.toolCalls,
502
+ successfulToolCalls: this.toolSucceeded,
503
+ failedToolCalls: this.toolFailed,
504
+ timestamp: Date.now()
505
+ });
506
+ }
507
+ }
508
+ stopMode(reason) {
509
+ switch (reason) {
510
+ case "end_turn":
511
+ return "GOAL" /* GOAL */;
512
+ case "max_turn_requests":
513
+ return "MAX_TURNS" /* MAX_TURNS */;
514
+ case "cancelled":
515
+ return "CANCELLED" /* CANCELLED */;
516
+ case "refusal":
517
+ return "ERROR" /* ERROR */;
518
+ default:
519
+ return "ERROR" /* ERROR */;
520
+ }
521
+ }
522
+ get id() {
523
+ return this.params.subagentId ?? this.params.name;
524
+ }
525
+ getFinalText() {
526
+ return this.finalText;
527
+ }
528
+ getTerminateMode() {
529
+ return this.terminateMode;
530
+ }
531
+ getCore() {
532
+ return this.coreView;
533
+ }
534
+ setExternalMessageProvider(provider) {
535
+ this.provider = provider;
536
+ }
537
+ // This executor deliberately does NOT implement `setExternalMessageWaiter` /
538
+ // `setExternalMessageWaitPredicate`: ACP v1 has no mid-turn injection
539
+ // primitive (no `session/steer`), so input that arrives while a prompt is in
540
+ // flight cannot be delivered until that prompt resolves. Queued input is
541
+ // drained between prompts via the provider above (next-turn-boundary
542
+ // delivery). Implementing true mid-turn steering would require cancel +
543
+ // re-prompt — re-billing the whole in-flight turn — which is a protocol/billing
544
+ // decision, not a safe default. The delegation result surfaces this
545
+ // limitation (see agent.ts EXTERNAL_MID_TURN_INPUT_NOTICE). (R3-6)
546
+ getExecutionSummary() {
547
+ return {
548
+ rounds: this.round,
549
+ totalDurationMs: this.durationMs + (this.executing ? Date.now() - this.turnStartedAt : 0),
550
+ totalToolCalls: this.toolCalls,
551
+ successfulToolCalls: this.toolSucceeded,
552
+ failedToolCalls: this.toolFailed,
553
+ successRate: this.toolCalls ? this.toolSucceeded / this.toolCalls * 100 : 0,
554
+ inputTokens: 0,
555
+ outputTokens: 0,
556
+ thoughtTokens: 0,
557
+ cachedTokens: 0,
558
+ totalTokens: 0,
559
+ toolUsage: []
560
+ };
561
+ }
562
+ dispose() {
563
+ this.disposed = true;
564
+ this.fail(new Error("External ACP agent disposed"));
565
+ return this.disposePromise ??= this.child.terminate().catch((error) => {
566
+ if (isUnprovenExternalAgentTreeExit(error)) {
567
+ const detail = error instanceof Error ? error.message : String(error);
568
+ debugLogger.warn(
569
+ `External ACP agent process tree was not proven gone after disposal: ${detail}`
570
+ );
571
+ if (this.emitter.rawListeners("error" /* ERROR */).length > 0) {
572
+ this.emitter.emit("error" /* ERROR */, {
573
+ subagentId: this.id,
574
+ error: `External agent process tree not proven gone after disposal: ${detail}`,
575
+ timestamp: Date.now()
576
+ });
577
+ }
578
+ return;
579
+ }
580
+ if (!isExpectedExternalAgentCleanupExit(error)) throw error;
581
+ });
582
+ }
583
+ drainPermissions() {
584
+ for (const cancel of this.pendingPermissions.values()) cancel();
585
+ this.pendingPermissions.clear();
586
+ }
587
+ onSessionUpdate({ sessionId, update }) {
588
+ if (sessionId !== this.sessionId || !this.executing || this.cancelled || this.disposed || this.failure.signal.aborted)
589
+ return;
590
+ switch (update.sessionUpdate) {
591
+ case "agent_message_chunk":
592
+ case "agent_thought_chunk": {
593
+ const thought = update.sessionUpdate === "agent_thought_chunk";
594
+ const text = update.content.type === "text" ? update.content.text : JSON.stringify(update.content);
595
+ if (thought) this.thoughtText += text;
596
+ else this.finalText += text;
597
+ this.emitter.emit("stream_text" /* STREAM_TEXT */, {
598
+ subagentId: this.id,
599
+ round: this.round,
600
+ text,
601
+ thought,
602
+ timestamp: Date.now()
603
+ });
604
+ break;
605
+ }
606
+ case "tool_call":
607
+ this.updateTool(update);
608
+ break;
609
+ case "tool_call_update":
610
+ this.updateTool(update);
611
+ break;
612
+ default:
613
+ break;
614
+ }
615
+ }
616
+ updateTool(update) {
617
+ const callId = update.toolCallId;
618
+ if (this.finishedTools.has(callId)) return;
619
+ const previous = this.tools.get(callId);
620
+ const tool = {
621
+ toolCallId: callId,
622
+ title: previous?.title ?? "External tool",
623
+ ...previous,
624
+ ...Object.fromEntries(
625
+ Object.entries(update).filter(
626
+ ([, value]) => value !== null && value !== void 0
627
+ )
628
+ )
629
+ };
630
+ this.tools.set(callId, tool);
631
+ const meta = tool._meta?.["claudeCode"];
632
+ const reportedName = isRecord(meta) && typeof meta["toolName"] === "string" ? meta["toolName"] : tool.kind ?? "external_tool";
633
+ const name = this.toolNames.get(callId) ?? reportedName;
634
+ if (!previous) {
635
+ this.toolNames.set(callId, name);
636
+ this.toolCalls++;
637
+ this.emitter.emit("tool_call" /* TOOL_CALL */, {
638
+ subagentId: this.id,
639
+ round: this.round,
640
+ callId,
641
+ name,
642
+ args: isRecord(tool.rawInput) ? tool.rawInput : { input: tool.rawInput },
643
+ description: tool.title,
644
+ timestamp: Date.now()
645
+ });
646
+ }
647
+ if (tool.status !== "completed" && tool.status !== "failed") return;
648
+ this.finishedTools.add(callId);
649
+ this.tools.delete(callId);
650
+ const success = tool.status === "completed";
651
+ if (success) this.toolSucceeded++;
652
+ else this.toolFailed++;
653
+ this.toolNames.delete(callId);
654
+ const response = {
655
+ input: tool.rawInput ?? null,
656
+ toolName: reportedName,
657
+ output: tool.rawOutput ?? null,
658
+ content: tool.content ?? null,
659
+ status: tool.status
660
+ };
661
+ const responseParts = [
662
+ { functionResponse: { id: callId, name, response } }
663
+ ];
664
+ this.emitter.emit("tool_result" /* TOOL_RESULT */, {
665
+ subagentId: this.id,
666
+ round: this.round,
667
+ callId,
668
+ name,
669
+ success,
670
+ responseParts,
671
+ resultDisplay: JSON.stringify(tool.rawOutput ?? tool.content ?? null),
672
+ timestamp: Date.now()
673
+ });
674
+ this.emitter.emit("tool_responses_finalized" /* TOOL_RESPONSES_FINALIZED */, {
675
+ subagentId: this.id,
676
+ round: this.round,
677
+ responses: [{ callId, responseParts }],
678
+ timestamp: Date.now()
679
+ });
680
+ }
681
+ /**
682
+ * Emit a terminal TOOL_RESULT + TOOL_RESPONSES_FINALIZED for every tool call
683
+ * still open when the turn ends. Cancel, timeout and peer crash all leave
684
+ * entries in `this.tools`: `cancel()` sets `this.cancelled` before the peer's
685
+ * own terminal `tool_call_update` can arrive (so `onSessionUpdate` drops it),
686
+ * and the next `runTurn` clears the map. Without this flush three consumers
687
+ * keep a false record — the inline frame and Web Shell row show the tool
688
+ * executing forever (TOOL_RESULT is the only writer of their status), the
689
+ * JSONL transcript holds a permanently unpaired `functionCall`
690
+ * (TOOL_RESPONSES_FINALIZED is the only writer of its `tool_result`), and
691
+ * FINISH's totals do not sum. The in-process sibling closes the same gap via
692
+ * `onAllToolCallsComplete`.
693
+ */
694
+ flushOpenTools() {
695
+ for (const [callId, tool] of this.tools) {
696
+ const meta = tool._meta?.["claudeCode"];
697
+ const reportedName = isRecord(meta) && typeof meta["toolName"] === "string" ? meta["toolName"] : tool.kind ?? "external_tool";
698
+ const name = this.toolNames.get(callId) ?? reportedName;
699
+ this.toolFailed++;
700
+ const response = {
701
+ input: tool.rawInput ?? null,
702
+ toolName: reportedName,
703
+ output: null,
704
+ content: tool.content ?? null,
705
+ status: "failed"
706
+ };
707
+ const responseParts = [
708
+ { functionResponse: { id: callId, name, response } }
709
+ ];
710
+ this.emitter.emit("tool_result" /* TOOL_RESULT */, {
711
+ subagentId: this.id,
712
+ round: this.round,
713
+ callId,
714
+ name,
715
+ success: false,
716
+ responseParts,
717
+ resultDisplay: JSON.stringify(tool.content ?? null),
718
+ timestamp: Date.now()
719
+ });
720
+ this.emitter.emit("tool_responses_finalized" /* TOOL_RESPONSES_FINALIZED */, {
721
+ subagentId: this.id,
722
+ round: this.round,
723
+ responses: [{ callId, responseParts }],
724
+ timestamp: Date.now()
725
+ });
726
+ }
727
+ this.tools.clear();
728
+ this.toolNames.clear();
729
+ }
730
+ async onRequestPermission(params) {
731
+ const cancelled = {
732
+ outcome: { outcome: "cancelled" }
733
+ };
734
+ const runtime = this.params.runtimeContext;
735
+ const callId = params.toolCall.toolCallId;
736
+ const meta = params.toolCall._meta?.["claudeCode"];
737
+ const name = isRecord(meta) && typeof meta["toolName"] === "string" ? meta["toolName"] : params.toolCall.kind ?? "external_tool";
738
+ if (params.sessionId !== this.sessionId || !this.executing || this.cancelled || this.disposed || this.failure.signal.aborted || this.pendingPermissions.has(callId) || params.options.length === 0 || new Set(params.options.map((option) => option.optionId)).size !== params.options.length)
739
+ return cancelled;
740
+ if (name.replaceAll("_", "").toLowerCase() === "askuserquestion" || runtime.getShouldAvoidPermissionPrompts() || !runtime.isInteractive() && !runtime.getExperimentalZedIntegration() && runtime.getInputFormat() !== "stream-json" /* STREAM_JSON */ || this.emitter.rawListeners("tool_waiting_approval" /* TOOL_WAITING_APPROVAL */).length === 0) {
741
+ const rejectOptionId = selectRejectOption(params.options);
742
+ return rejectOptionId ? { outcome: { outcome: "selected", optionId: rejectOptionId } } : cancelled;
743
+ }
744
+ return new Promise((resolve) => {
745
+ const finish = /* @__PURE__ */ __name((optionId) => {
746
+ if (this.pendingPermissions.get(callId) !== deny) return;
747
+ this.pendingPermissions.delete(callId);
748
+ resolve(
749
+ optionId ? { outcome: { outcome: "selected", optionId } } : cancelled
750
+ );
751
+ }, "finish");
752
+ const deny = /* @__PURE__ */ __name(() => finish(), "deny");
753
+ this.pendingPermissions.set(callId, deny);
754
+ try {
755
+ this.emitter.emit("tool_waiting_approval" /* TOOL_WAITING_APPROVAL */, {
756
+ subagentId: this.id,
757
+ round: this.round,
758
+ callId,
759
+ name,
760
+ args: isRecord(params.toolCall.rawInput) ? params.toolCall.rawInput : {},
761
+ description: params.toolCall.title ?? "External action",
762
+ confirmationDetails: {
763
+ type: "info",
764
+ title: params.toolCall.title ?? "External action",
765
+ // Carry the action's arguments so the user sees WHAT they are
766
+ // authorizing — not just the option labels the dialog already
767
+ // renders as buttons (R11-5). Bounded and control-stripped.
768
+ prompt: describeExternalAction(params.toolCall),
769
+ // The prompt is a foreign-process payload; render it as plain text,
770
+ // never markdown — otherwise the dialog would eat glob `**` and
771
+ // render links, misrepresenting what the user approves. (R11-5 fix)
772
+ renderPromptAsPlainText: true,
773
+ hideAlwaysAllow: true
774
+ },
775
+ respond: /* @__PURE__ */ __name(async (outcome) => finish(
776
+ selectPermissionOption(params.options, outcome) ?? // An explicit user rejection of THIS tool must deny the tool,
777
+ // not cancel the whole turn: `selectPermissionOption` maps
778
+ // Cancel to undefined, and ACP `cancelled` ends the prompt turn
779
+ // (abandoning the remaining work and billing a fresh prompt to
780
+ // re-delegate). Select the peer's `reject_once` option so the
781
+ // turn continues without this one action, matching the dialog's
782
+ // "suggest changes" promise and the in-process sibling. Fall
783
+ // back to `cancelled` only when no reject option is selectable.
784
+ (outcome === "cancel" /* Cancel */ ? selectRejectOption(params.options) : void 0)
785
+ ), "respond"),
786
+ timestamp: Date.now()
787
+ });
788
+ } catch {
789
+ deny();
790
+ }
791
+ });
792
+ }
793
+ };
794
+ var acpExternalAgentExecutor = {
795
+ create: /* @__PURE__ */ __name((params) => AcpSubagentExecutor.create(params), "create")
796
+ };
797
+
798
+ export {
799
+ externalModelLabel,
800
+ describeExternalAction,
801
+ assertExternalAgentSpawnPlatformSupported,
802
+ resolvePermissionMode,
803
+ selectPeerModeId,
804
+ optionKindForOutcome,
805
+ selectPermissionOption,
806
+ selectRejectOption,
807
+ isExpectedExternalAgentCleanupExit,
808
+ isUnprovenExternalAgentTreeExit,
809
+ acpExternalAgentExecutor
810
+ };
811
+ /**
812
+ * @license
813
+ * Copyright 2025 Qwen
814
+ * SPDX-License-Identifier: Apache-2.0
815
+ */
816
+ /**
817
+ * @license
818
+ * Copyright 2026 Qwen Team
819
+ * SPDX-License-Identifier: Apache-2.0
820
+ */