@qwen-code/qwen-code 0.21.3 → 0.21.4-nightly.20260804.d6f55a1c9

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 (274) hide show
  1. package/bundled/qc-helper/docs/configuration/model-providers.md +8 -7
  2. package/bundled/qc-helper/docs/configuration/settings.md +14 -1
  3. package/bundled/qc-helper/docs/features/channels/github.md +12 -8
  4. package/bundled/qc-helper/docs/features/code-review.md +16 -1
  5. package/bundled/qc-helper/docs/features/commands.md +46 -40
  6. package/bundled/qc-helper/docs/features/mcp.md +11 -3
  7. package/bundled/qc-helper/docs/qwen-serve.md +27 -26
  8. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +50 -19
  9. package/bundled/review/SKILL.md +99 -23
  10. package/chunks/{MaxSizedBox-OJR636GP.js → MaxSizedBox-6J7WTW2Q.js} +16 -15
  11. package/chunks/{StandaloneSessionPicker-AMMBF5UY.js → StandaloneSessionPicker-J3HNBNWF.js} +30 -29
  12. package/chunks/{acpAgent-M57LVIQA.js → acpAgent-SGIEWC4W.js} +681 -291
  13. package/chunks/{agent-PE37ARLM.js → agent-W6IG55Q7.js} +16 -15
  14. package/chunks/{agent-headless-45ASME4R.js → agent-headless-EAPKUL6K.js} +16 -15
  15. package/chunks/{anthropicContentGenerator-WCBYB6JG.js → anthropicContentGenerator-3CAHEZBM.js} +4 -2
  16. package/chunks/{artifact-tool-TBOYEKTY.js → artifact-tool-RROCCJDA.js} +1 -1
  17. package/chunks/{askUserQuestion-23Y5WZFJ.js → askUserQuestion-2EPPBPUZ.js} +1 -1
  18. package/chunks/{bridge-K3ZRPO4D.js → bridge-SNQAVLI3.js} +17 -16
  19. package/chunks/{ca-4OJN75WT.js → ca-NYKNH222.js} +4 -0
  20. package/chunks/{channel-management-service-IXJ2MZTS.js → channel-management-service-UHX56NBO.js} +1 -1
  21. package/chunks/{channel-settings-store-PEAR3IME.js → channel-settings-store-TR7UMQVQ.js} +22 -21
  22. package/chunks/{chunk-L7FTDKCD.js → chunk-23DFTW2G.js} +21 -3
  23. package/chunks/{chunk-PWCQRLM5.js → chunk-2AGOQ7QO.js} +1 -1
  24. package/chunks/{chunk-HUIQ4FYC.js → chunk-2UYGQRYZ.js} +3 -3
  25. package/chunks/{chunk-4K3RV3OA.js → chunk-36Q4BOUL.js} +243 -108
  26. package/chunks/{chunk-2MI7ZTRT.js → chunk-3KTHFE53.js} +5 -5
  27. package/chunks/{chunk-QDWLUXKP.js → chunk-3X3CRYEU.js} +1 -1
  28. package/chunks/{chunk-YXEVDA66.js → chunk-4LLUH3A7.js} +19 -18
  29. package/chunks/{chunk-QPSYIV2O.js → chunk-4RNMAX6B.js} +2492 -690
  30. package/chunks/{chunk-O2ZYHG33.js → chunk-5L6CQ4ZU.js} +131 -67
  31. package/chunks/{chunk-HEBW74ZW.js → chunk-5WFVHBQR.js} +3 -3
  32. package/chunks/{chunk-LZV2BZPL.js → chunk-6BBIRJ6Z.js} +2 -2
  33. package/chunks/{chunk-TZTBZ25J.js → chunk-6WBWIPBF.js} +2 -2
  34. package/chunks/{chunk-QWDVZH24.js → chunk-7BUWEQD3.js} +3 -3
  35. package/chunks/{chunk-EGYJRIDF.js → chunk-7DKCE4VO.js} +2 -2
  36. package/chunks/{chunk-UQDFEU47.js → chunk-7E5BCHGR.js} +1165 -385
  37. package/chunks/{chunk-X6QNZOTC.js → chunk-7MFQLOHZ.js} +1 -1
  38. package/chunks/{chunk-MCXMWLFT.js → chunk-7VZZVBW7.js} +5 -5
  39. package/chunks/{chunk-FF75UUB2.js → chunk-7WE7B63C.js} +1 -1
  40. package/chunks/{chunk-M5LIY7Y6.js → chunk-AUM6IYIZ.js} +1 -1
  41. package/chunks/{chunk-K2J5JZ6B.js → chunk-B452JFK7.js} +1 -1
  42. package/chunks/{chunk-6NE5NTHJ.js → chunk-BDUPVCHA.js} +1 -1
  43. package/chunks/{chunk-SKSF3LGQ.js → chunk-BH4HRGTW.js} +4 -4
  44. package/chunks/{chunk-3XF4WT3B.js → chunk-BKLXFYJJ.js} +1 -1
  45. package/chunks/{chunk-RL6J3BPE.js → chunk-BQUXJJ72.js} +3 -3
  46. package/chunks/{chunk-H6FIBBXK.js → chunk-C4EK5K64.js} +13 -13
  47. package/chunks/{chunk-VUNRNRN6.js → chunk-CE424L46.js} +5 -5
  48. package/chunks/{chunk-DSGJLHM3.js → chunk-CJGLCNDE.js} +3 -3
  49. package/chunks/{chunk-FXVHVCNA.js → chunk-CTRZ7IDH.js} +1 -1
  50. package/chunks/{chunk-CFDR3GNL.js → chunk-D7D7RXIJ.js} +11 -0
  51. package/chunks/{chunk-ZGSUFIL5.js → chunk-DMI5SX2V.js} +1 -1
  52. package/chunks/{chunk-X6WUYMOV.js → chunk-DTAPI453.js} +2 -2
  53. package/chunks/{chunk-NW57GHNL.js → chunk-EF2FDVAL.js} +5 -5
  54. package/chunks/{chunk-BSKUTHLO.js → chunk-EVSV25NF.js} +16 -3
  55. package/chunks/{chunk-3MWNROHB.js → chunk-FQL6PVUI.js} +3 -3
  56. package/chunks/{chunk-IF6K42YJ.js → chunk-FSHOUNV4.js} +1 -1
  57. package/chunks/chunk-HGCQ5SE7.js +136 -0
  58. package/chunks/{chunk-GMSBXEH4.js → chunk-HTCXG5RY.js} +6 -6
  59. package/chunks/{chunk-FG63DZQA.js → chunk-I4PRUCND.js} +10 -10
  60. package/chunks/{chunk-YWMDTMAU.js → chunk-J2QPGVAE.js} +2 -2
  61. package/chunks/{chunk-RCXCGZG6.js → chunk-KCHQQBHO.js} +4 -4
  62. package/chunks/{chunk-LGT3YMLN.js → chunk-LEZFUYPM.js} +1 -1
  63. package/chunks/{chunk-G7XXKQYS.js → chunk-LKRMNRSN.js} +27 -1
  64. package/chunks/{chunk-WY2ENRDN.js → chunk-LZPIUB47.js} +1 -1
  65. package/chunks/{chunk-HFVW54NL.js → chunk-MBEMTXQT.js} +9 -2
  66. package/chunks/{chunk-RPYYTL7E.js → chunk-MGSSJT27.js} +2 -2
  67. package/chunks/{chunk-H35Q5CEG.js → chunk-MMWH7ERH.js} +6 -6
  68. package/chunks/{chunk-MUEJ4R3E.js → chunk-MP2XAFAD.js} +3 -3
  69. package/chunks/{chunk-R7XNRHYD.js → chunk-N64L3CUV.js} +1 -1
  70. package/chunks/{chunk-EIMKVOSF.js → chunk-NJ4ANA44.js} +1 -1
  71. package/chunks/{chunk-ZJES4C3I.js → chunk-O6GB7LVR.js} +2 -2
  72. package/chunks/{chunk-QWW6I2UO.js → chunk-PFQWATDS.js} +410 -39
  73. package/chunks/{chunk-XUMAD5IT.js → chunk-PMMWMPWV.js} +1 -1
  74. package/chunks/{chunk-H6ZYP74A.js → chunk-PUQDGXJV.js} +1 -1
  75. package/chunks/{chunk-XMJO6C44.js → chunk-PYXZLKUJ.js} +3 -3
  76. package/chunks/{chunk-KXWERR6P.js → chunk-QIS6FQFI.js} +10 -10
  77. package/chunks/{chunk-22YFMJBW.js → chunk-QK6BFCAL.js} +59 -7
  78. package/chunks/{chunk-HIXVWF7I.js → chunk-R2JZCL4S.js} +3 -3
  79. package/chunks/{chunk-N42C2FU3.js → chunk-RJ2KM6NF.js} +1 -1
  80. package/chunks/{chunk-2LZCLQIS.js → chunk-S5VUT4K2.js} +5 -5
  81. package/chunks/{chunk-4AGGSHCH.js → chunk-SVR6JPEL.js} +197 -53
  82. package/chunks/{chunk-SQ3YD5MI.js → chunk-T4LUW2CP.js} +4 -3
  83. package/chunks/{chunk-BKGA75MU.js → chunk-T7AALAF5.js} +1 -1
  84. package/chunks/{chunk-YU6TBRTA.js → chunk-URJHXOSO.js} +2 -2
  85. package/chunks/{chunk-MTR4JWQJ.js → chunk-UZNJUCOI.js} +4 -4
  86. package/chunks/{chunk-D2GPKXCQ.js → chunk-VQHIIPVE.js} +4 -4
  87. package/chunks/{chunk-IWGTGH4G.js → chunk-W2W6PMZX.js} +2 -2
  88. package/chunks/{chunk-SRY26X4H.js → chunk-WVAESIM6.js} +12 -3
  89. package/chunks/{chunk-5VYFXHY2.js → chunk-XKX3PNZR.js} +3 -3
  90. package/chunks/{chunk-BKXTHMOZ.js → chunk-XLD2R34T.js} +1 -1
  91. package/chunks/{chunk-5JPVOYWA.js → chunk-YT2BQ4JH.js} +5 -5
  92. package/chunks/{chunk-YPUHMQXV.js → chunk-Z5ZLRJFS.js} +1 -1
  93. package/chunks/{chunk-VA5NLVPT.js → chunk-Z7JILXGX.js} +1 -1
  94. package/chunks/{chunk-RR224BUP.js → chunk-ZLJQIGCH.js} +45 -1
  95. package/chunks/{chunk-TXABHVZD.js → chunk-ZNCRSKRP.js} +1 -1
  96. package/chunks/{chunk-UEJESCS7.js → chunk-ZPPP6VCL.js} +1 -1
  97. package/chunks/{chunk-Q3G5L5KF.js → chunk-ZQPHKE4K.js} +1 -1
  98. package/chunks/{computer-use-UJMK6JQU.js → computer-use-NFBEZ73C.js} +16 -15
  99. package/chunks/{config-utils-7COTJMWK.js → config-utils-E3ZQTHGM.js} +2 -2
  100. package/chunks/{contextCommand-4YABGF4S.js → contextCommand-HJN4W5PC.js} +18 -17
  101. package/chunks/{core-runtime-7M4VM3DA.js → core-runtime-Z4IALQ37.js} +16 -15
  102. package/chunks/{create-sub-session-J32WC64U.js → create-sub-session-6EWLAZD5.js} +1 -1
  103. package/chunks/{create-sub-session-HOFDW4N7.js → create-sub-session-MJKTT6R4.js} +28 -21
  104. package/chunks/{cron-create-HMFSHIAR.js → cron-create-CCRIULJE.js} +1 -1
  105. package/chunks/{cron-delete-ZJFHOX57.js → cron-delete-FCFW6BGP.js} +1 -1
  106. package/chunks/{cron-list-ZEX2NBMN.js → cron-list-QDBVCHRF.js} +1 -1
  107. package/chunks/{daemon-status-provider-W2U5Q3J5.js → daemon-status-provider-GR32VNM6.js} +21 -20
  108. package/chunks/{daemon-trust-policy-IFICWPXP.js → daemon-trust-policy-O4DGWLR5.js} +21 -20
  109. package/chunks/{daemon-trust-policy-monitor-GX7EO6FW.js → daemon-trust-policy-monitor-5RHH3YSK.js} +21 -20
  110. package/chunks/{de-A6TI4LBB.js → de-VL76CPLV.js} +4 -0
  111. package/chunks/{deferred-core-runtime-U36OOOKE.js → deferred-core-runtime-A5CKPGQZ.js} +16 -15
  112. package/chunks/{display-image-VS3TXYQH.js → display-image-GUJA352B.js} +2 -2
  113. package/chunks/{dist-NEBRI7WO.js → dist-C5U4LJKW.js} +95 -0
  114. package/chunks/{dist-4KAX7CCL.js → dist-IKGVITP3.js} +401 -24
  115. package/chunks/{earlyInputCapture-5ZWDH3SB.js → earlyInputCapture-ZB4EHBSD.js} +16 -15
  116. package/chunks/{edit-J7SW6UP6.js → edit-QSTJ353U.js} +17 -16
  117. package/chunks/{en-L4UQDLWW.js → en-IRJ2WN5T.js} +4 -0
  118. package/chunks/{enter-worktree-NRLOHRB6.js → enter-worktree-R73VWVFF.js} +16 -15
  119. package/chunks/{enterPlanMode-GDSTEFSM.js → enterPlanMode-OWFAGX5J.js} +16 -15
  120. package/chunks/{environment-KHYEKG5W.js → environment-57MAPDBT.js} +18 -17
  121. package/chunks/{errors-VNLAJV3O.js → errors-5BKZ3KMI.js} +18 -17
  122. package/chunks/{exit-worktree-ARVID7DF.js → exit-worktree-6O2324LA.js} +16 -15
  123. package/chunks/{exitPlanMode-4ZFY7KUH.js → exitPlanMode-GCRUFTNX.js} +16 -15
  124. package/chunks/{fast-path-KA65VREJ.js → fast-path-VN3BV4WN.js} +11 -2
  125. package/chunks/{fr-QF7RI5ZE.js → fr-GK3HQYVB.js} +4 -0
  126. package/chunks/{gemini-5PMCNPF7.js → gemini-K43YNDW7.js} +50 -48
  127. package/chunks/{geminiContentGenerator-NFSYJ4HA.js → geminiContentGenerator-BTPPSMCF.js} +1 -1
  128. package/chunks/{glob-F3EAUDAX.js → glob-4MLY2HOS.js} +16 -15
  129. package/chunks/{goal-tools-SPQ5M6D3.js → goal-tools-3AZKX5WQ.js} +2 -18
  130. package/chunks/{grep-UJMPVZER.js → grep-XFBSAUJW.js} +16 -15
  131. package/chunks/{handleAutoUpdate-MG4FRZPN.js → handleAutoUpdate-HWVO6M65.js} +20 -19
  132. package/chunks/{i18n-EVHV4ZF3.js → i18n-MASWUB3I.js} +17 -16
  133. package/chunks/{image-gen-UC7XVHI7.js → image-gen-XLFJRDFA.js} +2 -2
  134. package/chunks/{initializer-O5B6HUBI.js → initializer-M6JYLRYA.js} +21 -20
  135. package/chunks/{installationInfo-2LIKCNVX.js → installationInfo-TEJOXP5W.js} +17 -16
  136. package/chunks/{ja-URQESVGW.js → ja-3FA46IKD.js} +4 -0
  137. package/chunks/{list-BPKIE3Z4.js → list-UABKY6YY.js} +24 -23
  138. package/chunks/{list-agents-TWEGRJWO.js → list-agents-GC4BRET7.js} +1 -1
  139. package/chunks/{loadedSettingsAdapter-NGLFF4V4.js → loadedSettingsAdapter-L7PIVGJX.js} +21 -20
  140. package/chunks/{loggingContentGenerator-7TFESRG5.js → loggingContentGenerator-W7QO23AD.js} +8 -8
  141. package/chunks/{loop-wakeup-6LLEOQYV.js → loop-wakeup-SQQSBMEY.js} +2 -2
  142. package/chunks/{ls-H5WX22VK.js → ls-63CC3NNX.js} +1 -1
  143. package/chunks/{lsp-G6FXYEIS.js → lsp-P6NVJVNT.js} +1 -1
  144. package/chunks/{managed-npm-update-CLZGGV7F.js → managed-npm-update-WQ2J42H7.js} +17 -16
  145. package/chunks/{mcp-X5OZOOXX.js → mcp-A652OREB.js} +21 -20
  146. package/chunks/{monitor-TGSVSAZZ.js → monitor-Y7YAHCA6.js} +16 -15
  147. package/chunks/{nonInteractiveCli-GUMJ5JLG.js → nonInteractiveCli-EKLP5WCN.js} +48 -46
  148. package/chunks/{notebook-edit-EZISE7IC.js → notebook-edit-MALKVMST.js} +17 -16
  149. package/chunks/{openaiContentGenerator-ZAKS5A6P.js → openaiContentGenerator-WM2TUU7E.js} +8 -8
  150. package/chunks/{pidfile-PCMBX4LR.js → pidfile-QBNVWD7M.js} +16 -15
  151. package/chunks/{processUtils-2CSVE5BW.js → processUtils-4L46PM2I.js} +2 -2
  152. package/chunks/{pt-EEEQXRUI.js → pt-3AOBKPIJ.js} +4 -0
  153. package/chunks/{qwenContentGenerator-S3H6PIC4.js → qwenContentGenerator-GG6SY4YP.js} +17 -17
  154. package/chunks/{qwenOAuth2-MNU425VE.js → qwenOAuth2-PE27GJRG.js} +1 -1
  155. package/chunks/{read-file-HXJXHBI6.js → read-file-IHXKC6D3.js} +6 -6
  156. package/chunks/{read-mcp-resource-DRZSI3HE.js → read-mcp-resource-RTSSEER5.js} +1 -1
  157. package/chunks/{record-artifact-IPIRWMFY.js → record-artifact-L3BAHQFN.js} +2 -2
  158. package/chunks/{resumeHistoryUtils-4QAMC2S6.js → resumeHistoryUtils-BWVAHKRZ.js} +19 -18
  159. package/chunks/{ripGrep-MCETPF2E.js → ripGrep-7ASLNF5O.js} +16 -15
  160. package/chunks/{ru-WGZDYQAB.js → ru-VJRAMC4W.js} +4 -0
  161. package/chunks/{run-qwen-serve-3NMODTXV.js → run-qwen-serve-JLFJHJSU.js} +82 -35
  162. package/chunks/{runtime-AQOV7DVP.js → runtime-DVQFRHKX.js} +24 -23
  163. package/chunks/{scheduler-DN7SZ6ZE.js → scheduler-WMFCKI7V.js} +16 -15
  164. package/chunks/{sdk-exporters-http-IKNWQJNV.js → sdk-exporters-http-IL2346MJ.js} +6 -2
  165. package/chunks/{sdk-impl-7CUUMQDB.js → sdk-impl-SYKGVWOZ.js} +2 -2
  166. package/chunks/{send-message-HGCVVDTZ.js → send-message-TL6FIMMN.js} +3 -3
  167. package/chunks/{serve-WZB45HVT.js → serve-NYWUO6YF.js} +22 -20
  168. package/chunks/{server-GOTZFEEZ.js → server-WHLRWZCG.js} +44 -42
  169. package/chunks/{session-23LOFLWN.js → session-EN34VEJM.js} +49 -47
  170. package/chunks/{settings-LI2ORVXC.js → settings-FZH5YZLH.js} +20 -19
  171. package/chunks/{shell-GLC6OP3C.js → shell-FQLEHJKT.js} +16 -15
  172. package/chunks/{skill-C7W6M4GO.js → skill-QAXTGG6F.js} +7 -7
  173. package/chunks/{skill-settings-W25NCK5I.js → skill-settings-SRUMUJIE.js} +20 -19
  174. package/chunks/{spawnChannel-OHJLEBLD.js → spawnChannel-VYQCFI7T.js} +16 -15
  175. package/chunks/{standalone-update-E4V5V7WT.js → standalone-update-LEPP5BOB.js} +18 -17
  176. package/chunks/{startInteractiveUI-FKILLW7Q.js → startInteractiveUI-IQIG2MKN.js} +77 -62
  177. package/chunks/{syntheticOutput-EYL7DWO7.js → syntheticOutput-BN7E626U.js} +2 -2
  178. package/chunks/{task-create-CSCEG4SM.js → task-create-2X4UP4F3.js} +4 -4
  179. package/chunks/{task-list-6CVQPORX.js → task-list-WOLJPZ64.js} +1 -1
  180. package/chunks/{task-stop-Y5ZTFVRX.js → task-stop-TNXRNAL2.js} +1 -1
  181. package/chunks/{task-update-C52LNFU5.js → task-update-VDUSN36E.js} +4 -4
  182. package/chunks/{team-create-HBIJ7NHT.js → team-create-7B5NKWA2.js} +16 -15
  183. package/chunks/{team-delete-CE7DC53R.js → team-delete-D2VMSDOT.js} +1 -1
  184. package/chunks/{team-plan-approval-IBJOKS4J.js → team-plan-approval-J6TURTZC.js} +16 -15
  185. package/chunks/{terminal-image-renderer-BOQJPVLB.js → terminal-image-renderer-KZMAF5E5.js} +17 -16
  186. package/chunks/{theme-manager-NSS7VLUD.js → theme-manager-NPISCKAX.js} +16 -15
  187. package/chunks/{todoWrite-YKAA57W2.js → todoWrite-MHWHO5UO.js} +3 -2
  188. package/chunks/{tool-search-DEAS54VG.js → tool-search-MFTNRTFA.js} +8 -8
  189. package/chunks/{total-session-admission-4LWTX3WD.js → total-session-admission-42THE4X2.js} +17 -16
  190. package/chunks/{trustedFolders-NF3J2TA7.js → trustedFolders-OT7IORFI.js} +17 -16
  191. package/chunks/{update-relaunch-WUHRH5V3.js → update-relaunch-2NJAMGWQ.js} +5 -5
  192. package/chunks/{updateCheck-7EG4BLBH.js → updateCheck-XSIBJXYA.js} +19 -18
  193. package/chunks/{useAutoAcceptIndicator-ZRV56GVP.js → useAutoAcceptIndicator-VH4DU3JR.js} +22 -21
  194. package/chunks/{validateNonInterActiveAuth-WC2FPE3I.js → validateNonInterActiveAuth-JD3VEJ2O.js} +45 -43
  195. package/chunks/{version-6SS7KCUP.js → version-F75ALUI3.js} +1 -1
  196. package/chunks/{web-fetch-Y5QQMPKA.js → web-fetch-Y6VEJMFN.js} +6 -6
  197. package/chunks/{web-search-QKKEU723.js → web-search-BTKVYWOR.js} +4 -4
  198. package/chunks/{workflow-PWIU6Q2M.js → workflow-LWFOBFN3.js} +17 -16
  199. package/chunks/{workspace-providers-status-B2DM6FNK.js → workspace-providers-status-VFEB7C5S.js} +23 -22
  200. package/chunks/{workspace-registration-store-7Y33TTHJ.js → workspace-registration-store-MB24E7PA.js} +1 -1
  201. package/chunks/{workspace-registry-TSNJKLPC.js → workspace-registry-FHFAPD74.js} +17 -16
  202. package/chunks/{workspace-service-4I2QHDX4.js → workspace-service-A6EFCR5H.js} +24 -23
  203. package/chunks/{workspace-skills-status-HVXNWVGR.js → workspace-skills-status-SDX2JT7P.js} +21 -20
  204. package/chunks/{workspace-trust-reconciler-RDBBGMWP.js → workspace-trust-reconciler-5NOCATAW.js} +22 -21
  205. package/chunks/{write-file-RQ4DG5RY.js → write-file-OHTP7KKV.js} +16 -15
  206. package/chunks/{zh-72XPUG5P.js → zh-ARWDLDLR.js} +4 -0
  207. package/chunks/{zh-TW-LTB4SRH3.js → zh-TW-Y4RGI3P7.js} +4 -0
  208. package/chunks/{zoom-image-O5YCB7WN.js → zoom-image-WLSVNK2C.js} +6 -6
  209. package/cli.js +12 -12
  210. package/locales/ca.js +8 -0
  211. package/locales/de.js +8 -0
  212. package/locales/en.js +8 -0
  213. package/locales/fr.js +8 -0
  214. package/locales/ja.js +8 -0
  215. package/locales/pt.js +8 -0
  216. package/locales/ru.js +8 -0
  217. package/locales/zh-TW.js +7 -0
  218. package/locales/zh.js +7 -0
  219. package/package.json +3 -3
  220. package/web-shell/assets/{arc-Bd7d781i.js → arc-Dpg66jw7.js} +1 -1
  221. package/web-shell/assets/{architectureDiagram-3BPJPVTR-CpnOJqNE.js → architectureDiagram-3BPJPVTR-BJ4FIBxN.js} +1 -1
  222. package/web-shell/assets/{blockDiagram-GPEHLZMM-NxVTiWnk.js → blockDiagram-GPEHLZMM-VXmYdtYT.js} +1 -1
  223. package/web-shell/assets/{c4Diagram-AAUBKEIU-BWT75l82.js → c4Diagram-AAUBKEIU-BNLDb8FE.js} +1 -1
  224. package/web-shell/assets/channel-Bd9wOnaA.js +1 -0
  225. package/web-shell/assets/{chunk-2J33WTMH-Dzz03hk6.js → chunk-2J33WTMH-DR5yHxr0.js} +1 -1
  226. package/web-shell/assets/{chunk-4BX2VUAB-DRF-egfm.js → chunk-4BX2VUAB-Czkq8UZU.js} +1 -1
  227. package/web-shell/assets/{chunk-55IACEB6-Co15vq5x.js → chunk-55IACEB6-DugUgM6s.js} +1 -1
  228. package/web-shell/assets/{chunk-727SXJPM-DHSUk1J7.js → chunk-727SXJPM-Dw6quA1K.js} +1 -1
  229. package/web-shell/assets/{chunk-AQP2D5EJ-Br8u_E2R.js → chunk-AQP2D5EJ-BoVYOTTz.js} +1 -1
  230. package/web-shell/assets/{chunk-FMBD7UC4-DXbPTnqF.js → chunk-FMBD7UC4--Amcse-j.js} +1 -1
  231. package/web-shell/assets/{chunk-ND2GUHAM-BleQdi4d.js → chunk-ND2GUHAM-ajaEYAC8.js} +1 -1
  232. package/web-shell/assets/{chunk-QZHKN3VN-CqgBf-95.js → chunk-QZHKN3VN-CUNDZ7im.js} +1 -1
  233. package/web-shell/assets/classDiagram-4FO5ZUOK-XhCT8FE3.js +1 -0
  234. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-XhCT8FE3.js +1 -0
  235. package/web-shell/assets/{cose-bilkent-S5V4N54A-WS7b13Yg.js → cose-bilkent-S5V4N54A-BnfkD-m1.js} +1 -1
  236. package/web-shell/assets/{dagre-BM42HDAG-v_55ki8o.js → dagre-BM42HDAG-BuUdFk7Z.js} +1 -1
  237. package/web-shell/assets/{diagram-2AECGRRQ-DaYAjbdK.js → diagram-2AECGRRQ-B2ZXxoab.js} +1 -1
  238. package/web-shell/assets/{diagram-5GNKFQAL-D_Hy-L64.js → diagram-5GNKFQAL-BsgOICzM.js} +1 -1
  239. package/web-shell/assets/{diagram-KO2AKTUF-dB06cZyD.js → diagram-KO2AKTUF-DTTjG6U-.js} +1 -1
  240. package/web-shell/assets/{diagram-LMA3HP47-DzSluD4F.js → diagram-LMA3HP47-temLf1x7.js} +1 -1
  241. package/web-shell/assets/{diagram-OG6HWLK6-Cvb6CeXQ.js → diagram-OG6HWLK6-CRFjScs2.js} +1 -1
  242. package/web-shell/assets/{erDiagram-TEJ5UH35-7eB2Hmov.js → erDiagram-TEJ5UH35-D4oaY-rQ.js} +1 -1
  243. package/web-shell/assets/{flowDiagram-I6XJVG4X-B08iGCw_.js → flowDiagram-I6XJVG4X-BqG8B49b.js} +1 -1
  244. package/web-shell/assets/{ganttDiagram-6RSMTGT7-BgsrCHq-.js → ganttDiagram-6RSMTGT7-DffQBdd5.js} +1 -1
  245. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-DQLurQ2i.js → gitGraphDiagram-PVQCEYII-CMDPfseF.js} +1 -1
  246. package/web-shell/assets/index-2F4RsNzd.js +1756 -0
  247. package/web-shell/assets/index-CaucmEO_.css +5 -0
  248. package/web-shell/assets/{index-B_1Z0Mgr.js → index-qTQR_smP.js} +1 -1
  249. package/web-shell/assets/{infoDiagram-5YYISTIA-DXZGO8qB.js → infoDiagram-5YYISTIA-Cn3T83MA.js} +1 -1
  250. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-g7gbuH2w.js → ishikawaDiagram-YF4QCWOH-ijFs7e25.js} +1 -1
  251. package/web-shell/assets/{journeyDiagram-JHISSGLW-euefICGn.js → journeyDiagram-JHISSGLW-CINTv8VB.js} +1 -1
  252. package/web-shell/assets/{kanban-definition-UN3LZRKU-Dws8-mjG.js → kanban-definition-UN3LZRKU-CMGRZCxx.js} +1 -1
  253. package/web-shell/assets/{linear-C63F0tyh.js → linear-Co-2_37d.js} +1 -1
  254. package/web-shell/assets/{mermaid.core-fLrhp_4-.js → mermaid.core-DijbyaN5.js} +5 -5
  255. package/web-shell/assets/{mindmap-definition-RKZ34NQL-qRkydfT-.js → mindmap-definition-RKZ34NQL-k_sDYDPZ.js} +1 -1
  256. package/web-shell/assets/{pieDiagram-4H26LBE5-BZ0wQaKN.js → pieDiagram-4H26LBE5-CG-oz8V3.js} +1 -1
  257. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Fjq6GbSZ.js → quadrantDiagram-W4KKPZXB-Baq7HIG2.js} +1 -1
  258. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CqWvjLHU.js → requirementDiagram-4Y6WPE33-CDM3ZvBt.js} +1 -1
  259. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-VcXX6PVZ.js → sankeyDiagram-5OEKKPKP-C2dJbWKN.js} +1 -1
  260. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BJSRtxFr.js → sequenceDiagram-3UESZ5HK-Cf1_h59p.js} +1 -1
  261. package/web-shell/assets/{stateDiagram-AJRCARHV-Dt9zUwmZ.js → stateDiagram-AJRCARHV-CI5clUEc.js} +1 -1
  262. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BDc8asKD.js +1 -0
  263. package/web-shell/assets/{timeline-definition-PNZ67QCA-DQwlNRws.js → timeline-definition-PNZ67QCA-B2O8cAZX.js} +1 -1
  264. package/web-shell/assets/{vennDiagram-CIIHVFJN-DwxjUEtQ.js → vennDiagram-CIIHVFJN-BLsJ_h9s.js} +1 -1
  265. package/web-shell/assets/{wardley-L42UT6IY-D3QdMSpJ.js → wardley-L42UT6IY-BlPU4FTA.js} +1 -1
  266. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BddN8oK8.js → wardleyDiagram-YWT4CUSO-D_U-RdU4.js} +1 -1
  267. package/web-shell/assets/{xychartDiagram-2RQKCTM6-BUNuBrRJ.js → xychartDiagram-2RQKCTM6-BynXGSTl.js} +1 -1
  268. package/web-shell/index.html +2 -2
  269. package/web-shell/assets/channel-A434sWK5.js +0 -1
  270. package/web-shell/assets/classDiagram-4FO5ZUOK-CwPuhldB.js +0 -1
  271. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CwPuhldB.js +0 -1
  272. package/web-shell/assets/index-Bi1dP2mU.css +0 -5
  273. package/web-shell/assets/index-DJ-z1Oba.js +0 -1756
  274. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CCxQt56w.js +0 -1
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  recomputeMcpGating
5
- } from "./chunk-RCXCGZG6.js";
5
+ } from "./chunk-KCHQQBHO.js";
6
6
  import {
7
7
  classifyApiError,
8
8
  fireSessionDeleteHook
@@ -16,14 +16,14 @@ import {
16
16
  matchMcpServerByRef,
17
17
  parseExtensionRef,
18
18
  parseMcpServerRef
19
- } from "./chunk-XMJO6C44.js";
19
+ } from "./chunk-PYXZLKUJ.js";
20
20
  import {
21
21
  getAvailableCommands,
22
22
  handleSlashCommand,
23
23
  insertAfterFunctionResponses,
24
24
  isSlashCommand,
25
25
  normalizePartList
26
- } from "./chunk-4AGGSHCH.js";
26
+ } from "./chunk-SVR6JPEL.js";
27
27
  import {
28
28
  SessionIdConflictError,
29
29
  appEvents,
@@ -31,23 +31,23 @@ import {
31
31
  cleanupReviewWorktreeLeases,
32
32
  loadCliConfig,
33
33
  normalizeDisabledToolList
34
- } from "./chunk-QPSYIV2O.js";
34
+ } from "./chunk-4RNMAX6B.js";
35
35
  import "./chunk-NYX53SV4.js";
