@qwen-code/qwen-code 0.19.9 → 0.19.10-nightly.20260716.506ce0a1a

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 (323) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +14 -6
  2. package/bundled/qc-helper/docs/features/approval-mode.md +2 -2
  3. package/bundled/qc-helper/docs/features/channels/dingtalk.md +33 -0
  4. package/bundled/qc-helper/docs/features/channels/overview.md +64 -20
  5. package/bundled/qc-helper/docs/features/channels/wecom.md +8 -7
  6. package/bundled/qc-helper/docs/features/code-review.md +88 -44
  7. package/bundled/qc-helper/docs/features/commands.md +6 -6
  8. package/bundled/qc-helper/docs/features/hooks.md +29 -0
  9. package/bundled/qc-helper/docs/features/sandbox.md +2 -0
  10. package/bundled/qc-helper/docs/features/sub-agents.md +21 -0
  11. package/bundled/qc-helper/docs/qwen-serve.md +49 -20
  12. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +1 -1
  13. package/bundled/review/DESIGN.md +219 -33
  14. package/bundled/review/SKILL.md +429 -382
  15. package/chunks/{MaxSizedBox-6HYJ3ZPJ.js → MaxSizedBox-WOC3YDWA.js} +31 -32
  16. package/chunks/{StandaloneSessionPicker-WS4GXYOG.js → StandaloneSessionPicker-H5HZCAFD.js} +49 -48
  17. package/chunks/{acpAgent-5FWSOZL5.js → acpAgent-55YDJDNM.js} +922 -550
  18. package/chunks/{agent-HOLHB3RT.js → agent-H6VE5W3L.js} +26 -27
  19. package/chunks/{agent-headless-SXL6H56A.js → agent-headless-T4XJOCRU.js} +26 -27
  20. package/chunks/{anthropicContentGenerator-L73TO3DB.js → anthropicContentGenerator-HBRXJSP4.js} +78 -16
  21. package/chunks/{artifact-tool-U7IRTLIV.js → artifact-tool-MIZLXBLF.js} +2 -2
  22. package/chunks/{askUserQuestion-2DLUUZZG.js → askUserQuestion-XMJVPNWM.js} +2 -2
  23. package/chunks/{bridge-BCJQ7BBB.js → bridge-FTB6ZP3R.js} +31 -34
  24. package/chunks/{ca-UJ6HC4H2.js → ca-CODEN7TD.js} +9 -1
  25. package/chunks/channel-worker-group-K7QKH6IG.js +13 -0
  26. package/chunks/channel-worker-manager-CUDPU4CN.js +418 -0
  27. package/chunks/channel-worker-supervisor-4XTO2ZD3.js +20 -0
  28. package/chunks/{chunk-LXNEJD34.js → chunk-2FO5GFKZ.js} +1 -1
  29. package/chunks/{chunk-VA4KQY6V.js → chunk-2JNR4VP2.js} +3 -3
  30. package/chunks/{chunk-L36P3NBD.js → chunk-2W3OOD4W.js} +2 -0
  31. package/chunks/{chunk-7R3CZA3Q.js → chunk-2Z5UX4KI.js} +1 -1
  32. package/chunks/{chunk-CUMMSHH6.js → chunk-3DWIFU7L.js} +1 -1
  33. package/chunks/chunk-3MX7D6QN.js +516 -0
  34. package/chunks/{chunk-SJHDYNHF.js → chunk-4BJVSIS3.js} +3 -3
  35. package/chunks/{chunk-TO6QE22P.js → chunk-5CNYZ7TN.js} +26 -22
  36. package/chunks/{chunk-N3EMS75V.js → chunk-5DEJ4T6C.js} +1333 -1232
  37. package/chunks/chunk-5HBA2Z7V.js +28 -0
  38. package/chunks/{chunk-ZJE7NSL3.js → chunk-5M6IDOMF.js} +34 -97
  39. package/chunks/{chunk-SCGXUJBT.js → chunk-6LI3L22E.js} +3 -3
  40. package/chunks/{chunk-K434OPES.js → chunk-6WPJRYLZ.js} +3 -3
  41. package/chunks/{chunk-YAUFFXDS.js → chunk-7GM2RWCR.js} +12 -11
  42. package/chunks/{chunk-OQ4DRIOA.js → chunk-7HWE2W74.js} +2 -2
  43. package/chunks/{chunk-J4TSQ5EQ.js → chunk-7NFB7LBQ.js} +8 -1
  44. package/chunks/{chunk-MC23XKFE.js → chunk-A2HWMJVO.js} +37 -3
  45. package/chunks/{chunk-3G7CIHVV.js → chunk-ABNYOMDG.js} +4 -4
  46. package/chunks/{chunk-3AHXV67U.js → chunk-AGZLXLBY.js} +1 -1
  47. package/chunks/{chunk-RDJSGHZE.js → chunk-ALGGS7UH.js} +1 -38
  48. package/chunks/{chunk-Q4YQW46J.js → chunk-AMRZVQUY.js} +43 -40
  49. package/chunks/{chunk-W3JHSWRP.js → chunk-AN6C2U46.js} +4 -4
  50. package/chunks/{chunk-GWHYEOV2.js → chunk-ARKANCNX.js} +2 -1
  51. package/chunks/{chunk-5SFOMFG4.js → chunk-AVEOWVOM.js} +36 -2
  52. package/chunks/{chunk-34MW4KTI.js → chunk-BA5JGE5F.js} +2 -2
  53. package/chunks/{chunk-5HOMWMCL.js → chunk-BSJAQUFD.js} +5492 -1336
  54. package/chunks/{chunk-L6P4KPHR.js → chunk-BWJKL5DB.js} +58 -38
  55. package/chunks/{chunk-PVZM22CK.js → chunk-C32JFRGV.js} +5 -5
  56. package/chunks/{chunk-AKIVHSJR.js → chunk-CZIHPO7L.js} +163 -782
  57. package/chunks/chunk-DL7RCO6V.js +493 -0
  58. package/chunks/{chunk-KKNMOEZH.js → chunk-E2UVIFI2.js} +185 -398
  59. package/chunks/{chunk-5VXNZWGF.js → chunk-ENUQSKEY.js} +1 -1
  60. package/chunks/{chunk-PDZ7MBDG.js → chunk-EWILX3BM.js} +27 -6
  61. package/chunks/{chunk-BMGVRZN4.js → chunk-EZWX232B.js} +1 -1
  62. package/chunks/{chunk-4GORAUCN.js → chunk-F333XEAU.js} +1 -1
  63. package/chunks/{chunk-YLV3XXFB.js → chunk-FBU7WRZI.js} +17 -1
  64. package/chunks/chunk-FEOZBUMT.js +77 -0
  65. package/chunks/{chunk-5U27BZ72.js → chunk-FKEGVMPX.js} +269 -83
  66. package/chunks/chunk-FNX3LGAK.js +34 -0
  67. package/chunks/{chunk-LK7KUE55.js → chunk-FSA7ERJ2.js} +1 -1
  68. package/chunks/{chunk-PODM4SZ4.js → chunk-G3BIBPI7.js} +5 -5
  69. package/chunks/{chunk-A3XKDTSH.js → chunk-GA65O2TB.js} +4 -4
  70. package/chunks/{chunk-3BTRNWWD.js → chunk-GOXKNSDZ.js} +1 -64
  71. package/chunks/{channel-worker-supervisor-WSOAAYUO.js → chunk-GXGIM7QP.js} +67 -35
  72. package/chunks/{chunk-6PESIEKJ.js → chunk-GXUWGPYX.js} +68 -6
  73. package/chunks/chunk-GYTKQYDB.js +23 -0
  74. package/chunks/{chunk-GZRTYZ2R.js → chunk-H3XMJV7T.js} +218 -1
  75. package/chunks/{chunk-WQUQVGTF.js → chunk-HGRXW4HQ.js} +467 -106
  76. package/chunks/{chunk-YVEDCAUE.js → chunk-HGT6JR3U.js} +19 -0
  77. package/chunks/{chunk-ECNYL4AA.js → chunk-HUEWOHKV.js} +1 -1
  78. package/chunks/chunk-IDS7MSUP.js +74 -0
  79. package/chunks/{chunk-KHUQZZJ6.js → chunk-IHDRJLLR.js} +382 -36
  80. package/chunks/{chunk-CLFKOZEK.js → chunk-J4SEAF4X.js} +114 -4
  81. package/chunks/{chunk-B5ORX3FG.js → chunk-JGUT3LWZ.js} +6 -1
  82. package/chunks/{chunk-P67PFTUT.js → chunk-KEYEYCHZ.js} +4 -4
  83. package/chunks/{chunk-ORBGV7NJ.js → chunk-KKRTYONM.js} +6 -4
  84. package/chunks/{chunk-7PU4FYLG.js → chunk-KOXFAG6P.js} +4 -18
  85. package/chunks/{chunk-EGYZ275M.js → chunk-KWLVWNF5.js} +55 -7
  86. package/chunks/{chunk-XLA62MYB.js → chunk-KXECVZPD.js} +2 -2
  87. package/chunks/{chunk-IAVB3HM3.js → chunk-L4Y55KIS.js} +33 -1
  88. package/chunks/{chunk-4QLQE5WJ.js → chunk-L5U3ELZX.js} +1 -1
  89. package/chunks/{chunk-4ZVWQHEQ.js → chunk-LQIDP6K5.js} +1 -1
  90. package/chunks/{chunk-DC5Z3DU6.js → chunk-LXLTBIDP.js} +43 -6
  91. package/chunks/chunk-LXXMOYPL.js +22 -0
  92. package/chunks/{chunk-Q6I5QHMH.js → chunk-MFNKBXYH.js} +1 -1
  93. package/chunks/chunk-MR3PXB6E.js +48 -0
  94. package/chunks/{chunk-JZETEN3Z.js → chunk-N45S36AH.js} +3 -3
  95. package/chunks/{chunk-GWLSNBG4.js → chunk-NA3IG6XG.js} +748 -27
  96. package/chunks/{chunk-D5SKC4YG.js → chunk-O3M25JXE.js} +213 -29
  97. package/chunks/{chunk-EAXLGSFP.js → chunk-O6XGHDS5.js} +11 -11
  98. package/chunks/{chunk-WL4L7EZH.js → chunk-OA4JVLSA.js} +27 -1
  99. package/chunks/{chunk-X4NKFGFJ.js → chunk-OJAMDVF5.js} +0 -15
  100. package/chunks/{chunk-BZIFY5TF.js → chunk-OKAIGAYW.js} +3 -3
  101. package/chunks/{chunk-CNEIYWSA.js → chunk-OVIV236K.js} +5 -5
  102. package/chunks/{chunk-3SJSQXNS.js → chunk-PEJWA3QQ.js} +12 -8
  103. package/chunks/{chunk-E2IY465S.js → chunk-PWNOAWXB.js} +59 -12
  104. package/chunks/{chunk-B4G2WOFA.js → chunk-Q5MKHNIR.js} +28 -5
  105. package/chunks/{chunk-MXL5UP4X.js → chunk-Q6TUALBE.js} +1 -1
  106. package/chunks/{chunk-QYMQSECS.js → chunk-QAW7PIHT.js} +2 -2
  107. package/chunks/{chunk-HKMAENAO.js → chunk-QDTGDM2T.js} +14 -9
  108. package/chunks/{chunk-LUODI7WD.js → chunk-RCEEXIOO.js} +6 -4
  109. package/chunks/{chunk-W2UIXQDL.js → chunk-RTV5TUYB.js} +12 -4
  110. package/chunks/chunk-RW7DUKFO.js +91 -0
  111. package/chunks/{chunk-NVYTCB5Z.js → chunk-SA6QVLWI.js} +17325 -16259
  112. package/chunks/chunk-SJSI7PXU.js +59 -0
  113. package/chunks/{chunk-HVY356M2.js → chunk-SMGBWLNU.js} +3 -3
  114. package/chunks/{chunk-CEA3E3JB.js → chunk-SPJQO2CE.js} +2 -2
  115. package/chunks/{chunk-CC2ITGCF.js → chunk-STZQCNN3.js} +49 -6
  116. package/chunks/{chunk-HPDUL5MF.js → chunk-T2ZDAER2.js} +1 -1
  117. package/chunks/{chunk-XUOOWUZS.js → chunk-T3TQ3ACP.js} +1 -1
  118. package/chunks/{chunk-4C5BQ2D2.js → chunk-TIKDHS6V.js} +100 -17
  119. package/chunks/chunk-TV6K2FB4.js +224 -0
  120. package/chunks/{chunk-5XUCZNSY.js → chunk-TYLOFD2U.js} +1 -1
  121. package/chunks/{chunk-D2GFWEXB.js → chunk-UCUUH2JV.js} +6 -6
  122. package/chunks/{chunk-BAPGSC7U.js → chunk-UZP7K33Y.js} +23 -9
  123. package/chunks/{chunk-77XJ3SWN.js → chunk-VDAR6UO2.js} +8 -6
  124. package/chunks/{chunk-XYQSMABS.js → chunk-VKLVGA2D.js} +4 -4
  125. package/chunks/{chunk-JSG7ZSBC.js → chunk-VRR65QYW.js} +251 -3
  126. package/chunks/{chunk-U2NNEY4R.js → chunk-VT5AWJN4.js} +1 -1
  127. package/chunks/{chunk-ZLXQN2QS.js → chunk-WIEO4CWB.js} +1 -1
  128. package/chunks/{chunk-X6TJ3YZV.js → chunk-WKEO3GLZ.js} +160 -60
  129. package/chunks/{chunk-J3JA76CF.js → chunk-WTNZ6DXB.js} +1 -1
  130. package/chunks/{chunk-VWPVHAMO.js → chunk-XIWQ5QST.js} +8 -1
  131. package/chunks/{chunk-TDEXZKMT.js → chunk-Y66VOBRP.js} +2 -2
  132. package/chunks/{chunk-3VAGG5T5.js → chunk-YYBZUIPL.js} +1015 -100
  133. package/chunks/{chunk-CCDMCZPP.js → chunk-YZ3SBNP7.js} +1 -1
  134. package/chunks/{chunk-ATAKVRIF.js → chunk-Z3XA2TNG.js} +7 -7
  135. package/chunks/{chunk-EMDMPBJ4.js → chunk-Z7SVC7PJ.js} +10 -3
  136. package/chunks/{chunk-AURZZYMD.js → chunk-ZIVSSTUG.js} +4 -4
  137. package/chunks/{chunk-UOZWKTQG.js → chunk-ZPAHLFZU.js} +2 -2
  138. package/chunks/{chunk-34Z3U5RQ.js → chunk-ZQIYGQCG.js} +765 -168
  139. package/chunks/{computer-use-HM37RX6A.js → computer-use-NADT7ULB.js} +26 -27
  140. package/chunks/{config-utils-NV2SVGPB.js → config-utils-IQQT3GCI.js} +3 -2
  141. package/chunks/{contextCommand-OF5SFGH2.js → contextCommand-U7NEJYJ7.js} +28 -29
  142. package/chunks/{create-sub-session-INX7TXJI.js → create-sub-session-EAB2U5XW.js} +2 -2
  143. package/chunks/{create-sub-session-KPRT7ECJ.js → create-sub-session-SUN33INC.js} +26 -27
  144. package/chunks/{cron-create-AMBKGZX6.js → cron-create-GMVKSXZT.js} +4 -4
  145. package/chunks/{cron-delete-LRU4OJYG.js → cron-delete-VDZKUAVK.js} +4 -4
  146. package/chunks/{cron-list-WVP2JXER.js → cron-list-UG7C7RAR.js} +4 -4
  147. package/chunks/{daemon-ARHTSTXP.js → daemon-SJXEKP3H.js} +773 -126
  148. package/chunks/daemon-status-provider-WIIYLGZJ.js +74 -0
  149. package/chunks/{de-EBJN3OVN.js → de-NOXPCSYN.js} +9 -1
  150. package/chunks/{dist-XKU3ABM5.js → dist-4WCQEZIN.js} +4 -51
  151. package/chunks/{dist-QYCAEZIT.js → dist-DOPL5LSQ.js} +5 -1
  152. package/chunks/{dist-WKPOYU7O.js → dist-GXJVCOS7.js} +1 -1
  153. package/chunks/{dist-R7LN5AZE.js → dist-PX2ERZ6I.js} +2 -2
  154. package/chunks/{dist-PNVLTKTL.js → dist-V2YVLYOW.js} +215 -33
  155. package/chunks/{dist-VHV4EVHG.js → dist-VYWUKURL.js} +1 -1
  156. package/chunks/{earlyInputCapture-3VTHRC4C.js → earlyInputCapture-6FRM6UMU.js} +27 -28
  157. package/chunks/{edit-VNI4NJ73.js → edit-7GOIQTCZ.js} +27 -28
  158. package/chunks/{en-5A6LA7RK.js → en-JFVULHTB.js} +11 -1
  159. package/chunks/{enter-worktree-IYYBKPZT.js → enter-worktree-476E6WIK.js} +26 -27
  160. package/chunks/{enterPlanMode-GMC5FD5A.js → enterPlanMode-IRJM6W3C.js} +42 -28
  161. package/chunks/{environment-5HSSRMJ7.js → environment-ROMULS2X.js} +30 -30
  162. package/chunks/{errors-HMFCJJ7P.js → errors-OUIWPUDY.js} +28 -29
  163. package/chunks/{exit-worktree-6BHCMP5G.js → exit-worktree-PPSFK753.js} +26 -27
  164. package/chunks/{exitPlanMode-CJW7G74W.js → exitPlanMode-YKQMD4D7.js} +26 -27
  165. package/chunks/{fast-path-FRDMDVHG.js → fast-path-CNK2HHKH.js} +3 -3
  166. package/chunks/{fast-path-settings-5QZE64HR.js → fast-path-settings-DAOVFADC.js} +6 -4
  167. package/chunks/{fr-YXRABLYZ.js → fr-HVFNU42H.js} +9 -1
  168. package/chunks/{gemini-QYSEGHAX.js → gemini-WQNFT6TR.js} +216 -90
  169. package/chunks/{geminiContentGenerator-J7YNZDYP.js → geminiContentGenerator-4QJH2JDP.js} +4 -4
  170. package/chunks/{glob-BRCSGFOT.js → glob-36TVLBWW.js} +28 -28
  171. package/chunks/{grep-EE2DUOSY.js → grep-QTYLNO2M.js} +26 -27
  172. package/chunks/{handleAutoUpdate-5NWTLR67.js → handleAutoUpdate-36FQFODK.js} +30 -31
  173. package/chunks/{i18n-BASPENNQ.js → i18n-JUGYPVSP.js} +27 -28
  174. package/chunks/initializer-OBBJUS25.js +72 -0
  175. package/chunks/{installationInfo-W6V4DT7W.js → installationInfo-MCKTPX64.js} +27 -28
  176. package/chunks/{ja-7VQOANVG.js → ja-PY5AF544.js} +10 -2
  177. package/chunks/{keychain-token-storage-VKUBNCP4.js → keychain-token-storage-AU22CQI6.js} +2 -2
  178. package/chunks/list-VW5QY4VJ.js +75 -0
  179. package/chunks/loadedSettingsAdapter-IELOOXG6.js +69 -0
  180. package/chunks/{loop-wakeup-WX7BLWWP.js → loop-wakeup-QXWZSCYM.js} +5 -5
  181. package/chunks/{ls-ZB2BDP6T.js → ls-2OUTG3IZ.js} +4 -4
  182. package/chunks/{lsp-V5DN4YUJ.js → lsp-4VMNXZW6.js} +2 -2
  183. package/chunks/mcp-Q3EC37ZS.js +69 -0
  184. package/chunks/{monitor-X5Z3H4FY.js → monitor-DCZ27AFR.js} +26 -27
  185. package/chunks/nonInteractiveCli-KXD7PFO4.js +128 -0
  186. package/chunks/{notebook-edit-TRM2QIJK.js → notebook-edit-YU4XF5LI.js} +27 -28
  187. package/chunks/{openaiContentGenerator-AAYONPMF.js → openaiContentGenerator-KL5WER2D.js} +13 -13
  188. package/chunks/{pidfile-D4I4FTVA.js → pidfile-WBOD7EJV.js} +27 -28
  189. package/chunks/processUtils-AOV4R34M.js +29 -0
  190. package/chunks/{pt-2C6YCSHL.js → pt-A3PRQXMU.js} +9 -1
  191. package/chunks/{qwenContentGenerator-K3HZ2H76.js → qwenContentGenerator-YIGBHYE3.js} +28 -29
  192. package/chunks/{qwenOAuth2-PJQ27GSO.js → qwenOAuth2-LEYOU7RU.js} +5 -5
  193. package/chunks/{read-file-7SZSIZOL.js → read-file-WVL4Y76X.js} +9 -9
  194. package/chunks/{read-mcp-resource-SM5DA4RG.js → read-mcp-resource-JUFHCKSC.js} +2 -2
  195. package/chunks/{record-artifact-4XKZX3UW.js → record-artifact-DWSMBXYY.js} +2 -2
  196. package/chunks/{ripGrep-YNPFVCZP.js → ripGrep-6GSWJERP.js} +26 -27
  197. package/chunks/{ru-6BBHVZZV.js → ru-IBCWUTOC.js} +9 -1
  198. package/chunks/{run-qwen-serve-DMWV5N6L.js → run-qwen-serve-QYUQMEDT.js} +1233 -371
  199. package/chunks/{runtime-57WWRVHN.js → runtime-K2YZCNB3.js} +42 -38
  200. package/chunks/{scheduler-YBLGWSIL.js → scheduler-EQCSN7QV.js} +26 -27
  201. package/chunks/{send-message-F36YD6KQ.js → send-message-JZ752NWD.js} +3 -3
  202. package/chunks/{serve-R63NK3CV.js → serve-DX5UGZD4.js} +36 -35
  203. package/chunks/{server-Z22GCAXP.js → server-T6HJH3DR.js} +5869 -1398
  204. package/chunks/{session-HKAAI7BN.js → session-SNU6ACY6.js} +299 -100
  205. package/chunks/{settings-3EYN66GK.js → settings-AKHZZNEL.js} +34 -33
  206. package/chunks/{shell-6YXINTWJ.js → shell-EY74IEZK.js} +28 -27
  207. package/chunks/{skill-OO57P4X6.js → skill-DPU62O3H.js} +11 -11
  208. package/chunks/{spawnChannel-JD7G4VU6.js → spawnChannel-RQZRWJ2V.js} +28 -30
  209. package/chunks/{src-G5UPLZSZ.js → src-7FITDSVC.js} +164 -52
  210. package/chunks/{standalone-update-OB7F4JPZ.js → standalone-update-XO3RK6DO.js} +28 -29
  211. package/chunks/{startInteractiveUI-73EGLIIH.js → startInteractiveUI-DVWZRHYQ.js} +728 -382
  212. package/chunks/{syntheticOutput-34H7LGA7.js → syntheticOutput-LELY6HAI.js} +3 -3
  213. package/chunks/{task-create-FRGOEIKY.js → task-create-QY3BIMNM.js} +8 -7
  214. package/chunks/{task-list-OW766BXZ.js → task-list-D2U47WBJ.js} +6 -5
  215. package/chunks/{task-stop-SIR5SNBN.js → task-stop-N6E5IYLH.js} +2 -2
  216. package/chunks/{task-update-YRA532MT.js → task-update-HJCQILLB.js} +8 -7
  217. package/chunks/{team-create-PECAAPXK.js → team-create-FOSRT62K.js} +26 -27
  218. package/chunks/{team-delete-6OSECUZC.js → team-delete-RCWYDRF4.js} +6 -5
  219. package/chunks/{team-plan-approval-L6F434RY.js → team-plan-approval-6VUDV27J.js} +26 -27
  220. package/chunks/{theme-manager-ZG4RY6GU.js → theme-manager-6UT6IO5T.js} +27 -28
  221. package/chunks/{todoWrite-YDMFEV4G.js → todoWrite-FKCGATPJ.js} +4 -4
  222. package/chunks/{tool-search-THVIWAPB.js → tool-search-ASSFMMN5.js} +10 -10
  223. package/chunks/{total-session-admission-JOKNRIIA.js → total-session-admission-YYWUO23H.js} +32 -35
  224. package/chunks/tree-sitter-YJVE2ZUK.js +2980 -0
  225. package/chunks/{trustedFolders-EOGT3UVS.js → trustedFolders-4BWV2IBK.js} +29 -29
  226. package/chunks/types-ML3TRJQ5.js +16 -0
  227. package/chunks/update-relaunch-74DLGH73.js +87 -0
  228. package/chunks/{updateCheck-2KYEYVSB.js → updateCheck-CRFCGFO5.js} +31 -30
  229. package/chunks/{validateNonInterActiveAuth-EN6ZQSR2.js → validateNonInterActiveAuth-BTTEPBGQ.js} +76 -73
  230. package/chunks/{version-3UEA6ZIR.js → version-Y5JE5Q63.js} +1 -1
  231. package/chunks/{web-fetch-PAAEQKBW.js → web-fetch-CFCWTCAP.js} +5 -6
  232. package/chunks/{workflow-QCCCMYP3.js → workflow-6WC7VPQN.js} +27 -28
  233. package/chunks/workspace-providers-status-RVG2C5ZS.js +72 -0
  234. package/chunks/workspace-registration-store-SLEU3D3X.js +27 -0
  235. package/chunks/{workspace-registry-24QFLQYH.js → workspace-registry-QMWGVOTF.js} +32 -35
  236. package/chunks/workspace-service-G572JSEU.js +84 -0
  237. package/chunks/workspace-skills-status-VSSMSMNK.js +71 -0
  238. package/chunks/{write-file-I3MUDRIE.js → write-file-5XVDRORP.js} +27 -28
  239. package/chunks/{zh-RQE7I22T.js → zh-PAUNIMHQ.js} +12 -2
  240. package/chunks/{zh-TW-TBPQGHKH.js → zh-TW-GNEUIUFF.js} +12 -2
  241. package/cli-entry.js +92 -8
  242. package/cli.js +11 -11
  243. package/locales/ca.js +16 -0
  244. package/locales/de.js +16 -0
  245. package/locales/en.js +19 -0
  246. package/locales/fr.js +16 -0
  247. package/locales/ja.js +17 -1
  248. package/locales/pt.js +16 -0
  249. package/locales/ru.js +16 -0
  250. package/locales/zh-TW.js +20 -1
  251. package/locales/zh.js +20 -1
  252. package/package.json +3 -3
  253. package/web-shell/assets/{arc-C15hqnJe.js → arc-vx1tRwnX.js} +1 -1
  254. package/web-shell/assets/{architectureDiagram-3BPJPVTR-B-At37J_.js → architectureDiagram-3BPJPVTR-DBi6iUA1.js} +1 -1
  255. package/web-shell/assets/{blockDiagram-GPEHLZMM-B51wjcU7.js → blockDiagram-GPEHLZMM-Ga9JJ4Ak.js} +1 -1
  256. package/web-shell/assets/{c4Diagram-AAUBKEIU-xBK7BAwN.js → c4Diagram-AAUBKEIU-D8Vi5FYw.js} +1 -1
  257. package/web-shell/assets/channel-B29zQDTL.js +1 -0
  258. package/web-shell/assets/{chunk-2J33WTMH-xKmLg7Yr.js → chunk-2J33WTMH-CSV6yQpU.js} +1 -1
  259. package/web-shell/assets/{chunk-4BX2VUAB-BfkdKZCM.js → chunk-4BX2VUAB-toYlppdI.js} +1 -1
  260. package/web-shell/assets/{chunk-55IACEB6-DT713sZf.js → chunk-55IACEB6-DbjzuyAr.js} +1 -1
  261. package/web-shell/assets/{chunk-727SXJPM-CYEeAamv.js → chunk-727SXJPM-IkkSjSkk.js} +1 -1
  262. package/web-shell/assets/{chunk-AQP2D5EJ-DBN-5CFd.js → chunk-AQP2D5EJ-D5wUL6Zm.js} +1 -1
  263. package/web-shell/assets/{chunk-FMBD7UC4-CGZKk4PH.js → chunk-FMBD7UC4-C3o2DXG0.js} +1 -1
  264. package/web-shell/assets/{chunk-ND2GUHAM-qQbC2O-y.js → chunk-ND2GUHAM-CutIi14T.js} +1 -1
  265. package/web-shell/assets/{chunk-QZHKN3VN-B3zeXwsX.js → chunk-QZHKN3VN-DZ0NRHH-.js} +1 -1
  266. package/web-shell/assets/classDiagram-4FO5ZUOK-BNGI2SvC.js +1 -0
  267. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BNGI2SvC.js +1 -0
  268. package/web-shell/assets/{cose-bilkent-S5V4N54A-BKsl1Wvy.js → cose-bilkent-S5V4N54A-B3Dl88UJ.js} +1 -1
  269. package/web-shell/assets/{dagre-BM42HDAG-CuuuLiBK.js → dagre-BM42HDAG-DfTxfF6-.js} +1 -1
  270. package/web-shell/assets/{diagram-2AECGRRQ-CG4_eKiV.js → diagram-2AECGRRQ-CJyH98yO.js} +1 -1
  271. package/web-shell/assets/{diagram-5GNKFQAL-DSFTmZB1.js → diagram-5GNKFQAL-EbOiJNmW.js} +1 -1
  272. package/web-shell/assets/{diagram-KO2AKTUF-BxwlEHn8.js → diagram-KO2AKTUF-AYNqpqqA.js} +1 -1
  273. package/web-shell/assets/{diagram-LMA3HP47-BUAg-jMG.js → diagram-LMA3HP47-BY5VPa4H.js} +1 -1
  274. package/web-shell/assets/{diagram-OG6HWLK6-BFM2jlO5.js → diagram-OG6HWLK6-BhMYAKlk.js} +1 -1
  275. package/web-shell/assets/{erDiagram-TEJ5UH35-CerbFPa2.js → erDiagram-TEJ5UH35-Bp8S_F9l.js} +1 -1
  276. package/web-shell/assets/{flowDiagram-I6XJVG4X-BNeZz5Zz.js → flowDiagram-I6XJVG4X-az3TE9PU.js} +1 -1
  277. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CTOogLaM.js → ganttDiagram-6RSMTGT7-CfkAEpCe.js} +3 -3
  278. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-yxSFkXPj.js → gitGraphDiagram-PVQCEYII-D1QmjMCy.js} +1 -1
  279. package/web-shell/assets/index-C8sDwQUv.js +1130 -0
  280. package/web-shell/assets/index-CaBoc5bb.js +3 -0
  281. package/web-shell/assets/index-Dpg5Wymg.css +5 -0
  282. package/web-shell/assets/{infoDiagram-5YYISTIA-DYdAUevm.js → infoDiagram-5YYISTIA-D3ompLrG.js} +1 -1
  283. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CNuijZ90.js → ishikawaDiagram-YF4QCWOH-D3MRWp9I.js} +1 -1
  284. package/web-shell/assets/{journeyDiagram-JHISSGLW-BTyiuonf.js → journeyDiagram-JHISSGLW-DVkKCa44.js} +1 -1
  285. package/web-shell/assets/{kanban-definition-UN3LZRKU-DPJo0Uow.js → kanban-definition-UN3LZRKU-BLif81wF.js} +1 -1
  286. package/web-shell/assets/{linear-C8wKCbIC.js → linear-BDU96EGS.js} +1 -1
  287. package/web-shell/assets/{mermaid.core-BV5o7nW5.js → mermaid.core-B-CwC26B.js} +5 -5
  288. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BtLcBmSt.js → mindmap-definition-RKZ34NQL-CS1WOJ4G.js} +1 -1
  289. package/web-shell/assets/{pieDiagram-4H26LBE5-C22J7A9Q.js → pieDiagram-4H26LBE5-BzgtNXVP.js} +1 -1
  290. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-DSL10wiL.js → quadrantDiagram-W4KKPZXB-BRfGC8MA.js} +1 -1
  291. package/web-shell/assets/{requirementDiagram-4Y6WPE33-feqh0UpX.js → requirementDiagram-4Y6WPE33-CPBZkC7g.js} +1 -1
  292. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-Z4OVaWaZ.js → sankeyDiagram-5OEKKPKP-nqNvinIk.js} +1 -1
  293. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DIluIcb1.js → sequenceDiagram-3UESZ5HK-CM_Wdjh3.js} +1 -1
  294. package/web-shell/assets/{stateDiagram-AJRCARHV-hlhnuoYH.js → stateDiagram-AJRCARHV-L0y-48VE.js} +1 -1
  295. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BX1DdF8s.js +1 -0
  296. package/web-shell/assets/{timeline-definition-PNZ67QCA-Dqf_CqgL.js → timeline-definition-PNZ67QCA-B_n5rb3A.js} +1 -1
  297. package/web-shell/assets/{vennDiagram-CIIHVFJN-DD2QhaTX.js → vennDiagram-CIIHVFJN-C9NmLV5e.js} +1 -1
  298. package/web-shell/assets/{wardley-L42UT6IY-B2uI85U_.js → wardley-L42UT6IY-CrefK9gt.js} +1 -1
  299. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-U1aJX71g.js → wardleyDiagram-YWT4CUSO-BUccf-bC.js} +1 -1
  300. package/web-shell/assets/{xychartDiagram-2RQKCTM6-C0ODHUee.js → xychartDiagram-2RQKCTM6-DM6ef92l.js} +1 -1
  301. package/web-shell/index.html +2 -2
  302. package/chunks/chunk-524RQP4Q.js +0 -305
  303. package/chunks/chunk-CARU2RR2.js +0 -24
  304. package/chunks/chunk-CU3L64TP.js +0 -93
  305. package/chunks/chunk-OCPBI7J5.js +0 -18
  306. package/chunks/chunk-TEGEBB2I.js +0 -122
  307. package/chunks/chunk-VTU57BWZ.js +0 -30
  308. package/chunks/daemon-status-provider-B2UTZUJ2.js +0 -76
  309. package/chunks/initializer-UTQ7FB7G.js +0 -71
  310. package/chunks/list-DEICDL65.js +0 -74
  311. package/chunks/loadedSettingsAdapter-NOWEGDYJ.js +0 -68
  312. package/chunks/mcp-L5JXEEIA.js +0 -68
  313. package/chunks/nonInteractiveCli-LS2K4X6A.js +0 -124
  314. package/chunks/types-JNKGKUJT.js +0 -12
  315. package/chunks/workspace-providers-status-4KMGETOJ.js +0 -71
  316. package/chunks/workspace-service-RVLBMSMZ.js +0 -80
  317. package/chunks/workspace-skills-status-DS4ZVFTO.js +0 -70
  318. package/web-shell/assets/channel-CLiQD50f.js +0 -1
  319. package/web-shell/assets/classDiagram-4FO5ZUOK-D3sYqow5.js +0 -1
  320. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-D3sYqow5.js +0 -1
  321. package/web-shell/assets/index-D5IWFVk1.css +0 -5
  322. package/web-shell/assets/index-KFJRDhX7.js +0 -783
  323. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BhQMwgpl.js +0 -1
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  classifyApiError,
5
5
  prefixMidTurnUserMessageParts