36
36
  import {
37
37
  collectContextData,
38
38
  formatContextUsageText
39
- } from "./chunk-SKSF3LGQ.js";
39
+ } from "./chunk-BH4HRGTW.js";
40
40
  import {
41
41
  getCommandSubcommandNames
42
- } from "./chunk-TXABHVZD.js";
42
+ } from "./chunk-ZNCRSKRP.js";
43
43
  import {
44
44
  getEffectiveSupportedModes
45
- } from "./chunk-LZV2BZPL.js";
45
+ } from "./chunk-6BBIRJ6Z.js";
46
46
  import "./chunk-3LGZEYOF.js";
47
47
  import "./chunk-4WGODMVR.js";
48
- import "./chunk-YWMDTMAU.js";
48
+ import "./chunk-J2QPGVAE.js";
49
49
  import "./chunk-KKN2IE7Q.js";
50
- import "./chunk-BSKUTHLO.js";
50
+ import "./chunk-EVSV25NF.js";
51
51
  import "./chunk-6H67XLET.js";
52
52
  import {
53
53
  beginAcpBootstrapConfigProfiling,
@@ -55,8 +55,8 @@ import {
55
55
  endAcpBootstrapConfigProfiling,
56
56
  markAcpStartup
57
57
  } from "./chunk-M744OFVE.js";
58
- import "./chunk-MTR4JWQJ.js";
59
- import "./chunk-EGYJRIDF.js";
58
+ import "./chunk-UZNJUCOI.js";
59
+ import "./chunk-7DKCE4VO.js";
60
60
  import "./chunk-YAF2MQZ6.js";
61
61
  import {
62
62
  GENERATION_MAX_PROMPT_BYTES,
@@ -78,7 +78,7 @@ import {
78
78
  shouldSuppressRememberErrorDetails,
79
79
  workspaceMemoryFailureCode,
80
80
  workspaceMemoryFailureDiagnostics
81
- } from "./chunk-5JPVOYWA.js";
81
+ } from "./chunk-YT2BQ4JH.js";
82
82
  import {
83
83
  HistoryReplayer,
84
84
  MessageEmitter,
@@ -88,10 +88,10 @@ import {
88
88
  goalTerminalEventToHistoryItem,
89
89
  recordGoalStatusItem,
90
90
  restoreGoalFromHistory
91
- } from "./chunk-VUNRNRN6.js";
91
+ } from "./chunk-CE424L46.js";
92
92
  import "./chunk-DYA25Y7U.js";
93
93
  import "./chunk-4NFY2S7N.js";
94
- import "./chunk-N42C2FU3.js";
94
+ import "./chunk-RJ2KM6NF.js";
95
95
  import "./chunk-2MIN6GRR.js";
96
96
  import "./chunk-QHTIBUWB.js";
97
97
  import {
@@ -102,6 +102,7 @@ import {
102
102
  computeCpuPercent
103
103
  } from "./chunk-LBOVL47Y.js";
104
104
  import "./chunk-RXFQM6FQ.js";
105
+ import "./chunk-HGCQ5SE7.js";
105
106
  import {
106
107
  mapSkillConfigToStatus
107
108
  } from "./chunk-BGXZBI5B.js";
@@ -111,32 +112,32 @@ import {
111
112
  buildPermissionSettings,
112
113
  normalizePermissionRules,
113
114
  readPermissionRuleSet
114
- } from "./chunk-YPUHMQXV.js";
115
+ } from "./chunk-Z5ZLRJFS.js";
115
116
  import {
116
117
  MAX_AUDIO_BYTES,
117
118
  sanitizeVoiceErrorMessage,
118
119
  transcribeVoiceAudio
119
- } from "./chunk-WY2ENRDN.js";
120
+ } from "./chunk-LZPIUB47.js";
120
121
  import {
121
122
  readVoiceModel
122
- } from "./chunk-BKGA75MU.js";
123
+ } from "./chunk-T7AALAF5.js";
123
124
  import "./chunk-JELIWHXD.js";
124
125
  import {
125
126
  resolveSkillSettings
126
127
  } from "./chunk-Z4X5MTRT.js";
127
- import "./chunk-2LZCLQIS.js";
128
- import "./chunk-D2GPKXCQ.js";
128
+ import "./chunk-S5VUT4K2.js";
129
+ import "./chunk-VQHIIPVE.js";
129
130
  import "./chunk-57OAHC2Y.js";
130
131
  import {
131
132
  createLoadedSettingsAdapter
132
- } from "./chunk-IF6K42YJ.js";
133
+ } from "./chunk-FSHOUNV4.js";
133
134
  import "./chunk-VXZBKKQR.js";
134
- import "./chunk-QWDVZH24.js";
135
+ import "./chunk-7BUWEQD3.js";
135
136
  import "./chunk-3SH53ANB.js";
136
137
  import {
137
138
  SESSION_SOURCE_META_KEY,
138
139
  parseSessionSource
139
- } from "./chunk-HIXVWF7I.js";
140
+ } from "./chunk-R2JZCL4S.js";
140
141
  import "./chunk-GLWP3FDB.js";
141
142
  import "./chunk-XCGIMOLN.js";
142
143
  import "./chunk-OCPBI7J5.js";
@@ -151,7 +152,7 @@ import {
151
152
  parseAcpModelOption,
152
153
  resolveAcpModelOption,
153
154
  sanitizeProviderBaseUrl
154
- } from "./chunk-5VYFXHY2.js";
155
+ } from "./chunk-XKX3PNZR.js";
155
156
  import {
156
157
  ACP_PREFLIGHT_KINDS,
157
158
  IDLE_HOOK_EVENTS,
@@ -160,8 +161,8 @@ import {
160
161
  STATUS_SCHEMA_VERSION,
161
162
  mapDomainErrorToErrorKind
162
163
  } from "./chunk-PDDYAXL2.js";
163
- import "./chunk-LGT3YMLN.js";
164
- import "./chunk-X6WUYMOV.js";
164
+ import "./chunk-LEZFUYPM.js";
165
+ import "./chunk-DTAPI453.js";
165
166
  import "./chunk-VWOVHOTT.js";
166
167
  import "./chunk-V6WHFGST.js";
167
168
  import {
@@ -206,7 +207,7 @@ import {
206
207
  import {
207
208
  assembleMcpServers,
208
209
  loadMcpApprovals
209
- } from "./chunk-2MI7ZTRT.js";
210
+ } from "./chunk-3KTHFE53.js";
210
211
  import {
211
212
  getOutputLanguageFilePath,
212
213
  getPersistScopeForModelSelection,
@@ -214,7 +215,7 @@ import {
214
215
  resolveOutputLanguageOrPreserveAuto,
215
216
  updateOutputLanguageFile,
216
217
  writeOutputLanguageAndRegisterPath
217
- } from "./chunk-22YFMJBW.js";
218
+ } from "./chunk-QK6BFCAL.js";
218
219
  import "./chunk-RKUWKYED.js";
219
220
  import "./chunk-GOXKNSDZ.js";
220
221
  import "./chunk-IDS7MSUP.js";
@@ -222,19 +223,19 @@ import {
222
223
  SUPPORTED_LANGUAGES,
223
224
  getCurrentLanguage,
224
225
  setLanguageAsync
225
- } from "./chunk-KXWERR6P.js";
226
+ } from "./chunk-QIS6FQFI.js";
226
227
  import {
227
228
  reloadEnvironment
228
- } from "./chunk-6NE5NTHJ.js";
229
+ } from "./chunk-BDUPVCHA.js";
229
230
  import "./chunk-6PEXNQTX.js";
230
- import "./chunk-FXVHVCNA.js";
231
- import "./chunk-BKXTHMOZ.js";
231
+ import "./chunk-CTRZ7IDH.js";
232
+ import "./chunk-XLD2R34T.js";
232
233
  import "./chunk-VJNBRRZG.js";
233
234
  import {
234
235
  isFolderTrustEnabled,
235
236
  isWorkspaceTrusted,
236
237
  loadTrustedFolders
237
- } from "./chunk-M5LIY7Y6.js";
238
+ } from "./chunk-AUM6IYIZ.js";
238
239
  import "./chunk-ALGGS7UH.js";
239
240
  import "./chunk-MR3PXB6E.js";
240
241
  import "./chunk-XFSFZCM5.js";
@@ -362,25 +363,25 @@ import {
362
363
  validatePlanModeShellApproval,
363
364
  validatePlanModeShellContext,
364
365
  wrapUserPromptSubmitContext
365
- } from "./chunk-UQDFEU47.js";
366
+ } from "./chunk-7E5BCHGR.js";
366
367
  import "./chunk-GOFAQQZA.js";
367
368
  import "./chunk-5M6IDOMF.js";
368
369
  import "./chunk-TWPJO254.js";
369
370
  import {
370
371
  external_exports
371
372
  } from "./chunk-H6XPXXMH.js";
372
- import "./chunk-VA5NLVPT.js";
373
+ import "./chunk-Z7JILXGX.js";
373
374
  import "./chunk-I7JDGNG6.js";
374
375
  import "./chunk-A6SX5TAH.js";
375
376
  import "./chunk-33FNCQSY.js";
376
377
  import {
377
378
  parsePositiveIntegerEnv
378
379
  } from "./chunk-6PVPNMXU.js";
379
- import "./chunk-XUMAD5IT.js";
380
+ import "./chunk-PMMWMPWV.js";
380
381
  import "./chunk-IRH27ZC2.js";
381
382
  import "./chunk-QHWCP53L.js";
382
383
  import "./chunk-MOHAWIAW.js";
383
- import "./chunk-X6QNZOTC.js";
384
+ import "./chunk-7MFQLOHZ.js";
384
385
  import {
385
386
  promptIdContext,
386
387
  todoWorkChainContext
@@ -396,20 +397,21 @@ import {
396
397
  } from "./chunk-A5YZ3FA2.js";
397
398
  import "./chunk-YAVY33G4.js";
398
399
  import "./chunk-2UISUFHQ.js";
399
- import "./chunk-HFVW54NL.js";
400
+ import "./chunk-MBEMTXQT.js";
400
401
  import {
401
402
  APPROVAL_MODES,
402
403
  runWithRuntimeContentGenerator
403
- } from "./chunk-TZTBZ25J.js";
404
+ } from "./chunk-6WBWIPBF.js";
404
405
  import "./chunk-S6LOFUVP.js";