6
- } from "./chunk-Q4YQW46J.js";
6
+ } from "./chunk-AMRZVQUY.js";
7
7
  import {
8
8
  EXTENSION_CONTEXT_BUDGET,
9
9
  buildExtensionMentionContext,
@@ -12,96 +12,109 @@ import {
12
12
  matchMcpServerByRef,
13
13
  parseExtensionRef,
14
14
  parseMcpServerRef
15
- } from "./chunk-77XJ3SWN.js";
15
+ } from "./chunk-VDAR6UO2.js";
16
16
  import {
17
17
  getAvailableCommands,
18
18
  handleSlashCommand,
19
19
  insertAfterFunctionResponses,
20
20
  isSlashCommand,
21
21
  normalizePartList
22
- } from "./chunk-5U27BZ72.js";
22
+ } from "./chunk-FKEGVMPX.js";
23
+ import {
24
+ collectContextData,
25
+ formatContextUsageText
26
+ } from "./chunk-UCUUH2JV.js";
23
27
  import {
24
28
  appEvents,
25
29
  buildDisabledSkillNamesProvider,
26
30
  loadCliConfig,
27
31
  normalizeDisabledToolList
28
- } from "./chunk-5HOMWMCL.js";
29
- import "./chunk-5DTTYNB7.js";
30
- import {
31
- collectContextData,
32
- formatContextUsageText
33
- } from "./chunk-D2GFWEXB.js";
32
+ } from "./chunk-BSJAQUFD.js";
34
33
  import {
35
34
  getCommandSubcommandNames
36
- } from "./chunk-AURZZYMD.js";
37
- import "./chunk-JZETEN3Z.js";
35
+ } from "./chunk-ZIVSSTUG.js";
36
+ import "./chunk-N45S36AH.js";
38
37
  import {
39
38
  getEffectiveSupportedModes
40
- } from "./chunk-GWLSNBG4.js";
39
+ } from "./chunk-NA3IG6XG.js";
41
40
  import "./chunk-4WGODMVR.js";