405
406
  import {
406
407
  FORK_SUBAGENT_TYPE,
407
408
  getStartupContextLength,
408
409
  isSystemReminderContent
409
- } from "./chunk-SRY26X4H.js";
410
+ } from "./chunk-WVAESIM6.js";
410
411
  import "./chunk-K623ENWT.js";
411
412
  import "./chunk-AQ37AY7B.js";
412
413
  import "./chunk-432XCUHF.js";
414
+ import "./chunk-4LLUH3A7.js";
413
415
  import {
414
416
  clearCachedCredentialFile,
415
417
  qwenOAuth2Events
@@ -421,7 +423,7 @@ import "./chunk-DGEIYUC3.js";
421
423
  import "./chunk-MPHPFVKK.js";
422
424
  import "./chunk-GLNBDYUX.js";
423
425
  import "./chunk-DJ2GSRLV.js";
424
- import "./chunk-EIMKVOSF.js";
426
+ import "./chunk-NJ4ANA44.js";
425
427
  import {
426
428
  addToolArgumentsAttributes,
427
429
  addToolCallResultAttributes,
@@ -429,7 +431,7 @@ import {
429
431
  registerAcpEventLoopLagGauge,
430
432
  startEventLoopLagMonitor,
431
433
  withDaemonSpan
432
- } from "./chunk-RPYYTL7E.js";
434
+ } from "./chunk-MGSSJT27.js";
433
435
  import "./chunk-2J3OJGTL.js";
434
436
  import "./chunk-P3QQPMQA.js";
435
437
  import "./chunk-6O5DVH27.js";
@@ -467,22 +469,22 @@ import {
467
469
  shouldRunVisionBridge,
468
470
  splitImageParts,
469
471
  uiTelemetryService
470
- } from "./chunk-4K3RV3OA.js";
472
+ } from "./chunk-36Q4BOUL.js";
471
473
  import "./chunk-VGC4I5JJ.js";
472
474
  import {
473
475
  getAutoMemoryRoot,
474
476
  getUserAutoMemoryRoot
475
477
  } from "./chunk-E4WHKETF.js";
476
- import "./chunk-UEJESCS7.js";
478
+ import "./chunk-ZPPP6VCL.js";
477
479
  import {
478
480
  ToolConfirmationOutcome,
479
481
  ToolNames,
480
482
  isShellProgressData
481
- } from "./chunk-CFDR3GNL.js";
483
+ } from "./chunk-D7D7RXIJ.js";
482
484
  import {
483
485
  AuthType,
484
486
  preloadContentGenerator
485
- } from "./chunk-H35Q5CEG.js";
487
+ } from "./chunk-MMWH7ERH.js";
486
488
  import "./chunk-46UV252V.js";
487
489
  import {
488
490
  DEFAULT_TOKEN_LIMIT,
@@ -499,9 +501,9 @@ import {
499
501
  startToolExecutionSpan,
500
502
  startToolSpan,
501
503
  withInteractionSpan
502
- } from "./chunk-O2ZYHG33.js";
504
+ } from "./chunk-5L6CQ4ZU.js";
503
505
  import "./chunk-W4RQUHY3.js";
504
- import "./chunk-G7XXKQYS.js";
506
+ import "./chunk-LKRMNRSN.js";
505
507
  import {
506
508
  Storage,
507
509
  createDebugLogger,
@@ -510,10 +512,10 @@ import {
510
512
  isSubpath
511
513
  } from "./chunk-3RXUYQJI.js";
512
514
  import "./chunk-VOQXFAY5.js";
513
- import "./chunk-R7XNRHYD.js";
515
+ import "./chunk-N64L3CUV.js";
514
516
  import {
515
517
  runExitCleanup
516
- } from "./chunk-QDWLUXKP.js";
518
+ } from "./chunk-3X3CRYEU.js";
517
519
  import {
518
520
  writeStderrLine,
519
521
  writeStderrLineSafe
@@ -1240,6 +1242,11 @@ var SubAgentTracker = class {
1240
1242
  callId: event.callId,
1241
1243
  args: event.args,
1242
1244
  subagentMeta: this.subagentMeta
1245
+ }).catch((error) => {
1246
+ debugLogger2.debug(
1247
+ `Failed to emit subagent tool start for ${event.name}:`,
1248
+ error
1249
+ );
1243
1250
  });
1244
1251
  };
1245
1252
  }
@@ -1259,6 +1266,11 @@ var SubAgentTracker = class {
1259
1266
  resultDisplay: event.resultDisplay,
1260
1267
  args: state?.args,
1261
1268
  subagentMeta: this.subagentMeta
1269
+ }).catch((error) => {
1270
+ debugLogger2.debug(
1271
+ `Failed to emit subagent tool result for ${event.name}:`,
1272
+ error
1273
+ );
1262
1274
  });
1263
1275
  this.toolStates.delete(event.callId);
1264
1276
  };
@@ -1312,7 +1324,7 @@ var SubAgentTracker = class {
1312
1324
  await event.respond(outcome, {
1313
1325
  answers: "answers" in output ? output.answers : void 0
1314
1326
  });
1315
- if (outcome === "cancel" /* Cancel */) {
1327
+ if (outcome === "cancel" /* Cancel */ && !abortSignal.aborted) {
1316
1328
  this.onPermissionCancel?.();
1317
1329
  }
1318
1330
  } catch (error) {
@@ -1320,7 +1332,9 @@ var SubAgentTracker = class {
1320
1332
  `Permission request failed for subagent tool ${event.name}:`,
1321
1333
  error
1322
1334
  );
1323
- this.onPermissionCancel?.();
1335
+ if (!abortSignal.aborted) {
1336
+ this.onPermissionCancel?.();
1337
+ }
1324
1338
  try {
1325
1339
  await event.respond("cancel" /* Cancel */);
1326
1340
  } catch (respondError) {
@@ -1339,12 +1353,9 @@ var SubAgentTracker = class {
1339
1353
  return (...args) => {
1340
1354
  const event = args[0];
1341
1355
  if (abortSignal.aborted) return;
1342
- this.messageEmitter.emitUsageMetadata(
1343
- event.usage,
1344
- "",
1345
- event.durationMs,
1346
- this.subagentMeta
1347
- );
1356
+ void this.messageEmitter.emitUsageMetadata(event.usage, "", event.durationMs, this.subagentMeta).catch((error) => {
1357
+ debugLogger2.debug("Failed to emit subagent usage metadata:", error);
1358
+ });
1348
1359
  };
1349
1360
  }
1350
1361
  /**
@@ -1361,7 +1372,9 @@ var SubAgentTracker = class {
1361
1372
  event.thought ?? false,
1362
1373
  void 0,
1363
1374
  this.subagentMeta
1364
- );
1375
+ ).catch((error) => {
1376
+ debugLogger2.debug("Failed to emit subagent stream text:", error);
1377
+ });
1365
1378
  };
1366
1379
  }
1367
1380
  };
@@ -1910,6 +1923,8 @@ var DAEMON_INVALID_TOOL_PARAMS_THRESHOLD = 3;
1910
1923
  var PERMISSION_CANCEL_SKIP_MESSAGE = "Skipped because a permission request was cancelled before the user answered; user input is required before continuing.";
1911
1924
  var LOOP_DETECTED_SKIP_MESSAGE = "Skipped because loop detection stopped the current turn before this tool call could run.";
1912
1925
  var LOOP_DETECTED_CONTEXT_MESSAGE = "System: this turn was terminated because the model exceeded tool-call safety limits. Try a different approach on the next turn.";
1926
+ var TOOL_EXECUTION_CANCELLED_MESSAGE = "Tool execution was cancelled.";
1927
+ var TOOL_POST_EXECUTION_CANCELLED_MESSAGE = "The tool had already completed; its output was discarded.";
1913
1928
  function createDaemonToolLoopState() {
1914
1929
  return {
1915
1930
  totalToolCalls: 0,
@@ -1922,7 +1937,14 @@ function recordDaemonLoopDetected(config, promptId, loopType, message, loopState
1922
1937
  if (!loopState.loopDetected) {
1923
1938
  loopState.loopDetected = true;
1924
1939
  debugLogger5.warn(message);
1925
- logLoopDetected(config, new LoopDetectedEvent(loopType, promptId));
1940
+ try {
1941
+ logLoopDetected(config, new LoopDetectedEvent(loopType, promptId));
1942
+ } catch (error) {
1943
+ debugLogger5.debug(
1944
+ "[Session] Failed to record loop detection telemetry",
1945
+ error
1946
+ );
1947
+ }
1926
1948
  }
1927
1949
  return true;
1928
1950
  }
@@ -3959,7 +3981,7 @@ ${this.pendingRecoveredAgentsNotice}
3959
3981
  onFullTurnModel
3960
3982
  )
3961
3983
  );
3962
- if (toolRun.stopAfterPermissionCancel) {
3984
+ if (toolRun.stopAfterPermissionCancel || pendingSend.signal.aborted) {
3963
3985
  this.todoStopGuard.suspend();
3964
3986
  await this.#preserveStoppedToolRun(
3965
3987
  toolRun,
@@ -4698,7 +4720,7 @@ ${this.pendingRecoveredAgentsNotice}
4698
4720
  options.onFullTurnModel
4699
4721
  )
4700
4722
  );
4701
- if (toolRun.stopAfterPermissionCancel || toolRun.loopDetected) {
4723
+ if (toolRun.stopAfterPermissionCancel || toolRun.loopDetected || pendingSend.signal.aborted) {
4702
4724
  this.todoStopGuard.suspend();
4703
4725
  await this.#preserveStoppedToolRun(toolRun, pendingSend.signal);
4704
4726
  return {
@@ -5659,7 +5681,7 @@ ${this.pendingRecoveredAgentsNotice}
5659
5681
  functionCalls,
5660
5682
  toolLoopState
5661
5683
  );
5662
- if (toolRun.stopAfterPermissionCancel) {
5684
+ if (toolRun.stopAfterPermissionCancel || ac.signal.aborted) {
5663
5685
  this.todoStopGuard.suspend();
5664
5686
  await this.#preserveStoppedToolRun(toolRun, ac.signal);
5665
5687
  return;
@@ -6065,7 +6087,7 @@ ${this.pendingRecoveredAgentsNotice}
6065
6087
  functionCalls,
6066
6088
  toolLoopState
6067
6089
  );
6068
- if (toolRun.stopAfterPermissionCancel) {
6090
+ if (toolRun.stopAfterPermissionCancel || ac.signal.aborted) {
6069
6091
  this.todoStopGuard.suspend();
6070
6092
  await this.#preserveStoppedToolRun(toolRun, ac.signal);
6071
6093
  await this.#emitBackgroundNotificationEndTurn(
@@ -6491,9 +6513,10 @@ ${this.pendingRecoveredAgentsNotice}
6491
6513
  metadata: {
6492
6514
  callId,
6493
6515
  status: "error",
6516
+ executionStatus: "not_started",
6494
6517
  resultDisplay: void 0,
6495
6518
  error,
6496
- errorType
6519
+ errorType: errorType ?? "execution_denied" /* EXECUTION_DENIED */
6497
6520
  }
6498
6521
  });