41
+ import "./chunk-KW7NOTN6.js";
42
+ import "./chunk-OVIV236K.js";
43
+ import "./chunk-5DTTYNB7.js";
44
+ import "./chunk-NHDKSOEY.js";
42
45
  import {
43
46
  isTerminalGoalStatusKind
44
47
  } from "./chunk-7X7TEQNX.js";
45
- import "./chunk-KW7NOTN6.js";
46
- import "./chunk-CNEIYWSA.js";
47
48
  import "./chunk-HTHUX2T5.js";
48
- import "./chunk-MXL5UP4X.js";
49
- import "./chunk-3G7CIHVV.js";
50
- import "./chunk-VA4KQY6V.js";
51
- import "./chunk-NHDKSOEY.js";
52
- import "./chunk-OQ4DRIOA.js";
53
- import "./chunk-EMDMPBJ4.js";
49
+ import "./chunk-7HWE2W74.js";
50
+ import "./chunk-Z7SVC7PJ.js";
54
51
  import "./chunk-YAF2MQZ6.js";
52
+ import "./chunk-Q6TUALBE.js";
55
53
  import {
54
+ GENERATION_MAX_PROMPT_BYTES,
55
+ GENERATION_TIMEOUT_MS,
56
56
  MAX_REMEMBER_CONTENT_BYTES,
57
+ collectHistoryReplayUpdates,
58
+ copyCumulativeUsage,
59
+ createReplayCumulativeUsage,
57
60
  createWorkspaceMemoryExtractionErrorLogger,
61
+ executeGeneration,
58
62
  formatWorkspaceMemoryForgetSummary,
59
63
  isValidServerName,
64
+ replayTranscriptRecordPage,
60
65
  shouldSuppressRememberErrorDetails,
61
66
  workspaceMemoryFailureCode,
62
67
  workspaceMemoryFailureDiagnostics
63
- } from "./chunk-GZRTYZ2R.js";
68
+ } from "./chunk-H3XMJV7T.js";
64
69
  import {
65
70
  HistoryReplayer,
66
71
  MessageEmitter,
67
72
  PlanEmitter,
68
73
  ToolCallEmitter
69
- } from "./chunk-N3EMS75V.js";
70
- import "./chunk-U2NNEY4R.js";
71
- import "./chunk-Q6I5QHMH.js";
74
+ } from "./chunk-5DEJ4T6C.js";
75
+ import "./chunk-VT5AWJN4.js";
76
+ import "./chunk-MFNKBXYH.js";
72
77
  import "./chunk-QHTIBUWB.js";
73
78
  import "./chunk-L573Z2QZ.js";
79
+ import {
80
+ computeCpuPercent
81
+ } from "./chunk-HGT6JR3U.js";
82
+ import "./chunk-RXFQM6FQ.js";
83
+ import "./chunk-G3BIBPI7.js";
84
+ import "./chunk-6H67XLET.js";
85
+ import "./chunk-ABNYOMDG.js";
86
+ import "./chunk-2JNR4VP2.js";
87
+ import "./chunk-LXXMOYPL.js";
88
+ import "./chunk-AN6C2U46.js";
89
+ import "./chunk-E5Z2AVNV.js";
90
+ import {
91
+ formatAcpModelId,
92
+ parseAcpBaseModelId,
93
+ parseAcpModelOption,
94
+ sanitizeProviderBaseUrl
95
+ } from "./chunk-BA5JGE5F.js";
96
+ import {
97
+ mapSkillConfigToStatus
98
+ } from "./chunk-2W3OOD4W.js";
74
99
  import {
75
100
  PERMISSION_RULE_TYPES,
76
101
  PermissionRulesValidationError,
77
102
  buildPermissionSettings,
78
103
  normalizePermissionRules,
79
104
  readPermissionRuleSet
80
- } from "./chunk-5VXNZWGF.js";
105
+ } from "./chunk-ENUQSKEY.js";
81
106
  import {
82
107
  MAX_AUDIO_BYTES,
83
108
  sanitizeVoiceErrorMessage,
84
109
  transcribeVoiceAudio
85
- } from "./chunk-PDZ7MBDG.js";
110
+ } from "./chunk-EWILX3BM.js";
86
111
  import {
87
112
  readVoiceModel
88
- } from "./chunk-HPDUL5MF.js";
89
- import "./chunk-LK7KUE55.js";
113
+ } from "./chunk-T2ZDAER2.js";
114
+ import "./chunk-FSA7ERJ2.js";
90
115
  import {
91
- computeCpuPercent
92
- } from "./chunk-YVEDCAUE.js";
93
- import "./chunk-RXFQM6FQ.js";
94
- import "./chunk-PODM4SZ4.js";
95
- import "./chunk-6H67XLET.js";
96
- import "./chunk-BAPGSC7U.js";
97
- import "./chunk-P67PFTUT.js";
98
- import "./chunk-57OAHC2Y.js";
99
- import "./chunk-TO6QE22P.js";
100
- import "./chunk-W3JHSWRP.js";
101
- import "./chunk-E5Z2AVNV.js";
102
- import {
103
- NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE
104
- } from "./chunk-IAVB3HM3.js";
116
+ parseSessionSource
117
+ } from "./chunk-HGRXW4HQ.js";
105
118
  import {
106
119
  CLIENT_MCP_OVER_WS_CONFIG_FLAG,
107
120
  LOAD_REPLAY_BULK_MODE,
@@ -110,21 +123,23 @@ import {
110
123
  LOAD_REPLAY_VERSION,
111
124
  MID_TURN_QUEUE_DRAIN_METHOD
112
125
  } from "./chunk-PZL23GTM.js";
113
- import "./chunk-W7FJ3N32.js";
114
126
  import "./chunk-6RLROE6G.js";
115
127
  import "./chunk-COH43MRJ.js";
116
128
  import {
117
- ndJsonStream
118
- } from "./chunk-TEGEBB2I.js";
129
+ NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE
130
+ } from "./chunk-L4Y55KIS.js";
131
+ import "./chunk-UZP7K33Y.js";
132
+ import "./chunk-KEYEYCHZ.js";
133
+ import "./chunk-57OAHC2Y.js";
134
+ import "./chunk-5CNYZ7TN.js";
135
+ import "./chunk-FNX3LGAK.js";
136
+ import "./chunk-V6WHFGST.js";
119
137
  import {
120
- formatAcpModelId,
121
- parseAcpBaseModelId,
122
- parseAcpModelOption,
123
- sanitizeProviderBaseUrl
124
- } from "./chunk-34MW4KTI.js";
138
+ createLoadedSettingsAdapter
139
+ } from "./chunk-EZWX232B.js";
125
140
  import {
126
- mapSkillConfigToStatus
127
- } from "./chunk-L36P3NBD.js";
141
+ ndJsonStream
142
+ } from "./chunk-J4SEAF4X.js";
128
143
  import {
129
144
  ACP_PREFLIGHT_KINDS,
130
145
  IDLE_HOOK_EVENTS,
@@ -132,14 +147,21 @@ import {
132
147
  SERVE_STATUS_EXT_METHODS,
133
148
  STATUS_SCHEMA_VERSION,
134
149
  mapDomainErrorToErrorKind
135
- } from "./chunk-VWPVHAMO.js";
136
- import "./chunk-DC5Z3DU6.js";
137
- import "./chunk-V6WHFGST.js";
150
+ } from "./chunk-XIWQ5QST.js";
151
+ import "./chunk-W7FJ3N32.js";
152
+ import "./chunk-GYTKQYDB.js";
153
+ import "./chunk-TJTKSVIV.js";
154
+ import "./chunk-M5GB774H.js";
155
+ import "./chunk-OJAMDVF5.js";
156
+ import "./chunk-LXLTBIDP.js";
157
+ import "./chunk-3DWIFU7L.js";
158
+ import "./chunk-ZQIYGQCG.js";
138
159
  import {
139
- createLoadedSettingsAdapter
140
- } from "./chunk-BMGVRZN4.js";
141
- import "./chunk-CUMMSHH6.js";
142
- import "./chunk-ATAKVRIF.js";
160
+ AgentSideConnection,
161
+ PROTOCOL_VERSION,
162
+ RequestError
163
+ } from "./chunk-UDXSXLER.js";
164
+ import "./chunk-Z3XA2TNG.js";
143
165
  import {
144
166
  OUTPUT_LANGUAGE_AUTO,
145
167
  getOutputLanguageFilePath,
@@ -150,44 +172,37 @@ import {
150
172
  resolveOutputLanguage,
151
173
  updateOutputLanguageFile,
152
174
  writeOutputLanguageAndRegisterPath
153
- } from "./chunk-4C5BQ2D2.js";
175
+ } from "./chunk-TIKDHS6V.js";
154
176
  import "./chunk-RKUWKYED.js";
155
177
  import {
156
178
  SUPPORTED_LANGUAGES,
157
179
  getCurrentLanguage,
158
180
  setLanguageAsync
159
- } from "./chunk-YAUFFXDS.js";
181
+ } from "./chunk-7GM2RWCR.js";
160
182
  import {
161
183
  findEnvFiles,
162
184
  preResolveHomeEnvOverrides,
163
185
  reloadEnvironment
164
- } from "./chunk-SCGXUJBT.js";
186
+ } from "./chunk-6LI3L22E.js";
187
+ import "./chunk-GOXKNSDZ.js";
165
188
  import {
166
189
  getSystemDefaultsPath,
167
190
  getSystemSettingsPath
168
- } from "./chunk-3BTRNWWD.js";
191
+ } from "./chunk-IDS7MSUP.js";
169
192
  import "./chunk-QRUIS3DN.js";
170
- import "./chunk-X4NKFGFJ.js";
171
- import "./chunk-TJTKSVIV.js";
172
- import "./chunk-M5GB774H.js";
173
- import "./chunk-34Z3U5RQ.js";
174
- import {
175
- AgentSideConnection,
176
- PROTOCOL_VERSION,
177
- RequestError
178
- } from "./chunk-UDXSXLER.js";
179
193
  import {
180
194
  isFolderTrustEnabled,
181
195
  isWorkspaceTrusted,
182
196
  loadTrustedFolders
183
- } from "./chunk-HKMAENAO.js";
184
- import "./chunk-RDJSGHZE.js";
185
- import "./chunk-XFSFZCM5.js";
186
- import "./chunk-3AHXV67U.js";
187
- import "./chunk-VJNBRRZG.js";
197
+ } from "./chunk-QDTGDM2T.js";
198
+ import "./chunk-ALGGS7UH.js";
199
+ import "./chunk-MR3PXB6E.js";
188
200
  import {
189
201
  writeStderrLine
190
202
  } from "./chunk-YUZI3WAC.js";
203
+ import "./chunk-XFSFZCM5.js";
204
+ import "./chunk-AGZLXLBY.js";
205
+ import "./chunk-VJNBRRZG.js";
191
206
  import {
192
207
  ALL_PROVIDERS,
193
208
  APPROVAL_MODE_INFO,
@@ -205,7 +220,7 @@ import {
205
220
  McpBudgetWouldExceedError,
206
221
  McpServerSpawnFailedError,
207
222
  McpTransportPool,
208
- ORPHAN_TOOL_USE_REPAIR_REASON,
223
+ MessageDisplayDispatcher,
209
224
  POOLED_TRANSPORTS_DEFAULT,
210
225
  SESSION_ARTIFACT_PERSISTENCE_VERSION,
211
226
  SESSION_TITLE_MAX_LENGTH,
@@ -226,16 +241,16 @@ import {
226
241
  buildBtwPrompt,
227
242
  buildContextUsage,
228
243
  buildInstallPlan,
229
- buildSyntheticToolResponseParts,
244
+ buildSessionRecoveryPlanFromApiHistory,
230
245
  clampInlineMediaPart,
231
246
  clearGoalTerminalObserver,
232
247
  computeUniqueBranchTitle,
248
+ convertToFunctionErrorResponse,
233
249
  convertToFunctionResponse,
234
250
  createDuplicateProviderToolCallResponse,
235
251
  dedupeToolCallsById,
236
252
  detectAutonomousSentinel,
237
253
  detectLoopSentinel,
238
- detectTurnInterruption,
239
254
  encodeSessionTranscriptCursor,
240
255
  evaluateAutoMode,
241
256
  evaluatePermissionFlow,
@@ -262,7 +277,6 @@ import {
262
277
  getProviderToolCallId,
263
278
  getScopedEnvContents,
264
279
  getStartupContextLength,
265
- hasImageParts,
266
280
  ideContextStore,
267
281
  injectPermissionRulesIfMissing,
268
282
  isApproveOutcome,
@@ -273,7 +287,6 @@ import {
273
287
  matchesAnyServerPattern,
274
288
  needsConfirmation,
275
289
  normalizeEventPayload,
276
- normalizeParts,
277
290
  normalizeSnapshotPayload,
278
291
  parsePositiveIntegerEnv,
279
292
  persistPermissionOutcome,
@@ -281,12 +294,13 @@ import {
281
294
  recordAllow,
282
295
  recordFallbackApprove,
283
296
  redactUrlCredentials,
297
+ refreshMemoryAfterManagedWrite,
298
+ refreshMemoryInstruction,
284
299
  resolveBaseUrl,
285
300
  restoreWorktreeContext,
286
301
  runForkedAgent,
287
302
  runManagedAutoMemoryDream,
288
303
  runManagedRememberByAgent,
289
- runVisionBridge,
290
304
  sessionIdContext,
291
305
  setGoalTerminalObserver,
292
306
  shouldClassifyAllShellForAutoMode,
@@ -294,42 +308,37 @@ import {
294
308
  shouldFirePermissionDeniedForAutoMode,
295
309
  shouldForceAutoModeReviewForAllow,
296
310
  shouldRunAutoModeForCall,
297
- shouldRunVisionBridge,
298
- splitImageParts,
299
311
  subagentGenerator,
300
312
  unregisterGoalHook,
301
313
  updateSetting
302
- } from "./chunk-NVYTCB5Z.js";
303
- import "./chunk-CU3L64TP.js";
304
- import "./chunk-ZJE7NSL3.js";
314
+ } from "./chunk-SA6QVLWI.js";
305
315
  import {
306
316
  external_exports
307
317
  } from "./chunk-H6XPXXMH.js";
308
- import "./chunk-MC23XKFE.js";
309
- import "./chunk-LUODI7WD.js";
310
- import "./chunk-ORBGV7NJ.js";
311
- import "./chunk-KKNMOEZH.js";
312
- import {
313
- runSideQuery
314
- } from "./chunk-W2UIXQDL.js";
318
+ import "./chunk-5M6IDOMF.js";
319
+ import "./chunk-A2HWMJVO.js";
320
+ import "./chunk-RCEEXIOO.js";
321
+ import "./chunk-KKRTYONM.js";
322
+ import "./chunk-TV6K2FB4.js";
323
+ import "./chunk-E2UVIFI2.js";
315
324
  import "./chunk-XU457J4V.js";
316
325
  import "./chunk-VDDGDZMA.js";
317
- import "./chunk-CEA3E3JB.js";
326
+ import "./chunk-SPJQO2CE.js";
318
327
  import "./chunk-SZRN75WQ.js";
319
328
  import "./chunk-HTO4JFDZ.js";
320
329
  import "./chunk-CPBF7KYF.js";
321
330
  import {
322
331
  APPROVAL_MODES,
323
332
  FORK_SUBAGENT_TYPE
324
- } from "./chunk-4GORAUCN.js";
333
+ } from "./chunk-F333XEAU.js";
325
334
  import "./chunk-6AM5D4ME.js";
326
- import "./chunk-7R3CZA3Q.js";
335
+ import "./chunk-2Z5UX4KI.js";
327
336
  import {
328
337
  HookEventName,
329
338
  createHookOutput
330
- } from "./chunk-GWHYEOV2.js";
331
- import "./chunk-4QLQE5WJ.js";
332
- import "./chunk-5XUCZNSY.js";
339
+ } from "./chunk-ARKANCNX.js";
340
+ import "./chunk-L5U3ELZX.js";
341
+ import "./chunk-TYLOFD2U.js";
333
342
  import {
334
343
  AuthType,
335
344
  ConversationFinishedEvent,
@@ -340,66 +349,76 @@ import {
340
349
  endToolExecutionSpan,
341
350
  endToolSpan,
342
351
  extractDaemonTraceContext,
352
+ formatVisionBridgeNotice,
343
353
  getAllGeminiMdFilenames,
344
354
  getMCPServerStatus,
355
+ hasImageParts,
345
356
  logConversationFinishedEvent,
346
357
  logLoopDetected,
347
358
  logPromptSuggestion,
348
359
  logToolCall,
349
360
  logUserPrompt,
361
+ normalizeParts,
350
362
  registerAcpEventLoopLagGauge,
351
363
  runInToolSpanContext,
364
+ runVisionBridge,
365
+ shouldRunVisionBridge,
366
+ splitImageParts,
352
367
  startEventLoopLagMonitor,
353
368
  startToolExecutionSpan,
354
369
  startToolSpan,
355
370
  uiTelemetryService,
356
371
  withInteractionSpan
357
- } from "./chunk-3VAGG5T5.js";
372
+ } from "./chunk-YYBZUIPL.js";
358
373
  import "./chunk-4WKAA4KS.js";
359
374
  import "./chunk-CR3C7WXL.js";
360
- import "./chunk-CARU2RR2.js";
375
+ import {
376
+ runSideQuery
377
+ } from "./chunk-RTV5TUYB.js";
361
378
  import "./chunk-VGC4I5JJ.js";
362
379
  import {
363
380
  getAutoMemoryRoot,
364
381
  getUserAutoMemoryRoot
365
- } from "./chunk-YLV3XXFB.js";
366
- import "./chunk-TDEXZKMT.js";
367
- import "./chunk-J3JA76CF.js";
382
+ } from "./chunk-FBU7WRZI.js";
383
+ import "./chunk-Y66VOBRP.js";
384
+ import "./chunk-WTNZ6DXB.js";
368
385
  import {
369
386
  ToolConfirmationOutcome,
370
- ToolNames
371
- } from "./chunk-B5ORX3FG.js";
387
+ ToolNames,
388
+ isShellProgressData
389
+ } from "./chunk-JGUT3LWZ.js";
372
390
  import {
373
391
  clearCachedCredentialFile,
374
392
  qwenOAuth2Events
375
- } from "./chunk-BZIFY5TF.js";
376
- import "./chunk-UOZWKTQG.js";
393
+ } from "./chunk-OKAIGAYW.js";
394
+ import "./chunk-ZPAHLFZU.js";
377
395
  import "./chunk-JESCGQM3.js";
378
- import "./chunk-ZLXQN2QS.js";
396
+ import "./chunk-WIEO4CWB.js";
379
397
  import "./chunk-XVNQMZ2I.js";
398
+ import "./chunk-FEOZBUMT.js";
380
399
  import {
381
400
  DEFAULT_TOKEN_LIMIT,
401
+ getToolCallPreparations,
382
402
  tokenLimit
383
- } from "./chunk-524RQP4Q.js";
384
- import "./chunk-JSG7ZSBC.js";
403
+ } from "./chunk-VRR65QYW.js";
385
404
  import "./chunk-A4UCTEB5.js";
386
405
  import "./chunk-XWRJCPHC.js";
387
406
  import "./chunk-4LD5APFL.js";
388
407
  import "./chunk-TYAMGABM.js";
389
408
  import "./chunk-FCMNKVXT.js";
390
409
  import "./chunk-DJ2GSRLV.js";
391
- import "./chunk-4ZVWQHEQ.js";
410
+ import "./chunk-LQIDP6K5.js";
392
411
  import {
393
412
  Storage,
394
413
  createDebugLogger,
395
414
  getErrorMessage,
396
415
  getErrorStatus,
397
416
  isSubpath
398
- } from "./chunk-J4TSQ5EQ.js";
399
- import "./chunk-CCDMCZPP.js";
417
+ } from "./chunk-7NFB7LBQ.js";
418
+ import "./chunk-YZ3SBNP7.js";
400
419
  import {
401
420
  runExitCleanup
402
- } from "./chunk-ECNYL4AA.js";
421
+ } from "./chunk-HUEWOHKV.js";
403
422
  import "./chunk-75DOP5OR.js";
404
423
  import "./chunk-DMTGGOSA.js";
405
424
  import "./chunk-YQ3U5MUC.js";
@@ -793,6 +812,79 @@ import { Buffer as Buffer2 } from "node:buffer";
793
812
  import * as os2 from "node:os";
794
813
  import * as path3 from "node:path";
795
814
 
815
+ // packages/cli/src/acp-integration/session/tool-call-preparation-tracker.ts
816
+ init_esbuild_shims();
817
+ var ToolCallPreparationTracker = class {
818
+ constructor(emitter) {
819
+ this.emitter = emitter;
820
+ }
821
+ static {
822
+ __name(this, "ToolCallPreparationTracker");
823
+ }
824
+ /** Contains only calls whose start frame was emitted successfully. */
825
+ pending = /* @__PURE__ */ new Map();
826
+ /** Contains calls whose start frame was intentionally suppressed. */
827
+ suppressed = /* @__PURE__ */ new Set();
828
+ /** Calls parsed completely but not yet handed to tool execution. */
829
+ resolved = /* @__PURE__ */ new Set();
830
+ /**
831
+ * Emits at most one preparing frame per call ID before the full call arrives.
832
+ */
833
+ async observe(response) {
834
+ for (const preparation of getToolCallPreparations(response)) {
835
+ if (this.pending.has(preparation.callId) || this.suppressed.has(preparation.callId)) {
836
+ continue;
837
+ }
838
+ const emitted = await this.emitter.emitStart({
839
+ callId: preparation.callId,
840
+ toolName: preparation.toolName,
841
+ args: {},
842
+ status: "pending",
843
+ phase: "preparing"
844
+ });
845
+ if (emitted) {
846
+ this.pending.set(preparation.callId, preparation.toolName);
847
+ } else {
848
+ this.suppressed.add(preparation.callId);
849
+ }
850
+ }
851
+ }
852
+ /** Resolves preparations once their complete function calls arrive. */
853
+ resolve(functionCalls) {
854
+ for (const functionCall of functionCalls) {
855
+ if (functionCall.id && this.pending.has(functionCall.id)) {
856
+ this.resolved.add(functionCall.id);
857
+ }
858
+ }
859
+ }
860
+ /**
861
+ * Terminates unresolved preparations. The map is cleared first so repeated
862
+ * cleanup, including re-entry after an emission failure, cannot emit twice.
863
+ */
864
+ async discard(includeResolved = false) {
865
+ const pending = [...this.pending.entries()];
866
+ this.pending.clear();
867
+ const resolved = new Set(this.resolved);
868
+ this.resolved.clear();
869
+ let firstError;
870
+ let hasError = false;
871
+ for (const [callId, toolName] of pending) {
872
+ if (!includeResolved && resolved.has(callId)) continue;
873
+ try {
874
+ await this.emitter.emitPreparationDiscarded(callId, toolName);
875
+ } catch (error) {
876
+ if (!hasError) {
877
+ firstError = error;
878
+ hasError = true;
879
+ }
880
+ }
881
+ }
882
+ if (hasError) {
883
+ throw firstError;
884
+ }
885
+ }
886
+ };
887
+
796
888
  // packages/cli/src/acp-integration/session/SubAgentTracker.ts
797
889
  init_esbuild_shims();
798
890
 
@@ -1337,7 +1429,12 @@ ${inputText}
1337
1429
  ${rewritten}