6499
6522
  if (emitStart) {
@@ -6519,7 +6542,12 @@ ${this.pendingRecoveredAgentsNotice}
6519
6542
  return await finalizeRunToolResult({
6520
6543
  parts: await Promise.all(
6521
6544
  dedupedFunctionCalls.map(
6522
- (fc) => recordSkippedToolCall(fc, LOOP_DETECTED_SKIP_MESSAGE, false)
6545
+ (fc) => recordSkippedToolCall(
6546
+ fc,
6547
+ LOOP_DETECTED_SKIP_MESSAGE,
6548
+ false,
6549
+ "unknown" /* UNKNOWN */
6550
+ )
6523
6551
  )
6524
6552
  ),
6525
6553
  stopAfterPermissionCancel: false,
@@ -6561,38 +6589,47 @@ ${this.pendingRecoveredAgentsNotice}
6561
6589
  }, "pushDuplicateBatch");
6562
6590
  const emitDuplicateBatch = /* @__PURE__ */ __name(async (batch) => {
6563
6591
  const { request, response } = batch;
6564
- if (request.name === ToolNames.TODO_WRITE) {
6565
- const provenance = ToolCallEmitter.resolveToolProvenance(request.name);
6566
- await this.sendUpdate({
6567
- sessionUpdate: "tool_call_update",
6568
- toolCallId: response.callId,
6569
- status: "failed",
6570
- content: [
6571
- {
6572
- type: "content",
6573
- content: {
6574
- type: "text",
6575
- text: response.error?.message ?? String(response.resultDisplay)
6592
+ try {
6593
+ if (request.name === ToolNames.TODO_WRITE) {
6594
+ const provenance = ToolCallEmitter.resolveToolProvenance(
6595
+ request.name
6596
+ );
6597
+ await this.sendUpdate({
6598
+ sessionUpdate: "tool_call_update",
6599
+ toolCallId: response.callId,
6600
+ status: "failed",
6601
+ content: [
6602
+ {
6603
+ type: "content",
6604
+ content: {
6605
+ type: "text",
6606
+ text: response.error?.message ?? String(response.resultDisplay)
6607
+ }
6576
6608
  }
6609
+ ],
6610
+ rawOutput: response.resultDisplay,
6611
+ _meta: {
6612
+ toolName: request.name,
6613
+ provenance: provenance.provenance,
6614
+ ...provenance.serverId ? { serverId: provenance.serverId } : {}
6577
6615
  }
6578
- ],
6579
- rawOutput: response.resultDisplay,
6580
- _meta: {
6616
+ });
6617
+ } else {
6618
+ await this.toolCallEmitter.emitResult({
6619
+ callId: response.callId,
6581
6620
  toolName: request.name,
6582
- provenance: provenance.provenance,
6583
- ...provenance.serverId ? { serverId: provenance.serverId } : {}
6584
- }
6585
- });
6586
- } else {
6587
- await this.toolCallEmitter.emitResult({
6588
- callId: response.callId,
6589
- toolName: request.name,
6590
- args: request.args,
6591
- message: response.responseParts,
6592
- resultDisplay: response.resultDisplay,
6593
- error: response.error,
6594
- success: false
6595
- });
6621
+ args: request.args,
6622
+ message: response.responseParts,
6623
+ resultDisplay: response.resultDisplay,
6624
+ error: response.error,
6625
+ success: false
6626
+ });
6627
+ }
6628
+ } catch (emitError) {
6629
+ debugLogger5.debug(
6630
+ "[Session.runToolCalls] Failed to emit duplicate tool update",
6631
+ emitError
6632
+ );
6596
6633
  }
6597
6634
  queueToolResultRecord(batch.fc, {
6598
6635
  callId: response.callId,
@@ -6602,6 +6639,7 @@ ${this.pendingRecoveredAgentsNotice}
6602
6639
  metadata: {
6603
6640
  callId: response.callId,
6604
6641
  status: "error",
6642
+ executionStatus: response.executionStatus ?? "not_started",
6605
6643
  resultDisplay: response.resultDisplay,
6606
6644
  error: response.error,
6607
6645
  errorType: response.errorType
@@ -6640,10 +6678,12 @@ ${this.pendingRecoveredAgentsNotice}
6640
6678
  executableCalls.map((call) => call.name)
6641
6679
  );
6642
6680
  const planModeEntryBoundary = planModeEntryBoundaryIndex === void 0 ? void 0 : executableCalls[planModeEntryBoundaryIndex];
6643
- const appendSkippedAfter = /* @__PURE__ */ __name(async (parts2, fc, message = PERMISSION_CANCEL_SKIP_MESSAGE) => {
6681
+ const appendSkippedAfter = /* @__PURE__ */ __name(async (parts2, fc, message = PERMISSION_CANCEL_SKIP_MESSAGE, errorType) => {
6644
6682
  const startIndex = dedupedFunctionCalls.indexOf(fc) + 1;
6645
6683
  for (const remainingCall of dedupedFunctionCalls.slice(startIndex)) {
6646
- parts2.push(await recordSkippedToolCall(remainingCall, message));
6684
+ parts2.push(
6685
+ await recordSkippedToolCall(remainingCall, message, true, errorType)
6686
+ );
6647
6687
  }
6648
6688
  }, "appendSkippedAfter");
6649
6689
  const memoryWriteCandidates = [];
@@ -6673,7 +6713,12 @@ ${this.pendingRecoveredAgentsNotice}
6673
6713
  if (results[i]) continue;
6674
6714
  results[i] = {
6675
6715
  parts: [
6676
- await recordSkippedToolCall(calls[i], LOOP_DETECTED_SKIP_MESSAGE)
6716
+ await recordSkippedToolCall(
6717
+ calls[i],
6718
+ LOOP_DETECTED_SKIP_MESSAGE,
6719
+ true,
6720
+ "unknown" /* UNKNOWN */
6721
+ )
6677
6722
  ],
6678
6723
  stopAfterPermissionCancel: false,
6679
6724
  loopDetected: true
@@ -6837,7 +6882,8 @@ ${this.pendingRecoveredAgentsNotice}
6837
6882
  await appendSkippedAfter(
6838
6883
  parts,
6839
6884
  batch.calls[batch.calls.length - 1],
6840
- LOOP_DETECTED_SKIP_MESSAGE
6885
+ LOOP_DETECTED_SKIP_MESSAGE,
6886
+ "unknown" /* UNKNOWN */
6841
6887
  );
6842
6888
  return await finalizeRunToolResult({
6843
6889
  parts,
@@ -6874,7 +6920,12 @@ ${this.pendingRecoveredAgentsNotice}
6874
6920
  parts.push(...r.parts);
6875
6921
  collectMemoryWriteCandidates(r);
6876
6922
  if (r.loopDetected) {
6877
- await appendSkippedAfter(parts, fc, LOOP_DETECTED_SKIP_MESSAGE);
6923
+ await appendSkippedAfter(
6924
+ parts,
6925
+ fc,
6926
+ LOOP_DETECTED_SKIP_MESSAGE,
6927
+ "unknown" /* UNKNOWN */
6928
+ );
6878
6929
  return await finalizeRunToolResult({
6879
6930
  parts,
6880
6931
  stopAfterPermissionCancel: false,
@@ -6937,10 +6988,21 @@ ${this.pendingRecoveredAgentsNotice}
6937
6988
  async runTool(abortSignal, promptId, fc, onStopAfterPermissionCancel, toolLoopState, recordSkippedToolCall, queueToolResultRecord, generatedCallId, onFullTurnModel) {
6938
6989
  const callId = fc.id ?? generatedCallId ?? `${fc.name}-${Date.now()}`;
6939
6990
  let args = fc.args ?? {};
6991
+ let executionStatus = "not_started";
6992
+ let executionErrorType;
6993
+ let executeReturned = false;
6994
+ let terminalStatus;
6995
+ let toolType = "native";
6996
+ let mcpServerName = void 0;
6940
6997
  if (toolLoopState?.loopDetected) {
6941
6998
  return {
6942
6999
  parts: [
6943
- recordSkippedToolCall ? await recordSkippedToolCall(fc, LOOP_DETECTED_SKIP_MESSAGE, false) : {
7000
+ recordSkippedToolCall ? await recordSkippedToolCall(
7001
+ fc,
7002
+ LOOP_DETECTED_SKIP_MESSAGE,
7003
+ false,
7004
+ "unknown" /* UNKNOWN */
7005
+ ) : {
6944
7006
  functionResponse: {
6945
7007
  id: callId,
6946
7008
  name: fc.name ?? "unknown_tool",
@@ -6965,51 +7027,80 @@ ${this.pendingRecoveredAgentsNotice}
6965
7027
  removeAgentToolAbortPropagation?.();
6966
7028
  removeAgentToolAbortPropagation = void 0;
6967
7029
  }, "cleanupAgentToolResources");
6968
- const errorResponse = /* @__PURE__ */ __name((error) => {
7030
+ const errorResponse = /* @__PURE__ */ __name((error, toolName2, status, errorType) => {
6969
7031
  const durationMs = Date.now() - startTime;
6970
- logToolCall(this.config, {
6971
- "event.name": "tool_call",
6972
- "event.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
6973
- prompt_id: promptId,
6974
- function_name: fc.name ?? "",
6975
- function_args: args,
6976
- duration_ms: durationMs,
6977
- // An aborted signal means the call was cancelled, not a genuine error.
6978
- status: activeToolAbortSignal.aborted ? "cancelled" : "error",
6979
- success: false,
6980
- error: error.message,
6981
- tool_type: typeof tool !== "undefined" && tool instanceof DiscoveredMCPTool ? "mcp" : "native"
6982
- });
7032
+ try {
7033
+ logToolCall(this.config, {
7034
+ "event.name": "tool_call",
7035
+ "event.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
7036
+ call_id: callId,
7037
+ prompt_id: promptId,
7038
+ function_name: toolName2,
7039
+ function_args: args,
7040
+ duration_ms: durationMs,
7041
+ status,
7042
+ execution_status: executionStatus,
7043
+ success: false,
7044
+ ...status === "error" ? {
7045
+ error: error.message,
7046
+ error_type: errorType
7047
+ } : {},
7048
+ tool_type: toolType,
7049
+ mcp_server_name: mcpServerName
7050
+ });
7051
+ } catch (telemetryError) {
7052
+ debugLogger5.debug(
7053
+ "[Session.runTool] Failed to record terminal tool telemetry",
7054
+ telemetryError
7055
+ );
7056
+ }
6983
7057
  return [
6984
7058
  {
6985
7059
  functionResponse: {
6986
7060
  id: callId,
6987
- name: fc.name ?? "",
7061
+ name: toolName2,
6988
7062
  response: { error: error.message }
6989
7063
  }
6990
7064
  }
6991
7065
  ];
6992
7066
  }, "errorResponse");
6993
7067
  const earlyErrorResponse = /* @__PURE__ */ __name(async (error, toolName2 = fc.name ?? "unknown_tool", opts) => {
6994
- spanError = error.message;
7068
+ executionStatus = opts.executionStatus;
7069
+ terminalStatus = opts.status;
7070
+ spanError = opts.status === "error" ? error.message : void 0;
6995
7071
  cleanupAgentToolResources();
6996
7072
  if (toolName2 !== ToolNames.TODO_WRITE) {
6997
- await this.toolCallEmitter.emitError(callId, toolName2, error);
7073
+ try {
7074
+ await this.toolCallEmitter.emitError(callId, toolName2, error);
7075
+ } catch (emitError) {
7076
+ debugLogger5.debug(
7077
+ "[Session.runTool] Failed to emit terminal tool update",
7078
+ emitError
7079
+ );
7080
+ }
6998
7081
  }
6999
- const errorParts = errorResponse(error);
7082
+ const errorParts = errorResponse(
7083
+ error,
7084
+ toolName2,
7085
+ opts.status,
7086
+ opts.errorType
7087
+ );
7000
7088
  queueToolResultRecord?.(fc, {
7001
7089
  callId,
7002
7090
  toolName: toolName2,
7003
7091
  responseParts: errorParts,
7004
7092
  metadata: {
7005
7093
  callId,
7006
- status: opts?.status ?? "error",
7094
+ status: opts.status,
7095
+ executionStatus,
7007
7096
  resultDisplay: void 0,
7008
- error,
7009
- errorType: opts?.errorType
7097
+ error: opts.status === "error" ? error : void 0,
7098
+ errorType: opts.status === "error" ? opts.errorType : void 0
7010
7099
  }
7011
7100
  });
7012
- const loopDetected = opts?.recordInvalidToolParams === true && !activeToolAbortSignal.aborted && !opts?.stopAfterPermissionCancel && recordDaemonInvalidToolParams(
7101
+ const loopDetected = opts.recordInvalidToolParams === true && !activeToolAbortSignal.aborted && // A permission cancellation is the user declining, not the model
7102
+ // re-sending invalid params, so it must not feed loop detection.
7103
+ !opts.stopAfterPermissionCancel && recordDaemonInvalidToolParams(
7013
7104
  this.config,
7014
7105
  promptId,
7015
7106
  toolLoopState,
@@ -7018,14 +7109,32 @@ ${this.pendingRecoveredAgentsNotice}
7018
7109
  );
7019
7110
  return {
7020
7111
  parts: errorParts,
7021
- stopAfterPermissionCancel: opts?.stopAfterPermissionCancel ?? false,
7112
+ stopAfterPermissionCancel: opts.stopAfterPermissionCancel ?? false,
7022
7113
  loopDetected
7023
7114
  };
7024
7115
  }, "earlyErrorResponse");
7116
+ const cancelBeforeExecutionIfAborted = /* @__PURE__ */ __name((toolName2 = fc.name ?? "unknown_tool") => activeToolAbortSignal.aborted ? earlyErrorResponse(
7117
+ new Error("Tool call was cancelled before execution."),
7118
+ toolName2,
7119
+ {
7120
+ status: "cancelled",
7121
+ errorType: void 0,
7122
+ executionStatus: "not_started"
7123
+ }
7124
+ ) : void 0, "cancelBeforeExecutionIfAborted");
7125
+ const initialCancellation = cancelBeforeExecutionIfAborted();
7126
+ if (initialCancellation) return initialCancellation;
7025
7127
  if (!fc.name) {
7026
- return earlyErrorResponse(new Error("Missing function name"), void 0, {
7027
- recordInvalidToolParams: true
7028
- });
7128
+ return earlyErrorResponse(
7129
+ new Error("Missing function name"),
7130
+ "unknown_tool",
7131
+ {
7132
+ status: "error",
7133
+ errorType: "invalid_tool_params" /* INVALID_TOOL_PARAMS */,
7134
+ executionStatus: "not_started",
7135
+ recordInvalidToolParams: true
7136
+ }
7137
+ );
7029
7138
  }
7030
7139
  const toolName = fc.name;
7031
7140
  const toolRegistry = this.config.getToolRegistry();
@@ -7034,9 +7143,16 @@ ${this.pendingRecoveredAgentsNotice}
7034
7143
  return earlyErrorResponse(
7035
7144
  new Error(`Tool "${toolName}" not found in registry.`),
7036
7145
  toolName,
7037
- { recordInvalidToolParams: true }
7146
+ {
7147
+ status: "error",
7148
+ errorType: "tool_not_registered" /* TOOL_NOT_REGISTERED */,
7149
+ executionStatus: "not_started",
7150
+ recordInvalidToolParams: true
7151
+ }
7038
7152
  );
7039
7153
  }
7154
+ toolType = tool instanceof DiscoveredMCPTool ? "mcp" : "native";
7155
+ mcpServerName = tool instanceof DiscoveredMCPTool ? tool.serverName : void 0;
7040
7156
  const policyToolName = tool.name;
7041
7157
  const originalPolicyRequestArgs = policyToolName === ToolNames.SHELL || policyToolName === ToolNames.MONITOR ? structuredClone(args) : args;
7042
7158
  const toolSpan = startToolSpan(
@@ -7053,14 +7169,23 @@ ${this.pendingRecoveredAgentsNotice}
7053
7169
  tool.description,
7054
7170
  promptId
7055
7171
  );
7056
- let spanSuccess = false;
7057
7172
  try {
7058
7173
  return await runInToolSpanContext(toolSpan, async () => {
7174
+ const entryCancellation = cancelBeforeExecutionIfAborted(toolName);
7175
+ if (entryCancellation) return entryCancellation;
7059
7176
  const pm = this.config.getPermissionManager?.();
7060
- if (pm && !await pm.isToolEnabled(policyToolName)) {
7177
+ const toolEnabled = pm ? await pm.isToolEnabled(policyToolName) : true;
7178
+ const enablementCancellation = cancelBeforeExecutionIfAborted(toolName);
7179
+ if (enablementCancellation) return enablementCancellation;
7180
+ if (pm && !toolEnabled) {
7061
7181
  return earlyErrorResponse(
7062
7182
  new Error(`Tool "${toolName}" is disabled.`),
7063
- toolName
7183
+ toolName,
7184
+ {
7185
+ status: "error",
7186
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7187
+ executionStatus: "not_started"
7188
+ }
7064
7189
  );
7065
7190
  }
7066
7191
  const isTodoWriteTool = tool.name === ToolNames.TODO_WRITE;
@@ -7122,6 +7247,8 @@ ${this.pendingRecoveredAgentsNotice}
7122
7247
  policyToolName,
7123
7248
  toolParams
7124
7249
  );
7250
+ const permissionFlowCancellation = cancelBeforeExecutionIfAborted(toolName);
7251
+ if (permissionFlowCancellation) return permissionFlowCancellation;
7125
7252
  const {
7126
7253
  finalPermission,
7127
7254
  pmForcedAsk,
@@ -7135,7 +7262,12 @@ ${this.pendingRecoveredAgentsNotice}
7135
7262
  if (finalPermission === "deny") {
7136
7263
  return earlyErrorResponse(
7137
7264
  new Error(denyMessage ?? `Tool "${toolName}" is denied.`),
7138
- toolName
7265
+ toolName,
7266
+ {
7267
+ status: "error",
7268
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7269
+ executionStatus: "not_started"
7270
+ }
7139
7271
  );
7140
7272
  }
7141
7273
  let planShellAmbientWorkingDirectory;
@@ -7157,6 +7289,8 @@ ${this.pendingRecoveredAgentsNotice}
7157
7289
  ambientWorkingDirectory: planShellAmbientWorkingDirectory,
7158
7290
  signal: activeToolAbortSignal
7159
7291
  }) : { classification: "not-applicable" };
7292
+ const planPolicyCancellation = cancelBeforeExecutionIfAborted(toolName);
7293
+ if (planPolicyCancellation) return planPolicyCancellation;
7160
7294
  if (planShellDecision.classification !== "not-applicable") {
7161
7295
  const initialPlanShellError = await validatePlanModeShellContext({
7162
7296
  config: this.config,
@@ -7165,17 +7299,31 @@ ${this.pendingRecoveredAgentsNotice}
7165
7299
  invocationParams: invocation.params,
7166
7300
  signal: activeToolAbortSignal
7167
7301
  });
7302
+ const initialPlanValidationCancellation = cancelBeforeExecutionIfAborted(toolName);
7303
+ if (initialPlanValidationCancellation) {
7304
+ return initialPlanValidationCancellation;
7305
+ }
7168
7306
  if (initialPlanShellError) {
7169
7307
  return earlyErrorResponse(
7170
7308
  new Error(initialPlanShellError),
7171
- toolName
7309
+ toolName,
7310
+ {
7311
+ status: "error",
7312
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7313
+ executionStatus: "not_started"
7314
+ }
7172
7315
  );
7173
7316
  }
7174
7317
  }
7175
7318
  if (planShellDecision.classification === "write") {
7176
7319
  return earlyErrorResponse(
7177
7320
  new Error(planShellDecision.writeBlockMessage),
7178
- toolName
7321
+ toolName,
7322
+ {
7323
+ status: "error",
7324
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7325
+ executionStatus: "not_started"
7326
+ }
7179
7327
  );
7180
7328
  }
7181
7329
  const planShellRequiresConfirmation = planShellDecision.classification === "unknown";
@@ -7210,6 +7358,8 @@ ${this.pendingRecoveredAgentsNotice}
7210
7358
  signal: abortSignal,
7211
7359
  skipClassifierReason: fallback.fallback ? fallback.reason : void 0
7212
7360
  });
7361
+ const autoModeCancellation = cancelBeforeExecutionIfAborted(toolName);
7362
+ if (autoModeCancellation) return autoModeCancellation;
7213
7363
  const outcome = applyAutoModeDecision(
7214
7364
  decision,
7215
7365
  this.config,
@@ -7224,6 +7374,10 @@ ${this.pendingRecoveredAgentsNotice}
7224
7374
  callId,
7225
7375
  abortSignal
7226
7376
  );
7377
+ const permissionDeniedHookCancellation = cancelBeforeExecutionIfAborted(toolName);
7378
+ if (permissionDeniedHookCancellation) {
7379
+ return permissionDeniedHookCancellation;
7380
+ }
7227
7381
  switch (outcome.kind) {
7228
7382
  case "approved":
7229
7383
  autoModeAllowed = true;
@@ -7234,7 +7388,12 @@ ${this.pendingRecoveredAgentsNotice}
7234
7388
  );
7235
7389
  return earlyErrorResponse(
7236
7390
  new Error(outcome.errorMessage),
7237
- toolName
7391
+ toolName,
7392
+ {
7393
+ status: "error",
7394
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7395
+ executionStatus: "not_started"
7396
+ }
7238
7397
  );
7239
7398
  case "fallback":
7240
7399
  wasAutoModeManualFallback = isDenialFallbackReason(outcome.reason) || outcome.reason === "classifier_unavailable";
@@ -7278,6 +7437,10 @@ ${this.pendingRecoveredAgentsNotice}
7278
7437
  confirmationDetails = await invocation.getConfirmationDetails(
7279
7438
  activeToolAbortSignal
7280
7439
  );
7440
+ const confirmationDetailsCancellation = cancelBeforeExecutionIfAborted(toolName);
7441
+ if (confirmationDetailsCancellation) {
7442
+ return confirmationDetailsCancellation;
7443
+ }
7281
7444
  if (autoModeFallbackMessage) {
7282
7445
  confirmationDetails = decorateClassifierUnavailableConfirmation(
7283
7446
  confirmationDetails,
@@ -7292,10 +7455,19 @@ ${this.pendingRecoveredAgentsNotice}
7292
7455
  invocationParams: invocation.params,
7293
7456
  signal: activeToolAbortSignal
7294
7457
  });
7458
+ const preDisplayValidationCancellation = cancelBeforeExecutionIfAborted(toolName);
7459
+ if (preDisplayValidationCancellation) {
7460
+ return preDisplayValidationCancellation;
7461
+ }
7295
7462
  if (preDisplayPlanShellError) {
7296
7463
  return earlyErrorResponse(
7297
7464
  new Error(preDisplayPlanShellError),
7298
- toolName
7465
+ toolName,
7466
+ {
7467
+ status: "error",
7468
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7469
+ executionStatus: "not_started"
7470
+ }
7299
7471
  );
7300
7472
  }
7301
7473
  }
@@ -7308,7 +7480,12 @@ ${this.pendingRecoveredAgentsNotice}
7308
7480
  if (planShellDecision.classification === "unknown") {
7309
7481
  return earlyErrorResponse(
7310
7482
  new Error(planShellDecision.noApprovalMessage),
7311
- toolName
7483
+ toolName,
7484
+ {
7485
+ status: "error",
7486
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7487
+ executionStatus: "not_started"
7488
+ }
7312
7489
  );
7313
7490
  }
7314
7491
  throw new Error("Unable to prepare shell confirmation.");
@@ -7325,7 +7502,12 @@ ${this.pendingRecoveredAgentsNotice}
7325
7502
  new Error(
7326
7503
  `Plan mode is active. The tool "${toolName}" cannot be executed because it modifies the system. Please use the exit_plan_mode tool to present your plan and exit plan mode before making changes.`
7327
7504
  ),
7328
- toolName
7505
+ toolName,
7506
+ {
7507
+ status: "error",
7508
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7509
+ executionStatus: "not_started"
7510
+ }
7329
7511
  );
7330
7512
  }
7331
7513
  const messageBus = this.config.getMessageBus?.();
@@ -7340,6 +7522,10 @@ ${this.pendingRecoveredAgentsNotice}
7340
7522
  void 0,
7341
7523
  activeToolAbortSignal
7342
7524
  );
7525
+ const permissionHookCancellation = cancelBeforeExecutionIfAborted(toolName);
7526
+ if (permissionHookCancellation) {
7527
+ return permissionHookCancellation;
7528
+ }
7343
7529
  if (hookResult.hasDecision && (!hookResult.shouldAllow || !requiresUserInteraction)) {
7344
7530
  hookHandled = true;
7345
7531
  if (hookResult.shouldAllow) {
@@ -7353,16 +7539,29 @@ ${this.pendingRecoveredAgentsNotice}
7353
7539
  outcome: "proceed_once" /* ProceedOnce */,
7354
7540
  payload: hookResult.updatedInput ? { updatedInput: hookResult.updatedInput } : void 0
7355
7541
  });
7542
+ const hookPlanApprovalCancellation = cancelBeforeExecutionIfAborted(toolName);
7543
+ if (hookPlanApprovalCancellation) {
7544
+ return hookPlanApprovalCancellation;
7545
+ }
7356
7546
  await confirmationDetails.onConfirm(
7357
7547
  approval.outcome,
7358
7548
  approval.payload
7359
7549
  );
7550
+ const hookPlanConfirmationCancellation = cancelBeforeExecutionIfAborted(toolName);
7551
+ if (hookPlanConfirmationCancellation) {
7552
+ return hookPlanConfirmationCancellation;
7553
+ }
7360
7554
  if (approval.outcome === "cancel" /* Cancel */) {
7361
7555
  return earlyErrorResponse(
7362
7556
  new Error(
7363
7557
  approval.payload?.cancelMessage ?? planShellDecision.noApprovalMessage
7364
7558
  ),
7365
- toolName
7559
+ toolName,
7560
+ {
7561
+ status: "error",
7562
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7563
+ executionStatus: "not_started"
7564
+ }
7366
7565
  );
7367
7566
  }
7368
7567
  recordAutoModeFallbackResolution(approval.outcome);
@@ -7374,6 +7573,10 @@ ${this.pendingRecoveredAgentsNotice}
7374
7573
  await confirmationDetails.onConfirm(
7375
7574
  "proceed_once" /* ProceedOnce */
7376
7575
  );
7576
+ const hookConfirmationCancellation = cancelBeforeExecutionIfAborted(toolName);
7577
+ if (hookConfirmationCancellation) {
7578
+ return hookConfirmationCancellation;
7579
+ }
7377
7580
  recordAutoModeFallbackResolution(
7378
7581
  "proceed_once" /* ProceedOnce */
7379
7582
  );
@@ -7383,7 +7586,12 @@ ${this.pendingRecoveredAgentsNotice}
7383
7586
  new Error(
7384
7587
  hookResult.denyMessage || `Permission denied by hook for "${toolName}"`
7385
7588
  ),
7386
- toolName
7589
+ toolName,
7590
+ {
7591
+ status: "error",
7592
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7593
+ executionStatus: "not_started"
7594
+ }
7387
7595
  );
7388
7596
  }
7389
7597
  }
@@ -7398,10 +7606,19 @@ ${this.pendingRecoveredAgentsNotice}
7398
7606
  invocationParams: invocation.params,
7399
7607
  signal: activeToolAbortSignal
7400
7608
  });
7609
+ const finalPlanValidationCancellation = cancelBeforeExecutionIfAborted(toolName);
7610
+ if (finalPlanValidationCancellation) {
7611
+ return finalPlanValidationCancellation;
7612
+ }
7401
7613
  if (finalPreDisplayPlanShellError) {
7402
7614
  return earlyErrorResponse(
7403
7615
  new Error(finalPreDisplayPlanShellError),
7404
- toolName
7616
+ toolName,
7617
+ {
7618
+ status: "error",
7619
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7620
+ executionStatus: "not_started"
7621
+ }
7405
7622
  );
7406
7623
  }
7407
7624
  }
@@ -7454,7 +7671,12 @@ ${this.pendingRecoveredAgentsNotice}
7454
7671
  message ?? `Tool "${toolName}" was canceled by the user.`
7455
7672
  ),
7456
7673
  toolName,
7457
- { stopAfterPermissionCancel: true }
7674
+ {
7675
+ status: "cancelled",
7676
+ errorType: void 0,
7677
+ executionStatus: "not_started",
7678
+ stopAfterPermissionCancel: true
7679
+ }
7458
7680
  );
7459
7681
  }, "stopAfterPermissionCancel");
7460
7682
  let output;
@@ -7464,6 +7686,10 @@ ${this.pendingRecoveredAgentsNotice}
7464
7686
  params,
7465
7687
  activeToolAbortSignal
7466
7688
  );
7689
+ const permissionRequestCancellation = cancelBeforeExecutionIfAborted(toolName);
7690
+ if (permissionRequestCancellation) {
7691
+ return permissionRequestCancellation;
7692
+ }
7467
7693
  outcome = resolvePermissionOutcome(
7468
7694
  output,
7469
7695
  offeredPermissionOptions
@@ -7483,16 +7709,26 @@ ${this.pendingRecoveredAgentsNotice}
7483
7709
  confirmError
7484
7710
  );
7485
7711
  }
7486
- onStopAfterPermissionCancel?.();
7712
+ const wasAborted = activeToolAbortSignal.aborted;
7713
+ if (!wasAborted) {
7714
+ onStopAfterPermissionCancel?.();
7715
+ }
7487
7716
  const permissionFailureMessage = isExitPlanModeTool ? "The host could not present plan-exit approval. Plan mode remains active; use the host mode selector or /plan exit to leave plan mode." : planShellDecision.classification === "unknown" ? `Plan mode could not complete approval for this shell command: ${this.#formatError(
7488
7717
  error
7489
7718
  )}. The command was not run; Plan mode remains active.` : `Permission request failed for "${toolName}": ${this.#formatError(
7490
7719
  error
7491
7720
  )}`;
7492
7721
  return earlyErrorResponse(
7493
- new Error(permissionFailureMessage),
7722
+ new Error(
7723
+ wasAborted ? "Tool call was cancelled before execution." : permissionFailureMessage
7724
+ ),
7494
7725
  toolName,
7495
- { stopAfterPermissionCancel: true }
7726
+ {
7727
+ status: wasAborted ? "cancelled" : "error",
7728
+ errorType: wasAborted ? void 0 : "unhandled_exception" /* UNHANDLED_EXCEPTION */,
7729
+ executionStatus: "not_started",
7730
+ stopAfterPermissionCancel: !wasAborted
7731
+ }
7496
7732
  );
7497
7733
  }
7498
7734
  let confirmationPayload = {
@@ -7508,6 +7744,10 @@ ${this.pendingRecoveredAgentsNotice}
7508
7744
  outcome,
7509
7745
  payload: confirmationPayload
7510
7746
  });
7747
+ const planApprovalCancellation = cancelBeforeExecutionIfAborted(toolName);
7748
+ if (planApprovalCancellation) {
7749
+ return planApprovalCancellation;
7750
+ }
7511
7751
  outcome = approval.outcome;
7512
7752
  confirmationPayload = approval.payload;
7513
7753
  }
@@ -7521,6 +7761,10 @@ ${this.pendingRecoveredAgentsNotice}
7521
7761
  outcome,
7522
7762
  confirmationPayload
7523
7763
  );
7764
+ const confirmationCancellation = cancelBeforeExecutionIfAborted(toolName);
7765
+ if (confirmationCancellation) {
7766
+ return confirmationCancellation;
7767
+ }
7524
7768
  } catch (error) {
7525
7769
  if (outcome !== "cancel" /* Cancel */) {
7526
7770
  throw error;
@@ -7534,6 +7778,8 @@ ${this.pendingRecoveredAgentsNotice}
7534
7778
  if (shouldSwitchToDefault) {
7535
7779
  this.config.setApprovalMode("default" /* DEFAULT */);
7536
7780
  await this.sendCurrentModeUpdateNotification();
7781
+ const modeUpdateCancellation = cancelBeforeExecutionIfAborted(toolName);
7782
+ if (modeUpdateCancellation) return modeUpdateCancellation;
7537
7783
  }
7538
7784
  if (outcome === "proceed_always" /* ProceedAlways */ || outcome === "proceed_always_project" /* ProceedAlwaysProject */ || outcome === "proceed_always_user" /* ProceedAlwaysUser */) {
7539
7785
  await persistPermissionOutcome(
@@ -7543,9 +7789,17 @@ ${this.pendingRecoveredAgentsNotice}
7543
7789
  this.config.getPermissionManager?.(),
7544
7790
  confirmationPayload
7545
7791
  );
7792
+ const permissionPersistenceCancellation = cancelBeforeExecutionIfAborted(toolName);
7793
+ if (permissionPersistenceCancellation) {
7794
+ return permissionPersistenceCancellation;
7795
+ }
7546
7796
  }
7547
7797
  if (confirmationDetails.type === "edit" && outcome === "proceed_always" /* ProceedAlways */) {
7548
7798
  await this.sendCurrentModeUpdateNotification();
7799
+ const editModeUpdateCancellation = cancelBeforeExecutionIfAborted(toolName);
7800
+ if (editModeUpdateCancellation) {
7801
+ return editModeUpdateCancellation;
7802
+ }
7549
7803
  }
7550
7804
  switch (outcome) {
7551
7805
  case "proceed_once_and_switch_to_default" /* ProceedOnceAndSwitchToDefault */:
@@ -7579,7 +7833,16 @@ ${this.pendingRecoveredAgentsNotice}
7579
7833
  args,
7580
7834
  status: "in_progress"
7581
7835
  };
7582
- await this.toolCallEmitter.emitStart(startParams);
7836
+ try {
7837
+ await this.toolCallEmitter.emitStart(startParams);
7838
+ } catch (emitError) {
7839
+ debugLogger5.debug(
7840
+ "[Session.runTool] Failed to emit tool start update",
7841
+ emitError
7842
+ );
7843
+ }
7844
+ const startEmissionCancellation = cancelBeforeExecutionIfAborted(toolName);
7845
+ if (startEmissionCancellation) return startEmissionCancellation;
7583
7846
  }
7584
7847
  const hooksEnabledForTool = !this.config.getDisableAllHooks?.();
7585
7848
  const messageBusForTool = this.config.getMessageBus?.();
@@ -7594,12 +7857,27 @@ ${this.pendingRecoveredAgentsNotice}
7594
7857
  activeToolAbortSignal,
7595
7858
  callId
7596
7859
  );
7860
+ const preHookCancellation = cancelBeforeExecutionIfAborted(toolName);
7861
+ if (preHookCancellation) return preHookCancellation;
7597
7862
  if (!preHookResult.shouldProceed) {
7598
7863
  const blockReason = preHookResult.blockReason || "Blocked by PreToolUse hook";
7599
- await this.messageEmitter.emitAgentMessage(
7600
- `\u2717 **PreToolUse blocked**: ${toolName} - ${blockReason}`
7601
- );
7602
- return earlyErrorResponse(new Error(blockReason), toolName);
7864
+ try {
7865
+ await this.messageEmitter.emitAgentMessage(
7866
+ `\u2717 **PreToolUse blocked**: ${toolName} - ${blockReason}`
7867
+ );
7868
+ } catch (emitError) {
7869
+ debugLogger5.debug(
7870
+ "[Session.runTool] Failed to emit PreToolUse block message",
7871
+ emitError
7872
+ );
7873
+ }
7874
+ const blockMessageCancellation = cancelBeforeExecutionIfAborted(toolName);
7875
+ if (blockMessageCancellation) return blockMessageCancellation;
7876
+ return earlyErrorResponse(new Error(blockReason), toolName, {
7877
+ status: "error",
7878
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7879
+ executionStatus: "not_started"
7880
+ });
7603
7881
  }
7604
7882
  if (preHookResult.additionalContext) {
7605
7883
  debugLogger5.debug(
@@ -7622,17 +7900,29 @@ ${this.pendingRecoveredAgentsNotice}
7622
7900
  return earlyErrorResponse(
7623
7901
  new Error("Tool invocation was cancelled"),
7624
7902
  toolName,
7625
- { status: "cancelled" }
7903
+ {
7904
+ status: "cancelled",
7905
+ errorType: void 0,
7906
+ executionStatus: "not_started"
7907
+ }
7626
7908
  );
7627
7909
  }
7628
7910
  if (!guardDecision.allowed) {
7629
7911
  return earlyErrorResponse(
7630
7912
  new Error(guardDecision.reason),
7631
7913
  toolName,
7632
- { errorType: "execution_denied" /* EXECUTION_DENIED */ }
7914
+ {
7915
+ status: "error",
7916
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
7917
+ executionStatus: "not_started"
7918
+ }
7633
7919
  );
7634
7920
  }
7635
7921
  }
7922
+ const executionBoundaryCancellation = cancelBeforeExecutionIfAborted(toolName);
7923
+ if (executionBoundaryCancellation) {
7924
+ return executionBoundaryCancellation;
7925
+ }
7636
7926
  const continuedAgentId = toolName === ToolNames.SEND_MESSAGE && typeof args["task_id"] === "string" && args["task_id"].length > 0 ? args["task_id"] : void 0;
7637
7927
  const provisionalRelatedAgent = continuedAgentId !== void 0 && !this.relatedAgentIds.has(continuedAgentId);
7638
7928
  if (provisionalRelatedAgent) {
@@ -7660,9 +7950,9 @@ ${this.pendingRecoveredAgentsNotice}
7660
7950
  this.relatedAgentIds.add(continuedAgentId);
7661
7951
  }
7662
7952
  }, "settleRelatedAgent");