1338
1430
  ---`
1339
1431
  );
1340
- this.outputHistory.push(rewritten);
1432
+ if (this.contextTurns > 0) {
1433
+ this.outputHistory.push(rewritten);
1434
+ if (Number.isFinite(this.contextTurns) && this.outputHistory.length > this.contextTurns) {
1435
+ this.outputHistory = this.outputHistory.slice(-this.contextTurns);
1436
+ }
1437
+ }
1341
1438
  return rewritten;
1342
1439
  } catch (error) {
1343
1440
  debugLogger4.warn(
@@ -1387,6 +1484,9 @@ var MessageRewriteMiddleware = class {
1387
1484
  const content = updateRecord["content"];
1388
1485
  const text = content?.["text"] ?? "";
1389
1486
  await this.sendUpdate(update);
1487
+ if (updateType === "agent_message_chunk" && updateRecord["_meta"]?.["source"] === "slash_command") {
1488
+ return;
1489
+ }
1390
1490
  let didAccumulate = false;
1391
1491
  if (updateType === "agent_thought_chunk") {
1392
1492
  if (this.target === "thought" || this.target === "all") {
@@ -1473,9 +1573,10 @@ var MessageRewriteMiddleware = class {
1473
1573
  * Call this before session ends to ensure all rewrites are flushed.
1474
1574
  */
1475
1575
  async waitForPendingRewrites() {
1476
- if (this.pendingRewrites.length > 0) {
1477
- await Promise.allSettled(this.pendingRewrites);
1576
+ while (this.pendingRewrites.length > 0) {
1577
+ const inFlight = this.pendingRewrites;
1478
1578
  this.pendingRewrites = [];
1579
+ await Promise.allSettled(inFlight);
1479
1580
  }
1480
1581
  }
1481
1582
  };
@@ -1494,6 +1595,17 @@ var debugLogger6 = createDebugLogger("SESSION");
1494
1595
  var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
1495
1596
  var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
1496
1597
  var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
1598
+ async function finalizeToolCallPreparations(tracker, includeResolved, streamName) {
1599
+ try {
1600
+ await tracker.discard(includeResolved);
1601
+ } catch (error) {
1602
+ const message = error instanceof Error ? error.message : String(error);
1603
+ debugLogger6.warn(
1604
+ `Failed to discard tool preparations for ${streamName}; continuing stream: ${message}`
1605
+ );
1606
+ }
1607
+ }
1608
+ __name(finalizeToolCallPreparations, "finalizeToolCallPreparations");
1497
1609
  function maskApiKeyForDisplay(apiKey) {
1498
1610
  const trimmed = apiKey?.trim() ?? "";
1499
1611
  if (trimmed.length === 0) return "(not set)";
@@ -2022,6 +2134,7 @@ var Session = class {
2022
2134
  // or session reload), which would otherwise execute orphaned cron prompts
2023
2135
  // on a session whose registries are already unregistered.
2024
2136
  disposed = false;
2137
+ unsubscribeChatRecordingFailure;
2025
2138
  // Modular components
2026
2139
  historyReplayer;
2027
2140
  toolCallEmitter;
@@ -2131,6 +2244,8 @@ var Session = class {
2131
2244
  this.config.getMonitorRegistry().setNotificationCallback(void 0);
2132
2245
  this.config.getBackgroundShellRegistry().setNotificationCallback(void 0);
2133
2246
  this.config.getChatRecordingService()?.setTitleRecordedCallback(void 0);
2247
+ this.unsubscribeChatRecordingFailure?.();
2248
+ this.unsubscribeChatRecordingFailure = void 0;
2134
2249
  this.config.setSubSessionSpawner(void 0);
2135
2250
  clearGoalTerminalObserver(this.sessionId);
2136
2251
  }
@@ -2389,16 +2504,18 @@ var Session = class {
2389
2504
  return { accepted: false, interruption: "none" };
2390
2505
  }
2391
2506
  const chat = this.#getCurrentChat();
2392
- const detection = detectTurnInterruption(
2393
- chat.getHistoryTailShallow?.(TURN_INTERRUPTION_HISTORY_TAIL_COUNT) ?? chat.getHistoryTail(TURN_INTERRUPTION_HISTORY_TAIL_COUNT)
2394
- );
2395
- if (detection.kind === "none") {
2507
+ const recoveryPlan = buildSessionRecoveryPlanFromApiHistory({
2508
+ sessionId: this.sessionId,
2509
+ apiHistory: chat.getHistoryTailShallow?.(TURN_INTERRUPTION_HISTORY_TAIL_COUNT) ?? chat.getHistoryTail(TURN_INTERRUPTION_HISTORY_TAIL_COUNT)
2510
+ });
2511
+ if (!recoveryPlan.continuation) {
2396
2512
  return { accepted: false, interruption: "none" };
2397
2513
  }
2514
+ const interruption = recoveryPlan.kind === "interrupted_prompt" ? "interrupted_prompt" : "interrupted_turn";
2398
2515
  if (this.pendingPrompt && !this.pendingPrompt.signal.aborted) {
2399
- return { accepted: false, interruption: detection.kind };
2516
+ return { accepted: false, interruption };
2400
2517
  }
2401
- return { accepted: true, interruption: detection.kind };
2518
+ return { accepted: true, interruption };
2402
2519
  }
2403
2520
  /**
2404
2521
  * Generate a server-side follow-up suggestion for the just-completed
@@ -2522,10 +2639,11 @@ var Session = class {
2522
2639
  let strippedOrphanEntries = null;
2523
2640
  let orphanPushCountSnapshot = 0;
2524
2641
  if (isContinue) {
2525
- const detection = detectTurnInterruption(
2526
- this.#getCurrentChat().getHistory()
2527
- );
2528
- if (detection.kind === "none") {
2642
+ const recoveryPlan = buildSessionRecoveryPlanFromApiHistory({
2643
+ sessionId: this.sessionId,
2644
+ apiHistory: this.#getCurrentChat().getHistory()
2645
+ });
2646
+ if (!recoveryPlan.continuation) {
2529
2647
  debugLogger6.warn(
2530
2648
  `[Session] continue ${promptId}: no interrupted turn on re-detection, nothing to continue`
2531
2649
  );
@@ -2538,15 +2656,12 @@ var Session = class {
2538
2656
  );
2539
2657
  return { stopReason: "end_turn" };
2540
2658
  }
2541
- if (detection.kind === "interrupted_prompt") {
2659
+ if (recoveryPlan.continuation.mode === "retry_user_parts") {
2542
2660
  strippedOrphanEntries = this.#getCurrentChat().stripOrphanedUserEntriesFromHistory() ?? null;
2543
2661
  orphanPushCountSnapshot = this.#getCurrentChat().getUserContentPushCount?.() ?? 0;
2544
- continuationParts = detection.parts;
2662
+ continuationParts = recoveryPlan.continuation.parts;
2545
2663
  } else {
2546
- continuationParts = buildSyntheticToolResponseParts(
2547
- detection.danglingCalls,
2548
- ORPHAN_TOOL_USE_REPAIR_REASON
2549
- );
2664
+ continuationParts = recoveryPlan.continuation.parts;
2550
2665
  }
2551
2666
  }
2552
2667
  if (isContinue) {
@@ -2579,7 +2694,8 @@ var Session = class {
2579
2694
  } else {
2580
2695
  parts = await this.#resolvePrompt(
2581
2696
  params.prompt,
2582
- pendingSend.signal
2697
+ pendingSend.signal,
2698
+ { promptLast: true }
2583
2699
  );
2584
2700
  }
2585
2701
  const hooksEnabled = !this.config.getDisableAllHooks?.();
@@ -2654,8 +2770,14 @@ ${this.pendingWorktreeNotice}
2654
2770
  return { stopReason: "cancelled" };
2655
2771
  }
2656
2772
  const functionCalls = [];
2773
+ const preparationTracker = new ToolCallPreparationTracker(
2774
+ this.toolCallEmitter
2775
+ );
2657
2776
  let usageMetadata = null;
2658
2777
  const streamStartTime = Date.now();
2778
+ const messageDisplay = this.#createMessageDisplayDispatcher(
2779
+ pendingSend.signal
2780
+ );
2659
2781
  try {
2660
2782
  const sendResult = await this.#sendMessageStreamWithAutoCompression(
2661
2783
  promptId,
@@ -2671,32 +2793,56 @@ ${this.pendingWorktreeNotice}
2671
2793
  }
2672
2794
  const responseStream = sendResult.responseStream;
2673
2795
  nextMessage = null;
2674
- for await (const resp of responseStream) {
2675
- if (pendingSend.signal.aborted) {
2676
- return { stopReason: "cancelled" };
2677
- }
2678
- if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
2679
- const candidate = resp.value.candidates[0];
2680
- for (const part of candidate.content?.parts ?? []) {
2681
- if (!part.text) {
2682
- continue;
2796
+ let streamFailed = false;
2797
+ try {
2798
+ for await (const resp of responseStream) {
2799
+ if (pendingSend.signal.aborted) {
2800
+ return { stopReason: "cancelled" };
2801
+ }
2802
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
2803
+ const candidate = resp.value.candidates[0];
2804
+ for (const part of candidate.content?.parts ?? []) {
2805
+ if (!part.text) {
2806
+ continue;
2807
+ }
2808
+ this.messageEmitter.emitMessage(
2809
+ part.text,
2810
+ "assistant",
2811
+ part.thought
2812
+ );
2813
+ if (!part.thought) {
2814
+ messageDisplay?.addChunk(part.text);
2815
+ }
2683
2816
  }
2684
- this.messageEmitter.emitMessage(
2685
- part.text,
2686
- "assistant",
2687
- part.thought
2817
+ }
2818
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
2819
+ usageMetadata = resp.value.usageMetadata;
2820
+ }
2821
+ if (resp.type === "chunk" /* CHUNK */) {
2822
+ await preparationTracker.observe(resp.value);
2823
+ if (resp.value.functionCalls) {
2824
+ preparationTracker.resolve(resp.value.functionCalls);
2825
+ functionCalls.push(...resp.value.functionCalls);
2826
+ }
2827
+ }
2828
+ if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
2829
+ await finalizeToolCallPreparations(
2830
+ preparationTracker,
2831
+ true,
2832
+ `main prompt ${resp.type}`
2688
2833
  );
2834
+ functionCalls.length = 0;
2689
2835
  }
2690
2836
  }
2691
- if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
2692
- usageMetadata = resp.value.usageMetadata;
2693
- }
2694
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
2695
- functionCalls.push(...resp.value.functionCalls);
2696
- }
2697
- if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
2698
- functionCalls.length = 0;
2699
- }
2837
+ } catch (error) {
2838
+ streamFailed = true;
2839
+ throw error;
2840
+ } finally {
2841
+ await finalizeToolCallPreparations(
2842
+ preparationTracker,
2843
+ streamFailed || pendingSend.signal.aborted,
2844
+ "main prompt"
2845
+ );
2700
2846
  }
2701
2847
  } catch (error) {
2702
2848
  if (strippedOrphanEntries && (this.#getCurrentChat().getUserContentPushCount?.() ?? 0) <= orphanPushCountSnapshot) {
@@ -2728,6 +2874,8 @@ ${this.pendingWorktreeNotice}
2728
2874
  );
2729
2875
  }
2730
2876
  throw error;
2877
+ } finally {
2878
+ await messageDisplay?.finish();
2731
2879
  }
2732
2880
  if (usageMetadata) {
2733
2881
  this.#recordPromptTokenCount(usageMetadata);
@@ -2874,8 +3022,14 @@ ${this.pendingWorktreeNotice}
2874
3022
  return { stopReason: "cancelled" };
2875
3023
  }
2876
3024
  const functionCalls = [];
3025
+ const preparationTracker = new ToolCallPreparationTracker(
3026
+ this.toolCallEmitter
3027
+ );
2877
3028
  let usageMetadata = null;
2878
3029
  const streamStartTime = Date.now();
3030
+ const messageDisplay = this.#createMessageDisplayDispatcher(
3031
+ pendingSend.signal
3032
+ );
2879
3033
  try {
2880
3034
  const continueSendResult = await this.#sendMessageStreamWithAutoCompression(
2881
3035
  promptId + "_stop_hook_" + stopHookIterationCount,
@@ -2892,30 +3046,54 @@ ${this.pendingWorktreeNotice}
2892
3046
  }
2893
3047
  const continueResponseStream = continueSendResult.responseStream;
2894
3048
  nextMessage = null;
2895
- for await (const resp of continueResponseStream) {
2896
- if (pendingSend.signal.aborted) {
2897
- return { stopReason: "cancelled" };
2898
- }
2899
- if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
2900
- const candidate = resp.value.candidates[0];
2901
- for (const part of candidate.content?.parts ?? []) {
2902
- if (!part.text) continue;
2903
- this.messageEmitter.emitMessage(
2904
- part.text,
2905
- "assistant",
2906
- part.thought
3049
+ let streamFailed = false;
3050
+ try {
3051
+ for await (const resp of continueResponseStream) {
3052
+ if (pendingSend.signal.aborted) {
3053
+ return { stopReason: "cancelled" };
3054
+ }
3055
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
3056
+ const candidate = resp.value.candidates[0];
3057
+ for (const part of candidate.content?.parts ?? []) {
3058
+ if (!part.text) continue;
3059
+ this.messageEmitter.emitMessage(
3060
+ part.text,
3061
+ "assistant",
3062
+ part.thought
3063
+ );
3064
+ if (!part.thought) {
3065
+ messageDisplay?.addChunk(part.text);
3066
+ }
3067
+ }
3068
+ }
3069
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
3070
+ usageMetadata = resp.value.usageMetadata;
3071
+ }
3072
+ if (resp.type === "chunk" /* CHUNK */) {
3073
+ await preparationTracker.observe(resp.value);
3074
+ if (resp.value.functionCalls) {
3075
+ preparationTracker.resolve(resp.value.functionCalls);
3076
+ functionCalls.push(...resp.value.functionCalls);
3077
+ }
3078
+ }
3079
+ if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
3080
+ await finalizeToolCallPreparations(
3081
+ preparationTracker,
3082
+ true,
3083
+ `Stop Hook continuation ${resp.type}`
2907
3084
  );
3085
+ functionCalls.length = 0;
2908
3086
  }
2909
3087
  }
2910
- if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
2911
- usageMetadata = resp.value.usageMetadata;
2912
- }
2913
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
2914
- functionCalls.push(...resp.value.functionCalls);
2915
- }
2916
- if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
2917
- functionCalls.length = 0;
2918
- }
3088
+ } catch (error) {
3089
+ streamFailed = true;
3090
+ throw error;
3091
+ } finally {
3092
+ await finalizeToolCallPreparations(
3093
+ preparationTracker,
3094
+ streamFailed || pendingSend.signal.aborted,
3095
+ "Stop Hook continuation"
3096
+ );
2919
3097
  }
2920
3098
  } catch (error) {
2921
3099
  const errorStatus = getErrorStatus(error);
@@ -2938,6 +3116,8 @@ ${this.pendingWorktreeNotice}
2938
3116
  );
2939
3117
  }
2940
3118
  throw error;
3119
+ } finally {
3120
+ await messageDisplay?.finish();
2941
3121
  }
2942
3122
  if (usageMetadata) {
2943
3123
  this.#recordPromptTokenCount(usageMetadata);
@@ -2993,6 +3173,28 @@ ${this.pendingWorktreeNotice}
2993
3173
  * stop reason when the provider send should be skipped because the request
2994
3174
  * was cancelled or the session token limit was exceeded.
2995
3175
  */
3176
+ /**
3177
+ * Create the MessageDisplay hook dispatcher for one model call's streamed
3178
+ * reply, or null when the hook isn't registered (the common case — keeps
3179
+ * the streaming loops zero-cost). The ACP surface consumes GeminiChat's
3180
+ * raw stream directly rather than going through
3181
+ * GeminiClient.sendMessageStream, so it has to fire this hook itself —
3182
+ * with the same contract as the terminal UI path in client.ts: debounced
3183
+ * cumulative text, one message_id per model call, and an is_final firing
3184
+ * on every non-aborted exit (delivered by awaiting `finish()` in a
3185
+ * finally around each streaming loop).
3186
+ */
3187
+ #createMessageDisplayDispatcher(signal) {
3188
+ const messageBus = this.config.getMessageBus?.();
3189
+ if (this.config.getDisableAllHooks?.() || !messageBus || !this.config.hasHooksForEvent?.("MessageDisplay")) {
3190
+ return null;
3191
+ }
3192
+ return new MessageDisplayDispatcher(
3193
+ messageBus,
3194
+ signal,
3195
+ (message) => debugLogger6.warn(message)
3196
+ );
3197
+ }
2996
3198
  async #sendMessageStreamWithAutoCompression(promptId, message, abortSignal, options = {}) {
2997
3199
  const geminiClient = this.config.getGeminiClient();
2998
3200
  let compressionDiagnostic = null;
@@ -3497,6 +3699,9 @@ ${this.pendingWorktreeNotice}
3497
3699
  turnCount++;
3498
3700
  if (ac.signal.aborted) return;
3499
3701
  const functionCalls = [];
3702
+ const preparationTracker = new ToolCallPreparationTracker(
3703
+ this.toolCallEmitter
3704
+ );
3500
3705
  let usageMetadata = null;
3501
3706
  const streamStartTime = Date.now();
3502
3707
  const sendResult = await this.#sendMessageStreamWithAutoCompression(
@@ -3519,27 +3724,58 @@ ${this.pendingWorktreeNotice}
3519
3724
  this.loopTickResolver?.markDelivered();
3520
3725
  }
3521
3726
  nextMessage = null;
3522
- for await (const resp of responseStream) {
3523
- if (ac.signal.aborted) return;
3524
- if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
3525
- const candidate = resp.value.candidates[0];
3526
- for (const part of candidate.content?.parts ?? []) {
3527
- if (!part.text) continue;
3528
- this.messageEmitter.emitMessage(
3529
- part.text,
3530
- "assistant",
3531
- part.thought
3727
+ const messageDisplay = this.#createMessageDisplayDispatcher(
3728
+ ac.signal
3729
+ );
3730
+ let streamFailed = false;
3731
+ try {
3732
+ for await (const resp of responseStream) {
3733
+ if (ac.signal.aborted) return;
3734
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
3735
+ const candidate = resp.value.candidates[0];
3736
+ for (const part of candidate.content?.parts ?? []) {
3737
+ if (!part.text) continue;
3738
+ this.messageEmitter.emitMessage(
3739
+ part.text,
3740
+ "assistant",
3741
+ part.thought
3742
+ );
3743
+ if (!part.thought) {
3744
+ messageDisplay?.addChunk(part.text);
3745
+ }
3746
+ }
3747
+ }
3748
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
3749
+ usageMetadata = resp.value.usageMetadata;
3750
+ }
3751
+ if (resp.type === "chunk" /* CHUNK */) {
3752
+ await preparationTracker.observe(resp.value);
3753
+ if (resp.value.functionCalls) {
3754
+ preparationTracker.resolve(resp.value.functionCalls);
3755
+ functionCalls.push(...resp.value.functionCalls);
3756
+ }
3757
+ }
3758
+ if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
3759
+ await finalizeToolCallPreparations(
3760
+ preparationTracker,
3761
+ true,
3762
+ `cron/loop tick ${resp.type}`
3532
3763
  );
3764
+ functionCalls.length = 0;
3533
3765
  }
3534
3766
  }
3535
- if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
3536
- usageMetadata = resp.value.usageMetadata;
3537
- }
3538
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
3539
- functionCalls.push(...resp.value.functionCalls);
3540
- }
3541
- if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
3542
- functionCalls.length = 0;
3767
+ } catch (error) {
3768
+ streamFailed = true;
3769
+ throw error;
3770
+ } finally {
3771
+ try {
3772
+ await finalizeToolCallPreparations(
3773
+ preparationTracker,
3774
+ streamFailed || ac.signal.aborted,
3775
+ "cron/loop tick"
3776
+ );
3777
+ } finally {
3778
+ await messageDisplay?.finish();
3543
3779
  }
3544
3780
  }
3545
3781
  if (usageMetadata) {
@@ -3649,15 +3885,27 @@ ${this.pendingWorktreeNotice}
3649
3885
  kind: "shell"
3650
3886
  });
3651
3887
  });
3652
- this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource) => {
3888
+ this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource, sessionId) => {
3653
3889
  void this.client.extNotification("qwen/notify/session/title-update", {
3654
3890
  v: 1,
3655
- sessionId: this.sessionId,
3891
+ sessionId,
3656
3892
  title: customTitle,
3657
3893
  titleSource
3658
3894
  }).catch(() => {
3659
3895
  });
3660
3896
  });
3897
+ if (typeof this.config.onChatRecordingFailure === "function") {
3898
+ this.unsubscribeChatRecordingFailure = this.config.onChatRecordingFailure(
3899
+ (event) => this.client.extNotification(
3900
+ "qwen/notify/session/recording-degraded",
3901
+ {
3902
+ v: 1,
3903
+ sessionId: event.sessionId,
3904
+ reason: "write_failed"
3905
+ }
3906
+ )
3907
+ );
3908
+ }
3661
3909
  }
3662
3910
  #enqueueBackgroundNotification(item) {
3663
3911
  while (this.notificationQueue.length >= MAX_NOTIFICATION_QUEUE) {
@@ -3726,6 +3974,9 @@ ${this.pendingWorktreeNotice}
3726
3974
  return;
3727
3975
  }
3728
3976
  const functionCalls = [];
3977
+ const preparationTracker = new ToolCallPreparationTracker(
3978
+ this.toolCallEmitter
3979
+ );
3729
3980
  let usageMetadata = null;
3730
3981
  let responseText = "";
3731
3982
  const streamStartTime = Date.now();
@@ -3746,34 +3997,63 @@ ${this.pendingWorktreeNotice}
3746
3997
  }
3747
3998
  const responseStream = sendResult.responseStream;
3748
3999
  nextMessage = null;
3749
- for await (const resp of responseStream) {
3750
- if (ac.signal.aborted) {
3751
- await this.#emitBackgroundNotificationEndTurn("cancelled");
3752
- return;
3753
- }
3754
- if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
3755
- const candidate = resp.value.candidates[0];
3756
- for (const part of candidate.content?.parts ?? []) {
3757
- if (!part.text) continue;
3758
- if (part.thought) {
3759
- await this.messageEmitter.emitMessage(
3760
- part.text,
3761
- "assistant",
3762
- true
3763
- );
3764
- } else {
3765
- responseText += part.text;
4000
+ const messageDisplay = this.#createMessageDisplayDispatcher(
4001
+ ac.signal
4002
+ );
4003
+ let streamFailed = false;
4004
+ try {
4005
+ for await (const resp of responseStream) {
4006
+ if (ac.signal.aborted) {
4007
+ await this.#emitBackgroundNotificationEndTurn("cancelled");
4008
+ return;
4009
+ }
4010
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
4011
+ const candidate = resp.value.candidates[0];
4012
+ for (const part of candidate.content?.parts ?? []) {
4013
+ if (!part.text) continue;
4014
+ if (part.thought) {
4015
+ await this.messageEmitter.emitMessage(
4016
+ part.text,
4017
+ "assistant",
4018
+ true
4019
+ );
4020
+ } else {
4021
+ responseText += part.text;
4022
+ messageDisplay?.addChunk(part.text);
4023
+ }
3766
4024
  }
3767
4025
  }
4026
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
4027
+ usageMetadata = resp.value.usageMetadata;
4028
+ }
4029
+ if (resp.type === "chunk" /* CHUNK */) {
4030
+ await preparationTracker.observe(resp.value);
4031
+ if (resp.value.functionCalls) {
4032
+ preparationTracker.resolve(resp.value.functionCalls);
4033
+ functionCalls.push(...resp.value.functionCalls);
4034
+ }
4035
+ }
4036
+ if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
4037
+ await finalizeToolCallPreparations(
4038
+ preparationTracker,
4039
+ true,
4040
+ `background notification ${resp.type}`
4041
+ );
4042
+ functionCalls.length = 0;
4043
+ }
3768
4044
  }
3769
- if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
3770
- usageMetadata = resp.value.usageMetadata;
3771
- }
3772
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
3773
- functionCalls.push(...resp.value.functionCalls);
3774
- }
3775
- if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
3776
- functionCalls.length = 0;
4045
+ } catch (error) {
4046
+ streamFailed = true;
4047
+ throw error;
4048
+ } finally {
4049
+ try {
4050
+ await finalizeToolCallPreparations(
4051
+ preparationTracker,
4052
+ streamFailed || ac.signal.aborted,
4053
+ "background notification"
4054
+ );
4055
+ } finally {
4056
+ await messageDisplay?.finish();
3777
4057
  }
3778
4058
  }
3779
4059
  if (responseText.length > 0) {
@@ -3901,26 +4181,54 @@ ${this.pendingWorktreeNotice}
3901
4181
  }
3902
4182
  async sendAvailableCommandsUpdate() {
3903
4183
  try {
3904
- const { availableCommands, availableSkills, availableSkillDetails } = await buildAvailableCommandsSnapshot(
3905
- this.config,
3906
- void 0,
3907
- this.settings
3908
- );
3909
- const update = {
3910
- sessionUpdate: "available_commands_update",
3911
- availableCommands,
3912
- ...availableSkills !== void 0 ? {
3913
- _meta: {
3914
- availableSkills,
3915
- ...availableSkillDetails ? { availableSkillDetails } : {}
3916
- }
3917
- } : {}
3918
- };
3919
- await this.sendUpdate(update);
4184
+ await this.sendAvailableCommandsUpdateOrThrow();
3920
4185
  } catch (error) {
3921
4186
  debugLogger6.error("Error sending available commands update:", error);
3922
4187
  }
3923
4188
  }
4189
+ async refreshSkillsFromSettings() {
4190
+ this.settings.reloadScopeFromDisk("Workspace" /* Workspace */);
4191
+ const skillManager = this.config.getSkillManager();
4192
+ let updateFailed = false;
4193
+ let updateError;
4194
+ try {
4195
+ await this.sendAvailableCommandsUpdateOrThrow();
4196
+ } catch (error) {
4197
+ updateFailed = true;
4198
+ updateError = error;
4199
+ }
4200
+ if (skillManager) {
4201
+ try {
4202
+ skillManager.suppressNextSlashReload();
4203
+ await skillManager.notifyConfigChanged();
4204
+ } catch (error) {
4205
+ if (!updateFailed) throw error;
4206
+ debugLogger6.error(
4207
+ "SkillManager refresh failed after command update failure:",
4208
+ error
4209
+ );
4210
+ }
4211
+ }
4212
+ if (updateFailed) throw updateError;
4213
+ }
4214
+ async sendAvailableCommandsUpdateOrThrow() {
4215
+ const { availableCommands, availableSkills, availableSkillDetails } = await buildAvailableCommandsSnapshot(
4216
+ this.config,
4217
+ void 0,
4218
+ this.settings
4219
+ );
4220
+ const update = {
4221
+ sessionUpdate: "available_commands_update",
4222
+ availableCommands,
4223
+ ...availableSkills !== void 0 ? {
4224
+ _meta: {
4225
+ availableSkills,
4226
+ ...availableSkillDetails ? { availableSkillDetails } : {}
4227
+ }
4228
+ } : {}
4229
+ };
4230
+ await this.sendUpdate(update);
4231
+ }
3924
4232
  /**
3925
4233
  * Requests permission from the client for a tool call.
3926
4234
  * Used by SubAgentTracker for sub-agent approval requests.
@@ -4212,6 +4520,17 @@ ${this.pendingWorktreeNotice}
4212
4520
  parts2.push(await recordSkippedToolCall(remainingCall, message));
4213
4521
  }
4214
4522
  }, "appendSkippedAfter");
4523
+ const memoryWriteCandidates = [];
4524
+ const collectMemoryWriteCandidates = /* @__PURE__ */ __name((result) => {
4525
+ if (result.memoryWriteCandidates) {
4526
+ memoryWriteCandidates.push(...result.memoryWriteCandidates);
4527
+ }
4528
+ }, "collectMemoryWriteCandidates");
4529
+ const refreshMemoryIfNeeded = /* @__PURE__ */ __name(async () => {
4530
+ await refreshMemoryAfterManagedWrite(this.config, memoryWriteCandidates, {
4531
+ logContext: `ACP session ${this.sessionId} memory tool batch`
4532
+ });
4533
+ }, "refreshMemoryIfNeeded");
4215
4534
  const runBounded = /* @__PURE__ */ __name(async (calls, runAbortSignal, onStopAfterPermissionCancel, onStopAfterLoopDetected, shouldSkipUnstarted) => {
4216
4535
  const configuredMaxConcurrency = parsePositiveIntegerEnv(
4217
4536
  process.env["QWEN_CODE_MAX_TOOL_CONCURRENCY"],
@@ -4325,103 +4644,117 @@ ${this.pendingWorktreeNotice}
4325
4644
  return results;
4326
4645
  }, "runBounded");
4327
4646
  const parts = [];
4328
- for (const batch of batches) {
4329
- if (batch.kind === "duplicate") {
4330
- await emitDuplicateBatch(batch);
4331
- parts.push(...batch.response.responseParts);
4332
- continue;
4333
- }
4334
- if (batch.concurrent && batch.calls.length > 1) {
4335
- const batchAbortController = new AbortController();
4336
- let batchStopAfterPermissionCancel = false;
4337
- const propagateAbort = /* @__PURE__ */ __name(() => {
4338
- batchAbortController.abort(abortSignal.reason);
4339
- }, "propagateAbort");
4340
- if (abortSignal.aborted) {
4341
- propagateAbort();
4342
- } else {
4343
- abortSignal.addEventListener("abort", propagateAbort, {
4344
- once: true
4345
- });
4346
- }
4347
- const stopBatchAfterPermissionCancel = /* @__PURE__ */ __name(() => {
4348
- batchStopAfterPermissionCancel = true;
4349
- batchAbortController.abort(USER_CANCEL_ABORT_REASON);
4350
- }, "stopBatchAfterPermissionCancel");
4351
- let results;
4352
- try {
4353
- results = await runBounded(
4354
- batch.calls,
4355
- batchAbortController.signal,
4356
- stopBatchAfterPermissionCancel,
4357
- () => batchAbortController.abort("loop_detected"),
4358
- () => batchStopAfterPermissionCancel
4359
- );
4360
- } finally {
4361
- abortSignal.removeEventListener("abort", propagateAbort);
4362
- }
4363
- let shouldStop = false;
4364
- let shouldStopForLoop = false;
4365
- for (const r of results) {
4366
- parts.push(...r.parts);
4367
- shouldStop ||= r.stopAfterPermissionCancel;
4368
- shouldStopForLoop ||= r.loopDetected === true;
4369
- }
4370
- if (shouldStopForLoop) {
4371
- await appendSkippedAfter(
4372
- parts,
4373
- batch.calls[batch.calls.length - 1],
4374
- LOOP_DETECTED_SKIP_MESSAGE
4375
- );
4376
- return {
4377
- parts,
4378
- stopAfterPermissionCancel: false,
4379
- loopDetected: true
4380
- };
4381
- }
4382
- if (shouldStop) {
4383
- await appendSkippedAfter(parts, batch.calls[batch.calls.length - 1]);
4384
- return {
4385
- parts,
4386
- stopAfterPermissionCancel: true,
4387
- repeatedDuplicateProviderToolCall: false
4388
- };
4647
+ try {
4648
+ for (const batch of batches) {
4649
+ if (batch.kind === "duplicate") {
4650
+ await emitDuplicateBatch(batch);
4651
+ parts.push(...batch.response.responseParts);
4652
+ continue;
4389
4653
  }
4390
- } else {
4391
- for (const fc of batch.calls) {
4392
- const r = await this.runTool(
4393
- abortSignal,
4394
- promptId,
4395
- fc,
4396
- void 0,
4397
- toolLoopState,
4398
- recordSkippedToolCall
4399
- );
4400
- parts.push(...r.parts);
4401
- if (r.loopDetected) {
4402
- await appendSkippedAfter(parts, fc, LOOP_DETECTED_SKIP_MESSAGE);
4654
+ if (batch.concurrent && batch.calls.length > 1) {
4655
+ const batchAbortController = new AbortController();
4656
+ let batchStopAfterPermissionCancel = false;
4657
+ const propagateAbort = /* @__PURE__ */ __name(() => {
4658
+ batchAbortController.abort(abortSignal.reason);
4659
+ }, "propagateAbort");
4660
+ if (abortSignal.aborted) {
4661
+ propagateAbort();
4662
+ } else {
4663
+ abortSignal.addEventListener("abort", propagateAbort, {
4664
+ once: true
4665
+ });
4666
+ }
4667
+ const stopBatchAfterPermissionCancel = /* @__PURE__ */ __name(() => {
4668
+ batchStopAfterPermissionCancel = true;
4669
+ batchAbortController.abort(USER_CANCEL_ABORT_REASON);
4670
+ }, "stopBatchAfterPermissionCancel");
4671
+ let results;
4672
+ try {
4673
+ results = await runBounded(
4674
+ batch.calls,
4675
+ batchAbortController.signal,
4676
+ stopBatchAfterPermissionCancel,
4677
+ () => batchAbortController.abort("loop_detected"),
4678
+ () => batchStopAfterPermissionCancel
4679
+ );
4680
+ } finally {
4681
+ abortSignal.removeEventListener("abort", propagateAbort);
4682
+ }
4683
+ let shouldStop = false;
4684
+ let shouldStopForLoop = false;
4685
+ for (const r of results) {
4686
+ parts.push(...r.parts);
4687
+ collectMemoryWriteCandidates(r);
4688
+ shouldStop ||= r.stopAfterPermissionCancel;
4689
+ shouldStopForLoop ||= r.loopDetected === true;
4690
+ }
4691
+ if (shouldStopForLoop) {
4692
+ await appendSkippedAfter(
4693
+ parts,
4694
+ batch.calls[batch.calls.length - 1],
4695
+ LOOP_DETECTED_SKIP_MESSAGE
4696
+ );
4403
4697
  return {
4404
4698
  parts,
4405
4699
  stopAfterPermissionCancel: false,
4406
- loopDetected: true
4700
+ loopDetected: true,
4701
+ memoryWriteCandidates
4407
4702
  };
4408
4703
  }
4409
- if (r.stopAfterPermissionCancel) {
4410
- await appendSkippedAfter(parts, fc);
4704
+ if (shouldStop) {
4705
+ await appendSkippedAfter(
4706
+ parts,
4707
+ batch.calls[batch.calls.length - 1]
4708
+ );
4411
4709
  return {
4412
4710
  parts,
4413
4711
  stopAfterPermissionCancel: true,
4414
- repeatedDuplicateProviderToolCall: false
4712
+ repeatedDuplicateProviderToolCall: false,
4713
+ memoryWriteCandidates
4415
4714
  };
4416
4715
  }
4716
+ } else {
4717
+ for (const fc of batch.calls) {
4718
+ const r = await this.runTool(
4719
+ abortSignal,
4720
+ promptId,
4721
+ fc,
4722
+ void 0,
4723
+ toolLoopState,
4724
+ recordSkippedToolCall
4725
+ );
4726
+ parts.push(...r.parts);
4727
+ collectMemoryWriteCandidates(r);
4728
+ if (r.loopDetected) {
4729
+ await appendSkippedAfter(parts, fc, LOOP_DETECTED_SKIP_MESSAGE);
4730
+ return {
4731
+ parts,
4732
+ stopAfterPermissionCancel: false,
4733
+ loopDetected: true,
4734
+ memoryWriteCandidates
4735
+ };
4736
+ }
4737
+ if (r.stopAfterPermissionCancel) {
4738
+ await appendSkippedAfter(parts, fc);
4739
+ return {
4740
+ parts,
4741
+ stopAfterPermissionCancel: true,
4742
+ repeatedDuplicateProviderToolCall: false,
4743
+ memoryWriteCandidates
4744
+ };
4745
+ }
4746
+ }
4417
4747
  }
4418
4748
  }
4749
+ return {
4750
+ parts,
4751
+ stopAfterPermissionCancel: false,
4752
+ repeatedDuplicateProviderToolCall: false,
4753
+ memoryWriteCandidates
4754
+ };
4755
+ } finally {
4756
+ await refreshMemoryIfNeeded();
4419
4757
  }
4420
- return {
4421
- parts,
4422
- stopAfterPermissionCancel: false,
4423
- repeatedDuplicateProviderToolCall: false
4424
- };
4425
4758
  }
4426
4759
  /**
4427
4760
  * Assemble the per-turn system reminders the model needs to see at the
@@ -4936,27 +5269,64 @@ ${this.pendingWorktreeNotice}
4936
5269
  }
4937
5270
  const execSpan = startToolExecutionSpan();
4938
5271
  let toolResult;
5272
+ let isExecutionTimeout = false;
5273
+ let aborted = false;
5274
+ let toolSettled = false;
5275
+ let heartbeatCount = 0;
5276
+ let lastHeartbeat;
5277
+ const onToolProgress = /* @__PURE__ */ __name((chunk) => {
5278
+ if (toolSettled || !isShellProgressData(chunk)) {
5279
+ return;
5280
+ }
5281
+ heartbeatCount++;
5282
+ lastHeartbeat = chunk;
5283
+ void this.sendUpdate({
5284
+ sessionUpdate: "tool_call_update",
5285
+ toolCallId: callId,
5286
+ status: "in_progress",
5287
+ _meta: { toolName, shellProgress: chunk }
5288
+ }).catch((err) => {
5289
+ debugLogger6.debug(
5290
+ `[Session.runTool] heartbeat update failed for ${callId}: ${err}`
5291
+ );
5292
+ });
5293
+ }, "onToolProgress");
5294
+ const heartbeatSpanAttributes = /* @__PURE__ */ __name(() => heartbeatCount > 0 ? {
5295
+ attributes: {
5296
+ "shell.heartbeat_count": heartbeatCount,
5297
+ ...lastHeartbeat?.lastOutputAgeMs !== void 0 && {
5298
+ "shell.last_output_age_ms": lastHeartbeat.lastOutputAgeMs
5299
+ }
5300
+ }
5301
+ } : void 0, "heartbeatSpanAttributes");
4939
5302
  try {
4940
5303
  const sleepInhibitorHandle = acquireSleepInhibitor(
4941
5304
  this.config,
4942
5305
  `Qwen Code is executing tool ${toolName}`
4943
5306
  );
4944
5307
  try {
4945
- toolResult = await invocation.execute(activeToolAbortSignal);
5308
+ toolResult = await invocation.execute(
5309
+ activeToolAbortSignal,
5310
+ onToolProgress
5311
+ );
4946
5312
  } finally {
5313
+ toolSettled = true;
4947
5314
  sleepInhibitorHandle.release();
4948
5315
  }
4949
- const aborted2 = activeToolAbortSignal.aborted;
5316
+ isExecutionTimeout = toolResult.error?.type === "execution_timeout" /* EXECUTION_TIMEOUT */;
5317
+ aborted = activeToolAbortSignal.aborted && !isExecutionTimeout;
4950
5318
  endToolExecutionSpan(execSpan, {
4951
- success: !toolResult.error && !aborted2,
4952
- error: aborted2 ? "tool_cancelled" : toolResult.error ? "tool_error" : void 0,
4953
- cancelled: aborted2
5319
+ success: !toolResult.error && !aborted,
5320
+ error: aborted ? "tool_cancelled" : isExecutionTimeout ? "tool_timeout" : toolResult.error ? "tool_error" : void 0,
5321
+ cancelled: aborted,
5322
+ ...heartbeatSpanAttributes()
4954
5323
  });
4955
5324
  } catch (execError) {
4956
5325
  endToolExecutionSpan(execSpan, {
4957
5326
  success: false,
4958
5327
  error: activeToolAbortSignal.aborted ? "tool_cancelled" : "tool_exception",
4959
- cancelled: activeToolAbortSignal.aborted
5328
+ cancelled: activeToolAbortSignal.aborted,
5329
+ ...heartbeatSpanAttributes()
4960
5330
  });
4961
5331
  throw execError;
4962
5332
  }
@@ -4967,12 +5337,16 @@ ${this.pendingWorktreeNotice}
4967
5337
  currentModeId: this.config.getApprovalMode()
4968
5338
  });
4969
5339
  }
4970
- const responseParts = convertToFunctionResponse(
5340
+ const responseParts = toolResult.error ? convertToFunctionErrorResponse(
5341
+ toolName,
5342
+ callId,
5343
+ toolResult.llmContent,
5344
+ toolResult.error.message
5345
+ ) : convertToFunctionResponse(
4971
5346
  toolName,
4972
5347
  callId,
4973
5348
  toolResult.llmContent
4974
5349
  );
4975
- const aborted = activeToolAbortSignal.aborted;
4976
5350
  const status = aborted ? "cancelled" : toolResult.error ? "error" : "success";
4977
5351
  const succeeded = status === "success";
4978
5352
  const responseError = toolResult.error ? new Error(toolResult.error.message) : aborted ? new Error("Tool execution was cancelled") : void 0;
@@ -5082,7 +5456,14 @@ ${this.pendingWorktreeNotice}
5082
5456
  }
5083
5457
  return {
5084
5458
  parts: responseParts,
5085
- stopAfterPermissionCancel: nestedPermissionCancelled
5459
+ stopAfterPermissionCancel: nestedPermissionCancelled,
5460
+ memoryWriteCandidates: status === "success" ? [
5461
+ {
5462
+ toolName,
5463
+ args,
5464
+ status
5465
+ }
5466
+ ] : void 0
5086
5467
  };
5087
5468
  } catch (e) {
5088
5469
  cleanupAgentToolResources();
@@ -5203,7 +5584,7 @@ ${this.pendingWorktreeNotice}
5203
5584
  throw new Error(result.content || "Slash command failed.");
5204
5585
  }
5205
5586
  const rendered = (result.content || "").replace(/\n/g, " \n");
5206
- await this.messageEmitter.emitAgentMessage(rendered);
5587
+ await this.messageEmitter.emitSlashCommandOutput(rendered);
5207
5588
  this.config.getChatRecordingService()?.recordSlashCommand({
5208
5589
  phase: "result",
5209
5590
  rawCommand: originalPrompt.filter((b) => b.type === "text").map((b) => b.type === "text" ? b.text : "").join(" "),
@@ -5219,7 +5600,7 @@ ${this.pendingWorktreeNotice}
5219
5600
  if (msg.messageType === "error") {
5220
5601
  throw new Error(msg.content || "Slash command failed.");
5221
5602
  }
5222
- await this.messageEmitter.emitAgentMessage(
5603
+ await this.messageEmitter.emitSlashCommandOutput(
5223
5604
  (msg.content || "").replace(/\n/g, " \n")
5224
5605
  );
5225
5606
  chunks.push(msg.content || "");
@@ -5242,7 +5623,8 @@ ${this.pendingWorktreeNotice}
5242
5623
  case "no_command":
5243
5624
  return this.#resolvePrompt(
5244
5625
  originalPrompt,
5245
- new AbortController().signal
5626
+ new AbortController().signal,
5627
+ { promptLast: true }
5246
5628
  );
5247
5629
  default: {
5248
5630
  const _exhaustive = result;
@@ -5251,7 +5633,7 @@ ${this.pendingWorktreeNotice}
5251
5633
  }
5252
5634
  }
5253
5635
  }
5254
- async #resolvePrompt(message, abortSignal) {
5636
+ async #resolvePrompt(message, abortSignal, options = {}) {
5255
5637
  const FILE_URI_SCHEME = "file://";
5256
5638
  const embeddedContext = [];
5257
5639
  const extensionMentions = /* @__PURE__ */ new Map();
@@ -5341,7 +5723,7 @@ ${this.pendingWorktreeNotice}
5341
5723
  initialQueryText += `@${pathName}`;
5342
5724
  }
5343
5725
  }
5344
- const processedQueryParts = [];
5726
+ const referenceParts = [...extensionParts, ...mcpServerParts];
5345
5727
  if (pathSpecsToRead.length > 0) {
5346
5728
  const readResult = await readManyFiles(this.config, {
5347
5729
  paths: pathSpecsToRead,
@@ -5349,26 +5731,19 @@ ${this.pendingWorktreeNotice}
5349
5731
  ...preserveUnsupportedImageForBridge ? { preserveUnsupportedImageForBridge } : {}
5350
5732
  });
5351
5733
  const contentParts = Array.isArray(readResult.contentParts) ? readResult.contentParts : [readResult.contentParts];
5352
- processedQueryParts.push({ text: initialQueryText });
5353
- processedQueryParts.push(...extensionParts);
5354
- processedQueryParts.push(...mcpServerParts);
5355
5734
  for (const part of contentParts) {
5356
5735
  if (typeof part === "string") {
5357
- processedQueryParts.push({ text: part });
5736
+ referenceParts.push({ text: part });
5358
5737
  } else if (preserveUnsupportedImageForBridge && hasImageParts([part])) {
5359
- processedQueryParts.push(part);
5738
+ referenceParts.push(part);
5360
5739
  } else {
5361
- processedQueryParts.push(clampInlineMediaPart(part));
5740
+ referenceParts.push(clampInlineMediaPart(part));
5362
5741
  }
5363
5742
  }
5364
- } else {
5365
- processedQueryParts.push({ text: initialQueryText.trim() });
5366
- processedQueryParts.push(...extensionParts);
5367
- processedQueryParts.push(...mcpServerParts);
5368
5743
  }
5369
5744
  for (const contextPart of embeddedContext) {
5370
5745
  if ("text" in contextPart && contextPart.text) {
5371
- processedQueryParts.push({
5746
+ referenceParts.push({
5372
5747
  text: `File: ${contextPart.uri}
5373
5748
  ${contextPart.text}`
5374
5749
  });
@@ -5380,11 +5755,14 @@ ${contextPart.text}`
5380
5755
  data: contextPart.blob
5381
5756
  }
5382
5757
  };
5383
- processedQueryParts.push(
5758
+ referenceParts.push(
5384
5759
  preserveUnsupportedImageForBridge && hasImageParts([inlinePart]) ? inlinePart : clampInlineMediaPart(inlinePart)
5385
5760
  );
5386
5761
  }
5387
5762
  }
5763
+ const promptText = pathSpecsToRead.length > 0 ? initialQueryText : initialQueryText.trim();
5764
+ const promptPart = { text: promptText };
5765
+ const processedQueryParts = options.promptLast ? [...referenceParts, promptPart] : [promptPart, ...referenceParts];
5388
5766
  return this.#applyBridgeConversionsIfNeeded(
5389
5767
  processedQueryParts,
5390
5768
  abortSignal
@@ -5418,7 +5796,7 @@ ${contextPart.text}`
5418
5796
  if (bridgeResult.status !== "skipped" || bridgeResult.egressOccurred) {
5419
5797
  try {
5420
5798
  await this.messageEmitter.emitAgentMessage(
5421
- this.#formatVisionBridgeNotice(bridgeResult)
5799
+ formatVisionBridgeNotice(bridgeResult)
5422
5800
  );
5423
5801
  } catch (error) {
5424
5802
  debugLogger6.debug(
@@ -5527,20 +5905,6 @@ ${contextPart.text}`
5527
5905
  #formatVoiceBridgeEgressNotice(modelId, audioCount) {