7663
- const execSpan = startToolExecutionSpan();
7664
7953
  let toolResult;
7665
7954
  let isExecutionTimeout = false;
7955
+ let parentAbortedAtExecutionSettle = false;
7666
7956
  let aborted = false;
7667
7957
  let toolSettled = false;
7668
7958
  let heartbeatCount = 0;
@@ -7692,49 +7982,66 @@ ${this.pendingRecoveredAgentsNotice}
7692
7982
  }
7693
7983
  }
7694
7984
  } : void 0, "heartbeatSpanAttributes");
7985
+ const sleepInhibitorHandle = acquireSleepInhibitor(
7986
+ this.config,
7987
+ `Qwen Code is executing tool ${toolName}`
7988
+ );
7695
7989
  try {
7696
- const sleepInhibitorHandle = acquireSleepInhibitor(
7697
- this.config,
7698
- `Qwen Code is executing tool ${toolName}`
7699
- );
7700
7990
  try {
7701
- try {
7702
- addToolArgumentsAttributes(
7703
- this.config,
7704
- toolSpan,
7705
- invocation.params
7706
- );
7707
- } catch {
7708
- debugLogger5.debug(
7709
- "[Session.runTool] Failed to record tool arguments telemetry"
7710
- );
7711
- }
7991
+ addToolArgumentsAttributes(
7992
+ this.config,
7993
+ toolSpan,
7994
+ invocation.params
7995
+ );
7996
+ } catch {
7997
+ debugLogger5.debug(
7998
+ "[Session.runTool] Failed to record tool arguments telemetry"
7999
+ );
8000
+ }
8001
+ const execSpan = startToolExecutionSpan({
8002
+ toolName: policyToolName,
8003
+ callId
8004
+ });
8005
+ executionStatus = "error";
8006
+ try {
7712
8007
  toolResult = await invocation.execute(
7713
8008
  activeToolAbortSignal,
7714
8009
  onToolProgress
7715
8010
  );
7716
- } finally {
7717
- toolSettled = true;
7718
- sleepInhibitorHandle.release();
8011
+ executeReturned = true;
8012
+ parentAbortedAtExecutionSettle = activeToolAbortSignal.aborted;
8013
+ isExecutionTimeout = toolResult.error?.type === "execution_timeout" /* EXECUTION_TIMEOUT */;
8014
+ aborted = parentAbortedAtExecutionSettle && !isExecutionTimeout;
8015
+ executionStatus = aborted ? "cancelled" : toolResult.error ? "error" : "success";
8016
+ executionErrorType = toolResult.error ? toolResult.error.type ?? (toolType === "mcp" ? "mcp_tool_error" /* MCP_TOOL_ERROR */ : "unknown" /* UNKNOWN */) : void 0;
8017
+ settleRelatedAgent(executionStatus === "success");
8018
+ endToolExecutionSpan(execSpan, {
8019
+ success: executionStatus === "success",
8020
+ error: aborted ? "tool_cancelled" : isExecutionTimeout ? "tool_timeout" : toolResult.error ? "tool_error" : void 0,
8021
+ cancelled: aborted,
8022
+ executionStatus,
8023
+ errorType: executionErrorType,
8024
+ ...heartbeatSpanAttributes()
8025
+ });
8026
+ } catch (execError) {
8027
+ const explicitErrorType = execError?.errorType;
8028
+ const executionTimedOut = explicitErrorType === "execution_timeout" /* EXECUTION_TIMEOUT */;
8029
+ executionStatus = activeToolAbortSignal.aborted && !executionTimedOut ? "cancelled" : "error";
8030
+ executionErrorType = executionStatus === "error" ? explicitErrorType ?? (toolType === "mcp" ? "mcp_tool_error" /* MCP_TOOL_ERROR */ : "unhandled_exception" /* UNHANDLED_EXCEPTION */) : void 0;
8031
+ settleRelatedAgent(false);
8032
+ endToolExecutionSpan(execSpan, {
8033
+ success: false,
8034
+ error: executionStatus === "cancelled" ? "tool_cancelled" : executionTimedOut ? "tool_timeout" : "tool_exception",
8035
+ cancelled: executionStatus === "cancelled",
8036
+ executionStatus,
8037
+ errorType: executionErrorType,
8038
+ ...heartbeatSpanAttributes()
8039
+ });
8040
+ throw execError;
7719
8041
  }
7720
- isExecutionTimeout = toolResult.error?.type === "execution_timeout" /* EXECUTION_TIMEOUT */;
7721
- aborted = activeToolAbortSignal.aborted && !isExecutionTimeout;
7722
- settleRelatedAgent(!toolResult.error && !aborted);
7723
- endToolExecutionSpan(execSpan, {
7724
- success: !toolResult.error && !aborted,
7725
- error: aborted ? "tool_cancelled" : isExecutionTimeout ? "tool_timeout" : toolResult.error ? "tool_error" : void 0,
7726
- cancelled: aborted,
7727
- ...heartbeatSpanAttributes()
7728
- });
7729
- } catch (execError) {
7730
- settleRelatedAgent(false);
7731
- endToolExecutionSpan(execSpan, {
7732
- success: false,
7733
- error: activeToolAbortSignal.aborted ? "tool_cancelled" : "tool_exception",
7734
- cancelled: activeToolAbortSignal.aborted,
7735
- ...heartbeatSpanAttributes()
7736
- });
7737
- throw execError;
8042
+ } finally {
8043
+ toolSettled = true;
8044
+ sleepInhibitorHandle.release();
7738
8045
  }