5528
5906
  return `Sent ${audioCount} audio file(s) to ${modelId} for transcription, but no transcript was produced.`;
5529
5907
  }
5530
- #formatVisionBridgeNotice(result) {
5531
- const modelName = result.modelId ?? "vision model";
5532
- const target = result.modelEndpoint ? `${modelName} (${result.modelEndpoint})` : modelName;
5533
- const egressNote = result.egressOccurred ? ` Your image and prompt/context were sent to ${target}.` : "";
5534
- if (result.status === "failed") {
5535
- const reason = result.egressOccurred ? "the vision model request failed" : "the vision bridge could not run";
5536
- return `Vision bridge (${modelName}) failed: ${reason}.${egressNote} The image was not interpreted.`;
5537
- }
5538
- if (result.status === "skipped") {
5539
- return `Vision bridge cancelled.${egressNote}`;
5540
- }
5541
- const omitted = result.omittedCount > 0 ? ` (${result.omittedCount} image(s) omitted)` : "";
5542
- return `Converted ${result.convertedCount} image(s)${omitted} to text via ${target}. Your image and prompt/context were sent to that model.`;
5543
- }
5544
5908
  async #resolveExtensionMentionParts(extensionMentions, abortSignal) {
5545
5909
  if (extensionMentions.size === 0) return [];
5546
5910
  const activeExtensions = this.config.getActiveExtensions?.() ?? [];
@@ -5830,132 +6194,6 @@ function isBulkLoadReplayRequest(params) {
5830
6194
  return meta?.[LOAD_REPLAY_MODE_META_KEY] === LOAD_REPLAY_BULK_MODE;
5831
6195
  }
5832
6196
  __name(isBulkLoadReplayRequest, "isBulkLoadReplayRequest");
5833
- function createReplayCumulativeUsage() {
5834
- return {
5835
- promptTokens: 0,
5836
- cachedTokens: 0,
5837
- candidateTokens: 0,
5838
- apiTimeMs: 0
5839
- };
5840
- }
5841
- __name(createReplayCumulativeUsage, "createReplayCumulativeUsage");
5842
- function copyCumulativeUsage(target, source) {
5843
- target.promptTokens = source.promptTokens;
5844
- target.cachedTokens = source.cachedTokens;
5845
- target.candidateTokens = source.candidateTokens;
5846
- target.apiTimeMs = source.apiTimeMs;
5847
- }
5848
- __name(copyCumulativeUsage, "copyCumulativeUsage");
5849
- function isCumulativeUsage(value) {
5850
- if (!isObjectRecord(value)) return false;
5851
- return typeof value["promptTokens"] === "number" && Number.isFinite(value["promptTokens"]) && typeof value["cachedTokens"] === "number" && Number.isFinite(value["cachedTokens"]) && typeof value["candidateTokens"] === "number" && Number.isFinite(value["candidateTokens"]) && typeof value["apiTimeMs"] === "number" && Number.isFinite(value["apiTimeMs"]);
5852
- }
5853
- __name(isCumulativeUsage, "isCumulativeUsage");
5854
- function isPendingReplayToolCall(value) {
5855
- if (!isObjectRecord(value)) return false;
5856
- return typeof value["callId"] === "string" && typeof value["toolName"] === "string" && (value["timestamp"] === void 0 || typeof value["timestamp"] === "string") && typeof value["recordId"] === "string";
5857
- }
5858
- __name(isPendingReplayToolCall, "isPendingReplayToolCall");
5859
- function parseTranscriptReplayState(replay) {
5860
- if (!isObjectRecord(replay)) {
5861
- return {
5862
- pendingToolCalls: [],
5863
- cumulativeUsage: createReplayCumulativeUsage()
5864
- };
5865
- }
5866
- const rawPending = replay["pendingToolCalls"];
5867
- const pendingToolCalls = Array.isArray(rawPending) ? rawPending.filter(isPendingReplayToolCall) : [];
5868
- if (Array.isArray(rawPending) && pendingToolCalls.length !== rawPending.length) {
5869
- const dropped = rawPending.length - pendingToolCalls.length;
5870
- debugLogger7.warn(
5871
- `[transcript] replay state dropped ${dropped} of ${rawPending.length} malformed pending tool calls`
5872
- );
5873
- }
5874
- const cumulativeUsage = isCumulativeUsage(replay["cumulativeUsage"]) ? { ...replay["cumulativeUsage"] } : createReplayCumulativeUsage();
5875
- return { pendingToolCalls, cumulativeUsage };
5876
- }
5877
- __name(parseTranscriptReplayState, "parseTranscriptReplayState");
5878
- async function collectHistoryReplayUpdates({
5879
- sessionId,
5880
- config,
5881
- records,
5882
- gaps,
5883
- cumulativeUsage
5884
- }) {
5885
- const updates = [];
5886
- const replayContext = {
5887
- sessionId,
5888
- config,
5889
- sendUpdate: /* @__PURE__ */ __name(async (update) => {
5890
- updates.push(update);
5891
- }, "sendUpdate"),
5892
- cumulativeUsage
5893
- };
5894
- try {
5895
- await new HistoryReplayer(replayContext).replay(records, gaps);
5896
- } catch (error) {
5897
- const replayError = error instanceof Error ? error.message : String(error);
5898
- debugLogger7.warn(
5899
- "[historyReplay] History replay failed for session %s (partial updates: %d):",
5900
- sessionId,
5901
- updates.length,
5902
- error
5903
- );
5904
- return { updates, replayError };
5905
- }
5906
- return { updates };
5907
- }
5908
- __name(collectHistoryReplayUpdates, "collectHistoryReplayUpdates");
5909
- async function collectHistoryReplayUpdatesPage({
5910
- sessionId,
5911
- config,
5912
- records,
5913
- gaps,
5914
- cumulativeUsage,
5915
- pendingToolCalls,
5916
- finalizeDangling
5917
- }) {
5918
- const updates = [];
5919
- const replayContext = {
5920
- sessionId,
5921
- config,
5922
- sendUpdate: /* @__PURE__ */ __name(async (update) => {
5923
- updates.push(update);
5924
- }, "sendUpdate"),
5925
- cumulativeUsage
5926
- };
5927
- const replayer = new HistoryReplayer(replayContext);
5928
- try {
5929
- const state = await replayer.replayPage(records, {
5930
- pendingToolCalls,
5931
- finalizeDangling,
5932
- gaps
5933
- });
5934
- return { updates, pendingToolCalls: state.pendingToolCalls };
5935
- } catch (error) {
5936
- debugLogger7.warn(
5937
- "[historyReplay] Paged history replay failed for session %s (partial updates: %d):",
5938
- sessionId,
5939
- updates.length,
5940
- error
5941
- );
5942
- return {
5943
- updates,
5944
- pendingToolCalls: replayer.getPendingToolCalls(),
5945
- replayError: "Replay conversion failed for this page"
5946
- };
5947
- }
5948
- }
5949
- __name(collectHistoryReplayUpdatesPage, "collectHistoryReplayUpdatesPage");
5950
- function liftSessionUpdateTimestamps(updates) {
5951
- return updates.map((update) => {
5952
- const record = update;
5953
- const meta = record["_meta"];
5954
- const timestamp = isObjectRecord(meta) ? meta["timestamp"] : void 0;
5955
- return typeof timestamp === "number" || typeof timestamp === "string" ? { ...record, timestamp } : update;
5956
- });
5957
- }
5958
- __name(liftSessionUpdateTimestamps, "liftSessionUpdateTimestamps");
5959
6197
  function createHiddenWorkspaceMemoryConfig(config) {
5960
6198
  return new Proxy(config, {
5961
6199
  get(target, prop) {
@@ -6013,6 +6251,10 @@ var QWEN_CORE_SETTING_DEFINITIONS = {
6013
6251
  "general.showSessionRecap": { type: "boolean" },
6014
6252
  "general.sessionRecapAwayThresholdMinutes": { type: "number", min: 1 },
6015
6253
  "general.terminalBell": { type: "boolean" },
6254
+ "general.notificationMode": {
6255
+ type: "enum",
6256
+ values: ["all", "task-complete"]
6257
+ },
6016
6258
  "general.gitCoAuthor.commit": { type: "boolean" },
6017
6259
  "general.gitCoAuthor.pr": { type: "boolean" },
6018
6260
  "general.defaultFileEncoding": {
@@ -6037,7 +6279,7 @@ var QWEN_HOOK_EVENTS = Object.values(HookEventName);
6037
6279
  var DEFAULT_QWEN_MEMORY_SETTINGS = {
6038
6280
  enableManagedAutoMemory: true,
6039
6281
  enableManagedAutoDream: true,
6040
- enableAutoSkill: true,
6282
+ enableAutoSkill: false,
6041
6283
  autoSkillConfirm: true,
6042
6284
  enableTeamMemory: false,
6043
6285
  enableTeamMemorySync: false
@@ -7643,6 +7885,7 @@ var QwenAgent = class {
7643
7885
  __name(this, "QwenAgent");
7644
7886
  }
7645
7887
  sessions = /* @__PURE__ */ new Map();
7888
+ generationControllers = /* @__PURE__ */ new Map();
7646
7889
  transcriptReplayConfigCache = /* @__PURE__ */ new Map();
7647
7890
  clientCapabilities;
7648
7891
  // CPU-usage delta baseline for the daemon's `workspaceResource` extMethod
@@ -7697,6 +7940,11 @@ var QwenAgent = class {
7697
7940
  }
7698
7941
  }
7699
7942
  async closeStoredSession(sessionId, opts) {
7943
+ for (const [requestId, generation] of this.generationControllers) {
7944
+ if (generation.sessionId !== sessionId) continue;
7945
+ generation.controller.abort();
7946
+ this.generationControllers.delete(requestId);
7947
+ }
7700
7948
  const session = this.sessions.get(sessionId);
7701
7949
  if (!session) {
7702
7950
  this.mcpPool?.releaseSession(sessionId);
@@ -7775,6 +8023,10 @@ var QwenAgent = class {
7775
8023
  this.sessions.delete(sessionId);
7776
8024
  }
7777
8025
  disposeSessions() {
8026
+ for (const generation of this.generationControllers.values()) {
8027
+ generation.controller.abort();
8028
+ }
8029
+ this.generationControllers.clear();
7778
8030
  for (const session of this.sessions.values()) {
7779
8031
  session.dispose();
7780
8032
  }
@@ -7809,7 +8061,7 @@ var QwenAgent = class {
7809
8061
  async initialize(args) {
7810
8062
  this.clientCapabilities = args.clientCapabilities;
7811
8063
  const authMethods = buildAuthMethods();
7812
- const version = "0.19.9";
8064
+ const version = "0.19.10-nightly.20260716.506ce0a1a";
7813
8065
  return {
7814
8066
  protocolVersion: PROTOCOL_VERSION,
7815
8067
  agentInfo: {
@@ -7933,9 +8185,10 @@ var QwenAgent = class {
7933
8185
  config,
7934
8186
  records,
7935
8187
  gaps: sessionData?.historyGaps,
7936
- cumulativeUsage: replayUsage
8188
+ cumulativeUsage: replayUsage,
8189
+ logger: debugLogger7
7937
8190
  });
7938
- replayUpdates = liftSessionUpdateTimestamps(replay.updates);
8191
+ replayUpdates = replay.updates;
7939
8192
  copyCumulativeUsage(session.cumulativeUsage, replayUsage);
7940
8193
  if (replay.replayError !== void 0) {
7941
8194
  replayEnvelope = {
@@ -9191,6 +9444,19 @@ var QwenAgent = class {
9191
9444
  }
9192
9445
  return session;
9193
9446
  }
9447
+ async refreshLiveSessionMemoryInstructions(logContext) {
9448
+ const sessions = [...this.sessions.values()];
9449
+ if (sessions.length === 0) {
9450
+ return;
9451
+ }
9452
+ await Promise.all(
9453
+ sessions.map(
9454
+ (session) => refreshMemoryInstruction(session.getConfig(), {
9455
+ logContext: `${logContext} session ${session.getId()}`
9456
+ })
9457
+ )
9458
+ );
9459
+ }
9194
9460
  buildSessionContextStatus(sessionId) {
9195
9461
  const session = this.sessionOrThrow(sessionId);
9196
9462
  const config = session.getConfig();
@@ -10041,43 +10307,25 @@ var QwenAgent = class {
10041
10307
  ...typeof rawLimit === "number" ? { limit: rawLimit } : {}
10042
10308
  });
10043
10309
  const config = await this.getTranscriptReplayConfig(cwd, settings);
10044
- const replayState = parseTranscriptReplayState(page.replay);
10045
- const replay = await collectHistoryReplayUpdatesPage({
10310
+ const replay = await replayTranscriptRecordPage({
10046
10311
  sessionId,
10312
+ page,
10047
10313
  config,
10048
- records: page.records,
10049
- gaps: page.gaps,
10050
- cumulativeUsage: replayState.cumulativeUsage,
10051
- pendingToolCalls: replayState.pendingToolCalls,
10052
- finalizeDangling: !page.hasMore
10314
+ encodeCursor: /* @__PURE__ */ __name((state) => encodeSessionTranscriptCursor(state, cwd), "encodeCursor"),
10315
+ logger: debugLogger7
10053
10316
  });
10054
- const updates = liftSessionUpdateTimestamps(replay.updates);
10055
- let nextCursor;
10056
- if (page.nextCursorState && replay.replayError === void 0) {
10057
- const nextCursorState = {
10058
- ...page.nextCursorState,
10059
- replay: {
10060
- pendingToolCalls: replay.pendingToolCalls,
10061
- // Preserved for future replay emitters that need cumulative
10062
- // usage across page boundaries; current frames expose per-record
10063
- // usage metadata only.
10064
- cumulativeUsage: replayState.cumulativeUsage
10065
- }
10066
- };
10067
- nextCursor = encodeSessionTranscriptCursor(nextCursorState, cwd);
10068
- }
10069
10317
  return {
10070
10318
  v: 1,
10071
10319
  sessionId,
10072
- events: updates.map((update) => ({
10320
+ events: replay.updates.map((update) => ({
10073
10321
  v: 1,
10074
10322
  type: "session_update",
10075
10323
  data: update
10076
10324
  })),
10077
- ...nextCursor !== void 0 ? { nextCursor } : {},
10078
- hasMore: page.hasMore,
10079
- startTime: page.startTime,
10080
- lastUpdated: page.lastUpdated,
10325
+ ...replay.nextCursor !== void 0 ? { nextCursor: replay.nextCursor } : {},
10326
+ hasMore: replay.hasMore,
10327
+ startTime: replay.startTime,
10328
+ lastUpdated: replay.lastUpdated,
10081
10329
  ...replay.replayError !== void 0 ? { partial: true, replayError: replay.replayError } : {}
10082
10330
  };
10083
10331
  });
@@ -10228,6 +10476,11 @@ var QwenAgent = class {
10228
10476
  contextMode,
10229
10477
  abortSignal: childSignal
10230
10478
  });
10479
+ if (result.filesTouched.length > 0) {
10480
+ await this.refreshLiveSessionMemoryInstructions(
10481
+ "workspace memory remember"
10482
+ );
10483
+ }
10231
10484
  return result;
10232
10485
  } catch (err) {
10233
10486
  if (err instanceof RequestError) {
@@ -10806,8 +11059,7 @@ var QwenAgent = class {
10806
11059
  const recording = session.getConfig().getChatRecordingService();
10807
11060
  let ok = false;
10808
11061
  if (recording) {
10809
- ok = recording.recordCustomTitle(displayName, source);
10810
- await recording.flush();
11062
+ ok = await recording.recordCustomTitle(displayName, source);
10811
11063
  }
10812
11064
  return { sessionId, displayName, titleSource: source, persisted: ok };
10813
11065
  }
@@ -10834,6 +11086,39 @@ var QwenAgent = class {
10834
11086
  }
10835
11087
  return { sessionId, parentSessionId, persisted: ok };
10836
11088
  }
11089
+ case SERVE_CONTROL_EXT_METHODS.sessionSource: {
11090
+ const sessionId = params["sessionId"];
11091
+ const sourceType = params["sourceType"];
11092
+ const sourceId = params["sourceId"];
11093
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
11094
+ throw RequestError.invalidParams(
11095
+ void 0,
11096
+ "Invalid or missing sessionId"
11097
+ );
11098
+ }
11099
+ const source = parseSessionSource(sourceType, sourceId);
11100
+ if ("error" in source || source.sourceType === void 0) {
11101
+ throw RequestError.invalidParams(
11102
+ void 0,
11103
+ "error" in source ? source.error : "Invalid or missing sourceType"
11104
+ );
11105
+ }
11106
+ const session = this.sessionOrThrow(sessionId);
11107
+ const recording = session.getConfig().getChatRecordingService();
11108
+ let ok = false;
11109
+ if (recording) {
11110
+ ok = await recording.recordSessionSource(
11111
+ source.sourceType,
11112
+ source.sourceId
11113
+ );
11114
+ }
11115
+ return {
11116
+ sessionId,
11117
+ sourceType: source.sourceType,
11118
+ ...source.sourceId !== void 0 ? { sourceId: source.sourceId } : {},
11119
+ persisted: ok
11120
+ };
11121
+ }
10837
11122
  case SERVE_CONTROL_EXT_METHODS.sessionClose: {
10838
11123
  const sessionId = params["sessionId"];
10839
11124
  if (typeof sessionId !== "string" || sessionId.length === 0) {
@@ -11076,6 +11361,64 @@ var QwenAgent = class {
11076
11361
  );
11077
11362
  return { sessionId, recap };
11078
11363
  }
11364
+ case SERVE_CONTROL_EXT_METHODS.sessionGenerationStart: {
11365
+ const sessionId = params["sessionId"];
11366
+ const requestId = params["requestId"];
11367
+ const prompt = params["prompt"];
11368
+ if (typeof sessionId !== "string" || typeof requestId !== "string" || typeof prompt !== "string" || prompt.trim().length === 0 || Buffer.byteLength(prompt, "utf8") > GENERATION_MAX_PROMPT_BYTES) {
11369
+ throw RequestError.invalidParams(
11370
+ void 0,
11371
+ "Invalid generation request"
11372
+ );
11373
+ }
11374
+ if (this.generationControllers.has(requestId)) {
11375
+ throw RequestError.invalidParams(
11376
+ void 0,
11377
+ "Duplicate generation requestId"
11378
+ );
11379
+ }
11380
+ const session = this.sessionOrThrow(sessionId);
11381
+ const controller = new AbortController();
11382
+ this.generationControllers.set(requestId, { sessionId, controller });
11383
+ const signal = AbortSignal.any([
11384
+ controller.signal,
11385
+ AbortSignal.timeout(GENERATION_TIMEOUT_MS)
11386
+ ]);
11387
+ try {
11388
+ const result = await executeGeneration(
11389
+ session.getConfig(),
11390
+ requestId,
11391
+ prompt,
11392
+ signal,
11393
+ async (event) => {
11394
+ await this.connection.extNotification(
11395
+ "qwen/notify/session/generation/event",
11396
+ { v: 1, sessionId, requestId, event }
11397
+ );
11398
+ }
11399
+ );
11400
+ return { sessionId, requestId, ...result };
11401
+ } finally {
11402
+ this.generationControllers.delete(requestId);
11403
+ }
11404
+ }
11405
+ case SERVE_CONTROL_EXT_METHODS.sessionGenerationCancel: {
11406
+ const sessionId = params["sessionId"];
11407
+ const requestId = params["requestId"];
11408
+ if (typeof sessionId !== "string" || typeof requestId !== "string") {
11409
+ throw RequestError.invalidParams(
11410
+ void 0,
11411
+ "Invalid generation cancellation request"
11412
+ );
11413
+ }
11414
+ const generation = this.generationControllers.get(requestId);
11415
+ const cancelled = generation?.sessionId === sessionId;
11416
+ if (cancelled) {
11417
+ generation.controller.abort();
11418
+ this.generationControllers.delete(requestId);
11419
+ }
11420
+ return { sessionId, requestId, cancelled };
11421
+ }
11079
11422
  case SERVE_CONTROL_EXT_METHODS.sessionBtw: {
11080
11423
  const sessionId = params["sessionId"];
11081
11424
  if (typeof sessionId !== "string" || sessionId.length === 0) {
@@ -11506,28 +11849,33 @@ ${outputText}
11506
11849
  case SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh: {
11507
11850
  const sessionId = params["sessionId"];
11508
11851
  const session = this.sessionOrThrow(sessionId);
11509
- const extensionManager = session.getConfig().getExtensionManager();
11510
- const skillManager = session.getConfig().getSkillManager();
11511
- await Promise.all([
11512
- extensionManager.refreshCache().catch((err) => {
11513
- debugLogger7.warn(
11514
- `Extension refresh failed for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
11515
- );
11516
- }),
11517
- skillManager?.refreshCache().catch((err) => {
11518
- debugLogger7.warn(
11519
- `Skill refresh failed after extension refresh for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
11520
- );
11521
- })
11522
- ]);
11523
- try {
11524
- await extensionManager.refreshTools();
11525
- } catch (err) {
11526
- debugLogger7.warn(
11527
- `Extension tool refresh failed for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
11852
+ const config = session.getConfig();
11853
+ const extensionManager = config.getExtensionManager();
11854
+ const errors = [];
11855
+ const runRefresh = /* @__PURE__ */ __name(async (refresh) => {
11856
+ try {
11857
+ await refresh();
11858
+ } catch (error) {
11859
+ errors.push(error);
11860
+ }
11861
+ }, "runRefresh");
11862
+ await runRefresh(async () => await extensionManager.refreshCache());
11863
+ await runRefresh(async () => await extensionManager.refreshTools());
11864
+ await runRefresh(
11865
+ async () => await config.getGeminiClient()?.refreshSystemInstruction()
11866
+ );
11867
+ await runRefresh(
11868
+ async () => await session.sendAvailableCommandsUpdate()
11869
+ );
11870
+ if (errors.length > 0) {
11871
+ const details = errors.map(
11872
+ (error) => error instanceof Error ? error.message : String(error)
11873
+ ).join("; ");
11874
+ throw new AggregateError(
11875
+ errors,
11876
+ `Extension runtime refresh failed: ${details}`
11528
11877
  );
11529
11878
  }
11530
- await session.sendAvailableCommandsUpdate();
11531
11879
  return { ok: true };
11532
11880
  }
11533
11881
  case "deleteSession": {
@@ -11571,8 +11919,7 @@ ${outputText}
11571
11919
  }
11572
11920
  const liveRecording = this.sessions.get(sessionId)?.getConfig().getChatRecordingService();
11573
11921
  if (liveRecording) {
11574
- const ok = liveRecording.recordCustomTitle(title, "manual");
11575
- await liveRecording.flush();
11922
+ const ok = await liveRecording.recordCustomTitle(title, "manual");
11576
11923
  return { success: ok };
11577
11924
  }
11578
11925
  const success = await runWithAcpRuntimeOutputDir(
@@ -11706,9 +12053,10 @@ ${outputText}
11706
12053
  };
11707
12054
  }
11708
12055
  } catch (err) {
11709
- artifactSnapshotUnavailable = err instanceof Error ? err.message : String(err);
12056
+ const reason = err instanceof Error ? err.message : String(err);
12057
+ artifactSnapshotUnavailable = "artifact snapshot unavailable after rewind";
11710
12058
  debugLogger7.warn(
11711
- `[ACP] Failed to rebuild artifact snapshot after rewind for session=${sessionId}: ${artifactSnapshotUnavailable}`
12059
+ `[ACP] Failed to rebuild artifact snapshot after rewind for session=${sessionId}: ${reason}`
11712
12060
  );
11713
12061
  }
11714
12062
  return {
@@ -11745,10 +12093,11 @@ ${outputText}
11745
12093
  config: this.config,
11746
12094
  records: sessionData.conversation.messages,
11747
12095
  gaps: sessionData.historyGaps,
11748
- cumulativeUsage: createReplayCumulativeUsage()
12096
+ cumulativeUsage: createReplayCumulativeUsage(),
12097
+ logger: debugLogger7
11749
12098
  });
11750
12099
  return {
11751
- updates: liftSessionUpdateTimestamps(replay.updates),
12100
+ updates: replay.updates,
11752
12101
  startTime: sessionData.conversation.startTime,
11753
12102
  lastUpdated: sessionData.conversation.lastUpdated,
11754
12103
  // Signal to the client that replay aborted partway so it doesn't
@@ -12166,6 +12515,29 @@ ${outputText}
12166
12515
  sessionsSkipped: skipped
12167
12516
  };
12168
12517
  }
12518
+ case SERVE_CONTROL_EXT_METHODS.workspaceSkillsRefresh: {
12519
+ this.settings.reloadScopeFromDisk("Workspace" /* Workspace */);
12520
+ const sessions = this.getActiveSessions();
12521
+ const results = await Promise.allSettled(
12522
+ sessions.map((session) => session.refreshSkillsFromSettings())
12523
+ );
12524
+ for (let i = 0; i < results.length; i++) {
12525
+ if (results[i].status === "rejected") {
12526
+ const reason = results[i].reason;
12527
+ debugLogger7.warn(
12528
+ `Session ${sessions[i].getId()} skill refresh failed: ${reason}`
12529
+ );
12530
+ }
12531
+ }
12532
+ return {
12533
+ sessionsRefreshed: results.filter(
12534
+ (result) => result.status === "fulfilled"
12535
+ ).length,
12536
+ sessionsFailed: results.filter(
12537
+ (result) => result.status === "rejected"
12538
+ ).length
12539
+ };
12540
+ }
12169
12541
  default:
12170
12542
  throw RequestError.methodNotFound(method);
12171
12543
  }