7739
8046
  cleanupAgentToolResources();
7740
8047
  if ((isEnterPlanModeTool || isExitPlanModeTool) && !toolResult.error && this.config.getApprovalMode() !== approvalMode) {
@@ -7743,7 +8050,12 @@ ${this.pendingRecoveredAgentsNotice}
7743
8050
  this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
7744
8051
  }
7745
8052
  }
7746
- let responseParts = toolResult.error ? convertToFunctionErrorResponse(
8053
+ let responseParts = aborted ? convertToFunctionErrorResponse(
8054
+ toolName,
8055
+ callId,
8056
+ TOOL_EXECUTION_CANCELLED_MESSAGE,
8057
+ TOOL_EXECUTION_CANCELLED_MESSAGE
8058
+ ) : toolResult.error ? convertToFunctionErrorResponse(
7747
8059
  toolName,
7748
8060
  callId,
7749
8061
  toolResult.llmContent,
@@ -7753,9 +8065,7 @@ ${this.pendingRecoveredAgentsNotice}
7753
8065
  callId,
7754
8066
  toolResult.llmContent
7755
8067
  );
7756
- const status = aborted ? "cancelled" : toolResult.error ? "error" : "success";
7757
- const succeeded = status === "success";
7758
- const responseError = toolResult.error ? new Error(toolResult.error.message) : aborted ? new Error("Tool execution was cancelled") : void 0;
8068
+ let status = aborted ? "cancelled" : toolResult.error ? "error" : "success";
7759
8069
  if (isTrustedTodoWriteTool && !toolResult.error) {
7760
8070
  this.todoStopGuard.observeTodoWrite(
7761
8071
  toolResult.returnDisplay,
@@ -7778,13 +8088,28 @@ ${this.pendingRecoveredAgentsNotice}
7778
8088
  activeToolAbortSignal,
7779
8089
  callId
7780
8090
  );
8091
+ if (activeToolAbortSignal.aborted) {
8092
+ return earlyErrorResponse(
8093
+ new Error(TOOL_POST_EXECUTION_CANCELLED_MESSAGE),
8094
+ toolName,
8095
+ {
8096
+ status: "cancelled",
8097
+ errorType: void 0,
8098
+ executionStatus
8099
+ }
8100
+ );
8101
+ }
7781
8102
  if (postHookResult.shouldStop) {
7782
8103
  const stopMessage = postHookResult.stopReason || "Execution stopped by PostToolUse hook";
7783
8104
  debugLogger5.info(
7784
8105
  `PostToolUse hook requested stop for ${toolName}: ${stopMessage}`
7785
8106
  );
7786
8107
  this.todoStopGuard.suspend();
7787
- return earlyErrorResponse(new Error(stopMessage), toolName);
8108
+ return earlyErrorResponse(new Error(stopMessage), toolName, {
8109
+ status: "error",
8110
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
8111
+ executionStatus
8112
+ });
7788
8113
  }
7789
8114
  if (postHookResult.additionalContext) {
7790
8115
  const contextPart = { text: postHookResult.additionalContext };
@@ -7798,28 +8123,35 @@ ${this.pendingRecoveredAgentsNotice}
7798
8123
  });
7799
8124
  } else if (hooksEnabledForTool && messageBusForTool && (toolResult.error || aborted)) {
7800
8125
  const isInterrupt = aborted;
7801
- const failureHookResult = await firePostToolUseFailureHook(
7802
- messageBusForTool,
7803
- toolUseId,
7804
- policyToolName,
7805
- args,
7806
- toolResult.error?.message ?? "Tool execution was cancelled",
7807
- isInterrupt,
7808
- permissionMode,
7809
- activeToolAbortSignal,
7810
- callId
7811
- );
7812
- if (failureHookResult.additionalContext) {
8126
+ try {
8127
+ const failureHookResult = await firePostToolUseFailureHook(
8128
+ messageBusForTool,
8129
+ toolUseId,
8130
+ policyToolName,
8131
+ args,
8132
+ toolResult.error?.message ?? TOOL_EXECUTION_CANCELLED_MESSAGE,
8133
+ isInterrupt,
8134
+ permissionMode,
8135
+ activeToolAbortSignal,
8136
+ callId
8137
+ );
8138
+ if (failureHookResult.additionalContext) {
8139
+ debugLogger5.debug(
8140
+ `PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
8141
+ );
8142
+ }
8143
+ await this.emitHookArtifactsNotification({
8144
+ hookEventName: "PostToolUseFailure",
8145
+ toolName,
8146
+ toolCallId: callId,
8147
+ artifacts: failureHookResult.artifacts
8148
+ });
8149
+ } catch (hookError) {
7813
8150
  debugLogger5.debug(
7814
- `PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
8151
+ "[Session.runTool] PostToolUseFailure hook failed",
8152
+ hookError
7815
8153
  );
7816
8154
  }
7817
- await this.emitHookArtifactsNotification({
7818
- hookEventName: "PostToolUseFailure",
7819
- toolName,
7820
- toolCallId: callId,
7821
- artifacts: failureHookResult.artifacts
7822
- });
7823
8155
  }
7824
8156
  const visionBridgeNotices = [];
7825
8157
  responseParts = await bridgeToolResultImages({
@@ -7831,7 +8163,29 @@ ${this.pendingRecoveredAgentsNotice}
7831
8163
  });
7832
8164
  const visionBridgeNotice = visionBridgeNotices.length > 0 ? visionBridgeNotices.join("\n") : void 0;
7833
8165
  if (visionBridgeNotice) {
7834
- await this.messageEmitter.emitAgentMessage(visionBridgeNotice);
8166
+ try {
8167
+ await this.messageEmitter.emitAgentMessage(visionBridgeNotice);
8168
+ } catch (emitError) {
8169
+ debugLogger5.debug(
8170
+ "[Session.runTool] Failed to emit vision bridge notice",
8171
+ emitError
8172
+ );
8173
+ }
8174
+ }
8175
+ if (activeToolAbortSignal.aborted && !(isExecutionTimeout && parentAbortedAtExecutionSettle)) {
8176
+ status = "cancelled";
8177
+ responseParts = convertToFunctionErrorResponse(
8178
+ toolName,
8179
+ callId,
8180
+ TOOL_POST_EXECUTION_CANCELLED_MESSAGE,
8181
+ TOOL_POST_EXECUTION_CANCELLED_MESSAGE
8182
+ );
8183
+ }
8184
+ terminalStatus = status;
8185
+ const succeeded = status === "success";
8186
+ const responseError = status === "error" && toolResult.error ? new Error(toolResult.error.message) : status === "cancelled" ? new Error(TOOL_POST_EXECUTION_CANCELLED_MESSAGE) : void 0;
8187
+ if (isTrustedTodoWriteTool && status === "cancelled") {
8188
+ this.todoStopGuard.suspend();
7835
8189
  }
7836
8190
  if (isTodoWriteTool) {
7837
8191
  const plan = this.planEmitter.extractPlan(
@@ -7839,34 +8193,60 @@ ${this.pendingRecoveredAgentsNotice}
7839
8193
  succeeded ? args : void 0
7840
8194
  );
7841
8195
  if (plan && (plan.todos.length > 0 || Array.isArray(args["todos"]))) {
7842
- await this.planEmitter.emitPlan(plan, callId);
8196
+ try {
8197
+ await this.planEmitter.emitPlan(plan, callId);
8198
+ } catch (emitError) {
8199
+ debugLogger5.debug(
8200
+ "[Session.runTool] Failed to emit plan update",
8201
+ emitError
8202
+ );
8203
+ }
7843
8204
  }
7844
8205
  } else if (!isTodoWriteTool) {
7845
- await this.toolCallEmitter.emitResult({
7846
- callId,
7847
- toolName,
7848
- args,
7849
- message: responseParts,
7850
- resultDisplay: toolResult.returnDisplay,
7851
- error: responseError,
8206
+ try {
8207
+ await this.toolCallEmitter.emitResult({
8208
+ callId,
8209
+ toolName,
8210
+ args,
8211
+ message: responseParts,
8212
+ resultDisplay: toolResult.returnDisplay,
8213
+ error: responseError,
8214
+ success: succeeded,
8215
+ artifacts: toolResult.artifacts
8216
+ });
8217
+ } catch (emitError) {
8218
+ debugLogger5.debug(
8219
+ "[Session.runTool] Failed to emit terminal tool update",
8220
+ emitError
8221
+ );
8222
+ }
8223
+ }
8224
+ const durationMs = Date.now() - startTime;
8225
+ try {
8226
+ logToolCall(this.config, {
8227
+ "event.name": "tool_call",
8228
+ "event.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
8229
+ call_id: callId,
8230
+ function_name: toolName,
8231
+ function_args: args,
8232
+ duration_ms: durationMs,
8233
+ status,
8234
+ execution_status: executionStatus,
7852
8235
  success: succeeded,
7853
- artifacts: toolResult.artifacts
8236
+ ...status === "error" ? {
8237
+ error: toolResult.error?.message,
8238
+ error_type: executionErrorType
8239
+ } : {},
8240
+ prompt_id: promptId,
8241
+ tool_type: toolType,
8242
+ mcp_server_name: mcpServerName
7854
8243
  });
8244
+ } catch (telemetryError) {
8245
+ debugLogger5.debug(
8246
+ "[Session.runTool] Failed to record terminal tool telemetry",
8247
+ telemetryError
8248
+ );
7855
8249
  }
7856
- const durationMs = Date.now() - startTime;
7857
- logToolCall(this.config, {
7858
- "event.name": "tool_call",
7859
- "event.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
7860
- function_name: toolName,
7861
- function_args: args,
7862
- duration_ms: durationMs,
7863
- status,
7864
- success: succeeded,
7865
- error: toolResult.error?.message,
7866
- error_type: toolResult.error?.type,
7867
- prompt_id: promptId,
7868
- tool_type: typeof tool !== "undefined" && tool instanceof DiscoveredMCPTool ? "mcp" : "native"
7869
- });
7870
8250
  queueToolResultRecord?.(fc, {
7871
8251
  callId,
7872
8252
  toolName,
@@ -7875,13 +8255,13 @@ ${this.pendingRecoveredAgentsNotice}
7875
8255
  metadata: {
7876
8256
  callId,
7877
8257
  status,
8258
+ executionStatus,
7878
8259
  resultDisplay: toolResult.returnDisplay,
7879
8260
  ...visionBridgeNotice !== void 0 ? { visionBridgeNotice } : {},
7880
- error: toolResult.error ? new Error(toolResult.error.message) : void 0,
7881
- errorType: toolResult.error?.type
8261
+ error: status === "error" && toolResult.error ? new Error(toolResult.error.message) : void 0,
8262
+ errorType: status === "error" ? executionErrorType : void 0
7882
8263
  }
7883
8264
  });
7884
- spanSuccess = succeeded;
7885
8265
  if (succeeded && !nestedPermissionCancelled) {
7886
8266
  const result = responseParts.find(
7887
8267
  (part) => part.functionResponse !== void 0
@@ -7896,10 +8276,8 @@ ${this.pendingRecoveredAgentsNotice}
7896
8276
  }
7897
8277
  }
7898
8278
  }
7899
- if (toolResult.error) {
8279
+ if (status === "error" && toolResult.error) {
7900
8280
  spanError = toolResult.error.message;
7901
- } else if (aborted) {
7902
- spanError = "Tool execution was cancelled";
7903
8281
  }
7904
8282
  return {
7905
8283
  parts: responseParts,
@@ -7913,66 +8291,74 @@ ${this.pendingRecoveredAgentsNotice}
7913
8291
  ] : void 0
7914
8292
  };
7915
8293
  } catch (e) {
7916
- cleanupAgentToolResources();
7917
8294
  const error = e instanceof Error ? e : new Error(String(e));
7918
- spanError = error.message;
7919
8295
  const hooksEnabledForError = !this.config.getDisableAllHooks?.();
7920
8296
  const messageBusForError = this.config.getMessageBus?.();
7921
- const isInterrupt = activeToolAbortSignal.aborted;
8297
+ const executionTimeoutException = !executeReturned && executionErrorType === "execution_timeout" /* EXECUTION_TIMEOUT */;
8298
+ let status = executionStatus === "cancelled" || activeToolAbortSignal.aborted && !executionTimeoutException ? "cancelled" : "error";
8299
+ const isInterrupt = status === "cancelled";
7922
8300
  if (hooksEnabledForError && messageBusForError) {
7923
- const failureHookResult = await firePostToolUseFailureHook(
7924
- messageBusForError,
7925
- toolUseId,
7926
- policyToolName,
7927
- args,
7928
- error.message,
7929
- isInterrupt,
7930
- String(approvalMode),
7931
- activeToolAbortSignal,
7932
- callId
7933
- );
7934
- if (failureHookResult.additionalContext) {
8301
+ try {
8302
+ const failureHookResult = await firePostToolUseFailureHook(
8303
+ messageBusForError,
8304
+ toolUseId,
8305
+ policyToolName,
8306
+ args,
8307
+ error.message,
8308
+ isInterrupt,
8309
+ String(approvalMode),
8310
+ activeToolAbortSignal,
8311
+ callId
8312
+ );
8313
+ if (failureHookResult.additionalContext) {
8314
+ debugLogger5.debug(
8315
+ `PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
8316
+ );
8317
+ }
8318
+ await this.emitHookArtifactsNotification({
8319
+ hookEventName: "PostToolUseFailure",
8320
+ toolName,
8321
+ toolCallId: callId,
8322
+ artifacts: failureHookResult.artifacts
8323
+ });
8324
+ } catch (hookError) {
7935
8325
  debugLogger5.debug(
7936
- `PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
8326
+ "[Session.runTool] PostToolUseFailure hook failed",
8327
+ hookError
7937
8328
  );
7938
8329
  }
7939
- await this.emitHookArtifactsNotification({
7940
- hookEventName: "PostToolUseFailure",
7941
- toolName,
7942
- toolCallId: callId,
7943
- artifacts: failureHookResult.artifacts
7944
- });
7945
8330
  }
7946
- await this.toolCallEmitter.emitError(callId, toolName, error);
7947
- const loopDetected = !activeToolAbortSignal.aborted && !toolBuildSucceeded && recordDaemonInvalidToolParams(
7948
- this.config,
7949
- promptId,
7950
- toolLoopState,
7951
- toolName,
7952
- error
7953
- );
7954
- const responseParts = errorResponse(error);
7955
- queueToolResultRecord?.(fc, {
7956
- callId,
7957
- toolName,
7958
- responseParts,
7959
- metadata: {
7960
- callId,
7961
- status: activeToolAbortSignal.aborted ? "cancelled" : "error",
7962
- resultDisplay: void 0,
7963
- error,
7964
- errorType: void 0
7965
- }
8331
+ if (activeToolAbortSignal.aborted && !executionTimeoutException) {
8332
+ status = "cancelled";
8333
+ }
8334
+ const explicitErrorType = e?.errorType;
8335
+ const errorType = status === "cancelled" ? void 0 : explicitErrorType ?? (executeReturned ? "unhandled_exception" /* UNHANDLED_EXCEPTION */ : executionErrorType ?? (!toolBuildSucceeded ? "invalid_tool_params" /* INVALID_TOOL_PARAMS */ : "unhandled_exception" /* UNHANDLED_EXCEPTION */));
8336
+ return earlyErrorResponse(error, toolName, {
8337
+ status,
8338
+ errorType,
8339
+ executionStatus,
8340
+ recordInvalidToolParams: !toolBuildSucceeded,
8341
+ stopAfterPermissionCancel: nestedPermissionCancelled
7966
8342
  });
7967
- return {
7968
- parts: responseParts,
7969
- stopAfterPermissionCancel: nestedPermissionCancelled,
7970
- loopDetected
7971
- };
7972
8343
  }
7973
8344
  });
8345
+ } catch (e) {
8346
+ const error = e instanceof Error ? e : new Error(String(e));
8347
+ const status = activeToolAbortSignal.aborted ? "cancelled" : "error";
8348
+ return await earlyErrorResponse(error, toolName, {
8349
+ status,
8350
+ errorType: status === "error" ? "unhandled_exception" /* UNHANDLED_EXCEPTION */ : void 0,
8351
+ executionStatus
8352
+ });
7974
8353
  } finally {
7975
- endToolSpan(toolSpan, { success: spanSuccess, error: spanError });
8354
+ if (terminalStatus === "cancelled") {
8355
+ endToolSpan(toolSpan, { success: false, cancelled: true });
8356
+ } else {
8357
+ endToolSpan(toolSpan, {
8358
+ success: terminalStatus === "success",
8359
+ error: spanError
8360
+ });
8361
+ }
7976
8362
  }
7977
8363
  }
7978
8364
  #emitGoalStatusItems(result) {
@@ -8065,6 +8451,10 @@ ${this.pendingRecoveredAgentsNotice}
8065
8451
  const unsupportedError = `Slash command not supported in ACP integration: ${result.reason}`;
8066
8452
  throw new Error(unsupportedError);
8067
8453
  }
8454
+ case "goal_control":
8455
+ throw new Error(
8456
+ "Canonical Goal control is not available in ACP integration yet."
8457
+ );
8068
8458
  case "no_command":
8069
8459
  return this.#resolvePrompt(originalPrompt, abortSignal, {
8070
8460
  promptLast: true,
@@ -11522,7 +11912,7 @@ var QwenAgent = class {
11522
11912
  }
11523
11913
  this.clientCapabilities = args.clientCapabilities;
11524
11914
  const authMethods = buildAuthMethods();
11525
- const version = "0.21.3";
11915
+ const version = "0.21.4-nightly.20260804.d6f55a1c9";
11526
11916
  const response = {
11527
11917
  protocolVersion: PROTOCOL_VERSION,
11528
11918
  agentInfo: {